Skip to content

Commit 6fcc820

Browse files
committed
removed redundant util
1 parent 82b874c commit 6fcc820

File tree

4 files changed

+29
-31
lines changed

4 files changed

+29
-31
lines changed

apps/sim/app/workspace/[workspaceId]/knowledge/[id]/components/connectors-section/connectors-section.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import {
3434
} from '@/lib/oauth'
3535
import { EditConnectorModal } from '@/app/workspace/[workspaceId]/knowledge/[id]/components/edit-connector-modal/edit-connector-modal'
3636
import { OAuthRequiredModal } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/credential-selector/components/oauth-required-modal'
37-
import { CONNECTOR_META } from '@/connectors/icons'
3837
import { CONNECTOR_REGISTRY } from '@/connectors/registry'
3938
import type { ConnectorData, SyncLogData } from '@/hooks/queries/kb/connectors'
4039
import {
@@ -265,15 +264,14 @@ function ConnectorCard({
265264
const [expanded, setExpanded] = useState(false)
266265
const [showOAuthModal, setShowOAuthModal] = useState(false)
267266

268-
const meta = CONNECTOR_META[connector.connectorType]
269-
const Icon = meta?.icon
267+
const connectorDef = CONNECTOR_REGISTRY[connector.connectorType]
268+
const Icon = connectorDef?.icon
270269
const statusConfig =
271270
STATUS_CONFIG[connector.status as keyof typeof STATUS_CONFIG] || STATUS_CONFIG.active
272271

273-
const connectorConfig = CONNECTOR_REGISTRY[connector.connectorType]
274-
const serviceId = connectorConfig?.oauth.provider
272+
const serviceId = connectorDef?.oauth.provider
275273
const providerId = serviceId ? getProviderIdFromServiceId(serviceId) : undefined
276-
const requiredScopes = connectorConfig?.oauth.requiredScopes ?? []
274+
const requiredScopes = connectorDef?.oauth.requiredScopes ?? []
277275

278276
const { data: credentials } = useOAuthCredentials(providerId)
279277

@@ -297,7 +295,7 @@ function ConnectorCard({
297295
<div className='flex flex-col gap-[2px]'>
298296
<div className='flex items-center gap-[8px]'>
299297
<span className='font-medium text-[13px] text-[var(--text-primary)]'>
300-
{meta?.name || connector.connectorType}
298+
{connectorDef?.name || connector.connectorType}
301299
</span>
302300
<Badge variant={statusConfig.variant} className='text-[10px]'>
303301
{connector.status === 'syncing' && (
@@ -444,7 +442,7 @@ function ConnectorCard({
444442
isOpen={showOAuthModal}
445443
onClose={() => setShowOAuthModal(false)}
446444
provider={providerId as OAuthProvider}
447-
toolName={connectorConfig?.name ?? connector.connectorType}
445+
toolName={connectorDef?.name ?? connector.connectorType}
448446
requiredScopes={getCanonicalScopesForProvider(providerId)}
449447
newScopes={missingScopes}
450448
serviceId={serviceId}

apps/sim/connectors/github/github.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ export const githubConnector: ConnectorConfig = {
282282
const path = externalId
283283

284284
try {
285-
const url = `${GITHUB_API_URL}/repos/${owner}/${repo}/contents/${encodeURIComponent(path)}?ref=${encodeURIComponent(branch)}`
285+
const encodedPath = path.split('/').map(encodeURIComponent).join('/')
286+
const url = `${GITHUB_API_URL}/repos/${owner}/${repo}/contents/${encodedPath}?ref=${encodeURIComponent(branch)}`
286287
const response = await fetchWithRetry(url, {
287288
method: 'GET',
288289
headers: {

apps/sim/connectors/icons.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

apps/sim/lib/knowledge/documents/service.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,9 +804,28 @@ export interface TagFilterCondition {
804804
/**
805805
* Builds a Drizzle SQL condition from a tag filter.
806806
*/
807+
const ALLOWED_TAG_SLOTS = new Set([
808+
'tag1',
809+
'tag2',
810+
'tag3',
811+
'tag4',
812+
'tag5',
813+
'tag6',
814+
'tag7',
815+
'number1',
816+
'number2',
817+
'number3',
818+
'number4',
819+
'number5',
820+
'date1',
821+
'date2',
822+
'boolean1',
823+
'boolean2',
824+
'boolean3',
825+
])
826+
807827
function buildTagFilterCondition(filter: TagFilterCondition): SQL | undefined {
808-
const column = document[filter.tagSlot as keyof typeof document.$inferSelect]
809-
if (!column) return undefined
828+
if (!ALLOWED_TAG_SLOTS.has(filter.tagSlot)) return undefined
810829

811830
const col = document[filter.tagSlot as keyof typeof document]
812831

0 commit comments

Comments
 (0)