Skip to content
Permalink
Browse files
feat(datasync): add interface
  • Loading branch information
Enda Phelan committed Sep 23, 2020
1 parent 96083f0 commit f46e9200def565b0b0e34ccc13f7efa50f346550
Showing 1 changed file with 19 additions and 1 deletion.
@@ -8,7 +8,25 @@ import { createDataSyncConflictProviderCreator } from '../providers';

type DataSyncGraphbackAPIConfig = Omit<GraphbackAPIConfig, "dataProviderCreator">

export function createDataSyncAPI(model: string | GraphQLSchema, createDataSyncConfig: { db: Db, conflictConfig?: GlobalConflictConfig, graphbackAPIConfig?: DataSyncGraphbackAPIConfig }): GraphbackAPI {
/**
* Config to create a Graphback DataSync API
*/
export interface DataSyncAPIConfig {
/**
* MongoDB driver
*/
db: Db,
/**
* Conflict configmap for the data models
*/
conflictConfig?: GlobalConflictConfig
/**
* GraphbackAPI config
*/
graphbackAPIConfig?: DataSyncGraphbackAPIConfig
}

export function createDataSyncAPI(model: string | GraphQLSchema, createDataSyncConfig: DataSyncAPIConfig): GraphbackAPI {
const { db, conflictConfig, graphbackAPIConfig } = createDataSyncConfig;

return buildGraphbackAPI(model, {

0 comments on commit f46e920

Please sign in to comment.