-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bringing Prisma entities to the frontend #962
Merged
Merged
Changes from 58 commits
Commits
Show all changes
63 commits
Select commit
Hold shift + click to select a range
4eb5fce
Support typing backend queries
sodic c418d43
Implement types for actions and extract entities
sodic b9f68e4
Merge remote-tracking branch 'origin/main' into filip-types-for-queri…
sodic 2d45fb6
Add Prisma entities to the frontend
sodic 3441e73
Add frontend types to internal todoApp
sodic 7e9a8a4
Merge remote-tracking branch 'origin/main' into filip-frontend-entities
sodic 994c64a
Undo moving for easier review
sodic 807f58c
Revert back to generating a query.js file
sodic 917299a
Rename buildEntityData
sodic 693a9c3
Remove solved todo in schema template
sodic acdea9a
Fix docs in method
sodic 8464fec
Adding uninstall command (#953)
infomiho adf2ac9
Use StrongPath instead of FilePath
sodic e7a3386
Fix review feedback
sodic b3a9c99
Merge remote-tracking branch 'origin/main' into filip-frontend-entities
sodic 9fed4c9
Move prisma client generation messages
sodic 3c0e9fd
Generalize FileDraft functions
sodic 38c7b55
Generate prisma clients using ENV
sodic 7714d56
Fix schema checksum check
sodic 7b1b08b
Small refactor in db generator
sodic acc3e0f
Run prisma generate from server root dir
sodic 46ca1a9
Fix types for useAction
sodic d714717
Fix type error for useAction
sodic 7b17987
Fix schema generation in Dockerfile
sodic 30fe6fc
Refactor passing env vars to prisma schema
sodic 1ce7aae
Fix useAction types
sodic c75cd3c
Replace Prelude readFile with SP readFile
sodic fba3e46
Add comment for prisma/client in web app
sodic b51b631
Replace Prelude writeFile with SP writeFile
sodic 5cba399
Replace do and if with ifM
sodic 4ccbe72
Rename readProjectTelemetryFile
sodic 7cc9541
Refactor readOrCreateUserSignatureFile
sodic 43516f5
Remove redundant comment
sodic f6dc618
Fix typo in variable name
sodic f82922a
Simulate unions with a type class
sodic f49ecf8
Further improve strongpath types
sodic ccd3548
Generate prisma clients after migration
sodic d8750a8
Change ModuleRootDir to ComponentRootDir
sodic 77ad8a7
Remove solved todo
sodic eff0595
Merge remote-tracking branch 'origin/main' into filip-frontend-entities
sodic c01f0af
Improve naming
sodic d817192
Remove redundant env variable
sodic 1c73bf6
Improve formatting
sodic beaaabe
Merge remote-tracking branch 'origin/main' into filip-frontend-entities
sodic 1435a70
Fix errors after merging
sodic 5a3b4f8
Change local function name
sodic 8b78054
Rename local function again
sodic 533ef8a
Update changelog
sodic 0b3eafb
Fix error type in useQuery
sodic c754861
Rename Component to AppComponent
sodic ddf6113
Refactor DbGenerator
sodic 6f61e31
Explain Abs paths in SP helpers
sodic 95a747b
Update e2e tests
sodic 89a8e53
Fix formatting
sodic a70c86c
Change signature for doesFileExist
sodic 8c74e6b
Change signature for SP functions
sodic 2eb4c9d
Remove redundant do block
sodic c376d78
Fix formatting
sodic 105f5c6
Reorder functions
sodic bddc967
Rename module to appComponent in functions
sodic 5b089c3
Rename module to component in functions
sodic 3fcdd53
Rename telemetry cache function
sodic 5c92849
Fix formatting
sodic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -14,14 +14,14 @@ export type Action<Input, Output> = (args?: Input) => Promise<Output>; | |
* action with extra options. | ||
* | ||
*/ | ||
export type ActionOptions<ActionInput, CachedData> = { | ||
optimisticUpdates: OptimisticUpdateDefinition<ActionInput, CachedData>[] | ||
export type ActionOptions<ActionInput> = { | ||
optimisticUpdates: OptimisticUpdateDefinition<ActionInput, any>[] | ||
} | ||
|
||
/** | ||
* A documented (public) way to define optimistic updates. | ||
*/ | ||
export type OptimisticUpdateDefinition<ActionInput, CachedData = unknown> = { | ||
export type OptimisticUpdateDefinition<ActionInput, CachedData> = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file contains unrelated fixes for a bug that came to light when I introduced the entities to the frontend. |
||
getQuerySpecifier: GetQuerySpecifier<ActionInput, CachedData> | ||
updateQuery: UpdateQuery<ActionInput, CachedData> | ||
} | ||
|
@@ -50,9 +50,9 @@ export type QuerySpecifier<Input, Output> = [Query<Input, Output>, ...any[]] | |
* @param actionOptions An options object for enhancing/decorating the given Action. | ||
* @returns A decorated Action with added behavior but an unchanged API. | ||
*/ | ||
export function useAction<Input = unknown, Output = unknown, CachedData = unknown>( | ||
export function useAction<Input = unknown, Output = unknown>( | ||
actionFn: Action<Input, Output>, | ||
actionOptions?: ActionOptions<Input, CachedData> | ||
actionOptions?: ActionOptions<Input> | ||
): typeof actionFn { | ||
const queryClient = useQueryClient(); | ||
|
||
|
18 changes: 18 additions & 0 deletions
18
waspc/data/Generator/templates/react-app/src/entities/index.ts
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,18 @@ | ||
{{={= =}=}} | ||
sodic marked this conversation as resolved.
Show resolved
Hide resolved
shayneczyzewski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import { | ||
{=# entities =} | ||
{= name =}, | ||
{=/ entities =} | ||
} from '@prisma/client' | ||
|
||
export type { | ||
{=# entities =} | ||
{= name =}, | ||
{=/ entities =} | ||
} from '@prisma/client' | ||
|
||
export type WaspEntity = | ||
{=# entities =} | ||
| {= name =} | ||
{=/ entities =} | ||
| never |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit.: I think the point of having
File
in the name was to indicate this function reads a file, which is now not evident any more. Maybe it is not important though. But I would consider leaving it. So you could just addFile
at the end. But ok, if you like this better that is also ok.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I can change it back.