@fachkraftfreund/n8n-nodes-supabase 1.2.10 → 1.2.12

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.
@@ -891,12 +891,6 @@ class Supabase {
891
891
  async execute() {
892
892
  const items = this.getInputData();
893
893
  const returnData = [];
894
- const firstItem = items[0];
895
- if (items.length === 1 &&
896
- (firstItem === null || firstItem === void 0 ? void 0 : firstItem.json) &&
897
- Object.keys(firstItem.json).length === 0) {
898
- return [[{ json: {} }]];
899
- }
900
894
  const credentials = await this.getCredentials('supabaseExtendedApi');
901
895
  try {
902
896
  (0, supabaseClient_1.validateCredentials)(credentials);
@@ -909,6 +903,12 @@ class Supabase {
909
903
  const resource = this.getNodeParameter('resource', 0);
910
904
  const operation = this.getNodeParameter('operation', 0);
911
905
  if (resource === 'database' && ['create', 'upsert', 'update'].includes(operation)) {
906
+ const firstItem = items[0];
907
+ if (items.length === 1 &&
908
+ (firstItem === null || firstItem === void 0 ? void 0 : firstItem.json) &&
909
+ Object.keys(firstItem.json).length === 0) {
910
+ return [[{ json: {} }]];
911
+ }
912
912
  try {
913
913
  const results = await database_1.executeBulkDatabaseOperation.call(this, supabase, operation, items.length);
914
914
  returnData.push(...results);
@@ -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.12",
4
4
  "description": "Comprehensive n8n community node for Supabase with database and storage operations",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",