Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b603d0
commit ea2ae16
Showing
116 changed files
with
3,732 additions
and
881 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,11 @@ | ||
apollo client 3 | ||
|
||
Most of the types and values are moved upward to the topmost module | ||
to improve ergonomics. | ||
|
||
Note that react apollo client hooks return `js.UndefOr[T]` while the | ||
standard query functions return `js.UndefOr[T|Null]`. | ||
|
||
I'm also trying out some new facade scala file naming schemes | ||
to see if they help with cracking down types and values more | ||
easily. |
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
65 changes: 65 additions & 0 deletions
65
components/apollo3/src/main/scala/cache/core/cache-module.scala
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,65 @@ | ||
/* | ||
* Copyright (c) 2018 The Trapelo Group | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
* this software and associated documentation files (the "Software"), to deal in | ||
* the Software without restriction, including without limitation the rights to | ||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
* the Software, and to permit persons to whom the Software is furnished to do so, | ||
* subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
package apollo | ||
package client3 | ||
package cache | ||
|
||
import scala.scalajs.js | ||
import js.| | ||
import js.annotation._ | ||
import graphql._ | ||
import client3.utilities._ | ||
import rxjs._ | ||
|
||
@js.native | ||
@JSImport("@apollo/client/cache/core/cache", "ApolloCache") | ||
abstract class ApolloCache[TSerialized]() extends DataProxy { | ||
// abstract members | ||
def read[T, TVars](query: Cache.ReadOptions[TVars]): T | Null | ||
def write[TResult, TVars](write: Cache.WriteOptions[TResult, TVars]): Unit | ||
def diff[T](query: Cache.DiffOptions[T]): Cache.DiffResult[T] | ||
def watch[TVars](watch: Cache.WatchOptions[TVars]): js.Function0[Unit] | ||
def reset(): js.Promise[Unit] | ||
def evict(options: Cache.EvictOptions): Boolean | ||
def evict( | ||
id: String, | ||
field: js.UndefOr[String] = js.undefined, | ||
args: js.UndefOr[js.Object | js.Dynamic] = js.undefined): Boolean | ||
def restore(serializedState: TSerialized): ApolloCache[TSerialized] | ||
def extract(optimistic: js.UndefOr[Boolean]): TSerialized | ||
def removeOptimistic(id: String): Unit | ||
def performTransaction(transaction: Transaction[TSerialized]): Unit | ||
def recordOptimisticTransaction(transaction: Transaction[TSerialized], id: String): Unit | ||
|
||
def transformDocument(document: DocumentNode): DocumentNode = js.native | ||
def identify(obj: StoreObject): js.UndefOr[String] = js.native | ||
def gc(): js.Array[String] = js.native | ||
def transformForLink(document: DocumentNode): DocumentNode = js.native | ||
def readQuery[QueryType, TVars]( | ||
options: DataProxy.Query[TVars], | ||
optimistic: js.UndefOr[Boolean] = js.undefined): QueryType | Null = js.native | ||
def readFragment[FragmentType, TVars]( | ||
options: DataProxy.Fragment[TVars], | ||
optimistic: js.UndefOr[Boolean] = js.undefined): FragmentType | Null = js.native | ||
def writeQuery[T, TVars](options: Cache.WriteQueryOptions[T, TVars]): Unit = js.native | ||
def writeFragment[T, TVars](options: Cache.WriteFragmentOptions[T, TVars]): Unit = js.native | ||
} |
34 changes: 34 additions & 0 deletions
34
components/apollo3/src/main/scala/cache/core/cache-package.scala
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,34 @@ | ||
/* | ||
* Copyright (c) 2018 The Trapelo Group | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
* this software and associated documentation files (the "Software"), to deal in | ||
* the Software without restriction, including without limitation the rights to | ||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
* the Software, and to permit persons to whom the Software is furnished to do so, | ||
* subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
package apollo | ||
package client3 | ||
package cache | ||
package core | ||
|
||
import scala.scalajs.js | ||
import js.| | ||
import js.annotation._ | ||
import graphql._ | ||
|
||
trait cache_module { | ||
type Transaction[T] = js.Function1[ApolloCache[T], Unit] | ||
} |
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
components/apollo3/src/main/scala/cache/core/cache_package.scala
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
components/apollo3/src/main/scala/cache/core/core_package.scala
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
components/apollo3/src/main/scala/cache/core/index-package.scala
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,29 @@ | ||
/* | ||
* Copyright (c) 2018 The Trapelo Group | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
* this software and associated documentation files (the "Software"), to deal in | ||
* the Software without restriction, including without limitation the rights to | ||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
* the Software, and to permit persons to whom the Software is furnished to do so, | ||
* subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
package apollo | ||
package client3 | ||
package cache | ||
package core | ||
|
||
import scala.scalajs.js | ||
|
||
trait core_module extends core.cache_module with types.common_module |
Oops, something went wrong.