Skip to content

Commit

Permalink
Merge pull request #162 from Suwayomi/urql
Browse files Browse the repository at this point in the history
gql.tada + urql
  • Loading branch information
Robonau authored Feb 29, 2024
2 parents 5f3ba06 + 4380fc2 commit a766f4f
Show file tree
Hide file tree
Showing 120 changed files with 20,616 additions and 7,838 deletions.
5 changes: 3 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"printWidth": 80,
"plugins": ["prettier-plugin-svelte"],
"pluginSearchDirs": ["."],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }],
"bracketSameLine": false
}
30 changes: 30 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch server",
"request": "launch",
"runtimeArgs": ["run", "dev"],
"runtimeExecutable": "bun",
"skipFiles": ["<node_internals>/**"],
"type": "node",
"console": "internalConsole"
},
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome",
"url": "http://localhost:5173/api/graphql",
"webRoot": "${workspaceFolder}"
}
],
"compounds": [
{
"name": "Both",
"configurations": ["Launch server", "Launch Chrome"]
}
]
}
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,7 @@
"licenser.projectName": "suwayomi-VUI",
"licenser.author": "Contributors to the Suwayomi project",
"cSpell.words": ["iconify", "localsourcelang", "tipclass"],
"cSpell.ignoreRegExpList": ["\\s*import (.+\n?)+ from '.*';"]
"cSpell.ignoreRegExpList": ["\\s*import (.+\n?)+ from '.*';"],
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}
Binary file modified bun.lockb
Binary file not shown.
16 changes: 0 additions & 16 deletions codegen.ts

This file was deleted.

12 changes: 4 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"build-md5": "find build -type f | sort | xargs md5sum | awk '{ print $1 }' | tr -d '\n' | md5sum| awk '{ print $1 }' > buildZip/md5sum "
},
"devDependencies": {
"@0no-co/graphqlsp": "^1.4.1",
"@skeletonlabs/skeleton": "^2.7.1",
"@skeletonlabs/tw-plugin": "^0.3.1",
"@sveltejs/kit": "^2.5.0",
Expand All @@ -39,20 +40,15 @@
},
"type": "module",
"dependencies": {
"@apollo/client": "^3.8.10",
"@floating-ui/dom": "^1.6.0",
"@graphql-codegen/cli": "^5.0.0",
"@graphql-codegen/typescript": "^4.0.1",
"@graphql-codegen/typescript-operations": "^4.0.1",
"@iconify/svelte": "^3.1.6",
"@iconify/types": "^2.0.0",
"@sveltejs/adapter-static": "^3.0.1",
"@types/apollo-upload-client": "18.0.0",
"@types/dom-view-transitions": "^1.0.4",
"apollo-upload-client": "^18.0.1",
"@urql/exchange-graphcache": "^6.4.1",
"@urql/svelte": "^4.0.4",
"devalue": "^4.3.2",
"gql.tada": "^1.2.1",
"graphql": "^16.8.1",
"graphql-codegen-svelte-apollo": "^1.1.0",
"graphql-ws": "^5.14.3",
"p-queue": "^8.0.1",
"sveltekit-search-params": "^2.1.0"
Expand Down
4 changes: 3 additions & 1 deletion src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover" data-theme="skeleton">
<div style="display: contents" class="h-full overflow-hidden">%sveltekit.body%</div>
<div style="display: contents" class="h-full overflow-hidden">
%sveltekit.body%
</div>
</body>
</html>
81 changes: 66 additions & 15 deletions src/gql/Mutations.gql
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ mutation updateChapters(
updateChapters(
input: {
ids: $ids
patch: { isRead: $isRead, isBookmarked: $isBookmarked, lastPageRead: $lastPageRead }
patch: {
isRead: $isRead
isBookmarked: $isBookmarked
lastPageRead: $lastPageRead
}
}
) {
chapters {
Expand All @@ -36,8 +40,14 @@ mutation updateChapters(
}
}

mutation updateChapter($isRead: Boolean = null, $lastPageRead: Int!, $id: Int!) {
updateChapter(input: { id: $id, patch: { isRead: $isRead, lastPageRead: $lastPageRead } }) {
mutation updateChapter(
$isRead: Boolean = null
$lastPageRead: Int!
$id: Int!
) {
updateChapter(
input: { id: $id, patch: { isRead: $isRead, lastPageRead: $lastPageRead } }
) {
chapter {
id
isRead
Expand Down Expand Up @@ -91,7 +101,9 @@ mutation setMangaMeta($value: String!, $id: Int!, $key: String!) {
}

mutation setSourceMeta($value: String!, $sourceId: LongString!, $key: String!) {
setSourceMeta(input: { meta: { key: $key, sourceId: $sourceId, value: $value } }) {
setSourceMeta(
input: { meta: { key: $key, sourceId: $sourceId, value: $value } }
) {
meta {
source {
...SourceTypeFragment
Expand Down Expand Up @@ -153,7 +165,10 @@ mutation updateExtension(
$update: Boolean = null
) {
updateExtension(
input: { id: $pkgName, patch: { install: $install, uninstall: $uninstall, update: $update } }
input: {
id: $pkgName
patch: { install: $install, uninstall: $uninstall, update: $update }
}
) {
extension {
...ExtensionTypeFragment
Expand All @@ -179,7 +194,13 @@ mutation fetchSourceManga(
$filters: [FilterChangeInput!]
) {
fetchSourceManga(
input: { page: $page, source: $source, type: $type, query: $query, filters: $filters }
input: {
page: $page
source: $source
type: $type
query: $query
filters: $filters
}
) {
hasNextPage
mangas {
Expand Down Expand Up @@ -326,9 +347,16 @@ mutation updateCategory(
}
}

mutation updateMangasCategories($addTo: [Int!] = null, $clear: Boolean = null, $id: [Int!]!) {
mutation updateMangasCategories(
$addTo: [Int!] = null
$clear: Boolean = null
$id: [Int!]!
) {
updateMangasCategories(
input: { ids: $id, patch: { addToCategories: $addTo, clearCategories: $clear } }
input: {
ids: $id
patch: { addToCategories: $addTo, clearCategories: $clear }
}
) {
mangas {
id
Expand All @@ -341,9 +369,16 @@ mutation updateMangasCategories($addTo: [Int!] = null, $clear: Boolean = null, $
}
}

mutation updateMangaCategories($addTo: [Int!] = null, $clear: Boolean = null, $id: Int!) {
mutation updateMangaCategories(
$addTo: [Int!] = null
$clear: Boolean = null
$id: Int!
) {
updateMangaCategories(
input: { id: $id, patch: { addToCategories: $addTo, clearCategories: $clear } }
input: {
id: $id
patch: { addToCategories: $addTo, clearCategories: $clear }
}
) {
manga {
id
Expand Down Expand Up @@ -371,7 +406,11 @@ mutation ChaptersMigration(
updateChapters(
input: {
ids: $ids
patch: { isBookmarked: $isBookmarked, isRead: $isRead, lastPageRead: $lastPageRead }
patch: {
isBookmarked: $isBookmarked
isRead: $isRead
lastPageRead: $lastPageRead
}
}
) {
clientMutationId
Expand Down Expand Up @@ -464,7 +503,11 @@ mutation deleteDownloadedChapters($ids: [Int!]!) {

mutation clearCachedImages {
clearCachedImages(
input: { cachedPages: true, cachedThumbnails: true, downloadedThumbnails: true }
input: {
cachedPages: true
cachedThumbnails: true
downloadedThumbnails: true
}
) {
clientMutationId
}
Expand All @@ -489,7 +532,9 @@ mutation installExternalExtension($extensionFile: Upload!) {
}

mutation loginTrackerOAuth($callbackUrl: String!, $trackerId: Int!) {
loginTrackerOAuth(input: { callbackUrl: $callbackUrl, trackerId: $trackerId }) {
loginTrackerOAuth(
input: { callbackUrl: $callbackUrl, trackerId: $trackerId }
) {
isLoggedIn
tracker {
...TrackerTypeFragment
Expand All @@ -506,7 +551,11 @@ mutation logoutTracker($trackerId: Int!) {
}
}

mutation loginTrackerCredentials($password: String!, $trackerId: Int!, $username: String!) {
mutation loginTrackerCredentials(
$password: String!
$trackerId: Int!
$username: String!
) {
loginTrackerCredentials(
input: { password: $password, trackerId: $trackerId, username: $username }
) {
Expand All @@ -517,7 +566,9 @@ mutation loginTrackerCredentials($password: String!, $trackerId: Int!, $username
}

mutation bindTrack($mangaId: Int!, $remoteId: LongString!, $trackerId: Int!) {
bindTrack(input: { mangaId: $mangaId, remoteId: $remoteId, trackerId: $trackerId }) {
bindTrack(
input: { mangaId: $mangaId, remoteId: $remoteId, trackerId: $trackerId }
) {
trackRecord {
...TrackRecordTypeFragment
}
Expand Down
6 changes: 5 additions & 1 deletion src/gql/Queries.gql
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,11 @@ query ConditionalChaptersOfGivenManga(
) {
chapters(
filter: { mangaId: { in: $in } }
condition: { isDownloaded: $isDownloaded, isRead: $isRead, isBookmarked: $isBookmarked }
condition: {
isDownloaded: $isDownloaded
isRead: $isRead
isBookmarked: $isBookmarked
}
) {
nodes {
id
Expand Down
Loading

0 comments on commit a766f4f

Please sign in to comment.