@fachkraftfreund/n8n-nodes-supabase 1.3.1 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -76,21 +76,24 @@ function parseFilters(context, itemIndex) {
76
76
  }
77
77
  }
78
78
  const BATCH_SIZE = 1000;
79
- async function* fetchBatches(supabase, table, selectFields, filters, sort, hostUrl, returnAll, limit, preferOffset) {
79
+ async function* fetchBatches(supabase, table, selectFields, filters, sort, hostUrl, returnAll, limit) {
80
80
  const overhead = (0, supabaseClient_2.estimateUrlOverhead)(hostUrl, table, selectFields, filters, sort);
81
81
  const maxInChars = Math.max(500, supabaseClient_2.MAX_SAFE_URL_LENGTH - overhead);
82
82
  const maxItems = (0, supabaseClient_2.computeMaxIdsPerChunk)(selectFields);
83
83
  const filterChunks = (0, supabaseClient_2.expandChunkedFilters)(filters, maxInChars, maxItems);
84
+ const hasIdColumn = selectFields === '*' || selectFields.split(',').some((f) => f.trim() === 'id');
84
85
  let totalYielded = 0;
85
86
  const maxRows = returnAll ? Infinity : limit;
86
- for (const chunkFilters of filterChunks) {
87
+ const startTime = Date.now();
88
+ console.log(`[Supabase CSV] starting export table=${table} returnAll=${returnAll} chunks=${filterChunks.length} keyset=${hasIdColumn}`);
89
+ for (let ci = 0; ci < filterChunks.length; ci++) {
90
+ const chunkFilters = filterChunks[ci];
87
91
  if (totalYielded >= maxRows)
88
92
  break;
89
93
  if (returnAll) {
90
- const useKeyset = !preferOffset &&
91
- (selectFields === '*' || selectFields.split(',').some((f) => f.trim() === 'id'));
92
94
  let hasMore = true;
93
- if (useKeyset) {
95
+ let batchNum = 0;
96
+ if (hasIdColumn) {
94
97
  let lastId = null;
95
98
  while (hasMore) {
96
99
  let query = buildSelectQuery(supabase, table, selectFields, chunkFilters, []);
@@ -109,6 +112,11 @@ async function* fetchBatches(supabase, table, selectFields, filters, sort, hostU
109
112
  else {
110
113
  hasMore = false;
111
114
  }
115
+ batchNum++;
116
+ if (batchNum % 50 === 0) {
117
+ const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
118
+ console.log(`[Supabase CSV] chunk ${ci + 1}/${filterChunks.length} batch ${batchNum} — ${totalYielded} rows fetched (${elapsed}s)`);
119
+ }
112
120
  }
113
121
  }
114
122
  else {
@@ -127,6 +135,11 @@ async function* fetchBatches(supabase, table, selectFields, filters, sort, hostU
127
135
  hasMore = false;
128
136
  }
129
137
  offset += BATCH_SIZE;
138
+ batchNum++;
139
+ if (batchNum % 50 === 0) {
140
+ const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
141
+ console.log(`[Supabase CSV] chunk ${ci + 1}/${filterChunks.length} batch ${batchNum} (offset) — ${totalYielded} rows fetched (${elapsed}s)`);
142
+ }
130
143
  }
131
144
  }
132
145
  }
@@ -144,6 +157,8 @@ async function* fetchBatches(supabase, table, selectFields, filters, sort, hostU
144
157
  }
145
158
  }
146
159
  }
160
+ const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
161
+ console.log(`[Supabase CSV] fetch complete — ${totalYielded} rows in ${elapsed}s`);
147
162
  }
148
163
  class SupabaseCsvExport {
149
164
  constructor() {
@@ -587,8 +602,7 @@ class SupabaseCsvExport {
587
602
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Transform code syntax error: ${msg}`);
588
603
  }
589
604
  }
590
- const preferOffset = sort.length > 0;
591
- for await (const batch of fetchBatches(supabase, table, selectWithJoins, filters, sort, credentials.host, returnAll, limit, preferOffset)) {
605
+ for await (const batch of fetchBatches(supabase, table, selectWithJoins, filters, sort, credentials.host, returnAll, limit)) {
592
606
  let rows = batch;
593
607
  if (transformFn) {
594
608
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fachkraftfreund/n8n-nodes-supabase",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "Comprehensive n8n community node for Supabase with database and storage operations",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",