From 7910d70da8bb9aac564ed0125d15efb79d0da17c Mon Sep 17 00:00:00 2001 From: Lucas BERGERON Date: Wed, 25 Sep 2024 11:21:21 +0200 Subject: [PATCH 1/4] Fix #14074 - Paginate not working --- components/nocodb/nocodb.app.mjs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/nocodb/nocodb.app.mjs b/components/nocodb/nocodb.app.mjs index e96f1c2b49fe3..2308545db412c 100644 --- a/components/nocodb/nocodb.app.mjs +++ b/components/nocodb/nocodb.app.mjs @@ -122,19 +122,20 @@ export default { let lastPage, count = 0; args.params = { ...args.params, - page: 1, + offset: 0, + limit: 1000 }; do { const { list, pageInfo, } = await fn(args); for (const item of list) { + args.params.offset++; yield item; if (max && ++count === max) { return; } } - args.params.page++; lastPage = !pageInfo.isLastPage; } while (lastPage); }, From e31def96946155dc3a7a96677042640b7d6e34b3 Mon Sep 17 00:00:00 2001 From: Lucas BERGERON Date: Wed, 25 Sep 2024 11:24:22 +0200 Subject: [PATCH 2/4] Increment version --- components/nocodb/actions/add-record/add-record.mjs | 2 +- components/nocodb/actions/delete-record/delete-record.mjs | 2 +- components/nocodb/actions/get-record/get-record.mjs | 2 +- .../list-records-matching-criteria.mjs | 2 +- components/nocodb/actions/update-record/update-record.mjs | 2 +- components/nocodb/package.json | 2 +- components/nocodb/sources/new-record/new-record.mjs | 2 +- components/nocodb/sources/updated-record/updated-record.mjs | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/components/nocodb/actions/add-record/add-record.mjs b/components/nocodb/actions/add-record/add-record.mjs index 226246b3e465d..82b347bf0bf13 100644 --- a/components/nocodb/actions/add-record/add-record.mjs +++ b/components/nocodb/actions/add-record/add-record.mjs @@ -5,7 +5,7 @@ export default { key: "nocodb-add-record", name: "Add Record", description: "This action adds a record in a table. [See the documentation](https://data-apis-v2.nocodb.com/#tag/Table-Records/operation/db-data-table-row-create)", - version: "0.0.3", + version: "0.0.4", type: "action", props: { ...common.props, diff --git a/components/nocodb/actions/delete-record/delete-record.mjs b/components/nocodb/actions/delete-record/delete-record.mjs index 53f7db0a5c7cd..58de395793d2b 100644 --- a/components/nocodb/actions/delete-record/delete-record.mjs +++ b/components/nocodb/actions/delete-record/delete-record.mjs @@ -5,7 +5,7 @@ export default { key: "nocodb-delete-record", name: "Delete Record", description: "This action deletes a row in a table. [See the documentation](https://data-apis-v2.nocodb.com/#tag/Table-Records/operation/db-data-table-row-delete)", - version: "0.0.3", + version: "0.0.4", type: "action", props: { ...common.props, diff --git a/components/nocodb/actions/get-record/get-record.mjs b/components/nocodb/actions/get-record/get-record.mjs index 052c238609b1d..63c4f67494548 100644 --- a/components/nocodb/actions/get-record/get-record.mjs +++ b/components/nocodb/actions/get-record/get-record.mjs @@ -5,7 +5,7 @@ export default { key: "nocodb-get-record", name: "Get Record (from row number)", description: "This action gets a row by row Id. [See the documentation](https://data-apis-v2.nocodb.com/#tag/Table-Records/operation/db-data-table-row-read)", - version: "0.0.3", + version: "0.0.4", type: "action", props: { ...common.props, diff --git a/components/nocodb/actions/list-records-matching-criteria/list-records-matching-criteria.mjs b/components/nocodb/actions/list-records-matching-criteria/list-records-matching-criteria.mjs index ea90d775d5943..b1df484d68558 100644 --- a/components/nocodb/actions/list-records-matching-criteria/list-records-matching-criteria.mjs +++ b/components/nocodb/actions/list-records-matching-criteria/list-records-matching-criteria.mjs @@ -5,7 +5,7 @@ export default { key: "nocodb-list-records-matching-criteria", name: "List Records in Table Matching Criteria", description: "This action lists all rows in a table. [See the documentation](https://data-apis-v2.nocodb.com/#tag/Table-Records/operation/db-data-table-row-list)", - version: "0.0.4", + version: "0.0.5", type: "action", props: { ...common.props, diff --git a/components/nocodb/actions/update-record/update-record.mjs b/components/nocodb/actions/update-record/update-record.mjs index 429f7dd7dd833..adab950775c61 100644 --- a/components/nocodb/actions/update-record/update-record.mjs +++ b/components/nocodb/actions/update-record/update-record.mjs @@ -5,7 +5,7 @@ export default { key: "nocodb-update-record", name: "Update Record", description: "This action updates a record in a table. [See the documentation](https://data-apis-v2.nocodb.com/#tag/Table-Records/operation/db-data-table-row-update)", - version: "0.0.3", + version: "0.0.4", type: "action", props: { ...common.props, diff --git a/components/nocodb/package.json b/components/nocodb/package.json index ef4846cc158d3..c53cdf7a13904 100644 --- a/components/nocodb/package.json +++ b/components/nocodb/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/nocodb", - "version": "0.0.6", + "version": "0.0.7", "description": "Pipedream Nocodb Components", "main": "nocodb.app.mjs", "keywords": [ diff --git a/components/nocodb/sources/new-record/new-record.mjs b/components/nocodb/sources/new-record/new-record.mjs index 5552f15cf9058..238bf43ca4421 100644 --- a/components/nocodb/sources/new-record/new-record.mjs +++ b/components/nocodb/sources/new-record/new-record.mjs @@ -6,7 +6,7 @@ export default { name: "New Record in Table", key: "nocodb-new-record", description: "Emit new event for each new record in table. [See the documentation](https://data-apis-v2.nocodb.com/#tag/Table-Records/operation/db-data-table-row-list)", - version: "0.0.4", + version: "0.0.5", dedupe: "unique", props: { ...common.props, diff --git a/components/nocodb/sources/updated-record/updated-record.mjs b/components/nocodb/sources/updated-record/updated-record.mjs index ca2d81072a2f6..aa6daa498b211 100644 --- a/components/nocodb/sources/updated-record/updated-record.mjs +++ b/components/nocodb/sources/updated-record/updated-record.mjs @@ -6,7 +6,7 @@ export default { name: "New Update in Table", key: "nocodb-updated-record", description: "Emit new event for each update in table. [See the documentation](https://data-apis-v2.nocodb.com/#tag/Table-Records/operation/db-data-table-row-list)", - version: "0.0.4", + version: "0.0.5", dedupe: "unique", props: { ...common.props, From 92c44e47c783100a00efdd638a0932ec0880d629 Mon Sep 17 00:00:00 2001 From: LucBerge Date: Wed, 25 Sep 2024 20:17:33 +0200 Subject: [PATCH 3/4] Add missing comma --- components/nocodb/nocodb.app.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/nocodb/nocodb.app.mjs b/components/nocodb/nocodb.app.mjs index 2308545db412c..a8872601a8431 100644 --- a/components/nocodb/nocodb.app.mjs +++ b/components/nocodb/nocodb.app.mjs @@ -123,7 +123,7 @@ export default { args.params = { ...args.params, offset: 0, - limit: 1000 + limit: 1000, }; do { const { From d163ec73376ac1b4316ef6e5918c4450dae552d3 Mon Sep 17 00:00:00 2001 From: Lucas BERGERON Date: Thu, 26 Sep 2024 15:00:47 +0200 Subject: [PATCH 4/4] Rename `lastPage` variable to `hasMore` --- components/nocodb/nocodb.app.mjs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/nocodb/nocodb.app.mjs b/components/nocodb/nocodb.app.mjs index a8872601a8431..97065fcb0e0ed 100644 --- a/components/nocodb/nocodb.app.mjs +++ b/components/nocodb/nocodb.app.mjs @@ -119,7 +119,8 @@ export default { async *paginate({ fn, args = {}, max, }) { - let lastPage, count = 0; + let hasMore = false; + let count = 0; args.params = { ...args.params, offset: 0, @@ -136,8 +137,8 @@ export default { return; } } - lastPage = !pageInfo.isLastPage; - } while (lastPage); + hasMore = !pageInfo.isLastPage; + } while (hasMore); }, listWorkspaces(opts = {}) { return this._makeRequest({