@fachkraftfreund/n8n-nodes-supabase 1.3.14 → 1.4.0
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.
|
@@ -786,12 +786,22 @@ async function handleCount(supabase, itemIndex, hostUrl) {
|
|
|
786
786
|
const table = this.getNodeParameter('table', itemIndex);
|
|
787
787
|
(0, supabaseClient_1.validateTableName)(table);
|
|
788
788
|
const filters = getFilters(this, itemIndex);
|
|
789
|
-
const
|
|
789
|
+
const joins = this.getNodeParameter('joins.join', itemIndex, []);
|
|
790
|
+
let selectWithJoins = '*';
|
|
791
|
+
for (const j of joins) {
|
|
792
|
+
if (!j.table)
|
|
793
|
+
continue;
|
|
794
|
+
const cols = j.columns || '*';
|
|
795
|
+
const hint = j.joinType === 'inner' ? `${j.table}!inner` : j.table;
|
|
796
|
+
selectWithJoins += `,${hint}(${cols})`;
|
|
797
|
+
}
|
|
798
|
+
const overhead = (0, supabaseClient_1.estimateUrlOverhead)(hostUrl, table, selectWithJoins, filters);
|
|
790
799
|
const maxInChars = Math.max(500, supabaseClient_1.MAX_SAFE_URL_LENGTH - overhead);
|
|
791
|
-
const
|
|
800
|
+
const maxItems = (0, supabaseClient_1.computeMaxIdsPerChunk)(selectWithJoins);
|
|
801
|
+
const filterChunks = (0, supabaseClient_1.expandChunkedFilters)(filters, maxInChars, maxItems);
|
|
792
802
|
let totalCount = 0;
|
|
793
803
|
for (const chunkFilters of filterChunks) {
|
|
794
|
-
let query = supabase.from(table).select(
|
|
804
|
+
let query = supabase.from(table).select(selectWithJoins, { count: 'exact', head: true });
|
|
795
805
|
for (const filter of chunkFilters) {
|
|
796
806
|
const operator = (0, supabaseClient_1.convertFilterOperator)(filter.operator);
|
|
797
807
|
query = query.filter(filter.column, operator, (0, supabaseClient_1.normalizeFilterValue)(filter.operator, filter.value));
|
package/package.json
CHANGED