@fachkraftfreund/n8n-nodes-supabase 1.2.10 → 1.2.11

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.
@@ -12,6 +12,6 @@ export declare function validateTableName(tableName: string): void;
12
12
  export declare function validateColumnName(columnName: string): void;
13
13
  export declare function convertFilterOperator(operator: string): string;
14
14
  export declare function normalizeFilterValue(operator: string, value: string | number | boolean | null | unknown[]): string | number | boolean | null;
15
- export declare const IN_FILTER_CHUNK_SIZE = 200;
16
- export declare function chunkArray<T>(arr: T[], size: number): T[][];
15
+ export declare const IN_FILTER_MAX_CHAR_LENGTH = 4000;
16
+ export declare function chunkInFilterValues(values: unknown[]): unknown[][];
17
17
  export declare function expandChunkedFilters(filters: IRowFilter[]): IRowFilter[][];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.expandChunkedFilters = exports.chunkArray = exports.IN_FILTER_CHUNK_SIZE = exports.normalizeFilterValue = exports.convertFilterOperator = exports.validateColumnName = exports.validateTableName = exports.sanitizeColumnName = exports.isNetworkError = exports.isAuthError = exports.formatSupabaseError = exports.getDatabaseUrl = exports.getStorageUrl = exports.validateCredentials = exports.createSupabaseClient = void 0;
3
+ exports.expandChunkedFilters = exports.chunkInFilterValues = exports.IN_FILTER_MAX_CHAR_LENGTH = exports.normalizeFilterValue = exports.convertFilterOperator = exports.validateColumnName = exports.validateTableName = exports.sanitizeColumnName = exports.isNetworkError = exports.isAuthError = exports.formatSupabaseError = exports.getDatabaseUrl = exports.getStorageUrl = exports.validateCredentials = exports.createSupabaseClient = void 0;
4
4
  const supabase_js_1 = require("@supabase/supabase-js");
5
5
  function createSupabaseClient(credentials) {
6
6
  const client = (0, supabase_js_1.createClient)(credentials.host, credentials.serviceKey, {
@@ -152,28 +152,45 @@ function normalizeFilterValue(operator, value) {
152
152
  return value;
153
153
  }
154
154
  exports.normalizeFilterValue = normalizeFilterValue;
155
- exports.IN_FILTER_CHUNK_SIZE = 200;
156
- function chunkArray(arr, size) {
155
+ exports.IN_FILTER_MAX_CHAR_LENGTH = 4000;
156
+ function chunkInFilterValues(values) {
157
157
  const chunks = [];
158
- for (let i = 0; i < arr.length; i += size) {
159
- chunks.push(arr.slice(i, i + size));
158
+ let currentChunk = [];
159
+ let currentLength = 0;
160
+ for (const value of values) {
161
+ const valueStr = String(value);
162
+ const addedLength = currentChunk.length === 0 ? valueStr.length : valueStr.length + 1;
163
+ if (currentLength + addedLength > exports.IN_FILTER_MAX_CHAR_LENGTH && currentChunk.length > 0) {
164
+ chunks.push(currentChunk);
165
+ currentChunk = [value];
166
+ currentLength = valueStr.length;
167
+ }
168
+ else {
169
+ currentChunk.push(value);
170
+ currentLength += addedLength;
171
+ }
172
+ }
173
+ if (currentChunk.length > 0) {
174
+ chunks.push(currentChunk);
160
175
  }
161
176
  return chunks;
162
177
  }
163
- exports.chunkArray = chunkArray;
178
+ exports.chunkInFilterValues = chunkInFilterValues;
164
179
  function expandChunkedFilters(filters) {
165
180
  const staticFilters = [];
166
181
  const chunkedEntries = [];
167
182
  for (const filter of filters) {
168
- if (filter.operator === 'in' && Array.isArray(filter.value) && filter.value.length > exports.IN_FILTER_CHUNK_SIZE) {
169
- chunkedEntries.push({
170
- filter,
171
- chunks: chunkArray(filter.value, exports.IN_FILTER_CHUNK_SIZE),
172
- });
173
- }
174
- else {
175
- staticFilters.push(filter);
183
+ if (filter.operator === 'in' && Array.isArray(filter.value)) {
184
+ const serialized = filter.value.map(String).join(',');
185
+ if (serialized.length > exports.IN_FILTER_MAX_CHAR_LENGTH) {
186
+ chunkedEntries.push({
187
+ filter,
188
+ chunks: chunkInFilterValues(filter.value),
189
+ });
190
+ continue;
191
+ }
176
192
  }
193
+ staticFilters.push(filter);
177
194
  }
178
195
  if (chunkedEntries.length === 0) {
179
196
  return [filters];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fachkraftfreund/n8n-nodes-supabase",
3
- "version": "1.2.10",
3
+ "version": "1.2.11",
4
4
  "description": "Comprehensive n8n community node for Supabase with database and storage operations",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",