Merge pull request #760 from AnishSarkar22/fix/connectors

fix: various issues with connectors & other issues
This commit is contained in:
Rohan Verma 2026-02-01 17:38:48 -08:00 committed by GitHub
commit 32ab938329
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
49 changed files with 1829 additions and 107 deletions

View file

@ -5,6 +5,7 @@ import {
type DeleteConnectorRequest,
deleteConnectorRequest,
deleteConnectorResponse,
type DiscordChannel,
type GetConnectorRequest,
type GetConnectorsRequest,
getConnectorRequest,
@ -16,10 +17,13 @@ import {
indexConnectorResponse,
type ListGitHubRepositoriesRequest,
type ListGoogleDriveFoldersRequest,
listDiscordChannelsResponse,
listGitHubRepositoriesRequest,
listGitHubRepositoriesResponse,
listGoogleDriveFoldersRequest,
listGoogleDriveFoldersResponse,
listSlackChannelsResponse,
type SlackChannel,
type UpdateConnectorRequest,
updateConnectorRequest,
updateConnectorResponse,
@ -335,6 +339,36 @@ class ConnectorsApiService {
}
);
};
// =============================================================================
// Slack Connector Methods
// =============================================================================
/**
* Get Slack channels with bot membership status
*/
getSlackChannels = async (connectorId: number) => {
return baseApiService.get(
`/api/v1/slack/connector/${connectorId}/channels`,
listSlackChannelsResponse
);
};
// =============================================================================
// Discord Connector Methods
// =============================================================================
/**
* Get Discord text channels for a connector
*/
getDiscordChannels = async (connectorId: number) => {
return baseApiService.get(
`/api/v1/discord/connector/${connectorId}/channels`,
listDiscordChannelsResponse
);
};
}
export type { SlackChannel, DiscordChannel };
export const connectorsApiService = new ConnectorsApiService();

View file

@ -55,7 +55,8 @@ const pendingSyncs = new Map<string, Promise<SyncHandle>>();
// Version for sync state - increment this to force fresh sync when Electric config changes
// v2: user-specific database architecture
// v3: consistent cutoff date for sync+queries, visibility refresh support
const SYNC_VERSION = 3;
// v4: heartbeat-based stale notification detection with updated_at tracking
const SYNC_VERSION = 4;
// Database name prefix for identifying SurfSense databases
const DB_PREFIX = "surfsense-";

View file

@ -0,0 +1,24 @@
import { differenceInDays, differenceInMinutes, format, isToday, isYesterday } from "date-fns";
/**
* Format a date string as a human-readable relative time
* - < 1 min: "Just now"
* - < 60 min: "15m ago"
* - Today: "Today, 2:30 PM"
* - Yesterday: "Yesterday, 2:30 PM"
* - < 7 days: "3d ago"
* - Older: "Jan 15, 2026"
*/
export function formatRelativeDate(dateString: string): string {
const date = new Date(dateString);
const now = new Date();
const minutesAgo = differenceInMinutes(now, date);
const daysAgo = differenceInDays(now, date);
if (minutesAgo < 1) return "Just now";
if (minutesAgo < 60) return `${minutesAgo}m ago`;
if (isToday(date)) return `Today, ${format(date, "h:mm a")}`;
if (isYesterday(date)) return `Yesterday, ${format(date, "h:mm a")}`;
if (daysAgo < 7) return `${daysAgo}d ago`;
return format(date, "MMM d, yyyy");
}