@ibm-cloud/cloudant
Version:
IBM Cloudant Node.js SDK
47 lines • 1.76 kB
JavaScript
;
/**
* © Copyright IBM Corporation 2025. 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.AllDocsBasePageIterator = void 0;
const keyPageIterator_1 = require("./keyPageIterator");
class AllDocsBasePageIterator extends keyPageIterator_1.KeyPageIterator {
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
constructor(client, params) {
super(client, params);
}
/**
* Setting start key doc ID is a no-op for all_docs based paging where
* key is the same as id.
*/
setNextKeyId(params, startKeyDocId) {
return;
}
getItems(result) {
return result.rows;
}
checkBoundary(penultimateItem, lastItem) {
return null;
}
getValidateParamsAbsentErrorMessage(paramName) {
let errorMsg = super.getValidateParamsAbsentErrorMessage(paramName);
if (paramName === 'key') {
errorMsg = `${errorMsg} No need to paginate as 'key' returns a single result for an ID.`;
}
return errorMsg;
}
}
exports.AllDocsBasePageIterator = AllDocsBasePageIterator;
//# sourceMappingURL=allDocsBasePageIterator.js.map