afpnews-api
Advanced tools
Comparing version 2.0.7 to 2.0.8
@@ -583,13 +583,14 @@ import { parse } from 'liqe'; | ||
const direction = params.sortOrder === 'asc' ? 'dateFrom' : 'dateTo'; | ||
const maxSize = params.size || defaultSearchParams.size; | ||
let i = 0; | ||
while (true) { | ||
while (i < maxSize) { | ||
params.size = Math.min(maxSize - i, 1000); | ||
const { | ||
count, | ||
documents | ||
} = await this.search(params, fields); | ||
if (!documents.length) return; | ||
for (const doc of documents) { | ||
i++; | ||
yield doc; | ||
} | ||
i += documents.length; | ||
if (i === Math.min(count, params.size || defaultSearchParams.size)) return; | ||
params[direction] = docParser.parse(documents.pop()).published; | ||
@@ -596,0 +597,0 @@ } |
@@ -592,13 +592,14 @@ 'use strict'; | ||
const direction = params.sortOrder === 'asc' ? 'dateFrom' : 'dateTo'; | ||
const maxSize = params.size || defaultSearchParams.size; | ||
let i = 0; | ||
while (true) { | ||
while (i < maxSize) { | ||
params.size = Math.min(maxSize - i, 1000); | ||
const { | ||
count, | ||
documents | ||
} = await this.search(params, fields); | ||
if (!documents.length) return; | ||
for (const doc of documents) { | ||
i++; | ||
yield doc; | ||
} | ||
i += documents.length; | ||
if (i === Math.min(count, params.size || defaultSearchParams.size)) return; | ||
params[direction] = docParser.parse(documents.pop()).published; | ||
@@ -605,0 +606,0 @@ } |
{ | ||
"name": "afpnews-api", | ||
"version": "2.0.7", | ||
"version": "2.0.8", | ||
"description": "Node helper functions to authenticate and fetch AFP Core API", | ||
@@ -45,12 +45,12 @@ "main": "dist/afpnews-api.js", | ||
"@types/nearley": "^2.11.5", | ||
"@types/node": "^20.10.4", | ||
"@types/node": "^20.11.0", | ||
"@types/statuses": "^2.0.4", | ||
"@typescript-eslint/eslint-plugin": "^6.13.2", | ||
"@typescript-eslint/eslint-plugin-tslint": "^6.13.2", | ||
"@typescript-eslint/parser": "^6.13.2", | ||
"@typescript-eslint/eslint-plugin": "^6.18.1", | ||
"@typescript-eslint/eslint-plugin-tslint": "^6.18.1", | ||
"@typescript-eslint/parser": "^6.18.1", | ||
"dotenv": "^16.3.1", | ||
"eslint": "^8.55.0", | ||
"eslint": "^8.56.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-import": "^2.29.0", | ||
"eslint-plugin-jsdoc": "^46.9.0", | ||
"eslint-plugin-import": "^2.29.1", | ||
"eslint-plugin-jsdoc": "^48.0.2", | ||
"jest": "^29.7.0", | ||
@@ -57,0 +57,0 @@ "microbundle": "^0.15.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
700205
2301