UNPKG

@ibm-cloud/cloudant

Version:
40 lines 1.56 kB
"use strict"; /** * © Copyright IBM Corporation 2022. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.ChangesResultItemStream = void 0; const stream_1 = require("./stream"); const ibm_cloud_sdk_core_1 = require("ibm-cloud-sdk-core"); class ChangesResultItemStream extends stream_1.Stream { _transform(chunk, encoding, callback) { const validationError = this.getValidationError(chunk); if (validationError !== null) { this.destroy(validationError); } else { for (let result of chunk.results) { this.push(result); } } callback(); } getValidationError(params) { const requiredParams = ['lastSeq', 'pending', 'results']; return (0, ibm_cloud_sdk_core_1.validateParams)(params, requiredParams, requiredParams); } } exports.ChangesResultItemStream = ChangesResultItemStream; //# sourceMappingURL=changesResultItemStream.js.map