mobql
mobql copied to clipboard
Feature: Better API for registering objects
Currently, the API for registering objects doesn't work well for adding features without getting very verbose, and has potential for breaking changes to the API. The API should be switched to options passed as an object so that new options can be added without creating a breaking change.
Current API
registerListType<T extends DataLoadedListEntry>(
object: new (id: string, manager: DataLoadedListEntryManager<any>) => T,
queryName: string,
typename?: string,
idName: string = "id",
idType: string = "ID!"
)
registerObject<T extends DataLoadedObject>(
object: new (...args: any[]) => T,
queryName: string,
typename?: string
)
Proposed API
registerListType<T extends DataLoadedListEntry>(
object: new (id: string, manager: DataLoadedListEntryManager<any>) => T,
options: ListTypeOptions,
)
registerObject<T extends DataLoadedObject>(
object: new (...args: any[]) => T,
options: ObjectTypeOptions,
)