-
-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: react-hooks generator and runtime targeting @tanstack/react-que…
…ry (#309) Co-authored-by: Jonathan Gerbaud <jonathan.gerbaud@abewy.com>
- Loading branch information
1 parent
955e657
commit 21ccddb
Showing
24 changed files
with
2,784 additions
and
2,063 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { DMMF } from '@prisma/generator-helper'; | ||
import { PluginError, type PluginOptions } from '@zenstackhq/sdk'; | ||
import type { Model } from '@zenstackhq/sdk/ast'; | ||
import { generate as reactQueryGenerate } from './react-query'; | ||
import { generate as swrGenerate } from './swr'; | ||
|
||
export async function generate(model: Model, options: PluginOptions, dmmf: DMMF.Document) { | ||
const fetcher = (options.fetcher as string) ?? 'swr'; | ||
switch (fetcher) { | ||
case 'swr': | ||
return swrGenerate(model, options, dmmf); | ||
case 'react-query': | ||
return reactQueryGenerate(model, options, dmmf); | ||
default: | ||
throw new PluginError(`Unknown "fetcher" option: ${fetcher}, use "swr" or "react-query"`); | ||
} | ||
} |
Oops, something went wrong.