@fachkraftfreund/n8n-nodes-supabase 1.2.12 → 1.2.13

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.
@@ -197,14 +197,14 @@ async function handleRead(supabase, itemIndex) {
197
197
  const sort = this.getNodeParameter('sort.sortField', itemIndex, []);
198
198
  const filterChunks = (0, supabaseClient_1.expandChunkedFilters)(filters);
199
199
  const returnData = [];
200
- for (const chunkFilters of filterChunks) {
201
- if (returnAll) {
200
+ if (returnAll) {
201
+ for (const chunkFilters of filterChunks) {
202
202
  const batchSize = 1000;
203
- let offset = 0;
203
+ let batchOffset = 0;
204
204
  let hasMore = true;
205
205
  while (hasMore) {
206
206
  const batchQuery = buildReadQuery(supabase, table, returnFields, chunkFilters, sort, { count: 'exact' });
207
- const { data: batchData, error: batchError } = await batchQuery.range(offset, offset + batchSize - 1);
207
+ const { data: batchData, error: batchError } = await batchQuery.range(batchOffset, batchOffset + batchSize - 1);
208
208
  if (batchError) {
209
209
  throw new Error((0, supabaseClient_1.formatSupabaseError)(batchError));
210
210
  }
@@ -217,18 +217,26 @@ async function handleRead(supabase, itemIndex) {
217
217
  else {
218
218
  hasMore = false;
219
219
  }
220
- offset += batchSize;
220
+ batchOffset += batchSize;
221
221
  }
222
222
  }
223
- else {
224
- const limit = this.getNodeParameter('limit', itemIndex, undefined);
225
- const offset = this.getNodeParameter('offset', itemIndex, undefined);
223
+ }
224
+ else {
225
+ const limit = this.getNodeParameter('limit', itemIndex, 100);
226
+ const userOffset = this.getNodeParameter('offset', itemIndex, 0);
227
+ const isMultiChunk = filterChunks.length > 1;
228
+ for (const chunkFilters of filterChunks) {
226
229
  let query = buildReadQuery(supabase, table, returnFields, chunkFilters, sort);
227
- if (limit !== undefined) {
228
- query = query.limit(limit);
230
+ if (isMultiChunk) {
231
+ query = query.limit(userOffset + limit);
229
232
  }
230
- if (offset !== undefined) {
231
- query = query.range(offset, offset + (limit || 1000) - 1);
233
+ else {
234
+ if (userOffset > 0) {
235
+ query = query.range(userOffset, userOffset + limit - 1);
236
+ }
237
+ else {
238
+ query = query.limit(limit);
239
+ }
232
240
  }
233
241
  const { data, error } = await query;
234
242
  if (error) {
@@ -240,6 +248,11 @@ async function handleRead(supabase, itemIndex) {
240
248
  }
241
249
  }
242
250
  }
251
+ if (isMultiChunk && (userOffset > 0 || returnData.length > limit)) {
252
+ const sliced = returnData.slice(userOffset, userOffset + limit);
253
+ returnData.length = 0;
254
+ returnData.push(...sliced);
255
+ }
243
256
  }
244
257
  if (returnData.length === 0) {
245
258
  returnData.push({
@@ -180,12 +180,28 @@ function expandChunkedFilters(filters) {
180
180
  const staticFilters = [];
181
181
  const chunkedEntries = [];
182
182
  for (const filter of filters) {
183
- if (filter.operator === 'in' && Array.isArray(filter.value)) {
184
- const serialized = filter.value.map(String).join(',');
183
+ if (filter.operator === 'in') {
184
+ let values;
185
+ if (Array.isArray(filter.value)) {
186
+ values = filter.value;
187
+ }
188
+ else if (typeof filter.value === 'string') {
189
+ let str = filter.value.trim();
190
+ if (str.startsWith('(') && str.endsWith(')'))
191
+ str = str.slice(1, -1);
192
+ if (str.startsWith('[') && str.endsWith(']'))
193
+ str = str.slice(1, -1);
194
+ values = str.split(',').map(v => v.trim()).filter(v => v.length > 0);
195
+ }
196
+ else {
197
+ staticFilters.push(filter);
198
+ continue;
199
+ }
200
+ const serialized = values.map(String).join(',');
185
201
  if (serialized.length > exports.IN_FILTER_MAX_CHAR_LENGTH) {
186
202
  chunkedEntries.push({
187
- filter,
188
- chunks: chunkInFilterValues(filter.value),
203
+ filter: { ...filter, value: values },
204
+ chunks: chunkInFilterValues(values),
189
205
  });
190
206
  continue;
191
207
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fachkraftfreund/n8n-nodes-supabase",
3
- "version": "1.2.12",
3
+ "version": "1.2.13",
4
4
  "description": "Comprehensive n8n community node for Supabase with database and storage operations",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",