diff --git a/handwritten/pubsub/package.json b/handwritten/pubsub/package.json index 875998dd31a6..50658f7d6925 100644 --- a/handwritten/pubsub/package.json +++ b/handwritten/pubsub/package.json @@ -43,13 +43,14 @@ "clean": "gts clean", "compile": "tsc -p . && cp -r protos build/", "compile-protos": "compileProtos src", - "prepare": "npm run compile-protos && npm run compile", + "prepare": "npm run compile", "pretest": "npm run compile", "benchwrapper": "node bin/benchwrapper.js", "prelint": "cd samples; npm link ../; npm install", "precompile": "gts clean" }, "dependencies": { + "@google-cloud/pubsub-api": "./tmp/google-cloud-pubsub-api-0.1.0.tgz", "@google-cloud/paginator": "^6.0.0", "@google-cloud/precise-date": "^5.0.0", "@google-cloud/projectify": "^5.0.0", diff --git a/handwritten/pubsub/protos/protos.js b/handwritten/pubsub/protos/protos.js index 87591ea8cee6..45619bf22448 100644 --- a/handwritten/pubsub/protos/protos.js +++ b/handwritten/pubsub/protos/protos.js @@ -28,7 +28,7 @@ var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; // Exported root namespace - var $root = $protobuf.roots._google_cloud_pubsub_protos || ($protobuf.roots._google_cloud_pubsub_protos = {}); + var $root = $protobuf.roots["_google_cloud_pubsub_protos"] || ($protobuf.roots["_google_cloud_pubsub_protos"] = {}); $root.google = (function() { @@ -109,7 +109,7 @@ * @variation 1 */ Object.defineProperty(Publisher.prototype.createTopic = function createTopic(request, callback) { - return this.rpcCall(createTopic, $root.google.pubsub.v1.Topic, $root.google.pubsub.v1.Topic, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, createTopic, $root.google.pubsub.v1.Topic, $root.google.pubsub.v1.Topic, request, callback); }, "name", { value: "CreateTopic" }); /** @@ -142,7 +142,7 @@ * @variation 1 */ Object.defineProperty(Publisher.prototype.updateTopic = function updateTopic(request, callback) { - return this.rpcCall(updateTopic, $root.google.pubsub.v1.UpdateTopicRequest, $root.google.pubsub.v1.Topic, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, updateTopic, $root.google.pubsub.v1.UpdateTopicRequest, $root.google.pubsub.v1.Topic, request, callback); }, "name", { value: "UpdateTopic" }); /** @@ -175,7 +175,7 @@ * @variation 1 */ Object.defineProperty(Publisher.prototype.publish = function publish(request, callback) { - return this.rpcCall(publish, $root.google.pubsub.v1.PublishRequest, $root.google.pubsub.v1.PublishResponse, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, publish, $root.google.pubsub.v1.PublishRequest, $root.google.pubsub.v1.PublishResponse, request, callback); }, "name", { value: "Publish" }); /** @@ -208,7 +208,7 @@ * @variation 1 */ Object.defineProperty(Publisher.prototype.getTopic = function getTopic(request, callback) { - return this.rpcCall(getTopic, $root.google.pubsub.v1.GetTopicRequest, $root.google.pubsub.v1.Topic, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, getTopic, $root.google.pubsub.v1.GetTopicRequest, $root.google.pubsub.v1.Topic, request, callback); }, "name", { value: "GetTopic" }); /** @@ -241,7 +241,7 @@ * @variation 1 */ Object.defineProperty(Publisher.prototype.listTopics = function listTopics(request, callback) { - return this.rpcCall(listTopics, $root.google.pubsub.v1.ListTopicsRequest, $root.google.pubsub.v1.ListTopicsResponse, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, listTopics, $root.google.pubsub.v1.ListTopicsRequest, $root.google.pubsub.v1.ListTopicsResponse, request, callback); }, "name", { value: "ListTopics" }); /** @@ -274,7 +274,7 @@ * @variation 1 */ Object.defineProperty(Publisher.prototype.listTopicSubscriptions = function listTopicSubscriptions(request, callback) { - return this.rpcCall(listTopicSubscriptions, $root.google.pubsub.v1.ListTopicSubscriptionsRequest, $root.google.pubsub.v1.ListTopicSubscriptionsResponse, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, listTopicSubscriptions, $root.google.pubsub.v1.ListTopicSubscriptionsRequest, $root.google.pubsub.v1.ListTopicSubscriptionsResponse, request, callback); }, "name", { value: "ListTopicSubscriptions" }); /** @@ -307,7 +307,7 @@ * @variation 1 */ Object.defineProperty(Publisher.prototype.listTopicSnapshots = function listTopicSnapshots(request, callback) { - return this.rpcCall(listTopicSnapshots, $root.google.pubsub.v1.ListTopicSnapshotsRequest, $root.google.pubsub.v1.ListTopicSnapshotsResponse, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, listTopicSnapshots, $root.google.pubsub.v1.ListTopicSnapshotsRequest, $root.google.pubsub.v1.ListTopicSnapshotsResponse, request, callback); }, "name", { value: "ListTopicSnapshots" }); /** @@ -340,7 +340,7 @@ * @variation 1 */ Object.defineProperty(Publisher.prototype.deleteTopic = function deleteTopic(request, callback) { - return this.rpcCall(deleteTopic, $root.google.pubsub.v1.DeleteTopicRequest, $root.google.protobuf.Empty, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, deleteTopic, $root.google.pubsub.v1.DeleteTopicRequest, $root.google.protobuf.Empty, request, callback); }, "name", { value: "DeleteTopic" }); /** @@ -373,7 +373,7 @@ * @variation 1 */ Object.defineProperty(Publisher.prototype.detachSubscription = function detachSubscription(request, callback) { - return this.rpcCall(detachSubscription, $root.google.pubsub.v1.DetachSubscriptionRequest, $root.google.pubsub.v1.DetachSubscriptionResponse, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, detachSubscription, $root.google.pubsub.v1.DetachSubscriptionRequest, $root.google.pubsub.v1.DetachSubscriptionResponse, request, callback); }, "name", { value: "DetachSubscription" }); /** @@ -452,9 +452,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - MessageStoragePolicy.encode = function encode(message, writer) { + MessageStoragePolicy.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.allowedPersistenceRegions != null && message.allowedPersistenceRegions.length) for (var i = 0; i < message.allowedPersistenceRegions.length; ++i) writer.uint32(/* id 1, wireType 2 =*/10).string(message.allowedPersistenceRegions[i]); @@ -473,7 +477,7 @@ * @returns {$protobuf.Writer} Writer */ MessageStoragePolicy.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -549,14 +553,14 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.allowedPersistenceRegions != null && message.hasOwnProperty("allowedPersistenceRegions")) { + if (message.allowedPersistenceRegions != null && Object.hasOwnProperty.call(message, "allowedPersistenceRegions")) { if (!Array.isArray(message.allowedPersistenceRegions)) return "allowedPersistenceRegions: array expected"; for (var i = 0; i < message.allowedPersistenceRegions.length; ++i) if (!$util.isString(message.allowedPersistenceRegions[i])) return "allowedPersistenceRegions: string[] expected"; } - if (message.enforceInTransit != null && message.hasOwnProperty("enforceInTransit")) + if (message.enforceInTransit != null && Object.hasOwnProperty.call(message, "enforceInTransit")) if (typeof message.enforceInTransit !== "boolean") return "enforceInTransit: boolean expected"; return null; @@ -573,6 +577,8 @@ MessageStoragePolicy.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.MessageStoragePolicy) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.MessageStoragePolicy: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -599,9 +605,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - MessageStoragePolicy.toObject = function toObject(message, options) { + MessageStoragePolicy.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.allowedPersistenceRegions = []; @@ -612,7 +622,7 @@ for (var j = 0; j < message.allowedPersistenceRegions.length; ++j) object.allowedPersistenceRegions[j] = message.allowedPersistenceRegions[j]; } - if (message.enforceInTransit != null && message.hasOwnProperty("enforceInTransit")) + if (message.enforceInTransit != null && Object.hasOwnProperty.call(message, "enforceInTransit")) object.enforceInTransit = message.enforceInTransit; return object; }; @@ -726,9 +736,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SchemaSettings.encode = function encode(message, writer) { + SchemaSettings.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.schema != null && Object.hasOwnProperty.call(message, "schema")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.schema); if (message.encoding != null && Object.hasOwnProperty.call(message, "encoding")) @@ -750,7 +764,7 @@ * @returns {$protobuf.Writer} Writer */ SchemaSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -832,10 +846,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.schema != null && message.hasOwnProperty("schema")) + if (message.schema != null && Object.hasOwnProperty.call(message, "schema")) if (!$util.isString(message.schema)) return "schema: string expected"; - if (message.encoding != null && message.hasOwnProperty("encoding")) + if (message.encoding != null && Object.hasOwnProperty.call(message, "encoding")) switch (message.encoding) { default: return "encoding: enum value expected"; @@ -844,10 +858,10 @@ case 2: break; } - if (message.firstRevisionId != null && message.hasOwnProperty("firstRevisionId")) + if (message.firstRevisionId != null && Object.hasOwnProperty.call(message, "firstRevisionId")) if (!$util.isString(message.firstRevisionId)) return "firstRevisionId: string expected"; - if (message.lastRevisionId != null && message.hasOwnProperty("lastRevisionId")) + if (message.lastRevisionId != null && Object.hasOwnProperty.call(message, "lastRevisionId")) if (!$util.isString(message.lastRevisionId)) return "lastRevisionId: string expected"; return null; @@ -864,6 +878,8 @@ SchemaSettings.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.SchemaSettings) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.SchemaSettings: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -907,9 +923,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SchemaSettings.toObject = function toObject(message, options) { + SchemaSettings.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.schema = ""; @@ -917,13 +937,13 @@ object.firstRevisionId = ""; object.lastRevisionId = ""; } - if (message.schema != null && message.hasOwnProperty("schema")) + if (message.schema != null && Object.hasOwnProperty.call(message, "schema")) object.schema = message.schema; - if (message.encoding != null && message.hasOwnProperty("encoding")) + if (message.encoding != null && Object.hasOwnProperty.call(message, "encoding")) object.encoding = options.enums === String ? $root.google.pubsub.v1.Encoding[message.encoding] === undefined ? message.encoding : $root.google.pubsub.v1.Encoding[message.encoding] : message.encoding; - if (message.firstRevisionId != null && message.hasOwnProperty("firstRevisionId")) + if (message.firstRevisionId != null && Object.hasOwnProperty.call(message, "firstRevisionId")) object.firstRevisionId = message.firstRevisionId; - if (message.lastRevisionId != null && message.hasOwnProperty("lastRevisionId")) + if (message.lastRevisionId != null && Object.hasOwnProperty.call(message, "lastRevisionId")) object.lastRevisionId = message.lastRevisionId; return object; }; @@ -1069,21 +1089,25 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - IngestionDataSourceSettings.encode = function encode(message, writer) { + IngestionDataSourceSettings.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.awsKinesis != null && Object.hasOwnProperty.call(message, "awsKinesis")) - $root.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.encode(message.awsKinesis, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.encode(message.awsKinesis, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); if (message.cloudStorage != null && Object.hasOwnProperty.call(message, "cloudStorage")) - $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.encode(message.cloudStorage, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.encode(message.cloudStorage, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); if (message.azureEventHubs != null && Object.hasOwnProperty.call(message, "azureEventHubs")) - $root.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.encode(message.azureEventHubs, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + $root.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.encode(message.azureEventHubs, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); if (message.platformLogsSettings != null && Object.hasOwnProperty.call(message, "platformLogsSettings")) - $root.google.pubsub.v1.PlatformLogsSettings.encode(message.platformLogsSettings, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + $root.google.pubsub.v1.PlatformLogsSettings.encode(message.platformLogsSettings, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); if (message.awsMsk != null && Object.hasOwnProperty.call(message, "awsMsk")) - $root.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.encode(message.awsMsk, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + $root.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.encode(message.awsMsk, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); if (message.confluentCloud != null && Object.hasOwnProperty.call(message, "confluentCloud")) - $root.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.encode(message.confluentCloud, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + $root.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.encode(message.confluentCloud, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); return writer; }; @@ -1097,7 +1121,7 @@ * @returns {$protobuf.Writer} Writer */ IngestionDataSourceSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -1188,7 +1212,7 @@ if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; var properties = {}; - if (message.awsKinesis != null && message.hasOwnProperty("awsKinesis")) { + if (message.awsKinesis != null && Object.hasOwnProperty.call(message, "awsKinesis")) { properties.source = 1; { var error = $root.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.verify(message.awsKinesis, long + 1); @@ -1196,7 +1220,7 @@ return "awsKinesis." + error; } } - if (message.cloudStorage != null && message.hasOwnProperty("cloudStorage")) { + if (message.cloudStorage != null && Object.hasOwnProperty.call(message, "cloudStorage")) { if (properties.source === 1) return "source: multiple values"; properties.source = 1; @@ -1206,7 +1230,7 @@ return "cloudStorage." + error; } } - if (message.azureEventHubs != null && message.hasOwnProperty("azureEventHubs")) { + if (message.azureEventHubs != null && Object.hasOwnProperty.call(message, "azureEventHubs")) { if (properties.source === 1) return "source: multiple values"; properties.source = 1; @@ -1216,7 +1240,7 @@ return "azureEventHubs." + error; } } - if (message.awsMsk != null && message.hasOwnProperty("awsMsk")) { + if (message.awsMsk != null && Object.hasOwnProperty.call(message, "awsMsk")) { if (properties.source === 1) return "source: multiple values"; properties.source = 1; @@ -1226,7 +1250,7 @@ return "awsMsk." + error; } } - if (message.confluentCloud != null && message.hasOwnProperty("confluentCloud")) { + if (message.confluentCloud != null && Object.hasOwnProperty.call(message, "confluentCloud")) { if (properties.source === 1) return "source: multiple values"; properties.source = 1; @@ -1236,7 +1260,7 @@ return "confluentCloud." + error; } } - if (message.platformLogsSettings != null && message.hasOwnProperty("platformLogsSettings")) { + if (message.platformLogsSettings != null && Object.hasOwnProperty.call(message, "platformLogsSettings")) { var error = $root.google.pubsub.v1.PlatformLogsSettings.verify(message.platformLogsSettings, long + 1); if (error) return "platformLogsSettings." + error; @@ -1255,38 +1279,40 @@ IngestionDataSourceSettings.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.IngestionDataSourceSettings) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.IngestionDataSourceSettings: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) throw Error("maximum nesting depth exceeded"); var message = new $root.google.pubsub.v1.IngestionDataSourceSettings(); if (object.awsKinesis != null) { - if (typeof object.awsKinesis !== "object") + if (!$util.isObject(object.awsKinesis)) throw TypeError(".google.pubsub.v1.IngestionDataSourceSettings.awsKinesis: object expected"); message.awsKinesis = $root.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.fromObject(object.awsKinesis, long + 1); } if (object.cloudStorage != null) { - if (typeof object.cloudStorage !== "object") + if (!$util.isObject(object.cloudStorage)) throw TypeError(".google.pubsub.v1.IngestionDataSourceSettings.cloudStorage: object expected"); message.cloudStorage = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.fromObject(object.cloudStorage, long + 1); } if (object.azureEventHubs != null) { - if (typeof object.azureEventHubs !== "object") + if (!$util.isObject(object.azureEventHubs)) throw TypeError(".google.pubsub.v1.IngestionDataSourceSettings.azureEventHubs: object expected"); message.azureEventHubs = $root.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.fromObject(object.azureEventHubs, long + 1); } if (object.awsMsk != null) { - if (typeof object.awsMsk !== "object") + if (!$util.isObject(object.awsMsk)) throw TypeError(".google.pubsub.v1.IngestionDataSourceSettings.awsMsk: object expected"); message.awsMsk = $root.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.fromObject(object.awsMsk, long + 1); } if (object.confluentCloud != null) { - if (typeof object.confluentCloud !== "object") + if (!$util.isObject(object.confluentCloud)) throw TypeError(".google.pubsub.v1.IngestionDataSourceSettings.confluentCloud: object expected"); message.confluentCloud = $root.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.fromObject(object.confluentCloud, long + 1); } if (object.platformLogsSettings != null) { - if (typeof object.platformLogsSettings !== "object") + if (!$util.isObject(object.platformLogsSettings)) throw TypeError(".google.pubsub.v1.IngestionDataSourceSettings.platformLogsSettings: object expected"); message.platformLogsSettings = $root.google.pubsub.v1.PlatformLogsSettings.fromObject(object.platformLogsSettings, long + 1); } @@ -1302,36 +1328,40 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - IngestionDataSourceSettings.toObject = function toObject(message, options) { + IngestionDataSourceSettings.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) object.platformLogsSettings = null; - if (message.awsKinesis != null && message.hasOwnProperty("awsKinesis")) { - object.awsKinesis = $root.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.toObject(message.awsKinesis, options); + if (message.awsKinesis != null && Object.hasOwnProperty.call(message, "awsKinesis")) { + object.awsKinesis = $root.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.toObject(message.awsKinesis, options, q + 1); if (options.oneofs) object.source = "awsKinesis"; } - if (message.cloudStorage != null && message.hasOwnProperty("cloudStorage")) { - object.cloudStorage = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.toObject(message.cloudStorage, options); + if (message.cloudStorage != null && Object.hasOwnProperty.call(message, "cloudStorage")) { + object.cloudStorage = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.toObject(message.cloudStorage, options, q + 1); if (options.oneofs) object.source = "cloudStorage"; } - if (message.azureEventHubs != null && message.hasOwnProperty("azureEventHubs")) { - object.azureEventHubs = $root.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.toObject(message.azureEventHubs, options); + if (message.azureEventHubs != null && Object.hasOwnProperty.call(message, "azureEventHubs")) { + object.azureEventHubs = $root.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.toObject(message.azureEventHubs, options, q + 1); if (options.oneofs) object.source = "azureEventHubs"; } - if (message.platformLogsSettings != null && message.hasOwnProperty("platformLogsSettings")) - object.platformLogsSettings = $root.google.pubsub.v1.PlatformLogsSettings.toObject(message.platformLogsSettings, options); - if (message.awsMsk != null && message.hasOwnProperty("awsMsk")) { - object.awsMsk = $root.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.toObject(message.awsMsk, options); + if (message.platformLogsSettings != null && Object.hasOwnProperty.call(message, "platformLogsSettings")) + object.platformLogsSettings = $root.google.pubsub.v1.PlatformLogsSettings.toObject(message.platformLogsSettings, options, q + 1); + if (message.awsMsk != null && Object.hasOwnProperty.call(message, "awsMsk")) { + object.awsMsk = $root.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.toObject(message.awsMsk, options, q + 1); if (options.oneofs) object.source = "awsMsk"; } - if (message.confluentCloud != null && message.hasOwnProperty("confluentCloud")) { - object.confluentCloud = $root.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.toObject(message.confluentCloud, options); + if (message.confluentCloud != null && Object.hasOwnProperty.call(message, "confluentCloud")) { + object.confluentCloud = $root.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.toObject(message.confluentCloud, options, q + 1); if (options.oneofs) object.source = "confluentCloud"; } @@ -1453,9 +1483,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AwsKinesis.encode = function encode(message, writer) { + AwsKinesis.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.state != null && Object.hasOwnProperty.call(message, "state")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); if (message.streamArn != null && Object.hasOwnProperty.call(message, "streamArn")) @@ -1479,7 +1513,7 @@ * @returns {$protobuf.Writer} Writer */ AwsKinesis.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -1565,7 +1599,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.state != null && message.hasOwnProperty("state")) + if (message.state != null && Object.hasOwnProperty.call(message, "state")) switch (message.state) { default: return "state: enum value expected"; @@ -1577,16 +1611,16 @@ case 5: break; } - if (message.streamArn != null && message.hasOwnProperty("streamArn")) + if (message.streamArn != null && Object.hasOwnProperty.call(message, "streamArn")) if (!$util.isString(message.streamArn)) return "streamArn: string expected"; - if (message.consumerArn != null && message.hasOwnProperty("consumerArn")) + if (message.consumerArn != null && Object.hasOwnProperty.call(message, "consumerArn")) if (!$util.isString(message.consumerArn)) return "consumerArn: string expected"; - if (message.awsRoleArn != null && message.hasOwnProperty("awsRoleArn")) + if (message.awsRoleArn != null && Object.hasOwnProperty.call(message, "awsRoleArn")) if (!$util.isString(message.awsRoleArn)) return "awsRoleArn: string expected"; - if (message.gcpServiceAccount != null && message.hasOwnProperty("gcpServiceAccount")) + if (message.gcpServiceAccount != null && Object.hasOwnProperty.call(message, "gcpServiceAccount")) if (!$util.isString(message.gcpServiceAccount)) return "gcpServiceAccount: string expected"; return null; @@ -1603,6 +1637,8 @@ AwsKinesis.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -1660,9 +1696,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AwsKinesis.toObject = function toObject(message, options) { + AwsKinesis.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; @@ -1671,15 +1711,15 @@ object.awsRoleArn = ""; object.gcpServiceAccount = ""; } - if (message.state != null && message.hasOwnProperty("state")) + if (message.state != null && Object.hasOwnProperty.call(message, "state")) object.state = options.enums === String ? $root.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State[message.state] === undefined ? message.state : $root.google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State[message.state] : message.state; - if (message.streamArn != null && message.hasOwnProperty("streamArn")) + if (message.streamArn != null && Object.hasOwnProperty.call(message, "streamArn")) object.streamArn = message.streamArn; - if (message.consumerArn != null && message.hasOwnProperty("consumerArn")) + if (message.consumerArn != null && Object.hasOwnProperty.call(message, "consumerArn")) object.consumerArn = message.consumerArn; - if (message.awsRoleArn != null && message.hasOwnProperty("awsRoleArn")) + if (message.awsRoleArn != null && Object.hasOwnProperty.call(message, "awsRoleArn")) object.awsRoleArn = message.awsRoleArn; - if (message.gcpServiceAccount != null && message.hasOwnProperty("gcpServiceAccount")) + if (message.gcpServiceAccount != null && Object.hasOwnProperty.call(message, "gcpServiceAccount")) object.gcpServiceAccount = message.gcpServiceAccount; return object; }; @@ -1856,21 +1896,25 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CloudStorage.encode = function encode(message, writer) { + CloudStorage.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.state != null && Object.hasOwnProperty.call(message, "state")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); if (message.bucket != null && Object.hasOwnProperty.call(message, "bucket")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.bucket); if (message.textFormat != null && Object.hasOwnProperty.call(message, "textFormat")) - $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.encode(message.textFormat, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.encode(message.textFormat, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); if (message.avroFormat != null && Object.hasOwnProperty.call(message, "avroFormat")) - $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat.encode(message.avroFormat, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat.encode(message.avroFormat, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); if (message.pubsubAvroFormat != null && Object.hasOwnProperty.call(message, "pubsubAvroFormat")) - $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat.encode(message.pubsubAvroFormat, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat.encode(message.pubsubAvroFormat, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); if (message.minimumObjectCreateTime != null && Object.hasOwnProperty.call(message, "minimumObjectCreateTime")) - $root.google.protobuf.Timestamp.encode(message.minimumObjectCreateTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + $root.google.protobuf.Timestamp.encode(message.minimumObjectCreateTime, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); if (message.matchGlob != null && Object.hasOwnProperty.call(message, "matchGlob")) writer.uint32(/* id 9, wireType 2 =*/74).string(message.matchGlob); return writer; @@ -1886,7 +1930,7 @@ * @returns {$protobuf.Writer} Writer */ CloudStorage.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -1981,7 +2025,7 @@ if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; var properties = {}; - if (message.state != null && message.hasOwnProperty("state")) + if (message.state != null && Object.hasOwnProperty.call(message, "state")) switch (message.state) { default: return "state: enum value expected"; @@ -1993,10 +2037,10 @@ case 5: break; } - if (message.bucket != null && message.hasOwnProperty("bucket")) + if (message.bucket != null && Object.hasOwnProperty.call(message, "bucket")) if (!$util.isString(message.bucket)) return "bucket: string expected"; - if (message.textFormat != null && message.hasOwnProperty("textFormat")) { + if (message.textFormat != null && Object.hasOwnProperty.call(message, "textFormat")) { properties.inputFormat = 1; { var error = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.verify(message.textFormat, long + 1); @@ -2004,7 +2048,7 @@ return "textFormat." + error; } } - if (message.avroFormat != null && message.hasOwnProperty("avroFormat")) { + if (message.avroFormat != null && Object.hasOwnProperty.call(message, "avroFormat")) { if (properties.inputFormat === 1) return "inputFormat: multiple values"; properties.inputFormat = 1; @@ -2014,7 +2058,7 @@ return "avroFormat." + error; } } - if (message.pubsubAvroFormat != null && message.hasOwnProperty("pubsubAvroFormat")) { + if (message.pubsubAvroFormat != null && Object.hasOwnProperty.call(message, "pubsubAvroFormat")) { if (properties.inputFormat === 1) return "inputFormat: multiple values"; properties.inputFormat = 1; @@ -2024,12 +2068,12 @@ return "pubsubAvroFormat." + error; } } - if (message.minimumObjectCreateTime != null && message.hasOwnProperty("minimumObjectCreateTime")) { + if (message.minimumObjectCreateTime != null && Object.hasOwnProperty.call(message, "minimumObjectCreateTime")) { var error = $root.google.protobuf.Timestamp.verify(message.minimumObjectCreateTime, long + 1); if (error) return "minimumObjectCreateTime." + error; } - if (message.matchGlob != null && message.hasOwnProperty("matchGlob")) + if (message.matchGlob != null && Object.hasOwnProperty.call(message, "matchGlob")) if (!$util.isString(message.matchGlob)) return "matchGlob: string expected"; return null; @@ -2046,6 +2090,8 @@ CloudStorage.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.IngestionDataSourceSettings.CloudStorage: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -2086,22 +2132,22 @@ if (object.bucket != null) message.bucket = String(object.bucket); if (object.textFormat != null) { - if (typeof object.textFormat !== "object") + if (!$util.isObject(object.textFormat)) throw TypeError(".google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.textFormat: object expected"); message.textFormat = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.fromObject(object.textFormat, long + 1); } if (object.avroFormat != null) { - if (typeof object.avroFormat !== "object") + if (!$util.isObject(object.avroFormat)) throw TypeError(".google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.avroFormat: object expected"); message.avroFormat = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat.fromObject(object.avroFormat, long + 1); } if (object.pubsubAvroFormat != null) { - if (typeof object.pubsubAvroFormat !== "object") + if (!$util.isObject(object.pubsubAvroFormat)) throw TypeError(".google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.pubsubAvroFormat: object expected"); message.pubsubAvroFormat = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat.fromObject(object.pubsubAvroFormat, long + 1); } if (object.minimumObjectCreateTime != null) { - if (typeof object.minimumObjectCreateTime !== "object") + if (!$util.isObject(object.minimumObjectCreateTime)) throw TypeError(".google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.minimumObjectCreateTime: object expected"); message.minimumObjectCreateTime = $root.google.protobuf.Timestamp.fromObject(object.minimumObjectCreateTime, long + 1); } @@ -2119,9 +2165,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CloudStorage.toObject = function toObject(message, options) { + CloudStorage.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; @@ -2129,28 +2179,28 @@ object.minimumObjectCreateTime = null; object.matchGlob = ""; } - if (message.state != null && message.hasOwnProperty("state")) + if (message.state != null && Object.hasOwnProperty.call(message, "state")) object.state = options.enums === String ? $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State[message.state] === undefined ? message.state : $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State[message.state] : message.state; - if (message.bucket != null && message.hasOwnProperty("bucket")) + if (message.bucket != null && Object.hasOwnProperty.call(message, "bucket")) object.bucket = message.bucket; - if (message.textFormat != null && message.hasOwnProperty("textFormat")) { - object.textFormat = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.toObject(message.textFormat, options); + if (message.textFormat != null && Object.hasOwnProperty.call(message, "textFormat")) { + object.textFormat = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat.toObject(message.textFormat, options, q + 1); if (options.oneofs) object.inputFormat = "textFormat"; } - if (message.avroFormat != null && message.hasOwnProperty("avroFormat")) { - object.avroFormat = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat.toObject(message.avroFormat, options); + if (message.avroFormat != null && Object.hasOwnProperty.call(message, "avroFormat")) { + object.avroFormat = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat.toObject(message.avroFormat, options, q + 1); if (options.oneofs) object.inputFormat = "avroFormat"; } - if (message.pubsubAvroFormat != null && message.hasOwnProperty("pubsubAvroFormat")) { - object.pubsubAvroFormat = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat.toObject(message.pubsubAvroFormat, options); + if (message.pubsubAvroFormat != null && Object.hasOwnProperty.call(message, "pubsubAvroFormat")) { + object.pubsubAvroFormat = $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat.toObject(message.pubsubAvroFormat, options, q + 1); if (options.oneofs) object.inputFormat = "pubsubAvroFormat"; } - if (message.minimumObjectCreateTime != null && message.hasOwnProperty("minimumObjectCreateTime")) - object.minimumObjectCreateTime = $root.google.protobuf.Timestamp.toObject(message.minimumObjectCreateTime, options); - if (message.matchGlob != null && message.hasOwnProperty("matchGlob")) + if (message.minimumObjectCreateTime != null && Object.hasOwnProperty.call(message, "minimumObjectCreateTime")) + object.minimumObjectCreateTime = $root.google.protobuf.Timestamp.toObject(message.minimumObjectCreateTime, options, q + 1); + if (message.matchGlob != null && Object.hasOwnProperty.call(message, "matchGlob")) object.matchGlob = message.matchGlob; return object; }; @@ -2265,9 +2315,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - TextFormat.encode = function encode(message, writer) { + TextFormat.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.delimiter != null && Object.hasOwnProperty.call(message, "delimiter")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.delimiter); return writer; @@ -2283,7 +2337,7 @@ * @returns {$protobuf.Writer} Writer */ TextFormat.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -2354,7 +2408,7 @@ if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; var properties = {}; - if (message.delimiter != null && message.hasOwnProperty("delimiter")) { + if (message.delimiter != null && Object.hasOwnProperty.call(message, "delimiter")) { properties._delimiter = 1; if (!$util.isString(message.delimiter)) return "delimiter: string expected"; @@ -2373,6 +2427,8 @@ TextFormat.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -2392,11 +2448,15 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - TextFormat.toObject = function toObject(message, options) { + TextFormat.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; - if (message.delimiter != null && message.hasOwnProperty("delimiter")) { + if (message.delimiter != null && Object.hasOwnProperty.call(message, "delimiter")) { object.delimiter = message.delimiter; if (options.oneofs) object._delimiter = "delimiter"; @@ -2477,9 +2537,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AvroFormat.encode = function encode(message, writer) { + AvroFormat.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); return writer; }; @@ -2493,7 +2557,7 @@ * @returns {$protobuf.Writer} Writer */ AvroFormat.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -2573,10 +2637,6 @@ AvroFormat.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat) return object; - if (long === undefined) - long = 0; - if (long > $util.recursionLimit) - throw Error("maximum nesting depth exceeded"); return new $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat(); }; @@ -2666,9 +2726,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PubSubAvroFormat.encode = function encode(message, writer) { + PubSubAvroFormat.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); return writer; }; @@ -2682,7 +2746,7 @@ * @returns {$protobuf.Writer} Writer */ PubSubAvroFormat.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -2762,10 +2826,6 @@ PubSubAvroFormat.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat) return object; - if (long === undefined) - long = 0; - if (long > $util.recursionLimit) - throw Error("maximum nesting depth exceeded"); return new $root.google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat(); }; @@ -2930,9 +2990,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AzureEventHubs.encode = function encode(message, writer) { + AzureEventHubs.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.state != null && Object.hasOwnProperty.call(message, "state")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); if (message.resourceGroup != null && Object.hasOwnProperty.call(message, "resourceGroup")) @@ -2962,7 +3026,7 @@ * @returns {$protobuf.Writer} Writer */ AzureEventHubs.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -3060,7 +3124,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.state != null && message.hasOwnProperty("state")) + if (message.state != null && Object.hasOwnProperty.call(message, "state")) switch (message.state) { default: return "state: enum value expected"; @@ -3074,25 +3138,25 @@ case 7: break; } - if (message.resourceGroup != null && message.hasOwnProperty("resourceGroup")) + if (message.resourceGroup != null && Object.hasOwnProperty.call(message, "resourceGroup")) if (!$util.isString(message.resourceGroup)) return "resourceGroup: string expected"; - if (message.namespace != null && message.hasOwnProperty("namespace")) + if (message.namespace != null && Object.hasOwnProperty.call(message, "namespace")) if (!$util.isString(message.namespace)) return "namespace: string expected"; - if (message.eventHub != null && message.hasOwnProperty("eventHub")) + if (message.eventHub != null && Object.hasOwnProperty.call(message, "eventHub")) if (!$util.isString(message.eventHub)) return "eventHub: string expected"; - if (message.clientId != null && message.hasOwnProperty("clientId")) + if (message.clientId != null && Object.hasOwnProperty.call(message, "clientId")) if (!$util.isString(message.clientId)) return "clientId: string expected"; - if (message.tenantId != null && message.hasOwnProperty("tenantId")) + if (message.tenantId != null && Object.hasOwnProperty.call(message, "tenantId")) if (!$util.isString(message.tenantId)) return "tenantId: string expected"; - if (message.subscriptionId != null && message.hasOwnProperty("subscriptionId")) + if (message.subscriptionId != null && Object.hasOwnProperty.call(message, "subscriptionId")) if (!$util.isString(message.subscriptionId)) return "subscriptionId: string expected"; - if (message.gcpServiceAccount != null && message.hasOwnProperty("gcpServiceAccount")) + if (message.gcpServiceAccount != null && Object.hasOwnProperty.call(message, "gcpServiceAccount")) if (!$util.isString(message.gcpServiceAccount)) return "gcpServiceAccount: string expected"; return null; @@ -3109,6 +3173,8 @@ AzureEventHubs.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -3180,9 +3246,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AzureEventHubs.toObject = function toObject(message, options) { + AzureEventHubs.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; @@ -3194,21 +3264,21 @@ object.subscriptionId = ""; object.gcpServiceAccount = ""; } - if (message.state != null && message.hasOwnProperty("state")) + if (message.state != null && Object.hasOwnProperty.call(message, "state")) object.state = options.enums === String ? $root.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State[message.state] === undefined ? message.state : $root.google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State[message.state] : message.state; - if (message.resourceGroup != null && message.hasOwnProperty("resourceGroup")) + if (message.resourceGroup != null && Object.hasOwnProperty.call(message, "resourceGroup")) object.resourceGroup = message.resourceGroup; - if (message.namespace != null && message.hasOwnProperty("namespace")) + if (message.namespace != null && Object.hasOwnProperty.call(message, "namespace")) object.namespace = message.namespace; - if (message.eventHub != null && message.hasOwnProperty("eventHub")) + if (message.eventHub != null && Object.hasOwnProperty.call(message, "eventHub")) object.eventHub = message.eventHub; - if (message.clientId != null && message.hasOwnProperty("clientId")) + if (message.clientId != null && Object.hasOwnProperty.call(message, "clientId")) object.clientId = message.clientId; - if (message.tenantId != null && message.hasOwnProperty("tenantId")) + if (message.tenantId != null && Object.hasOwnProperty.call(message, "tenantId")) object.tenantId = message.tenantId; - if (message.subscriptionId != null && message.hasOwnProperty("subscriptionId")) + if (message.subscriptionId != null && Object.hasOwnProperty.call(message, "subscriptionId")) object.subscriptionId = message.subscriptionId; - if (message.gcpServiceAccount != null && message.hasOwnProperty("gcpServiceAccount")) + if (message.gcpServiceAccount != null && Object.hasOwnProperty.call(message, "gcpServiceAccount")) object.gcpServiceAccount = message.gcpServiceAccount; return object; }; @@ -3357,9 +3427,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AwsMsk.encode = function encode(message, writer) { + AwsMsk.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.state != null && Object.hasOwnProperty.call(message, "state")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); if (message.clusterArn != null && Object.hasOwnProperty.call(message, "clusterArn")) @@ -3383,7 +3457,7 @@ * @returns {$protobuf.Writer} Writer */ AwsMsk.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -3469,7 +3543,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.state != null && message.hasOwnProperty("state")) + if (message.state != null && Object.hasOwnProperty.call(message, "state")) switch (message.state) { default: return "state: enum value expected"; @@ -3481,16 +3555,16 @@ case 5: break; } - if (message.clusterArn != null && message.hasOwnProperty("clusterArn")) + if (message.clusterArn != null && Object.hasOwnProperty.call(message, "clusterArn")) if (!$util.isString(message.clusterArn)) return "clusterArn: string expected"; - if (message.topic != null && message.hasOwnProperty("topic")) + if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) if (!$util.isString(message.topic)) return "topic: string expected"; - if (message.awsRoleArn != null && message.hasOwnProperty("awsRoleArn")) + if (message.awsRoleArn != null && Object.hasOwnProperty.call(message, "awsRoleArn")) if (!$util.isString(message.awsRoleArn)) return "awsRoleArn: string expected"; - if (message.gcpServiceAccount != null && message.hasOwnProperty("gcpServiceAccount")) + if (message.gcpServiceAccount != null && Object.hasOwnProperty.call(message, "gcpServiceAccount")) if (!$util.isString(message.gcpServiceAccount)) return "gcpServiceAccount: string expected"; return null; @@ -3507,6 +3581,8 @@ AwsMsk.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.IngestionDataSourceSettings.AwsMsk: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -3564,9 +3640,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AwsMsk.toObject = function toObject(message, options) { + AwsMsk.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; @@ -3575,15 +3655,15 @@ object.awsRoleArn = ""; object.gcpServiceAccount = ""; } - if (message.state != null && message.hasOwnProperty("state")) + if (message.state != null && Object.hasOwnProperty.call(message, "state")) object.state = options.enums === String ? $root.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State[message.state] === undefined ? message.state : $root.google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State[message.state] : message.state; - if (message.clusterArn != null && message.hasOwnProperty("clusterArn")) + if (message.clusterArn != null && Object.hasOwnProperty.call(message, "clusterArn")) object.clusterArn = message.clusterArn; - if (message.topic != null && message.hasOwnProperty("topic")) + if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) object.topic = message.topic; - if (message.awsRoleArn != null && message.hasOwnProperty("awsRoleArn")) + if (message.awsRoleArn != null && Object.hasOwnProperty.call(message, "awsRoleArn")) object.awsRoleArn = message.awsRoleArn; - if (message.gcpServiceAccount != null && message.hasOwnProperty("gcpServiceAccount")) + if (message.gcpServiceAccount != null && Object.hasOwnProperty.call(message, "gcpServiceAccount")) object.gcpServiceAccount = message.gcpServiceAccount; return object; }; @@ -3737,9 +3817,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ConfluentCloud.encode = function encode(message, writer) { + ConfluentCloud.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.state != null && Object.hasOwnProperty.call(message, "state")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); if (message.bootstrapServer != null && Object.hasOwnProperty.call(message, "bootstrapServer")) @@ -3765,7 +3849,7 @@ * @returns {$protobuf.Writer} Writer */ ConfluentCloud.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -3855,7 +3939,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.state != null && message.hasOwnProperty("state")) + if (message.state != null && Object.hasOwnProperty.call(message, "state")) switch (message.state) { default: return "state: enum value expected"; @@ -3868,19 +3952,19 @@ case 6: break; } - if (message.bootstrapServer != null && message.hasOwnProperty("bootstrapServer")) + if (message.bootstrapServer != null && Object.hasOwnProperty.call(message, "bootstrapServer")) if (!$util.isString(message.bootstrapServer)) return "bootstrapServer: string expected"; - if (message.clusterId != null && message.hasOwnProperty("clusterId")) + if (message.clusterId != null && Object.hasOwnProperty.call(message, "clusterId")) if (!$util.isString(message.clusterId)) return "clusterId: string expected"; - if (message.topic != null && message.hasOwnProperty("topic")) + if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) if (!$util.isString(message.topic)) return "topic: string expected"; - if (message.identityPoolId != null && message.hasOwnProperty("identityPoolId")) + if (message.identityPoolId != null && Object.hasOwnProperty.call(message, "identityPoolId")) if (!$util.isString(message.identityPoolId)) return "identityPoolId: string expected"; - if (message.gcpServiceAccount != null && message.hasOwnProperty("gcpServiceAccount")) + if (message.gcpServiceAccount != null && Object.hasOwnProperty.call(message, "gcpServiceAccount")) if (!$util.isString(message.gcpServiceAccount)) return "gcpServiceAccount: string expected"; return null; @@ -3897,6 +3981,8 @@ ConfluentCloud.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -3960,9 +4046,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ConfluentCloud.toObject = function toObject(message, options) { + ConfluentCloud.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; @@ -3972,17 +4062,17 @@ object.identityPoolId = ""; object.gcpServiceAccount = ""; } - if (message.state != null && message.hasOwnProperty("state")) + if (message.state != null && Object.hasOwnProperty.call(message, "state")) object.state = options.enums === String ? $root.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State[message.state] === undefined ? message.state : $root.google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State[message.state] : message.state; - if (message.bootstrapServer != null && message.hasOwnProperty("bootstrapServer")) + if (message.bootstrapServer != null && Object.hasOwnProperty.call(message, "bootstrapServer")) object.bootstrapServer = message.bootstrapServer; - if (message.clusterId != null && message.hasOwnProperty("clusterId")) + if (message.clusterId != null && Object.hasOwnProperty.call(message, "clusterId")) object.clusterId = message.clusterId; - if (message.topic != null && message.hasOwnProperty("topic")) + if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) object.topic = message.topic; - if (message.identityPoolId != null && message.hasOwnProperty("identityPoolId")) + if (message.identityPoolId != null && Object.hasOwnProperty.call(message, "identityPoolId")) object.identityPoolId = message.identityPoolId; - if (message.gcpServiceAccount != null && message.hasOwnProperty("gcpServiceAccount")) + if (message.gcpServiceAccount != null && Object.hasOwnProperty.call(message, "gcpServiceAccount")) object.gcpServiceAccount = message.gcpServiceAccount; return object; }; @@ -4096,9 +4186,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PlatformLogsSettings.encode = function encode(message, writer) { + PlatformLogsSettings.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.severity != null && Object.hasOwnProperty.call(message, "severity")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.severity); return writer; @@ -4114,7 +4208,7 @@ * @returns {$protobuf.Writer} Writer */ PlatformLogsSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -4184,7 +4278,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.severity != null && message.hasOwnProperty("severity")) + if (message.severity != null && Object.hasOwnProperty.call(message, "severity")) switch (message.severity) { default: return "severity: enum value expected"; @@ -4210,6 +4304,8 @@ PlatformLogsSettings.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.PlatformLogsSettings) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.PlatformLogsSettings: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -4259,13 +4355,17 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PlatformLogsSettings.toObject = function toObject(message, options) { + PlatformLogsSettings.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) object.severity = options.enums === String ? "SEVERITY_UNSPECIFIED" : 0; - if (message.severity != null && message.hasOwnProperty("severity")) + if (message.severity != null && Object.hasOwnProperty.call(message, "severity")) object.severity = options.enums === String ? $root.google.pubsub.v1.PlatformLogsSettings.Severity[message.severity] === undefined ? message.severity : $root.google.pubsub.v1.PlatformLogsSettings.Severity[message.severity] : message.severity; return object; }; @@ -4442,23 +4542,27 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - IngestionFailureEvent.encode = function encode(message, writer) { + IngestionFailureEvent.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.topic); if (message.errorMessage != null && Object.hasOwnProperty.call(message, "errorMessage")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.errorMessage); if (message.cloudStorageFailure != null && Object.hasOwnProperty.call(message, "cloudStorageFailure")) - $root.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.encode(message.cloudStorageFailure, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + $root.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.encode(message.cloudStorageFailure, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); if (message.awsMskFailure != null && Object.hasOwnProperty.call(message, "awsMskFailure")) - $root.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.encode(message.awsMskFailure, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + $root.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.encode(message.awsMskFailure, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); if (message.azureEventHubsFailure != null && Object.hasOwnProperty.call(message, "azureEventHubsFailure")) - $root.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason.encode(message.azureEventHubsFailure, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + $root.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason.encode(message.azureEventHubsFailure, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); if (message.confluentCloudFailure != null && Object.hasOwnProperty.call(message, "confluentCloudFailure")) - $root.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason.encode(message.confluentCloudFailure, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + $root.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason.encode(message.confluentCloudFailure, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); if (message.awsKinesisFailure != null && Object.hasOwnProperty.call(message, "awsKinesisFailure")) - $root.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason.encode(message.awsKinesisFailure, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + $root.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason.encode(message.awsKinesisFailure, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); return writer; }; @@ -4472,7 +4576,7 @@ * @returns {$protobuf.Writer} Writer */ IngestionFailureEvent.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -4567,13 +4671,13 @@ if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; var properties = {}; - if (message.topic != null && message.hasOwnProperty("topic")) + if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) if (!$util.isString(message.topic)) return "topic: string expected"; - if (message.errorMessage != null && message.hasOwnProperty("errorMessage")) + if (message.errorMessage != null && Object.hasOwnProperty.call(message, "errorMessage")) if (!$util.isString(message.errorMessage)) return "errorMessage: string expected"; - if (message.cloudStorageFailure != null && message.hasOwnProperty("cloudStorageFailure")) { + if (message.cloudStorageFailure != null && Object.hasOwnProperty.call(message, "cloudStorageFailure")) { properties.failure = 1; { var error = $root.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.verify(message.cloudStorageFailure, long + 1); @@ -4581,7 +4685,7 @@ return "cloudStorageFailure." + error; } } - if (message.awsMskFailure != null && message.hasOwnProperty("awsMskFailure")) { + if (message.awsMskFailure != null && Object.hasOwnProperty.call(message, "awsMskFailure")) { if (properties.failure === 1) return "failure: multiple values"; properties.failure = 1; @@ -4591,7 +4695,7 @@ return "awsMskFailure." + error; } } - if (message.azureEventHubsFailure != null && message.hasOwnProperty("azureEventHubsFailure")) { + if (message.azureEventHubsFailure != null && Object.hasOwnProperty.call(message, "azureEventHubsFailure")) { if (properties.failure === 1) return "failure: multiple values"; properties.failure = 1; @@ -4601,7 +4705,7 @@ return "azureEventHubsFailure." + error; } } - if (message.confluentCloudFailure != null && message.hasOwnProperty("confluentCloudFailure")) { + if (message.confluentCloudFailure != null && Object.hasOwnProperty.call(message, "confluentCloudFailure")) { if (properties.failure === 1) return "failure: multiple values"; properties.failure = 1; @@ -4611,7 +4715,7 @@ return "confluentCloudFailure." + error; } } - if (message.awsKinesisFailure != null && message.hasOwnProperty("awsKinesisFailure")) { + if (message.awsKinesisFailure != null && Object.hasOwnProperty.call(message, "awsKinesisFailure")) { if (properties.failure === 1) return "failure: multiple values"; properties.failure = 1; @@ -4635,6 +4739,8 @@ IngestionFailureEvent.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.IngestionFailureEvent) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.IngestionFailureEvent: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -4645,27 +4751,27 @@ if (object.errorMessage != null) message.errorMessage = String(object.errorMessage); if (object.cloudStorageFailure != null) { - if (typeof object.cloudStorageFailure !== "object") + if (!$util.isObject(object.cloudStorageFailure)) throw TypeError(".google.pubsub.v1.IngestionFailureEvent.cloudStorageFailure: object expected"); message.cloudStorageFailure = $root.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.fromObject(object.cloudStorageFailure, long + 1); } if (object.awsMskFailure != null) { - if (typeof object.awsMskFailure !== "object") + if (!$util.isObject(object.awsMskFailure)) throw TypeError(".google.pubsub.v1.IngestionFailureEvent.awsMskFailure: object expected"); message.awsMskFailure = $root.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.fromObject(object.awsMskFailure, long + 1); } if (object.azureEventHubsFailure != null) { - if (typeof object.azureEventHubsFailure !== "object") + if (!$util.isObject(object.azureEventHubsFailure)) throw TypeError(".google.pubsub.v1.IngestionFailureEvent.azureEventHubsFailure: object expected"); message.azureEventHubsFailure = $root.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason.fromObject(object.azureEventHubsFailure, long + 1); } if (object.confluentCloudFailure != null) { - if (typeof object.confluentCloudFailure !== "object") + if (!$util.isObject(object.confluentCloudFailure)) throw TypeError(".google.pubsub.v1.IngestionFailureEvent.confluentCloudFailure: object expected"); message.confluentCloudFailure = $root.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason.fromObject(object.confluentCloudFailure, long + 1); } if (object.awsKinesisFailure != null) { - if (typeof object.awsKinesisFailure !== "object") + if (!$util.isObject(object.awsKinesisFailure)) throw TypeError(".google.pubsub.v1.IngestionFailureEvent.awsKinesisFailure: object expected"); message.awsKinesisFailure = $root.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason.fromObject(object.awsKinesisFailure, long + 1); } @@ -4681,40 +4787,44 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - IngestionFailureEvent.toObject = function toObject(message, options) { + IngestionFailureEvent.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.topic = ""; object.errorMessage = ""; } - if (message.topic != null && message.hasOwnProperty("topic")) + if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) object.topic = message.topic; - if (message.errorMessage != null && message.hasOwnProperty("errorMessage")) + if (message.errorMessage != null && Object.hasOwnProperty.call(message, "errorMessage")) object.errorMessage = message.errorMessage; - if (message.cloudStorageFailure != null && message.hasOwnProperty("cloudStorageFailure")) { - object.cloudStorageFailure = $root.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.toObject(message.cloudStorageFailure, options); + if (message.cloudStorageFailure != null && Object.hasOwnProperty.call(message, "cloudStorageFailure")) { + object.cloudStorageFailure = $root.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.toObject(message.cloudStorageFailure, options, q + 1); if (options.oneofs) object.failure = "cloudStorageFailure"; } - if (message.awsMskFailure != null && message.hasOwnProperty("awsMskFailure")) { - object.awsMskFailure = $root.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.toObject(message.awsMskFailure, options); + if (message.awsMskFailure != null && Object.hasOwnProperty.call(message, "awsMskFailure")) { + object.awsMskFailure = $root.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.toObject(message.awsMskFailure, options, q + 1); if (options.oneofs) object.failure = "awsMskFailure"; } - if (message.azureEventHubsFailure != null && message.hasOwnProperty("azureEventHubsFailure")) { - object.azureEventHubsFailure = $root.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason.toObject(message.azureEventHubsFailure, options); + if (message.azureEventHubsFailure != null && Object.hasOwnProperty.call(message, "azureEventHubsFailure")) { + object.azureEventHubsFailure = $root.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason.toObject(message.azureEventHubsFailure, options, q + 1); if (options.oneofs) object.failure = "azureEventHubsFailure"; } - if (message.confluentCloudFailure != null && message.hasOwnProperty("confluentCloudFailure")) { - object.confluentCloudFailure = $root.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason.toObject(message.confluentCloudFailure, options); + if (message.confluentCloudFailure != null && Object.hasOwnProperty.call(message, "confluentCloudFailure")) { + object.confluentCloudFailure = $root.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason.toObject(message.confluentCloudFailure, options, q + 1); if (options.oneofs) object.failure = "confluentCloudFailure"; } - if (message.awsKinesisFailure != null && message.hasOwnProperty("awsKinesisFailure")) { - object.awsKinesisFailure = $root.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason.toObject(message.awsKinesisFailure, options); + if (message.awsKinesisFailure != null && Object.hasOwnProperty.call(message, "awsKinesisFailure")) { + object.awsKinesisFailure = $root.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason.toObject(message.awsKinesisFailure, options, q + 1); if (options.oneofs) object.failure = "awsKinesisFailure"; } @@ -4791,9 +4901,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ApiViolationReason.encode = function encode(message, writer) { + ApiViolationReason.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); return writer; }; @@ -4807,7 +4921,7 @@ * @returns {$protobuf.Writer} Writer */ ApiViolationReason.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -4887,10 +5001,6 @@ ApiViolationReason.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason) return object; - if (long === undefined) - long = 0; - if (long > $util.recursionLimit) - throw Error("maximum nesting depth exceeded"); return new $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason(); }; @@ -4980,9 +5090,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AvroFailureReason.encode = function encode(message, writer) { + AvroFailureReason.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); return writer; }; @@ -4996,7 +5110,7 @@ * @returns {$protobuf.Writer} Writer */ AvroFailureReason.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -5076,10 +5190,6 @@ AvroFailureReason.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason) return object; - if (long === undefined) - long = 0; - if (long > $util.recursionLimit) - throw Error("maximum nesting depth exceeded"); return new $root.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason(); }; @@ -5169,9 +5279,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SchemaViolationReason.encode = function encode(message, writer) { + SchemaViolationReason.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); return writer; }; @@ -5185,7 +5299,7 @@ * @returns {$protobuf.Writer} Writer */ SchemaViolationReason.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -5265,10 +5379,6 @@ SchemaViolationReason.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason) return object; - if (long === undefined) - long = 0; - if (long > $util.recursionLimit) - throw Error("maximum nesting depth exceeded"); return new $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason(); }; @@ -5358,9 +5468,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - MessageTransformationFailureReason.encode = function encode(message, writer) { + MessageTransformationFailureReason.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); return writer; }; @@ -5374,7 +5488,7 @@ * @returns {$protobuf.Writer} Writer */ MessageTransformationFailureReason.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -5454,10 +5568,6 @@ MessageTransformationFailureReason.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason) return object; - if (long === undefined) - long = 0; - if (long > $util.recursionLimit) - throw Error("maximum nesting depth exceeded"); return new $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason(); }; @@ -5624,9 +5734,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CloudStorageFailure.encode = function encode(message, writer) { + CloudStorageFailure.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.bucket != null && Object.hasOwnProperty.call(message, "bucket")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.bucket); if (message.objectName != null && Object.hasOwnProperty.call(message, "objectName")) @@ -5634,13 +5748,13 @@ if (message.objectGeneration != null && Object.hasOwnProperty.call(message, "objectGeneration")) writer.uint32(/* id 3, wireType 0 =*/24).int64(message.objectGeneration); if (message.avroFailureReason != null && Object.hasOwnProperty.call(message, "avroFailureReason")) - $root.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason.encode(message.avroFailureReason, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + $root.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason.encode(message.avroFailureReason, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); if (message.apiViolationReason != null && Object.hasOwnProperty.call(message, "apiViolationReason")) - $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.encode(message.apiViolationReason, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.encode(message.apiViolationReason, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); if (message.schemaViolationReason != null && Object.hasOwnProperty.call(message, "schemaViolationReason")) - $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.encode(message.schemaViolationReason, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.encode(message.schemaViolationReason, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); if (message.messageTransformationFailureReason != null && Object.hasOwnProperty.call(message, "messageTransformationFailureReason")) - $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.encode(message.messageTransformationFailureReason, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.encode(message.messageTransformationFailureReason, writer.uint32(/* id 8, wireType 2 =*/66).fork(), q + 1).ldelim(); return writer; }; @@ -5654,7 +5768,7 @@ * @returns {$protobuf.Writer} Writer */ CloudStorageFailure.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -5749,16 +5863,16 @@ if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; var properties = {}; - if (message.bucket != null && message.hasOwnProperty("bucket")) + if (message.bucket != null && Object.hasOwnProperty.call(message, "bucket")) if (!$util.isString(message.bucket)) return "bucket: string expected"; - if (message.objectName != null && message.hasOwnProperty("objectName")) + if (message.objectName != null && Object.hasOwnProperty.call(message, "objectName")) if (!$util.isString(message.objectName)) return "objectName: string expected"; - if (message.objectGeneration != null && message.hasOwnProperty("objectGeneration")) + if (message.objectGeneration != null && Object.hasOwnProperty.call(message, "objectGeneration")) if (!$util.isInteger(message.objectGeneration) && !(message.objectGeneration && $util.isInteger(message.objectGeneration.low) && $util.isInteger(message.objectGeneration.high))) return "objectGeneration: integer|Long expected"; - if (message.avroFailureReason != null && message.hasOwnProperty("avroFailureReason")) { + if (message.avroFailureReason != null && Object.hasOwnProperty.call(message, "avroFailureReason")) { properties.reason = 1; { var error = $root.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason.verify(message.avroFailureReason, long + 1); @@ -5766,7 +5880,7 @@ return "avroFailureReason." + error; } } - if (message.apiViolationReason != null && message.hasOwnProperty("apiViolationReason")) { + if (message.apiViolationReason != null && Object.hasOwnProperty.call(message, "apiViolationReason")) { if (properties.reason === 1) return "reason: multiple values"; properties.reason = 1; @@ -5776,7 +5890,7 @@ return "apiViolationReason." + error; } } - if (message.schemaViolationReason != null && message.hasOwnProperty("schemaViolationReason")) { + if (message.schemaViolationReason != null && Object.hasOwnProperty.call(message, "schemaViolationReason")) { if (properties.reason === 1) return "reason: multiple values"; properties.reason = 1; @@ -5786,7 +5900,7 @@ return "schemaViolationReason." + error; } } - if (message.messageTransformationFailureReason != null && message.hasOwnProperty("messageTransformationFailureReason")) { + if (message.messageTransformationFailureReason != null && Object.hasOwnProperty.call(message, "messageTransformationFailureReason")) { if (properties.reason === 1) return "reason: multiple values"; properties.reason = 1; @@ -5810,6 +5924,8 @@ CloudStorageFailure.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -5821,7 +5937,7 @@ message.objectName = String(object.objectName); if (object.objectGeneration != null) if ($util.Long) - (message.objectGeneration = $util.Long.fromValue(object.objectGeneration)).unsigned = false; + message.objectGeneration = $util.Long.fromValue(object.objectGeneration, false); else if (typeof object.objectGeneration === "string") message.objectGeneration = parseInt(object.objectGeneration, 10); else if (typeof object.objectGeneration === "number") @@ -5829,22 +5945,22 @@ else if (typeof object.objectGeneration === "object") message.objectGeneration = new $util.LongBits(object.objectGeneration.low >>> 0, object.objectGeneration.high >>> 0).toNumber(); if (object.avroFailureReason != null) { - if (typeof object.avroFailureReason !== "object") + if (!$util.isObject(object.avroFailureReason)) throw TypeError(".google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.avroFailureReason: object expected"); message.avroFailureReason = $root.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason.fromObject(object.avroFailureReason, long + 1); } if (object.apiViolationReason != null) { - if (typeof object.apiViolationReason !== "object") + if (!$util.isObject(object.apiViolationReason)) throw TypeError(".google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.apiViolationReason: object expected"); message.apiViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.fromObject(object.apiViolationReason, long + 1); } if (object.schemaViolationReason != null) { - if (typeof object.schemaViolationReason !== "object") + if (!$util.isObject(object.schemaViolationReason)) throw TypeError(".google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.schemaViolationReason: object expected"); message.schemaViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.fromObject(object.schemaViolationReason, long + 1); } if (object.messageTransformationFailureReason != null) { - if (typeof object.messageTransformationFailureReason !== "object") + if (!$util.isObject(object.messageTransformationFailureReason)) throw TypeError(".google.pubsub.v1.IngestionFailureEvent.CloudStorageFailure.messageTransformationFailureReason: object expected"); message.messageTransformationFailureReason = $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.fromObject(object.messageTransformationFailureReason, long + 1); } @@ -5860,45 +5976,51 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CloudStorageFailure.toObject = function toObject(message, options) { + CloudStorageFailure.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.bucket = ""; object.objectName = ""; if ($util.Long) { var long = new $util.Long(0, 0, false); - object.objectGeneration = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + object.objectGeneration = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; } else - object.objectGeneration = options.longs === String ? "0" : 0; + object.objectGeneration = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; } - if (message.bucket != null && message.hasOwnProperty("bucket")) + if (message.bucket != null && Object.hasOwnProperty.call(message, "bucket")) object.bucket = message.bucket; - if (message.objectName != null && message.hasOwnProperty("objectName")) + if (message.objectName != null && Object.hasOwnProperty.call(message, "objectName")) object.objectName = message.objectName; - if (message.objectGeneration != null && message.hasOwnProperty("objectGeneration")) - if (typeof message.objectGeneration === "number") + if (message.objectGeneration != null && Object.hasOwnProperty.call(message, "objectGeneration")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.objectGeneration = typeof message.objectGeneration === "number" ? BigInt(message.objectGeneration) : $util.Long.fromBits(message.objectGeneration.low >>> 0, message.objectGeneration.high >>> 0, false).toBigInt(); + else if (typeof message.objectGeneration === "number") object.objectGeneration = options.longs === String ? String(message.objectGeneration) : message.objectGeneration; else object.objectGeneration = options.longs === String ? $util.Long.prototype.toString.call(message.objectGeneration) : options.longs === Number ? new $util.LongBits(message.objectGeneration.low >>> 0, message.objectGeneration.high >>> 0).toNumber() : message.objectGeneration; - if (message.avroFailureReason != null && message.hasOwnProperty("avroFailureReason")) { - object.avroFailureReason = $root.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason.toObject(message.avroFailureReason, options); + if (message.avroFailureReason != null && Object.hasOwnProperty.call(message, "avroFailureReason")) { + object.avroFailureReason = $root.google.pubsub.v1.IngestionFailureEvent.AvroFailureReason.toObject(message.avroFailureReason, options, q + 1); if (options.oneofs) object.reason = "avroFailureReason"; } - if (message.apiViolationReason != null && message.hasOwnProperty("apiViolationReason")) { - object.apiViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.toObject(message.apiViolationReason, options); + if (message.apiViolationReason != null && Object.hasOwnProperty.call(message, "apiViolationReason")) { + object.apiViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.toObject(message.apiViolationReason, options, q + 1); if (options.oneofs) object.reason = "apiViolationReason"; } - if (message.schemaViolationReason != null && message.hasOwnProperty("schemaViolationReason")) { - object.schemaViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.toObject(message.schemaViolationReason, options); + if (message.schemaViolationReason != null && Object.hasOwnProperty.call(message, "schemaViolationReason")) { + object.schemaViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.toObject(message.schemaViolationReason, options, q + 1); if (options.oneofs) object.reason = "schemaViolationReason"; } - if (message.messageTransformationFailureReason != null && message.hasOwnProperty("messageTransformationFailureReason")) { - object.messageTransformationFailureReason = $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.toObject(message.messageTransformationFailureReason, options); + if (message.messageTransformationFailureReason != null && Object.hasOwnProperty.call(message, "messageTransformationFailureReason")) { + object.messageTransformationFailureReason = $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.toObject(message.messageTransformationFailureReason, options, q + 1); if (options.oneofs) object.reason = "messageTransformationFailureReason"; } @@ -6055,9 +6177,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AwsMskFailureReason.encode = function encode(message, writer) { + AwsMskFailureReason.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.clusterArn != null && Object.hasOwnProperty.call(message, "clusterArn")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.clusterArn); if (message.kafkaTopic != null && Object.hasOwnProperty.call(message, "kafkaTopic")) @@ -6067,11 +6193,11 @@ if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) writer.uint32(/* id 4, wireType 0 =*/32).int64(message.offset); if (message.apiViolationReason != null && Object.hasOwnProperty.call(message, "apiViolationReason")) - $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.encode(message.apiViolationReason, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.encode(message.apiViolationReason, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); if (message.schemaViolationReason != null && Object.hasOwnProperty.call(message, "schemaViolationReason")) - $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.encode(message.schemaViolationReason, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.encode(message.schemaViolationReason, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); if (message.messageTransformationFailureReason != null && Object.hasOwnProperty.call(message, "messageTransformationFailureReason")) - $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.encode(message.messageTransformationFailureReason, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.encode(message.messageTransformationFailureReason, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); return writer; }; @@ -6085,7 +6211,7 @@ * @returns {$protobuf.Writer} Writer */ AwsMskFailureReason.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -6180,19 +6306,19 @@ if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; var properties = {}; - if (message.clusterArn != null && message.hasOwnProperty("clusterArn")) + if (message.clusterArn != null && Object.hasOwnProperty.call(message, "clusterArn")) if (!$util.isString(message.clusterArn)) return "clusterArn: string expected"; - if (message.kafkaTopic != null && message.hasOwnProperty("kafkaTopic")) + if (message.kafkaTopic != null && Object.hasOwnProperty.call(message, "kafkaTopic")) if (!$util.isString(message.kafkaTopic)) return "kafkaTopic: string expected"; - if (message.partitionId != null && message.hasOwnProperty("partitionId")) + if (message.partitionId != null && Object.hasOwnProperty.call(message, "partitionId")) if (!$util.isInteger(message.partitionId) && !(message.partitionId && $util.isInteger(message.partitionId.low) && $util.isInteger(message.partitionId.high))) return "partitionId: integer|Long expected"; - if (message.offset != null && message.hasOwnProperty("offset")) + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) if (!$util.isInteger(message.offset) && !(message.offset && $util.isInteger(message.offset.low) && $util.isInteger(message.offset.high))) return "offset: integer|Long expected"; - if (message.apiViolationReason != null && message.hasOwnProperty("apiViolationReason")) { + if (message.apiViolationReason != null && Object.hasOwnProperty.call(message, "apiViolationReason")) { properties.reason = 1; { var error = $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.verify(message.apiViolationReason, long + 1); @@ -6200,7 +6326,7 @@ return "apiViolationReason." + error; } } - if (message.schemaViolationReason != null && message.hasOwnProperty("schemaViolationReason")) { + if (message.schemaViolationReason != null && Object.hasOwnProperty.call(message, "schemaViolationReason")) { if (properties.reason === 1) return "reason: multiple values"; properties.reason = 1; @@ -6210,7 +6336,7 @@ return "schemaViolationReason." + error; } } - if (message.messageTransformationFailureReason != null && message.hasOwnProperty("messageTransformationFailureReason")) { + if (message.messageTransformationFailureReason != null && Object.hasOwnProperty.call(message, "messageTransformationFailureReason")) { if (properties.reason === 1) return "reason: multiple values"; properties.reason = 1; @@ -6234,6 +6360,8 @@ AwsMskFailureReason.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -6245,7 +6373,7 @@ message.kafkaTopic = String(object.kafkaTopic); if (object.partitionId != null) if ($util.Long) - (message.partitionId = $util.Long.fromValue(object.partitionId)).unsigned = false; + message.partitionId = $util.Long.fromValue(object.partitionId, false); else if (typeof object.partitionId === "string") message.partitionId = parseInt(object.partitionId, 10); else if (typeof object.partitionId === "number") @@ -6254,7 +6382,7 @@ message.partitionId = new $util.LongBits(object.partitionId.low >>> 0, object.partitionId.high >>> 0).toNumber(); if (object.offset != null) if ($util.Long) - (message.offset = $util.Long.fromValue(object.offset)).unsigned = false; + message.offset = $util.Long.fromValue(object.offset, false); else if (typeof object.offset === "string") message.offset = parseInt(object.offset, 10); else if (typeof object.offset === "number") @@ -6262,17 +6390,17 @@ else if (typeof object.offset === "object") message.offset = new $util.LongBits(object.offset.low >>> 0, object.offset.high >>> 0).toNumber(); if (object.apiViolationReason != null) { - if (typeof object.apiViolationReason !== "object") + if (!$util.isObject(object.apiViolationReason)) throw TypeError(".google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.apiViolationReason: object expected"); message.apiViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.fromObject(object.apiViolationReason, long + 1); } if (object.schemaViolationReason != null) { - if (typeof object.schemaViolationReason !== "object") + if (!$util.isObject(object.schemaViolationReason)) throw TypeError(".google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.schemaViolationReason: object expected"); message.schemaViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.fromObject(object.schemaViolationReason, long + 1); } if (object.messageTransformationFailureReason != null) { - if (typeof object.messageTransformationFailureReason !== "object") + if (!$util.isObject(object.messageTransformationFailureReason)) throw TypeError(".google.pubsub.v1.IngestionFailureEvent.AwsMskFailureReason.messageTransformationFailureReason: object expected"); message.messageTransformationFailureReason = $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.fromObject(object.messageTransformationFailureReason, long + 1); } @@ -6288,50 +6416,58 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AwsMskFailureReason.toObject = function toObject(message, options) { + AwsMskFailureReason.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.clusterArn = ""; object.kafkaTopic = ""; if ($util.Long) { var long = new $util.Long(0, 0, false); - object.partitionId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + object.partitionId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; } else - object.partitionId = options.longs === String ? "0" : 0; + object.partitionId = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; if ($util.Long) { var long = new $util.Long(0, 0, false); - object.offset = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + object.offset = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; } else - object.offset = options.longs === String ? "0" : 0; + object.offset = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; } - if (message.clusterArn != null && message.hasOwnProperty("clusterArn")) + if (message.clusterArn != null && Object.hasOwnProperty.call(message, "clusterArn")) object.clusterArn = message.clusterArn; - if (message.kafkaTopic != null && message.hasOwnProperty("kafkaTopic")) + if (message.kafkaTopic != null && Object.hasOwnProperty.call(message, "kafkaTopic")) object.kafkaTopic = message.kafkaTopic; - if (message.partitionId != null && message.hasOwnProperty("partitionId")) - if (typeof message.partitionId === "number") + if (message.partitionId != null && Object.hasOwnProperty.call(message, "partitionId")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.partitionId = typeof message.partitionId === "number" ? BigInt(message.partitionId) : $util.Long.fromBits(message.partitionId.low >>> 0, message.partitionId.high >>> 0, false).toBigInt(); + else if (typeof message.partitionId === "number") object.partitionId = options.longs === String ? String(message.partitionId) : message.partitionId; else object.partitionId = options.longs === String ? $util.Long.prototype.toString.call(message.partitionId) : options.longs === Number ? new $util.LongBits(message.partitionId.low >>> 0, message.partitionId.high >>> 0).toNumber() : message.partitionId; - if (message.offset != null && message.hasOwnProperty("offset")) - if (typeof message.offset === "number") + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.offset = typeof message.offset === "number" ? BigInt(message.offset) : $util.Long.fromBits(message.offset.low >>> 0, message.offset.high >>> 0, false).toBigInt(); + else if (typeof message.offset === "number") object.offset = options.longs === String ? String(message.offset) : message.offset; else object.offset = options.longs === String ? $util.Long.prototype.toString.call(message.offset) : options.longs === Number ? new $util.LongBits(message.offset.low >>> 0, message.offset.high >>> 0).toNumber() : message.offset; - if (message.apiViolationReason != null && message.hasOwnProperty("apiViolationReason")) { - object.apiViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.toObject(message.apiViolationReason, options); + if (message.apiViolationReason != null && Object.hasOwnProperty.call(message, "apiViolationReason")) { + object.apiViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.toObject(message.apiViolationReason, options, q + 1); if (options.oneofs) object.reason = "apiViolationReason"; } - if (message.schemaViolationReason != null && message.hasOwnProperty("schemaViolationReason")) { - object.schemaViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.toObject(message.schemaViolationReason, options); + if (message.schemaViolationReason != null && Object.hasOwnProperty.call(message, "schemaViolationReason")) { + object.schemaViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.toObject(message.schemaViolationReason, options, q + 1); if (options.oneofs) object.reason = "schemaViolationReason"; } - if (message.messageTransformationFailureReason != null && message.hasOwnProperty("messageTransformationFailureReason")) { - object.messageTransformationFailureReason = $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.toObject(message.messageTransformationFailureReason, options); + if (message.messageTransformationFailureReason != null && Object.hasOwnProperty.call(message, "messageTransformationFailureReason")) { + object.messageTransformationFailureReason = $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.toObject(message.messageTransformationFailureReason, options, q + 1); if (options.oneofs) object.reason = "messageTransformationFailureReason"; } @@ -6488,9 +6624,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AzureEventHubsFailureReason.encode = function encode(message, writer) { + AzureEventHubsFailureReason.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.namespace != null && Object.hasOwnProperty.call(message, "namespace")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.namespace); if (message.eventHub != null && Object.hasOwnProperty.call(message, "eventHub")) @@ -6500,11 +6640,11 @@ if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) writer.uint32(/* id 4, wireType 0 =*/32).int64(message.offset); if (message.apiViolationReason != null && Object.hasOwnProperty.call(message, "apiViolationReason")) - $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.encode(message.apiViolationReason, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.encode(message.apiViolationReason, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); if (message.schemaViolationReason != null && Object.hasOwnProperty.call(message, "schemaViolationReason")) - $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.encode(message.schemaViolationReason, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.encode(message.schemaViolationReason, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); if (message.messageTransformationFailureReason != null && Object.hasOwnProperty.call(message, "messageTransformationFailureReason")) - $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.encode(message.messageTransformationFailureReason, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.encode(message.messageTransformationFailureReason, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); return writer; }; @@ -6518,7 +6658,7 @@ * @returns {$protobuf.Writer} Writer */ AzureEventHubsFailureReason.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -6613,19 +6753,19 @@ if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; var properties = {}; - if (message.namespace != null && message.hasOwnProperty("namespace")) + if (message.namespace != null && Object.hasOwnProperty.call(message, "namespace")) if (!$util.isString(message.namespace)) return "namespace: string expected"; - if (message.eventHub != null && message.hasOwnProperty("eventHub")) + if (message.eventHub != null && Object.hasOwnProperty.call(message, "eventHub")) if (!$util.isString(message.eventHub)) return "eventHub: string expected"; - if (message.partitionId != null && message.hasOwnProperty("partitionId")) + if (message.partitionId != null && Object.hasOwnProperty.call(message, "partitionId")) if (!$util.isInteger(message.partitionId) && !(message.partitionId && $util.isInteger(message.partitionId.low) && $util.isInteger(message.partitionId.high))) return "partitionId: integer|Long expected"; - if (message.offset != null && message.hasOwnProperty("offset")) + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) if (!$util.isInteger(message.offset) && !(message.offset && $util.isInteger(message.offset.low) && $util.isInteger(message.offset.high))) return "offset: integer|Long expected"; - if (message.apiViolationReason != null && message.hasOwnProperty("apiViolationReason")) { + if (message.apiViolationReason != null && Object.hasOwnProperty.call(message, "apiViolationReason")) { properties.reason = 1; { var error = $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.verify(message.apiViolationReason, long + 1); @@ -6633,7 +6773,7 @@ return "apiViolationReason." + error; } } - if (message.schemaViolationReason != null && message.hasOwnProperty("schemaViolationReason")) { + if (message.schemaViolationReason != null && Object.hasOwnProperty.call(message, "schemaViolationReason")) { if (properties.reason === 1) return "reason: multiple values"; properties.reason = 1; @@ -6643,7 +6783,7 @@ return "schemaViolationReason." + error; } } - if (message.messageTransformationFailureReason != null && message.hasOwnProperty("messageTransformationFailureReason")) { + if (message.messageTransformationFailureReason != null && Object.hasOwnProperty.call(message, "messageTransformationFailureReason")) { if (properties.reason === 1) return "reason: multiple values"; properties.reason = 1; @@ -6667,6 +6807,8 @@ AzureEventHubsFailureReason.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -6678,7 +6820,7 @@ message.eventHub = String(object.eventHub); if (object.partitionId != null) if ($util.Long) - (message.partitionId = $util.Long.fromValue(object.partitionId)).unsigned = false; + message.partitionId = $util.Long.fromValue(object.partitionId, false); else if (typeof object.partitionId === "string") message.partitionId = parseInt(object.partitionId, 10); else if (typeof object.partitionId === "number") @@ -6687,7 +6829,7 @@ message.partitionId = new $util.LongBits(object.partitionId.low >>> 0, object.partitionId.high >>> 0).toNumber(); if (object.offset != null) if ($util.Long) - (message.offset = $util.Long.fromValue(object.offset)).unsigned = false; + message.offset = $util.Long.fromValue(object.offset, false); else if (typeof object.offset === "string") message.offset = parseInt(object.offset, 10); else if (typeof object.offset === "number") @@ -6695,17 +6837,17 @@ else if (typeof object.offset === "object") message.offset = new $util.LongBits(object.offset.low >>> 0, object.offset.high >>> 0).toNumber(); if (object.apiViolationReason != null) { - if (typeof object.apiViolationReason !== "object") + if (!$util.isObject(object.apiViolationReason)) throw TypeError(".google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason.apiViolationReason: object expected"); message.apiViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.fromObject(object.apiViolationReason, long + 1); } if (object.schemaViolationReason != null) { - if (typeof object.schemaViolationReason !== "object") + if (!$util.isObject(object.schemaViolationReason)) throw TypeError(".google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason.schemaViolationReason: object expected"); message.schemaViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.fromObject(object.schemaViolationReason, long + 1); } if (object.messageTransformationFailureReason != null) { - if (typeof object.messageTransformationFailureReason !== "object") + if (!$util.isObject(object.messageTransformationFailureReason)) throw TypeError(".google.pubsub.v1.IngestionFailureEvent.AzureEventHubsFailureReason.messageTransformationFailureReason: object expected"); message.messageTransformationFailureReason = $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.fromObject(object.messageTransformationFailureReason, long + 1); } @@ -6721,50 +6863,58 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AzureEventHubsFailureReason.toObject = function toObject(message, options) { + AzureEventHubsFailureReason.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.namespace = ""; object.eventHub = ""; if ($util.Long) { var long = new $util.Long(0, 0, false); - object.partitionId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + object.partitionId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; } else - object.partitionId = options.longs === String ? "0" : 0; + object.partitionId = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; if ($util.Long) { var long = new $util.Long(0, 0, false); - object.offset = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + object.offset = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; } else - object.offset = options.longs === String ? "0" : 0; + object.offset = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; } - if (message.namespace != null && message.hasOwnProperty("namespace")) + if (message.namespace != null && Object.hasOwnProperty.call(message, "namespace")) object.namespace = message.namespace; - if (message.eventHub != null && message.hasOwnProperty("eventHub")) + if (message.eventHub != null && Object.hasOwnProperty.call(message, "eventHub")) object.eventHub = message.eventHub; - if (message.partitionId != null && message.hasOwnProperty("partitionId")) - if (typeof message.partitionId === "number") + if (message.partitionId != null && Object.hasOwnProperty.call(message, "partitionId")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.partitionId = typeof message.partitionId === "number" ? BigInt(message.partitionId) : $util.Long.fromBits(message.partitionId.low >>> 0, message.partitionId.high >>> 0, false).toBigInt(); + else if (typeof message.partitionId === "number") object.partitionId = options.longs === String ? String(message.partitionId) : message.partitionId; else object.partitionId = options.longs === String ? $util.Long.prototype.toString.call(message.partitionId) : options.longs === Number ? new $util.LongBits(message.partitionId.low >>> 0, message.partitionId.high >>> 0).toNumber() : message.partitionId; - if (message.offset != null && message.hasOwnProperty("offset")) - if (typeof message.offset === "number") + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.offset = typeof message.offset === "number" ? BigInt(message.offset) : $util.Long.fromBits(message.offset.low >>> 0, message.offset.high >>> 0, false).toBigInt(); + else if (typeof message.offset === "number") object.offset = options.longs === String ? String(message.offset) : message.offset; else object.offset = options.longs === String ? $util.Long.prototype.toString.call(message.offset) : options.longs === Number ? new $util.LongBits(message.offset.low >>> 0, message.offset.high >>> 0).toNumber() : message.offset; - if (message.apiViolationReason != null && message.hasOwnProperty("apiViolationReason")) { - object.apiViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.toObject(message.apiViolationReason, options); + if (message.apiViolationReason != null && Object.hasOwnProperty.call(message, "apiViolationReason")) { + object.apiViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.toObject(message.apiViolationReason, options, q + 1); if (options.oneofs) object.reason = "apiViolationReason"; } - if (message.schemaViolationReason != null && message.hasOwnProperty("schemaViolationReason")) { - object.schemaViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.toObject(message.schemaViolationReason, options); + if (message.schemaViolationReason != null && Object.hasOwnProperty.call(message, "schemaViolationReason")) { + object.schemaViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.toObject(message.schemaViolationReason, options, q + 1); if (options.oneofs) object.reason = "schemaViolationReason"; } - if (message.messageTransformationFailureReason != null && message.hasOwnProperty("messageTransformationFailureReason")) { - object.messageTransformationFailureReason = $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.toObject(message.messageTransformationFailureReason, options); + if (message.messageTransformationFailureReason != null && Object.hasOwnProperty.call(message, "messageTransformationFailureReason")) { + object.messageTransformationFailureReason = $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.toObject(message.messageTransformationFailureReason, options, q + 1); if (options.oneofs) object.reason = "messageTransformationFailureReason"; } @@ -6921,9 +7071,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ConfluentCloudFailureReason.encode = function encode(message, writer) { + ConfluentCloudFailureReason.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.clusterId != null && Object.hasOwnProperty.call(message, "clusterId")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.clusterId); if (message.kafkaTopic != null && Object.hasOwnProperty.call(message, "kafkaTopic")) @@ -6933,11 +7087,11 @@ if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) writer.uint32(/* id 4, wireType 0 =*/32).int64(message.offset); if (message.apiViolationReason != null && Object.hasOwnProperty.call(message, "apiViolationReason")) - $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.encode(message.apiViolationReason, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.encode(message.apiViolationReason, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); if (message.schemaViolationReason != null && Object.hasOwnProperty.call(message, "schemaViolationReason")) - $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.encode(message.schemaViolationReason, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.encode(message.schemaViolationReason, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); if (message.messageTransformationFailureReason != null && Object.hasOwnProperty.call(message, "messageTransformationFailureReason")) - $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.encode(message.messageTransformationFailureReason, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.encode(message.messageTransformationFailureReason, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); return writer; }; @@ -6951,7 +7105,7 @@ * @returns {$protobuf.Writer} Writer */ ConfluentCloudFailureReason.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -7046,19 +7200,19 @@ if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; var properties = {}; - if (message.clusterId != null && message.hasOwnProperty("clusterId")) + if (message.clusterId != null && Object.hasOwnProperty.call(message, "clusterId")) if (!$util.isString(message.clusterId)) return "clusterId: string expected"; - if (message.kafkaTopic != null && message.hasOwnProperty("kafkaTopic")) + if (message.kafkaTopic != null && Object.hasOwnProperty.call(message, "kafkaTopic")) if (!$util.isString(message.kafkaTopic)) return "kafkaTopic: string expected"; - if (message.partitionId != null && message.hasOwnProperty("partitionId")) + if (message.partitionId != null && Object.hasOwnProperty.call(message, "partitionId")) if (!$util.isInteger(message.partitionId) && !(message.partitionId && $util.isInteger(message.partitionId.low) && $util.isInteger(message.partitionId.high))) return "partitionId: integer|Long expected"; - if (message.offset != null && message.hasOwnProperty("offset")) + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) if (!$util.isInteger(message.offset) && !(message.offset && $util.isInteger(message.offset.low) && $util.isInteger(message.offset.high))) return "offset: integer|Long expected"; - if (message.apiViolationReason != null && message.hasOwnProperty("apiViolationReason")) { + if (message.apiViolationReason != null && Object.hasOwnProperty.call(message, "apiViolationReason")) { properties.reason = 1; { var error = $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.verify(message.apiViolationReason, long + 1); @@ -7066,7 +7220,7 @@ return "apiViolationReason." + error; } } - if (message.schemaViolationReason != null && message.hasOwnProperty("schemaViolationReason")) { + if (message.schemaViolationReason != null && Object.hasOwnProperty.call(message, "schemaViolationReason")) { if (properties.reason === 1) return "reason: multiple values"; properties.reason = 1; @@ -7076,7 +7230,7 @@ return "schemaViolationReason." + error; } } - if (message.messageTransformationFailureReason != null && message.hasOwnProperty("messageTransformationFailureReason")) { + if (message.messageTransformationFailureReason != null && Object.hasOwnProperty.call(message, "messageTransformationFailureReason")) { if (properties.reason === 1) return "reason: multiple values"; properties.reason = 1; @@ -7100,6 +7254,8 @@ ConfluentCloudFailureReason.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -7111,7 +7267,7 @@ message.kafkaTopic = String(object.kafkaTopic); if (object.partitionId != null) if ($util.Long) - (message.partitionId = $util.Long.fromValue(object.partitionId)).unsigned = false; + message.partitionId = $util.Long.fromValue(object.partitionId, false); else if (typeof object.partitionId === "string") message.partitionId = parseInt(object.partitionId, 10); else if (typeof object.partitionId === "number") @@ -7120,7 +7276,7 @@ message.partitionId = new $util.LongBits(object.partitionId.low >>> 0, object.partitionId.high >>> 0).toNumber(); if (object.offset != null) if ($util.Long) - (message.offset = $util.Long.fromValue(object.offset)).unsigned = false; + message.offset = $util.Long.fromValue(object.offset, false); else if (typeof object.offset === "string") message.offset = parseInt(object.offset, 10); else if (typeof object.offset === "number") @@ -7128,17 +7284,17 @@ else if (typeof object.offset === "object") message.offset = new $util.LongBits(object.offset.low >>> 0, object.offset.high >>> 0).toNumber(); if (object.apiViolationReason != null) { - if (typeof object.apiViolationReason !== "object") + if (!$util.isObject(object.apiViolationReason)) throw TypeError(".google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason.apiViolationReason: object expected"); message.apiViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.fromObject(object.apiViolationReason, long + 1); } if (object.schemaViolationReason != null) { - if (typeof object.schemaViolationReason !== "object") + if (!$util.isObject(object.schemaViolationReason)) throw TypeError(".google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason.schemaViolationReason: object expected"); message.schemaViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.fromObject(object.schemaViolationReason, long + 1); } if (object.messageTransformationFailureReason != null) { - if (typeof object.messageTransformationFailureReason !== "object") + if (!$util.isObject(object.messageTransformationFailureReason)) throw TypeError(".google.pubsub.v1.IngestionFailureEvent.ConfluentCloudFailureReason.messageTransformationFailureReason: object expected"); message.messageTransformationFailureReason = $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.fromObject(object.messageTransformationFailureReason, long + 1); } @@ -7154,50 +7310,58 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ConfluentCloudFailureReason.toObject = function toObject(message, options) { + ConfluentCloudFailureReason.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.clusterId = ""; object.kafkaTopic = ""; if ($util.Long) { var long = new $util.Long(0, 0, false); - object.partitionId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + object.partitionId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; } else - object.partitionId = options.longs === String ? "0" : 0; + object.partitionId = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; if ($util.Long) { var long = new $util.Long(0, 0, false); - object.offset = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + object.offset = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; } else - object.offset = options.longs === String ? "0" : 0; + object.offset = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; } - if (message.clusterId != null && message.hasOwnProperty("clusterId")) + if (message.clusterId != null && Object.hasOwnProperty.call(message, "clusterId")) object.clusterId = message.clusterId; - if (message.kafkaTopic != null && message.hasOwnProperty("kafkaTopic")) + if (message.kafkaTopic != null && Object.hasOwnProperty.call(message, "kafkaTopic")) object.kafkaTopic = message.kafkaTopic; - if (message.partitionId != null && message.hasOwnProperty("partitionId")) - if (typeof message.partitionId === "number") + if (message.partitionId != null && Object.hasOwnProperty.call(message, "partitionId")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.partitionId = typeof message.partitionId === "number" ? BigInt(message.partitionId) : $util.Long.fromBits(message.partitionId.low >>> 0, message.partitionId.high >>> 0, false).toBigInt(); + else if (typeof message.partitionId === "number") object.partitionId = options.longs === String ? String(message.partitionId) : message.partitionId; else object.partitionId = options.longs === String ? $util.Long.prototype.toString.call(message.partitionId) : options.longs === Number ? new $util.LongBits(message.partitionId.low >>> 0, message.partitionId.high >>> 0).toNumber() : message.partitionId; - if (message.offset != null && message.hasOwnProperty("offset")) - if (typeof message.offset === "number") + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.offset = typeof message.offset === "number" ? BigInt(message.offset) : $util.Long.fromBits(message.offset.low >>> 0, message.offset.high >>> 0, false).toBigInt(); + else if (typeof message.offset === "number") object.offset = options.longs === String ? String(message.offset) : message.offset; else object.offset = options.longs === String ? $util.Long.prototype.toString.call(message.offset) : options.longs === Number ? new $util.LongBits(message.offset.low >>> 0, message.offset.high >>> 0).toNumber() : message.offset; - if (message.apiViolationReason != null && message.hasOwnProperty("apiViolationReason")) { - object.apiViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.toObject(message.apiViolationReason, options); + if (message.apiViolationReason != null && Object.hasOwnProperty.call(message, "apiViolationReason")) { + object.apiViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.toObject(message.apiViolationReason, options, q + 1); if (options.oneofs) object.reason = "apiViolationReason"; } - if (message.schemaViolationReason != null && message.hasOwnProperty("schemaViolationReason")) { - object.schemaViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.toObject(message.schemaViolationReason, options); + if (message.schemaViolationReason != null && Object.hasOwnProperty.call(message, "schemaViolationReason")) { + object.schemaViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.toObject(message.schemaViolationReason, options, q + 1); if (options.oneofs) object.reason = "schemaViolationReason"; } - if (message.messageTransformationFailureReason != null && message.hasOwnProperty("messageTransformationFailureReason")) { - object.messageTransformationFailureReason = $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.toObject(message.messageTransformationFailureReason, options); + if (message.messageTransformationFailureReason != null && Object.hasOwnProperty.call(message, "messageTransformationFailureReason")) { + object.messageTransformationFailureReason = $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.toObject(message.messageTransformationFailureReason, options, q + 1); if (options.oneofs) object.reason = "messageTransformationFailureReason"; } @@ -7345,9 +7509,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AwsKinesisFailureReason.encode = function encode(message, writer) { + AwsKinesisFailureReason.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.streamArn != null && Object.hasOwnProperty.call(message, "streamArn")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.streamArn); if (message.partitionKey != null && Object.hasOwnProperty.call(message, "partitionKey")) @@ -7355,11 +7523,11 @@ if (message.sequenceNumber != null && Object.hasOwnProperty.call(message, "sequenceNumber")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.sequenceNumber); if (message.schemaViolationReason != null && Object.hasOwnProperty.call(message, "schemaViolationReason")) - $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.encode(message.schemaViolationReason, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.encode(message.schemaViolationReason, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); if (message.messageTransformationFailureReason != null && Object.hasOwnProperty.call(message, "messageTransformationFailureReason")) - $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.encode(message.messageTransformationFailureReason, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.encode(message.messageTransformationFailureReason, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); if (message.apiViolationReason != null && Object.hasOwnProperty.call(message, "apiViolationReason")) - $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.encode(message.apiViolationReason, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.encode(message.apiViolationReason, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); return writer; }; @@ -7373,7 +7541,7 @@ * @returns {$protobuf.Writer} Writer */ AwsKinesisFailureReason.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -7464,16 +7632,16 @@ if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; var properties = {}; - if (message.streamArn != null && message.hasOwnProperty("streamArn")) + if (message.streamArn != null && Object.hasOwnProperty.call(message, "streamArn")) if (!$util.isString(message.streamArn)) return "streamArn: string expected"; - if (message.partitionKey != null && message.hasOwnProperty("partitionKey")) + if (message.partitionKey != null && Object.hasOwnProperty.call(message, "partitionKey")) if (!$util.isString(message.partitionKey)) return "partitionKey: string expected"; - if (message.sequenceNumber != null && message.hasOwnProperty("sequenceNumber")) + if (message.sequenceNumber != null && Object.hasOwnProperty.call(message, "sequenceNumber")) if (!$util.isString(message.sequenceNumber)) return "sequenceNumber: string expected"; - if (message.schemaViolationReason != null && message.hasOwnProperty("schemaViolationReason")) { + if (message.schemaViolationReason != null && Object.hasOwnProperty.call(message, "schemaViolationReason")) { properties.reason = 1; { var error = $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.verify(message.schemaViolationReason, long + 1); @@ -7481,7 +7649,7 @@ return "schemaViolationReason." + error; } } - if (message.messageTransformationFailureReason != null && message.hasOwnProperty("messageTransformationFailureReason")) { + if (message.messageTransformationFailureReason != null && Object.hasOwnProperty.call(message, "messageTransformationFailureReason")) { if (properties.reason === 1) return "reason: multiple values"; properties.reason = 1; @@ -7491,7 +7659,7 @@ return "messageTransformationFailureReason." + error; } } - if (message.apiViolationReason != null && message.hasOwnProperty("apiViolationReason")) { + if (message.apiViolationReason != null && Object.hasOwnProperty.call(message, "apiViolationReason")) { if (properties.reason === 1) return "reason: multiple values"; properties.reason = 1; @@ -7515,6 +7683,8 @@ AwsKinesisFailureReason.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -7527,17 +7697,17 @@ if (object.sequenceNumber != null) message.sequenceNumber = String(object.sequenceNumber); if (object.schemaViolationReason != null) { - if (typeof object.schemaViolationReason !== "object") + if (!$util.isObject(object.schemaViolationReason)) throw TypeError(".google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason.schemaViolationReason: object expected"); message.schemaViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.fromObject(object.schemaViolationReason, long + 1); } if (object.messageTransformationFailureReason != null) { - if (typeof object.messageTransformationFailureReason !== "object") + if (!$util.isObject(object.messageTransformationFailureReason)) throw TypeError(".google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason.messageTransformationFailureReason: object expected"); message.messageTransformationFailureReason = $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.fromObject(object.messageTransformationFailureReason, long + 1); } if (object.apiViolationReason != null) { - if (typeof object.apiViolationReason !== "object") + if (!$util.isObject(object.apiViolationReason)) throw TypeError(".google.pubsub.v1.IngestionFailureEvent.AwsKinesisFailureReason.apiViolationReason: object expected"); message.apiViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.fromObject(object.apiViolationReason, long + 1); } @@ -7553,33 +7723,37 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AwsKinesisFailureReason.toObject = function toObject(message, options) { + AwsKinesisFailureReason.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.streamArn = ""; object.partitionKey = ""; object.sequenceNumber = ""; } - if (message.streamArn != null && message.hasOwnProperty("streamArn")) + if (message.streamArn != null && Object.hasOwnProperty.call(message, "streamArn")) object.streamArn = message.streamArn; - if (message.partitionKey != null && message.hasOwnProperty("partitionKey")) + if (message.partitionKey != null && Object.hasOwnProperty.call(message, "partitionKey")) object.partitionKey = message.partitionKey; - if (message.sequenceNumber != null && message.hasOwnProperty("sequenceNumber")) + if (message.sequenceNumber != null && Object.hasOwnProperty.call(message, "sequenceNumber")) object.sequenceNumber = message.sequenceNumber; - if (message.schemaViolationReason != null && message.hasOwnProperty("schemaViolationReason")) { - object.schemaViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.toObject(message.schemaViolationReason, options); + if (message.schemaViolationReason != null && Object.hasOwnProperty.call(message, "schemaViolationReason")) { + object.schemaViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.SchemaViolationReason.toObject(message.schemaViolationReason, options, q + 1); if (options.oneofs) object.reason = "schemaViolationReason"; } - if (message.messageTransformationFailureReason != null && message.hasOwnProperty("messageTransformationFailureReason")) { - object.messageTransformationFailureReason = $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.toObject(message.messageTransformationFailureReason, options); + if (message.messageTransformationFailureReason != null && Object.hasOwnProperty.call(message, "messageTransformationFailureReason")) { + object.messageTransformationFailureReason = $root.google.pubsub.v1.IngestionFailureEvent.MessageTransformationFailureReason.toObject(message.messageTransformationFailureReason, options, q + 1); if (options.oneofs) object.reason = "messageTransformationFailureReason"; } - if (message.apiViolationReason != null && message.hasOwnProperty("apiViolationReason")) { - object.apiViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.toObject(message.apiViolationReason, options); + if (message.apiViolationReason != null && Object.hasOwnProperty.call(message, "apiViolationReason")) { + object.apiViolationReason = $root.google.pubsub.v1.IngestionFailureEvent.ApiViolationReason.toObject(message.apiViolationReason, options, q + 1); if (options.oneofs) object.reason = "apiViolationReason"; } @@ -7680,9 +7854,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - JavaScriptUDF.encode = function encode(message, writer) { + JavaScriptUDF.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.functionName != null && Object.hasOwnProperty.call(message, "functionName")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.functionName); if (message.code != null && Object.hasOwnProperty.call(message, "code")) @@ -7700,7 +7878,7 @@ * @returns {$protobuf.Writer} Writer */ JavaScriptUDF.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -7774,10 +7952,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.functionName != null && message.hasOwnProperty("functionName")) + if (message.functionName != null && Object.hasOwnProperty.call(message, "functionName")) if (!$util.isString(message.functionName)) return "functionName: string expected"; - if (message.code != null && message.hasOwnProperty("code")) + if (message.code != null && Object.hasOwnProperty.call(message, "code")) if (!$util.isString(message.code)) return "code: string expected"; return null; @@ -7794,6 +7972,8 @@ JavaScriptUDF.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.JavaScriptUDF) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.JavaScriptUDF: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -7815,17 +7995,21 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - JavaScriptUDF.toObject = function toObject(message, options) { + JavaScriptUDF.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.functionName = ""; object.code = ""; } - if (message.functionName != null && message.hasOwnProperty("functionName")) + if (message.functionName != null && Object.hasOwnProperty.call(message, "functionName")) object.functionName = message.functionName; - if (message.code != null && message.hasOwnProperty("code")) + if (message.code != null && Object.hasOwnProperty.call(message, "code")) object.code = message.code; return object; }; @@ -7944,13 +8128,17 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AIInference.encode = function encode(message, writer) { + AIInference.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.endpoint != null && Object.hasOwnProperty.call(message, "endpoint")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.endpoint); if (message.unstructuredInference != null && Object.hasOwnProperty.call(message, "unstructuredInference")) - $root.google.pubsub.v1.AIInference.UnstructuredInference.encode(message.unstructuredInference, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.pubsub.v1.AIInference.UnstructuredInference.encode(message.unstructuredInference, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); if (message.serviceAccountEmail != null && Object.hasOwnProperty.call(message, "serviceAccountEmail")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.serviceAccountEmail); return writer; @@ -7966,7 +8154,7 @@ * @returns {$protobuf.Writer} Writer */ AIInference.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -8045,10 +8233,10 @@ if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; var properties = {}; - if (message.endpoint != null && message.hasOwnProperty("endpoint")) + if (message.endpoint != null && Object.hasOwnProperty.call(message, "endpoint")) if (!$util.isString(message.endpoint)) return "endpoint: string expected"; - if (message.unstructuredInference != null && message.hasOwnProperty("unstructuredInference")) { + if (message.unstructuredInference != null && Object.hasOwnProperty.call(message, "unstructuredInference")) { properties.inferenceMode = 1; { var error = $root.google.pubsub.v1.AIInference.UnstructuredInference.verify(message.unstructuredInference, long + 1); @@ -8056,7 +8244,7 @@ return "unstructuredInference." + error; } } - if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + if (message.serviceAccountEmail != null && Object.hasOwnProperty.call(message, "serviceAccountEmail")) if (!$util.isString(message.serviceAccountEmail)) return "serviceAccountEmail: string expected"; return null; @@ -8073,6 +8261,8 @@ AIInference.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.AIInference) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.AIInference: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -8081,7 +8271,7 @@ if (object.endpoint != null) message.endpoint = String(object.endpoint); if (object.unstructuredInference != null) { - if (typeof object.unstructuredInference !== "object") + if (!$util.isObject(object.unstructuredInference)) throw TypeError(".google.pubsub.v1.AIInference.unstructuredInference: object expected"); message.unstructuredInference = $root.google.pubsub.v1.AIInference.UnstructuredInference.fromObject(object.unstructuredInference, long + 1); } @@ -8099,22 +8289,26 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AIInference.toObject = function toObject(message, options) { + AIInference.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.endpoint = ""; object.serviceAccountEmail = ""; } - if (message.endpoint != null && message.hasOwnProperty("endpoint")) + if (message.endpoint != null && Object.hasOwnProperty.call(message, "endpoint")) object.endpoint = message.endpoint; - if (message.unstructuredInference != null && message.hasOwnProperty("unstructuredInference")) { - object.unstructuredInference = $root.google.pubsub.v1.AIInference.UnstructuredInference.toObject(message.unstructuredInference, options); + if (message.unstructuredInference != null && Object.hasOwnProperty.call(message, "unstructuredInference")) { + object.unstructuredInference = $root.google.pubsub.v1.AIInference.UnstructuredInference.toObject(message.unstructuredInference, options, q + 1); if (options.oneofs) object.inferenceMode = "unstructuredInference"; } - if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + if (message.serviceAccountEmail != null && Object.hasOwnProperty.call(message, "serviceAccountEmail")) object.serviceAccountEmail = message.serviceAccountEmail; return object; }; @@ -8198,11 +8392,15 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UnstructuredInference.encode = function encode(message, writer) { + UnstructuredInference.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.parameters != null && Object.hasOwnProperty.call(message, "parameters")) - $root.google.protobuf.Struct.encode(message.parameters, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.protobuf.Struct.encode(message.parameters, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); return writer; }; @@ -8216,7 +8414,7 @@ * @returns {$protobuf.Writer} Writer */ UnstructuredInference.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -8286,7 +8484,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.parameters != null && message.hasOwnProperty("parameters")) { + if (message.parameters != null && Object.hasOwnProperty.call(message, "parameters")) { var error = $root.google.protobuf.Struct.verify(message.parameters, long + 1); if (error) return "parameters." + error; @@ -8305,13 +8503,15 @@ UnstructuredInference.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.AIInference.UnstructuredInference) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.AIInference.UnstructuredInference: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) throw Error("maximum nesting depth exceeded"); var message = new $root.google.pubsub.v1.AIInference.UnstructuredInference(); if (object.parameters != null) { - if (typeof object.parameters !== "object") + if (!$util.isObject(object.parameters)) throw TypeError(".google.pubsub.v1.AIInference.UnstructuredInference.parameters: object expected"); message.parameters = $root.google.protobuf.Struct.fromObject(object.parameters, long + 1); } @@ -8327,14 +8527,18 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UnstructuredInference.toObject = function toObject(message, options) { + UnstructuredInference.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) object.parameters = null; - if (message.parameters != null && message.hasOwnProperty("parameters")) - object.parameters = $root.google.protobuf.Struct.toObject(message.parameters, options); + if (message.parameters != null && Object.hasOwnProperty.call(message, "parameters")) + object.parameters = $root.google.protobuf.Struct.toObject(message.parameters, options, q + 1); return object; }; @@ -8464,17 +8668,21 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - MessageTransform.encode = function encode(message, writer) { + MessageTransform.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.javascriptUdf != null && Object.hasOwnProperty.call(message, "javascriptUdf")) - $root.google.pubsub.v1.JavaScriptUDF.encode(message.javascriptUdf, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.pubsub.v1.JavaScriptUDF.encode(message.javascriptUdf, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enabled); if (message.disabled != null && Object.hasOwnProperty.call(message, "disabled")) writer.uint32(/* id 4, wireType 0 =*/32).bool(message.disabled); if (message.aiInference != null && Object.hasOwnProperty.call(message, "aiInference")) - $root.google.pubsub.v1.AIInference.encode(message.aiInference, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + $root.google.pubsub.v1.AIInference.encode(message.aiInference, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); return writer; }; @@ -8488,7 +8696,7 @@ * @returns {$protobuf.Writer} Writer */ MessageTransform.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -8571,7 +8779,7 @@ if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; var properties = {}; - if (message.javascriptUdf != null && message.hasOwnProperty("javascriptUdf")) { + if (message.javascriptUdf != null && Object.hasOwnProperty.call(message, "javascriptUdf")) { properties.transform = 1; { var error = $root.google.pubsub.v1.JavaScriptUDF.verify(message.javascriptUdf, long + 1); @@ -8579,7 +8787,7 @@ return "javascriptUdf." + error; } } - if (message.aiInference != null && message.hasOwnProperty("aiInference")) { + if (message.aiInference != null && Object.hasOwnProperty.call(message, "aiInference")) { if (properties.transform === 1) return "transform: multiple values"; properties.transform = 1; @@ -8589,10 +8797,10 @@ return "aiInference." + error; } } - if (message.enabled != null && message.hasOwnProperty("enabled")) + if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) if (typeof message.enabled !== "boolean") return "enabled: boolean expected"; - if (message.disabled != null && message.hasOwnProperty("disabled")) + if (message.disabled != null && Object.hasOwnProperty.call(message, "disabled")) if (typeof message.disabled !== "boolean") return "disabled: boolean expected"; return null; @@ -8609,18 +8817,20 @@ MessageTransform.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.MessageTransform) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.MessageTransform: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) throw Error("maximum nesting depth exceeded"); var message = new $root.google.pubsub.v1.MessageTransform(); if (object.javascriptUdf != null) { - if (typeof object.javascriptUdf !== "object") + if (!$util.isObject(object.javascriptUdf)) throw TypeError(".google.pubsub.v1.MessageTransform.javascriptUdf: object expected"); message.javascriptUdf = $root.google.pubsub.v1.JavaScriptUDF.fromObject(object.javascriptUdf, long + 1); } if (object.aiInference != null) { - if (typeof object.aiInference !== "object") + if (!$util.isObject(object.aiInference)) throw TypeError(".google.pubsub.v1.MessageTransform.aiInference: object expected"); message.aiInference = $root.google.pubsub.v1.AIInference.fromObject(object.aiInference, long + 1); } @@ -8640,25 +8850,29 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - MessageTransform.toObject = function toObject(message, options) { + MessageTransform.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.enabled = false; object.disabled = false; } - if (message.javascriptUdf != null && message.hasOwnProperty("javascriptUdf")) { - object.javascriptUdf = $root.google.pubsub.v1.JavaScriptUDF.toObject(message.javascriptUdf, options); + if (message.javascriptUdf != null && Object.hasOwnProperty.call(message, "javascriptUdf")) { + object.javascriptUdf = $root.google.pubsub.v1.JavaScriptUDF.toObject(message.javascriptUdf, options, q + 1); if (options.oneofs) object.transform = "javascriptUdf"; } - if (message.enabled != null && message.hasOwnProperty("enabled")) + if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) object.enabled = message.enabled; - if (message.disabled != null && message.hasOwnProperty("disabled")) + if (message.disabled != null && Object.hasOwnProperty.call(message, "disabled")) object.disabled = message.disabled; - if (message.aiInference != null && message.hasOwnProperty("aiInference")) { - object.aiInference = $root.google.pubsub.v1.AIInference.toObject(message.aiInference, options); + if (message.aiInference != null && Object.hasOwnProperty.call(message, "aiInference")) { + object.aiInference = $root.google.pubsub.v1.AIInference.toObject(message.aiInference, options, q + 1); if (options.oneofs) object.transform = "aiInference"; } @@ -8840,31 +9054,35 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Topic.encode = function encode(message, writer) { + Topic.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); if (message.messageStoragePolicy != null && Object.hasOwnProperty.call(message, "messageStoragePolicy")) - $root.google.pubsub.v1.MessageStoragePolicy.encode(message.messageStoragePolicy, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + $root.google.pubsub.v1.MessageStoragePolicy.encode(message.messageStoragePolicy, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); if (message.kmsKeyName != null && Object.hasOwnProperty.call(message, "kmsKeyName")) writer.uint32(/* id 5, wireType 2 =*/42).string(message.kmsKeyName); if (message.schemaSettings != null && Object.hasOwnProperty.call(message, "schemaSettings")) - $root.google.pubsub.v1.SchemaSettings.encode(message.schemaSettings, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + $root.google.pubsub.v1.SchemaSettings.encode(message.schemaSettings, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); if (message.satisfiesPzs != null && Object.hasOwnProperty.call(message, "satisfiesPzs")) writer.uint32(/* id 7, wireType 0 =*/56).bool(message.satisfiesPzs); if (message.messageRetentionDuration != null && Object.hasOwnProperty.call(message, "messageRetentionDuration")) - $root.google.protobuf.Duration.encode(message.messageRetentionDuration, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + $root.google.protobuf.Duration.encode(message.messageRetentionDuration, writer.uint32(/* id 8, wireType 2 =*/66).fork(), q + 1).ldelim(); if (message.state != null && Object.hasOwnProperty.call(message, "state")) writer.uint32(/* id 9, wireType 0 =*/72).int32(message.state); if (message.ingestionDataSourceSettings != null && Object.hasOwnProperty.call(message, "ingestionDataSourceSettings")) - $root.google.pubsub.v1.IngestionDataSourceSettings.encode(message.ingestionDataSourceSettings, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + $root.google.pubsub.v1.IngestionDataSourceSettings.encode(message.ingestionDataSourceSettings, writer.uint32(/* id 10, wireType 2 =*/82).fork(), q + 1).ldelim(); if (message.messageTransforms != null && message.messageTransforms.length) for (var i = 0; i < message.messageTransforms.length; ++i) - $root.google.pubsub.v1.MessageTransform.encode(message.messageTransforms[i], writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + $root.google.pubsub.v1.MessageTransform.encode(message.messageTransforms[i], writer.uint32(/* id 13, wireType 2 =*/106).fork(), q + 1).ldelim(); if (message.tags != null && Object.hasOwnProperty.call(message, "tags")) for (var keys = Object.keys(message.tags), i = 0; i < keys.length; ++i) writer.uint32(/* id 14, wireType 2 =*/114).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.tags[keys[i]]).ldelim(); @@ -8881,7 +9099,7 @@ * @returns {$protobuf.Writer} Writer */ Topic.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -9035,10 +9253,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) if (!$util.isString(message.name)) return "name: string expected"; - if (message.labels != null && message.hasOwnProperty("labels")) { + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) { if (!$util.isObject(message.labels)) return "labels: object expected"; var key = Object.keys(message.labels); @@ -9046,28 +9264,28 @@ if (!$util.isString(message.labels[key[i]])) return "labels: string{k:string} expected"; } - if (message.messageStoragePolicy != null && message.hasOwnProperty("messageStoragePolicy")) { + if (message.messageStoragePolicy != null && Object.hasOwnProperty.call(message, "messageStoragePolicy")) { var error = $root.google.pubsub.v1.MessageStoragePolicy.verify(message.messageStoragePolicy, long + 1); if (error) return "messageStoragePolicy." + error; } - if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + if (message.kmsKeyName != null && Object.hasOwnProperty.call(message, "kmsKeyName")) if (!$util.isString(message.kmsKeyName)) return "kmsKeyName: string expected"; - if (message.schemaSettings != null && message.hasOwnProperty("schemaSettings")) { + if (message.schemaSettings != null && Object.hasOwnProperty.call(message, "schemaSettings")) { var error = $root.google.pubsub.v1.SchemaSettings.verify(message.schemaSettings, long + 1); if (error) return "schemaSettings." + error; } - if (message.satisfiesPzs != null && message.hasOwnProperty("satisfiesPzs")) + if (message.satisfiesPzs != null && Object.hasOwnProperty.call(message, "satisfiesPzs")) if (typeof message.satisfiesPzs !== "boolean") return "satisfiesPzs: boolean expected"; - if (message.messageRetentionDuration != null && message.hasOwnProperty("messageRetentionDuration")) { + if (message.messageRetentionDuration != null && Object.hasOwnProperty.call(message, "messageRetentionDuration")) { var error = $root.google.protobuf.Duration.verify(message.messageRetentionDuration, long + 1); if (error) return "messageRetentionDuration." + error; } - if (message.state != null && message.hasOwnProperty("state")) + if (message.state != null && Object.hasOwnProperty.call(message, "state")) switch (message.state) { default: return "state: enum value expected"; @@ -9076,12 +9294,12 @@ case 2: break; } - if (message.ingestionDataSourceSettings != null && message.hasOwnProperty("ingestionDataSourceSettings")) { + if (message.ingestionDataSourceSettings != null && Object.hasOwnProperty.call(message, "ingestionDataSourceSettings")) { var error = $root.google.pubsub.v1.IngestionDataSourceSettings.verify(message.ingestionDataSourceSettings, long + 1); if (error) return "ingestionDataSourceSettings." + error; } - if (message.messageTransforms != null && message.hasOwnProperty("messageTransforms")) { + if (message.messageTransforms != null && Object.hasOwnProperty.call(message, "messageTransforms")) { if (!Array.isArray(message.messageTransforms)) return "messageTransforms: array expected"; for (var i = 0; i < message.messageTransforms.length; ++i) { @@ -9090,7 +9308,7 @@ return "messageTransforms." + error; } } - if (message.tags != null && message.hasOwnProperty("tags")) { + if (message.tags != null && Object.hasOwnProperty.call(message, "tags")) { if (!$util.isObject(message.tags)) return "tags: object expected"; var key = Object.keys(message.tags); @@ -9112,6 +9330,8 @@ Topic.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.Topic) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.Topic: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -9120,7 +9340,7 @@ if (object.name != null) message.name = String(object.name); if (object.labels) { - if (typeof object.labels !== "object") + if (!$util.isObject(object.labels)) throw TypeError(".google.pubsub.v1.Topic.labels: object expected"); message.labels = {}; for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) { @@ -9130,21 +9350,21 @@ } } if (object.messageStoragePolicy != null) { - if (typeof object.messageStoragePolicy !== "object") + if (!$util.isObject(object.messageStoragePolicy)) throw TypeError(".google.pubsub.v1.Topic.messageStoragePolicy: object expected"); message.messageStoragePolicy = $root.google.pubsub.v1.MessageStoragePolicy.fromObject(object.messageStoragePolicy, long + 1); } if (object.kmsKeyName != null) message.kmsKeyName = String(object.kmsKeyName); if (object.schemaSettings != null) { - if (typeof object.schemaSettings !== "object") + if (!$util.isObject(object.schemaSettings)) throw TypeError(".google.pubsub.v1.Topic.schemaSettings: object expected"); message.schemaSettings = $root.google.pubsub.v1.SchemaSettings.fromObject(object.schemaSettings, long + 1); } if (object.satisfiesPzs != null) message.satisfiesPzs = Boolean(object.satisfiesPzs); if (object.messageRetentionDuration != null) { - if (typeof object.messageRetentionDuration !== "object") + if (!$util.isObject(object.messageRetentionDuration)) throw TypeError(".google.pubsub.v1.Topic.messageRetentionDuration: object expected"); message.messageRetentionDuration = $root.google.protobuf.Duration.fromObject(object.messageRetentionDuration, long + 1); } @@ -9169,7 +9389,7 @@ break; } if (object.ingestionDataSourceSettings != null) { - if (typeof object.ingestionDataSourceSettings !== "object") + if (!$util.isObject(object.ingestionDataSourceSettings)) throw TypeError(".google.pubsub.v1.Topic.ingestionDataSourceSettings: object expected"); message.ingestionDataSourceSettings = $root.google.pubsub.v1.IngestionDataSourceSettings.fromObject(object.ingestionDataSourceSettings, long + 1); } @@ -9178,13 +9398,13 @@ throw TypeError(".google.pubsub.v1.Topic.messageTransforms: array expected"); message.messageTransforms = []; for (var i = 0; i < object.messageTransforms.length; ++i) { - if (typeof object.messageTransforms[i] !== "object") + if (!$util.isObject(object.messageTransforms[i])) throw TypeError(".google.pubsub.v1.Topic.messageTransforms: object expected"); message.messageTransforms[i] = $root.google.pubsub.v1.MessageTransform.fromObject(object.messageTransforms[i], long + 1); } } if (object.tags) { - if (typeof object.tags !== "object") + if (!$util.isObject(object.tags)) throw TypeError(".google.pubsub.v1.Topic.tags: object expected"); message.tags = {}; for (var keys = Object.keys(object.tags), i = 0; i < keys.length; ++i) { @@ -9205,9 +9425,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Topic.toObject = function toObject(message, options) { + Topic.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.messageTransforms = []; @@ -9225,7 +9449,7 @@ object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; object.ingestionDataSourceSettings = null; } - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) object.name = message.name; var keys2; if (message.labels && (keys2 = Object.keys(message.labels)).length) { @@ -9236,24 +9460,24 @@ object.labels[keys2[j]] = message.labels[keys2[j]]; } } - if (message.messageStoragePolicy != null && message.hasOwnProperty("messageStoragePolicy")) - object.messageStoragePolicy = $root.google.pubsub.v1.MessageStoragePolicy.toObject(message.messageStoragePolicy, options); - if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + if (message.messageStoragePolicy != null && Object.hasOwnProperty.call(message, "messageStoragePolicy")) + object.messageStoragePolicy = $root.google.pubsub.v1.MessageStoragePolicy.toObject(message.messageStoragePolicy, options, q + 1); + if (message.kmsKeyName != null && Object.hasOwnProperty.call(message, "kmsKeyName")) object.kmsKeyName = message.kmsKeyName; - if (message.schemaSettings != null && message.hasOwnProperty("schemaSettings")) - object.schemaSettings = $root.google.pubsub.v1.SchemaSettings.toObject(message.schemaSettings, options); - if (message.satisfiesPzs != null && message.hasOwnProperty("satisfiesPzs")) + if (message.schemaSettings != null && Object.hasOwnProperty.call(message, "schemaSettings")) + object.schemaSettings = $root.google.pubsub.v1.SchemaSettings.toObject(message.schemaSettings, options, q + 1); + if (message.satisfiesPzs != null && Object.hasOwnProperty.call(message, "satisfiesPzs")) object.satisfiesPzs = message.satisfiesPzs; - if (message.messageRetentionDuration != null && message.hasOwnProperty("messageRetentionDuration")) - object.messageRetentionDuration = $root.google.protobuf.Duration.toObject(message.messageRetentionDuration, options); - if (message.state != null && message.hasOwnProperty("state")) + if (message.messageRetentionDuration != null && Object.hasOwnProperty.call(message, "messageRetentionDuration")) + object.messageRetentionDuration = $root.google.protobuf.Duration.toObject(message.messageRetentionDuration, options, q + 1); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) object.state = options.enums === String ? $root.google.pubsub.v1.Topic.State[message.state] === undefined ? message.state : $root.google.pubsub.v1.Topic.State[message.state] : message.state; - if (message.ingestionDataSourceSettings != null && message.hasOwnProperty("ingestionDataSourceSettings")) - object.ingestionDataSourceSettings = $root.google.pubsub.v1.IngestionDataSourceSettings.toObject(message.ingestionDataSourceSettings, options); + if (message.ingestionDataSourceSettings != null && Object.hasOwnProperty.call(message, "ingestionDataSourceSettings")) + object.ingestionDataSourceSettings = $root.google.pubsub.v1.IngestionDataSourceSettings.toObject(message.ingestionDataSourceSettings, options, q + 1); if (message.messageTransforms && message.messageTransforms.length) { object.messageTransforms = []; for (var j = 0; j < message.messageTransforms.length; ++j) - object.messageTransforms[j] = $root.google.pubsub.v1.MessageTransform.toObject(message.messageTransforms[j], options); + object.messageTransforms[j] = $root.google.pubsub.v1.MessageTransform.toObject(message.messageTransforms[j], options, q + 1); } if (message.tags && (keys2 = Object.keys(message.tags)).length) { object.tags = {}; @@ -9401,9 +9625,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PubsubMessage.encode = function encode(message, writer) { + PubsubMessage.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.data != null && Object.hasOwnProperty.call(message, "data")) writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.data); if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) @@ -9412,7 +9640,7 @@ if (message.messageId != null && Object.hasOwnProperty.call(message, "messageId")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.messageId); if (message.publishTime != null && Object.hasOwnProperty.call(message, "publishTime")) - $root.google.protobuf.Timestamp.encode(message.publishTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + $root.google.protobuf.Timestamp.encode(message.publishTime, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); if (message.orderingKey != null && Object.hasOwnProperty.call(message, "orderingKey")) writer.uint32(/* id 5, wireType 2 =*/42).string(message.orderingKey); return writer; @@ -9428,7 +9656,7 @@ * @returns {$protobuf.Writer} Writer */ PubsubMessage.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -9535,10 +9763,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.data != null && message.hasOwnProperty("data")) + if (message.data != null && Object.hasOwnProperty.call(message, "data")) if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) return "data: buffer expected"; - if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) { if (!$util.isObject(message.attributes)) return "attributes: object expected"; var key = Object.keys(message.attributes); @@ -9546,15 +9774,15 @@ if (!$util.isString(message.attributes[key[i]])) return "attributes: string{k:string} expected"; } - if (message.messageId != null && message.hasOwnProperty("messageId")) + if (message.messageId != null && Object.hasOwnProperty.call(message, "messageId")) if (!$util.isString(message.messageId)) return "messageId: string expected"; - if (message.publishTime != null && message.hasOwnProperty("publishTime")) { + if (message.publishTime != null && Object.hasOwnProperty.call(message, "publishTime")) { var error = $root.google.protobuf.Timestamp.verify(message.publishTime, long + 1); if (error) return "publishTime." + error; } - if (message.orderingKey != null && message.hasOwnProperty("orderingKey")) + if (message.orderingKey != null && Object.hasOwnProperty.call(message, "orderingKey")) if (!$util.isString(message.orderingKey)) return "orderingKey: string expected"; return null; @@ -9571,6 +9799,8 @@ PubsubMessage.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.PubsubMessage) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.PubsubMessage: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -9582,7 +9812,7 @@ else if (object.data.length >= 0) message.data = object.data; if (object.attributes) { - if (typeof object.attributes !== "object") + if (!$util.isObject(object.attributes)) throw TypeError(".google.pubsub.v1.PubsubMessage.attributes: object expected"); message.attributes = {}; for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { @@ -9594,7 +9824,7 @@ if (object.messageId != null) message.messageId = String(object.messageId); if (object.publishTime != null) { - if (typeof object.publishTime !== "object") + if (!$util.isObject(object.publishTime)) throw TypeError(".google.pubsub.v1.PubsubMessage.publishTime: object expected"); message.publishTime = $root.google.protobuf.Timestamp.fromObject(object.publishTime, long + 1); } @@ -9612,9 +9842,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PubsubMessage.toObject = function toObject(message, options) { + PubsubMessage.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.objects || options.defaults) object.attributes = {}; @@ -9630,7 +9864,7 @@ object.publishTime = null; object.orderingKey = ""; } - if (message.data != null && message.hasOwnProperty("data")) + if (message.data != null && Object.hasOwnProperty.call(message, "data")) object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; var keys2; if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { @@ -9641,11 +9875,11 @@ object.attributes[keys2[j]] = message.attributes[keys2[j]]; } } - if (message.messageId != null && message.hasOwnProperty("messageId")) + if (message.messageId != null && Object.hasOwnProperty.call(message, "messageId")) object.messageId = message.messageId; - if (message.publishTime != null && message.hasOwnProperty("publishTime")) - object.publishTime = $root.google.protobuf.Timestamp.toObject(message.publishTime, options); - if (message.orderingKey != null && message.hasOwnProperty("orderingKey")) + if (message.publishTime != null && Object.hasOwnProperty.call(message, "publishTime")) + object.publishTime = $root.google.protobuf.Timestamp.toObject(message.publishTime, options, q + 1); + if (message.orderingKey != null && Object.hasOwnProperty.call(message, "orderingKey")) object.orderingKey = message.orderingKey; return object; }; @@ -9732,9 +9966,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetTopicRequest.encode = function encode(message, writer) { + GetTopicRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.topic); return writer; @@ -9750,7 +9988,7 @@ * @returns {$protobuf.Writer} Writer */ GetTopicRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -9820,7 +10058,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.topic != null && message.hasOwnProperty("topic")) + if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) if (!$util.isString(message.topic)) return "topic: string expected"; return null; @@ -9837,6 +10075,8 @@ GetTopicRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.GetTopicRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.GetTopicRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -9856,13 +10096,17 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetTopicRequest.toObject = function toObject(message, options) { + GetTopicRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) object.topic = ""; - if (message.topic != null && message.hasOwnProperty("topic")) + if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) object.topic = message.topic; return object; }; @@ -9958,13 +10202,17 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateTopicRequest.encode = function encode(message, writer) { + UpdateTopicRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) - $root.google.pubsub.v1.Topic.encode(message.topic, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.pubsub.v1.Topic.encode(message.topic, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); return writer; }; @@ -9978,7 +10226,7 @@ * @returns {$protobuf.Writer} Writer */ UpdateTopicRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -10052,12 +10300,12 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.topic != null && message.hasOwnProperty("topic")) { + if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) { var error = $root.google.pubsub.v1.Topic.verify(message.topic, long + 1); if (error) return "topic." + error; } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) { var error = $root.google.protobuf.FieldMask.verify(message.updateMask, long + 1); if (error) return "updateMask." + error; @@ -10076,18 +10324,20 @@ UpdateTopicRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.UpdateTopicRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.UpdateTopicRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) throw Error("maximum nesting depth exceeded"); var message = new $root.google.pubsub.v1.UpdateTopicRequest(); if (object.topic != null) { - if (typeof object.topic !== "object") + if (!$util.isObject(object.topic)) throw TypeError(".google.pubsub.v1.UpdateTopicRequest.topic: object expected"); message.topic = $root.google.pubsub.v1.Topic.fromObject(object.topic, long + 1); } if (object.updateMask != null) { - if (typeof object.updateMask !== "object") + if (!$util.isObject(object.updateMask)) throw TypeError(".google.pubsub.v1.UpdateTopicRequest.updateMask: object expected"); message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask, long + 1); } @@ -10103,18 +10353,22 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UpdateTopicRequest.toObject = function toObject(message, options) { + UpdateTopicRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.topic = null; object.updateMask = null; } - if (message.topic != null && message.hasOwnProperty("topic")) - object.topic = $root.google.pubsub.v1.Topic.toObject(message.topic, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) + object.topic = $root.google.pubsub.v1.Topic.toObject(message.topic, options, q + 1); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options, q + 1); return object; }; @@ -10210,14 +10464,18 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PublishRequest.encode = function encode(message, writer) { + PublishRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.topic); if (message.messages != null && message.messages.length) for (var i = 0; i < message.messages.length; ++i) - $root.google.pubsub.v1.PubsubMessage.encode(message.messages[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.pubsub.v1.PubsubMessage.encode(message.messages[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); return writer; }; @@ -10231,7 +10489,7 @@ * @returns {$protobuf.Writer} Writer */ PublishRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -10307,10 +10565,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.topic != null && message.hasOwnProperty("topic")) + if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) if (!$util.isString(message.topic)) return "topic: string expected"; - if (message.messages != null && message.hasOwnProperty("messages")) { + if (message.messages != null && Object.hasOwnProperty.call(message, "messages")) { if (!Array.isArray(message.messages)) return "messages: array expected"; for (var i = 0; i < message.messages.length; ++i) { @@ -10333,6 +10591,8 @@ PublishRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.PublishRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.PublishRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -10345,7 +10605,7 @@ throw TypeError(".google.pubsub.v1.PublishRequest.messages: array expected"); message.messages = []; for (var i = 0; i < object.messages.length; ++i) { - if (typeof object.messages[i] !== "object") + if (!$util.isObject(object.messages[i])) throw TypeError(".google.pubsub.v1.PublishRequest.messages: object expected"); message.messages[i] = $root.google.pubsub.v1.PubsubMessage.fromObject(object.messages[i], long + 1); } @@ -10362,20 +10622,24 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PublishRequest.toObject = function toObject(message, options) { + PublishRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.messages = []; if (options.defaults) object.topic = ""; - if (message.topic != null && message.hasOwnProperty("topic")) + if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) object.topic = message.topic; if (message.messages && message.messages.length) { object.messages = []; for (var j = 0; j < message.messages.length; ++j) - object.messages[j] = $root.google.pubsub.v1.PubsubMessage.toObject(message.messages[j], options); + object.messages[j] = $root.google.pubsub.v1.PubsubMessage.toObject(message.messages[j], options, q + 1); } return object; }; @@ -10463,9 +10727,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PublishResponse.encode = function encode(message, writer) { + PublishResponse.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.messageIds != null && message.messageIds.length) for (var i = 0; i < message.messageIds.length; ++i) writer.uint32(/* id 1, wireType 2 =*/10).string(message.messageIds[i]); @@ -10482,7 +10750,7 @@ * @returns {$protobuf.Writer} Writer */ PublishResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -10554,7 +10822,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.messageIds != null && message.hasOwnProperty("messageIds")) { + if (message.messageIds != null && Object.hasOwnProperty.call(message, "messageIds")) { if (!Array.isArray(message.messageIds)) return "messageIds: array expected"; for (var i = 0; i < message.messageIds.length; ++i) @@ -10575,6 +10843,8 @@ PublishResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.PublishResponse) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.PublishResponse: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -10599,9 +10869,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PublishResponse.toObject = function toObject(message, options) { + PublishResponse.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.messageIds = []; @@ -10713,9 +10987,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListTopicsRequest.encode = function encode(message, writer) { + ListTopicsRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.project != null && Object.hasOwnProperty.call(message, "project")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.project); if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) @@ -10735,7 +11013,7 @@ * @returns {$protobuf.Writer} Writer */ ListTopicsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -10813,13 +11091,13 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.project != null && message.hasOwnProperty("project")) + if (message.project != null && Object.hasOwnProperty.call(message, "project")) if (!$util.isString(message.project)) return "project: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) if (!$util.isInteger(message.pageSize)) return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) if (!$util.isString(message.pageToken)) return "pageToken: string expected"; return null; @@ -10836,6 +11114,8 @@ ListTopicsRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.ListTopicsRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.ListTopicsRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -10859,20 +11139,24 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListTopicsRequest.toObject = function toObject(message, options) { + ListTopicsRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.project = ""; object.pageSize = 0; object.pageToken = ""; } - if (message.project != null && message.hasOwnProperty("project")) + if (message.project != null && Object.hasOwnProperty.call(message, "project")) object.project = message.project; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) object.pageToken = message.pageToken; return object; }; @@ -10969,12 +11253,16 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListTopicsResponse.encode = function encode(message, writer) { + ListTopicsResponse.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.topics != null && message.topics.length) for (var i = 0; i < message.topics.length; ++i) - $root.google.pubsub.v1.Topic.encode(message.topics[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.pubsub.v1.Topic.encode(message.topics[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); return writer; @@ -10990,7 +11278,7 @@ * @returns {$protobuf.Writer} Writer */ ListTopicsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -11066,7 +11354,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.topics != null && message.hasOwnProperty("topics")) { + if (message.topics != null && Object.hasOwnProperty.call(message, "topics")) { if (!Array.isArray(message.topics)) return "topics: array expected"; for (var i = 0; i < message.topics.length; ++i) { @@ -11075,7 +11363,7 @@ return "topics." + error; } } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) if (!$util.isString(message.nextPageToken)) return "nextPageToken: string expected"; return null; @@ -11092,6 +11380,8 @@ ListTopicsResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.ListTopicsResponse) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.ListTopicsResponse: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -11102,7 +11392,7 @@ throw TypeError(".google.pubsub.v1.ListTopicsResponse.topics: array expected"); message.topics = []; for (var i = 0; i < object.topics.length; ++i) { - if (typeof object.topics[i] !== "object") + if (!$util.isObject(object.topics[i])) throw TypeError(".google.pubsub.v1.ListTopicsResponse.topics: object expected"); message.topics[i] = $root.google.pubsub.v1.Topic.fromObject(object.topics[i], long + 1); } @@ -11121,9 +11411,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListTopicsResponse.toObject = function toObject(message, options) { + ListTopicsResponse.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.topics = []; @@ -11132,9 +11426,9 @@ if (message.topics && message.topics.length) { object.topics = []; for (var j = 0; j < message.topics.length; ++j) - object.topics[j] = $root.google.pubsub.v1.Topic.toObject(message.topics[j], options); + object.topics[j] = $root.google.pubsub.v1.Topic.toObject(message.topics[j], options, q + 1); } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) object.nextPageToken = message.nextPageToken; return object; }; @@ -11239,9 +11533,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListTopicSubscriptionsRequest.encode = function encode(message, writer) { + ListTopicSubscriptionsRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.topic); if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) @@ -11261,7 +11559,7 @@ * @returns {$protobuf.Writer} Writer */ ListTopicSubscriptionsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -11339,13 +11637,13 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.topic != null && message.hasOwnProperty("topic")) + if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) if (!$util.isString(message.topic)) return "topic: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) if (!$util.isInteger(message.pageSize)) return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) if (!$util.isString(message.pageToken)) return "pageToken: string expected"; return null; @@ -11362,6 +11660,8 @@ ListTopicSubscriptionsRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.ListTopicSubscriptionsRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.ListTopicSubscriptionsRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -11385,20 +11685,24 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListTopicSubscriptionsRequest.toObject = function toObject(message, options) { + ListTopicSubscriptionsRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.topic = ""; object.pageSize = 0; object.pageToken = ""; } - if (message.topic != null && message.hasOwnProperty("topic")) + if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) object.topic = message.topic; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) object.pageToken = message.pageToken; return object; }; @@ -11495,9 +11799,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListTopicSubscriptionsResponse.encode = function encode(message, writer) { + ListTopicSubscriptionsResponse.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.subscriptions != null && message.subscriptions.length) for (var i = 0; i < message.subscriptions.length; ++i) writer.uint32(/* id 1, wireType 2 =*/10).string(message.subscriptions[i]); @@ -11516,7 +11824,7 @@ * @returns {$protobuf.Writer} Writer */ ListTopicSubscriptionsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -11592,14 +11900,14 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.subscriptions != null && message.hasOwnProperty("subscriptions")) { + if (message.subscriptions != null && Object.hasOwnProperty.call(message, "subscriptions")) { if (!Array.isArray(message.subscriptions)) return "subscriptions: array expected"; for (var i = 0; i < message.subscriptions.length; ++i) if (!$util.isString(message.subscriptions[i])) return "subscriptions: string[] expected"; } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) if (!$util.isString(message.nextPageToken)) return "nextPageToken: string expected"; return null; @@ -11616,6 +11924,8 @@ ListTopicSubscriptionsResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.ListTopicSubscriptionsResponse) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.ListTopicSubscriptionsResponse: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -11642,9 +11952,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListTopicSubscriptionsResponse.toObject = function toObject(message, options) { + ListTopicSubscriptionsResponse.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.subscriptions = []; @@ -11655,7 +11969,7 @@ for (var j = 0; j < message.subscriptions.length; ++j) object.subscriptions[j] = message.subscriptions[j]; } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) object.nextPageToken = message.nextPageToken; return object; }; @@ -11760,9 +12074,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListTopicSnapshotsRequest.encode = function encode(message, writer) { + ListTopicSnapshotsRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.topic); if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) @@ -11782,7 +12100,7 @@ * @returns {$protobuf.Writer} Writer */ ListTopicSnapshotsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -11860,13 +12178,13 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.topic != null && message.hasOwnProperty("topic")) + if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) if (!$util.isString(message.topic)) return "topic: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) if (!$util.isInteger(message.pageSize)) return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) if (!$util.isString(message.pageToken)) return "pageToken: string expected"; return null; @@ -11883,6 +12201,8 @@ ListTopicSnapshotsRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.ListTopicSnapshotsRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.ListTopicSnapshotsRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -11906,20 +12226,24 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListTopicSnapshotsRequest.toObject = function toObject(message, options) { + ListTopicSnapshotsRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.topic = ""; object.pageSize = 0; object.pageToken = ""; } - if (message.topic != null && message.hasOwnProperty("topic")) + if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) object.topic = message.topic; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) object.pageToken = message.pageToken; return object; }; @@ -12016,9 +12340,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListTopicSnapshotsResponse.encode = function encode(message, writer) { + ListTopicSnapshotsResponse.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.snapshots != null && message.snapshots.length) for (var i = 0; i < message.snapshots.length; ++i) writer.uint32(/* id 1, wireType 2 =*/10).string(message.snapshots[i]); @@ -12037,7 +12365,7 @@ * @returns {$protobuf.Writer} Writer */ ListTopicSnapshotsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -12113,14 +12441,14 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.snapshots != null && message.hasOwnProperty("snapshots")) { + if (message.snapshots != null && Object.hasOwnProperty.call(message, "snapshots")) { if (!Array.isArray(message.snapshots)) return "snapshots: array expected"; for (var i = 0; i < message.snapshots.length; ++i) if (!$util.isString(message.snapshots[i])) return "snapshots: string[] expected"; } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) if (!$util.isString(message.nextPageToken)) return "nextPageToken: string expected"; return null; @@ -12137,6 +12465,8 @@ ListTopicSnapshotsResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.ListTopicSnapshotsResponse) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.ListTopicSnapshotsResponse: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -12163,9 +12493,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListTopicSnapshotsResponse.toObject = function toObject(message, options) { + ListTopicSnapshotsResponse.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.snapshots = []; @@ -12176,7 +12510,7 @@ for (var j = 0; j < message.snapshots.length; ++j) object.snapshots[j] = message.snapshots[j]; } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) object.nextPageToken = message.nextPageToken; return object; }; @@ -12263,9 +12597,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteTopicRequest.encode = function encode(message, writer) { + DeleteTopicRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.topic); return writer; @@ -12281,7 +12619,7 @@ * @returns {$protobuf.Writer} Writer */ DeleteTopicRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -12351,7 +12689,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.topic != null && message.hasOwnProperty("topic")) + if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) if (!$util.isString(message.topic)) return "topic: string expected"; return null; @@ -12368,6 +12706,8 @@ DeleteTopicRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.DeleteTopicRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.DeleteTopicRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -12387,13 +12727,17 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DeleteTopicRequest.toObject = function toObject(message, options) { + DeleteTopicRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) object.topic = ""; - if (message.topic != null && message.hasOwnProperty("topic")) + if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) object.topic = message.topic; return object; }; @@ -12480,9 +12824,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DetachSubscriptionRequest.encode = function encode(message, writer) { + DetachSubscriptionRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.subscription); return writer; @@ -12498,7 +12846,7 @@ * @returns {$protobuf.Writer} Writer */ DetachSubscriptionRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -12568,7 +12916,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.subscription != null && message.hasOwnProperty("subscription")) + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) if (!$util.isString(message.subscription)) return "subscription: string expected"; return null; @@ -12585,6 +12933,8 @@ DetachSubscriptionRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.DetachSubscriptionRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.DetachSubscriptionRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -12604,13 +12954,17 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DetachSubscriptionRequest.toObject = function toObject(message, options) { + DetachSubscriptionRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) object.subscription = ""; - if (message.subscription != null && message.hasOwnProperty("subscription")) + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) object.subscription = message.subscription; return object; }; @@ -12688,9 +13042,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DetachSubscriptionResponse.encode = function encode(message, writer) { + DetachSubscriptionResponse.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); return writer; }; @@ -12704,7 +13062,7 @@ * @returns {$protobuf.Writer} Writer */ DetachSubscriptionResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -12784,10 +13142,6 @@ DetachSubscriptionResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.DetachSubscriptionResponse) return object; - if (long === undefined) - long = 0; - if (long > $util.recursionLimit) - throw Error("maximum nesting depth exceeded"); return new $root.google.pubsub.v1.DetachSubscriptionResponse(); }; @@ -12885,7 +13239,7 @@ * @variation 1 */ Object.defineProperty(Subscriber.prototype.createSubscription = function createSubscription(request, callback) { - return this.rpcCall(createSubscription, $root.google.pubsub.v1.Subscription, $root.google.pubsub.v1.Subscription, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, createSubscription, $root.google.pubsub.v1.Subscription, $root.google.pubsub.v1.Subscription, request, callback); }, "name", { value: "CreateSubscription" }); /** @@ -12918,7 +13272,7 @@ * @variation 1 */ Object.defineProperty(Subscriber.prototype.getSubscription = function getSubscription(request, callback) { - return this.rpcCall(getSubscription, $root.google.pubsub.v1.GetSubscriptionRequest, $root.google.pubsub.v1.Subscription, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, getSubscription, $root.google.pubsub.v1.GetSubscriptionRequest, $root.google.pubsub.v1.Subscription, request, callback); }, "name", { value: "GetSubscription" }); /** @@ -12951,7 +13305,7 @@ * @variation 1 */ Object.defineProperty(Subscriber.prototype.updateSubscription = function updateSubscription(request, callback) { - return this.rpcCall(updateSubscription, $root.google.pubsub.v1.UpdateSubscriptionRequest, $root.google.pubsub.v1.Subscription, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, updateSubscription, $root.google.pubsub.v1.UpdateSubscriptionRequest, $root.google.pubsub.v1.Subscription, request, callback); }, "name", { value: "UpdateSubscription" }); /** @@ -12984,7 +13338,7 @@ * @variation 1 */ Object.defineProperty(Subscriber.prototype.listSubscriptions = function listSubscriptions(request, callback) { - return this.rpcCall(listSubscriptions, $root.google.pubsub.v1.ListSubscriptionsRequest, $root.google.pubsub.v1.ListSubscriptionsResponse, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, listSubscriptions, $root.google.pubsub.v1.ListSubscriptionsRequest, $root.google.pubsub.v1.ListSubscriptionsResponse, request, callback); }, "name", { value: "ListSubscriptions" }); /** @@ -13017,7 +13371,7 @@ * @variation 1 */ Object.defineProperty(Subscriber.prototype.deleteSubscription = function deleteSubscription(request, callback) { - return this.rpcCall(deleteSubscription, $root.google.pubsub.v1.DeleteSubscriptionRequest, $root.google.protobuf.Empty, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, deleteSubscription, $root.google.pubsub.v1.DeleteSubscriptionRequest, $root.google.protobuf.Empty, request, callback); }, "name", { value: "DeleteSubscription" }); /** @@ -13050,7 +13404,7 @@ * @variation 1 */ Object.defineProperty(Subscriber.prototype.modifyAckDeadline = function modifyAckDeadline(request, callback) { - return this.rpcCall(modifyAckDeadline, $root.google.pubsub.v1.ModifyAckDeadlineRequest, $root.google.protobuf.Empty, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, modifyAckDeadline, $root.google.pubsub.v1.ModifyAckDeadlineRequest, $root.google.protobuf.Empty, request, callback); }, "name", { value: "ModifyAckDeadline" }); /** @@ -13083,7 +13437,7 @@ * @variation 1 */ Object.defineProperty(Subscriber.prototype.acknowledge = function acknowledge(request, callback) { - return this.rpcCall(acknowledge, $root.google.pubsub.v1.AcknowledgeRequest, $root.google.protobuf.Empty, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, acknowledge, $root.google.pubsub.v1.AcknowledgeRequest, $root.google.protobuf.Empty, request, callback); }, "name", { value: "Acknowledge" }); /** @@ -13116,7 +13470,7 @@ * @variation 1 */ Object.defineProperty(Subscriber.prototype.pull = function pull(request, callback) { - return this.rpcCall(pull, $root.google.pubsub.v1.PullRequest, $root.google.pubsub.v1.PullResponse, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, pull, $root.google.pubsub.v1.PullRequest, $root.google.pubsub.v1.PullResponse, request, callback); }, "name", { value: "Pull" }); /** @@ -13149,7 +13503,7 @@ * @variation 1 */ Object.defineProperty(Subscriber.prototype.streamingPull = function streamingPull(request, callback) { - return this.rpcCall(streamingPull, $root.google.pubsub.v1.StreamingPullRequest, $root.google.pubsub.v1.StreamingPullResponse, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, streamingPull, $root.google.pubsub.v1.StreamingPullRequest, $root.google.pubsub.v1.StreamingPullResponse, request, callback); }, "name", { value: "StreamingPull" }); /** @@ -13182,7 +13536,7 @@ * @variation 1 */ Object.defineProperty(Subscriber.prototype.modifyPushConfig = function modifyPushConfig(request, callback) { - return this.rpcCall(modifyPushConfig, $root.google.pubsub.v1.ModifyPushConfigRequest, $root.google.protobuf.Empty, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, modifyPushConfig, $root.google.pubsub.v1.ModifyPushConfigRequest, $root.google.protobuf.Empty, request, callback); }, "name", { value: "ModifyPushConfig" }); /** @@ -13215,7 +13569,7 @@ * @variation 1 */ Object.defineProperty(Subscriber.prototype.getSnapshot = function getSnapshot(request, callback) { - return this.rpcCall(getSnapshot, $root.google.pubsub.v1.GetSnapshotRequest, $root.google.pubsub.v1.Snapshot, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, getSnapshot, $root.google.pubsub.v1.GetSnapshotRequest, $root.google.pubsub.v1.Snapshot, request, callback); }, "name", { value: "GetSnapshot" }); /** @@ -13248,7 +13602,7 @@ * @variation 1 */ Object.defineProperty(Subscriber.prototype.listSnapshots = function listSnapshots(request, callback) { - return this.rpcCall(listSnapshots, $root.google.pubsub.v1.ListSnapshotsRequest, $root.google.pubsub.v1.ListSnapshotsResponse, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, listSnapshots, $root.google.pubsub.v1.ListSnapshotsRequest, $root.google.pubsub.v1.ListSnapshotsResponse, request, callback); }, "name", { value: "ListSnapshots" }); /** @@ -13281,7 +13635,7 @@ * @variation 1 */ Object.defineProperty(Subscriber.prototype.createSnapshot = function createSnapshot(request, callback) { - return this.rpcCall(createSnapshot, $root.google.pubsub.v1.CreateSnapshotRequest, $root.google.pubsub.v1.Snapshot, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, createSnapshot, $root.google.pubsub.v1.CreateSnapshotRequest, $root.google.pubsub.v1.Snapshot, request, callback); }, "name", { value: "CreateSnapshot" }); /** @@ -13314,7 +13668,7 @@ * @variation 1 */ Object.defineProperty(Subscriber.prototype.updateSnapshot = function updateSnapshot(request, callback) { - return this.rpcCall(updateSnapshot, $root.google.pubsub.v1.UpdateSnapshotRequest, $root.google.pubsub.v1.Snapshot, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, updateSnapshot, $root.google.pubsub.v1.UpdateSnapshotRequest, $root.google.pubsub.v1.Snapshot, request, callback); }, "name", { value: "UpdateSnapshot" }); /** @@ -13347,7 +13701,7 @@ * @variation 1 */ Object.defineProperty(Subscriber.prototype.deleteSnapshot = function deleteSnapshot(request, callback) { - return this.rpcCall(deleteSnapshot, $root.google.pubsub.v1.DeleteSnapshotRequest, $root.google.protobuf.Empty, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, deleteSnapshot, $root.google.pubsub.v1.DeleteSnapshotRequest, $root.google.protobuf.Empty, request, callback); }, "name", { value: "DeleteSnapshot" }); /** @@ -13380,7 +13734,7 @@ * @variation 1 */ Object.defineProperty(Subscriber.prototype.seek = function seek(request, callback) { - return this.rpcCall(seek, $root.google.pubsub.v1.SeekRequest, $root.google.pubsub.v1.SeekResponse, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, seek, $root.google.pubsub.v1.SeekRequest, $root.google.pubsub.v1.SeekResponse, request, callback); }, "name", { value: "Seek" }); /** @@ -13641,56 +13995,60 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Subscription.encode = function encode(message, writer) { + Subscription.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.topic); if (message.pushConfig != null && Object.hasOwnProperty.call(message, "pushConfig")) - $root.google.pubsub.v1.PushConfig.encode(message.pushConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + $root.google.pubsub.v1.PushConfig.encode(message.pushConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); if (message.ackDeadlineSeconds != null && Object.hasOwnProperty.call(message, "ackDeadlineSeconds")) writer.uint32(/* id 5, wireType 0 =*/40).int32(message.ackDeadlineSeconds); if (message.retainAckedMessages != null && Object.hasOwnProperty.call(message, "retainAckedMessages")) writer.uint32(/* id 7, wireType 0 =*/56).bool(message.retainAckedMessages); if (message.messageRetentionDuration != null && Object.hasOwnProperty.call(message, "messageRetentionDuration")) - $root.google.protobuf.Duration.encode(message.messageRetentionDuration, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + $root.google.protobuf.Duration.encode(message.messageRetentionDuration, writer.uint32(/* id 8, wireType 2 =*/66).fork(), q + 1).ldelim(); if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) writer.uint32(/* id 9, wireType 2 =*/74).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); if (message.enableMessageOrdering != null && Object.hasOwnProperty.call(message, "enableMessageOrdering")) writer.uint32(/* id 10, wireType 0 =*/80).bool(message.enableMessageOrdering); if (message.expirationPolicy != null && Object.hasOwnProperty.call(message, "expirationPolicy")) - $root.google.pubsub.v1.ExpirationPolicy.encode(message.expirationPolicy, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + $root.google.pubsub.v1.ExpirationPolicy.encode(message.expirationPolicy, writer.uint32(/* id 11, wireType 2 =*/90).fork(), q + 1).ldelim(); if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) writer.uint32(/* id 12, wireType 2 =*/98).string(message.filter); if (message.deadLetterPolicy != null && Object.hasOwnProperty.call(message, "deadLetterPolicy")) - $root.google.pubsub.v1.DeadLetterPolicy.encode(message.deadLetterPolicy, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + $root.google.pubsub.v1.DeadLetterPolicy.encode(message.deadLetterPolicy, writer.uint32(/* id 13, wireType 2 =*/106).fork(), q + 1).ldelim(); if (message.retryPolicy != null && Object.hasOwnProperty.call(message, "retryPolicy")) - $root.google.pubsub.v1.RetryPolicy.encode(message.retryPolicy, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + $root.google.pubsub.v1.RetryPolicy.encode(message.retryPolicy, writer.uint32(/* id 14, wireType 2 =*/114).fork(), q + 1).ldelim(); if (message.detached != null && Object.hasOwnProperty.call(message, "detached")) writer.uint32(/* id 15, wireType 0 =*/120).bool(message.detached); if (message.enableExactlyOnceDelivery != null && Object.hasOwnProperty.call(message, "enableExactlyOnceDelivery")) writer.uint32(/* id 16, wireType 0 =*/128).bool(message.enableExactlyOnceDelivery); if (message.topicMessageRetentionDuration != null && Object.hasOwnProperty.call(message, "topicMessageRetentionDuration")) - $root.google.protobuf.Duration.encode(message.topicMessageRetentionDuration, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + $root.google.protobuf.Duration.encode(message.topicMessageRetentionDuration, writer.uint32(/* id 17, wireType 2 =*/138).fork(), q + 1).ldelim(); if (message.bigqueryConfig != null && Object.hasOwnProperty.call(message, "bigqueryConfig")) - $root.google.pubsub.v1.BigQueryConfig.encode(message.bigqueryConfig, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); + $root.google.pubsub.v1.BigQueryConfig.encode(message.bigqueryConfig, writer.uint32(/* id 18, wireType 2 =*/146).fork(), q + 1).ldelim(); if (message.state != null && Object.hasOwnProperty.call(message, "state")) writer.uint32(/* id 19, wireType 0 =*/152).int32(message.state); if (message.cloudStorageConfig != null && Object.hasOwnProperty.call(message, "cloudStorageConfig")) - $root.google.pubsub.v1.CloudStorageConfig.encode(message.cloudStorageConfig, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); + $root.google.pubsub.v1.CloudStorageConfig.encode(message.cloudStorageConfig, writer.uint32(/* id 22, wireType 2 =*/178).fork(), q + 1).ldelim(); if (message.analyticsHubSubscriptionInfo != null && Object.hasOwnProperty.call(message, "analyticsHubSubscriptionInfo")) - $root.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.encode(message.analyticsHubSubscriptionInfo, writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); + $root.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.encode(message.analyticsHubSubscriptionInfo, writer.uint32(/* id 23, wireType 2 =*/186).fork(), q + 1).ldelim(); if (message.messageTransforms != null && message.messageTransforms.length) for (var i = 0; i < message.messageTransforms.length; ++i) - $root.google.pubsub.v1.MessageTransform.encode(message.messageTransforms[i], writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim(); + $root.google.pubsub.v1.MessageTransform.encode(message.messageTransforms[i], writer.uint32(/* id 25, wireType 2 =*/202).fork(), q + 1).ldelim(); if (message.tags != null && Object.hasOwnProperty.call(message, "tags")) for (var keys = Object.keys(message.tags), i = 0; i < keys.length; ++i) writer.uint32(/* id 26, wireType 2 =*/210).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.tags[keys[i]]).ldelim(); if (message.bigtableConfig != null && Object.hasOwnProperty.call(message, "bigtableConfig")) - $root.google.pubsub.v1.BigtableConfig.encode(message.bigtableConfig, writer.uint32(/* id 27, wireType 2 =*/218).fork()).ldelim(); + $root.google.pubsub.v1.BigtableConfig.encode(message.bigtableConfig, writer.uint32(/* id 27, wireType 2 =*/218).fork(), q + 1).ldelim(); return writer; }; @@ -13704,7 +14062,7 @@ * @returns {$protobuf.Writer} Writer */ Subscription.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -13902,44 +14260,44 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) if (!$util.isString(message.name)) return "name: string expected"; - if (message.topic != null && message.hasOwnProperty("topic")) + if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) if (!$util.isString(message.topic)) return "topic: string expected"; - if (message.pushConfig != null && message.hasOwnProperty("pushConfig")) { + if (message.pushConfig != null && Object.hasOwnProperty.call(message, "pushConfig")) { var error = $root.google.pubsub.v1.PushConfig.verify(message.pushConfig, long + 1); if (error) return "pushConfig." + error; } - if (message.bigqueryConfig != null && message.hasOwnProperty("bigqueryConfig")) { + if (message.bigqueryConfig != null && Object.hasOwnProperty.call(message, "bigqueryConfig")) { var error = $root.google.pubsub.v1.BigQueryConfig.verify(message.bigqueryConfig, long + 1); if (error) return "bigqueryConfig." + error; } - if (message.cloudStorageConfig != null && message.hasOwnProperty("cloudStorageConfig")) { + if (message.cloudStorageConfig != null && Object.hasOwnProperty.call(message, "cloudStorageConfig")) { var error = $root.google.pubsub.v1.CloudStorageConfig.verify(message.cloudStorageConfig, long + 1); if (error) return "cloudStorageConfig." + error; } - if (message.bigtableConfig != null && message.hasOwnProperty("bigtableConfig")) { + if (message.bigtableConfig != null && Object.hasOwnProperty.call(message, "bigtableConfig")) { var error = $root.google.pubsub.v1.BigtableConfig.verify(message.bigtableConfig, long + 1); if (error) return "bigtableConfig." + error; } - if (message.ackDeadlineSeconds != null && message.hasOwnProperty("ackDeadlineSeconds")) + if (message.ackDeadlineSeconds != null && Object.hasOwnProperty.call(message, "ackDeadlineSeconds")) if (!$util.isInteger(message.ackDeadlineSeconds)) return "ackDeadlineSeconds: integer expected"; - if (message.retainAckedMessages != null && message.hasOwnProperty("retainAckedMessages")) + if (message.retainAckedMessages != null && Object.hasOwnProperty.call(message, "retainAckedMessages")) if (typeof message.retainAckedMessages !== "boolean") return "retainAckedMessages: boolean expected"; - if (message.messageRetentionDuration != null && message.hasOwnProperty("messageRetentionDuration")) { + if (message.messageRetentionDuration != null && Object.hasOwnProperty.call(message, "messageRetentionDuration")) { var error = $root.google.protobuf.Duration.verify(message.messageRetentionDuration, long + 1); if (error) return "messageRetentionDuration." + error; } - if (message.labels != null && message.hasOwnProperty("labels")) { + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) { if (!$util.isObject(message.labels)) return "labels: object expected"; var key = Object.keys(message.labels); @@ -13947,39 +14305,39 @@ if (!$util.isString(message.labels[key[i]])) return "labels: string{k:string} expected"; } - if (message.enableMessageOrdering != null && message.hasOwnProperty("enableMessageOrdering")) + if (message.enableMessageOrdering != null && Object.hasOwnProperty.call(message, "enableMessageOrdering")) if (typeof message.enableMessageOrdering !== "boolean") return "enableMessageOrdering: boolean expected"; - if (message.expirationPolicy != null && message.hasOwnProperty("expirationPolicy")) { + if (message.expirationPolicy != null && Object.hasOwnProperty.call(message, "expirationPolicy")) { var error = $root.google.pubsub.v1.ExpirationPolicy.verify(message.expirationPolicy, long + 1); if (error) return "expirationPolicy." + error; } - if (message.filter != null && message.hasOwnProperty("filter")) + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) if (!$util.isString(message.filter)) return "filter: string expected"; - if (message.deadLetterPolicy != null && message.hasOwnProperty("deadLetterPolicy")) { + if (message.deadLetterPolicy != null && Object.hasOwnProperty.call(message, "deadLetterPolicy")) { var error = $root.google.pubsub.v1.DeadLetterPolicy.verify(message.deadLetterPolicy, long + 1); if (error) return "deadLetterPolicy." + error; } - if (message.retryPolicy != null && message.hasOwnProperty("retryPolicy")) { + if (message.retryPolicy != null && Object.hasOwnProperty.call(message, "retryPolicy")) { var error = $root.google.pubsub.v1.RetryPolicy.verify(message.retryPolicy, long + 1); if (error) return "retryPolicy." + error; } - if (message.detached != null && message.hasOwnProperty("detached")) + if (message.detached != null && Object.hasOwnProperty.call(message, "detached")) if (typeof message.detached !== "boolean") return "detached: boolean expected"; - if (message.enableExactlyOnceDelivery != null && message.hasOwnProperty("enableExactlyOnceDelivery")) + if (message.enableExactlyOnceDelivery != null && Object.hasOwnProperty.call(message, "enableExactlyOnceDelivery")) if (typeof message.enableExactlyOnceDelivery !== "boolean") return "enableExactlyOnceDelivery: boolean expected"; - if (message.topicMessageRetentionDuration != null && message.hasOwnProperty("topicMessageRetentionDuration")) { + if (message.topicMessageRetentionDuration != null && Object.hasOwnProperty.call(message, "topicMessageRetentionDuration")) { var error = $root.google.protobuf.Duration.verify(message.topicMessageRetentionDuration, long + 1); if (error) return "topicMessageRetentionDuration." + error; } - if (message.state != null && message.hasOwnProperty("state")) + if (message.state != null && Object.hasOwnProperty.call(message, "state")) switch (message.state) { default: return "state: enum value expected"; @@ -13988,12 +14346,12 @@ case 2: break; } - if (message.analyticsHubSubscriptionInfo != null && message.hasOwnProperty("analyticsHubSubscriptionInfo")) { + if (message.analyticsHubSubscriptionInfo != null && Object.hasOwnProperty.call(message, "analyticsHubSubscriptionInfo")) { var error = $root.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.verify(message.analyticsHubSubscriptionInfo, long + 1); if (error) return "analyticsHubSubscriptionInfo." + error; } - if (message.messageTransforms != null && message.hasOwnProperty("messageTransforms")) { + if (message.messageTransforms != null && Object.hasOwnProperty.call(message, "messageTransforms")) { if (!Array.isArray(message.messageTransforms)) return "messageTransforms: array expected"; for (var i = 0; i < message.messageTransforms.length; ++i) { @@ -14002,7 +14360,7 @@ return "messageTransforms." + error; } } - if (message.tags != null && message.hasOwnProperty("tags")) { + if (message.tags != null && Object.hasOwnProperty.call(message, "tags")) { if (!$util.isObject(message.tags)) return "tags: object expected"; var key = Object.keys(message.tags); @@ -14024,6 +14382,8 @@ Subscription.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.Subscription) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.Subscription: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -14034,22 +14394,22 @@ if (object.topic != null) message.topic = String(object.topic); if (object.pushConfig != null) { - if (typeof object.pushConfig !== "object") + if (!$util.isObject(object.pushConfig)) throw TypeError(".google.pubsub.v1.Subscription.pushConfig: object expected"); message.pushConfig = $root.google.pubsub.v1.PushConfig.fromObject(object.pushConfig, long + 1); } if (object.bigqueryConfig != null) { - if (typeof object.bigqueryConfig !== "object") + if (!$util.isObject(object.bigqueryConfig)) throw TypeError(".google.pubsub.v1.Subscription.bigqueryConfig: object expected"); message.bigqueryConfig = $root.google.pubsub.v1.BigQueryConfig.fromObject(object.bigqueryConfig, long + 1); } if (object.cloudStorageConfig != null) { - if (typeof object.cloudStorageConfig !== "object") + if (!$util.isObject(object.cloudStorageConfig)) throw TypeError(".google.pubsub.v1.Subscription.cloudStorageConfig: object expected"); message.cloudStorageConfig = $root.google.pubsub.v1.CloudStorageConfig.fromObject(object.cloudStorageConfig, long + 1); } if (object.bigtableConfig != null) { - if (typeof object.bigtableConfig !== "object") + if (!$util.isObject(object.bigtableConfig)) throw TypeError(".google.pubsub.v1.Subscription.bigtableConfig: object expected"); message.bigtableConfig = $root.google.pubsub.v1.BigtableConfig.fromObject(object.bigtableConfig, long + 1); } @@ -14058,12 +14418,12 @@ if (object.retainAckedMessages != null) message.retainAckedMessages = Boolean(object.retainAckedMessages); if (object.messageRetentionDuration != null) { - if (typeof object.messageRetentionDuration !== "object") + if (!$util.isObject(object.messageRetentionDuration)) throw TypeError(".google.pubsub.v1.Subscription.messageRetentionDuration: object expected"); message.messageRetentionDuration = $root.google.protobuf.Duration.fromObject(object.messageRetentionDuration, long + 1); } if (object.labels) { - if (typeof object.labels !== "object") + if (!$util.isObject(object.labels)) throw TypeError(".google.pubsub.v1.Subscription.labels: object expected"); message.labels = {}; for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) { @@ -14075,19 +14435,19 @@ if (object.enableMessageOrdering != null) message.enableMessageOrdering = Boolean(object.enableMessageOrdering); if (object.expirationPolicy != null) { - if (typeof object.expirationPolicy !== "object") + if (!$util.isObject(object.expirationPolicy)) throw TypeError(".google.pubsub.v1.Subscription.expirationPolicy: object expected"); message.expirationPolicy = $root.google.pubsub.v1.ExpirationPolicy.fromObject(object.expirationPolicy, long + 1); } if (object.filter != null) message.filter = String(object.filter); if (object.deadLetterPolicy != null) { - if (typeof object.deadLetterPolicy !== "object") + if (!$util.isObject(object.deadLetterPolicy)) throw TypeError(".google.pubsub.v1.Subscription.deadLetterPolicy: object expected"); message.deadLetterPolicy = $root.google.pubsub.v1.DeadLetterPolicy.fromObject(object.deadLetterPolicy, long + 1); } if (object.retryPolicy != null) { - if (typeof object.retryPolicy !== "object") + if (!$util.isObject(object.retryPolicy)) throw TypeError(".google.pubsub.v1.Subscription.retryPolicy: object expected"); message.retryPolicy = $root.google.pubsub.v1.RetryPolicy.fromObject(object.retryPolicy, long + 1); } @@ -14096,7 +14456,7 @@ if (object.enableExactlyOnceDelivery != null) message.enableExactlyOnceDelivery = Boolean(object.enableExactlyOnceDelivery); if (object.topicMessageRetentionDuration != null) { - if (typeof object.topicMessageRetentionDuration !== "object") + if (!$util.isObject(object.topicMessageRetentionDuration)) throw TypeError(".google.pubsub.v1.Subscription.topicMessageRetentionDuration: object expected"); message.topicMessageRetentionDuration = $root.google.protobuf.Duration.fromObject(object.topicMessageRetentionDuration, long + 1); } @@ -14121,7 +14481,7 @@ break; } if (object.analyticsHubSubscriptionInfo != null) { - if (typeof object.analyticsHubSubscriptionInfo !== "object") + if (!$util.isObject(object.analyticsHubSubscriptionInfo)) throw TypeError(".google.pubsub.v1.Subscription.analyticsHubSubscriptionInfo: object expected"); message.analyticsHubSubscriptionInfo = $root.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.fromObject(object.analyticsHubSubscriptionInfo, long + 1); } @@ -14130,13 +14490,13 @@ throw TypeError(".google.pubsub.v1.Subscription.messageTransforms: array expected"); message.messageTransforms = []; for (var i = 0; i < object.messageTransforms.length; ++i) { - if (typeof object.messageTransforms[i] !== "object") + if (!$util.isObject(object.messageTransforms[i])) throw TypeError(".google.pubsub.v1.Subscription.messageTransforms: object expected"); message.messageTransforms[i] = $root.google.pubsub.v1.MessageTransform.fromObject(object.messageTransforms[i], long + 1); } } if (object.tags) { - if (typeof object.tags !== "object") + if (!$util.isObject(object.tags)) throw TypeError(".google.pubsub.v1.Subscription.tags: object expected"); message.tags = {}; for (var keys = Object.keys(object.tags), i = 0; i < keys.length; ++i) { @@ -14157,9 +14517,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Subscription.toObject = function toObject(message, options) { + Subscription.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.messageTransforms = []; @@ -14188,18 +14552,18 @@ object.analyticsHubSubscriptionInfo = null; object.bigtableConfig = null; } - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) object.name = message.name; - if (message.topic != null && message.hasOwnProperty("topic")) + if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) object.topic = message.topic; - if (message.pushConfig != null && message.hasOwnProperty("pushConfig")) - object.pushConfig = $root.google.pubsub.v1.PushConfig.toObject(message.pushConfig, options); - if (message.ackDeadlineSeconds != null && message.hasOwnProperty("ackDeadlineSeconds")) + if (message.pushConfig != null && Object.hasOwnProperty.call(message, "pushConfig")) + object.pushConfig = $root.google.pubsub.v1.PushConfig.toObject(message.pushConfig, options, q + 1); + if (message.ackDeadlineSeconds != null && Object.hasOwnProperty.call(message, "ackDeadlineSeconds")) object.ackDeadlineSeconds = message.ackDeadlineSeconds; - if (message.retainAckedMessages != null && message.hasOwnProperty("retainAckedMessages")) + if (message.retainAckedMessages != null && Object.hasOwnProperty.call(message, "retainAckedMessages")) object.retainAckedMessages = message.retainAckedMessages; - if (message.messageRetentionDuration != null && message.hasOwnProperty("messageRetentionDuration")) - object.messageRetentionDuration = $root.google.protobuf.Duration.toObject(message.messageRetentionDuration, options); + if (message.messageRetentionDuration != null && Object.hasOwnProperty.call(message, "messageRetentionDuration")) + object.messageRetentionDuration = $root.google.protobuf.Duration.toObject(message.messageRetentionDuration, options, q + 1); var keys2; if (message.labels && (keys2 = Object.keys(message.labels)).length) { object.labels = {}; @@ -14209,34 +14573,34 @@ object.labels[keys2[j]] = message.labels[keys2[j]]; } } - if (message.enableMessageOrdering != null && message.hasOwnProperty("enableMessageOrdering")) + if (message.enableMessageOrdering != null && Object.hasOwnProperty.call(message, "enableMessageOrdering")) object.enableMessageOrdering = message.enableMessageOrdering; - if (message.expirationPolicy != null && message.hasOwnProperty("expirationPolicy")) - object.expirationPolicy = $root.google.pubsub.v1.ExpirationPolicy.toObject(message.expirationPolicy, options); - if (message.filter != null && message.hasOwnProperty("filter")) + if (message.expirationPolicy != null && Object.hasOwnProperty.call(message, "expirationPolicy")) + object.expirationPolicy = $root.google.pubsub.v1.ExpirationPolicy.toObject(message.expirationPolicy, options, q + 1); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) object.filter = message.filter; - if (message.deadLetterPolicy != null && message.hasOwnProperty("deadLetterPolicy")) - object.deadLetterPolicy = $root.google.pubsub.v1.DeadLetterPolicy.toObject(message.deadLetterPolicy, options); - if (message.retryPolicy != null && message.hasOwnProperty("retryPolicy")) - object.retryPolicy = $root.google.pubsub.v1.RetryPolicy.toObject(message.retryPolicy, options); - if (message.detached != null && message.hasOwnProperty("detached")) + if (message.deadLetterPolicy != null && Object.hasOwnProperty.call(message, "deadLetterPolicy")) + object.deadLetterPolicy = $root.google.pubsub.v1.DeadLetterPolicy.toObject(message.deadLetterPolicy, options, q + 1); + if (message.retryPolicy != null && Object.hasOwnProperty.call(message, "retryPolicy")) + object.retryPolicy = $root.google.pubsub.v1.RetryPolicy.toObject(message.retryPolicy, options, q + 1); + if (message.detached != null && Object.hasOwnProperty.call(message, "detached")) object.detached = message.detached; - if (message.enableExactlyOnceDelivery != null && message.hasOwnProperty("enableExactlyOnceDelivery")) + if (message.enableExactlyOnceDelivery != null && Object.hasOwnProperty.call(message, "enableExactlyOnceDelivery")) object.enableExactlyOnceDelivery = message.enableExactlyOnceDelivery; - if (message.topicMessageRetentionDuration != null && message.hasOwnProperty("topicMessageRetentionDuration")) - object.topicMessageRetentionDuration = $root.google.protobuf.Duration.toObject(message.topicMessageRetentionDuration, options); - if (message.bigqueryConfig != null && message.hasOwnProperty("bigqueryConfig")) - object.bigqueryConfig = $root.google.pubsub.v1.BigQueryConfig.toObject(message.bigqueryConfig, options); - if (message.state != null && message.hasOwnProperty("state")) + if (message.topicMessageRetentionDuration != null && Object.hasOwnProperty.call(message, "topicMessageRetentionDuration")) + object.topicMessageRetentionDuration = $root.google.protobuf.Duration.toObject(message.topicMessageRetentionDuration, options, q + 1); + if (message.bigqueryConfig != null && Object.hasOwnProperty.call(message, "bigqueryConfig")) + object.bigqueryConfig = $root.google.pubsub.v1.BigQueryConfig.toObject(message.bigqueryConfig, options, q + 1); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) object.state = options.enums === String ? $root.google.pubsub.v1.Subscription.State[message.state] === undefined ? message.state : $root.google.pubsub.v1.Subscription.State[message.state] : message.state; - if (message.cloudStorageConfig != null && message.hasOwnProperty("cloudStorageConfig")) - object.cloudStorageConfig = $root.google.pubsub.v1.CloudStorageConfig.toObject(message.cloudStorageConfig, options); - if (message.analyticsHubSubscriptionInfo != null && message.hasOwnProperty("analyticsHubSubscriptionInfo")) - object.analyticsHubSubscriptionInfo = $root.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.toObject(message.analyticsHubSubscriptionInfo, options); + if (message.cloudStorageConfig != null && Object.hasOwnProperty.call(message, "cloudStorageConfig")) + object.cloudStorageConfig = $root.google.pubsub.v1.CloudStorageConfig.toObject(message.cloudStorageConfig, options, q + 1); + if (message.analyticsHubSubscriptionInfo != null && Object.hasOwnProperty.call(message, "analyticsHubSubscriptionInfo")) + object.analyticsHubSubscriptionInfo = $root.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo.toObject(message.analyticsHubSubscriptionInfo, options, q + 1); if (message.messageTransforms && message.messageTransforms.length) { object.messageTransforms = []; for (var j = 0; j < message.messageTransforms.length; ++j) - object.messageTransforms[j] = $root.google.pubsub.v1.MessageTransform.toObject(message.messageTransforms[j], options); + object.messageTransforms[j] = $root.google.pubsub.v1.MessageTransform.toObject(message.messageTransforms[j], options, q + 1); } if (message.tags && (keys2 = Object.keys(message.tags)).length) { object.tags = {}; @@ -14246,8 +14610,8 @@ object.tags[keys2[j]] = message.tags[keys2[j]]; } } - if (message.bigtableConfig != null && message.hasOwnProperty("bigtableConfig")) - object.bigtableConfig = $root.google.pubsub.v1.BigtableConfig.toObject(message.bigtableConfig, options); + if (message.bigtableConfig != null && Object.hasOwnProperty.call(message, "bigtableConfig")) + object.bigtableConfig = $root.google.pubsub.v1.BigtableConfig.toObject(message.bigtableConfig, options, q + 1); return object; }; @@ -14355,9 +14719,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnalyticsHubSubscriptionInfo.encode = function encode(message, writer) { + AnalyticsHubSubscriptionInfo.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.listing != null && Object.hasOwnProperty.call(message, "listing")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.listing); if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) @@ -14375,7 +14743,7 @@ * @returns {$protobuf.Writer} Writer */ AnalyticsHubSubscriptionInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -14449,10 +14817,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.listing != null && message.hasOwnProperty("listing")) + if (message.listing != null && Object.hasOwnProperty.call(message, "listing")) if (!$util.isString(message.listing)) return "listing: string expected"; - if (message.subscription != null && message.hasOwnProperty("subscription")) + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) if (!$util.isString(message.subscription)) return "subscription: string expected"; return null; @@ -14469,6 +14837,8 @@ AnalyticsHubSubscriptionInfo.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -14490,17 +14860,21 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AnalyticsHubSubscriptionInfo.toObject = function toObject(message, options) { + AnalyticsHubSubscriptionInfo.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.listing = ""; object.subscription = ""; } - if (message.listing != null && message.hasOwnProperty("listing")) + if (message.listing != null && Object.hasOwnProperty.call(message, "listing")) object.listing = message.listing; - if (message.subscription != null && message.hasOwnProperty("subscription")) + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) object.subscription = message.subscription; return object; }; @@ -14599,13 +14973,17 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RetryPolicy.encode = function encode(message, writer) { + RetryPolicy.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.minimumBackoff != null && Object.hasOwnProperty.call(message, "minimumBackoff")) - $root.google.protobuf.Duration.encode(message.minimumBackoff, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.protobuf.Duration.encode(message.minimumBackoff, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); if (message.maximumBackoff != null && Object.hasOwnProperty.call(message, "maximumBackoff")) - $root.google.protobuf.Duration.encode(message.maximumBackoff, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.protobuf.Duration.encode(message.maximumBackoff, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); return writer; }; @@ -14619,7 +14997,7 @@ * @returns {$protobuf.Writer} Writer */ RetryPolicy.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -14693,12 +15071,12 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.minimumBackoff != null && message.hasOwnProperty("minimumBackoff")) { + if (message.minimumBackoff != null && Object.hasOwnProperty.call(message, "minimumBackoff")) { var error = $root.google.protobuf.Duration.verify(message.minimumBackoff, long + 1); if (error) return "minimumBackoff." + error; } - if (message.maximumBackoff != null && message.hasOwnProperty("maximumBackoff")) { + if (message.maximumBackoff != null && Object.hasOwnProperty.call(message, "maximumBackoff")) { var error = $root.google.protobuf.Duration.verify(message.maximumBackoff, long + 1); if (error) return "maximumBackoff." + error; @@ -14717,18 +15095,20 @@ RetryPolicy.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.RetryPolicy) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.RetryPolicy: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) throw Error("maximum nesting depth exceeded"); var message = new $root.google.pubsub.v1.RetryPolicy(); if (object.minimumBackoff != null) { - if (typeof object.minimumBackoff !== "object") + if (!$util.isObject(object.minimumBackoff)) throw TypeError(".google.pubsub.v1.RetryPolicy.minimumBackoff: object expected"); message.minimumBackoff = $root.google.protobuf.Duration.fromObject(object.minimumBackoff, long + 1); } if (object.maximumBackoff != null) { - if (typeof object.maximumBackoff !== "object") + if (!$util.isObject(object.maximumBackoff)) throw TypeError(".google.pubsub.v1.RetryPolicy.maximumBackoff: object expected"); message.maximumBackoff = $root.google.protobuf.Duration.fromObject(object.maximumBackoff, long + 1); } @@ -14744,18 +15124,22 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RetryPolicy.toObject = function toObject(message, options) { + RetryPolicy.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.minimumBackoff = null; object.maximumBackoff = null; } - if (message.minimumBackoff != null && message.hasOwnProperty("minimumBackoff")) - object.minimumBackoff = $root.google.protobuf.Duration.toObject(message.minimumBackoff, options); - if (message.maximumBackoff != null && message.hasOwnProperty("maximumBackoff")) - object.maximumBackoff = $root.google.protobuf.Duration.toObject(message.maximumBackoff, options); + if (message.minimumBackoff != null && Object.hasOwnProperty.call(message, "minimumBackoff")) + object.minimumBackoff = $root.google.protobuf.Duration.toObject(message.minimumBackoff, options, q + 1); + if (message.maximumBackoff != null && Object.hasOwnProperty.call(message, "maximumBackoff")) + object.maximumBackoff = $root.google.protobuf.Duration.toObject(message.maximumBackoff, options, q + 1); return object; }; @@ -14850,9 +15234,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeadLetterPolicy.encode = function encode(message, writer) { + DeadLetterPolicy.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.deadLetterTopic != null && Object.hasOwnProperty.call(message, "deadLetterTopic")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.deadLetterTopic); if (message.maxDeliveryAttempts != null && Object.hasOwnProperty.call(message, "maxDeliveryAttempts")) @@ -14870,7 +15258,7 @@ * @returns {$protobuf.Writer} Writer */ DeadLetterPolicy.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -14944,10 +15332,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.deadLetterTopic != null && message.hasOwnProperty("deadLetterTopic")) + if (message.deadLetterTopic != null && Object.hasOwnProperty.call(message, "deadLetterTopic")) if (!$util.isString(message.deadLetterTopic)) return "deadLetterTopic: string expected"; - if (message.maxDeliveryAttempts != null && message.hasOwnProperty("maxDeliveryAttempts")) + if (message.maxDeliveryAttempts != null && Object.hasOwnProperty.call(message, "maxDeliveryAttempts")) if (!$util.isInteger(message.maxDeliveryAttempts)) return "maxDeliveryAttempts: integer expected"; return null; @@ -14964,6 +15352,8 @@ DeadLetterPolicy.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.DeadLetterPolicy) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.DeadLetterPolicy: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -14985,17 +15375,21 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DeadLetterPolicy.toObject = function toObject(message, options) { + DeadLetterPolicy.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.deadLetterTopic = ""; object.maxDeliveryAttempts = 0; } - if (message.deadLetterTopic != null && message.hasOwnProperty("deadLetterTopic")) + if (message.deadLetterTopic != null && Object.hasOwnProperty.call(message, "deadLetterTopic")) object.deadLetterTopic = message.deadLetterTopic; - if (message.maxDeliveryAttempts != null && message.hasOwnProperty("maxDeliveryAttempts")) + if (message.maxDeliveryAttempts != null && Object.hasOwnProperty.call(message, "maxDeliveryAttempts")) object.maxDeliveryAttempts = message.maxDeliveryAttempts; return object; }; @@ -15082,11 +15476,15 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExpirationPolicy.encode = function encode(message, writer) { + ExpirationPolicy.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.ttl != null && Object.hasOwnProperty.call(message, "ttl")) - $root.google.protobuf.Duration.encode(message.ttl, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.protobuf.Duration.encode(message.ttl, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); return writer; }; @@ -15100,7 +15498,7 @@ * @returns {$protobuf.Writer} Writer */ ExpirationPolicy.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -15170,7 +15568,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.ttl != null && message.hasOwnProperty("ttl")) { + if (message.ttl != null && Object.hasOwnProperty.call(message, "ttl")) { var error = $root.google.protobuf.Duration.verify(message.ttl, long + 1); if (error) return "ttl." + error; @@ -15189,13 +15587,15 @@ ExpirationPolicy.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.ExpirationPolicy) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.ExpirationPolicy: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) throw Error("maximum nesting depth exceeded"); var message = new $root.google.pubsub.v1.ExpirationPolicy(); if (object.ttl != null) { - if (typeof object.ttl !== "object") + if (!$util.isObject(object.ttl)) throw TypeError(".google.pubsub.v1.ExpirationPolicy.ttl: object expected"); message.ttl = $root.google.protobuf.Duration.fromObject(object.ttl, long + 1); } @@ -15211,14 +15611,18 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ExpirationPolicy.toObject = function toObject(message, options) { + ExpirationPolicy.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) object.ttl = null; - if (message.ttl != null && message.hasOwnProperty("ttl")) - object.ttl = $root.google.protobuf.Duration.toObject(message.ttl, options); + if (message.ttl != null && Object.hasOwnProperty.call(message, "ttl")) + object.ttl = $root.google.protobuf.Duration.toObject(message.ttl, options, q + 1); return object; }; @@ -15366,20 +15770,24 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PushConfig.encode = function encode(message, writer) { + PushConfig.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.pushEndpoint != null && Object.hasOwnProperty.call(message, "pushEndpoint")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.pushEndpoint); if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) for (var keys = Object.keys(message.attributes), i = 0; i < keys.length; ++i) writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.attributes[keys[i]]).ldelim(); if (message.oidcToken != null && Object.hasOwnProperty.call(message, "oidcToken")) - $root.google.pubsub.v1.PushConfig.OidcToken.encode(message.oidcToken, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + $root.google.pubsub.v1.PushConfig.OidcToken.encode(message.oidcToken, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); if (message.pubsubWrapper != null && Object.hasOwnProperty.call(message, "pubsubWrapper")) - $root.google.pubsub.v1.PushConfig.PubsubWrapper.encode(message.pubsubWrapper, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + $root.google.pubsub.v1.PushConfig.PubsubWrapper.encode(message.pubsubWrapper, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); if (message.noWrapper != null && Object.hasOwnProperty.call(message, "noWrapper")) - $root.google.pubsub.v1.PushConfig.NoWrapper.encode(message.noWrapper, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + $root.google.pubsub.v1.PushConfig.NoWrapper.encode(message.noWrapper, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); return writer; }; @@ -15393,7 +15801,7 @@ * @returns {$protobuf.Writer} Writer */ PushConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -15501,10 +15909,10 @@ if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; var properties = {}; - if (message.pushEndpoint != null && message.hasOwnProperty("pushEndpoint")) + if (message.pushEndpoint != null && Object.hasOwnProperty.call(message, "pushEndpoint")) if (!$util.isString(message.pushEndpoint)) return "pushEndpoint: string expected"; - if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (message.attributes != null && Object.hasOwnProperty.call(message, "attributes")) { if (!$util.isObject(message.attributes)) return "attributes: object expected"; var key = Object.keys(message.attributes); @@ -15512,7 +15920,7 @@ if (!$util.isString(message.attributes[key[i]])) return "attributes: string{k:string} expected"; } - if (message.oidcToken != null && message.hasOwnProperty("oidcToken")) { + if (message.oidcToken != null && Object.hasOwnProperty.call(message, "oidcToken")) { properties.authenticationMethod = 1; { var error = $root.google.pubsub.v1.PushConfig.OidcToken.verify(message.oidcToken, long + 1); @@ -15520,7 +15928,7 @@ return "oidcToken." + error; } } - if (message.pubsubWrapper != null && message.hasOwnProperty("pubsubWrapper")) { + if (message.pubsubWrapper != null && Object.hasOwnProperty.call(message, "pubsubWrapper")) { properties.wrapper = 1; { var error = $root.google.pubsub.v1.PushConfig.PubsubWrapper.verify(message.pubsubWrapper, long + 1); @@ -15528,7 +15936,7 @@ return "pubsubWrapper." + error; } } - if (message.noWrapper != null && message.hasOwnProperty("noWrapper")) { + if (message.noWrapper != null && Object.hasOwnProperty.call(message, "noWrapper")) { if (properties.wrapper === 1) return "wrapper: multiple values"; properties.wrapper = 1; @@ -15552,6 +15960,8 @@ PushConfig.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.PushConfig) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.PushConfig: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -15560,7 +15970,7 @@ if (object.pushEndpoint != null) message.pushEndpoint = String(object.pushEndpoint); if (object.attributes) { - if (typeof object.attributes !== "object") + if (!$util.isObject(object.attributes)) throw TypeError(".google.pubsub.v1.PushConfig.attributes: object expected"); message.attributes = {}; for (var keys = Object.keys(object.attributes), i = 0; i < keys.length; ++i) { @@ -15570,17 +15980,17 @@ } } if (object.oidcToken != null) { - if (typeof object.oidcToken !== "object") + if (!$util.isObject(object.oidcToken)) throw TypeError(".google.pubsub.v1.PushConfig.oidcToken: object expected"); message.oidcToken = $root.google.pubsub.v1.PushConfig.OidcToken.fromObject(object.oidcToken, long + 1); } if (object.pubsubWrapper != null) { - if (typeof object.pubsubWrapper !== "object") + if (!$util.isObject(object.pubsubWrapper)) throw TypeError(".google.pubsub.v1.PushConfig.pubsubWrapper: object expected"); message.pubsubWrapper = $root.google.pubsub.v1.PushConfig.PubsubWrapper.fromObject(object.pubsubWrapper, long + 1); } if (object.noWrapper != null) { - if (typeof object.noWrapper !== "object") + if (!$util.isObject(object.noWrapper)) throw TypeError(".google.pubsub.v1.PushConfig.noWrapper: object expected"); message.noWrapper = $root.google.pubsub.v1.PushConfig.NoWrapper.fromObject(object.noWrapper, long + 1); } @@ -15596,15 +16006,19 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PushConfig.toObject = function toObject(message, options) { + PushConfig.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.objects || options.defaults) object.attributes = {}; if (options.defaults) object.pushEndpoint = ""; - if (message.pushEndpoint != null && message.hasOwnProperty("pushEndpoint")) + if (message.pushEndpoint != null && Object.hasOwnProperty.call(message, "pushEndpoint")) object.pushEndpoint = message.pushEndpoint; var keys2; if (message.attributes && (keys2 = Object.keys(message.attributes)).length) { @@ -15615,18 +16029,18 @@ object.attributes[keys2[j]] = message.attributes[keys2[j]]; } } - if (message.oidcToken != null && message.hasOwnProperty("oidcToken")) { - object.oidcToken = $root.google.pubsub.v1.PushConfig.OidcToken.toObject(message.oidcToken, options); + if (message.oidcToken != null && Object.hasOwnProperty.call(message, "oidcToken")) { + object.oidcToken = $root.google.pubsub.v1.PushConfig.OidcToken.toObject(message.oidcToken, options, q + 1); if (options.oneofs) object.authenticationMethod = "oidcToken"; } - if (message.pubsubWrapper != null && message.hasOwnProperty("pubsubWrapper")) { - object.pubsubWrapper = $root.google.pubsub.v1.PushConfig.PubsubWrapper.toObject(message.pubsubWrapper, options); + if (message.pubsubWrapper != null && Object.hasOwnProperty.call(message, "pubsubWrapper")) { + object.pubsubWrapper = $root.google.pubsub.v1.PushConfig.PubsubWrapper.toObject(message.pubsubWrapper, options, q + 1); if (options.oneofs) object.wrapper = "pubsubWrapper"; } - if (message.noWrapper != null && message.hasOwnProperty("noWrapper")) { - object.noWrapper = $root.google.pubsub.v1.PushConfig.NoWrapper.toObject(message.noWrapper, options); + if (message.noWrapper != null && Object.hasOwnProperty.call(message, "noWrapper")) { + object.noWrapper = $root.google.pubsub.v1.PushConfig.NoWrapper.toObject(message.noWrapper, options, q + 1); if (options.oneofs) object.wrapper = "noWrapper"; } @@ -15721,9 +16135,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OidcToken.encode = function encode(message, writer) { + OidcToken.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.serviceAccountEmail != null && Object.hasOwnProperty.call(message, "serviceAccountEmail")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.serviceAccountEmail); if (message.audience != null && Object.hasOwnProperty.call(message, "audience")) @@ -15741,7 +16159,7 @@ * @returns {$protobuf.Writer} Writer */ OidcToken.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -15815,10 +16233,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + if (message.serviceAccountEmail != null && Object.hasOwnProperty.call(message, "serviceAccountEmail")) if (!$util.isString(message.serviceAccountEmail)) return "serviceAccountEmail: string expected"; - if (message.audience != null && message.hasOwnProperty("audience")) + if (message.audience != null && Object.hasOwnProperty.call(message, "audience")) if (!$util.isString(message.audience)) return "audience: string expected"; return null; @@ -15835,6 +16253,8 @@ OidcToken.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.PushConfig.OidcToken) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.PushConfig.OidcToken: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -15856,17 +16276,21 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - OidcToken.toObject = function toObject(message, options) { + OidcToken.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.serviceAccountEmail = ""; object.audience = ""; } - if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + if (message.serviceAccountEmail != null && Object.hasOwnProperty.call(message, "serviceAccountEmail")) object.serviceAccountEmail = message.serviceAccountEmail; - if (message.audience != null && message.hasOwnProperty("audience")) + if (message.audience != null && Object.hasOwnProperty.call(message, "audience")) object.audience = message.audience; return object; }; @@ -15944,9 +16368,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PubsubWrapper.encode = function encode(message, writer) { + PubsubWrapper.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); return writer; }; @@ -15960,7 +16388,7 @@ * @returns {$protobuf.Writer} Writer */ PubsubWrapper.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -16040,10 +16468,6 @@ PubsubWrapper.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.PushConfig.PubsubWrapper) return object; - if (long === undefined) - long = 0; - if (long > $util.recursionLimit) - throw Error("maximum nesting depth exceeded"); return new $root.google.pubsub.v1.PushConfig.PubsubWrapper(); }; @@ -16142,9 +16566,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - NoWrapper.encode = function encode(message, writer) { + NoWrapper.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.writeMetadata != null && Object.hasOwnProperty.call(message, "writeMetadata")) writer.uint32(/* id 1, wireType 0 =*/8).bool(message.writeMetadata); return writer; @@ -16160,7 +16588,7 @@ * @returns {$protobuf.Writer} Writer */ NoWrapper.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -16230,7 +16658,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.writeMetadata != null && message.hasOwnProperty("writeMetadata")) + if (message.writeMetadata != null && Object.hasOwnProperty.call(message, "writeMetadata")) if (typeof message.writeMetadata !== "boolean") return "writeMetadata: boolean expected"; return null; @@ -16247,6 +16675,8 @@ NoWrapper.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.PushConfig.NoWrapper) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.PushConfig.NoWrapper: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -16266,13 +16696,17 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - NoWrapper.toObject = function toObject(message, options) { + NoWrapper.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) object.writeMetadata = false; - if (message.writeMetadata != null && message.hasOwnProperty("writeMetadata")) + if (message.writeMetadata != null && Object.hasOwnProperty.call(message, "writeMetadata")) object.writeMetadata = message.writeMetadata; return object; }; @@ -16416,9 +16850,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BigQueryConfig.encode = function encode(message, writer) { + BigQueryConfig.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.table != null && Object.hasOwnProperty.call(message, "table")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.table); if (message.useTopicSchema != null && Object.hasOwnProperty.call(message, "useTopicSchema")) @@ -16446,7 +16884,7 @@ * @returns {$protobuf.Writer} Writer */ BigQueryConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -16540,19 +16978,19 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.table != null && message.hasOwnProperty("table")) + if (message.table != null && Object.hasOwnProperty.call(message, "table")) if (!$util.isString(message.table)) return "table: string expected"; - if (message.useTopicSchema != null && message.hasOwnProperty("useTopicSchema")) + if (message.useTopicSchema != null && Object.hasOwnProperty.call(message, "useTopicSchema")) if (typeof message.useTopicSchema !== "boolean") return "useTopicSchema: boolean expected"; - if (message.writeMetadata != null && message.hasOwnProperty("writeMetadata")) + if (message.writeMetadata != null && Object.hasOwnProperty.call(message, "writeMetadata")) if (typeof message.writeMetadata !== "boolean") return "writeMetadata: boolean expected"; - if (message.dropUnknownFields != null && message.hasOwnProperty("dropUnknownFields")) + if (message.dropUnknownFields != null && Object.hasOwnProperty.call(message, "dropUnknownFields")) if (typeof message.dropUnknownFields !== "boolean") return "dropUnknownFields: boolean expected"; - if (message.state != null && message.hasOwnProperty("state")) + if (message.state != null && Object.hasOwnProperty.call(message, "state")) switch (message.state) { default: return "state: enum value expected"; @@ -16565,10 +17003,10 @@ case 6: break; } - if (message.useTableSchema != null && message.hasOwnProperty("useTableSchema")) + if (message.useTableSchema != null && Object.hasOwnProperty.call(message, "useTableSchema")) if (typeof message.useTableSchema !== "boolean") return "useTableSchema: boolean expected"; - if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + if (message.serviceAccountEmail != null && Object.hasOwnProperty.call(message, "serviceAccountEmail")) if (!$util.isString(message.serviceAccountEmail)) return "serviceAccountEmail: string expected"; return null; @@ -16585,6 +17023,8 @@ BigQueryConfig.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.BigQueryConfig) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.BigQueryConfig: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -16650,9 +17090,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BigQueryConfig.toObject = function toObject(message, options) { + BigQueryConfig.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.table = ""; @@ -16663,19 +17107,19 @@ object.useTableSchema = false; object.serviceAccountEmail = ""; } - if (message.table != null && message.hasOwnProperty("table")) + if (message.table != null && Object.hasOwnProperty.call(message, "table")) object.table = message.table; - if (message.useTopicSchema != null && message.hasOwnProperty("useTopicSchema")) + if (message.useTopicSchema != null && Object.hasOwnProperty.call(message, "useTopicSchema")) object.useTopicSchema = message.useTopicSchema; - if (message.writeMetadata != null && message.hasOwnProperty("writeMetadata")) + if (message.writeMetadata != null && Object.hasOwnProperty.call(message, "writeMetadata")) object.writeMetadata = message.writeMetadata; - if (message.dropUnknownFields != null && message.hasOwnProperty("dropUnknownFields")) + if (message.dropUnknownFields != null && Object.hasOwnProperty.call(message, "dropUnknownFields")) object.dropUnknownFields = message.dropUnknownFields; - if (message.state != null && message.hasOwnProperty("state")) + if (message.state != null && Object.hasOwnProperty.call(message, "state")) object.state = options.enums === String ? $root.google.pubsub.v1.BigQueryConfig.State[message.state] === undefined ? message.state : $root.google.pubsub.v1.BigQueryConfig.State[message.state] : message.state; - if (message.useTableSchema != null && message.hasOwnProperty("useTableSchema")) + if (message.useTableSchema != null && Object.hasOwnProperty.call(message, "useTableSchema")) object.useTableSchema = message.useTableSchema; - if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + if (message.serviceAccountEmail != null && Object.hasOwnProperty.call(message, "serviceAccountEmail")) object.serviceAccountEmail = message.serviceAccountEmail; return object; }; @@ -16822,9 +17266,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BigtableConfig.encode = function encode(message, writer) { + BigtableConfig.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.table != null && Object.hasOwnProperty.call(message, "table")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.table); if (message.appProfileId != null && Object.hasOwnProperty.call(message, "appProfileId")) @@ -16848,7 +17296,7 @@ * @returns {$protobuf.Writer} Writer */ BigtableConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -16934,19 +17382,19 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.table != null && message.hasOwnProperty("table")) + if (message.table != null && Object.hasOwnProperty.call(message, "table")) if (!$util.isString(message.table)) return "table: string expected"; - if (message.appProfileId != null && message.hasOwnProperty("appProfileId")) + if (message.appProfileId != null && Object.hasOwnProperty.call(message, "appProfileId")) if (!$util.isString(message.appProfileId)) return "appProfileId: string expected"; - if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + if (message.serviceAccountEmail != null && Object.hasOwnProperty.call(message, "serviceAccountEmail")) if (!$util.isString(message.serviceAccountEmail)) return "serviceAccountEmail: string expected"; - if (message.writeMetadata != null && message.hasOwnProperty("writeMetadata")) + if (message.writeMetadata != null && Object.hasOwnProperty.call(message, "writeMetadata")) if (typeof message.writeMetadata !== "boolean") return "writeMetadata: boolean expected"; - if (message.state != null && message.hasOwnProperty("state")) + if (message.state != null && Object.hasOwnProperty.call(message, "state")) switch (message.state) { default: return "state: enum value expected"; @@ -16974,6 +17422,8 @@ BigtableConfig.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.BigtableConfig) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.BigtableConfig: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -17039,9 +17489,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BigtableConfig.toObject = function toObject(message, options) { + BigtableConfig.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.table = ""; @@ -17050,15 +17504,15 @@ object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; object.writeMetadata = false; } - if (message.table != null && message.hasOwnProperty("table")) + if (message.table != null && Object.hasOwnProperty.call(message, "table")) object.table = message.table; - if (message.appProfileId != null && message.hasOwnProperty("appProfileId")) + if (message.appProfileId != null && Object.hasOwnProperty.call(message, "appProfileId")) object.appProfileId = message.appProfileId; - if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + if (message.serviceAccountEmail != null && Object.hasOwnProperty.call(message, "serviceAccountEmail")) object.serviceAccountEmail = message.serviceAccountEmail; - if (message.state != null && message.hasOwnProperty("state")) + if (message.state != null && Object.hasOwnProperty.call(message, "state")) object.state = options.enums === String ? $root.google.pubsub.v1.BigtableConfig.State[message.state] === undefined ? message.state : $root.google.pubsub.v1.BigtableConfig.State[message.state] : message.state; - if (message.writeMetadata != null && message.hasOwnProperty("writeMetadata")) + if (message.writeMetadata != null && Object.hasOwnProperty.call(message, "writeMetadata")) object.writeMetadata = message.writeMetadata; return object; }; @@ -17275,9 +17729,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CloudStorageConfig.encode = function encode(message, writer) { + CloudStorageConfig.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.bucket != null && Object.hasOwnProperty.call(message, "bucket")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.bucket); if (message.filenamePrefix != null && Object.hasOwnProperty.call(message, "filenamePrefix")) @@ -17285,11 +17743,11 @@ if (message.filenameSuffix != null && Object.hasOwnProperty.call(message, "filenameSuffix")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.filenameSuffix); if (message.textConfig != null && Object.hasOwnProperty.call(message, "textConfig")) - $root.google.pubsub.v1.CloudStorageConfig.TextConfig.encode(message.textConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + $root.google.pubsub.v1.CloudStorageConfig.TextConfig.encode(message.textConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); if (message.avroConfig != null && Object.hasOwnProperty.call(message, "avroConfig")) - $root.google.pubsub.v1.CloudStorageConfig.AvroConfig.encode(message.avroConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + $root.google.pubsub.v1.CloudStorageConfig.AvroConfig.encode(message.avroConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); if (message.maxDuration != null && Object.hasOwnProperty.call(message, "maxDuration")) - $root.google.protobuf.Duration.encode(message.maxDuration, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + $root.google.protobuf.Duration.encode(message.maxDuration, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); if (message.maxBytes != null && Object.hasOwnProperty.call(message, "maxBytes")) writer.uint32(/* id 7, wireType 0 =*/56).int64(message.maxBytes); if (message.maxMessages != null && Object.hasOwnProperty.call(message, "maxMessages")) @@ -17313,7 +17771,7 @@ * @returns {$protobuf.Writer} Writer */ CloudStorageConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -17424,19 +17882,19 @@ if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; var properties = {}; - if (message.bucket != null && message.hasOwnProperty("bucket")) + if (message.bucket != null && Object.hasOwnProperty.call(message, "bucket")) if (!$util.isString(message.bucket)) return "bucket: string expected"; - if (message.filenamePrefix != null && message.hasOwnProperty("filenamePrefix")) + if (message.filenamePrefix != null && Object.hasOwnProperty.call(message, "filenamePrefix")) if (!$util.isString(message.filenamePrefix)) return "filenamePrefix: string expected"; - if (message.filenameSuffix != null && message.hasOwnProperty("filenameSuffix")) + if (message.filenameSuffix != null && Object.hasOwnProperty.call(message, "filenameSuffix")) if (!$util.isString(message.filenameSuffix)) return "filenameSuffix: string expected"; - if (message.filenameDatetimeFormat != null && message.hasOwnProperty("filenameDatetimeFormat")) + if (message.filenameDatetimeFormat != null && Object.hasOwnProperty.call(message, "filenameDatetimeFormat")) if (!$util.isString(message.filenameDatetimeFormat)) return "filenameDatetimeFormat: string expected"; - if (message.textConfig != null && message.hasOwnProperty("textConfig")) { + if (message.textConfig != null && Object.hasOwnProperty.call(message, "textConfig")) { properties.outputFormat = 1; { var error = $root.google.pubsub.v1.CloudStorageConfig.TextConfig.verify(message.textConfig, long + 1); @@ -17444,7 +17902,7 @@ return "textConfig." + error; } } - if (message.avroConfig != null && message.hasOwnProperty("avroConfig")) { + if (message.avroConfig != null && Object.hasOwnProperty.call(message, "avroConfig")) { if (properties.outputFormat === 1) return "outputFormat: multiple values"; properties.outputFormat = 1; @@ -17454,18 +17912,18 @@ return "avroConfig." + error; } } - if (message.maxDuration != null && message.hasOwnProperty("maxDuration")) { + if (message.maxDuration != null && Object.hasOwnProperty.call(message, "maxDuration")) { var error = $root.google.protobuf.Duration.verify(message.maxDuration, long + 1); if (error) return "maxDuration." + error; } - if (message.maxBytes != null && message.hasOwnProperty("maxBytes")) + if (message.maxBytes != null && Object.hasOwnProperty.call(message, "maxBytes")) if (!$util.isInteger(message.maxBytes) && !(message.maxBytes && $util.isInteger(message.maxBytes.low) && $util.isInteger(message.maxBytes.high))) return "maxBytes: integer|Long expected"; - if (message.maxMessages != null && message.hasOwnProperty("maxMessages")) + if (message.maxMessages != null && Object.hasOwnProperty.call(message, "maxMessages")) if (!$util.isInteger(message.maxMessages) && !(message.maxMessages && $util.isInteger(message.maxMessages.low) && $util.isInteger(message.maxMessages.high))) return "maxMessages: integer|Long expected"; - if (message.state != null && message.hasOwnProperty("state")) + if (message.state != null && Object.hasOwnProperty.call(message, "state")) switch (message.state) { default: return "state: enum value expected"; @@ -17478,7 +17936,7 @@ case 6: break; } - if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + if (message.serviceAccountEmail != null && Object.hasOwnProperty.call(message, "serviceAccountEmail")) if (!$util.isString(message.serviceAccountEmail)) return "serviceAccountEmail: string expected"; return null; @@ -17495,6 +17953,8 @@ CloudStorageConfig.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.CloudStorageConfig) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.CloudStorageConfig: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -17509,23 +17969,23 @@ if (object.filenameDatetimeFormat != null) message.filenameDatetimeFormat = String(object.filenameDatetimeFormat); if (object.textConfig != null) { - if (typeof object.textConfig !== "object") + if (!$util.isObject(object.textConfig)) throw TypeError(".google.pubsub.v1.CloudStorageConfig.textConfig: object expected"); message.textConfig = $root.google.pubsub.v1.CloudStorageConfig.TextConfig.fromObject(object.textConfig, long + 1); } if (object.avroConfig != null) { - if (typeof object.avroConfig !== "object") + if (!$util.isObject(object.avroConfig)) throw TypeError(".google.pubsub.v1.CloudStorageConfig.avroConfig: object expected"); message.avroConfig = $root.google.pubsub.v1.CloudStorageConfig.AvroConfig.fromObject(object.avroConfig, long + 1); } if (object.maxDuration != null) { - if (typeof object.maxDuration !== "object") + if (!$util.isObject(object.maxDuration)) throw TypeError(".google.pubsub.v1.CloudStorageConfig.maxDuration: object expected"); message.maxDuration = $root.google.protobuf.Duration.fromObject(object.maxDuration, long + 1); } if (object.maxBytes != null) if ($util.Long) - (message.maxBytes = $util.Long.fromValue(object.maxBytes)).unsigned = false; + message.maxBytes = $util.Long.fromValue(object.maxBytes, false); else if (typeof object.maxBytes === "string") message.maxBytes = parseInt(object.maxBytes, 10); else if (typeof object.maxBytes === "number") @@ -17534,7 +17994,7 @@ message.maxBytes = new $util.LongBits(object.maxBytes.low >>> 0, object.maxBytes.high >>> 0).toNumber(); if (object.maxMessages != null) if ($util.Long) - (message.maxMessages = $util.Long.fromValue(object.maxMessages)).unsigned = false; + message.maxMessages = $util.Long.fromValue(object.maxMessages, false); else if (typeof object.maxMessages === "string") message.maxMessages = parseInt(object.maxMessages, 10); else if (typeof object.maxMessages === "number") @@ -17591,9 +18051,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CloudStorageConfig.toObject = function toObject(message, options) { + CloudStorageConfig.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.bucket = ""; @@ -17602,51 +18066,55 @@ object.maxDuration = null; if ($util.Long) { var long = new $util.Long(0, 0, false); - object.maxBytes = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + object.maxBytes = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; } else - object.maxBytes = options.longs === String ? "0" : 0; + object.maxBytes = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; if ($util.Long) { var long = new $util.Long(0, 0, false); - object.maxMessages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + object.maxMessages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; } else - object.maxMessages = options.longs === String ? "0" : 0; + object.maxMessages = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; object.filenameDatetimeFormat = ""; object.serviceAccountEmail = ""; } - if (message.bucket != null && message.hasOwnProperty("bucket")) + if (message.bucket != null && Object.hasOwnProperty.call(message, "bucket")) object.bucket = message.bucket; - if (message.filenamePrefix != null && message.hasOwnProperty("filenamePrefix")) + if (message.filenamePrefix != null && Object.hasOwnProperty.call(message, "filenamePrefix")) object.filenamePrefix = message.filenamePrefix; - if (message.filenameSuffix != null && message.hasOwnProperty("filenameSuffix")) + if (message.filenameSuffix != null && Object.hasOwnProperty.call(message, "filenameSuffix")) object.filenameSuffix = message.filenameSuffix; - if (message.textConfig != null && message.hasOwnProperty("textConfig")) { - object.textConfig = $root.google.pubsub.v1.CloudStorageConfig.TextConfig.toObject(message.textConfig, options); + if (message.textConfig != null && Object.hasOwnProperty.call(message, "textConfig")) { + object.textConfig = $root.google.pubsub.v1.CloudStorageConfig.TextConfig.toObject(message.textConfig, options, q + 1); if (options.oneofs) object.outputFormat = "textConfig"; } - if (message.avroConfig != null && message.hasOwnProperty("avroConfig")) { - object.avroConfig = $root.google.pubsub.v1.CloudStorageConfig.AvroConfig.toObject(message.avroConfig, options); + if (message.avroConfig != null && Object.hasOwnProperty.call(message, "avroConfig")) { + object.avroConfig = $root.google.pubsub.v1.CloudStorageConfig.AvroConfig.toObject(message.avroConfig, options, q + 1); if (options.oneofs) object.outputFormat = "avroConfig"; } - if (message.maxDuration != null && message.hasOwnProperty("maxDuration")) - object.maxDuration = $root.google.protobuf.Duration.toObject(message.maxDuration, options); - if (message.maxBytes != null && message.hasOwnProperty("maxBytes")) - if (typeof message.maxBytes === "number") + if (message.maxDuration != null && Object.hasOwnProperty.call(message, "maxDuration")) + object.maxDuration = $root.google.protobuf.Duration.toObject(message.maxDuration, options, q + 1); + if (message.maxBytes != null && Object.hasOwnProperty.call(message, "maxBytes")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.maxBytes = typeof message.maxBytes === "number" ? BigInt(message.maxBytes) : $util.Long.fromBits(message.maxBytes.low >>> 0, message.maxBytes.high >>> 0, false).toBigInt(); + else if (typeof message.maxBytes === "number") object.maxBytes = options.longs === String ? String(message.maxBytes) : message.maxBytes; else object.maxBytes = options.longs === String ? $util.Long.prototype.toString.call(message.maxBytes) : options.longs === Number ? new $util.LongBits(message.maxBytes.low >>> 0, message.maxBytes.high >>> 0).toNumber() : message.maxBytes; - if (message.maxMessages != null && message.hasOwnProperty("maxMessages")) - if (typeof message.maxMessages === "number") + if (message.maxMessages != null && Object.hasOwnProperty.call(message, "maxMessages")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.maxMessages = typeof message.maxMessages === "number" ? BigInt(message.maxMessages) : $util.Long.fromBits(message.maxMessages.low >>> 0, message.maxMessages.high >>> 0, false).toBigInt(); + else if (typeof message.maxMessages === "number") object.maxMessages = options.longs === String ? String(message.maxMessages) : message.maxMessages; else object.maxMessages = options.longs === String ? $util.Long.prototype.toString.call(message.maxMessages) : options.longs === Number ? new $util.LongBits(message.maxMessages.low >>> 0, message.maxMessages.high >>> 0).toNumber() : message.maxMessages; - if (message.state != null && message.hasOwnProperty("state")) + if (message.state != null && Object.hasOwnProperty.call(message, "state")) object.state = options.enums === String ? $root.google.pubsub.v1.CloudStorageConfig.State[message.state] === undefined ? message.state : $root.google.pubsub.v1.CloudStorageConfig.State[message.state] : message.state; - if (message.filenameDatetimeFormat != null && message.hasOwnProperty("filenameDatetimeFormat")) + if (message.filenameDatetimeFormat != null && Object.hasOwnProperty.call(message, "filenameDatetimeFormat")) object.filenameDatetimeFormat = message.filenameDatetimeFormat; - if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail")) + if (message.serviceAccountEmail != null && Object.hasOwnProperty.call(message, "serviceAccountEmail")) object.serviceAccountEmail = message.serviceAccountEmail; return object; }; @@ -17721,9 +18189,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - TextConfig.encode = function encode(message, writer) { + TextConfig.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); return writer; }; @@ -17737,7 +18209,7 @@ * @returns {$protobuf.Writer} Writer */ TextConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -17817,10 +18289,6 @@ TextConfig.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.CloudStorageConfig.TextConfig) return object; - if (long === undefined) - long = 0; - if (long > $util.recursionLimit) - throw Error("maximum nesting depth exceeded"); return new $root.google.pubsub.v1.CloudStorageConfig.TextConfig(); }; @@ -17928,9 +18396,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AvroConfig.encode = function encode(message, writer) { + AvroConfig.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.writeMetadata != null && Object.hasOwnProperty.call(message, "writeMetadata")) writer.uint32(/* id 1, wireType 0 =*/8).bool(message.writeMetadata); if (message.useTopicSchema != null && Object.hasOwnProperty.call(message, "useTopicSchema")) @@ -17948,7 +18420,7 @@ * @returns {$protobuf.Writer} Writer */ AvroConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -18022,10 +18494,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.writeMetadata != null && message.hasOwnProperty("writeMetadata")) + if (message.writeMetadata != null && Object.hasOwnProperty.call(message, "writeMetadata")) if (typeof message.writeMetadata !== "boolean") return "writeMetadata: boolean expected"; - if (message.useTopicSchema != null && message.hasOwnProperty("useTopicSchema")) + if (message.useTopicSchema != null && Object.hasOwnProperty.call(message, "useTopicSchema")) if (typeof message.useTopicSchema !== "boolean") return "useTopicSchema: boolean expected"; return null; @@ -18042,6 +18514,8 @@ AvroConfig.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.CloudStorageConfig.AvroConfig) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.CloudStorageConfig.AvroConfig: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -18063,17 +18537,21 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AvroConfig.toObject = function toObject(message, options) { + AvroConfig.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.writeMetadata = false; object.useTopicSchema = false; } - if (message.writeMetadata != null && message.hasOwnProperty("writeMetadata")) + if (message.writeMetadata != null && Object.hasOwnProperty.call(message, "writeMetadata")) object.writeMetadata = message.writeMetadata; - if (message.useTopicSchema != null && message.hasOwnProperty("useTopicSchema")) + if (message.useTopicSchema != null && Object.hasOwnProperty.call(message, "useTopicSchema")) object.useTopicSchema = message.useTopicSchema; return object; }; @@ -18205,13 +18683,17 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReceivedMessage.encode = function encode(message, writer) { + ReceivedMessage.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.ackId != null && Object.hasOwnProperty.call(message, "ackId")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.ackId); if (message.message != null && Object.hasOwnProperty.call(message, "message")) - $root.google.pubsub.v1.PubsubMessage.encode(message.message, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.pubsub.v1.PubsubMessage.encode(message.message, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); if (message.deliveryAttempt != null && Object.hasOwnProperty.call(message, "deliveryAttempt")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.deliveryAttempt); return writer; @@ -18227,7 +18709,7 @@ * @returns {$protobuf.Writer} Writer */ ReceivedMessage.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -18305,15 +18787,15 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.ackId != null && message.hasOwnProperty("ackId")) + if (message.ackId != null && Object.hasOwnProperty.call(message, "ackId")) if (!$util.isString(message.ackId)) return "ackId: string expected"; - if (message.message != null && message.hasOwnProperty("message")) { + if (message.message != null && Object.hasOwnProperty.call(message, "message")) { var error = $root.google.pubsub.v1.PubsubMessage.verify(message.message, long + 1); if (error) return "message." + error; } - if (message.deliveryAttempt != null && message.hasOwnProperty("deliveryAttempt")) + if (message.deliveryAttempt != null && Object.hasOwnProperty.call(message, "deliveryAttempt")) if (!$util.isInteger(message.deliveryAttempt)) return "deliveryAttempt: integer expected"; return null; @@ -18330,6 +18812,8 @@ ReceivedMessage.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.ReceivedMessage) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.ReceivedMessage: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -18338,7 +18822,7 @@ if (object.ackId != null) message.ackId = String(object.ackId); if (object.message != null) { - if (typeof object.message !== "object") + if (!$util.isObject(object.message)) throw TypeError(".google.pubsub.v1.ReceivedMessage.message: object expected"); message.message = $root.google.pubsub.v1.PubsubMessage.fromObject(object.message, long + 1); } @@ -18356,20 +18840,24 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ReceivedMessage.toObject = function toObject(message, options) { + ReceivedMessage.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.ackId = ""; object.message = null; object.deliveryAttempt = 0; } - if (message.ackId != null && message.hasOwnProperty("ackId")) + if (message.ackId != null && Object.hasOwnProperty.call(message, "ackId")) object.ackId = message.ackId; - if (message.message != null && message.hasOwnProperty("message")) - object.message = $root.google.pubsub.v1.PubsubMessage.toObject(message.message, options); - if (message.deliveryAttempt != null && message.hasOwnProperty("deliveryAttempt")) + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + object.message = $root.google.pubsub.v1.PubsubMessage.toObject(message.message, options, q + 1); + if (message.deliveryAttempt != null && Object.hasOwnProperty.call(message, "deliveryAttempt")) object.deliveryAttempt = message.deliveryAttempt; return object; }; @@ -18456,9 +18944,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetSubscriptionRequest.encode = function encode(message, writer) { + GetSubscriptionRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.subscription); return writer; @@ -18474,7 +18966,7 @@ * @returns {$protobuf.Writer} Writer */ GetSubscriptionRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -18544,7 +19036,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.subscription != null && message.hasOwnProperty("subscription")) + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) if (!$util.isString(message.subscription)) return "subscription: string expected"; return null; @@ -18561,6 +19053,8 @@ GetSubscriptionRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.GetSubscriptionRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.GetSubscriptionRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -18580,13 +19074,17 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetSubscriptionRequest.toObject = function toObject(message, options) { + GetSubscriptionRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) object.subscription = ""; - if (message.subscription != null && message.hasOwnProperty("subscription")) + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) object.subscription = message.subscription; return object; }; @@ -18682,13 +19180,17 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateSubscriptionRequest.encode = function encode(message, writer) { + UpdateSubscriptionRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) - $root.google.pubsub.v1.Subscription.encode(message.subscription, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.pubsub.v1.Subscription.encode(message.subscription, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); return writer; }; @@ -18702,7 +19204,7 @@ * @returns {$protobuf.Writer} Writer */ UpdateSubscriptionRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -18776,12 +19278,12 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.subscription != null && message.hasOwnProperty("subscription")) { + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) { var error = $root.google.pubsub.v1.Subscription.verify(message.subscription, long + 1); if (error) return "subscription." + error; } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) { var error = $root.google.protobuf.FieldMask.verify(message.updateMask, long + 1); if (error) return "updateMask." + error; @@ -18800,18 +19302,20 @@ UpdateSubscriptionRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.UpdateSubscriptionRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.UpdateSubscriptionRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) throw Error("maximum nesting depth exceeded"); var message = new $root.google.pubsub.v1.UpdateSubscriptionRequest(); if (object.subscription != null) { - if (typeof object.subscription !== "object") + if (!$util.isObject(object.subscription)) throw TypeError(".google.pubsub.v1.UpdateSubscriptionRequest.subscription: object expected"); message.subscription = $root.google.pubsub.v1.Subscription.fromObject(object.subscription, long + 1); } if (object.updateMask != null) { - if (typeof object.updateMask !== "object") + if (!$util.isObject(object.updateMask)) throw TypeError(".google.pubsub.v1.UpdateSubscriptionRequest.updateMask: object expected"); message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask, long + 1); } @@ -18827,18 +19331,22 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UpdateSubscriptionRequest.toObject = function toObject(message, options) { + UpdateSubscriptionRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.subscription = null; object.updateMask = null; } - if (message.subscription != null && message.hasOwnProperty("subscription")) - object.subscription = $root.google.pubsub.v1.Subscription.toObject(message.subscription, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) + object.subscription = $root.google.pubsub.v1.Subscription.toObject(message.subscription, options, q + 1); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options, q + 1); return object; }; @@ -18942,9 +19450,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListSubscriptionsRequest.encode = function encode(message, writer) { + ListSubscriptionsRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.project != null && Object.hasOwnProperty.call(message, "project")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.project); if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) @@ -18964,7 +19476,7 @@ * @returns {$protobuf.Writer} Writer */ ListSubscriptionsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -19042,13 +19554,13 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.project != null && message.hasOwnProperty("project")) + if (message.project != null && Object.hasOwnProperty.call(message, "project")) if (!$util.isString(message.project)) return "project: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) if (!$util.isInteger(message.pageSize)) return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) if (!$util.isString(message.pageToken)) return "pageToken: string expected"; return null; @@ -19065,6 +19577,8 @@ ListSubscriptionsRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.ListSubscriptionsRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.ListSubscriptionsRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -19088,20 +19602,24 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListSubscriptionsRequest.toObject = function toObject(message, options) { + ListSubscriptionsRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.project = ""; object.pageSize = 0; object.pageToken = ""; } - if (message.project != null && message.hasOwnProperty("project")) + if (message.project != null && Object.hasOwnProperty.call(message, "project")) object.project = message.project; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) object.pageToken = message.pageToken; return object; }; @@ -19198,12 +19716,16 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListSubscriptionsResponse.encode = function encode(message, writer) { + ListSubscriptionsResponse.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.subscriptions != null && message.subscriptions.length) for (var i = 0; i < message.subscriptions.length; ++i) - $root.google.pubsub.v1.Subscription.encode(message.subscriptions[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.pubsub.v1.Subscription.encode(message.subscriptions[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); return writer; @@ -19219,7 +19741,7 @@ * @returns {$protobuf.Writer} Writer */ ListSubscriptionsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -19295,7 +19817,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.subscriptions != null && message.hasOwnProperty("subscriptions")) { + if (message.subscriptions != null && Object.hasOwnProperty.call(message, "subscriptions")) { if (!Array.isArray(message.subscriptions)) return "subscriptions: array expected"; for (var i = 0; i < message.subscriptions.length; ++i) { @@ -19304,7 +19826,7 @@ return "subscriptions." + error; } } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) if (!$util.isString(message.nextPageToken)) return "nextPageToken: string expected"; return null; @@ -19321,6 +19843,8 @@ ListSubscriptionsResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.ListSubscriptionsResponse) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.ListSubscriptionsResponse: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -19331,7 +19855,7 @@ throw TypeError(".google.pubsub.v1.ListSubscriptionsResponse.subscriptions: array expected"); message.subscriptions = []; for (var i = 0; i < object.subscriptions.length; ++i) { - if (typeof object.subscriptions[i] !== "object") + if (!$util.isObject(object.subscriptions[i])) throw TypeError(".google.pubsub.v1.ListSubscriptionsResponse.subscriptions: object expected"); message.subscriptions[i] = $root.google.pubsub.v1.Subscription.fromObject(object.subscriptions[i], long + 1); } @@ -19350,9 +19874,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListSubscriptionsResponse.toObject = function toObject(message, options) { + ListSubscriptionsResponse.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.subscriptions = []; @@ -19361,9 +19889,9 @@ if (message.subscriptions && message.subscriptions.length) { object.subscriptions = []; for (var j = 0; j < message.subscriptions.length; ++j) - object.subscriptions[j] = $root.google.pubsub.v1.Subscription.toObject(message.subscriptions[j], options); + object.subscriptions[j] = $root.google.pubsub.v1.Subscription.toObject(message.subscriptions[j], options, q + 1); } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) object.nextPageToken = message.nextPageToken; return object; }; @@ -19450,9 +19978,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteSubscriptionRequest.encode = function encode(message, writer) { + DeleteSubscriptionRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.subscription); return writer; @@ -19468,7 +20000,7 @@ * @returns {$protobuf.Writer} Writer */ DeleteSubscriptionRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -19538,7 +20070,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.subscription != null && message.hasOwnProperty("subscription")) + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) if (!$util.isString(message.subscription)) return "subscription: string expected"; return null; @@ -19555,6 +20087,8 @@ DeleteSubscriptionRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.DeleteSubscriptionRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.DeleteSubscriptionRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -19574,13 +20108,17 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DeleteSubscriptionRequest.toObject = function toObject(message, options) { + DeleteSubscriptionRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) object.subscription = ""; - if (message.subscription != null && message.hasOwnProperty("subscription")) + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) object.subscription = message.subscription; return object; }; @@ -19676,13 +20214,17 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ModifyPushConfigRequest.encode = function encode(message, writer) { + ModifyPushConfigRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.subscription); if (message.pushConfig != null && Object.hasOwnProperty.call(message, "pushConfig")) - $root.google.pubsub.v1.PushConfig.encode(message.pushConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.pubsub.v1.PushConfig.encode(message.pushConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); return writer; }; @@ -19696,7 +20238,7 @@ * @returns {$protobuf.Writer} Writer */ ModifyPushConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -19770,10 +20312,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.subscription != null && message.hasOwnProperty("subscription")) + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) if (!$util.isString(message.subscription)) return "subscription: string expected"; - if (message.pushConfig != null && message.hasOwnProperty("pushConfig")) { + if (message.pushConfig != null && Object.hasOwnProperty.call(message, "pushConfig")) { var error = $root.google.pubsub.v1.PushConfig.verify(message.pushConfig, long + 1); if (error) return "pushConfig." + error; @@ -19792,6 +20334,8 @@ ModifyPushConfigRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.ModifyPushConfigRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.ModifyPushConfigRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -19800,7 +20344,7 @@ if (object.subscription != null) message.subscription = String(object.subscription); if (object.pushConfig != null) { - if (typeof object.pushConfig !== "object") + if (!$util.isObject(object.pushConfig)) throw TypeError(".google.pubsub.v1.ModifyPushConfigRequest.pushConfig: object expected"); message.pushConfig = $root.google.pubsub.v1.PushConfig.fromObject(object.pushConfig, long + 1); } @@ -19816,18 +20360,22 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ModifyPushConfigRequest.toObject = function toObject(message, options) { + ModifyPushConfigRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.subscription = ""; object.pushConfig = null; } - if (message.subscription != null && message.hasOwnProperty("subscription")) + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) object.subscription = message.subscription; - if (message.pushConfig != null && message.hasOwnProperty("pushConfig")) - object.pushConfig = $root.google.pubsub.v1.PushConfig.toObject(message.pushConfig, options); + if (message.pushConfig != null && Object.hasOwnProperty.call(message, "pushConfig")) + object.pushConfig = $root.google.pubsub.v1.PushConfig.toObject(message.pushConfig, options, q + 1); return object; }; @@ -19931,9 +20479,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PullRequest.encode = function encode(message, writer) { + PullRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.subscription); if (message.returnImmediately != null && Object.hasOwnProperty.call(message, "returnImmediately")) @@ -19953,7 +20505,7 @@ * @returns {$protobuf.Writer} Writer */ PullRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -20031,13 +20583,13 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.subscription != null && message.hasOwnProperty("subscription")) + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) if (!$util.isString(message.subscription)) return "subscription: string expected"; - if (message.returnImmediately != null && message.hasOwnProperty("returnImmediately")) + if (message.returnImmediately != null && Object.hasOwnProperty.call(message, "returnImmediately")) if (typeof message.returnImmediately !== "boolean") return "returnImmediately: boolean expected"; - if (message.maxMessages != null && message.hasOwnProperty("maxMessages")) + if (message.maxMessages != null && Object.hasOwnProperty.call(message, "maxMessages")) if (!$util.isInteger(message.maxMessages)) return "maxMessages: integer expected"; return null; @@ -20054,6 +20606,8 @@ PullRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.PullRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.PullRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -20077,20 +20631,24 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PullRequest.toObject = function toObject(message, options) { + PullRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.subscription = ""; object.returnImmediately = false; object.maxMessages = 0; } - if (message.subscription != null && message.hasOwnProperty("subscription")) + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) object.subscription = message.subscription; - if (message.returnImmediately != null && message.hasOwnProperty("returnImmediately")) + if (message.returnImmediately != null && Object.hasOwnProperty.call(message, "returnImmediately")) object.returnImmediately = message.returnImmediately; - if (message.maxMessages != null && message.hasOwnProperty("maxMessages")) + if (message.maxMessages != null && Object.hasOwnProperty.call(message, "maxMessages")) object.maxMessages = message.maxMessages; return object; }; @@ -20178,12 +20736,16 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PullResponse.encode = function encode(message, writer) { + PullResponse.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.receivedMessages != null && message.receivedMessages.length) for (var i = 0; i < message.receivedMessages.length; ++i) - $root.google.pubsub.v1.ReceivedMessage.encode(message.receivedMessages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.pubsub.v1.ReceivedMessage.encode(message.receivedMessages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); return writer; }; @@ -20197,7 +20759,7 @@ * @returns {$protobuf.Writer} Writer */ PullResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -20269,7 +20831,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.receivedMessages != null && message.hasOwnProperty("receivedMessages")) { + if (message.receivedMessages != null && Object.hasOwnProperty.call(message, "receivedMessages")) { if (!Array.isArray(message.receivedMessages)) return "receivedMessages: array expected"; for (var i = 0; i < message.receivedMessages.length; ++i) { @@ -20292,6 +20854,8 @@ PullResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.PullResponse) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.PullResponse: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -20302,7 +20866,7 @@ throw TypeError(".google.pubsub.v1.PullResponse.receivedMessages: array expected"); message.receivedMessages = []; for (var i = 0; i < object.receivedMessages.length; ++i) { - if (typeof object.receivedMessages[i] !== "object") + if (!$util.isObject(object.receivedMessages[i])) throw TypeError(".google.pubsub.v1.PullResponse.receivedMessages: object expected"); message.receivedMessages[i] = $root.google.pubsub.v1.ReceivedMessage.fromObject(object.receivedMessages[i], long + 1); } @@ -20319,16 +20883,20 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PullResponse.toObject = function toObject(message, options) { + PullResponse.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.receivedMessages = []; if (message.receivedMessages && message.receivedMessages.length) { object.receivedMessages = []; for (var j = 0; j < message.receivedMessages.length; ++j) - object.receivedMessages[j] = $root.google.pubsub.v1.ReceivedMessage.toObject(message.receivedMessages[j], options); + object.receivedMessages[j] = $root.google.pubsub.v1.ReceivedMessage.toObject(message.receivedMessages[j], options, q + 1); } return object; }; @@ -20434,9 +21002,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ModifyAckDeadlineRequest.encode = function encode(message, writer) { + ModifyAckDeadlineRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.subscription); if (message.ackDeadlineSeconds != null && Object.hasOwnProperty.call(message, "ackDeadlineSeconds")) @@ -20457,7 +21029,7 @@ * @returns {$protobuf.Writer} Writer */ ModifyAckDeadlineRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -20537,17 +21109,17 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.subscription != null && message.hasOwnProperty("subscription")) + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) if (!$util.isString(message.subscription)) return "subscription: string expected"; - if (message.ackIds != null && message.hasOwnProperty("ackIds")) { + if (message.ackIds != null && Object.hasOwnProperty.call(message, "ackIds")) { if (!Array.isArray(message.ackIds)) return "ackIds: array expected"; for (var i = 0; i < message.ackIds.length; ++i) if (!$util.isString(message.ackIds[i])) return "ackIds: string[] expected"; } - if (message.ackDeadlineSeconds != null && message.hasOwnProperty("ackDeadlineSeconds")) + if (message.ackDeadlineSeconds != null && Object.hasOwnProperty.call(message, "ackDeadlineSeconds")) if (!$util.isInteger(message.ackDeadlineSeconds)) return "ackDeadlineSeconds: integer expected"; return null; @@ -20564,6 +21136,8 @@ ModifyAckDeadlineRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.ModifyAckDeadlineRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.ModifyAckDeadlineRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -20592,9 +21166,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ModifyAckDeadlineRequest.toObject = function toObject(message, options) { + ModifyAckDeadlineRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.ackIds = []; @@ -20602,9 +21180,9 @@ object.subscription = ""; object.ackDeadlineSeconds = 0; } - if (message.subscription != null && message.hasOwnProperty("subscription")) + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) object.subscription = message.subscription; - if (message.ackDeadlineSeconds != null && message.hasOwnProperty("ackDeadlineSeconds")) + if (message.ackDeadlineSeconds != null && Object.hasOwnProperty.call(message, "ackDeadlineSeconds")) object.ackDeadlineSeconds = message.ackDeadlineSeconds; if (message.ackIds && message.ackIds.length) { object.ackIds = []; @@ -20706,9 +21284,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AcknowledgeRequest.encode = function encode(message, writer) { + AcknowledgeRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.subscription); if (message.ackIds != null && message.ackIds.length) @@ -20727,7 +21309,7 @@ * @returns {$protobuf.Writer} Writer */ AcknowledgeRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -20803,10 +21385,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.subscription != null && message.hasOwnProperty("subscription")) + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) if (!$util.isString(message.subscription)) return "subscription: string expected"; - if (message.ackIds != null && message.hasOwnProperty("ackIds")) { + if (message.ackIds != null && Object.hasOwnProperty.call(message, "ackIds")) { if (!Array.isArray(message.ackIds)) return "ackIds: array expected"; for (var i = 0; i < message.ackIds.length; ++i) @@ -20827,6 +21409,8 @@ AcknowledgeRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.AcknowledgeRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.AcknowledgeRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -20853,15 +21437,19 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AcknowledgeRequest.toObject = function toObject(message, options) { + AcknowledgeRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.ackIds = []; if (options.defaults) object.subscription = ""; - if (message.subscription != null && message.hasOwnProperty("subscription")) + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) object.subscription = message.subscription; if (message.ackIds && message.ackIds.length) { object.ackIds = []; @@ -21028,9 +21616,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - StreamingPullRequest.encode = function encode(message, writer) { + StreamingPullRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.subscription); if (message.ackIds != null && message.ackIds.length) @@ -21068,7 +21660,7 @@ * @returns {$protobuf.Writer} Writer */ StreamingPullRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -21181,43 +21773,43 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.subscription != null && message.hasOwnProperty("subscription")) + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) if (!$util.isString(message.subscription)) return "subscription: string expected"; - if (message.ackIds != null && message.hasOwnProperty("ackIds")) { + if (message.ackIds != null && Object.hasOwnProperty.call(message, "ackIds")) { if (!Array.isArray(message.ackIds)) return "ackIds: array expected"; for (var i = 0; i < message.ackIds.length; ++i) if (!$util.isString(message.ackIds[i])) return "ackIds: string[] expected"; } - if (message.modifyDeadlineSeconds != null && message.hasOwnProperty("modifyDeadlineSeconds")) { + if (message.modifyDeadlineSeconds != null && Object.hasOwnProperty.call(message, "modifyDeadlineSeconds")) { if (!Array.isArray(message.modifyDeadlineSeconds)) return "modifyDeadlineSeconds: array expected"; for (var i = 0; i < message.modifyDeadlineSeconds.length; ++i) if (!$util.isInteger(message.modifyDeadlineSeconds[i])) return "modifyDeadlineSeconds: integer[] expected"; } - if (message.modifyDeadlineAckIds != null && message.hasOwnProperty("modifyDeadlineAckIds")) { + if (message.modifyDeadlineAckIds != null && Object.hasOwnProperty.call(message, "modifyDeadlineAckIds")) { if (!Array.isArray(message.modifyDeadlineAckIds)) return "modifyDeadlineAckIds: array expected"; for (var i = 0; i < message.modifyDeadlineAckIds.length; ++i) if (!$util.isString(message.modifyDeadlineAckIds[i])) return "modifyDeadlineAckIds: string[] expected"; } - if (message.streamAckDeadlineSeconds != null && message.hasOwnProperty("streamAckDeadlineSeconds")) + if (message.streamAckDeadlineSeconds != null && Object.hasOwnProperty.call(message, "streamAckDeadlineSeconds")) if (!$util.isInteger(message.streamAckDeadlineSeconds)) return "streamAckDeadlineSeconds: integer expected"; - if (message.clientId != null && message.hasOwnProperty("clientId")) + if (message.clientId != null && Object.hasOwnProperty.call(message, "clientId")) if (!$util.isString(message.clientId)) return "clientId: string expected"; - if (message.maxOutstandingMessages != null && message.hasOwnProperty("maxOutstandingMessages")) + if (message.maxOutstandingMessages != null && Object.hasOwnProperty.call(message, "maxOutstandingMessages")) if (!$util.isInteger(message.maxOutstandingMessages) && !(message.maxOutstandingMessages && $util.isInteger(message.maxOutstandingMessages.low) && $util.isInteger(message.maxOutstandingMessages.high))) return "maxOutstandingMessages: integer|Long expected"; - if (message.maxOutstandingBytes != null && message.hasOwnProperty("maxOutstandingBytes")) + if (message.maxOutstandingBytes != null && Object.hasOwnProperty.call(message, "maxOutstandingBytes")) if (!$util.isInteger(message.maxOutstandingBytes) && !(message.maxOutstandingBytes && $util.isInteger(message.maxOutstandingBytes.low) && $util.isInteger(message.maxOutstandingBytes.high))) return "maxOutstandingBytes: integer|Long expected"; - if (message.protocolVersion != null && message.hasOwnProperty("protocolVersion")) + if (message.protocolVersion != null && Object.hasOwnProperty.call(message, "protocolVersion")) if (!$util.isInteger(message.protocolVersion) && !(message.protocolVersion && $util.isInteger(message.protocolVersion.low) && $util.isInteger(message.protocolVersion.high))) return "protocolVersion: integer|Long expected"; return null; @@ -21234,6 +21826,8 @@ StreamingPullRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.StreamingPullRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.StreamingPullRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -21268,7 +21862,7 @@ message.clientId = String(object.clientId); if (object.maxOutstandingMessages != null) if ($util.Long) - (message.maxOutstandingMessages = $util.Long.fromValue(object.maxOutstandingMessages)).unsigned = false; + message.maxOutstandingMessages = $util.Long.fromValue(object.maxOutstandingMessages, false); else if (typeof object.maxOutstandingMessages === "string") message.maxOutstandingMessages = parseInt(object.maxOutstandingMessages, 10); else if (typeof object.maxOutstandingMessages === "number") @@ -21277,7 +21871,7 @@ message.maxOutstandingMessages = new $util.LongBits(object.maxOutstandingMessages.low >>> 0, object.maxOutstandingMessages.high >>> 0).toNumber(); if (object.maxOutstandingBytes != null) if ($util.Long) - (message.maxOutstandingBytes = $util.Long.fromValue(object.maxOutstandingBytes)).unsigned = false; + message.maxOutstandingBytes = $util.Long.fromValue(object.maxOutstandingBytes, false); else if (typeof object.maxOutstandingBytes === "string") message.maxOutstandingBytes = parseInt(object.maxOutstandingBytes, 10); else if (typeof object.maxOutstandingBytes === "number") @@ -21286,7 +21880,7 @@ message.maxOutstandingBytes = new $util.LongBits(object.maxOutstandingBytes.low >>> 0, object.maxOutstandingBytes.high >>> 0).toNumber(); if (object.protocolVersion != null) if ($util.Long) - (message.protocolVersion = $util.Long.fromValue(object.protocolVersion)).unsigned = false; + message.protocolVersion = $util.Long.fromValue(object.protocolVersion, false); else if (typeof object.protocolVersion === "string") message.protocolVersion = parseInt(object.protocolVersion, 10); else if (typeof object.protocolVersion === "number") @@ -21305,9 +21899,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - StreamingPullRequest.toObject = function toObject(message, options) { + StreamingPullRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) { object.ackIds = []; @@ -21320,21 +21918,21 @@ object.clientId = ""; if ($util.Long) { var long = new $util.Long(0, 0, false); - object.maxOutstandingMessages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + object.maxOutstandingMessages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; } else - object.maxOutstandingMessages = options.longs === String ? "0" : 0; + object.maxOutstandingMessages = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; if ($util.Long) { var long = new $util.Long(0, 0, false); - object.maxOutstandingBytes = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + object.maxOutstandingBytes = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; } else - object.maxOutstandingBytes = options.longs === String ? "0" : 0; + object.maxOutstandingBytes = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; if ($util.Long) { var long = new $util.Long(0, 0, false); - object.protocolVersion = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + object.protocolVersion = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; } else - object.protocolVersion = options.longs === String ? "0" : 0; + object.protocolVersion = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; } - if (message.subscription != null && message.hasOwnProperty("subscription")) + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) object.subscription = message.subscription; if (message.ackIds && message.ackIds.length) { object.ackIds = []; @@ -21351,22 +21949,28 @@ for (var j = 0; j < message.modifyDeadlineAckIds.length; ++j) object.modifyDeadlineAckIds[j] = message.modifyDeadlineAckIds[j]; } - if (message.streamAckDeadlineSeconds != null && message.hasOwnProperty("streamAckDeadlineSeconds")) + if (message.streamAckDeadlineSeconds != null && Object.hasOwnProperty.call(message, "streamAckDeadlineSeconds")) object.streamAckDeadlineSeconds = message.streamAckDeadlineSeconds; - if (message.clientId != null && message.hasOwnProperty("clientId")) + if (message.clientId != null && Object.hasOwnProperty.call(message, "clientId")) object.clientId = message.clientId; - if (message.maxOutstandingMessages != null && message.hasOwnProperty("maxOutstandingMessages")) - if (typeof message.maxOutstandingMessages === "number") + if (message.maxOutstandingMessages != null && Object.hasOwnProperty.call(message, "maxOutstandingMessages")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.maxOutstandingMessages = typeof message.maxOutstandingMessages === "number" ? BigInt(message.maxOutstandingMessages) : $util.Long.fromBits(message.maxOutstandingMessages.low >>> 0, message.maxOutstandingMessages.high >>> 0, false).toBigInt(); + else if (typeof message.maxOutstandingMessages === "number") object.maxOutstandingMessages = options.longs === String ? String(message.maxOutstandingMessages) : message.maxOutstandingMessages; else object.maxOutstandingMessages = options.longs === String ? $util.Long.prototype.toString.call(message.maxOutstandingMessages) : options.longs === Number ? new $util.LongBits(message.maxOutstandingMessages.low >>> 0, message.maxOutstandingMessages.high >>> 0).toNumber() : message.maxOutstandingMessages; - if (message.maxOutstandingBytes != null && message.hasOwnProperty("maxOutstandingBytes")) - if (typeof message.maxOutstandingBytes === "number") + if (message.maxOutstandingBytes != null && Object.hasOwnProperty.call(message, "maxOutstandingBytes")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.maxOutstandingBytes = typeof message.maxOutstandingBytes === "number" ? BigInt(message.maxOutstandingBytes) : $util.Long.fromBits(message.maxOutstandingBytes.low >>> 0, message.maxOutstandingBytes.high >>> 0, false).toBigInt(); + else if (typeof message.maxOutstandingBytes === "number") object.maxOutstandingBytes = options.longs === String ? String(message.maxOutstandingBytes) : message.maxOutstandingBytes; else object.maxOutstandingBytes = options.longs === String ? $util.Long.prototype.toString.call(message.maxOutstandingBytes) : options.longs === Number ? new $util.LongBits(message.maxOutstandingBytes.low >>> 0, message.maxOutstandingBytes.high >>> 0).toNumber() : message.maxOutstandingBytes; - if (message.protocolVersion != null && message.hasOwnProperty("protocolVersion")) - if (typeof message.protocolVersion === "number") + if (message.protocolVersion != null && Object.hasOwnProperty.call(message, "protocolVersion")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.protocolVersion = typeof message.protocolVersion === "number" ? BigInt(message.protocolVersion) : $util.Long.fromBits(message.protocolVersion.low >>> 0, message.protocolVersion.high >>> 0, false).toBigInt(); + else if (typeof message.protocolVersion === "number") object.protocolVersion = options.longs === String ? String(message.protocolVersion) : message.protocolVersion; else object.protocolVersion = options.longs === String ? $util.Long.prototype.toString.call(message.protocolVersion) : options.longs === Number ? new $util.LongBits(message.protocolVersion.low >>> 0, message.protocolVersion.high >>> 0).toNumber() : message.protocolVersion; @@ -21483,18 +22087,22 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - StreamingPullResponse.encode = function encode(message, writer) { + StreamingPullResponse.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.receivedMessages != null && message.receivedMessages.length) for (var i = 0; i < message.receivedMessages.length; ++i) - $root.google.pubsub.v1.ReceivedMessage.encode(message.receivedMessages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.pubsub.v1.ReceivedMessage.encode(message.receivedMessages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); if (message.modifyAckDeadlineConfirmation != null && Object.hasOwnProperty.call(message, "modifyAckDeadlineConfirmation")) - $root.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation.encode(message.modifyAckDeadlineConfirmation, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + $root.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation.encode(message.modifyAckDeadlineConfirmation, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); if (message.subscriptionProperties != null && Object.hasOwnProperty.call(message, "subscriptionProperties")) - $root.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties.encode(message.subscriptionProperties, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + $root.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties.encode(message.subscriptionProperties, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); if (message.acknowledgeConfirmation != null && Object.hasOwnProperty.call(message, "acknowledgeConfirmation")) - $root.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation.encode(message.acknowledgeConfirmation, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + $root.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation.encode(message.acknowledgeConfirmation, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); return writer; }; @@ -21508,7 +22116,7 @@ * @returns {$protobuf.Writer} Writer */ StreamingPullResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -21592,7 +22200,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.receivedMessages != null && message.hasOwnProperty("receivedMessages")) { + if (message.receivedMessages != null && Object.hasOwnProperty.call(message, "receivedMessages")) { if (!Array.isArray(message.receivedMessages)) return "receivedMessages: array expected"; for (var i = 0; i < message.receivedMessages.length; ++i) { @@ -21601,17 +22209,17 @@ return "receivedMessages." + error; } } - if (message.acknowledgeConfirmation != null && message.hasOwnProperty("acknowledgeConfirmation")) { + if (message.acknowledgeConfirmation != null && Object.hasOwnProperty.call(message, "acknowledgeConfirmation")) { var error = $root.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation.verify(message.acknowledgeConfirmation, long + 1); if (error) return "acknowledgeConfirmation." + error; } - if (message.modifyAckDeadlineConfirmation != null && message.hasOwnProperty("modifyAckDeadlineConfirmation")) { + if (message.modifyAckDeadlineConfirmation != null && Object.hasOwnProperty.call(message, "modifyAckDeadlineConfirmation")) { var error = $root.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation.verify(message.modifyAckDeadlineConfirmation, long + 1); if (error) return "modifyAckDeadlineConfirmation." + error; } - if (message.subscriptionProperties != null && message.hasOwnProperty("subscriptionProperties")) { + if (message.subscriptionProperties != null && Object.hasOwnProperty.call(message, "subscriptionProperties")) { var error = $root.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties.verify(message.subscriptionProperties, long + 1); if (error) return "subscriptionProperties." + error; @@ -21630,6 +22238,8 @@ StreamingPullResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.StreamingPullResponse) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.StreamingPullResponse: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -21640,23 +22250,23 @@ throw TypeError(".google.pubsub.v1.StreamingPullResponse.receivedMessages: array expected"); message.receivedMessages = []; for (var i = 0; i < object.receivedMessages.length; ++i) { - if (typeof object.receivedMessages[i] !== "object") + if (!$util.isObject(object.receivedMessages[i])) throw TypeError(".google.pubsub.v1.StreamingPullResponse.receivedMessages: object expected"); message.receivedMessages[i] = $root.google.pubsub.v1.ReceivedMessage.fromObject(object.receivedMessages[i], long + 1); } } if (object.acknowledgeConfirmation != null) { - if (typeof object.acknowledgeConfirmation !== "object") + if (!$util.isObject(object.acknowledgeConfirmation)) throw TypeError(".google.pubsub.v1.StreamingPullResponse.acknowledgeConfirmation: object expected"); message.acknowledgeConfirmation = $root.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation.fromObject(object.acknowledgeConfirmation, long + 1); } if (object.modifyAckDeadlineConfirmation != null) { - if (typeof object.modifyAckDeadlineConfirmation !== "object") + if (!$util.isObject(object.modifyAckDeadlineConfirmation)) throw TypeError(".google.pubsub.v1.StreamingPullResponse.modifyAckDeadlineConfirmation: object expected"); message.modifyAckDeadlineConfirmation = $root.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation.fromObject(object.modifyAckDeadlineConfirmation, long + 1); } if (object.subscriptionProperties != null) { - if (typeof object.subscriptionProperties !== "object") + if (!$util.isObject(object.subscriptionProperties)) throw TypeError(".google.pubsub.v1.StreamingPullResponse.subscriptionProperties: object expected"); message.subscriptionProperties = $root.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties.fromObject(object.subscriptionProperties, long + 1); } @@ -21672,9 +22282,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - StreamingPullResponse.toObject = function toObject(message, options) { + StreamingPullResponse.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.receivedMessages = []; @@ -21686,14 +22300,14 @@ if (message.receivedMessages && message.receivedMessages.length) { object.receivedMessages = []; for (var j = 0; j < message.receivedMessages.length; ++j) - object.receivedMessages[j] = $root.google.pubsub.v1.ReceivedMessage.toObject(message.receivedMessages[j], options); - } - if (message.modifyAckDeadlineConfirmation != null && message.hasOwnProperty("modifyAckDeadlineConfirmation")) - object.modifyAckDeadlineConfirmation = $root.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation.toObject(message.modifyAckDeadlineConfirmation, options); - if (message.subscriptionProperties != null && message.hasOwnProperty("subscriptionProperties")) - object.subscriptionProperties = $root.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties.toObject(message.subscriptionProperties, options); - if (message.acknowledgeConfirmation != null && message.hasOwnProperty("acknowledgeConfirmation")) - object.acknowledgeConfirmation = $root.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation.toObject(message.acknowledgeConfirmation, options); + object.receivedMessages[j] = $root.google.pubsub.v1.ReceivedMessage.toObject(message.receivedMessages[j], options, q + 1); + } + if (message.modifyAckDeadlineConfirmation != null && Object.hasOwnProperty.call(message, "modifyAckDeadlineConfirmation")) + object.modifyAckDeadlineConfirmation = $root.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation.toObject(message.modifyAckDeadlineConfirmation, options, q + 1); + if (message.subscriptionProperties != null && Object.hasOwnProperty.call(message, "subscriptionProperties")) + object.subscriptionProperties = $root.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties.toObject(message.subscriptionProperties, options, q + 1); + if (message.acknowledgeConfirmation != null && Object.hasOwnProperty.call(message, "acknowledgeConfirmation")) + object.acknowledgeConfirmation = $root.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation.toObject(message.acknowledgeConfirmation, options, q + 1); return object; }; @@ -21807,9 +22421,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AcknowledgeConfirmation.encode = function encode(message, writer) { + AcknowledgeConfirmation.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.ackIds != null && message.ackIds.length) for (var i = 0; i < message.ackIds.length; ++i) writer.uint32(/* id 1, wireType 2 =*/10).string(message.ackIds[i]); @@ -21835,7 +22453,7 @@ * @returns {$protobuf.Writer} Writer */ AcknowledgeConfirmation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -21925,28 +22543,28 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.ackIds != null && message.hasOwnProperty("ackIds")) { + if (message.ackIds != null && Object.hasOwnProperty.call(message, "ackIds")) { if (!Array.isArray(message.ackIds)) return "ackIds: array expected"; for (var i = 0; i < message.ackIds.length; ++i) if (!$util.isString(message.ackIds[i])) return "ackIds: string[] expected"; } - if (message.invalidAckIds != null && message.hasOwnProperty("invalidAckIds")) { + if (message.invalidAckIds != null && Object.hasOwnProperty.call(message, "invalidAckIds")) { if (!Array.isArray(message.invalidAckIds)) return "invalidAckIds: array expected"; for (var i = 0; i < message.invalidAckIds.length; ++i) if (!$util.isString(message.invalidAckIds[i])) return "invalidAckIds: string[] expected"; } - if (message.unorderedAckIds != null && message.hasOwnProperty("unorderedAckIds")) { + if (message.unorderedAckIds != null && Object.hasOwnProperty.call(message, "unorderedAckIds")) { if (!Array.isArray(message.unorderedAckIds)) return "unorderedAckIds: array expected"; for (var i = 0; i < message.unorderedAckIds.length; ++i) if (!$util.isString(message.unorderedAckIds[i])) return "unorderedAckIds: string[] expected"; } - if (message.temporaryFailedAckIds != null && message.hasOwnProperty("temporaryFailedAckIds")) { + if (message.temporaryFailedAckIds != null && Object.hasOwnProperty.call(message, "temporaryFailedAckIds")) { if (!Array.isArray(message.temporaryFailedAckIds)) return "temporaryFailedAckIds: array expected"; for (var i = 0; i < message.temporaryFailedAckIds.length; ++i) @@ -21967,6 +22585,8 @@ AcknowledgeConfirmation.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -22012,9 +22632,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AcknowledgeConfirmation.toObject = function toObject(message, options) { + AcknowledgeConfirmation.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) { object.ackIds = []; @@ -22148,9 +22772,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ModifyAckDeadlineConfirmation.encode = function encode(message, writer) { + ModifyAckDeadlineConfirmation.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.ackIds != null && message.ackIds.length) for (var i = 0; i < message.ackIds.length; ++i) writer.uint32(/* id 1, wireType 2 =*/10).string(message.ackIds[i]); @@ -22173,7 +22801,7 @@ * @returns {$protobuf.Writer} Writer */ ModifyAckDeadlineConfirmation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -22257,21 +22885,21 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.ackIds != null && message.hasOwnProperty("ackIds")) { + if (message.ackIds != null && Object.hasOwnProperty.call(message, "ackIds")) { if (!Array.isArray(message.ackIds)) return "ackIds: array expected"; for (var i = 0; i < message.ackIds.length; ++i) if (!$util.isString(message.ackIds[i])) return "ackIds: string[] expected"; } - if (message.invalidAckIds != null && message.hasOwnProperty("invalidAckIds")) { + if (message.invalidAckIds != null && Object.hasOwnProperty.call(message, "invalidAckIds")) { if (!Array.isArray(message.invalidAckIds)) return "invalidAckIds: array expected"; for (var i = 0; i < message.invalidAckIds.length; ++i) if (!$util.isString(message.invalidAckIds[i])) return "invalidAckIds: string[] expected"; } - if (message.temporaryFailedAckIds != null && message.hasOwnProperty("temporaryFailedAckIds")) { + if (message.temporaryFailedAckIds != null && Object.hasOwnProperty.call(message, "temporaryFailedAckIds")) { if (!Array.isArray(message.temporaryFailedAckIds)) return "temporaryFailedAckIds: array expected"; for (var i = 0; i < message.temporaryFailedAckIds.length; ++i) @@ -22292,6 +22920,8 @@ ModifyAckDeadlineConfirmation.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -22330,9 +22960,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ModifyAckDeadlineConfirmation.toObject = function toObject(message, options) { + ModifyAckDeadlineConfirmation.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) { object.ackIds = []; @@ -22448,9 +23082,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SubscriptionProperties.encode = function encode(message, writer) { + SubscriptionProperties.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.exactlyOnceDeliveryEnabled != null && Object.hasOwnProperty.call(message, "exactlyOnceDeliveryEnabled")) writer.uint32(/* id 1, wireType 0 =*/8).bool(message.exactlyOnceDeliveryEnabled); if (message.messageOrderingEnabled != null && Object.hasOwnProperty.call(message, "messageOrderingEnabled")) @@ -22468,7 +23106,7 @@ * @returns {$protobuf.Writer} Writer */ SubscriptionProperties.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -22542,10 +23180,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.exactlyOnceDeliveryEnabled != null && message.hasOwnProperty("exactlyOnceDeliveryEnabled")) + if (message.exactlyOnceDeliveryEnabled != null && Object.hasOwnProperty.call(message, "exactlyOnceDeliveryEnabled")) if (typeof message.exactlyOnceDeliveryEnabled !== "boolean") return "exactlyOnceDeliveryEnabled: boolean expected"; - if (message.messageOrderingEnabled != null && message.hasOwnProperty("messageOrderingEnabled")) + if (message.messageOrderingEnabled != null && Object.hasOwnProperty.call(message, "messageOrderingEnabled")) if (typeof message.messageOrderingEnabled !== "boolean") return "messageOrderingEnabled: boolean expected"; return null; @@ -22562,6 +23200,8 @@ SubscriptionProperties.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.StreamingPullResponse.SubscriptionProperties: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -22583,17 +23223,21 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SubscriptionProperties.toObject = function toObject(message, options) { + SubscriptionProperties.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.exactlyOnceDeliveryEnabled = false; object.messageOrderingEnabled = false; } - if (message.exactlyOnceDeliveryEnabled != null && message.hasOwnProperty("exactlyOnceDeliveryEnabled")) + if (message.exactlyOnceDeliveryEnabled != null && Object.hasOwnProperty.call(message, "exactlyOnceDeliveryEnabled")) object.exactlyOnceDeliveryEnabled = message.exactlyOnceDeliveryEnabled; - if (message.messageOrderingEnabled != null && message.hasOwnProperty("messageOrderingEnabled")) + if (message.messageOrderingEnabled != null && Object.hasOwnProperty.call(message, "messageOrderingEnabled")) object.messageOrderingEnabled = message.messageOrderingEnabled; return object; }; @@ -22712,9 +23356,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CreateSnapshotRequest.encode = function encode(message, writer) { + CreateSnapshotRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) @@ -22738,7 +23386,7 @@ * @returns {$protobuf.Writer} Writer */ CreateSnapshotRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -22862,13 +23510,13 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) if (!$util.isString(message.name)) return "name: string expected"; - if (message.subscription != null && message.hasOwnProperty("subscription")) + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) if (!$util.isString(message.subscription)) return "subscription: string expected"; - if (message.labels != null && message.hasOwnProperty("labels")) { + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) { if (!$util.isObject(message.labels)) return "labels: object expected"; var key = Object.keys(message.labels); @@ -22876,7 +23524,7 @@ if (!$util.isString(message.labels[key[i]])) return "labels: string{k:string} expected"; } - if (message.tags != null && message.hasOwnProperty("tags")) { + if (message.tags != null && Object.hasOwnProperty.call(message, "tags")) { if (!$util.isObject(message.tags)) return "tags: object expected"; var key = Object.keys(message.tags); @@ -22898,6 +23546,8 @@ CreateSnapshotRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.CreateSnapshotRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.CreateSnapshotRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -22908,7 +23558,7 @@ if (object.subscription != null) message.subscription = String(object.subscription); if (object.labels) { - if (typeof object.labels !== "object") + if (!$util.isObject(object.labels)) throw TypeError(".google.pubsub.v1.CreateSnapshotRequest.labels: object expected"); message.labels = {}; for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) { @@ -22918,7 +23568,7 @@ } } if (object.tags) { - if (typeof object.tags !== "object") + if (!$util.isObject(object.tags)) throw TypeError(".google.pubsub.v1.CreateSnapshotRequest.tags: object expected"); message.tags = {}; for (var keys = Object.keys(object.tags), i = 0; i < keys.length; ++i) { @@ -22939,9 +23589,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CreateSnapshotRequest.toObject = function toObject(message, options) { + CreateSnapshotRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.objects || options.defaults) { object.labels = {}; @@ -22951,9 +23605,9 @@ object.name = ""; object.subscription = ""; } - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) object.name = message.name; - if (message.subscription != null && message.hasOwnProperty("subscription")) + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) object.subscription = message.subscription; var keys2; if (message.labels && (keys2 = Object.keys(message.labels)).length) { @@ -23066,13 +23720,17 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateSnapshotRequest.encode = function encode(message, writer) { + UpdateSnapshotRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.snapshot != null && Object.hasOwnProperty.call(message, "snapshot")) - $root.google.pubsub.v1.Snapshot.encode(message.snapshot, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.pubsub.v1.Snapshot.encode(message.snapshot, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); return writer; }; @@ -23086,7 +23744,7 @@ * @returns {$protobuf.Writer} Writer */ UpdateSnapshotRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -23160,12 +23818,12 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.snapshot != null && message.hasOwnProperty("snapshot")) { + if (message.snapshot != null && Object.hasOwnProperty.call(message, "snapshot")) { var error = $root.google.pubsub.v1.Snapshot.verify(message.snapshot, long + 1); if (error) return "snapshot." + error; } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) { var error = $root.google.protobuf.FieldMask.verify(message.updateMask, long + 1); if (error) return "updateMask." + error; @@ -23184,18 +23842,20 @@ UpdateSnapshotRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.UpdateSnapshotRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.UpdateSnapshotRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) throw Error("maximum nesting depth exceeded"); var message = new $root.google.pubsub.v1.UpdateSnapshotRequest(); if (object.snapshot != null) { - if (typeof object.snapshot !== "object") + if (!$util.isObject(object.snapshot)) throw TypeError(".google.pubsub.v1.UpdateSnapshotRequest.snapshot: object expected"); message.snapshot = $root.google.pubsub.v1.Snapshot.fromObject(object.snapshot, long + 1); } if (object.updateMask != null) { - if (typeof object.updateMask !== "object") + if (!$util.isObject(object.updateMask)) throw TypeError(".google.pubsub.v1.UpdateSnapshotRequest.updateMask: object expected"); message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask, long + 1); } @@ -23211,18 +23871,22 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UpdateSnapshotRequest.toObject = function toObject(message, options) { + UpdateSnapshotRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.snapshot = null; object.updateMask = null; } - if (message.snapshot != null && message.hasOwnProperty("snapshot")) - object.snapshot = $root.google.pubsub.v1.Snapshot.toObject(message.snapshot, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.snapshot != null && Object.hasOwnProperty.call(message, "snapshot")) + object.snapshot = $root.google.pubsub.v1.Snapshot.toObject(message.snapshot, options, q + 1); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options, q + 1); return object; }; @@ -23336,15 +24000,19 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Snapshot.encode = function encode(message, writer) { + Snapshot.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.topic); if (message.expireTime != null && Object.hasOwnProperty.call(message, "expireTime")) - $root.google.protobuf.Timestamp.encode(message.expireTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + $root.google.protobuf.Timestamp.encode(message.expireTime, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); @@ -23361,7 +24029,7 @@ * @returns {$protobuf.Writer} Writer */ Snapshot.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -23464,18 +24132,18 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) if (!$util.isString(message.name)) return "name: string expected"; - if (message.topic != null && message.hasOwnProperty("topic")) + if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) if (!$util.isString(message.topic)) return "topic: string expected"; - if (message.expireTime != null && message.hasOwnProperty("expireTime")) { + if (message.expireTime != null && Object.hasOwnProperty.call(message, "expireTime")) { var error = $root.google.protobuf.Timestamp.verify(message.expireTime, long + 1); if (error) return "expireTime." + error; } - if (message.labels != null && message.hasOwnProperty("labels")) { + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) { if (!$util.isObject(message.labels)) return "labels: object expected"; var key = Object.keys(message.labels); @@ -23497,6 +24165,8 @@ Snapshot.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.Snapshot) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.Snapshot: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -23507,12 +24177,12 @@ if (object.topic != null) message.topic = String(object.topic); if (object.expireTime != null) { - if (typeof object.expireTime !== "object") + if (!$util.isObject(object.expireTime)) throw TypeError(".google.pubsub.v1.Snapshot.expireTime: object expected"); message.expireTime = $root.google.protobuf.Timestamp.fromObject(object.expireTime, long + 1); } if (object.labels) { - if (typeof object.labels !== "object") + if (!$util.isObject(object.labels)) throw TypeError(".google.pubsub.v1.Snapshot.labels: object expected"); message.labels = {}; for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) { @@ -23533,9 +24203,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Snapshot.toObject = function toObject(message, options) { + Snapshot.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.objects || options.defaults) object.labels = {}; @@ -23544,12 +24218,12 @@ object.topic = ""; object.expireTime = null; } - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) object.name = message.name; - if (message.topic != null && message.hasOwnProperty("topic")) + if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) object.topic = message.topic; - if (message.expireTime != null && message.hasOwnProperty("expireTime")) - object.expireTime = $root.google.protobuf.Timestamp.toObject(message.expireTime, options); + if (message.expireTime != null && Object.hasOwnProperty.call(message, "expireTime")) + object.expireTime = $root.google.protobuf.Timestamp.toObject(message.expireTime, options, q + 1); var keys2; if (message.labels && (keys2 = Object.keys(message.labels)).length) { object.labels = {}; @@ -23644,9 +24318,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetSnapshotRequest.encode = function encode(message, writer) { + GetSnapshotRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.snapshot != null && Object.hasOwnProperty.call(message, "snapshot")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.snapshot); return writer; @@ -23662,7 +24340,7 @@ * @returns {$protobuf.Writer} Writer */ GetSnapshotRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -23732,7 +24410,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.snapshot != null && message.hasOwnProperty("snapshot")) + if (message.snapshot != null && Object.hasOwnProperty.call(message, "snapshot")) if (!$util.isString(message.snapshot)) return "snapshot: string expected"; return null; @@ -23749,6 +24427,8 @@ GetSnapshotRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.GetSnapshotRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.GetSnapshotRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -23768,13 +24448,17 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetSnapshotRequest.toObject = function toObject(message, options) { + GetSnapshotRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) object.snapshot = ""; - if (message.snapshot != null && message.hasOwnProperty("snapshot")) + if (message.snapshot != null && Object.hasOwnProperty.call(message, "snapshot")) object.snapshot = message.snapshot; return object; }; @@ -23879,9 +24563,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListSnapshotsRequest.encode = function encode(message, writer) { + ListSnapshotsRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.project != null && Object.hasOwnProperty.call(message, "project")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.project); if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) @@ -23901,7 +24589,7 @@ * @returns {$protobuf.Writer} Writer */ ListSnapshotsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -23979,13 +24667,13 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.project != null && message.hasOwnProperty("project")) + if (message.project != null && Object.hasOwnProperty.call(message, "project")) if (!$util.isString(message.project)) return "project: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) if (!$util.isInteger(message.pageSize)) return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) if (!$util.isString(message.pageToken)) return "pageToken: string expected"; return null; @@ -24002,6 +24690,8 @@ ListSnapshotsRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.ListSnapshotsRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.ListSnapshotsRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -24025,20 +24715,24 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListSnapshotsRequest.toObject = function toObject(message, options) { + ListSnapshotsRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.project = ""; object.pageSize = 0; object.pageToken = ""; } - if (message.project != null && message.hasOwnProperty("project")) + if (message.project != null && Object.hasOwnProperty.call(message, "project")) object.project = message.project; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) object.pageToken = message.pageToken; return object; }; @@ -24135,12 +24829,16 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListSnapshotsResponse.encode = function encode(message, writer) { + ListSnapshotsResponse.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.snapshots != null && message.snapshots.length) for (var i = 0; i < message.snapshots.length; ++i) - $root.google.pubsub.v1.Snapshot.encode(message.snapshots[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.pubsub.v1.Snapshot.encode(message.snapshots[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); return writer; @@ -24156,7 +24854,7 @@ * @returns {$protobuf.Writer} Writer */ ListSnapshotsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -24232,7 +24930,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.snapshots != null && message.hasOwnProperty("snapshots")) { + if (message.snapshots != null && Object.hasOwnProperty.call(message, "snapshots")) { if (!Array.isArray(message.snapshots)) return "snapshots: array expected"; for (var i = 0; i < message.snapshots.length; ++i) { @@ -24241,7 +24939,7 @@ return "snapshots." + error; } } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) if (!$util.isString(message.nextPageToken)) return "nextPageToken: string expected"; return null; @@ -24258,6 +24956,8 @@ ListSnapshotsResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.ListSnapshotsResponse) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.ListSnapshotsResponse: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -24268,7 +24968,7 @@ throw TypeError(".google.pubsub.v1.ListSnapshotsResponse.snapshots: array expected"); message.snapshots = []; for (var i = 0; i < object.snapshots.length; ++i) { - if (typeof object.snapshots[i] !== "object") + if (!$util.isObject(object.snapshots[i])) throw TypeError(".google.pubsub.v1.ListSnapshotsResponse.snapshots: object expected"); message.snapshots[i] = $root.google.pubsub.v1.Snapshot.fromObject(object.snapshots[i], long + 1); } @@ -24287,9 +24987,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListSnapshotsResponse.toObject = function toObject(message, options) { + ListSnapshotsResponse.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.snapshots = []; @@ -24298,9 +25002,9 @@ if (message.snapshots && message.snapshots.length) { object.snapshots = []; for (var j = 0; j < message.snapshots.length; ++j) - object.snapshots[j] = $root.google.pubsub.v1.Snapshot.toObject(message.snapshots[j], options); + object.snapshots[j] = $root.google.pubsub.v1.Snapshot.toObject(message.snapshots[j], options, q + 1); } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) object.nextPageToken = message.nextPageToken; return object; }; @@ -24387,9 +25091,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteSnapshotRequest.encode = function encode(message, writer) { + DeleteSnapshotRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.snapshot != null && Object.hasOwnProperty.call(message, "snapshot")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.snapshot); return writer; @@ -24405,7 +25113,7 @@ * @returns {$protobuf.Writer} Writer */ DeleteSnapshotRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -24475,7 +25183,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.snapshot != null && message.hasOwnProperty("snapshot")) + if (message.snapshot != null && Object.hasOwnProperty.call(message, "snapshot")) if (!$util.isString(message.snapshot)) return "snapshot: string expected"; return null; @@ -24492,6 +25200,8 @@ DeleteSnapshotRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.DeleteSnapshotRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.DeleteSnapshotRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -24511,13 +25221,17 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DeleteSnapshotRequest.toObject = function toObject(message, options) { + DeleteSnapshotRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) object.snapshot = ""; - if (message.snapshot != null && message.hasOwnProperty("snapshot")) + if (message.snapshot != null && Object.hasOwnProperty.call(message, "snapshot")) object.snapshot = message.snapshot; return object; }; @@ -24636,13 +25350,17 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SeekRequest.encode = function encode(message, writer) { + SeekRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.subscription); if (message.time != null && Object.hasOwnProperty.call(message, "time")) - $root.google.protobuf.Timestamp.encode(message.time, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.protobuf.Timestamp.encode(message.time, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); if (message.snapshot != null && Object.hasOwnProperty.call(message, "snapshot")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.snapshot); return writer; @@ -24658,7 +25376,7 @@ * @returns {$protobuf.Writer} Writer */ SeekRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -24737,10 +25455,10 @@ if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; var properties = {}; - if (message.subscription != null && message.hasOwnProperty("subscription")) + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) if (!$util.isString(message.subscription)) return "subscription: string expected"; - if (message.time != null && message.hasOwnProperty("time")) { + if (message.time != null && Object.hasOwnProperty.call(message, "time")) { properties.target = 1; { var error = $root.google.protobuf.Timestamp.verify(message.time, long + 1); @@ -24748,7 +25466,7 @@ return "time." + error; } } - if (message.snapshot != null && message.hasOwnProperty("snapshot")) { + if (message.snapshot != null && Object.hasOwnProperty.call(message, "snapshot")) { if (properties.target === 1) return "target: multiple values"; properties.target = 1; @@ -24769,6 +25487,8 @@ SeekRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.SeekRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.SeekRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -24777,7 +25497,7 @@ if (object.subscription != null) message.subscription = String(object.subscription); if (object.time != null) { - if (typeof object.time !== "object") + if (!$util.isObject(object.time)) throw TypeError(".google.pubsub.v1.SeekRequest.time: object expected"); message.time = $root.google.protobuf.Timestamp.fromObject(object.time, long + 1); } @@ -24795,20 +25515,24 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SeekRequest.toObject = function toObject(message, options) { + SeekRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) object.subscription = ""; - if (message.subscription != null && message.hasOwnProperty("subscription")) + if (message.subscription != null && Object.hasOwnProperty.call(message, "subscription")) object.subscription = message.subscription; - if (message.time != null && message.hasOwnProperty("time")) { - object.time = $root.google.protobuf.Timestamp.toObject(message.time, options); + if (message.time != null && Object.hasOwnProperty.call(message, "time")) { + object.time = $root.google.protobuf.Timestamp.toObject(message.time, options, q + 1); if (options.oneofs) object.target = "time"; } - if (message.snapshot != null && message.hasOwnProperty("snapshot")) { + if (message.snapshot != null && Object.hasOwnProperty.call(message, "snapshot")) { object.snapshot = message.snapshot; if (options.oneofs) object.target = "snapshot"; @@ -24889,9 +25613,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SeekResponse.encode = function encode(message, writer) { + SeekResponse.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); return writer; }; @@ -24905,7 +25633,7 @@ * @returns {$protobuf.Writer} Writer */ SeekResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -24985,10 +25713,6 @@ SeekResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.SeekResponse) return object; - if (long === undefined) - long = 0; - if (long > $util.recursionLimit) - throw Error("maximum nesting depth exceeded"); return new $root.google.pubsub.v1.SeekResponse(); }; @@ -25086,7 +25810,7 @@ * @variation 1 */ Object.defineProperty(SchemaService.prototype.createSchema = function createSchema(request, callback) { - return this.rpcCall(createSchema, $root.google.pubsub.v1.CreateSchemaRequest, $root.google.pubsub.v1.Schema, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, createSchema, $root.google.pubsub.v1.CreateSchemaRequest, $root.google.pubsub.v1.Schema, request, callback); }, "name", { value: "CreateSchema" }); /** @@ -25119,7 +25843,7 @@ * @variation 1 */ Object.defineProperty(SchemaService.prototype.getSchema = function getSchema(request, callback) { - return this.rpcCall(getSchema, $root.google.pubsub.v1.GetSchemaRequest, $root.google.pubsub.v1.Schema, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, getSchema, $root.google.pubsub.v1.GetSchemaRequest, $root.google.pubsub.v1.Schema, request, callback); }, "name", { value: "GetSchema" }); /** @@ -25152,7 +25876,7 @@ * @variation 1 */ Object.defineProperty(SchemaService.prototype.listSchemas = function listSchemas(request, callback) { - return this.rpcCall(listSchemas, $root.google.pubsub.v1.ListSchemasRequest, $root.google.pubsub.v1.ListSchemasResponse, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, listSchemas, $root.google.pubsub.v1.ListSchemasRequest, $root.google.pubsub.v1.ListSchemasResponse, request, callback); }, "name", { value: "ListSchemas" }); /** @@ -25185,7 +25909,7 @@ * @variation 1 */ Object.defineProperty(SchemaService.prototype.listSchemaRevisions = function listSchemaRevisions(request, callback) { - return this.rpcCall(listSchemaRevisions, $root.google.pubsub.v1.ListSchemaRevisionsRequest, $root.google.pubsub.v1.ListSchemaRevisionsResponse, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, listSchemaRevisions, $root.google.pubsub.v1.ListSchemaRevisionsRequest, $root.google.pubsub.v1.ListSchemaRevisionsResponse, request, callback); }, "name", { value: "ListSchemaRevisions" }); /** @@ -25218,7 +25942,7 @@ * @variation 1 */ Object.defineProperty(SchemaService.prototype.commitSchema = function commitSchema(request, callback) { - return this.rpcCall(commitSchema, $root.google.pubsub.v1.CommitSchemaRequest, $root.google.pubsub.v1.Schema, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, commitSchema, $root.google.pubsub.v1.CommitSchemaRequest, $root.google.pubsub.v1.Schema, request, callback); }, "name", { value: "CommitSchema" }); /** @@ -25251,7 +25975,7 @@ * @variation 1 */ Object.defineProperty(SchemaService.prototype.rollbackSchema = function rollbackSchema(request, callback) { - return this.rpcCall(rollbackSchema, $root.google.pubsub.v1.RollbackSchemaRequest, $root.google.pubsub.v1.Schema, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, rollbackSchema, $root.google.pubsub.v1.RollbackSchemaRequest, $root.google.pubsub.v1.Schema, request, callback); }, "name", { value: "RollbackSchema" }); /** @@ -25284,7 +26008,7 @@ * @variation 1 */ Object.defineProperty(SchemaService.prototype.deleteSchemaRevision = function deleteSchemaRevision(request, callback) { - return this.rpcCall(deleteSchemaRevision, $root.google.pubsub.v1.DeleteSchemaRevisionRequest, $root.google.pubsub.v1.Schema, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, deleteSchemaRevision, $root.google.pubsub.v1.DeleteSchemaRevisionRequest, $root.google.pubsub.v1.Schema, request, callback); }, "name", { value: "DeleteSchemaRevision" }); /** @@ -25317,7 +26041,7 @@ * @variation 1 */ Object.defineProperty(SchemaService.prototype.deleteSchema = function deleteSchema(request, callback) { - return this.rpcCall(deleteSchema, $root.google.pubsub.v1.DeleteSchemaRequest, $root.google.protobuf.Empty, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, deleteSchema, $root.google.pubsub.v1.DeleteSchemaRequest, $root.google.protobuf.Empty, request, callback); }, "name", { value: "DeleteSchema" }); /** @@ -25350,7 +26074,7 @@ * @variation 1 */ Object.defineProperty(SchemaService.prototype.validateSchema = function validateSchema(request, callback) { - return this.rpcCall(validateSchema, $root.google.pubsub.v1.ValidateSchemaRequest, $root.google.pubsub.v1.ValidateSchemaResponse, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, validateSchema, $root.google.pubsub.v1.ValidateSchemaRequest, $root.google.pubsub.v1.ValidateSchemaResponse, request, callback); }, "name", { value: "ValidateSchema" }); /** @@ -25383,7 +26107,7 @@ * @variation 1 */ Object.defineProperty(SchemaService.prototype.validateMessage = function validateMessage(request, callback) { - return this.rpcCall(validateMessage, $root.google.pubsub.v1.ValidateMessageRequest, $root.google.pubsub.v1.ValidateMessageResponse, request, callback); + return $protobuf.rpc.Service.prototype.rpcCall.call(this, validateMessage, $root.google.pubsub.v1.ValidateMessageRequest, $root.google.pubsub.v1.ValidateMessageResponse, request, callback); }, "name", { value: "ValidateMessage" }); /** @@ -25488,9 +26212,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Schema.encode = function encode(message, writer) { + Schema.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); if (message.type != null && Object.hasOwnProperty.call(message, "type")) @@ -25500,7 +26228,7 @@ if (message.revisionId != null && Object.hasOwnProperty.call(message, "revisionId")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.revisionId); if (message.revisionCreateTime != null && Object.hasOwnProperty.call(message, "revisionCreateTime")) - $root.google.protobuf.Timestamp.encode(message.revisionCreateTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + $root.google.protobuf.Timestamp.encode(message.revisionCreateTime, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); return writer; }; @@ -25514,7 +26242,7 @@ * @returns {$protobuf.Writer} Writer */ Schema.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -25600,10 +26328,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) if (!$util.isString(message.name)) return "name: string expected"; - if (message.type != null && message.hasOwnProperty("type")) + if (message.type != null && Object.hasOwnProperty.call(message, "type")) switch (message.type) { default: return "type: enum value expected"; @@ -25612,13 +26340,13 @@ case 2: break; } - if (message.definition != null && message.hasOwnProperty("definition")) + if (message.definition != null && Object.hasOwnProperty.call(message, "definition")) if (!$util.isString(message.definition)) return "definition: string expected"; - if (message.revisionId != null && message.hasOwnProperty("revisionId")) + if (message.revisionId != null && Object.hasOwnProperty.call(message, "revisionId")) if (!$util.isString(message.revisionId)) return "revisionId: string expected"; - if (message.revisionCreateTime != null && message.hasOwnProperty("revisionCreateTime")) { + if (message.revisionCreateTime != null && Object.hasOwnProperty.call(message, "revisionCreateTime")) { var error = $root.google.protobuf.Timestamp.verify(message.revisionCreateTime, long + 1); if (error) return "revisionCreateTime." + error; @@ -25637,6 +26365,8 @@ Schema.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.Schema) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.Schema: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -25669,7 +26399,7 @@ if (object.revisionId != null) message.revisionId = String(object.revisionId); if (object.revisionCreateTime != null) { - if (typeof object.revisionCreateTime !== "object") + if (!$util.isObject(object.revisionCreateTime)) throw TypeError(".google.pubsub.v1.Schema.revisionCreateTime: object expected"); message.revisionCreateTime = $root.google.protobuf.Timestamp.fromObject(object.revisionCreateTime, long + 1); } @@ -25685,9 +26415,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Schema.toObject = function toObject(message, options) { + Schema.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.name = ""; @@ -25696,16 +26430,16 @@ object.revisionId = ""; object.revisionCreateTime = null; } - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) object.name = message.name; - if (message.type != null && message.hasOwnProperty("type")) + if (message.type != null && Object.hasOwnProperty.call(message, "type")) object.type = options.enums === String ? $root.google.pubsub.v1.Schema.Type[message.type] === undefined ? message.type : $root.google.pubsub.v1.Schema.Type[message.type] : message.type; - if (message.definition != null && message.hasOwnProperty("definition")) + if (message.definition != null && Object.hasOwnProperty.call(message, "definition")) object.definition = message.definition; - if (message.revisionId != null && message.hasOwnProperty("revisionId")) + if (message.revisionId != null && Object.hasOwnProperty.call(message, "revisionId")) object.revisionId = message.revisionId; - if (message.revisionCreateTime != null && message.hasOwnProperty("revisionCreateTime")) - object.revisionCreateTime = $root.google.protobuf.Timestamp.toObject(message.revisionCreateTime, options); + if (message.revisionCreateTime != null && Object.hasOwnProperty.call(message, "revisionCreateTime")) + object.revisionCreateTime = $root.google.protobuf.Timestamp.toObject(message.revisionCreateTime, options, q + 1); return object; }; @@ -25841,13 +26575,17 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CreateSchemaRequest.encode = function encode(message, writer) { + CreateSchemaRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); if (message.schema != null && Object.hasOwnProperty.call(message, "schema")) - $root.google.pubsub.v1.Schema.encode(message.schema, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.pubsub.v1.Schema.encode(message.schema, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); if (message.schemaId != null && Object.hasOwnProperty.call(message, "schemaId")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.schemaId); return writer; @@ -25863,7 +26601,7 @@ * @returns {$protobuf.Writer} Writer */ CreateSchemaRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -25941,15 +26679,15 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.parent != null && message.hasOwnProperty("parent")) + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) if (!$util.isString(message.parent)) return "parent: string expected"; - if (message.schema != null && message.hasOwnProperty("schema")) { + if (message.schema != null && Object.hasOwnProperty.call(message, "schema")) { var error = $root.google.pubsub.v1.Schema.verify(message.schema, long + 1); if (error) return "schema." + error; } - if (message.schemaId != null && message.hasOwnProperty("schemaId")) + if (message.schemaId != null && Object.hasOwnProperty.call(message, "schemaId")) if (!$util.isString(message.schemaId)) return "schemaId: string expected"; return null; @@ -25966,6 +26704,8 @@ CreateSchemaRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.CreateSchemaRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.CreateSchemaRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -25974,7 +26714,7 @@ if (object.parent != null) message.parent = String(object.parent); if (object.schema != null) { - if (typeof object.schema !== "object") + if (!$util.isObject(object.schema)) throw TypeError(".google.pubsub.v1.CreateSchemaRequest.schema: object expected"); message.schema = $root.google.pubsub.v1.Schema.fromObject(object.schema, long + 1); } @@ -25992,20 +26732,24 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CreateSchemaRequest.toObject = function toObject(message, options) { + CreateSchemaRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.parent = ""; object.schema = null; object.schemaId = ""; } - if (message.parent != null && message.hasOwnProperty("parent")) + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) object.parent = message.parent; - if (message.schema != null && message.hasOwnProperty("schema")) - object.schema = $root.google.pubsub.v1.Schema.toObject(message.schema, options); - if (message.schemaId != null && message.hasOwnProperty("schemaId")) + if (message.schema != null && Object.hasOwnProperty.call(message, "schema")) + object.schema = $root.google.pubsub.v1.Schema.toObject(message.schema, options, q + 1); + if (message.schemaId != null && Object.hasOwnProperty.call(message, "schemaId")) object.schemaId = message.schemaId; return object; }; @@ -26101,9 +26845,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetSchemaRequest.encode = function encode(message, writer) { + GetSchemaRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); if (message.view != null && Object.hasOwnProperty.call(message, "view")) @@ -26121,7 +26869,7 @@ * @returns {$protobuf.Writer} Writer */ GetSchemaRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -26195,10 +26943,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) if (!$util.isString(message.name)) return "name: string expected"; - if (message.view != null && message.hasOwnProperty("view")) + if (message.view != null && Object.hasOwnProperty.call(message, "view")) switch (message.view) { default: return "view: enum value expected"; @@ -26221,6 +26969,8 @@ GetSchemaRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.GetSchemaRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.GetSchemaRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -26260,17 +27010,21 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetSchemaRequest.toObject = function toObject(message, options) { + GetSchemaRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.name = ""; object.view = options.enums === String ? "SCHEMA_VIEW_UNSPECIFIED" : 0; } - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) object.name = message.name; - if (message.view != null && message.hasOwnProperty("view")) + if (message.view != null && Object.hasOwnProperty.call(message, "view")) object.view = options.enums === String ? $root.google.pubsub.v1.SchemaView[message.view] === undefined ? message.view : $root.google.pubsub.v1.SchemaView[message.view] : message.view; return object; }; @@ -26384,9 +27138,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListSchemasRequest.encode = function encode(message, writer) { + ListSchemasRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); if (message.view != null && Object.hasOwnProperty.call(message, "view")) @@ -26408,7 +27166,7 @@ * @returns {$protobuf.Writer} Writer */ ListSchemasRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -26490,10 +27248,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.parent != null && message.hasOwnProperty("parent")) + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) if (!$util.isString(message.parent)) return "parent: string expected"; - if (message.view != null && message.hasOwnProperty("view")) + if (message.view != null && Object.hasOwnProperty.call(message, "view")) switch (message.view) { default: return "view: enum value expected"; @@ -26502,10 +27260,10 @@ case 2: break; } - if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) if (!$util.isInteger(message.pageSize)) return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) if (!$util.isString(message.pageToken)) return "pageToken: string expected"; return null; @@ -26522,6 +27280,8 @@ ListSchemasRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.ListSchemasRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.ListSchemasRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -26565,9 +27325,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListSchemasRequest.toObject = function toObject(message, options) { + ListSchemasRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.parent = ""; @@ -26575,13 +27339,13 @@ object.pageSize = 0; object.pageToken = ""; } - if (message.parent != null && message.hasOwnProperty("parent")) + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) object.parent = message.parent; - if (message.view != null && message.hasOwnProperty("view")) + if (message.view != null && Object.hasOwnProperty.call(message, "view")) object.view = options.enums === String ? $root.google.pubsub.v1.SchemaView[message.view] === undefined ? message.view : $root.google.pubsub.v1.SchemaView[message.view] : message.view; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) object.pageToken = message.pageToken; return object; }; @@ -26678,12 +27442,16 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListSchemasResponse.encode = function encode(message, writer) { + ListSchemasResponse.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.schemas != null && message.schemas.length) for (var i = 0; i < message.schemas.length; ++i) - $root.google.pubsub.v1.Schema.encode(message.schemas[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.pubsub.v1.Schema.encode(message.schemas[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); return writer; @@ -26699,7 +27467,7 @@ * @returns {$protobuf.Writer} Writer */ ListSchemasResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -26775,7 +27543,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.schemas != null && message.hasOwnProperty("schemas")) { + if (message.schemas != null && Object.hasOwnProperty.call(message, "schemas")) { if (!Array.isArray(message.schemas)) return "schemas: array expected"; for (var i = 0; i < message.schemas.length; ++i) { @@ -26784,7 +27552,7 @@ return "schemas." + error; } } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) if (!$util.isString(message.nextPageToken)) return "nextPageToken: string expected"; return null; @@ -26801,6 +27569,8 @@ ListSchemasResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.ListSchemasResponse) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.ListSchemasResponse: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -26811,7 +27581,7 @@ throw TypeError(".google.pubsub.v1.ListSchemasResponse.schemas: array expected"); message.schemas = []; for (var i = 0; i < object.schemas.length; ++i) { - if (typeof object.schemas[i] !== "object") + if (!$util.isObject(object.schemas[i])) throw TypeError(".google.pubsub.v1.ListSchemasResponse.schemas: object expected"); message.schemas[i] = $root.google.pubsub.v1.Schema.fromObject(object.schemas[i], long + 1); } @@ -26830,9 +27600,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListSchemasResponse.toObject = function toObject(message, options) { + ListSchemasResponse.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.schemas = []; @@ -26841,9 +27615,9 @@ if (message.schemas && message.schemas.length) { object.schemas = []; for (var j = 0; j < message.schemas.length; ++j) - object.schemas[j] = $root.google.pubsub.v1.Schema.toObject(message.schemas[j], options); + object.schemas[j] = $root.google.pubsub.v1.Schema.toObject(message.schemas[j], options, q + 1); } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) object.nextPageToken = message.nextPageToken; return object; }; @@ -26957,9 +27731,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListSchemaRevisionsRequest.encode = function encode(message, writer) { + ListSchemaRevisionsRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); if (message.view != null && Object.hasOwnProperty.call(message, "view")) @@ -26981,7 +27759,7 @@ * @returns {$protobuf.Writer} Writer */ ListSchemaRevisionsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -27063,10 +27841,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) if (!$util.isString(message.name)) return "name: string expected"; - if (message.view != null && message.hasOwnProperty("view")) + if (message.view != null && Object.hasOwnProperty.call(message, "view")) switch (message.view) { default: return "view: enum value expected"; @@ -27075,10 +27853,10 @@ case 2: break; } - if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) if (!$util.isInteger(message.pageSize)) return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) if (!$util.isString(message.pageToken)) return "pageToken: string expected"; return null; @@ -27095,6 +27873,8 @@ ListSchemaRevisionsRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.ListSchemaRevisionsRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.ListSchemaRevisionsRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -27138,9 +27918,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListSchemaRevisionsRequest.toObject = function toObject(message, options) { + ListSchemaRevisionsRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.name = ""; @@ -27148,13 +27932,13 @@ object.pageSize = 0; object.pageToken = ""; } - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) object.name = message.name; - if (message.view != null && message.hasOwnProperty("view")) + if (message.view != null && Object.hasOwnProperty.call(message, "view")) object.view = options.enums === String ? $root.google.pubsub.v1.SchemaView[message.view] === undefined ? message.view : $root.google.pubsub.v1.SchemaView[message.view] : message.view; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) object.pageToken = message.pageToken; return object; }; @@ -27251,12 +28035,16 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListSchemaRevisionsResponse.encode = function encode(message, writer) { + ListSchemaRevisionsResponse.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.schemas != null && message.schemas.length) for (var i = 0; i < message.schemas.length; ++i) - $root.google.pubsub.v1.Schema.encode(message.schemas[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.pubsub.v1.Schema.encode(message.schemas[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); return writer; @@ -27272,7 +28060,7 @@ * @returns {$protobuf.Writer} Writer */ ListSchemaRevisionsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -27348,7 +28136,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.schemas != null && message.hasOwnProperty("schemas")) { + if (message.schemas != null && Object.hasOwnProperty.call(message, "schemas")) { if (!Array.isArray(message.schemas)) return "schemas: array expected"; for (var i = 0; i < message.schemas.length; ++i) { @@ -27357,7 +28145,7 @@ return "schemas." + error; } } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) if (!$util.isString(message.nextPageToken)) return "nextPageToken: string expected"; return null; @@ -27374,6 +28162,8 @@ ListSchemaRevisionsResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.ListSchemaRevisionsResponse) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.ListSchemaRevisionsResponse: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -27384,7 +28174,7 @@ throw TypeError(".google.pubsub.v1.ListSchemaRevisionsResponse.schemas: array expected"); message.schemas = []; for (var i = 0; i < object.schemas.length; ++i) { - if (typeof object.schemas[i] !== "object") + if (!$util.isObject(object.schemas[i])) throw TypeError(".google.pubsub.v1.ListSchemaRevisionsResponse.schemas: object expected"); message.schemas[i] = $root.google.pubsub.v1.Schema.fromObject(object.schemas[i], long + 1); } @@ -27403,9 +28193,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListSchemaRevisionsResponse.toObject = function toObject(message, options) { + ListSchemaRevisionsResponse.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.schemas = []; @@ -27414,9 +28208,9 @@ if (message.schemas && message.schemas.length) { object.schemas = []; for (var j = 0; j < message.schemas.length; ++j) - object.schemas[j] = $root.google.pubsub.v1.Schema.toObject(message.schemas[j], options); + object.schemas[j] = $root.google.pubsub.v1.Schema.toObject(message.schemas[j], options, q + 1); } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) object.nextPageToken = message.nextPageToken; return object; }; @@ -27512,13 +28306,17 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CommitSchemaRequest.encode = function encode(message, writer) { + CommitSchemaRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); if (message.schema != null && Object.hasOwnProperty.call(message, "schema")) - $root.google.pubsub.v1.Schema.encode(message.schema, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.pubsub.v1.Schema.encode(message.schema, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); return writer; }; @@ -27532,7 +28330,7 @@ * @returns {$protobuf.Writer} Writer */ CommitSchemaRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -27606,10 +28404,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) if (!$util.isString(message.name)) return "name: string expected"; - if (message.schema != null && message.hasOwnProperty("schema")) { + if (message.schema != null && Object.hasOwnProperty.call(message, "schema")) { var error = $root.google.pubsub.v1.Schema.verify(message.schema, long + 1); if (error) return "schema." + error; @@ -27628,6 +28426,8 @@ CommitSchemaRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.CommitSchemaRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.CommitSchemaRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -27636,7 +28436,7 @@ if (object.name != null) message.name = String(object.name); if (object.schema != null) { - if (typeof object.schema !== "object") + if (!$util.isObject(object.schema)) throw TypeError(".google.pubsub.v1.CommitSchemaRequest.schema: object expected"); message.schema = $root.google.pubsub.v1.Schema.fromObject(object.schema, long + 1); } @@ -27652,18 +28452,22 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CommitSchemaRequest.toObject = function toObject(message, options) { + CommitSchemaRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.name = ""; object.schema = null; } - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) object.name = message.name; - if (message.schema != null && message.hasOwnProperty("schema")) - object.schema = $root.google.pubsub.v1.Schema.toObject(message.schema, options); + if (message.schema != null && Object.hasOwnProperty.call(message, "schema")) + object.schema = $root.google.pubsub.v1.Schema.toObject(message.schema, options, q + 1); return object; }; @@ -27758,9 +28562,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RollbackSchemaRequest.encode = function encode(message, writer) { + RollbackSchemaRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); if (message.revisionId != null && Object.hasOwnProperty.call(message, "revisionId")) @@ -27778,7 +28586,7 @@ * @returns {$protobuf.Writer} Writer */ RollbackSchemaRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -27852,10 +28660,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) if (!$util.isString(message.name)) return "name: string expected"; - if (message.revisionId != null && message.hasOwnProperty("revisionId")) + if (message.revisionId != null && Object.hasOwnProperty.call(message, "revisionId")) if (!$util.isString(message.revisionId)) return "revisionId: string expected"; return null; @@ -27872,6 +28680,8 @@ RollbackSchemaRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.RollbackSchemaRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.RollbackSchemaRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -27893,17 +28703,21 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RollbackSchemaRequest.toObject = function toObject(message, options) { + RollbackSchemaRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.name = ""; object.revisionId = ""; } - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) object.name = message.name; - if (message.revisionId != null && message.hasOwnProperty("revisionId")) + if (message.revisionId != null && Object.hasOwnProperty.call(message, "revisionId")) object.revisionId = message.revisionId; return object; }; @@ -27999,9 +28813,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteSchemaRevisionRequest.encode = function encode(message, writer) { + DeleteSchemaRevisionRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); if (message.revisionId != null && Object.hasOwnProperty.call(message, "revisionId")) @@ -28019,7 +28837,7 @@ * @returns {$protobuf.Writer} Writer */ DeleteSchemaRevisionRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -28093,10 +28911,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) if (!$util.isString(message.name)) return "name: string expected"; - if (message.revisionId != null && message.hasOwnProperty("revisionId")) + if (message.revisionId != null && Object.hasOwnProperty.call(message, "revisionId")) if (!$util.isString(message.revisionId)) return "revisionId: string expected"; return null; @@ -28113,6 +28931,8 @@ DeleteSchemaRevisionRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.DeleteSchemaRevisionRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.DeleteSchemaRevisionRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -28134,17 +28954,21 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DeleteSchemaRevisionRequest.toObject = function toObject(message, options) { + DeleteSchemaRevisionRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.name = ""; object.revisionId = ""; } - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) object.name = message.name; - if (message.revisionId != null && message.hasOwnProperty("revisionId")) + if (message.revisionId != null && Object.hasOwnProperty.call(message, "revisionId")) object.revisionId = message.revisionId; return object; }; @@ -28231,9 +29055,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteSchemaRequest.encode = function encode(message, writer) { + DeleteSchemaRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; @@ -28249,7 +29077,7 @@ * @returns {$protobuf.Writer} Writer */ DeleteSchemaRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -28319,7 +29147,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) if (!$util.isString(message.name)) return "name: string expected"; return null; @@ -28336,6 +29164,8 @@ DeleteSchemaRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.DeleteSchemaRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.DeleteSchemaRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -28355,13 +29185,17 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DeleteSchemaRequest.toObject = function toObject(message, options) { + DeleteSchemaRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) object.name = message.name; return object; }; @@ -28457,13 +29291,17 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ValidateSchemaRequest.encode = function encode(message, writer) { + ValidateSchemaRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); if (message.schema != null && Object.hasOwnProperty.call(message, "schema")) - $root.google.pubsub.v1.Schema.encode(message.schema, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.pubsub.v1.Schema.encode(message.schema, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); return writer; }; @@ -28477,7 +29315,7 @@ * @returns {$protobuf.Writer} Writer */ ValidateSchemaRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -28551,10 +29389,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.parent != null && message.hasOwnProperty("parent")) + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) if (!$util.isString(message.parent)) return "parent: string expected"; - if (message.schema != null && message.hasOwnProperty("schema")) { + if (message.schema != null && Object.hasOwnProperty.call(message, "schema")) { var error = $root.google.pubsub.v1.Schema.verify(message.schema, long + 1); if (error) return "schema." + error; @@ -28573,6 +29411,8 @@ ValidateSchemaRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.ValidateSchemaRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.ValidateSchemaRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -28581,7 +29421,7 @@ if (object.parent != null) message.parent = String(object.parent); if (object.schema != null) { - if (typeof object.schema !== "object") + if (!$util.isObject(object.schema)) throw TypeError(".google.pubsub.v1.ValidateSchemaRequest.schema: object expected"); message.schema = $root.google.pubsub.v1.Schema.fromObject(object.schema, long + 1); } @@ -28597,18 +29437,22 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ValidateSchemaRequest.toObject = function toObject(message, options) { + ValidateSchemaRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.parent = ""; object.schema = null; } - if (message.parent != null && message.hasOwnProperty("parent")) + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) object.parent = message.parent; - if (message.schema != null && message.hasOwnProperty("schema")) - object.schema = $root.google.pubsub.v1.Schema.toObject(message.schema, options); + if (message.schema != null && Object.hasOwnProperty.call(message, "schema")) + object.schema = $root.google.pubsub.v1.Schema.toObject(message.schema, options, q + 1); return object; }; @@ -28685,9 +29529,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ValidateSchemaResponse.encode = function encode(message, writer) { + ValidateSchemaResponse.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); return writer; }; @@ -28701,7 +29549,7 @@ * @returns {$protobuf.Writer} Writer */ ValidateSchemaResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -28781,10 +29629,6 @@ ValidateSchemaResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.ValidateSchemaResponse) return object; - if (long === undefined) - long = 0; - if (long > $util.recursionLimit) - throw Error("maximum nesting depth exceeded"); return new $root.google.pubsub.v1.ValidateSchemaResponse(); }; @@ -28933,15 +29777,19 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ValidateMessageRequest.encode = function encode(message, writer) { + ValidateMessageRequest.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.name); if (message.schema != null && Object.hasOwnProperty.call(message, "schema")) - $root.google.pubsub.v1.Schema.encode(message.schema, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + $root.google.pubsub.v1.Schema.encode(message.schema, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); if (message.message != null && Object.hasOwnProperty.call(message, "message")) writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.message); if (message.encoding != null && Object.hasOwnProperty.call(message, "encoding")) @@ -28959,7 +29807,7 @@ * @returns {$protobuf.Writer} Writer */ ValidateMessageRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -29046,15 +29894,15 @@ if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; var properties = {}; - if (message.parent != null && message.hasOwnProperty("parent")) + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) if (!$util.isString(message.parent)) return "parent: string expected"; - if (message.name != null && message.hasOwnProperty("name")) { + if (message.name != null && Object.hasOwnProperty.call(message, "name")) { properties.schemaSpec = 1; if (!$util.isString(message.name)) return "name: string expected"; } - if (message.schema != null && message.hasOwnProperty("schema")) { + if (message.schema != null && Object.hasOwnProperty.call(message, "schema")) { if (properties.schemaSpec === 1) return "schemaSpec: multiple values"; properties.schemaSpec = 1; @@ -29064,10 +29912,10 @@ return "schema." + error; } } - if (message.message != null && message.hasOwnProperty("message")) + if (message.message != null && Object.hasOwnProperty.call(message, "message")) if (!(message.message && typeof message.message.length === "number" || $util.isString(message.message))) return "message: buffer expected"; - if (message.encoding != null && message.hasOwnProperty("encoding")) + if (message.encoding != null && Object.hasOwnProperty.call(message, "encoding")) switch (message.encoding) { default: return "encoding: enum value expected"; @@ -29090,6 +29938,8 @@ ValidateMessageRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.ValidateMessageRequest) return object; + if (!$util.isObject(object)) + throw TypeError(".google.pubsub.v1.ValidateMessageRequest: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -29100,7 +29950,7 @@ if (object.name != null) message.name = String(object.name); if (object.schema != null) { - if (typeof object.schema !== "object") + if (!$util.isObject(object.schema)) throw TypeError(".google.pubsub.v1.ValidateMessageRequest.schema: object expected"); message.schema = $root.google.pubsub.v1.Schema.fromObject(object.schema, long + 1); } @@ -29141,9 +29991,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ValidateMessageRequest.toObject = function toObject(message, options) { + ValidateMessageRequest.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.parent = ""; @@ -29156,21 +30010,21 @@ } object.encoding = options.enums === String ? "ENCODING_UNSPECIFIED" : 0; } - if (message.parent != null && message.hasOwnProperty("parent")) + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) object.parent = message.parent; - if (message.name != null && message.hasOwnProperty("name")) { + if (message.name != null && Object.hasOwnProperty.call(message, "name")) { object.name = message.name; if (options.oneofs) object.schemaSpec = "name"; } - if (message.schema != null && message.hasOwnProperty("schema")) { - object.schema = $root.google.pubsub.v1.Schema.toObject(message.schema, options); + if (message.schema != null && Object.hasOwnProperty.call(message, "schema")) { + object.schema = $root.google.pubsub.v1.Schema.toObject(message.schema, options, q + 1); if (options.oneofs) object.schemaSpec = "schema"; } - if (message.message != null && message.hasOwnProperty("message")) + if (message.message != null && Object.hasOwnProperty.call(message, "message")) object.message = options.bytes === String ? $util.base64.encode(message.message, 0, message.message.length) : options.bytes === Array ? Array.prototype.slice.call(message.message) : message.message; - if (message.encoding != null && message.hasOwnProperty("encoding")) + if (message.encoding != null && Object.hasOwnProperty.call(message, "encoding")) object.encoding = options.enums === String ? $root.google.pubsub.v1.Encoding[message.encoding] === undefined ? message.encoding : $root.google.pubsub.v1.Encoding[message.encoding] : message.encoding; return object; }; @@ -29248,9 +30102,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ValidateMessageResponse.encode = function encode(message, writer) { + ValidateMessageResponse.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); return writer; }; @@ -29264,7 +30122,7 @@ * @returns {$protobuf.Writer} Writer */ ValidateMessageResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -29344,10 +30202,6 @@ ValidateMessageResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.pubsub.v1.ValidateMessageResponse) return object; - if (long === undefined) - long = 0; - if (long > $util.recursionLimit) - throw Error("maximum nesting depth exceeded"); return new $root.google.pubsub.v1.ValidateMessageResponse(); }; @@ -29487,12 +30341,16 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Http.encode = function encode(message, writer) { + Http.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.rules != null && message.rules.length) for (var i = 0; i < message.rules.length; ++i) - $root.google.api.HttpRule.encode(message.rules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.api.HttpRule.encode(message.rules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); if (message.fullyDecodeReservedExpansion != null && Object.hasOwnProperty.call(message, "fullyDecodeReservedExpansion")) writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullyDecodeReservedExpansion); return writer; @@ -29508,7 +30366,7 @@ * @returns {$protobuf.Writer} Writer */ Http.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -29584,7 +30442,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.rules != null && message.hasOwnProperty("rules")) { + if (message.rules != null && Object.hasOwnProperty.call(message, "rules")) { if (!Array.isArray(message.rules)) return "rules: array expected"; for (var i = 0; i < message.rules.length; ++i) { @@ -29593,7 +30451,7 @@ return "rules." + error; } } - if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + if (message.fullyDecodeReservedExpansion != null && Object.hasOwnProperty.call(message, "fullyDecodeReservedExpansion")) if (typeof message.fullyDecodeReservedExpansion !== "boolean") return "fullyDecodeReservedExpansion: boolean expected"; return null; @@ -29610,6 +30468,8 @@ Http.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.Http) return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.Http: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -29620,7 +30480,7 @@ throw TypeError(".google.api.Http.rules: array expected"); message.rules = []; for (var i = 0; i < object.rules.length; ++i) { - if (typeof object.rules[i] !== "object") + if (!$util.isObject(object.rules[i])) throw TypeError(".google.api.Http.rules: object expected"); message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i], long + 1); } @@ -29639,9 +30499,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Http.toObject = function toObject(message, options) { + Http.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.rules = []; @@ -29650,9 +30514,9 @@ if (message.rules && message.rules.length) { object.rules = []; for (var j = 0; j < message.rules.length; ++j) - object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options); + object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options, q + 1); } - if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + if (message.fullyDecodeReservedExpansion != null && Object.hasOwnProperty.call(message, "fullyDecodeReservedExpansion")) object.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; return object; }; @@ -29835,9 +30699,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - HttpRule.encode = function encode(message, writer) { + HttpRule.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); if (message.get != null && Object.hasOwnProperty.call(message, "get")) @@ -29853,10 +30721,10 @@ if (message.body != null && Object.hasOwnProperty.call(message, "body")) writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); if (message.custom != null && Object.hasOwnProperty.call(message, "custom")) - $root.google.api.CustomHttpPattern.encode(message.custom, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + $root.google.api.CustomHttpPattern.encode(message.custom, writer.uint32(/* id 8, wireType 2 =*/66).fork(), q + 1).ldelim(); if (message.additionalBindings != null && message.additionalBindings.length) for (var i = 0; i < message.additionalBindings.length; ++i) - $root.google.api.HttpRule.encode(message.additionalBindings[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + $root.google.api.HttpRule.encode(message.additionalBindings[i], writer.uint32(/* id 11, wireType 2 =*/90).fork(), q + 1).ldelim(); if (message.responseBody != null && Object.hasOwnProperty.call(message, "responseBody")) writer.uint32(/* id 12, wireType 2 =*/98).string(message.responseBody); return writer; @@ -29872,7 +30740,7 @@ * @returns {$protobuf.Writer} Writer */ HttpRule.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -29981,43 +30849,43 @@ if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; var properties = {}; - if (message.selector != null && message.hasOwnProperty("selector")) + if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) if (!$util.isString(message.selector)) return "selector: string expected"; - if (message.get != null && message.hasOwnProperty("get")) { + if (message.get != null && Object.hasOwnProperty.call(message, "get")) { properties.pattern = 1; if (!$util.isString(message.get)) return "get: string expected"; } - if (message.put != null && message.hasOwnProperty("put")) { + if (message.put != null && Object.hasOwnProperty.call(message, "put")) { if (properties.pattern === 1) return "pattern: multiple values"; properties.pattern = 1; if (!$util.isString(message.put)) return "put: string expected"; } - if (message.post != null && message.hasOwnProperty("post")) { + if (message.post != null && Object.hasOwnProperty.call(message, "post")) { if (properties.pattern === 1) return "pattern: multiple values"; properties.pattern = 1; if (!$util.isString(message.post)) return "post: string expected"; } - if (message["delete"] != null && message.hasOwnProperty("delete")) { + if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) { if (properties.pattern === 1) return "pattern: multiple values"; properties.pattern = 1; if (!$util.isString(message["delete"])) return "delete: string expected"; } - if (message.patch != null && message.hasOwnProperty("patch")) { + if (message.patch != null && Object.hasOwnProperty.call(message, "patch")) { if (properties.pattern === 1) return "pattern: multiple values"; properties.pattern = 1; if (!$util.isString(message.patch)) return "patch: string expected"; } - if (message.custom != null && message.hasOwnProperty("custom")) { + if (message.custom != null && Object.hasOwnProperty.call(message, "custom")) { if (properties.pattern === 1) return "pattern: multiple values"; properties.pattern = 1; @@ -30027,13 +30895,13 @@ return "custom." + error; } } - if (message.body != null && message.hasOwnProperty("body")) + if (message.body != null && Object.hasOwnProperty.call(message, "body")) if (!$util.isString(message.body)) return "body: string expected"; - if (message.responseBody != null && message.hasOwnProperty("responseBody")) + if (message.responseBody != null && Object.hasOwnProperty.call(message, "responseBody")) if (!$util.isString(message.responseBody)) return "responseBody: string expected"; - if (message.additionalBindings != null && message.hasOwnProperty("additionalBindings")) { + if (message.additionalBindings != null && Object.hasOwnProperty.call(message, "additionalBindings")) { if (!Array.isArray(message.additionalBindings)) return "additionalBindings: array expected"; for (var i = 0; i < message.additionalBindings.length; ++i) { @@ -30056,6 +30924,8 @@ HttpRule.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.HttpRule) return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.HttpRule: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -30074,7 +30944,7 @@ if (object.patch != null) message.patch = String(object.patch); if (object.custom != null) { - if (typeof object.custom !== "object") + if (!$util.isObject(object.custom)) throw TypeError(".google.api.HttpRule.custom: object expected"); message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom, long + 1); } @@ -30087,7 +30957,7 @@ throw TypeError(".google.api.HttpRule.additionalBindings: array expected"); message.additionalBindings = []; for (var i = 0; i < object.additionalBindings.length; ++i) { - if (typeof object.additionalBindings[i] !== "object") + if (!$util.isObject(object.additionalBindings[i])) throw TypeError(".google.api.HttpRule.additionalBindings: object expected"); message.additionalBindings[i] = $root.google.api.HttpRule.fromObject(object.additionalBindings[i], long + 1); } @@ -30104,9 +30974,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - HttpRule.toObject = function toObject(message, options) { + HttpRule.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.additionalBindings = []; @@ -30115,46 +30989,46 @@ object.body = ""; object.responseBody = ""; } - if (message.selector != null && message.hasOwnProperty("selector")) + if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) object.selector = message.selector; - if (message.get != null && message.hasOwnProperty("get")) { + if (message.get != null && Object.hasOwnProperty.call(message, "get")) { object.get = message.get; if (options.oneofs) object.pattern = "get"; } - if (message.put != null && message.hasOwnProperty("put")) { + if (message.put != null && Object.hasOwnProperty.call(message, "put")) { object.put = message.put; if (options.oneofs) object.pattern = "put"; } - if (message.post != null && message.hasOwnProperty("post")) { + if (message.post != null && Object.hasOwnProperty.call(message, "post")) { object.post = message.post; if (options.oneofs) object.pattern = "post"; } - if (message["delete"] != null && message.hasOwnProperty("delete")) { + if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) { object["delete"] = message["delete"]; if (options.oneofs) object.pattern = "delete"; } - if (message.patch != null && message.hasOwnProperty("patch")) { + if (message.patch != null && Object.hasOwnProperty.call(message, "patch")) { object.patch = message.patch; if (options.oneofs) object.pattern = "patch"; } - if (message.body != null && message.hasOwnProperty("body")) + if (message.body != null && Object.hasOwnProperty.call(message, "body")) object.body = message.body; - if (message.custom != null && message.hasOwnProperty("custom")) { - object.custom = $root.google.api.CustomHttpPattern.toObject(message.custom, options); + if (message.custom != null && Object.hasOwnProperty.call(message, "custom")) { + object.custom = $root.google.api.CustomHttpPattern.toObject(message.custom, options, q + 1); if (options.oneofs) object.pattern = "custom"; } if (message.additionalBindings && message.additionalBindings.length) { object.additionalBindings = []; for (var j = 0; j < message.additionalBindings.length; ++j) - object.additionalBindings[j] = $root.google.api.HttpRule.toObject(message.additionalBindings[j], options); + object.additionalBindings[j] = $root.google.api.HttpRule.toObject(message.additionalBindings[j], options, q + 1); } - if (message.responseBody != null && message.hasOwnProperty("responseBody")) + if (message.responseBody != null && Object.hasOwnProperty.call(message, "responseBody")) object.responseBody = message.responseBody; return object; }; @@ -30250,9 +31124,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CustomHttpPattern.encode = function encode(message, writer) { + CustomHttpPattern.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); if (message.path != null && Object.hasOwnProperty.call(message, "path")) @@ -30270,7 +31148,7 @@ * @returns {$protobuf.Writer} Writer */ CustomHttpPattern.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -30344,10 +31222,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.kind != null && message.hasOwnProperty("kind")) + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) if (!$util.isString(message.kind)) return "kind: string expected"; - if (message.path != null && message.hasOwnProperty("path")) + if (message.path != null && Object.hasOwnProperty.call(message, "path")) if (!$util.isString(message.path)) return "path: string expected"; return null; @@ -30364,6 +31242,8 @@ CustomHttpPattern.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.CustomHttpPattern) return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.CustomHttpPattern: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -30385,17 +31265,21 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CustomHttpPattern.toObject = function toObject(message, options) { + CustomHttpPattern.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.kind = ""; object.path = ""; } - if (message.kind != null && message.hasOwnProperty("kind")) + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) object.kind = message.kind; - if (message.path != null && message.hasOwnProperty("path")) + if (message.path != null && Object.hasOwnProperty.call(message, "path")) object.path = message.path; return object; }; @@ -30501,9 +31385,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CommonLanguageSettings.encode = function encode(message, writer) { + CommonLanguageSettings.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.referenceDocsUri != null && Object.hasOwnProperty.call(message, "referenceDocsUri")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.referenceDocsUri); if (message.destinations != null && message.destinations.length) { @@ -30513,7 +31401,7 @@ writer.ldelim(); } if (message.selectiveGapicGeneration != null && Object.hasOwnProperty.call(message, "selectiveGapicGeneration")) - $root.google.api.SelectiveGapicGeneration.encode(message.selectiveGapicGeneration, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + $root.google.api.SelectiveGapicGeneration.encode(message.selectiveGapicGeneration, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); return writer; }; @@ -30527,7 +31415,7 @@ * @returns {$protobuf.Writer} Writer */ CommonLanguageSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -30612,10 +31500,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.referenceDocsUri != null && message.hasOwnProperty("referenceDocsUri")) + if (message.referenceDocsUri != null && Object.hasOwnProperty.call(message, "referenceDocsUri")) if (!$util.isString(message.referenceDocsUri)) return "referenceDocsUri: string expected"; - if (message.destinations != null && message.hasOwnProperty("destinations")) { + if (message.destinations != null && Object.hasOwnProperty.call(message, "destinations")) { if (!Array.isArray(message.destinations)) return "destinations: array expected"; for (var i = 0; i < message.destinations.length; ++i) @@ -30628,7 +31516,7 @@ break; } } - if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) { + if (message.selectiveGapicGeneration != null && Object.hasOwnProperty.call(message, "selectiveGapicGeneration")) { var error = $root.google.api.SelectiveGapicGeneration.verify(message.selectiveGapicGeneration, long + 1); if (error) return "selectiveGapicGeneration." + error; @@ -30647,6 +31535,8 @@ CommonLanguageSettings.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.CommonLanguageSettings) return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.CommonLanguageSettings: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -30680,7 +31570,7 @@ } } if (object.selectiveGapicGeneration != null) { - if (typeof object.selectiveGapicGeneration !== "object") + if (!$util.isObject(object.selectiveGapicGeneration)) throw TypeError(".google.api.CommonLanguageSettings.selectiveGapicGeneration: object expected"); message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.fromObject(object.selectiveGapicGeneration, long + 1); } @@ -30696,9 +31586,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CommonLanguageSettings.toObject = function toObject(message, options) { + CommonLanguageSettings.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.destinations = []; @@ -30706,15 +31600,15 @@ object.referenceDocsUri = ""; object.selectiveGapicGeneration = null; } - if (message.referenceDocsUri != null && message.hasOwnProperty("referenceDocsUri")) + if (message.referenceDocsUri != null && Object.hasOwnProperty.call(message, "referenceDocsUri")) object.referenceDocsUri = message.referenceDocsUri; if (message.destinations && message.destinations.length) { object.destinations = []; for (var j = 0; j < message.destinations.length; ++j) object.destinations[j] = options.enums === String ? $root.google.api.ClientLibraryDestination[message.destinations[j]] === undefined ? message.destinations[j] : $root.google.api.ClientLibraryDestination[message.destinations[j]] : message.destinations[j]; } - if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) - object.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.toObject(message.selectiveGapicGeneration, options); + if (message.selectiveGapicGeneration != null && Object.hasOwnProperty.call(message, "selectiveGapicGeneration")) + object.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.toObject(message.selectiveGapicGeneration, options, q + 1); return object; }; @@ -30890,9 +31784,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ClientLibrarySettings.encode = function encode(message, writer) { + ClientLibrarySettings.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.version != null && Object.hasOwnProperty.call(message, "version")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.version); if (message.launchStage != null && Object.hasOwnProperty.call(message, "launchStage")) @@ -30900,21 +31798,21 @@ if (message.restNumericEnums != null && Object.hasOwnProperty.call(message, "restNumericEnums")) writer.uint32(/* id 3, wireType 0 =*/24).bool(message.restNumericEnums); if (message.javaSettings != null && Object.hasOwnProperty.call(message, "javaSettings")) - $root.google.api.JavaSettings.encode(message.javaSettings, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + $root.google.api.JavaSettings.encode(message.javaSettings, writer.uint32(/* id 21, wireType 2 =*/170).fork(), q + 1).ldelim(); if (message.cppSettings != null && Object.hasOwnProperty.call(message, "cppSettings")) - $root.google.api.CppSettings.encode(message.cppSettings, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); + $root.google.api.CppSettings.encode(message.cppSettings, writer.uint32(/* id 22, wireType 2 =*/178).fork(), q + 1).ldelim(); if (message.phpSettings != null && Object.hasOwnProperty.call(message, "phpSettings")) - $root.google.api.PhpSettings.encode(message.phpSettings, writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); + $root.google.api.PhpSettings.encode(message.phpSettings, writer.uint32(/* id 23, wireType 2 =*/186).fork(), q + 1).ldelim(); if (message.pythonSettings != null && Object.hasOwnProperty.call(message, "pythonSettings")) - $root.google.api.PythonSettings.encode(message.pythonSettings, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); + $root.google.api.PythonSettings.encode(message.pythonSettings, writer.uint32(/* id 24, wireType 2 =*/194).fork(), q + 1).ldelim(); if (message.nodeSettings != null && Object.hasOwnProperty.call(message, "nodeSettings")) - $root.google.api.NodeSettings.encode(message.nodeSettings, writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim(); + $root.google.api.NodeSettings.encode(message.nodeSettings, writer.uint32(/* id 25, wireType 2 =*/202).fork(), q + 1).ldelim(); if (message.dotnetSettings != null && Object.hasOwnProperty.call(message, "dotnetSettings")) - $root.google.api.DotnetSettings.encode(message.dotnetSettings, writer.uint32(/* id 26, wireType 2 =*/210).fork()).ldelim(); + $root.google.api.DotnetSettings.encode(message.dotnetSettings, writer.uint32(/* id 26, wireType 2 =*/210).fork(), q + 1).ldelim(); if (message.rubySettings != null && Object.hasOwnProperty.call(message, "rubySettings")) - $root.google.api.RubySettings.encode(message.rubySettings, writer.uint32(/* id 27, wireType 2 =*/218).fork()).ldelim(); + $root.google.api.RubySettings.encode(message.rubySettings, writer.uint32(/* id 27, wireType 2 =*/218).fork(), q + 1).ldelim(); if (message.goSettings != null && Object.hasOwnProperty.call(message, "goSettings")) - $root.google.api.GoSettings.encode(message.goSettings, writer.uint32(/* id 28, wireType 2 =*/226).fork()).ldelim(); + $root.google.api.GoSettings.encode(message.goSettings, writer.uint32(/* id 28, wireType 2 =*/226).fork(), q + 1).ldelim(); return writer; }; @@ -30928,7 +31826,7 @@ * @returns {$protobuf.Writer} Writer */ ClientLibrarySettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -31038,10 +31936,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.version != null && message.hasOwnProperty("version")) + if (message.version != null && Object.hasOwnProperty.call(message, "version")) if (!$util.isString(message.version)) return "version: string expected"; - if (message.launchStage != null && message.hasOwnProperty("launchStage")) + if (message.launchStage != null && Object.hasOwnProperty.call(message, "launchStage")) switch (message.launchStage) { default: return "launchStage: enum value expected"; @@ -31055,45 +31953,45 @@ case 5: break; } - if (message.restNumericEnums != null && message.hasOwnProperty("restNumericEnums")) + if (message.restNumericEnums != null && Object.hasOwnProperty.call(message, "restNumericEnums")) if (typeof message.restNumericEnums !== "boolean") return "restNumericEnums: boolean expected"; - if (message.javaSettings != null && message.hasOwnProperty("javaSettings")) { + if (message.javaSettings != null && Object.hasOwnProperty.call(message, "javaSettings")) { var error = $root.google.api.JavaSettings.verify(message.javaSettings, long + 1); if (error) return "javaSettings." + error; } - if (message.cppSettings != null && message.hasOwnProperty("cppSettings")) { + if (message.cppSettings != null && Object.hasOwnProperty.call(message, "cppSettings")) { var error = $root.google.api.CppSettings.verify(message.cppSettings, long + 1); if (error) return "cppSettings." + error; } - if (message.phpSettings != null && message.hasOwnProperty("phpSettings")) { + if (message.phpSettings != null && Object.hasOwnProperty.call(message, "phpSettings")) { var error = $root.google.api.PhpSettings.verify(message.phpSettings, long + 1); if (error) return "phpSettings." + error; } - if (message.pythonSettings != null && message.hasOwnProperty("pythonSettings")) { + if (message.pythonSettings != null && Object.hasOwnProperty.call(message, "pythonSettings")) { var error = $root.google.api.PythonSettings.verify(message.pythonSettings, long + 1); if (error) return "pythonSettings." + error; } - if (message.nodeSettings != null && message.hasOwnProperty("nodeSettings")) { + if (message.nodeSettings != null && Object.hasOwnProperty.call(message, "nodeSettings")) { var error = $root.google.api.NodeSettings.verify(message.nodeSettings, long + 1); if (error) return "nodeSettings." + error; } - if (message.dotnetSettings != null && message.hasOwnProperty("dotnetSettings")) { + if (message.dotnetSettings != null && Object.hasOwnProperty.call(message, "dotnetSettings")) { var error = $root.google.api.DotnetSettings.verify(message.dotnetSettings, long + 1); if (error) return "dotnetSettings." + error; } - if (message.rubySettings != null && message.hasOwnProperty("rubySettings")) { + if (message.rubySettings != null && Object.hasOwnProperty.call(message, "rubySettings")) { var error = $root.google.api.RubySettings.verify(message.rubySettings, long + 1); if (error) return "rubySettings." + error; } - if (message.goSettings != null && message.hasOwnProperty("goSettings")) { + if (message.goSettings != null && Object.hasOwnProperty.call(message, "goSettings")) { var error = $root.google.api.GoSettings.verify(message.goSettings, long + 1); if (error) return "goSettings." + error; @@ -31112,6 +32010,8 @@ ClientLibrarySettings.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.ClientLibrarySettings) return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.ClientLibrarySettings: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -31162,42 +32062,42 @@ if (object.restNumericEnums != null) message.restNumericEnums = Boolean(object.restNumericEnums); if (object.javaSettings != null) { - if (typeof object.javaSettings !== "object") + if (!$util.isObject(object.javaSettings)) throw TypeError(".google.api.ClientLibrarySettings.javaSettings: object expected"); message.javaSettings = $root.google.api.JavaSettings.fromObject(object.javaSettings, long + 1); } if (object.cppSettings != null) { - if (typeof object.cppSettings !== "object") + if (!$util.isObject(object.cppSettings)) throw TypeError(".google.api.ClientLibrarySettings.cppSettings: object expected"); message.cppSettings = $root.google.api.CppSettings.fromObject(object.cppSettings, long + 1); } if (object.phpSettings != null) { - if (typeof object.phpSettings !== "object") + if (!$util.isObject(object.phpSettings)) throw TypeError(".google.api.ClientLibrarySettings.phpSettings: object expected"); message.phpSettings = $root.google.api.PhpSettings.fromObject(object.phpSettings, long + 1); } if (object.pythonSettings != null) { - if (typeof object.pythonSettings !== "object") + if (!$util.isObject(object.pythonSettings)) throw TypeError(".google.api.ClientLibrarySettings.pythonSettings: object expected"); message.pythonSettings = $root.google.api.PythonSettings.fromObject(object.pythonSettings, long + 1); } if (object.nodeSettings != null) { - if (typeof object.nodeSettings !== "object") + if (!$util.isObject(object.nodeSettings)) throw TypeError(".google.api.ClientLibrarySettings.nodeSettings: object expected"); message.nodeSettings = $root.google.api.NodeSettings.fromObject(object.nodeSettings, long + 1); } if (object.dotnetSettings != null) { - if (typeof object.dotnetSettings !== "object") + if (!$util.isObject(object.dotnetSettings)) throw TypeError(".google.api.ClientLibrarySettings.dotnetSettings: object expected"); message.dotnetSettings = $root.google.api.DotnetSettings.fromObject(object.dotnetSettings, long + 1); } if (object.rubySettings != null) { - if (typeof object.rubySettings !== "object") + if (!$util.isObject(object.rubySettings)) throw TypeError(".google.api.ClientLibrarySettings.rubySettings: object expected"); message.rubySettings = $root.google.api.RubySettings.fromObject(object.rubySettings, long + 1); } if (object.goSettings != null) { - if (typeof object.goSettings !== "object") + if (!$util.isObject(object.goSettings)) throw TypeError(".google.api.ClientLibrarySettings.goSettings: object expected"); message.goSettings = $root.google.api.GoSettings.fromObject(object.goSettings, long + 1); } @@ -31213,9 +32113,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ClientLibrarySettings.toObject = function toObject(message, options) { + ClientLibrarySettings.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.version = ""; @@ -31230,28 +32134,28 @@ object.rubySettings = null; object.goSettings = null; } - if (message.version != null && message.hasOwnProperty("version")) + if (message.version != null && Object.hasOwnProperty.call(message, "version")) object.version = message.version; - if (message.launchStage != null && message.hasOwnProperty("launchStage")) + if (message.launchStage != null && Object.hasOwnProperty.call(message, "launchStage")) object.launchStage = options.enums === String ? $root.google.api.LaunchStage[message.launchStage] === undefined ? message.launchStage : $root.google.api.LaunchStage[message.launchStage] : message.launchStage; - if (message.restNumericEnums != null && message.hasOwnProperty("restNumericEnums")) + if (message.restNumericEnums != null && Object.hasOwnProperty.call(message, "restNumericEnums")) object.restNumericEnums = message.restNumericEnums; - if (message.javaSettings != null && message.hasOwnProperty("javaSettings")) - object.javaSettings = $root.google.api.JavaSettings.toObject(message.javaSettings, options); - if (message.cppSettings != null && message.hasOwnProperty("cppSettings")) - object.cppSettings = $root.google.api.CppSettings.toObject(message.cppSettings, options); - if (message.phpSettings != null && message.hasOwnProperty("phpSettings")) - object.phpSettings = $root.google.api.PhpSettings.toObject(message.phpSettings, options); - if (message.pythonSettings != null && message.hasOwnProperty("pythonSettings")) - object.pythonSettings = $root.google.api.PythonSettings.toObject(message.pythonSettings, options); - if (message.nodeSettings != null && message.hasOwnProperty("nodeSettings")) - object.nodeSettings = $root.google.api.NodeSettings.toObject(message.nodeSettings, options); - if (message.dotnetSettings != null && message.hasOwnProperty("dotnetSettings")) - object.dotnetSettings = $root.google.api.DotnetSettings.toObject(message.dotnetSettings, options); - if (message.rubySettings != null && message.hasOwnProperty("rubySettings")) - object.rubySettings = $root.google.api.RubySettings.toObject(message.rubySettings, options); - if (message.goSettings != null && message.hasOwnProperty("goSettings")) - object.goSettings = $root.google.api.GoSettings.toObject(message.goSettings, options); + if (message.javaSettings != null && Object.hasOwnProperty.call(message, "javaSettings")) + object.javaSettings = $root.google.api.JavaSettings.toObject(message.javaSettings, options, q + 1); + if (message.cppSettings != null && Object.hasOwnProperty.call(message, "cppSettings")) + object.cppSettings = $root.google.api.CppSettings.toObject(message.cppSettings, options, q + 1); + if (message.phpSettings != null && Object.hasOwnProperty.call(message, "phpSettings")) + object.phpSettings = $root.google.api.PhpSettings.toObject(message.phpSettings, options, q + 1); + if (message.pythonSettings != null && Object.hasOwnProperty.call(message, "pythonSettings")) + object.pythonSettings = $root.google.api.PythonSettings.toObject(message.pythonSettings, options, q + 1); + if (message.nodeSettings != null && Object.hasOwnProperty.call(message, "nodeSettings")) + object.nodeSettings = $root.google.api.NodeSettings.toObject(message.nodeSettings, options, q + 1); + if (message.dotnetSettings != null && Object.hasOwnProperty.call(message, "dotnetSettings")) + object.dotnetSettings = $root.google.api.DotnetSettings.toObject(message.dotnetSettings, options, q + 1); + if (message.rubySettings != null && Object.hasOwnProperty.call(message, "rubySettings")) + object.rubySettings = $root.google.api.RubySettings.toObject(message.rubySettings, options, q + 1); + if (message.goSettings != null && Object.hasOwnProperty.call(message, "goSettings")) + object.goSettings = $root.google.api.GoSettings.toObject(message.goSettings, options, q + 1); return object; }; @@ -31430,12 +32334,16 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Publishing.encode = function encode(message, writer) { + Publishing.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.methodSettings != null && message.methodSettings.length) for (var i = 0; i < message.methodSettings.length; ++i) - $root.google.api.MethodSettings.encode(message.methodSettings[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.api.MethodSettings.encode(message.methodSettings[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); if (message.newIssueUri != null && Object.hasOwnProperty.call(message, "newIssueUri")) writer.uint32(/* id 101, wireType 2 =*/810).string(message.newIssueUri); if (message.documentationUri != null && Object.hasOwnProperty.call(message, "documentationUri")) @@ -31453,7 +32361,7 @@ writer.uint32(/* id 107, wireType 0 =*/856).int32(message.organization); if (message.librarySettings != null && message.librarySettings.length) for (var i = 0; i < message.librarySettings.length; ++i) - $root.google.api.ClientLibrarySettings.encode(message.librarySettings[i], writer.uint32(/* id 109, wireType 2 =*/874).fork()).ldelim(); + $root.google.api.ClientLibrarySettings.encode(message.librarySettings[i], writer.uint32(/* id 109, wireType 2 =*/874).fork(), q + 1).ldelim(); if (message.protoReferenceDocumentationUri != null && Object.hasOwnProperty.call(message, "protoReferenceDocumentationUri")) writer.uint32(/* id 110, wireType 2 =*/882).string(message.protoReferenceDocumentationUri); if (message.restReferenceDocumentationUri != null && Object.hasOwnProperty.call(message, "restReferenceDocumentationUri")) @@ -31471,7 +32379,7 @@ * @returns {$protobuf.Writer} Writer */ Publishing.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -31587,7 +32495,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.methodSettings != null && message.hasOwnProperty("methodSettings")) { + if (message.methodSettings != null && Object.hasOwnProperty.call(message, "methodSettings")) { if (!Array.isArray(message.methodSettings)) return "methodSettings: array expected"; for (var i = 0; i < message.methodSettings.length; ++i) { @@ -31596,29 +32504,29 @@ return "methodSettings." + error; } } - if (message.newIssueUri != null && message.hasOwnProperty("newIssueUri")) + if (message.newIssueUri != null && Object.hasOwnProperty.call(message, "newIssueUri")) if (!$util.isString(message.newIssueUri)) return "newIssueUri: string expected"; - if (message.documentationUri != null && message.hasOwnProperty("documentationUri")) + if (message.documentationUri != null && Object.hasOwnProperty.call(message, "documentationUri")) if (!$util.isString(message.documentationUri)) return "documentationUri: string expected"; - if (message.apiShortName != null && message.hasOwnProperty("apiShortName")) + if (message.apiShortName != null && Object.hasOwnProperty.call(message, "apiShortName")) if (!$util.isString(message.apiShortName)) return "apiShortName: string expected"; - if (message.githubLabel != null && message.hasOwnProperty("githubLabel")) + if (message.githubLabel != null && Object.hasOwnProperty.call(message, "githubLabel")) if (!$util.isString(message.githubLabel)) return "githubLabel: string expected"; - if (message.codeownerGithubTeams != null && message.hasOwnProperty("codeownerGithubTeams")) { + if (message.codeownerGithubTeams != null && Object.hasOwnProperty.call(message, "codeownerGithubTeams")) { if (!Array.isArray(message.codeownerGithubTeams)) return "codeownerGithubTeams: array expected"; for (var i = 0; i < message.codeownerGithubTeams.length; ++i) if (!$util.isString(message.codeownerGithubTeams[i])) return "codeownerGithubTeams: string[] expected"; } - if (message.docTagPrefix != null && message.hasOwnProperty("docTagPrefix")) + if (message.docTagPrefix != null && Object.hasOwnProperty.call(message, "docTagPrefix")) if (!$util.isString(message.docTagPrefix)) return "docTagPrefix: string expected"; - if (message.organization != null && message.hasOwnProperty("organization")) + if (message.organization != null && Object.hasOwnProperty.call(message, "organization")) switch (message.organization) { default: return "organization: enum value expected"; @@ -31632,7 +32540,7 @@ case 7: break; } - if (message.librarySettings != null && message.hasOwnProperty("librarySettings")) { + if (message.librarySettings != null && Object.hasOwnProperty.call(message, "librarySettings")) { if (!Array.isArray(message.librarySettings)) return "librarySettings: array expected"; for (var i = 0; i < message.librarySettings.length; ++i) { @@ -31641,10 +32549,10 @@ return "librarySettings." + error; } } - if (message.protoReferenceDocumentationUri != null && message.hasOwnProperty("protoReferenceDocumentationUri")) + if (message.protoReferenceDocumentationUri != null && Object.hasOwnProperty.call(message, "protoReferenceDocumentationUri")) if (!$util.isString(message.protoReferenceDocumentationUri)) return "protoReferenceDocumentationUri: string expected"; - if (message.restReferenceDocumentationUri != null && message.hasOwnProperty("restReferenceDocumentationUri")) + if (message.restReferenceDocumentationUri != null && Object.hasOwnProperty.call(message, "restReferenceDocumentationUri")) if (!$util.isString(message.restReferenceDocumentationUri)) return "restReferenceDocumentationUri: string expected"; return null; @@ -31661,6 +32569,8 @@ Publishing.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.Publishing) return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.Publishing: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -31671,7 +32581,7 @@ throw TypeError(".google.api.Publishing.methodSettings: array expected"); message.methodSettings = []; for (var i = 0; i < object.methodSettings.length; ++i) { - if (typeof object.methodSettings[i] !== "object") + if (!$util.isObject(object.methodSettings[i])) throw TypeError(".google.api.Publishing.methodSettings: object expected"); message.methodSettings[i] = $root.google.api.MethodSettings.fromObject(object.methodSettings[i], long + 1); } @@ -31738,7 +32648,7 @@ throw TypeError(".google.api.Publishing.librarySettings: array expected"); message.librarySettings = []; for (var i = 0; i < object.librarySettings.length; ++i) { - if (typeof object.librarySettings[i] !== "object") + if (!$util.isObject(object.librarySettings[i])) throw TypeError(".google.api.Publishing.librarySettings: object expected"); message.librarySettings[i] = $root.google.api.ClientLibrarySettings.fromObject(object.librarySettings[i], long + 1); } @@ -31759,9 +32669,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Publishing.toObject = function toObject(message, options) { + Publishing.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) { object.methodSettings = []; @@ -31781,33 +32695,33 @@ if (message.methodSettings && message.methodSettings.length) { object.methodSettings = []; for (var j = 0; j < message.methodSettings.length; ++j) - object.methodSettings[j] = $root.google.api.MethodSettings.toObject(message.methodSettings[j], options); + object.methodSettings[j] = $root.google.api.MethodSettings.toObject(message.methodSettings[j], options, q + 1); } - if (message.newIssueUri != null && message.hasOwnProperty("newIssueUri")) + if (message.newIssueUri != null && Object.hasOwnProperty.call(message, "newIssueUri")) object.newIssueUri = message.newIssueUri; - if (message.documentationUri != null && message.hasOwnProperty("documentationUri")) + if (message.documentationUri != null && Object.hasOwnProperty.call(message, "documentationUri")) object.documentationUri = message.documentationUri; - if (message.apiShortName != null && message.hasOwnProperty("apiShortName")) + if (message.apiShortName != null && Object.hasOwnProperty.call(message, "apiShortName")) object.apiShortName = message.apiShortName; - if (message.githubLabel != null && message.hasOwnProperty("githubLabel")) + if (message.githubLabel != null && Object.hasOwnProperty.call(message, "githubLabel")) object.githubLabel = message.githubLabel; if (message.codeownerGithubTeams && message.codeownerGithubTeams.length) { object.codeownerGithubTeams = []; for (var j = 0; j < message.codeownerGithubTeams.length; ++j) object.codeownerGithubTeams[j] = message.codeownerGithubTeams[j]; } - if (message.docTagPrefix != null && message.hasOwnProperty("docTagPrefix")) + if (message.docTagPrefix != null && Object.hasOwnProperty.call(message, "docTagPrefix")) object.docTagPrefix = message.docTagPrefix; - if (message.organization != null && message.hasOwnProperty("organization")) + if (message.organization != null && Object.hasOwnProperty.call(message, "organization")) object.organization = options.enums === String ? $root.google.api.ClientLibraryOrganization[message.organization] === undefined ? message.organization : $root.google.api.ClientLibraryOrganization[message.organization] : message.organization; if (message.librarySettings && message.librarySettings.length) { object.librarySettings = []; for (var j = 0; j < message.librarySettings.length; ++j) - object.librarySettings[j] = $root.google.api.ClientLibrarySettings.toObject(message.librarySettings[j], options); + object.librarySettings[j] = $root.google.api.ClientLibrarySettings.toObject(message.librarySettings[j], options, q + 1); } - if (message.protoReferenceDocumentationUri != null && message.hasOwnProperty("protoReferenceDocumentationUri")) + if (message.protoReferenceDocumentationUri != null && Object.hasOwnProperty.call(message, "protoReferenceDocumentationUri")) object.protoReferenceDocumentationUri = message.protoReferenceDocumentationUri; - if (message.restReferenceDocumentationUri != null && message.hasOwnProperty("restReferenceDocumentationUri")) + if (message.restReferenceDocumentationUri != null && Object.hasOwnProperty.call(message, "restReferenceDocumentationUri")) object.restReferenceDocumentationUri = message.restReferenceDocumentationUri; return object; }; @@ -31913,16 +32827,20 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - JavaSettings.encode = function encode(message, writer) { + JavaSettings.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.libraryPackage != null && Object.hasOwnProperty.call(message, "libraryPackage")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.libraryPackage); if (message.serviceClassNames != null && Object.hasOwnProperty.call(message, "serviceClassNames")) for (var keys = Object.keys(message.serviceClassNames), i = 0; i < keys.length; ++i) writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.serviceClassNames[keys[i]]).ldelim(); if (message.common != null && Object.hasOwnProperty.call(message, "common")) - $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); return writer; }; @@ -31936,7 +32854,7 @@ * @returns {$protobuf.Writer} Writer */ JavaSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -32035,10 +32953,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.libraryPackage != null && message.hasOwnProperty("libraryPackage")) + if (message.libraryPackage != null && Object.hasOwnProperty.call(message, "libraryPackage")) if (!$util.isString(message.libraryPackage)) return "libraryPackage: string expected"; - if (message.serviceClassNames != null && message.hasOwnProperty("serviceClassNames")) { + if (message.serviceClassNames != null && Object.hasOwnProperty.call(message, "serviceClassNames")) { if (!$util.isObject(message.serviceClassNames)) return "serviceClassNames: object expected"; var key = Object.keys(message.serviceClassNames); @@ -32046,7 +32964,7 @@ if (!$util.isString(message.serviceClassNames[key[i]])) return "serviceClassNames: string{k:string} expected"; } - if (message.common != null && message.hasOwnProperty("common")) { + if (message.common != null && Object.hasOwnProperty.call(message, "common")) { var error = $root.google.api.CommonLanguageSettings.verify(message.common, long + 1); if (error) return "common." + error; @@ -32065,6 +32983,8 @@ JavaSettings.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.JavaSettings) return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.JavaSettings: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -32073,7 +32993,7 @@ if (object.libraryPackage != null) message.libraryPackage = String(object.libraryPackage); if (object.serviceClassNames) { - if (typeof object.serviceClassNames !== "object") + if (!$util.isObject(object.serviceClassNames)) throw TypeError(".google.api.JavaSettings.serviceClassNames: object expected"); message.serviceClassNames = {}; for (var keys = Object.keys(object.serviceClassNames), i = 0; i < keys.length; ++i) { @@ -32083,7 +33003,7 @@ } } if (object.common != null) { - if (typeof object.common !== "object") + if (!$util.isObject(object.common)) throw TypeError(".google.api.JavaSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common, long + 1); } @@ -32099,9 +33019,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - JavaSettings.toObject = function toObject(message, options) { + JavaSettings.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.objects || options.defaults) object.serviceClassNames = {}; @@ -32109,7 +33033,7 @@ object.libraryPackage = ""; object.common = null; } - if (message.libraryPackage != null && message.hasOwnProperty("libraryPackage")) + if (message.libraryPackage != null && Object.hasOwnProperty.call(message, "libraryPackage")) object.libraryPackage = message.libraryPackage; var keys2; if (message.serviceClassNames && (keys2 = Object.keys(message.serviceClassNames)).length) { @@ -32120,8 +33044,8 @@ object.serviceClassNames[keys2[j]] = message.serviceClassNames[keys2[j]]; } } - if (message.common != null && message.hasOwnProperty("common")) - object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options, q + 1); return object; }; @@ -32207,11 +33131,15 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CppSettings.encode = function encode(message, writer) { + CppSettings.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.common != null && Object.hasOwnProperty.call(message, "common")) - $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); return writer; }; @@ -32225,7 +33153,7 @@ * @returns {$protobuf.Writer} Writer */ CppSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -32295,7 +33223,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.common != null && message.hasOwnProperty("common")) { + if (message.common != null && Object.hasOwnProperty.call(message, "common")) { var error = $root.google.api.CommonLanguageSettings.verify(message.common, long + 1); if (error) return "common." + error; @@ -32314,13 +33242,15 @@ CppSettings.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.CppSettings) return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.CppSettings: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.CppSettings(); if (object.common != null) { - if (typeof object.common !== "object") + if (!$util.isObject(object.common)) throw TypeError(".google.api.CppSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common, long + 1); } @@ -32336,14 +33266,18 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CppSettings.toObject = function toObject(message, options) { + CppSettings.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) object.common = null; - if (message.common != null && message.hasOwnProperty("common")) - object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options, q + 1); return object; }; @@ -32429,11 +33363,15 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PhpSettings.encode = function encode(message, writer) { + PhpSettings.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.common != null && Object.hasOwnProperty.call(message, "common")) - $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); return writer; }; @@ -32447,7 +33385,7 @@ * @returns {$protobuf.Writer} Writer */ PhpSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -32517,7 +33455,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.common != null && message.hasOwnProperty("common")) { + if (message.common != null && Object.hasOwnProperty.call(message, "common")) { var error = $root.google.api.CommonLanguageSettings.verify(message.common, long + 1); if (error) return "common." + error; @@ -32536,13 +33474,15 @@ PhpSettings.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.PhpSettings) return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.PhpSettings: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.PhpSettings(); if (object.common != null) { - if (typeof object.common !== "object") + if (!$util.isObject(object.common)) throw TypeError(".google.api.PhpSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common, long + 1); } @@ -32558,14 +33498,18 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PhpSettings.toObject = function toObject(message, options) { + PhpSettings.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) object.common = null; - if (message.common != null && message.hasOwnProperty("common")) - object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options, q + 1); return object; }; @@ -32660,13 +33604,17 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PythonSettings.encode = function encode(message, writer) { + PythonSettings.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.common != null && Object.hasOwnProperty.call(message, "common")) - $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); if (message.experimentalFeatures != null && Object.hasOwnProperty.call(message, "experimentalFeatures")) - $root.google.api.PythonSettings.ExperimentalFeatures.encode(message.experimentalFeatures, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.api.PythonSettings.ExperimentalFeatures.encode(message.experimentalFeatures, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); return writer; }; @@ -32680,7 +33628,7 @@ * @returns {$protobuf.Writer} Writer */ PythonSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -32754,12 +33702,12 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.common != null && message.hasOwnProperty("common")) { + if (message.common != null && Object.hasOwnProperty.call(message, "common")) { var error = $root.google.api.CommonLanguageSettings.verify(message.common, long + 1); if (error) return "common." + error; } - if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) { + if (message.experimentalFeatures != null && Object.hasOwnProperty.call(message, "experimentalFeatures")) { var error = $root.google.api.PythonSettings.ExperimentalFeatures.verify(message.experimentalFeatures, long + 1); if (error) return "experimentalFeatures." + error; @@ -32778,18 +33726,20 @@ PythonSettings.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.PythonSettings) return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.PythonSettings: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.PythonSettings(); if (object.common != null) { - if (typeof object.common !== "object") + if (!$util.isObject(object.common)) throw TypeError(".google.api.PythonSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common, long + 1); } if (object.experimentalFeatures != null) { - if (typeof object.experimentalFeatures !== "object") + if (!$util.isObject(object.experimentalFeatures)) throw TypeError(".google.api.PythonSettings.experimentalFeatures: object expected"); message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.fromObject(object.experimentalFeatures, long + 1); } @@ -32805,18 +33755,22 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PythonSettings.toObject = function toObject(message, options) { + PythonSettings.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.common = null; object.experimentalFeatures = null; } - if (message.common != null && message.hasOwnProperty("common")) - object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); - if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) - object.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.toObject(message.experimentalFeatures, options); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options, q + 1); + if (message.experimentalFeatures != null && Object.hasOwnProperty.call(message, "experimentalFeatures")) + object.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.toObject(message.experimentalFeatures, options, q + 1); return object; }; @@ -32917,9 +33871,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExperimentalFeatures.encode = function encode(message, writer) { + ExperimentalFeatures.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.restAsyncIoEnabled != null && Object.hasOwnProperty.call(message, "restAsyncIoEnabled")) writer.uint32(/* id 1, wireType 0 =*/8).bool(message.restAsyncIoEnabled); if (message.protobufPythonicTypesEnabled != null && Object.hasOwnProperty.call(message, "protobufPythonicTypesEnabled")) @@ -32939,7 +33897,7 @@ * @returns {$protobuf.Writer} Writer */ ExperimentalFeatures.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -33017,13 +33975,13 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + if (message.restAsyncIoEnabled != null && Object.hasOwnProperty.call(message, "restAsyncIoEnabled")) if (typeof message.restAsyncIoEnabled !== "boolean") return "restAsyncIoEnabled: boolean expected"; - if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + if (message.protobufPythonicTypesEnabled != null && Object.hasOwnProperty.call(message, "protobufPythonicTypesEnabled")) if (typeof message.protobufPythonicTypesEnabled !== "boolean") return "protobufPythonicTypesEnabled: boolean expected"; - if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + if (message.unversionedPackageDisabled != null && Object.hasOwnProperty.call(message, "unversionedPackageDisabled")) if (typeof message.unversionedPackageDisabled !== "boolean") return "unversionedPackageDisabled: boolean expected"; return null; @@ -33040,6 +33998,8 @@ ExperimentalFeatures.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.PythonSettings.ExperimentalFeatures) return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.PythonSettings.ExperimentalFeatures: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -33063,20 +34023,24 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ExperimentalFeatures.toObject = function toObject(message, options) { + ExperimentalFeatures.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.restAsyncIoEnabled = false; object.protobufPythonicTypesEnabled = false; object.unversionedPackageDisabled = false; } - if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + if (message.restAsyncIoEnabled != null && Object.hasOwnProperty.call(message, "restAsyncIoEnabled")) object.restAsyncIoEnabled = message.restAsyncIoEnabled; - if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + if (message.protobufPythonicTypesEnabled != null && Object.hasOwnProperty.call(message, "protobufPythonicTypesEnabled")) object.protobufPythonicTypesEnabled = message.protobufPythonicTypesEnabled; - if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + if (message.unversionedPackageDisabled != null && Object.hasOwnProperty.call(message, "unversionedPackageDisabled")) object.unversionedPackageDisabled = message.unversionedPackageDisabled; return object; }; @@ -33166,11 +34130,15 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - NodeSettings.encode = function encode(message, writer) { + NodeSettings.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.common != null && Object.hasOwnProperty.call(message, "common")) - $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); return writer; }; @@ -33184,7 +34152,7 @@ * @returns {$protobuf.Writer} Writer */ NodeSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -33254,7 +34222,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.common != null && message.hasOwnProperty("common")) { + if (message.common != null && Object.hasOwnProperty.call(message, "common")) { var error = $root.google.api.CommonLanguageSettings.verify(message.common, long + 1); if (error) return "common." + error; @@ -33273,13 +34241,15 @@ NodeSettings.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.NodeSettings) return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.NodeSettings: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.NodeSettings(); if (object.common != null) { - if (typeof object.common !== "object") + if (!$util.isObject(object.common)) throw TypeError(".google.api.NodeSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common, long + 1); } @@ -33295,14 +34265,18 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - NodeSettings.toObject = function toObject(message, options) { + NodeSettings.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) object.common = null; - if (message.common != null && message.hasOwnProperty("common")) - object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options, q + 1); return object; }; @@ -33438,11 +34412,15 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DotnetSettings.encode = function encode(message, writer) { + DotnetSettings.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.common != null && Object.hasOwnProperty.call(message, "common")) - $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) for (var keys = Object.keys(message.renamedServices), i = 0; i < keys.length; ++i) writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedServices[keys[i]]).ldelim(); @@ -33471,7 +34449,7 @@ * @returns {$protobuf.Writer} Writer */ DotnetSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -33609,12 +34587,12 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.common != null && message.hasOwnProperty("common")) { + if (message.common != null && Object.hasOwnProperty.call(message, "common")) { var error = $root.google.api.CommonLanguageSettings.verify(message.common, long + 1); if (error) return "common." + error; } - if (message.renamedServices != null && message.hasOwnProperty("renamedServices")) { + if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) { if (!$util.isObject(message.renamedServices)) return "renamedServices: object expected"; var key = Object.keys(message.renamedServices); @@ -33622,7 +34600,7 @@ if (!$util.isString(message.renamedServices[key[i]])) return "renamedServices: string{k:string} expected"; } - if (message.renamedResources != null && message.hasOwnProperty("renamedResources")) { + if (message.renamedResources != null && Object.hasOwnProperty.call(message, "renamedResources")) { if (!$util.isObject(message.renamedResources)) return "renamedResources: object expected"; var key = Object.keys(message.renamedResources); @@ -33630,21 +34608,21 @@ if (!$util.isString(message.renamedResources[key[i]])) return "renamedResources: string{k:string} expected"; } - if (message.ignoredResources != null && message.hasOwnProperty("ignoredResources")) { + if (message.ignoredResources != null && Object.hasOwnProperty.call(message, "ignoredResources")) { if (!Array.isArray(message.ignoredResources)) return "ignoredResources: array expected"; for (var i = 0; i < message.ignoredResources.length; ++i) if (!$util.isString(message.ignoredResources[i])) return "ignoredResources: string[] expected"; } - if (message.forcedNamespaceAliases != null && message.hasOwnProperty("forcedNamespaceAliases")) { + if (message.forcedNamespaceAliases != null && Object.hasOwnProperty.call(message, "forcedNamespaceAliases")) { if (!Array.isArray(message.forcedNamespaceAliases)) return "forcedNamespaceAliases: array expected"; for (var i = 0; i < message.forcedNamespaceAliases.length; ++i) if (!$util.isString(message.forcedNamespaceAliases[i])) return "forcedNamespaceAliases: string[] expected"; } - if (message.handwrittenSignatures != null && message.hasOwnProperty("handwrittenSignatures")) { + if (message.handwrittenSignatures != null && Object.hasOwnProperty.call(message, "handwrittenSignatures")) { if (!Array.isArray(message.handwrittenSignatures)) return "handwrittenSignatures: array expected"; for (var i = 0; i < message.handwrittenSignatures.length; ++i) @@ -33665,18 +34643,20 @@ DotnetSettings.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.DotnetSettings) return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.DotnetSettings: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.DotnetSettings(); if (object.common != null) { - if (typeof object.common !== "object") + if (!$util.isObject(object.common)) throw TypeError(".google.api.DotnetSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common, long + 1); } if (object.renamedServices) { - if (typeof object.renamedServices !== "object") + if (!$util.isObject(object.renamedServices)) throw TypeError(".google.api.DotnetSettings.renamedServices: object expected"); message.renamedServices = {}; for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) { @@ -33686,7 +34666,7 @@ } } if (object.renamedResources) { - if (typeof object.renamedResources !== "object") + if (!$util.isObject(object.renamedResources)) throw TypeError(".google.api.DotnetSettings.renamedResources: object expected"); message.renamedResources = {}; for (var keys = Object.keys(object.renamedResources), i = 0; i < keys.length; ++i) { @@ -33728,9 +34708,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DotnetSettings.toObject = function toObject(message, options) { + DotnetSettings.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) { object.ignoredResources = []; @@ -33743,8 +34727,8 @@ } if (options.defaults) object.common = null; - if (message.common != null && message.hasOwnProperty("common")) - object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options, q + 1); var keys2; if (message.renamedServices && (keys2 = Object.keys(message.renamedServices)).length) { object.renamedServices = {}; @@ -33862,11 +34846,15 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - RubySettings.encode = function encode(message, writer) { + RubySettings.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.common != null && Object.hasOwnProperty.call(message, "common")) - $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); return writer; }; @@ -33880,7 +34868,7 @@ * @returns {$protobuf.Writer} Writer */ RubySettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -33950,7 +34938,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.common != null && message.hasOwnProperty("common")) { + if (message.common != null && Object.hasOwnProperty.call(message, "common")) { var error = $root.google.api.CommonLanguageSettings.verify(message.common, long + 1); if (error) return "common." + error; @@ -33969,13 +34957,15 @@ RubySettings.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.RubySettings) return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.RubySettings: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.RubySettings(); if (object.common != null) { - if (typeof object.common !== "object") + if (!$util.isObject(object.common)) throw TypeError(".google.api.RubySettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common, long + 1); } @@ -33991,14 +34981,18 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - RubySettings.toObject = function toObject(message, options) { + RubySettings.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) object.common = null; - if (message.common != null && message.hasOwnProperty("common")) - object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options, q + 1); return object; }; @@ -34094,11 +35088,15 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GoSettings.encode = function encode(message, writer) { + GoSettings.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.common != null && Object.hasOwnProperty.call(message, "common")) - $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) for (var keys = Object.keys(message.renamedServices), i = 0; i < keys.length; ++i) writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedServices[keys[i]]).ldelim(); @@ -34115,7 +35113,7 @@ * @returns {$protobuf.Writer} Writer */ GoSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -34210,12 +35208,12 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.common != null && message.hasOwnProperty("common")) { + if (message.common != null && Object.hasOwnProperty.call(message, "common")) { var error = $root.google.api.CommonLanguageSettings.verify(message.common, long + 1); if (error) return "common." + error; } - if (message.renamedServices != null && message.hasOwnProperty("renamedServices")) { + if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) { if (!$util.isObject(message.renamedServices)) return "renamedServices: object expected"; var key = Object.keys(message.renamedServices); @@ -34237,18 +35235,20 @@ GoSettings.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.GoSettings) return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.GoSettings: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.GoSettings(); if (object.common != null) { - if (typeof object.common !== "object") + if (!$util.isObject(object.common)) throw TypeError(".google.api.GoSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common, long + 1); } if (object.renamedServices) { - if (typeof object.renamedServices !== "object") + if (!$util.isObject(object.renamedServices)) throw TypeError(".google.api.GoSettings.renamedServices: object expected"); message.renamedServices = {}; for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) { @@ -34269,16 +35269,20 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GoSettings.toObject = function toObject(message, options) { + GoSettings.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.objects || options.defaults) object.renamedServices = {}; if (options.defaults) object.common = null; - if (message.common != null && message.hasOwnProperty("common")) - object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options, q + 1); var keys2; if (message.renamedServices && (keys2 = Object.keys(message.renamedServices)).length) { object.renamedServices = {}; @@ -34392,13 +35396,17 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - MethodSettings.encode = function encode(message, writer) { + MethodSettings.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); if (message.longRunning != null && Object.hasOwnProperty.call(message, "longRunning")) - $root.google.api.MethodSettings.LongRunning.encode(message.longRunning, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.api.MethodSettings.LongRunning.encode(message.longRunning, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); if (message.autoPopulatedFields != null && message.autoPopulatedFields.length) for (var i = 0; i < message.autoPopulatedFields.length; ++i) writer.uint32(/* id 3, wireType 2 =*/26).string(message.autoPopulatedFields[i]); @@ -34415,7 +35423,7 @@ * @returns {$protobuf.Writer} Writer */ MethodSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -34495,15 +35503,15 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.selector != null && message.hasOwnProperty("selector")) + if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) if (!$util.isString(message.selector)) return "selector: string expected"; - if (message.longRunning != null && message.hasOwnProperty("longRunning")) { + if (message.longRunning != null && Object.hasOwnProperty.call(message, "longRunning")) { var error = $root.google.api.MethodSettings.LongRunning.verify(message.longRunning, long + 1); if (error) return "longRunning." + error; } - if (message.autoPopulatedFields != null && message.hasOwnProperty("autoPopulatedFields")) { + if (message.autoPopulatedFields != null && Object.hasOwnProperty.call(message, "autoPopulatedFields")) { if (!Array.isArray(message.autoPopulatedFields)) return "autoPopulatedFields: array expected"; for (var i = 0; i < message.autoPopulatedFields.length; ++i) @@ -34524,6 +35532,8 @@ MethodSettings.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.MethodSettings) return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.MethodSettings: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -34532,7 +35542,7 @@ if (object.selector != null) message.selector = String(object.selector); if (object.longRunning != null) { - if (typeof object.longRunning !== "object") + if (!$util.isObject(object.longRunning)) throw TypeError(".google.api.MethodSettings.longRunning: object expected"); message.longRunning = $root.google.api.MethodSettings.LongRunning.fromObject(object.longRunning, long + 1); } @@ -34555,9 +35565,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - MethodSettings.toObject = function toObject(message, options) { + MethodSettings.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.autoPopulatedFields = []; @@ -34565,10 +35579,10 @@ object.selector = ""; object.longRunning = null; } - if (message.selector != null && message.hasOwnProperty("selector")) + if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) object.selector = message.selector; - if (message.longRunning != null && message.hasOwnProperty("longRunning")) - object.longRunning = $root.google.api.MethodSettings.LongRunning.toObject(message.longRunning, options); + if (message.longRunning != null && Object.hasOwnProperty.call(message, "longRunning")) + object.longRunning = $root.google.api.MethodSettings.LongRunning.toObject(message.longRunning, options, q + 1); if (message.autoPopulatedFields && message.autoPopulatedFields.length) { object.autoPopulatedFields = []; for (var j = 0; j < message.autoPopulatedFields.length; ++j) @@ -34683,17 +35697,21 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - LongRunning.encode = function encode(message, writer) { + LongRunning.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.initialPollDelay != null && Object.hasOwnProperty.call(message, "initialPollDelay")) - $root.google.protobuf.Duration.encode(message.initialPollDelay, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.protobuf.Duration.encode(message.initialPollDelay, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); if (message.pollDelayMultiplier != null && Object.hasOwnProperty.call(message, "pollDelayMultiplier")) writer.uint32(/* id 2, wireType 5 =*/21).float(message.pollDelayMultiplier); if (message.maxPollDelay != null && Object.hasOwnProperty.call(message, "maxPollDelay")) - $root.google.protobuf.Duration.encode(message.maxPollDelay, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + $root.google.protobuf.Duration.encode(message.maxPollDelay, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); if (message.totalPollTimeout != null && Object.hasOwnProperty.call(message, "totalPollTimeout")) - $root.google.protobuf.Duration.encode(message.totalPollTimeout, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + $root.google.protobuf.Duration.encode(message.totalPollTimeout, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); return writer; }; @@ -34707,7 +35725,7 @@ * @returns {$protobuf.Writer} Writer */ LongRunning.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -34789,20 +35807,20 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.initialPollDelay != null && message.hasOwnProperty("initialPollDelay")) { + if (message.initialPollDelay != null && Object.hasOwnProperty.call(message, "initialPollDelay")) { var error = $root.google.protobuf.Duration.verify(message.initialPollDelay, long + 1); if (error) return "initialPollDelay." + error; } - if (message.pollDelayMultiplier != null && message.hasOwnProperty("pollDelayMultiplier")) + if (message.pollDelayMultiplier != null && Object.hasOwnProperty.call(message, "pollDelayMultiplier")) if (typeof message.pollDelayMultiplier !== "number") return "pollDelayMultiplier: number expected"; - if (message.maxPollDelay != null && message.hasOwnProperty("maxPollDelay")) { + if (message.maxPollDelay != null && Object.hasOwnProperty.call(message, "maxPollDelay")) { var error = $root.google.protobuf.Duration.verify(message.maxPollDelay, long + 1); if (error) return "maxPollDelay." + error; } - if (message.totalPollTimeout != null && message.hasOwnProperty("totalPollTimeout")) { + if (message.totalPollTimeout != null && Object.hasOwnProperty.call(message, "totalPollTimeout")) { var error = $root.google.protobuf.Duration.verify(message.totalPollTimeout, long + 1); if (error) return "totalPollTimeout." + error; @@ -34821,25 +35839,27 @@ LongRunning.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.MethodSettings.LongRunning) return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.MethodSettings.LongRunning: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.MethodSettings.LongRunning(); if (object.initialPollDelay != null) { - if (typeof object.initialPollDelay !== "object") + if (!$util.isObject(object.initialPollDelay)) throw TypeError(".google.api.MethodSettings.LongRunning.initialPollDelay: object expected"); message.initialPollDelay = $root.google.protobuf.Duration.fromObject(object.initialPollDelay, long + 1); } if (object.pollDelayMultiplier != null) message.pollDelayMultiplier = Number(object.pollDelayMultiplier); if (object.maxPollDelay != null) { - if (typeof object.maxPollDelay !== "object") + if (!$util.isObject(object.maxPollDelay)) throw TypeError(".google.api.MethodSettings.LongRunning.maxPollDelay: object expected"); message.maxPollDelay = $root.google.protobuf.Duration.fromObject(object.maxPollDelay, long + 1); } if (object.totalPollTimeout != null) { - if (typeof object.totalPollTimeout !== "object") + if (!$util.isObject(object.totalPollTimeout)) throw TypeError(".google.api.MethodSettings.LongRunning.totalPollTimeout: object expected"); message.totalPollTimeout = $root.google.protobuf.Duration.fromObject(object.totalPollTimeout, long + 1); } @@ -34855,9 +35875,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - LongRunning.toObject = function toObject(message, options) { + LongRunning.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.initialPollDelay = null; @@ -34865,14 +35889,14 @@ object.maxPollDelay = null; object.totalPollTimeout = null; } - if (message.initialPollDelay != null && message.hasOwnProperty("initialPollDelay")) - object.initialPollDelay = $root.google.protobuf.Duration.toObject(message.initialPollDelay, options); - if (message.pollDelayMultiplier != null && message.hasOwnProperty("pollDelayMultiplier")) + if (message.initialPollDelay != null && Object.hasOwnProperty.call(message, "initialPollDelay")) + object.initialPollDelay = $root.google.protobuf.Duration.toObject(message.initialPollDelay, options, q + 1); + if (message.pollDelayMultiplier != null && Object.hasOwnProperty.call(message, "pollDelayMultiplier")) object.pollDelayMultiplier = options.json && !isFinite(message.pollDelayMultiplier) ? String(message.pollDelayMultiplier) : message.pollDelayMultiplier; - if (message.maxPollDelay != null && message.hasOwnProperty("maxPollDelay")) - object.maxPollDelay = $root.google.protobuf.Duration.toObject(message.maxPollDelay, options); - if (message.totalPollTimeout != null && message.hasOwnProperty("totalPollTimeout")) - object.totalPollTimeout = $root.google.protobuf.Duration.toObject(message.totalPollTimeout, options); + if (message.maxPollDelay != null && Object.hasOwnProperty.call(message, "maxPollDelay")) + object.maxPollDelay = $root.google.protobuf.Duration.toObject(message.maxPollDelay, options, q + 1); + if (message.totalPollTimeout != null && Object.hasOwnProperty.call(message, "totalPollTimeout")) + object.totalPollTimeout = $root.google.protobuf.Duration.toObject(message.totalPollTimeout, options, q + 1); return object; }; @@ -35013,9 +36037,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SelectiveGapicGeneration.encode = function encode(message, writer) { + SelectiveGapicGeneration.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.methods != null && message.methods.length) for (var i = 0; i < message.methods.length; ++i) writer.uint32(/* id 1, wireType 2 =*/10).string(message.methods[i]); @@ -35034,7 +36062,7 @@ * @returns {$protobuf.Writer} Writer */ SelectiveGapicGeneration.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -35110,14 +36138,14 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.methods != null && message.hasOwnProperty("methods")) { + if (message.methods != null && Object.hasOwnProperty.call(message, "methods")) { if (!Array.isArray(message.methods)) return "methods: array expected"; for (var i = 0; i < message.methods.length; ++i) if (!$util.isString(message.methods[i])) return "methods: string[] expected"; } - if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + if (message.generateOmittedAsInternal != null && Object.hasOwnProperty.call(message, "generateOmittedAsInternal")) if (typeof message.generateOmittedAsInternal !== "boolean") return "generateOmittedAsInternal: boolean expected"; return null; @@ -35134,6 +36162,8 @@ SelectiveGapicGeneration.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.SelectiveGapicGeneration) return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.SelectiveGapicGeneration: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -35160,9 +36190,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SelectiveGapicGeneration.toObject = function toObject(message, options) { + SelectiveGapicGeneration.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.methods = []; @@ -35173,7 +36207,7 @@ for (var j = 0; j < message.methods.length; ++j) object.methods[j] = message.methods[j]; } - if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + if (message.generateOmittedAsInternal != null && Object.hasOwnProperty.call(message, "generateOmittedAsInternal")) object.generateOmittedAsInternal = message.generateOmittedAsInternal; return object; }; @@ -35370,9 +36404,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ResourceDescriptor.encode = function encode(message, writer) { + ResourceDescriptor.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.type != null && Object.hasOwnProperty.call(message, "type")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); if (message.pattern != null && message.pattern.length) @@ -35405,7 +36443,7 @@ * @returns {$protobuf.Writer} Writer */ ResourceDescriptor.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -35508,20 +36546,20 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.type != null && message.hasOwnProperty("type")) + if (message.type != null && Object.hasOwnProperty.call(message, "type")) if (!$util.isString(message.type)) return "type: string expected"; - if (message.pattern != null && message.hasOwnProperty("pattern")) { + if (message.pattern != null && Object.hasOwnProperty.call(message, "pattern")) { if (!Array.isArray(message.pattern)) return "pattern: array expected"; for (var i = 0; i < message.pattern.length; ++i) if (!$util.isString(message.pattern[i])) return "pattern: string[] expected"; } - if (message.nameField != null && message.hasOwnProperty("nameField")) + if (message.nameField != null && Object.hasOwnProperty.call(message, "nameField")) if (!$util.isString(message.nameField)) return "nameField: string expected"; - if (message.history != null && message.hasOwnProperty("history")) + if (message.history != null && Object.hasOwnProperty.call(message, "history")) switch (message.history) { default: return "history: enum value expected"; @@ -35530,13 +36568,13 @@ case 2: break; } - if (message.plural != null && message.hasOwnProperty("plural")) + if (message.plural != null && Object.hasOwnProperty.call(message, "plural")) if (!$util.isString(message.plural)) return "plural: string expected"; - if (message.singular != null && message.hasOwnProperty("singular")) + if (message.singular != null && Object.hasOwnProperty.call(message, "singular")) if (!$util.isString(message.singular)) return "singular: string expected"; - if (message.style != null && message.hasOwnProperty("style")) { + if (message.style != null && Object.hasOwnProperty.call(message, "style")) { if (!Array.isArray(message.style)) return "style: array expected"; for (var i = 0; i < message.style.length; ++i) @@ -35562,6 +36600,8 @@ ResourceDescriptor.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.ResourceDescriptor) return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.ResourceDescriptor: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -35635,9 +36675,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ResourceDescriptor.toObject = function toObject(message, options) { + ResourceDescriptor.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) { object.pattern = []; @@ -35650,20 +36694,20 @@ object.plural = ""; object.singular = ""; } - if (message.type != null && message.hasOwnProperty("type")) + if (message.type != null && Object.hasOwnProperty.call(message, "type")) object.type = message.type; if (message.pattern && message.pattern.length) { object.pattern = []; for (var j = 0; j < message.pattern.length; ++j) object.pattern[j] = message.pattern[j]; } - if (message.nameField != null && message.hasOwnProperty("nameField")) + if (message.nameField != null && Object.hasOwnProperty.call(message, "nameField")) object.nameField = message.nameField; - if (message.history != null && message.hasOwnProperty("history")) + if (message.history != null && Object.hasOwnProperty.call(message, "history")) object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] === undefined ? message.history : $root.google.api.ResourceDescriptor.History[message.history] : message.history; - if (message.plural != null && message.hasOwnProperty("plural")) + if (message.plural != null && Object.hasOwnProperty.call(message, "plural")) object.plural = message.plural; - if (message.singular != null && message.hasOwnProperty("singular")) + if (message.singular != null && Object.hasOwnProperty.call(message, "singular")) object.singular = message.singular; if (message.style && message.style.length) { object.style = []; @@ -35794,9 +36838,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ResourceReference.encode = function encode(message, writer) { + ResourceReference.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.type != null && Object.hasOwnProperty.call(message, "type")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); if (message.childType != null && Object.hasOwnProperty.call(message, "childType")) @@ -35814,7 +36862,7 @@ * @returns {$protobuf.Writer} Writer */ ResourceReference.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -35888,10 +36936,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.type != null && message.hasOwnProperty("type")) + if (message.type != null && Object.hasOwnProperty.call(message, "type")) if (!$util.isString(message.type)) return "type: string expected"; - if (message.childType != null && message.hasOwnProperty("childType")) + if (message.childType != null && Object.hasOwnProperty.call(message, "childType")) if (!$util.isString(message.childType)) return "childType: string expected"; return null; @@ -35908,6 +36956,8 @@ ResourceReference.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.ResourceReference) return object; + if (!$util.isObject(object)) + throw TypeError(".google.api.ResourceReference: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -35929,17 +36979,21 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ResourceReference.toObject = function toObject(message, options) { + ResourceReference.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.type = ""; object.childType = ""; } - if (message.type != null && message.hasOwnProperty("type")) + if (message.type != null && Object.hasOwnProperty.call(message, "type")) object.type = message.type; - if (message.childType != null && message.hasOwnProperty("childType")) + if (message.childType != null && Object.hasOwnProperty.call(message, "childType")) object.childType = message.childType; return object; }; @@ -36039,12 +37093,16 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FileDescriptorSet.encode = function encode(message, writer) { + FileDescriptorSet.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.file != null && message.file.length) for (var i = 0; i < message.file.length; ++i) - $root.google.protobuf.FileDescriptorProto.encode(message.file[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.protobuf.FileDescriptorProto.encode(message.file[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); return writer; }; @@ -36058,7 +37116,7 @@ * @returns {$protobuf.Writer} Writer */ FileDescriptorSet.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -36130,7 +37188,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.file != null && message.hasOwnProperty("file")) { + if (message.file != null && Object.hasOwnProperty.call(message, "file")) { if (!Array.isArray(message.file)) return "file: array expected"; for (var i = 0; i < message.file.length; ++i) { @@ -36153,6 +37211,8 @@ FileDescriptorSet.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.FileDescriptorSet) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.FileDescriptorSet: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -36163,7 +37223,7 @@ throw TypeError(".google.protobuf.FileDescriptorSet.file: array expected"); message.file = []; for (var i = 0; i < object.file.length; ++i) { - if (typeof object.file[i] !== "object") + if (!$util.isObject(object.file[i])) throw TypeError(".google.protobuf.FileDescriptorSet.file: object expected"); message.file[i] = $root.google.protobuf.FileDescriptorProto.fromObject(object.file[i], long + 1); } @@ -36180,16 +37240,20 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FileDescriptorSet.toObject = function toObject(message, options) { + FileDescriptorSet.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.file = []; if (message.file && message.file.length) { object.file = []; for (var j = 0; j < message.file.length; ++j) - object.file[j] = $root.google.protobuf.FileDescriptorProto.toObject(message.file[j], options); + object.file[j] = $root.google.protobuf.FileDescriptorProto.toObject(message.file[j], options, q + 1); } return object; }; @@ -36435,9 +37499,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FileDescriptorProto.encode = function encode(message, writer) { + FileDescriptorProto.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); if (message["package"] != null && Object.hasOwnProperty.call(message, "package")) @@ -36447,20 +37515,20 @@ writer.uint32(/* id 3, wireType 2 =*/26).string(message.dependency[i]); if (message.messageType != null && message.messageType.length) for (var i = 0; i < message.messageType.length; ++i) - $root.google.protobuf.DescriptorProto.encode(message.messageType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + $root.google.protobuf.DescriptorProto.encode(message.messageType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); if (message.enumType != null && message.enumType.length) for (var i = 0; i < message.enumType.length; ++i) - $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); if (message.service != null && message.service.length) for (var i = 0; i < message.service.length; ++i) - $root.google.protobuf.ServiceDescriptorProto.encode(message.service[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + $root.google.protobuf.ServiceDescriptorProto.encode(message.service[i], writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); if (message.extension != null && message.extension.length) for (var i = 0; i < message.extension.length; ++i) - $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.FileOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + $root.google.protobuf.FileOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork(), q + 1).ldelim(); if (message.sourceCodeInfo != null && Object.hasOwnProperty.call(message, "sourceCodeInfo")) - $root.google.protobuf.SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + $root.google.protobuf.SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(/* id 9, wireType 2 =*/74).fork(), q + 1).ldelim(); if (message.publicDependency != null && message.publicDependency.length) for (var i = 0; i < message.publicDependency.length; ++i) writer.uint32(/* id 10, wireType 0 =*/80).int32(message.publicDependency[i]); @@ -36487,7 +37555,7 @@ * @returns {$protobuf.Writer} Writer */ FileDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -36635,41 +37703,41 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) if (!$util.isString(message.name)) return "name: string expected"; - if (message["package"] != null && message.hasOwnProperty("package")) + if (message["package"] != null && Object.hasOwnProperty.call(message, "package")) if (!$util.isString(message["package"])) return "package: string expected"; - if (message.dependency != null && message.hasOwnProperty("dependency")) { + if (message.dependency != null && Object.hasOwnProperty.call(message, "dependency")) { if (!Array.isArray(message.dependency)) return "dependency: array expected"; for (var i = 0; i < message.dependency.length; ++i) if (!$util.isString(message.dependency[i])) return "dependency: string[] expected"; } - if (message.publicDependency != null && message.hasOwnProperty("publicDependency")) { + if (message.publicDependency != null && Object.hasOwnProperty.call(message, "publicDependency")) { if (!Array.isArray(message.publicDependency)) return "publicDependency: array expected"; for (var i = 0; i < message.publicDependency.length; ++i) if (!$util.isInteger(message.publicDependency[i])) return "publicDependency: integer[] expected"; } - if (message.weakDependency != null && message.hasOwnProperty("weakDependency")) { + if (message.weakDependency != null && Object.hasOwnProperty.call(message, "weakDependency")) { if (!Array.isArray(message.weakDependency)) return "weakDependency: array expected"; for (var i = 0; i < message.weakDependency.length; ++i) if (!$util.isInteger(message.weakDependency[i])) return "weakDependency: integer[] expected"; } - if (message.optionDependency != null && message.hasOwnProperty("optionDependency")) { + if (message.optionDependency != null && Object.hasOwnProperty.call(message, "optionDependency")) { if (!Array.isArray(message.optionDependency)) return "optionDependency: array expected"; for (var i = 0; i < message.optionDependency.length; ++i) if (!$util.isString(message.optionDependency[i])) return "optionDependency: string[] expected"; } - if (message.messageType != null && message.hasOwnProperty("messageType")) { + if (message.messageType != null && Object.hasOwnProperty.call(message, "messageType")) { if (!Array.isArray(message.messageType)) return "messageType: array expected"; for (var i = 0; i < message.messageType.length; ++i) { @@ -36678,7 +37746,7 @@ return "messageType." + error; } } - if (message.enumType != null && message.hasOwnProperty("enumType")) { + if (message.enumType != null && Object.hasOwnProperty.call(message, "enumType")) { if (!Array.isArray(message.enumType)) return "enumType: array expected"; for (var i = 0; i < message.enumType.length; ++i) { @@ -36687,7 +37755,7 @@ return "enumType." + error; } } - if (message.service != null && message.hasOwnProperty("service")) { + if (message.service != null && Object.hasOwnProperty.call(message, "service")) { if (!Array.isArray(message.service)) return "service: array expected"; for (var i = 0; i < message.service.length; ++i) { @@ -36696,7 +37764,7 @@ return "service." + error; } } - if (message.extension != null && message.hasOwnProperty("extension")) { + if (message.extension != null && Object.hasOwnProperty.call(message, "extension")) { if (!Array.isArray(message.extension)) return "extension: array expected"; for (var i = 0; i < message.extension.length; ++i) { @@ -36705,20 +37773,20 @@ return "extension." + error; } } - if (message.options != null && message.hasOwnProperty("options")) { + if (message.options != null && Object.hasOwnProperty.call(message, "options")) { var error = $root.google.protobuf.FileOptions.verify(message.options, long + 1); if (error) return "options." + error; } - if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) { + if (message.sourceCodeInfo != null && Object.hasOwnProperty.call(message, "sourceCodeInfo")) { var error = $root.google.protobuf.SourceCodeInfo.verify(message.sourceCodeInfo, long + 1); if (error) return "sourceCodeInfo." + error; } - if (message.syntax != null && message.hasOwnProperty("syntax")) + if (message.syntax != null && Object.hasOwnProperty.call(message, "syntax")) if (!$util.isString(message.syntax)) return "syntax: string expected"; - if (message.edition != null && message.hasOwnProperty("edition")) + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) switch (message.edition) { default: return "edition: enum value expected"; @@ -36750,6 +37818,8 @@ FileDescriptorProto.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.FileDescriptorProto) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.FileDescriptorProto: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -36792,7 +37862,7 @@ throw TypeError(".google.protobuf.FileDescriptorProto.messageType: array expected"); message.messageType = []; for (var i = 0; i < object.messageType.length; ++i) { - if (typeof object.messageType[i] !== "object") + if (!$util.isObject(object.messageType[i])) throw TypeError(".google.protobuf.FileDescriptorProto.messageType: object expected"); message.messageType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.messageType[i], long + 1); } @@ -36802,7 +37872,7 @@ throw TypeError(".google.protobuf.FileDescriptorProto.enumType: array expected"); message.enumType = []; for (var i = 0; i < object.enumType.length; ++i) { - if (typeof object.enumType[i] !== "object") + if (!$util.isObject(object.enumType[i])) throw TypeError(".google.protobuf.FileDescriptorProto.enumType: object expected"); message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i], long + 1); } @@ -36812,7 +37882,7 @@ throw TypeError(".google.protobuf.FileDescriptorProto.service: array expected"); message.service = []; for (var i = 0; i < object.service.length; ++i) { - if (typeof object.service[i] !== "object") + if (!$util.isObject(object.service[i])) throw TypeError(".google.protobuf.FileDescriptorProto.service: object expected"); message.service[i] = $root.google.protobuf.ServiceDescriptorProto.fromObject(object.service[i], long + 1); } @@ -36822,18 +37892,18 @@ throw TypeError(".google.protobuf.FileDescriptorProto.extension: array expected"); message.extension = []; for (var i = 0; i < object.extension.length; ++i) { - if (typeof object.extension[i] !== "object") + if (!$util.isObject(object.extension[i])) throw TypeError(".google.protobuf.FileDescriptorProto.extension: object expected"); message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i], long + 1); } } if (object.options != null) { - if (typeof object.options !== "object") + if (!$util.isObject(object.options)) throw TypeError(".google.protobuf.FileDescriptorProto.options: object expected"); message.options = $root.google.protobuf.FileOptions.fromObject(object.options, long + 1); } if (object.sourceCodeInfo != null) { - if (typeof object.sourceCodeInfo !== "object") + if (!$util.isObject(object.sourceCodeInfo)) throw TypeError(".google.protobuf.FileDescriptorProto.sourceCodeInfo: object expected"); message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.fromObject(object.sourceCodeInfo, long + 1); } @@ -36907,9 +37977,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FileDescriptorProto.toObject = function toObject(message, options) { + FileDescriptorProto.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) { object.dependency = []; @@ -36929,9 +38003,9 @@ object.syntax = ""; object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; } - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) object.name = message.name; - if (message["package"] != null && message.hasOwnProperty("package")) + if (message["package"] != null && Object.hasOwnProperty.call(message, "package")) object["package"] = message["package"]; if (message.dependency && message.dependency.length) { object.dependency = []; @@ -36941,27 +38015,27 @@ if (message.messageType && message.messageType.length) { object.messageType = []; for (var j = 0; j < message.messageType.length; ++j) - object.messageType[j] = $root.google.protobuf.DescriptorProto.toObject(message.messageType[j], options); + object.messageType[j] = $root.google.protobuf.DescriptorProto.toObject(message.messageType[j], options, q + 1); } if (message.enumType && message.enumType.length) { object.enumType = []; for (var j = 0; j < message.enumType.length; ++j) - object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); + object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options, q + 1); } if (message.service && message.service.length) { object.service = []; for (var j = 0; j < message.service.length; ++j) - object.service[j] = $root.google.protobuf.ServiceDescriptorProto.toObject(message.service[j], options); + object.service[j] = $root.google.protobuf.ServiceDescriptorProto.toObject(message.service[j], options, q + 1); } if (message.extension && message.extension.length) { object.extension = []; for (var j = 0; j < message.extension.length; ++j) - object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); + object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options, q + 1); } - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.FileOptions.toObject(message.options, options); - if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) - object.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.toObject(message.sourceCodeInfo, options); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + object.options = $root.google.protobuf.FileOptions.toObject(message.options, options, q + 1); + if (message.sourceCodeInfo != null && Object.hasOwnProperty.call(message, "sourceCodeInfo")) + object.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.toObject(message.sourceCodeInfo, options, q + 1); if (message.publicDependency && message.publicDependency.length) { object.publicDependency = []; for (var j = 0; j < message.publicDependency.length; ++j) @@ -36972,9 +38046,9 @@ for (var j = 0; j < message.weakDependency.length; ++j) object.weakDependency[j] = message.weakDependency[j]; } - if (message.syntax != null && message.hasOwnProperty("syntax")) + if (message.syntax != null && Object.hasOwnProperty.call(message, "syntax")) object.syntax = message.syntax; - if (message.edition != null && message.hasOwnProperty("edition")) + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; if (message.optionDependency && message.optionDependency.length) { object.optionDependency = []; @@ -37164,34 +38238,38 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DescriptorProto.encode = function encode(message, writer) { + DescriptorProto.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); if (message.field != null && message.field.length) for (var i = 0; i < message.field.length; ++i) - $root.google.protobuf.FieldDescriptorProto.encode(message.field[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.protobuf.FieldDescriptorProto.encode(message.field[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); if (message.nestedType != null && message.nestedType.length) for (var i = 0; i < message.nestedType.length; ++i) - $root.google.protobuf.DescriptorProto.encode(message.nestedType[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + $root.google.protobuf.DescriptorProto.encode(message.nestedType[i], writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); if (message.enumType != null && message.enumType.length) for (var i = 0; i < message.enumType.length; ++i) - $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); if (message.extensionRange != null && message.extensionRange.length) for (var i = 0; i < message.extensionRange.length; ++i) - $root.google.protobuf.DescriptorProto.ExtensionRange.encode(message.extensionRange[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + $root.google.protobuf.DescriptorProto.ExtensionRange.encode(message.extensionRange[i], writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); if (message.extension != null && message.extension.length) for (var i = 0; i < message.extension.length; ++i) - $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.MessageOptions.encode(message.options, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + $root.google.protobuf.MessageOptions.encode(message.options, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); if (message.oneofDecl != null && message.oneofDecl.length) for (var i = 0; i < message.oneofDecl.length; ++i) - $root.google.protobuf.OneofDescriptorProto.encode(message.oneofDecl[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + $root.google.protobuf.OneofDescriptorProto.encode(message.oneofDecl[i], writer.uint32(/* id 8, wireType 2 =*/66).fork(), q + 1).ldelim(); if (message.reservedRange != null && message.reservedRange.length) for (var i = 0; i < message.reservedRange.length; ++i) - $root.google.protobuf.DescriptorProto.ReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + $root.google.protobuf.DescriptorProto.ReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 9, wireType 2 =*/74).fork(), q + 1).ldelim(); if (message.reservedName != null && message.reservedName.length) for (var i = 0; i < message.reservedName.length; ++i) writer.uint32(/* id 10, wireType 2 =*/82).string(message.reservedName[i]); @@ -37210,7 +38288,7 @@ * @returns {$protobuf.Writer} Writer */ DescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -37336,10 +38414,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) if (!$util.isString(message.name)) return "name: string expected"; - if (message.field != null && message.hasOwnProperty("field")) { + if (message.field != null && Object.hasOwnProperty.call(message, "field")) { if (!Array.isArray(message.field)) return "field: array expected"; for (var i = 0; i < message.field.length; ++i) { @@ -37348,7 +38426,7 @@ return "field." + error; } } - if (message.extension != null && message.hasOwnProperty("extension")) { + if (message.extension != null && Object.hasOwnProperty.call(message, "extension")) { if (!Array.isArray(message.extension)) return "extension: array expected"; for (var i = 0; i < message.extension.length; ++i) { @@ -37357,7 +38435,7 @@ return "extension." + error; } } - if (message.nestedType != null && message.hasOwnProperty("nestedType")) { + if (message.nestedType != null && Object.hasOwnProperty.call(message, "nestedType")) { if (!Array.isArray(message.nestedType)) return "nestedType: array expected"; for (var i = 0; i < message.nestedType.length; ++i) { @@ -37366,7 +38444,7 @@ return "nestedType." + error; } } - if (message.enumType != null && message.hasOwnProperty("enumType")) { + if (message.enumType != null && Object.hasOwnProperty.call(message, "enumType")) { if (!Array.isArray(message.enumType)) return "enumType: array expected"; for (var i = 0; i < message.enumType.length; ++i) { @@ -37375,7 +38453,7 @@ return "enumType." + error; } } - if (message.extensionRange != null && message.hasOwnProperty("extensionRange")) { + if (message.extensionRange != null && Object.hasOwnProperty.call(message, "extensionRange")) { if (!Array.isArray(message.extensionRange)) return "extensionRange: array expected"; for (var i = 0; i < message.extensionRange.length; ++i) { @@ -37384,7 +38462,7 @@ return "extensionRange." + error; } } - if (message.oneofDecl != null && message.hasOwnProperty("oneofDecl")) { + if (message.oneofDecl != null && Object.hasOwnProperty.call(message, "oneofDecl")) { if (!Array.isArray(message.oneofDecl)) return "oneofDecl: array expected"; for (var i = 0; i < message.oneofDecl.length; ++i) { @@ -37393,12 +38471,12 @@ return "oneofDecl." + error; } } - if (message.options != null && message.hasOwnProperty("options")) { + if (message.options != null && Object.hasOwnProperty.call(message, "options")) { var error = $root.google.protobuf.MessageOptions.verify(message.options, long + 1); if (error) return "options." + error; } - if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { + if (message.reservedRange != null && Object.hasOwnProperty.call(message, "reservedRange")) { if (!Array.isArray(message.reservedRange)) return "reservedRange: array expected"; for (var i = 0; i < message.reservedRange.length; ++i) { @@ -37407,14 +38485,14 @@ return "reservedRange." + error; } } - if (message.reservedName != null && message.hasOwnProperty("reservedName")) { + if (message.reservedName != null && Object.hasOwnProperty.call(message, "reservedName")) { if (!Array.isArray(message.reservedName)) return "reservedName: array expected"; for (var i = 0; i < message.reservedName.length; ++i) if (!$util.isString(message.reservedName[i])) return "reservedName: string[] expected"; } - if (message.visibility != null && message.hasOwnProperty("visibility")) + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) switch (message.visibility) { default: return "visibility: enum value expected"; @@ -37437,6 +38515,8 @@ DescriptorProto.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.DescriptorProto) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.DescriptorProto: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -37449,7 +38529,7 @@ throw TypeError(".google.protobuf.DescriptorProto.field: array expected"); message.field = []; for (var i = 0; i < object.field.length; ++i) { - if (typeof object.field[i] !== "object") + if (!$util.isObject(object.field[i])) throw TypeError(".google.protobuf.DescriptorProto.field: object expected"); message.field[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.field[i], long + 1); } @@ -37459,7 +38539,7 @@ throw TypeError(".google.protobuf.DescriptorProto.extension: array expected"); message.extension = []; for (var i = 0; i < object.extension.length; ++i) { - if (typeof object.extension[i] !== "object") + if (!$util.isObject(object.extension[i])) throw TypeError(".google.protobuf.DescriptorProto.extension: object expected"); message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i], long + 1); } @@ -37469,7 +38549,7 @@ throw TypeError(".google.protobuf.DescriptorProto.nestedType: array expected"); message.nestedType = []; for (var i = 0; i < object.nestedType.length; ++i) { - if (typeof object.nestedType[i] !== "object") + if (!$util.isObject(object.nestedType[i])) throw TypeError(".google.protobuf.DescriptorProto.nestedType: object expected"); message.nestedType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.nestedType[i], long + 1); } @@ -37479,7 +38559,7 @@ throw TypeError(".google.protobuf.DescriptorProto.enumType: array expected"); message.enumType = []; for (var i = 0; i < object.enumType.length; ++i) { - if (typeof object.enumType[i] !== "object") + if (!$util.isObject(object.enumType[i])) throw TypeError(".google.protobuf.DescriptorProto.enumType: object expected"); message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i], long + 1); } @@ -37489,7 +38569,7 @@ throw TypeError(".google.protobuf.DescriptorProto.extensionRange: array expected"); message.extensionRange = []; for (var i = 0; i < object.extensionRange.length; ++i) { - if (typeof object.extensionRange[i] !== "object") + if (!$util.isObject(object.extensionRange[i])) throw TypeError(".google.protobuf.DescriptorProto.extensionRange: object expected"); message.extensionRange[i] = $root.google.protobuf.DescriptorProto.ExtensionRange.fromObject(object.extensionRange[i], long + 1); } @@ -37499,13 +38579,13 @@ throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: array expected"); message.oneofDecl = []; for (var i = 0; i < object.oneofDecl.length; ++i) { - if (typeof object.oneofDecl[i] !== "object") + if (!$util.isObject(object.oneofDecl[i])) throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: object expected"); message.oneofDecl[i] = $root.google.protobuf.OneofDescriptorProto.fromObject(object.oneofDecl[i], long + 1); } } if (object.options != null) { - if (typeof object.options !== "object") + if (!$util.isObject(object.options)) throw TypeError(".google.protobuf.DescriptorProto.options: object expected"); message.options = $root.google.protobuf.MessageOptions.fromObject(object.options, long + 1); } @@ -37514,7 +38594,7 @@ throw TypeError(".google.protobuf.DescriptorProto.reservedRange: array expected"); message.reservedRange = []; for (var i = 0; i < object.reservedRange.length; ++i) { - if (typeof object.reservedRange[i] !== "object") + if (!$util.isObject(object.reservedRange[i])) throw TypeError(".google.protobuf.DescriptorProto.reservedRange: object expected"); message.reservedRange[i] = $root.google.protobuf.DescriptorProto.ReservedRange.fromObject(object.reservedRange[i], long + 1); } @@ -37558,9 +38638,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DescriptorProto.toObject = function toObject(message, options) { + DescriptorProto.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) { object.field = []; @@ -37577,51 +38661,51 @@ object.options = null; object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; } - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) object.name = message.name; if (message.field && message.field.length) { object.field = []; for (var j = 0; j < message.field.length; ++j) - object.field[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.field[j], options); + object.field[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.field[j], options, q + 1); } if (message.nestedType && message.nestedType.length) { object.nestedType = []; for (var j = 0; j < message.nestedType.length; ++j) - object.nestedType[j] = $root.google.protobuf.DescriptorProto.toObject(message.nestedType[j], options); + object.nestedType[j] = $root.google.protobuf.DescriptorProto.toObject(message.nestedType[j], options, q + 1); } if (message.enumType && message.enumType.length) { object.enumType = []; for (var j = 0; j < message.enumType.length; ++j) - object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); + object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options, q + 1); } if (message.extensionRange && message.extensionRange.length) { object.extensionRange = []; for (var j = 0; j < message.extensionRange.length; ++j) - object.extensionRange[j] = $root.google.protobuf.DescriptorProto.ExtensionRange.toObject(message.extensionRange[j], options); + object.extensionRange[j] = $root.google.protobuf.DescriptorProto.ExtensionRange.toObject(message.extensionRange[j], options, q + 1); } if (message.extension && message.extension.length) { object.extension = []; for (var j = 0; j < message.extension.length; ++j) - object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); + object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options, q + 1); } - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.MessageOptions.toObject(message.options, options); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + object.options = $root.google.protobuf.MessageOptions.toObject(message.options, options, q + 1); if (message.oneofDecl && message.oneofDecl.length) { object.oneofDecl = []; for (var j = 0; j < message.oneofDecl.length; ++j) - object.oneofDecl[j] = $root.google.protobuf.OneofDescriptorProto.toObject(message.oneofDecl[j], options); + object.oneofDecl[j] = $root.google.protobuf.OneofDescriptorProto.toObject(message.oneofDecl[j], options, q + 1); } if (message.reservedRange && message.reservedRange.length) { object.reservedRange = []; for (var j = 0; j < message.reservedRange.length; ++j) - object.reservedRange[j] = $root.google.protobuf.DescriptorProto.ReservedRange.toObject(message.reservedRange[j], options); + object.reservedRange[j] = $root.google.protobuf.DescriptorProto.ReservedRange.toObject(message.reservedRange[j], options, q + 1); } if (message.reservedName && message.reservedName.length) { object.reservedName = []; for (var j = 0; j < message.reservedName.length; ++j) object.reservedName[j] = message.reservedName[j]; } - if (message.visibility != null && message.hasOwnProperty("visibility")) + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; return object; }; @@ -37723,15 +38807,19 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExtensionRange.encode = function encode(message, writer) { + ExtensionRange.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.start != null && Object.hasOwnProperty.call(message, "start")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); if (message.end != null && Object.hasOwnProperty.call(message, "end")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.ExtensionRangeOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + $root.google.protobuf.ExtensionRangeOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); return writer; }; @@ -37745,7 +38833,7 @@ * @returns {$protobuf.Writer} Writer */ ExtensionRange.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -37823,13 +38911,13 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.start != null && message.hasOwnProperty("start")) + if (message.start != null && Object.hasOwnProperty.call(message, "start")) if (!$util.isInteger(message.start)) return "start: integer expected"; - if (message.end != null && message.hasOwnProperty("end")) + if (message.end != null && Object.hasOwnProperty.call(message, "end")) if (!$util.isInteger(message.end)) return "end: integer expected"; - if (message.options != null && message.hasOwnProperty("options")) { + if (message.options != null && Object.hasOwnProperty.call(message, "options")) { var error = $root.google.protobuf.ExtensionRangeOptions.verify(message.options, long + 1); if (error) return "options." + error; @@ -37848,6 +38936,8 @@ ExtensionRange.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.DescriptorProto.ExtensionRange) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.DescriptorProto.ExtensionRange: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -37858,7 +38948,7 @@ if (object.end != null) message.end = object.end | 0; if (object.options != null) { - if (typeof object.options !== "object") + if (!$util.isObject(object.options)) throw TypeError(".google.protobuf.DescriptorProto.ExtensionRange.options: object expected"); message.options = $root.google.protobuf.ExtensionRangeOptions.fromObject(object.options, long + 1); } @@ -37874,21 +38964,25 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ExtensionRange.toObject = function toObject(message, options) { + ExtensionRange.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.start = 0; object.end = 0; object.options = null; } - if (message.start != null && message.hasOwnProperty("start")) + if (message.start != null && Object.hasOwnProperty.call(message, "start")) object.start = message.start; - if (message.end != null && message.hasOwnProperty("end")) + if (message.end != null && Object.hasOwnProperty.call(message, "end")) object.end = message.end; - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.ExtensionRangeOptions.toObject(message.options, options); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + object.options = $root.google.protobuf.ExtensionRangeOptions.toObject(message.options, options, q + 1); return object; }; @@ -37983,9 +39077,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReservedRange.encode = function encode(message, writer) { + ReservedRange.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.start != null && Object.hasOwnProperty.call(message, "start")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); if (message.end != null && Object.hasOwnProperty.call(message, "end")) @@ -38003,7 +39101,7 @@ * @returns {$protobuf.Writer} Writer */ ReservedRange.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -38077,10 +39175,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.start != null && message.hasOwnProperty("start")) + if (message.start != null && Object.hasOwnProperty.call(message, "start")) if (!$util.isInteger(message.start)) return "start: integer expected"; - if (message.end != null && message.hasOwnProperty("end")) + if (message.end != null && Object.hasOwnProperty.call(message, "end")) if (!$util.isInteger(message.end)) return "end: integer expected"; return null; @@ -38097,6 +39195,8 @@ ReservedRange.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.DescriptorProto.ReservedRange) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.DescriptorProto.ReservedRange: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -38118,17 +39218,21 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ReservedRange.toObject = function toObject(message, options) { + ReservedRange.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.start = 0; object.end = 0; } - if (message.start != null && message.hasOwnProperty("start")) + if (message.start != null && Object.hasOwnProperty.call(message, "start")) object.start = message.start; - if (message.end != null && message.hasOwnProperty("end")) + if (message.end != null && Object.hasOwnProperty.call(message, "end")) object.end = message.end; return object; }; @@ -38247,19 +39351,23 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ExtensionRangeOptions.encode = function encode(message, writer) { + ExtensionRangeOptions.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.declaration != null && message.declaration.length) for (var i = 0; i < message.declaration.length; ++i) - $root.google.protobuf.ExtensionRangeOptions.Declaration.encode(message.declaration[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.protobuf.ExtensionRangeOptions.Declaration.encode(message.declaration[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); if (message.verification != null && Object.hasOwnProperty.call(message, "verification")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.verification); if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 50, wireType 2 =*/402).fork()).ldelim(); + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 50, wireType 2 =*/402).fork(), q + 1).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork(), q + 1).ldelim(); return writer; }; @@ -38273,7 +39381,7 @@ * @returns {$protobuf.Writer} Writer */ ExtensionRangeOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -38359,7 +39467,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (message.uninterpretedOption != null && Object.hasOwnProperty.call(message, "uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; for (var i = 0; i < message.uninterpretedOption.length; ++i) { @@ -38368,7 +39476,7 @@ return "uninterpretedOption." + error; } } - if (message.declaration != null && message.hasOwnProperty("declaration")) { + if (message.declaration != null && Object.hasOwnProperty.call(message, "declaration")) { if (!Array.isArray(message.declaration)) return "declaration: array expected"; for (var i = 0; i < message.declaration.length; ++i) { @@ -38377,12 +39485,12 @@ return "declaration." + error; } } - if (message.features != null && message.hasOwnProperty("features")) { + if (message.features != null && Object.hasOwnProperty.call(message, "features")) { var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); if (error) return "features." + error; } - if (message.verification != null && message.hasOwnProperty("verification")) + if (message.verification != null && Object.hasOwnProperty.call(message, "verification")) switch (message.verification) { default: return "verification: enum value expected"; @@ -38404,6 +39512,8 @@ ExtensionRangeOptions.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.ExtensionRangeOptions) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.ExtensionRangeOptions: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -38414,7 +39524,7 @@ throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: array expected"); message.uninterpretedOption = []; for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") + if (!$util.isObject(object.uninterpretedOption[i])) throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: object expected"); message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); } @@ -38424,13 +39534,13 @@ throw TypeError(".google.protobuf.ExtensionRangeOptions.declaration: array expected"); message.declaration = []; for (var i = 0; i < object.declaration.length; ++i) { - if (typeof object.declaration[i] !== "object") + if (!$util.isObject(object.declaration[i])) throw TypeError(".google.protobuf.ExtensionRangeOptions.declaration: object expected"); message.declaration[i] = $root.google.protobuf.ExtensionRangeOptions.Declaration.fromObject(object.declaration[i], long + 1); } } if (object.features != null) { - if (typeof object.features !== "object") + if (!$util.isObject(object.features)) throw TypeError(".google.protobuf.ExtensionRangeOptions.features: object expected"); message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); } @@ -38462,9 +39572,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ExtensionRangeOptions.toObject = function toObject(message, options) { + ExtensionRangeOptions.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) { object.declaration = []; @@ -38477,16 +39591,16 @@ if (message.declaration && message.declaration.length) { object.declaration = []; for (var j = 0; j < message.declaration.length; ++j) - object.declaration[j] = $root.google.protobuf.ExtensionRangeOptions.Declaration.toObject(message.declaration[j], options); + object.declaration[j] = $root.google.protobuf.ExtensionRangeOptions.Declaration.toObject(message.declaration[j], options, q + 1); } - if (message.verification != null && message.hasOwnProperty("verification")) + if (message.verification != null && Object.hasOwnProperty.call(message, "verification")) object.verification = options.enums === String ? $root.google.protobuf.ExtensionRangeOptions.VerificationState[message.verification] === undefined ? message.verification : $root.google.protobuf.ExtensionRangeOptions.VerificationState[message.verification] : message.verification; - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options, q + 1); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options, q + 1); } return object; }; @@ -38606,9 +39720,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Declaration.encode = function encode(message, writer) { + Declaration.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.number != null && Object.hasOwnProperty.call(message, "number")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.number); if (message.fullName != null && Object.hasOwnProperty.call(message, "fullName")) @@ -38632,7 +39750,7 @@ * @returns {$protobuf.Writer} Writer */ Declaration.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -38718,19 +39836,19 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.number != null && message.hasOwnProperty("number")) + if (message.number != null && Object.hasOwnProperty.call(message, "number")) if (!$util.isInteger(message.number)) return "number: integer expected"; - if (message.fullName != null && message.hasOwnProperty("fullName")) + if (message.fullName != null && Object.hasOwnProperty.call(message, "fullName")) if (!$util.isString(message.fullName)) return "fullName: string expected"; - if (message.type != null && message.hasOwnProperty("type")) + if (message.type != null && Object.hasOwnProperty.call(message, "type")) if (!$util.isString(message.type)) return "type: string expected"; - if (message.reserved != null && message.hasOwnProperty("reserved")) + if (message.reserved != null && Object.hasOwnProperty.call(message, "reserved")) if (typeof message.reserved !== "boolean") return "reserved: boolean expected"; - if (message.repeated != null && message.hasOwnProperty("repeated")) + if (message.repeated != null && Object.hasOwnProperty.call(message, "repeated")) if (typeof message.repeated !== "boolean") return "repeated: boolean expected"; return null; @@ -38747,6 +39865,8 @@ Declaration.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.ExtensionRangeOptions.Declaration) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.ExtensionRangeOptions.Declaration: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -38774,9 +39894,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Declaration.toObject = function toObject(message, options) { + Declaration.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.number = 0; @@ -38785,15 +39909,15 @@ object.reserved = false; object.repeated = false; } - if (message.number != null && message.hasOwnProperty("number")) + if (message.number != null && Object.hasOwnProperty.call(message, "number")) object.number = message.number; - if (message.fullName != null && message.hasOwnProperty("fullName")) + if (message.fullName != null && Object.hasOwnProperty.call(message, "fullName")) object.fullName = message.fullName; - if (message.type != null && message.hasOwnProperty("type")) + if (message.type != null && Object.hasOwnProperty.call(message, "type")) object.type = message.type; - if (message.reserved != null && message.hasOwnProperty("reserved")) + if (message.reserved != null && Object.hasOwnProperty.call(message, "reserved")) object.reserved = message.reserved; - if (message.repeated != null && message.hasOwnProperty("repeated")) + if (message.repeated != null && Object.hasOwnProperty.call(message, "repeated")) object.repeated = message.repeated; return object; }; @@ -38987,9 +40111,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FieldDescriptorProto.encode = function encode(message, writer) { + FieldDescriptorProto.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); if (message.extendee != null && Object.hasOwnProperty.call(message, "extendee")) @@ -39005,7 +40133,7 @@ if (message.defaultValue != null && Object.hasOwnProperty.call(message, "defaultValue")) writer.uint32(/* id 7, wireType 2 =*/58).string(message.defaultValue); if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.FieldOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + $root.google.protobuf.FieldOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork(), q + 1).ldelim(); if (message.oneofIndex != null && Object.hasOwnProperty.call(message, "oneofIndex")) writer.uint32(/* id 9, wireType 0 =*/72).int32(message.oneofIndex); if (message.jsonName != null && Object.hasOwnProperty.call(message, "jsonName")) @@ -39025,7 +40153,7 @@ * @returns {$protobuf.Writer} Writer */ FieldDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -39135,13 +40263,13 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) if (!$util.isString(message.name)) return "name: string expected"; - if (message.number != null && message.hasOwnProperty("number")) + if (message.number != null && Object.hasOwnProperty.call(message, "number")) if (!$util.isInteger(message.number)) return "number: integer expected"; - if (message.label != null && message.hasOwnProperty("label")) + if (message.label != null && Object.hasOwnProperty.call(message, "label")) switch (message.label) { default: return "label: enum value expected"; @@ -39150,7 +40278,7 @@ case 2: break; } - if (message.type != null && message.hasOwnProperty("type")) + if (message.type != null && Object.hasOwnProperty.call(message, "type")) switch (message.type) { default: return "type: enum value expected"; @@ -39174,27 +40302,27 @@ case 18: break; } - if (message.typeName != null && message.hasOwnProperty("typeName")) + if (message.typeName != null && Object.hasOwnProperty.call(message, "typeName")) if (!$util.isString(message.typeName)) return "typeName: string expected"; - if (message.extendee != null && message.hasOwnProperty("extendee")) + if (message.extendee != null && Object.hasOwnProperty.call(message, "extendee")) if (!$util.isString(message.extendee)) return "extendee: string expected"; - if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + if (message.defaultValue != null && Object.hasOwnProperty.call(message, "defaultValue")) if (!$util.isString(message.defaultValue)) return "defaultValue: string expected"; - if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) + if (message.oneofIndex != null && Object.hasOwnProperty.call(message, "oneofIndex")) if (!$util.isInteger(message.oneofIndex)) return "oneofIndex: integer expected"; - if (message.jsonName != null && message.hasOwnProperty("jsonName")) + if (message.jsonName != null && Object.hasOwnProperty.call(message, "jsonName")) if (!$util.isString(message.jsonName)) return "jsonName: string expected"; - if (message.options != null && message.hasOwnProperty("options")) { + if (message.options != null && Object.hasOwnProperty.call(message, "options")) { var error = $root.google.protobuf.FieldOptions.verify(message.options, long + 1); if (error) return "options." + error; } - if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) + if (message.proto3Optional != null && Object.hasOwnProperty.call(message, "proto3Optional")) if (typeof message.proto3Optional !== "boolean") return "proto3Optional: boolean expected"; return null; @@ -39211,6 +40339,8 @@ FieldDescriptorProto.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.FieldDescriptorProto) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.FieldDescriptorProto: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -39331,7 +40461,7 @@ if (object.jsonName != null) message.jsonName = String(object.jsonName); if (object.options != null) { - if (typeof object.options !== "object") + if (!$util.isObject(object.options)) throw TypeError(".google.protobuf.FieldDescriptorProto.options: object expected"); message.options = $root.google.protobuf.FieldOptions.fromObject(object.options, long + 1); } @@ -39349,9 +40479,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FieldDescriptorProto.toObject = function toObject(message, options) { + FieldDescriptorProto.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.name = ""; @@ -39366,27 +40500,27 @@ object.jsonName = ""; object.proto3Optional = false; } - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) object.name = message.name; - if (message.extendee != null && message.hasOwnProperty("extendee")) + if (message.extendee != null && Object.hasOwnProperty.call(message, "extendee")) object.extendee = message.extendee; - if (message.number != null && message.hasOwnProperty("number")) + if (message.number != null && Object.hasOwnProperty.call(message, "number")) object.number = message.number; - if (message.label != null && message.hasOwnProperty("label")) + if (message.label != null && Object.hasOwnProperty.call(message, "label")) object.label = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Label[message.label] === undefined ? message.label : $root.google.protobuf.FieldDescriptorProto.Label[message.label] : message.label; - if (message.type != null && message.hasOwnProperty("type")) + if (message.type != null && Object.hasOwnProperty.call(message, "type")) object.type = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Type[message.type] === undefined ? message.type : $root.google.protobuf.FieldDescriptorProto.Type[message.type] : message.type; - if (message.typeName != null && message.hasOwnProperty("typeName")) + if (message.typeName != null && Object.hasOwnProperty.call(message, "typeName")) object.typeName = message.typeName; - if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + if (message.defaultValue != null && Object.hasOwnProperty.call(message, "defaultValue")) object.defaultValue = message.defaultValue; - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.FieldOptions.toObject(message.options, options); - if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + object.options = $root.google.protobuf.FieldOptions.toObject(message.options, options, q + 1); + if (message.oneofIndex != null && Object.hasOwnProperty.call(message, "oneofIndex")) object.oneofIndex = message.oneofIndex; - if (message.jsonName != null && message.hasOwnProperty("jsonName")) + if (message.jsonName != null && Object.hasOwnProperty.call(message, "jsonName")) object.jsonName = message.jsonName; - if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) + if (message.proto3Optional != null && Object.hasOwnProperty.call(message, "proto3Optional")) object.proto3Optional = message.proto3Optional; return object; }; @@ -39544,13 +40678,17 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OneofDescriptorProto.encode = function encode(message, writer) { + OneofDescriptorProto.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.OneofOptions.encode(message.options, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.protobuf.OneofOptions.encode(message.options, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); return writer; }; @@ -39564,7 +40702,7 @@ * @returns {$protobuf.Writer} Writer */ OneofDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -39638,10 +40776,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) if (!$util.isString(message.name)) return "name: string expected"; - if (message.options != null && message.hasOwnProperty("options")) { + if (message.options != null && Object.hasOwnProperty.call(message, "options")) { var error = $root.google.protobuf.OneofOptions.verify(message.options, long + 1); if (error) return "options." + error; @@ -39660,6 +40798,8 @@ OneofDescriptorProto.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.OneofDescriptorProto) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.OneofDescriptorProto: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -39668,7 +40808,7 @@ if (object.name != null) message.name = String(object.name); if (object.options != null) { - if (typeof object.options !== "object") + if (!$util.isObject(object.options)) throw TypeError(".google.protobuf.OneofDescriptorProto.options: object expected"); message.options = $root.google.protobuf.OneofOptions.fromObject(object.options, long + 1); } @@ -39684,18 +40824,22 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - OneofDescriptorProto.toObject = function toObject(message, options) { + OneofDescriptorProto.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.name = ""; object.options = null; } - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) object.name = message.name; - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.OneofOptions.toObject(message.options, options); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + object.options = $root.google.protobuf.OneofOptions.toObject(message.options, options, q + 1); return object; }; @@ -39829,19 +40973,23 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EnumDescriptorProto.encode = function encode(message, writer) { + EnumDescriptorProto.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); if (message.value != null && message.value.length) for (var i = 0; i < message.value.length; ++i) - $root.google.protobuf.EnumValueDescriptorProto.encode(message.value[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.protobuf.EnumValueDescriptorProto.encode(message.value[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.EnumOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + $root.google.protobuf.EnumOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); if (message.reservedRange != null && message.reservedRange.length) for (var i = 0; i < message.reservedRange.length; ++i) - $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); if (message.reservedName != null && message.reservedName.length) for (var i = 0; i < message.reservedName.length; ++i) writer.uint32(/* id 5, wireType 2 =*/42).string(message.reservedName[i]); @@ -39860,7 +41008,7 @@ * @returns {$protobuf.Writer} Writer */ EnumDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -39956,10 +41104,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) if (!$util.isString(message.name)) return "name: string expected"; - if (message.value != null && message.hasOwnProperty("value")) { + if (message.value != null && Object.hasOwnProperty.call(message, "value")) { if (!Array.isArray(message.value)) return "value: array expected"; for (var i = 0; i < message.value.length; ++i) { @@ -39968,12 +41116,12 @@ return "value." + error; } } - if (message.options != null && message.hasOwnProperty("options")) { + if (message.options != null && Object.hasOwnProperty.call(message, "options")) { var error = $root.google.protobuf.EnumOptions.verify(message.options, long + 1); if (error) return "options." + error; } - if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { + if (message.reservedRange != null && Object.hasOwnProperty.call(message, "reservedRange")) { if (!Array.isArray(message.reservedRange)) return "reservedRange: array expected"; for (var i = 0; i < message.reservedRange.length; ++i) { @@ -39982,14 +41130,14 @@ return "reservedRange." + error; } } - if (message.reservedName != null && message.hasOwnProperty("reservedName")) { + if (message.reservedName != null && Object.hasOwnProperty.call(message, "reservedName")) { if (!Array.isArray(message.reservedName)) return "reservedName: array expected"; for (var i = 0; i < message.reservedName.length; ++i) if (!$util.isString(message.reservedName[i])) return "reservedName: string[] expected"; } - if (message.visibility != null && message.hasOwnProperty("visibility")) + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) switch (message.visibility) { default: return "visibility: enum value expected"; @@ -40012,6 +41160,8 @@ EnumDescriptorProto.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.EnumDescriptorProto) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.EnumDescriptorProto: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -40024,13 +41174,13 @@ throw TypeError(".google.protobuf.EnumDescriptorProto.value: array expected"); message.value = []; for (var i = 0; i < object.value.length; ++i) { - if (typeof object.value[i] !== "object") + if (!$util.isObject(object.value[i])) throw TypeError(".google.protobuf.EnumDescriptorProto.value: object expected"); message.value[i] = $root.google.protobuf.EnumValueDescriptorProto.fromObject(object.value[i], long + 1); } } if (object.options != null) { - if (typeof object.options !== "object") + if (!$util.isObject(object.options)) throw TypeError(".google.protobuf.EnumDescriptorProto.options: object expected"); message.options = $root.google.protobuf.EnumOptions.fromObject(object.options, long + 1); } @@ -40039,7 +41189,7 @@ throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: array expected"); message.reservedRange = []; for (var i = 0; i < object.reservedRange.length; ++i) { - if (typeof object.reservedRange[i] !== "object") + if (!$util.isObject(object.reservedRange[i])) throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: object expected"); message.reservedRange[i] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.fromObject(object.reservedRange[i], long + 1); } @@ -40083,9 +41233,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EnumDescriptorProto.toObject = function toObject(message, options) { + EnumDescriptorProto.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) { object.value = []; @@ -40097,26 +41251,26 @@ object.options = null; object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; } - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) object.name = message.name; if (message.value && message.value.length) { object.value = []; for (var j = 0; j < message.value.length; ++j) - object.value[j] = $root.google.protobuf.EnumValueDescriptorProto.toObject(message.value[j], options); + object.value[j] = $root.google.protobuf.EnumValueDescriptorProto.toObject(message.value[j], options, q + 1); } - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.EnumOptions.toObject(message.options, options); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + object.options = $root.google.protobuf.EnumOptions.toObject(message.options, options, q + 1); if (message.reservedRange && message.reservedRange.length) { object.reservedRange = []; for (var j = 0; j < message.reservedRange.length; ++j) - object.reservedRange[j] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.toObject(message.reservedRange[j], options); + object.reservedRange[j] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.toObject(message.reservedRange[j], options, q + 1); } if (message.reservedName && message.reservedName.length) { object.reservedName = []; for (var j = 0; j < message.reservedName.length; ++j) object.reservedName[j] = message.reservedName[j]; } - if (message.visibility != null && message.hasOwnProperty("visibility")) + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; return object; }; @@ -40209,9 +41363,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EnumReservedRange.encode = function encode(message, writer) { + EnumReservedRange.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.start != null && Object.hasOwnProperty.call(message, "start")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); if (message.end != null && Object.hasOwnProperty.call(message, "end")) @@ -40229,7 +41387,7 @@ * @returns {$protobuf.Writer} Writer */ EnumReservedRange.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -40303,10 +41461,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.start != null && message.hasOwnProperty("start")) + if (message.start != null && Object.hasOwnProperty.call(message, "start")) if (!$util.isInteger(message.start)) return "start: integer expected"; - if (message.end != null && message.hasOwnProperty("end")) + if (message.end != null && Object.hasOwnProperty.call(message, "end")) if (!$util.isInteger(message.end)) return "end: integer expected"; return null; @@ -40323,6 +41481,8 @@ EnumReservedRange.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.EnumDescriptorProto.EnumReservedRange) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.EnumDescriptorProto.EnumReservedRange: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -40344,17 +41504,21 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EnumReservedRange.toObject = function toObject(message, options) { + EnumReservedRange.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.start = 0; object.end = 0; } - if (message.start != null && message.hasOwnProperty("start")) + if (message.start != null && Object.hasOwnProperty.call(message, "start")) object.start = message.start; - if (message.end != null && message.hasOwnProperty("end")) + if (message.end != null && Object.hasOwnProperty.call(message, "end")) object.end = message.end; return object; }; @@ -40462,15 +41626,19 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EnumValueDescriptorProto.encode = function encode(message, writer) { + EnumValueDescriptorProto.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); if (message.number != null && Object.hasOwnProperty.call(message, "number")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.number); if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.EnumValueOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + $root.google.protobuf.EnumValueOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); return writer; }; @@ -40484,7 +41652,7 @@ * @returns {$protobuf.Writer} Writer */ EnumValueDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -40562,13 +41730,13 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) if (!$util.isString(message.name)) return "name: string expected"; - if (message.number != null && message.hasOwnProperty("number")) + if (message.number != null && Object.hasOwnProperty.call(message, "number")) if (!$util.isInteger(message.number)) return "number: integer expected"; - if (message.options != null && message.hasOwnProperty("options")) { + if (message.options != null && Object.hasOwnProperty.call(message, "options")) { var error = $root.google.protobuf.EnumValueOptions.verify(message.options, long + 1); if (error) return "options." + error; @@ -40587,6 +41755,8 @@ EnumValueDescriptorProto.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.EnumValueDescriptorProto) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.EnumValueDescriptorProto: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -40597,7 +41767,7 @@ if (object.number != null) message.number = object.number | 0; if (object.options != null) { - if (typeof object.options !== "object") + if (!$util.isObject(object.options)) throw TypeError(".google.protobuf.EnumValueDescriptorProto.options: object expected"); message.options = $root.google.protobuf.EnumValueOptions.fromObject(object.options, long + 1); } @@ -40613,21 +41783,25 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EnumValueDescriptorProto.toObject = function toObject(message, options) { + EnumValueDescriptorProto.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.name = ""; object.number = 0; object.options = null; } - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) object.name = message.name; - if (message.number != null && message.hasOwnProperty("number")) + if (message.number != null && Object.hasOwnProperty.call(message, "number")) object.number = message.number; - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.EnumValueOptions.toObject(message.options, options); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + object.options = $root.google.protobuf.EnumValueOptions.toObject(message.options, options, q + 1); return object; }; @@ -40732,16 +41906,20 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ServiceDescriptorProto.encode = function encode(message, writer) { + ServiceDescriptorProto.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); if (message.method != null && message.method.length) for (var i = 0; i < message.method.length; ++i) - $root.google.protobuf.MethodDescriptorProto.encode(message.method[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.protobuf.MethodDescriptorProto.encode(message.method[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.ServiceOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + $root.google.protobuf.ServiceOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork(), q + 1).ldelim(); return writer; }; @@ -40755,7 +41933,7 @@ * @returns {$protobuf.Writer} Writer */ ServiceDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -40835,10 +42013,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) if (!$util.isString(message.name)) return "name: string expected"; - if (message.method != null && message.hasOwnProperty("method")) { + if (message.method != null && Object.hasOwnProperty.call(message, "method")) { if (!Array.isArray(message.method)) return "method: array expected"; for (var i = 0; i < message.method.length; ++i) { @@ -40847,7 +42025,7 @@ return "method." + error; } } - if (message.options != null && message.hasOwnProperty("options")) { + if (message.options != null && Object.hasOwnProperty.call(message, "options")) { var error = $root.google.protobuf.ServiceOptions.verify(message.options, long + 1); if (error) return "options." + error; @@ -40866,6 +42044,8 @@ ServiceDescriptorProto.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.ServiceDescriptorProto) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.ServiceDescriptorProto: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -40878,13 +42058,13 @@ throw TypeError(".google.protobuf.ServiceDescriptorProto.method: array expected"); message.method = []; for (var i = 0; i < object.method.length; ++i) { - if (typeof object.method[i] !== "object") + if (!$util.isObject(object.method[i])) throw TypeError(".google.protobuf.ServiceDescriptorProto.method: object expected"); message.method[i] = $root.google.protobuf.MethodDescriptorProto.fromObject(object.method[i], long + 1); } } if (object.options != null) { - if (typeof object.options !== "object") + if (!$util.isObject(object.options)) throw TypeError(".google.protobuf.ServiceDescriptorProto.options: object expected"); message.options = $root.google.protobuf.ServiceOptions.fromObject(object.options, long + 1); } @@ -40900,9 +42080,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ServiceDescriptorProto.toObject = function toObject(message, options) { + ServiceDescriptorProto.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.method = []; @@ -40910,15 +42094,15 @@ object.name = ""; object.options = null; } - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) object.name = message.name; if (message.method && message.method.length) { object.method = []; for (var j = 0; j < message.method.length; ++j) - object.method[j] = $root.google.protobuf.MethodDescriptorProto.toObject(message.method[j], options); + object.method[j] = $root.google.protobuf.MethodDescriptorProto.toObject(message.method[j], options, q + 1); } - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.ServiceOptions.toObject(message.options, options); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + object.options = $root.google.protobuf.ServiceOptions.toObject(message.options, options, q + 1); return object; }; @@ -41049,9 +42233,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - MethodDescriptorProto.encode = function encode(message, writer) { + MethodDescriptorProto.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); if (message.inputType != null && Object.hasOwnProperty.call(message, "inputType")) @@ -41059,7 +42247,7 @@ if (message.outputType != null && Object.hasOwnProperty.call(message, "outputType")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.outputType); if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.MethodOptions.encode(message.options, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + $root.google.protobuf.MethodOptions.encode(message.options, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); if (message.clientStreaming != null && Object.hasOwnProperty.call(message, "clientStreaming")) writer.uint32(/* id 5, wireType 0 =*/40).bool(message.clientStreaming); if (message.serverStreaming != null && Object.hasOwnProperty.call(message, "serverStreaming")) @@ -41077,7 +42265,7 @@ * @returns {$protobuf.Writer} Writer */ MethodDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -41167,24 +42355,24 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) if (!$util.isString(message.name)) return "name: string expected"; - if (message.inputType != null && message.hasOwnProperty("inputType")) + if (message.inputType != null && Object.hasOwnProperty.call(message, "inputType")) if (!$util.isString(message.inputType)) return "inputType: string expected"; - if (message.outputType != null && message.hasOwnProperty("outputType")) + if (message.outputType != null && Object.hasOwnProperty.call(message, "outputType")) if (!$util.isString(message.outputType)) return "outputType: string expected"; - if (message.options != null && message.hasOwnProperty("options")) { + if (message.options != null && Object.hasOwnProperty.call(message, "options")) { var error = $root.google.protobuf.MethodOptions.verify(message.options, long + 1); if (error) return "options." + error; } - if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) + if (message.clientStreaming != null && Object.hasOwnProperty.call(message, "clientStreaming")) if (typeof message.clientStreaming !== "boolean") return "clientStreaming: boolean expected"; - if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + if (message.serverStreaming != null && Object.hasOwnProperty.call(message, "serverStreaming")) if (typeof message.serverStreaming !== "boolean") return "serverStreaming: boolean expected"; return null; @@ -41201,6 +42389,8 @@ MethodDescriptorProto.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.MethodDescriptorProto) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.MethodDescriptorProto: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -41213,7 +42403,7 @@ if (object.outputType != null) message.outputType = String(object.outputType); if (object.options != null) { - if (typeof object.options !== "object") + if (!$util.isObject(object.options)) throw TypeError(".google.protobuf.MethodDescriptorProto.options: object expected"); message.options = $root.google.protobuf.MethodOptions.fromObject(object.options, long + 1); } @@ -41233,9 +42423,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - MethodDescriptorProto.toObject = function toObject(message, options) { + MethodDescriptorProto.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.name = ""; @@ -41245,17 +42439,17 @@ object.clientStreaming = false; object.serverStreaming = false; } - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) object.name = message.name; - if (message.inputType != null && message.hasOwnProperty("inputType")) + if (message.inputType != null && Object.hasOwnProperty.call(message, "inputType")) object.inputType = message.inputType; - if (message.outputType != null && message.hasOwnProperty("outputType")) + if (message.outputType != null && Object.hasOwnProperty.call(message, "outputType")) object.outputType = message.outputType; - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.MethodOptions.toObject(message.options, options); - if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + object.options = $root.google.protobuf.MethodOptions.toObject(message.options, options, q + 1); + if (message.clientStreaming != null && Object.hasOwnProperty.call(message, "clientStreaming")) object.clientStreaming = message.clientStreaming; - if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + if (message.serverStreaming != null && Object.hasOwnProperty.call(message, "serverStreaming")) object.serverStreaming = message.serverStreaming; return object; }; @@ -41533,9 +42727,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FileOptions.encode = function encode(message, writer) { + FileOptions.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.javaPackage != null && Object.hasOwnProperty.call(message, "javaPackage")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.javaPackage); if (message.javaOuterClassname != null && Object.hasOwnProperty.call(message, "javaOuterClassname")) @@ -41575,13 +42773,13 @@ if (message.rubyPackage != null && Object.hasOwnProperty.call(message, "rubyPackage")) writer.uint32(/* id 45, wireType 2 =*/362).string(message.rubyPackage); if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 50, wireType 2 =*/402).fork()).ldelim(); + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 50, wireType 2 =*/402).fork(), q + 1).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork(), q + 1).ldelim(); if (message[".google.api.resourceDefinition"] != null && message[".google.api.resourceDefinition"].length) for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) - $root.google.api.ResourceDescriptor.encode(message[".google.api.resourceDefinition"][i], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); + $root.google.api.ResourceDescriptor.encode(message[".google.api.resourceDefinition"][i], writer.uint32(/* id 1053, wireType 2 =*/8426).fork(), q + 1).ldelim(); return writer; }; @@ -41595,7 +42793,7 @@ * @returns {$protobuf.Writer} Writer */ FileOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -41753,22 +42951,22 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) + if (message.javaPackage != null && Object.hasOwnProperty.call(message, "javaPackage")) if (!$util.isString(message.javaPackage)) return "javaPackage: string expected"; - if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + if (message.javaOuterClassname != null && Object.hasOwnProperty.call(message, "javaOuterClassname")) if (!$util.isString(message.javaOuterClassname)) return "javaOuterClassname: string expected"; - if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + if (message.javaMultipleFiles != null && Object.hasOwnProperty.call(message, "javaMultipleFiles")) if (typeof message.javaMultipleFiles !== "boolean") return "javaMultipleFiles: boolean expected"; - if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + if (message.javaGenerateEqualsAndHash != null && Object.hasOwnProperty.call(message, "javaGenerateEqualsAndHash")) if (typeof message.javaGenerateEqualsAndHash !== "boolean") return "javaGenerateEqualsAndHash: boolean expected"; - if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + if (message.javaStringCheckUtf8 != null && Object.hasOwnProperty.call(message, "javaStringCheckUtf8")) if (typeof message.javaStringCheckUtf8 !== "boolean") return "javaStringCheckUtf8: boolean expected"; - if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + if (message.optimizeFor != null && Object.hasOwnProperty.call(message, "optimizeFor")) switch (message.optimizeFor) { default: return "optimizeFor: enum value expected"; @@ -41777,51 +42975,51 @@ case 3: break; } - if (message.goPackage != null && message.hasOwnProperty("goPackage")) + if (message.goPackage != null && Object.hasOwnProperty.call(message, "goPackage")) if (!$util.isString(message.goPackage)) return "goPackage: string expected"; - if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + if (message.ccGenericServices != null && Object.hasOwnProperty.call(message, "ccGenericServices")) if (typeof message.ccGenericServices !== "boolean") return "ccGenericServices: boolean expected"; - if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + if (message.javaGenericServices != null && Object.hasOwnProperty.call(message, "javaGenericServices")) if (typeof message.javaGenericServices !== "boolean") return "javaGenericServices: boolean expected"; - if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + if (message.pyGenericServices != null && Object.hasOwnProperty.call(message, "pyGenericServices")) if (typeof message.pyGenericServices !== "boolean") return "pyGenericServices: boolean expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) if (typeof message.deprecated !== "boolean") return "deprecated: boolean expected"; - if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + if (message.ccEnableArenas != null && Object.hasOwnProperty.call(message, "ccEnableArenas")) if (typeof message.ccEnableArenas !== "boolean") return "ccEnableArenas: boolean expected"; - if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + if (message.objcClassPrefix != null && Object.hasOwnProperty.call(message, "objcClassPrefix")) if (!$util.isString(message.objcClassPrefix)) return "objcClassPrefix: string expected"; - if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + if (message.csharpNamespace != null && Object.hasOwnProperty.call(message, "csharpNamespace")) if (!$util.isString(message.csharpNamespace)) return "csharpNamespace: string expected"; - if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) + if (message.swiftPrefix != null && Object.hasOwnProperty.call(message, "swiftPrefix")) if (!$util.isString(message.swiftPrefix)) return "swiftPrefix: string expected"; - if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) + if (message.phpClassPrefix != null && Object.hasOwnProperty.call(message, "phpClassPrefix")) if (!$util.isString(message.phpClassPrefix)) return "phpClassPrefix: string expected"; - if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) + if (message.phpNamespace != null && Object.hasOwnProperty.call(message, "phpNamespace")) if (!$util.isString(message.phpNamespace)) return "phpNamespace: string expected"; - if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) + if (message.phpMetadataNamespace != null && Object.hasOwnProperty.call(message, "phpMetadataNamespace")) if (!$util.isString(message.phpMetadataNamespace)) return "phpMetadataNamespace: string expected"; - if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) + if (message.rubyPackage != null && Object.hasOwnProperty.call(message, "rubyPackage")) if (!$util.isString(message.rubyPackage)) return "rubyPackage: string expected"; - if (message.features != null && message.hasOwnProperty("features")) { + if (message.features != null && Object.hasOwnProperty.call(message, "features")) { var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); if (error) return "features." + error; } - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (message.uninterpretedOption != null && Object.hasOwnProperty.call(message, "uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; for (var i = 0; i < message.uninterpretedOption.length; ++i) { @@ -41830,7 +43028,7 @@ return "uninterpretedOption." + error; } } - if (message[".google.api.resourceDefinition"] != null && message.hasOwnProperty(".google.api.resourceDefinition")) { + if (message[".google.api.resourceDefinition"] != null && Object.hasOwnProperty.call(message, ".google.api.resourceDefinition")) { if (!Array.isArray(message[".google.api.resourceDefinition"])) return ".google.api.resourceDefinition: array expected"; for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) { @@ -41853,6 +43051,8 @@ FileOptions.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.FileOptions) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.FileOptions: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -41915,7 +43115,7 @@ if (object.rubyPackage != null) message.rubyPackage = String(object.rubyPackage); if (object.features != null) { - if (typeof object.features !== "object") + if (!$util.isObject(object.features)) throw TypeError(".google.protobuf.FileOptions.features: object expected"); message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); } @@ -41924,7 +43124,7 @@ throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: array expected"); message.uninterpretedOption = []; for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") + if (!$util.isObject(object.uninterpretedOption[i])) throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: object expected"); message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); } @@ -41934,7 +43134,7 @@ throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: array expected"); message[".google.api.resourceDefinition"] = []; for (var i = 0; i < object[".google.api.resourceDefinition"].length; ++i) { - if (typeof object[".google.api.resourceDefinition"][i] !== "object") + if (!$util.isObject(object[".google.api.resourceDefinition"][i])) throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: object expected"); message[".google.api.resourceDefinition"][i] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resourceDefinition"][i], long + 1); } @@ -41951,9 +43151,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FileOptions.toObject = function toObject(message, options) { + FileOptions.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) { object.uninterpretedOption = []; @@ -41981,55 +43185,55 @@ object.rubyPackage = ""; object.features = null; } - if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) + if (message.javaPackage != null && Object.hasOwnProperty.call(message, "javaPackage")) object.javaPackage = message.javaPackage; - if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + if (message.javaOuterClassname != null && Object.hasOwnProperty.call(message, "javaOuterClassname")) object.javaOuterClassname = message.javaOuterClassname; - if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + if (message.optimizeFor != null && Object.hasOwnProperty.call(message, "optimizeFor")) object.optimizeFor = options.enums === String ? $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] === undefined ? message.optimizeFor : $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] : message.optimizeFor; - if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + if (message.javaMultipleFiles != null && Object.hasOwnProperty.call(message, "javaMultipleFiles")) object.javaMultipleFiles = message.javaMultipleFiles; - if (message.goPackage != null && message.hasOwnProperty("goPackage")) + if (message.goPackage != null && Object.hasOwnProperty.call(message, "goPackage")) object.goPackage = message.goPackage; - if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + if (message.ccGenericServices != null && Object.hasOwnProperty.call(message, "ccGenericServices")) object.ccGenericServices = message.ccGenericServices; - if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + if (message.javaGenericServices != null && Object.hasOwnProperty.call(message, "javaGenericServices")) object.javaGenericServices = message.javaGenericServices; - if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + if (message.pyGenericServices != null && Object.hasOwnProperty.call(message, "pyGenericServices")) object.pyGenericServices = message.pyGenericServices; - if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + if (message.javaGenerateEqualsAndHash != null && Object.hasOwnProperty.call(message, "javaGenerateEqualsAndHash")) object.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) object.deprecated = message.deprecated; - if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + if (message.javaStringCheckUtf8 != null && Object.hasOwnProperty.call(message, "javaStringCheckUtf8")) object.javaStringCheckUtf8 = message.javaStringCheckUtf8; - if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + if (message.ccEnableArenas != null && Object.hasOwnProperty.call(message, "ccEnableArenas")) object.ccEnableArenas = message.ccEnableArenas; - if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + if (message.objcClassPrefix != null && Object.hasOwnProperty.call(message, "objcClassPrefix")) object.objcClassPrefix = message.objcClassPrefix; - if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + if (message.csharpNamespace != null && Object.hasOwnProperty.call(message, "csharpNamespace")) object.csharpNamespace = message.csharpNamespace; - if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) + if (message.swiftPrefix != null && Object.hasOwnProperty.call(message, "swiftPrefix")) object.swiftPrefix = message.swiftPrefix; - if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) + if (message.phpClassPrefix != null && Object.hasOwnProperty.call(message, "phpClassPrefix")) object.phpClassPrefix = message.phpClassPrefix; - if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) + if (message.phpNamespace != null && Object.hasOwnProperty.call(message, "phpNamespace")) object.phpNamespace = message.phpNamespace; - if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) + if (message.phpMetadataNamespace != null && Object.hasOwnProperty.call(message, "phpMetadataNamespace")) object.phpMetadataNamespace = message.phpMetadataNamespace; - if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) + if (message.rubyPackage != null && Object.hasOwnProperty.call(message, "rubyPackage")) object.rubyPackage = message.rubyPackage; - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options, q + 1); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options, q + 1); } if (message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length) { object[".google.api.resourceDefinition"] = []; for (var j = 0; j < message[".google.api.resourceDefinition"].length; ++j) - object[".google.api.resourceDefinition"][j] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resourceDefinition"][j], options); + object[".google.api.resourceDefinition"][j] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resourceDefinition"][j], options, q + 1); } return object; }; @@ -42196,9 +43400,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - MessageOptions.encode = function encode(message, writer) { + MessageOptions.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.messageSetWireFormat != null && Object.hasOwnProperty.call(message, "messageSetWireFormat")) writer.uint32(/* id 1, wireType 0 =*/8).bool(message.messageSetWireFormat); if (message.noStandardDescriptorAccessor != null && Object.hasOwnProperty.call(message, "noStandardDescriptorAccessor")) @@ -42210,12 +43418,12 @@ if (message.deprecatedLegacyJsonFieldConflicts != null && Object.hasOwnProperty.call(message, "deprecatedLegacyJsonFieldConflicts")) writer.uint32(/* id 11, wireType 0 =*/88).bool(message.deprecatedLegacyJsonFieldConflicts); if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 12, wireType 2 =*/98).fork(), q + 1).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork(), q + 1).ldelim(); if (message[".google.api.resource"] != null && Object.hasOwnProperty.call(message, ".google.api.resource")) - $root.google.api.ResourceDescriptor.encode(message[".google.api.resource"], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); + $root.google.api.ResourceDescriptor.encode(message[".google.api.resource"], writer.uint32(/* id 1053, wireType 2 =*/8426).fork(), q + 1).ldelim(); return writer; }; @@ -42229,7 +43437,7 @@ * @returns {$protobuf.Writer} Writer */ MessageOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -42329,27 +43537,27 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) + if (message.messageSetWireFormat != null && Object.hasOwnProperty.call(message, "messageSetWireFormat")) if (typeof message.messageSetWireFormat !== "boolean") return "messageSetWireFormat: boolean expected"; - if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + if (message.noStandardDescriptorAccessor != null && Object.hasOwnProperty.call(message, "noStandardDescriptorAccessor")) if (typeof message.noStandardDescriptorAccessor !== "boolean") return "noStandardDescriptorAccessor: boolean expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) if (typeof message.deprecated !== "boolean") return "deprecated: boolean expected"; - if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) + if (message.mapEntry != null && Object.hasOwnProperty.call(message, "mapEntry")) if (typeof message.mapEntry !== "boolean") return "mapEntry: boolean expected"; - if (message.deprecatedLegacyJsonFieldConflicts != null && message.hasOwnProperty("deprecatedLegacyJsonFieldConflicts")) + if (message.deprecatedLegacyJsonFieldConflicts != null && Object.hasOwnProperty.call(message, "deprecatedLegacyJsonFieldConflicts")) if (typeof message.deprecatedLegacyJsonFieldConflicts !== "boolean") return "deprecatedLegacyJsonFieldConflicts: boolean expected"; - if (message.features != null && message.hasOwnProperty("features")) { + if (message.features != null && Object.hasOwnProperty.call(message, "features")) { var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); if (error) return "features." + error; } - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (message.uninterpretedOption != null && Object.hasOwnProperty.call(message, "uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; for (var i = 0; i < message.uninterpretedOption.length; ++i) { @@ -42358,7 +43566,7 @@ return "uninterpretedOption." + error; } } - if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) { + if (message[".google.api.resource"] != null && Object.hasOwnProperty.call(message, ".google.api.resource")) { var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resource"], long + 1); if (error) return ".google.api.resource." + error; @@ -42377,6 +43585,8 @@ MessageOptions.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.MessageOptions) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.MessageOptions: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -42393,7 +43603,7 @@ if (object.deprecatedLegacyJsonFieldConflicts != null) message.deprecatedLegacyJsonFieldConflicts = Boolean(object.deprecatedLegacyJsonFieldConflicts); if (object.features != null) { - if (typeof object.features !== "object") + if (!$util.isObject(object.features)) throw TypeError(".google.protobuf.MessageOptions.features: object expected"); message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); } @@ -42402,13 +43612,13 @@ throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: array expected"); message.uninterpretedOption = []; for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") + if (!$util.isObject(object.uninterpretedOption[i])) throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: object expected"); message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); } } if (object[".google.api.resource"] != null) { - if (typeof object[".google.api.resource"] !== "object") + if (!$util.isObject(object[".google.api.resource"])) throw TypeError(".google.protobuf.MessageOptions..google.api.resource: object expected"); message[".google.api.resource"] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resource"], long + 1); } @@ -42424,9 +43634,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - MessageOptions.toObject = function toObject(message, options) { + MessageOptions.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.uninterpretedOption = []; @@ -42439,25 +43653,25 @@ object.features = null; object[".google.api.resource"] = null; } - if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) + if (message.messageSetWireFormat != null && Object.hasOwnProperty.call(message, "messageSetWireFormat")) object.messageSetWireFormat = message.messageSetWireFormat; - if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + if (message.noStandardDescriptorAccessor != null && Object.hasOwnProperty.call(message, "noStandardDescriptorAccessor")) object.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) object.deprecated = message.deprecated; - if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) + if (message.mapEntry != null && Object.hasOwnProperty.call(message, "mapEntry")) object.mapEntry = message.mapEntry; - if (message.deprecatedLegacyJsonFieldConflicts != null && message.hasOwnProperty("deprecatedLegacyJsonFieldConflicts")) + if (message.deprecatedLegacyJsonFieldConflicts != null && Object.hasOwnProperty.call(message, "deprecatedLegacyJsonFieldConflicts")) object.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options, q + 1); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options, q + 1); } - if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) - object[".google.api.resource"] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resource"], options); + if (message[".google.api.resource"] != null && Object.hasOwnProperty.call(message, ".google.api.resource")) + object[".google.api.resource"] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resource"], options, q + 1); return object; }; @@ -42682,9 +43896,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FieldOptions.encode = function encode(message, writer) { + FieldOptions.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.ctype != null && Object.hasOwnProperty.call(message, "ctype")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ctype); if (message.packed != null && Object.hasOwnProperty.call(message, "packed")) @@ -42708,19 +43926,19 @@ writer.uint32(/* id 19, wireType 0 =*/152).int32(message.targets[i]); if (message.editionDefaults != null && message.editionDefaults.length) for (var i = 0; i < message.editionDefaults.length; ++i) - $root.google.protobuf.FieldOptions.EditionDefault.encode(message.editionDefaults[i], writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); + $root.google.protobuf.FieldOptions.EditionDefault.encode(message.editionDefaults[i], writer.uint32(/* id 20, wireType 2 =*/162).fork(), q + 1).ldelim(); if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 21, wireType 2 =*/170).fork(), q + 1).ldelim(); if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) - $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 22, wireType 2 =*/178).fork(), q + 1).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork(), q + 1).ldelim(); if (message[".google.api.fieldBehavior"] != null && message[".google.api.fieldBehavior"].length) for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) writer.uint32(/* id 1052, wireType 0 =*/8416).int32(message[".google.api.fieldBehavior"][i]); if (message[".google.api.resourceReference"] != null && Object.hasOwnProperty.call(message, ".google.api.resourceReference")) - $root.google.api.ResourceReference.encode(message[".google.api.resourceReference"], writer.uint32(/* id 1055, wireType 2 =*/8442).fork()).ldelim(); + $root.google.api.ResourceReference.encode(message[".google.api.resourceReference"], writer.uint32(/* id 1055, wireType 2 =*/8442).fork(), q + 1).ldelim(); return writer; }; @@ -42734,7 +43952,7 @@ * @returns {$protobuf.Writer} Writer */ FieldOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -42882,7 +44100,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.ctype != null && message.hasOwnProperty("ctype")) + if (message.ctype != null && Object.hasOwnProperty.call(message, "ctype")) switch (message.ctype) { default: return "ctype: enum value expected"; @@ -42891,10 +44109,10 @@ case 2: break; } - if (message.packed != null && message.hasOwnProperty("packed")) + if (message.packed != null && Object.hasOwnProperty.call(message, "packed")) if (typeof message.packed !== "boolean") return "packed: boolean expected"; - if (message.jstype != null && message.hasOwnProperty("jstype")) + if (message.jstype != null && Object.hasOwnProperty.call(message, "jstype")) switch (message.jstype) { default: return "jstype: enum value expected"; @@ -42903,22 +44121,22 @@ case 2: break; } - if (message.lazy != null && message.hasOwnProperty("lazy")) + if (message.lazy != null && Object.hasOwnProperty.call(message, "lazy")) if (typeof message.lazy !== "boolean") return "lazy: boolean expected"; - if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) + if (message.unverifiedLazy != null && Object.hasOwnProperty.call(message, "unverifiedLazy")) if (typeof message.unverifiedLazy !== "boolean") return "unverifiedLazy: boolean expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) if (typeof message.deprecated !== "boolean") return "deprecated: boolean expected"; - if (message.weak != null && message.hasOwnProperty("weak")) + if (message.weak != null && Object.hasOwnProperty.call(message, "weak")) if (typeof message.weak !== "boolean") return "weak: boolean expected"; - if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) + if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) if (typeof message.debugRedact !== "boolean") return "debugRedact: boolean expected"; - if (message.retention != null && message.hasOwnProperty("retention")) + if (message.retention != null && Object.hasOwnProperty.call(message, "retention")) switch (message.retention) { default: return "retention: enum value expected"; @@ -42927,7 +44145,7 @@ case 2: break; } - if (message.targets != null && message.hasOwnProperty("targets")) { + if (message.targets != null && Object.hasOwnProperty.call(message, "targets")) { if (!Array.isArray(message.targets)) return "targets: array expected"; for (var i = 0; i < message.targets.length; ++i) @@ -42947,7 +44165,7 @@ break; } } - if (message.editionDefaults != null && message.hasOwnProperty("editionDefaults")) { + if (message.editionDefaults != null && Object.hasOwnProperty.call(message, "editionDefaults")) { if (!Array.isArray(message.editionDefaults)) return "editionDefaults: array expected"; for (var i = 0; i < message.editionDefaults.length; ++i) { @@ -42956,17 +44174,17 @@ return "editionDefaults." + error; } } - if (message.features != null && message.hasOwnProperty("features")) { + if (message.features != null && Object.hasOwnProperty.call(message, "features")) { var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); if (error) return "features." + error; } - if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) { var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport, long + 1); if (error) return "featureSupport." + error; } - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (message.uninterpretedOption != null && Object.hasOwnProperty.call(message, "uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; for (var i = 0; i < message.uninterpretedOption.length; ++i) { @@ -42975,7 +44193,7 @@ return "uninterpretedOption." + error; } } - if (message[".google.api.fieldBehavior"] != null && message.hasOwnProperty(".google.api.fieldBehavior")) { + if (message[".google.api.fieldBehavior"] != null && Object.hasOwnProperty.call(message, ".google.api.fieldBehavior")) { if (!Array.isArray(message[".google.api.fieldBehavior"])) return ".google.api.fieldBehavior: array expected"; for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) @@ -42994,7 +44212,7 @@ break; } } - if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) { + if (message[".google.api.resourceReference"] != null && Object.hasOwnProperty.call(message, ".google.api.resourceReference")) { var error = $root.google.api.ResourceReference.verify(message[".google.api.resourceReference"], long + 1); if (error) return ".google.api.resourceReference." + error; @@ -43013,6 +44231,8 @@ FieldOptions.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.FieldOptions) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.FieldOptions: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -43148,18 +44368,18 @@ throw TypeError(".google.protobuf.FieldOptions.editionDefaults: array expected"); message.editionDefaults = []; for (var i = 0; i < object.editionDefaults.length; ++i) { - if (typeof object.editionDefaults[i] !== "object") + if (!$util.isObject(object.editionDefaults[i])) throw TypeError(".google.protobuf.FieldOptions.editionDefaults: object expected"); message.editionDefaults[i] = $root.google.protobuf.FieldOptions.EditionDefault.fromObject(object.editionDefaults[i], long + 1); } } if (object.features != null) { - if (typeof object.features !== "object") + if (!$util.isObject(object.features)) throw TypeError(".google.protobuf.FieldOptions.features: object expected"); message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); } if (object.featureSupport != null) { - if (typeof object.featureSupport !== "object") + if (!$util.isObject(object.featureSupport)) throw TypeError(".google.protobuf.FieldOptions.featureSupport: object expected"); message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport, long + 1); } @@ -43168,7 +44388,7 @@ throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: array expected"); message.uninterpretedOption = []; for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") + if (!$util.isObject(object.uninterpretedOption[i])) throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: object expected"); message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); } @@ -43223,7 +44443,7 @@ } } if (object[".google.api.resourceReference"] != null) { - if (typeof object[".google.api.resourceReference"] !== "object") + if (!$util.isObject(object[".google.api.resourceReference"])) throw TypeError(".google.protobuf.FieldOptions..google.api.resourceReference: object expected"); message[".google.api.resourceReference"] = $root.google.api.ResourceReference.fromObject(object[".google.api.resourceReference"], long + 1); } @@ -43239,9 +44459,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FieldOptions.toObject = function toObject(message, options) { + FieldOptions.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) { object.targets = []; @@ -43263,23 +44487,23 @@ object.featureSupport = null; object[".google.api.resourceReference"] = null; } - if (message.ctype != null && message.hasOwnProperty("ctype")) + if (message.ctype != null && Object.hasOwnProperty.call(message, "ctype")) object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] === undefined ? message.ctype : $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; - if (message.packed != null && message.hasOwnProperty("packed")) + if (message.packed != null && Object.hasOwnProperty.call(message, "packed")) object.packed = message.packed; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) object.deprecated = message.deprecated; - if (message.lazy != null && message.hasOwnProperty("lazy")) + if (message.lazy != null && Object.hasOwnProperty.call(message, "lazy")) object.lazy = message.lazy; - if (message.jstype != null && message.hasOwnProperty("jstype")) + if (message.jstype != null && Object.hasOwnProperty.call(message, "jstype")) object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] === undefined ? message.jstype : $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; - if (message.weak != null && message.hasOwnProperty("weak")) + if (message.weak != null && Object.hasOwnProperty.call(message, "weak")) object.weak = message.weak; - if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) + if (message.unverifiedLazy != null && Object.hasOwnProperty.call(message, "unverifiedLazy")) object.unverifiedLazy = message.unverifiedLazy; - if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) + if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) object.debugRedact = message.debugRedact; - if (message.retention != null && message.hasOwnProperty("retention")) + if (message.retention != null && Object.hasOwnProperty.call(message, "retention")) object.retention = options.enums === String ? $root.google.protobuf.FieldOptions.OptionRetention[message.retention] === undefined ? message.retention : $root.google.protobuf.FieldOptions.OptionRetention[message.retention] : message.retention; if (message.targets && message.targets.length) { object.targets = []; @@ -43289,24 +44513,24 @@ if (message.editionDefaults && message.editionDefaults.length) { object.editionDefaults = []; for (var j = 0; j < message.editionDefaults.length; ++j) - object.editionDefaults[j] = $root.google.protobuf.FieldOptions.EditionDefault.toObject(message.editionDefaults[j], options); + object.editionDefaults[j] = $root.google.protobuf.FieldOptions.EditionDefault.toObject(message.editionDefaults[j], options, q + 1); } - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); - if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) - object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options, q + 1); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options, q + 1); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options, q + 1); } if (message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length) { object[".google.api.fieldBehavior"] = []; for (var j = 0; j < message[".google.api.fieldBehavior"].length; ++j) object[".google.api.fieldBehavior"][j] = options.enums === String ? $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] === undefined ? message[".google.api.fieldBehavior"][j] : $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] : message[".google.api.fieldBehavior"][j]; } - if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) - object[".google.api.resourceReference"] = $root.google.api.ResourceReference.toObject(message[".google.api.resourceReference"], options); + if (message[".google.api.resourceReference"] != null && Object.hasOwnProperty.call(message, ".google.api.resourceReference")) + object[".google.api.resourceReference"] = $root.google.api.ResourceReference.toObject(message[".google.api.resourceReference"], options, q + 1); return object; }; @@ -43476,9 +44700,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EditionDefault.encode = function encode(message, writer) { + EditionDefault.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.value != null && Object.hasOwnProperty.call(message, "value")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) @@ -43496,7 +44724,7 @@ * @returns {$protobuf.Writer} Writer */ EditionDefault.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -43570,7 +44798,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.edition != null && message.hasOwnProperty("edition")) + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) switch (message.edition) { default: return "edition: enum value expected"; @@ -43588,7 +44816,7 @@ case 2147483647: break; } - if (message.value != null && message.hasOwnProperty("value")) + if (message.value != null && Object.hasOwnProperty.call(message, "value")) if (!$util.isString(message.value)) return "value: string expected"; return null; @@ -43605,6 +44833,8 @@ EditionDefault.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.FieldOptions.EditionDefault) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.FieldOptions.EditionDefault: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -43680,17 +44910,21 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EditionDefault.toObject = function toObject(message, options) { + EditionDefault.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.value = ""; object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; } - if (message.value != null && message.hasOwnProperty("value")) + if (message.value != null && Object.hasOwnProperty.call(message, "value")) object.value = message.value; - if (message.edition != null && message.hasOwnProperty("edition")) + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; return object; }; @@ -43804,9 +45038,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FeatureSupport.encode = function encode(message, writer) { + FeatureSupport.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.editionIntroduced != null && Object.hasOwnProperty.call(message, "editionIntroduced")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.editionIntroduced); if (message.editionDeprecated != null && Object.hasOwnProperty.call(message, "editionDeprecated")) @@ -43828,7 +45066,7 @@ * @returns {$protobuf.Writer} Writer */ FeatureSupport.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -43910,7 +45148,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + if (message.editionIntroduced != null && Object.hasOwnProperty.call(message, "editionIntroduced")) switch (message.editionIntroduced) { default: return "editionIntroduced: enum value expected"; @@ -43928,7 +45166,7 @@ case 2147483647: break; } - if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + if (message.editionDeprecated != null && Object.hasOwnProperty.call(message, "editionDeprecated")) switch (message.editionDeprecated) { default: return "editionDeprecated: enum value expected"; @@ -43946,10 +45184,10 @@ case 2147483647: break; } - if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + if (message.deprecationWarning != null && Object.hasOwnProperty.call(message, "deprecationWarning")) if (!$util.isString(message.deprecationWarning)) return "deprecationWarning: string expected"; - if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + if (message.editionRemoved != null && Object.hasOwnProperty.call(message, "editionRemoved")) switch (message.editionRemoved) { default: return "editionRemoved: enum value expected"; @@ -43981,6 +45219,8 @@ FeatureSupport.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.FieldOptions.FeatureSupport) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.FieldOptions.FeatureSupport: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -44168,9 +45408,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FeatureSupport.toObject = function toObject(message, options) { + FeatureSupport.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.editionIntroduced = options.enums === String ? "EDITION_UNKNOWN" : 0; @@ -44178,13 +45422,13 @@ object.deprecationWarning = ""; object.editionRemoved = options.enums === String ? "EDITION_UNKNOWN" : 0; } - if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + if (message.editionIntroduced != null && Object.hasOwnProperty.call(message, "editionIntroduced")) object.editionIntroduced = options.enums === String ? $root.google.protobuf.Edition[message.editionIntroduced] === undefined ? message.editionIntroduced : $root.google.protobuf.Edition[message.editionIntroduced] : message.editionIntroduced; - if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + if (message.editionDeprecated != null && Object.hasOwnProperty.call(message, "editionDeprecated")) object.editionDeprecated = options.enums === String ? $root.google.protobuf.Edition[message.editionDeprecated] === undefined ? message.editionDeprecated : $root.google.protobuf.Edition[message.editionDeprecated] : message.editionDeprecated; - if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + if (message.deprecationWarning != null && Object.hasOwnProperty.call(message, "deprecationWarning")) object.deprecationWarning = message.deprecationWarning; - if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + if (message.editionRemoved != null && Object.hasOwnProperty.call(message, "editionRemoved")) object.editionRemoved = options.enums === String ? $root.google.protobuf.Edition[message.editionRemoved] === undefined ? message.editionRemoved : $root.google.protobuf.Edition[message.editionRemoved] : message.editionRemoved; return object; }; @@ -44284,14 +45528,18 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OneofOptions.encode = function encode(message, writer) { + OneofOptions.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork(), q + 1).ldelim(); return writer; }; @@ -44305,7 +45553,7 @@ * @returns {$protobuf.Writer} Writer */ OneofOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -44381,12 +45629,12 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.features != null && message.hasOwnProperty("features")) { + if (message.features != null && Object.hasOwnProperty.call(message, "features")) { var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); if (error) return "features." + error; } - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (message.uninterpretedOption != null && Object.hasOwnProperty.call(message, "uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; for (var i = 0; i < message.uninterpretedOption.length; ++i) { @@ -44409,13 +45657,15 @@ OneofOptions.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.OneofOptions) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.OneofOptions: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.OneofOptions(); if (object.features != null) { - if (typeof object.features !== "object") + if (!$util.isObject(object.features)) throw TypeError(".google.protobuf.OneofOptions.features: object expected"); message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); } @@ -44424,7 +45674,7 @@ throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: array expected"); message.uninterpretedOption = []; for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") + if (!$util.isObject(object.uninterpretedOption[i])) throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: object expected"); message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); } @@ -44441,20 +45691,24 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - OneofOptions.toObject = function toObject(message, options) { + OneofOptions.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.uninterpretedOption = []; if (options.defaults) object.features = null; - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options, q + 1); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options, q + 1); } return object; }; @@ -44578,9 +45832,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EnumOptions.encode = function encode(message, writer) { + EnumOptions.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.allowAlias != null && Object.hasOwnProperty.call(message, "allowAlias")) writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowAlias); if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) @@ -44588,10 +45846,10 @@ if (message.deprecatedLegacyJsonFieldConflicts != null && Object.hasOwnProperty.call(message, "deprecatedLegacyJsonFieldConflicts")) writer.uint32(/* id 6, wireType 0 =*/48).bool(message.deprecatedLegacyJsonFieldConflicts); if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork(), q + 1).ldelim(); return writer; }; @@ -44605,7 +45863,7 @@ * @returns {$protobuf.Writer} Writer */ EnumOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -44693,21 +45951,21 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + if (message.allowAlias != null && Object.hasOwnProperty.call(message, "allowAlias")) if (typeof message.allowAlias !== "boolean") return "allowAlias: boolean expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) if (typeof message.deprecated !== "boolean") return "deprecated: boolean expected"; - if (message.deprecatedLegacyJsonFieldConflicts != null && message.hasOwnProperty("deprecatedLegacyJsonFieldConflicts")) + if (message.deprecatedLegacyJsonFieldConflicts != null && Object.hasOwnProperty.call(message, "deprecatedLegacyJsonFieldConflicts")) if (typeof message.deprecatedLegacyJsonFieldConflicts !== "boolean") return "deprecatedLegacyJsonFieldConflicts: boolean expected"; - if (message.features != null && message.hasOwnProperty("features")) { + if (message.features != null && Object.hasOwnProperty.call(message, "features")) { var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); if (error) return "features." + error; } - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (message.uninterpretedOption != null && Object.hasOwnProperty.call(message, "uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; for (var i = 0; i < message.uninterpretedOption.length; ++i) { @@ -44730,6 +45988,8 @@ EnumOptions.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.EnumOptions) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.EnumOptions: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -44742,7 +46002,7 @@ if (object.deprecatedLegacyJsonFieldConflicts != null) message.deprecatedLegacyJsonFieldConflicts = Boolean(object.deprecatedLegacyJsonFieldConflicts); if (object.features != null) { - if (typeof object.features !== "object") + if (!$util.isObject(object.features)) throw TypeError(".google.protobuf.EnumOptions.features: object expected"); message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); } @@ -44751,7 +46011,7 @@ throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: array expected"); message.uninterpretedOption = []; for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") + if (!$util.isObject(object.uninterpretedOption[i])) throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: object expected"); message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); } @@ -44768,9 +46028,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EnumOptions.toObject = function toObject(message, options) { + EnumOptions.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.uninterpretedOption = []; @@ -44780,18 +46044,18 @@ object.deprecatedLegacyJsonFieldConflicts = false; object.features = null; } - if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + if (message.allowAlias != null && Object.hasOwnProperty.call(message, "allowAlias")) object.allowAlias = message.allowAlias; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) object.deprecated = message.deprecated; - if (message.deprecatedLegacyJsonFieldConflicts != null && message.hasOwnProperty("deprecatedLegacyJsonFieldConflicts")) + if (message.deprecatedLegacyJsonFieldConflicts != null && Object.hasOwnProperty.call(message, "deprecatedLegacyJsonFieldConflicts")) object.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options, q + 1); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options, q + 1); } return object; }; @@ -44915,20 +46179,24 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EnumValueOptions.encode = function encode(message, writer) { + EnumValueOptions.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) writer.uint32(/* id 1, wireType 0 =*/8).bool(message.deprecated); if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) writer.uint32(/* id 3, wireType 0 =*/24).bool(message.debugRedact); if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) - $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork(), q + 1).ldelim(); return writer; }; @@ -44942,7 +46210,7 @@ * @returns {$protobuf.Writer} Writer */ EnumValueOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -45030,23 +46298,23 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) if (typeof message.deprecated !== "boolean") return "deprecated: boolean expected"; - if (message.features != null && message.hasOwnProperty("features")) { + if (message.features != null && Object.hasOwnProperty.call(message, "features")) { var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); if (error) return "features." + error; } - if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) + if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) if (typeof message.debugRedact !== "boolean") return "debugRedact: boolean expected"; - if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) { var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport, long + 1); if (error) return "featureSupport." + error; } - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (message.uninterpretedOption != null && Object.hasOwnProperty.call(message, "uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; for (var i = 0; i < message.uninterpretedOption.length; ++i) { @@ -45069,6 +46337,8 @@ EnumValueOptions.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.EnumValueOptions) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.EnumValueOptions: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -45077,14 +46347,14 @@ if (object.deprecated != null) message.deprecated = Boolean(object.deprecated); if (object.features != null) { - if (typeof object.features !== "object") + if (!$util.isObject(object.features)) throw TypeError(".google.protobuf.EnumValueOptions.features: object expected"); message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); } if (object.debugRedact != null) message.debugRedact = Boolean(object.debugRedact); if (object.featureSupport != null) { - if (typeof object.featureSupport !== "object") + if (!$util.isObject(object.featureSupport)) throw TypeError(".google.protobuf.EnumValueOptions.featureSupport: object expected"); message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport, long + 1); } @@ -45093,7 +46363,7 @@ throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: array expected"); message.uninterpretedOption = []; for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") + if (!$util.isObject(object.uninterpretedOption[i])) throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: object expected"); message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); } @@ -45110,9 +46380,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EnumValueOptions.toObject = function toObject(message, options) { + EnumValueOptions.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.uninterpretedOption = []; @@ -45122,18 +46396,18 @@ object.debugRedact = false; object.featureSupport = null; } - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) object.deprecated = message.deprecated; - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); - if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options, q + 1); + if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) object.debugRedact = message.debugRedact; - if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) - object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options, q + 1); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options, q + 1); } return object; }; @@ -45266,16 +46540,20 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ServiceOptions.encode = function encode(message, writer) { + ServiceOptions.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 34, wireType 2 =*/274).fork()).ldelim(); + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 34, wireType 2 =*/274).fork(), q + 1).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork(), q + 1).ldelim(); if (message[".google.api.defaultHost"] != null && Object.hasOwnProperty.call(message, ".google.api.defaultHost")) writer.uint32(/* id 1049, wireType 2 =*/8394).string(message[".google.api.defaultHost"]); if (message[".google.api.oauthScopes"] != null && Object.hasOwnProperty.call(message, ".google.api.oauthScopes")) @@ -45295,7 +46573,7 @@ * @returns {$protobuf.Writer} Writer */ ServiceOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -45387,15 +46665,15 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.features != null && message.hasOwnProperty("features")) { + if (message.features != null && Object.hasOwnProperty.call(message, "features")) { var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); if (error) return "features." + error; } - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) if (typeof message.deprecated !== "boolean") return "deprecated: boolean expected"; - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (message.uninterpretedOption != null && Object.hasOwnProperty.call(message, "uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; for (var i = 0; i < message.uninterpretedOption.length; ++i) { @@ -45404,13 +46682,13 @@ return "uninterpretedOption." + error; } } - if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) + if (message[".google.api.defaultHost"] != null && Object.hasOwnProperty.call(message, ".google.api.defaultHost")) if (!$util.isString(message[".google.api.defaultHost"])) return ".google.api.defaultHost: string expected"; - if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) + if (message[".google.api.oauthScopes"] != null && Object.hasOwnProperty.call(message, ".google.api.oauthScopes")) if (!$util.isString(message[".google.api.oauthScopes"])) return ".google.api.oauthScopes: string expected"; - if (message[".google.api.apiVersion"] != null && message.hasOwnProperty(".google.api.apiVersion")) + if (message[".google.api.apiVersion"] != null && Object.hasOwnProperty.call(message, ".google.api.apiVersion")) if (!$util.isString(message[".google.api.apiVersion"])) return ".google.api.apiVersion: string expected"; return null; @@ -45427,13 +46705,15 @@ ServiceOptions.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.ServiceOptions) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.ServiceOptions: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.ServiceOptions(); if (object.features != null) { - if (typeof object.features !== "object") + if (!$util.isObject(object.features)) throw TypeError(".google.protobuf.ServiceOptions.features: object expected"); message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); } @@ -45444,7 +46724,7 @@ throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: array expected"); message.uninterpretedOption = []; for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") + if (!$util.isObject(object.uninterpretedOption[i])) throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: object expected"); message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); } @@ -45467,9 +46747,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ServiceOptions.toObject = function toObject(message, options) { + ServiceOptions.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.uninterpretedOption = []; @@ -45480,20 +46764,20 @@ object[".google.api.oauthScopes"] = ""; object[".google.api.apiVersion"] = ""; } - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) object.deprecated = message.deprecated; - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options, q + 1); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options, q + 1); } - if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) + if (message[".google.api.defaultHost"] != null && Object.hasOwnProperty.call(message, ".google.api.defaultHost")) object[".google.api.defaultHost"] = message[".google.api.defaultHost"]; - if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) + if (message[".google.api.oauthScopes"] != null && Object.hasOwnProperty.call(message, ".google.api.oauthScopes")) object[".google.api.oauthScopes"] = message[".google.api.oauthScopes"]; - if (message[".google.api.apiVersion"] != null && message.hasOwnProperty(".google.api.apiVersion")) + if (message[".google.api.apiVersion"] != null && Object.hasOwnProperty.call(message, ".google.api.apiVersion")) object[".google.api.apiVersion"] = message[".google.api.apiVersion"]; return object; }; @@ -45627,23 +46911,27 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - MethodOptions.encode = function encode(message, writer) { + MethodOptions.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); if (message.idempotencyLevel != null && Object.hasOwnProperty.call(message, "idempotencyLevel")) writer.uint32(/* id 34, wireType 0 =*/272).int32(message.idempotencyLevel); if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 35, wireType 2 =*/282).fork()).ldelim(); + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 35, wireType 2 =*/282).fork(), q + 1).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork(), q + 1).ldelim(); if (message[".google.api.methodSignature"] != null && message[".google.api.methodSignature"].length) for (var i = 0; i < message[".google.api.methodSignature"].length; ++i) writer.uint32(/* id 1051, wireType 2 =*/8410).string(message[".google.api.methodSignature"][i]); if (message[".google.api.http"] != null && Object.hasOwnProperty.call(message, ".google.api.http")) - $root.google.api.HttpRule.encode(message[".google.api.http"], writer.uint32(/* id 72295728, wireType 2 =*/578365826).fork()).ldelim(); + $root.google.api.HttpRule.encode(message[".google.api.http"], writer.uint32(/* id 72295728, wireType 2 =*/578365826).fork(), q + 1).ldelim(); return writer; }; @@ -45657,7 +46945,7 @@ * @returns {$protobuf.Writer} Writer */ MethodOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -45751,10 +47039,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) if (typeof message.deprecated !== "boolean") return "deprecated: boolean expected"; - if (message.idempotencyLevel != null && message.hasOwnProperty("idempotencyLevel")) + if (message.idempotencyLevel != null && Object.hasOwnProperty.call(message, "idempotencyLevel")) switch (message.idempotencyLevel) { default: return "idempotencyLevel: enum value expected"; @@ -45763,12 +47051,12 @@ case 2: break; } - if (message.features != null && message.hasOwnProperty("features")) { + if (message.features != null && Object.hasOwnProperty.call(message, "features")) { var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); if (error) return "features." + error; } - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (message.uninterpretedOption != null && Object.hasOwnProperty.call(message, "uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; for (var i = 0; i < message.uninterpretedOption.length; ++i) { @@ -45777,12 +47065,12 @@ return "uninterpretedOption." + error; } } - if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) { + if (message[".google.api.http"] != null && Object.hasOwnProperty.call(message, ".google.api.http")) { var error = $root.google.api.HttpRule.verify(message[".google.api.http"], long + 1); if (error) return ".google.api.http." + error; } - if (message[".google.api.methodSignature"] != null && message.hasOwnProperty(".google.api.methodSignature")) { + if (message[".google.api.methodSignature"] != null && Object.hasOwnProperty.call(message, ".google.api.methodSignature")) { if (!Array.isArray(message[".google.api.methodSignature"])) return ".google.api.methodSignature: array expected"; for (var i = 0; i < message[".google.api.methodSignature"].length; ++i) @@ -45803,6 +47091,8 @@ MethodOptions.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.MethodOptions) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.MethodOptions: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -45831,7 +47121,7 @@ break; } if (object.features != null) { - if (typeof object.features !== "object") + if (!$util.isObject(object.features)) throw TypeError(".google.protobuf.MethodOptions.features: object expected"); message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); } @@ -45840,13 +47130,13 @@ throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: array expected"); message.uninterpretedOption = []; for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") + if (!$util.isObject(object.uninterpretedOption[i])) throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: object expected"); message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); } } if (object[".google.api.http"] != null) { - if (typeof object[".google.api.http"] !== "object") + if (!$util.isObject(object[".google.api.http"])) throw TypeError(".google.protobuf.MethodOptions..google.api.http: object expected"); message[".google.api.http"] = $root.google.api.HttpRule.fromObject(object[".google.api.http"], long + 1); } @@ -45869,9 +47159,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - MethodOptions.toObject = function toObject(message, options) { + MethodOptions.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) { object.uninterpretedOption = []; @@ -45883,24 +47177,24 @@ object.features = null; object[".google.api.http"] = null; } - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) object.deprecated = message.deprecated; - if (message.idempotencyLevel != null && message.hasOwnProperty("idempotencyLevel")) + if (message.idempotencyLevel != null && Object.hasOwnProperty.call(message, "idempotencyLevel")) object.idempotencyLevel = options.enums === String ? $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] === undefined ? message.idempotencyLevel : $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] : message.idempotencyLevel; - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options, q + 1); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options, q + 1); } if (message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length) { object[".google.api.methodSignature"] = []; for (var j = 0; j < message[".google.api.methodSignature"].length; ++j) object[".google.api.methodSignature"][j] = message[".google.api.methodSignature"][j]; } - if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) - object[".google.api.http"] = $root.google.api.HttpRule.toObject(message[".google.api.http"], options); + if (message[".google.api.http"] != null && Object.hasOwnProperty.call(message, ".google.api.http")) + object[".google.api.http"] = $root.google.api.HttpRule.toObject(message[".google.api.http"], options, q + 1); return object; }; @@ -46057,12 +47351,16 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UninterpretedOption.encode = function encode(message, writer) { + UninterpretedOption.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.name != null && message.name.length) for (var i = 0; i < message.name.length; ++i) - $root.google.protobuf.UninterpretedOption.NamePart.encode(message.name[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.protobuf.UninterpretedOption.NamePart.encode(message.name[i], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim(); if (message.identifierValue != null && Object.hasOwnProperty.call(message, "identifierValue")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.identifierValue); if (message.positiveIntValue != null && Object.hasOwnProperty.call(message, "positiveIntValue")) @@ -46088,7 +47386,7 @@ * @returns {$protobuf.Writer} Writer */ UninterpretedOption.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -46184,7 +47482,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.name != null && message.hasOwnProperty("name")) { + if (message.name != null && Object.hasOwnProperty.call(message, "name")) { if (!Array.isArray(message.name)) return "name: array expected"; for (var i = 0; i < message.name.length; ++i) { @@ -46193,22 +47491,22 @@ return "name." + error; } } - if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) + if (message.identifierValue != null && Object.hasOwnProperty.call(message, "identifierValue")) if (!$util.isString(message.identifierValue)) return "identifierValue: string expected"; - if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) + if (message.positiveIntValue != null && Object.hasOwnProperty.call(message, "positiveIntValue")) if (!$util.isInteger(message.positiveIntValue) && !(message.positiveIntValue && $util.isInteger(message.positiveIntValue.low) && $util.isInteger(message.positiveIntValue.high))) return "positiveIntValue: integer|Long expected"; - if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) + if (message.negativeIntValue != null && Object.hasOwnProperty.call(message, "negativeIntValue")) if (!$util.isInteger(message.negativeIntValue) && !(message.negativeIntValue && $util.isInteger(message.negativeIntValue.low) && $util.isInteger(message.negativeIntValue.high))) return "negativeIntValue: integer|Long expected"; - if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) + if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue")) if (typeof message.doubleValue !== "number") return "doubleValue: number expected"; - if (message.stringValue != null && message.hasOwnProperty("stringValue")) + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) if (!(message.stringValue && typeof message.stringValue.length === "number" || $util.isString(message.stringValue))) return "stringValue: buffer expected"; - if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) + if (message.aggregateValue != null && Object.hasOwnProperty.call(message, "aggregateValue")) if (!$util.isString(message.aggregateValue)) return "aggregateValue: string expected"; return null; @@ -46225,6 +47523,8 @@ UninterpretedOption.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.UninterpretedOption) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.UninterpretedOption: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -46235,7 +47535,7 @@ throw TypeError(".google.protobuf.UninterpretedOption.name: array expected"); message.name = []; for (var i = 0; i < object.name.length; ++i) { - if (typeof object.name[i] !== "object") + if (!$util.isObject(object.name[i])) throw TypeError(".google.protobuf.UninterpretedOption.name: object expected"); message.name[i] = $root.google.protobuf.UninterpretedOption.NamePart.fromObject(object.name[i], long + 1); } @@ -46244,7 +47544,7 @@ message.identifierValue = String(object.identifierValue); if (object.positiveIntValue != null) if ($util.Long) - (message.positiveIntValue = $util.Long.fromValue(object.positiveIntValue)).unsigned = true; + message.positiveIntValue = $util.Long.fromValue(object.positiveIntValue, true); else if (typeof object.positiveIntValue === "string") message.positiveIntValue = parseInt(object.positiveIntValue, 10); else if (typeof object.positiveIntValue === "number") @@ -46253,7 +47553,7 @@ message.positiveIntValue = new $util.LongBits(object.positiveIntValue.low >>> 0, object.positiveIntValue.high >>> 0).toNumber(true); if (object.negativeIntValue != null) if ($util.Long) - (message.negativeIntValue = $util.Long.fromValue(object.negativeIntValue)).unsigned = false; + message.negativeIntValue = $util.Long.fromValue(object.negativeIntValue, false); else if (typeof object.negativeIntValue === "string") message.negativeIntValue = parseInt(object.negativeIntValue, 10); else if (typeof object.negativeIntValue === "number") @@ -46281,9 +47581,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UninterpretedOption.toObject = function toObject(message, options) { + UninterpretedOption.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.name = []; @@ -46291,14 +47595,14 @@ object.identifierValue = ""; if ($util.Long) { var long = new $util.Long(0, 0, true); - object.positiveIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + object.positiveIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; } else - object.positiveIntValue = options.longs === String ? "0" : 0; + object.positiveIntValue = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; if ($util.Long) { var long = new $util.Long(0, 0, false); - object.negativeIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + object.negativeIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; } else - object.negativeIntValue = options.longs === String ? "0" : 0; + object.negativeIntValue = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; object.doubleValue = 0; if (options.bytes === String) object.stringValue = ""; @@ -46312,25 +47616,29 @@ if (message.name && message.name.length) { object.name = []; for (var j = 0; j < message.name.length; ++j) - object.name[j] = $root.google.protobuf.UninterpretedOption.NamePart.toObject(message.name[j], options); + object.name[j] = $root.google.protobuf.UninterpretedOption.NamePart.toObject(message.name[j], options, q + 1); } - if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) + if (message.identifierValue != null && Object.hasOwnProperty.call(message, "identifierValue")) object.identifierValue = message.identifierValue; - if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) - if (typeof message.positiveIntValue === "number") + if (message.positiveIntValue != null && Object.hasOwnProperty.call(message, "positiveIntValue")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.positiveIntValue = typeof message.positiveIntValue === "number" ? BigInt(message.positiveIntValue) : $util.Long.fromBits(message.positiveIntValue.low >>> 0, message.positiveIntValue.high >>> 0, true).toBigInt(); + else if (typeof message.positiveIntValue === "number") object.positiveIntValue = options.longs === String ? String(message.positiveIntValue) : message.positiveIntValue; else object.positiveIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.positiveIntValue) : options.longs === Number ? new $util.LongBits(message.positiveIntValue.low >>> 0, message.positiveIntValue.high >>> 0).toNumber(true) : message.positiveIntValue; - if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) - if (typeof message.negativeIntValue === "number") + if (message.negativeIntValue != null && Object.hasOwnProperty.call(message, "negativeIntValue")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.negativeIntValue = typeof message.negativeIntValue === "number" ? BigInt(message.negativeIntValue) : $util.Long.fromBits(message.negativeIntValue.low >>> 0, message.negativeIntValue.high >>> 0, false).toBigInt(); + else if (typeof message.negativeIntValue === "number") object.negativeIntValue = options.longs === String ? String(message.negativeIntValue) : message.negativeIntValue; else object.negativeIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.negativeIntValue) : options.longs === Number ? new $util.LongBits(message.negativeIntValue.low >>> 0, message.negativeIntValue.high >>> 0).toNumber() : message.negativeIntValue; - if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) + if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue")) object.doubleValue = options.json && !isFinite(message.doubleValue) ? String(message.doubleValue) : message.doubleValue; - if (message.stringValue != null && message.hasOwnProperty("stringValue")) + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) object.stringValue = options.bytes === String ? $util.base64.encode(message.stringValue, 0, message.stringValue.length) : options.bytes === Array ? Array.prototype.slice.call(message.stringValue) : message.stringValue; - if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) + if (message.aggregateValue != null && Object.hasOwnProperty.call(message, "aggregateValue")) object.aggregateValue = message.aggregateValue; return object; }; @@ -46423,9 +47731,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - NamePart.encode = function encode(message, writer) { + NamePart.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); writer.uint32(/* id 1, wireType 2 =*/10).string(message.namePart); writer.uint32(/* id 2, wireType 0 =*/16).bool(message.isExtension); return writer; @@ -46441,7 +47753,7 @@ * @returns {$protobuf.Writer} Writer */ NamePart.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -46481,9 +47793,9 @@ break; } } - if (!message.hasOwnProperty("namePart")) + if (!Object.hasOwnProperty.call(message, "namePart")) throw $util.ProtocolError("missing required 'namePart'", { instance: message }); - if (!message.hasOwnProperty("isExtension")) + if (!Object.hasOwnProperty.call(message, "isExtension")) throw $util.ProtocolError("missing required 'isExtension'", { instance: message }); return message; }; @@ -46537,6 +47849,8 @@ NamePart.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.UninterpretedOption.NamePart) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.UninterpretedOption.NamePart: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -46558,17 +47872,21 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - NamePart.toObject = function toObject(message, options) { + NamePart.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.namePart = ""; object.isExtension = false; } - if (message.namePart != null && message.hasOwnProperty("namePart")) + if (message.namePart != null && Object.hasOwnProperty.call(message, "namePart")) object.namePart = message.namePart; - if (message.isExtension != null && message.hasOwnProperty("isExtension")) + if (message.isExtension != null && Object.hasOwnProperty.call(message, "isExtension")) object.isExtension = message.isExtension; return object; }; @@ -46721,9 +48039,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FeatureSet.encode = function encode(message, writer) { + FeatureSet.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.fieldPresence != null && Object.hasOwnProperty.call(message, "fieldPresence")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.fieldPresence); if (message.enumType != null && Object.hasOwnProperty.call(message, "enumType")) @@ -46753,7 +48075,7 @@ * @returns {$protobuf.Writer} Writer */ FeatureSet.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -46851,7 +48173,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.fieldPresence != null && message.hasOwnProperty("fieldPresence")) + if (message.fieldPresence != null && Object.hasOwnProperty.call(message, "fieldPresence")) switch (message.fieldPresence) { default: return "fieldPresence: enum value expected"; @@ -46861,7 +48183,7 @@ case 3: break; } - if (message.enumType != null && message.hasOwnProperty("enumType")) + if (message.enumType != null && Object.hasOwnProperty.call(message, "enumType")) switch (message.enumType) { default: return "enumType: enum value expected"; @@ -46870,7 +48192,7 @@ case 2: break; } - if (message.repeatedFieldEncoding != null && message.hasOwnProperty("repeatedFieldEncoding")) + if (message.repeatedFieldEncoding != null && Object.hasOwnProperty.call(message, "repeatedFieldEncoding")) switch (message.repeatedFieldEncoding) { default: return "repeatedFieldEncoding: enum value expected"; @@ -46879,7 +48201,7 @@ case 2: break; } - if (message.utf8Validation != null && message.hasOwnProperty("utf8Validation")) + if (message.utf8Validation != null && Object.hasOwnProperty.call(message, "utf8Validation")) switch (message.utf8Validation) { default: return "utf8Validation: enum value expected"; @@ -46888,7 +48210,7 @@ case 3: break; } - if (message.messageEncoding != null && message.hasOwnProperty("messageEncoding")) + if (message.messageEncoding != null && Object.hasOwnProperty.call(message, "messageEncoding")) switch (message.messageEncoding) { default: return "messageEncoding: enum value expected"; @@ -46897,7 +48219,7 @@ case 2: break; } - if (message.jsonFormat != null && message.hasOwnProperty("jsonFormat")) + if (message.jsonFormat != null && Object.hasOwnProperty.call(message, "jsonFormat")) switch (message.jsonFormat) { default: return "jsonFormat: enum value expected"; @@ -46906,7 +48228,7 @@ case 2: break; } - if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + if (message.enforceNamingStyle != null && Object.hasOwnProperty.call(message, "enforceNamingStyle")) switch (message.enforceNamingStyle) { default: return "enforceNamingStyle: enum value expected"; @@ -46915,7 +48237,7 @@ case 2: break; } - if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + if (message.defaultSymbolVisibility != null && Object.hasOwnProperty.call(message, "defaultSymbolVisibility")) switch (message.defaultSymbolVisibility) { default: return "defaultSymbolVisibility: enum value expected"; @@ -46940,6 +48262,8 @@ FeatureSet.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.FeatureSet) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.FeatureSet: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -47129,9 +48453,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FeatureSet.toObject = function toObject(message, options) { + FeatureSet.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.fieldPresence = options.enums === String ? "FIELD_PRESENCE_UNKNOWN" : 0; @@ -47143,21 +48471,21 @@ object.enforceNamingStyle = options.enums === String ? "ENFORCE_NAMING_STYLE_UNKNOWN" : 0; object.defaultSymbolVisibility = options.enums === String ? "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN" : 0; } - if (message.fieldPresence != null && message.hasOwnProperty("fieldPresence")) + if (message.fieldPresence != null && Object.hasOwnProperty.call(message, "fieldPresence")) object.fieldPresence = options.enums === String ? $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] === undefined ? message.fieldPresence : $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] : message.fieldPresence; - if (message.enumType != null && message.hasOwnProperty("enumType")) + if (message.enumType != null && Object.hasOwnProperty.call(message, "enumType")) object.enumType = options.enums === String ? $root.google.protobuf.FeatureSet.EnumType[message.enumType] === undefined ? message.enumType : $root.google.protobuf.FeatureSet.EnumType[message.enumType] : message.enumType; - if (message.repeatedFieldEncoding != null && message.hasOwnProperty("repeatedFieldEncoding")) + if (message.repeatedFieldEncoding != null && Object.hasOwnProperty.call(message, "repeatedFieldEncoding")) object.repeatedFieldEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.RepeatedFieldEncoding[message.repeatedFieldEncoding] === undefined ? message.repeatedFieldEncoding : $root.google.protobuf.FeatureSet.RepeatedFieldEncoding[message.repeatedFieldEncoding] : message.repeatedFieldEncoding; - if (message.utf8Validation != null && message.hasOwnProperty("utf8Validation")) + if (message.utf8Validation != null && Object.hasOwnProperty.call(message, "utf8Validation")) object.utf8Validation = options.enums === String ? $root.google.protobuf.FeatureSet.Utf8Validation[message.utf8Validation] === undefined ? message.utf8Validation : $root.google.protobuf.FeatureSet.Utf8Validation[message.utf8Validation] : message.utf8Validation; - if (message.messageEncoding != null && message.hasOwnProperty("messageEncoding")) + if (message.messageEncoding != null && Object.hasOwnProperty.call(message, "messageEncoding")) object.messageEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] === undefined ? message.messageEncoding : $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] : message.messageEncoding; - if (message.jsonFormat != null && message.hasOwnProperty("jsonFormat")) + if (message.jsonFormat != null && Object.hasOwnProperty.call(message, "jsonFormat")) object.jsonFormat = options.enums === String ? $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] === undefined ? message.jsonFormat : $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] : message.jsonFormat; - if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + if (message.enforceNamingStyle != null && Object.hasOwnProperty.call(message, "enforceNamingStyle")) object.enforceNamingStyle = options.enums === String ? $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] === undefined ? message.enforceNamingStyle : $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] : message.enforceNamingStyle; - if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + if (message.defaultSymbolVisibility != null && Object.hasOwnProperty.call(message, "defaultSymbolVisibility")) object.defaultSymbolVisibility = options.enums === String ? $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] === undefined ? message.defaultSymbolVisibility : $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] : message.defaultSymbolVisibility; return object; }; @@ -47346,9 +48674,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - VisibilityFeature.encode = function encode(message, writer) { + VisibilityFeature.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); return writer; }; @@ -47362,7 +48694,7 @@ * @returns {$protobuf.Writer} Writer */ VisibilityFeature.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -47442,10 +48774,6 @@ VisibilityFeature.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.FeatureSet.VisibilityFeature) return object; - if (long === undefined) - long = 0; - if (long > $util.recursionLimit) - throw Error("maximum nesting depth exceeded"); return new $root.google.protobuf.FeatureSet.VisibilityFeature(); }; @@ -47586,12 +48914,16 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FeatureSetDefaults.encode = function encode(message, writer) { + FeatureSetDefaults.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.defaults != null && message.defaults.length) for (var i = 0; i < message.defaults.length; ++i) - $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.encode(message.defaults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.encode(message.defaults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); if (message.minimumEdition != null && Object.hasOwnProperty.call(message, "minimumEdition")) writer.uint32(/* id 4, wireType 0 =*/32).int32(message.minimumEdition); if (message.maximumEdition != null && Object.hasOwnProperty.call(message, "maximumEdition")) @@ -47609,7 +48941,7 @@ * @returns {$protobuf.Writer} Writer */ FeatureSetDefaults.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -47689,7 +49021,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.defaults != null && message.hasOwnProperty("defaults")) { + if (message.defaults != null && Object.hasOwnProperty.call(message, "defaults")) { if (!Array.isArray(message.defaults)) return "defaults: array expected"; for (var i = 0; i < message.defaults.length; ++i) { @@ -47698,7 +49030,7 @@ return "defaults." + error; } } - if (message.minimumEdition != null && message.hasOwnProperty("minimumEdition")) + if (message.minimumEdition != null && Object.hasOwnProperty.call(message, "minimumEdition")) switch (message.minimumEdition) { default: return "minimumEdition: enum value expected"; @@ -47716,7 +49048,7 @@ case 2147483647: break; } - if (message.maximumEdition != null && message.hasOwnProperty("maximumEdition")) + if (message.maximumEdition != null && Object.hasOwnProperty.call(message, "maximumEdition")) switch (message.maximumEdition) { default: return "maximumEdition: enum value expected"; @@ -47748,6 +49080,8 @@ FeatureSetDefaults.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.FeatureSetDefaults) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.FeatureSetDefaults: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -47758,7 +49092,7 @@ throw TypeError(".google.protobuf.FeatureSetDefaults.defaults: array expected"); message.defaults = []; for (var i = 0; i < object.defaults.length; ++i) { - if (typeof object.defaults[i] !== "object") + if (!$util.isObject(object.defaults[i])) throw TypeError(".google.protobuf.FeatureSetDefaults.defaults: object expected"); message.defaults[i] = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fromObject(object.defaults[i], long + 1); } @@ -47887,9 +49221,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FeatureSetDefaults.toObject = function toObject(message, options) { + FeatureSetDefaults.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.defaults = []; @@ -47900,11 +49238,11 @@ if (message.defaults && message.defaults.length) { object.defaults = []; for (var j = 0; j < message.defaults.length; ++j) - object.defaults[j] = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.toObject(message.defaults[j], options); + object.defaults[j] = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.toObject(message.defaults[j], options, q + 1); } - if (message.minimumEdition != null && message.hasOwnProperty("minimumEdition")) + if (message.minimumEdition != null && Object.hasOwnProperty.call(message, "minimumEdition")) object.minimumEdition = options.enums === String ? $root.google.protobuf.Edition[message.minimumEdition] === undefined ? message.minimumEdition : $root.google.protobuf.Edition[message.minimumEdition] : message.minimumEdition; - if (message.maximumEdition != null && message.hasOwnProperty("maximumEdition")) + if (message.maximumEdition != null && Object.hasOwnProperty.call(message, "maximumEdition")) object.maximumEdition = options.enums === String ? $root.google.protobuf.Edition[message.maximumEdition] === undefined ? message.maximumEdition : $root.google.protobuf.Edition[message.maximumEdition] : message.maximumEdition; return object; }; @@ -48006,15 +49344,19 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FeatureSetEditionDefault.encode = function encode(message, writer) { + FeatureSetEditionDefault.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); if (message.overridableFeatures != null && Object.hasOwnProperty.call(message, "overridableFeatures")) - $root.google.protobuf.FeatureSet.encode(message.overridableFeatures, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + $root.google.protobuf.FeatureSet.encode(message.overridableFeatures, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim(); if (message.fixedFeatures != null && Object.hasOwnProperty.call(message, "fixedFeatures")) - $root.google.protobuf.FeatureSet.encode(message.fixedFeatures, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + $root.google.protobuf.FeatureSet.encode(message.fixedFeatures, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); return writer; }; @@ -48028,7 +49370,7 @@ * @returns {$protobuf.Writer} Writer */ FeatureSetEditionDefault.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -48106,7 +49448,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.edition != null && message.hasOwnProperty("edition")) + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) switch (message.edition) { default: return "edition: enum value expected"; @@ -48124,12 +49466,12 @@ case 2147483647: break; } - if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) { + if (message.overridableFeatures != null && Object.hasOwnProperty.call(message, "overridableFeatures")) { var error = $root.google.protobuf.FeatureSet.verify(message.overridableFeatures, long + 1); if (error) return "overridableFeatures." + error; } - if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) { + if (message.fixedFeatures != null && Object.hasOwnProperty.call(message, "fixedFeatures")) { var error = $root.google.protobuf.FeatureSet.verify(message.fixedFeatures, long + 1); if (error) return "fixedFeatures." + error; @@ -48148,6 +49490,8 @@ FeatureSetEditionDefault.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -48210,12 +49554,12 @@ break; } if (object.overridableFeatures != null) { - if (typeof object.overridableFeatures !== "object") + if (!$util.isObject(object.overridableFeatures)) throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridableFeatures: object expected"); message.overridableFeatures = $root.google.protobuf.FeatureSet.fromObject(object.overridableFeatures, long + 1); } if (object.fixedFeatures != null) { - if (typeof object.fixedFeatures !== "object") + if (!$util.isObject(object.fixedFeatures)) throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixedFeatures: object expected"); message.fixedFeatures = $root.google.protobuf.FeatureSet.fromObject(object.fixedFeatures, long + 1); } @@ -48231,21 +49575,25 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FeatureSetEditionDefault.toObject = function toObject(message, options) { + FeatureSetEditionDefault.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; object.overridableFeatures = null; object.fixedFeatures = null; } - if (message.edition != null && message.hasOwnProperty("edition")) + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; - if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) - object.overridableFeatures = $root.google.protobuf.FeatureSet.toObject(message.overridableFeatures, options); - if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) - object.fixedFeatures = $root.google.protobuf.FeatureSet.toObject(message.fixedFeatures, options); + if (message.overridableFeatures != null && Object.hasOwnProperty.call(message, "overridableFeatures")) + object.overridableFeatures = $root.google.protobuf.FeatureSet.toObject(message.overridableFeatures, options, q + 1); + if (message.fixedFeatures != null && Object.hasOwnProperty.call(message, "fixedFeatures")) + object.fixedFeatures = $root.google.protobuf.FeatureSet.toObject(message.fixedFeatures, options, q + 1); return object; }; @@ -48335,12 +49683,16 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SourceCodeInfo.encode = function encode(message, writer) { + SourceCodeInfo.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.location != null && message.location.length) for (var i = 0; i < message.location.length; ++i) - $root.google.protobuf.SourceCodeInfo.Location.encode(message.location[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.protobuf.SourceCodeInfo.Location.encode(message.location[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); return writer; }; @@ -48354,7 +49706,7 @@ * @returns {$protobuf.Writer} Writer */ SourceCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -48426,7 +49778,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.location != null && message.hasOwnProperty("location")) { + if (message.location != null && Object.hasOwnProperty.call(message, "location")) { if (!Array.isArray(message.location)) return "location: array expected"; for (var i = 0; i < message.location.length; ++i) { @@ -48449,6 +49801,8 @@ SourceCodeInfo.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.SourceCodeInfo) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.SourceCodeInfo: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -48459,7 +49813,7 @@ throw TypeError(".google.protobuf.SourceCodeInfo.location: array expected"); message.location = []; for (var i = 0; i < object.location.length; ++i) { - if (typeof object.location[i] !== "object") + if (!$util.isObject(object.location[i])) throw TypeError(".google.protobuf.SourceCodeInfo.location: object expected"); message.location[i] = $root.google.protobuf.SourceCodeInfo.Location.fromObject(object.location[i], long + 1); } @@ -48476,16 +49830,20 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SourceCodeInfo.toObject = function toObject(message, options) { + SourceCodeInfo.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.location = []; if (message.location && message.location.length) { object.location = []; for (var j = 0; j < message.location.length; ++j) - object.location[j] = $root.google.protobuf.SourceCodeInfo.Location.toObject(message.location[j], options); + object.location[j] = $root.google.protobuf.SourceCodeInfo.Location.toObject(message.location[j], options, q + 1); } return object; }; @@ -48608,9 +49966,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Location.encode = function encode(message, writer) { + Location.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.path != null && message.path.length) { writer.uint32(/* id 1, wireType 2 =*/10).fork(); for (var i = 0; i < message.path.length; ++i) @@ -48643,7 +50005,7 @@ * @returns {$protobuf.Writer} Writer */ Location.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -48745,27 +50107,27 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.path != null && message.hasOwnProperty("path")) { + if (message.path != null && Object.hasOwnProperty.call(message, "path")) { if (!Array.isArray(message.path)) return "path: array expected"; for (var i = 0; i < message.path.length; ++i) if (!$util.isInteger(message.path[i])) return "path: integer[] expected"; } - if (message.span != null && message.hasOwnProperty("span")) { + if (message.span != null && Object.hasOwnProperty.call(message, "span")) { if (!Array.isArray(message.span)) return "span: array expected"; for (var i = 0; i < message.span.length; ++i) if (!$util.isInteger(message.span[i])) return "span: integer[] expected"; } - if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) + if (message.leadingComments != null && Object.hasOwnProperty.call(message, "leadingComments")) if (!$util.isString(message.leadingComments)) return "leadingComments: string expected"; - if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) + if (message.trailingComments != null && Object.hasOwnProperty.call(message, "trailingComments")) if (!$util.isString(message.trailingComments)) return "trailingComments: string expected"; - if (message.leadingDetachedComments != null && message.hasOwnProperty("leadingDetachedComments")) { + if (message.leadingDetachedComments != null && Object.hasOwnProperty.call(message, "leadingDetachedComments")) { if (!Array.isArray(message.leadingDetachedComments)) return "leadingDetachedComments: array expected"; for (var i = 0; i < message.leadingDetachedComments.length; ++i) @@ -48786,6 +50148,8 @@ Location.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.SourceCodeInfo.Location) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -48828,9 +50192,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Location.toObject = function toObject(message, options) { + Location.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) { object.path = []; @@ -48851,9 +50219,9 @@ for (var j = 0; j < message.span.length; ++j) object.span[j] = message.span[j]; } - if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) + if (message.leadingComments != null && Object.hasOwnProperty.call(message, "leadingComments")) object.leadingComments = message.leadingComments; - if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) + if (message.trailingComments != null && Object.hasOwnProperty.call(message, "trailingComments")) object.trailingComments = message.trailingComments; if (message.leadingDetachedComments && message.leadingDetachedComments.length) { object.leadingDetachedComments = []; @@ -48949,12 +50317,16 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GeneratedCodeInfo.encode = function encode(message, writer) { + GeneratedCodeInfo.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.annotation != null && message.annotation.length) for (var i = 0; i < message.annotation.length; ++i) - $root.google.protobuf.GeneratedCodeInfo.Annotation.encode(message.annotation[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.protobuf.GeneratedCodeInfo.Annotation.encode(message.annotation[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); return writer; }; @@ -48968,7 +50340,7 @@ * @returns {$protobuf.Writer} Writer */ GeneratedCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -49040,7 +50412,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.annotation != null && message.hasOwnProperty("annotation")) { + if (message.annotation != null && Object.hasOwnProperty.call(message, "annotation")) { if (!Array.isArray(message.annotation)) return "annotation: array expected"; for (var i = 0; i < message.annotation.length; ++i) { @@ -49063,6 +50435,8 @@ GeneratedCodeInfo.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.GeneratedCodeInfo) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.GeneratedCodeInfo: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -49073,7 +50447,7 @@ throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: array expected"); message.annotation = []; for (var i = 0; i < object.annotation.length; ++i) { - if (typeof object.annotation[i] !== "object") + if (!$util.isObject(object.annotation[i])) throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: object expected"); message.annotation[i] = $root.google.protobuf.GeneratedCodeInfo.Annotation.fromObject(object.annotation[i], long + 1); } @@ -49090,16 +50464,20 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GeneratedCodeInfo.toObject = function toObject(message, options) { + GeneratedCodeInfo.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.annotation = []; if (message.annotation && message.annotation.length) { object.annotation = []; for (var j = 0; j < message.annotation.length; ++j) - object.annotation[j] = $root.google.protobuf.GeneratedCodeInfo.Annotation.toObject(message.annotation[j], options); + object.annotation[j] = $root.google.protobuf.GeneratedCodeInfo.Annotation.toObject(message.annotation[j], options, q + 1); } return object; }; @@ -49220,9 +50598,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Annotation.encode = function encode(message, writer) { + Annotation.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.path != null && message.path.length) { writer.uint32(/* id 1, wireType 2 =*/10).fork(); for (var i = 0; i < message.path.length; ++i) @@ -49250,7 +50632,7 @@ * @returns {$protobuf.Writer} Writer */ Annotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -49343,23 +50725,23 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.path != null && message.hasOwnProperty("path")) { + if (message.path != null && Object.hasOwnProperty.call(message, "path")) { if (!Array.isArray(message.path)) return "path: array expected"; for (var i = 0; i < message.path.length; ++i) if (!$util.isInteger(message.path[i])) return "path: integer[] expected"; } - if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) + if (message.sourceFile != null && Object.hasOwnProperty.call(message, "sourceFile")) if (!$util.isString(message.sourceFile)) return "sourceFile: string expected"; - if (message.begin != null && message.hasOwnProperty("begin")) + if (message.begin != null && Object.hasOwnProperty.call(message, "begin")) if (!$util.isInteger(message.begin)) return "begin: integer expected"; - if (message.end != null && message.hasOwnProperty("end")) + if (message.end != null && Object.hasOwnProperty.call(message, "end")) if (!$util.isInteger(message.end)) return "end: integer expected"; - if (message.semantic != null && message.hasOwnProperty("semantic")) + if (message.semantic != null && Object.hasOwnProperty.call(message, "semantic")) switch (message.semantic) { default: return "semantic: enum value expected"; @@ -49382,6 +50764,8 @@ Annotation.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.GeneratedCodeInfo.Annotation) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.GeneratedCodeInfo.Annotation: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -49432,9 +50816,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Annotation.toObject = function toObject(message, options) { + Annotation.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.path = []; @@ -49449,13 +50837,13 @@ for (var j = 0; j < message.path.length; ++j) object.path[j] = message.path[j]; } - if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) + if (message.sourceFile != null && Object.hasOwnProperty.call(message, "sourceFile")) object.sourceFile = message.sourceFile; - if (message.begin != null && message.hasOwnProperty("begin")) + if (message.begin != null && Object.hasOwnProperty.call(message, "begin")) object.begin = message.begin; - if (message.end != null && message.hasOwnProperty("end")) + if (message.end != null && Object.hasOwnProperty.call(message, "end")) object.end = message.end; - if (message.semantic != null && message.hasOwnProperty("semantic")) + if (message.semantic != null && Object.hasOwnProperty.call(message, "semantic")) object.semantic = options.enums === String ? $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] === undefined ? message.semantic : $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] : message.semantic; return object; }; @@ -49586,9 +50974,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Duration.encode = function encode(message, writer) { + Duration.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) @@ -49606,7 +50998,7 @@ * @returns {$protobuf.Writer} Writer */ Duration.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -49680,10 +51072,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.seconds != null && message.hasOwnProperty("seconds")) + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) return "seconds: integer|Long expected"; - if (message.nanos != null && message.hasOwnProperty("nanos")) + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) if (!$util.isInteger(message.nanos)) return "nanos: integer expected"; return null; @@ -49700,6 +51092,8 @@ Duration.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.Duration) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.Duration: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -49707,7 +51101,7 @@ var message = new $root.google.protobuf.Duration(); if (object.seconds != null) if ($util.Long) - (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; + message.seconds = $util.Long.fromValue(object.seconds, false); else if (typeof object.seconds === "string") message.seconds = parseInt(object.seconds, 10); else if (typeof object.seconds === "number") @@ -49728,24 +51122,30 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Duration.toObject = function toObject(message, options) { + Duration.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { if ($util.Long) { var long = new $util.Long(0, 0, false); - object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; } else - object.seconds = options.longs === String ? "0" : 0; + object.seconds = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; object.nanos = 0; } - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (typeof message.seconds === "number") + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.seconds = typeof message.seconds === "number" ? BigInt(message.seconds) : $util.Long.fromBits(message.seconds.low >>> 0, message.seconds.high >>> 0, false).toBigInt(); + else if (typeof message.seconds === "number") object.seconds = options.longs === String ? String(message.seconds) : message.seconds; else object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; - if (message.nanos != null && message.hasOwnProperty("nanos")) + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) object.nanos = message.nanos; return object; }; @@ -49823,9 +51223,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Empty.encode = function encode(message, writer) { + Empty.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); return writer; }; @@ -49839,7 +51243,7 @@ * @returns {$protobuf.Writer} Writer */ Empty.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -49919,10 +51323,6 @@ Empty.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.Empty) return object; - if (long === undefined) - long = 0; - if (long > $util.recursionLimit) - throw Error("maximum nesting depth exceeded"); return new $root.google.protobuf.Empty(); }; @@ -50022,9 +51422,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FieldMask.encode = function encode(message, writer) { + FieldMask.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.paths != null && message.paths.length) for (var i = 0; i < message.paths.length; ++i) writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); @@ -50041,7 +51445,7 @@ * @returns {$protobuf.Writer} Writer */ FieldMask.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -50113,7 +51517,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.paths != null && message.hasOwnProperty("paths")) { + if (message.paths != null && Object.hasOwnProperty.call(message, "paths")) { if (!Array.isArray(message.paths)) return "paths: array expected"; for (var i = 0; i < message.paths.length; ++i) @@ -50134,6 +51538,8 @@ FieldMask.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.FieldMask) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.FieldMask: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -50158,9 +51564,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FieldMask.toObject = function toObject(message, options) { + FieldMask.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.paths = []; @@ -50255,13 +51665,17 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Struct.encode = function encode(message, writer) { + Struct.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.fields != null && Object.hasOwnProperty.call(message, "fields")) for (var keys = Object.keys(message.fields), i = 0; i < keys.length; ++i) { writer.uint32(/* id 1, wireType 2 =*/10).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.google.protobuf.Value.encode(message.fields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + $root.google.protobuf.Value.encode(message.fields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim().ldelim(); } return writer; }; @@ -50276,7 +51690,7 @@ * @returns {$protobuf.Writer} Writer */ Struct.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -50367,7 +51781,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.fields != null && message.hasOwnProperty("fields")) { + if (message.fields != null && Object.hasOwnProperty.call(message, "fields")) { if (!$util.isObject(message.fields)) return "fields: object expected"; var key = Object.keys(message.fields); @@ -50391,19 +51805,21 @@ Struct.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.Struct) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.Struct: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.Struct(); if (object.fields) { - if (typeof object.fields !== "object") + if (!$util.isObject(object.fields)) throw TypeError(".google.protobuf.Struct.fields: object expected"); message.fields = {}; for (var keys = Object.keys(object.fields), i = 0; i < keys.length; ++i) { if (keys[i] === "__proto__") $util.makeProp(message.fields, keys[i]); - if (typeof object.fields[keys[i]] !== "object") + if (!$util.isObject(object.fields[keys[i]])) throw TypeError(".google.protobuf.Struct.fields: object expected"); message.fields[keys[i]] = $root.google.protobuf.Value.fromObject(object.fields[keys[i]], long + 1); } @@ -50420,9 +51836,13 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Struct.toObject = function toObject(message, options) { + Struct.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.objects || options.defaults) object.fields = {}; @@ -50432,7 +51852,7 @@ for (var j = 0; j < keys2.length; ++j) { if (keys2[j] === "__proto__") $util.makeProp(object.fields, keys2[j]); - object.fields[keys2[j]] = $root.google.protobuf.Value.toObject(message.fields[keys2[j]], options); + object.fields[keys2[j]] = $root.google.protobuf.Value.toObject(message.fields[keys2[j]], options, q + 1); } } return object; @@ -50579,9 +51999,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Value.encode = function encode(message, writer) { + Value.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.nullValue != null && Object.hasOwnProperty.call(message, "nullValue")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.nullValue); if (message.numberValue != null && Object.hasOwnProperty.call(message, "numberValue")) @@ -50591,9 +52015,9 @@ if (message.boolValue != null && Object.hasOwnProperty.call(message, "boolValue")) writer.uint32(/* id 4, wireType 0 =*/32).bool(message.boolValue); if (message.structValue != null && Object.hasOwnProperty.call(message, "structValue")) - $root.google.protobuf.Struct.encode(message.structValue, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + $root.google.protobuf.Struct.encode(message.structValue, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim(); if (message.listValue != null && Object.hasOwnProperty.call(message, "listValue")) - $root.google.protobuf.ListValue.encode(message.listValue, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + $root.google.protobuf.ListValue.encode(message.listValue, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim(); return writer; }; @@ -50607,7 +52031,7 @@ * @returns {$protobuf.Writer} Writer */ Value.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -50698,7 +52122,7 @@ if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; var properties = {}; - if (message.nullValue != null && message.hasOwnProperty("nullValue")) { + if (message.nullValue != null && Object.hasOwnProperty.call(message, "nullValue")) { properties.kind = 1; switch (message.nullValue) { default: @@ -50707,28 +52131,28 @@ break; } } - if (message.numberValue != null && message.hasOwnProperty("numberValue")) { + if (message.numberValue != null && Object.hasOwnProperty.call(message, "numberValue")) { if (properties.kind === 1) return "kind: multiple values"; properties.kind = 1; if (typeof message.numberValue !== "number") return "numberValue: number expected"; } - if (message.stringValue != null && message.hasOwnProperty("stringValue")) { + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) { if (properties.kind === 1) return "kind: multiple values"; properties.kind = 1; if (!$util.isString(message.stringValue)) return "stringValue: string expected"; } - if (message.boolValue != null && message.hasOwnProperty("boolValue")) { + if (message.boolValue != null && Object.hasOwnProperty.call(message, "boolValue")) { if (properties.kind === 1) return "kind: multiple values"; properties.kind = 1; if (typeof message.boolValue !== "boolean") return "boolValue: boolean expected"; } - if (message.structValue != null && message.hasOwnProperty("structValue")) { + if (message.structValue != null && Object.hasOwnProperty.call(message, "structValue")) { if (properties.kind === 1) return "kind: multiple values"; properties.kind = 1; @@ -50738,7 +52162,7 @@ return "structValue." + error; } } - if (message.listValue != null && message.hasOwnProperty("listValue")) { + if (message.listValue != null && Object.hasOwnProperty.call(message, "listValue")) { if (properties.kind === 1) return "kind: multiple values"; properties.kind = 1; @@ -50762,6 +52186,8 @@ Value.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.Value) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.Value: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -50786,12 +52212,12 @@ if (object.boolValue != null) message.boolValue = Boolean(object.boolValue); if (object.structValue != null) { - if (typeof object.structValue !== "object") + if (!$util.isObject(object.structValue)) throw TypeError(".google.protobuf.Value.structValue: object expected"); message.structValue = $root.google.protobuf.Struct.fromObject(object.structValue, long + 1); } if (object.listValue != null) { - if (typeof object.listValue !== "object") + if (!$util.isObject(object.listValue)) throw TypeError(".google.protobuf.Value.listValue: object expected"); message.listValue = $root.google.protobuf.ListValue.fromObject(object.listValue, long + 1); } @@ -50807,37 +52233,41 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Value.toObject = function toObject(message, options) { + Value.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; - if (message.nullValue != null && message.hasOwnProperty("nullValue")) { + if (message.nullValue != null && Object.hasOwnProperty.call(message, "nullValue")) { object.nullValue = options.enums === String ? $root.google.protobuf.NullValue[message.nullValue] === undefined ? message.nullValue : $root.google.protobuf.NullValue[message.nullValue] : message.nullValue; if (options.oneofs) object.kind = "nullValue"; } - if (message.numberValue != null && message.hasOwnProperty("numberValue")) { + if (message.numberValue != null && Object.hasOwnProperty.call(message, "numberValue")) { object.numberValue = options.json && !isFinite(message.numberValue) ? String(message.numberValue) : message.numberValue; if (options.oneofs) object.kind = "numberValue"; } - if (message.stringValue != null && message.hasOwnProperty("stringValue")) { + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) { object.stringValue = message.stringValue; if (options.oneofs) object.kind = "stringValue"; } - if (message.boolValue != null && message.hasOwnProperty("boolValue")) { + if (message.boolValue != null && Object.hasOwnProperty.call(message, "boolValue")) { object.boolValue = message.boolValue; if (options.oneofs) object.kind = "boolValue"; } - if (message.structValue != null && message.hasOwnProperty("structValue")) { - object.structValue = $root.google.protobuf.Struct.toObject(message.structValue, options); + if (message.structValue != null && Object.hasOwnProperty.call(message, "structValue")) { + object.structValue = $root.google.protobuf.Struct.toObject(message.structValue, options, q + 1); if (options.oneofs) object.kind = "structValue"; } - if (message.listValue != null && message.hasOwnProperty("listValue")) { - object.listValue = $root.google.protobuf.ListValue.toObject(message.listValue, options); + if (message.listValue != null && Object.hasOwnProperty.call(message, "listValue")) { + object.listValue = $root.google.protobuf.ListValue.toObject(message.listValue, options, q + 1); if (options.oneofs) object.kind = "listValue"; } @@ -50939,12 +52369,16 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListValue.encode = function encode(message, writer) { + ListValue.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.values != null && message.values.length) for (var i = 0; i < message.values.length; ++i) - $root.google.protobuf.Value.encode(message.values[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.protobuf.Value.encode(message.values[i], writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim(); return writer; }; @@ -50958,7 +52392,7 @@ * @returns {$protobuf.Writer} Writer */ ListValue.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -51030,7 +52464,7 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.values != null && message.hasOwnProperty("values")) { + if (message.values != null && Object.hasOwnProperty.call(message, "values")) { if (!Array.isArray(message.values)) return "values: array expected"; for (var i = 0; i < message.values.length; ++i) { @@ -51053,6 +52487,8 @@ ListValue.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.ListValue) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.ListValue: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -51063,7 +52499,7 @@ throw TypeError(".google.protobuf.ListValue.values: array expected"); message.values = []; for (var i = 0; i < object.values.length; ++i) { - if (typeof object.values[i] !== "object") + if (!$util.isObject(object.values[i])) throw TypeError(".google.protobuf.ListValue.values: object expected"); message.values[i] = $root.google.protobuf.Value.fromObject(object.values[i], long + 1); } @@ -51080,16 +52516,20 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListValue.toObject = function toObject(message, options) { + ListValue.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.arrays || options.defaults) object.values = []; if (message.values && message.values.length) { object.values = []; for (var j = 0; j < message.values.length; ++j) - object.values[j] = $root.google.protobuf.Value.toObject(message.values[j], options); + object.values[j] = $root.google.protobuf.Value.toObject(message.values[j], options, q + 1); } return object; }; @@ -51185,9 +52625,13 @@ * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Timestamp.encode = function encode(message, writer) { + Timestamp.encode = function encode(message, writer, q) { if (!writer) writer = $Writer.create(); + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) @@ -51205,7 +52649,7 @@ * @returns {$protobuf.Writer} Writer */ Timestamp.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); }; /** @@ -51279,10 +52723,10 @@ long = 0; if (long > $util.recursionLimit) return "maximum nesting depth exceeded"; - if (message.seconds != null && message.hasOwnProperty("seconds")) + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) return "seconds: integer|Long expected"; - if (message.nanos != null && message.hasOwnProperty("nanos")) + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) if (!$util.isInteger(message.nanos)) return "nanos: integer expected"; return null; @@ -51299,6 +52743,8 @@ Timestamp.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.Timestamp) return object; + if (!$util.isObject(object)) + throw TypeError(".google.protobuf.Timestamp: object expected"); if (long === undefined) long = 0; if (long > $util.recursionLimit) @@ -51306,7 +52752,7 @@ var message = new $root.google.protobuf.Timestamp(); if (object.seconds != null) if ($util.Long) - (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; + message.seconds = $util.Long.fromValue(object.seconds, false); else if (typeof object.seconds === "string") message.seconds = parseInt(object.seconds, 10); else if (typeof object.seconds === "number") @@ -51327,24 +52773,30 @@ * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Timestamp.toObject = function toObject(message, options) { + Timestamp.toObject = function toObject(message, options, q) { if (!options) options = {}; + if (q === undefined) + q = 0; + if (q > $util.recursionLimit) + throw Error("max depth exceeded"); var object = {}; if (options.defaults) { if ($util.Long) { var long = new $util.Long(0, 0, false); - object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long; } else - object.seconds = options.longs === String ? "0" : 0; + object.seconds = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0; object.nanos = 0; } - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (typeof message.seconds === "number") + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + if (typeof BigInt !== "undefined" && options.longs === BigInt) + object.seconds = typeof message.seconds === "number" ? BigInt(message.seconds) : $util.Long.fromBits(message.seconds.low >>> 0, message.seconds.high >>> 0, false).toBigInt(); + else if (typeof message.seconds === "number") object.seconds = options.longs === String ? String(message.seconds) : message.seconds; else object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; - if (message.nanos != null && message.hasOwnProperty("nanos")) + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) object.nanos = message.nanos; return object; }; diff --git a/handwritten/pubsub/src/index.ts b/handwritten/pubsub/src/index.ts index 2b1432cdbdce..2e8ae3fff203 100644 --- a/handwritten/pubsub/src/index.ts +++ b/handwritten/pubsub/src/index.ts @@ -84,7 +84,7 @@ * @property {constructor} SubscriberClient * Reference to {@link v1.SubscriberClient}. */ -import * as v1 from './v1'; +import * as v1 from '@google-cloud/pubsub-api'; export {v1}; export {ServiceError, CallOptions} from 'google-gax'; export { diff --git a/handwritten/pubsub/src/message-stream.ts b/handwritten/pubsub/src/message-stream.ts index f1f2102f4d9a..2b71542b6ddb 100644 --- a/handwritten/pubsub/src/message-stream.ts +++ b/handwritten/pubsub/src/message-stream.ts @@ -44,9 +44,10 @@ export const logs = { const KEEP_ALIVE_INTERVAL = 30000; /*! - * Deadline for the stream. + * Deadline for the stream. This will need to go away and be replaced with something + * more graceful for pulling the config out of the pubsub-api package. */ -const PULL_TIMEOUT = require('./v1/subscriber_client_config.json').interfaces[ +const PULL_TIMEOUT = require('./v1-old/subscriber_client_config.json').interfaces[ 'google.pubsub.v1.Subscriber' ].methods.StreamingPull.timeout_millis; diff --git a/handwritten/pubsub/src/pubsub.ts b/handwritten/pubsub/src/pubsub.ts index e9c9fc7bdf1e..83effbde10cd 100644 --- a/handwritten/pubsub/src/pubsub.ts +++ b/handwritten/pubsub/src/pubsub.ts @@ -19,11 +19,10 @@ import {replaceProjectIdToken} from '@google-cloud/projectify'; import * as extend from 'extend'; import {AuthClient, GoogleAuth, GoogleAuthOptions} from 'google-auth-library'; import * as gax from 'google-gax'; +import {v1} from './'; // eslint-disable-next-line @typescript-eslint/no-var-requires const PKG = require('../../package.json'); -// eslint-disable-next-line @typescript-eslint/no-var-requires -const v1 = require('./v1'); import {promisifySome} from './util'; import { @@ -57,9 +56,10 @@ import {PublishOptions} from './publisher'; import {CallOptions} from 'google-gax'; import {Transform} from 'stream'; import {google} from '../protos/protos'; -import {SchemaServiceClient} from './v1'; import * as tracing from './telemetry-tracing'; +type SchemaServiceClient = v1.SchemaServiceClient; + /** * Project ID placeholder. * @type {string} @@ -1262,7 +1262,7 @@ export class PubSub { */ async getSchemaClient(): Promise { if (!this.schemaClient) { - const options = await this.getClientConfig(); + const options = await this.getClientConfig() as gax.ClientOptions; this.schemaClient = new v1.SchemaServiceClient(options); } @@ -1307,13 +1307,13 @@ export class PubSub { */ async getClientAsync_(config: GetClientConfig): Promise { // Make sure we've got a fully created config with projectId and such. - const options = await this.getClientConfig(); + const options = await this.getClientConfig() as gax.ClientOptions; let gaxClient = this.api[config.client]; if (!gaxClient) { // Lazily instantiate client. - gaxClient = new v1[config.client](options) as gax.ClientStub; + gaxClient = new v1[config.client](options) as unknown as gax.ClientStub; this.api[config.client] = gaxClient; } diff --git a/handwritten/pubsub/src/subscriber.ts b/handwritten/pubsub/src/subscriber.ts index 8332e93c819d..780f94b7342c 100644 --- a/handwritten/pubsub/src/subscriber.ts +++ b/handwritten/pubsub/src/subscriber.ts @@ -17,7 +17,7 @@ import {DateStruct, PreciseDate} from '@google-cloud/precise-date'; import {replaceProjectIdToken} from '@google-cloud/projectify'; import {promisify} from '@google-cloud/promisify'; -import defer = require('p-defer'); +import * as defer from 'p-defer'; import {google} from '../protos/protos'; import {Histogram} from './histogram'; @@ -26,7 +26,6 @@ import {AckQueue, BatchOptions, ModAckQueue} from './message-queues'; import {MessageStream, MessageStreamOptions} from './message-stream'; import {Subscription} from './subscription'; import {defaultOptions} from './default-options'; -import {SubscriberClient} from './v1'; import * as tracing from './telemetry-tracing'; import {Duration, atMost as durationAtMost} from './temporal'; import {EventEmitter} from 'events'; @@ -36,6 +35,9 @@ import {logs as baseLogs, LoggingFunction} from './logs'; export {StatusError} from './message-stream'; +import {v1} from '.'; +type SubscriberClient = v1.SubscriberClient; + /** * Loggers. Exported for unit tests. * diff --git a/handwritten/pubsub/src/v1/publisher_client_config.json b/handwritten/pubsub/src/v1-old/publisher_client_config.json similarity index 100% rename from handwritten/pubsub/src/v1/publisher_client_config.json rename to handwritten/pubsub/src/v1-old/publisher_client_config.json diff --git a/handwritten/pubsub/src/v1/schema_service_client_config.json b/handwritten/pubsub/src/v1-old/schema_service_client_config.json similarity index 100% rename from handwritten/pubsub/src/v1/schema_service_client_config.json rename to handwritten/pubsub/src/v1-old/schema_service_client_config.json diff --git a/handwritten/pubsub/src/v1/subscriber_client_config.json b/handwritten/pubsub/src/v1-old/subscriber_client_config.json similarity index 100% rename from handwritten/pubsub/src/v1/subscriber_client_config.json rename to handwritten/pubsub/src/v1-old/subscriber_client_config.json diff --git a/handwritten/pubsub/src/v1/index.ts b/handwritten/pubsub/src/v1/index.ts deleted file mode 100644 index 1dce1428427c..000000000000 --- a/handwritten/pubsub/src/v1/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2026 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {PublisherClient} from './publisher_client'; -export {SchemaServiceClient} from './schema_service_client'; -export {SubscriberClient} from './subscriber_client'; diff --git a/handwritten/pubsub/src/v1/publisher_client.ts b/handwritten/pubsub/src/v1/publisher_client.ts deleted file mode 100644 index 355581941e11..000000000000 --- a/handwritten/pubsub/src/v1/publisher_client.ts +++ /dev/null @@ -1,2319 +0,0 @@ -// Copyright 2026 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - PaginationCallback, - GaxCall, - IamClient, - IamProtos, -} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/publisher_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './publisher_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The service that an application uses to manipulate topics, and to send - * messages to a topic. - * @class - * @memberof v1 - */ -export class PublisherClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('pubsub'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - publisherStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of PublisherClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new PublisherClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof PublisherClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'pubsub.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}', - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}', - ), - projectTopicsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/topics/{topic}', - ), - schemaPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/schemas/{schema}', - ), - snapshotPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/snapshots/{snapshot}', - ), - subscriptionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/subscriptions/{subscription}', - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listTopics: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'topics', - ), - listTopicSubscriptions: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'subscriptions', - ), - listTopicSnapshots: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'snapshots', - ), - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // Some methods on this API support automatically batching - // requests; denote this. - - this.descriptors.batching = { - publish: new this._gaxModule.BundleDescriptor( - 'messages', - ['topic'], - 'message_ids', - this._gaxModule.GrpcClient.createByteLengthFunction( - // eslint-disable-next-line @typescript-eslint/no-explicit-any - protoFilesRoot.lookupType('google.pubsub.v1.PubsubMessage') as any, - ), - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.pubsub.v1.Publisher', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - {'x-goog-api-client': clientHeader.join(' ')}, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.publisherStub) { - return this.publisherStub; - } - - // Put together the "service stub" for - // google.pubsub.v1.Publisher. - this.publisherStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.pubsub.v1.Publisher', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.pubsub.v1.Publisher, - this._opts, - this._providedCustomServicePath, - ) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const publisherStubMethods = [ - 'createTopic', - 'updateTopic', - 'publish', - 'getTopic', - 'listTopics', - 'listTopicSubscriptions', - 'listTopicSnapshots', - 'deleteTopic', - 'detachSubscription', - ]; - for (const methodName of publisherStubMethods) { - const callPromise = this.publisherStub.then( - stub => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - }, - ); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.batching?.[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback, - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.publisherStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'pubsub.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'pubsub.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/pubsub', - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * Creates the given topic with the given name. See the [resource name rules] - * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Identifier. The name of the topic. It must have the format - * `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, - * and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), - * underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent - * signs (`%`). It must be between 3 and 255 characters in length, and it - * must not start with `"goog"`. - * @param {number[]} [request.labels] - * Optional. See [Creating and managing labels] - * (https://cloud.google.com/pubsub/docs/labels). - * @param {google.pubsub.v1.MessageStoragePolicy} [request.messageStoragePolicy] - * Optional. Policy constraining the set of Google Cloud Platform regions - * where messages published to the topic may be stored. If not present, then - * no constraints are in effect. - * @param {string} [request.kmsKeyName] - * Optional. The resource name of the Cloud KMS CryptoKey to be used to - * protect access to messages published on this topic. - * - * The expected format is `projects/* /locations/* /keyRings/* /cryptoKeys/*`. - * @param {google.pubsub.v1.SchemaSettings} [request.schemaSettings] - * Optional. Settings for validating messages published against a schema. - * @param {boolean} [request.satisfiesPzs] - * Optional. Reserved for future use. This field is set only in responses from - * the server; it is ignored if it is set in any requests. - * @param {google.protobuf.Duration} [request.messageRetentionDuration] - * Optional. Indicates the minimum duration to retain a message after it is - * published to the topic. If this field is set, messages published to the - * topic in the last `message_retention_duration` are always available to - * subscribers. For instance, it allows any attached subscription to [seek to - * a - * timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) - * that is up to `message_retention_duration` in the past. If this field is - * not set, message retention is controlled by settings on individual - * subscriptions. Cannot be more than 31 days or less than 10 minutes. - * @param {google.pubsub.v1.Topic.State} request.state - * Output only. An output-only field indicating the state of the topic. - * @param {google.pubsub.v1.IngestionDataSourceSettings} [request.ingestionDataSourceSettings] - * Optional. Settings for ingestion from a data source into this topic. - * @param {number[]} [request.messageTransforms] - * Optional. Transforms to be applied to messages published to the topic. - * Transforms are applied in the order specified. - * @param {number[]} request.tags - * Optional. Input only. Immutable. Tag keys/values directly bound to this - * resource. For example: - * "123/environment": "production", - * "123/costCenter": "marketing" - * See https://docs.cloud.google.com/pubsub/docs/tags for more information on - * using tags with Pub/Sub resources. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.pubsub.v1.Topic|Topic}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - createTopic( - request?: protos.google.pubsub.v1.ITopic, - options?: CallOptions, - ): Promise< - [ - protos.google.pubsub.v1.ITopic, - protos.google.pubsub.v1.ITopic | undefined, - {} | undefined, - ] - >; - createTopic( - request: protos.google.pubsub.v1.ITopic, - options: CallOptions, - callback: Callback< - protos.google.pubsub.v1.ITopic, - protos.google.pubsub.v1.ITopic | null | undefined, - {} | null | undefined - >, - ): void; - createTopic( - request: protos.google.pubsub.v1.ITopic, - callback: Callback< - protos.google.pubsub.v1.ITopic, - protos.google.pubsub.v1.ITopic | null | undefined, - {} | null | undefined - >, - ): void; - createTopic( - request?: protos.google.pubsub.v1.ITopic, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.pubsub.v1.ITopic, - protos.google.pubsub.v1.ITopic | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.pubsub.v1.ITopic, - protos.google.pubsub.v1.ITopic | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.pubsub.v1.ITopic, - protos.google.pubsub.v1.ITopic | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('createTopic request %j', request); - const wrappedCallback: - | Callback< - protos.google.pubsub.v1.ITopic, - protos.google.pubsub.v1.ITopic | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createTopic response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .createTopic(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.pubsub.v1.ITopic, - protos.google.pubsub.v1.ITopic | undefined, - {} | undefined, - ]) => { - this._log.info('createTopic response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Updates an existing topic by updating the fields specified in the update - * mask. Note that certain properties of a topic are not modifiable. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.pubsub.v1.Topic} request.topic - * Required. The updated topic object. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Indicates which fields in the provided topic to update. Must be - * specified and non-empty. Note that if `update_mask` contains - * "message_storage_policy" but the `message_storage_policy` is not set in - * the `topic` provided above, then the updated value is determined by the - * policy configured at the project or organization level. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.pubsub.v1.Topic|Topic}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - updateTopic( - request?: protos.google.pubsub.v1.IUpdateTopicRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.pubsub.v1.ITopic, - protos.google.pubsub.v1.IUpdateTopicRequest | undefined, - {} | undefined, - ] - >; - updateTopic( - request: protos.google.pubsub.v1.IUpdateTopicRequest, - options: CallOptions, - callback: Callback< - protos.google.pubsub.v1.ITopic, - protos.google.pubsub.v1.IUpdateTopicRequest | null | undefined, - {} | null | undefined - >, - ): void; - updateTopic( - request: protos.google.pubsub.v1.IUpdateTopicRequest, - callback: Callback< - protos.google.pubsub.v1.ITopic, - protos.google.pubsub.v1.IUpdateTopicRequest | null | undefined, - {} | null | undefined - >, - ): void; - updateTopic( - request?: protos.google.pubsub.v1.IUpdateTopicRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.pubsub.v1.ITopic, - protos.google.pubsub.v1.IUpdateTopicRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.pubsub.v1.ITopic, - protos.google.pubsub.v1.IUpdateTopicRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.pubsub.v1.ITopic, - protos.google.pubsub.v1.IUpdateTopicRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - 'topic.name': request.topic!.name ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('updateTopic request %j', request); - const wrappedCallback: - | Callback< - protos.google.pubsub.v1.ITopic, - protos.google.pubsub.v1.IUpdateTopicRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateTopic response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .updateTopic(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.pubsub.v1.ITopic, - protos.google.pubsub.v1.IUpdateTopicRequest | undefined, - {} | undefined, - ]) => { - this._log.info('updateTopic response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic - * does not exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.topic - * Required. The messages in the request will be published on this topic. - * Format is `projects/{project}/topics/{topic}`. - * @param {number[]} request.messages - * Required. The messages to publish. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.pubsub.v1.PublishResponse|PublishResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - publish( - request?: protos.google.pubsub.v1.IPublishRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.pubsub.v1.IPublishResponse, - protos.google.pubsub.v1.IPublishRequest | undefined, - {} | undefined, - ] - >; - publish( - request: protos.google.pubsub.v1.IPublishRequest, - options: CallOptions, - callback: Callback< - protos.google.pubsub.v1.IPublishResponse, - protos.google.pubsub.v1.IPublishRequest | null | undefined, - {} | null | undefined - >, - ): void; - publish( - request: protos.google.pubsub.v1.IPublishRequest, - callback: Callback< - protos.google.pubsub.v1.IPublishResponse, - protos.google.pubsub.v1.IPublishRequest | null | undefined, - {} | null | undefined - >, - ): void; - publish( - request?: protos.google.pubsub.v1.IPublishRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.pubsub.v1.IPublishResponse, - protos.google.pubsub.v1.IPublishRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.pubsub.v1.IPublishResponse, - protos.google.pubsub.v1.IPublishRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.pubsub.v1.IPublishResponse, - protos.google.pubsub.v1.IPublishRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - topic: request.topic ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('publish request %j', request); - const wrappedCallback: - | Callback< - protos.google.pubsub.v1.IPublishResponse, - protos.google.pubsub.v1.IPublishRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('publish response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .publish(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.pubsub.v1.IPublishResponse, - protos.google.pubsub.v1.IPublishRequest | undefined, - {} | undefined, - ]) => { - this._log.info('publish response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Gets the configuration of a topic. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.topic - * Required. The name of the topic to get. - * Format is `projects/{project}/topics/{topic}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.pubsub.v1.Topic|Topic}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - getTopic( - request?: protos.google.pubsub.v1.IGetTopicRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.pubsub.v1.ITopic, - protos.google.pubsub.v1.IGetTopicRequest | undefined, - {} | undefined, - ] - >; - getTopic( - request: protos.google.pubsub.v1.IGetTopicRequest, - options: CallOptions, - callback: Callback< - protos.google.pubsub.v1.ITopic, - protos.google.pubsub.v1.IGetTopicRequest | null | undefined, - {} | null | undefined - >, - ): void; - getTopic( - request: protos.google.pubsub.v1.IGetTopicRequest, - callback: Callback< - protos.google.pubsub.v1.ITopic, - protos.google.pubsub.v1.IGetTopicRequest | null | undefined, - {} | null | undefined - >, - ): void; - getTopic( - request?: protos.google.pubsub.v1.IGetTopicRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.pubsub.v1.ITopic, - protos.google.pubsub.v1.IGetTopicRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.pubsub.v1.ITopic, - protos.google.pubsub.v1.IGetTopicRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.pubsub.v1.ITopic, - protos.google.pubsub.v1.IGetTopicRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - topic: request.topic ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('getTopic request %j', request); - const wrappedCallback: - | Callback< - protos.google.pubsub.v1.ITopic, - protos.google.pubsub.v1.IGetTopicRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getTopic response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .getTopic(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.pubsub.v1.ITopic, - protos.google.pubsub.v1.IGetTopicRequest | undefined, - {} | undefined, - ]) => { - this._log.info('getTopic response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Deletes the topic with the given name. Returns `NOT_FOUND` if the topic - * does not exist. After a topic is deleted, a new topic may be created with - * the same name; this is an entirely new topic with none of the old - * configuration or subscriptions. Existing subscriptions to this topic are - * not deleted, but their `topic` field is set to `_deleted-topic_`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.topic - * Required. Name of the topic to delete. - * Format is `projects/{project}/topics/{topic}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - deleteTopic( - request?: protos.google.pubsub.v1.IDeleteTopicRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteTopicRequest | undefined, - {} | undefined, - ] - >; - deleteTopic( - request: protos.google.pubsub.v1.IDeleteTopicRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteTopicRequest | null | undefined, - {} | null | undefined - >, - ): void; - deleteTopic( - request: protos.google.pubsub.v1.IDeleteTopicRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteTopicRequest | null | undefined, - {} | null | undefined - >, - ): void; - deleteTopic( - request?: protos.google.pubsub.v1.IDeleteTopicRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteTopicRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteTopicRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteTopicRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - topic: request.topic ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('deleteTopic request %j', request); - const wrappedCallback: - | Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteTopicRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteTopic response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .deleteTopic(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteTopicRequest | undefined, - {} | undefined, - ]) => { - this._log.info('deleteTopic response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Detaches a subscription from this topic. All messages retained in the - * subscription are dropped. Subsequent `Pull` and `StreamingPull` requests - * will return FAILED_PRECONDITION. If the subscription is a push - * subscription, pushes to the endpoint will stop. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.subscription - * Required. The subscription to detach. - * Format is `projects/{project}/subscriptions/{subscription}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.pubsub.v1.DetachSubscriptionResponse|DetachSubscriptionResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - detachSubscription( - request?: protos.google.pubsub.v1.IDetachSubscriptionRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.pubsub.v1.IDetachSubscriptionResponse, - protos.google.pubsub.v1.IDetachSubscriptionRequest | undefined, - {} | undefined, - ] - >; - detachSubscription( - request: protos.google.pubsub.v1.IDetachSubscriptionRequest, - options: CallOptions, - callback: Callback< - protos.google.pubsub.v1.IDetachSubscriptionResponse, - protos.google.pubsub.v1.IDetachSubscriptionRequest | null | undefined, - {} | null | undefined - >, - ): void; - detachSubscription( - request: protos.google.pubsub.v1.IDetachSubscriptionRequest, - callback: Callback< - protos.google.pubsub.v1.IDetachSubscriptionResponse, - protos.google.pubsub.v1.IDetachSubscriptionRequest | null | undefined, - {} | null | undefined - >, - ): void; - detachSubscription( - request?: protos.google.pubsub.v1.IDetachSubscriptionRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.pubsub.v1.IDetachSubscriptionResponse, - protos.google.pubsub.v1.IDetachSubscriptionRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.pubsub.v1.IDetachSubscriptionResponse, - protos.google.pubsub.v1.IDetachSubscriptionRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.pubsub.v1.IDetachSubscriptionResponse, - protos.google.pubsub.v1.IDetachSubscriptionRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - subscription: request.subscription ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('detachSubscription request %j', request); - const wrappedCallback: - | Callback< - protos.google.pubsub.v1.IDetachSubscriptionResponse, - protos.google.pubsub.v1.IDetachSubscriptionRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('detachSubscription response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .detachSubscription(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.pubsub.v1.IDetachSubscriptionResponse, - protos.google.pubsub.v1.IDetachSubscriptionRequest | undefined, - {} | undefined, - ]) => { - this._log.info('detachSubscription response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - - /** - * Lists matching topics. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.project - * Required. The name of the project in which to list topics. - * Format is `projects/{project-id}`. - * @param {number} [request.pageSize] - * Optional. Maximum number of topics to return. - * @param {string} [request.pageToken] - * Optional. The value returned by the last `ListTopicsResponse`; indicates - * that this is a continuation of a prior `ListTopics` call, and that the - * system should return the next page of data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.pubsub.v1.Topic|Topic}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listTopicsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listTopics( - request?: protos.google.pubsub.v1.IListTopicsRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.pubsub.v1.ITopic[], - protos.google.pubsub.v1.IListTopicsRequest | null, - protos.google.pubsub.v1.IListTopicsResponse, - ] - >; - listTopics( - request: protos.google.pubsub.v1.IListTopicsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.pubsub.v1.IListTopicsRequest, - protos.google.pubsub.v1.IListTopicsResponse | null | undefined, - protos.google.pubsub.v1.ITopic - >, - ): void; - listTopics( - request: protos.google.pubsub.v1.IListTopicsRequest, - callback: PaginationCallback< - protos.google.pubsub.v1.IListTopicsRequest, - protos.google.pubsub.v1.IListTopicsResponse | null | undefined, - protos.google.pubsub.v1.ITopic - >, - ): void; - listTopics( - request?: protos.google.pubsub.v1.IListTopicsRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< - protos.google.pubsub.v1.IListTopicsRequest, - protos.google.pubsub.v1.IListTopicsResponse | null | undefined, - protos.google.pubsub.v1.ITopic - >, - callback?: PaginationCallback< - protos.google.pubsub.v1.IListTopicsRequest, - protos.google.pubsub.v1.IListTopicsResponse | null | undefined, - protos.google.pubsub.v1.ITopic - >, - ): Promise< - [ - protos.google.pubsub.v1.ITopic[], - protos.google.pubsub.v1.IListTopicsRequest | null, - protos.google.pubsub.v1.IListTopicsResponse, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - const wrappedCallback: - | PaginationCallback< - protos.google.pubsub.v1.IListTopicsRequest, - protos.google.pubsub.v1.IListTopicsResponse | null | undefined, - protos.google.pubsub.v1.ITopic - > - | undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listTopics values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listTopics request %j', request); - return this.innerApiCalls - .listTopics(request, options, wrappedCallback) - ?.then( - ([response, input, output]: [ - protos.google.pubsub.v1.ITopic[], - protos.google.pubsub.v1.IListTopicsRequest | null, - protos.google.pubsub.v1.IListTopicsResponse, - ]) => { - this._log.info('listTopics values %j', response); - return [response, input, output]; - }, - ); - } - - /** - * Equivalent to `listTopics`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.project - * Required. The name of the project in which to list topics. - * Format is `projects/{project-id}`. - * @param {number} [request.pageSize] - * Optional. Maximum number of topics to return. - * @param {string} [request.pageToken] - * Optional. The value returned by the last `ListTopicsResponse`; indicates - * that this is a continuation of a prior `ListTopics` call, and that the - * system should return the next page of data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.pubsub.v1.Topic|Topic} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listTopicsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listTopicsStream( - request?: protos.google.pubsub.v1.IListTopicsRequest, - options?: CallOptions, - ): Transform { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - }); - const defaultCallSettings = this._defaults['listTopics']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => { - throw err; - }); - this._log.info('listTopics stream %j', request); - return this.descriptors.page.listTopics.createStream( - this.innerApiCalls.listTopics as GaxCall, - request, - callSettings, - ); - } - - /** - * Equivalent to `listTopics`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.project - * Required. The name of the project in which to list topics. - * Format is `projects/{project-id}`. - * @param {number} [request.pageSize] - * Optional. Maximum number of topics to return. - * @param {string} [request.pageToken] - * Optional. The value returned by the last `ListTopicsResponse`; indicates - * that this is a continuation of a prior `ListTopics` call, and that the - * system should return the next page of data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.pubsub.v1.Topic|Topic}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listTopicsAsync( - request?: protos.google.pubsub.v1.IListTopicsRequest, - options?: CallOptions, - ): AsyncIterable { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - }); - const defaultCallSettings = this._defaults['listTopics']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => { - throw err; - }); - this._log.info('listTopics iterate %j', request); - return this.descriptors.page.listTopics.asyncIterate( - this.innerApiCalls['listTopics'] as GaxCall, - request as {}, - callSettings, - ) as AsyncIterable; - } - /** - * Lists the names of the attached subscriptions on this topic. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.topic - * Required. The name of the topic that subscriptions are attached to. - * Format is `projects/{project}/topics/{topic}`. - * @param {number} [request.pageSize] - * Optional. Maximum number of subscription names to return. - * @param {string} [request.pageToken] - * Optional. The value returned by the last `ListTopicSubscriptionsResponse`; - * indicates that this is a continuation of a prior `ListTopicSubscriptions` - * call, and that the system should return the next page of data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of string. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listTopicSubscriptionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listTopicSubscriptions( - request?: protos.google.pubsub.v1.IListTopicSubscriptionsRequest, - options?: CallOptions, - ): Promise< - [ - string[], - protos.google.pubsub.v1.IListTopicSubscriptionsRequest | null, - protos.google.pubsub.v1.IListTopicSubscriptionsResponse, - ] - >; - listTopicSubscriptions( - request: protos.google.pubsub.v1.IListTopicSubscriptionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.pubsub.v1.IListTopicSubscriptionsRequest, - | protos.google.pubsub.v1.IListTopicSubscriptionsResponse - | null - | undefined, - string - >, - ): void; - listTopicSubscriptions( - request: protos.google.pubsub.v1.IListTopicSubscriptionsRequest, - callback: PaginationCallback< - protos.google.pubsub.v1.IListTopicSubscriptionsRequest, - | protos.google.pubsub.v1.IListTopicSubscriptionsResponse - | null - | undefined, - string - >, - ): void; - listTopicSubscriptions( - request?: protos.google.pubsub.v1.IListTopicSubscriptionsRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< - protos.google.pubsub.v1.IListTopicSubscriptionsRequest, - | protos.google.pubsub.v1.IListTopicSubscriptionsResponse - | null - | undefined, - string - >, - callback?: PaginationCallback< - protos.google.pubsub.v1.IListTopicSubscriptionsRequest, - | protos.google.pubsub.v1.IListTopicSubscriptionsResponse - | null - | undefined, - string - >, - ): Promise< - [ - string[], - protos.google.pubsub.v1.IListTopicSubscriptionsRequest | null, - protos.google.pubsub.v1.IListTopicSubscriptionsResponse, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - topic: request.topic ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - const wrappedCallback: - | PaginationCallback< - protos.google.pubsub.v1.IListTopicSubscriptionsRequest, - | protos.google.pubsub.v1.IListTopicSubscriptionsResponse - | null - | undefined, - string - > - | undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listTopicSubscriptions values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listTopicSubscriptions request %j', request); - return this.innerApiCalls - .listTopicSubscriptions(request, options, wrappedCallback) - ?.then( - ([response, input, output]: [ - string[], - protos.google.pubsub.v1.IListTopicSubscriptionsRequest | null, - protos.google.pubsub.v1.IListTopicSubscriptionsResponse, - ]) => { - this._log.info('listTopicSubscriptions values %j', response); - return [response, input, output]; - }, - ); - } - - /** - * Equivalent to `listTopicSubscriptions`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.topic - * Required. The name of the topic that subscriptions are attached to. - * Format is `projects/{project}/topics/{topic}`. - * @param {number} [request.pageSize] - * Optional. Maximum number of subscription names to return. - * @param {string} [request.pageToken] - * Optional. The value returned by the last `ListTopicSubscriptionsResponse`; - * indicates that this is a continuation of a prior `ListTopicSubscriptions` - * call, and that the system should return the next page of data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing string on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listTopicSubscriptionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listTopicSubscriptionsStream( - request?: protos.google.pubsub.v1.IListTopicSubscriptionsRequest, - options?: CallOptions, - ): Transform { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - topic: request.topic ?? '', - }); - const defaultCallSettings = this._defaults['listTopicSubscriptions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => { - throw err; - }); - this._log.info('listTopicSubscriptions stream %j', request); - return this.descriptors.page.listTopicSubscriptions.createStream( - this.innerApiCalls.listTopicSubscriptions as GaxCall, - request, - callSettings, - ); - } - - /** - * Equivalent to `listTopicSubscriptions`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.topic - * Required. The name of the topic that subscriptions are attached to. - * Format is `projects/{project}/topics/{topic}`. - * @param {number} [request.pageSize] - * Optional. Maximum number of subscription names to return. - * @param {string} [request.pageToken] - * Optional. The value returned by the last `ListTopicSubscriptionsResponse`; - * indicates that this is a continuation of a prior `ListTopicSubscriptions` - * call, and that the system should return the next page of data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * string. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listTopicSubscriptionsAsync( - request?: protos.google.pubsub.v1.IListTopicSubscriptionsRequest, - options?: CallOptions, - ): AsyncIterable { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - topic: request.topic ?? '', - }); - const defaultCallSettings = this._defaults['listTopicSubscriptions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => { - throw err; - }); - this._log.info('listTopicSubscriptions iterate %j', request); - return this.descriptors.page.listTopicSubscriptions.asyncIterate( - this.innerApiCalls['listTopicSubscriptions'] as GaxCall, - request as {}, - callSettings, - ) as AsyncIterable; - } - /** - * Lists the names of the snapshots on this topic. Snapshots are used in - * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, - * which allow you to manage message acknowledgments in bulk. That is, you can - * set the acknowledgment state of messages in an existing subscription to the - * state captured by a snapshot. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.topic - * Required. The name of the topic that snapshots are attached to. - * Format is `projects/{project}/topics/{topic}`. - * @param {number} [request.pageSize] - * Optional. Maximum number of snapshot names to return. - * @param {string} [request.pageToken] - * Optional. The value returned by the last `ListTopicSnapshotsResponse`; - * indicates that this is a continuation of a prior `ListTopicSnapshots` call, - * and that the system should return the next page of data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of string. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listTopicSnapshotsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listTopicSnapshots( - request?: protos.google.pubsub.v1.IListTopicSnapshotsRequest, - options?: CallOptions, - ): Promise< - [ - string[], - protos.google.pubsub.v1.IListTopicSnapshotsRequest | null, - protos.google.pubsub.v1.IListTopicSnapshotsResponse, - ] - >; - listTopicSnapshots( - request: protos.google.pubsub.v1.IListTopicSnapshotsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.pubsub.v1.IListTopicSnapshotsRequest, - protos.google.pubsub.v1.IListTopicSnapshotsResponse | null | undefined, - string - >, - ): void; - listTopicSnapshots( - request: protos.google.pubsub.v1.IListTopicSnapshotsRequest, - callback: PaginationCallback< - protos.google.pubsub.v1.IListTopicSnapshotsRequest, - protos.google.pubsub.v1.IListTopicSnapshotsResponse | null | undefined, - string - >, - ): void; - listTopicSnapshots( - request?: protos.google.pubsub.v1.IListTopicSnapshotsRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< - protos.google.pubsub.v1.IListTopicSnapshotsRequest, - | protos.google.pubsub.v1.IListTopicSnapshotsResponse - | null - | undefined, - string - >, - callback?: PaginationCallback< - protos.google.pubsub.v1.IListTopicSnapshotsRequest, - protos.google.pubsub.v1.IListTopicSnapshotsResponse | null | undefined, - string - >, - ): Promise< - [ - string[], - protos.google.pubsub.v1.IListTopicSnapshotsRequest | null, - protos.google.pubsub.v1.IListTopicSnapshotsResponse, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - topic: request.topic ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - const wrappedCallback: - | PaginationCallback< - protos.google.pubsub.v1.IListTopicSnapshotsRequest, - | protos.google.pubsub.v1.IListTopicSnapshotsResponse - | null - | undefined, - string - > - | undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listTopicSnapshots values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listTopicSnapshots request %j', request); - return this.innerApiCalls - .listTopicSnapshots(request, options, wrappedCallback) - ?.then( - ([response, input, output]: [ - string[], - protos.google.pubsub.v1.IListTopicSnapshotsRequest | null, - protos.google.pubsub.v1.IListTopicSnapshotsResponse, - ]) => { - this._log.info('listTopicSnapshots values %j', response); - return [response, input, output]; - }, - ); - } - - /** - * Equivalent to `listTopicSnapshots`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.topic - * Required. The name of the topic that snapshots are attached to. - * Format is `projects/{project}/topics/{topic}`. - * @param {number} [request.pageSize] - * Optional. Maximum number of snapshot names to return. - * @param {string} [request.pageToken] - * Optional. The value returned by the last `ListTopicSnapshotsResponse`; - * indicates that this is a continuation of a prior `ListTopicSnapshots` call, - * and that the system should return the next page of data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing string on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listTopicSnapshotsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listTopicSnapshotsStream( - request?: protos.google.pubsub.v1.IListTopicSnapshotsRequest, - options?: CallOptions, - ): Transform { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - topic: request.topic ?? '', - }); - const defaultCallSettings = this._defaults['listTopicSnapshots']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => { - throw err; - }); - this._log.info('listTopicSnapshots stream %j', request); - return this.descriptors.page.listTopicSnapshots.createStream( - this.innerApiCalls.listTopicSnapshots as GaxCall, - request, - callSettings, - ); - } - - /** - * Equivalent to `listTopicSnapshots`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.topic - * Required. The name of the topic that snapshots are attached to. - * Format is `projects/{project}/topics/{topic}`. - * @param {number} [request.pageSize] - * Optional. Maximum number of snapshot names to return. - * @param {string} [request.pageToken] - * Optional. The value returned by the last `ListTopicSnapshotsResponse`; - * indicates that this is a continuation of a prior `ListTopicSnapshots` call, - * and that the system should return the next page of data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * string. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listTopicSnapshotsAsync( - request?: protos.google.pubsub.v1.IListTopicSnapshotsRequest, - options?: CallOptions, - ): AsyncIterable { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - topic: request.topic ?? '', - }); - const defaultCallSettings = this._defaults['listTopicSnapshots']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => { - throw err; - }); - this._log.info('listTopicSnapshots iterate %j', request); - return this.descriptors.page.listTopicSnapshots.asyncIterate( - this.innerApiCalls['listTopicSnapshots'] as GaxCall, - request as {}, - callSettings, - ) as AsyncIterable; - } - /** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - ): Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.getIamPolicy(request, options, callback); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - ): Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified cryptoKey resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} crypto_key - * @returns {string} Resource name string. - */ - cryptoKeyPath( - project: string, - location: string, - keyRing: string, - cryptoKey: string, - ) { - return this.pathTemplates.cryptoKeyPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - crypto_key: cryptoKey, - }); - } - - /** - * Parse the project from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) - .project; - } - - /** - * Parse the location from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) - .location; - } - - /** - * Parse the key_ring from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) - .key_ring; - } - - /** - * Parse the crypto_key from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the crypto_key. - */ - matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) - .crypto_key; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project: string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectTopics resource name string. - * - * @param {string} project - * @param {string} topic - * @returns {string} Resource name string. - */ - projectTopicsPath(project: string, topic: string) { - return this.pathTemplates.projectTopicsPathTemplate.render({ - project: project, - topic: topic, - }); - } - - /** - * Parse the project from ProjectTopics resource. - * - * @param {string} projectTopicsName - * A fully-qualified path representing project_topics resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectTopicsName(projectTopicsName: string) { - return this.pathTemplates.projectTopicsPathTemplate.match(projectTopicsName) - .project; - } - - /** - * Parse the topic from ProjectTopics resource. - * - * @param {string} projectTopicsName - * A fully-qualified path representing project_topics resource. - * @returns {string} A string representing the topic. - */ - matchTopicFromProjectTopicsName(projectTopicsName: string) { - return this.pathTemplates.projectTopicsPathTemplate.match(projectTopicsName) - .topic; - } - - /** - * Return a fully-qualified schema resource name string. - * - * @param {string} project - * @param {string} schema - * @returns {string} Resource name string. - */ - schemaPath(project: string, schema: string) { - return this.pathTemplates.schemaPathTemplate.render({ - project: project, - schema: schema, - }); - } - - /** - * Parse the project from Schema resource. - * - * @param {string} schemaName - * A fully-qualified path representing Schema resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSchemaName(schemaName: string) { - return this.pathTemplates.schemaPathTemplate.match(schemaName).project; - } - - /** - * Parse the schema from Schema resource. - * - * @param {string} schemaName - * A fully-qualified path representing Schema resource. - * @returns {string} A string representing the schema. - */ - matchSchemaFromSchemaName(schemaName: string) { - return this.pathTemplates.schemaPathTemplate.match(schemaName).schema; - } - - /** - * Return a fully-qualified snapshot resource name string. - * - * @param {string} project - * @param {string} snapshot - * @returns {string} Resource name string. - */ - snapshotPath(project: string, snapshot: string) { - return this.pathTemplates.snapshotPathTemplate.render({ - project: project, - snapshot: snapshot, - }); - } - - /** - * Parse the project from Snapshot resource. - * - * @param {string} snapshotName - * A fully-qualified path representing Snapshot resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSnapshotName(snapshotName: string) { - return this.pathTemplates.snapshotPathTemplate.match(snapshotName).project; - } - - /** - * Parse the snapshot from Snapshot resource. - * - * @param {string} snapshotName - * A fully-qualified path representing Snapshot resource. - * @returns {string} A string representing the snapshot. - */ - matchSnapshotFromSnapshotName(snapshotName: string) { - return this.pathTemplates.snapshotPathTemplate.match(snapshotName).snapshot; - } - - /** - * Return a fully-qualified subscription resource name string. - * - * @param {string} project - * @param {string} subscription - * @returns {string} Resource name string. - */ - subscriptionPath(project: string, subscription: string) { - return this.pathTemplates.subscriptionPathTemplate.render({ - project: project, - subscription: subscription, - }); - } - - /** - * Parse the project from Subscription resource. - * - * @param {string} subscriptionName - * A fully-qualified path representing Subscription resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSubscriptionName(subscriptionName: string) { - return this.pathTemplates.subscriptionPathTemplate.match(subscriptionName) - .project; - } - - /** - * Parse the subscription from Subscription resource. - * - * @param {string} subscriptionName - * A fully-qualified path representing Subscription resource. - * @returns {string} A string representing the subscription. - */ - matchSubscriptionFromSubscriptionName(subscriptionName: string) { - return this.pathTemplates.subscriptionPathTemplate.match(subscriptionName) - .subscription; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.publisherStub && !this._terminated) { - return this.publisherStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.iamClient.close().catch(err => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/handwritten/pubsub/src/v1/publisher_proto_list.json b/handwritten/pubsub/src/v1/publisher_proto_list.json deleted file mode 100644 index 91011aec1502..000000000000 --- a/handwritten/pubsub/src/v1/publisher_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/pubsub/v1/pubsub.proto", - "../../protos/google/pubsub/v1/schema.proto" -] diff --git a/handwritten/pubsub/src/v1/schema_service_client.ts b/handwritten/pubsub/src/v1/schema_service_client.ts deleted file mode 100644 index 26fd77579309..000000000000 --- a/handwritten/pubsub/src/v1/schema_service_client.ts +++ /dev/null @@ -1,2235 +0,0 @@ -// Copyright 2026 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - PaginationCallback, - GaxCall, - IamClient, - IamProtos, -} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/schema_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './schema_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for doing schema-related operations. - * @class - * @memberof v1 - */ -export class SchemaServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('pubsub'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - schemaServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of SchemaServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SchemaServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SchemaServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'pubsub.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}', - ), - projectTopicsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/topics/{topic}', - ), - schemaPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/schemas/{schema}', - ), - snapshotPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/snapshots/{snapshot}', - ), - subscriptionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/subscriptions/{subscription}', - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listSchemas: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'schemas', - ), - listSchemaRevisions: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'schemas', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.pubsub.v1.SchemaService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - {'x-goog-api-client': clientHeader.join(' ')}, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.schemaServiceStub) { - return this.schemaServiceStub; - } - - // Put together the "service stub" for - // google.pubsub.v1.SchemaService. - this.schemaServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.pubsub.v1.SchemaService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.pubsub.v1.SchemaService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const schemaServiceStubMethods = [ - 'createSchema', - 'getSchema', - 'listSchemas', - 'listSchemaRevisions', - 'commitSchema', - 'rollbackSchema', - 'deleteSchemaRevision', - 'deleteSchema', - 'validateSchema', - 'validateMessage', - ]; - for (const methodName of schemaServiceStubMethods) { - const callPromise = this.schemaServiceStub.then( - stub => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - }, - ); - - const descriptor = this.descriptors.page[methodName] || undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback, - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.schemaServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'pubsub.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'pubsub.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/pubsub', - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * Creates a schema. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project in which to create the schema. - * Format is `projects/{project-id}`. - * @param {google.pubsub.v1.Schema} request.schema - * Required. The schema object to create. - * - * This schema's `name` parameter is ignored. The schema object returned - * by CreateSchema will have a `name` made using the given `parent` and - * `schema_id`. - * @param {string} request.schemaId - * The ID to use for the schema, which will become the final component of - * the schema's resource name. - * - * See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for - * resource name constraints. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.pubsub.v1.Schema|Schema}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - createSchema( - request?: protos.google.pubsub.v1.ICreateSchemaRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.ICreateSchemaRequest | undefined, - {} | undefined, - ] - >; - createSchema( - request: protos.google.pubsub.v1.ICreateSchemaRequest, - options: CallOptions, - callback: Callback< - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.ICreateSchemaRequest | null | undefined, - {} | null | undefined - >, - ): void; - createSchema( - request: protos.google.pubsub.v1.ICreateSchemaRequest, - callback: Callback< - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.ICreateSchemaRequest | null | undefined, - {} | null | undefined - >, - ): void; - createSchema( - request?: protos.google.pubsub.v1.ICreateSchemaRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.ICreateSchemaRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.ICreateSchemaRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.ICreateSchemaRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('createSchema request %j', request); - const wrappedCallback: - | Callback< - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.ICreateSchemaRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createSchema response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .createSchema(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.ICreateSchemaRequest | undefined, - {} | undefined, - ]) => { - this._log.info('createSchema response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Gets a schema. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the schema to get. - * Format is `projects/{project}/schemas/{schema}`. - * @param {google.pubsub.v1.SchemaView} request.view - * The set of fields to return in the response. If not set, returns a Schema - * with all fields filled out. Set to `BASIC` to omit the `definition`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.pubsub.v1.Schema|Schema}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - getSchema( - request?: protos.google.pubsub.v1.IGetSchemaRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.IGetSchemaRequest | undefined, - {} | undefined, - ] - >; - getSchema( - request: protos.google.pubsub.v1.IGetSchemaRequest, - options: CallOptions, - callback: Callback< - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.IGetSchemaRequest | null | undefined, - {} | null | undefined - >, - ): void; - getSchema( - request: protos.google.pubsub.v1.IGetSchemaRequest, - callback: Callback< - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.IGetSchemaRequest | null | undefined, - {} | null | undefined - >, - ): void; - getSchema( - request?: protos.google.pubsub.v1.IGetSchemaRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.IGetSchemaRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.IGetSchemaRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.IGetSchemaRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('getSchema request %j', request); - const wrappedCallback: - | Callback< - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.IGetSchemaRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getSchema response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .getSchema(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.IGetSchemaRequest | undefined, - {} | undefined, - ]) => { - this._log.info('getSchema response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Commits a new schema revision to an existing schema. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the schema we are revising. - * Format is `projects/{project}/schemas/{schema}`. - * @param {google.pubsub.v1.Schema} request.schema - * Required. The schema revision to commit. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.pubsub.v1.Schema|Schema}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - commitSchema( - request?: protos.google.pubsub.v1.ICommitSchemaRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.ICommitSchemaRequest | undefined, - {} | undefined, - ] - >; - commitSchema( - request: protos.google.pubsub.v1.ICommitSchemaRequest, - options: CallOptions, - callback: Callback< - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.ICommitSchemaRequest | null | undefined, - {} | null | undefined - >, - ): void; - commitSchema( - request: protos.google.pubsub.v1.ICommitSchemaRequest, - callback: Callback< - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.ICommitSchemaRequest | null | undefined, - {} | null | undefined - >, - ): void; - commitSchema( - request?: protos.google.pubsub.v1.ICommitSchemaRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.ICommitSchemaRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.ICommitSchemaRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.ICommitSchemaRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('commitSchema request %j', request); - const wrappedCallback: - | Callback< - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.ICommitSchemaRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('commitSchema response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .commitSchema(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.ICommitSchemaRequest | undefined, - {} | undefined, - ]) => { - this._log.info('commitSchema response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Creates a new schema revision that is a copy of the provided revision_id. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The schema being rolled back with revision id. - * @param {string} request.revisionId - * Required. The revision ID to roll back to. - * It must be a revision of the same schema. - * - * Example: c7cfa2a8 - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.pubsub.v1.Schema|Schema}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - rollbackSchema( - request?: protos.google.pubsub.v1.IRollbackSchemaRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.IRollbackSchemaRequest | undefined, - {} | undefined, - ] - >; - rollbackSchema( - request: protos.google.pubsub.v1.IRollbackSchemaRequest, - options: CallOptions, - callback: Callback< - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.IRollbackSchemaRequest | null | undefined, - {} | null | undefined - >, - ): void; - rollbackSchema( - request: protos.google.pubsub.v1.IRollbackSchemaRequest, - callback: Callback< - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.IRollbackSchemaRequest | null | undefined, - {} | null | undefined - >, - ): void; - rollbackSchema( - request?: protos.google.pubsub.v1.IRollbackSchemaRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.IRollbackSchemaRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.IRollbackSchemaRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.IRollbackSchemaRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('rollbackSchema request %j', request); - const wrappedCallback: - | Callback< - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.IRollbackSchemaRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('rollbackSchema response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .rollbackSchema(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.IRollbackSchemaRequest | undefined, - {} | undefined, - ]) => { - this._log.info('rollbackSchema response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Deletes a specific schema revision. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the schema revision to be deleted, with a revision ID - * explicitly included. - * - * Example: `projects/123/schemas/my-schema@c7cfa2a8` - * @param {string} [request.revisionId] - * Optional. This field is deprecated and should not be used for specifying - * the revision ID. The revision ID should be specified via the `name` - * parameter. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.pubsub.v1.Schema|Schema}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - deleteSchemaRevision( - request?: protos.google.pubsub.v1.IDeleteSchemaRevisionRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.IDeleteSchemaRevisionRequest | undefined, - {} | undefined, - ] - >; - deleteSchemaRevision( - request: protos.google.pubsub.v1.IDeleteSchemaRevisionRequest, - options: CallOptions, - callback: Callback< - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.IDeleteSchemaRevisionRequest | null | undefined, - {} | null | undefined - >, - ): void; - deleteSchemaRevision( - request: protos.google.pubsub.v1.IDeleteSchemaRevisionRequest, - callback: Callback< - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.IDeleteSchemaRevisionRequest | null | undefined, - {} | null | undefined - >, - ): void; - deleteSchemaRevision( - request?: protos.google.pubsub.v1.IDeleteSchemaRevisionRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.pubsub.v1.ISchema, - | protos.google.pubsub.v1.IDeleteSchemaRevisionRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.IDeleteSchemaRevisionRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.IDeleteSchemaRevisionRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('deleteSchemaRevision request %j', request); - const wrappedCallback: - | Callback< - protos.google.pubsub.v1.ISchema, - | protos.google.pubsub.v1.IDeleteSchemaRevisionRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteSchemaRevision response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .deleteSchemaRevision(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.pubsub.v1.ISchema, - protos.google.pubsub.v1.IDeleteSchemaRevisionRequest | undefined, - {} | undefined, - ]) => { - this._log.info('deleteSchemaRevision response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Deletes a schema. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the schema to delete. - * Format is `projects/{project}/schemas/{schema}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - deleteSchema( - request?: protos.google.pubsub.v1.IDeleteSchemaRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteSchemaRequest | undefined, - {} | undefined, - ] - >; - deleteSchema( - request: protos.google.pubsub.v1.IDeleteSchemaRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteSchemaRequest | null | undefined, - {} | null | undefined - >, - ): void; - deleteSchema( - request: protos.google.pubsub.v1.IDeleteSchemaRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteSchemaRequest | null | undefined, - {} | null | undefined - >, - ): void; - deleteSchema( - request?: protos.google.pubsub.v1.IDeleteSchemaRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteSchemaRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteSchemaRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteSchemaRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('deleteSchema request %j', request); - const wrappedCallback: - | Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteSchemaRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteSchema response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .deleteSchema(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteSchemaRequest | undefined, - {} | undefined, - ]) => { - this._log.info('deleteSchema response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Validates a schema. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project in which to validate schemas. - * Format is `projects/{project-id}`. - * @param {google.pubsub.v1.Schema} request.schema - * Required. The schema object to validate. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.pubsub.v1.ValidateSchemaResponse|ValidateSchemaResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - validateSchema( - request?: protos.google.pubsub.v1.IValidateSchemaRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.pubsub.v1.IValidateSchemaResponse, - protos.google.pubsub.v1.IValidateSchemaRequest | undefined, - {} | undefined, - ] - >; - validateSchema( - request: protos.google.pubsub.v1.IValidateSchemaRequest, - options: CallOptions, - callback: Callback< - protos.google.pubsub.v1.IValidateSchemaResponse, - protos.google.pubsub.v1.IValidateSchemaRequest | null | undefined, - {} | null | undefined - >, - ): void; - validateSchema( - request: protos.google.pubsub.v1.IValidateSchemaRequest, - callback: Callback< - protos.google.pubsub.v1.IValidateSchemaResponse, - protos.google.pubsub.v1.IValidateSchemaRequest | null | undefined, - {} | null | undefined - >, - ): void; - validateSchema( - request?: protos.google.pubsub.v1.IValidateSchemaRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.pubsub.v1.IValidateSchemaResponse, - protos.google.pubsub.v1.IValidateSchemaRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.pubsub.v1.IValidateSchemaResponse, - protos.google.pubsub.v1.IValidateSchemaRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.pubsub.v1.IValidateSchemaResponse, - protos.google.pubsub.v1.IValidateSchemaRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('validateSchema request %j', request); - const wrappedCallback: - | Callback< - protos.google.pubsub.v1.IValidateSchemaResponse, - protos.google.pubsub.v1.IValidateSchemaRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('validateSchema response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .validateSchema(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.pubsub.v1.IValidateSchemaResponse, - protos.google.pubsub.v1.IValidateSchemaRequest | undefined, - {} | undefined, - ]) => { - this._log.info('validateSchema response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Validates a message against a schema. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project in which to validate schemas. - * Format is `projects/{project-id}`. - * @param {string} request.name - * Name of the schema against which to validate. - * - * Format is `projects/{project}/schemas/{schema}`. - * @param {google.pubsub.v1.Schema} request.schema - * Ad-hoc schema against which to validate - * @param {Buffer} request.message - * Message to validate against the provided `schema_spec`. - * @param {google.pubsub.v1.Encoding} request.encoding - * The encoding expected for messages - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.pubsub.v1.ValidateMessageResponse|ValidateMessageResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - validateMessage( - request?: protos.google.pubsub.v1.IValidateMessageRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.pubsub.v1.IValidateMessageResponse, - protos.google.pubsub.v1.IValidateMessageRequest | undefined, - {} | undefined, - ] - >; - validateMessage( - request: protos.google.pubsub.v1.IValidateMessageRequest, - options: CallOptions, - callback: Callback< - protos.google.pubsub.v1.IValidateMessageResponse, - protos.google.pubsub.v1.IValidateMessageRequest | null | undefined, - {} | null | undefined - >, - ): void; - validateMessage( - request: protos.google.pubsub.v1.IValidateMessageRequest, - callback: Callback< - protos.google.pubsub.v1.IValidateMessageResponse, - protos.google.pubsub.v1.IValidateMessageRequest | null | undefined, - {} | null | undefined - >, - ): void; - validateMessage( - request?: protos.google.pubsub.v1.IValidateMessageRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.pubsub.v1.IValidateMessageResponse, - protos.google.pubsub.v1.IValidateMessageRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.pubsub.v1.IValidateMessageResponse, - protos.google.pubsub.v1.IValidateMessageRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.pubsub.v1.IValidateMessageResponse, - protos.google.pubsub.v1.IValidateMessageRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('validateMessage request %j', request); - const wrappedCallback: - | Callback< - protos.google.pubsub.v1.IValidateMessageResponse, - protos.google.pubsub.v1.IValidateMessageRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('validateMessage response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .validateMessage(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.pubsub.v1.IValidateMessageResponse, - protos.google.pubsub.v1.IValidateMessageRequest | undefined, - {} | undefined, - ]) => { - this._log.info('validateMessage response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - - /** - * Lists schemas in a project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project in which to list schemas. - * Format is `projects/{project-id}`. - * @param {google.pubsub.v1.SchemaView} request.view - * The set of Schema fields to return in the response. If not set, returns - * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to - * retrieve all fields. - * @param {number} request.pageSize - * Maximum number of schemas to return. - * @param {string} request.pageToken - * The value returned by the last `ListSchemasResponse`; indicates that - * this is a continuation of a prior `ListSchemas` call, and that the - * system should return the next page of data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.pubsub.v1.Schema|Schema}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSchemasAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listSchemas( - request?: protos.google.pubsub.v1.IListSchemasRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.pubsub.v1.ISchema[], - protos.google.pubsub.v1.IListSchemasRequest | null, - protos.google.pubsub.v1.IListSchemasResponse, - ] - >; - listSchemas( - request: protos.google.pubsub.v1.IListSchemasRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.pubsub.v1.IListSchemasRequest, - protos.google.pubsub.v1.IListSchemasResponse | null | undefined, - protos.google.pubsub.v1.ISchema - >, - ): void; - listSchemas( - request: protos.google.pubsub.v1.IListSchemasRequest, - callback: PaginationCallback< - protos.google.pubsub.v1.IListSchemasRequest, - protos.google.pubsub.v1.IListSchemasResponse | null | undefined, - protos.google.pubsub.v1.ISchema - >, - ): void; - listSchemas( - request?: protos.google.pubsub.v1.IListSchemasRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< - protos.google.pubsub.v1.IListSchemasRequest, - protos.google.pubsub.v1.IListSchemasResponse | null | undefined, - protos.google.pubsub.v1.ISchema - >, - callback?: PaginationCallback< - protos.google.pubsub.v1.IListSchemasRequest, - protos.google.pubsub.v1.IListSchemasResponse | null | undefined, - protos.google.pubsub.v1.ISchema - >, - ): Promise< - [ - protos.google.pubsub.v1.ISchema[], - protos.google.pubsub.v1.IListSchemasRequest | null, - protos.google.pubsub.v1.IListSchemasResponse, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - const wrappedCallback: - | PaginationCallback< - protos.google.pubsub.v1.IListSchemasRequest, - protos.google.pubsub.v1.IListSchemasResponse | null | undefined, - protos.google.pubsub.v1.ISchema - > - | undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listSchemas values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listSchemas request %j', request); - return this.innerApiCalls - .listSchemas(request, options, wrappedCallback) - ?.then( - ([response, input, output]: [ - protos.google.pubsub.v1.ISchema[], - protos.google.pubsub.v1.IListSchemasRequest | null, - protos.google.pubsub.v1.IListSchemasResponse, - ]) => { - this._log.info('listSchemas values %j', response); - return [response, input, output]; - }, - ); - } - - /** - * Equivalent to `listSchemas`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project in which to list schemas. - * Format is `projects/{project-id}`. - * @param {google.pubsub.v1.SchemaView} request.view - * The set of Schema fields to return in the response. If not set, returns - * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to - * retrieve all fields. - * @param {number} request.pageSize - * Maximum number of schemas to return. - * @param {string} request.pageToken - * The value returned by the last `ListSchemasResponse`; indicates that - * this is a continuation of a prior `ListSchemas` call, and that the - * system should return the next page of data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.pubsub.v1.Schema|Schema} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listSchemasAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listSchemasStream( - request?: protos.google.pubsub.v1.IListSchemasRequest, - options?: CallOptions, - ): Transform { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSchemas']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => { - throw err; - }); - this._log.info('listSchemas stream %j', request); - return this.descriptors.page.listSchemas.createStream( - this.innerApiCalls.listSchemas as GaxCall, - request, - callSettings, - ); - } - - /** - * Equivalent to `listSchemas`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project in which to list schemas. - * Format is `projects/{project-id}`. - * @param {google.pubsub.v1.SchemaView} request.view - * The set of Schema fields to return in the response. If not set, returns - * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to - * retrieve all fields. - * @param {number} request.pageSize - * Maximum number of schemas to return. - * @param {string} request.pageToken - * The value returned by the last `ListSchemasResponse`; indicates that - * this is a continuation of a prior `ListSchemas` call, and that the - * system should return the next page of data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.pubsub.v1.Schema|Schema}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listSchemasAsync( - request?: protos.google.pubsub.v1.IListSchemasRequest, - options?: CallOptions, - ): AsyncIterable { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSchemas']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => { - throw err; - }); - this._log.info('listSchemas iterate %j', request); - return this.descriptors.page.listSchemas.asyncIterate( - this.innerApiCalls['listSchemas'] as GaxCall, - request as {}, - callSettings, - ) as AsyncIterable; - } - /** - * Lists all schema revisions for the named schema. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the schema to list revisions for. - * @param {google.pubsub.v1.SchemaView} request.view - * The set of Schema fields to return in the response. If not set, returns - * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to - * retrieve all fields. - * @param {number} request.pageSize - * The maximum number of revisions to return per page. - * @param {string} request.pageToken - * The page token, received from a previous ListSchemaRevisions call. - * Provide this to retrieve the subsequent page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.pubsub.v1.Schema|Schema}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSchemaRevisionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listSchemaRevisions( - request?: protos.google.pubsub.v1.IListSchemaRevisionsRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.pubsub.v1.ISchema[], - protos.google.pubsub.v1.IListSchemaRevisionsRequest | null, - protos.google.pubsub.v1.IListSchemaRevisionsResponse, - ] - >; - listSchemaRevisions( - request: protos.google.pubsub.v1.IListSchemaRevisionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.pubsub.v1.IListSchemaRevisionsRequest, - protos.google.pubsub.v1.IListSchemaRevisionsResponse | null | undefined, - protos.google.pubsub.v1.ISchema - >, - ): void; - listSchemaRevisions( - request: protos.google.pubsub.v1.IListSchemaRevisionsRequest, - callback: PaginationCallback< - protos.google.pubsub.v1.IListSchemaRevisionsRequest, - protos.google.pubsub.v1.IListSchemaRevisionsResponse | null | undefined, - protos.google.pubsub.v1.ISchema - >, - ): void; - listSchemaRevisions( - request?: protos.google.pubsub.v1.IListSchemaRevisionsRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< - protos.google.pubsub.v1.IListSchemaRevisionsRequest, - | protos.google.pubsub.v1.IListSchemaRevisionsResponse - | null - | undefined, - protos.google.pubsub.v1.ISchema - >, - callback?: PaginationCallback< - protos.google.pubsub.v1.IListSchemaRevisionsRequest, - protos.google.pubsub.v1.IListSchemaRevisionsResponse | null | undefined, - protos.google.pubsub.v1.ISchema - >, - ): Promise< - [ - protos.google.pubsub.v1.ISchema[], - protos.google.pubsub.v1.IListSchemaRevisionsRequest | null, - protos.google.pubsub.v1.IListSchemaRevisionsResponse, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - const wrappedCallback: - | PaginationCallback< - protos.google.pubsub.v1.IListSchemaRevisionsRequest, - | protos.google.pubsub.v1.IListSchemaRevisionsResponse - | null - | undefined, - protos.google.pubsub.v1.ISchema - > - | undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listSchemaRevisions values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listSchemaRevisions request %j', request); - return this.innerApiCalls - .listSchemaRevisions(request, options, wrappedCallback) - ?.then( - ([response, input, output]: [ - protos.google.pubsub.v1.ISchema[], - protos.google.pubsub.v1.IListSchemaRevisionsRequest | null, - protos.google.pubsub.v1.IListSchemaRevisionsResponse, - ]) => { - this._log.info('listSchemaRevisions values %j', response); - return [response, input, output]; - }, - ); - } - - /** - * Equivalent to `listSchemaRevisions`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the schema to list revisions for. - * @param {google.pubsub.v1.SchemaView} request.view - * The set of Schema fields to return in the response. If not set, returns - * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to - * retrieve all fields. - * @param {number} request.pageSize - * The maximum number of revisions to return per page. - * @param {string} request.pageToken - * The page token, received from a previous ListSchemaRevisions call. - * Provide this to retrieve the subsequent page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.pubsub.v1.Schema|Schema} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listSchemaRevisionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listSchemaRevisionsStream( - request?: protos.google.pubsub.v1.IListSchemaRevisionsRequest, - options?: CallOptions, - ): Transform { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - const defaultCallSettings = this._defaults['listSchemaRevisions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => { - throw err; - }); - this._log.info('listSchemaRevisions stream %j', request); - return this.descriptors.page.listSchemaRevisions.createStream( - this.innerApiCalls.listSchemaRevisions as GaxCall, - request, - callSettings, - ); - } - - /** - * Equivalent to `listSchemaRevisions`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the schema to list revisions for. - * @param {google.pubsub.v1.SchemaView} request.view - * The set of Schema fields to return in the response. If not set, returns - * Schemas with `name` and `type`, but not `definition`. Set to `FULL` to - * retrieve all fields. - * @param {number} request.pageSize - * The maximum number of revisions to return per page. - * @param {string} request.pageToken - * The page token, received from a previous ListSchemaRevisions call. - * Provide this to retrieve the subsequent page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.pubsub.v1.Schema|Schema}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listSchemaRevisionsAsync( - request?: protos.google.pubsub.v1.IListSchemaRevisionsRequest, - options?: CallOptions, - ): AsyncIterable { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - const defaultCallSettings = this._defaults['listSchemaRevisions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => { - throw err; - }); - this._log.info('listSchemaRevisions iterate %j', request); - return this.descriptors.page.listSchemaRevisions.asyncIterate( - this.innerApiCalls['listSchemaRevisions'] as GaxCall, - request as {}, - callSettings, - ) as AsyncIterable; - } - /** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - ): Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.getIamPolicy(request, options, callback); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - ): Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project: string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectTopics resource name string. - * - * @param {string} project - * @param {string} topic - * @returns {string} Resource name string. - */ - projectTopicsPath(project: string, topic: string) { - return this.pathTemplates.projectTopicsPathTemplate.render({ - project: project, - topic: topic, - }); - } - - /** - * Parse the project from ProjectTopics resource. - * - * @param {string} projectTopicsName - * A fully-qualified path representing project_topics resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectTopicsName(projectTopicsName: string) { - return this.pathTemplates.projectTopicsPathTemplate.match(projectTopicsName) - .project; - } - - /** - * Parse the topic from ProjectTopics resource. - * - * @param {string} projectTopicsName - * A fully-qualified path representing project_topics resource. - * @returns {string} A string representing the topic. - */ - matchTopicFromProjectTopicsName(projectTopicsName: string) { - return this.pathTemplates.projectTopicsPathTemplate.match(projectTopicsName) - .topic; - } - - /** - * Return a fully-qualified schema resource name string. - * - * @param {string} project - * @param {string} schema - * @returns {string} Resource name string. - */ - schemaPath(project: string, schema: string) { - return this.pathTemplates.schemaPathTemplate.render({ - project: project, - schema: schema, - }); - } - - /** - * Parse the project from Schema resource. - * - * @param {string} schemaName - * A fully-qualified path representing Schema resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSchemaName(schemaName: string) { - return this.pathTemplates.schemaPathTemplate.match(schemaName).project; - } - - /** - * Parse the schema from Schema resource. - * - * @param {string} schemaName - * A fully-qualified path representing Schema resource. - * @returns {string} A string representing the schema. - */ - matchSchemaFromSchemaName(schemaName: string) { - return this.pathTemplates.schemaPathTemplate.match(schemaName).schema; - } - - /** - * Return a fully-qualified snapshot resource name string. - * - * @param {string} project - * @param {string} snapshot - * @returns {string} Resource name string. - */ - snapshotPath(project: string, snapshot: string) { - return this.pathTemplates.snapshotPathTemplate.render({ - project: project, - snapshot: snapshot, - }); - } - - /** - * Parse the project from Snapshot resource. - * - * @param {string} snapshotName - * A fully-qualified path representing Snapshot resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSnapshotName(snapshotName: string) { - return this.pathTemplates.snapshotPathTemplate.match(snapshotName).project; - } - - /** - * Parse the snapshot from Snapshot resource. - * - * @param {string} snapshotName - * A fully-qualified path representing Snapshot resource. - * @returns {string} A string representing the snapshot. - */ - matchSnapshotFromSnapshotName(snapshotName: string) { - return this.pathTemplates.snapshotPathTemplate.match(snapshotName).snapshot; - } - - /** - * Return a fully-qualified subscription resource name string. - * - * @param {string} project - * @param {string} subscription - * @returns {string} Resource name string. - */ - subscriptionPath(project: string, subscription: string) { - return this.pathTemplates.subscriptionPathTemplate.render({ - project: project, - subscription: subscription, - }); - } - - /** - * Parse the project from Subscription resource. - * - * @param {string} subscriptionName - * A fully-qualified path representing Subscription resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSubscriptionName(subscriptionName: string) { - return this.pathTemplates.subscriptionPathTemplate.match(subscriptionName) - .project; - } - - /** - * Parse the subscription from Subscription resource. - * - * @param {string} subscriptionName - * A fully-qualified path representing Subscription resource. - * @returns {string} A string representing the subscription. - */ - matchSubscriptionFromSubscriptionName(subscriptionName: string) { - return this.pathTemplates.subscriptionPathTemplate.match(subscriptionName) - .subscription; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.schemaServiceStub && !this._terminated) { - return this.schemaServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.iamClient.close().catch(err => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/handwritten/pubsub/src/v1/schema_service_proto_list.json b/handwritten/pubsub/src/v1/schema_service_proto_list.json deleted file mode 100644 index 91011aec1502..000000000000 --- a/handwritten/pubsub/src/v1/schema_service_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/pubsub/v1/pubsub.proto", - "../../protos/google/pubsub/v1/schema.proto" -] diff --git a/handwritten/pubsub/src/v1/subscriber_client.ts b/handwritten/pubsub/src/v1/subscriber_client.ts deleted file mode 100644 index bee4adc6e953..000000000000 --- a/handwritten/pubsub/src/v1/subscriber_client.ts +++ /dev/null @@ -1,3204 +0,0 @@ -// Copyright 2026 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 -// -// https://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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - PaginationCallback, - GaxCall, - IamClient, - IamProtos, -} from 'google-gax'; -import {Transform, PassThrough} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/subscriber_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './subscriber_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The service that an application uses to manipulate subscriptions and to - * consume messages from a subscription via the `Pull` method or by - * establishing a bi-directional stream using the `StreamingPull` method. - * @class - * @memberof v1 - */ -export class SubscriberClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('pubsub'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - subscriberStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of SubscriberClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SubscriberClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SubscriberClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'pubsub.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}', - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}', - ), - projectTopicsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/topics/{topic}', - ), - schemaPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/schemas/{schema}', - ), - snapshotPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/snapshots/{snapshot}', - ), - subscriptionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/subscriptions/{subscription}', - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listSubscriptions: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'subscriptions', - ), - listSnapshots: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'snapshots', - ), - }; - - // Some of the methods on this service provide streaming responses. - // Provide descriptors for these. - this.descriptors.stream = { - streamingPull: new this._gaxModule.StreamDescriptor( - this._gaxModule.StreamType.BIDI_STREAMING, - !!opts.fallback, - !!opts.gaxServerStreamingRetries, - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.pubsub.v1.Subscriber', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - {'x-goog-api-client': clientHeader.join(' ')}, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.subscriberStub) { - return this.subscriberStub; - } - - // Put together the "service stub" for - // google.pubsub.v1.Subscriber. - this.subscriberStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.pubsub.v1.Subscriber', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.pubsub.v1.Subscriber, - this._opts, - this._providedCustomServicePath, - ) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const subscriberStubMethods = [ - 'createSubscription', - 'getSubscription', - 'updateSubscription', - 'listSubscriptions', - 'deleteSubscription', - 'modifyAckDeadline', - 'acknowledge', - 'pull', - 'streamingPull', - 'modifyPushConfig', - 'getSnapshot', - 'listSnapshots', - 'createSnapshot', - 'updateSnapshot', - 'deleteSnapshot', - 'seek', - ]; - for (const methodName of subscriberStubMethods) { - const callPromise = this.subscriberStub.then( - stub => - (...args: Array<{}>) => { - if (this._terminated) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough({objectMode: true}); - setImmediate(() => { - stream.emit( - 'error', - new this._gaxModule.GoogleError( - 'The client has already been closed.', - ), - ); - }); - return stream; - } - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - }, - ); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.stream[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback, - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.subscriberStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'pubsub.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'pubsub.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/pubsub', - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * Creates a subscription to a given topic. See the [resource name rules] - * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). - * If the subscription already exists, returns `ALREADY_EXISTS`. - * If the corresponding topic doesn't exist, returns `NOT_FOUND`. - * - * If the name is not provided in the request, the server will assign a random - * name for this subscription on the same project as the topic, conforming - * to the [resource name format] - * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The - * generated name is populated in the returned Subscription object. Note that - * for REST API requests, you must specify a name in the request. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Identifier. The name of the subscription. It must have the format - * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must - * start with a letter, and contain only letters (`[A-Za-z]`), numbers - * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), - * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters - * in length, and it must not start with `"goog"`. - * @param {string} request.topic - * Required. The name of the topic from which this subscription is receiving - * messages. Format is `projects/{project}/topics/{topic}`. The value of this - * field will be `_deleted-topic_` if the topic has been deleted. - * @param {google.pubsub.v1.PushConfig} [request.pushConfig] - * Optional. If push delivery is used with this subscription, this field is - * used to configure it. - * @param {google.pubsub.v1.BigQueryConfig} [request.bigqueryConfig] - * Optional. If delivery to BigQuery is used with this subscription, this - * field is used to configure it. - * @param {google.pubsub.v1.CloudStorageConfig} [request.cloudStorageConfig] - * Optional. If delivery to Google Cloud Storage is used with this - * subscription, this field is used to configure it. - * @param {google.pubsub.v1.BigtableConfig} [request.bigtableConfig] - * Optional. If delivery to Bigtable is used with this subscription, this - * field is used to configure it. - * @param {number} [request.ackDeadlineSeconds] - * Optional. The approximate amount of time (on a best-effort basis) Pub/Sub - * waits for the subscriber to acknowledge receipt before resending the - * message. In the interval after the message is delivered and before it is - * acknowledged, it is considered to be _outstanding_. During that time - * period, the message will not be redelivered (on a best-effort basis). - * - * For pull subscriptions, this value is used as the initial value for the ack - * deadline. To override this value for a given message, call - * `ModifyAckDeadline` with the corresponding `ack_id` if using - * non-streaming pull or send the `ack_id` in a - * `StreamingModifyAckDeadlineRequest` if using streaming pull. - * The minimum custom deadline you can specify is 10 seconds. - * The maximum custom deadline you can specify is 600 seconds (10 minutes). - * If this parameter is 0, a default value of 10 seconds is used. - * - * For push delivery, this value is also used to set the request timeout for - * the call to the push endpoint. - * - * If the subscriber never acknowledges the message, the Pub/Sub - * system will eventually redeliver the message. - * @param {boolean} [request.retainAckedMessages] - * Optional. Indicates whether to retain acknowledged messages. If true, then - * messages are not expunged from the subscription's backlog, even if they are - * acknowledged, until they fall out of the `message_retention_duration` - * window. This must be true if you would like to [`Seek` to a timestamp] - * (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) in - * the past to replay previously-acknowledged messages. - * @param {google.protobuf.Duration} [request.messageRetentionDuration] - * Optional. How long to retain unacknowledged messages in the subscription's - * backlog, from the moment a message is published. If `retain_acked_messages` - * is true, then this also configures the retention of acknowledged messages, - * and thus configures how far back in time a `Seek` can be done. Defaults to - * 7 days. Cannot be more than 31 days or less than 10 minutes. - * @param {number[]} [request.labels] - * Optional. See [Creating and managing - * labels](https://cloud.google.com/pubsub/docs/labels). - * @param {boolean} [request.enableMessageOrdering] - * Optional. If true, messages published with the same `ordering_key` in - * `PubsubMessage` will be delivered to the subscribers in the order in which - * they are received by the Pub/Sub system. Otherwise, they may be delivered - * in any order. - * @param {google.pubsub.v1.ExpirationPolicy} [request.expirationPolicy] - * Optional. A policy that specifies the conditions for this subscription's - * expiration. A subscription is considered active as long as any connected - * subscriber is successfully consuming messages from the subscription or is - * issuing operations on the subscription. If `expiration_policy` is not set, - * a *default policy* with `ttl` of 31 days will be used. The minimum allowed - * value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set, - * but `expiration_policy.ttl` is not set, the subscription never expires. - * @param {string} [request.filter] - * Optional. An expression written in the Pub/Sub [filter - * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty, - * then only `PubsubMessage`s whose `attributes` field matches the filter are - * delivered on this subscription. If empty, then no messages are filtered - * out. - * @param {google.pubsub.v1.DeadLetterPolicy} [request.deadLetterPolicy] - * Optional. A policy that specifies the conditions for dead lettering - * messages in this subscription. If dead_letter_policy is not set, dead - * lettering is disabled. - * - * The Pub/Sub service account associated with this subscriptions's - * parent project (i.e., - * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have - * permission to Acknowledge() messages on this subscription. - * @param {google.pubsub.v1.RetryPolicy} [request.retryPolicy] - * Optional. A policy that specifies how Pub/Sub retries message delivery for - * this subscription. - * - * If not set, the default retry policy is applied. This generally implies - * that messages will be retried as soon as possible for healthy subscribers. - * RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded - * events for a given message. - * @param {boolean} [request.detached] - * Optional. Indicates whether the subscription is detached from its topic. - * Detached subscriptions don't receive messages from their topic and don't - * retain any backlog. `Pull` and `StreamingPull` requests will return - * FAILED_PRECONDITION. If the subscription is a push subscription, pushes to - * the endpoint will not be made. - * @param {boolean} [request.enableExactlyOnceDelivery] - * Optional. If true, Pub/Sub provides the following guarantees for the - * delivery of a message with a given value of `message_id` on this - * subscription: - * - * * The message sent to a subscriber is guaranteed not to be resent - * before the message's acknowledgment deadline expires. - * * An acknowledged message will not be resent to a subscriber. - * - * Note that subscribers may still receive multiple copies of a message - * when `enable_exactly_once_delivery` is true if the message was published - * multiple times by a publisher client. These copies are considered distinct - * by Pub/Sub and have distinct `message_id` values. - * @param {google.protobuf.Duration} request.topicMessageRetentionDuration - * Output only. Indicates the minimum duration for which a message is retained - * after it is published to the subscription's topic. If this field is set, - * messages published to the subscription's topic in the last - * `topic_message_retention_duration` are always available to subscribers. See - * the `message_retention_duration` field in `Topic`. This field is set only - * in responses from the server; it is ignored if it is set in any requests. - * @param {google.pubsub.v1.Subscription.State} request.state - * Output only. An output-only field indicating whether or not the - * subscription can receive messages. - * @param {google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo} request.analyticsHubSubscriptionInfo - * Output only. Information about the associated Analytics Hub subscription. - * Only set if the subscription is created by Analytics Hub. - * @param {number[]} [request.messageTransforms] - * Optional. Transforms to be applied to messages before they are delivered to - * subscribers. Transforms are applied in the order specified. - * @param {number[]} request.tags - * Optional. Input only. Immutable. Tag keys/values directly bound to this - * resource. For example: - * "123/environment": "production", - * "123/costCenter": "marketing" - * See https://docs.cloud.google.com/pubsub/docs/tags for more information on - * using tags with Pub/Sub resources. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.pubsub.v1.Subscription|Subscription}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - createSubscription( - request?: protos.google.pubsub.v1.ISubscription, - options?: CallOptions, - ): Promise< - [ - protos.google.pubsub.v1.ISubscription, - protos.google.pubsub.v1.ISubscription | undefined, - {} | undefined, - ] - >; - createSubscription( - request: protos.google.pubsub.v1.ISubscription, - options: CallOptions, - callback: Callback< - protos.google.pubsub.v1.ISubscription, - protos.google.pubsub.v1.ISubscription | null | undefined, - {} | null | undefined - >, - ): void; - createSubscription( - request: protos.google.pubsub.v1.ISubscription, - callback: Callback< - protos.google.pubsub.v1.ISubscription, - protos.google.pubsub.v1.ISubscription | null | undefined, - {} | null | undefined - >, - ): void; - createSubscription( - request?: protos.google.pubsub.v1.ISubscription, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.pubsub.v1.ISubscription, - protos.google.pubsub.v1.ISubscription | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.pubsub.v1.ISubscription, - protos.google.pubsub.v1.ISubscription | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.pubsub.v1.ISubscription, - protos.google.pubsub.v1.ISubscription | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('createSubscription request %j', request); - const wrappedCallback: - | Callback< - protos.google.pubsub.v1.ISubscription, - protos.google.pubsub.v1.ISubscription | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createSubscription response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .createSubscription(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.pubsub.v1.ISubscription, - protos.google.pubsub.v1.ISubscription | undefined, - {} | undefined, - ]) => { - this._log.info('createSubscription response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Gets the configuration details of a subscription. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.subscription - * Required. The name of the subscription to get. - * Format is `projects/{project}/subscriptions/{sub}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.pubsub.v1.Subscription|Subscription}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - getSubscription( - request?: protos.google.pubsub.v1.IGetSubscriptionRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.pubsub.v1.ISubscription, - protos.google.pubsub.v1.IGetSubscriptionRequest | undefined, - {} | undefined, - ] - >; - getSubscription( - request: protos.google.pubsub.v1.IGetSubscriptionRequest, - options: CallOptions, - callback: Callback< - protos.google.pubsub.v1.ISubscription, - protos.google.pubsub.v1.IGetSubscriptionRequest | null | undefined, - {} | null | undefined - >, - ): void; - getSubscription( - request: protos.google.pubsub.v1.IGetSubscriptionRequest, - callback: Callback< - protos.google.pubsub.v1.ISubscription, - protos.google.pubsub.v1.IGetSubscriptionRequest | null | undefined, - {} | null | undefined - >, - ): void; - getSubscription( - request?: protos.google.pubsub.v1.IGetSubscriptionRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.pubsub.v1.ISubscription, - protos.google.pubsub.v1.IGetSubscriptionRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.pubsub.v1.ISubscription, - protos.google.pubsub.v1.IGetSubscriptionRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.pubsub.v1.ISubscription, - protos.google.pubsub.v1.IGetSubscriptionRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - subscription: request.subscription ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('getSubscription request %j', request); - const wrappedCallback: - | Callback< - protos.google.pubsub.v1.ISubscription, - protos.google.pubsub.v1.IGetSubscriptionRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getSubscription response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .getSubscription(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.pubsub.v1.ISubscription, - protos.google.pubsub.v1.IGetSubscriptionRequest | undefined, - {} | undefined, - ]) => { - this._log.info('getSubscription response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Updates an existing subscription by updating the fields specified in the - * update mask. Note that certain properties of a subscription, such as its - * topic, are not modifiable. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.pubsub.v1.Subscription} request.subscription - * Required. The updated subscription object. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Indicates which fields in the provided subscription to update. - * Must be specified and non-empty. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.pubsub.v1.Subscription|Subscription}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - updateSubscription( - request?: protos.google.pubsub.v1.IUpdateSubscriptionRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.pubsub.v1.ISubscription, - protos.google.pubsub.v1.IUpdateSubscriptionRequest | undefined, - {} | undefined, - ] - >; - updateSubscription( - request: protos.google.pubsub.v1.IUpdateSubscriptionRequest, - options: CallOptions, - callback: Callback< - protos.google.pubsub.v1.ISubscription, - protos.google.pubsub.v1.IUpdateSubscriptionRequest | null | undefined, - {} | null | undefined - >, - ): void; - updateSubscription( - request: protos.google.pubsub.v1.IUpdateSubscriptionRequest, - callback: Callback< - protos.google.pubsub.v1.ISubscription, - protos.google.pubsub.v1.IUpdateSubscriptionRequest | null | undefined, - {} | null | undefined - >, - ): void; - updateSubscription( - request?: protos.google.pubsub.v1.IUpdateSubscriptionRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.pubsub.v1.ISubscription, - protos.google.pubsub.v1.IUpdateSubscriptionRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.pubsub.v1.ISubscription, - protos.google.pubsub.v1.IUpdateSubscriptionRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.pubsub.v1.ISubscription, - protos.google.pubsub.v1.IUpdateSubscriptionRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - 'subscription.name': request.subscription!.name ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('updateSubscription request %j', request); - const wrappedCallback: - | Callback< - protos.google.pubsub.v1.ISubscription, - protos.google.pubsub.v1.IUpdateSubscriptionRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateSubscription response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .updateSubscription(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.pubsub.v1.ISubscription, - protos.google.pubsub.v1.IUpdateSubscriptionRequest | undefined, - {} | undefined, - ]) => { - this._log.info('updateSubscription response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Deletes an existing subscription. All messages retained in the subscription - * are immediately dropped. Calls to `Pull` after deletion will return - * `NOT_FOUND`. After a subscription is deleted, a new one may be created with - * the same name, but the new one has no association with the old - * subscription or its topic unless the same topic is specified. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.subscription - * Required. The subscription to delete. - * Format is `projects/{project}/subscriptions/{sub}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - deleteSubscription( - request?: protos.google.pubsub.v1.IDeleteSubscriptionRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteSubscriptionRequest | undefined, - {} | undefined, - ] - >; - deleteSubscription( - request: protos.google.pubsub.v1.IDeleteSubscriptionRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteSubscriptionRequest | null | undefined, - {} | null | undefined - >, - ): void; - deleteSubscription( - request: protos.google.pubsub.v1.IDeleteSubscriptionRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteSubscriptionRequest | null | undefined, - {} | null | undefined - >, - ): void; - deleteSubscription( - request?: protos.google.pubsub.v1.IDeleteSubscriptionRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteSubscriptionRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteSubscriptionRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteSubscriptionRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - subscription: request.subscription ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('deleteSubscription request %j', request); - const wrappedCallback: - | Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteSubscriptionRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteSubscription response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .deleteSubscription(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteSubscriptionRequest | undefined, - {} | undefined, - ]) => { - this._log.info('deleteSubscription response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Modifies the ack deadline for a specific message. This method is useful - * to indicate that more time is needed to process a message by the - * subscriber, or to make the message available for redelivery if the - * processing was interrupted. Note that this does not modify the - * subscription-level `ackDeadlineSeconds` used for subsequent messages. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.subscription - * Required. The name of the subscription. - * Format is `projects/{project}/subscriptions/{sub}`. - * @param {string[]} request.ackIds - * Required. List of acknowledgment IDs. - * @param {number} request.ackDeadlineSeconds - * Required. The new ack deadline with respect to the time this request was - * sent to the Pub/Sub system. For example, if the value is 10, the new ack - * deadline will expire 10 seconds after the `ModifyAckDeadline` call was - * made. Specifying zero might immediately make the message available for - * delivery to another subscriber client. This typically results in an - * increase in the rate of message redeliveries (that is, duplicates). - * The minimum deadline you can specify is 0 seconds. - * The maximum deadline you can specify in a single request is 600 seconds - * (10 minutes). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - modifyAckDeadline( - request?: protos.google.pubsub.v1.IModifyAckDeadlineRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IModifyAckDeadlineRequest | undefined, - {} | undefined, - ] - >; - modifyAckDeadline( - request: protos.google.pubsub.v1.IModifyAckDeadlineRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IModifyAckDeadlineRequest | null | undefined, - {} | null | undefined - >, - ): void; - modifyAckDeadline( - request: protos.google.pubsub.v1.IModifyAckDeadlineRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IModifyAckDeadlineRequest | null | undefined, - {} | null | undefined - >, - ): void; - modifyAckDeadline( - request?: protos.google.pubsub.v1.IModifyAckDeadlineRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IModifyAckDeadlineRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IModifyAckDeadlineRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IModifyAckDeadlineRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - subscription: request.subscription ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('modifyAckDeadline request %j', request); - const wrappedCallback: - | Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IModifyAckDeadlineRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('modifyAckDeadline response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .modifyAckDeadline(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IModifyAckDeadlineRequest | undefined, - {} | undefined, - ]) => { - this._log.info('modifyAckDeadline response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Acknowledges the messages associated with the `ack_ids` in the - * `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages - * from the subscription. - * - * Acknowledging a message whose ack deadline has expired may succeed, - * but such a message may be redelivered later. Acknowledging a message more - * than once will not result in an error. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.subscription - * Required. The subscription whose message is being acknowledged. - * Format is `projects/{project}/subscriptions/{sub}`. - * @param {string[]} request.ackIds - * Required. The acknowledgment ID for the messages being acknowledged that - * was returned by the Pub/Sub system in the `Pull` response. Must not be - * empty. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - acknowledge( - request?: protos.google.pubsub.v1.IAcknowledgeRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IAcknowledgeRequest | undefined, - {} | undefined, - ] - >; - acknowledge( - request: protos.google.pubsub.v1.IAcknowledgeRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IAcknowledgeRequest | null | undefined, - {} | null | undefined - >, - ): void; - acknowledge( - request: protos.google.pubsub.v1.IAcknowledgeRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IAcknowledgeRequest | null | undefined, - {} | null | undefined - >, - ): void; - acknowledge( - request?: protos.google.pubsub.v1.IAcknowledgeRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IAcknowledgeRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IAcknowledgeRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IAcknowledgeRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - subscription: request.subscription ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('acknowledge request %j', request); - const wrappedCallback: - | Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IAcknowledgeRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('acknowledge response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .acknowledge(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IAcknowledgeRequest | undefined, - {} | undefined, - ]) => { - this._log.info('acknowledge response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Pulls messages from the server. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.subscription - * Required. The subscription from which messages should be pulled. - * Format is `projects/{project}/subscriptions/{sub}`. - * @param {boolean} [request.returnImmediately] - * Optional. If this field set to true, the system will respond immediately - * even if it there are no messages available to return in the `Pull` - * response. Otherwise, the system may wait (for a bounded amount of time) - * until at least one message is available, rather than returning no messages. - * Warning: setting this field to `true` is discouraged because it adversely - * impacts the performance of `Pull` operations. We recommend that users do - * not set this field. - * @param {number} request.maxMessages - * Required. The maximum number of messages to return for this request. Must - * be a positive integer. The Pub/Sub system may return fewer than the number - * specified. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.pubsub.v1.PullResponse|PullResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - pull( - request?: protos.google.pubsub.v1.IPullRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.pubsub.v1.IPullResponse, - protos.google.pubsub.v1.IPullRequest | undefined, - {} | undefined, - ] - >; - pull( - request: protos.google.pubsub.v1.IPullRequest, - options: CallOptions, - callback: Callback< - protos.google.pubsub.v1.IPullResponse, - protos.google.pubsub.v1.IPullRequest | null | undefined, - {} | null | undefined - >, - ): void; - pull( - request: protos.google.pubsub.v1.IPullRequest, - callback: Callback< - protos.google.pubsub.v1.IPullResponse, - protos.google.pubsub.v1.IPullRequest | null | undefined, - {} | null | undefined - >, - ): void; - pull( - request?: protos.google.pubsub.v1.IPullRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.pubsub.v1.IPullResponse, - protos.google.pubsub.v1.IPullRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.pubsub.v1.IPullResponse, - protos.google.pubsub.v1.IPullRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.pubsub.v1.IPullResponse, - protos.google.pubsub.v1.IPullRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - subscription: request.subscription ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('pull request %j', request); - const wrappedCallback: - | Callback< - protos.google.pubsub.v1.IPullResponse, - protos.google.pubsub.v1.IPullRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('pull response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .pull(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.pubsub.v1.IPullResponse, - protos.google.pubsub.v1.IPullRequest | undefined, - {} | undefined, - ]) => { - this._log.info('pull response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Modifies the `PushConfig` for a specified subscription. - * - * This may be used to change a push subscription to a pull one (signified by - * an empty `PushConfig`) or vice versa, or change the endpoint URL and other - * attributes of a push subscription. Messages will accumulate for delivery - * continuously through the call regardless of changes to the `PushConfig`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.subscription - * Required. The name of the subscription. - * Format is `projects/{project}/subscriptions/{sub}`. - * @param {google.pubsub.v1.PushConfig} request.pushConfig - * Required. The push configuration for future deliveries. - * - * An empty `pushConfig` indicates that the Pub/Sub system should - * stop pushing messages from the given subscription and allow - * messages to be pulled and acknowledged - effectively pausing - * the subscription if `Pull` or `StreamingPull` is not called. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - modifyPushConfig( - request?: protos.google.pubsub.v1.IModifyPushConfigRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IModifyPushConfigRequest | undefined, - {} | undefined, - ] - >; - modifyPushConfig( - request: protos.google.pubsub.v1.IModifyPushConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IModifyPushConfigRequest | null | undefined, - {} | null | undefined - >, - ): void; - modifyPushConfig( - request: protos.google.pubsub.v1.IModifyPushConfigRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IModifyPushConfigRequest | null | undefined, - {} | null | undefined - >, - ): void; - modifyPushConfig( - request?: protos.google.pubsub.v1.IModifyPushConfigRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IModifyPushConfigRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IModifyPushConfigRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IModifyPushConfigRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - subscription: request.subscription ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('modifyPushConfig request %j', request); - const wrappedCallback: - | Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IModifyPushConfigRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('modifyPushConfig response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .modifyPushConfig(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IModifyPushConfigRequest | undefined, - {} | undefined, - ]) => { - this._log.info('modifyPushConfig response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Gets the configuration details of a snapshot. Snapshots are used in - * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, - * which allow you to manage message acknowledgments in bulk. That is, you can - * set the acknowledgment state of messages in an existing subscription to the - * state captured by a snapshot. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.snapshot - * Required. The name of the snapshot to get. - * Format is `projects/{project}/snapshots/{snap}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.pubsub.v1.Snapshot|Snapshot}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - getSnapshot( - request?: protos.google.pubsub.v1.IGetSnapshotRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.pubsub.v1.ISnapshot, - protos.google.pubsub.v1.IGetSnapshotRequest | undefined, - {} | undefined, - ] - >; - getSnapshot( - request: protos.google.pubsub.v1.IGetSnapshotRequest, - options: CallOptions, - callback: Callback< - protos.google.pubsub.v1.ISnapshot, - protos.google.pubsub.v1.IGetSnapshotRequest | null | undefined, - {} | null | undefined - >, - ): void; - getSnapshot( - request: protos.google.pubsub.v1.IGetSnapshotRequest, - callback: Callback< - protos.google.pubsub.v1.ISnapshot, - protos.google.pubsub.v1.IGetSnapshotRequest | null | undefined, - {} | null | undefined - >, - ): void; - getSnapshot( - request?: protos.google.pubsub.v1.IGetSnapshotRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.pubsub.v1.ISnapshot, - protos.google.pubsub.v1.IGetSnapshotRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.pubsub.v1.ISnapshot, - protos.google.pubsub.v1.IGetSnapshotRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.pubsub.v1.ISnapshot, - protos.google.pubsub.v1.IGetSnapshotRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - snapshot: request.snapshot ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('getSnapshot request %j', request); - const wrappedCallback: - | Callback< - protos.google.pubsub.v1.ISnapshot, - protos.google.pubsub.v1.IGetSnapshotRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getSnapshot response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .getSnapshot(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.pubsub.v1.ISnapshot, - protos.google.pubsub.v1.IGetSnapshotRequest | undefined, - {} | undefined, - ]) => { - this._log.info('getSnapshot response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Creates a snapshot from the requested subscription. Snapshots are used in - * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, - * which allow you to manage message acknowledgments in bulk. That is, you can - * set the acknowledgment state of messages in an existing subscription to the - * state captured by a snapshot. - * If the snapshot already exists, returns `ALREADY_EXISTS`. - * If the requested subscription doesn't exist, returns `NOT_FOUND`. - * If the backlog in the subscription is too old -- and the resulting snapshot - * would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. - * See also the `Snapshot.expire_time` field. If the name is not provided in - * the request, the server will assign a random - * name for this snapshot on the same project as the subscription, conforming - * to the [resource name format] - * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The - * generated name is populated in the returned Snapshot object. Note that for - * REST API requests, you must specify a name in the request. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. User-provided name for this snapshot. If the name is not provided - * in the request, the server will assign a random name for this snapshot on - * the same project as the subscription. Note that for REST API requests, you - * must specify a name. See the [resource name - * rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). - * Format is `projects/{project}/snapshots/{snap}`. - * @param {string} request.subscription - * Required. The subscription whose backlog the snapshot retains. - * Specifically, the created snapshot is guaranteed to retain: - * (a) The existing backlog on the subscription. More precisely, this is - * defined as the messages in the subscription's backlog that are - * unacknowledged upon the successful completion of the - * `CreateSnapshot` request; as well as: - * (b) Any messages published to the subscription's topic following the - * successful completion of the CreateSnapshot request. - * Format is `projects/{project}/subscriptions/{sub}`. - * @param {number[]} [request.labels] - * Optional. See [Creating and managing - * labels](https://cloud.google.com/pubsub/docs/labels). - * @param {number[]} request.tags - * Optional. Input only. Immutable. Tag keys/values directly bound to this - * resource. For example: - * "123/environment": "production", - * "123/costCenter": "marketing" - * See https://docs.cloud.google.com/pubsub/docs/tags for more information on - * using tags with Pub/Sub resources. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.pubsub.v1.Snapshot|Snapshot}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - createSnapshot( - request?: protos.google.pubsub.v1.ICreateSnapshotRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.pubsub.v1.ISnapshot, - protos.google.pubsub.v1.ICreateSnapshotRequest | undefined, - {} | undefined, - ] - >; - createSnapshot( - request: protos.google.pubsub.v1.ICreateSnapshotRequest, - options: CallOptions, - callback: Callback< - protos.google.pubsub.v1.ISnapshot, - protos.google.pubsub.v1.ICreateSnapshotRequest | null | undefined, - {} | null | undefined - >, - ): void; - createSnapshot( - request: protos.google.pubsub.v1.ICreateSnapshotRequest, - callback: Callback< - protos.google.pubsub.v1.ISnapshot, - protos.google.pubsub.v1.ICreateSnapshotRequest | null | undefined, - {} | null | undefined - >, - ): void; - createSnapshot( - request?: protos.google.pubsub.v1.ICreateSnapshotRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.pubsub.v1.ISnapshot, - protos.google.pubsub.v1.ICreateSnapshotRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.pubsub.v1.ISnapshot, - protos.google.pubsub.v1.ICreateSnapshotRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.pubsub.v1.ISnapshot, - protos.google.pubsub.v1.ICreateSnapshotRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('createSnapshot request %j', request); - const wrappedCallback: - | Callback< - protos.google.pubsub.v1.ISnapshot, - protos.google.pubsub.v1.ICreateSnapshotRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createSnapshot response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .createSnapshot(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.pubsub.v1.ISnapshot, - protos.google.pubsub.v1.ICreateSnapshotRequest | undefined, - {} | undefined, - ]) => { - this._log.info('createSnapshot response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Updates an existing snapshot by updating the fields specified in the update - * mask. Snapshots are used in - * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, - * which allow you to manage message acknowledgments in bulk. That is, you can - * set the acknowledgment state of messages in an existing subscription to the - * state captured by a snapshot. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.pubsub.v1.Snapshot} request.snapshot - * Required. The updated snapshot object. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Indicates which fields in the provided snapshot to update. - * Must be specified and non-empty. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.pubsub.v1.Snapshot|Snapshot}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - updateSnapshot( - request?: protos.google.pubsub.v1.IUpdateSnapshotRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.pubsub.v1.ISnapshot, - protos.google.pubsub.v1.IUpdateSnapshotRequest | undefined, - {} | undefined, - ] - >; - updateSnapshot( - request: protos.google.pubsub.v1.IUpdateSnapshotRequest, - options: CallOptions, - callback: Callback< - protos.google.pubsub.v1.ISnapshot, - protos.google.pubsub.v1.IUpdateSnapshotRequest | null | undefined, - {} | null | undefined - >, - ): void; - updateSnapshot( - request: protos.google.pubsub.v1.IUpdateSnapshotRequest, - callback: Callback< - protos.google.pubsub.v1.ISnapshot, - protos.google.pubsub.v1.IUpdateSnapshotRequest | null | undefined, - {} | null | undefined - >, - ): void; - updateSnapshot( - request?: protos.google.pubsub.v1.IUpdateSnapshotRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.pubsub.v1.ISnapshot, - protos.google.pubsub.v1.IUpdateSnapshotRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.pubsub.v1.ISnapshot, - protos.google.pubsub.v1.IUpdateSnapshotRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.pubsub.v1.ISnapshot, - protos.google.pubsub.v1.IUpdateSnapshotRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - 'snapshot.name': request.snapshot!.name ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('updateSnapshot request %j', request); - const wrappedCallback: - | Callback< - protos.google.pubsub.v1.ISnapshot, - protos.google.pubsub.v1.IUpdateSnapshotRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateSnapshot response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .updateSnapshot(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.pubsub.v1.ISnapshot, - protos.google.pubsub.v1.IUpdateSnapshotRequest | undefined, - {} | undefined, - ]) => { - this._log.info('updateSnapshot response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Removes an existing snapshot. Snapshots are used in [Seek] - * (https://cloud.google.com/pubsub/docs/replay-overview) operations, which - * allow you to manage message acknowledgments in bulk. That is, you can set - * the acknowledgment state of messages in an existing subscription to the - * state captured by a snapshot. - * When the snapshot is deleted, all messages retained in the snapshot - * are immediately dropped. After a snapshot is deleted, a new one may be - * created with the same name, but the new one has no association with the old - * snapshot or its subscription, unless the same subscription is specified. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.snapshot - * Required. The name of the snapshot to delete. - * Format is `projects/{project}/snapshots/{snap}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - deleteSnapshot( - request?: protos.google.pubsub.v1.IDeleteSnapshotRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteSnapshotRequest | undefined, - {} | undefined, - ] - >; - deleteSnapshot( - request: protos.google.pubsub.v1.IDeleteSnapshotRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteSnapshotRequest | null | undefined, - {} | null | undefined - >, - ): void; - deleteSnapshot( - request: protos.google.pubsub.v1.IDeleteSnapshotRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteSnapshotRequest | null | undefined, - {} | null | undefined - >, - ): void; - deleteSnapshot( - request?: protos.google.pubsub.v1.IDeleteSnapshotRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteSnapshotRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteSnapshotRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteSnapshotRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - snapshot: request.snapshot ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('deleteSnapshot request %j', request); - const wrappedCallback: - | Callback< - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteSnapshotRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteSnapshot response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .deleteSnapshot(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.pubsub.v1.IDeleteSnapshotRequest | undefined, - {} | undefined, - ]) => { - this._log.info('deleteSnapshot response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Seeks an existing subscription to a point in time or to a given snapshot, - * whichever is provided in the request. Snapshots are used in [Seek] - * (https://cloud.google.com/pubsub/docs/replay-overview) operations, which - * allow you to manage message acknowledgments in bulk. That is, you can set - * the acknowledgment state of messages in an existing subscription to the - * state captured by a snapshot. Note that both the subscription and the - * snapshot must be on the same topic. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.subscription - * Required. The subscription to affect. - * @param {google.protobuf.Timestamp} [request.time] - * Optional. The time to seek to. - * Messages retained in the subscription that were published before this - * time are marked as acknowledged, and messages retained in the - * subscription that were published after this time are marked as - * unacknowledged. Note that this operation affects only those messages - * retained in the subscription (configured by the combination of - * `message_retention_duration` and `retain_acked_messages`). For example, - * if `time` corresponds to a point before the message retention - * window (or to a point before the system's notion of the subscription - * creation time), only retained messages will be marked as unacknowledged, - * and already-expunged messages will not be restored. - * @param {string} [request.snapshot] - * Optional. The snapshot to seek to. The snapshot's topic must be the same - * as that of the provided subscription. Format is - * `projects/{project}/snapshots/{snap}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.pubsub.v1.SeekResponse|SeekResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - */ - seek( - request?: protos.google.pubsub.v1.ISeekRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.pubsub.v1.ISeekResponse, - protos.google.pubsub.v1.ISeekRequest | undefined, - {} | undefined, - ] - >; - seek( - request: protos.google.pubsub.v1.ISeekRequest, - options: CallOptions, - callback: Callback< - protos.google.pubsub.v1.ISeekResponse, - protos.google.pubsub.v1.ISeekRequest | null | undefined, - {} | null | undefined - >, - ): void; - seek( - request: protos.google.pubsub.v1.ISeekRequest, - callback: Callback< - protos.google.pubsub.v1.ISeekResponse, - protos.google.pubsub.v1.ISeekRequest | null | undefined, - {} | null | undefined - >, - ): void; - seek( - request?: protos.google.pubsub.v1.ISeekRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.pubsub.v1.ISeekResponse, - protos.google.pubsub.v1.ISeekRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.pubsub.v1.ISeekResponse, - protos.google.pubsub.v1.ISeekRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.pubsub.v1.ISeekResponse, - protos.google.pubsub.v1.ISeekRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - subscription: request.subscription ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - this._log.info('seek request %j', request); - const wrappedCallback: - | Callback< - protos.google.pubsub.v1.ISeekResponse, - protos.google.pubsub.v1.ISeekRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('seek response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .seek(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.pubsub.v1.ISeekResponse, - protos.google.pubsub.v1.ISeekRequest | undefined, - {} | undefined, - ]) => { - this._log.info('seek response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - - /** - * Establishes a stream with the server, which sends messages down to the - * client. The client streams acknowledgments and ack deadline modifications - * back to the server. The server will close the stream and return the status - * on any error. The server may close the stream with status `UNAVAILABLE` to - * reassign server-side resources, in which case, the client should - * re-establish the stream. Flow control can be achieved by configuring the - * underlying RPC channel. - * - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which is both readable and writable. It accepts objects - * representing {@link protos.google.pubsub.v1.StreamingPullRequest|StreamingPullRequest} for write() method, and - * will emit objects representing {@link protos.google.pubsub.v1.StreamingPullResponse|StreamingPullResponse} on 'data' event asynchronously. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } - * for more details and examples. - */ - streamingPull(options?: CallOptions): gax.CancellableStream { - this.initialize().catch(err => { - throw err; - }); - this._log.info('streamingPull stream %j', options); - return this.innerApiCalls.streamingPull(null, options); - } - - /** - * Lists matching subscriptions. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.project - * Required. The name of the project in which to list subscriptions. - * Format is `projects/{project-id}`. - * @param {number} [request.pageSize] - * Optional. Maximum number of subscriptions to return. - * @param {string} [request.pageToken] - * Optional. The value returned by the last `ListSubscriptionsResponse`; - * indicates that this is a continuation of a prior `ListSubscriptions` call, - * and that the system should return the next page of data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.pubsub.v1.Subscription|Subscription}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSubscriptionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listSubscriptions( - request?: protos.google.pubsub.v1.IListSubscriptionsRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.pubsub.v1.ISubscription[], - protos.google.pubsub.v1.IListSubscriptionsRequest | null, - protos.google.pubsub.v1.IListSubscriptionsResponse, - ] - >; - listSubscriptions( - request: protos.google.pubsub.v1.IListSubscriptionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.pubsub.v1.IListSubscriptionsRequest, - protos.google.pubsub.v1.IListSubscriptionsResponse | null | undefined, - protos.google.pubsub.v1.ISubscription - >, - ): void; - listSubscriptions( - request: protos.google.pubsub.v1.IListSubscriptionsRequest, - callback: PaginationCallback< - protos.google.pubsub.v1.IListSubscriptionsRequest, - protos.google.pubsub.v1.IListSubscriptionsResponse | null | undefined, - protos.google.pubsub.v1.ISubscription - >, - ): void; - listSubscriptions( - request?: protos.google.pubsub.v1.IListSubscriptionsRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< - protos.google.pubsub.v1.IListSubscriptionsRequest, - protos.google.pubsub.v1.IListSubscriptionsResponse | null | undefined, - protos.google.pubsub.v1.ISubscription - >, - callback?: PaginationCallback< - protos.google.pubsub.v1.IListSubscriptionsRequest, - protos.google.pubsub.v1.IListSubscriptionsResponse | null | undefined, - protos.google.pubsub.v1.ISubscription - >, - ): Promise< - [ - protos.google.pubsub.v1.ISubscription[], - protos.google.pubsub.v1.IListSubscriptionsRequest | null, - protos.google.pubsub.v1.IListSubscriptionsResponse, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - const wrappedCallback: - | PaginationCallback< - protos.google.pubsub.v1.IListSubscriptionsRequest, - protos.google.pubsub.v1.IListSubscriptionsResponse | null | undefined, - protos.google.pubsub.v1.ISubscription - > - | undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listSubscriptions values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listSubscriptions request %j', request); - return this.innerApiCalls - .listSubscriptions(request, options, wrappedCallback) - ?.then( - ([response, input, output]: [ - protos.google.pubsub.v1.ISubscription[], - protos.google.pubsub.v1.IListSubscriptionsRequest | null, - protos.google.pubsub.v1.IListSubscriptionsResponse, - ]) => { - this._log.info('listSubscriptions values %j', response); - return [response, input, output]; - }, - ); - } - - /** - * Equivalent to `listSubscriptions`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.project - * Required. The name of the project in which to list subscriptions. - * Format is `projects/{project-id}`. - * @param {number} [request.pageSize] - * Optional. Maximum number of subscriptions to return. - * @param {string} [request.pageToken] - * Optional. The value returned by the last `ListSubscriptionsResponse`; - * indicates that this is a continuation of a prior `ListSubscriptions` call, - * and that the system should return the next page of data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.pubsub.v1.Subscription|Subscription} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listSubscriptionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listSubscriptionsStream( - request?: protos.google.pubsub.v1.IListSubscriptionsRequest, - options?: CallOptions, - ): Transform { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - }); - const defaultCallSettings = this._defaults['listSubscriptions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => { - throw err; - }); - this._log.info('listSubscriptions stream %j', request); - return this.descriptors.page.listSubscriptions.createStream( - this.innerApiCalls.listSubscriptions as GaxCall, - request, - callSettings, - ); - } - - /** - * Equivalent to `listSubscriptions`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.project - * Required. The name of the project in which to list subscriptions. - * Format is `projects/{project-id}`. - * @param {number} [request.pageSize] - * Optional. Maximum number of subscriptions to return. - * @param {string} [request.pageToken] - * Optional. The value returned by the last `ListSubscriptionsResponse`; - * indicates that this is a continuation of a prior `ListSubscriptions` call, - * and that the system should return the next page of data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.pubsub.v1.Subscription|Subscription}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listSubscriptionsAsync( - request?: protos.google.pubsub.v1.IListSubscriptionsRequest, - options?: CallOptions, - ): AsyncIterable { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - }); - const defaultCallSettings = this._defaults['listSubscriptions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => { - throw err; - }); - this._log.info('listSubscriptions iterate %j', request); - return this.descriptors.page.listSubscriptions.asyncIterate( - this.innerApiCalls['listSubscriptions'] as GaxCall, - request as {}, - callSettings, - ) as AsyncIterable; - } - /** - * Lists the existing snapshots. Snapshots are used in [Seek]( - * https://cloud.google.com/pubsub/docs/replay-overview) operations, which - * allow you to manage message acknowledgments in bulk. That is, you can set - * the acknowledgment state of messages in an existing subscription to the - * state captured by a snapshot. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.project - * Required. The name of the project in which to list snapshots. - * Format is `projects/{project-id}`. - * @param {number} [request.pageSize] - * Optional. Maximum number of snapshots to return. - * @param {string} [request.pageToken] - * Optional. The value returned by the last `ListSnapshotsResponse`; indicates - * that this is a continuation of a prior `ListSnapshots` call, and that the - * system should return the next page of data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.pubsub.v1.Snapshot|Snapshot}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSnapshotsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listSnapshots( - request?: protos.google.pubsub.v1.IListSnapshotsRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.pubsub.v1.ISnapshot[], - protos.google.pubsub.v1.IListSnapshotsRequest | null, - protos.google.pubsub.v1.IListSnapshotsResponse, - ] - >; - listSnapshots( - request: protos.google.pubsub.v1.IListSnapshotsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.pubsub.v1.IListSnapshotsRequest, - protos.google.pubsub.v1.IListSnapshotsResponse | null | undefined, - protos.google.pubsub.v1.ISnapshot - >, - ): void; - listSnapshots( - request: protos.google.pubsub.v1.IListSnapshotsRequest, - callback: PaginationCallback< - protos.google.pubsub.v1.IListSnapshotsRequest, - protos.google.pubsub.v1.IListSnapshotsResponse | null | undefined, - protos.google.pubsub.v1.ISnapshot - >, - ): void; - listSnapshots( - request?: protos.google.pubsub.v1.IListSnapshotsRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< - protos.google.pubsub.v1.IListSnapshotsRequest, - protos.google.pubsub.v1.IListSnapshotsResponse | null | undefined, - protos.google.pubsub.v1.ISnapshot - >, - callback?: PaginationCallback< - protos.google.pubsub.v1.IListSnapshotsRequest, - protos.google.pubsub.v1.IListSnapshotsResponse | null | undefined, - protos.google.pubsub.v1.ISnapshot - >, - ): Promise< - [ - protos.google.pubsub.v1.ISnapshot[], - protos.google.pubsub.v1.IListSnapshotsRequest | null, - protos.google.pubsub.v1.IListSnapshotsResponse, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - }); - this.initialize().catch(err => { - throw err; - }); - const wrappedCallback: - | PaginationCallback< - protos.google.pubsub.v1.IListSnapshotsRequest, - protos.google.pubsub.v1.IListSnapshotsResponse | null | undefined, - protos.google.pubsub.v1.ISnapshot - > - | undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listSnapshots values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listSnapshots request %j', request); - return this.innerApiCalls - .listSnapshots(request, options, wrappedCallback) - ?.then( - ([response, input, output]: [ - protos.google.pubsub.v1.ISnapshot[], - protos.google.pubsub.v1.IListSnapshotsRequest | null, - protos.google.pubsub.v1.IListSnapshotsResponse, - ]) => { - this._log.info('listSnapshots values %j', response); - return [response, input, output]; - }, - ); - } - - /** - * Equivalent to `listSnapshots`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.project - * Required. The name of the project in which to list snapshots. - * Format is `projects/{project-id}`. - * @param {number} [request.pageSize] - * Optional. Maximum number of snapshots to return. - * @param {string} [request.pageToken] - * Optional. The value returned by the last `ListSnapshotsResponse`; indicates - * that this is a continuation of a prior `ListSnapshots` call, and that the - * system should return the next page of data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.pubsub.v1.Snapshot|Snapshot} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listSnapshotsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listSnapshotsStream( - request?: protos.google.pubsub.v1.IListSnapshotsRequest, - options?: CallOptions, - ): Transform { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - }); - const defaultCallSettings = this._defaults['listSnapshots']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => { - throw err; - }); - this._log.info('listSnapshots stream %j', request); - return this.descriptors.page.listSnapshots.createStream( - this.innerApiCalls.listSnapshots as GaxCall, - request, - callSettings, - ); - } - - /** - * Equivalent to `listSnapshots`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.project - * Required. The name of the project in which to list snapshots. - * Format is `projects/{project-id}`. - * @param {number} [request.pageSize] - * Optional. Maximum number of snapshots to return. - * @param {string} [request.pageToken] - * Optional. The value returned by the last `ListSnapshotsResponse`; indicates - * that this is a continuation of a prior `ListSnapshots` call, and that the - * system should return the next page of data. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.pubsub.v1.Snapshot|Snapshot}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listSnapshotsAsync( - request?: protos.google.pubsub.v1.IListSnapshotsRequest, - options?: CallOptions, - ): AsyncIterable { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - }); - const defaultCallSettings = this._defaults['listSnapshots']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => { - throw err; - }); - this._log.info('listSnapshots iterate %j', request); - return this.descriptors.page.listSnapshots.asyncIterate( - this.innerApiCalls['listSnapshots'] as GaxCall, - request as {}, - callSettings, - ) as AsyncIterable; - } - /** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - ): Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.getIamPolicy(request, options, callback); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - ): Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified cryptoKey resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} key_ring - * @param {string} crypto_key - * @returns {string} Resource name string. - */ - cryptoKeyPath( - project: string, - location: string, - keyRing: string, - cryptoKey: string, - ) { - return this.pathTemplates.cryptoKeyPathTemplate.render({ - project: project, - location: location, - key_ring: keyRing, - crypto_key: cryptoKey, - }); - } - - /** - * Parse the project from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) - .project; - } - - /** - * Parse the location from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) - .location; - } - - /** - * Parse the key_ring from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the key_ring. - */ - matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) - .key_ring; - } - - /** - * Parse the crypto_key from CryptoKey resource. - * - * @param {string} cryptoKeyName - * A fully-qualified path representing CryptoKey resource. - * @returns {string} A string representing the crypto_key. - */ - matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) - .crypto_key; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project: string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectTopics resource name string. - * - * @param {string} project - * @param {string} topic - * @returns {string} Resource name string. - */ - projectTopicsPath(project: string, topic: string) { - return this.pathTemplates.projectTopicsPathTemplate.render({ - project: project, - topic: topic, - }); - } - - /** - * Parse the project from ProjectTopics resource. - * - * @param {string} projectTopicsName - * A fully-qualified path representing project_topics resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectTopicsName(projectTopicsName: string) { - return this.pathTemplates.projectTopicsPathTemplate.match(projectTopicsName) - .project; - } - - /** - * Parse the topic from ProjectTopics resource. - * - * @param {string} projectTopicsName - * A fully-qualified path representing project_topics resource. - * @returns {string} A string representing the topic. - */ - matchTopicFromProjectTopicsName(projectTopicsName: string) { - return this.pathTemplates.projectTopicsPathTemplate.match(projectTopicsName) - .topic; - } - - /** - * Return a fully-qualified schema resource name string. - * - * @param {string} project - * @param {string} schema - * @returns {string} Resource name string. - */ - schemaPath(project: string, schema: string) { - return this.pathTemplates.schemaPathTemplate.render({ - project: project, - schema: schema, - }); - } - - /** - * Parse the project from Schema resource. - * - * @param {string} schemaName - * A fully-qualified path representing Schema resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSchemaName(schemaName: string) { - return this.pathTemplates.schemaPathTemplate.match(schemaName).project; - } - - /** - * Parse the schema from Schema resource. - * - * @param {string} schemaName - * A fully-qualified path representing Schema resource. - * @returns {string} A string representing the schema. - */ - matchSchemaFromSchemaName(schemaName: string) { - return this.pathTemplates.schemaPathTemplate.match(schemaName).schema; - } - - /** - * Return a fully-qualified snapshot resource name string. - * - * @param {string} project - * @param {string} snapshot - * @returns {string} Resource name string. - */ - snapshotPath(project: string, snapshot: string) { - return this.pathTemplates.snapshotPathTemplate.render({ - project: project, - snapshot: snapshot, - }); - } - - /** - * Parse the project from Snapshot resource. - * - * @param {string} snapshotName - * A fully-qualified path representing Snapshot resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSnapshotName(snapshotName: string) { - return this.pathTemplates.snapshotPathTemplate.match(snapshotName).project; - } - - /** - * Parse the snapshot from Snapshot resource. - * - * @param {string} snapshotName - * A fully-qualified path representing Snapshot resource. - * @returns {string} A string representing the snapshot. - */ - matchSnapshotFromSnapshotName(snapshotName: string) { - return this.pathTemplates.snapshotPathTemplate.match(snapshotName).snapshot; - } - - /** - * Return a fully-qualified subscription resource name string. - * - * @param {string} project - * @param {string} subscription - * @returns {string} Resource name string. - */ - subscriptionPath(project: string, subscription: string) { - return this.pathTemplates.subscriptionPathTemplate.render({ - project: project, - subscription: subscription, - }); - } - - /** - * Parse the project from Subscription resource. - * - * @param {string} subscriptionName - * A fully-qualified path representing Subscription resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSubscriptionName(subscriptionName: string) { - return this.pathTemplates.subscriptionPathTemplate.match(subscriptionName) - .project; - } - - /** - * Parse the subscription from Subscription resource. - * - * @param {string} subscriptionName - * A fully-qualified path representing Subscription resource. - * @returns {string} A string representing the subscription. - */ - matchSubscriptionFromSubscriptionName(subscriptionName: string) { - return this.pathTemplates.subscriptionPathTemplate.match(subscriptionName) - .subscription; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.subscriberStub && !this._terminated) { - return this.subscriberStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.iamClient.close().catch(err => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/handwritten/pubsub/src/v1/subscriber_proto_list.json b/handwritten/pubsub/src/v1/subscriber_proto_list.json deleted file mode 100644 index 91011aec1502..000000000000 --- a/handwritten/pubsub/src/v1/subscriber_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/pubsub/v1/pubsub.proto", - "../../protos/google/pubsub/v1/schema.proto" -] diff --git a/handwritten/pubsub/test/message-stream.ts b/handwritten/pubsub/test/message-stream.ts index d5be750bbcb0..00bc31fff02e 100644 --- a/handwritten/pubsub/test/message-stream.ts +++ b/handwritten/pubsub/test/message-stream.ts @@ -160,7 +160,7 @@ describe('MessageStream', () => { before(() => { MessageStream = proxyquire('../src/message-stream.js', { stream: {PassThrough: FakePassThrough}, - './v1/subscriber_client_config.json': FAKE_CLIENT_CONFIG, + './v1-old/subscriber_client_config.json': FAKE_CLIENT_CONFIG, }).MessageStream; }); diff --git a/handwritten/pubsub/test/pubsub.ts b/handwritten/pubsub/test/pubsub.ts index c231deae118d..b2ecbfa7d29f 100644 --- a/handwritten/pubsub/test/pubsub.ts +++ b/handwritten/pubsub/test/pubsub.ts @@ -29,6 +29,7 @@ import * as tracing from '../src/telemetry-tracing'; import {Topic} from '../src/topic'; import * as util from '../src/util'; import {Schema, SchemaTypes, ISchema, SchemaViews} from '../src/schema'; +import {v1 as v1real} from '../src'; // eslint-disable-next-line @typescript-eslint/no-var-requires const PKG = require('../../package.json'); const sandbox = sinon.createSandbox(); @@ -145,7 +146,7 @@ function fakeGoogleAuth(...args: Array<{}>) { return (googleAuthOverride || util.noop)(...args); } -const v1Override = {}; +const v1Override = Object.assign({}, v1real); // eslint-disable-next-line @typescript-eslint/no-explicit-any let v1ClientOverrides: any = {}; @@ -195,7 +196,7 @@ describe('PubSub', () => { './snapshot': {Snapshot: FakeSnapshot}, './subscription': {Subscription}, './topic': {Topic: FakeTopic}, - './v1': v1Override, + './index': {v1:v1Override}, './util': fakeUtil, }).PubSub; }); diff --git a/handwritten/pubsub/test/schema.ts b/handwritten/pubsub/test/schema.ts index d1e6294640eb..44acf5dc12ff 100644 --- a/handwritten/pubsub/test/schema.ts +++ b/handwritten/pubsub/test/schema.ts @@ -18,7 +18,9 @@ import * as sinon from 'sinon'; import {google} from '../protos/protos'; import {PubSub} from '../src/pubsub'; import {ISchema, Schema, SchemaTypes, SchemaViews} from '../src/schema'; -import {SchemaServiceClient} from '../src/v1'; + +import {v1} from '../src'; +type SchemaServiceClient = v1.SchemaServiceClient; const sandbox = sinon.createSandbox(); diff --git a/handwritten/pubsub/tmp/google-cloud-pubsub-api-0.1.0.tgz b/handwritten/pubsub/tmp/google-cloud-pubsub-api-0.1.0.tgz new file mode 100644 index 000000000000..7c0e0ba9c81e Binary files /dev/null and b/handwritten/pubsub/tmp/google-cloud-pubsub-api-0.1.0.tgz differ diff --git a/packages/google-cloud-pubsub-api/package.json b/packages/google-cloud-pubsub-api/package.json index 5a8bf19a804e..516d780ae0e9 100644 --- a/packages/google-cloud-pubsub-api/package.json +++ b/packages/google-cloud-pubsub-api/package.json @@ -42,7 +42,7 @@ "test": "c8 mocha --config ../../.mocharc.cjs build/test" }, "dependencies": { - "google-gax": "^5.1.1-rc.1" + "google-gax": "^5.0.7" }, "devDependencies": { "@types/mocha": "^10.0.10",