@dataql/astro
Version:
DataQL Astro SDK with SSR/SSG support and multi-framework compatibility
101 lines (100 loc) • 2.5 kB
TypeScript
export interface QueryResult<T = any> {
data: T[];
isFromCache: boolean;
lastUpdated?: Date;
error?: string;
}
export interface MutationResult<T = any> {
success: boolean;
data?: T;
error?: string;
insertedId?: string;
modifiedCount?: number;
deletedCount?: number;
}
export interface SyncStatus {
isOnline: boolean;
lastSyncTime: Date | null;
pendingOperations: number;
failedOperations: number;
syncInProgress: boolean;
}
export type SyncEventType = "sync_start" | "sync_complete" | "sync_error" | "sync_progress";
export interface SyncEvent {
type: SyncEventType;
timestamp: Date;
error?: string;
progress?: number;
total?: number;
}
export interface OfflineOperation {
id: string;
type: "create" | "update" | "upsert" | "delete";
tableName: string;
data: any;
timestamp: Date;
status: "pending" | "syncing" | "synced" | "failed";
retryCount: number;
error?: string;
serverId?: string;
}
export interface DataQLAstroConfig {
appToken?: string;
databaseName?: string;
syncConfig?: AstroSyncConfig;
enablePersistence?: boolean;
staticGeneration?: boolean;
islandMode?: boolean;
staticConfig?: StaticDataConfig;
islandConfig?: IslandConfig;
debug?: boolean;
}
export interface AstroSyncConfig {
serverUrl?: string;
syncInterval?: number;
retryCount?: number;
batchSize?: number;
autoSync?: boolean;
enableStaticSync?: boolean;
enableIslandSync?: boolean;
}
export interface StaticDataConfig {
enableStaticQueries?: boolean;
staticQueryPaths?: string[];
preloadData?: boolean;
buildTimeGeneration?: boolean;
}
export interface IslandConfig {
enableIslandHydration?: boolean;
islandComponents?: string[];
hydrateOnVisible?: boolean;
hydrateOnIdle?: boolean;
}
export interface AstroDataQLContext {
isServer: boolean;
isStatic: boolean;
isIsland: boolean;
mode?: "development" | "production";
request?: any;
}
export interface ConnectionOptions {
timeout?: number;
retries?: number;
backoff?: "linear" | "exponential";
}
export interface CustomRequestConnection {
url?: string;
headers?: Record<string, string>;
}
export interface WorkerBinding {
name?: string;
type?: string;
}
export interface InternalConnectionConfig {
enabled?: boolean;
endpoint?: string;
}
export interface DatabaseConfig {
name?: string;
url?: string;
}