Skip to content

Commit

Permalink
feat: factory interface
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Jun 20, 2024
1 parent b710329 commit bde6d93
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/plenty-birds-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"alcaeus": patch
---

Export type for alcaeus factory
7 changes: 6 additions & 1 deletion packages/alcaeus/Factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ interface AlcaeusInit<D extends DatasetCore> {
Headers?: typeof Headers
}

export default <D extends DatasetCore<Quad, Quad>>({ dataset, fetch, Headers, rootSelectors }: AlcaeusInit<D> = {}) => class AlcaeusFactory {
export interface AlcaeusFactory<D extends DatasetCore = DatasetCore> {
hydra: HydraClient<D>
init(this: HydraEnvironment<D>): void
}

export default <D extends DatasetCore<Quad, Quad>>({ dataset, fetch, Headers, rootSelectors }: AlcaeusInit<D> = {}) => class implements AlcaeusFactory<D> {
hydra!: HydraClient<D>

init(this: HydraEnvironment<D>) {
Expand Down

0 comments on commit bde6d93

Please sign in to comment.