Skip to content

Commit be01b9c

Browse files
committed
Try reducing bundle size
1 parent 5569da9 commit be01b9c

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

packages/core/src/integrations/supabase.ts

+2-21
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable max-lines */
2-
import { logger, isPlainObject } from '../utils-hoist';
2+
import { isPlainObject } from '../utils-hoist';
33

44
import type { Span, IntegrationFn } from '../types-hoist';
55
import { setHttpStatus, startInactiveSpan } from '../tracing';
@@ -57,20 +57,10 @@ export interface SupabaseBreadcrumb {
5757
export const AVAILABLE_OPERATIONS = ['select', 'insert', 'upsert', 'update', 'delete'];
5858

5959
export const FILTER_MAPPINGS = {
60-
eq: 'eq',
61-
neq: 'neq',
62-
gt: 'gt',
63-
gte: 'gte',
64-
lt: 'lt',
65-
lte: 'lte',
66-
like: 'like',
6760
'like(all)': 'likeAllOf',
6861
'like(any)': 'likeAnyOf',
69-
ilike: 'ilike',
7062
'ilike(all)': 'ilikeAllOf',
7163
'ilike(any)': 'ilikeAnyOf',
72-
is: 'is',
73-
in: 'in',
7464
cs: 'contains',
7565
cd: 'containedBy',
7666
sr: 'rangeGt',
@@ -79,11 +69,6 @@ export const FILTER_MAPPINGS = {
7969
nxr: 'rangeLte',
8070
adj: 'rangeAdjacent',
8171
ov: 'overlaps',
82-
fts: '',
83-
plfts: 'plain',
84-
phfts: 'phrase',
85-
wfts: 'websearch',
86-
not: 'not',
8772
};
8873

8974
const instrumented = new Map();
@@ -150,7 +135,7 @@ export function translateFiltersIntoMethods(key: string, query: string): string
150135
} else if (filter?.startsWith('wfts')) {
151136
method = 'textSearch[websearch]';
152137
} else {
153-
method = (filter && FILTER_MAPPINGS[filter as keyof typeof FILTER_MAPPINGS]) || 'filter';
138+
method = (filter && FILTER_MAPPINGS[filter as keyof typeof FILTER_MAPPINGS]) || filter || 'filter';
154139
}
155140

156141
return `${method}(${key}, ${value.join('.')})`;
@@ -360,8 +345,6 @@ function instrumentPostgrestQueryBuilder(PostgrestQueryBuilder: new () => Postgr
360345
// We need to wrap _all_ operations despite them sharing the same `PostgrestFilterBuilder`
361346
// constructor, as we don't know which method will be called first, an we don't want to miss any calls.
362347
for (const operation of AVAILABLE_OPERATIONS) {
363-
logger.log(`Instrumenting ${operation} operation`);
364-
365348
instrumented.set(PostgrestQueryBuilder, {
366349
[operation]: (PostgrestQueryBuilder.prototype as Record<string, unknown>)[
367350
operation as 'select' | 'insert' | 'upsert' | 'update' | 'delete'
@@ -376,8 +359,6 @@ function instrumentPostgrestQueryBuilder(PostgrestQueryBuilder: new () => Postgr
376359
const rv = Reflect.apply(target, thisArg, argumentsList);
377360
const PostgrestFilterBuilder = (rv as PostgrestFilterBuilder).constructor;
378361

379-
logger.log(`Instrumenting ${operation} operation's PostgrestFilterBuilder`);
380-
381362
instrumentPostgrestFilterBuilder(PostgrestFilterBuilder);
382363

383364
return rv;

0 commit comments

Comments
 (0)