-
-
Notifications
You must be signed in to change notification settings - Fork 2
Collection-resolvers #103
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
Open
odama626
wants to merge
30
commits into
FlatbreadLabs:main
Choose a base branch
from
odama626:collection-resolvers
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Collection-resolvers #103
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
ceb7697
wip
odama626 9339af9
refactor collection metadata
odama626 a3cc34a
Merge branch 'main' into mutate
odama626 9410310
add more metadata to collection
odama626 df774c0
add json assertsions
odama626 fdefe15
update mutations update file and memory :D, breaks ava watch
odama626 978b130
isolate context based on plugin, major breaking changes
odama626 b724de1
comments
odama626 2309708
added sourceMemory to allow for testing without a filesystem
odama626 27912b9
sourceVirtual
odama626 a1fd32d
disable star paths, add basic create mutations
odama626 22da949
handle creating new records with variable paths
odama626 ed214f3
Merge branch 'main' into mutate
odama626 f31e91f
remove nanoid-dictionary
odama626 e43f01c
cleanups, add required fields to resolvers, add upsert resolver
odama626 251ec6b
Merge branch 'main' into mutate
odama626 a18ee39
expose collectionResolvers to config
odama626 259d940
prettier
odama626 fe42961
test husky
odama626 40f4c26
test husky
odama626 02bc50f
remove stray arg
odama626 b82ddf5
Merge branch 'main' into mutate
odama626 4d98b05
Merge branch 'mutate' into collection-resolvers
odama626 30b9953
Merge branch 'main' into mutate
odama626 20158df
migrate sveltekit
odama626 215ecce
add error messages, prevent creating record with existing id, use ref…
odama626 04a9983
fix tests
odama626 231442f
Merge branch 'mutate' into collection-resolvers
odama626 eb4c5b0
linting
odama626 2bd9687
Merge branch 'mutate' into collection-resolvers
odama626 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 hidden or 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,8 @@ | ||
| --- | ||
| name: Adam | ||
| friend: Amanda | ||
| enjoys: | ||
| - cats | ||
| - coding | ||
| - flatbread | ||
| --- |
This file contains hidden or 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,7 @@ | ||
| --- | ||
| name: Amanda | ||
| enjoys: | ||
| - cats | ||
| - coding | ||
| - flatbread | ||
| --- |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
File renamed without changes.
This file contains hidden or 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,55 @@ | ||
| <script lang="ts"> | ||
| import { browser } from '$app/env'; | ||
| import Pane from './../lib/components/Pane.svelte'; | ||
|
|
||
| /** @type {import('./$types').PageData}*/ | ||
| export let data; | ||
|
|
||
| if (browser) { | ||
| import('svimg/dist/s-image'); | ||
| } | ||
|
|
||
| export let error = null; | ||
| if (error) console.error(error); | ||
|
|
||
| function joinAuthors(authors) { | ||
| return authors?.map((author) => author.name).join(', '); | ||
| } | ||
| </script> | ||
|
|
||
| <div class="grid grid-cols-2 divide-x-2 divide-black"> | ||
| <Pane label="JSON Output"> | ||
| <pre | ||
| class="overflow-auto p-3" | ||
| style="height: calc(100vh - 3.5rem);"> | ||
| <code class="text-sm"> | ||
| {JSON.stringify(data, null, 2)} | ||
| </code> | ||
| </pre> | ||
| </Pane> | ||
| <Pane label="Frontend"> | ||
| {#each data.allPostCategories as post, _ (post.id)} | ||
| <article class="m-3 border border-opacity-20 bg-gray-50 p-3"> | ||
| <h3 class="text-xl font-medium">{post.title}</h3> | ||
| <ul> | ||
| <li class="text-xs font-semibold text-gray-500"> | ||
| <div class="flex"> | ||
| {#each post.authors as author} | ||
| <div> | ||
| <div class="h-12 w-12"> | ||
| <s-image {...author.image} /> | ||
| </div> | ||
| {author.name} | ||
| </div> | ||
| {/each} | ||
| </div> | ||
| </li> | ||
| <li class="text-xs font-semibold text-gray-500"> | ||
| Rating: {post.rating} | ||
| </li> | ||
| </ul> | ||
| <div>{@html post._content.html}</div> | ||
| </article> | ||
| {/each} | ||
| </Pane> | ||
| </div> |
This file contains hidden or 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,79 @@ | ||
| import { error } from '@sveltejs/kit'; | ||
|
|
||
| export const load = async ({ fetch }) => { | ||
| const query = ` | ||
| query PostCategory { | ||
| allPostCategories (sortBy: "title", order: DESC) { | ||
| _metadata { | ||
| sourceContext { | ||
| filename | ||
| slug | ||
| } | ||
| collection | ||
| } | ||
| id | ||
| title | ||
| category | ||
| slug | ||
| rating | ||
| _content { | ||
| raw | ||
| html | ||
| excerpt | ||
| timeToRead | ||
| } | ||
| authors { | ||
| _metadata { | ||
| sourceContext { | ||
| slug | ||
| } | ||
| } | ||
| id | ||
| name | ||
| entity | ||
| enjoys | ||
| image { | ||
| srcset | ||
| srcsetwebp | ||
| srcsetavif | ||
| placeholder | ||
| aspectratio | ||
| } | ||
| friend { | ||
| name | ||
| date_joined | ||
| } | ||
| date_joined | ||
| skills { | ||
| sitting | ||
| breathing | ||
| liquid_consumption | ||
| existence | ||
| sports | ||
| } | ||
| } | ||
| } | ||
| } | ||
| `; | ||
|
|
||
| try { | ||
| const response = await fetch('http://localhost:5057/graphql', { | ||
| body: JSON.stringify({ | ||
| query, | ||
| }), | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| Accept: 'application/json', | ||
| }, | ||
| method: 'POST', | ||
| }); | ||
|
|
||
| const { data, errors } = await response.json(); | ||
|
|
||
| if (errors) | ||
| throw error(500, errors.map(({ message }) => message).join('\\n')); | ||
| return data; | ||
| } catch (e) { | ||
| throw error(500, 'Failed to load data'); | ||
| } | ||
| }; |
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.
Should we rename
contenttocollectionsfor consistency?