diff --git a/src/lib/fetcher.ts b/src/lib/fetcher.ts index d20a5f967..94679493d 100644 --- a/src/lib/fetcher.ts +++ b/src/lib/fetcher.ts @@ -151,6 +151,8 @@ export default class Fetcher implements APIFetcher { while (true) { const paramsWithSkip = { + limit: '500', + order: 'sys.createdAt', ...params, skip: skip.toString(10) } diff --git a/test/unit/lib/content-types-in-chunks.spec.ts b/test/unit/lib/content-types-in-chunks.spec.ts index 2d24c9f68..0eecde0c8 100644 --- a/test/unit/lib/content-types-in-chunks.spec.ts +++ b/test/unit/lib/content-types-in-chunks.spec.ts @@ -79,7 +79,7 @@ describe('Content Type fetcher', function () { expect(request).to.have.been.calledWith({ method: 'GET', - url: '/content_types?sys.id[in]=person,dog,cat,plant&skip=0' + url: '/content_types?limit=500&order=sys.createdAt&sys.id[in]=person,dog,cat,plant&skip=0' }) expect(contentTypes).to.eql([ { diff --git a/test/unit/lib/fetcher.spec.ts b/test/unit/lib/fetcher.spec.ts index 660450c31..05d08faac 100644 --- a/test/unit/lib/fetcher.spec.ts +++ b/test/unit/lib/fetcher.spec.ts @@ -30,7 +30,7 @@ describe('Fetcher', function () { request .withArgs({ method: 'GET', - url: '/entries?sys.archivedAt[exists]=false&sys.contentType.sys.id[in]=newsArticle&skip=0' + url: '/entries?limit=500&order=sys.createdAt&sys.archivedAt[exists]=false&sys.contentType.sys.id[in]=newsArticle&skip=0' }) .resolves({ skip: 0, @@ -41,7 +41,7 @@ describe('Fetcher', function () { request .withArgs({ method: 'GET', - url: '/entries?sys.archivedAt[exists]=false&sys.contentType.sys.id[in]=newsArticle&skip=4' + url: '/entries?limit=500&order=sys.createdAt&sys.archivedAt[exists]=false&sys.contentType.sys.id[in]=newsArticle&skip=4' }) .resolves({ skip: 4, @@ -57,11 +57,11 @@ describe('Fetcher', function () { expect(request).to.have.been.calledWith({ method: 'GET', - url: '/entries?sys.archivedAt[exists]=false&sys.contentType.sys.id[in]=newsArticle&skip=0' + url: '/entries?limit=500&order=sys.createdAt&sys.archivedAt[exists]=false&sys.contentType.sys.id[in]=newsArticle&skip=0' }) expect(request).to.have.been.calledWith({ method: 'GET', - url: '/entries?sys.archivedAt[exists]=false&sys.contentType.sys.id[in]=newsArticle&skip=4' + url: '/entries?limit=500&order=sys.createdAt&sys.archivedAt[exists]=false&sys.contentType.sys.id[in]=newsArticle&skip=4' }) const result = ['item1', 'item2', 'item3', 'item4', 'item5', 'item6'] @@ -87,7 +87,7 @@ describe('Fetcher', function () { request .withArgs({ method: 'GET', - url: '/entries?sys.archivedAt[exists]=false&skip=0' + url: '/entries?limit=500&order=sys.createdAt&sys.archivedAt[exists]=false&skip=0' }) .resolves({ skip: 0, @@ -98,7 +98,7 @@ describe('Fetcher', function () { request .withArgs({ method: 'GET', - url: '/entries?sys.archivedAt[exists]=false&skip=4' + url: '/entries?limit=500&order=sys.createdAt&sys.archivedAt[exists]=false&skip=4' }) .resolves({ skip: 4, @@ -114,11 +114,11 @@ describe('Fetcher', function () { expect(request).to.have.been.calledWith({ method: 'GET', - url: '/entries?sys.archivedAt[exists]=false&skip=0' + url: '/entries?limit=500&order=sys.createdAt&sys.archivedAt[exists]=false&skip=0' }) expect(request).to.have.been.calledWith({ method: 'GET', - url: '/entries?sys.archivedAt[exists]=false&skip=4' + url: '/entries?limit=500&order=sys.createdAt&sys.archivedAt[exists]=false&skip=4' }) const result = ['item1', 'item2', 'item3', 'item4', 'item5', 'item6'] @@ -253,7 +253,7 @@ describe('Fetcher', function () { expect(request).to.have.been.calledWith({ method: 'GET', - url: `/content_types?sys.id[in]=person,dog,cat,plant&skip=0` + url: `/content_types?limit=500&order=sys.createdAt&sys.id[in]=person,dog,cat,plant&skip=0` }) expect(contentTypes).to.eql([ { @@ -353,7 +353,7 @@ describe('Fetcher', function () { expect(request).to.have.been.calledWith({ method: 'GET', - url: '/content_types?sys.id[in]=dog,owner&skip=0' + url: '/content_types?limit=500&order=sys.createdAt&sys.id[in]=dog,owner&skip=0' }) }) @@ -444,7 +444,7 @@ describe('Fetcher', function () { request .withArgs({ method: 'GET', - url: '/locales?skip=0' + url: '/locales?limit=500&order=sys.createdAt&skip=0' }) .resolves({ skip: 0, @@ -455,7 +455,7 @@ describe('Fetcher', function () { request .withArgs({ method: 'GET', - url: '/locales?skip=2' + url: '/locales?limit=500&order=sys.createdAt&skip=2' }) .resolves({ skip: 2, @@ -466,7 +466,7 @@ describe('Fetcher', function () { request .withArgs({ method: 'GET', - url: '/locales?skip=4' + url: '/locales?limit=500&order=sys.createdAt&skip=4' }) .resolves({ skip: 4, @@ -480,15 +480,15 @@ describe('Fetcher', function () { expect(request).to.have.been.calledWith({ method: 'GET', - url: '/locales?skip=0' + url: '/locales?limit=500&order=sys.createdAt&skip=0' }) expect(request).to.have.been.calledWith({ method: 'GET', - url: '/locales?skip=2' + url: '/locales?limit=500&order=sys.createdAt&skip=2' }) expect(request).to.have.been.calledWith({ method: 'GET', - url: '/locales?skip=4' + url: '/locales?limit=500&order=sys.createdAt&skip=4' }) const result = ['a', 'b', 'c', 'd', 'e', 'f'] diff --git a/test/unit/lib/migration-parser.spec.ts b/test/unit/lib/migration-parser.spec.ts index 248579ada..f658dcb89 100644 --- a/test/unit/lib/migration-parser.spec.ts +++ b/test/unit/lib/migration-parser.spec.ts @@ -7,7 +7,7 @@ describe('Migration parser', function () { describe('when transforming content', function () { it('returns all collected errors', async function () { const fakeMakeRequest = (config) => { - if (config.url === '/content_types?sys.id[in]=foo,cat&skip=0') { + if (config.url === '/content_types?limit=500&order=sys.createdAt&sys.id[in]=foo,cat&skip=0') { return { total: 2, skip: 0, @@ -25,7 +25,7 @@ describe('Migration parser', function () { } } - if (config.url.indexOf('/entries?sys.archivedAt[exists]=false&sys.contentType.sys.id[in]=foo,cat&skip=0') !== -1) { + if (config.url.indexOf('/entries?limit=500&order=sys.createdAt&sys.archivedAt[exists]=false&sys.contentType.sys.id[in]=foo,cat&skip=0') !== -1) { return { total: 2, skip: 0, @@ -56,7 +56,7 @@ describe('Migration parser', function () { } } - if (config.url === '/locales?skip=0') { + if (config.url === '/locales?limit=500&order=sys.createdAt&skip=0') { return { total: 1, skip: 0, @@ -116,7 +116,7 @@ describe('Migration parser', function () { describe('when shouldPublish is false', function () { it('does not produce publish requests', async function () { const fakeMakeRequest = (config) => { - if (config.url === '/content_types?sys.id[in]=foo&skip=0') { + if (config.url === '/content_types?limit=500&order=sys.createdAt&sys.id[in]=foo&skip=0') { return { total: 1, skip: 0, @@ -130,7 +130,7 @@ describe('Migration parser', function () { } } - if (config.url === '/entries?sys.archivedAt[exists]=false&sys.contentType.sys.id[in]=foo&skip=0') { + if (config.url === '/entries?limit=500&order=sys.createdAt&sys.archivedAt[exists]=false&sys.contentType.sys.id[in]=foo&skip=0') { return { total: 2, skip: 0, @@ -154,7 +154,7 @@ describe('Migration parser', function () { } } - if (config.url === '/locales?skip=0') { + if (config.url === '/locales?limit=500&order=sys.createdAt&skip=0') { return { total: 1, skip: 0,