From 9849568af3928544641232a5f9d453e9b5bf8e7f Mon Sep 17 00:00:00 2001 From: Pierre Ricadat <ghostdogpr@gmail.com> Date: Wed, 26 Feb 2020 10:06:10 +0900 Subject: [PATCH 1/7] Fix scaladoc --- finch/src/main/scala/caliban/FinchAdapter.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/finch/src/main/scala/caliban/FinchAdapter.scala b/finch/src/main/scala/caliban/FinchAdapter.scala index edc645e71..55487d19c 100644 --- a/finch/src/main/scala/caliban/FinchAdapter.scala +++ b/finch/src/main/scala/caliban/FinchAdapter.scala @@ -16,9 +16,9 @@ object FinchAdapter extends Endpoint.Module[Task] { * * @param interpreter the graphql interpreter * @param runtime the zio runtime used to execute the query - * @tparam R the environment the [[Runtime]] requires + * @tparam R the environment the `Runtime` requires * @tparam E the error type that the interpreter can fail with - * @return a Finch endpoint in [[Task]] returning a Json response that is the result of executing incoming graphql + * @return a Finch endpoint in `Task` returning a Json response that is the result of executing incoming graphql * queries against the interpreter */ def makeHttpService[R, E]( From a21c61754a492599dda9c85cde1b01acf5c69dba Mon Sep 17 00:00:00 2001 From: Pierre Ricadat <ghostdogpr@gmail.com> Date: Wed, 26 Feb 2020 10:27:47 +0900 Subject: [PATCH 2/7] Update version in docs --- README.md | 2 ++ .../test/scala/caliban/codegen/ClientWriterSpec.scala | 4 ++-- .../test/scala/caliban/codegen/SchemaWriterSpec.scala | 4 ++-- examples/README.md | 10 +++++----- vuepress/docs/docs/README.md | 10 +++++----- vuepress/docs/docs/client.md | 4 ++-- vuepress/docs/docs/schema.md | 2 +- 7 files changed, 19 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index b286f2450..9b9ff86c8 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ The design principles behind the library are the following: - clean separation between schema definition and implementation: schema is defined and validated at compile time using Scala standard types, resolver (`RootResolver`) is a simple value provided at runtime. - minimal amount of boilerplate: no need to manually define a schema for every type in your API. +Caliban can also be used to build GraphQL frontends thanks to a type-safe and functional DSL. + ### Consult the [Documentation](https://ghostdogpr.github.io/caliban/docs/) to learn how to use Caliban. ### Any questions? Head up to the [#caliban](https://discordapp.com/channels/629491597070827530/633200096393166868) channel on [ZIO Discord](https://discord.gg/EYpumuv). diff --git a/codegen/src/test/scala/caliban/codegen/ClientWriterSpec.scala b/codegen/src/test/scala/caliban/codegen/ClientWriterSpec.scala index a55e94cd6..ccb70c56e 100644 --- a/codegen/src/test/scala/caliban/codegen/ClientWriterSpec.scala +++ b/codegen/src/test/scala/caliban/codegen/ClientWriterSpec.scala @@ -3,7 +3,7 @@ package caliban.codegen import caliban.parsing.Parser import zio.Task import zio.test.Assertion._ -import zio.test.{ assertM, suite, testM, DefaultRunnableSpec } +import zio.test.{ assertM, suite, testM, DefaultRunnableSpec, TestAspect } object ClientWriterSpec extends DefaultRunnableSpec( @@ -361,6 +361,6 @@ object Client { ) ) } - ) + ) @@ TestAspect.sequential } ) diff --git a/codegen/src/test/scala/caliban/codegen/SchemaWriterSpec.scala b/codegen/src/test/scala/caliban/codegen/SchemaWriterSpec.scala index a5800d3f6..4913fadbb 100644 --- a/codegen/src/test/scala/caliban/codegen/SchemaWriterSpec.scala +++ b/codegen/src/test/scala/caliban/codegen/SchemaWriterSpec.scala @@ -4,7 +4,7 @@ import caliban.parsing.Parser import caliban.parsing.adt.Document import zio.Task import zio.test.Assertion.equalTo -import zio.test.{ assertM, suite, testM, DefaultRunnableSpec } +import zio.test.{ assertM, suite, testM, DefaultRunnableSpec, TestAspect } object SchemaWriterSpec extends DefaultRunnableSpec({ @@ -307,5 +307,5 @@ object Types { ) ) } - ) + ) @@ TestAspect.sequential }) diff --git a/examples/README.md b/examples/README.md index a42457355..639145974 100644 --- a/examples/README.md +++ b/examples/README.md @@ -4,11 +4,11 @@ To run the examples without the rest of the project, add this to your build.sbt: ```scala libraryDependencies ++= Seq( - "com.github.ghostdogpr" %% "caliban" % "0.5.2", - "com.github.ghostdogpr" %% "caliban-http4s" % "0.5.2", - "com.github.ghostdogpr" %% "caliban-akka-http" % "0.5.2", - "com.github.ghostdogpr" %% "caliban-cats" % "0.5.2", - "com.github.ghostdogpr" %% "caliban-finch" % "0.5.2" + "com.github.ghostdogpr" %% "caliban" % "0.6.0", + "com.github.ghostdogpr" %% "caliban-http4s" % "0.6.0", + "com.github.ghostdogpr" %% "caliban-akka-http" % "0.6.0", + "com.github.ghostdogpr" %% "caliban-cats" % "0.6.0", + "com.github.ghostdogpr" %% "caliban-finch" % "0.6.0" ) scalacOptions += "-Ypartial-unification" diff --git a/vuepress/docs/docs/README.md b/vuepress/docs/docs/README.md index 1cfeeebda..7bc82b813 100644 --- a/vuepress/docs/docs/README.md +++ b/vuepress/docs/docs/README.md @@ -16,16 +16,16 @@ Caliban can also be used to build GraphQL frontends: see the [dedicated section] To use `caliban`, add the following line in your `build.sbt` file: ``` -libraryDependencies += "com.github.ghostdogpr" %% "caliban" % "0.5.2" +libraryDependencies += "com.github.ghostdogpr" %% "caliban" % "0.6.0" ``` The following modules are optional: ``` -libraryDependencies += "com.github.ghostdogpr" %% "caliban-http4s" % "0.5.2" // routes for http4s -libraryDependencies += "com.github.ghostdogpr" %% "caliban-akka-http" % "0.5.2" // routes for akka-http -libraryDependencies += "com.github.ghostdogpr" %% "caliban-cats" % "0.5.2" // interop with cats effect -libraryDependencies += "com.github.ghostdogpr" %% "caliban-monix" % "0.5.2" // interop with monix +libraryDependencies += "com.github.ghostdogpr" %% "caliban-http4s" % "0.6.0" // routes for http4s +libraryDependencies += "com.github.ghostdogpr" %% "caliban-akka-http" % "0.6.0" // routes for akka-http +libraryDependencies += "com.github.ghostdogpr" %% "caliban-cats" % "0.6.0" // interop with cats effect +libraryDependencies += "com.github.ghostdogpr" %% "caliban-monix" % "0.6.0" // interop with monix ``` Note that Caliban is also available for ScalaJS. diff --git a/vuepress/docs/docs/client.md b/vuepress/docs/docs/client.md index bb80ac7b0..43152fe5a 100644 --- a/vuepress/docs/docs/client.md +++ b/vuepress/docs/docs/client.md @@ -12,7 +12,7 @@ Just like Caliban, `caliban-client` offers a purely functional interface and kee To use `caliban-client`, add the following line in your `build.sbt` file: ``` -libraryDependencies += "com.github.ghostdogpr" %% "caliban-client" % "0.5.2" +libraryDependencies += "com.github.ghostdogpr" %% "caliban-client" % "0.6.0" ``` Caliban-client is available for ScalaJS. @@ -24,7 +24,7 @@ The first step for building GraphQL queries with `caliban-client` is to generate To use this feature, add the `caliban-codegen` sbt plugin to your project and enable it. ```scala -addSbtPlugin("com.github.ghostdogpr" % "caliban-codegen" % "0.5.2") +addSbtPlugin("com.github.ghostdogpr" % "caliban-codegen" % "0.6.0") enablePlugins(CodegenPlugin) ``` Then call the `calibanGenClient` sbt command. diff --git a/vuepress/docs/docs/schema.md b/vuepress/docs/docs/schema.md index 855fd798e..15aeac17d 100644 --- a/vuepress/docs/docs/schema.md +++ b/vuepress/docs/docs/schema.md @@ -184,7 +184,7 @@ Caliban can automatically generate Scala code from a GraphQL schema. In order to use this feature, add the `caliban-codegen` sbt plugin to your project and enable it. ```scala -addSbtPlugin("com.github.ghostdogpr" % "caliban-codegen" % "0.5.2") +addSbtPlugin("com.github.ghostdogpr" % "caliban-codegen" % "0.6.0") enablePlugins(CodegenPlugin) ``` Then call the `calibanGenSchema` sbt command. From 22e80af60d8b52762178b12e9d03db5a3ffe98ee Mon Sep 17 00:00:00 2001 From: Pierre Ricadat <ghostdogpr@gmail.com> Date: Wed, 26 Feb 2020 01:28:38 +0000 Subject: [PATCH 3/7] [ci skip] update docs --- docs/404.html | 12 +-- docs/about/index.html | 12 +-- ...les.ce455d84.css => 0.styles.3f660e69.css} | 0 docs/assets/js/10.5f8b2c07.js | 1 + docs/assets/js/10.b8fd5856.js | 1 - docs/assets/js/11.151b57de.js | 1 - docs/assets/js/11.5f34d6b0.js | 1 + docs/assets/js/12.40588870.js | 1 - docs/assets/js/12.bc45abe0.js | 1 + docs/assets/js/13.a0ebd332.js | 1 - docs/assets/js/13.d315a1c7.js | 1 + docs/assets/js/14.b8b8c6ff.js | 1 + docs/assets/js/14.fe3db0cd.js | 1 - docs/assets/js/15.23ceaf26.js | 1 + docs/assets/js/15.a58fc205.js | 1 - docs/assets/js/16.09e4e2e8.js | 1 - docs/assets/js/16.f357ff30.js | 1 + docs/assets/js/17.fa6e8c03.js | 1 + docs/assets/js/2.07c68b8b.js | 1 + docs/assets/js/2.fa272699.js | 1 - docs/assets/js/3.865f603a.js | 1 + docs/assets/js/3.af853996.js | 1 - docs/assets/js/4.b0dd307f.js | 1 - docs/assets/js/4.f03b7f8e.js | 1 + docs/assets/js/5.5defc76c.js | 1 + docs/assets/js/5.e6948aea.js | 1 - docs/assets/js/6.d222e5e8.js | 1 + docs/assets/js/6.e0cf4477.js | 1 - docs/assets/js/7.57a8ce51.js | 1 + docs/assets/js/7.a06094f2.js | 1 - docs/assets/js/8.6272775d.js | 1 + docs/assets/js/8.abf14876.js | 1 - docs/assets/js/9.417f11bf.js | 1 + docs/assets/js/9.9cf833f6.js | 1 - docs/assets/js/app.098f98e8.js | 14 --- docs/assets/js/app.d7caee50.js | 13 +++ docs/docs/client.html | 98 +++++++++++++++++++ docs/docs/examples.html | 21 ++-- docs/docs/index.html | 27 ++--- docs/docs/interop.html | 32 +++--- docs/docs/introspection.html | 12 +-- docs/docs/middleware.html | 20 ++-- docs/docs/optimization.html | 12 +-- docs/docs/schema.html | 27 ++--- docs/docs/validation.html | 12 +-- docs/index.html | 12 +-- docs/resources/index.html | 10 +- 47 files changed, 237 insertions(+), 128 deletions(-) rename docs/assets/css/{0.styles.ce455d84.css => 0.styles.3f660e69.css} (100%) create mode 100644 docs/assets/js/10.5f8b2c07.js delete mode 100644 docs/assets/js/10.b8fd5856.js delete mode 100644 docs/assets/js/11.151b57de.js create mode 100644 docs/assets/js/11.5f34d6b0.js delete mode 100644 docs/assets/js/12.40588870.js create mode 100644 docs/assets/js/12.bc45abe0.js delete mode 100644 docs/assets/js/13.a0ebd332.js create mode 100644 docs/assets/js/13.d315a1c7.js create mode 100644 docs/assets/js/14.b8b8c6ff.js delete mode 100644 docs/assets/js/14.fe3db0cd.js create mode 100644 docs/assets/js/15.23ceaf26.js delete mode 100644 docs/assets/js/15.a58fc205.js delete mode 100644 docs/assets/js/16.09e4e2e8.js create mode 100644 docs/assets/js/16.f357ff30.js create mode 100644 docs/assets/js/17.fa6e8c03.js create mode 100644 docs/assets/js/2.07c68b8b.js delete mode 100644 docs/assets/js/2.fa272699.js create mode 100644 docs/assets/js/3.865f603a.js delete mode 100644 docs/assets/js/3.af853996.js delete mode 100644 docs/assets/js/4.b0dd307f.js create mode 100644 docs/assets/js/4.f03b7f8e.js create mode 100644 docs/assets/js/5.5defc76c.js delete mode 100644 docs/assets/js/5.e6948aea.js create mode 100644 docs/assets/js/6.d222e5e8.js delete mode 100644 docs/assets/js/6.e0cf4477.js create mode 100644 docs/assets/js/7.57a8ce51.js delete mode 100644 docs/assets/js/7.a06094f2.js create mode 100644 docs/assets/js/8.6272775d.js delete mode 100644 docs/assets/js/8.abf14876.js create mode 100644 docs/assets/js/9.417f11bf.js delete mode 100644 docs/assets/js/9.9cf833f6.js delete mode 100644 docs/assets/js/app.098f98e8.js create mode 100644 docs/assets/js/app.d7caee50.js create mode 100644 docs/docs/client.html diff --git a/docs/404.html b/docs/404.html index a5e5b9bdd..4fc8410b3 100644 --- a/docs/404.html +++ b/docs/404.html @@ -4,17 +4,17 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>Caliban</title> - <meta name="description" content="Functional GraphQL backend in Scala"> - <meta name="generator" content="VuePress 1.3.0"> + <meta name="description" content="Functional GraphQL library for Scala"> + <meta name="generator" content="VuePress 1.3.1"> <link rel="icon" href="/caliban/caliban.png"> - <link rel="preload" href="/caliban/assets/css/0.styles.ce455d84.css" as="style"><link rel="preload" href="/caliban/assets/js/app.098f98e8.js" as="script"><link rel="preload" href="/caliban/assets/js/4.b0dd307f.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.b8fd5856.js"><link rel="prefetch" href="/caliban/assets/js/11.151b57de.js"><link rel="prefetch" href="/caliban/assets/js/12.40588870.js"><link rel="prefetch" href="/caliban/assets/js/13.a0ebd332.js"><link rel="prefetch" href="/caliban/assets/js/14.fe3db0cd.js"><link rel="prefetch" href="/caliban/assets/js/15.a58fc205.js"><link rel="prefetch" href="/caliban/assets/js/16.09e4e2e8.js"><link rel="prefetch" href="/caliban/assets/js/2.fa272699.js"><link rel="prefetch" href="/caliban/assets/js/3.af853996.js"><link rel="prefetch" href="/caliban/assets/js/5.e6948aea.js"><link rel="prefetch" href="/caliban/assets/js/6.e0cf4477.js"><link rel="prefetch" href="/caliban/assets/js/7.a06094f2.js"><link rel="prefetch" href="/caliban/assets/js/8.abf14876.js"><link rel="prefetch" href="/caliban/assets/js/9.9cf833f6.js"> - <link rel="stylesheet" href="/caliban/assets/css/0.styles.ce455d84.css"> + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/4.f03b7f8e.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.5f8b2c07.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.bc45abe0.js"><link rel="prefetch" href="/caliban/assets/js/13.d315a1c7.js"><link rel="prefetch" href="/caliban/assets/js/14.b8b8c6ff.js"><link rel="prefetch" href="/caliban/assets/js/15.23ceaf26.js"><link rel="prefetch" href="/caliban/assets/js/16.f357ff30.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/2.07c68b8b.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.57a8ce51.js"><link rel="prefetch" href="/caliban/assets/js/8.6272775d.js"><link rel="prefetch" href="/caliban/assets/js/9.417f11bf.js"> + <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> </head> <body> - <div id="app" data-server-rendered="true"><div class="theme-container"><div class="theme-default-content"><h1>404</h1> <blockquote>Looks like we've got some broken links.</blockquote> <a href="/caliban/" class="router-link-active"> + <div id="app" data-server-rendered="true"><div class="theme-container"><div class="theme-default-content"><h1>404</h1> <blockquote>How did we get here?</blockquote> <a href="/caliban/" class="router-link-active"> Take me home. </a></div></div><div class="global-ui"></div></div> - <script src="/caliban/assets/js/app.098f98e8.js" defer></script><script src="/caliban/assets/js/4.b0dd307f.js" defer></script> + <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/4.f03b7f8e.js" defer></script> </body> </html> diff --git a/docs/about/index.html b/docs/about/index.html index 4d5989677..cf474a0c4 100644 --- a/docs/about/index.html +++ b/docs/about/index.html @@ -4,12 +4,12 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>About | Caliban</title> - <meta name="description" content="Functional GraphQL backend in Scala"> - <meta name="generator" content="VuePress 1.3.0"> + <meta name="description" content="Functional GraphQL library for Scala"> + <meta name="generator" content="VuePress 1.3.1"> <link rel="icon" href="/caliban/caliban.png"> - <link rel="preload" href="/caliban/assets/css/0.styles.ce455d84.css" as="style"><link rel="preload" href="/caliban/assets/js/app.098f98e8.js" as="script"><link rel="preload" href="/caliban/assets/js/2.fa272699.js" as="script"><link rel="preload" href="/caliban/assets/js/6.e0cf4477.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.b8fd5856.js"><link rel="prefetch" href="/caliban/assets/js/11.151b57de.js"><link rel="prefetch" href="/caliban/assets/js/12.40588870.js"><link rel="prefetch" href="/caliban/assets/js/13.a0ebd332.js"><link rel="prefetch" href="/caliban/assets/js/14.fe3db0cd.js"><link rel="prefetch" href="/caliban/assets/js/15.a58fc205.js"><link rel="prefetch" href="/caliban/assets/js/16.09e4e2e8.js"><link rel="prefetch" href="/caliban/assets/js/3.af853996.js"><link rel="prefetch" href="/caliban/assets/js/4.b0dd307f.js"><link rel="prefetch" href="/caliban/assets/js/5.e6948aea.js"><link rel="prefetch" href="/caliban/assets/js/7.a06094f2.js"><link rel="prefetch" href="/caliban/assets/js/8.abf14876.js"><link rel="prefetch" href="/caliban/assets/js/9.9cf833f6.js"> - <link rel="stylesheet" href="/caliban/assets/css/0.styles.ce455d84.css"> + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/6.d222e5e8.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.5f8b2c07.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.bc45abe0.js"><link rel="prefetch" href="/caliban/assets/js/13.d315a1c7.js"><link rel="prefetch" href="/caliban/assets/js/14.b8b8c6ff.js"><link rel="prefetch" href="/caliban/assets/js/15.23ceaf26.js"><link rel="prefetch" href="/caliban/assets/js/16.f357ff30.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/7.57a8ce51.js"><link rel="prefetch" href="/caliban/assets/js/8.6272775d.js"><link rel="prefetch" href="/caliban/assets/js/9.417f11bf.js"> + <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> </head> <body> <div id="app" data-server-rendered="true"><div class="theme-container no-sidebar"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/caliban/" class="home-link router-link-active"><img src="/caliban/caliban.svg" alt="Caliban" class="logo"> <span class="site-name can-hide">Caliban</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/caliban/docs/" class="nav-link"> @@ -32,7 +32,7 @@ Github <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div><div class="nav-item"><a href="https://javadoc.io/doc/com.github.ghostdogpr/caliban_2.12/" target="_blank" rel="noopener noreferrer" class="nav-link external"> Scaladoc - <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <!----> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="about"><a href="#about" class="header-anchor">#</a> About</h1> <p>Caliban is a project developed by Pierre Ricadat aka <a href="https://github.com/ghostdogpr" target="_blank" rel="noopener noreferrer">@ghostdogpr<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>.</p> <p>The name is inspired by the SF novel and tv series <a href="https://en.wikipedia.org/wiki/Caliban%27s_War" target="_blank" rel="noopener noreferrer">The Expanse<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>.</p> <p><strong>Thanks</strong>:</p> <ul><li><a href="https://github.com/deckerst" target="_blank" rel="noopener noreferrer">@deckerst<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> for the logo</li> <li><a href="https://github.com/yoohaemin" target="_blank" rel="noopener noreferrer">@yoohaemin<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>, <a href="https://github.com/adamgfraser" target="_blank" rel="noopener noreferrer">@adamgfraser<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> and <a href="https://github.com/jdegoes" target="_blank" rel="noopener noreferrer">@jdegoes<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> for the early feedback</li> <li>the <a href="https://morpheusgraphql.com/" target="_blank" rel="noopener noreferrer">Morpheus<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> library in Haskell for the inspiration</li> <li>all Caliban's <a href="https://github.com/ghostdogpr/caliban/graphs/contributors" target="_blank" rel="noopener noreferrer">contributors<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>!</li></ul></div> <footer class="page-edit"><!----> <!----></footer> <!----> </main></div><div class="global-ui"></div></div> - <script src="/caliban/assets/js/app.098f98e8.js" defer></script><script src="/caliban/assets/js/2.fa272699.js" defer></script><script src="/caliban/assets/js/6.e0cf4477.js" defer></script> + <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <!----> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="about"><a href="#about" class="header-anchor">#</a> About</h1> <p>Caliban is a project developed by Pierre Ricadat aka <a href="https://github.com/ghostdogpr" target="_blank" rel="noopener noreferrer">@ghostdogpr<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>.</p> <p>The name is inspired by the SF novel and tv series <a href="https://en.wikipedia.org/wiki/Caliban%27s_War" target="_blank" rel="noopener noreferrer">The Expanse<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>.</p> <p><strong>Thanks</strong>:</p> <ul><li><a href="https://github.com/deckerst" target="_blank" rel="noopener noreferrer">@deckerst<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> for the logo</li> <li><a href="https://github.com/yoohaemin" target="_blank" rel="noopener noreferrer">@yoohaemin<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>, <a href="https://github.com/adamgfraser" target="_blank" rel="noopener noreferrer">@adamgfraser<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> and <a href="https://github.com/jdegoes" target="_blank" rel="noopener noreferrer">@jdegoes<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> for the early feedback</li> <li>the <a href="https://morpheusgraphql.com/" target="_blank" rel="noopener noreferrer">Morpheus<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> library in Haskell for the inspiration leading to the GraphQL backend implementation</li> <li>the <a href="https://github.com/dillonkearns/elm-graphql" target="_blank" rel="noopener noreferrer">elm-graphql<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> library for the inspiration leading to the GraphQL client implementation</li> <li>all Caliban's <a href="https://github.com/ghostdogpr/caliban/graphs/contributors" target="_blank" rel="noopener noreferrer">contributors<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>!</li></ul></div> <footer class="page-edit"><!----> <!----></footer> <!----> </main></div><div class="global-ui"></div></div> + <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/6.d222e5e8.js" defer></script> </body> </html> diff --git a/docs/assets/css/0.styles.ce455d84.css b/docs/assets/css/0.styles.3f660e69.css similarity index 100% rename from docs/assets/css/0.styles.ce455d84.css rename to docs/assets/css/0.styles.3f660e69.css diff --git a/docs/assets/js/10.5f8b2c07.js b/docs/assets/js/10.5f8b2c07.js new file mode 100644 index 000000000..9b3f7ff54 --- /dev/null +++ b/docs/assets/js/10.5f8b2c07.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[10],{212:function(t,a,s){"use strict";s.r(a);var n=s(28),e=Object(n.a)({},(function(){var t=this,a=t.$createElement,s=t._self._c||a;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"interop-cats-monix"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#interop-cats-monix"}},[t._v("#")]),t._v(" Interop (Cats, Monix)")]),t._v(" "),s("p",[t._v("If you prefer using "),s("a",{attrs:{href:"https://github.com/typelevel/cats-effect",target:"_blank",rel:"noopener noreferrer"}},[t._v("Cats Effect"),s("OutboundLink")],1),t._v(" or "),s("a",{attrs:{href:"https://github.com/monix/monix",target:"_blank",rel:"noopener noreferrer"}},[t._v("Monix"),s("OutboundLink")],1),t._v(" rather than ZIO, you can use the respective "),s("code",[t._v("caliban-cats")]),t._v(" and "),s("code",[t._v("caliban-monix")]),t._v(" modules.")]),t._v(" "),s("h2",{attrs:{id:"cats-effect"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#cats-effect"}},[t._v("#")]),t._v(" Cats Effect")]),t._v(" "),s("p",[t._v("You first need to import "),s("code",[t._v("caliban.interop.cats.implicits._")]),t._v(" and have an implicit "),s("code",[t._v("zio.Runtime")]),t._v(" in scope. Then a few helpers are available:")]),t._v(" "),s("ul",[s("li",[t._v("the GraphQL object is enriched with "),s("code",[t._v("interpreterAsync")]),t._v(", "),s("code",[t._v("executeAsync")]),t._v(" and "),s("code",[t._v("checkAsync")]),t._v(", variants of "),s("code",[t._v("interpreter")]),t._v(", "),s("code",[t._v("execute")]),t._v(" and "),s("code",[t._v("check")]),t._v(" that return an "),s("code",[t._v("F[_]: Async")]),t._v(" instead of a "),s("code",[t._v("ZIO")]),t._v(".")]),t._v(" "),s("li",[t._v("the "),s("code",[t._v("Http4sAdapter")]),t._v(" also has cats-effect variants named "),s("code",[t._v("makeRestServiceF")]),t._v(" and "),s("code",[t._v("makeWebSocketServiceF")]),t._v(".")])]),t._v(" "),s("p",[t._v("In addition to that, a "),s("code",[t._v("Schema")]),t._v(" for any "),s("code",[t._v("F[_]: Effect")]),t._v(" is provided. That means you can include fields returning Monix Task for Cats IO in your queries, mutations or subscriptions.")]),t._v(" "),s("p",[t._v("The following example shows how to create an interpreter and run a query while only using Cats IO.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("GraphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("graphQL\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("RootResolver\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("interop"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("cats"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("implicits")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("cats"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("effect")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" ExitCode"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" IOApp "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" zio"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("DefaultRuntime\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" ExampleCatsInterop "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" IOApp "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" runtime "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" DefaultRuntime "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("numbers"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" randomNumber"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" queries "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("2")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("3")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("scala"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("util"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Random"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("nextInt"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("RootResolver"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" query "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token triple-quoted-string string"}},[t._v('"""\n {\n numbers\n randomNumber\n }"""')]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("override")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" run"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("args"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("ExitCode"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n interpreter "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" api"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("interpreterAsync"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n result "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" interpreter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("executeAsync"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("query"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n _ "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("println"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("result"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("yield")]),t._v(" ExitCode"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Success\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("You can find this example within the "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/blob/master/examples/src/main/scala/caliban/interop/cats/ExampleCatsInterop.scala",target:"_blank",rel:"noopener noreferrer"}},[t._v("examples"),s("OutboundLink")],1),t._v(" project.")]),t._v(" "),s("h2",{attrs:{id:"monix"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#monix"}},[t._v("#")]),t._v(" Monix")]),t._v(" "),s("p",[t._v("You first need to import "),s("code",[t._v("caliban.interop.monix.implicits._")]),t._v(" and have an implicit "),s("code",[t._v("zio.Runtime")]),t._v(" in scope. Then a few helpers are available:")]),t._v(" "),s("ul",[s("li",[t._v("the GraphQL object is enriched with "),s("code",[t._v("interpreterAsync")]),t._v(", "),s("code",[t._v("executeAsync")]),t._v(" and "),s("code",[t._v("checkAsync")]),t._v(", variants of "),s("code",[t._v("interpreter")]),t._v(", "),s("code",[t._v("execute")]),t._v(" and "),s("code",[t._v("check")]),t._v(" that return a Monix "),s("code",[t._v("Task")]),t._v(" instead of a "),s("code",[t._v("ZIO")]),t._v(".")])]),t._v(" "),s("p",[t._v("In addition to that, a "),s("code",[t._v("Schema")]),t._v(" for any Monix "),s("code",[t._v("Task")]),t._v(" as well as "),s("code",[t._v("Observable")]),t._v(" is provided.")]),t._v(" "),s("p",[t._v("The following example shows how to create an interpreter and run a query while only using Monix Task.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("GraphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("graphQL\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("RootResolver\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("interop"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("monix"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("implicits")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("cats"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("effect")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("ExitCode\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("monix"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("eval")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" TaskApp "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("monix"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("execution")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Scheduler\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" zio"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("DefaultRuntime\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" ExampleMonixInterop "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" TaskApp "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" runtime "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" DefaultRuntime "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" monixScheduler"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Scheduler "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" scheduler\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("numbers"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" randomNumber"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" queries "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("2")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("3")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("eval"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("scala"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("util"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Random"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("nextInt"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("RootResolver"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" query "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token triple-quoted-string string"}},[t._v('"""\n {\n numbers\n randomNumber\n }"""')]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("override")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" run"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("args"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("ExitCode"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n interpreter "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" api"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("interpreterAsync\n result "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" interpreter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("executeAsync"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("query"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n _ "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("eval"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("println"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("result"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("yield")]),t._v(" ExitCode"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Success\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("You can find this example within the "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/blob/master/examples/src/main/scala/caliban/interop/monix/ExampleMonixInterop.scala",target:"_blank",rel:"noopener noreferrer"}},[t._v("examples"),s("OutboundLink")],1),t._v(" project.")])])}),[],!1,null,null,null);a.default=e.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/10.b8fd5856.js b/docs/assets/js/10.b8fd5856.js deleted file mode 100644 index 503d31a30..000000000 --- a/docs/assets/js/10.b8fd5856.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[10],{210:function(t,e,r){"use strict";r.r(e);var n=r(0),a=Object(n.a)({},(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[r("h1",{attrs:{id:"introspection"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#introspection"}},[t._v("#")]),t._v(" Introspection")]),t._v(" "),r("p",[t._v("Introspection queries are fully supported, which means you can use your favorite tool to inspect your schema and generate documentation for free.")]),t._v(" "),r("p",[t._v("Here's an example of documentation generated by introspection in "),r("a",{attrs:{href:"https://altair.sirmuel.design/",target:"_blank",rel:"noopener noreferrer"}},[t._v("Altair GraphQL Client"),r("OutboundLink")],1),t._v(":")]),t._v(" "),r("p",[r("img",{attrs:{src:"/caliban/altair.png",alt:"altair screenshot"}})])])}),[],!1,null,null,null);e.default=a.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/11.151b57de.js b/docs/assets/js/11.151b57de.js deleted file mode 100644 index 466bf0afb..000000000 --- a/docs/assets/js/11.151b57de.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[11],{209:function(t,a,e){"use strict";e.r(a);var s=e(0),n=Object(s.a)({},(function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[e("h1",{attrs:{id:"middleware"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#middleware"}},[t._v("#")]),t._v(" Middleware")]),t._v(" "),e("p",[t._v("Caliban allows you to perform additional actions at various levels of a query processing, via the concept of "),e("code",[t._v("Wrapper")]),t._v(". Using wrappers, you can:")]),t._v(" "),e("ul",[e("li",[t._v("verify that a query doesn't reach some limit (e.g. depth, complexity)")]),t._v(" "),e("li",[t._v("modify a query before it's executed")]),t._v(" "),e("li",[t._v("add timeouts to queries or fields")]),t._v(" "),e("li",[t._v("log each field execution time")]),t._v(" "),e("li",[t._v("support "),e("a",{attrs:{href:"https://github.com/apollographql/apollo-tracing",target:"_blank",rel:"noopener noreferrer"}},[t._v("Apollo Tracing"),e("OutboundLink")],1),t._v(" or anything similar")]),t._v(" "),e("li",[t._v("etc.")])]),t._v(" "),e("h2",{attrs:{id:"wrapper-types"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#wrapper-types"}},[t._v("#")]),t._v(" Wrapper types")]),t._v(" "),e("p",[t._v("There are 5 basic types of wrappers:")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("OverallWrapper")]),t._v(" to wrap the whole query processing")]),t._v(" "),e("li",[e("code",[t._v("ParsingWrapper")]),t._v(" to wrap the query parsing only")]),t._v(" "),e("li",[e("code",[t._v("ValidationWrapper")]),t._v(" to wrap the query validation only")]),t._v(" "),e("li",[e("code",[t._v("ExecutionWrapper")]),t._v(" to wrap the query execution only")]),t._v(" "),e("li",[e("code",[t._v("FieldWrapper")]),t._v(" to wrap each field execution")])]),t._v(" "),e("p",[t._v("Each one requires a function that takes a "),e("code",[t._v("ZIO")]),t._v(" or "),e("code",[t._v("ZQuery")]),t._v(" computation together with some contextual information (e.g. the query string) and should return another computation.")]),t._v(" "),e("p",[t._v("Let's see how to implement a wrapper that times out the whole query if its processing takes longer that 1 minute.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" wrapper "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" OverallWrapper "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("io"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" query"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v("\n io"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("timeout"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),t._v(" minute"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("map"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n _"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("getOrElse"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n GraphQLResponse"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n NullValue"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("ExecutionError"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("s"),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Query was interrupted after timeout of ${duration.render}:\\n$query"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("You can also combine wrappers using "),e("code",[t._v("|+|")]),t._v(" and create a wrapper that requires an effect to be run at each query using "),e("code",[t._v("EffectfulWrapper")]),t._v(".")]),t._v(" "),e("p",[t._v("To use your wrapper, call "),e("code",[t._v("GraphQL#withWrapper")]),t._v(" or its alias "),e("code",[t._v("@@")]),t._v(".")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("withWrapper"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("wrapper"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// or")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" @@ wrapper\n")])])]),e("h2",{attrs:{id:"pre-defined-wrappers"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#pre-defined-wrappers"}},[t._v("#")]),t._v(" Pre-defined wrappers")]),t._v(" "),e("p",[t._v("Caliban comes with a few pre-made wrappers in "),e("code",[t._v("caliban.wrappers.Wrappers")]),t._v(":")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("maxDepth")]),t._v(" returns a wrapper that fails queries whose depth is higher than a given value")]),t._v(" "),e("li",[e("code",[t._v("maxFields")]),t._v(" returns a wrapper that fails queries whose number of fields is higher than a given value")]),t._v(" "),e("li",[e("code",[t._v("timeout")]),t._v(" returns a wrapper that fails queries taking more than a specified time")]),t._v(" "),e("li",[e("code",[t._v("printSlowQueries")]),t._v(" returns a wrapper that prints slow queries")]),t._v(" "),e("li",[e("code",[t._v("onSlowQueries")]),t._v(" returns a wrapper that can run a given function on slow queries")])]),t._v(" "),e("p",[t._v("In addition to those, "),e("code",[t._v("caliban.wrappers.ApolloTracing.apolloTracing")]),t._v(" returns a wrapper that adds tracing data into the "),e("code",[t._v("extensions")]),t._v(" field of each response following "),e("a",{attrs:{href:"https://github.com/apollographql/apollo-tracing",target:"_blank",rel:"noopener noreferrer"}},[t._v("Apollo Tracing"),e("OutboundLink")],1),t._v(" format.")]),t._v(" "),e("p",[t._v("They can be used like this:")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n graphQL"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" @@\n maxDepth"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("50")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" @@\n timeout"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("3")]),t._v(" seconds"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" @@\n printSlowQueries"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("500")]),t._v(" millis"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" @@\n apolloTracing\n")])])]),e("h2",{attrs:{id:"wrapping-the-interpreter"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#wrapping-the-interpreter"}},[t._v("#")]),t._v(" Wrapping the interpreter")]),t._v(" "),e("p",[t._v("All the wrappers mentioned above require that you don't modify the environment "),e("code",[t._v("R")]),t._v(" and the error type which is always a "),e("code",[t._v("CalibanError")]),t._v(". It is also possible to wrap your "),e("code",[t._v("GraphQLInterpreter")]),t._v(" by calling "),e("code",[t._v("wrapExecutionWith")]),t._v(" on it. This method takes in a function "),e("code",[t._v("f")]),t._v(" and returns a new "),e("code",[t._v("GraphQLInterpreter")]),t._v(" that will wrap the "),e("code",[t._v("execute")]),t._v(" method with this function "),e("code",[t._v("f")]),t._v(".")]),t._v(" "),e("p",[t._v("It is used internally to implement "),e("code",[t._v("mapError")]),t._v(" (customize errors) and "),e("code",[t._v("provide")]),t._v(" (eliminate the environment), but you can use it for other purposes such as adding a general timeout, logging response times, etc.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// create an interpreter")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" i"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" GraphQLInterpreter"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("MyEnv"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" CalibanError"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphqQL"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("interpreter\n\n"),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// change error type to String")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" i2"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" GraphQLInterpreter"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("MyEnv"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" i"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mapError"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("_"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("toString"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// provide the environment")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" i3"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" GraphQLInterpreter"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" CalibanError"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" i"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("provide"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("myEnv"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// add a timeout on every query execution")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" i4"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" GraphQLInterpreter"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("MyEnv "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("with")]),t._v(" Clock"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" CalibanError"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n i"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("wrapExecutionWith"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n _"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("timeout"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("30")]),t._v(" seconds"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("map"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n _"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("getOrElse"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("GraphQLResponse"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("NullValue"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("ExecutionError"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Timeout!"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])])])}),[],!1,null,null,null);a.default=n.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/11.5f34d6b0.js b/docs/assets/js/11.5f34d6b0.js new file mode 100644 index 000000000..85cc70520 --- /dev/null +++ b/docs/assets/js/11.5f34d6b0.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[11],{209:function(t,e,r){"use strict";r.r(e);var n=r(28),a=Object(n.a)({},(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[r("h1",{attrs:{id:"introspection"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#introspection"}},[t._v("#")]),t._v(" Introspection")]),t._v(" "),r("p",[t._v("Introspection queries are fully supported, which means you can use your favorite tool to inspect your schema and generate documentation for free.")]),t._v(" "),r("p",[t._v("Here's an example of documentation generated by introspection in "),r("a",{attrs:{href:"https://altair.sirmuel.design/",target:"_blank",rel:"noopener noreferrer"}},[t._v("Altair GraphQL Client"),r("OutboundLink")],1),t._v(":")]),t._v(" "),r("p",[r("img",{attrs:{src:"/caliban/altair.png",alt:"altair screenshot"}})])])}),[],!1,null,null,null);e.default=a.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/12.40588870.js b/docs/assets/js/12.40588870.js deleted file mode 100644 index 39f241314..000000000 --- a/docs/assets/js/12.40588870.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[12],{211:function(t,a,s){"use strict";s.r(a);var e=s(0),n=Object(e.a)({},(function(){var t=this,a=t.$createElement,s=t._self._c||a;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"query-optimization"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#query-optimization"}},[t._v("#")]),t._v(" Query optimization")]),t._v(" "),s("p",[t._v("A GraphQL query may request multiple fields that are using the same resolver. It's not a problem if the resolver is a simple value, but it can be less than optimal when the resolver runs an effect (such as reading from a database).")]),t._v(" "),s("p",[t._v("We might want to:")]),t._v(" "),s("ul",[s("li",[s("strong",[t._v("cache")]),t._v(" identical queries (deduplication)")]),t._v(" "),s("li",[s("strong",[t._v("batch")]),t._v(" queries to the same source")])]),t._v(" "),s("p",[t._v("This is possible in Caliban using the "),s("code",[t._v("ZQuery")]),t._v(" data type.")]),t._v(" "),s("h2",{attrs:{id:"introducing-zquery"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#introducing-zquery"}},[t._v("#")]),t._v(" Introducing ZQuery")]),t._v(" "),s("p",[t._v("A "),s("code",[t._v("ZQuery[R, E, A]")]),t._v(" is a purely functional description of an effectual query that may contain requests to one or more data sources. Similarly to "),s("code",[t._v("ZIO[R, E, A]")]),t._v(", it requires an environment "),s("code",[t._v("R")]),t._v(", may fail with an "),s("code",[t._v("E")]),t._v(" or succeed with an "),s("code",[t._v("A")]),t._v(". All requests that do not need to be performed sequentially will automatically be batched, allowing for aggressive data source specific optimizations. Requests will also automatically be deduplicated and cached.")]),t._v(" "),s("p",[t._v("This allows for writing queries in a high level, compositional style, with confidence that they will automatically be optimized. For example, consider the following query from a user service.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" getAllUserIds"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Nothing")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" getUserNameById"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Nothing")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n userIds "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" getAllUserIds\n userNames "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("foreachPar"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("userIds"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("getUserNameById"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("yield")]),t._v(" userNames\n")])])]),s("p",[t._v("This would normally require N + 1 queries, one for "),s("code",[t._v("getAllUserIds")]),t._v(" and one for each call to "),s("code",[t._v("getUserNameById")]),t._v(". In contrast, "),s("code",[t._v("ZQuery")]),t._v(" will automatically optimize this to two queries, one for "),s("code",[t._v("userIds")]),t._v(" and one for "),s("code",[t._v("userNames")]),t._v(", assuming an implementation of the user service that supports batching.")]),t._v(" "),s("h2",{attrs:{id:"building-a-datasource"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#building-a-datasource"}},[t._v("#")]),t._v(" Building a DataSource")]),t._v(" "),s("p",[t._v("To build a "),s("code",[t._v("ZQuery")]),t._v(" that executes a request, you first need to build a "),s("code",[t._v("DataSource")]),t._v(". A "),s("code",[t._v("DataSource[R, E, A]")]),t._v(" defines how to execute requests of type "),s("code",[t._v("A")]),t._v(" and it requires 2 things:")]),t._v(" "),s("ul",[s("li",[t._v("an "),s("code",[t._v("identifier")]),t._v(" that uniquely identifies the data source (requests from "),s("em",[t._v("different")]),t._v(" data sources will "),s("em",[t._v("not")]),t._v(" be batched together)")]),t._v(" "),s("li",[t._v("a effectful function "),s("code",[t._v("run")]),t._v(" from an "),s("code",[t._v("Iterable")]),t._v(" of requests to a "),s("code",[t._v("Map")]),t._v(" of requests and results")])]),t._v(" "),s("p",[t._v("Let's consider "),s("code",[t._v("getUserNameById")]),t._v(" from the previous example. We need to define a corresponding request type that extends "),s("code",[t._v("zquery.Request")]),t._v(" for a given response type:")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" GetUserName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" Request"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Throwable"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n")])])]),s("p",[t._v("Now let's build the corresponding "),s("code",[t._v("DataSource")]),t._v(". We need to implement the following functions:")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" UserDataSource "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" DataSource"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" GetUserName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("override")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" identifier"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("override")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" run"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("requests"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Iterable"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("GetUserName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZIO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Throwable"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" CompletedRequestMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v('We will use "UserDataSource" as our identifier. This name should not be reused for other data sources.')]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("override")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" identifier"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"UserDataSource"')]),t._v("\n")])])]),s("p",[t._v("We will define two different behaviors depending on whether we receive a single request or multiple requests at once.\nFor each request, we need to insert into the result map a value of type "),s("code",[t._v("Either")]),t._v(" ("),s("code",[t._v("Left")]),t._v(" for an error and "),s("code",[t._v("Right")]),t._v(" for a success).")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("override")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" run"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("requests"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Iterable"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("GetUserName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZIO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Nothing")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" CompletedRequestMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" resultMap "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" CompletedRequestMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("empty\n requests"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("toList "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("match")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" request "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("::")]),t._v(" Nil "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// get user by ID e.g. SELECT name FROM users WHERE id = $id")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" result"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n result"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("either"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("map"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("resultMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("insert"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("request"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" batch "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// get multiple users at once e.g. SELECT id, name FROM users WHERE id IN ($ids)")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" result"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n result"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("fold"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n err "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" requests"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("foldLeft"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("resultMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("map"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" req"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" map"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("insert"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("req"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("Left"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("err"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n _"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("foldLeft"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("resultMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("map"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" name"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" map"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("insert"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("GetUserName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("Right"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("name"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("Now to build a "),s("code",[t._v("ZQuery")]),t._v(" from it, we can use "),s("code",[t._v("ZQuery.fromRequest")]),t._v(" and just pass the request and the data source:")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" getUserNameById"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Throwable"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("fromRequest"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("GetUserName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("UserDataSource"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("To run a "),s("code",[t._v("ZQuery")]),t._v(", simply use "),s("code",[t._v("ZQuery#run")]),t._v(" which will return a "),s("code",[t._v("ZIO[R, E, A]")]),t._v(".")]),t._v(" "),s("h2",{attrs:{id:"zquery-constructors-and-operators"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#zquery-constructors-and-operators"}},[t._v("#")]),t._v(" ZQuery constructors and operators")]),t._v(" "),s("p",[t._v("There are several ways to create a "),s("code",[t._v("ZQuery")]),t._v(". We've seen "),s("code",[t._v("ZQuery.fromRequest")]),t._v(", but you can also:")]),t._v(" "),s("ul",[s("li",[t._v("create from a pure value with "),s("code",[t._v("ZQuery.succeed")])]),t._v(" "),s("li",[t._v("create from an effect value with "),s("code",[t._v("ZQuery.fromEffect")])]),t._v(" "),s("li",[t._v("create from multiple queries with "),s("code",[t._v("ZQuery.collectAllPar")]),t._v(" and "),s("code",[t._v("ZQuery.foreachPar")]),t._v(" and their sequential equivalents "),s("code",[t._v("ZQuery.collectAll")]),t._v(" and "),s("code",[t._v("ZQuery.foreach")])])]),t._v(" "),s("p",[t._v("If you have a "),s("code",[t._v("ZQuery")]),t._v(" object, you can use:")]),t._v(" "),s("ul",[s("li",[s("code",[t._v("map")]),t._v(" and "),s("code",[t._v("mapError")]),t._v(" to modify the returned result or error")]),t._v(" "),s("li",[s("code",[t._v("flatMap")]),t._v(" or "),s("code",[t._v("zip")]),t._v(" to combine it with other "),s("code",[t._v("ZQuery")]),t._v(" objects")]),t._v(" "),s("li",[s("code",[t._v("provide")]),t._v(" and "),s("code",[t._v("provideSome")]),t._v(" to eliminate some of the "),s("code",[t._v("R")]),t._v(" requirements")])]),t._v(" "),s("p",[t._v("There are several ways to run a "),s("code",[t._v("ZQuery")]),t._v(":")]),t._v(" "),s("ul",[s("li",[s("code",[t._v("runCache")]),t._v(' runs the query using a given pre-populated cache. This can be useful for deterministically "replaying" a query without executing any new requests.')]),t._v(" "),s("li",[s("code",[t._v("runLog")]),t._v(" runs the query and returns its result along with the cache containing a complete log of all requests executed and their results. This can be useful for logging or analysis of query execution.")]),t._v(" "),s("li",[s("code",[t._v("run")]),t._v(" runs the query and returns its result.")])]),t._v(" "),s("h2",{attrs:{id:"using-zquery-with-caliban"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#using-zquery-with-caliban"}},[t._v("#")]),t._v(" Using ZQuery with Caliban")]),t._v(" "),s("p",[t._v("To use "),s("code",[t._v("ZQuery")]),t._v(" with Caliban, you can simply include fields of type "),s("code",[t._v("ZQuery")]),t._v(" in your API definition.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n users"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Nothing")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("User"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n user"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" UserArgs "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Nothing")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" User"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("During the query execution, Caliban will merge all the requested fields that return a "),s("code",[t._v("ZQuery")]),t._v(" into a single "),s("code",[t._v("ZQuery")]),t._v(" and run it, so that all the possible optimizations are applied.")]),t._v(" "),s("p",[t._v("The "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/examples",target:"_blank",rel:"noopener noreferrer"}},[t._v("examples"),s("OutboundLink")],1),t._v(" project provides 2 versions of the problem described in "),s("a",{attrs:{href:"https://blog.apollographql.com/optimizing-your-graphql-request-waterfalls-7c3f3360b051",target:"_blank",rel:"noopener noreferrer"}},[t._v("this article about GraphQL query optimization"),s("OutboundLink")],1),t._v(":")]),t._v(" "),s("ul",[s("li",[t._v("a "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/examples/src/main/scala/caliban/optimizations/NaiveTest.scala",target:"_blank",rel:"noopener noreferrer"}},[t._v("naive"),s("OutboundLink")],1),t._v(" version where fields are just returning "),s("code",[t._v("IO")]),t._v(", resulting in 47 requests")]),t._v(" "),s("li",[t._v("an "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/examples/src/main/scala/caliban/optimizations/OptimizedTest.scala",target:"_blank",rel:"noopener noreferrer"}},[t._v("optimized"),s("OutboundLink")],1),t._v(" version where fields are returning "),s("code",[t._v("ZQuery")]),t._v(", resulting in 8 requests only")])])])}),[],!1,null,null,null);a.default=n.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/12.bc45abe0.js b/docs/assets/js/12.bc45abe0.js new file mode 100644 index 000000000..8702eb593 --- /dev/null +++ b/docs/assets/js/12.bc45abe0.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[12],{210:function(t,a,e){"use strict";e.r(a);var s=e(28),n=Object(s.a)({},(function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[e("h1",{attrs:{id:"middleware"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#middleware"}},[t._v("#")]),t._v(" Middleware")]),t._v(" "),e("p",[t._v("Caliban allows you to perform additional actions at various levels of a query processing, via the concept of "),e("code",[t._v("Wrapper")]),t._v(". Using wrappers, you can:")]),t._v(" "),e("ul",[e("li",[t._v("verify that a query doesn't reach some limit (e.g. depth, complexity)")]),t._v(" "),e("li",[t._v("modify a query before it's executed")]),t._v(" "),e("li",[t._v("add timeouts to queries or fields")]),t._v(" "),e("li",[t._v("log each field execution time")]),t._v(" "),e("li",[t._v("support "),e("a",{attrs:{href:"https://github.com/apollographql/apollo-tracing",target:"_blank",rel:"noopener noreferrer"}},[t._v("Apollo Tracing"),e("OutboundLink")],1),t._v(", "),e("a",{attrs:{href:"https://github.com/apollographql/apollo-cache-control",target:"_blank",rel:"noopener noreferrer"}},[t._v("Apollo Caching"),e("OutboundLink")],1),t._v(" or anything similar")]),t._v(" "),e("li",[t._v("etc.")])]),t._v(" "),e("h2",{attrs:{id:"wrapper-types"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#wrapper-types"}},[t._v("#")]),t._v(" Wrapper types")]),t._v(" "),e("p",[t._v("There are 5 basic types of wrappers:")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("OverallWrapper")]),t._v(" to wrap the whole query processing")]),t._v(" "),e("li",[e("code",[t._v("ParsingWrapper")]),t._v(" to wrap the query parsing only")]),t._v(" "),e("li",[e("code",[t._v("ValidationWrapper")]),t._v(" to wrap the query validation only")]),t._v(" "),e("li",[e("code",[t._v("ExecutionWrapper")]),t._v(" to wrap the query execution only")]),t._v(" "),e("li",[e("code",[t._v("FieldWrapper")]),t._v(" to wrap each field execution")])]),t._v(" "),e("p",[t._v("Each one requires a function that takes a "),e("code",[t._v("ZIO")]),t._v(" or "),e("code",[t._v("ZQuery")]),t._v(" computation together with some contextual information (e.g. the query string) and should return another computation.")]),t._v(" "),e("p",[t._v("Let's see how to implement a wrapper that times out the whole query if its processing takes longer that 1 minute.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" wrapper "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" OverallWrapper "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("io"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" query"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v("\n io"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("timeout"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),t._v(" minute"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("map"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n _"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("getOrElse"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n GraphQLResponse"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n NullValue"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("ExecutionError"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("s"),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Query was interrupted after timeout of ${duration.render}:\\n$query"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("You can also combine wrappers using "),e("code",[t._v("|+|")]),t._v(" and create a wrapper that requires an effect to be run at each query using "),e("code",[t._v("EffectfulWrapper")]),t._v(".")]),t._v(" "),e("p",[t._v("To use your wrapper, call "),e("code",[t._v("GraphQL#withWrapper")]),t._v(" or its alias "),e("code",[t._v("@@")]),t._v(".")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("withWrapper"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("wrapper"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// or")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" @@ wrapper\n")])])]),e("h2",{attrs:{id:"pre-defined-wrappers"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#pre-defined-wrappers"}},[t._v("#")]),t._v(" Pre-defined wrappers")]),t._v(" "),e("p",[t._v("Caliban comes with a few pre-made wrappers in "),e("code",[t._v("caliban.wrappers.Wrappers")]),t._v(":")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("maxDepth")]),t._v(" returns a wrapper that fails queries whose depth is higher than a given value")]),t._v(" "),e("li",[e("code",[t._v("maxFields")]),t._v(" returns a wrapper that fails queries whose number of fields is higher than a given value")]),t._v(" "),e("li",[e("code",[t._v("timeout")]),t._v(" returns a wrapper that fails queries taking more than a specified time")]),t._v(" "),e("li",[e("code",[t._v("printSlowQueries")]),t._v(" returns a wrapper that prints slow queries")]),t._v(" "),e("li",[e("code",[t._v("onSlowQueries")]),t._v(" returns a wrapper that can run a given function on slow queries")])]),t._v(" "),e("p",[t._v("In addition to those, Caliban also ships with some non-spec but standard wrappers")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("caliban.wrappers.ApolloTracing.apolloTracing")]),t._v(" returns a wrapper that adds tracing data into the "),e("code",[t._v("extensions")]),t._v(" field of each response following "),e("a",{attrs:{href:"https://github.com/apollographql/apollo-tracing",target:"_blank",rel:"noopener noreferrer"}},[t._v("Apollo Tracing"),e("OutboundLink")],1),t._v(" format.")]),t._v(" "),e("li",[e("code",[t._v("caliban.wrappers.ApolloCaching.apolloCaching")]),t._v(" returns a wrapper that adds caching hints to properly annotated fields using the "),e("a",{attrs:{href:"https://github.com/apollographql/apollo-cache-control",target:"_blank",rel:"noopener noreferrer"}},[t._v("Apollo Caching"),e("OutboundLink")],1),t._v(" format.")])]),t._v(" "),e("p",[t._v("They can be used like this:")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n graphQL"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" @@\n maxDepth"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("50")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" @@\n timeout"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("3")]),t._v(" seconds"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" @@\n printSlowQueries"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("500")]),t._v(" millis"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" @@\n apolloTracing @@\n apolloCaching\n")])])]),e("h2",{attrs:{id:"wrapping-the-interpreter"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#wrapping-the-interpreter"}},[t._v("#")]),t._v(" Wrapping the interpreter")]),t._v(" "),e("p",[t._v("All the wrappers mentioned above require that you don't modify the environment "),e("code",[t._v("R")]),t._v(" and the error type which is always a "),e("code",[t._v("CalibanError")]),t._v(". It is also possible to wrap your "),e("code",[t._v("GraphQLInterpreter")]),t._v(" by calling "),e("code",[t._v("wrapExecutionWith")]),t._v(" on it. This method takes in a function "),e("code",[t._v("f")]),t._v(" and returns a new "),e("code",[t._v("GraphQLInterpreter")]),t._v(" that will wrap the "),e("code",[t._v("execute")]),t._v(" method with this function "),e("code",[t._v("f")]),t._v(".")]),t._v(" "),e("p",[t._v("It is used internally to implement "),e("code",[t._v("mapError")]),t._v(" (customize errors) and "),e("code",[t._v("provide")]),t._v(" (eliminate the environment), but you can use it for other purposes such as adding a general timeout, logging response times, etc.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" i"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" GraphQLInterpreter"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("MyEnv"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" CalibanError"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// change error type to String")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" i2"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" GraphQLInterpreter"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("MyEnv"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" i"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mapError"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("_"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("toString"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// provide the environment")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" i3"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" GraphQLInterpreter"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" CalibanError"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" i"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("provide"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("myEnv"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// add a timeout on every query execution")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" i4"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" GraphQLInterpreter"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("MyEnv "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("with")]),t._v(" Clock"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" CalibanError"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n i"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("wrapExecutionWith"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n _"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("timeout"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("30")]),t._v(" seconds"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("map"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n _"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("getOrElse"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("GraphQLResponse"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("NullValue"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("ExecutionError"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Timeout!"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])])])}),[],!1,null,null,null);a.default=n.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/13.a0ebd332.js b/docs/assets/js/13.a0ebd332.js deleted file mode 100644 index 721edff3d..000000000 --- a/docs/assets/js/13.a0ebd332.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[13],{213:function(t,a,s){"use strict";s.r(a);var e=s(0),n=Object(e.a)({},(function(){var t=this,a=t.$createElement,s=t._self._c||a;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"schemas"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#schemas"}},[t._v("#")]),t._v(" Schemas")]),t._v(" "),s("p",[t._v("A GraphQL schema will be derived automatically at compile-time (no reflection) from the types present in your resolver.\nThe table below shows how common Scala types are converted to GraphQL types.")]),t._v(" "),s("table",[s("thead",[s("tr",[s("th",[t._v("Scala Type")]),t._v(" "),s("th",[t._v("GraphQL Type")])])]),t._v(" "),s("tbody",[s("tr",[s("td",[t._v("Boolean")]),t._v(" "),s("td",[t._v("Boolean")])]),t._v(" "),s("tr",[s("td",[t._v("Int")]),t._v(" "),s("td",[t._v("Int")])]),t._v(" "),s("tr",[s("td",[t._v("Float")]),t._v(" "),s("td",[t._v("Float")])]),t._v(" "),s("tr",[s("td",[t._v("Double")]),t._v(" "),s("td",[t._v("Float")])]),t._v(" "),s("tr",[s("td",[t._v("String")]),t._v(" "),s("td",[t._v("String")])]),t._v(" "),s("tr",[s("td",[t._v("java.util.UUID")]),t._v(" "),s("td",[t._v("ID")])]),t._v(" "),s("tr",[s("td",[t._v("Unit")]),t._v(" "),s("td",[t._v("Unit (custom scalar)")])]),t._v(" "),s("tr",[s("td",[t._v("Long")]),t._v(" "),s("td",[t._v("Long (custom scalar)")])]),t._v(" "),s("tr",[s("td",[t._v("BigInt")]),t._v(" "),s("td",[t._v("BigInt (custom scalar)")])]),t._v(" "),s("tr",[s("td",[t._v("BigDecimal")]),t._v(" "),s("td",[t._v("BigDecimal (custom scalar)")])]),t._v(" "),s("tr",[s("td",[t._v("Case Class")]),t._v(" "),s("td",[t._v("Object")])]),t._v(" "),s("tr",[s("td",[t._v("Sealed Trait")]),t._v(" "),s("td",[t._v("Enum or Union")])]),t._v(" "),s("tr",[s("td",[t._v("Option[A]")]),t._v(" "),s("td",[t._v("Nullable A")])]),t._v(" "),s("tr",[s("td",[t._v("List[A]")]),t._v(" "),s("td",[t._v("List of A")])]),t._v(" "),s("tr",[s("td",[t._v("Set[A]")]),t._v(" "),s("td",[t._v("List of A")])]),t._v(" "),s("tr",[s("td",[t._v("A => B")]),t._v(" "),s("td",[t._v("A and B")])]),t._v(" "),s("tr",[s("td",[t._v("(A, B)")]),t._v(" "),s("td",[t._v("Object with 2 fields "),s("code",[t._v("_1")]),t._v(" and "),s("code",[t._v("_2")])])]),t._v(" "),s("tr",[s("td",[t._v("Either[A, B]")]),t._v(" "),s("td",[t._v("Object with 2 nullable fields "),s("code",[t._v("left")]),t._v(" and "),s("code",[t._v("right")])])]),t._v(" "),s("tr",[s("td",[t._v("Map[A, B]")]),t._v(" "),s("td",[t._v("List of Object with 2 fields "),s("code",[t._v("key")]),t._v(" and "),s("code",[t._v("value")])])]),t._v(" "),s("tr",[s("td",[t._v("ZIO[R, Nothing, A]")]),t._v(" "),s("td",[t._v("A")])]),t._v(" "),s("tr",[s("td",[t._v("ZIO[R, E, A]")]),t._v(" "),s("td",[t._v("Nullable A")])]),t._v(" "),s("tr",[s("td",[t._v("Future[A]")]),t._v(" "),s("td",[t._v("Nullable A")])]),t._v(" "),s("tr",[s("td",[t._v("ZStream[R, E, A]")]),t._v(" "),s("td",[t._v("A (subscription) or List of A (query, mutation)")])]),t._v(" "),s("tr",[s("td",[t._v("Json (from "),s("a",{attrs:{href:"https://github.com/circe/circe",target:"_blank",rel:"noopener noreferrer"}},[t._v("Circe"),s("OutboundLink")],1),t._v(")")]),t._v(" "),s("td",[t._v("Json (custom scalar, need "),s("code",[t._v("import caliban.interop.circe.json._")]),t._v(")")])])])]),t._v(" "),s("p",[t._v("See the "),s("a",{attrs:{href:"#custom-types"}},[t._v("Custom Types")]),t._v(" section to find out how to support your own types.")]),t._v(" "),s("p",[t._v("If you want Caliban to support other standard types, feel free to "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/issues",target:"_blank",rel:"noopener noreferrer"}},[t._v("file an issue"),s("OutboundLink")],1),t._v(" or even a PR.")]),t._v(" "),s("div",{staticClass:"custom-block warning"},[s("p",{staticClass:"custom-block-title"},[t._v("Schema derivation issues")]),t._v(" "),s("p",[t._v("Magnolia (the library used to derive the schema at compile-time) sometimes has some trouble generating schemas with a lot of nested types, or types reused in multiple places.\nto deal with this, you can declare schemas for your case classes and sealed traits explicitly:")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" roleSchema "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Schema"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("gen"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Role"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" characterSchema "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Schema"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("gen"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n")])])]),s("p",[t._v("Make sure those implicits are in scope when you call "),s("code",[t._v("graphQL(...)")]),t._v(". This will make Magnolia's job easier by pre-generating schemas for those classes and re-using them when needed.\nThis will also improve compilation times and generate less bytecode.")])]),t._v(" "),s("h2",{attrs:{id:"enum-and-union"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#enum-and-union"}},[t._v("#")]),t._v(" Enum and union")]),t._v(" "),s("p",[t._v("A sealed trait will be converted to a different GraphQL type depending on its content:")]),t._v(" "),s("ul",[s("li",[t._v("a sealed trait with only case objects will be converted to an "),s("code",[t._v("ENUM")])]),t._v(" "),s("li",[t._v("a sealed trait with only case classes will be converted to a "),s("code",[t._v("UNION")])])]),t._v(" "),s("p",[t._v('GraphQL does not support empty objects, so in case a sealed trait mixes case classes and case objects, a union type will be created and the case objects will have a "fake" field named '),s("code",[t._v("_")]),t._v(" which is not queryable.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("sealed")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("trait")]),t._v(" ORIGIN\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" ORIGIN "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" EARTH "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" ORIGIN\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" MARS "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" ORIGIN\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" BELT "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" ORIGIN\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("The snippet above will produce the following GraphQL type:")]),t._v(" "),s("div",{staticClass:"language-graphql extra-class"},[s("pre",{pre:!0,attrs:{class:"language-graphql"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("enum")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Origin")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("BELT")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("EARTH")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("MARS")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("Here's an example of union:")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("sealed")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("trait")]),t._v(" Role\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" Role "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Captain"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("shipName"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" Role\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Engineer"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("specialty"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" Role\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" Mechanic "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" Role\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("The snippet above will produce the following GraphQL type:")]),t._v(" "),s("div",{staticClass:"language-graphql extra-class"},[s("pre",{pre:!0,attrs:{class:"language-graphql"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("union")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Role")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Captain "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),t._v(" Engineer "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),t._v(" Mechanic\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Captain")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("shipName")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" String"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Engineer")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("specialty")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" String"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Mechanic")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("_")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" Boolean"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("h2",{attrs:{id:"arguments"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#arguments"}},[t._v("#")]),t._v(" Arguments")]),t._v(" "),s("p",[t._v("To declare a field that take arguments, create a dedicated case class representing the arguments and make the field a "),s("em",[t._v("function")]),t._v(" from this class to the result type.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" FilterArgs"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("origin"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Option"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Origin"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("characters"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" FilterArgs "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("The snippet above will produce the following GraphQL type:")]),t._v(" "),s("div",{staticClass:"language-graphql extra-class"},[s("pre",{pre:!0,attrs:{class:"language-graphql"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Queries")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("characters")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("origin")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" Origin"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("Caliban provides auto-derivation for common types such as "),s("code",[t._v("Int")]),t._v(", "),s("code",[t._v("String")]),t._v(", "),s("code",[t._v("List")]),t._v(", "),s("code",[t._v("Option")]),t._v(", etc. but you can also support your own types by providing an implicit instance of "),s("code",[t._v("caliban.schema.ArgBuilder")]),t._v(".")]),t._v(" "),s("div",{staticClass:"custom-block tip"},[s("p",{staticClass:"custom-block-title"},[t._v("TIP")]),t._v(" "),s("p",[t._v("There is no "),s("code",[t._v("ArgBuilder")]),t._v(" for tuples. If you have multiple arguments, use a case class containing all of them instead of a tuple.")])]),t._v(" "),s("h2",{attrs:{id:"effects"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#effects"}},[t._v("#")]),t._v(" Effects")]),t._v(" "),s("p",[t._v("Fields can return ZIO effects. This allows you to leverage all the features provided by ZIO: timeouts, retries, access to ZIO environment, memoizing, etc. An effect will be run every time a query requiring the corresponding field is executed.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("characters"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n character"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" CharacterName "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" RIO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("If you don't use ZIO environment ("),s("code",[t._v("R")]),t._v(" = "),s("code",[t._v("Any")]),t._v("), there is nothing special to do to get it working.")]),t._v(" "),s("p",[t._v("If you require a ZIO environment, you will need to have the content of "),s("code",[t._v("caliban.schema.GenericSchema[R]")]),t._v(" for your custom "),s("code",[t._v("R")]),t._v(" in scope when you call "),s("code",[t._v("graphQL(...)")]),t._v(".")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" schema "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" GenericSchema"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("MyEnv"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" schema"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_\n")])])]),s("h2",{attrs:{id:"annotations"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#annotations"}},[t._v("#")]),t._v(" Annotations")]),t._v(" "),s("p",[t._v("Caliban supports a few annotations to enrich data types:")]),t._v(" "),s("ul",[s("li",[s("code",[t._v('@GQLName("name")')]),t._v(" allows you to specify a different name for a data type or a field.")]),t._v(" "),s("li",[s("code",[t._v('@GQLInputName("name")')]),t._v(" allows you to specify a different name for a data type used as an input (by default, the suffix "),s("code",[t._v("Input")]),t._v(" is appended to the type name).")]),t._v(" "),s("li",[s("code",[t._v('@GQLDescription("description")')]),t._v(" lets you provide a description for a data type or field. This description will be visible when your schema is introspected.")]),t._v(" "),s("li",[s("code",[t._v('@GQLDeprecated("reason")')]),t._v(" allows deprecating a field or an enum value.")])]),t._v(" "),s("h2",{attrs:{id:"custom-types"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#custom-types"}},[t._v("#")]),t._v(" Custom types")]),t._v(" "),s("p",[t._v("Caliban provides auto-derivation for common types such as "),s("code",[t._v("Int")]),t._v(", "),s("code",[t._v("String")]),t._v(", "),s("code",[t._v("List")]),t._v(", "),s("code",[t._v("Option")]),t._v(", etc. but you can also support your own types by providing an implicit instance of "),s("code",[t._v("caliban.schema.Schema")]),t._v(".")]),t._v(" "),s("p",[t._v("An easy way to do this is to reuse existing instances and use "),s("code",[t._v("contramap")]),t._v(" to map from your type to the original type. Here's an example of creating an instance for "),s("a",{attrs:{href:"https://github.com/fthomas/refined",target:"_blank",rel:"noopener noreferrer"}},[t._v("refined"),s("OutboundLink")],1),t._v("'s "),s("code",[t._v("NonEmptyString")]),t._v(" reusing existing instance for "),s("code",[t._v("String")]),t._v(":")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("schema")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" nonEmptyStringSchema"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Schema"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" NonEmptyString"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Schema"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("stringSchema"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("contramap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("_"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("value"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("You can also use the "),s("code",[t._v("scalarSchema")]),t._v(" helper to create your own scalar types, providing a name, an optional description, and a function from your type to a "),s("code",[t._v("ResponseValue")]),t._v(":")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("schema")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" unitSchema"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Schema"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Unit")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" scalarSchema"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Unit"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" None"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" _ "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" ObjectValue"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("Nil"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("h2",{attrs:{id:"code-generation"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#code-generation"}},[t._v("#")]),t._v(" Code generation")]),t._v(" "),s("p",[t._v("Caliban can automatically generate Scala code from a GraphQL schema.")]),t._v(" "),s("p",[t._v("In order to use this feature, add the "),s("code",[t._v("caliban-codegen")]),t._v(" sbt plugin to your project and enable it.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[t._v("addSbtPlugin"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"com.github.ghostdogpr"')]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("%")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"caliban-codegen"')]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("%")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"0.5.2"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\nenablePlugins"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("CodegenPlugin"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("Then call the "),s("code",[t._v("codegen")]),t._v(" sbt command.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[t._v("calibanGenSchema schemaPath outPath "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("scalafmtPath\n\ncalibanGenSchema project"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("schema"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("json src"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("main"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("GQLSchema"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("scala\n")])])]),s("p",[t._v("This command will create a Scala file in "),s("code",[t._v("outputPath")]),t._v(" containing all the types defined in the provided GraphQL schema defined at "),s("code",[t._v("schemaPath")]),t._v(". The generated code will be formatted with Scalafmt using the configuration defined by "),s("code",[t._v("scalafmtPath")]),t._v(".")]),t._v(" "),s("div",{staticClass:"custom-block warning"},[s("p",{staticClass:"custom-block-title"},[t._v("Unsupported features")]),t._v(" "),s("p",[t._v("Some features are not supported by Caliban and will cause an error during code generation:")]),t._v(" "),s("ul",[s("li",[t._v("interfaces")]),t._v(" "),s("li",[t._v("extensions")])])])])}),[],!1,null,null,null);a.default=n.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/13.d315a1c7.js b/docs/assets/js/13.d315a1c7.js new file mode 100644 index 000000000..ddc850c26 --- /dev/null +++ b/docs/assets/js/13.d315a1c7.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[13],{211:function(t,a,s){"use strict";s.r(a);var e=s(28),n=Object(e.a)({},(function(){var t=this,a=t.$createElement,s=t._self._c||a;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"query-optimization"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#query-optimization"}},[t._v("#")]),t._v(" Query optimization")]),t._v(" "),s("p",[t._v("A GraphQL query may request multiple fields that are using the same resolver. It's not a problem if the resolver is a simple value, but it can be less than optimal when the resolver runs an effect (such as reading from a database).")]),t._v(" "),s("p",[t._v("We might want to:")]),t._v(" "),s("ul",[s("li",[s("strong",[t._v("cache")]),t._v(" identical queries (deduplication)")]),t._v(" "),s("li",[s("strong",[t._v("batch")]),t._v(" queries to the same source")])]),t._v(" "),s("p",[t._v("This is possible in Caliban using the "),s("code",[t._v("ZQuery")]),t._v(" data type.")]),t._v(" "),s("h2",{attrs:{id:"introducing-zquery"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#introducing-zquery"}},[t._v("#")]),t._v(" Introducing ZQuery")]),t._v(" "),s("p",[t._v("A "),s("code",[t._v("ZQuery[R, E, A]")]),t._v(" is a purely functional description of an effectual query that may contain requests to one or more data sources. Similarly to "),s("code",[t._v("ZIO[R, E, A]")]),t._v(", it requires an environment "),s("code",[t._v("R")]),t._v(", may fail with an "),s("code",[t._v("E")]),t._v(" or succeed with an "),s("code",[t._v("A")]),t._v(". All requests that do not need to be performed sequentially will automatically be batched, allowing for aggressive data source specific optimizations. Requests will also automatically be deduplicated and cached.")]),t._v(" "),s("p",[t._v("This allows for writing queries in a high level, compositional style, with confidence that they will automatically be optimized. For example, consider the following query from a user service.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" getAllUserIds"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Nothing")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" getUserNameById"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Nothing")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n userIds "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" getAllUserIds\n userNames "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("foreachPar"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("userIds"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("getUserNameById"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("yield")]),t._v(" userNames\n")])])]),s("p",[t._v("This would normally require N + 1 queries, one for "),s("code",[t._v("getAllUserIds")]),t._v(" and one for each call to "),s("code",[t._v("getUserNameById")]),t._v(". In contrast, "),s("code",[t._v("ZQuery")]),t._v(" will automatically optimize this to two queries, one for "),s("code",[t._v("userIds")]),t._v(" and one for "),s("code",[t._v("userNames")]),t._v(", assuming an implementation of the user service that supports batching.")]),t._v(" "),s("h2",{attrs:{id:"building-a-datasource"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#building-a-datasource"}},[t._v("#")]),t._v(" Building a DataSource")]),t._v(" "),s("p",[t._v("To build a "),s("code",[t._v("ZQuery")]),t._v(" that executes a request, you first need to build a "),s("code",[t._v("DataSource")]),t._v(". A "),s("code",[t._v("DataSource[R, E, A]")]),t._v(" defines how to execute requests of type "),s("code",[t._v("A")]),t._v(" and it requires 2 things:")]),t._v(" "),s("ul",[s("li",[t._v("an "),s("code",[t._v("identifier")]),t._v(" that uniquely identifies the data source (requests from "),s("em",[t._v("different")]),t._v(" data sources will "),s("em",[t._v("not")]),t._v(" be batched together)")]),t._v(" "),s("li",[t._v("a effectful function "),s("code",[t._v("run")]),t._v(" from an "),s("code",[t._v("Iterable")]),t._v(" of requests to a "),s("code",[t._v("Map")]),t._v(" of requests and results")])]),t._v(" "),s("p",[t._v("Let's consider "),s("code",[t._v("getUserNameById")]),t._v(" from the previous example. We need to define a corresponding request type that extends "),s("code",[t._v("zquery.Request")]),t._v(" for a given response type:")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" GetUserName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" Request"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Throwable"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n")])])]),s("p",[t._v("Now let's build the corresponding "),s("code",[t._v("DataSource")]),t._v(". We need to implement the following functions:")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" UserDataSource "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" DataSource"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" GetUserName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("override")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" identifier"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("override")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" run"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("requests"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Iterable"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("GetUserName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZIO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Throwable"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" CompletedRequestMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v('We will use "UserDataSource" as our identifier. This name should not be reused for other data sources.')]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("override")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" identifier"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"UserDataSource"')]),t._v("\n")])])]),s("p",[t._v("We will define two different behaviors depending on whether we receive a single request or multiple requests at once.\nFor each request, we need to insert into the result map a value of type "),s("code",[t._v("Either")]),t._v(" ("),s("code",[t._v("Left")]),t._v(" for an error and "),s("code",[t._v("Right")]),t._v(" for a success).")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("override")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" run"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("requests"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Iterable"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("GetUserName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZIO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Nothing")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" CompletedRequestMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" resultMap "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" CompletedRequestMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("empty\n requests"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("toList "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("match")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" request "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("::")]),t._v(" Nil "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// get user by ID e.g. SELECT name FROM users WHERE id = $id")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" result"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n result"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("either"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("map"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("resultMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("insert"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("request"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" batch "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// get multiple users at once e.g. SELECT id, name FROM users WHERE id IN ($ids)")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" result"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n result"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("fold"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n err "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" requests"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("foldLeft"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("resultMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("map"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" req"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" map"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("insert"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("req"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("Left"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("err"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n _"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("foldLeft"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("resultMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("map"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" name"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" map"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("insert"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("GetUserName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("Right"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("name"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("Now to build a "),s("code",[t._v("ZQuery")]),t._v(" from it, we can use "),s("code",[t._v("ZQuery.fromRequest")]),t._v(" and just pass the request and the data source:")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" getUserNameById"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Throwable"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("fromRequest"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("GetUserName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("UserDataSource"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("To run a "),s("code",[t._v("ZQuery")]),t._v(", simply use "),s("code",[t._v("ZQuery#run")]),t._v(" which will return a "),s("code",[t._v("ZIO[R, E, A]")]),t._v(".")]),t._v(" "),s("h2",{attrs:{id:"zquery-constructors-and-operators"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#zquery-constructors-and-operators"}},[t._v("#")]),t._v(" ZQuery constructors and operators")]),t._v(" "),s("p",[t._v("There are several ways to create a "),s("code",[t._v("ZQuery")]),t._v(". We've seen "),s("code",[t._v("ZQuery.fromRequest")]),t._v(", but you can also:")]),t._v(" "),s("ul",[s("li",[t._v("create from a pure value with "),s("code",[t._v("ZQuery.succeed")])]),t._v(" "),s("li",[t._v("create from an effect value with "),s("code",[t._v("ZQuery.fromEffect")])]),t._v(" "),s("li",[t._v("create from multiple queries with "),s("code",[t._v("ZQuery.collectAllPar")]),t._v(" and "),s("code",[t._v("ZQuery.foreachPar")]),t._v(" and their sequential equivalents "),s("code",[t._v("ZQuery.collectAll")]),t._v(" and "),s("code",[t._v("ZQuery.foreach")])])]),t._v(" "),s("p",[t._v("If you have a "),s("code",[t._v("ZQuery")]),t._v(" object, you can use:")]),t._v(" "),s("ul",[s("li",[s("code",[t._v("map")]),t._v(" and "),s("code",[t._v("mapError")]),t._v(" to modify the returned result or error")]),t._v(" "),s("li",[s("code",[t._v("flatMap")]),t._v(" or "),s("code",[t._v("zip")]),t._v(" to combine it with other "),s("code",[t._v("ZQuery")]),t._v(" objects")]),t._v(" "),s("li",[s("code",[t._v("provide")]),t._v(" and "),s("code",[t._v("provideSome")]),t._v(" to eliminate some of the "),s("code",[t._v("R")]),t._v(" requirements")])]),t._v(" "),s("p",[t._v("There are several ways to run a "),s("code",[t._v("ZQuery")]),t._v(":")]),t._v(" "),s("ul",[s("li",[s("code",[t._v("runCache")]),t._v(' runs the query using a given pre-populated cache. This can be useful for deterministically "replaying" a query without executing any new requests.')]),t._v(" "),s("li",[s("code",[t._v("runLog")]),t._v(" runs the query and returns its result along with the cache containing a complete log of all requests executed and their results. This can be useful for logging or analysis of query execution.")]),t._v(" "),s("li",[s("code",[t._v("run")]),t._v(" runs the query and returns its result.")])]),t._v(" "),s("h2",{attrs:{id:"using-zquery-with-caliban"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#using-zquery-with-caliban"}},[t._v("#")]),t._v(" Using ZQuery with Caliban")]),t._v(" "),s("p",[t._v("To use "),s("code",[t._v("ZQuery")]),t._v(" with Caliban, you can simply include fields of type "),s("code",[t._v("ZQuery")]),t._v(" in your API definition.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n users"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Nothing")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("User"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n user"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" UserArgs "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Nothing")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" User"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("During the query execution, Caliban will merge all the requested fields that return a "),s("code",[t._v("ZQuery")]),t._v(" into a single "),s("code",[t._v("ZQuery")]),t._v(" and run it, so that all the possible optimizations are applied.")]),t._v(" "),s("p",[t._v("The "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/examples",target:"_blank",rel:"noopener noreferrer"}},[t._v("examples"),s("OutboundLink")],1),t._v(" project provides 2 versions of the problem described in "),s("a",{attrs:{href:"https://blog.apollographql.com/optimizing-your-graphql-request-waterfalls-7c3f3360b051",target:"_blank",rel:"noopener noreferrer"}},[t._v("this article about GraphQL query optimization"),s("OutboundLink")],1),t._v(":")]),t._v(" "),s("ul",[s("li",[t._v("a "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/examples/src/main/scala/caliban/optimizations/NaiveTest.scala",target:"_blank",rel:"noopener noreferrer"}},[t._v("naive"),s("OutboundLink")],1),t._v(" version where fields are just returning "),s("code",[t._v("IO")]),t._v(", resulting in 47 requests")]),t._v(" "),s("li",[t._v("an "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/examples/src/main/scala/caliban/optimizations/OptimizedTest.scala",target:"_blank",rel:"noopener noreferrer"}},[t._v("optimized"),s("OutboundLink")],1),t._v(" version where fields are returning "),s("code",[t._v("ZQuery")]),t._v(", resulting in 8 requests only")])])])}),[],!1,null,null,null);a.default=n.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/14.b8b8c6ff.js b/docs/assets/js/14.b8b8c6ff.js new file mode 100644 index 000000000..7d70ef829 --- /dev/null +++ b/docs/assets/js/14.b8b8c6ff.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[14],{214:function(t,a,e){"use strict";e.r(a);var s=e(28),n=Object(s.a)({},(function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[e("h1",{attrs:{id:"schemas"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#schemas"}},[t._v("#")]),t._v(" Schemas")]),t._v(" "),e("p",[t._v("A GraphQL schema will be derived automatically at compile-time (no reflection) from the types present in your resolver.\nThe table below shows how common Scala types are converted to GraphQL types.")]),t._v(" "),e("table",[e("thead",[e("tr",[e("th",[t._v("Scala Type")]),t._v(" "),e("th",[t._v("GraphQL Type")])])]),t._v(" "),e("tbody",[e("tr",[e("td",[t._v("Boolean")]),t._v(" "),e("td",[t._v("Boolean")])]),t._v(" "),e("tr",[e("td",[t._v("Int")]),t._v(" "),e("td",[t._v("Int")])]),t._v(" "),e("tr",[e("td",[t._v("Float")]),t._v(" "),e("td",[t._v("Float")])]),t._v(" "),e("tr",[e("td",[t._v("Double")]),t._v(" "),e("td",[t._v("Float")])]),t._v(" "),e("tr",[e("td",[t._v("String")]),t._v(" "),e("td",[t._v("String")])]),t._v(" "),e("tr",[e("td",[t._v("java.util.UUID")]),t._v(" "),e("td",[t._v("ID")])]),t._v(" "),e("tr",[e("td",[t._v("Unit")]),t._v(" "),e("td",[t._v("Unit (custom scalar)")])]),t._v(" "),e("tr",[e("td",[t._v("Long")]),t._v(" "),e("td",[t._v("Long (custom scalar)")])]),t._v(" "),e("tr",[e("td",[t._v("BigInt")]),t._v(" "),e("td",[t._v("BigInt (custom scalar)")])]),t._v(" "),e("tr",[e("td",[t._v("BigDecimal")]),t._v(" "),e("td",[t._v("BigDecimal (custom scalar)")])]),t._v(" "),e("tr",[e("td",[t._v("Case Class")]),t._v(" "),e("td",[t._v("Object")])]),t._v(" "),e("tr",[e("td",[t._v("Sealed Trait")]),t._v(" "),e("td",[t._v("Enum or Union")])]),t._v(" "),e("tr",[e("td",[t._v("Option[A]")]),t._v(" "),e("td",[t._v("Nullable A")])]),t._v(" "),e("tr",[e("td",[t._v("List[A]")]),t._v(" "),e("td",[t._v("List of A")])]),t._v(" "),e("tr",[e("td",[t._v("Set[A]")]),t._v(" "),e("td",[t._v("List of A")])]),t._v(" "),e("tr",[e("td",[t._v("A => B")]),t._v(" "),e("td",[t._v("A and B")])]),t._v(" "),e("tr",[e("td",[t._v("(A, B)")]),t._v(" "),e("td",[t._v("Object with 2 fields "),e("code",[t._v("_1")]),t._v(" and "),e("code",[t._v("_2")])])]),t._v(" "),e("tr",[e("td",[t._v("Either[A, B]")]),t._v(" "),e("td",[t._v("Object with 2 nullable fields "),e("code",[t._v("left")]),t._v(" and "),e("code",[t._v("right")])])]),t._v(" "),e("tr",[e("td",[t._v("Map[A, B]")]),t._v(" "),e("td",[t._v("List of Object with 2 fields "),e("code",[t._v("key")]),t._v(" and "),e("code",[t._v("value")])])]),t._v(" "),e("tr",[e("td",[t._v("ZIO[R, Nothing, A]")]),t._v(" "),e("td",[t._v("A")])]),t._v(" "),e("tr",[e("td",[t._v("ZIO[R, E, A]")]),t._v(" "),e("td",[t._v("Nullable A")])]),t._v(" "),e("tr",[e("td",[t._v("Future[A]")]),t._v(" "),e("td",[t._v("Nullable A")])]),t._v(" "),e("tr",[e("td",[t._v("ZStream[R, E, A]")]),t._v(" "),e("td",[t._v("A (subscription) or List of A (query, mutation)")])]),t._v(" "),e("tr",[e("td",[t._v("Json (from "),e("a",{attrs:{href:"https://github.com/circe/circe",target:"_blank",rel:"noopener noreferrer"}},[t._v("Circe"),e("OutboundLink")],1),t._v(")")]),t._v(" "),e("td",[t._v("Json (custom scalar, need "),e("code",[t._v("import caliban.interop.circe.json._")]),t._v(")")])])])]),t._v(" "),e("p",[t._v("See the "),e("a",{attrs:{href:"#custom-types"}},[t._v("Custom Types")]),t._v(" section to find out how to support your own types.")]),t._v(" "),e("p",[t._v("If you want Caliban to support other standard types, feel free to "),e("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/issues",target:"_blank",rel:"noopener noreferrer"}},[t._v("file an issue"),e("OutboundLink")],1),t._v(" or even a PR.")]),t._v(" "),e("div",{staticClass:"custom-block warning"},[e("p",{staticClass:"custom-block-title"},[t._v("Schema derivation issues")]),t._v(" "),e("p",[t._v("Magnolia (the library used to derive the schema at compile-time) sometimes has some trouble generating schemas with a lot of nested types, or types reused in multiple places.\nto deal with this, you can declare schemas for your case classes and sealed traits explicitly:")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" roleSchema "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Schema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("gen"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Role"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" characterSchema "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Schema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("gen"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n")])])]),e("p",[t._v("Make sure those implicits are in scope when you call "),e("code",[t._v("graphQL(...)")]),t._v(". This will make Magnolia's job easier by pre-generating schemas for those classes and re-using them when needed.\nThis will also improve compilation times and generate less bytecode.")])]),t._v(" "),e("h2",{attrs:{id:"enums-unions-interfaces"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#enums-unions-interfaces"}},[t._v("#")]),t._v(" Enums, unions, interfaces")]),t._v(" "),e("p",[t._v("A sealed trait will be converted to a different GraphQL type depending on its content:")]),t._v(" "),e("ul",[e("li",[t._v("a sealed trait with only case objects will be converted to an "),e("code",[t._v("ENUM")])]),t._v(" "),e("li",[t._v("a sealed trait with only case classes will be converted to a "),e("code",[t._v("UNION")])])]),t._v(" "),e("p",[t._v('GraphQL does not support empty objects, so in case a sealed trait mixes case classes and case objects, a union type will be created and the case objects will have a "fake" field named '),e("code",[t._v("_")]),t._v(" which is not queryable.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("sealed")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("trait")]),t._v(" ORIGIN\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" ORIGIN "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" EARTH "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" ORIGIN\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" MARS "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" ORIGIN\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" BELT "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" ORIGIN\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("The snippet above will produce the following GraphQL type:")]),t._v(" "),e("div",{staticClass:"language-graphql extra-class"},[e("pre",{pre:!0,attrs:{class:"language-graphql"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("enum")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Origin")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token constant"}},[t._v("BELT")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token constant"}},[t._v("EARTH")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token constant"}},[t._v("MARS")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("Here's an example of union:")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("sealed")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("trait")]),t._v(" Role\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" Role "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Captain"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("shipName"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" Role\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Engineer"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("specialty"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" Role\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" Mechanic "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" Role\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("The snippet above will produce the following GraphQL type:")]),t._v(" "),e("div",{staticClass:"language-graphql extra-class"},[e("pre",{pre:!0,attrs:{class:"language-graphql"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("union")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Role")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Captain "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),t._v(" Engineer "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),t._v(" Mechanic\n\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Captain")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("shipName")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" String"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Engineer")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("specialty")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" String"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Mechanic")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("_")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" Boolean"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("If you prefer an "),e("code",[t._v("Interface")]),t._v(" instead of a "),e("code",[t._v("Union")]),t._v(" type, add the "),e("code",[t._v("@GQLInterface")]),t._v(" annotation to your sealed trait.\nAn interface will be created with all the fields that are common to the case classes extending the sealed trait.")]),t._v(" "),e("h2",{attrs:{id:"arguments"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#arguments"}},[t._v("#")]),t._v(" Arguments")]),t._v(" "),e("p",[t._v("To declare a field that take arguments, create a dedicated case class representing the arguments and make the field a "),e("em",[t._v("function")]),t._v(" from this class to the result type.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" FilterArgs"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("origin"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Option"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Origin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Queries"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("characters"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" FilterArgs "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("p",[t._v("The snippet above will produce the following GraphQL type:")]),t._v(" "),e("div",{staticClass:"language-graphql extra-class"},[e("pre",{pre:!0,attrs:{class:"language-graphql"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Queries")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("characters")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("origin")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" Origin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("Caliban provides auto-derivation for common types such as "),e("code",[t._v("Int")]),t._v(", "),e("code",[t._v("String")]),t._v(", "),e("code",[t._v("List")]),t._v(", "),e("code",[t._v("Option")]),t._v(", etc. but you can also support your own types by providing an implicit instance of "),e("code",[t._v("caliban.schema.ArgBuilder")]),t._v(".")]),t._v(" "),e("div",{staticClass:"custom-block tip"},[e("p",{staticClass:"custom-block-title"},[t._v("TIP")]),t._v(" "),e("p",[t._v("There is no "),e("code",[t._v("ArgBuilder")]),t._v(" for tuples. If you have multiple arguments, use a case class containing all of them instead of a tuple.")])]),t._v(" "),e("h2",{attrs:{id:"effects"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#effects"}},[t._v("#")]),t._v(" Effects")]),t._v(" "),e("p",[t._v("Fields can return ZIO effects. This allows you to leverage all the features provided by ZIO: timeouts, retries, access to ZIO environment, memoizing, etc. An effect will be run every time a query requiring the corresponding field is executed.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Queries"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("characters"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Task"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n character"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" CharacterName "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" RIO"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Console"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("p",[t._v("If you don't use ZIO environment ("),e("code",[t._v("R")]),t._v(" = "),e("code",[t._v("Any")]),t._v("), there is nothing special to do to get it working.")]),t._v(" "),e("p",[t._v("If you require a ZIO environment, you will need to have the content of "),e("code",[t._v("caliban.schema.GenericSchema[R]")]),t._v(" for your custom "),e("code",[t._v("R")]),t._v(" in scope when you call "),e("code",[t._v("graphQL(...)")]),t._v(".")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" schema "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" GenericSchema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("MyEnv"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" schema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_\n")])])]),e("h2",{attrs:{id:"annotations"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#annotations"}},[t._v("#")]),t._v(" Annotations")]),t._v(" "),e("p",[t._v("Caliban supports a few annotations to enrich data types:")]),t._v(" "),e("ul",[e("li",[e("code",[t._v('@GQLName("name")')]),t._v(" allows you to specify a different name for a data type or a field.")]),t._v(" "),e("li",[e("code",[t._v('@GQLInputName("name")')]),t._v(" allows you to specify a different name for a data type used as an input (by default, the suffix "),e("code",[t._v("Input")]),t._v(" is appended to the type name).")]),t._v(" "),e("li",[e("code",[t._v('@GQLDescription("description")')]),t._v(" lets you provide a description for a data type or field. This description will be visible when your schema is introspected.")]),t._v(" "),e("li",[e("code",[t._v('@GQLDeprecated("reason")')]),t._v(" allows deprecating a field or an enum value.")]),t._v(" "),e("li",[e("code",[t._v("@GQLInterface")]),t._v(" to force a sealed trait generating an interface instead of a union.")]),t._v(" "),e("li",[e("code",[t._v("@GQLDirective(directive: Directive)")]),t._v(" to add a directive to a field or type.")])]),t._v(" "),e("h2",{attrs:{id:"custom-types"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#custom-types"}},[t._v("#")]),t._v(" Custom types")]),t._v(" "),e("p",[t._v("Caliban provides auto-derivation for common types such as "),e("code",[t._v("Int")]),t._v(", "),e("code",[t._v("String")]),t._v(", "),e("code",[t._v("List")]),t._v(", "),e("code",[t._v("Option")]),t._v(", etc. but you can also support your own types by providing an implicit instance of "),e("code",[t._v("caliban.schema.Schema")]),t._v(".")]),t._v(" "),e("p",[t._v("An easy way to do this is to reuse existing instances and use "),e("code",[t._v("contramap")]),t._v(" to map from your type to the original type. Here's an example of creating an instance for "),e("a",{attrs:{href:"https://github.com/fthomas/refined",target:"_blank",rel:"noopener noreferrer"}},[t._v("refined"),e("OutboundLink")],1),t._v("'s "),e("code",[t._v("NonEmptyString")]),t._v(" reusing existing instance for "),e("code",[t._v("String")]),t._v(":")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("caliban"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("schema")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" nonEmptyStringSchema"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Schema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" NonEmptyString"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Schema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("stringSchema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("contramap"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("_"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("value"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("p",[t._v("You can also use the "),e("code",[t._v("scalarSchema")]),t._v(" helper to create your own scalar types, providing a name, an optional description, and a function from your type to a "),e("code",[t._v("ResponseValue")]),t._v(":")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("caliban"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("schema")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" unitSchema"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Schema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Unit")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" scalarSchema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Unit"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" None"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" _ "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" ObjectValue"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("Nil"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("h2",{attrs:{id:"code-generation"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#code-generation"}},[t._v("#")]),t._v(" Code generation")]),t._v(" "),e("p",[t._v("Caliban can automatically generate Scala code from a GraphQL schema.")]),t._v(" "),e("p",[t._v("In order to use this feature, add the "),e("code",[t._v("caliban-codegen")]),t._v(" sbt plugin to your project and enable it.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[t._v("addSbtPlugin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"com.github.ghostdogpr"')]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("%")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"caliban-codegen"')]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("%")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"0.6.0"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\nenablePlugins"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("CodegenPlugin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("p",[t._v("Then call the "),e("code",[t._v("calibanGenSchema")]),t._v(" sbt command.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[t._v("calibanGenSchema schemaPath outPath "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("scalafmtPath\n\ncalibanGenSchema project"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("schema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("graphql src"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("main"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("MyAPI"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("scala\n")])])]),e("p",[t._v("This command will create a Scala file in "),e("code",[t._v("outputPath")]),t._v(" containing all the types defined in the provided GraphQL schema defined at "),e("code",[t._v("schemaPath")]),t._v(". The generated code will be formatted with Scalafmt using the configuration defined by "),e("code",[t._v("scalafmtPath")]),t._v(" (default: "),e("code",[t._v(".scalafmt.conf")]),t._v(").")]),t._v(" "),e("div",{staticClass:"custom-block warning"},[e("p",{staticClass:"custom-block-title"},[t._v("Unsupported features")]),t._v(" "),e("p",[t._v("Some features are not supported by Caliban and will cause an error during code generation:")]),t._v(" "),e("ul",[e("li",[t._v("interfaces")]),t._v(" "),e("li",[t._v("extensions")])])])])}),[],!1,null,null,null);a.default=n.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/14.fe3db0cd.js b/docs/assets/js/14.fe3db0cd.js deleted file mode 100644 index 64b63d400..000000000 --- a/docs/assets/js/14.fe3db0cd.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[14],{214:function(a,t,s){"use strict";s.r(t);var e=s(0),n=Object(e.a)({},(function(){var a=this,t=a.$createElement,s=a._self._c||t;return s("ContentSlotsDistributor",{attrs:{"slot-key":a.$parent.slotKey}},[s("h1",{attrs:{id:"validation"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#validation"}},[a._v("#")]),a._v(" Validation")]),a._v(" "),s("p",[a._v("Caliban provides a little macro called "),s("code",[a._v("gqldoc")]),a._v(" that can check at "),s("strong",[a._v("compile-time")]),a._v(" that a GraphQL query (a "),s("em",[a._v("document")]),a._v(" to be exact) has valid syntax.")]),a._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("import")]),a._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("Macros"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("gqldoc\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("val")]),a._v(" query "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("=")]),a._v(" gqldoc"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token triple-quoted-string string"}},[a._v('"""\n query test {\n amos: character(name: "Amos Burton") {\n name\n }\n }"""')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n")])])]),s("p",[a._v("At "),s("strong",[a._v("runtime")]),a._v(", it is possible to validate a query against your schema by calling the method "),s("code",[a._v("check")]),a._v(" on your API.")]),a._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("def")]),a._v(" check"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("query"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[a._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),a._v(" IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("[")]),a._v("CalibanError"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(",")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[a._v("Unit")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("]")]),a._v("\n")])])]),s("p",[a._v("It is also possible to skip validation when executing a query by passing "),s("code",[a._v("skipValidation = true")]),a._v(" when calling "),s("code",[a._v("execute")]),a._v(". This will slightly improve performance.")])])}),[],!1,null,null,null);t.default=n.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/15.23ceaf26.js b/docs/assets/js/15.23ceaf26.js new file mode 100644 index 000000000..cb750db92 --- /dev/null +++ b/docs/assets/js/15.23ceaf26.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[15],{213:function(a,t,s){"use strict";s.r(t);var e=s(28),n=Object(e.a)({},(function(){var a=this,t=a.$createElement,s=a._self._c||t;return s("ContentSlotsDistributor",{attrs:{"slot-key":a.$parent.slotKey}},[s("h1",{attrs:{id:"validation"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#validation"}},[a._v("#")]),a._v(" Validation")]),a._v(" "),s("p",[a._v("Caliban provides a little macro called "),s("code",[a._v("gqldoc")]),a._v(" that can check at "),s("strong",[a._v("compile-time")]),a._v(" that a GraphQL query (a "),s("em",[a._v("document")]),a._v(" to be exact) has valid syntax.")]),a._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("import")]),a._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("Macros"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("gqldoc\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("val")]),a._v(" query "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("=")]),a._v(" gqldoc"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token triple-quoted-string string"}},[a._v('"""\n query test {\n amos: character(name: "Amos Burton") {\n name\n }\n }"""')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n")])])]),s("p",[a._v("At "),s("strong",[a._v("runtime")]),a._v(", it is possible to validate a query against your schema by calling the method "),s("code",[a._v("check")]),a._v(" on your API.")]),a._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("def")]),a._v(" check"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("query"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[a._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),a._v(" IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("[")]),a._v("CalibanError"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(",")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[a._v("Unit")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("]")]),a._v("\n")])])]),s("p",[a._v("It is also possible to skip validation when executing a query by passing "),s("code",[a._v("skipValidation = true")]),a._v(" when calling "),s("code",[a._v("execute")]),a._v(". This will slightly improve performance.")])])}),[],!1,null,null,null);t.default=n.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/15.a58fc205.js b/docs/assets/js/15.a58fc205.js deleted file mode 100644 index 7a4b00e0c..000000000 --- a/docs/assets/js/15.a58fc205.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[15],{215:function(r,t,a){"use strict";a.r(t);var e=a(0),n=Object(e.a)({},(function(){var r=this,t=r.$createElement,a=r._self._c||t;return a("ContentSlotsDistributor",{attrs:{"slot-key":r.$parent.slotKey}},[a("h1",{attrs:{id:"resources"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#resources"}},[r._v("#")]),r._v(" Resources")]),r._v(" "),a("h2",{attrs:{id:"talks"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#talks"}},[r._v("#")]),r._v(" Talks")]),r._v(" "),a("ul",[a("li",[a("a",{attrs:{href:"https://www.youtube.com/watch?v=OC8PbviYUlQ",target:"_blank",rel:"noopener noreferrer"}},[r._v("Caliban: Designing a Functional GraphQL Library"),a("OutboundLink")],1),r._v(" by Pierre Ricadat at "),a("a",{attrs:{href:"https://www.functionalscala.com/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Functional Scala"),a("OutboundLink")],1),r._v(" in December 2019 (slides available "),a("a",{attrs:{href:"https://www.slideshare.net/PierreRicadat/designing-a-functional-graphql-library-204680947",target:"_blank",rel:"noopener noreferrer"}},[r._v("here"),a("OutboundLink")],1),r._v(")")])]),r._v(" "),a("h2",{attrs:{id:"blog-articles"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#blog-articles"}},[r._v("#")]),r._v(" Blog Articles")]),r._v(" "),a("ul",[a("li",[a("strong",[a("em",[r._v("GraphQL in Scala with Caliban")])]),r._v(" by Pierre Ricadat (February 2020)\n"),a("ul",[a("li",[a("a",{attrs:{href:"https://medium.com/@ghostdogpr/graphql-in-scala-with-caliban-part-1-8ceb6099c3c2",target:"_blank",rel:"noopener noreferrer"}},[r._v("Part 1: Turn a simple API into GraphQL"),a("OutboundLink")],1)]),r._v(" "),a("li",[a("a",{attrs:{href:"https://medium.com/@ghostdogpr/graphql-in-scala-with-caliban-part-2-c7762110c0f9",target:"_blank",rel:"noopener noreferrer"}},[r._v("Part 2: Query optimization"),a("OutboundLink")],1)]),r._v(" "),a("li",[a("a",{attrs:{href:"https://medium.com/@ghostdogpr/graphql-in-scala-with-caliban-part-3-8962a02d5d64",target:"_blank",rel:"noopener noreferrer"}},[r._v("Part 3: Customization"),a("OutboundLink")],1)])])]),r._v(" "),a("li",[a("a",{attrs:{href:"http://fokot.github.io/post/caliban-auth.html",target:"_blank",rel:"noopener noreferrer"}},[r._v("Authentication in Caliban"),a("OutboundLink")],1),r._v(" by František Kocun (December 2019)")])])])}),[],!1,null,null,null);t.default=n.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/16.09e4e2e8.js b/docs/assets/js/16.09e4e2e8.js deleted file mode 100644 index 546eb61f5..000000000 --- a/docs/assets/js/16.09e4e2e8.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[16],{9:function(n,w,o){}}]); \ No newline at end of file diff --git a/docs/assets/js/16.f357ff30.js b/docs/assets/js/16.f357ff30.js new file mode 100644 index 000000000..61e14bfb6 --- /dev/null +++ b/docs/assets/js/16.f357ff30.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[16],{215:function(r,t,a){"use strict";a.r(t);var e=a(28),n=Object(e.a)({},(function(){var r=this,t=r.$createElement,a=r._self._c||t;return a("ContentSlotsDistributor",{attrs:{"slot-key":r.$parent.slotKey}},[a("h1",{attrs:{id:"resources"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#resources"}},[r._v("#")]),r._v(" Resources")]),r._v(" "),a("h2",{attrs:{id:"talks"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#talks"}},[r._v("#")]),r._v(" Talks")]),r._v(" "),a("ul",[a("li",[a("a",{attrs:{href:"https://www.youtube.com/watch?v=OC8PbviYUlQ",target:"_blank",rel:"noopener noreferrer"}},[r._v("Caliban: Designing a Functional GraphQL Library"),a("OutboundLink")],1),r._v(" by Pierre Ricadat at "),a("a",{attrs:{href:"https://www.functionalscala.com/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Functional Scala"),a("OutboundLink")],1),r._v(" in December 2019 (slides available "),a("a",{attrs:{href:"https://www.slideshare.net/PierreRicadat/designing-a-functional-graphql-library-204680947",target:"_blank",rel:"noopener noreferrer"}},[r._v("here"),a("OutboundLink")],1),r._v(")")])]),r._v(" "),a("h2",{attrs:{id:"blog-articles"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#blog-articles"}},[r._v("#")]),r._v(" Blog Articles")]),r._v(" "),a("ul",[a("li",[a("strong",[a("em",[r._v("GraphQL in Scala with Caliban")])]),r._v(" by Pierre Ricadat (February 2020)\n"),a("ul",[a("li",[a("a",{attrs:{href:"https://medium.com/@ghostdogpr/graphql-in-scala-with-caliban-part-1-8ceb6099c3c2",target:"_blank",rel:"noopener noreferrer"}},[r._v("Part 1: Turn a simple API into GraphQL"),a("OutboundLink")],1)]),r._v(" "),a("li",[a("a",{attrs:{href:"https://medium.com/@ghostdogpr/graphql-in-scala-with-caliban-part-2-c7762110c0f9",target:"_blank",rel:"noopener noreferrer"}},[r._v("Part 2: Query optimization"),a("OutboundLink")],1)]),r._v(" "),a("li",[a("a",{attrs:{href:"https://medium.com/@ghostdogpr/graphql-in-scala-with-caliban-part-3-8962a02d5d64",target:"_blank",rel:"noopener noreferrer"}},[r._v("Part 3: Customization"),a("OutboundLink")],1)])])]),r._v(" "),a("li",[a("a",{attrs:{href:"http://fokot.github.io/post/caliban-auth.html",target:"_blank",rel:"noopener noreferrer"}},[r._v("Authentication in Caliban"),a("OutboundLink")],1),r._v(" by František Kocun (December 2019)")])])])}),[],!1,null,null,null);t.default=n.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/17.fa6e8c03.js b/docs/assets/js/17.fa6e8c03.js new file mode 100644 index 000000000..fb5b85984 --- /dev/null +++ b/docs/assets/js/17.fa6e8c03.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[17],{141:function(n,w,o){}}]); \ No newline at end of file diff --git a/docs/assets/js/2.07c68b8b.js b/docs/assets/js/2.07c68b8b.js new file mode 100644 index 000000000..e137d9477 --- /dev/null +++ b/docs/assets/js/2.07c68b8b.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[2],Array(142).concat([function(t,e,n){"use strict";n.d(e,"d",(function(){return i})),n.d(e,"a",(function(){return a})),n.d(e,"i",(function(){return s})),n.d(e,"f",(function(){return u})),n.d(e,"g",(function(){return l})),n.d(e,"h",(function(){return c})),n.d(e,"b",(function(){return f})),n.d(e,"e",(function(){return h})),n.d(e,"k",(function(){return p})),n.d(e,"l",(function(){return d})),n.d(e,"c",(function(){return g})),n.d(e,"j",(function(){return v}));n(17),n(66),n(103),n(159),n(168),n(40),n(29),n(143),n(41),n(169),n(67);var i=/#.*$/,r=/\.(md|html)$/,a=/\/$/,s=/^[a-z]+:/i;function o(t){return decodeURI(t).replace(i,"").replace(r,"")}function u(t){return s.test(t)}function l(t){return/^mailto:/.test(t)}function c(t){return/^tel:/.test(t)}function f(t){if(u(t))return t;var e=t.match(i),n=e?e[0]:"",r=o(t);return a.test(r)?t:r+".html"+n}function h(t,e){var n=decodeURIComponent(t.hash),r=function(t){var e=t.match(i);if(e)return e[0]}(e);return(!r||n===r)&&o(t.path)===o(e)}function p(t,e,n){if(u(e))return{type:"external",path:e};n&&(e=function(t,e,n){var i=t.charAt(0);if("/"===i)return t;if("?"===i||"#"===i)return e+t;var r=e.split("/");n&&r[r.length-1]||r.pop();for(var a=t.replace(/^\//,"").split("/"),s=0;s<a.length;s++){var o=a[s];".."===o?r.pop():"."!==o&&r.push(o)}""!==r[0]&&r.unshift("");return r.join("/")}(e,n));for(var i=o(e),r=0;r<t.length;r++)if(o(t[r].regularPath)===i)return Object.assign({},t[r],{type:"page",path:f(t[r].path)});return console.error('[vuepress] No matching page found for sidebar item "'.concat(e,'"')),{}}function d(t,e,n,i){var r=n.pages,a=n.themeConfig,s=i&&a.locales&&a.locales[i]||a;if("auto"===(t.frontmatter.sidebar||s.sidebar||a.sidebar))return function(t){var e=g(t.headers||[]);return[{type:"group",collapsable:!1,title:t.title,path:null,children:e.map((function(e){return{type:"auto",title:e.title,basePath:t.path,path:t.path+"#"+e.slug,children:e.children||[]}}))}]}(t);var o=s.sidebar||a.sidebar;if(o){var u=function(t,e){if(Array.isArray(e))return{base:"/",config:e};for(var n in e)if(0===(i=t,/(\.html|\/)$/.test(i)?i:i+"/").indexOf(encodeURI(n)))return{base:n,config:e[n]};var i;return{}}(e,o),l=u.base,c=u.config;return c?c.map((function(t){return function t(e,n,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if("string"==typeof e)return p(n,e,i);if(Array.isArray(e))return Object.assign(p(n,e[0],i),{title:e[1]});r>3&&console.error("[vuepress] detected a too deep nested sidebar group.");var a=e.children||[];return 0===a.length&&e.path?Object.assign(p(n,e.path,i),{title:e.title}):{type:"group",path:e.path,title:e.title,sidebarDepth:e.sidebarDepth,children:a.map((function(e){return t(e,n,i,r+1)})),collapsable:!1!==e.collapsable}}(t,r,l)})):[]}return[]}function g(t){var e;return(t=t.map((function(t){return Object.assign({},t)}))).forEach((function(t){2===t.level?e=t:e&&(e.children||(e.children=[])).push(t)})),t.filter((function(t){return 2===t.level}))}function v(t){return Object.assign(t,{type:t.items&&t.items.length?"links":"link"})}},function(t,e,n){"use strict";var i=n(100),r=n(8),a=n(12),s=n(16),o=n(101),u=n(102);i("match",1,(function(t,e,n){return[function(e){var n=s(this),i=null==e?void 0:e[t];return void 0!==i?i.call(e,n):new RegExp(e)[t](String(n))},function(t){var i=n(e,t,this);if(i.done)return i.value;var s=r(t),l=String(this);if(!s.global)return u(s,l);var c=s.unicode;s.lastIndex=0;for(var f,h=[],p=0;null!==(f=u(s,l));){var d=String(f[0]);h[p]=d,""===d&&(s.lastIndex=o(l,a(s.lastIndex),c)),p++}return 0===p?null:h}]}))},function(t,e,n){},function(t,e){t.exports="\t\n\v\f\r \u2028\u2029\ufeff"},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},,function(t,e,n){n(0)({target:"Array",stat:!0},{isArray:n(42)})},function(t,e,n){var i=n(16),r="["+n(145)+"]",a=RegExp("^"+r+r+"*"),s=RegExp(r+r+"*$"),o=function(t){return function(e){var n=String(i(e));return 1&t&&(n=n.replace(a,"")),2&t&&(n=n.replace(s,"")),n}};t.exports={start:o(1),end:o(2),trim:o(3)}},function(t,e){t.exports=function(t){return null==t}},function(t,e,n){var i=n(189).Symbol;t.exports=i},function(t,e,n){"use strict";n.r(e);n(97);var i=n(142),r={name:"SidebarGroup",components:{DropdownTransition:n(164).a},props:["item","open","collapsable","depth"],beforeCreate:function(){this.$options.components.SidebarLinks=n(163).default},methods:{isActive:i.e}},a=(n(197),n(28)),s=Object(a.a)(r,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("section",{staticClass:"sidebar-group",class:[{collapsable:t.collapsable,"is-sub-group":0!==t.depth},"depth-"+t.depth]},[t.item.path?n("RouterLink",{staticClass:"sidebar-heading clickable",class:{open:t.open,active:t.isActive(t.$route,t.item.path)},attrs:{to:t.item.path},nativeOn:{click:function(e){return t.$emit("toggle")}}},[n("span",[t._v(t._s(t.item.title))]),t._v(" "),t.collapsable?n("span",{staticClass:"arrow",class:t.open?"down":"right"}):t._e()]):n("p",{staticClass:"sidebar-heading",class:{open:t.open},on:{click:function(e){return t.$emit("toggle")}}},[n("span",[t._v(t._s(t.item.title))]),t._v(" "),t.collapsable?n("span",{staticClass:"arrow",class:t.open?"down":"right"}):t._e()]),t._v(" "),n("DropdownTransition",[t.open||!t.collapsable?n("SidebarLinks",{staticClass:"sidebar-group-items",attrs:{items:t.item.children,"sidebar-depth":t.item.sidebarDepth,depth:t.depth+1}}):t._e()],1)],1)}),[],!1,null,null,null).exports;n(198),n(40);function o(t,e,n,i,r){var a={props:{to:e,activeClass:"",exactActiveClass:""},class:{active:i,"sidebar-link":!0}};return r>2&&(a.style={"padding-left":r+"rem"}),t("RouterLink",a,n)}function u(t,e,n,r,a){var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;return!e||s>a?null:t("ul",{class:"sidebar-sub-headers"},e.map((function(e){var l=Object(i.e)(r,n+"#"+e.slug);return t("li",{class:"sidebar-sub-header"},[o(t,n+"#"+e.slug,e.title,l,e.level-1),u(t,e.children,n,r,a,s+1)])})))}var l={functional:!0,props:["item","sidebarDepth"],render:function(t,e){var n=e.parent,r=n.$page,a=(n.$site,n.$route),s=n.$themeConfig,l=n.$themeLocaleConfig,c=e.props,f=c.item,h=c.sidebarDepth,p=Object(i.e)(a,f.path),d="auto"===f.type?p||f.children.some((function(t){return Object(i.e)(a,f.basePath+"#"+t.slug)})):p,g="external"===f.type?function(t,e,n){return t("a",{attrs:{href:e,target:"_blank",rel:"noopener noreferrer"},class:{"sidebar-link":!0}},[n,t("OutboundLink")])}(t,f.path,f.title||f.path):o(t,f.path,f.title||f.path,d),v=[r.frontmatter.sidebarDepth,h,l.sidebarDepth,s.sidebarDepth,1].find((function(t){return void 0!==t})),m=l.displayAllHeaders||s.displayAllHeaders;return"auto"===f.type?[g,u(t,f.children,f.basePath,a,v)]:(d||m)&&f.headers&&!i.d.test(f.path)?[g,u(t,Object(i.c)(f.headers),f.path,a,v)]:g}};n(199);function c(t,e){return"group"===e.type&&e.children.some((function(e){return"group"===e.type?c(t,e):"page"===e.type&&Object(i.e)(t,e.path)}))}var f={name:"SidebarLinks",components:{SidebarGroup:s,SidebarLink:Object(a.a)(l,void 0,void 0,!1,null,null,null).exports},props:["items","depth","sidebarDepth"],data:function(){return{openGroupIndex:0}},watch:{$route:function(){this.refreshIndex()}},created:function(){this.refreshIndex()},methods:{refreshIndex:function(){var t=function(t,e){for(var n=0;n<e.length;n++){var i=e[n];if(c(t,i))return n}return-1}(this.$route,this.items);t>-1&&(this.openGroupIndex=t)},toggleGroup:function(t){this.openGroupIndex=t===this.openGroupIndex?-1:t},isActive:function(t){return Object(i.e)(this.$route,t.regularPath)}}},h=Object(a.a)(f,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.items.length?n("ul",{staticClass:"sidebar-links"},t._l(t.items,(function(e,i){return n("li",{key:i},["group"===e.type?n("SidebarGroup",{attrs:{item:e,open:i===t.openGroupIndex,collapsable:e.collapsable||e.collapsible,depth:t.depth},on:{toggle:function(e){return t.toggleGroup(i)}}}):n("SidebarLink",{attrs:{"sidebar-depth":t.sidebarDepth,item:e}})],1)})),0):t._e()}),[],!1,null,null,null);e.default=h.exports},function(t,e,n){"use strict";var i={name:"DropdownTransition",methods:{setHeight:function(t){t.style.height=t.scrollHeight+"px"},unsetHeight:function(t){t.style.height=""}}},r=(n(181),n(28)),a=Object(r.a)(i,(function(){var t=this.$createElement;return(this._self._c||t)("transition",{attrs:{name:"dropdown"},on:{enter:this.setHeight,"after-enter":this.unsetHeight,"before-leave":this.setHeight}},[this._t("default")],2)}),[],!1,null,null,null);e.a=a.exports},function(t,e,n){"use strict";var i=n(0),r=n(166);i({target:"String",proto:!0,forced:n(167)("link")},{link:function(t){return r(this,"a","href",t)}})},function(t,e,n){var i=n(16),r=/"/g;t.exports=function(t,e,n,a){var s=String(i(t)),o="<"+e;return""!==n&&(o+=" "+n+'="'+String(a).replace(r,""")+'"'),o+">"+s+"</"+e+">"}},function(t,e,n){var i=n(2);t.exports=function(t){return i((function(){var e=""[t]('"');return e!==e.toLowerCase()||e.split('"').length>3}))}},function(t,e,n){"use strict";var i=n(0),r=n(43),a=n(10),s=n(30),o=[].join,u=r!=Object,l=s("join",",");i({target:"Array",proto:!0,forced:u||!l},{join:function(t){return o.call(a(this),void 0===t?",":t)}})},function(t,e,n){"use strict";var i=n(100),r=n(98),a=n(8),s=n(16),o=n(170),u=n(101),l=n(12),c=n(102),f=n(46),h=n(2),p=[].push,d=Math.min,g=!h((function(){return!RegExp(4294967295,"y")}));i("split",2,(function(t,e,n){var i;return i="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(t,n){var i=String(s(this)),a=void 0===n?4294967295:n>>>0;if(0===a)return[];if(void 0===t)return[i];if(!r(t))return e.call(i,t,a);for(var o,u,l,c=[],h=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),d=0,g=new RegExp(t.source,h+"g");(o=f.call(g,i))&&!((u=g.lastIndex)>d&&(c.push(i.slice(d,o.index)),o.length>1&&o.index<i.length&&p.apply(c,o.slice(1)),l=o[0].length,d=u,c.length>=a));)g.lastIndex===o.index&&g.lastIndex++;return d===i.length?!l&&g.test("")||c.push(""):c.push(i.slice(d)),c.length>a?c.slice(0,a):c}:"0".split(void 0,0).length?function(t,n){return void 0===t&&0===n?[]:e.call(this,t,n)}:e,[function(e,n){var r=s(this),a=null==e?void 0:e[t];return void 0!==a?a.call(e,r,n):i.call(String(r),e,n)},function(t,r){var s=n(i,t,this,r,i!==e);if(s.done)return s.value;var f=a(t),h=String(this),p=o(f,RegExp),v=f.unicode,m=(f.ignoreCase?"i":"")+(f.multiline?"m":"")+(f.unicode?"u":"")+(g?"y":"g"),b=new p(g?f:"^(?:"+f.source+")",m),k=void 0===r?4294967295:r>>>0;if(0===k)return[];if(0===h.length)return null===c(b,h)?[h]:[];for(var _=0,x=0,y=[];x<h.length;){b.lastIndex=g?x:0;var C,$=c(b,g?h:h.slice(x));if(null===$||(C=d(l(b.lastIndex+(g?0:x)),h.length))===_)x=u(h,x,v);else{if(y.push(h.slice(_,x)),y.length===k)return y;for(var L=1;L<=$.length-1;L++)if(y.push($[L]),y.length===k)return y;x=_=C}}return y.push(h.slice(_)),y}]}),!g)},function(t,e,n){var i=n(8),r=n(63),a=n(1)("species");t.exports=function(t,e){var n,s=i(t).constructor;return void 0===s||null==(n=i(s)[a])?e:r(n)}},function(t,e,n){"use strict";var i=n(144);n.n(i).a},function(t,e,n){var i=n(0),r=n(173);i({global:!0,forced:parseInt!=r},{parseInt:r})},function(t,e,n){var i=n(3),r=n(160).trim,a=n(145),s=i.parseInt,o=/^[+-]?0[Xx]/,u=8!==s(a+"08")||22!==s(a+"0x16");t.exports=u?function(t,e){var n=r(String(t));return s(n,e>>>0||(o.test(n)?16:10))}:s},function(t,e,n){"use strict";var i=n(0),r=n(160).trim;i({target:"String",proto:!0,forced:n(175)("trim")},{trim:function(){return r(this)}})},function(t,e,n){var i=n(2),r=n(145);t.exports=function(t){return i((function(){return!!r[t]()||" "!=" "[t]()||r[t].name!==t}))}},function(t,e,n){"use strict";var i=n(146);n.n(i).a},function(t,e,n){"use strict";var i=n(147);n.n(i).a},function(t,e,n){"use strict";var i=n(0),r=n(2),a=n(42),s=n(4),o=n(14),u=n(12),l=n(64),c=n(104),f=n(45),h=n(1),p=n(105),d=h("isConcatSpreadable"),g=p>=51||!r((function(){var t=[];return t[d]=!1,t.concat()[0]!==t})),v=f("concat"),m=function(t){if(!s(t))return!1;var e=t[d];return void 0!==e?!!e:a(t)};i({target:"Array",proto:!0,forced:!g||!v},{concat:function(t){var e,n,i,r,a,s=o(this),f=c(s,0),h=0;for(e=-1,i=arguments.length;e<i;e++)if(a=-1===e?s:arguments[e],m(a)){if(h+(r=u(a.length))>9007199254740991)throw TypeError("Maximum allowed index exceeded");for(n=0;n<r;n++,h++)n in a&&l(f,h,a[n])}else{if(h>=9007199254740991)throw TypeError("Maximum allowed index exceeded");l(f,h++,a)}return f.length=h,f}})},function(t,e,n){var i=n(6),r=n(3),a=n(62),s=n(109),o=n(7).f,u=n(44).f,l=n(98),c=n(99),f=n(107),h=n(13),p=n(2),d=n(18).set,g=n(110),v=n(1)("match"),m=r.RegExp,b=m.prototype,k=/a/g,_=/a/g,x=new m(k)!==k,y=f.UNSUPPORTED_Y;if(i&&a("RegExp",!x||y||p((function(){return _[v]=!1,m(k)!=k||m(_)==_||"/a/i"!=m(k,"i")})))){for(var C=function(t,e){var n,i=this instanceof C,r=l(t),a=void 0===e;if(!i&&r&&t.constructor===C&&a)return t;x?r&&!a&&(t=t.source):t instanceof C&&(a&&(e=c.call(t)),t=t.source),y&&(n=!!e&&e.indexOf("y")>-1)&&(e=e.replace(/y/g,""));var o=s(x?new m(t,e):m(t,e),i?this:b,C);return y&&n&&d(o,{sticky:n}),o},$=function(t){t in C||o(C,t,{configurable:!0,get:function(){return m[t]},set:function(e){m[t]=e}})},L=u(m),S=0;L.length>S;)$(L[S++]);b.constructor=C,C.prototype=b,h(r,"RegExp",C)}g("RegExp")},function(t,e,n){"use strict";var i=n(13),r=n(8),a=n(2),s=n(99),o=RegExp.prototype,u=o.toString,l=a((function(){return"/a/b"!=u.call({source:"a",flags:"b"})})),c="toString"!=u.name;(l||c)&&i(RegExp.prototype,"toString",(function(){var t=r(this),e=String(t.source),n=t.flags;return"/"+e+"/"+String(void 0===n&&t instanceof RegExp&&!("flags"in o)?s.call(t):n)}),{unsafe:!0})},function(t,e,n){"use strict";var i=n(148);n.n(i).a},function(t,e){t.exports=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}},function(t,e,n){"use strict";var i=n(149);n.n(i).a},function(t,e,n){"use strict";var i=n(150);n.n(i).a},function(t,e,n){"use strict";var i=n(151);n.n(i).a},function(t,e,n){"use strict";var i=n(152);n.n(i).a},function(t,e,n){var i=n(188),r=n(193),a=n(194);t.exports=function(t){return"string"==typeof t||!r(t)&&a(t)&&"[object String]"==i(t)}},function(t,e,n){var i=n(162),r=n(191),a=n(192),s=i?i.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":s&&s in Object(t)?r(t):a(t)}},function(t,e,n){var i=n(190),r="object"==typeof self&&self&&self.Object===Object&&self,a=i||r||Function("return this")();t.exports=a},function(t,e){var n="object"==typeof global&&global&&global.Object===Object&&global;t.exports=n},function(t,e,n){var i=n(162),r=Object.prototype,a=r.hasOwnProperty,s=r.toString,o=i?i.toStringTag:void 0;t.exports=function(t){var e=a.call(t,o),n=t[o];try{t[o]=void 0;var i=!0}catch(t){}var r=s.call(t);return i&&(e?t[o]=n:delete t[o]),r}},function(t,e){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},function(t,e){var n=Array.isArray;t.exports=n},function(t,e){t.exports=function(t){return null!=t&&"object"==typeof t}},function(t,e,n){"use strict";var i=n(153);n.n(i).a},function(t,e,n){"use strict";var i=n(154);n.n(i).a},function(t,e,n){"use strict";var i=n(155);n.n(i).a},function(t,e,n){"use strict";var i=n(0),r=n(19).find,a=n(65),s=n(11),o=!0,u=s("find");"find"in[]&&Array(1).find((function(){o=!1})),i({target:"Array",proto:!0,forced:o||!u},{find:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}}),a("find")},function(t,e,n){"use strict";var i=n(156);n.n(i).a},function(t,e,n){"use strict";var i=n(157);n.n(i).a},,function(t,e,n){"use strict";n.r(e);n(97),n(61),n(165);var i=n(142),r={name:"NavLink",props:{item:{required:!0}},computed:{link:function(){return Object(i.b)(this.item.link)},exact:function(){var t=this;return this.$site.locales?Object.keys(this.$site.locales).some((function(e){return e===t.link})):"/"===this.link},isNonHttpURI:function(){return Object(i.g)(this.link)||Object(i.h)(this.link)},isBlankTarget:function(){return"_blank"===this.target},isInternal:function(){return!Object(i.f)(this.link)&&!this.isBlankTarget},target:function(){return this.isNonHttpURI?null:this.item.target?this.item.target:Object(i.f)(this.link)?"_blank":""},rel:function(){return this.isNonHttpURI?null:this.item.rel?this.item.rel:this.isBlankTarget?"noopener noreferrer":""}},methods:{focusoutAction:function(){this.$emit("focusout")}}},a=n(28),s=Object(a.a)(r,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.isInternal?n("RouterLink",{staticClass:"nav-link",attrs:{to:t.link,exact:t.exact},nativeOn:{focusout:function(e){return t.focusoutAction(e)}}},[t._v("\n "+t._s(t.item.text)+"\n")]):n("a",{staticClass:"nav-link external",attrs:{href:t.link,target:t.target,rel:t.rel},on:{focusout:t.focusoutAction}},[t._v("\n "+t._s(t.item.text)+"\n "),t.isBlankTarget?n("OutboundLink"):t._e()],1)}),[],!1,null,null,null).exports,o={name:"Home",components:{NavLink:s},computed:{data:function(){return this.$page.frontmatter},actionLink:function(){return{link:this.data.actionLink,text:this.data.actionText}}}},u=(n(171),Object(a.a)(o,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("main",{staticClass:"home",attrs:{"aria-labelledby":"main-title"}},[n("header",{staticClass:"hero"},[t.data.heroImage?n("img",{attrs:{src:t.$withBase(t.data.heroImage),alt:t.data.heroAlt||"hero"}}):t._e(),t._v(" "),null!==t.data.heroText?n("h1",{attrs:{id:"main-title"}},[t._v("\n "+t._s(t.data.heroText||t.$title||"Hello")+"\n ")]):t._e(),t._v(" "),null!==t.data.tagline?n("p",{staticClass:"description"},[t._v("\n "+t._s(t.data.tagline||t.$description||"Welcome to your VuePress site")+"\n ")]):t._e(),t._v(" "),t.data.actionText&&t.data.actionLink?n("p",{staticClass:"action"},[n("NavLink",{staticClass:"action-button",attrs:{item:t.actionLink}})],1):t._e()]),t._v(" "),t.data.features&&t.data.features.length?n("div",{staticClass:"features"},t._l(t.data.features,(function(e,i){return n("div",{key:i,staticClass:"feature"},[n("h2",[t._v(t._s(e.title))]),t._v(" "),n("p",[t._v(t._s(e.details))])])})),0):t._e(),t._v(" "),n("Content",{staticClass:"theme-default-content custom"}),t._v(" "),t.data.footer?n("div",{staticClass:"footer"},[t._v("\n "+t._s(t.data.footer)+"\n ")]):t._e()],1)}),[],!1,null,null,null).exports),l=(n(172),n(17),n(106),n(103),n(159),n(29),n(108),n(143),n(174),{name:"SearchBox",data:function(){return{query:"",focused:!1,focusIndex:0,placeholder:void 0}},computed:{showSuggestions:function(){return this.focused&&this.suggestions&&this.suggestions.length},suggestions:function(){var t=this.query.trim().toLowerCase();if(t){for(var e=this.$site.pages,n=this.$site.themeConfig.searchMaxSuggestions||5,i=this.$localePath,r=function(e){return e&&e.title&&e.title.toLowerCase().indexOf(t)>-1},a=[],s=0;s<e.length&&!(a.length>=n);s++){var o=e[s];if(this.getPageLocalePath(o)===i&&this.isSearchable(o))if(r(o))a.push(o);else if(o.headers)for(var u=0;u<o.headers.length&&!(a.length>=n);u++){var l=o.headers[u];r(l)&&a.push(Object.assign({},o,{path:o.path+"#"+l.slug,header:l}))}}return a}},alignRight:function(){return(this.$site.themeConfig.nav||[]).length+(this.$site.repo?1:0)<=2}},mounted:function(){this.placeholder=this.$site.themeConfig.searchPlaceholder||"",document.addEventListener("keydown",this.onHotkey)},beforeDestroy:function(){document.removeEventListener("keydown",this.onHotkey)},methods:{getPageLocalePath:function(t){for(var e in this.$site.locales||{})if("/"!==e&&0===t.path.indexOf(e))return e;return"/"},isSearchable:function(t){var e=null;return null===e||(e=Array.isArray(e)?e:new Array(e)).filter((function(e){return t.path.match(e)})).length>0},onHotkey:function(t){t.srcElement===document.body&&["s","/"].includes(t.key)&&(this.$refs.input.focus(),t.preventDefault())},onUp:function(){this.showSuggestions&&(this.focusIndex>0?this.focusIndex--:this.focusIndex=this.suggestions.length-1)},onDown:function(){this.showSuggestions&&(this.focusIndex<this.suggestions.length-1?this.focusIndex++:this.focusIndex=0)},go:function(t){this.showSuggestions&&(this.$router.push(this.suggestions[t].path),this.query="",this.focusIndex=0)},focus:function(t){this.focusIndex=t},unfocus:function(){this.focusIndex=-1}}}),c=(n(176),Object(a.a)(l,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"search-box"},[n("input",{ref:"input",class:{focused:t.focused},attrs:{"aria-label":"Search",placeholder:t.placeholder,autocomplete:"off",spellcheck:"false"},domProps:{value:t.query},on:{input:function(e){t.query=e.target.value},focus:function(e){t.focused=!0},blur:function(e){t.focused=!1},keyup:[function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.go(t.focusIndex)},function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"up",38,e.key,["Up","ArrowUp"])?null:t.onUp(e)},function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"down",40,e.key,["Down","ArrowDown"])?null:t.onDown(e)}]}}),t._v(" "),t.showSuggestions?n("ul",{staticClass:"suggestions",class:{"align-right":t.alignRight},on:{mouseleave:t.unfocus}},t._l(t.suggestions,(function(e,i){return n("li",{key:i,staticClass:"suggestion",class:{focused:i===t.focusIndex},on:{mousedown:function(e){return t.go(i)},mouseenter:function(e){return t.focus(i)}}},[n("a",{attrs:{href:e.path},on:{click:function(t){t.preventDefault()}}},[n("span",{staticClass:"page-title"},[t._v(t._s(e.title||e.path))]),t._v(" "),e.header?n("span",{staticClass:"header"},[t._v("> "+t._s(e.header.title))]):t._e()])])})),0):t._e()])}),[],!1,null,null,null).exports),f=(n(177),Object(a.a)({},(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"sidebar-button",on:{click:function(e){return t.$emit("toggle-sidebar")}}},[n("svg",{staticClass:"icon",attrs:{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",viewBox:"0 0 448 512"}},[n("path",{attrs:{fill:"currentColor",d:"M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"}})])])}),[],!1,null,null,null).exports),h=(n(178),n(40),n(179),n(180),n(41),n(38)),p=n(164),d=n(182),g=n.n(d),v={name:"DropdownLink",components:{NavLink:s,DropdownTransition:p.a},props:{item:{required:!0}},data:function(){return{open:!1}},computed:{dropdownAriaLabel:function(){return this.item.ariaLabel||this.item.text}},watch:{$route:function(){this.open=!1}},methods:{setOpen:function(t){this.open=t},isLastItemOfArray:function(t,e){return g()(e)===t}}},m=(n(183),{name:"NavLinks",components:{NavLink:s,DropdownLink:Object(a.a)(v,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"dropdown-wrapper",class:{open:t.open}},[n("button",{staticClass:"dropdown-title",attrs:{type:"button","aria-label":t.dropdownAriaLabel},on:{click:function(e){return t.setOpen(!t.open)}}},[n("span",{staticClass:"title"},[t._v(t._s(t.item.text))]),t._v(" "),n("span",{staticClass:"arrow",class:t.open?"down":"right"})]),t._v(" "),n("DropdownTransition",[n("ul",{directives:[{name:"show",rawName:"v-show",value:t.open,expression:"open"}],staticClass:"nav-dropdown"},t._l(t.item.items,(function(e,i){return n("li",{key:e.link||i,staticClass:"dropdown-item"},["links"===e.type?n("h4",[t._v("\n "+t._s(e.text)+"\n ")]):t._e(),t._v(" "),"links"===e.type?n("ul",{staticClass:"dropdown-subitem-wrapper"},t._l(e.items,(function(i){return n("li",{key:i.link,staticClass:"dropdown-subitem"},[n("NavLink",{attrs:{item:i},on:{focusout:function(n){t.isLastItemOfArray(i,e.items)&&t.isLastItemOfArray(e,t.item.items)&&t.setOpen(!1)}}})],1)})),0):n("NavLink",{attrs:{item:e},on:{focusout:function(n){t.isLastItemOfArray(e,t.item.items)&&t.setOpen(!1)}}})],1)})),0)])],1)}),[],!1,null,null,null).exports},computed:{userNav:function(){return this.$themeLocaleConfig.nav||this.$site.themeConfig.nav||[]},nav:function(){var t=this,e=this.$site.locales;if(e&&Object.keys(e).length>1){var n=this.$page.path,i=this.$router.options.routes,r=this.$site.themeConfig.locales||{},a={text:this.$themeLocaleConfig.selectText||"Languages",ariaLabel:this.$themeLocaleConfig.ariaLabel||"Select language",items:Object.keys(e).map((function(a){var s,o=e[a],u=r[a]&&r[a].label||o.lang;return o.lang===t.$lang?s=n:(s=n.replace(t.$localeConfig.path,a),i.some((function(t){return t.path===s}))||(s=a)),{text:u,link:s}}))};return[].concat(Object(h.a)(this.userNav),[a])}return this.userNav},userLinks:function(){return(this.nav||[]).map((function(t){return Object.assign(Object(i.j)(t),{items:(t.items||[]).map(i.j)})}))},repoLink:function(){var t=this.$site.themeConfig.repo;return t?/^https?:/.test(t)?t:"https://github.com/".concat(t):null},repoLabel:function(){if(this.repoLink){if(this.$site.themeConfig.repoLabel)return this.$site.themeConfig.repoLabel;for(var t=this.repoLink.match(/^https?:\/\/[^/]+/)[0],e=["GitHub","GitLab","Bitbucket"],n=0;n<e.length;n++){var i=e[n];if(new RegExp(i,"i").test(t))return i}return"Source"}}}}),b=(n(184),Object(a.a)(m,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.userLinks.length||t.repoLink?n("nav",{staticClass:"nav-links"},[t._l(t.userLinks,(function(t){return n("div",{key:t.link,staticClass:"nav-item"},["links"===t.type?n("DropdownLink",{attrs:{item:t}}):n("NavLink",{attrs:{item:t}})],1)})),t._v(" "),t.repoLink?n("a",{staticClass:"repo-link",attrs:{href:t.repoLink,target:"_blank",rel:"noopener noreferrer"}},[t._v("\n "+t._s(t.repoLabel)+"\n "),n("OutboundLink")],1):t._e()],2):t._e()}),[],!1,null,null,null).exports);function k(t,e){return t.ownerDocument.defaultView.getComputedStyle(t,null)[e]}var _={name:"Navbar",components:{SidebarButton:f,NavLinks:b,SearchBox:c,AlgoliaSearchBox:{}},data:function(){return{linksWrapMaxWidth:null}},computed:{algolia:function(){return this.$themeLocaleConfig.algolia||this.$site.themeConfig.algolia||{}},isAlgoliaSearch:function(){return this.algolia&&this.algolia.apiKey&&this.algolia.indexName}},mounted:function(){var t=this,e=parseInt(k(this.$el,"paddingLeft"))+parseInt(k(this.$el,"paddingRight")),n=function(){document.documentElement.clientWidth<719?t.linksWrapMaxWidth=null:t.linksWrapMaxWidth=t.$el.offsetWidth-e-(t.$refs.siteName&&t.$refs.siteName.offsetWidth||0)};n(),window.addEventListener("resize",n,!1)}},x=(n(185),Object(a.a)(_,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("header",{staticClass:"navbar"},[n("SidebarButton",{on:{"toggle-sidebar":function(e){return t.$emit("toggle-sidebar")}}}),t._v(" "),n("RouterLink",{staticClass:"home-link",attrs:{to:t.$localePath}},[t.$site.themeConfig.logo?n("img",{staticClass:"logo",attrs:{src:t.$withBase(t.$site.themeConfig.logo),alt:t.$siteTitle}}):t._e(),t._v(" "),t.$siteTitle?n("span",{ref:"siteName",staticClass:"site-name",class:{"can-hide":t.$site.themeConfig.logo}},[t._v(t._s(t.$siteTitle))]):t._e()]),t._v(" "),n("div",{staticClass:"links",style:t.linksWrapMaxWidth?{"max-width":t.linksWrapMaxWidth+"px"}:{}},[t.isAlgoliaSearch?n("AlgoliaSearchBox",{attrs:{options:t.algolia}}):!1!==t.$site.themeConfig.search&&!1!==t.$page.frontmatter.search?n("SearchBox"):t._e(),t._v(" "),n("NavLinks",{staticClass:"can-hide"})],1)],1)}),[],!1,null,null,null).exports),y=n(161),C=n.n(y),$={name:"PageEdit",computed:{lastUpdated:function(){return this.$page.lastUpdated},lastUpdatedText:function(){return"string"==typeof this.$themeLocaleConfig.lastUpdated?this.$themeLocaleConfig.lastUpdated:"string"==typeof this.$site.themeConfig.lastUpdated?this.$site.themeConfig.lastUpdated:"Last Updated"},editLink:function(){var t=C()(this.$page.frontmatter.editLink)?this.$site.themeConfig.editLinks:this.$page.frontmatter.editLink,e=this.$site.themeConfig,n=e.repo,i=e.docsDir,r=void 0===i?"":i,a=e.docsBranch,s=void 0===a?"master":a,o=e.docsRepo,u=void 0===o?n:o;return t&&u&&this.$page.relativePath?this.createEditLink(n,u,r,s,this.$page.relativePath):null},editLinkText:function(){return this.$themeLocaleConfig.editLinkText||this.$site.themeConfig.editLinkText||"Edit this page"}},methods:{createEditLink:function(t,e,n,r,a){return/bitbucket.org/.test(t)?(i.i.test(e)?e:t).replace(i.a,"")+"/src"+"/".concat(r,"/")+(n?n.replace(i.a,"")+"/":"")+a+"?mode=edit&spa=0&at=".concat(r,"&fileviewer=file-view-default"):(i.i.test(e)?e:"https://github.com/".concat(e)).replace(i.a,"")+"/edit"+"/".concat(r,"/")+(n?n.replace(i.a,"")+"/":"")+a}}},L=(n(186),Object(a.a)($,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("footer",{staticClass:"page-edit"},[t.editLink?n("div",{staticClass:"edit-link"},[n("a",{attrs:{href:t.editLink,target:"_blank",rel:"noopener noreferrer"}},[t._v(t._s(t.editLinkText))]),t._v(" "),n("OutboundLink")],1):t._e(),t._v(" "),t.lastUpdated?n("div",{staticClass:"last-updated"},[n("span",{staticClass:"prefix"},[t._v(t._s(t.lastUpdatedText)+":")]),t._v(" "),n("span",{staticClass:"time"},[t._v(t._s(t.lastUpdated))])]):t._e()])}),[],!1,null,null,null).exports),S=n(187),w=n.n(S),O={name:"PageNav",props:["sidebarItems"],computed:{prev:function(){return I(j.PREV,this)},next:function(){return I(j.NEXT,this)}}};var j={NEXT:{resolveLink:function(t,e){return E(t,e,1)},getThemeLinkConfig:function(t){return t.nextLinks},getPageLinkConfig:function(t){return t.frontmatter.next}},PREV:{resolveLink:function(t,e){return E(t,e,-1)},getThemeLinkConfig:function(t){return t.prevLinks},getPageLinkConfig:function(t){return t.frontmatter.prev}}};function I(t,e){var n=e.$themeConfig,r=e.$page,a=e.$route,s=e.$site,o=e.sidebarItems,u=t.resolveLink,l=t.getThemeLinkConfig,c=t.getPageLinkConfig,f=l(n),h=c(r),p=C()(h)?f:h;return!1===p?void 0:w()(p)?Object(i.k)(s.pages,p,a.path):u(r,o)}function E(t,e,n){var i=[];!function t(e,n){for(var i=0,r=e.length;i<r;i++)"group"===e[i].type?t(e[i].children||[],n):n.push(e[i])}(e,i);for(var r=0;r<i.length;r++){var a=i[r];if("page"===a.type&&a.path===decodeURIComponent(t.path))return i[r+n]}}var T=O,A=(n(195),{components:{PageEdit:L,PageNav:Object(a.a)(T,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.prev||t.next?n("div",{staticClass:"page-nav"},[n("p",{staticClass:"inner"},[t.prev?n("span",{staticClass:"prev"},[t._v("\n ←\n "),"external"===t.prev.type?n("a",{staticClass:"prev",attrs:{href:t.prev.path,target:"_blank",rel:"noopener noreferrer"}},[t._v("\n "+t._s(t.prev.title||t.prev.path)+"\n\n "),n("OutboundLink")],1):n("RouterLink",{staticClass:"prev",attrs:{to:t.prev.path}},[t._v("\n "+t._s(t.prev.title||t.prev.path)+"\n ")])],1):t._e(),t._v(" "),t.next?n("span",{staticClass:"next"},["external"===t.next.type?n("a",{attrs:{href:t.next.path,target:"_blank",rel:"noopener noreferrer"}},[t._v("\n "+t._s(t.next.title||t.next.path)+"\n\n "),n("OutboundLink")],1):n("RouterLink",{attrs:{to:t.next.path}},[t._v("\n "+t._s(t.next.title||t.next.path)+"\n ")]),t._v("\n →\n ")],1):t._e()])]):t._e()}),[],!1,null,null,null).exports},props:["sidebarItems"]}),N=(n(196),Object(a.a)(A,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("main",{staticClass:"page"},[t._t("top"),t._v(" "),n("Content",{staticClass:"theme-default-content"}),t._v(" "),n("PageEdit"),t._v(" "),n("PageNav",t._b({},"PageNav",{sidebarItems:t.sidebarItems},!1)),t._v(" "),t._t("bottom")],2)}),[],!1,null,null,null).exports),P={name:"Sidebar",components:{SidebarLinks:n(163).default,NavLinks:b},props:["items"]},R=(n(200),{name:"Layout",components:{Home:u,Page:N,Sidebar:Object(a.a)(P,(function(){var t=this.$createElement,e=this._self._c||t;return e("aside",{staticClass:"sidebar"},[e("NavLinks"),this._v(" "),this._t("top"),this._v(" "),e("SidebarLinks",{attrs:{depth:0,items:this.items}}),this._v(" "),this._t("bottom")],2)}),[],!1,null,null,null).exports,Navbar:x},data:function(){return{isSidebarOpen:!1}},computed:{shouldShowNavbar:function(){var t=this.$site.themeConfig;return!1!==this.$page.frontmatter.navbar&&!1!==t.navbar&&(this.$title||t.logo||t.repo||t.nav||this.$themeLocaleConfig.nav)},shouldShowSidebar:function(){var t=this.$page.frontmatter;return!t.home&&!1!==t.sidebar&&this.sidebarItems.length},sidebarItems:function(){return Object(i.l)(this.$page,this.$page.regularPath,this.$site,this.$localePath)},pageClasses:function(){var t=this.$page.frontmatter.pageClass;return[{"no-navbar":!this.shouldShowNavbar,"sidebar-open":this.isSidebarOpen,"no-sidebar":!this.shouldShowSidebar},t]}},mounted:function(){var t=this;this.$router.afterEach((function(){t.isSidebarOpen=!1}))},methods:{toggleSidebar:function(t){this.isSidebarOpen="boolean"==typeof t?t:!this.isSidebarOpen,this.$emit("toggle-sidebar",this.isSidebarOpen)},onTouchStart:function(t){this.touchStart={x:t.changedTouches[0].clientX,y:t.changedTouches[0].clientY}},onTouchEnd:function(t){var e=t.changedTouches[0].clientX-this.touchStart.x,n=t.changedTouches[0].clientY-this.touchStart.y;Math.abs(e)>Math.abs(n)&&Math.abs(e)>40&&(e>0&&this.touchStart.x<=80?this.toggleSidebar(!0):this.toggleSidebar(!1))}}}),D=Object(a.a)(R,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"theme-container",class:t.pageClasses,on:{touchstart:t.onTouchStart,touchend:t.onTouchEnd}},[t.shouldShowNavbar?n("Navbar",{on:{"toggle-sidebar":t.toggleSidebar}}):t._e(),t._v(" "),n("div",{staticClass:"sidebar-mask",on:{click:function(e){return t.toggleSidebar(!1)}}}),t._v(" "),n("Sidebar",{attrs:{items:t.sidebarItems},on:{"toggle-sidebar":t.toggleSidebar},scopedSlots:t._u([{key:"top",fn:function(){return[t._t("sidebar-top")]},proxy:!0},{key:"bottom",fn:function(){return[t._t("sidebar-bottom")]},proxy:!0}],null,!0)}),t._v(" "),t.$page.frontmatter.home?n("Home"):n("Page",{attrs:{"sidebar-items":t.sidebarItems},scopedSlots:t._u([{key:"top",fn:function(){return[t._t("page-top")]},proxy:!0},{key:"bottom",fn:function(){return[t._t("page-bottom")]},proxy:!0}],null,!0)})],1)}),[],!1,null,null,null);e.default=D.exports}])]); \ No newline at end of file diff --git a/docs/assets/js/2.fa272699.js b/docs/assets/js/2.fa272699.js deleted file mode 100644 index b0e942aed..000000000 --- a/docs/assets/js/2.fa272699.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[2],[,,,,,,,,,,function(t,e,n){var r=n(12),i=n(28),o=n(16),a=n(25),s=n(46),u=function(t,e,n){var c,l,f,p,h=t&u.F,d=t&u.G,v=t&u.S,g=t&u.P,m=t&u.B,b=d?r:v?r[e]||(r[e]={}):(r[e]||{}).prototype,y=d?i:i[e]||(i[e]={}),x=y.prototype||(y.prototype={});for(c in d&&(n=e),n)f=((l=!h&&b&&void 0!==b[c])?b:n)[c],p=m&&l?s(f,r):g&&"function"==typeof f?s(Function.call,f):f,b&&a(b,c,f,t&u.U),y[c]!=f&&o(y,c,p),g&&x[c]!=f&&(x[c]=f)};r.core=i,u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,t.exports=u},function(t,e,n){var r=n(42)("wks"),i=n(43),o=n(12).Symbol,a="function"==typeof o;(t.exports=function(t){return r[t]||(r[t]=a&&o[t]||(a?o:i)("Symbol."+t))}).store=r},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e,n){var r=n(97)("wks"),i=n(98),o=n(21).Symbol,a="function"==typeof o;(t.exports=function(t){return r[t]||(r[t]=a&&o[t]||(a?o:i)("Symbol."+t))}).store=r},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){"use strict";n.d(e,"d",(function(){return r})),n.d(e,"a",(function(){return o})),n.d(e,"i",(function(){return a})),n.d(e,"f",(function(){return u})),n.d(e,"g",(function(){return c})),n.d(e,"h",(function(){return l})),n.d(e,"b",(function(){return f})),n.d(e,"e",(function(){return p})),n.d(e,"k",(function(){return h})),n.d(e,"l",(function(){return d})),n.d(e,"c",(function(){return v})),n.d(e,"j",(function(){return g}));const r=/#.*$/,i=/\.(md|html)$/,o=/\/$/,a=/^[a-z]+:/i;function s(t){return decodeURI(t).replace(r,"").replace(i,"")}function u(t){return a.test(t)}function c(t){return/^mailto:/.test(t)}function l(t){return/^tel:/.test(t)}function f(t){if(u(t))return t;const e=t.match(r),n=e?e[0]:"",i=s(t);return o.test(i)?t:i+".html"+n}function p(t,e){const n=t.hash,i=function(t){const e=t.match(r);if(e)return e[0]}(e);return(!i||n===i)&&s(t.path)===s(e)}function h(t,e,n){if(u(e))return{type:"external",path:e};n&&(e=function(t,e,n){const r=t.charAt(0);if("/"===r)return t;if("?"===r||"#"===r)return e+t;const i=e.split("/");n&&i[i.length-1]||i.pop();const o=t.replace(/^\//,"").split("/");for(let t=0;t<o.length;t++){const e=o[t];".."===e?i.pop():"."!==e&&i.push(e)}""!==i[0]&&i.unshift("");return i.join("/")}(e,n));const r=s(e);for(let e=0;e<t.length;e++)if(s(t[e].regularPath)===r)return Object.assign({},t[e],{type:"page",path:f(t[e].path)});return console.error(`[vuepress] No matching page found for sidebar item "${e}"`),{}}function d(t,e,n,r){const{pages:i,themeConfig:o}=n,a=r&&o.locales&&o.locales[r]||o;if("auto"===(t.frontmatter.sidebar||a.sidebar||o.sidebar))return function(t){const e=v(t.headers||[]);return[{type:"group",collapsable:!1,title:t.title,path:null,children:e.map(e=>({type:"auto",title:e.title,basePath:t.path,path:t.path+"#"+e.slug,children:e.children||[]}))}]}(t);const s=a.sidebar||o.sidebar;if(s){const{base:t,config:n}=function(t,e){if(Array.isArray(e))return{base:"/",config:e};for(const r in e)if(0===(n=t,/(\.html|\/)$/.test(n)?n:n+"/").indexOf(encodeURI(r)))return{base:r,config:e[r]};var n;return{}}(e,s);return n?n.map(e=>function t(e,n,r,i=1){if("string"==typeof e)return h(n,e,r);if(Array.isArray(e))return Object.assign(h(n,e[0],r),{title:e[1]});{i>3&&console.error("[vuepress] detected a too deep nested sidebar group.");const o=e.children||[];return 0===o.length&&e.path?Object.assign(h(n,e.path,r),{title:e.title}):{type:"group",path:e.path,title:e.title,sidebarDepth:e.sidebarDepth,children:o.map(e=>t(e,n,r,i+1)),collapsable:!1!==e.collapsable}}}(e,i,t)):[]}return[]}function v(t){let e;return(t=t.map(t=>Object.assign({},t))).forEach(t=>{2===t.level?e=t:e&&(e.children||(e.children=[])).push(t)}),t.filter(t=>2===t.level)}function g(t){return Object.assign(t,{type:t.items&&t.items.length?"links":"link"})}},function(t,e,n){var r=n(24),i=n(44);t.exports=n(19)?function(t,e,n){return r.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(18);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){t.exports=!n(14)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e){var n=t.exports={version:"2.6.11"};"number"==typeof __e&&(__e=n)},function(t,e){t.exports={}},function(t,e,n){var r=n(17),i=n(75),o=n(77),a=Object.defineProperty;e.f=n(19)?Object.defineProperty:function(t,e,n){if(r(t),e=o(e,!0),r(n),i)try{return a(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){var r=n(12),i=n(16),o=n(26),a=n(43)("src"),s=n(112),u=(""+s).split("toString");n(28).inspectSource=function(t){return s.call(t)},(t.exports=function(t,e,n,s){var c="function"==typeof n;c&&(o(n,"name")||i(n,"name",e)),t[e]!==n&&(c&&(o(n,a)||i(n,a,t[e]?""+t[e]:u.join(String(e)))),t===r?t[e]=n:s?t[e]?t[e]=n:i(t,e,n):(delete t[e],i(t,e,n)))})(Function.prototype,"toString",(function(){return"function"==typeof this&&this[a]||s.call(this)}))},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var r=n(37),i=n(56);t.exports=n(39)?function(t,e,n){return r.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e){var n=t.exports={version:"2.6.11"};"number"==typeof __e&&(__e=n)},function(t,e,n){var r=n(78),i=n(20);t.exports=function(t){return r(i(t))}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){var r=n(32),i=Math.min;t.exports=function(t){return t>0?i(r(t),9007199254740991):0}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e,n){var r=n(20);t.exports=function(t){return Object(r(t))}},function(t,e,n){"use strict";var r=n(10),i=n(35)(3);r(r.P+r.F*!n(36)([].some,!0),"Array",{some:function(t){return i(this,t,arguments[1])}})},function(t,e,n){var r=n(46),i=n(78),o=n(33),a=n(31),s=n(121);t.exports=function(t,e){var n=1==t,u=2==t,c=3==t,l=4==t,f=6==t,p=5==t||f,h=e||s;return function(e,s,d){for(var v,g,m=o(e),b=i(m),y=r(s,d,3),x=a(b.length),_=0,k=n?h(e,x):u?h(e,0):void 0;x>_;_++)if((p||_ in b)&&(g=y(v=b[_],_,m),t))if(n)k[_]=g;else if(g)switch(t){case 3:return!0;case 5:return v;case 6:return _;case 2:k.push(v)}else if(l)return!1;return f?-1:c||l?l:k}}},function(t,e,n){"use strict";var r=n(14);t.exports=function(t,e){return!!t&&r((function(){e?t.call(null,(function(){}),1):t.call(null)}))}},function(t,e,n){var r=n(38),i=n(152),o=n(153),a=Object.defineProperty;e.f=n(39)?Object.defineProperty:function(t,e,n){if(r(t),e=o(e,!0),r(n),i)try{return a(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){var r=n(55);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e,n){t.exports=!n(91)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var r=n(11)("unscopables"),i=Array.prototype;null==i[r]&&n(16)(i,r,{}),t.exports=function(t){i[r][t]=!0}},function(t,e,n){var r=n(28),i=n(12),o=i["__core-js_shared__"]||(i["__core-js_shared__"]={});(t.exports=function(t,e){return o[t]||(o[t]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:n(74)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e){t.exports={}},function(t,e,n){var r=n(113);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}}},function(t,e,n){var r=n(79),i=n(50);t.exports=Object.keys||function(t){return r(t,i)}},function(t,e,n){var r=n(29),i=n(31),o=n(117);t.exports=function(t){return function(e,n,a){var s,u=r(e),c=i(u.length),l=o(a,c);if(t&&n!=n){for(;c>l;)if((s=u[l++])!=s)return!0}else for(;c>l;l++)if((t||l in u)&&u[l]===n)return t||l||0;return!t&&-1}}},function(t,e,n){var r=n(42)("keys"),i=n(43);t.exports=function(t){return r[t]||(r[t]=i(t))}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){var r=n(21),i=n(22),o=n(90),a=n(27),s=n(40),u=function(t,e,n){var c,l,f,p=t&u.F,h=t&u.G,d=t&u.S,v=t&u.P,g=t&u.B,m=t&u.W,b=h?i:i[e]||(i[e]={}),y=b.prototype,x=h?r:d?r[e]:(r[e]||{}).prototype;for(c in h&&(n=e),n)(l=!p&&x&&void 0!==x[c])&&s(b,c)||(f=l?x[c]:n[c],b[c]=h&&"function"!=typeof x[c]?n[c]:g&&l?o(f,r):m&&x[c]==f?function(t){var e=function(e,n,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,r)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(f):v&&"function"==typeof f?o(Function.call,f):f,v&&((b.virtual||(b.virtual={}))[c]=f,t&u.R&&y&&!y[c]&&a(y,c,f)))};u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,t.exports=u},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){var r=n(164),i=n(59);t.exports=function(t){return r(i(t))}},function(t,e,n){var r=n(97)("keys"),i=n(98);t.exports=function(t){return r[t]||(r[t]=i(t))}},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},,function(t,e,n){for(var r=n(109),i=n(47),o=n(25),a=n(12),s=n(16),u=n(45),c=n(11),l=c("iterator"),f=c("toStringTag"),p=u.Array,h={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},d=i(h),v=0;v<d.length;v++){var g,m=d[v],b=h[m],y=a[m],x=y&&y.prototype;if(x&&(x[l]||s(x,l,p),x[f]||s(x,f,m),u[m]=p,b))for(g in r)x[g]||o(x,g,r[g],!0)}},function(t,e){t.exports=!1},function(t,e,n){t.exports=!n(19)&&!n(14)((function(){return 7!=Object.defineProperty(n(76)("div"),"a",{get:function(){return 7}}).a}))},function(t,e,n){var r=n(18),i=n(12).document,o=r(i)&&r(i.createElement);t.exports=function(t){return o?i.createElement(t):{}}},function(t,e,n){var r=n(18);t.exports=function(t,e){if(!r(t))return t;var n,i;if(e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;if("function"==typeof(n=t.valueOf)&&!r(i=n.call(t)))return i;if(!e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},function(t,e,n){var r=n(30);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,e,n){var r=n(26),i=n(29),o=n(48)(!1),a=n(49)("IE_PROTO");t.exports=function(t,e){var n,s=i(t),u=0,c=[];for(n in s)n!=a&&r(s,n)&&c.push(n);for(;e.length>u;)r(s,n=e[u++])&&(~o(c,n)||c.push(n));return c}},function(t,e,n){var r=n(24).f,i=n(26),o=n(11)("toStringTag");t.exports=function(t,e,n){t&&!i(t=n?t:t.prototype,o)&&r(t,o,{configurable:!0,value:e})}},function(t,e,n){var r=n(33),i=n(47);n(120)("keys",(function(){return function(t){return i(r(t))}}))},function(t,e,n){var r=n(30);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,e,n){var r=n(18),i=n(30),o=n(11)("match");t.exports=function(t){var e;return r(t)&&(void 0!==(e=t[o])?!!e:"RegExp"==i(t))}},function(t,e,n){"use strict";var r=n(17),i=n(31),o=n(85),a=n(86);n(87)("match",1,(function(t,e,n,s){return[function(n){var r=t(this),i=null==n?void 0:n[e];return void 0!==i?i.call(n,r):new RegExp(n)[e](String(r))},function(t){var e=s(n,t,this);if(e.done)return e.value;var u=r(t),c=String(this);if(!u.global)return a(u,c);var l=u.unicode;u.lastIndex=0;for(var f,p=[],h=0;null!==(f=a(u,c));){var d=String(f[0]);p[h]=d,""===d&&(u.lastIndex=o(c,i(u.lastIndex),l)),h++}return 0===h?null:p}]}))},function(t,e,n){"use strict";var r=n(130)(!0);t.exports=function(t,e,n){return e+(n?r(t,e).length:1)}},function(t,e,n){"use strict";var r=n(131),i=RegExp.prototype.exec;t.exports=function(t,e){var n=t.exec;if("function"==typeof n){var o=n.call(t,e);if("object"!=typeof o)throw new TypeError("RegExp exec method returned something other than an Object or null");return o}if("RegExp"!==r(t))throw new TypeError("RegExp#exec called on incompatible receiver");return i.call(t,e)}},function(t,e,n){"use strict";n(132);var r=n(25),i=n(16),o=n(14),a=n(20),s=n(11),u=n(88),c=s("species"),l=!o((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")})),f=function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2===n.length&&"a"===n[0]&&"b"===n[1]}();t.exports=function(t,e,n){var p=s(t),h=!o((function(){var e={};return e[p]=function(){return 7},7!=""[t](e)})),d=h?!o((function(){var e=!1,n=/a/;return n.exec=function(){return e=!0,null},"split"===t&&(n.constructor={},n.constructor[c]=function(){return n}),n[p](""),!e})):void 0;if(!h||!d||"replace"===t&&!l||"split"===t&&!f){var v=/./[p],g=n(a,p,""[t],(function(t,e,n,r,i){return e.exec===u?h&&!i?{done:!0,value:v.call(e,n,r)}:{done:!0,value:t.call(n,e,r)}:{done:!1}})),m=g[0],b=g[1];r(String.prototype,t,m),i(RegExp.prototype,p,2==e?function(t,e){return b.call(t,this,e)}:function(t){return b.call(t,this)})}}},function(t,e,n){"use strict";var r,i,o=n(89),a=RegExp.prototype.exec,s=String.prototype.replace,u=a,c=(r=/a/,i=/b*/g,a.call(r,"a"),a.call(i,"a"),0!==r.lastIndex||0!==i.lastIndex),l=void 0!==/()??/.exec("")[1];(c||l)&&(u=function(t){var e,n,r,i,u=this;return l&&(n=new RegExp("^"+u.source+"$(?!\\s)",o.call(u))),c&&(e=u.lastIndex),r=a.call(u,t),c&&r&&(u.lastIndex=u.global?r.index+r[0].length:e),l&&r&&r.length>1&&s.call(r[0],n,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(r[i]=void 0)})),r}),t.exports=u},function(t,e,n){"use strict";var r=n(17);t.exports=function(){var t=r(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},function(t,e,n){var r=n(151);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){var r=n(55),i=n(21).document,o=r(i)&&r(i.createElement);t.exports=function(t){return o?i.createElement(t):{}}},function(t,e,n){"use strict";var r=n(157)(!0);n(94)(String,"String",(function(t){this._t=String(t),this._i=0}),(function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=r(e,n),this._i+=t.length,{value:t,done:!1})}))},function(t,e,n){"use strict";var r=n(95),i=n(54),o=n(158),a=n(27),s=n(23),u=n(159),c=n(100),l=n(168),f=n(13)("iterator"),p=!([].keys&&"next"in[].keys()),h=function(){return this};t.exports=function(t,e,n,d,v,g,m){u(n,e,d);var b,y,x,_=function(t){if(!p&&t in O)return O[t];switch(t){case"keys":case"values":return function(){return new n(this,t)}}return function(){return new n(this,t)}},k=e+" Iterator",S="values"==v,L=!1,O=t.prototype,w=O[f]||O["@@iterator"]||v&&O[v],C=w||_(v),$=v?S?_("entries"):C:void 0,j="Array"==e&&O.entries||w;if(j&&(x=l(j.call(new t)))!==Object.prototype&&x.next&&(c(x,k,!0),r||"function"==typeof x[f]||a(x,f,h)),S&&w&&"values"!==w.name&&(L=!0,C=function(){return w.call(this)}),r&&!m||!p&&!L&&O[f]||a(O,f,C),s[e]=C,s[k]=h,v)if(b={values:S?C:_("values"),keys:g?C:_("keys"),entries:$},m)for(y in b)y in O||o(O,y,b[y]);else i(i.P+i.F*(p||L),e,b);return b}},function(t,e){t.exports=!0},function(t,e,n){var r=n(58),i=Math.min;t.exports=function(t){return t>0?i(r(t),9007199254740991):0}},function(t,e,n){var r=n(22),i=n(21),o=i["__core-js_shared__"]||(i["__core-js_shared__"]={});(t.exports=function(t,e){return o[t]||(o[t]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:n(95)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,n){var r=n(37).f,i=n(40),o=n(13)("toStringTag");t.exports=function(t,e,n){t&&!i(t=n?t:t.prototype,o)&&r(t,o,{configurable:!0,value:e})}},function(t,e,n){var r=n(59);t.exports=function(t){return Object(r(t))}},function(t,e,n){var r=n(57),i=n(13)("toStringTag"),o="Arguments"==r(function(){return arguments}());t.exports=function(t){var e,n,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),i))?n:o?r(e):"Object"==(a=r(e))&&"function"==typeof e.callee?"Arguments":a}},function(t,e,n){"use strict";var r=n(17),i=n(33),o=n(31),a=n(32),s=n(85),u=n(86),c=Math.max,l=Math.min,f=Math.floor,p=/\$([$&`']|\d\d?|<[^>]*>)/g,h=/\$([$&`']|\d\d?)/g;n(87)("replace",2,(function(t,e,n,d){return[function(r,i){var o=t(this),a=null==r?void 0:r[e];return void 0!==a?a.call(r,o,i):n.call(String(o),r,i)},function(t,e){var i=d(n,t,this,e);if(i.done)return i.value;var f=r(t),p=String(this),h="function"==typeof e;h||(e=String(e));var g=f.global;if(g){var m=f.unicode;f.lastIndex=0}for(var b=[];;){var y=u(f,p);if(null===y)break;if(b.push(y),!g)break;""===String(y[0])&&(f.lastIndex=s(p,o(f.lastIndex),m))}for(var x,_="",k=0,S=0;S<b.length;S++){y=b[S];for(var L=String(y[0]),O=c(l(a(y.index),p.length),0),w=[],C=1;C<y.length;C++)w.push(void 0===(x=y[C])?x:String(x));var $=y.groups;if(h){var j=[L].concat(w,O,p);void 0!==$&&j.push($);var A=String(e.apply(void 0,j))}else A=v(L,p,O,w,$,e);O>=k&&(_+=p.slice(k,O)+A,k=O+L.length)}return _+p.slice(k)}];function v(t,e,r,o,a,s){var u=r+t.length,c=o.length,l=h;return void 0!==a&&(a=i(a),l=p),n.call(s,l,(function(n,i){var s;switch(i.charAt(0)){case"$":return"$";case"&":return t;case"`":return e.slice(0,r);case"'":return e.slice(u);case"<":s=a[i.slice(1,-1)];break;default:var l=+i;if(0===l)return n;if(l>c){var p=f(l/10);return 0===p?n:p<=c?void 0===o[p-1]?i.charAt(1):o[p-1]+i.charAt(1):n}s=o[l-1]}return void 0===s?"":s}))}}))},function(t,e,n){"use strict";var r=n(10),i=n(35)(1);r(r.P+r.F*!n(36)([].map,!0),"Array",{map:function(t){return i(this,t,arguments[1])}})},function(t,e){t.exports=function(t){return null==t}},function(t,e,n){var r=n(190).Symbol;t.exports=r},function(t,e,n){"use strict";n.r(e);n(34);var r=n(15),i={name:"SidebarGroup",components:{DropdownTransition:n(108).a},props:["item","open","collapsable","depth"],beforeCreate:function(){this.$options.components.SidebarLinks=n(107).default},methods:{isActive:r.e}},o=(n(198),n(0)),a=Object(o.a)(i,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("section",{staticClass:"sidebar-group",class:[{collapsable:t.collapsable,"is-sub-group":0!==t.depth},"depth-"+t.depth]},[t.item.path?n("RouterLink",{staticClass:"sidebar-heading clickable",class:{open:t.open,active:t.isActive(t.$route,t.item.path)},attrs:{to:t.item.path},nativeOn:{click:function(e){return t.$emit("toggle")}}},[n("span",[t._v(t._s(t.item.title))]),t._v(" "),t.collapsable?n("span",{staticClass:"arrow",class:t.open?"down":"right"}):t._e()]):n("p",{staticClass:"sidebar-heading",class:{open:t.open},on:{click:function(e){return t.$emit("toggle")}}},[n("span",[t._v(t._s(t.item.title))]),t._v(" "),t.collapsable?n("span",{staticClass:"arrow",class:t.open?"down":"right"}):t._e()]),t._v(" "),n("DropdownTransition",[t.open||!t.collapsable?n("SidebarLinks",{staticClass:"sidebar-group-items",attrs:{items:t.item.children,"sidebar-depth":t.item.sidebarDepth,depth:t.depth+1}}):t._e()],1)],1)}),[],!1,null,null,null).exports;n(104),n(199);function s(t,e,n,r,i){var o={props:{to:e,activeClass:"",exactActiveClass:""},class:{active:r,"sidebar-link":!0}};return i>2&&(o.style={"padding-left":i+"rem"}),t("RouterLink",o,n)}function u(t,e,n,i,o){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;return!e||a>o?null:t("ul",{class:"sidebar-sub-headers"},e.map((function(e){var c=Object(r.e)(i,n+"#"+e.slug);return t("li",{class:"sidebar-sub-header"},[s(t,n+"#"+e.slug,e.title,c,e.level-1),u(t,e.children,n,i,o,a+1)])})))}var c={functional:!0,props:["item","sidebarDepth"],render:function(t,e){var n=e.parent,i=n.$page,o=(n.$site,n.$route),a=n.$themeConfig,c=n.$themeLocaleConfig,l=e.props,f=l.item,p=l.sidebarDepth,h=Object(r.e)(o,f.path),d="auto"===f.type?h||f.children.some((function(t){return Object(r.e)(o,f.basePath+"#"+t.slug)})):h,v="external"===f.type?function(t,e,n){return t("a",{attrs:{href:e,target:"_blank",rel:"noopener noreferrer"},class:{"sidebar-link":!0}},[n,t("OutboundLink")])}(t,f.path,f.title||f.path):s(t,f.path,f.title||f.path,d),g=[i.frontmatter.sidebarDepth,p,c.sidebarDepth,a.sidebarDepth,1].find((function(t){return void 0!==t})),m=c.displayAllHeaders||a.displayAllHeaders;return"auto"===f.type?[v,u(t,f.children,f.basePath,o,g)]:(d||m)&&f.headers&&!r.d.test(f.path)?[v,u(t,Object(r.c)(f.headers),f.path,o,g)]:v}};n(200);function l(t,e){return"group"===e.type&&e.children.some((function(e){return"group"===e.type?l(t,e):"page"===e.type&&Object(r.e)(t,e.path)}))}var f={name:"SidebarLinks",components:{SidebarGroup:a,SidebarLink:Object(o.a)(c,void 0,void 0,!1,null,null,null).exports},props:["items","depth","sidebarDepth"],data:function(){return{openGroupIndex:0}},watch:{$route:function(){this.refreshIndex()}},created:function(){this.refreshIndex()},methods:{refreshIndex:function(){var t=function(t,e){for(var n=0;n<e.length;n++){var r=e[n];if(l(t,r))return n}return-1}(this.$route,this.items);t>-1&&(this.openGroupIndex=t)},toggleGroup:function(t){this.openGroupIndex=t===this.openGroupIndex?-1:t},isActive:function(t){return Object(r.e)(this.$route,t.regularPath)}}},p=Object(o.a)(f,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.items.length?n("ul",{staticClass:"sidebar-links"},t._l(t.items,(function(e,r){return n("li",{key:r},["group"===e.type?n("SidebarGroup",{attrs:{item:e,open:r===t.openGroupIndex,collapsable:e.collapsable||e.collapsible,depth:t.depth},on:{toggle:function(e){return t.toggleGroup(r)}}}):n("SidebarLink",{attrs:{"sidebar-depth":t.sidebarDepth,item:e}})],1)})),0):t._e()}),[],!1,null,null,null);e.default=p.exports},function(t,e,n){"use strict";var r={name:"DropdownTransition",methods:{setHeight:function(t){t.style.height=t.scrollHeight+"px"},unsetHeight:function(t){t.style.height=""}}},i=(n(182),n(0)),o=Object(i.a)(r,(function(){var t=this.$createElement;return(this._self._c||t)("transition",{attrs:{name:"dropdown"},on:{enter:this.setHeight,"after-enter":this.unsetHeight,"before-leave":this.setHeight}},[this._t("default")],2)}),[],!1,null,null,null);e.a=o.exports},function(t,e,n){"use strict";var r=n(41),i=n(110),o=n(45),a=n(29);t.exports=n(111)(Array,"Array",(function(t,e){this._t=a(t),this._i=0,this._k=e}),(function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,i(1)):i(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])}),"values"),o.Arguments=o.Array,r("keys"),r("values"),r("entries")},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e,n){"use strict";var r=n(74),i=n(10),o=n(25),a=n(16),s=n(45),u=n(114),c=n(80),l=n(119),f=n(11)("iterator"),p=!([].keys&&"next"in[].keys()),h=function(){return this};t.exports=function(t,e,n,d,v,g,m){u(n,e,d);var b,y,x,_=function(t){if(!p&&t in O)return O[t];switch(t){case"keys":case"values":return function(){return new n(this,t)}}return function(){return new n(this,t)}},k=e+" Iterator",S="values"==v,L=!1,O=t.prototype,w=O[f]||O["@@iterator"]||v&&O[v],C=w||_(v),$=v?S?_("entries"):C:void 0,j="Array"==e&&O.entries||w;if(j&&(x=l(j.call(new t)))!==Object.prototype&&x.next&&(c(x,k,!0),r||"function"==typeof x[f]||a(x,f,h)),S&&w&&"values"!==w.name&&(L=!0,C=function(){return w.call(this)}),r&&!m||!p&&!L&&O[f]||a(O,f,C),s[e]=C,s[k]=h,v)if(b={values:S?C:_("values"),keys:g?C:_("keys"),entries:$},m)for(y in b)y in O||o(O,y,b[y]);else i(i.P+i.F*(p||L),e,b);return b}},function(t,e,n){t.exports=n(42)("native-function-to-string",Function.toString)},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){"use strict";var r=n(115),i=n(44),o=n(80),a={};n(16)(a,n(11)("iterator"),(function(){return this})),t.exports=function(t,e,n){t.prototype=r(a,{next:i(1,n)}),o(t,e+" Iterator")}},function(t,e,n){var r=n(17),i=n(116),o=n(50),a=n(49)("IE_PROTO"),s=function(){},u=function(){var t,e=n(76)("iframe"),r=o.length;for(e.style.display="none",n(118).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),u=t.F;r--;)delete u.prototype[o[r]];return u()};t.exports=Object.create||function(t,e){var n;return null!==t?(s.prototype=r(t),n=new s,s.prototype=null,n[a]=t):n=u(),void 0===e?n:i(n,e)}},function(t,e,n){var r=n(24),i=n(17),o=n(47);t.exports=n(19)?Object.defineProperties:function(t,e){i(t);for(var n,a=o(e),s=a.length,u=0;s>u;)r.f(t,n=a[u++],e[n]);return t}},function(t,e,n){var r=n(32),i=Math.max,o=Math.min;t.exports=function(t,e){return(t=r(t))<0?i(t+e,0):o(t,e)}},function(t,e,n){var r=n(12).document;t.exports=r&&r.documentElement},function(t,e,n){var r=n(26),i=n(33),o=n(49)("IE_PROTO"),a=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=i(t),r(t,o)?t[o]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?a:null}},function(t,e,n){var r=n(10),i=n(28),o=n(14);t.exports=function(t,e){var n=(i.Object||{})[t]||Object[t],a={};a[t]=e(n),r(r.S+r.F*o((function(){n(1)})),"Object",a)}},function(t,e,n){var r=n(122);t.exports=function(t,e){return new(r(t))(e)}},function(t,e,n){var r=n(18),i=n(82),o=n(11)("species");t.exports=function(t){var e;return i(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!i(e.prototype)||(e=void 0),r(e)&&null===(e=e[o])&&(e=void 0)),void 0===e?Array:e}},function(t,e,n){"use strict";n(124)("link",(function(t){return function(e){return t(this,"a","href",e)}}))},function(t,e,n){var r=n(10),i=n(14),o=n(20),a=/"/g,s=function(t,e,n,r){var i=String(o(t)),s="<"+e;return""!==n&&(s+=" "+n+'="'+String(r).replace(a,""")+'"'),s+">"+i+"</"+e+">"};t.exports=function(t,e){var n={};n[t]=e(s),r(r.P+r.F*i((function(){var e=""[t]('"');return e!==e.toLowerCase()||e.split('"').length>3})),"String",n)}},function(t,e,n){"use strict";var r=n(51);n.n(r).a},function(t,e,n){"use strict";var r=n(10),i=n(48)(!0);r(r.P,"Array",{includes:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),n(41)("includes")},function(t,e,n){"use strict";var r=n(10),i=n(128);r(r.P+r.F*n(129)("includes"),"String",{includes:function(t){return!!~i(this,t,"includes").indexOf(t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){var r=n(83),i=n(20);t.exports=function(t,e,n){if(r(e))throw TypeError("String#"+n+" doesn't accept regex!");return String(i(t))}},function(t,e,n){var r=n(11)("match");t.exports=function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[r]=!1,!"/./"[t](e)}catch(t){}}return!0}},function(t,e,n){var r=n(32),i=n(20);t.exports=function(t){return function(e,n){var o,a,s=String(i(e)),u=r(n),c=s.length;return u<0||u>=c?t?"":void 0:(o=s.charCodeAt(u))<55296||o>56319||u+1===c||(a=s.charCodeAt(u+1))<56320||a>57343?t?s.charAt(u):o:t?s.slice(u,u+2):a-56320+(o-55296<<10)+65536}}},function(t,e,n){var r=n(30),i=n(11)("toStringTag"),o="Arguments"==r(function(){return arguments}());t.exports=function(t){var e,n,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),i))?n:o?r(e):"Object"==(a=r(e))&&"function"==typeof e.callee?"Arguments":a}},function(t,e,n){"use strict";var r=n(88);n(10)({target:"RegExp",proto:!0,forced:r!==/./.exec},{exec:r})},function(t,e,n){"use strict";var r=n(10),i=n(35)(2);r(r.P+r.F*!n(36)([].filter,!0),"Array",{filter:function(t){return i(this,t,arguments[1])}})},function(t,e,n){var r=n(10);r(r.S,"Array",{isArray:n(82)})},function(t,e,n){"use strict";var r=n(10),i=n(48)(!1),o=[].indexOf,a=!!o&&1/[1].indexOf(1,-0)<0;r(r.P+r.F*(a||!n(36)(o)),"Array",{indexOf:function(t){return a?o.apply(this,arguments)||0:i(this,t,arguments[1])}})},function(t,e,n){"use strict";n(137)("trim",(function(t){return function(){return t(this,3)}}))},function(t,e,n){var r=n(10),i=n(20),o=n(14),a=n(138),s="["+a+"]",u=RegExp("^"+s+s+"*"),c=RegExp(s+s+"*$"),l=function(t,e,n){var i={},s=o((function(){return!!a[t]()||" "!=" "[t]()})),u=i[t]=s?e(f):a[t];n&&(i[n]=u),r(r.P+r.F*s,"String",i)},f=l.trim=function(t,e){return t=String(i(t)),1&e&&(t=t.replace(u,"")),2&e&&(t=t.replace(c,"")),t};t.exports=l},function(t,e){t.exports="\t\n\v\f\r \u2028\u2029\ufeff"},function(t,e,n){"use strict";var r=n(52);n.n(r).a},function(t,e,n){"use strict";var r=n(53);n.n(r).a},function(t,e,n){var r=n(12),i=n(142),o=n(24).f,a=n(146).f,s=n(83),u=n(89),c=r.RegExp,l=c,f=c.prototype,p=/a/g,h=/a/g,d=new c(p)!==p;if(n(19)&&(!d||n(14)((function(){return h[n(11)("match")]=!1,c(p)!=p||c(h)==h||"/a/i"!=c(p,"i")})))){c=function(t,e){var n=this instanceof c,r=s(t),o=void 0===e;return!n&&r&&t.constructor===c&&o?t:i(d?new l(r&&!o?t.source:t,e):l((r=t instanceof c)?t.source:t,r&&o?u.call(t):e),n?this:f,c)};for(var v=function(t){t in c||o(c,t,{configurable:!0,get:function(){return l[t]},set:function(e){l[t]=e}})},g=a(l),m=0;g.length>m;)v(g[m++]);f.constructor=c,c.prototype=f,n(25)(r,"RegExp",c)}n(147)("RegExp")},function(t,e,n){var r=n(18),i=n(143).set;t.exports=function(t,e,n){var o,a=e.constructor;return a!==n&&"function"==typeof a&&(o=a.prototype)!==n.prototype&&r(o)&&i&&i(t,o),t}},function(t,e,n){var r=n(18),i=n(17),o=function(t,e){if(i(t),!r(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,r){try{(r=n(46)(Function.call,n(144).f(Object.prototype,"__proto__").set,2))(t,[]),e=!(t instanceof Array)}catch(t){e=!0}return function(t,n){return o(t,n),e?t.__proto__=n:r(t,n),t}}({},!1):void 0),check:o}},function(t,e,n){var r=n(145),i=n(44),o=n(29),a=n(77),s=n(26),u=n(75),c=Object.getOwnPropertyDescriptor;e.f=n(19)?c:function(t,e){if(t=o(t),e=a(e,!0),u)try{return c(t,e)}catch(t){}if(s(t,e))return i(!r.f.call(t,e),t[e])}},function(t,e){e.f={}.propertyIsEnumerable},function(t,e,n){var r=n(79),i=n(50).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,i)}},function(t,e,n){"use strict";var r=n(12),i=n(24),o=n(19),a=n(11)("species");t.exports=function(t){var e=r[t];o&&e&&!e[a]&&i.f(e,a,{configurable:!0,get:function(){return this}})}},function(t,e,n){t.exports=n(149)},function(t,e,n){n(150),t.exports=n(22).Array.isArray},function(t,e,n){var r=n(54);r(r.S,"Array",{isArray:n(154)})},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){t.exports=!n(39)&&!n(91)((function(){return 7!=Object.defineProperty(n(92)("div"),"a",{get:function(){return 7}}).a}))},function(t,e,n){var r=n(55);t.exports=function(t,e){if(!r(t))return t;var n,i;if(e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;if("function"==typeof(n=t.valueOf)&&!r(i=n.call(t)))return i;if(!e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},function(t,e,n){var r=n(57);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,e,n){t.exports=n(156)},function(t,e,n){n(93),n(169),t.exports=n(22).Array.from},function(t,e,n){var r=n(58),i=n(59);t.exports=function(t){return function(e,n){var o,a,s=String(i(e)),u=r(n),c=s.length;return u<0||u>=c?t?"":void 0:(o=s.charCodeAt(u))<55296||o>56319||u+1===c||(a=s.charCodeAt(u+1))<56320||a>57343?t?s.charAt(u):o:t?s.slice(u,u+2):a-56320+(o-55296<<10)+65536}}},function(t,e,n){t.exports=n(27)},function(t,e,n){"use strict";var r=n(160),i=n(56),o=n(100),a={};n(27)(a,n(13)("iterator"),(function(){return this})),t.exports=function(t,e,n){t.prototype=r(a,{next:i(1,n)}),o(t,e+" Iterator")}},function(t,e,n){var r=n(38),i=n(161),o=n(99),a=n(61)("IE_PROTO"),s=function(){},u=function(){var t,e=n(92)("iframe"),r=o.length;for(e.style.display="none",n(167).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),u=t.F;r--;)delete u.prototype[o[r]];return u()};t.exports=Object.create||function(t,e){var n;return null!==t?(s.prototype=r(t),n=new s,s.prototype=null,n[a]=t):n=u(),void 0===e?n:i(n,e)}},function(t,e,n){var r=n(37),i=n(38),o=n(162);t.exports=n(39)?Object.defineProperties:function(t,e){i(t);for(var n,a=o(e),s=a.length,u=0;s>u;)r.f(t,n=a[u++],e[n]);return t}},function(t,e,n){var r=n(163),i=n(99);t.exports=Object.keys||function(t){return r(t,i)}},function(t,e,n){var r=n(40),i=n(60),o=n(165)(!1),a=n(61)("IE_PROTO");t.exports=function(t,e){var n,s=i(t),u=0,c=[];for(n in s)n!=a&&r(s,n)&&c.push(n);for(;e.length>u;)r(s,n=e[u++])&&(~o(c,n)||c.push(n));return c}},function(t,e,n){var r=n(57);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,e,n){var r=n(60),i=n(96),o=n(166);t.exports=function(t){return function(e,n,a){var s,u=r(e),c=i(u.length),l=o(a,c);if(t&&n!=n){for(;c>l;)if((s=u[l++])!=s)return!0}else for(;c>l;l++)if((t||l in u)&&u[l]===n)return t||l||0;return!t&&-1}}},function(t,e,n){var r=n(58),i=Math.max,o=Math.min;t.exports=function(t,e){return(t=r(t))<0?i(t+e,0):o(t,e)}},function(t,e,n){var r=n(21).document;t.exports=r&&r.documentElement},function(t,e,n){var r=n(40),i=n(101),o=n(61)("IE_PROTO"),a=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=i(t),r(t,o)?t[o]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?a:null}},function(t,e,n){"use strict";var r=n(90),i=n(54),o=n(101),a=n(170),s=n(171),u=n(96),c=n(172),l=n(173);i(i.S+i.F*!n(174)((function(t){Array.from(t)})),"Array",{from:function(t){var e,n,i,f,p=o(t),h="function"==typeof this?this:Array,d=arguments.length,v=d>1?arguments[1]:void 0,g=void 0!==v,m=0,b=l(p);if(g&&(v=r(v,d>2?arguments[2]:void 0,2)),null==b||h==Array&&s(b))for(n=new h(e=u(p.length));e>m;m++)c(n,m,g?v(p[m],m):p[m]);else for(f=b.call(p),n=new h;!(i=f.next()).done;m++)c(n,m,g?a(f,v,[i.value,m],!0):i.value);return n.length=m,n}})},function(t,e,n){var r=n(38);t.exports=function(t,e,n,i){try{return i?e(r(n)[0],n[1]):e(n)}catch(e){var o=t.return;throw void 0!==o&&r(o.call(t)),e}}},function(t,e,n){var r=n(23),i=n(13)("iterator"),o=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||o[i]===t)}},function(t,e,n){"use strict";var r=n(37),i=n(56);t.exports=function(t,e,n){e in t?r.f(t,e,i(0,n)):t[e]=n}},function(t,e,n){var r=n(102),i=n(13)("iterator"),o=n(23);t.exports=n(22).getIteratorMethod=function(t){if(null!=t)return t[i]||t["@@iterator"]||o[r(t)]}},function(t,e,n){var r=n(13)("iterator"),i=!1;try{var o=[7][r]();o.return=function(){i=!0},Array.from(o,(function(){throw 2}))}catch(t){}t.exports=function(t,e){if(!e&&!i)return!1;var n=!1;try{var o=[7],a=o[r]();a.next=function(){return{done:n=!0}},o[r]=function(){return a},t(o)}catch(t){}return n}},function(t,e,n){t.exports=n(176)},function(t,e,n){n(177),n(93),t.exports=n(181)},function(t,e,n){n(178);for(var r=n(21),i=n(27),o=n(23),a=n(13)("toStringTag"),s="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),u=0;u<s.length;u++){var c=s[u],l=r[c],f=l&&l.prototype;f&&!f[a]&&i(f,a,c),o[c]=o.Array}},function(t,e,n){"use strict";var r=n(179),i=n(180),o=n(23),a=n(60);t.exports=n(94)(Array,"Array",(function(t,e){this._t=a(t),this._i=0,this._k=e}),(function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,i(1)):i(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])}),"values"),o.Arguments=o.Array,r("keys"),r("values"),r("entries")},function(t,e){t.exports=function(){}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e,n){var r=n(102),i=n(13)("iterator"),o=n(23);t.exports=n(22).isIterable=function(t){var e=Object(t);return void 0!==e[i]||"@@iterator"in e||o.hasOwnProperty(r(e))}},function(t,e,n){"use strict";var r=n(62);n.n(r).a},function(t,e){t.exports=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}},function(t,e,n){"use strict";var r=n(63);n.n(r).a},function(t,e,n){"use strict";var r=n(64);n.n(r).a},function(t,e,n){"use strict";var r=n(65);n.n(r).a},function(t,e,n){"use strict";var r=n(66);n.n(r).a},function(t,e,n){var r=n(189),i=n(194),o=n(195);t.exports=function(t){return"string"==typeof t||!i(t)&&o(t)&&"[object String]"==r(t)}},function(t,e,n){var r=n(106),i=n(192),o=n(193),a=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":a&&a in Object(t)?i(t):o(t)}},function(t,e,n){var r=n(191),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();t.exports=o},function(t,e){var n="object"==typeof global&&global&&global.Object===Object&&global;t.exports=n},function(t,e,n){var r=n(106),i=Object.prototype,o=i.hasOwnProperty,a=i.toString,s=r?r.toStringTag:void 0;t.exports=function(t){var e=o.call(t,s),n=t[s];try{t[s]=void 0;var r=!0}catch(t){}var i=a.call(t);return r&&(e?t[s]=n:delete t[s]),i}},function(t,e){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},function(t,e){var n=Array.isArray;t.exports=n},function(t,e){t.exports=function(t){return null!=t&&"object"==typeof t}},function(t,e,n){"use strict";var r=n(67);n.n(r).a},function(t,e,n){"use strict";var r=n(68);n.n(r).a},function(t,e,n){"use strict";var r=n(69);n.n(r).a},function(t,e,n){"use strict";var r=n(10),i=n(35)(5),o=!0;"find"in[]&&Array(1).find((function(){o=!1})),r(r.P+r.F*o,"Array",{find:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),n(41)("find")},function(t,e,n){"use strict";var r=n(70);n.n(r).a},function(t,e,n){"use strict";var r=n(71);n.n(r).a},,function(t,e,n){"use strict";n.r(e);n(73),n(81),n(34),n(123);var r=n(15),i={name:"NavLink",props:{item:{required:!0}},computed:{link:function(){return Object(r.b)(this.item.link)},exact:function(){var t=this;return this.$site.locales?Object.keys(this.$site.locales).some((function(e){return e===t.link})):"/"===this.link},isNonHttpURI:function(){return Object(r.g)(this.link)||Object(r.h)(this.link)},isBlankTarget:function(){return"_blank"===this.target},isInternal:function(){return!Object(r.f)(this.link)&&!this.isBlankTarget},target:function(){return this.isNonHttpURI?null:this.item.target?this.item.target:Object(r.f)(this.link)?"_blank":""},rel:function(){return this.isNonHttpURI?null:this.item.rel?this.item.rel:this.isBlankTarget?"noopener noreferrer":""}},methods:{focusoutAction:function(){this.$emit("focusout")}}},o=n(0),a=Object(o.a)(i,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.isInternal?n("RouterLink",{staticClass:"nav-link",attrs:{to:t.link,exact:t.exact},nativeOn:{focusout:function(e){return t.focusoutAction(e)}}},[t._v("\n "+t._s(t.item.text)+"\n")]):n("a",{staticClass:"nav-link external",attrs:{href:t.link,target:t.target,rel:t.rel},on:{focusout:t.focusoutAction}},[t._v("\n "+t._s(t.item.text)+"\n "),t.isBlankTarget?n("OutboundLink"):t._e()],1)}),[],!1,null,null,null).exports,s={name:"Home",components:{NavLink:a},computed:{data:function(){return this.$page.frontmatter},actionLink:function(){return{link:this.data.actionLink,text:this.data.actionText}}}},u=(n(125),Object(o.a)(s,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("main",{staticClass:"home",attrs:{"aria-labelledby":"main-title"}},[n("header",{staticClass:"hero"},[t.data.heroImage?n("img",{attrs:{src:t.$withBase(t.data.heroImage),alt:t.data.heroAlt||"hero"}}):t._e(),t._v(" "),null!==t.data.heroText?n("h1",{attrs:{id:"main-title"}},[t._v("\n "+t._s(t.data.heroText||t.$title||"Hello")+"\n ")]):t._e(),t._v(" "),null!==t.data.tagline?n("p",{staticClass:"description"},[t._v("\n "+t._s(t.data.tagline||t.$description||"Welcome to your VuePress site")+"\n ")]):t._e(),t._v(" "),t.data.actionText&&t.data.actionLink?n("p",{staticClass:"action"},[n("NavLink",{staticClass:"action-button",attrs:{item:t.actionLink}})],1):t._e()]),t._v(" "),t.data.features&&t.data.features.length?n("div",{staticClass:"features"},t._l(t.data.features,(function(e,r){return n("div",{key:r,staticClass:"feature"},[n("h2",[t._v(t._s(e.title))]),t._v(" "),n("p",[t._v(t._s(e.details))])])})),0):t._e(),t._v(" "),n("Content",{staticClass:"theme-default-content custom"}),t._v(" "),t.data.footer?n("div",{staticClass:"footer"},[t._v("\n "+t._s(t.data.footer)+"\n ")]):t._e()],1)}),[],!1,null,null,null).exports),c=(n(126),n(127),n(84),n(133),n(134),n(135),n(136),{name:"SearchBox",data:function(){return{query:"",focused:!1,focusIndex:0,placeholder:void 0}},computed:{showSuggestions:function(){return this.focused&&this.suggestions&&this.suggestions.length},suggestions:function(){var t=this.query.trim().toLowerCase();if(t){for(var e=this.$site.pages,n=this.$site.themeConfig.searchMaxSuggestions||5,r=this.$localePath,i=function(e){return e&&e.title&&e.title.toLowerCase().indexOf(t)>-1},o=[],a=0;a<e.length&&!(o.length>=n);a++){var s=e[a];if(this.getPageLocalePath(s)===r&&this.isSearchable(s))if(i(s))o.push(s);else if(s.headers)for(var u=0;u<s.headers.length&&!(o.length>=n);u++){var c=s.headers[u];i(c)&&o.push(Object.assign({},s,{path:s.path+"#"+c.slug,header:c}))}}return o}},alignRight:function(){return(this.$site.themeConfig.nav||[]).length+(this.$site.repo?1:0)<=2}},mounted:function(){this.placeholder=this.$site.themeConfig.searchPlaceholder||"",document.addEventListener("keydown",this.onHotkey)},beforeDestroy:function(){document.removeEventListener("keydown",this.onHotkey)},methods:{getPageLocalePath:function(t){for(var e in this.$site.locales||{})if("/"!==e&&0===t.path.indexOf(e))return e;return"/"},isSearchable:function(t){var e=null;return null===e||(e=Array.isArray(e)?e:new Array(e)).filter((function(e){return t.path.match(e)})).length>0},onHotkey:function(t){t.srcElement===document.body&&["s","/"].includes(t.key)&&(this.$refs.input.focus(),t.preventDefault())},onUp:function(){this.showSuggestions&&(this.focusIndex>0?this.focusIndex--:this.focusIndex=this.suggestions.length-1)},onDown:function(){this.showSuggestions&&(this.focusIndex<this.suggestions.length-1?this.focusIndex++:this.focusIndex=0)},go:function(t){this.showSuggestions&&(this.$router.push(this.suggestions[t].path),this.query="",this.focusIndex=0)},focus:function(t){this.focusIndex=t},unfocus:function(){this.focusIndex=-1}}}),l=(n(139),Object(o.a)(c,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"search-box"},[n("input",{ref:"input",class:{focused:t.focused},attrs:{"aria-label":"Search",placeholder:t.placeholder,autocomplete:"off",spellcheck:"false"},domProps:{value:t.query},on:{input:function(e){t.query=e.target.value},focus:function(e){t.focused=!0},blur:function(e){t.focused=!1},keyup:[function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.go(t.focusIndex)},function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"up",38,e.key,["Up","ArrowUp"])?null:t.onUp(e)},function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"down",40,e.key,["Down","ArrowDown"])?null:t.onDown(e)}]}}),t._v(" "),t.showSuggestions?n("ul",{staticClass:"suggestions",class:{"align-right":t.alignRight},on:{mouseleave:t.unfocus}},t._l(t.suggestions,(function(e,r){return n("li",{key:r,staticClass:"suggestion",class:{focused:r===t.focusIndex},on:{mousedown:function(e){return t.go(r)},mouseenter:function(e){return t.focus(r)}}},[n("a",{attrs:{href:e.path},on:{click:function(t){t.preventDefault()}}},[n("span",{staticClass:"page-title"},[t._v(t._s(e.title||e.path))]),t._v(" "),e.header?n("span",{staticClass:"header"},[t._v("> "+t._s(e.header.title))]):t._e()])])})),0):t._e()])}),[],!1,null,null,null).exports),f=(n(140),Object(o.a)({},(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"sidebar-button",on:{click:function(e){return t.$emit("toggle-sidebar")}}},[n("svg",{staticClass:"icon",attrs:{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",viewBox:"0 0 448 512"}},[n("path",{attrs:{fill:"currentColor",d:"M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"}})])])}),[],!1,null,null,null).exports),p=(n(141),n(148)),h=n.n(p);var d=n(155),v=n.n(d),g=n(175),m=n.n(g);function b(t){return function(t){if(h()(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(m()(Object(t))||"[object Arguments]"===Object.prototype.toString.call(t))return v()(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}n(103),n(104);var y=n(108),x=n(183),_=n.n(x),k={name:"DropdownLink",components:{NavLink:a,DropdownTransition:y.a},props:{item:{required:!0}},data:function(){return{open:!1}},computed:{dropdownAriaLabel:function(){return this.item.ariaLabel||this.item.text}},watch:{$route:function(){this.open=!1}},methods:{setOpen:function(t){this.open=t},isLastItemOfArray:function(t,e){return _()(e)===t}}},S=(n(184),{name:"NavLinks",components:{NavLink:a,DropdownLink:Object(o.a)(k,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"dropdown-wrapper",class:{open:t.open}},[n("button",{staticClass:"dropdown-title",attrs:{type:"button","aria-label":t.dropdownAriaLabel},on:{click:function(e){return t.setOpen(!t.open)}}},[n("span",{staticClass:"title"},[t._v(t._s(t.item.text))]),t._v(" "),n("span",{staticClass:"arrow",class:t.open?"down":"right"})]),t._v(" "),n("DropdownTransition",[n("ul",{directives:[{name:"show",rawName:"v-show",value:t.open,expression:"open"}],staticClass:"nav-dropdown"},t._l(t.item.items,(function(e,r){return n("li",{key:e.link||r,staticClass:"dropdown-item"},["links"===e.type?n("h4",[t._v("\n "+t._s(e.text)+"\n ")]):t._e(),t._v(" "),"links"===e.type?n("ul",{staticClass:"dropdown-subitem-wrapper"},t._l(e.items,(function(r){return n("li",{key:r.link,staticClass:"dropdown-subitem"},[n("NavLink",{attrs:{item:r},on:{focusout:function(n){t.isLastItemOfArray(r,e.items)&&t.isLastItemOfArray(e,t.item.items)&&t.setOpen(!1)}}})],1)})),0):n("NavLink",{attrs:{item:e},on:{focusout:function(n){t.isLastItemOfArray(e,t.item.items)&&t.setOpen(!1)}}})],1)})),0)])],1)}),[],!1,null,null,null).exports},computed:{userNav:function(){return this.$themeLocaleConfig.nav||this.$site.themeConfig.nav||[]},nav:function(){var t=this,e=this.$site.locales;if(e&&Object.keys(e).length>1){var n=this.$page.path,r=this.$router.options.routes,i=this.$site.themeConfig.locales||{},o={text:this.$themeLocaleConfig.selectText||"Languages",ariaLabel:this.$themeLocaleConfig.ariaLabel||"Select language",items:Object.keys(e).map((function(o){var a,s=e[o],u=i[o]&&i[o].label||s.lang;return s.lang===t.$lang?a=n:(a=n.replace(t.$localeConfig.path,o),r.some((function(t){return t.path===a}))||(a=o)),{text:u,link:a}}))};return[].concat(b(this.userNav),[o])}return this.userNav},userLinks:function(){return(this.nav||[]).map((function(t){return Object.assign(Object(r.j)(t),{items:(t.items||[]).map(r.j)})}))},repoLink:function(){var t=this.$site.themeConfig.repo;return t?/^https?:/.test(t)?t:"https://github.com/".concat(t):null},repoLabel:function(){if(this.repoLink){if(this.$site.themeConfig.repoLabel)return this.$site.themeConfig.repoLabel;for(var t=this.repoLink.match(/^https?:\/\/[^/]+/)[0],e=["GitHub","GitLab","Bitbucket"],n=0;n<e.length;n++){var r=e[n];if(new RegExp(r,"i").test(t))return r}return"Source"}}}}),L=(n(185),Object(o.a)(S,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.userLinks.length||t.repoLink?n("nav",{staticClass:"nav-links"},[t._l(t.userLinks,(function(t){return n("div",{key:t.link,staticClass:"nav-item"},["links"===t.type?n("DropdownLink",{attrs:{item:t}}):n("NavLink",{attrs:{item:t}})],1)})),t._v(" "),t.repoLink?n("a",{staticClass:"repo-link",attrs:{href:t.repoLink,target:"_blank",rel:"noopener noreferrer"}},[t._v("\n "+t._s(t.repoLabel)+"\n "),n("OutboundLink")],1):t._e()],2):t._e()}),[],!1,null,null,null).exports);function O(t,e){return t.ownerDocument.defaultView.getComputedStyle(t,null)[e]}var w={name:"Navbar",components:{SidebarButton:f,NavLinks:L,SearchBox:l,AlgoliaSearchBox:{}},data:function(){return{linksWrapMaxWidth:null}},computed:{algolia:function(){return this.$themeLocaleConfig.algolia||this.$site.themeConfig.algolia||{}},isAlgoliaSearch:function(){return this.algolia&&this.algolia.apiKey&&this.algolia.indexName}},mounted:function(){var t=this,e=parseInt(O(this.$el,"paddingLeft"))+parseInt(O(this.$el,"paddingRight")),n=function(){document.documentElement.clientWidth<719?t.linksWrapMaxWidth=null:t.linksWrapMaxWidth=t.$el.offsetWidth-e-(t.$refs.siteName&&t.$refs.siteName.offsetWidth||0)};n(),window.addEventListener("resize",n,!1)}},C=(n(186),Object(o.a)(w,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("header",{staticClass:"navbar"},[n("SidebarButton",{on:{"toggle-sidebar":function(e){return t.$emit("toggle-sidebar")}}}),t._v(" "),n("RouterLink",{staticClass:"home-link",attrs:{to:t.$localePath}},[t.$site.themeConfig.logo?n("img",{staticClass:"logo",attrs:{src:t.$withBase(t.$site.themeConfig.logo),alt:t.$siteTitle}}):t._e(),t._v(" "),t.$siteTitle?n("span",{ref:"siteName",staticClass:"site-name",class:{"can-hide":t.$site.themeConfig.logo}},[t._v(t._s(t.$siteTitle))]):t._e()]),t._v(" "),n("div",{staticClass:"links",style:t.linksWrapMaxWidth?{"max-width":t.linksWrapMaxWidth+"px"}:{}},[t.isAlgoliaSearch?n("AlgoliaSearchBox",{attrs:{options:t.algolia}}):!1!==t.$site.themeConfig.search&&!1!==t.$page.frontmatter.search?n("SearchBox"):t._e(),t._v(" "),n("NavLinks",{staticClass:"can-hide"})],1)],1)}),[],!1,null,null,null).exports),$=n(105),j=n.n($),A={name:"PageEdit",computed:{lastUpdated:function(){return this.$page.lastUpdated},lastUpdatedText:function(){return"string"==typeof this.$themeLocaleConfig.lastUpdated?this.$themeLocaleConfig.lastUpdated:"string"==typeof this.$site.themeConfig.lastUpdated?this.$site.themeConfig.lastUpdated:"Last Updated"},editLink:function(){var t=j()(this.$page.frontmatter.editLink)?this.$site.themeConfig.editLinks:this.$page.frontmatter.editLink,e=this.$site.themeConfig,n=e.repo,r=e.docsDir,i=void 0===r?"":r,o=e.docsBranch,a=void 0===o?"master":o,s=e.docsRepo,u=void 0===s?n:s;return t&&u&&this.$page.relativePath?this.createEditLink(n,u,i,a,this.$page.relativePath):null},editLinkText:function(){return this.$themeLocaleConfig.editLinkText||this.$site.themeConfig.editLinkText||"Edit this page"}},methods:{createEditLink:function(t,e,n,i,o){return/bitbucket.org/.test(t)?(r.i.test(e)?e:t).replace(r.a,"")+"/src"+"/".concat(i,"/")+(n?n.replace(r.a,"")+"/":"")+o+"?mode=edit&spa=0&at=".concat(i,"&fileviewer=file-view-default"):(r.i.test(e)?e:"https://github.com/".concat(e)).replace(r.a,"")+"/edit"+"/".concat(i,"/")+(n?n.replace(r.a,"")+"/":"")+o}}},T=(n(187),Object(o.a)(A,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("footer",{staticClass:"page-edit"},[t.editLink?n("div",{staticClass:"edit-link"},[n("a",{attrs:{href:t.editLink,target:"_blank",rel:"noopener noreferrer"}},[t._v(t._s(t.editLinkText))]),t._v(" "),n("OutboundLink")],1):t._e(),t._v(" "),t.lastUpdated?n("div",{staticClass:"last-updated"},[n("span",{staticClass:"prefix"},[t._v(t._s(t.lastUpdatedText)+":")]),t._v(" "),n("span",{staticClass:"time"},[t._v(t._s(t.lastUpdated))])]):t._e()])}),[],!1,null,null,null).exports),P=n(188),E=n.n(P),I={name:"PageNav",props:["sidebarItems"],computed:{prev:function(){return N(M.PREV,this)},next:function(){return N(M.NEXT,this)}}};var M={NEXT:{resolveLink:function(t,e){return R(t,e,1)},getThemeLinkConfig:function(t){return t.nextLinks},getPageLinkConfig:function(t){return t.frontmatter.next}},PREV:{resolveLink:function(t,e){return R(t,e,-1)},getThemeLinkConfig:function(t){return t.prevLinks},getPageLinkConfig:function(t){return t.frontmatter.prev}}};function N(t,e){var n=e.$themeConfig,i=e.$page,o=e.$route,a=e.$site,s=e.sidebarItems,u=t.resolveLink,c=t.getThemeLinkConfig,l=t.getPageLinkConfig,f=c(n),p=l(i),h=j()(p)?f:p;return!1===h?void 0:E()(h)?Object(r.k)(a.pages,h,o.path):u(i,s)}function R(t,e,n){var r=[];!function t(e,n){for(var r=0,i=e.length;r<i;r++)"group"===e[r].type?t(e[r].children||[],n):n.push(e[r])}(e,r);for(var i=0;i<r.length;i++){var o=r[i];if("page"===o.type&&o.path===decodeURIComponent(t.path))return r[i+n]}}var D=I,F=(n(196),{components:{PageEdit:T,PageNav:Object(o.a)(D,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.prev||t.next?n("div",{staticClass:"page-nav"},[n("p",{staticClass:"inner"},[t.prev?n("span",{staticClass:"prev"},[t._v("\n ←\n "),"external"===t.prev.type?n("a",{staticClass:"prev",attrs:{href:t.prev.path,target:"_blank",rel:"noopener noreferrer"}},[t._v("\n "+t._s(t.prev.title||t.prev.path)+"\n\n "),n("OutboundLink")],1):n("RouterLink",{staticClass:"prev",attrs:{to:t.prev.path}},[t._v("\n "+t._s(t.prev.title||t.prev.path)+"\n ")])],1):t._e(),t._v(" "),t.next?n("span",{staticClass:"next"},["external"===t.next.type?n("a",{attrs:{href:t.next.path,target:"_blank",rel:"noopener noreferrer"}},[t._v("\n "+t._s(t.next.title||t.next.path)+"\n\n "),n("OutboundLink")],1):n("RouterLink",{attrs:{to:t.next.path}},[t._v("\n "+t._s(t.next.title||t.next.path)+"\n ")]),t._v("\n →\n ")],1):t._e()])]):t._e()}),[],!1,null,null,null).exports},props:["sidebarItems"]}),H=(n(197),Object(o.a)(F,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("main",{staticClass:"page"},[t._t("top"),t._v(" "),n("Content",{staticClass:"theme-default-content"}),t._v(" "),n("PageEdit"),t._v(" "),n("PageNav",t._b({},"PageNav",{sidebarItems:t.sidebarItems},!1)),t._v(" "),t._t("bottom")],2)}),[],!1,null,null,null).exports),G={name:"Sidebar",components:{SidebarLinks:n(107).default,NavLinks:L},props:["items"]},U=(n(201),{name:"Layout",components:{Home:u,Page:H,Sidebar:Object(o.a)(G,(function(){var t=this.$createElement,e=this._self._c||t;return e("aside",{staticClass:"sidebar"},[e("NavLinks"),this._v(" "),this._t("top"),this._v(" "),e("SidebarLinks",{attrs:{depth:0,items:this.items}}),this._v(" "),this._t("bottom")],2)}),[],!1,null,null,null).exports,Navbar:C},data:function(){return{isSidebarOpen:!1}},computed:{shouldShowNavbar:function(){var t=this.$site.themeConfig;return!1!==this.$page.frontmatter.navbar&&!1!==t.navbar&&(this.$title||t.logo||t.repo||t.nav||this.$themeLocaleConfig.nav)},shouldShowSidebar:function(){var t=this.$page.frontmatter;return!t.home&&!1!==t.sidebar&&this.sidebarItems.length},sidebarItems:function(){return Object(r.l)(this.$page,this.$page.regularPath,this.$site,this.$localePath)},pageClasses:function(){var t=this.$page.frontmatter.pageClass;return[{"no-navbar":!this.shouldShowNavbar,"sidebar-open":this.isSidebarOpen,"no-sidebar":!this.shouldShowSidebar},t]}},mounted:function(){var t=this;this.$router.afterEach((function(){t.isSidebarOpen=!1}))},methods:{toggleSidebar:function(t){this.isSidebarOpen="boolean"==typeof t?t:!this.isSidebarOpen,this.$emit("toggle-sidebar",this.isSidebarOpen)},onTouchStart:function(t){this.touchStart={x:t.changedTouches[0].clientX,y:t.changedTouches[0].clientY}},onTouchEnd:function(t){var e=t.changedTouches[0].clientX-this.touchStart.x,n=t.changedTouches[0].clientY-this.touchStart.y;Math.abs(e)>Math.abs(n)&&Math.abs(e)>40&&(e>0&&this.touchStart.x<=80?this.toggleSidebar(!0):this.toggleSidebar(!1))}}}),B=Object(o.a)(U,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"theme-container",class:t.pageClasses,on:{touchstart:t.onTouchStart,touchend:t.onTouchEnd}},[t.shouldShowNavbar?n("Navbar",{on:{"toggle-sidebar":t.toggleSidebar}}):t._e(),t._v(" "),n("div",{staticClass:"sidebar-mask",on:{click:function(e){return t.toggleSidebar(!1)}}}),t._v(" "),n("Sidebar",{attrs:{items:t.sidebarItems},on:{"toggle-sidebar":t.toggleSidebar},scopedSlots:t._u([{key:"top",fn:function(){return[t._t("sidebar-top")]},proxy:!0},{key:"bottom",fn:function(){return[t._t("sidebar-bottom")]},proxy:!0}],null,!0)}),t._v(" "),t.$page.frontmatter.home?n("Home"):n("Page",{attrs:{"sidebar-items":t.sidebarItems},scopedSlots:t._u([{key:"top",fn:function(){return[t._t("page-top")]},proxy:!0},{key:"bottom",fn:function(){return[t._t("page-bottom")]},proxy:!0}],null,!0)})],1)}),[],!1,null,null,null);e.default=B.exports}]]); \ No newline at end of file diff --git a/docs/assets/js/3.865f603a.js b/docs/assets/js/3.865f603a.js new file mode 100644 index 000000000..c9c109121 --- /dev/null +++ b/docs/assets/js/3.865f603a.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[3],{158:function(t,e,n){},201:function(t,e,n){"use strict";var i=n(158);n.n(i).a},216:function(t,e,n){"use strict";n.r(e);var i={functional:!0,props:{type:{type:String,default:"tip"},text:String,vertical:{type:String,default:"top"}},render:function(t,e){var n=e.props,i=e.slots;return t("span",{class:["badge",n.type],style:{verticalAlign:n.vertical}},n.text||i().default)}},r=(n(201),n(28)),a=Object(r.a)(i,void 0,void 0,!1,null,"15b7b770",null);e.default=a.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/3.af853996.js b/docs/assets/js/3.af853996.js deleted file mode 100644 index cc0b000c7..000000000 --- a/docs/assets/js/3.af853996.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[3],{202:function(t,e,n){"use strict";var i=n(72);n.n(i).a},216:function(t,e,n){"use strict";n.r(e);var i={functional:!0,props:{type:{type:String,default:"tip"},text:String,vertical:{type:String,default:"top"}},render:function(t,e){var n=e.props,i=e.slots;return t("span",{class:["badge",n.type],style:{verticalAlign:n.vertical}},n.text||i().default)}},r=(n(202),n(0)),a=Object(r.a)(i,void 0,void 0,!1,null,"15b7b770",null);e.default=a.exports},72:function(t,e,n){}}]); \ No newline at end of file diff --git a/docs/assets/js/4.b0dd307f.js b/docs/assets/js/4.b0dd307f.js deleted file mode 100644 index 84abf4bfa..000000000 --- a/docs/assets/js/4.b0dd307f.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{204:function(t,e,s){"use strict";s.r(e);var n=["There's nothing here.","How did we get here?","That's a Four-Oh-Four.","Looks like we've got some broken links."],o={methods:{getMsg:function(){return n[Math.floor(Math.random()*n.length)]}}},i=s(0),h=Object(i.a)(o,(function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"theme-container"},[e("div",{staticClass:"theme-default-content"},[e("h1",[this._v("404")]),this._v(" "),e("blockquote",[this._v(this._s(this.getMsg()))]),this._v(" "),e("RouterLink",{attrs:{to:"/"}},[this._v("\n Take me home.\n ")])],1)])}),[],!1,null,null,null);e.default=h.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/4.f03b7f8e.js b/docs/assets/js/4.f03b7f8e.js new file mode 100644 index 000000000..6f5542227 --- /dev/null +++ b/docs/assets/js/4.f03b7f8e.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{203:function(t,e,s){"use strict";s.r(e);var n=["There's nothing here.","How did we get here?","That's a Four-Oh-Four.","Looks like we've got some broken links."],o={methods:{getMsg:function(){return n[Math.floor(Math.random()*n.length)]}}},i=s(28),h=Object(i.a)(o,(function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"theme-container"},[e("div",{staticClass:"theme-default-content"},[e("h1",[this._v("404")]),this._v(" "),e("blockquote",[this._v(this._s(this.getMsg()))]),this._v(" "),e("RouterLink",{attrs:{to:"/"}},[this._v("\n Take me home.\n ")])],1)])}),[],!1,null,null,null);e.default=h.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/5.5defc76c.js b/docs/assets/js/5.5defc76c.js new file mode 100644 index 000000000..0cf734231 --- /dev/null +++ b/docs/assets/js/5.5defc76c.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[5],{204:function(t,e,n){"use strict";n.r(e);var s=n(28),l=Object(s.a)({},(function(){var t=this.$createElement;return(this._self._c||t)("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}})}),[],!1,null,null,null);e.default=l.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/5.e6948aea.js b/docs/assets/js/5.e6948aea.js deleted file mode 100644 index 5935503f3..000000000 --- a/docs/assets/js/5.e6948aea.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[5],{205:function(t,e,n){"use strict";n.r(e);var s=n(0),l=Object(s.a)({},(function(){var t=this.$createElement;return(this._self._c||t)("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}})}),[],!1,null,null,null);e.default=l.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/6.d222e5e8.js b/docs/assets/js/6.d222e5e8.js new file mode 100644 index 000000000..8f9ead5fb --- /dev/null +++ b/docs/assets/js/6.d222e5e8.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[6],{205:function(e,r,t){"use strict";t.r(r);var n=t(28),a=Object(n.a)({},(function(){var e=this,r=e.$createElement,t=e._self._c||r;return t("ContentSlotsDistributor",{attrs:{"slot-key":e.$parent.slotKey}},[t("h1",{attrs:{id:"about"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#about"}},[e._v("#")]),e._v(" About")]),e._v(" "),t("p",[e._v("Caliban is a project developed by Pierre Ricadat aka "),t("a",{attrs:{href:"https://github.com/ghostdogpr",target:"_blank",rel:"noopener noreferrer"}},[e._v("@ghostdogpr"),t("OutboundLink")],1),e._v(".")]),e._v(" "),t("p",[e._v("The name is inspired by the SF novel and tv series "),t("a",{attrs:{href:"https://en.wikipedia.org/wiki/Caliban%27s_War",target:"_blank",rel:"noopener noreferrer"}},[e._v("The Expanse"),t("OutboundLink")],1),e._v(".")]),e._v(" "),t("p",[t("strong",[e._v("Thanks")]),e._v(":")]),e._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://github.com/deckerst",target:"_blank",rel:"noopener noreferrer"}},[e._v("@deckerst"),t("OutboundLink")],1),e._v(" for the logo")]),e._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/yoohaemin",target:"_blank",rel:"noopener noreferrer"}},[e._v("@yoohaemin"),t("OutboundLink")],1),e._v(", "),t("a",{attrs:{href:"https://github.com/adamgfraser",target:"_blank",rel:"noopener noreferrer"}},[e._v("@adamgfraser"),t("OutboundLink")],1),e._v(" and "),t("a",{attrs:{href:"https://github.com/jdegoes",target:"_blank",rel:"noopener noreferrer"}},[e._v("@jdegoes"),t("OutboundLink")],1),e._v(" for the early feedback")]),e._v(" "),t("li",[e._v("the "),t("a",{attrs:{href:"https://morpheusgraphql.com/",target:"_blank",rel:"noopener noreferrer"}},[e._v("Morpheus"),t("OutboundLink")],1),e._v(" library in Haskell for the inspiration leading to the GraphQL backend implementation")]),e._v(" "),t("li",[e._v("the "),t("a",{attrs:{href:"https://github.com/dillonkearns/elm-graphql",target:"_blank",rel:"noopener noreferrer"}},[e._v("elm-graphql"),t("OutboundLink")],1),e._v(" library for the inspiration leading to the GraphQL client implementation")]),e._v(" "),t("li",[e._v("all Caliban's "),t("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/graphs/contributors",target:"_blank",rel:"noopener noreferrer"}},[e._v("contributors"),t("OutboundLink")],1),e._v("!")])])])}),[],!1,null,null,null);r.default=a.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/6.e0cf4477.js b/docs/assets/js/6.e0cf4477.js deleted file mode 100644 index f91b3f64a..000000000 --- a/docs/assets/js/6.e0cf4477.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[6],{206:function(e,r,t){"use strict";t.r(r);var a=t(0),n=Object(a.a)({},(function(){var e=this,r=e.$createElement,t=e._self._c||r;return t("ContentSlotsDistributor",{attrs:{"slot-key":e.$parent.slotKey}},[t("h1",{attrs:{id:"about"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#about"}},[e._v("#")]),e._v(" About")]),e._v(" "),t("p",[e._v("Caliban is a project developed by Pierre Ricadat aka "),t("a",{attrs:{href:"https://github.com/ghostdogpr",target:"_blank",rel:"noopener noreferrer"}},[e._v("@ghostdogpr"),t("OutboundLink")],1),e._v(".")]),e._v(" "),t("p",[e._v("The name is inspired by the SF novel and tv series "),t("a",{attrs:{href:"https://en.wikipedia.org/wiki/Caliban%27s_War",target:"_blank",rel:"noopener noreferrer"}},[e._v("The Expanse"),t("OutboundLink")],1),e._v(".")]),e._v(" "),t("p",[t("strong",[e._v("Thanks")]),e._v(":")]),e._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://github.com/deckerst",target:"_blank",rel:"noopener noreferrer"}},[e._v("@deckerst"),t("OutboundLink")],1),e._v(" for the logo")]),e._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/yoohaemin",target:"_blank",rel:"noopener noreferrer"}},[e._v("@yoohaemin"),t("OutboundLink")],1),e._v(", "),t("a",{attrs:{href:"https://github.com/adamgfraser",target:"_blank",rel:"noopener noreferrer"}},[e._v("@adamgfraser"),t("OutboundLink")],1),e._v(" and "),t("a",{attrs:{href:"https://github.com/jdegoes",target:"_blank",rel:"noopener noreferrer"}},[e._v("@jdegoes"),t("OutboundLink")],1),e._v(" for the early feedback")]),e._v(" "),t("li",[e._v("the "),t("a",{attrs:{href:"https://morpheusgraphql.com/",target:"_blank",rel:"noopener noreferrer"}},[e._v("Morpheus"),t("OutboundLink")],1),e._v(" library in Haskell for the inspiration")]),e._v(" "),t("li",[e._v("all Caliban's "),t("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/graphs/contributors",target:"_blank",rel:"noopener noreferrer"}},[e._v("contributors"),t("OutboundLink")],1),e._v("!")])])])}),[],!1,null,null,null);r.default=n.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/7.57a8ce51.js b/docs/assets/js/7.57a8ce51.js new file mode 100644 index 000000000..745a33bb8 --- /dev/null +++ b/docs/assets/js/7.57a8ce51.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[7],{207:function(t,a,s){"use strict";s.r(a);var e=s(28),n=Object(e.a)({},(function(){var t=this,a=t.$createElement,s=t._self._c||a;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"getting-started"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#getting-started"}},[t._v("#")]),t._v(" Getting Started")]),t._v(" "),s("p",[s("strong",[t._v("Caliban")]),t._v(" is a purely functional library for creating GraphQL backends in Scala.\nIt relies on "),s("a",{attrs:{href:"https://github.com/propensive/magnolia",target:"_blank",rel:"noopener noreferrer"}},[t._v("Magnolia"),s("OutboundLink")],1),t._v(" to automatically derives GraphQL schemas from your data types, "),s("a",{attrs:{href:"https://github.com/lihaoyi/fastparse",target:"_blank",rel:"noopener noreferrer"}},[t._v("Fastparse"),s("OutboundLink")],1),t._v(" to parse queries and "),s("a",{attrs:{href:"https://github.com/zio/zio",target:"_blank",rel:"noopener noreferrer"}},[t._v("ZIO"),s("OutboundLink")],1),t._v(" to handle various effects.")]),t._v(" "),s("p",[t._v("The design principles behind the library are the following:")]),t._v(" "),s("ul",[s("li",[t._v("pure interface: errors and effects are returned explicitly (no exceptions thrown), all returned types are referentially transparent (no "),s("code",[t._v("Future")]),t._v(").")]),t._v(" "),s("li",[t._v("clean separation between schema definition and implementation: schema is defined and validated at compile-time (no reflection) using Scala standard types, resolver is a simple value provided at runtime.")]),t._v(" "),s("li",[t._v("minimal amount of boilerplate: no need to manually define a schema for every type in your API.")])]),t._v(" "),s("p",[t._v("Caliban can also be used to build GraphQL frontends: see the "),s("RouterLink",{attrs:{to:"/docs/client.html"}},[t._v("dedicated section")]),t._v(" for more details.")],1),t._v(" "),s("h2",{attrs:{id:"dependencies"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#dependencies"}},[t._v("#")]),t._v(" Dependencies")]),t._v(" "),s("p",[t._v("To use "),s("code",[t._v("caliban")]),t._v(", add the following line in your "),s("code",[t._v("build.sbt")]),t._v(" file:")]),t._v(" "),s("div",{staticClass:"language- extra-class"},[s("pre",{pre:!0,attrs:{class:"language-text"}},[s("code",[t._v('libraryDependencies += "com.github.ghostdogpr" %% "caliban" % "0.6.0"\n')])])]),s("p",[t._v("The following modules are optional:")]),t._v(" "),s("div",{staticClass:"language- extra-class"},[s("pre",{pre:!0,attrs:{class:"language-text"}},[s("code",[t._v('libraryDependencies += "com.github.ghostdogpr" %% "caliban-http4s" % "0.6.0" // routes for http4s\nlibraryDependencies += "com.github.ghostdogpr" %% "caliban-akka-http" % "0.6.0" // routes for akka-http\nlibraryDependencies += "com.github.ghostdogpr" %% "caliban-cats" % "0.6.0" // interop with cats effect\nlibraryDependencies += "com.github.ghostdogpr" %% "caliban-monix" % "0.6.0" // interop with monix\n')])])]),s("p",[t._v("Note that Caliban is also available for ScalaJS.")]),t._v(" "),s("h2",{attrs:{id:"a-simple-example"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#a-simple-example"}},[t._v("#")]),t._v(" A simple example")]),t._v(" "),s("p",[t._v("Creating a GraphQL API with Caliban is as simple as creating a case class. Indeed, the whole GraphQL schema will be derived from a case class structure (its fields and the other types it references), and the resolver is just an instance of that case class.")]),t._v(" "),s("p",[t._v("Let's say we have a class "),s("code",[t._v("Character")]),t._v(" and 2 functions: "),s("code",[t._v("getCharacters")]),t._v(" and "),s("code",[t._v("getCharacter")]),t._v(":")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("name"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" age"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" getCharacters"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" getCharacter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("name"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Option"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n")])])]),s("p",[t._v("Let's create a case class named "),s("code",[t._v("Queries")]),t._v(" that will represent our API, with 2 fields named and modeled after the functions we want to expose (a "),s("em",[t._v("record of functions")]),t._v("). We then create a value of this class that calls our actual functions. This is our resolver.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// schema")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" CharacterName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("name"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("characters"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n character"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" CharacterName "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" Option"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// resolver")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" queries "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("getCharacters"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" args "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" getCharacter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("args"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("name"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("The next step is creating our GraphQL API definition. First, we wrap our query resolver inside a "),s("code",[t._v("RootResolver")]),t._v(", the root object that contains queries, mutations and subscriptions. Only queries are mandatory.\nThen we can call the "),s("code",[t._v("graphQL")]),t._v(" function which will turn our simple resolver value into a GraphQL API definition.\nThe whole schema will be derived at compile time, meaning that if it compiles, it will be able to serve it.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("GraphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("graphQL\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("RootResolver\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("RootResolver"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("You can use "),s("code",[t._v("api.render")]),t._v(" to visualize the schema generated, in this case:")]),t._v(" "),s("div",{staticClass:"language-graphql extra-class"},[s("pre",{pre:!0,attrs:{class:"language-graphql"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Character")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("name")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" String"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("age")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" Int"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Queries")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("characters")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("character")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("name")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" String"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" Character\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("In order to process requests, you need to turn your API into an interpreter, which can be done easily by calling "),s("code",[t._v(".interpreter")]),t._v(".\nAn interpreter is a light wrapper around the API definition that allows plugging in some middleware and possibly modifying the environment and error types (see "),s("RouterLink",{attrs:{to:"/docs/middleware.html"}},[t._v("Middleware")]),t._v(" for more info).\nCreating the interpreter may fail with a "),s("code",[t._v("ValidationError")]),t._v(" if some type is found invalid.")],1),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n interpreter "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" api"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("interpreter\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("yield")]),t._v(" interpreter\n")])])]),s("p",[t._v("Now you can call "),s("code",[t._v("interpreter.execute")]),t._v(" with a given GraphQL query, and you will get an "),s("code",[t._v("ZIO[R, Nothing, GraphQLResponse[CalibanError]]")]),t._v(" as a response, with "),s("code",[t._v("GraphQLResponse")]),t._v(" defined as follows:")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" GraphQLResponse"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v("E"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("data"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ResponseValue"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" errors"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("E"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("Use "),s("code",[t._v("ResponseValue#toString")]),t._v(" to get the JSON representation of the result.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" query "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token triple-quoted-string string"}},[t._v('"""\n {\n characters {\n name\n }\n }"""')]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n result "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" interpreter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("execute"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("query"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n _ "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" zio"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("putStrLn"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("result"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("toString"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("yield")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("A "),s("code",[t._v("CalibanError")]),t._v(" can be:")]),t._v(" "),s("ul",[s("li",[t._v("a "),s("code",[t._v("ParsingError")]),t._v(": the query has invalid syntax")]),t._v(" "),s("li",[t._v("a "),s("code",[t._v("ValidationError")]),t._v(": the query was parsed but does not match the schema")]),t._v(" "),s("li",[t._v("an "),s("code",[t._v("ExecutionError")]),t._v(": an error happened while executing the query")])]),t._v(" "),s("p",[t._v("Caliban itself is not tied to any web framework, you are free to expose this function using the protocol and library of your choice. The "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/http4s",target:"_blank",rel:"noopener noreferrer"}},[t._v("caliban-http4s"),s("OutboundLink")],1),t._v(" module provides an "),s("code",[t._v("Http4sAdapter")]),t._v(" that exposes an interpreter over HTTP and WebSocket using http4s. There is also a "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/akka-http",target:"_blank",rel:"noopener noreferrer"}},[t._v("caliban-akka-http"),s("OutboundLink")],1),t._v(" that provides similar functionality for Akka HTTP.")]),t._v(" "),s("div",{staticClass:"custom-block tip"},[s("p",{staticClass:"custom-block-title"},[t._v("Combining GraphQL APIs")]),t._v(" "),s("p",[t._v("You don't have to define all your root fields into a single case class: you can use smaller case classes and combine "),s("code",[t._v("GraphQL")]),t._v(" objects using the "),s("code",[t._v("|+|")]),t._v(" operator.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api1 "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api2 "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" api1 "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),t._v(" api2\n")])])]),s("p",[t._v("You can use "),s("code",[t._v(".rename")]),t._v(" to change the names of the generated root types.")])]),t._v(" "),s("h2",{attrs:{id:"mutations"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#mutations"}},[t._v("#")]),t._v(" Mutations")]),t._v(" "),s("p",[t._v("Creating mutations is the same as queries, except you pass them as the second argument to "),s("code",[t._v("RootResolver")]),t._v(":")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" CharacterArgs"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("name"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Mutations"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("deleteCharacter"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" CharacterArgs "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Boolean")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" mutations "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Mutations"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("RootResolver"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" mutations"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("h2",{attrs:{id:"subscriptions"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#subscriptions"}},[t._v("#")]),t._v(" Subscriptions")]),t._v(" "),s("p",[t._v("Similarly, subscriptions are passed as the third argument to "),s("code",[t._v("RootResolver")]),t._v(":")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Subscriptions"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("deletedCharacter"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZStream"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Nothing")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" subscriptions "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Subscriptions"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("RootResolver"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" mutations"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" subscriptions"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("All the fields of the subscription root case class MUST return "),s("code",[t._v("ZStream")]),t._v(" or "),s("code",[t._v("? => ZStream")]),t._v(" objects. When a subscription request is received, an output stream of "),s("code",[t._v("ResponseValue")]),t._v(" (a "),s("code",[t._v("StreamValue")]),t._v(") will be returned wrapped inside an "),s("code",[t._v("ObjectValue")]),t._v(".")])])}),[],!1,null,null,null);a.default=n.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/7.a06094f2.js b/docs/assets/js/7.a06094f2.js deleted file mode 100644 index 01a31aa88..000000000 --- a/docs/assets/js/7.a06094f2.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[7],{207:function(a,t,s){"use strict";s.r(t);var e=s(0),r=Object(e.a)({},(function(){var a=this,t=a.$createElement,s=a._self._c||t;return s("ContentSlotsDistributor",{attrs:{"slot-key":a.$parent.slotKey}},[s("h1",{attrs:{id:"getting-started"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#getting-started"}},[a._v("#")]),a._v(" Getting Started")]),a._v(" "),s("p",[s("strong",[a._v("Caliban")]),a._v(" is a purely functional library for creating GraphQL backends in Scala.\nIt relies on "),s("a",{attrs:{href:"https://github.com/propensive/magnolia",target:"_blank",rel:"noopener noreferrer"}},[a._v("Magnolia"),s("OutboundLink")],1),a._v(" to automatically derives GraphQL schemas from your data types, "),s("a",{attrs:{href:"https://github.com/lihaoyi/fastparse",target:"_blank",rel:"noopener noreferrer"}},[a._v("Fastparse"),s("OutboundLink")],1),a._v(" to parse queries and "),s("a",{attrs:{href:"https://github.com/zio/zio",target:"_blank",rel:"noopener noreferrer"}},[a._v("ZIO"),s("OutboundLink")],1),a._v(" to handle various effects.")]),a._v(" "),s("p",[a._v("The design principles behind the library are the following:")]),a._v(" "),s("ul",[s("li",[a._v("pure interface: errors and effects are returned explicitly (no exceptions thrown), all returned types are referentially transparent (no "),s("code",[a._v("Future")]),a._v(").")]),a._v(" "),s("li",[a._v("clean separation between schema definition and implementation: schema is defined and validated at compile-time (no reflection) using Scala standard types, resolver is a simple value provided at runtime.")]),a._v(" "),s("li",[a._v("minimal amount of boilerplate: no need to manually define a schema for every type in your API.")])]),a._v(" "),s("h2",{attrs:{id:"dependencies"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#dependencies"}},[a._v("#")]),a._v(" Dependencies")]),a._v(" "),s("p",[a._v("To use "),s("code",[a._v("caliban")]),a._v(", add the following line in your "),s("code",[a._v("build.sbt")]),a._v(" file:")]),a._v(" "),s("div",{staticClass:"language- extra-class"},[s("pre",{pre:!0,attrs:{class:"language-text"}},[s("code",[a._v('libraryDependencies += "com.github.ghostdogpr" %% "caliban" % "0.5.2"\n')])])]),s("p",[a._v("The following modules are optional:")]),a._v(" "),s("div",{staticClass:"language- extra-class"},[s("pre",{pre:!0,attrs:{class:"language-text"}},[s("code",[a._v('libraryDependencies += "com.github.ghostdogpr" %% "caliban-http4s" % "0.5.2" // routes for http4s\nlibraryDependencies += "com.github.ghostdogpr" %% "caliban-akka-http" % "0.5.2" // routes for akka-http\nlibraryDependencies += "com.github.ghostdogpr" %% "caliban-cats" % "0.5.2" // interop with cats effect\nlibraryDependencies += "com.github.ghostdogpr" %% "caliban-monix" % "0.5.2" // interop with monix\n')])])]),s("p",[a._v("Note that Caliban is also available for ScalaJS.")]),a._v(" "),s("h2",{attrs:{id:"a-simple-example"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#a-simple-example"}},[a._v("#")]),a._v(" A simple example")]),a._v(" "),s("p",[a._v("Creating a GraphQL API with Caliban is as simple as creating a case class. Indeed, the whole GraphQL schema will be derived from a case class structure (its fields and the other types it references), and the resolver is just an instance of that case class.")]),a._v(" "),s("p",[a._v("Let's say we have a class "),s("code",[a._v("Character")]),a._v(" and 2 functions: "),s("code",[a._v("getCharacters")]),a._v(" and "),s("code",[a._v("getCharacter")]),a._v(":")]),a._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("case")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("class")]),a._v(" Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("name"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[a._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(",")]),a._v(" age"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[a._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("def")]),a._v(" getCharacters"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),a._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("[")]),a._v("Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("]")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("=")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("?")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("def")]),a._v(" getCharacter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("name"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[a._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),a._v(" Option"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("[")]),a._v("Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("]")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("=")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("?")]),a._v("\n")])])]),s("p",[a._v("Let's create a case class named "),s("code",[a._v("Queries")]),a._v(" that will represent our API, with 2 fields named and modeled after the functions we want to expose (a "),s("em",[a._v("record of functions")]),a._v("). We then create a value of this class that calls our actual functions. This is our resolver.")]),a._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[a._v("// schema")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("case")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("class")]),a._v(" CharacterName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("name"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[a._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("case")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("class")]),a._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("characters"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),a._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("[")]),a._v("Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(",")]),a._v("\n character"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),a._v(" CharacterName "),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("=>")]),a._v(" Option"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("[")]),a._v("Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[a._v("// resolver")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("val")]),a._v(" queries "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("=")]),a._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("getCharacters"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(",")]),a._v(" args "),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("=>")]),a._v(" getCharacter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("args"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("name"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n")])])]),s("p",[a._v("The next step is creating our GraphQL API definition. First, we wrap our query resolver inside a "),s("code",[a._v("RootResolver")]),a._v(", the root object that contains queries, mutations and subscriptions. Only queries are mandatory.\nThen we can call the "),s("code",[a._v("graphQL")]),a._v(" function which will turn our simple resolver value into a GraphQL API definition.\nThe whole schema will be derived at compile time, meaning that if it compiles, it will be able to serve it.")]),a._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("import")]),a._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("GraphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("graphQL\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("import")]),a._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("RootResolver\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("val")]),a._v(" api "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("=")]),a._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("RootResolver"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n")])])]),s("p",[a._v("You can use "),s("code",[a._v("api.render")]),a._v(" to visualize the schema generated, in this case:")]),a._v(" "),s("div",{staticClass:"language-graphql extra-class"},[s("pre",{pre:!0,attrs:{class:"language-graphql"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("type")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("Character")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("{")]),a._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[a._v("name")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(":")]),a._v(" String"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("!")]),a._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[a._v("age")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(":")]),a._v(" Int"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("!")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("}")]),a._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("type")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[a._v("Queries")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("{")]),a._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[a._v("characters")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(":")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("[")]),a._v("Character"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("!")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("]")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("!")]),a._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[a._v("character")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token attr-name"}},[a._v("name")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(":")]),a._v(" String"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("!")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(":")]),a._v(" Character\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("}")]),a._v("\n")])])]),s("p",[a._v("In order to process requests, you need to turn your API into an interpreter, which can be done easily by calling "),s("code",[a._v(".interpreter")]),a._v(".\nAn interpreter is a light wrapper around the API definition that allows plugging in some middleware and possibly modifying the environment and error types (see "),s("RouterLink",{attrs:{to:"/docs/middleware.html"}},[a._v("Middleware")]),a._v(" for more info).")],1),a._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("val")]),a._v(" interpreter "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("=")]),a._v(" api"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("interpreter\n")])])]),s("p",[a._v("Now you can call "),s("code",[a._v("interpreter.execute")]),a._v(" with a given GraphQL query, and you will get an "),s("code",[a._v("ZIO[R, Nothing, GraphQLResponse[CalibanError]]")]),a._v(" as a response, with "),s("code",[a._v("GraphQLResponse")]),a._v(" defined as follows:")]),a._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("case")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("class")]),a._v(" GraphQLResponse"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("[")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("+")]),a._v("E"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("data"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),a._v(" ResponseValue"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(",")]),a._v(" errors"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),a._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("[")]),a._v("E"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n")])])]),s("p",[a._v("Use "),s("code",[a._v("ResponseValue#toString")]),a._v(" to get the JSON representation of the result.")]),a._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("val")]),a._v(" query "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("=")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token triple-quoted-string string"}},[a._v('"""\n {\n characters {\n name\n }\n }"""')]),a._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("for")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("{")]),a._v("\n result "),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("<-")]),a._v(" interpreter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("execute"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("query"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n _ "),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("<-")]),a._v(" zio"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("putStrLn"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("result"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("toString"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("}")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("yield")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n")])])]),s("p",[a._v("A "),s("code",[a._v("CalibanError")]),a._v(" can be:")]),a._v(" "),s("ul",[s("li",[a._v("a "),s("code",[a._v("ParsingError")]),a._v(": the query has invalid syntax")]),a._v(" "),s("li",[a._v("a "),s("code",[a._v("ValidationError")]),a._v(": the query was parsed but does not match the schema")]),a._v(" "),s("li",[a._v("an "),s("code",[a._v("ExecutionError")]),a._v(": an error happened while executing the query")])]),a._v(" "),s("p",[a._v("Caliban itself is not tied to any web framework, you are free to expose this function using the protocol and library of your choice. The "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/http4s",target:"_blank",rel:"noopener noreferrer"}},[a._v("caliban-http4s"),s("OutboundLink")],1),a._v(" module provides an "),s("code",[a._v("Http4sAdapter")]),a._v(" that exposes an interpreter over HTTP and WebSocket using http4s. There is also a "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/akka-http",target:"_blank",rel:"noopener noreferrer"}},[a._v("caliban-akka-http"),s("OutboundLink")],1),a._v(" that provides similar functionality for Akka HTTP.")]),a._v(" "),s("div",{staticClass:"custom-block tip"},[s("p",{staticClass:"custom-block-title"},[a._v("Combining GraphQL APIs")]),a._v(" "),s("p",[a._v("You don't have to define all your root fields into a single case class: you can use smaller case classes and combine "),s("code",[a._v("GraphQL")]),a._v(" objects using the "),s("code",[a._v("|+|")]),a._v(" operator.")]),a._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("val")]),a._v(" api1 "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("=")]),a._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("val")]),a._v(" api2 "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("=")]),a._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("val")]),a._v(" api "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("=")]),a._v(" api1 "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("|")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("+")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("|")]),a._v(" api2\n")])])]),s("p",[a._v("You can use "),s("code",[a._v(".rename")]),a._v(" to change the names of the generated root types.")])]),a._v(" "),s("h2",{attrs:{id:"mutations"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#mutations"}},[a._v("#")]),a._v(" Mutations")]),a._v(" "),s("p",[a._v("Creating mutations is the same as queries, except you pass them as the second argument to "),s("code",[a._v("RootResolver")]),a._v(":")]),a._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("case")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("class")]),a._v(" CharacterArgs"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("name"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[a._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("case")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("class")]),a._v(" Mutations"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("deleteCharacter"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),a._v(" CharacterArgs "),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("=>")]),a._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[a._v("Boolean")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("val")]),a._v(" mutations "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("=")]),a._v(" Mutations"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("?")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("val")]),a._v(" api "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("=")]),a._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("RootResolver"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(",")]),a._v(" mutations"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n")])])]),s("h2",{attrs:{id:"subscriptions"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#subscriptions"}},[a._v("#")]),a._v(" Subscriptions")]),a._v(" "),s("p",[a._v("Similarly, subscriptions are passed as the third argument to "),s("code",[a._v("RootResolver")]),a._v(":")]),a._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("case")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("class")]),a._v(" Subscriptions"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("deletedCharacter"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),a._v(" ZStream"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[a._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(",")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[a._v("Nothing")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(",")]),a._v(" Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("val")]),a._v(" subscriptions "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("=")]),a._v(" Subscriptions"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("?")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("val")]),a._v(" api "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("=")]),a._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("RootResolver"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(",")]),a._v(" mutations"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(",")]),a._v(" subscriptions"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n")])])]),s("p",[a._v("All the fields of the subscription root case class MUST return "),s("code",[a._v("ZStream")]),a._v(" or "),s("code",[a._v("? => ZStream")]),a._v(" objects. When a subscription request is received, an output stream of "),s("code",[a._v("ResponseValue")]),a._v(" (a "),s("code",[a._v("StreamValue")]),a._v(") will be returned wrapped inside an "),s("code",[a._v("ObjectValue")]),a._v(".")])])}),[],!1,null,null,null);t.default=r.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/8.6272775d.js b/docs/assets/js/8.6272775d.js new file mode 100644 index 000000000..cee574a9e --- /dev/null +++ b/docs/assets/js/8.6272775d.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[8],{208:function(t,a,e){"use strict";e.r(a);var s=e(28),n=Object(s.a)({},(function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[e("h1",{attrs:{id:"graphql-client"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#graphql-client"}},[t._v("#")]),t._v(" GraphQL Client")]),t._v(" "),e("p",[e("strong",[t._v("Caliban-client")]),t._v(" is a module independent from Caliban that makes it possible to write GraphQL queries using Scala code in a type-safe and functional fashion. It is built on top of "),e("a",{attrs:{href:"https://github.com/softwaremill/sttp",target:"_blank",rel:"noopener noreferrer"}},[t._v("sttp"),e("OutboundLink")],1),t._v(", which means you can run requests using the backend of your choice.")]),t._v(" "),e("p",[t._v("Just like Caliban, "),e("code",[t._v("caliban-client")]),t._v(" offers a purely functional interface and keeps the boilerplate minimal. It works as follows:")]),t._v(" "),e("ol",[e("li",[t._v("Use the "),e("code",[t._v("caliban-codegen")]),t._v(" tool to generate boilerplate code from a given GraphQL schema")]),t._v(" "),e("li",[t._v("Write your GraphQL query/mutation by combining helpers from the generated code")]),t._v(" "),e("li",[t._v("Transform your query/mutation into an "),e("code",[t._v("sttp")]),t._v(" request and run it with your preferred backend")])]),t._v(" "),e("h2",{attrs:{id:"dependencies"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#dependencies"}},[t._v("#")]),t._v(" Dependencies")]),t._v(" "),e("p",[t._v("To use "),e("code",[t._v("caliban-client")]),t._v(", add the following line in your "),e("code",[t._v("build.sbt")]),t._v(" file:")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v('libraryDependencies += "com.github.ghostdogpr" %% "caliban-client" % "0.6.0"\n')])])]),e("p",[t._v("Caliban-client is available for ScalaJS.")]),t._v(" "),e("h2",{attrs:{id:"code-generation"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#code-generation"}},[t._v("#")]),t._v(" Code generation")]),t._v(" "),e("p",[t._v("The first step for building GraphQL queries with "),e("code",[t._v("caliban-client")]),t._v(" is to generate boilerplate code from a GraphQL schema. For that, you need a file containing your schema (if your backend uses "),e("code",[t._v("caliban")]),t._v(", you can get it by calling "),e("code",[t._v("GraphQL#render")]),t._v(" on your API).")]),t._v(" "),e("p",[t._v("To use this feature, add the "),e("code",[t._v("caliban-codegen")]),t._v(" sbt plugin to your project and enable it.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[t._v("addSbtPlugin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"com.github.ghostdogpr"')]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("%")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"caliban-codegen"')]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("%")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"0.6.0"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\nenablePlugins"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("CodegenPlugin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("p",[t._v("Then call the "),e("code",[t._v("calibanGenClient")]),t._v(" sbt command.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[t._v("calibanGenClient schemaPath outPath "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("scalafmtPath\n\ncalibanGenClient project"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("schema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("graphql src"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("main"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("Client"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("scala\n")])])]),e("p",[t._v("This command will generate a Scala file in "),e("code",[t._v("outputPath")]),t._v(" containing helper functions for all the types defined in the provided GraphQL schema defined at "),e("code",[t._v("schemaPath")]),t._v(". The generated code will be formatted with Scalafmt using the configuration defined by "),e("code",[t._v("scalafmtPath")]),t._v(" (default: "),e("code",[t._v(".scalafmt.conf")]),t._v(").")]),t._v(" "),e("h2",{attrs:{id:"query-building"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#query-building"}},[t._v("#")]),t._v(" Query building")]),t._v(" "),e("p",[t._v("Once the boilerplate code is generated, you can start building queries. For each "),e("em",[t._v("type")]),t._v(" in your schema, a corresponding Scala object has been created. For each "),e("em",[t._v("field")]),t._v(" in your schema, a corresponding Scala function has been created.")]),t._v(" "),e("p",[t._v("For example, given the following schema:")]),t._v(" "),e("div",{staticClass:"language-graphql extra-class"},[e("pre",{pre:!0,attrs:{class:"language-graphql"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Character")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("name")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" String"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("nicknames")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("String"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("origin")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" Origin"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("Your generated code will have the following:")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" Character "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" name"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SelectionBuilder"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" nicknames"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SelectionBuilder"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" origin"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SelectionBuilder"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Origin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("A "),e("code",[t._v("SelectionBuilder[Origin, A]")]),t._v(" is a selection from a parent type "),e("code",[t._v("Origin")]),t._v(" that returns a result of type "),e("code",[t._v("A")]),t._v(". In this example, "),e("code",[t._v("name")]),t._v(" is a selection from a "),e("code",[t._v("Character")]),t._v(" that returns a "),e("code",[t._v("String")]),t._v(".")]),t._v(" "),e("p",[t._v("You can combine multiple selections using the "),e("code",[t._v("~")]),t._v(" operator. The new result type will be a tuple from the 2 combined result types. Note that you can only combine selections that have the same origin.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" selection"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SelectionBuilder"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("name "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("~")]),t._v(" Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("nicknames\n")])])]),e("p",[t._v("If you combine multiple fields, it is more convenient to have a case class to represent your data (to avoid seeing nested tuples). You can use "),e("code",[t._v("mapN")]),t._v(" to map a nested tuple to a case class.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" CharacterView"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("name"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" nickname"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" origin"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Origin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" character"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SelectionBuilder"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" CharacterView"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("name "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("~")]),t._v(" Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("nicknames "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("~")]),t._v(" Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("origin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mapN"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("CharacterView"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("p",[t._v("Fields that return an object type will require an inner selection, which is another "),e("code",[t._v("SelectionBuilder")]),t._v(". Let's consider the following "),e("code",[t._v("Query")]),t._v(" type.")]),t._v(" "),e("div",{staticClass:"language-graphql extra-class"},[e("pre",{pre:!0,attrs:{class:"language-graphql"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Query")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("characters")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("When calling "),e("code",[t._v("characters")]),t._v(", we need to provide a "),e("code",[t._v("SelectionBuilder[Character, ?]")]),t._v(" to indicate which fields to select on the returned "),e("code",[t._v("Character")]),t._v(".")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" query"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SelectionBuilder"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("RootQuery"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("CharacterView"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" \n Query"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("characters "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("name "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("~")]),t._v(" Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("nicknames "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("~")]),t._v(" Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("origin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mapN"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("CharacterView"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("Or if we reuse the "),e("code",[t._v("character")]),t._v(" selection we just created:")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" query"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SelectionBuilder"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("RootQuery"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("CharacterView"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" \n Query"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("characters "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n character\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("Because this is Scala code, you can easily reuse a selection in multiple places without having to worry about GraphQL fragments. The Scala compiler will also make sure that you only combine fields that make sense.")]),t._v(" "),e("p",[t._v("When a field requires an argument, the helper method for the field will require one as well. Let's enrich our query:")]),t._v(" "),e("div",{staticClass:"language-graphql extra-class"},[e("pre",{pre:!0,attrs:{class:"language-graphql"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Query")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("characters")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("origin")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" Origin"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("You now need to provide an "),e("code",[t._v("Origin")]),t._v(" when calling "),e("code",[t._v("characters")]),t._v(":")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" query"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SelectionBuilder"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("RootQuery"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("CharacterView"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" \n Query"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("characters"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("Origin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("MARS"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n character\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("h2",{attrs:{id:"request-execution"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#request-execution"}},[t._v("#")]),t._v(" Request execution")]),t._v(" "),e("p",[t._v("Once your query or mutation is created, it is time to execute it. To do that, you can transform your "),e("code",[t._v("SelectionBuilder")]),t._v(" into an "),e("code",[t._v("sttp")]),t._v(" request by calling "),e("code",[t._v(".toRequest")]),t._v(". This function takes the URL of your GraphQL server and an optional boolean "),e("code",[t._v("useVariables")]),t._v(" that determines if arguments should be using variables or not (default: false).")]),t._v(" "),e("p",[t._v("You can then simply run the "),e("code",[t._v("sttp")]),t._v(" request with the backend of your choice. See the "),e("a",{attrs:{href:"https://sttp.readthedocs.io/en/latest/",target:"_blank",rel:"noopener noreferrer"}},[t._v("sttp docs"),e("OutboundLink")],1),t._v(" if you are not familiar with it.")]),t._v(" "),e("p",[t._v("Here is an example using the "),e("code",[t._v("AsyncHttpClient")]),t._v(" backend for "),e("code",[t._v("ZIO")]),t._v(":")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("sttp"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("client")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("sttp"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("client"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("asynchttpclient"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("zio")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("AsyncHttpClientZioBackend\n\nAsyncHttpClientZioBackend"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("flatMap "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" backend "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" serverUrl "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" uri"),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"http://localhost:8088/api/graphql"')]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" result"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Task"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("CharacterView"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" \n query"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("toRequest"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("serverUrl"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("send"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("map"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("_"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("body"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("absolve\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("As a result, we get a ZIO "),e("code",[t._v("Task")]),t._v(" whose return type is the same as our "),e("code",[t._v("SelectionBuilder")]),t._v(". The sttp request does not only contain the request to send, but also takes care of parsing the response into the expected type.")]),t._v(" "),e("p",[t._v("The "),e("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/examples/",target:"_blank",rel:"noopener noreferrer"}},[t._v("examples"),e("OutboundLink")],1),t._v(" project contains a runnable sample code that queries the example GraphQL backend.")]),t._v(" "),e("div",{staticClass:"custom-block warning"},[e("p",{staticClass:"custom-block-title"},[t._v("Limitations")]),t._v(" "),e("p",[t._v("Only Queries and Mutations are supported. Subscriptions support will be added in the future.\nType extensions are not supported by the codegen tool.")])])])}),[],!1,null,null,null);a.default=n.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/8.abf14876.js b/docs/assets/js/8.abf14876.js deleted file mode 100644 index 2114414c6..000000000 --- a/docs/assets/js/8.abf14876.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[8],{212:function(e,t,r){"use strict";r.r(t);var a=r(0),n=Object(a.a)({},(function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("ContentSlotsDistributor",{attrs:{"slot-key":e.$parent.slotKey}},[r("h1",{attrs:{id:"examples"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#examples"}},[e._v("#")]),e._v(" Examples")]),e._v(" "),r("p",[e._v("A sample project showing how to serve a simple GraphQL schema over HTTP and WebSocket using "),r("a",{attrs:{href:"https://github.com/http4s/http4s",target:"_blank",rel:"noopener noreferrer"}},[e._v("http4s"),r("OutboundLink")],1),e._v(" or "),r("a",{attrs:{href:"https://doc.akka.io/docs/akka-http/current/index.html",target:"_blank",rel:"noopener noreferrer"}},[e._v("Akka HTTP"),r("OutboundLink")],1),e._v(" is available in the "),r("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/examples/",target:"_blank",rel:"noopener noreferrer"}},[e._v("examples"),r("OutboundLink")],1),e._v(" folder.")])])}),[],!1,null,null,null);t.default=n.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/9.417f11bf.js b/docs/assets/js/9.417f11bf.js new file mode 100644 index 000000000..77a886e84 --- /dev/null +++ b/docs/assets/js/9.417f11bf.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[9],{206:function(e,t,r){"use strict";r.r(t);var n=r(28),a=Object(n.a)({},(function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("ContentSlotsDistributor",{attrs:{"slot-key":e.$parent.slotKey}},[r("h1",{attrs:{id:"examples"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#examples"}},[e._v("#")]),e._v(" Examples")]),e._v(" "),r("p",[e._v("A sample project showing how to serve a simple GraphQL schema over HTTP and WebSocket using\n"),r("a",{attrs:{href:"https://github.com/http4s/http4s",target:"_blank",rel:"noopener noreferrer"}},[e._v("http4s"),r("OutboundLink")],1),e._v(" or\n"),r("a",{attrs:{href:"https://doc.akka.io/docs/akka-http/current/index.html",target:"_blank",rel:"noopener noreferrer"}},[e._v("Akka HTTP"),r("OutboundLink")],1),e._v(" or\n"),r("a",{attrs:{href:"https://finagle.github.io/finch/",target:"_blank",rel:"noopener noreferrer"}},[e._v("Finch"),r("OutboundLink")],1),e._v(" is available in\nthe\n"),r("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/examples/",target:"_blank",rel:"noopener noreferrer"}},[e._v("examples"),r("OutboundLink")],1),e._v(" folder.")])])}),[],!1,null,null,null);t.default=a.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/9.9cf833f6.js b/docs/assets/js/9.9cf833f6.js deleted file mode 100644 index d5408ed76..000000000 --- a/docs/assets/js/9.9cf833f6.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[9],{208:function(t,a,s){"use strict";s.r(a);var n=s(0),e=Object(n.a)({},(function(){var t=this,a=t.$createElement,s=t._self._c||a;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"interop-cats-monix"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#interop-cats-monix"}},[t._v("#")]),t._v(" Interop (Cats, Monix)")]),t._v(" "),s("p",[t._v("If you prefer using "),s("a",{attrs:{href:"https://github.com/typelevel/cats-effect",target:"_blank",rel:"noopener noreferrer"}},[t._v("Cats Effect"),s("OutboundLink")],1),t._v(" or "),s("a",{attrs:{href:"https://github.com/monix/monix",target:"_blank",rel:"noopener noreferrer"}},[t._v("Monix"),s("OutboundLink")],1),t._v(" rather than ZIO, you can use the respective "),s("code",[t._v("caliban-cats")]),t._v(" and "),s("code",[t._v("caliban-monix")]),t._v(" modules.")]),t._v(" "),s("h2",{attrs:{id:"cats-effect"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#cats-effect"}},[t._v("#")]),t._v(" Cats Effect")]),t._v(" "),s("p",[t._v("You first need to import "),s("code",[t._v("caliban.interop.cats.implicits._")]),t._v(" and have an implicit "),s("code",[t._v("zio.Runtime")]),t._v(" in scope. Then a few helpers are available:")]),t._v(" "),s("ul",[s("li",[t._v("the GraphQL object is enriched with "),s("code",[t._v("executeAsync")]),t._v(" and "),s("code",[t._v("checkAsync")]),t._v(", variants of "),s("code",[t._v("execute")]),t._v(" and "),s("code",[t._v("check")]),t._v(" that return an "),s("code",[t._v("F[_]: Async")]),t._v(" instead of a "),s("code",[t._v("ZIO")]),t._v(".")]),t._v(" "),s("li",[t._v("the "),s("code",[t._v("Http4sAdapter")]),t._v(" also has cats-effect variants named "),s("code",[t._v("makeRestServiceF")]),t._v(" and "),s("code",[t._v("makeWebSocketServiceF")]),t._v(".")])]),t._v(" "),s("p",[t._v("In addition to that, a "),s("code",[t._v("Schema")]),t._v(" for any "),s("code",[t._v("F[_]: Effect")]),t._v(" is provided. That means you can include fields returning Monix Task for Cats IO in your queries, mutations or subscriptions.")]),t._v(" "),s("p",[t._v("The following example shows how to create an interpreter and run a query while only using Cats IO.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("GraphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("graphQL\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("RootResolver\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("interop"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("cats"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("implicits")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("cats"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("effect")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" ExitCode"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" IOApp "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" zio"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("DefaultRuntime\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" ExampleCatsInterop "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" IOApp "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" runtime "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" DefaultRuntime "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("numbers"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" randomNumber"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" queries "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("2")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("3")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("scala"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("util"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Random"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("nextInt"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" interpreter "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("RootResolver"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("interpreter\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" query "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token triple-quoted-string string"}},[t._v('"""\n {\n numbers\n randomNumber\n }"""')]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("override")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" run"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("args"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("ExitCode"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n result "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" interpreter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("executeAsync"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("query"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n _ "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("println"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("result"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("yield")]),t._v(" ExitCode"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Success\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("You can find this example within the "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/blob/master/examples/src/main/scala/caliban/interop/cats/ExampleCatsInterop.scala",target:"_blank",rel:"noopener noreferrer"}},[t._v("examples"),s("OutboundLink")],1),t._v(" project.")]),t._v(" "),s("h2",{attrs:{id:"monix"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#monix"}},[t._v("#")]),t._v(" Monix")]),t._v(" "),s("p",[t._v("You first need to import "),s("code",[t._v("caliban.interop.monix.implicits._")]),t._v(" and have an implicit "),s("code",[t._v("zio.Runtime")]),t._v(" in scope. Then a few helpers are available:")]),t._v(" "),s("ul",[s("li",[t._v("the GraphQL object is enriched with "),s("code",[t._v("executeAsync")]),t._v(" and "),s("code",[t._v("checkAsync")]),t._v(", variants of "),s("code",[t._v("execute")]),t._v(" and "),s("code",[t._v("check")]),t._v(" that return a Monix "),s("code",[t._v("Task")]),t._v(" instead of a "),s("code",[t._v("ZIO")]),t._v(".")])]),t._v(" "),s("p",[t._v("In addition to that, a "),s("code",[t._v("Schema")]),t._v(" for any Monix "),s("code",[t._v("Task")]),t._v(" as well as "),s("code",[t._v("Observable")]),t._v(" is provided.")]),t._v(" "),s("p",[t._v("The following example shows how to create an interpreter and run a query while only using Monix Task.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("GraphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("graphQL\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("RootResolver\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("interop"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("monix"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("implicits")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("cats"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("effect")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("ExitCode\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("monix"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("eval")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" TaskApp "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("monix"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("execution")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Scheduler\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" zio"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("DefaultRuntime\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" ExampleMonixInterop "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" TaskApp "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" runtime "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" DefaultRuntime "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" monixScheduler"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Scheduler "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" scheduler\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("numbers"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" randomNumber"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" queries "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("2")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("3")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("eval"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("scala"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("util"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Random"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("nextInt"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" interpreter "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("RootResolver"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("interpreter\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" query "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token triple-quoted-string string"}},[t._v('"""\n {\n numbers\n randomNumber\n }"""')]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("override")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" run"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("args"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("ExitCode"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n result "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" interpreter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("executeAsync"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("query"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n _ "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("eval"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("println"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("result"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("yield")]),t._v(" ExitCode"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Success\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("You can find this example within the "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/blob/master/examples/src/main/scala/caliban/interop/monix/ExampleMonixInterop.scala",target:"_blank",rel:"noopener noreferrer"}},[t._v("examples"),s("OutboundLink")],1),t._v(" project.")])])}),[],!1,null,null,null);a.default=e.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/app.098f98e8.js b/docs/assets/js/app.098f98e8.js deleted file mode 100644 index b6a91a024..000000000 --- a/docs/assets/js/app.098f98e8.js +++ /dev/null @@ -1,14 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[0],[]]);!function(t){function e(e){for(var r,a,s=e[0],c=e[1],u=e[2],f=0,p=[];f<s.length;f++)a=s[f],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&p.push(o[a][0]),o[a]=0;for(r in c)Object.prototype.hasOwnProperty.call(c,r)&&(t[r]=c[r]);for(l&&l(e);p.length;)p.shift()();return i.push.apply(i,u||[]),n()}function n(){for(var t,e=0;e<i.length;e++){for(var n=i[e],r=!0,s=1;s<n.length;s++){var c=n[s];0!==o[c]&&(r=!1)}r&&(i.splice(e--,1),t=a(a.s=n[0]))}return t}var r={},o={1:0},i=[];function a(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.e=function(t){var e=[],n=o[t];if(0!==n)if(n)e.push(n[2]);else{var r=new Promise((function(e,r){n=o[t]=[e,r]}));e.push(n[2]=r);var i,s=document.createElement("script");s.charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.src=function(t){return a.p+"assets/js/"+({}[t]||t)+"."+{2:"fa272699",3:"af853996",4:"b0dd307f",5:"e6948aea",6:"e0cf4477",7:"a06094f2",8:"abf14876",9:"9cf833f6",10:"b8fd5856",11:"151b57de",12:"40588870",13:"a0ebd332",14:"fe3db0cd",15:"a58fc205",16:"09e4e2e8"}[t]+".js"}(t);var c=new Error;i=function(e){s.onerror=s.onload=null,clearTimeout(u);var n=o[t];if(0!==n){if(n){var r=e&&("load"===e.type?"missing":e.type),i=e&&e.target&&e.target.src;c.message="Loading chunk "+t+" failed.\n("+r+": "+i+")",c.name="ChunkLoadError",c.type=r,c.request=i,n[1](c)}o[t]=void 0}};var u=setTimeout((function(){i({type:"timeout",target:s})}),12e4);s.onerror=s.onload=i,document.head.appendChild(s)}return Promise.all(e)},a.m=t,a.c=r,a.d=function(t,e,n){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)a.d(n,r,function(e){return t[e]}.bind(null,r));return n},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="/caliban/",a.oe=function(t){throw console.error(t),t};var s=window.webpackJsonp=window.webpackJsonp||[],c=s.push.bind(s);s.push=e,s=s.slice();for(var u=0;u<s.length;u++)e(s[u]);var l=c;i.push([4,0]),n()}([function(t,e,n){"use strict";function r(t,e,n,r,o,i,a,s){var c,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),r&&(u.functional=!0),i&&(u._scopeId="data-v-"+i),a?(c=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},u._ssrRegister=c):o&&(c=s?function(){o.call(this,this.$root.$options.shadowRoot)}:o),c)if(u.functional){u._injectStyles=c;var l=u.render;u.render=function(t,e){return c.call(e),l(t,e)}}else{var f=u.beforeCreate;u.beforeCreate=f?[].concat(f,c):[c]}return{exports:t,options:u}}n.d(e,"a",(function(){return r}))},function(t,e,n){},function(t,e,n){var r,o; -/* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress - * @license MIT */void 0===(o="function"==typeof(r=function(){var t,e,n={version:"0.2.0"},r=n.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'};function o(t,e,n){return t<e?e:t>n?n:t}function i(t){return 100*(-1+t)}n.configure=function(t){var e,n;for(e in t)void 0!==(n=t[e])&&t.hasOwnProperty(e)&&(r[e]=n);return this},n.status=null,n.set=function(t){var e=n.isStarted();t=o(t,r.minimum,1),n.status=1===t?null:t;var c=n.render(!e),u=c.querySelector(r.barSelector),l=r.speed,f=r.easing;return c.offsetWidth,a((function(e){""===r.positionUsing&&(r.positionUsing=n.getPositioningCSS()),s(u,function(t,e,n){var o;return(o="translate3d"===r.positionUsing?{transform:"translate3d("+i(t)+"%,0,0)"}:"translate"===r.positionUsing?{transform:"translate("+i(t)+"%,0)"}:{"margin-left":i(t)+"%"}).transition="all "+e+"ms "+n,o}(t,l,f)),1===t?(s(c,{transition:"none",opacity:1}),c.offsetWidth,setTimeout((function(){s(c,{transition:"all "+l+"ms linear",opacity:0}),setTimeout((function(){n.remove(),e()}),l)}),l)):setTimeout(e,l)})),this},n.isStarted=function(){return"number"==typeof n.status},n.start=function(){n.status||n.set(0);var t=function(){setTimeout((function(){n.status&&(n.trickle(),t())}),r.trickleSpeed)};return r.trickle&&t(),this},n.done=function(t){return t||n.status?n.inc(.3+.5*Math.random()).set(1):this},n.inc=function(t){var e=n.status;return e?("number"!=typeof t&&(t=(1-e)*o(Math.random()*e,.1,.95)),e=o(e+t,0,.994),n.set(e)):n.start()},n.trickle=function(){return n.inc(Math.random()*r.trickleRate)},t=0,e=0,n.promise=function(r){return r&&"resolved"!==r.state()?(0===e&&n.start(),t++,e++,r.always((function(){0==--e?(t=0,n.done()):n.set((t-e)/t)})),this):this},n.render=function(t){if(n.isRendered())return document.getElementById("nprogress");u(document.documentElement,"nprogress-busy");var e=document.createElement("div");e.id="nprogress",e.innerHTML=r.template;var o,a=e.querySelector(r.barSelector),c=t?"-100":i(n.status||0),l=document.querySelector(r.parent);return s(a,{transition:"all 0 linear",transform:"translate3d("+c+"%,0,0)"}),r.showSpinner||(o=e.querySelector(r.spinnerSelector))&&p(o),l!=document.body&&u(l,"nprogress-custom-parent"),l.appendChild(e),e},n.remove=function(){l(document.documentElement,"nprogress-busy"),l(document.querySelector(r.parent),"nprogress-custom-parent");var t=document.getElementById("nprogress");t&&p(t)},n.isRendered=function(){return!!document.getElementById("nprogress")},n.getPositioningCSS=function(){var t=document.body.style,e="WebkitTransform"in t?"Webkit":"MozTransform"in t?"Moz":"msTransform"in t?"ms":"OTransform"in t?"O":"";return e+"Perspective"in t?"translate3d":e+"Transform"in t?"translate":"margin"};var a=function(){var t=[];function e(){var n=t.shift();n&&n(e)}return function(n){t.push(n),1==t.length&&e()}}(),s=function(){var t=["Webkit","O","Moz","ms"],e={};function n(n){return n=n.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,(function(t,e){return e.toUpperCase()})),e[n]||(e[n]=function(e){var n=document.body.style;if(e in n)return e;for(var r,o=t.length,i=e.charAt(0).toUpperCase()+e.slice(1);o--;)if((r=t[o]+i)in n)return r;return e}(n))}function r(t,e,r){e=n(e),t.style[e]=r}return function(t,e){var n,o,i=arguments;if(2==i.length)for(n in e)void 0!==(o=e[n])&&e.hasOwnProperty(n)&&r(t,n,o);else r(t,i[1],i[2])}}();function c(t,e){return("string"==typeof t?t:f(t)).indexOf(" "+e+" ")>=0}function u(t,e){var n=f(t),r=n+e;c(n,e)||(t.className=r.substring(1))}function l(t,e){var n,r=f(t);c(t,e)&&(n=r.replace(" "+e+" "," "),t.className=n.substring(1,n.length-1))}function f(t){return(" "+(t.className||"")+" ").replace(/\s+/gi," ")}function p(t){t&&t.parentNode&&t.parentNode.removeChild(t)}return n})?r.call(e,n,e,t):r)||(t.exports=o)},function(t,e){var n=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt,s="object"==typeof global&&global&&global.Object===Object&&global,c="object"==typeof self&&self&&self.Object===Object&&self,u=s||c||Function("return this")(),l=Object.prototype.toString,f=Math.max,p=Math.min,d=function(){return u.Date.now()};function h(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function v(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==l.call(t)}(t))return NaN;if(h(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=h(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(n,"");var s=o.test(t);return s||i.test(t)?a(t.slice(2),s?2:8):r.test(t)?NaN:+t}t.exports=function(t,e,n){var r,o,i,a,s,c,u=0,l=!1,m=!1,y=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function g(e){var n=r,i=o;return r=o=void 0,u=e,a=t.apply(i,n)}function b(t){return u=t,s=setTimeout(w,e),l?g(t):a}function _(t){var n=t-c;return void 0===c||n>=e||n<0||m&&t-u>=i}function w(){var t=d();if(_(t))return $(t);s=setTimeout(w,function(t){var n=e-(t-c);return m?p(n,i-(t-u)):n}(t))}function $(t){return s=void 0,y&&r?g(t):(r=o=void 0,a)}function C(){var t=d(),n=_(t);if(r=arguments,o=this,c=t,n){if(void 0===s)return b(c);if(m)return s=setTimeout(w,e),g(c)}return void 0===s&&(s=setTimeout(w,e)),a}return e=v(e)||0,h(n)&&(l=!!n.leading,i=(m="maxWait"in n)?f(v(n.maxWait)||0,e):i,y="trailing"in n?!!n.trailing:y),C.cancel=function(){void 0!==s&&clearTimeout(s),u=0,r=c=o=s=void 0},C.flush=function(){return void 0===s?a:$(d())},C}},function(t,e,n){t.exports=n(8)},function(t,e,n){Promise.all([n.e(0),n.e(16)]).then(n.t.bind(null,9,7))},function(t,e,n){},function(t,e,n){"use strict";var r=n(1);n.n(r).a},function(t,e,n){"use strict";n.r(e); -/*! - * Vue.js v2.6.11 - * (c) 2014-2019 Evan You - * Released under the MIT License. - */ -var r=Object.freeze({});function o(t){return null==t}function i(t){return null!=t}function a(t){return!0===t}function s(t){return"string"==typeof t||"number"==typeof t||"symbol"==typeof t||"boolean"==typeof t}function c(t){return null!==t&&"object"==typeof t}var u=Object.prototype.toString;function l(t){return"[object Object]"===u.call(t)}function f(t){return"[object RegExp]"===u.call(t)}function p(t){var e=parseFloat(String(t));return e>=0&&Math.floor(e)===e&&isFinite(t)}function d(t){return i(t)&&"function"==typeof t.then&&"function"==typeof t.catch}function h(t){return null==t?"":Array.isArray(t)||l(t)&&t.toString===u?JSON.stringify(t,null,2):String(t)}function v(t){var e=parseFloat(t);return isNaN(e)?t:e}function m(t,e){for(var n=Object.create(null),r=t.split(","),o=0;o<r.length;o++)n[r[o]]=!0;return e?function(t){return n[t.toLowerCase()]}:function(t){return n[t]}}m("slot,component",!0);var y=m("key,ref,slot,slot-scope,is");function g(t,e){if(t.length){var n=t.indexOf(e);if(n>-1)return t.splice(n,1)}}var b=Object.prototype.hasOwnProperty;function _(t,e){return b.call(t,e)}function w(t){var e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}var $=/-(\w)/g,C=w((function(t){return t.replace($,(function(t,e){return e?e.toUpperCase():""}))})),x=w((function(t){return t.charAt(0).toUpperCase()+t.slice(1)})),k=/\B([A-Z])/g,A=w((function(t){return t.replace(k,"-$1").toLowerCase()}));var O=Function.prototype.bind?function(t,e){return t.bind(e)}:function(t,e){function n(n){var r=arguments.length;return r?r>1?t.apply(e,arguments):t.call(e,n):t.call(e)}return n._length=t.length,n};function S(t,e){e=e||0;for(var n=t.length-e,r=new Array(n);n--;)r[n]=t[n+e];return r}function E(t,e){for(var n in e)t[n]=e[n];return t}function j(t){for(var e={},n=0;n<t.length;n++)t[n]&&E(e,t[n]);return e}function T(t,e,n){}var P=function(t,e,n){return!1},R=function(t){return t};function L(t,e){if(t===e)return!0;var n=c(t),r=c(e);if(!n||!r)return!n&&!r&&String(t)===String(e);try{var o=Array.isArray(t),i=Array.isArray(e);if(o&&i)return t.length===e.length&&t.every((function(t,n){return L(t,e[n])}));if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();if(o||i)return!1;var a=Object.keys(t),s=Object.keys(e);return a.length===s.length&&a.every((function(n){return L(t[n],e[n])}))}catch(t){return!1}}function I(t,e){for(var n=0;n<t.length;n++)if(L(t[n],e))return n;return-1}function M(t){var e=!1;return function(){e||(e=!0,t.apply(this,arguments))}}var D=["component","directive","filter"],N=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeDestroy","destroyed","activated","deactivated","errorCaptured","serverPrefetch"],U={optionMergeStrategies:Object.create(null),silent:!1,productionTip:!1,devtools:!1,performance:!1,errorHandler:null,warnHandler:null,ignoredElements:[],keyCodes:Object.create(null),isReservedTag:P,isReservedAttr:P,isUnknownElement:P,getTagNamespace:T,parsePlatformTagName:R,mustUseProp:P,async:!0,_lifecycleHooks:N},F=/a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;function B(t,e,n,r){Object.defineProperty(t,e,{value:n,enumerable:!!r,writable:!0,configurable:!0})}var V=new RegExp("[^"+F.source+".$_\\d]");var z,q="__proto__"in{},H="undefined"!=typeof window,W="undefined"!=typeof WXEnvironment&&!!WXEnvironment.platform,K=W&&WXEnvironment.platform.toLowerCase(),G=H&&window.navigator.userAgent.toLowerCase(),X=G&&/msie|trident/.test(G),Q=G&&G.indexOf("msie 9.0")>0,Z=G&&G.indexOf("edge/")>0,J=(G&&G.indexOf("android"),G&&/iphone|ipad|ipod|ios/.test(G)||"ios"===K),Y=(G&&/chrome\/\d+/.test(G),G&&/phantomjs/.test(G),G&&G.match(/firefox\/(\d+)/)),tt={}.watch,et=!1;if(H)try{var nt={};Object.defineProperty(nt,"passive",{get:function(){et=!0}}),window.addEventListener("test-passive",null,nt)}catch(t){}var rt=function(){return void 0===z&&(z=!H&&!W&&"undefined"!=typeof global&&(global.process&&"server"===global.process.env.VUE_ENV)),z},ot=H&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function it(t){return"function"==typeof t&&/native code/.test(t.toString())}var at,st="undefined"!=typeof Symbol&&it(Symbol)&&"undefined"!=typeof Reflect&&it(Reflect.ownKeys);at="undefined"!=typeof Set&&it(Set)?Set:function(){function t(){this.set=Object.create(null)}return t.prototype.has=function(t){return!0===this.set[t]},t.prototype.add=function(t){this.set[t]=!0},t.prototype.clear=function(){this.set=Object.create(null)},t}();var ct=T,ut=0,lt=function(){this.id=ut++,this.subs=[]};lt.prototype.addSub=function(t){this.subs.push(t)},lt.prototype.removeSub=function(t){g(this.subs,t)},lt.prototype.depend=function(){lt.target&<.target.addDep(this)},lt.prototype.notify=function(){var t=this.subs.slice();for(var e=0,n=t.length;e<n;e++)t[e].update()},lt.target=null;var ft=[];function pt(t){ft.push(t),lt.target=t}function dt(){ft.pop(),lt.target=ft[ft.length-1]}var ht=function(t,e,n,r,o,i,a,s){this.tag=t,this.data=e,this.children=n,this.text=r,this.elm=o,this.ns=void 0,this.context=i,this.fnContext=void 0,this.fnOptions=void 0,this.fnScopeId=void 0,this.key=e&&e.key,this.componentOptions=a,this.componentInstance=void 0,this.parent=void 0,this.raw=!1,this.isStatic=!1,this.isRootInsert=!0,this.isComment=!1,this.isCloned=!1,this.isOnce=!1,this.asyncFactory=s,this.asyncMeta=void 0,this.isAsyncPlaceholder=!1},vt={child:{configurable:!0}};vt.child.get=function(){return this.componentInstance},Object.defineProperties(ht.prototype,vt);var mt=function(t){void 0===t&&(t="");var e=new ht;return e.text=t,e.isComment=!0,e};function yt(t){return new ht(void 0,void 0,void 0,String(t))}function gt(t){var e=new ht(t.tag,t.data,t.children&&t.children.slice(),t.text,t.elm,t.context,t.componentOptions,t.asyncFactory);return e.ns=t.ns,e.isStatic=t.isStatic,e.key=t.key,e.isComment=t.isComment,e.fnContext=t.fnContext,e.fnOptions=t.fnOptions,e.fnScopeId=t.fnScopeId,e.asyncMeta=t.asyncMeta,e.isCloned=!0,e}var bt=Array.prototype,_t=Object.create(bt);["push","pop","shift","unshift","splice","sort","reverse"].forEach((function(t){var e=bt[t];B(_t,t,(function(){for(var n=[],r=arguments.length;r--;)n[r]=arguments[r];var o,i=e.apply(this,n),a=this.__ob__;switch(t){case"push":case"unshift":o=n;break;case"splice":o=n.slice(2)}return o&&a.observeArray(o),a.dep.notify(),i}))}));var wt=Object.getOwnPropertyNames(_t),$t=!0;function Ct(t){$t=t}var xt=function(t){this.value=t,this.dep=new lt,this.vmCount=0,B(t,"__ob__",this),Array.isArray(t)?(q?function(t,e){t.__proto__=e}(t,_t):function(t,e,n){for(var r=0,o=n.length;r<o;r++){var i=n[r];B(t,i,e[i])}}(t,_t,wt),this.observeArray(t)):this.walk(t)};function kt(t,e){var n;if(c(t)&&!(t instanceof ht))return _(t,"__ob__")&&t.__ob__ instanceof xt?n=t.__ob__:$t&&!rt()&&(Array.isArray(t)||l(t))&&Object.isExtensible(t)&&!t._isVue&&(n=new xt(t)),e&&n&&n.vmCount++,n}function At(t,e,n,r,o){var i=new lt,a=Object.getOwnPropertyDescriptor(t,e);if(!a||!1!==a.configurable){var s=a&&a.get,c=a&&a.set;s&&!c||2!==arguments.length||(n=t[e]);var u=!o&&kt(n);Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:function(){var e=s?s.call(t):n;return lt.target&&(i.depend(),u&&(u.dep.depend(),Array.isArray(e)&&Et(e))),e},set:function(e){var r=s?s.call(t):n;e===r||e!=e&&r!=r||s&&!c||(c?c.call(t,e):n=e,u=!o&&kt(e),i.notify())}})}}function Ot(t,e,n){if(Array.isArray(t)&&p(e))return t.length=Math.max(t.length,e),t.splice(e,1,n),n;if(e in t&&!(e in Object.prototype))return t[e]=n,n;var r=t.__ob__;return t._isVue||r&&r.vmCount?n:r?(At(r.value,e,n),r.dep.notify(),n):(t[e]=n,n)}function St(t,e){if(Array.isArray(t)&&p(e))t.splice(e,1);else{var n=t.__ob__;t._isVue||n&&n.vmCount||_(t,e)&&(delete t[e],n&&n.dep.notify())}}function Et(t){for(var e=void 0,n=0,r=t.length;n<r;n++)(e=t[n])&&e.__ob__&&e.__ob__.dep.depend(),Array.isArray(e)&&Et(e)}xt.prototype.walk=function(t){for(var e=Object.keys(t),n=0;n<e.length;n++)At(t,e[n])},xt.prototype.observeArray=function(t){for(var e=0,n=t.length;e<n;e++)kt(t[e])};var jt=U.optionMergeStrategies;function Tt(t,e){if(!e)return t;for(var n,r,o,i=st?Reflect.ownKeys(e):Object.keys(e),a=0;a<i.length;a++)"__ob__"!==(n=i[a])&&(r=t[n],o=e[n],_(t,n)?r!==o&&l(r)&&l(o)&&Tt(r,o):Ot(t,n,o));return t}function Pt(t,e,n){return n?function(){var r="function"==typeof e?e.call(n,n):e,o="function"==typeof t?t.call(n,n):t;return r?Tt(r,o):o}:e?t?function(){return Tt("function"==typeof e?e.call(this,this):e,"function"==typeof t?t.call(this,this):t)}:e:t}function Rt(t,e){var n=e?t?t.concat(e):Array.isArray(e)?e:[e]:t;return n?function(t){for(var e=[],n=0;n<t.length;n++)-1===e.indexOf(t[n])&&e.push(t[n]);return e}(n):n}function Lt(t,e,n,r){var o=Object.create(t||null);return e?E(o,e):o}jt.data=function(t,e,n){return n?Pt(t,e,n):e&&"function"!=typeof e?t:Pt(t,e)},N.forEach((function(t){jt[t]=Rt})),D.forEach((function(t){jt[t+"s"]=Lt})),jt.watch=function(t,e,n,r){if(t===tt&&(t=void 0),e===tt&&(e=void 0),!e)return Object.create(t||null);if(!t)return e;var o={};for(var i in E(o,t),e){var a=o[i],s=e[i];a&&!Array.isArray(a)&&(a=[a]),o[i]=a?a.concat(s):Array.isArray(s)?s:[s]}return o},jt.props=jt.methods=jt.inject=jt.computed=function(t,e,n,r){if(!t)return e;var o=Object.create(null);return E(o,t),e&&E(o,e),o},jt.provide=Pt;var It=function(t,e){return void 0===e?t:e};function Mt(t,e,n){if("function"==typeof e&&(e=e.options),function(t,e){var n=t.props;if(n){var r,o,i={};if(Array.isArray(n))for(r=n.length;r--;)"string"==typeof(o=n[r])&&(i[C(o)]={type:null});else if(l(n))for(var a in n)o=n[a],i[C(a)]=l(o)?o:{type:o};else 0;t.props=i}}(e),function(t,e){var n=t.inject;if(n){var r=t.inject={};if(Array.isArray(n))for(var o=0;o<n.length;o++)r[n[o]]={from:n[o]};else if(l(n))for(var i in n){var a=n[i];r[i]=l(a)?E({from:i},a):{from:a}}else 0}}(e),function(t){var e=t.directives;if(e)for(var n in e){var r=e[n];"function"==typeof r&&(e[n]={bind:r,update:r})}}(e),!e._base&&(e.extends&&(t=Mt(t,e.extends,n)),e.mixins))for(var r=0,o=e.mixins.length;r<o;r++)t=Mt(t,e.mixins[r],n);var i,a={};for(i in t)s(i);for(i in e)_(t,i)||s(i);function s(r){var o=jt[r]||It;a[r]=o(t[r],e[r],n,r)}return a}function Dt(t,e,n,r){if("string"==typeof n){var o=t[e];if(_(o,n))return o[n];var i=C(n);if(_(o,i))return o[i];var a=x(i);return _(o,a)?o[a]:o[n]||o[i]||o[a]}}function Nt(t,e,n,r){var o=e[t],i=!_(n,t),a=n[t],s=Bt(Boolean,o.type);if(s>-1)if(i&&!_(o,"default"))a=!1;else if(""===a||a===A(t)){var c=Bt(String,o.type);(c<0||s<c)&&(a=!0)}if(void 0===a){a=function(t,e,n){if(!_(e,"default"))return;var r=e.default;0;if(t&&t.$options.propsData&&void 0===t.$options.propsData[n]&&void 0!==t._props[n])return t._props[n];return"function"==typeof r&&"Function"!==Ut(e.type)?r.call(t):r}(r,o,t);var u=$t;Ct(!0),kt(a),Ct(u)}return a}function Ut(t){var e=t&&t.toString().match(/^\s*function (\w+)/);return e?e[1]:""}function Ft(t,e){return Ut(t)===Ut(e)}function Bt(t,e){if(!Array.isArray(e))return Ft(e,t)?0:-1;for(var n=0,r=e.length;n<r;n++)if(Ft(e[n],t))return n;return-1}function Vt(t,e,n){pt();try{if(e)for(var r=e;r=r.$parent;){var o=r.$options.errorCaptured;if(o)for(var i=0;i<o.length;i++)try{if(!1===o[i].call(r,t,e,n))return}catch(t){qt(t,r,"errorCaptured hook")}}qt(t,e,n)}finally{dt()}}function zt(t,e,n,r,o){var i;try{(i=n?t.apply(e,n):t.call(e))&&!i._isVue&&d(i)&&!i._handled&&(i.catch((function(t){return Vt(t,r,o+" (Promise/async)")})),i._handled=!0)}catch(t){Vt(t,r,o)}return i}function qt(t,e,n){if(U.errorHandler)try{return U.errorHandler.call(null,t,e,n)}catch(e){e!==t&&Ht(e,null,"config.errorHandler")}Ht(t,e,n)}function Ht(t,e,n){if(!H&&!W||"undefined"==typeof console)throw t;console.error(t)}var Wt,Kt=!1,Gt=[],Xt=!1;function Qt(){Xt=!1;var t=Gt.slice(0);Gt.length=0;for(var e=0;e<t.length;e++)t[e]()}if("undefined"!=typeof Promise&&it(Promise)){var Zt=Promise.resolve();Wt=function(){Zt.then(Qt),J&&setTimeout(T)},Kt=!0}else if(X||"undefined"==typeof MutationObserver||!it(MutationObserver)&&"[object MutationObserverConstructor]"!==MutationObserver.toString())Wt="undefined"!=typeof setImmediate&&it(setImmediate)?function(){setImmediate(Qt)}:function(){setTimeout(Qt,0)};else{var Jt=1,Yt=new MutationObserver(Qt),te=document.createTextNode(String(Jt));Yt.observe(te,{characterData:!0}),Wt=function(){Jt=(Jt+1)%2,te.data=String(Jt)},Kt=!0}function ee(t,e){var n;if(Gt.push((function(){if(t)try{t.call(e)}catch(t){Vt(t,e,"nextTick")}else n&&n(e)})),Xt||(Xt=!0,Wt()),!t&&"undefined"!=typeof Promise)return new Promise((function(t){n=t}))}var ne=new at;function re(t){!function t(e,n){var r,o,i=Array.isArray(e);if(!i&&!c(e)||Object.isFrozen(e)||e instanceof ht)return;if(e.__ob__){var a=e.__ob__.dep.id;if(n.has(a))return;n.add(a)}if(i)for(r=e.length;r--;)t(e[r],n);else for(o=Object.keys(e),r=o.length;r--;)t(e[o[r]],n)}(t,ne),ne.clear()}var oe=w((function(t){var e="&"===t.charAt(0),n="~"===(t=e?t.slice(1):t).charAt(0),r="!"===(t=n?t.slice(1):t).charAt(0);return{name:t=r?t.slice(1):t,once:n,capture:r,passive:e}}));function ie(t,e){function n(){var t=arguments,r=n.fns;if(!Array.isArray(r))return zt(r,null,arguments,e,"v-on handler");for(var o=r.slice(),i=0;i<o.length;i++)zt(o[i],null,t,e,"v-on handler")}return n.fns=t,n}function ae(t,e,n,r,i,s){var c,u,l,f;for(c in t)u=t[c],l=e[c],f=oe(c),o(u)||(o(l)?(o(u.fns)&&(u=t[c]=ie(u,s)),a(f.once)&&(u=t[c]=i(f.name,u,f.capture)),n(f.name,u,f.capture,f.passive,f.params)):u!==l&&(l.fns=u,t[c]=l));for(c in e)o(t[c])&&r((f=oe(c)).name,e[c],f.capture)}function se(t,e,n){var r;t instanceof ht&&(t=t.data.hook||(t.data.hook={}));var s=t[e];function c(){n.apply(this,arguments),g(r.fns,c)}o(s)?r=ie([c]):i(s.fns)&&a(s.merged)?(r=s).fns.push(c):r=ie([s,c]),r.merged=!0,t[e]=r}function ce(t,e,n,r,o){if(i(e)){if(_(e,n))return t[n]=e[n],o||delete e[n],!0;if(_(e,r))return t[n]=e[r],o||delete e[r],!0}return!1}function ue(t){return s(t)?[yt(t)]:Array.isArray(t)?function t(e,n){var r,c,u,l,f=[];for(r=0;r<e.length;r++)o(c=e[r])||"boolean"==typeof c||(u=f.length-1,l=f[u],Array.isArray(c)?c.length>0&&(le((c=t(c,(n||"")+"_"+r))[0])&&le(l)&&(f[u]=yt(l.text+c[0].text),c.shift()),f.push.apply(f,c)):s(c)?le(l)?f[u]=yt(l.text+c):""!==c&&f.push(yt(c)):le(c)&&le(l)?f[u]=yt(l.text+c.text):(a(e._isVList)&&i(c.tag)&&o(c.key)&&i(n)&&(c.key="__vlist"+n+"_"+r+"__"),f.push(c)));return f}(t):void 0}function le(t){return i(t)&&i(t.text)&&!1===t.isComment}function fe(t,e){if(t){for(var n=Object.create(null),r=st?Reflect.ownKeys(t):Object.keys(t),o=0;o<r.length;o++){var i=r[o];if("__ob__"!==i){for(var a=t[i].from,s=e;s;){if(s._provided&&_(s._provided,a)){n[i]=s._provided[a];break}s=s.$parent}if(!s)if("default"in t[i]){var c=t[i].default;n[i]="function"==typeof c?c.call(e):c}else 0}}return n}}function pe(t,e){if(!t||!t.length)return{};for(var n={},r=0,o=t.length;r<o;r++){var i=t[r],a=i.data;if(a&&a.attrs&&a.attrs.slot&&delete a.attrs.slot,i.context!==e&&i.fnContext!==e||!a||null==a.slot)(n.default||(n.default=[])).push(i);else{var s=a.slot,c=n[s]||(n[s]=[]);"template"===i.tag?c.push.apply(c,i.children||[]):c.push(i)}}for(var u in n)n[u].every(de)&&delete n[u];return n}function de(t){return t.isComment&&!t.asyncFactory||" "===t.text}function he(t,e,n){var o,i=Object.keys(e).length>0,a=t?!!t.$stable:!i,s=t&&t.$key;if(t){if(t._normalized)return t._normalized;if(a&&n&&n!==r&&s===n.$key&&!i&&!n.$hasNormal)return n;for(var c in o={},t)t[c]&&"$"!==c[0]&&(o[c]=ve(e,c,t[c]))}else o={};for(var u in e)u in o||(o[u]=me(e,u));return t&&Object.isExtensible(t)&&(t._normalized=o),B(o,"$stable",a),B(o,"$key",s),B(o,"$hasNormal",i),o}function ve(t,e,n){var r=function(){var t=arguments.length?n.apply(null,arguments):n({});return(t=t&&"object"==typeof t&&!Array.isArray(t)?[t]:ue(t))&&(0===t.length||1===t.length&&t[0].isComment)?void 0:t};return n.proxy&&Object.defineProperty(t,e,{get:r,enumerable:!0,configurable:!0}),r}function me(t,e){return function(){return t[e]}}function ye(t,e){var n,r,o,a,s;if(Array.isArray(t)||"string"==typeof t)for(n=new Array(t.length),r=0,o=t.length;r<o;r++)n[r]=e(t[r],r);else if("number"==typeof t)for(n=new Array(t),r=0;r<t;r++)n[r]=e(r+1,r);else if(c(t))if(st&&t[Symbol.iterator]){n=[];for(var u=t[Symbol.iterator](),l=u.next();!l.done;)n.push(e(l.value,n.length)),l=u.next()}else for(a=Object.keys(t),n=new Array(a.length),r=0,o=a.length;r<o;r++)s=a[r],n[r]=e(t[s],s,r);return i(n)||(n=[]),n._isVList=!0,n}function ge(t,e,n,r){var o,i=this.$scopedSlots[t];i?(n=n||{},r&&(n=E(E({},r),n)),o=i(n)||e):o=this.$slots[t]||e;var a=n&&n.slot;return a?this.$createElement("template",{slot:a},o):o}function be(t){return Dt(this.$options,"filters",t)||R}function _e(t,e){return Array.isArray(t)?-1===t.indexOf(e):t!==e}function we(t,e,n,r,o){var i=U.keyCodes[e]||n;return o&&r&&!U.keyCodes[e]?_e(o,r):i?_e(i,t):r?A(r)!==e:void 0}function $e(t,e,n,r,o){if(n)if(c(n)){var i;Array.isArray(n)&&(n=j(n));var a=function(a){if("class"===a||"style"===a||y(a))i=t;else{var s=t.attrs&&t.attrs.type;i=r||U.mustUseProp(e,s,a)?t.domProps||(t.domProps={}):t.attrs||(t.attrs={})}var c=C(a),u=A(a);c in i||u in i||(i[a]=n[a],o&&((t.on||(t.on={}))["update:"+a]=function(t){n[a]=t}))};for(var s in n)a(s)}else;return t}function Ce(t,e){var n=this._staticTrees||(this._staticTrees=[]),r=n[t];return r&&!e?r:(ke(r=n[t]=this.$options.staticRenderFns[t].call(this._renderProxy,null,this),"__static__"+t,!1),r)}function xe(t,e,n){return ke(t,"__once__"+e+(n?"_"+n:""),!0),t}function ke(t,e,n){if(Array.isArray(t))for(var r=0;r<t.length;r++)t[r]&&"string"!=typeof t[r]&&Ae(t[r],e+"_"+r,n);else Ae(t,e,n)}function Ae(t,e,n){t.isStatic=!0,t.key=e,t.isOnce=n}function Oe(t,e){if(e)if(l(e)){var n=t.on=t.on?E({},t.on):{};for(var r in e){var o=n[r],i=e[r];n[r]=o?[].concat(o,i):i}}else;return t}function Se(t,e,n,r){e=e||{$stable:!n};for(var o=0;o<t.length;o++){var i=t[o];Array.isArray(i)?Se(i,e,n):i&&(i.proxy&&(i.fn.proxy=!0),e[i.key]=i.fn)}return r&&(e.$key=r),e}function Ee(t,e){for(var n=0;n<e.length;n+=2){var r=e[n];"string"==typeof r&&r&&(t[e[n]]=e[n+1])}return t}function je(t,e){return"string"==typeof t?e+t:t}function Te(t){t._o=xe,t._n=v,t._s=h,t._l=ye,t._t=ge,t._q=L,t._i=I,t._m=Ce,t._f=be,t._k=we,t._b=$e,t._v=yt,t._e=mt,t._u=Se,t._g=Oe,t._d=Ee,t._p=je}function Pe(t,e,n,o,i){var s,c=this,u=i.options;_(o,"_uid")?(s=Object.create(o))._original=o:(s=o,o=o._original);var l=a(u._compiled),f=!l;this.data=t,this.props=e,this.children=n,this.parent=o,this.listeners=t.on||r,this.injections=fe(u.inject,o),this.slots=function(){return c.$slots||he(t.scopedSlots,c.$slots=pe(n,o)),c.$slots},Object.defineProperty(this,"scopedSlots",{enumerable:!0,get:function(){return he(t.scopedSlots,this.slots())}}),l&&(this.$options=u,this.$slots=this.slots(),this.$scopedSlots=he(t.scopedSlots,this.$slots)),u._scopeId?this._c=function(t,e,n,r){var i=Ue(s,t,e,n,r,f);return i&&!Array.isArray(i)&&(i.fnScopeId=u._scopeId,i.fnContext=o),i}:this._c=function(t,e,n,r){return Ue(s,t,e,n,r,f)}}function Re(t,e,n,r,o){var i=gt(t);return i.fnContext=n,i.fnOptions=r,e.slot&&((i.data||(i.data={})).slot=e.slot),i}function Le(t,e){for(var n in e)t[C(n)]=e[n]}Te(Pe.prototype);var Ie={init:function(t,e){if(t.componentInstance&&!t.componentInstance._isDestroyed&&t.data.keepAlive){var n=t;Ie.prepatch(n,n)}else{(t.componentInstance=function(t,e){var n={_isComponent:!0,_parentVnode:t,parent:e},r=t.data.inlineTemplate;i(r)&&(n.render=r.render,n.staticRenderFns=r.staticRenderFns);return new t.componentOptions.Ctor(n)}(t,Xe)).$mount(e?t.elm:void 0,e)}},prepatch:function(t,e){var n=e.componentOptions;!function(t,e,n,o,i){0;var a=o.data.scopedSlots,s=t.$scopedSlots,c=!!(a&&!a.$stable||s!==r&&!s.$stable||a&&t.$scopedSlots.$key!==a.$key),u=!!(i||t.$options._renderChildren||c);t.$options._parentVnode=o,t.$vnode=o,t._vnode&&(t._vnode.parent=o);if(t.$options._renderChildren=i,t.$attrs=o.data.attrs||r,t.$listeners=n||r,e&&t.$options.props){Ct(!1);for(var l=t._props,f=t.$options._propKeys||[],p=0;p<f.length;p++){var d=f[p],h=t.$options.props;l[d]=Nt(d,h,e,t)}Ct(!0),t.$options.propsData=e}n=n||r;var v=t.$options._parentListeners;t.$options._parentListeners=n,Ge(t,n,v),u&&(t.$slots=pe(i,o.context),t.$forceUpdate());0}(e.componentInstance=t.componentInstance,n.propsData,n.listeners,e,n.children)},insert:function(t){var e,n=t.context,r=t.componentInstance;r._isMounted||(r._isMounted=!0,Ye(r,"mounted")),t.data.keepAlive&&(n._isMounted?((e=r)._inactive=!1,en.push(e)):Je(r,!0))},destroy:function(t){var e=t.componentInstance;e._isDestroyed||(t.data.keepAlive?function t(e,n){if(n&&(e._directInactive=!0,Ze(e)))return;if(!e._inactive){e._inactive=!0;for(var r=0;r<e.$children.length;r++)t(e.$children[r]);Ye(e,"deactivated")}}(e,!0):e.$destroy())}},Me=Object.keys(Ie);function De(t,e,n,s,u){if(!o(t)){var l=n.$options._base;if(c(t)&&(t=l.extend(t)),"function"==typeof t){var f;if(o(t.cid)&&void 0===(t=function(t,e){if(a(t.error)&&i(t.errorComp))return t.errorComp;if(i(t.resolved))return t.resolved;var n=Be;n&&i(t.owners)&&-1===t.owners.indexOf(n)&&t.owners.push(n);if(a(t.loading)&&i(t.loadingComp))return t.loadingComp;if(n&&!i(t.owners)){var r=t.owners=[n],s=!0,u=null,l=null;n.$on("hook:destroyed",(function(){return g(r,n)}));var f=function(t){for(var e=0,n=r.length;e<n;e++)r[e].$forceUpdate();t&&(r.length=0,null!==u&&(clearTimeout(u),u=null),null!==l&&(clearTimeout(l),l=null))},p=M((function(n){t.resolved=Ve(n,e),s?r.length=0:f(!0)})),h=M((function(e){i(t.errorComp)&&(t.error=!0,f(!0))})),v=t(p,h);return c(v)&&(d(v)?o(t.resolved)&&v.then(p,h):d(v.component)&&(v.component.then(p,h),i(v.error)&&(t.errorComp=Ve(v.error,e)),i(v.loading)&&(t.loadingComp=Ve(v.loading,e),0===v.delay?t.loading=!0:u=setTimeout((function(){u=null,o(t.resolved)&&o(t.error)&&(t.loading=!0,f(!1))}),v.delay||200)),i(v.timeout)&&(l=setTimeout((function(){l=null,o(t.resolved)&&h(null)}),v.timeout)))),s=!1,t.loading?t.loadingComp:t.resolved}}(f=t,l)))return function(t,e,n,r,o){var i=mt();return i.asyncFactory=t,i.asyncMeta={data:e,context:n,children:r,tag:o},i}(f,e,n,s,u);e=e||{},$n(t),i(e.model)&&function(t,e){var n=t.model&&t.model.prop||"value",r=t.model&&t.model.event||"input";(e.attrs||(e.attrs={}))[n]=e.model.value;var o=e.on||(e.on={}),a=o[r],s=e.model.callback;i(a)?(Array.isArray(a)?-1===a.indexOf(s):a!==s)&&(o[r]=[s].concat(a)):o[r]=s}(t.options,e);var p=function(t,e,n){var r=e.options.props;if(!o(r)){var a={},s=t.attrs,c=t.props;if(i(s)||i(c))for(var u in r){var l=A(u);ce(a,c,u,l,!0)||ce(a,s,u,l,!1)}return a}}(e,t);if(a(t.options.functional))return function(t,e,n,o,a){var s=t.options,c={},u=s.props;if(i(u))for(var l in u)c[l]=Nt(l,u,e||r);else i(n.attrs)&&Le(c,n.attrs),i(n.props)&&Le(c,n.props);var f=new Pe(n,c,a,o,t),p=s.render.call(null,f._c,f);if(p instanceof ht)return Re(p,n,f.parent,s,f);if(Array.isArray(p)){for(var d=ue(p)||[],h=new Array(d.length),v=0;v<d.length;v++)h[v]=Re(d[v],n,f.parent,s,f);return h}}(t,p,e,n,s);var h=e.on;if(e.on=e.nativeOn,a(t.options.abstract)){var v=e.slot;e={},v&&(e.slot=v)}!function(t){for(var e=t.hook||(t.hook={}),n=0;n<Me.length;n++){var r=Me[n],o=e[r],i=Ie[r];o===i||o&&o._merged||(e[r]=o?Ne(i,o):i)}}(e);var m=t.options.name||u;return new ht("vue-component-"+t.cid+(m?"-"+m:""),e,void 0,void 0,void 0,n,{Ctor:t,propsData:p,listeners:h,tag:u,children:s},f)}}}function Ne(t,e){var n=function(n,r){t(n,r),e(n,r)};return n._merged=!0,n}function Ue(t,e,n,r,u,l){return(Array.isArray(n)||s(n))&&(u=r,r=n,n=void 0),a(l)&&(u=2),function(t,e,n,r,s){if(i(n)&&i(n.__ob__))return mt();i(n)&&i(n.is)&&(e=n.is);if(!e)return mt();0;Array.isArray(r)&&"function"==typeof r[0]&&((n=n||{}).scopedSlots={default:r[0]},r.length=0);2===s?r=ue(r):1===s&&(r=function(t){for(var e=0;e<t.length;e++)if(Array.isArray(t[e]))return Array.prototype.concat.apply([],t);return t}(r));var u,l;if("string"==typeof e){var f;l=t.$vnode&&t.$vnode.ns||U.getTagNamespace(e),u=U.isReservedTag(e)?new ht(U.parsePlatformTagName(e),n,r,void 0,void 0,t):n&&n.pre||!i(f=Dt(t.$options,"components",e))?new ht(e,n,r,void 0,void 0,t):De(f,n,t,r,e)}else u=De(e,n,t,r);return Array.isArray(u)?u:i(u)?(i(l)&&function t(e,n,r){e.ns=n,"foreignObject"===e.tag&&(n=void 0,r=!0);if(i(e.children))for(var s=0,c=e.children.length;s<c;s++){var u=e.children[s];i(u.tag)&&(o(u.ns)||a(r)&&"svg"!==u.tag)&&t(u,n,r)}}(u,l),i(n)&&function(t){c(t.style)&&re(t.style);c(t.class)&&re(t.class)}(n),u):mt()}(t,e,n,r,u)}var Fe,Be=null;function Ve(t,e){return(t.__esModule||st&&"Module"===t[Symbol.toStringTag])&&(t=t.default),c(t)?e.extend(t):t}function ze(t){return t.isComment&&t.asyncFactory}function qe(t){if(Array.isArray(t))for(var e=0;e<t.length;e++){var n=t[e];if(i(n)&&(i(n.componentOptions)||ze(n)))return n}}function He(t,e){Fe.$on(t,e)}function We(t,e){Fe.$off(t,e)}function Ke(t,e){var n=Fe;return function r(){var o=e.apply(null,arguments);null!==o&&n.$off(t,r)}}function Ge(t,e,n){Fe=t,ae(e,n||{},He,We,Ke,t),Fe=void 0}var Xe=null;function Qe(t){var e=Xe;return Xe=t,function(){Xe=e}}function Ze(t){for(;t&&(t=t.$parent);)if(t._inactive)return!0;return!1}function Je(t,e){if(e){if(t._directInactive=!1,Ze(t))return}else if(t._directInactive)return;if(t._inactive||null===t._inactive){t._inactive=!1;for(var n=0;n<t.$children.length;n++)Je(t.$children[n]);Ye(t,"activated")}}function Ye(t,e){pt();var n=t.$options[e],r=e+" hook";if(n)for(var o=0,i=n.length;o<i;o++)zt(n[o],t,null,t,r);t._hasHookEvent&&t.$emit("hook:"+e),dt()}var tn=[],en=[],nn={},rn=!1,on=!1,an=0;var sn=0,cn=Date.now;if(H&&!X){var un=window.performance;un&&"function"==typeof un.now&&cn()>document.createEvent("Event").timeStamp&&(cn=function(){return un.now()})}function ln(){var t,e;for(sn=cn(),on=!0,tn.sort((function(t,e){return t.id-e.id})),an=0;an<tn.length;an++)(t=tn[an]).before&&t.before(),e=t.id,nn[e]=null,t.run();var n=en.slice(),r=tn.slice();an=tn.length=en.length=0,nn={},rn=on=!1,function(t){for(var e=0;e<t.length;e++)t[e]._inactive=!0,Je(t[e],!0)}(n),function(t){var e=t.length;for(;e--;){var n=t[e],r=n.vm;r._watcher===n&&r._isMounted&&!r._isDestroyed&&Ye(r,"updated")}}(r),ot&&U.devtools&&ot.emit("flush")}var fn=0,pn=function(t,e,n,r,o){this.vm=t,o&&(t._watcher=this),t._watchers.push(this),r?(this.deep=!!r.deep,this.user=!!r.user,this.lazy=!!r.lazy,this.sync=!!r.sync,this.before=r.before):this.deep=this.user=this.lazy=this.sync=!1,this.cb=n,this.id=++fn,this.active=!0,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=new at,this.newDepIds=new at,this.expression="","function"==typeof e?this.getter=e:(this.getter=function(t){if(!V.test(t)){var e=t.split(".");return function(t){for(var n=0;n<e.length;n++){if(!t)return;t=t[e[n]]}return t}}}(e),this.getter||(this.getter=T)),this.value=this.lazy?void 0:this.get()};pn.prototype.get=function(){var t;pt(this);var e=this.vm;try{t=this.getter.call(e,e)}catch(t){if(!this.user)throw t;Vt(t,e,'getter for watcher "'+this.expression+'"')}finally{this.deep&&re(t),dt(),this.cleanupDeps()}return t},pn.prototype.addDep=function(t){var e=t.id;this.newDepIds.has(e)||(this.newDepIds.add(e),this.newDeps.push(t),this.depIds.has(e)||t.addSub(this))},pn.prototype.cleanupDeps=function(){for(var t=this.deps.length;t--;){var e=this.deps[t];this.newDepIds.has(e.id)||e.removeSub(this)}var n=this.depIds;this.depIds=this.newDepIds,this.newDepIds=n,this.newDepIds.clear(),n=this.deps,this.deps=this.newDeps,this.newDeps=n,this.newDeps.length=0},pn.prototype.update=function(){this.lazy?this.dirty=!0:this.sync?this.run():function(t){var e=t.id;if(null==nn[e]){if(nn[e]=!0,on){for(var n=tn.length-1;n>an&&tn[n].id>t.id;)n--;tn.splice(n+1,0,t)}else tn.push(t);rn||(rn=!0,ee(ln))}}(this)},pn.prototype.run=function(){if(this.active){var t=this.get();if(t!==this.value||c(t)||this.deep){var e=this.value;if(this.value=t,this.user)try{this.cb.call(this.vm,t,e)}catch(t){Vt(t,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,t,e)}}},pn.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},pn.prototype.depend=function(){for(var t=this.deps.length;t--;)this.deps[t].depend()},pn.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||g(this.vm._watchers,this);for(var t=this.deps.length;t--;)this.deps[t].removeSub(this);this.active=!1}};var dn={enumerable:!0,configurable:!0,get:T,set:T};function hn(t,e,n){dn.get=function(){return this[e][n]},dn.set=function(t){this[e][n]=t},Object.defineProperty(t,n,dn)}function vn(t){t._watchers=[];var e=t.$options;e.props&&function(t,e){var n=t.$options.propsData||{},r=t._props={},o=t.$options._propKeys=[];t.$parent&&Ct(!1);var i=function(i){o.push(i);var a=Nt(i,e,n,t);At(r,i,a),i in t||hn(t,"_props",i)};for(var a in e)i(a);Ct(!0)}(t,e.props),e.methods&&function(t,e){t.$options.props;for(var n in e)t[n]="function"!=typeof e[n]?T:O(e[n],t)}(t,e.methods),e.data?function(t){var e=t.$options.data;l(e=t._data="function"==typeof e?function(t,e){pt();try{return t.call(e,e)}catch(t){return Vt(t,e,"data()"),{}}finally{dt()}}(e,t):e||{})||(e={});var n=Object.keys(e),r=t.$options.props,o=(t.$options.methods,n.length);for(;o--;){var i=n[o];0,r&&_(r,i)||(a=void 0,36!==(a=(i+"").charCodeAt(0))&&95!==a&&hn(t,"_data",i))}var a;kt(e,!0)}(t):kt(t._data={},!0),e.computed&&function(t,e){var n=t._computedWatchers=Object.create(null),r=rt();for(var o in e){var i=e[o],a="function"==typeof i?i:i.get;0,r||(n[o]=new pn(t,a||T,T,mn)),o in t||yn(t,o,i)}}(t,e.computed),e.watch&&e.watch!==tt&&function(t,e){for(var n in e){var r=e[n];if(Array.isArray(r))for(var o=0;o<r.length;o++)_n(t,n,r[o]);else _n(t,n,r)}}(t,e.watch)}var mn={lazy:!0};function yn(t,e,n){var r=!rt();"function"==typeof n?(dn.get=r?gn(e):bn(n),dn.set=T):(dn.get=n.get?r&&!1!==n.cache?gn(e):bn(n.get):T,dn.set=n.set||T),Object.defineProperty(t,e,dn)}function gn(t){return function(){var e=this._computedWatchers&&this._computedWatchers[t];if(e)return e.dirty&&e.evaluate(),lt.target&&e.depend(),e.value}}function bn(t){return function(){return t.call(this,this)}}function _n(t,e,n,r){return l(n)&&(r=n,n=n.handler),"string"==typeof n&&(n=t[n]),t.$watch(e,n,r)}var wn=0;function $n(t){var e=t.options;if(t.super){var n=$n(t.super);if(n!==t.superOptions){t.superOptions=n;var r=function(t){var e,n=t.options,r=t.sealedOptions;for(var o in n)n[o]!==r[o]&&(e||(e={}),e[o]=n[o]);return e}(t);r&&E(t.extendOptions,r),(e=t.options=Mt(n,t.extendOptions)).name&&(e.components[e.name]=t)}}return e}function Cn(t){this._init(t)}function xn(t){t.cid=0;var e=1;t.extend=function(t){t=t||{};var n=this,r=n.cid,o=t._Ctor||(t._Ctor={});if(o[r])return o[r];var i=t.name||n.options.name;var a=function(t){this._init(t)};return(a.prototype=Object.create(n.prototype)).constructor=a,a.cid=e++,a.options=Mt(n.options,t),a.super=n,a.options.props&&function(t){var e=t.options.props;for(var n in e)hn(t.prototype,"_props",n)}(a),a.options.computed&&function(t){var e=t.options.computed;for(var n in e)yn(t.prototype,n,e[n])}(a),a.extend=n.extend,a.mixin=n.mixin,a.use=n.use,D.forEach((function(t){a[t]=n[t]})),i&&(a.options.components[i]=a),a.superOptions=n.options,a.extendOptions=t,a.sealedOptions=E({},a.options),o[r]=a,a}}function kn(t){return t&&(t.Ctor.options.name||t.tag)}function An(t,e){return Array.isArray(t)?t.indexOf(e)>-1:"string"==typeof t?t.split(",").indexOf(e)>-1:!!f(t)&&t.test(e)}function On(t,e){var n=t.cache,r=t.keys,o=t._vnode;for(var i in n){var a=n[i];if(a){var s=kn(a.componentOptions);s&&!e(s)&&Sn(n,i,r,o)}}}function Sn(t,e,n,r){var o=t[e];!o||r&&o.tag===r.tag||o.componentInstance.$destroy(),t[e]=null,g(n,e)}Cn.prototype._init=function(t){var e=this;e._uid=wn++,e._isVue=!0,t&&t._isComponent?function(t,e){var n=t.$options=Object.create(t.constructor.options),r=e._parentVnode;n.parent=e.parent,n._parentVnode=r;var o=r.componentOptions;n.propsData=o.propsData,n._parentListeners=o.listeners,n._renderChildren=o.children,n._componentTag=o.tag,e.render&&(n.render=e.render,n.staticRenderFns=e.staticRenderFns)}(e,t):e.$options=Mt($n(e.constructor),t||{},e),e._renderProxy=e,e._self=e,function(t){var e=t.$options,n=e.parent;if(n&&!e.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(t)}t.$parent=n,t.$root=n?n.$root:t,t.$children=[],t.$refs={},t._watcher=null,t._inactive=null,t._directInactive=!1,t._isMounted=!1,t._isDestroyed=!1,t._isBeingDestroyed=!1}(e),function(t){t._events=Object.create(null),t._hasHookEvent=!1;var e=t.$options._parentListeners;e&&Ge(t,e)}(e),function(t){t._vnode=null,t._staticTrees=null;var e=t.$options,n=t.$vnode=e._parentVnode,o=n&&n.context;t.$slots=pe(e._renderChildren,o),t.$scopedSlots=r,t._c=function(e,n,r,o){return Ue(t,e,n,r,o,!1)},t.$createElement=function(e,n,r,o){return Ue(t,e,n,r,o,!0)};var i=n&&n.data;At(t,"$attrs",i&&i.attrs||r,null,!0),At(t,"$listeners",e._parentListeners||r,null,!0)}(e),Ye(e,"beforeCreate"),function(t){var e=fe(t.$options.inject,t);e&&(Ct(!1),Object.keys(e).forEach((function(n){At(t,n,e[n])})),Ct(!0))}(e),vn(e),function(t){var e=t.$options.provide;e&&(t._provided="function"==typeof e?e.call(t):e)}(e),Ye(e,"created"),e.$options.el&&e.$mount(e.$options.el)},function(t){var e={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(t.prototype,"$data",e),Object.defineProperty(t.prototype,"$props",n),t.prototype.$set=Ot,t.prototype.$delete=St,t.prototype.$watch=function(t,e,n){if(l(e))return _n(this,t,e,n);(n=n||{}).user=!0;var r=new pn(this,t,e,n);if(n.immediate)try{e.call(this,r.value)}catch(t){Vt(t,this,'callback for immediate watcher "'+r.expression+'"')}return function(){r.teardown()}}}(Cn),function(t){var e=/^hook:/;t.prototype.$on=function(t,n){var r=this;if(Array.isArray(t))for(var o=0,i=t.length;o<i;o++)r.$on(t[o],n);else(r._events[t]||(r._events[t]=[])).push(n),e.test(t)&&(r._hasHookEvent=!0);return r},t.prototype.$once=function(t,e){var n=this;function r(){n.$off(t,r),e.apply(n,arguments)}return r.fn=e,n.$on(t,r),n},t.prototype.$off=function(t,e){var n=this;if(!arguments.length)return n._events=Object.create(null),n;if(Array.isArray(t)){for(var r=0,o=t.length;r<o;r++)n.$off(t[r],e);return n}var i,a=n._events[t];if(!a)return n;if(!e)return n._events[t]=null,n;for(var s=a.length;s--;)if((i=a[s])===e||i.fn===e){a.splice(s,1);break}return n},t.prototype.$emit=function(t){var e=this,n=e._events[t];if(n){n=n.length>1?S(n):n;for(var r=S(arguments,1),o='event handler for "'+t+'"',i=0,a=n.length;i<a;i++)zt(n[i],e,r,e,o)}return e}}(Cn),function(t){t.prototype._update=function(t,e){var n=this,r=n.$el,o=n._vnode,i=Qe(n);n._vnode=t,n.$el=o?n.__patch__(o,t):n.__patch__(n.$el,t,e,!1),i(),r&&(r.__vue__=null),n.$el&&(n.$el.__vue__=n),n.$vnode&&n.$parent&&n.$vnode===n.$parent._vnode&&(n.$parent.$el=n.$el)},t.prototype.$forceUpdate=function(){this._watcher&&this._watcher.update()},t.prototype.$destroy=function(){var t=this;if(!t._isBeingDestroyed){Ye(t,"beforeDestroy"),t._isBeingDestroyed=!0;var e=t.$parent;!e||e._isBeingDestroyed||t.$options.abstract||g(e.$children,t),t._watcher&&t._watcher.teardown();for(var n=t._watchers.length;n--;)t._watchers[n].teardown();t._data.__ob__&&t._data.__ob__.vmCount--,t._isDestroyed=!0,t.__patch__(t._vnode,null),Ye(t,"destroyed"),t.$off(),t.$el&&(t.$el.__vue__=null),t.$vnode&&(t.$vnode.parent=null)}}}(Cn),function(t){Te(t.prototype),t.prototype.$nextTick=function(t){return ee(t,this)},t.prototype._render=function(){var t,e=this,n=e.$options,r=n.render,o=n._parentVnode;o&&(e.$scopedSlots=he(o.data.scopedSlots,e.$slots,e.$scopedSlots)),e.$vnode=o;try{Be=e,t=r.call(e._renderProxy,e.$createElement)}catch(n){Vt(n,e,"render"),t=e._vnode}finally{Be=null}return Array.isArray(t)&&1===t.length&&(t=t[0]),t instanceof ht||(t=mt()),t.parent=o,t}}(Cn);var En=[String,RegExp,Array],jn={KeepAlive:{name:"keep-alive",abstract:!0,props:{include:En,exclude:En,max:[String,Number]},created:function(){this.cache=Object.create(null),this.keys=[]},destroyed:function(){for(var t in this.cache)Sn(this.cache,t,this.keys)},mounted:function(){var t=this;this.$watch("include",(function(e){On(t,(function(t){return An(e,t)}))})),this.$watch("exclude",(function(e){On(t,(function(t){return!An(e,t)}))}))},render:function(){var t=this.$slots.default,e=qe(t),n=e&&e.componentOptions;if(n){var r=kn(n),o=this.include,i=this.exclude;if(o&&(!r||!An(o,r))||i&&r&&An(i,r))return e;var a=this.cache,s=this.keys,c=null==e.key?n.Ctor.cid+(n.tag?"::"+n.tag:""):e.key;a[c]?(e.componentInstance=a[c].componentInstance,g(s,c),s.push(c)):(a[c]=e,s.push(c),this.max&&s.length>parseInt(this.max)&&Sn(a,s[0],s,this._vnode)),e.data.keepAlive=!0}return e||t&&t[0]}}};!function(t){var e={get:function(){return U}};Object.defineProperty(t,"config",e),t.util={warn:ct,extend:E,mergeOptions:Mt,defineReactive:At},t.set=Ot,t.delete=St,t.nextTick=ee,t.observable=function(t){return kt(t),t},t.options=Object.create(null),D.forEach((function(e){t.options[e+"s"]=Object.create(null)})),t.options._base=t,E(t.options.components,jn),function(t){t.use=function(t){var e=this._installedPlugins||(this._installedPlugins=[]);if(e.indexOf(t)>-1)return this;var n=S(arguments,1);return n.unshift(this),"function"==typeof t.install?t.install.apply(t,n):"function"==typeof t&&t.apply(null,n),e.push(t),this}}(t),function(t){t.mixin=function(t){return this.options=Mt(this.options,t),this}}(t),xn(t),function(t){D.forEach((function(e){t[e]=function(t,n){return n?("component"===e&&l(n)&&(n.name=n.name||t,n=this.options._base.extend(n)),"directive"===e&&"function"==typeof n&&(n={bind:n,update:n}),this.options[e+"s"][t]=n,n):this.options[e+"s"][t]}}))}(t)}(Cn),Object.defineProperty(Cn.prototype,"$isServer",{get:rt}),Object.defineProperty(Cn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(Cn,"FunctionalRenderContext",{value:Pe}),Cn.version="2.6.11";var Tn=m("style,class"),Pn=m("input,textarea,option,select,progress"),Rn=m("contenteditable,draggable,spellcheck"),Ln=m("events,caret,typing,plaintext-only"),In=m("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),Mn="http://www.w3.org/1999/xlink",Dn=function(t){return":"===t.charAt(5)&&"xlink"===t.slice(0,5)},Nn=function(t){return Dn(t)?t.slice(6,t.length):""},Un=function(t){return null==t||!1===t};function Fn(t){for(var e=t.data,n=t,r=t;i(r.componentInstance);)(r=r.componentInstance._vnode)&&r.data&&(e=Bn(r.data,e));for(;i(n=n.parent);)n&&n.data&&(e=Bn(e,n.data));return function(t,e){if(i(t)||i(e))return Vn(t,zn(e));return""}(e.staticClass,e.class)}function Bn(t,e){return{staticClass:Vn(t.staticClass,e.staticClass),class:i(t.class)?[t.class,e.class]:e.class}}function Vn(t,e){return t?e?t+" "+e:t:e||""}function zn(t){return Array.isArray(t)?function(t){for(var e,n="",r=0,o=t.length;r<o;r++)i(e=zn(t[r]))&&""!==e&&(n&&(n+=" "),n+=e);return n}(t):c(t)?function(t){var e="";for(var n in t)t[n]&&(e&&(e+=" "),e+=n);return e}(t):"string"==typeof t?t:""}var qn={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"},Hn=m("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,menuitem,summary,content,element,shadow,template,blockquote,iframe,tfoot"),Wn=m("svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view",!0),Kn=function(t){return Hn(t)||Wn(t)};var Gn=Object.create(null);var Xn=m("text,number,password,search,email,tel,url");var Qn=Object.freeze({createElement:function(t,e){var n=document.createElement(t);return"select"!==t?n:(e.data&&e.data.attrs&&void 0!==e.data.attrs.multiple&&n.setAttribute("multiple","multiple"),n)},createElementNS:function(t,e){return document.createElementNS(qn[t],e)},createTextNode:function(t){return document.createTextNode(t)},createComment:function(t){return document.createComment(t)},insertBefore:function(t,e,n){t.insertBefore(e,n)},removeChild:function(t,e){t.removeChild(e)},appendChild:function(t,e){t.appendChild(e)},parentNode:function(t){return t.parentNode},nextSibling:function(t){return t.nextSibling},tagName:function(t){return t.tagName},setTextContent:function(t,e){t.textContent=e},setStyleScope:function(t,e){t.setAttribute(e,"")}}),Zn={create:function(t,e){Jn(e)},update:function(t,e){t.data.ref!==e.data.ref&&(Jn(t,!0),Jn(e))},destroy:function(t){Jn(t,!0)}};function Jn(t,e){var n=t.data.ref;if(i(n)){var r=t.context,o=t.componentInstance||t.elm,a=r.$refs;e?Array.isArray(a[n])?g(a[n],o):a[n]===o&&(a[n]=void 0):t.data.refInFor?Array.isArray(a[n])?a[n].indexOf(o)<0&&a[n].push(o):a[n]=[o]:a[n]=o}}var Yn=new ht("",{},[]),tr=["create","activate","update","remove","destroy"];function er(t,e){return t.key===e.key&&(t.tag===e.tag&&t.isComment===e.isComment&&i(t.data)===i(e.data)&&function(t,e){if("input"!==t.tag)return!0;var n,r=i(n=t.data)&&i(n=n.attrs)&&n.type,o=i(n=e.data)&&i(n=n.attrs)&&n.type;return r===o||Xn(r)&&Xn(o)}(t,e)||a(t.isAsyncPlaceholder)&&t.asyncFactory===e.asyncFactory&&o(e.asyncFactory.error))}function nr(t,e,n){var r,o,a={};for(r=e;r<=n;++r)i(o=t[r].key)&&(a[o]=r);return a}var rr={create:or,update:or,destroy:function(t){or(t,Yn)}};function or(t,e){(t.data.directives||e.data.directives)&&function(t,e){var n,r,o,i=t===Yn,a=e===Yn,s=ar(t.data.directives,t.context),c=ar(e.data.directives,e.context),u=[],l=[];for(n in c)r=s[n],o=c[n],r?(o.oldValue=r.value,o.oldArg=r.arg,cr(o,"update",e,t),o.def&&o.def.componentUpdated&&l.push(o)):(cr(o,"bind",e,t),o.def&&o.def.inserted&&u.push(o));if(u.length){var f=function(){for(var n=0;n<u.length;n++)cr(u[n],"inserted",e,t)};i?se(e,"insert",f):f()}l.length&&se(e,"postpatch",(function(){for(var n=0;n<l.length;n++)cr(l[n],"componentUpdated",e,t)}));if(!i)for(n in s)c[n]||cr(s[n],"unbind",t,t,a)}(t,e)}var ir=Object.create(null);function ar(t,e){var n,r,o=Object.create(null);if(!t)return o;for(n=0;n<t.length;n++)(r=t[n]).modifiers||(r.modifiers=ir),o[sr(r)]=r,r.def=Dt(e.$options,"directives",r.name);return o}function sr(t){return t.rawName||t.name+"."+Object.keys(t.modifiers||{}).join(".")}function cr(t,e,n,r,o){var i=t.def&&t.def[e];if(i)try{i(n.elm,t,n,r,o)}catch(r){Vt(r,n.context,"directive "+t.name+" "+e+" hook")}}var ur=[Zn,rr];function lr(t,e){var n=e.componentOptions;if(!(i(n)&&!1===n.Ctor.options.inheritAttrs||o(t.data.attrs)&&o(e.data.attrs))){var r,a,s=e.elm,c=t.data.attrs||{},u=e.data.attrs||{};for(r in i(u.__ob__)&&(u=e.data.attrs=E({},u)),u)a=u[r],c[r]!==a&&fr(s,r,a);for(r in(X||Z)&&u.value!==c.value&&fr(s,"value",u.value),c)o(u[r])&&(Dn(r)?s.removeAttributeNS(Mn,Nn(r)):Rn(r)||s.removeAttribute(r))}}function fr(t,e,n){t.tagName.indexOf("-")>-1?pr(t,e,n):In(e)?Un(n)?t.removeAttribute(e):(n="allowfullscreen"===e&&"EMBED"===t.tagName?"true":e,t.setAttribute(e,n)):Rn(e)?t.setAttribute(e,function(t,e){return Un(e)||"false"===e?"false":"contenteditable"===t&&Ln(e)?e:"true"}(e,n)):Dn(e)?Un(n)?t.removeAttributeNS(Mn,Nn(e)):t.setAttributeNS(Mn,e,n):pr(t,e,n)}function pr(t,e,n){if(Un(n))t.removeAttribute(e);else{if(X&&!Q&&"TEXTAREA"===t.tagName&&"placeholder"===e&&""!==n&&!t.__ieph){var r=function(e){e.stopImmediatePropagation(),t.removeEventListener("input",r)};t.addEventListener("input",r),t.__ieph=!0}t.setAttribute(e,n)}}var dr={create:lr,update:lr};function hr(t,e){var n=e.elm,r=e.data,a=t.data;if(!(o(r.staticClass)&&o(r.class)&&(o(a)||o(a.staticClass)&&o(a.class)))){var s=Fn(e),c=n._transitionClasses;i(c)&&(s=Vn(s,zn(c))),s!==n._prevClass&&(n.setAttribute("class",s),n._prevClass=s)}}var vr,mr={create:hr,update:hr};function yr(t,e,n){var r=vr;return function o(){var i=e.apply(null,arguments);null!==i&&_r(t,o,n,r)}}var gr=Kt&&!(Y&&Number(Y[1])<=53);function br(t,e,n,r){if(gr){var o=sn,i=e;e=i._wrapper=function(t){if(t.target===t.currentTarget||t.timeStamp>=o||t.timeStamp<=0||t.target.ownerDocument!==document)return i.apply(this,arguments)}}vr.addEventListener(t,e,et?{capture:n,passive:r}:n)}function _r(t,e,n,r){(r||vr).removeEventListener(t,e._wrapper||e,n)}function wr(t,e){if(!o(t.data.on)||!o(e.data.on)){var n=e.data.on||{},r=t.data.on||{};vr=e.elm,function(t){if(i(t.__r)){var e=X?"change":"input";t[e]=[].concat(t.__r,t[e]||[]),delete t.__r}i(t.__c)&&(t.change=[].concat(t.__c,t.change||[]),delete t.__c)}(n),ae(n,r,br,_r,yr,e.context),vr=void 0}}var $r,Cr={create:wr,update:wr};function xr(t,e){if(!o(t.data.domProps)||!o(e.data.domProps)){var n,r,a=e.elm,s=t.data.domProps||{},c=e.data.domProps||{};for(n in i(c.__ob__)&&(c=e.data.domProps=E({},c)),s)n in c||(a[n]="");for(n in c){if(r=c[n],"textContent"===n||"innerHTML"===n){if(e.children&&(e.children.length=0),r===s[n])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===n&&"PROGRESS"!==a.tagName){a._value=r;var u=o(r)?"":String(r);kr(a,u)&&(a.value=u)}else if("innerHTML"===n&&Wn(a.tagName)&&o(a.innerHTML)){($r=$r||document.createElement("div")).innerHTML="<svg>"+r+"</svg>";for(var l=$r.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;l.firstChild;)a.appendChild(l.firstChild)}else if(r!==s[n])try{a[n]=r}catch(t){}}}}function kr(t,e){return!t.composing&&("OPTION"===t.tagName||function(t,e){var n=!0;try{n=document.activeElement!==t}catch(t){}return n&&t.value!==e}(t,e)||function(t,e){var n=t.value,r=t._vModifiers;if(i(r)){if(r.number)return v(n)!==v(e);if(r.trim)return n.trim()!==e.trim()}return n!==e}(t,e))}var Ar={create:xr,update:xr},Or=w((function(t){var e={},n=/:(.+)/;return t.split(/;(?![^(]*\))/g).forEach((function(t){if(t){var r=t.split(n);r.length>1&&(e[r[0].trim()]=r[1].trim())}})),e}));function Sr(t){var e=Er(t.style);return t.staticStyle?E(t.staticStyle,e):e}function Er(t){return Array.isArray(t)?j(t):"string"==typeof t?Or(t):t}var jr,Tr=/^--/,Pr=/\s*!important$/,Rr=function(t,e,n){if(Tr.test(e))t.style.setProperty(e,n);else if(Pr.test(n))t.style.setProperty(A(e),n.replace(Pr,""),"important");else{var r=Ir(e);if(Array.isArray(n))for(var o=0,i=n.length;o<i;o++)t.style[r]=n[o];else t.style[r]=n}},Lr=["Webkit","Moz","ms"],Ir=w((function(t){if(jr=jr||document.createElement("div").style,"filter"!==(t=C(t))&&t in jr)return t;for(var e=t.charAt(0).toUpperCase()+t.slice(1),n=0;n<Lr.length;n++){var r=Lr[n]+e;if(r in jr)return r}}));function Mr(t,e){var n=e.data,r=t.data;if(!(o(n.staticStyle)&&o(n.style)&&o(r.staticStyle)&&o(r.style))){var a,s,c=e.elm,u=r.staticStyle,l=r.normalizedStyle||r.style||{},f=u||l,p=Er(e.data.style)||{};e.data.normalizedStyle=i(p.__ob__)?E({},p):p;var d=function(t,e){var n,r={};if(e)for(var o=t;o.componentInstance;)(o=o.componentInstance._vnode)&&o.data&&(n=Sr(o.data))&&E(r,n);(n=Sr(t.data))&&E(r,n);for(var i=t;i=i.parent;)i.data&&(n=Sr(i.data))&&E(r,n);return r}(e,!0);for(s in f)o(d[s])&&Rr(c,s,"");for(s in d)(a=d[s])!==f[s]&&Rr(c,s,null==a?"":a)}}var Dr={create:Mr,update:Mr},Nr=/\s+/;function Ur(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(Nr).forEach((function(e){return t.classList.add(e)})):t.classList.add(e);else{var n=" "+(t.getAttribute("class")||"")+" ";n.indexOf(" "+e+" ")<0&&t.setAttribute("class",(n+e).trim())}}function Fr(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(Nr).forEach((function(e){return t.classList.remove(e)})):t.classList.remove(e),t.classList.length||t.removeAttribute("class");else{for(var n=" "+(t.getAttribute("class")||"")+" ",r=" "+e+" ";n.indexOf(r)>=0;)n=n.replace(r," ");(n=n.trim())?t.setAttribute("class",n):t.removeAttribute("class")}}function Br(t){if(t){if("object"==typeof t){var e={};return!1!==t.css&&E(e,Vr(t.name||"v")),E(e,t),e}return"string"==typeof t?Vr(t):void 0}}var Vr=w((function(t){return{enterClass:t+"-enter",enterToClass:t+"-enter-to",enterActiveClass:t+"-enter-active",leaveClass:t+"-leave",leaveToClass:t+"-leave-to",leaveActiveClass:t+"-leave-active"}})),zr=H&&!Q,qr="transition",Hr="transitionend",Wr="animation",Kr="animationend";zr&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(qr="WebkitTransition",Hr="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(Wr="WebkitAnimation",Kr="webkitAnimationEnd"));var Gr=H?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(t){return t()};function Xr(t){Gr((function(){Gr(t)}))}function Qr(t,e){var n=t._transitionClasses||(t._transitionClasses=[]);n.indexOf(e)<0&&(n.push(e),Ur(t,e))}function Zr(t,e){t._transitionClasses&&g(t._transitionClasses,e),Fr(t,e)}function Jr(t,e,n){var r=to(t,e),o=r.type,i=r.timeout,a=r.propCount;if(!o)return n();var s="transition"===o?Hr:Kr,c=0,u=function(){t.removeEventListener(s,l),n()},l=function(e){e.target===t&&++c>=a&&u()};setTimeout((function(){c<a&&u()}),i+1),t.addEventListener(s,l)}var Yr=/\b(transform|all)(,|$)/;function to(t,e){var n,r=window.getComputedStyle(t),o=(r[qr+"Delay"]||"").split(", "),i=(r[qr+"Duration"]||"").split(", "),a=eo(o,i),s=(r[Wr+"Delay"]||"").split(", "),c=(r[Wr+"Duration"]||"").split(", "),u=eo(s,c),l=0,f=0;return"transition"===e?a>0&&(n="transition",l=a,f=i.length):"animation"===e?u>0&&(n="animation",l=u,f=c.length):f=(n=(l=Math.max(a,u))>0?a>u?"transition":"animation":null)?"transition"===n?i.length:c.length:0,{type:n,timeout:l,propCount:f,hasTransform:"transition"===n&&Yr.test(r[qr+"Property"])}}function eo(t,e){for(;t.length<e.length;)t=t.concat(t);return Math.max.apply(null,e.map((function(e,n){return no(e)+no(t[n])})))}function no(t){return 1e3*Number(t.slice(0,-1).replace(",","."))}function ro(t,e){var n=t.elm;i(n._leaveCb)&&(n._leaveCb.cancelled=!0,n._leaveCb());var r=Br(t.data.transition);if(!o(r)&&!i(n._enterCb)&&1===n.nodeType){for(var a=r.css,s=r.type,u=r.enterClass,l=r.enterToClass,f=r.enterActiveClass,p=r.appearClass,d=r.appearToClass,h=r.appearActiveClass,m=r.beforeEnter,y=r.enter,g=r.afterEnter,b=r.enterCancelled,_=r.beforeAppear,w=r.appear,$=r.afterAppear,C=r.appearCancelled,x=r.duration,k=Xe,A=Xe.$vnode;A&&A.parent;)k=A.context,A=A.parent;var O=!k._isMounted||!t.isRootInsert;if(!O||w||""===w){var S=O&&p?p:u,E=O&&h?h:f,j=O&&d?d:l,T=O&&_||m,P=O&&"function"==typeof w?w:y,R=O&&$||g,L=O&&C||b,I=v(c(x)?x.enter:x);0;var D=!1!==a&&!Q,N=ao(P),U=n._enterCb=M((function(){D&&(Zr(n,j),Zr(n,E)),U.cancelled?(D&&Zr(n,S),L&&L(n)):R&&R(n),n._enterCb=null}));t.data.show||se(t,"insert",(function(){var e=n.parentNode,r=e&&e._pending&&e._pending[t.key];r&&r.tag===t.tag&&r.elm._leaveCb&&r.elm._leaveCb(),P&&P(n,U)})),T&&T(n),D&&(Qr(n,S),Qr(n,E),Xr((function(){Zr(n,S),U.cancelled||(Qr(n,j),N||(io(I)?setTimeout(U,I):Jr(n,s,U)))}))),t.data.show&&(e&&e(),P&&P(n,U)),D||N||U()}}}function oo(t,e){var n=t.elm;i(n._enterCb)&&(n._enterCb.cancelled=!0,n._enterCb());var r=Br(t.data.transition);if(o(r)||1!==n.nodeType)return e();if(!i(n._leaveCb)){var a=r.css,s=r.type,u=r.leaveClass,l=r.leaveToClass,f=r.leaveActiveClass,p=r.beforeLeave,d=r.leave,h=r.afterLeave,m=r.leaveCancelled,y=r.delayLeave,g=r.duration,b=!1!==a&&!Q,_=ao(d),w=v(c(g)?g.leave:g);0;var $=n._leaveCb=M((function(){n.parentNode&&n.parentNode._pending&&(n.parentNode._pending[t.key]=null),b&&(Zr(n,l),Zr(n,f)),$.cancelled?(b&&Zr(n,u),m&&m(n)):(e(),h&&h(n)),n._leaveCb=null}));y?y(C):C()}function C(){$.cancelled||(!t.data.show&&n.parentNode&&((n.parentNode._pending||(n.parentNode._pending={}))[t.key]=t),p&&p(n),b&&(Qr(n,u),Qr(n,f),Xr((function(){Zr(n,u),$.cancelled||(Qr(n,l),_||(io(w)?setTimeout($,w):Jr(n,s,$)))}))),d&&d(n,$),b||_||$())}}function io(t){return"number"==typeof t&&!isNaN(t)}function ao(t){if(o(t))return!1;var e=t.fns;return i(e)?ao(Array.isArray(e)?e[0]:e):(t._length||t.length)>1}function so(t,e){!0!==e.data.show&&ro(e)}var co=function(t){var e,n,r={},c=t.modules,u=t.nodeOps;for(e=0;e<tr.length;++e)for(r[tr[e]]=[],n=0;n<c.length;++n)i(c[n][tr[e]])&&r[tr[e]].push(c[n][tr[e]]);function l(t){var e=u.parentNode(t);i(e)&&u.removeChild(e,t)}function f(t,e,n,o,s,c,l){if(i(t.elm)&&i(c)&&(t=c[l]=gt(t)),t.isRootInsert=!s,!function(t,e,n,o){var s=t.data;if(i(s)){var c=i(t.componentInstance)&&s.keepAlive;if(i(s=s.hook)&&i(s=s.init)&&s(t,!1),i(t.componentInstance))return p(t,e),d(n,t.elm,o),a(c)&&function(t,e,n,o){var a,s=t;for(;s.componentInstance;)if(s=s.componentInstance._vnode,i(a=s.data)&&i(a=a.transition)){for(a=0;a<r.activate.length;++a)r.activate[a](Yn,s);e.push(s);break}d(n,t.elm,o)}(t,e,n,o),!0}}(t,e,n,o)){var f=t.data,v=t.children,m=t.tag;i(m)?(t.elm=t.ns?u.createElementNS(t.ns,m):u.createElement(m,t),g(t),h(t,v,e),i(f)&&y(t,e),d(n,t.elm,o)):a(t.isComment)?(t.elm=u.createComment(t.text),d(n,t.elm,o)):(t.elm=u.createTextNode(t.text),d(n,t.elm,o))}}function p(t,e){i(t.data.pendingInsert)&&(e.push.apply(e,t.data.pendingInsert),t.data.pendingInsert=null),t.elm=t.componentInstance.$el,v(t)?(y(t,e),g(t)):(Jn(t),e.push(t))}function d(t,e,n){i(t)&&(i(n)?u.parentNode(n)===t&&u.insertBefore(t,e,n):u.appendChild(t,e))}function h(t,e,n){if(Array.isArray(e)){0;for(var r=0;r<e.length;++r)f(e[r],n,t.elm,null,!0,e,r)}else s(t.text)&&u.appendChild(t.elm,u.createTextNode(String(t.text)))}function v(t){for(;t.componentInstance;)t=t.componentInstance._vnode;return i(t.tag)}function y(t,n){for(var o=0;o<r.create.length;++o)r.create[o](Yn,t);i(e=t.data.hook)&&(i(e.create)&&e.create(Yn,t),i(e.insert)&&n.push(t))}function g(t){var e;if(i(e=t.fnScopeId))u.setStyleScope(t.elm,e);else for(var n=t;n;)i(e=n.context)&&i(e=e.$options._scopeId)&&u.setStyleScope(t.elm,e),n=n.parent;i(e=Xe)&&e!==t.context&&e!==t.fnContext&&i(e=e.$options._scopeId)&&u.setStyleScope(t.elm,e)}function b(t,e,n,r,o,i){for(;r<=o;++r)f(n[r],i,t,e,!1,n,r)}function _(t){var e,n,o=t.data;if(i(o))for(i(e=o.hook)&&i(e=e.destroy)&&e(t),e=0;e<r.destroy.length;++e)r.destroy[e](t);if(i(e=t.children))for(n=0;n<t.children.length;++n)_(t.children[n])}function w(t,e,n){for(;e<=n;++e){var r=t[e];i(r)&&(i(r.tag)?($(r),_(r)):l(r.elm))}}function $(t,e){if(i(e)||i(t.data)){var n,o=r.remove.length+1;for(i(e)?e.listeners+=o:e=function(t,e){function n(){0==--n.listeners&&l(t)}return n.listeners=e,n}(t.elm,o),i(n=t.componentInstance)&&i(n=n._vnode)&&i(n.data)&&$(n,e),n=0;n<r.remove.length;++n)r.remove[n](t,e);i(n=t.data.hook)&&i(n=n.remove)?n(t,e):e()}else l(t.elm)}function C(t,e,n,r){for(var o=n;o<r;o++){var a=e[o];if(i(a)&&er(t,a))return o}}function x(t,e,n,s,c,l){if(t!==e){i(e.elm)&&i(s)&&(e=s[c]=gt(e));var p=e.elm=t.elm;if(a(t.isAsyncPlaceholder))i(e.asyncFactory.resolved)?O(t.elm,e,n):e.isAsyncPlaceholder=!0;else if(a(e.isStatic)&&a(t.isStatic)&&e.key===t.key&&(a(e.isCloned)||a(e.isOnce)))e.componentInstance=t.componentInstance;else{var d,h=e.data;i(h)&&i(d=h.hook)&&i(d=d.prepatch)&&d(t,e);var m=t.children,y=e.children;if(i(h)&&v(e)){for(d=0;d<r.update.length;++d)r.update[d](t,e);i(d=h.hook)&&i(d=d.update)&&d(t,e)}o(e.text)?i(m)&&i(y)?m!==y&&function(t,e,n,r,a){var s,c,l,p=0,d=0,h=e.length-1,v=e[0],m=e[h],y=n.length-1,g=n[0],_=n[y],$=!a;for(0;p<=h&&d<=y;)o(v)?v=e[++p]:o(m)?m=e[--h]:er(v,g)?(x(v,g,r,n,d),v=e[++p],g=n[++d]):er(m,_)?(x(m,_,r,n,y),m=e[--h],_=n[--y]):er(v,_)?(x(v,_,r,n,y),$&&u.insertBefore(t,v.elm,u.nextSibling(m.elm)),v=e[++p],_=n[--y]):er(m,g)?(x(m,g,r,n,d),$&&u.insertBefore(t,m.elm,v.elm),m=e[--h],g=n[++d]):(o(s)&&(s=nr(e,p,h)),o(c=i(g.key)?s[g.key]:C(g,e,p,h))?f(g,r,t,v.elm,!1,n,d):er(l=e[c],g)?(x(l,g,r,n,d),e[c]=void 0,$&&u.insertBefore(t,l.elm,v.elm)):f(g,r,t,v.elm,!1,n,d),g=n[++d]);p>h?b(t,o(n[y+1])?null:n[y+1].elm,n,d,y,r):d>y&&w(e,p,h)}(p,m,y,n,l):i(y)?(i(t.text)&&u.setTextContent(p,""),b(p,null,y,0,y.length-1,n)):i(m)?w(m,0,m.length-1):i(t.text)&&u.setTextContent(p,""):t.text!==e.text&&u.setTextContent(p,e.text),i(h)&&i(d=h.hook)&&i(d=d.postpatch)&&d(t,e)}}}function k(t,e,n){if(a(n)&&i(t.parent))t.parent.data.pendingInsert=e;else for(var r=0;r<e.length;++r)e[r].data.hook.insert(e[r])}var A=m("attrs,class,staticClass,staticStyle,key");function O(t,e,n,r){var o,s=e.tag,c=e.data,u=e.children;if(r=r||c&&c.pre,e.elm=t,a(e.isComment)&&i(e.asyncFactory))return e.isAsyncPlaceholder=!0,!0;if(i(c)&&(i(o=c.hook)&&i(o=o.init)&&o(e,!0),i(o=e.componentInstance)))return p(e,n),!0;if(i(s)){if(i(u))if(t.hasChildNodes())if(i(o=c)&&i(o=o.domProps)&&i(o=o.innerHTML)){if(o!==t.innerHTML)return!1}else{for(var l=!0,f=t.firstChild,d=0;d<u.length;d++){if(!f||!O(f,u[d],n,r)){l=!1;break}f=f.nextSibling}if(!l||f)return!1}else h(e,u,n);if(i(c)){var v=!1;for(var m in c)if(!A(m)){v=!0,y(e,n);break}!v&&c.class&&re(c.class)}}else t.data!==e.text&&(t.data=e.text);return!0}return function(t,e,n,s){if(!o(e)){var c,l=!1,p=[];if(o(t))l=!0,f(e,p);else{var d=i(t.nodeType);if(!d&&er(t,e))x(t,e,p,null,null,s);else{if(d){if(1===t.nodeType&&t.hasAttribute("data-server-rendered")&&(t.removeAttribute("data-server-rendered"),n=!0),a(n)&&O(t,e,p))return k(e,p,!0),t;c=t,t=new ht(u.tagName(c).toLowerCase(),{},[],void 0,c)}var h=t.elm,m=u.parentNode(h);if(f(e,p,h._leaveCb?null:m,u.nextSibling(h)),i(e.parent))for(var y=e.parent,g=v(e);y;){for(var b=0;b<r.destroy.length;++b)r.destroy[b](y);if(y.elm=e.elm,g){for(var $=0;$<r.create.length;++$)r.create[$](Yn,y);var C=y.data.hook.insert;if(C.merged)for(var A=1;A<C.fns.length;A++)C.fns[A]()}else Jn(y);y=y.parent}i(m)?w([t],0,0):i(t.tag)&&_(t)}}return k(e,p,l),e.elm}i(t)&&_(t)}}({nodeOps:Qn,modules:[dr,mr,Cr,Ar,Dr,H?{create:so,activate:so,remove:function(t,e){!0!==t.data.show?oo(t,e):e()}}:{}].concat(ur)});Q&&document.addEventListener("selectionchange",(function(){var t=document.activeElement;t&&t.vmodel&&yo(t,"input")}));var uo={inserted:function(t,e,n,r){"select"===n.tag?(r.elm&&!r.elm._vOptions?se(n,"postpatch",(function(){uo.componentUpdated(t,e,n)})):lo(t,e,n.context),t._vOptions=[].map.call(t.options,ho)):("textarea"===n.tag||Xn(t.type))&&(t._vModifiers=e.modifiers,e.modifiers.lazy||(t.addEventListener("compositionstart",vo),t.addEventListener("compositionend",mo),t.addEventListener("change",mo),Q&&(t.vmodel=!0)))},componentUpdated:function(t,e,n){if("select"===n.tag){lo(t,e,n.context);var r=t._vOptions,o=t._vOptions=[].map.call(t.options,ho);if(o.some((function(t,e){return!L(t,r[e])})))(t.multiple?e.value.some((function(t){return po(t,o)})):e.value!==e.oldValue&&po(e.value,o))&&yo(t,"change")}}};function lo(t,e,n){fo(t,e,n),(X||Z)&&setTimeout((function(){fo(t,e,n)}),0)}function fo(t,e,n){var r=e.value,o=t.multiple;if(!o||Array.isArray(r)){for(var i,a,s=0,c=t.options.length;s<c;s++)if(a=t.options[s],o)i=I(r,ho(a))>-1,a.selected!==i&&(a.selected=i);else if(L(ho(a),r))return void(t.selectedIndex!==s&&(t.selectedIndex=s));o||(t.selectedIndex=-1)}}function po(t,e){return e.every((function(e){return!L(e,t)}))}function ho(t){return"_value"in t?t._value:t.value}function vo(t){t.target.composing=!0}function mo(t){t.target.composing&&(t.target.composing=!1,yo(t.target,"input"))}function yo(t,e){var n=document.createEvent("HTMLEvents");n.initEvent(e,!0,!0),t.dispatchEvent(n)}function go(t){return!t.componentInstance||t.data&&t.data.transition?t:go(t.componentInstance._vnode)}var bo={model:uo,show:{bind:function(t,e,n){var r=e.value,o=(n=go(n)).data&&n.data.transition,i=t.__vOriginalDisplay="none"===t.style.display?"":t.style.display;r&&o?(n.data.show=!0,ro(n,(function(){t.style.display=i}))):t.style.display=r?i:"none"},update:function(t,e,n){var r=e.value;!r!=!e.oldValue&&((n=go(n)).data&&n.data.transition?(n.data.show=!0,r?ro(n,(function(){t.style.display=t.__vOriginalDisplay})):oo(n,(function(){t.style.display="none"}))):t.style.display=r?t.__vOriginalDisplay:"none")},unbind:function(t,e,n,r,o){o||(t.style.display=t.__vOriginalDisplay)}}},_o={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function wo(t){var e=t&&t.componentOptions;return e&&e.Ctor.options.abstract?wo(qe(e.children)):t}function $o(t){var e={},n=t.$options;for(var r in n.propsData)e[r]=t[r];var o=n._parentListeners;for(var i in o)e[C(i)]=o[i];return e}function Co(t,e){if(/\d-keep-alive$/.test(e.tag))return t("keep-alive",{props:e.componentOptions.propsData})}var xo=function(t){return t.tag||ze(t)},ko=function(t){return"show"===t.name},Ao={name:"transition",props:_o,abstract:!0,render:function(t){var e=this,n=this.$slots.default;if(n&&(n=n.filter(xo)).length){0;var r=this.mode;0;var o=n[0];if(function(t){for(;t=t.parent;)if(t.data.transition)return!0}(this.$vnode))return o;var i=wo(o);if(!i)return o;if(this._leaving)return Co(t,o);var a="__transition-"+this._uid+"-";i.key=null==i.key?i.isComment?a+"comment":a+i.tag:s(i.key)?0===String(i.key).indexOf(a)?i.key:a+i.key:i.key;var c=(i.data||(i.data={})).transition=$o(this),u=this._vnode,l=wo(u);if(i.data.directives&&i.data.directives.some(ko)&&(i.data.show=!0),l&&l.data&&!function(t,e){return e.key===t.key&&e.tag===t.tag}(i,l)&&!ze(l)&&(!l.componentInstance||!l.componentInstance._vnode.isComment)){var f=l.data.transition=E({},c);if("out-in"===r)return this._leaving=!0,se(f,"afterLeave",(function(){e._leaving=!1,e.$forceUpdate()})),Co(t,o);if("in-out"===r){if(ze(i))return u;var p,d=function(){p()};se(c,"afterEnter",d),se(c,"enterCancelled",d),se(f,"delayLeave",(function(t){p=t}))}}return o}}},Oo=E({tag:String,moveClass:String},_o);function So(t){t.elm._moveCb&&t.elm._moveCb(),t.elm._enterCb&&t.elm._enterCb()}function Eo(t){t.data.newPos=t.elm.getBoundingClientRect()}function jo(t){var e=t.data.pos,n=t.data.newPos,r=e.left-n.left,o=e.top-n.top;if(r||o){t.data.moved=!0;var i=t.elm.style;i.transform=i.WebkitTransform="translate("+r+"px,"+o+"px)",i.transitionDuration="0s"}}delete Oo.mode;var To={Transition:Ao,TransitionGroup:{props:Oo,beforeMount:function(){var t=this,e=this._update;this._update=function(n,r){var o=Qe(t);t.__patch__(t._vnode,t.kept,!1,!0),t._vnode=t.kept,o(),e.call(t,n,r)}},render:function(t){for(var e=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,o=this.$slots.default||[],i=this.children=[],a=$o(this),s=0;s<o.length;s++){var c=o[s];if(c.tag)if(null!=c.key&&0!==String(c.key).indexOf("__vlist"))i.push(c),n[c.key]=c,(c.data||(c.data={})).transition=a;else;}if(r){for(var u=[],l=[],f=0;f<r.length;f++){var p=r[f];p.data.transition=a,p.data.pos=p.elm.getBoundingClientRect(),n[p.key]?u.push(p):l.push(p)}this.kept=t(e,null,u),this.removed=l}return t(e,null,i)},updated:function(){var t=this.prevChildren,e=this.moveClass||(this.name||"v")+"-move";t.length&&this.hasMove(t[0].elm,e)&&(t.forEach(So),t.forEach(Eo),t.forEach(jo),this._reflow=document.body.offsetHeight,t.forEach((function(t){if(t.data.moved){var n=t.elm,r=n.style;Qr(n,e),r.transform=r.WebkitTransform=r.transitionDuration="",n.addEventListener(Hr,n._moveCb=function t(r){r&&r.target!==n||r&&!/transform$/.test(r.propertyName)||(n.removeEventListener(Hr,t),n._moveCb=null,Zr(n,e))})}})))},methods:{hasMove:function(t,e){if(!zr)return!1;if(this._hasMove)return this._hasMove;var n=t.cloneNode();t._transitionClasses&&t._transitionClasses.forEach((function(t){Fr(n,t)})),Ur(n,e),n.style.display="none",this.$el.appendChild(n);var r=to(n);return this.$el.removeChild(n),this._hasMove=r.hasTransform}}}};Cn.config.mustUseProp=function(t,e,n){return"value"===n&&Pn(t)&&"button"!==e||"selected"===n&&"option"===t||"checked"===n&&"input"===t||"muted"===n&&"video"===t},Cn.config.isReservedTag=Kn,Cn.config.isReservedAttr=Tn,Cn.config.getTagNamespace=function(t){return Wn(t)?"svg":"math"===t?"math":void 0},Cn.config.isUnknownElement=function(t){if(!H)return!0;if(Kn(t))return!1;if(t=t.toLowerCase(),null!=Gn[t])return Gn[t];var e=document.createElement(t);return t.indexOf("-")>-1?Gn[t]=e.constructor===window.HTMLUnknownElement||e.constructor===window.HTMLElement:Gn[t]=/HTMLUnknownElement/.test(e.toString())},E(Cn.options.directives,bo),E(Cn.options.components,To),Cn.prototype.__patch__=H?co:T,Cn.prototype.$mount=function(t,e){return function(t,e,n){var r;return t.$el=e,t.$options.render||(t.$options.render=mt),Ye(t,"beforeMount"),r=function(){t._update(t._render(),n)},new pn(t,r,T,{before:function(){t._isMounted&&!t._isDestroyed&&Ye(t,"beforeUpdate")}},!0),n=!1,null==t.$vnode&&(t._isMounted=!0,Ye(t,"mounted")),t}(this,t=t&&H?function(t){if("string"==typeof t){var e=document.querySelector(t);return e||document.createElement("div")}return t}(t):void 0,e)},H&&setTimeout((function(){U.devtools&&ot&&ot.emit("init",Cn)}),0);var Po=Cn; -/*! - * vue-router v3.1.5 - * (c) 2020 Evan You - * @license MIT - */function Ro(t){return Object.prototype.toString.call(t).indexOf("Error")>-1}function Lo(t,e){return e instanceof t||e&&(e.name===t.name||e._name===t._name)}function Io(t,e){for(var n in e)t[n]=e[n];return t}var Mo={name:"RouterView",functional:!0,props:{name:{type:String,default:"default"}},render:function(t,e){var n=e.props,r=e.children,o=e.parent,i=e.data;i.routerView=!0;for(var a=o.$createElement,s=n.name,c=o.$route,u=o._routerViewCache||(o._routerViewCache={}),l=0,f=!1;o&&o._routerRoot!==o;){var p=o.$vnode?o.$vnode.data:{};p.routerView&&l++,p.keepAlive&&o._directInactive&&o._inactive&&(f=!0),o=o.$parent}if(i.routerViewDepth=l,f){var d=u[s],h=d&&d.component;return h?(d.configProps&&Do(h,i,d.route,d.configProps),a(h,i,r)):a()}var v=c.matched[l],m=v&&v.components[s];if(!v||!m)return u[s]=null,a();u[s]={component:m},i.registerRouteInstance=function(t,e){var n=v.instances[s];(e&&n!==t||!e&&n===t)&&(v.instances[s]=e)},(i.hook||(i.hook={})).prepatch=function(t,e){v.instances[s]=e.componentInstance},i.hook.init=function(t){t.data.keepAlive&&t.componentInstance&&t.componentInstance!==v.instances[s]&&(v.instances[s]=t.componentInstance)};var y=v.props&&v.props[s];return y&&(Io(u[s],{route:c,configProps:y}),Do(m,i,c,y)),a(m,i,r)}};function Do(t,e,n,r){var o=e.props=function(t,e){switch(typeof e){case"undefined":return;case"object":return e;case"function":return e(t);case"boolean":return e?t.params:void 0;default:0}}(n,r);if(o){o=e.props=Io({},o);var i=e.attrs=e.attrs||{};for(var a in o)t.props&&a in t.props||(i[a]=o[a],delete o[a])}}var No=/[!'()*]/g,Uo=function(t){return"%"+t.charCodeAt(0).toString(16)},Fo=/%2C/g,Bo=function(t){return encodeURIComponent(t).replace(No,Uo).replace(Fo,",")},Vo=decodeURIComponent;function zo(t){var e={};return(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach((function(t){var n=t.replace(/\+/g," ").split("="),r=Vo(n.shift()),o=n.length>0?Vo(n.join("=")):null;void 0===e[r]?e[r]=o:Array.isArray(e[r])?e[r].push(o):e[r]=[e[r],o]})),e):e}function qo(t){var e=t?Object.keys(t).map((function(e){var n=t[e];if(void 0===n)return"";if(null===n)return Bo(e);if(Array.isArray(n)){var r=[];return n.forEach((function(t){void 0!==t&&(null===t?r.push(Bo(e)):r.push(Bo(e)+"="+Bo(t)))})),r.join("&")}return Bo(e)+"="+Bo(n)})).filter((function(t){return t.length>0})).join("&"):null;return e?"?"+e:""}var Ho=/\/?$/;function Wo(t,e,n,r){var o=r&&r.options.stringifyQuery,i=e.query||{};try{i=Ko(i)}catch(t){}var a={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:i,params:e.params||{},fullPath:Qo(e,o),matched:t?Xo(t):[]};return n&&(a.redirectedFrom=Qo(n,o)),Object.freeze(a)}function Ko(t){if(Array.isArray(t))return t.map(Ko);if(t&&"object"==typeof t){var e={};for(var n in t)e[n]=Ko(t[n]);return e}return t}var Go=Wo(null,{path:"/"});function Xo(t){for(var e=[];t;)e.unshift(t),t=t.parent;return e}function Qo(t,e){var n=t.path,r=t.query;void 0===r&&(r={});var o=t.hash;return void 0===o&&(o=""),(n||"/")+(e||qo)(r)+o}function Zo(t,e){return e===Go?t===e:!!e&&(t.path&&e.path?t.path.replace(Ho,"")===e.path.replace(Ho,"")&&t.hash===e.hash&&Jo(t.query,e.query):!(!t.name||!e.name)&&(t.name===e.name&&t.hash===e.hash&&Jo(t.query,e.query)&&Jo(t.params,e.params)))}function Jo(t,e){if(void 0===t&&(t={}),void 0===e&&(e={}),!t||!e)return t===e;var n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every((function(n){var r=t[n],o=e[n];return"object"==typeof r&&"object"==typeof o?Jo(r,o):String(r)===String(o)}))}function Yo(t,e,n){var r=t.charAt(0);if("/"===r)return t;if("?"===r||"#"===r)return e+t;var o=e.split("/");n&&o[o.length-1]||o.pop();for(var i=t.replace(/^\//,"").split("/"),a=0;a<i.length;a++){var s=i[a];".."===s?o.pop():"."!==s&&o.push(s)}return""!==o[0]&&o.unshift(""),o.join("/")}function ti(t){return t.replace(/\/\//g,"/")}var ei=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},ni=mi,ri=ci,oi=function(t,e){return li(ci(t,e))},ii=li,ai=vi,si=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function ci(t,e){for(var n,r=[],o=0,i=0,a="",s=e&&e.delimiter||"/";null!=(n=si.exec(t));){var c=n[0],u=n[1],l=n.index;if(a+=t.slice(i,l),i=l+c.length,u)a+=u[1];else{var f=t[i],p=n[2],d=n[3],h=n[4],v=n[5],m=n[6],y=n[7];a&&(r.push(a),a="");var g=null!=p&&null!=f&&f!==p,b="+"===m||"*"===m,_="?"===m||"*"===m,w=n[2]||s,$=h||v;r.push({name:d||o++,prefix:p||"",delimiter:w,optional:_,repeat:b,partial:g,asterisk:!!y,pattern:$?pi($):y?".*":"[^"+fi(w)+"]+?"})}}return i<t.length&&(a+=t.substr(i)),a&&r.push(a),r}function ui(t){return encodeURI(t).replace(/[\/?#]/g,(function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()}))}function li(t){for(var e=new Array(t.length),n=0;n<t.length;n++)"object"==typeof t[n]&&(e[n]=new RegExp("^(?:"+t[n].pattern+")$"));return function(n,r){for(var o="",i=n||{},a=(r||{}).pretty?ui:encodeURIComponent,s=0;s<t.length;s++){var c=t[s];if("string"!=typeof c){var u,l=i[c.name];if(null==l){if(c.optional){c.partial&&(o+=c.prefix);continue}throw new TypeError('Expected "'+c.name+'" to be defined')}if(ei(l)){if(!c.repeat)throw new TypeError('Expected "'+c.name+'" to not repeat, but received `'+JSON.stringify(l)+"`");if(0===l.length){if(c.optional)continue;throw new TypeError('Expected "'+c.name+'" to not be empty')}for(var f=0;f<l.length;f++){if(u=a(l[f]),!e[s].test(u))throw new TypeError('Expected all "'+c.name+'" to match "'+c.pattern+'", but received `'+JSON.stringify(u)+"`");o+=(0===f?c.prefix:c.delimiter)+u}}else{if(u=c.asterisk?encodeURI(l).replace(/[?#]/g,(function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})):a(l),!e[s].test(u))throw new TypeError('Expected "'+c.name+'" to match "'+c.pattern+'", but received "'+u+'"');o+=c.prefix+u}}else o+=c}return o}}function fi(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function pi(t){return t.replace(/([=!:$\/()])/g,"\\$1")}function di(t,e){return t.keys=e,t}function hi(t){return t.sensitive?"":"i"}function vi(t,e,n){ei(e)||(n=e||n,e=[]);for(var r=(n=n||{}).strict,o=!1!==n.end,i="",a=0;a<t.length;a++){var s=t[a];if("string"==typeof s)i+=fi(s);else{var c=fi(s.prefix),u="(?:"+s.pattern+")";e.push(s),s.repeat&&(u+="(?:"+c+u+")*"),i+=u=s.optional?s.partial?c+"("+u+")?":"(?:"+c+"("+u+"))?":c+"("+u+")"}}var l=fi(n.delimiter||"/"),f=i.slice(-l.length)===l;return r||(i=(f?i.slice(0,-l.length):i)+"(?:"+l+"(?=$))?"),i+=o?"$":r&&f?"":"(?="+l+"|$)",di(new RegExp("^"+i,hi(n)),e)}function mi(t,e,n){return ei(e)||(n=e||n,e=[]),n=n||{},t instanceof RegExp?function(t,e){var n=t.source.match(/\((?!\?)/g);if(n)for(var r=0;r<n.length;r++)e.push({name:r,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return di(t,e)}(t,e):ei(t)?function(t,e,n){for(var r=[],o=0;o<t.length;o++)r.push(mi(t[o],e,n).source);return di(new RegExp("(?:"+r.join("|")+")",hi(n)),e)}(t,e,n):function(t,e,n){return vi(ci(t,n),e,n)}(t,e,n)}ni.parse=ri,ni.compile=oi,ni.tokensToFunction=ii,ni.tokensToRegExp=ai;var yi=Object.create(null);function gi(t,e,n){e=e||{};try{var r=yi[t]||(yi[t]=ni.compile(t));return e.pathMatch&&(e[0]=e.pathMatch),r(e,{pretty:!0})}catch(t){return""}finally{delete e[0]}}function bi(t,e,n,r){var o="string"==typeof t?{path:t}:t;if(o._normalized)return o;if(o.name){var i=(o=Io({},t)).params;return i&&"object"==typeof i&&(o.params=Io({},i)),o}if(!o.path&&o.params&&e){(o=Io({},o))._normalized=!0;var a=Io(Io({},e.params),o.params);if(e.name)o.name=e.name,o.params=a;else if(e.matched.length){var s=e.matched[e.matched.length-1].path;o.path=gi(s,a,e.path)}else 0;return o}var c=function(t){var e="",n="",r=t.indexOf("#");r>=0&&(e=t.slice(r),t=t.slice(0,r));var o=t.indexOf("?");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{path:t,query:n,hash:e}}(o.path||""),u=e&&e.path||"/",l=c.path?Yo(c.path,u,n||o.append):u,f=function(t,e,n){void 0===e&&(e={});var r,o=n||zo;try{r=o(t||"")}catch(t){r={}}for(var i in e)r[i]=e[i];return r}(c.query,o.query,r&&r.options.parseQuery),p=o.hash||c.hash;return p&&"#"!==p.charAt(0)&&(p="#"+p),{_normalized:!0,path:l,query:f,hash:p}}var _i,wi=function(){},$i={name:"RouterLink",props:{to:{type:[String,Object],required:!0},tag:{type:String,default:"a"},exact:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String,event:{type:[String,Array],default:"click"}},render:function(t){var e=this,n=this.$router,r=this.$route,o=n.resolve(this.to,r,this.append),i=o.location,a=o.route,s=o.href,c={},u=n.options.linkActiveClass,l=n.options.linkExactActiveClass,f=null==u?"router-link-active":u,p=null==l?"router-link-exact-active":l,d=null==this.activeClass?f:this.activeClass,h=null==this.exactActiveClass?p:this.exactActiveClass,v=a.redirectedFrom?Wo(null,bi(a.redirectedFrom),null,n):a;c[h]=Zo(r,v),c[d]=this.exact?c[h]:function(t,e){return 0===t.path.replace(Ho,"/").indexOf(e.path.replace(Ho,"/"))&&(!e.hash||t.hash===e.hash)&&function(t,e){for(var n in e)if(!(n in t))return!1;return!0}(t.query,e.query)}(r,v);var m=function(t){Ci(t)&&(e.replace?n.replace(i,wi):n.push(i,wi))},y={click:Ci};Array.isArray(this.event)?this.event.forEach((function(t){y[t]=m})):y[this.event]=m;var g={class:c},b=!this.$scopedSlots.$hasNormal&&this.$scopedSlots.default&&this.$scopedSlots.default({href:s,route:a,navigate:m,isActive:c[d],isExactActive:c[h]});if(b){if(1===b.length)return b[0];if(b.length>1||!b.length)return 0===b.length?t():t("span",{},b)}if("a"===this.tag)g.on=y,g.attrs={href:s};else{var _=function t(e){var n;if(e)for(var r=0;r<e.length;r++){if("a"===(n=e[r]).tag)return n;if(n.children&&(n=t(n.children)))return n}}(this.$slots.default);if(_){_.isStatic=!1;var w=_.data=Io({},_.data);for(var $ in w.on=w.on||{},w.on){var C=w.on[$];$ in y&&(w.on[$]=Array.isArray(C)?C:[C])}for(var x in y)x in w.on?w.on[x].push(y[x]):w.on[x]=m;(_.data.attrs=Io({},_.data.attrs)).href=s}else g.on=y}return t(this.tag,g,this.$slots.default)}};function Ci(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||t.defaultPrevented||void 0!==t.button&&0!==t.button)){if(t.currentTarget&&t.currentTarget.getAttribute){var e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}var xi="undefined"!=typeof window;function ki(t,e,n,r){var o=e||[],i=n||Object.create(null),a=r||Object.create(null);t.forEach((function(t){!function t(e,n,r,o,i,a){var s=o.path,c=o.name;0;var u=o.pathToRegexpOptions||{},l=function(t,e,n){n||(t=t.replace(/\/$/,""));if("/"===t[0])return t;if(null==e)return t;return ti(e.path+"/"+t)}(s,i,u.strict);"boolean"==typeof o.caseSensitive&&(u.sensitive=o.caseSensitive);var f={path:l,regex:Ai(l,u),components:o.components||{default:o.component},instances:{},name:c,parent:i,matchAs:a,redirect:o.redirect,beforeEnter:o.beforeEnter,meta:o.meta||{},props:null==o.props?{}:o.components?o.props:{default:o.props}};o.children&&o.children.forEach((function(o){var i=a?ti(a+"/"+o.path):void 0;t(e,n,r,o,f,i)}));n[f.path]||(e.push(f.path),n[f.path]=f);if(void 0!==o.alias)for(var p=Array.isArray(o.alias)?o.alias:[o.alias],d=0;d<p.length;++d){0;var h={path:p[d],children:o.children};t(e,n,r,h,i,f.path||"/")}c&&(r[c]||(r[c]=f))}(o,i,a,t)}));for(var s=0,c=o.length;s<c;s++)"*"===o[s]&&(o.push(o.splice(s,1)[0]),c--,s--);return{pathList:o,pathMap:i,nameMap:a}}function Ai(t,e){return ni(t,[],e)}function Oi(t,e){var n=ki(t),r=n.pathList,o=n.pathMap,i=n.nameMap;function a(t,n,a){var s=bi(t,n,!1,e),u=s.name;if(u){var l=i[u];if(!l)return c(null,s);var f=l.regex.keys.filter((function(t){return!t.optional})).map((function(t){return t.name}));if("object"!=typeof s.params&&(s.params={}),n&&"object"==typeof n.params)for(var p in n.params)!(p in s.params)&&f.indexOf(p)>-1&&(s.params[p]=n.params[p]);return s.path=gi(l.path,s.params),c(l,s,a)}if(s.path){s.params={};for(var d=0;d<r.length;d++){var h=r[d],v=o[h];if(Si(v.regex,s.path,s.params))return c(v,s,a)}}return c(null,s)}function s(t,n){var r=t.redirect,o="function"==typeof r?r(Wo(t,n,null,e)):r;if("string"==typeof o&&(o={path:o}),!o||"object"!=typeof o)return c(null,n);var s=o,u=s.name,l=s.path,f=n.query,p=n.hash,d=n.params;if(f=s.hasOwnProperty("query")?s.query:f,p=s.hasOwnProperty("hash")?s.hash:p,d=s.hasOwnProperty("params")?s.params:d,u){i[u];return a({_normalized:!0,name:u,query:f,hash:p,params:d},void 0,n)}if(l){var h=function(t,e){return Yo(t,e.parent?e.parent.path:"/",!0)}(l,t);return a({_normalized:!0,path:gi(h,d),query:f,hash:p},void 0,n)}return c(null,n)}function c(t,n,r){return t&&t.redirect?s(t,r||n):t&&t.matchAs?function(t,e,n){var r=a({_normalized:!0,path:gi(n,e.params)});if(r){var o=r.matched,i=o[o.length-1];return e.params=r.params,c(i,e)}return c(null,e)}(0,n,t.matchAs):Wo(t,n,r,e)}return{match:a,addRoutes:function(t){ki(t,r,o,i)}}}function Si(t,e,n){var r=e.match(t);if(!r)return!1;if(!n)return!0;for(var o=1,i=r.length;o<i;++o){var a=t.keys[o-1],s="string"==typeof r[o]?decodeURIComponent(r[o]):r[o];a&&(n[a.name||"pathMatch"]=s)}return!0}var Ei=xi&&window.performance&&window.performance.now?window.performance:Date;function ji(){return Ei.now().toFixed(3)}var Ti=ji();function Pi(){return Ti}function Ri(t){return Ti=t}var Li=Object.create(null);function Ii(){var t=window.location.protocol+"//"+window.location.host,e=window.location.href.replace(t,"");window.history.replaceState({key:Pi()},"",e),window.addEventListener("popstate",(function(t){Di(),t.state&&t.state.key&&Ri(t.state.key)}))}function Mi(t,e,n,r){if(t.app){var o=t.options.scrollBehavior;o&&t.app.$nextTick((function(){var i=function(){var t=Pi();if(t)return Li[t]}(),a=o.call(t,e,n,r?i:null);a&&("function"==typeof a.then?a.then((function(t){Vi(t,i)})).catch((function(t){0})):Vi(a,i))}))}}function Di(){var t=Pi();t&&(Li[t]={x:window.pageXOffset,y:window.pageYOffset})}function Ni(t){return Fi(t.x)||Fi(t.y)}function Ui(t){return{x:Fi(t.x)?t.x:window.pageXOffset,y:Fi(t.y)?t.y:window.pageYOffset}}function Fi(t){return"number"==typeof t}var Bi=/^#\d/;function Vi(t,e){var n,r="object"==typeof t;if(r&&"string"==typeof t.selector){var o=Bi.test(t.selector)?document.getElementById(t.selector.slice(1)):document.querySelector(t.selector);if(o){var i=t.offset&&"object"==typeof t.offset?t.offset:{};e=function(t,e){var n=document.documentElement.getBoundingClientRect(),r=t.getBoundingClientRect();return{x:r.left-n.left-e.x,y:r.top-n.top-e.y}}(o,i={x:Fi((n=i).x)?n.x:0,y:Fi(n.y)?n.y:0})}else Ni(t)&&(e=Ui(t))}else r&&Ni(t)&&(e=Ui(t));e&&window.scrollTo(e.x,e.y)}var zi,qi=xi&&((-1===(zi=window.navigator.userAgent).indexOf("Android 2.")&&-1===zi.indexOf("Android 4.0")||-1===zi.indexOf("Mobile Safari")||-1!==zi.indexOf("Chrome")||-1!==zi.indexOf("Windows Phone"))&&window.history&&"pushState"in window.history);function Hi(t,e){Di();var n=window.history;try{if(e){var r=Io({},n.state);r.key=Pi(),n.replaceState(r,"",t)}else n.pushState({key:Ri(ji())},"",t)}catch(n){window.location[e?"replace":"assign"](t)}}function Wi(t){Hi(t,!0)}function Ki(t,e,n){var r=function(o){o>=t.length?n():t[o]?e(t[o],(function(){r(o+1)})):r(o+1)};r(0)}function Gi(t){return function(e,n,r){var o=!1,i=0,a=null;Xi(t,(function(t,e,n,s){if("function"==typeof t&&void 0===t.cid){o=!0,i++;var c,u=Ji((function(e){var o;((o=e).__esModule||Zi&&"Module"===o[Symbol.toStringTag])&&(e=e.default),t.resolved="function"==typeof e?e:_i.extend(e),n.components[s]=e,--i<=0&&r()})),l=Ji((function(t){var e="Failed to resolve async component "+s+": "+t;a||(a=Ro(t)?t:new Error(e),r(a))}));try{c=t(u,l)}catch(t){l(t)}if(c)if("function"==typeof c.then)c.then(u,l);else{var f=c.component;f&&"function"==typeof f.then&&f.then(u,l)}}})),o||r()}}function Xi(t,e){return Qi(t.map((function(t){return Object.keys(t.components).map((function(n){return e(t.components[n],t.instances[n],t,n)}))})))}function Qi(t){return Array.prototype.concat.apply([],t)}var Zi="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;function Ji(t){var e=!1;return function(){for(var n=[],r=arguments.length;r--;)n[r]=arguments[r];if(!e)return e=!0,t.apply(this,n)}}var Yi=function(t){function e(e){t.call(this),this.name=this._name="NavigationDuplicated",this.message='Navigating to current location ("'+e.fullPath+'") is not allowed',Object.defineProperty(this,"stack",{value:(new t).stack,writable:!0,configurable:!0})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error);Yi._name="NavigationDuplicated";var ta=function(t,e){this.router=t,this.base=function(t){if(!t)if(xi){var e=document.querySelector("base");t=(t=e&&e.getAttribute("href")||"/").replace(/^https?:\/\/[^\/]+/,"")}else t="/";"/"!==t.charAt(0)&&(t="/"+t);return t.replace(/\/$/,"")}(e),this.current=Go,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[]};function ea(t,e,n,r){var o=Xi(t,(function(t,r,o,i){var a=function(t,e){"function"!=typeof t&&(t=_i.extend(t));return t.options[e]}(t,e);if(a)return Array.isArray(a)?a.map((function(t){return n(t,r,o,i)})):n(a,r,o,i)}));return Qi(r?o.reverse():o)}function na(t,e){if(e)return function(){return t.apply(e,arguments)}}ta.prototype.listen=function(t){this.cb=t},ta.prototype.onReady=function(t,e){this.ready?t():(this.readyCbs.push(t),e&&this.readyErrorCbs.push(e))},ta.prototype.onError=function(t){this.errorCbs.push(t)},ta.prototype.transitionTo=function(t,e,n){var r=this,o=this.router.match(t,this.current);this.confirmTransition(o,(function(){r.updateRoute(o),e&&e(o),r.ensureURL(),r.ready||(r.ready=!0,r.readyCbs.forEach((function(t){t(o)})))}),(function(t){n&&n(t),t&&!r.ready&&(r.ready=!0,r.readyErrorCbs.forEach((function(e){e(t)})))}))},ta.prototype.confirmTransition=function(t,e,n){var r=this,o=this.current,i=function(t){!Lo(Yi,t)&&Ro(t)&&(r.errorCbs.length?r.errorCbs.forEach((function(e){e(t)})):console.error(t)),n&&n(t)};if(Zo(t,o)&&t.matched.length===o.matched.length)return this.ensureURL(),i(new Yi(t));var a=function(t,e){var n,r=Math.max(t.length,e.length);for(n=0;n<r&&t[n]===e[n];n++);return{updated:e.slice(0,n),activated:e.slice(n),deactivated:t.slice(n)}}(this.current.matched,t.matched),s=a.updated,c=a.deactivated,u=a.activated,l=[].concat(function(t){return ea(t,"beforeRouteLeave",na,!0)}(c),this.router.beforeHooks,function(t){return ea(t,"beforeRouteUpdate",na)}(s),u.map((function(t){return t.beforeEnter})),Gi(u));this.pending=t;var f=function(e,n){if(r.pending!==t)return i();try{e(t,o,(function(t){!1===t||Ro(t)?(r.ensureURL(!0),i(t)):"string"==typeof t||"object"==typeof t&&("string"==typeof t.path||"string"==typeof t.name)?(i(),"object"==typeof t&&t.replace?r.replace(t):r.push(t)):n(t)}))}catch(t){i(t)}};Ki(l,f,(function(){var n=[];Ki(function(t,e,n){return ea(t,"beforeRouteEnter",(function(t,r,o,i){return function(t,e,n,r,o){return function(i,a,s){return t(i,a,(function(t){"function"==typeof t&&r.push((function(){!function t(e,n,r,o){n[r]&&!n[r]._isBeingDestroyed?e(n[r]):o()&&setTimeout((function(){t(e,n,r,o)}),16)}(t,e.instances,n,o)})),s(t)}))}}(t,o,i,e,n)}))}(u,n,(function(){return r.current===t})).concat(r.router.resolveHooks),f,(function(){if(r.pending!==t)return i();r.pending=null,e(t),r.router.app&&r.router.app.$nextTick((function(){n.forEach((function(t){t()}))}))}))}))},ta.prototype.updateRoute=function(t){var e=this.current;this.current=t,this.cb&&this.cb(t),this.router.afterHooks.forEach((function(n){n&&n(t,e)}))};var ra=function(t){function e(e,n){var r=this;t.call(this,e,n);var o=e.options.scrollBehavior,i=qi&&o;i&&Ii();var a=oa(this.base);window.addEventListener("popstate",(function(t){var n=r.current,o=oa(r.base);r.current===Go&&o===a||r.transitionTo(o,(function(t){i&&Mi(e,t,n,!0)}))}))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.go=function(t){window.history.go(t)},e.prototype.push=function(t,e,n){var r=this,o=this.current;this.transitionTo(t,(function(t){Hi(ti(r.base+t.fullPath)),Mi(r.router,t,o,!1),e&&e(t)}),n)},e.prototype.replace=function(t,e,n){var r=this,o=this.current;this.transitionTo(t,(function(t){Wi(ti(r.base+t.fullPath)),Mi(r.router,t,o,!1),e&&e(t)}),n)},e.prototype.ensureURL=function(t){if(oa(this.base)!==this.current.fullPath){var e=ti(this.base+this.current.fullPath);t?Hi(e):Wi(e)}},e.prototype.getCurrentLocation=function(){return oa(this.base)},e}(ta);function oa(t){var e=decodeURI(window.location.pathname);return t&&0===e.indexOf(t)&&(e=e.slice(t.length)),(e||"/")+window.location.search+window.location.hash}var ia=function(t){function e(e,n,r){t.call(this,e,n),r&&function(t){var e=oa(t);if(!/^\/#/.test(e))return window.location.replace(ti(t+"/#"+e)),!0}(this.base)||aa()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setupListeners=function(){var t=this,e=this.router.options.scrollBehavior,n=qi&&e;n&&Ii(),window.addEventListener(qi?"popstate":"hashchange",(function(){var e=t.current;aa()&&t.transitionTo(sa(),(function(r){n&&Mi(t.router,r,e,!0),qi||la(r.fullPath)}))}))},e.prototype.push=function(t,e,n){var r=this,o=this.current;this.transitionTo(t,(function(t){ua(t.fullPath),Mi(r.router,t,o,!1),e&&e(t)}),n)},e.prototype.replace=function(t,e,n){var r=this,o=this.current;this.transitionTo(t,(function(t){la(t.fullPath),Mi(r.router,t,o,!1),e&&e(t)}),n)},e.prototype.go=function(t){window.history.go(t)},e.prototype.ensureURL=function(t){var e=this.current.fullPath;sa()!==e&&(t?ua(e):la(e))},e.prototype.getCurrentLocation=function(){return sa()},e}(ta);function aa(){var t=sa();return"/"===t.charAt(0)||(la("/"+t),!1)}function sa(){var t=window.location.href,e=t.indexOf("#");if(e<0)return"";var n=(t=t.slice(e+1)).indexOf("?");if(n<0){var r=t.indexOf("#");t=r>-1?decodeURI(t.slice(0,r))+t.slice(r):decodeURI(t)}else t=decodeURI(t.slice(0,n))+t.slice(n);return t}function ca(t){var e=window.location.href,n=e.indexOf("#");return(n>=0?e.slice(0,n):e)+"#"+t}function ua(t){qi?Hi(ca(t)):window.location.hash=t}function la(t){qi?Wi(ca(t)):window.location.replace(ca(t))}var fa=function(t){function e(e,n){t.call(this,e,n),this.stack=[],this.index=-1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.push=function(t,e,n){var r=this;this.transitionTo(t,(function(t){r.stack=r.stack.slice(0,r.index+1).concat(t),r.index++,e&&e(t)}),n)},e.prototype.replace=function(t,e,n){var r=this;this.transitionTo(t,(function(t){r.stack=r.stack.slice(0,r.index).concat(t),e&&e(t)}),n)},e.prototype.go=function(t){var e=this,n=this.index+t;if(!(n<0||n>=this.stack.length)){var r=this.stack[n];this.confirmTransition(r,(function(){e.index=n,e.updateRoute(r)}),(function(t){Lo(Yi,t)&&(e.index=n)}))}},e.prototype.getCurrentLocation=function(){var t=this.stack[this.stack.length-1];return t?t.fullPath:"/"},e.prototype.ensureURL=function(){},e}(ta),pa=function(t){void 0===t&&(t={}),this.app=null,this.apps=[],this.options=t,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=Oi(t.routes||[],this);var e=t.mode||"hash";switch(this.fallback="history"===e&&!qi&&!1!==t.fallback,this.fallback&&(e="hash"),xi||(e="abstract"),this.mode=e,e){case"history":this.history=new ra(this,t.base);break;case"hash":this.history=new ia(this,t.base,this.fallback);break;case"abstract":this.history=new fa(this,t.base);break;default:0}},da={currentRoute:{configurable:!0}};function ha(t,e){return t.push(e),function(){var n=t.indexOf(e);n>-1&&t.splice(n,1)}}pa.prototype.match=function(t,e,n){return this.matcher.match(t,e,n)},da.currentRoute.get=function(){return this.history&&this.history.current},pa.prototype.init=function(t){var e=this;if(this.apps.push(t),t.$once("hook:destroyed",(function(){var n=e.apps.indexOf(t);n>-1&&e.apps.splice(n,1),e.app===t&&(e.app=e.apps[0]||null)})),!this.app){this.app=t;var n=this.history;if(n instanceof ra)n.transitionTo(n.getCurrentLocation());else if(n instanceof ia){var r=function(){n.setupListeners()};n.transitionTo(n.getCurrentLocation(),r,r)}n.listen((function(t){e.apps.forEach((function(e){e._route=t}))}))}},pa.prototype.beforeEach=function(t){return ha(this.beforeHooks,t)},pa.prototype.beforeResolve=function(t){return ha(this.resolveHooks,t)},pa.prototype.afterEach=function(t){return ha(this.afterHooks,t)},pa.prototype.onReady=function(t,e){this.history.onReady(t,e)},pa.prototype.onError=function(t){this.history.onError(t)},pa.prototype.push=function(t,e,n){var r=this;if(!e&&!n&&"undefined"!=typeof Promise)return new Promise((function(e,n){r.history.push(t,e,n)}));this.history.push(t,e,n)},pa.prototype.replace=function(t,e,n){var r=this;if(!e&&!n&&"undefined"!=typeof Promise)return new Promise((function(e,n){r.history.replace(t,e,n)}));this.history.replace(t,e,n)},pa.prototype.go=function(t){this.history.go(t)},pa.prototype.back=function(){this.go(-1)},pa.prototype.forward=function(){this.go(1)},pa.prototype.getMatchedComponents=function(t){var e=t?t.matched?t:this.resolve(t).route:this.currentRoute;return e?[].concat.apply([],e.matched.map((function(t){return Object.keys(t.components).map((function(e){return t.components[e]}))}))):[]},pa.prototype.resolve=function(t,e,n){var r=bi(t,e=e||this.history.current,n,this),o=this.match(r,e),i=o.redirectedFrom||o.fullPath;return{location:r,route:o,href:function(t,e,n){var r="hash"===n?"#"+e:e;return t?ti(t+"/"+r):r}(this.history.base,i,this.mode),normalizedTo:r,resolved:o}},pa.prototype.addRoutes=function(t){this.matcher.addRoutes(t),this.history.current!==Go&&this.history.transitionTo(this.history.getCurrentLocation())},Object.defineProperties(pa.prototype,da),pa.install=function t(e){if(!t.installed||_i!==e){t.installed=!0,_i=e;var n=function(t){return void 0!==t},r=function(t,e){var r=t.$options._parentVnode;n(r)&&n(r=r.data)&&n(r=r.registerRouteInstance)&&r(t,e)};e.mixin({beforeCreate:function(){n(this.$options.router)?(this._routerRoot=this,this._router=this.$options.router,this._router.init(this),e.util.defineReactive(this,"_route",this._router.history.current)):this._routerRoot=this.$parent&&this.$parent._routerRoot||this,r(this,this)},destroyed:function(){r(this)}}),Object.defineProperty(e.prototype,"$router",{get:function(){return this._routerRoot._router}}),Object.defineProperty(e.prototype,"$route",{get:function(){return this._routerRoot._route}}),e.component("RouterView",Mo),e.component("RouterLink",$i);var o=e.config.optionMergeStrategies;o.beforeRouteEnter=o.beforeRouteLeave=o.beforeRouteUpdate=o.created}},pa.version="3.1.5",xi&&window.Vue&&window.Vue.use(pa);var va=pa;var ma={NotFound:()=>n.e(4).then(n.bind(null,204)),Layout:()=>Promise.all([n.e(0),n.e(2)]).then(n.bind(null,203))},ya={"v-3c88bbf2":()=>n.e(5).then(n.bind(null,205)),"v-0decf914":()=>n.e(6).then(n.bind(null,206)),"v-d7e5bcfc":()=>n.e(7).then(n.bind(null,207)),"v-6d148503":()=>n.e(9).then(n.bind(null,208)),"v-2bf9c0ae":()=>n.e(11).then(n.bind(null,209)),"v-70457f72":()=>n.e(10).then(n.bind(null,210)),"v-1c00b5c9":()=>n.e(12).then(n.bind(null,211)),"v-4419f5c9":()=>n.e(8).then(n.bind(null,212)),"v-7bafdcee":()=>n.e(13).then(n.bind(null,213)),"v-300a59ee":()=>n.e(14).then(n.bind(null,214)),"v-a971ed74":()=>n.e(15).then(n.bind(null,215))};function ga(t){const e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}const ba=/-(\w)/g,_a=ga(t=>t.replace(ba,(t,e)=>e?e.toUpperCase():"")),wa=/\B([A-Z])/g,$a=ga(t=>t.replace(wa,"-$1").toLowerCase()),Ca=ga(t=>t.charAt(0).toUpperCase()+t.slice(1));function xa(t,e){if(!e)return;if(t(e))return t(e);return e.includes("-")?t(Ca(_a(e))):t(Ca(e))||t($a(e))}const ka=Object.assign({},ma,ya),Aa=t=>ka[t],Oa=t=>ya[t],Sa=t=>ma[t],Ea=t=>Po.component(t);function ja(t){return xa(Oa,t)}function Ta(t){return xa(Sa,t)}function Pa(t){return xa(Aa,t)}function Ra(t){return xa(Ea,t)}function La(...t){return Promise.all(t.filter(t=>t).map(async t=>{if(!Ra(t)&&Pa(t)){const e=await Pa(t)();Po.component(t,e.default)}}))}function Ia(t,e){"undefined"!=typeof window&&window.__VUEPRESS__&&(window.__VUEPRESS__[t]=e)}var Ma={created(){this.$ssrContext&&(this.$ssrContext.title=this.$title,this.$ssrContext.lang=this.$lang,this.$ssrContext.description=this.$page.description||this.$description)},mounted(){this.currentMetaTags=new Set,this.updateMeta()},methods:{updateMeta(){document.title=this.$title,document.documentElement.lang=this.$lang;const t=this.$page.frontmatter.meta||[],e=t.slice(0);0===t.filter(t=>"description"===t.name).length&&e.push({name:"description",content:this.$description});const n=document.querySelectorAll('meta[name="description"]');n.length&&n.forEach(t=>this.currentMetaTags.add(t)),this.currentMetaTags=new Set(Da(e,this.currentMetaTags))}},watch:{$page(){this.updateMeta()}},beforeDestroy(){Da(null,this.currentMetaTags)}};function Da(t,e){if(e&&[...e].forEach(t=>{document.head.removeChild(t)}),t)return t.map(t=>{const e=document.createElement("meta");return Object.keys(t).forEach(n=>{e.setAttribute(n,t[n])}),document.head.appendChild(e),e})}var Na=n(3),Ua={mounted(){window.addEventListener("scroll",this.onScroll)},methods:{onScroll:n.n(Na)()((function(){this.setActiveHash()}),300),setActiveHash(){const t=[].slice.call(document.querySelectorAll(".sidebar-link")),e=[].slice.call(document.querySelectorAll(".header-anchor")).filter(e=>t.some(t=>t.hash===e.hash)),n=Math.max(window.pageYOffset,document.documentElement.scrollTop,document.body.scrollTop),r=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),o=window.innerHeight+n;for(let t=0;t<e.length;t++){const i=e[t],a=e[t+1],s=0===t&&0===n||n>=i.parentElement.offsetTop+10&&(!a||n<a.parentElement.offsetTop-10),c=decodeURIComponent(this.$route.hash);if(s&&c!==decodeURIComponent(i.hash)){const n=i;if(o===r)for(let n=t+1;n<e.length;n++)if(c===decodeURIComponent(e[n].hash))return;return this.$vuepress.$set("disableScrollBehavior",!0),void this.$router.replace(decodeURIComponent(n.hash),()=>{this.$nextTick(()=>{this.$vuepress.$set("disableScrollBehavior",!1)})})}}}},beforeDestroy(){window.removeEventListener("scroll",this.onScroll)}},Fa=n(2),Ba=n.n(Fa),Va=[Ma,Ua,{mounted(){Ba.a.configure({showSpinner:!1}),this.$router.beforeEach((t,e,n)=>{t.path===e.path||Po.component(t.name)||Ba.a.start(),n()}),this.$router.afterEach(()=>{Ba.a.done(),this.isSidebarOpen=!1})}}],za={name:"GlobalLayout",computed:{layout:function(){var t=this.getLayout();return Ia("layout",t),Po.component(t)}},methods:{getLayout:function(){if(this.$page.path){var t=this.$page.frontmatter.layout;return t&&(this.$vuepress.getLayoutAsyncComponent(t)||this.$vuepress.getVueComponent(t))?t:"Layout"}return"NotFound"}}},qa=n(0),Ha=Object(qa.a)(za,(function(){var t=this.$createElement;return(this._self._c||t)(this.layout,{tag:"component"})}),[],!1,null,null,null).exports;!function(t,e,n){switch(e){case"components":t[e]||(t[e]={}),Object.assign(t[e],n);break;case"mixins":t[e]||(t[e]=[]),t[e].push(...n);break;default:throw new Error("Unknown option name.")}}(Ha,"mixins",Va);const Wa=[{name:"v-3c88bbf2",path:"/",component:Ha,beforeEnter:(t,e,n)=>{La("Layout","v-3c88bbf2").then(n)}},{path:"/index.html",redirect:"/"},{name:"v-0decf914",path:"/about/",component:Ha,beforeEnter:(t,e,n)=>{La("Layout","v-0decf914").then(n)}},{path:"/about/index.html",redirect:"/about/"},{name:"v-d7e5bcfc",path:"/docs/",component:Ha,beforeEnter:(t,e,n)=>{La("Layout","v-d7e5bcfc").then(n)}},{path:"/docs/index.html",redirect:"/docs/"},{name:"v-6d148503",path:"/docs/interop.html",component:Ha,beforeEnter:(t,e,n)=>{La("Layout","v-6d148503").then(n)}},{name:"v-2bf9c0ae",path:"/docs/middleware.html",component:Ha,beforeEnter:(t,e,n)=>{La("Layout","v-2bf9c0ae").then(n)}},{name:"v-70457f72",path:"/docs/introspection.html",component:Ha,beforeEnter:(t,e,n)=>{La("Layout","v-70457f72").then(n)}},{name:"v-1c00b5c9",path:"/docs/optimization.html",component:Ha,beforeEnter:(t,e,n)=>{La("Layout","v-1c00b5c9").then(n)}},{name:"v-4419f5c9",path:"/docs/examples.html",component:Ha,beforeEnter:(t,e,n)=>{La("Layout","v-4419f5c9").then(n)}},{name:"v-7bafdcee",path:"/docs/schema.html",component:Ha,beforeEnter:(t,e,n)=>{La("Layout","v-7bafdcee").then(n)}},{name:"v-300a59ee",path:"/docs/validation.html",component:Ha,beforeEnter:(t,e,n)=>{La("Layout","v-300a59ee").then(n)}},{name:"v-a971ed74",path:"/resources/",component:Ha,beforeEnter:(t,e,n)=>{La("Layout","v-a971ed74").then(n)}},{path:"/resources/index.html",redirect:"/resources/"},{path:"*",component:Ha}],Ka={title:"",description:"",base:"/caliban/",pages:[{title:"Home",frontmatter:{home:!0,heroImage:"/caliban.svg",actionText:"Get Started →",actionLink:"/docs/",features:[{title:"Purely functional",details:"All interfaces are pure and types are referentially transparent."},{title:"Minimal boilerplate",details:"No need to manually define a schema for every type in your API."},{title:"Type safe schema",details:"Schema is derived at compile-time. Resolver is provided at runtime."}]},regularPath:"/",relativePath:"README.md",key:"v-3c88bbf2",path:"/"},{title:"About",frontmatter:{},regularPath:"/about/",relativePath:"about/README.md",key:"v-0decf914",path:"/about/"},{title:"Getting Started",frontmatter:{},regularPath:"/docs/",relativePath:"docs/README.md",key:"v-d7e5bcfc",path:"/docs/",headers:[{level:2,title:"Dependencies",slug:"dependencies"},{level:2,title:"A simple example",slug:"a-simple-example"},{level:2,title:"Mutations",slug:"mutations"},{level:2,title:"Subscriptions",slug:"subscriptions"}]},{title:"Interop (Cats, Monix)",frontmatter:{},regularPath:"/docs/interop.html",relativePath:"docs/interop.md",key:"v-6d148503",path:"/docs/interop.html",headers:[{level:2,title:"Cats Effect",slug:"cats-effect"},{level:2,title:"Monix",slug:"monix"}]},{title:"Middleware",frontmatter:{},regularPath:"/docs/middleware.html",relativePath:"docs/middleware.md",key:"v-2bf9c0ae",path:"/docs/middleware.html",headers:[{level:2,title:"Wrapper types",slug:"wrapper-types"},{level:2,title:"Pre-defined wrappers",slug:"pre-defined-wrappers"},{level:2,title:"Wrapping the interpreter",slug:"wrapping-the-interpreter"}]},{title:"Introspection",frontmatter:{},regularPath:"/docs/introspection.html",relativePath:"docs/introspection.md",key:"v-70457f72",path:"/docs/introspection.html"},{title:"Query optimization",frontmatter:{},regularPath:"/docs/optimization.html",relativePath:"docs/optimization.md",key:"v-1c00b5c9",path:"/docs/optimization.html",headers:[{level:2,title:"Introducing ZQuery",slug:"introducing-zquery"},{level:2,title:"Building a DataSource",slug:"building-a-datasource"},{level:2,title:"ZQuery constructors and operators",slug:"zquery-constructors-and-operators"},{level:2,title:"Using ZQuery with Caliban",slug:"using-zquery-with-caliban"}]},{title:"Examples",frontmatter:{},regularPath:"/docs/examples.html",relativePath:"docs/examples.md",key:"v-4419f5c9",path:"/docs/examples.html"},{title:"Schemas",frontmatter:{},regularPath:"/docs/schema.html",relativePath:"docs/schema.md",key:"v-7bafdcee",path:"/docs/schema.html",headers:[{level:2,title:"Enum and union",slug:"enum-and-union"},{level:2,title:"Arguments",slug:"arguments"},{level:2,title:"Effects",slug:"effects"},{level:2,title:"Annotations",slug:"annotations"},{level:2,title:"Custom types",slug:"custom-types"},{level:2,title:"Code generation",slug:"code-generation"}]},{title:"Validation",frontmatter:{},regularPath:"/docs/validation.html",relativePath:"docs/validation.md",key:"v-300a59ee",path:"/docs/validation.html"},{title:"Resources",frontmatter:{},regularPath:"/resources/",relativePath:"resources/README.md",key:"v-a971ed74",path:"/resources/",headers:[{level:2,title:"Talks",slug:"talks"},{level:2,title:"Blog Articles",slug:"blog-articles"}]}],themeConfig:{logo:"/caliban.svg",locales:{"/":{selectText:"Language",label:"English",nav:[{text:"Documentation",link:"/docs/"},{text:"Resources",link:"/resources/"},{text:"About",link:"/about/"},{text:"Github",link:"https://github.com/ghostdogpr/caliban"},{text:"Scaladoc",link:"https://javadoc.io/doc/com.github.ghostdogpr/caliban_2.12/"}],sidebar:{"/docs/":[{title:"Caliban",collapsable:!1,sidebarDepth:2,children:["","schema","middleware","optimization","validation","introspection","interop","examples"]}]}}}},locales:{"/":{lang:"en-US",title:"Caliban",description:"Functional GraphQL backend in Scala",path:"/"}}};n(5);Po.component("Badge",()=>Promise.all([n.e(0),n.e(3)]).then(n.bind(null,216)));n(6);var Ga=[{},({Vue:t})=>{t.mixin({computed:{$dataBlock(){return this.$options.__data__block__}}})},{},{}],Xa=[];class Qa extends class{constructor(){this.store=new Po({data:{state:{}}})}$get(t){return this.store.state[t]}$set(t,e){Po.set(this.store.state,t,e)}$emit(...t){this.store.$emit(...t)}$on(...t){this.store.$on(...t)}}{}Object.assign(Qa.prototype,{getPageAsyncComponent:ja,getLayoutAsyncComponent:Ta,getAsyncComponent:Pa,getVueComponent:Ra});var Za={install(t){const e=new Qa;t.$vuepress=e,t.prototype.$vuepress=e}};function Ja(t,e){return t.options.routes.filter(t=>t.path.toLowerCase()===e.toLowerCase()).length>0}var Ya={props:{pageKey:String,slotKey:{type:String,default:"default"}},render(t){const e=this.pageKey||this.$parent.$page.key;return Ia("pageKey",e),Po.component(e)||Po.component(e,ja(e)),Po.component(e)?t(e):t("")}},ts={functional:!0,props:{slotKey:String,required:!0},render:(t,{props:e,slots:n})=>t("div",{class:[`content__${e.slotKey}`]},n()[e.slotKey])},es=(n(7),Object(qa.a)({},(function(t,e){var n=e._c;return n("svg",{staticClass:"icon outbound",attrs:{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",x:"0px",y:"0px",viewBox:"0 0 100 100",width:"15",height:"15"}},[n("path",{attrs:{fill:"currentColor",d:"M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"}}),e._v(" "),n("polygon",{attrs:{fill:"currentColor",points:"45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"}})])}),[],!0,null,null,null).exports),ns={functional:!0,render(t,{parent:e,children:n}){if(e._isMounted)return n;e.$once("hook:mounted",()=>{e.$forceUpdate()})}};Po.config.productionTip=!1,Po.use(va),Po.use(Za),Po.mixin(function(t,e,n=Po){!function(t){t.locales&&Object.keys(t.locales).forEach(e=>{t.locales[e].path=e});Object.freeze(t)}(e),n.$vuepress.$set("siteData",e);const r=new(t(n.$vuepress.$get("siteData"))),o=Object.getOwnPropertyDescriptors(Object.getPrototypeOf(r)),i={};return Object.keys(o).reduce((t,e)=>(e.startsWith("$")&&(t[e]=o[e].get),t),i),{computed:i}}(t=>class{setPage(t){this.__page=t}get $site(){return t}get $themeConfig(){return this.$site.themeConfig}get $frontmatter(){return this.$page.frontmatter}get $localeConfig(){const{locales:t={}}=this.$site;let e,n;for(const r in t)"/"===r?n=t[r]:0===this.$page.path.indexOf(r)&&(e=t[r]);return e||n||{}}get $siteTitle(){return this.$localeConfig.title||this.$site.title||""}get $title(){const t=this.$page,{metaTitle:e}=this.$page.frontmatter;if("string"==typeof e)return e;const n=this.$siteTitle,r=t.frontmatter.home?null:t.frontmatter.title||t.title;return n?r?r+" | "+n:n:r||"VuePress"}get $description(){const t=function(t){if(t){const e=t.filter(t=>"description"===t.name)[0];if(e)return e.content}}(this.$page.frontmatter.meta);return t||(this.$page.frontmatter.description||this.$localeConfig.description||this.$site.description||"")}get $lang(){return this.$page.frontmatter.lang||this.$localeConfig.lang||"en-US"}get $localePath(){return this.$localeConfig.path||"/"}get $themeLocaleConfig(){return(this.$site.themeConfig.locales||{})[this.$localePath]||{}}get $page(){return this.__page?this.__page:function(t,e){for(let n=0;n<t.length;n++){const r=t[n];if(r.path.toLowerCase()===e.toLowerCase())return r}return{path:"",frontmatter:{}}}(this.$site.pages,this.$route.path)}},Ka)),Po.component("Content",Ya),Po.component("ContentSlotsDistributor",ts),Po.component("OutboundLink",es),Po.component("ClientOnly",ns),Po.component("Layout",Ta("Layout")),Po.component("NotFound",Ta("NotFound")),Po.prototype.$withBase=function(t){const e=this.$site.base;return"/"===t.charAt(0)?e+t.slice(1):t};const{app:rs,router:os}=function(t){const e="undefined"!=typeof window&&window.__VUEPRESS_ROUTER_BASE__?window.__VUEPRESS_ROUTER_BASE__:Ka.routerBase||Ka.base,n=new va({base:e,mode:"history",fallback:!1,routes:Wa,scrollBehavior:(t,e,n)=>n||(t.hash?!Po.$vuepress.$get("disableScrollBehavior")&&{selector:t.hash}:{x:0,y:0})});!function(t){t.beforeEach((e,n,r)=>{if(Ja(t,e.path))r();else if(/(\/|\.html)$/.test(e.path))if(/\/$/.test(e.path)){const n=e.path.replace(/\/$/,"")+".html";Ja(t,n)?r(n):r()}else r();else{const n=e.path+"/",o=e.path+".html";Ja(t,o)?r(o):Ja(t,n)?r(n):r()}})}(n);const r={};try{Ga.forEach(e=>{"function"==typeof e&&e({Vue:Po,options:r,router:n,siteData:Ka,isServer:t})})}catch(t){console.error(t)}return{app:new Po(Object.assign(r,{router:n,render:t=>t("div",{attrs:{id:"app"}},[t("RouterView",{ref:"layout"}),t("div",{class:"global-ui"},Xa.map(e=>t(e)))])})),router:n}}(!1);window.__VUEPRESS__={version:"1.3.0",hash:"475a498"},os.onReady(()=>{rs.$mount("#app")})}]); \ No newline at end of file diff --git a/docs/assets/js/app.d7caee50.js b/docs/assets/js/app.d7caee50.js new file mode 100644 index 000000000..d3608c40d --- /dev/null +++ b/docs/assets/js/app.d7caee50.js @@ -0,0 +1,13 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[0],[]]);!function(t){function e(e){for(var r,a,s=e[0],c=e[1],u=e[2],l=0,p=[];l<s.length;l++)a=s[l],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&p.push(o[a][0]),o[a]=0;for(r in c)Object.prototype.hasOwnProperty.call(c,r)&&(t[r]=c[r]);for(f&&f(e);p.length;)p.shift()();return i.push.apply(i,u||[]),n()}function n(){for(var t,e=0;e<i.length;e++){for(var n=i[e],r=!0,s=1;s<n.length;s++){var c=n[s];0!==o[c]&&(r=!1)}r&&(i.splice(e--,1),t=a(a.s=n[0]))}return t}var r={},o={1:0},i=[];function a(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.e=function(t){var e=[],n=o[t];if(0!==n)if(n)e.push(n[2]);else{var r=new Promise((function(e,r){n=o[t]=[e,r]}));e.push(n[2]=r);var i,s=document.createElement("script");s.charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.src=function(t){return a.p+"assets/js/"+({}[t]||t)+"."+{2:"07c68b8b",3:"865f603a",4:"f03b7f8e",5:"5defc76c",6:"d222e5e8",7:"57a8ce51",8:"6272775d",9:"417f11bf",10:"5f8b2c07",11:"5f34d6b0",12:"bc45abe0",13:"d315a1c7",14:"b8b8c6ff",15:"23ceaf26",16:"f357ff30",17:"fa6e8c03"}[t]+".js"}(t);var c=new Error;i=function(e){s.onerror=s.onload=null,clearTimeout(u);var n=o[t];if(0!==n){if(n){var r=e&&("load"===e.type?"missing":e.type),i=e&&e.target&&e.target.src;c.message="Loading chunk "+t+" failed.\n("+r+": "+i+")",c.name="ChunkLoadError",c.type=r,c.request=i,n[1](c)}o[t]=void 0}};var u=setTimeout((function(){i({type:"timeout",target:s})}),12e4);s.onerror=s.onload=i,document.head.appendChild(s)}return Promise.all(e)},a.m=t,a.c=r,a.d=function(t,e,n){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)a.d(n,r,function(e){return t[e]}.bind(null,r));return n},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="/caliban/",a.oe=function(t){throw console.error(t),t};var s=window.webpackJsonp=window.webpackJsonp||[],c=s.push.bind(s);s.push=e,s=s.slice();for(var u=0;u<s.length;u++)e(s[u]);var f=c;i.push([111,0]),n()}([function(t,e,n){var r=n(3),o=n(20).f,i=n(9),a=n(13),s=n(47),c=n(73),u=n(62);t.exports=function(t,e){var n,f,l,p,d,h=t.target,v=t.global,y=t.stat;if(n=v?r:y?r[h]||s(h,{}):(r[h]||{}).prototype)for(f in e){if(p=e[f],l=t.noTargetGet?(d=o(n,f))&&d.value:n[f],!u(v?f:h+(y?".":"#")+f,t.forced)&&void 0!==l){if(typeof p==typeof l)continue;c(p,l)}(t.sham||l&&l.sham)&&i(p,"sham",!0),a(n,f,p,t)}}},function(t,e,n){var r=n(3),o=n(48),i=n(5),a=n(33),s=n(52),c=n(79),u=o("wks"),f=r.Symbol,l=c?f:f&&f.withoutSetter||a;t.exports=function(t){return i(u,t)||(s&&i(f,t)?u[t]=f[t]:u[t]=l("Symbol."+t)),u[t]}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){var n=function(t){return t&&t.Math==Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof global&&global)||Function("return this")()},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var r=n(2);t.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(t,e,n){var r=n(6),o=n(69),i=n(8),a=n(31),s=Object.defineProperty;e.f=r?s:function(t,e,n){if(i(t),e=a(e,!0),i(n),o)try{return s(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){var r=n(4);t.exports=function(t){if(!r(t))throw TypeError(String(t)+" is not an object");return t}},function(t,e,n){var r=n(6),o=n(7),i=n(21);t.exports=r?function(t,e,n){return o.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(43),o=n(16);t.exports=function(t){return r(o(t))}},function(t,e,n){var r=n(6),o=n(2),i=n(5),a=Object.defineProperty,s={},c=function(t){throw t};t.exports=function(t,e){if(i(s,t))return s[t];e||(e={});var n=[][t],u=!!i(e,"ACCESSORS")&&e.ACCESSORS,f=i(e,0)?e[0]:c,l=i(e,1)?e[1]:void 0;return s[t]=!!n&&!o((function(){if(u&&!r)return!0;var t={length:-1};u?a(t,1,{enumerable:!0,get:c}):t[1]=1,n.call(t,f,l)}))}},function(t,e,n){var r=n(34),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,e,n){var r=n(3),o=n(9),i=n(5),a=n(47),s=n(71),c=n(18),u=c.get,f=c.enforce,l=String(String).split("String");(t.exports=function(t,e,n,s){var c=!!s&&!!s.unsafe,u=!!s&&!!s.enumerable,p=!!s&&!!s.noTargetGet;"function"==typeof n&&("string"!=typeof e||i(n,"name")||o(n,"name",e),f(n).source=l.join("string"==typeof e?e:"")),t!==r?(c?!p&&t[e]&&(u=!0):delete t[e],u?t[e]=n:o(t,e,n)):u?t[e]=n:a(e,n)})(Function.prototype,"toString",(function(){return"function"==typeof this&&u(this).source||s(this)}))},function(t,e,n){var r=n(16);t.exports=function(t){return Object(r(t))}},function(t,e,n){var r=n(53),o=n(13),i=n(114);r||o(Object.prototype,"toString",i,{unsafe:!0})},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){"use strict";var r=n(0),o=n(19).filter,i=n(45),a=n(11),s=i("filter"),c=a("filter");r({target:"Array",proto:!0,forced:!s||!c},{filter:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){var r,o,i,a=n(112),s=n(3),c=n(4),u=n(9),f=n(5),l=n(32),p=n(24),d=s.WeakMap;if(a){var h=new d,v=h.get,y=h.has,m=h.set;r=function(t,e){return m.call(h,t,e),e},o=function(t){return v.call(h,t)||{}},i=function(t){return y.call(h,t)}}else{var g=l("state");p[g]=!0,r=function(t,e){return u(t,g,e),e},o=function(t){return f(t,g)?t[g]:{}},i=function(t){return f(t,g)}}t.exports={set:r,get:o,has:i,enforce:function(t){return i(t)?o(t):r(t,{})},getterFor:function(t){return function(e){var n;if(!c(e)||(n=o(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}}}},function(t,e,n){var r=n(51),o=n(43),i=n(14),a=n(12),s=n(104),c=[].push,u=function(t){var e=1==t,n=2==t,u=3==t,f=4==t,l=6==t,p=5==t||l;return function(d,h,v,y){for(var m,g,b=i(d),_=o(b),x=r(h,v,3),w=a(_.length),S=0,O=y||s,E=e?O(d,w):n?O(d,0):void 0;w>S;S++)if((p||S in _)&&(g=x(m=_[S],S,b),t))if(e)E[S]=g;else if(g)switch(t){case 3:return!0;case 5:return m;case 6:return S;case 2:c.call(E,m)}else if(f)return!1;return l?-1:u||f?f:E}};t.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6)}},function(t,e,n){var r=n(6),o=n(68),i=n(21),a=n(10),s=n(31),c=n(5),u=n(69),f=Object.getOwnPropertyDescriptor;e.f=r?f:function(t,e){if(t=a(t),e=s(e,!0),u)try{return f(t,e)}catch(t){}if(c(t,e))return i(!o.f.call(t,e),t[e])}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e){t.exports=!1},function(t,e){t.exports={}},function(t,e,n){var r=n(75),o=n(3),i=function(t){return"function"==typeof t?t:void 0};t.exports=function(t,e){return arguments.length<2?i(r[t])||i(o[t]):r[t]&&r[t][e]||o[t]&&o[t][e]}},function(t,e,n){var r,o=n(8),i=n(116),a=n(50),s=n(24),c=n(117),u=n(70),f=n(32),l=f("IE_PROTO"),p=function(){},d=function(t){return"<script>"+t+"<\/script>"},h=function(){try{r=document.domain&&new ActiveXObject("htmlfile")}catch(t){}var t,e;h=r?function(t){t.write(d("")),t.close();var e=t.parentWindow.Object;return t=null,e}(r):((e=u("iframe")).style.display="none",c.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(d("document.F=Object")),t.close(),t.F);for(var n=a.length;n--;)delete h.prototype[a[n]];return h()};s[l]=!0,t.exports=Object.create||function(t,e){var n;return null!==t?(p.prototype=o(t),n=new p,p.prototype=null,n[l]=t):n=h(),void 0===e?n:i(n,e)}},function(t,e){t.exports={}},function(t,e,n){"use strict";function r(t,e,n,r,o,i,a,s){var c,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),r&&(u.functional=!0),i&&(u._scopeId="data-v-"+i),a?(c=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},u._ssrRegister=c):o&&(c=s?function(){o.call(this,this.$root.$options.shadowRoot)}:o),c)if(u.functional){u._injectStyles=c;var f=u.render;u.render=function(t,e){return c.call(e),f(t,e)}}else{var l=u.beforeCreate;u.beforeCreate=l?[].concat(l,c):[c]}return{exports:t,options:u}}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";var r=n(0),o=n(46);r({target:"RegExp",proto:!0,forced:/./.exec!==o},{exec:o})},function(t,e,n){"use strict";var r=n(2);t.exports=function(t,e){var n=[][t];return!!n&&r((function(){n.call(null,e||function(){throw 1},1)}))}},function(t,e,n){var r=n(4);t.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e,n){var r=n(48),o=n(33),i=r("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++n+r).toString(36)}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e,n){"use strict";var r=n(0),o=n(4),i=n(42),a=n(77),s=n(12),c=n(10),u=n(64),f=n(1),l=n(45),p=n(11),d=l("slice"),h=p("slice",{ACCESSORS:!0,0:0,1:2}),v=f("species"),y=[].slice,m=Math.max;r({target:"Array",proto:!0,forced:!d||!h},{slice:function(t,e){var n,r,f,l=c(this),p=s(l.length),d=a(t,p),h=a(void 0===e?p:e,p);if(i(l)&&("function"!=typeof(n=l.constructor)||n!==Array&&!i(n.prototype)?o(n)&&null===(n=n[v])&&(n=void 0):n=void 0,n===Array||void 0===n))return y.call(l,d,h);for(r=new(void 0===n?Array:n)(m(h-d,0)),f=0;d<h;d++,f++)d in l&&u(r,f,l[d]);return r.length=f,r}})},function(t,e,n){var r=n(7).f,o=n(5),i=n(1)("toStringTag");t.exports=function(t,e,n){t&&!o(t=n?t:t.prototype,i)&&r(t,i,{configurable:!0,value:e})}},function(t,e,n){},function(t,e,n){"use strict";function r(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}n.d(e,"a",(function(){return r}))},function(t,e,n){var r,o; +/* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress + * @license MIT */void 0===(o="function"==typeof(r=function(){var t,e,n={version:"0.2.0"},r=n.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'};function o(t,e,n){return t<e?e:t>n?n:t}function i(t){return 100*(-1+t)}n.configure=function(t){var e,n;for(e in t)void 0!==(n=t[e])&&t.hasOwnProperty(e)&&(r[e]=n);return this},n.status=null,n.set=function(t){var e=n.isStarted();t=o(t,r.minimum,1),n.status=1===t?null:t;var c=n.render(!e),u=c.querySelector(r.barSelector),f=r.speed,l=r.easing;return c.offsetWidth,a((function(e){""===r.positionUsing&&(r.positionUsing=n.getPositioningCSS()),s(u,function(t,e,n){var o;return(o="translate3d"===r.positionUsing?{transform:"translate3d("+i(t)+"%,0,0)"}:"translate"===r.positionUsing?{transform:"translate("+i(t)+"%,0)"}:{"margin-left":i(t)+"%"}).transition="all "+e+"ms "+n,o}(t,f,l)),1===t?(s(c,{transition:"none",opacity:1}),c.offsetWidth,setTimeout((function(){s(c,{transition:"all "+f+"ms linear",opacity:0}),setTimeout((function(){n.remove(),e()}),f)}),f)):setTimeout(e,f)})),this},n.isStarted=function(){return"number"==typeof n.status},n.start=function(){n.status||n.set(0);var t=function(){setTimeout((function(){n.status&&(n.trickle(),t())}),r.trickleSpeed)};return r.trickle&&t(),this},n.done=function(t){return t||n.status?n.inc(.3+.5*Math.random()).set(1):this},n.inc=function(t){var e=n.status;return e?("number"!=typeof t&&(t=(1-e)*o(Math.random()*e,.1,.95)),e=o(e+t,0,.994),n.set(e)):n.start()},n.trickle=function(){return n.inc(Math.random()*r.trickleRate)},t=0,e=0,n.promise=function(r){return r&&"resolved"!==r.state()?(0===e&&n.start(),t++,e++,r.always((function(){0==--e?(t=0,n.done()):n.set((t-e)/t)})),this):this},n.render=function(t){if(n.isRendered())return document.getElementById("nprogress");u(document.documentElement,"nprogress-busy");var e=document.createElement("div");e.id="nprogress",e.innerHTML=r.template;var o,a=e.querySelector(r.barSelector),c=t?"-100":i(n.status||0),f=document.querySelector(r.parent);return s(a,{transition:"all 0 linear",transform:"translate3d("+c+"%,0,0)"}),r.showSpinner||(o=e.querySelector(r.spinnerSelector))&&p(o),f!=document.body&&u(f,"nprogress-custom-parent"),f.appendChild(e),e},n.remove=function(){f(document.documentElement,"nprogress-busy"),f(document.querySelector(r.parent),"nprogress-custom-parent");var t=document.getElementById("nprogress");t&&p(t)},n.isRendered=function(){return!!document.getElementById("nprogress")},n.getPositioningCSS=function(){var t=document.body.style,e="WebkitTransform"in t?"Webkit":"MozTransform"in t?"Moz":"msTransform"in t?"ms":"OTransform"in t?"O":"";return e+"Perspective"in t?"translate3d":e+"Transform"in t?"translate":"margin"};var a=function(){var t=[];function e(){var n=t.shift();n&&n(e)}return function(n){t.push(n),1==t.length&&e()}}(),s=function(){var t=["Webkit","O","Moz","ms"],e={};function n(n){return n=n.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,(function(t,e){return e.toUpperCase()})),e[n]||(e[n]=function(e){var n=document.body.style;if(e in n)return e;for(var r,o=t.length,i=e.charAt(0).toUpperCase()+e.slice(1);o--;)if((r=t[o]+i)in n)return r;return e}(n))}function r(t,e,r){e=n(e),t.style[e]=r}return function(t,e){var n,o,i=arguments;if(2==i.length)for(n in e)void 0!==(o=e[n])&&e.hasOwnProperty(n)&&r(t,n,o);else r(t,i[1],i[2])}}();function c(t,e){return("string"==typeof t?t:l(t)).indexOf(" "+e+" ")>=0}function u(t,e){var n=l(t),r=n+e;c(n,e)||(t.className=r.substring(1))}function f(t,e){var n,r=l(t);c(t,e)&&(n=r.replace(" "+e+" "," "),t.className=n.substring(1,n.length-1))}function l(t){return(" "+(t.className||"")+" ").replace(/\s+/gi," ")}function p(t){t&&t.parentNode&&t.parentNode.removeChild(t)}return n})?r.call(e,n,e,t):r)||(t.exports=o)},function(t,e,n){"use strict";var r=n(0),o=n(19).map,i=n(45),a=n(11),s=i("map"),c=a("map");r({target:"Array",proto:!0,forced:!s||!c},{map:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){"use strict";var r=n(100),o=n(8),i=n(14),a=n(12),s=n(34),c=n(16),u=n(101),f=n(102),l=Math.max,p=Math.min,d=Math.floor,h=/\$([$&'`]|\d\d?|<[^>]*>)/g,v=/\$([$&'`]|\d\d?)/g;r("replace",2,(function(t,e,n,r){var y=r.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,m=r.REPLACE_KEEPS_$0,g=y?"$":"$0";return[function(n,r){var o=c(this),i=null==n?void 0:n[t];return void 0!==i?i.call(n,o,r):e.call(String(o),n,r)},function(t,r){if(!y&&m||"string"==typeof r&&-1===r.indexOf(g)){var i=n(e,t,this,r);if(i.done)return i.value}var c=o(t),d=String(this),h="function"==typeof r;h||(r=String(r));var v=c.global;if(v){var _=c.unicode;c.lastIndex=0}for(var x=[];;){var w=f(c,d);if(null===w)break;if(x.push(w),!v)break;""===String(w[0])&&(c.lastIndex=u(d,a(c.lastIndex),_))}for(var S,O="",E=0,C=0;C<x.length;C++){w=x[C];for(var $=String(w[0]),k=l(p(s(w.index),d.length),0),A=[],j=1;j<w.length;j++)A.push(void 0===(S=w[j])?S:String(S));var T=w.groups;if(h){var P=[$].concat(A,k,d);void 0!==T&&P.push(T);var L=String(r.apply(void 0,P))}else L=b($,d,k,A,T,r);k>=E&&(O+=d.slice(E,k)+L,E=k+$.length)}return O+d.slice(E)}];function b(t,n,r,o,a,s){var c=r+t.length,u=o.length,f=v;return void 0!==a&&(a=i(a),f=h),e.call(s,f,(function(e,i){var s;switch(i.charAt(0)){case"$":return"$";case"&":return t;case"`":return n.slice(0,r);case"'":return n.slice(c);case"<":s=a[i.slice(1,-1)];break;default:var f=+i;if(0===f)return e;if(f>u){var l=d(f/10);return 0===l?e:l<=u?void 0===o[l-1]?i.charAt(1):o[l-1]+i.charAt(1):e}s=o[f-1]}return void 0===s?"":s}))}}))},function(t,e,n){var r=n(22);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,e,n){var r=n(2),o=n(22),i="".split;t.exports=r((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==o(t)?i.call(t,""):Object(t)}:Object},function(t,e,n){var r=n(76),o=n(50).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,o)}},function(t,e,n){var r=n(2),o=n(1),i=n(105),a=o("species");t.exports=function(t){return i>=51||!r((function(){var e=[];return(e.constructor={})[a]=function(){return{foo:1}},1!==e[t](Boolean).foo}))}},function(t,e,n){"use strict";var r,o,i=n(99),a=n(107),s=RegExp.prototype.exec,c=String.prototype.replace,u=s,f=(r=/a/,o=/b*/g,s.call(r,"a"),s.call(o,"a"),0!==r.lastIndex||0!==o.lastIndex),l=a.UNSUPPORTED_Y||a.BROKEN_CARET,p=void 0!==/()??/.exec("")[1];(f||p||l)&&(u=function(t){var e,n,r,o,a=this,u=l&&a.sticky,d=i.call(a),h=a.source,v=0,y=t;return u&&(-1===(d=d.replace("y","")).indexOf("g")&&(d+="g"),y=String(t).slice(a.lastIndex),a.lastIndex>0&&(!a.multiline||a.multiline&&"\n"!==t[a.lastIndex-1])&&(h="(?: "+h+")",y=" "+y,v++),n=new RegExp("^(?:"+h+")",d)),p&&(n=new RegExp("^"+h+"$(?!\\s)",d)),f&&(e=a.lastIndex),r=s.call(u?n:a,y),u?r?(r.input=r.input.slice(v),r[0]=r[0].slice(v),r.index=a.lastIndex,a.lastIndex+=r[0].length):a.lastIndex=0:f&&r&&(a.lastIndex=a.global?r.index+r[0].length:e),p&&r&&r.length>1&&c.call(r[0],n,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(r[o]=void 0)})),r}),t.exports=u},function(t,e,n){var r=n(3),o=n(9);t.exports=function(t,e){try{o(r,t,e)}catch(n){r[t]=e}return e}},function(t,e,n){var r=n(23),o=n(72);(t.exports=function(t,e){return o[t]||(o[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.4",mode:r?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(t,e,n){var r=n(10),o=n(12),i=n(77),a=function(t){return function(e,n,a){var s,c=r(e),u=o(c.length),f=i(a,u);if(t&&n!=n){for(;u>f;)if((s=c[f++])!=s)return!0}else for(;u>f;f++)if((t||f in c)&&c[f]===n)return t||f||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},function(t,e){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(t,e,n){var r=n(63);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 0:return function(){return t.call(e)};case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},function(t,e,n){var r=n(2);t.exports=!!Object.getOwnPropertySymbols&&!r((function(){return!String(Symbol())}))},function(t,e,n){var r={};r[n(1)("toStringTag")]="z",t.exports="[object z]"===String(r)},function(t,e,n){"use strict";var r=n(81).charAt,o=n(18),i=n(55),a=o.set,s=o.getterFor("String Iterator");i(String,"String",(function(t){a(this,{type:"String Iterator",string:String(t),index:0})}),(function(){var t,e=s(this),n=e.string,o=e.index;return o>=n.length?{value:void 0,done:!0}:(t=r(n,o),e.index+=t.length,{value:t,done:!1})}))},function(t,e,n){"use strict";var r=n(0),o=n(115),i=n(56),a=n(84),s=n(36),c=n(9),u=n(13),f=n(1),l=n(23),p=n(27),d=n(82),h=d.IteratorPrototype,v=d.BUGGY_SAFARI_ITERATORS,y=f("iterator"),m=function(){return this};t.exports=function(t,e,n,f,d,g,b){o(n,e,f);var _,x,w,S=function(t){if(t===d&&k)return k;if(!v&&t in C)return C[t];switch(t){case"keys":case"values":case"entries":return function(){return new n(this,t)}}return function(){return new n(this)}},O=e+" Iterator",E=!1,C=t.prototype,$=C[y]||C["@@iterator"]||d&&C[d],k=!v&&$||S(d),A="Array"==e&&C.entries||$;if(A&&(_=i(A.call(new t)),h!==Object.prototype&&_.next&&(l||i(_)===h||(a?a(_,h):"function"!=typeof _[y]&&c(_,y,m)),s(_,O,!0,!0),l&&(p[O]=m))),"values"==d&&$&&"values"!==$.name&&(E=!0,k=function(){return $.call(this)}),l&&!b||C[y]===k||c(C,y,k),p[e]=k,d)if(x={values:S("values"),keys:g?k:S("keys"),entries:S("entries")},b)for(w in x)!v&&!E&&w in C||u(C,w,x[w]);else r({target:e,proto:!0,forced:v||E},x);return x}},function(t,e,n){var r=n(5),o=n(14),i=n(32),a=n(83),s=i("IE_PROTO"),c=Object.prototype;t.exports=a?Object.getPrototypeOf:function(t){return t=o(t),r(t,s)?t[s]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?c:null}},function(t,e,n){var r=n(76),o=n(50);t.exports=Object.keys||function(t){return r(t,o)}},function(t,e,n){var r=n(3),o=n(85),i=n(119),a=n(9),s=n(1),c=s("iterator"),u=s("toStringTag"),f=i.values;for(var l in o){var p=r[l],d=p&&p.prototype;if(d){if(d[c]!==f)try{a(d,c,f)}catch(t){d[c]=f}if(d[u]||a(d,u,l),o[l])for(var h in i)if(d[h]!==i[h])try{a(d,h,i[h])}catch(t){d[h]=i[h]}}}},function(t,e,n){var r=n(24),o=n(4),i=n(5),a=n(7).f,s=n(33),c=n(88),u=s("meta"),f=0,l=Object.isExtensible||function(){return!0},p=function(t){a(t,u,{value:{objectID:"O"+ ++f,weakData:{}}})},d=t.exports={REQUIRED:!1,fastKey:function(t,e){if(!o(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!i(t,u)){if(!l(t))return"F";if(!e)return"E";p(t)}return t[u].objectID},getWeakData:function(t,e){if(!i(t,u)){if(!l(t))return!0;if(!e)return!1;p(t)}return t[u].weakData},onFreeze:function(t){return c&&d.REQUIRED&&l(t)&&!i(t,u)&&p(t),t}};r[u]=!0},function(t,e,n){var r=n(6),o=n(7).f,i=Function.prototype,a=i.toString,s=/^\s*function ([^ (]*)/;!r||"name"in i||o(i,"name",{configurable:!0,get:function(){try{return a.call(this).match(s)[1]}catch(t){return""}}})},function(t,e,n){var r=n(0),o=n(14),i=n(57);r({target:"Object",stat:!0,forced:n(2)((function(){i(1)}))},{keys:function(t){return i(o(t))}})},function(t,e,n){var r=n(2),o=/#|\.prototype\./,i=function(t,e){var n=s[a(t)];return n==u||n!=c&&("function"==typeof e?r(e):!!e)},a=i.normalize=function(t){return String(t).replace(o,".").toLowerCase()},s=i.data={},c=i.NATIVE="N",u=i.POLYFILL="P";t.exports=i},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}},function(t,e,n){"use strict";var r=n(31),o=n(7),i=n(21);t.exports=function(t,e,n){var a=r(e);a in t?o.f(t,a,i(0,n)):t[a]=n}},function(t,e,n){var r=n(1),o=n(26),i=n(7),a=r("unscopables"),s=Array.prototype;null==s[a]&&i.f(s,a,{configurable:!0,value:o(null)}),t.exports=function(t){s[a][t]=!0}},function(t,e,n){"use strict";var r=n(0),o=n(87);r({target:"Array",proto:!0,forced:[].forEach!=o},{forEach:o})},function(t,e,n){var r=n(3),o=n(85),i=n(87),a=n(9);for(var s in o){var c=r[s],u=c&&c.prototype;if(u&&u.forEach!==i)try{a(u,"forEach",i)}catch(t){u.forEach=i}}},function(t,e,n){"use strict";var r={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i=o&&!r.call({1:2},1);e.f=i?function(t){var e=o(this,t);return!!e&&e.enumerable}:r},function(t,e,n){var r=n(6),o=n(2),i=n(70);t.exports=!r&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},function(t,e,n){var r=n(3),o=n(4),i=r.document,a=o(i)&&o(i.createElement);t.exports=function(t){return a?i.createElement(t):{}}},function(t,e,n){var r=n(72),o=Function.toString;"function"!=typeof r.inspectSource&&(r.inspectSource=function(t){return o.call(t)}),t.exports=r.inspectSource},function(t,e,n){var r=n(3),o=n(47),i=r["__core-js_shared__"]||o("__core-js_shared__",{});t.exports=i},function(t,e,n){var r=n(5),o=n(74),i=n(20),a=n(7);t.exports=function(t,e){for(var n=o(e),s=a.f,c=i.f,u=0;u<n.length;u++){var f=n[u];r(t,f)||s(t,f,c(e,f))}}},function(t,e,n){var r=n(25),o=n(44),i=n(78),a=n(8);t.exports=r("Reflect","ownKeys")||function(t){var e=o.f(a(t)),n=i.f;return n?e.concat(n(t)):e}},function(t,e,n){var r=n(3);t.exports=r},function(t,e,n){var r=n(5),o=n(10),i=n(49).indexOf,a=n(24);t.exports=function(t,e){var n,s=o(t),c=0,u=[];for(n in s)!r(a,n)&&r(s,n)&&u.push(n);for(;e.length>c;)r(s,n=e[c++])&&(~i(u,n)||u.push(n));return u}},function(t,e,n){var r=n(34),o=Math.max,i=Math.min;t.exports=function(t,e){var n=r(t);return n<0?o(n+e,0):i(n,e)}},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e,n){var r=n(52);t.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(t,e,n){var r=n(53),o=n(22),i=n(1)("toStringTag"),a="Arguments"==o(function(){return arguments}());t.exports=r?o:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),i))?n:a?o(e):"Object"==(r=o(e))&&"function"==typeof e.callee?"Arguments":r}},function(t,e,n){var r=n(34),o=n(16),i=function(t){return function(e,n){var i,a,s=String(o(e)),c=r(n),u=s.length;return c<0||c>=u?t?"":void 0:(i=s.charCodeAt(c))<55296||i>56319||c+1===u||(a=s.charCodeAt(c+1))<56320||a>57343?t?s.charAt(c):i:t?s.slice(c,c+2):a-56320+(i-55296<<10)+65536}};t.exports={codeAt:i(!1),charAt:i(!0)}},function(t,e,n){"use strict";var r,o,i,a=n(56),s=n(9),c=n(5),u=n(1),f=n(23),l=u("iterator"),p=!1;[].keys&&("next"in(i=[].keys())?(o=a(a(i)))!==Object.prototype&&(r=o):p=!0),null==r&&(r={}),f||c(r,l)||s(r,l,(function(){return this})),t.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:p}},function(t,e,n){var r=n(2);t.exports=!r((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}))},function(t,e,n){var r=n(8),o=n(118);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),e=n instanceof Array}catch(t){}return function(n,i){return r(n),o(i),e?t.call(n,i):n.__proto__=i,n}}():void 0)},function(t,e){t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(t,e,n){var r=function(t){"use strict";var e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function s(t,e,n,r){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new w(r||[]);return i._invoke=function(t,e,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return O()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var s=b(a,n);if(s){if(s===u)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var f=c(t,e,n);if("normal"===f.type){if(r=n.done?"completed":"suspendedYield",f.arg===u)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(r="completed",n.method="throw",n.arg=f.arg)}}}(t,n,a),i}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var u={};function f(){}function l(){}function p(){}var d={};d[o]=function(){return this};var h=Object.getPrototypeOf,v=h&&h(h(S([])));v&&v!==e&&n.call(v,o)&&(d=v);var y=p.prototype=f.prototype=Object.create(d);function m(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function g(t){var e;this._invoke=function(r,o){function i(){return new Promise((function(e,i){!function e(r,o,i,a){var s=c(t[r],t,o);if("throw"!==s.type){var u=s.arg,f=u.value;return f&&"object"==typeof f&&n.call(f,"__await")?Promise.resolve(f.__await).then((function(t){e("next",t,i,a)}),(function(t){e("throw",t,i,a)})):Promise.resolve(f).then((function(t){u.value=t,i(u)}),(function(t){return e("throw",t,i,a)}))}a(s.arg)}(r,o,e,i)}))}return e=e?e.then(i,i):i()}}function b(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var r=c(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,u;var o=r.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function w(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function S(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return l.prototype=y.constructor=p,p.constructor=l,p[a]=l.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===l||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,a in t||(t[a]="GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},m(g.prototype),g.prototype[i]=function(){return this},t.AsyncIterator=g,t.async=function(e,n,r,o){var i=new g(s(e,n,r,o));return t.isGeneratorFunction(n)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},m(y),y[a]="Generator",y[o]=function(){return this},y.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=S,w.prototype={constructor:w,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,u):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),u},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),x(n),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;x(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:S(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},t}(t.exports);try{regeneratorRuntime=r}catch(t){Function("r","regeneratorRuntime = r")(r)}},function(t,e,n){"use strict";var r=n(19).forEach,o=n(30),i=n(11),a=o("forEach"),s=i("forEach");t.exports=a&&s?[].forEach:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}},function(t,e,n){var r=n(2);t.exports=!r((function(){return Object.isExtensible(Object.preventExtensions({}))}))},function(t,e,n){var r=n(98);t.exports=function(t){if(r(t))throw TypeError("The method doesn't accept regular expressions");return t}},function(t,e,n){var r=n(1)("match");t.exports=function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[r]=!1,"/./"[t](e)}catch(t){}}return!1}},function(t,e,n){"use strict";var r=n(0),o=n(3),i=n(25),a=n(23),s=n(6),c=n(52),u=n(79),f=n(2),l=n(5),p=n(42),d=n(4),h=n(8),v=n(14),y=n(10),m=n(31),g=n(21),b=n(26),_=n(57),x=n(44),w=n(127),S=n(78),O=n(20),E=n(7),C=n(68),$=n(9),k=n(13),A=n(48),j=n(32),T=n(24),P=n(33),L=n(1),R=n(92),I=n(128),M=n(36),D=n(18),N=n(19).forEach,F=j("hidden"),U=L("toPrimitive"),z=D.set,B=D.getterFor("Symbol"),V=Object.prototype,q=o.Symbol,H=i("JSON","stringify"),W=O.f,G=E.f,K=w.f,Q=C.f,X=A("symbols"),Y=A("op-symbols"),J=A("string-to-symbol-registry"),Z=A("symbol-to-string-registry"),tt=A("wks"),et=o.QObject,nt=!et||!et.prototype||!et.prototype.findChild,rt=s&&f((function(){return 7!=b(G({},"a",{get:function(){return G(this,"a",{value:7}).a}})).a}))?function(t,e,n){var r=W(V,e);r&&delete V[e],G(t,e,n),r&&t!==V&&G(V,e,r)}:G,ot=function(t,e){var n=X[t]=b(q.prototype);return z(n,{type:"Symbol",tag:t,description:e}),s||(n.description=e),n},it=u?function(t){return"symbol"==typeof t}:function(t){return Object(t)instanceof q},at=function(t,e,n){t===V&&at(Y,e,n),h(t);var r=m(e,!0);return h(n),l(X,r)?(n.enumerable?(l(t,F)&&t[F][r]&&(t[F][r]=!1),n=b(n,{enumerable:g(0,!1)})):(l(t,F)||G(t,F,g(1,{})),t[F][r]=!0),rt(t,r,n)):G(t,r,n)},st=function(t,e){h(t);var n=y(e),r=_(n).concat(lt(n));return N(r,(function(e){s&&!ct.call(n,e)||at(t,e,n[e])})),t},ct=function(t){var e=m(t,!0),n=Q.call(this,e);return!(this===V&&l(X,e)&&!l(Y,e))&&(!(n||!l(this,e)||!l(X,e)||l(this,F)&&this[F][e])||n)},ut=function(t,e){var n=y(t),r=m(e,!0);if(n!==V||!l(X,r)||l(Y,r)){var o=W(n,r);return!o||!l(X,r)||l(n,F)&&n[F][r]||(o.enumerable=!0),o}},ft=function(t){var e=K(y(t)),n=[];return N(e,(function(t){l(X,t)||l(T,t)||n.push(t)})),n},lt=function(t){var e=t===V,n=K(e?Y:y(t)),r=[];return N(n,(function(t){!l(X,t)||e&&!l(V,t)||r.push(X[t])})),r};(c||(k((q=function(){if(this instanceof q)throw TypeError("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,e=P(t),n=function(t){this===V&&n.call(Y,t),l(this,F)&&l(this[F],e)&&(this[F][e]=!1),rt(this,e,g(1,t))};return s&&nt&&rt(V,e,{configurable:!0,set:n}),ot(e,t)}).prototype,"toString",(function(){return B(this).tag})),k(q,"withoutSetter",(function(t){return ot(P(t),t)})),C.f=ct,E.f=at,O.f=ut,x.f=w.f=ft,S.f=lt,R.f=function(t){return ot(L(t),t)},s&&(G(q.prototype,"description",{configurable:!0,get:function(){return B(this).description}}),a||k(V,"propertyIsEnumerable",ct,{unsafe:!0}))),r({global:!0,wrap:!0,forced:!c,sham:!c},{Symbol:q}),N(_(tt),(function(t){I(t)})),r({target:"Symbol",stat:!0,forced:!c},{for:function(t){var e=String(t);if(l(J,e))return J[e];var n=q(e);return J[e]=n,Z[n]=e,n},keyFor:function(t){if(!it(t))throw TypeError(t+" is not a symbol");if(l(Z,t))return Z[t]},useSetter:function(){nt=!0},useSimple:function(){nt=!1}}),r({target:"Object",stat:!0,forced:!c,sham:!s},{create:function(t,e){return void 0===e?b(t):st(b(t),e)},defineProperty:at,defineProperties:st,getOwnPropertyDescriptor:ut}),r({target:"Object",stat:!0,forced:!c},{getOwnPropertyNames:ft,getOwnPropertySymbols:lt}),r({target:"Object",stat:!0,forced:f((function(){S.f(1)}))},{getOwnPropertySymbols:function(t){return S.f(v(t))}}),H)&&r({target:"JSON",stat:!0,forced:!c||f((function(){var t=q();return"[null]"!=H([t])||"{}"!=H({a:t})||"{}"!=H(Object(t))}))},{stringify:function(t,e,n){for(var r,o=[t],i=1;arguments.length>i;)o.push(arguments[i++]);if(r=e,(d(e)||void 0!==t)&&!it(t))return p(e)||(e=function(t,e){if("function"==typeof r&&(e=r.call(this,t,e)),!it(e))return e}),o[1]=e,H.apply(null,o)}});q.prototype[U]||$(q.prototype,U,q.prototype.valueOf),M(q,"Symbol"),T[F]=!0},function(t,e,n){var r=n(1);e.f=r},function(t,e,n){"use strict";var r=n(0),o=n(6),i=n(3),a=n(5),s=n(4),c=n(7).f,u=n(73),f=i.Symbol;if(o&&"function"==typeof f&&(!("description"in f.prototype)||void 0!==f().description)){var l={},p=function(){var t=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),e=this instanceof p?new f(t):void 0===t?f():f(t);return""===t&&(l[e]=!0),e};u(p,f);var d=p.prototype=f.prototype;d.constructor=p;var h=d.toString,v="Symbol(test)"==String(f("test")),y=/^Symbol\((.*)\)[^)]+$/;c(d,"description",{configurable:!0,get:function(){var t=s(this)?this.valueOf():this,e=h.call(t);if(a(l,t))return"";var n=v?e.slice(7,-1):e.replace(y,"$1");return""===n?void 0:n}}),r({global:!0,forced:!0},{Symbol:p})}},function(t,e,n){var r=n(8),o=n(131),i=n(12),a=n(51),s=n(132),c=n(133),u=function(t,e){this.stopped=t,this.result=e};(t.exports=function(t,e,n,f,l){var p,d,h,v,y,m,g,b=a(e,n,f?2:1);if(l)p=t;else{if("function"!=typeof(d=s(t)))throw TypeError("Target is not iterable");if(o(d)){for(h=0,v=i(t.length);v>h;h++)if((y=f?b(r(g=t[h])[0],g[1]):b(t[h]))&&y instanceof u)return y;return new u(!1)}p=d.call(t)}for(m=p.next;!(g=m.call(p)).done;)if("object"==typeof(y=c(p,b,g.value,f))&&y&&y instanceof u)return y;return new u(!1)}).stop=function(t){return new u(!0,t)}},function(t,e){t.exports=function(t,e,n){if(!(t instanceof e))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return t}},function(t,e){var n=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt,s="object"==typeof global&&global&&global.Object===Object&&global,c="object"==typeof self&&self&&self.Object===Object&&self,u=s||c||Function("return this")(),f=Object.prototype.toString,l=Math.max,p=Math.min,d=function(){return u.Date.now()};function h(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function v(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==f.call(t)}(t))return NaN;if(h(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=h(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(n,"");var s=o.test(t);return s||i.test(t)?a(t.slice(2),s?2:8):r.test(t)?NaN:+t}t.exports=function(t,e,n){var r,o,i,a,s,c,u=0,f=!1,y=!1,m=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function g(e){var n=r,i=o;return r=o=void 0,u=e,a=t.apply(i,n)}function b(t){return u=t,s=setTimeout(x,e),f?g(t):a}function _(t){var n=t-c;return void 0===c||n>=e||n<0||y&&t-u>=i}function x(){var t=d();if(_(t))return w(t);s=setTimeout(x,function(t){var n=e-(t-c);return y?p(n,i-(t-u)):n}(t))}function w(t){return s=void 0,m&&r?g(t):(r=o=void 0,a)}function S(){var t=d(),n=_(t);if(r=arguments,o=this,c=t,n){if(void 0===s)return b(c);if(y)return s=setTimeout(x,e),g(c)}return void 0===s&&(s=setTimeout(x,e)),a}return e=v(e)||0,h(n)&&(f=!!n.leading,i=(y="maxWait"in n)?l(v(n.maxWait)||0,e):i,m="trailing"in n?!!n.trailing:m),S.cancel=function(){void 0!==s&&clearTimeout(s),u=0,r=c=o=s=void 0},S.flush=function(){return void 0===s?a:w(d())},S}},function(t,e,n){"use strict";var r=n(0),o=n(19).some,i=n(30),a=n(11),s=i("some"),c=a("some");r({target:"Array",proto:!0,forced:!s||!c},{some:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){var r=n(4),o=n(22),i=n(1)("match");t.exports=function(t){var e;return r(t)&&(void 0!==(e=t[i])?!!e:"RegExp"==o(t))}},function(t,e,n){"use strict";var r=n(8);t.exports=function(){var t=r(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},function(t,e,n){"use strict";n(29);var r=n(13),o=n(2),i=n(1),a=n(46),s=n(9),c=i("species"),u=!o((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")})),f="$0"==="a".replace(/./,"$0"),l=i("replace"),p=!!/./[l]&&""===/./[l]("a","$0"),d=!o((function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));t.exports=function(t,e,n,l){var h=i(t),v=!o((function(){var e={};return e[h]=function(){return 7},7!=""[t](e)})),y=v&&!o((function(){var e=!1,n=/a/;return"split"===t&&((n={}).constructor={},n.constructor[c]=function(){return n},n.flags="",n[h]=/./[h]),n.exec=function(){return e=!0,null},n[h](""),!e}));if(!v||!y||"replace"===t&&(!u||!f||p)||"split"===t&&!d){var m=/./[h],g=n(h,""[t],(function(t,e,n,r,o){return e.exec===a?v&&!o?{done:!0,value:m.call(e,n,r)}:{done:!0,value:t.call(n,e,r)}:{done:!1}}),{REPLACE_KEEPS_$0:f,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:p}),b=g[0],_=g[1];r(String.prototype,t,b),r(RegExp.prototype,h,2==e?function(t,e){return _.call(t,this,e)}:function(t){return _.call(t,this)})}l&&s(RegExp.prototype[h],"sham",!0)}},function(t,e,n){"use strict";var r=n(81).charAt;t.exports=function(t,e,n){return e+(n?r(t,e).length:1)}},function(t,e,n){var r=n(22),o=n(46);t.exports=function(t,e){var n=t.exec;if("function"==typeof n){var i=n.call(t,e);if("object"!=typeof i)throw TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==r(t))throw TypeError("RegExp#exec called on incompatible receiver");return o.call(t,e)}},function(t,e,n){"use strict";var r=n(0),o=n(49).indexOf,i=n(30),a=n(11),s=[].indexOf,c=!!s&&1/[1].indexOf(1,-0)<0,u=i("indexOf"),f=a("indexOf",{ACCESSORS:!0,1:0});r({target:"Array",proto:!0,forced:c||!u||!f},{indexOf:function(t){return c?s.apply(this,arguments)||0:o(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){var r=n(4),o=n(42),i=n(1)("species");t.exports=function(t,e){var n;return o(t)&&("function"!=typeof(n=t.constructor)||n!==Array&&!o(n.prototype)?r(n)&&null===(n=n[i])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===e?0:e)}},function(t,e,n){var r,o,i=n(3),a=n(113),s=i.process,c=s&&s.versions,u=c&&c.v8;u?o=(r=u.split("."))[0]+r[1]:a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(o=r[1]),t.exports=o&&+o},function(t,e,n){"use strict";var r=n(0),o=n(49).includes,i=n(65);r({target:"Array",proto:!0,forced:!n(11)("indexOf",{ACCESSORS:!0,1:0})},{includes:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),i("includes")},function(t,e,n){"use strict";var r=n(2);function o(t,e){return RegExp(t,e)}e.UNSUPPORTED_Y=r((function(){var t=o("a","y");return t.lastIndex=2,null!=t.exec("abcd")})),e.BROKEN_CARET=r((function(){var t=o("^r","gy");return t.lastIndex=2,null!=t.exec("str")}))},function(t,e,n){"use strict";var r=n(0),o=n(89),i=n(16);r({target:"String",proto:!0,forced:!n(90)("includes")},{includes:function(t){return!!~String(i(this)).indexOf(o(t),arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){var r=n(4),o=n(84);t.exports=function(t,e,n){var i,a;return o&&"function"==typeof(i=e.constructor)&&i!==n&&r(a=i.prototype)&&a!==n.prototype&&o(t,a),t}},function(t,e,n){"use strict";var r=n(25),o=n(7),i=n(1),a=n(6),s=i("species");t.exports=function(t){var e=r(t),n=o.f;a&&e&&!e[s]&&n(e,s,{configurable:!0,get:function(){return this}})}},function(t,e,n){t.exports=n(140)},function(t,e,n){var r=n(3),o=n(71),i=r.WeakMap;t.exports="function"==typeof i&&/native code/.test(o(i))},function(t,e,n){var r=n(25);t.exports=r("navigator","userAgent")||""},function(t,e,n){"use strict";var r=n(53),o=n(80);t.exports=r?{}.toString:function(){return"[object "+o(this)+"]"}},function(t,e,n){"use strict";var r=n(82).IteratorPrototype,o=n(26),i=n(21),a=n(36),s=n(27),c=function(){return this};t.exports=function(t,e,n){var u=e+" Iterator";return t.prototype=o(r,{next:i(1,n)}),a(t,u,!1,!0),s[u]=c,t}},function(t,e,n){var r=n(6),o=n(7),i=n(8),a=n(57);t.exports=r?Object.defineProperties:function(t,e){i(t);for(var n,r=a(e),s=r.length,c=0;s>c;)o.f(t,n=r[c++],e[n]);return t}},function(t,e,n){var r=n(25);t.exports=r("document","documentElement")},function(t,e,n){var r=n(4);t.exports=function(t){if(!r(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype");return t}},function(t,e,n){"use strict";var r=n(10),o=n(65),i=n(27),a=n(18),s=n(55),c=a.set,u=a.getterFor("Array Iterator");t.exports=s(Array,"Array",(function(t,e){c(this,{type:"Array Iterator",target:r(t),index:0,kind:e})}),(function(){var t=u(this),e=t.target,n=t.kind,r=t.index++;return!e||r>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:e[r],done:!1}:{value:[r,e[r]],done:!1}}),"values"),i.Arguments=i.Array,o("keys"),o("values"),o("entries")},function(t,e,n){"use strict";var r=n(0),o=n(121).left,i=n(30),a=n(11),s=i("reduce"),c=a("reduce",{1:0});r({target:"Array",proto:!0,forced:!s||!c},{reduce:function(t){return o(this,t,arguments.length,arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){var r=n(63),o=n(14),i=n(43),a=n(12),s=function(t){return function(e,n,s,c){r(n);var u=o(e),f=i(u),l=a(u.length),p=t?l-1:0,d=t?-1:1;if(s<2)for(;;){if(p in f){c=f[p],p+=d;break}if(p+=d,t?p<0:l<=p)throw TypeError("Reduce of empty array with no initial value")}for(;t?p>=0:l>p;p+=d)p in f&&(c=n(c,f[p],p,u));return c}};t.exports={left:s(!1),right:s(!0)}},function(t,e,n){var r=n(0),o=n(88),i=n(2),a=n(4),s=n(59).onFreeze,c=Object.freeze;r({target:"Object",stat:!0,forced:i((function(){c(1)})),sham:!o},{freeze:function(t){return c&&a(t)?c(s(t)):t}})},function(t,e,n){var r=n(0),o=n(6),i=n(74),a=n(10),s=n(20),c=n(64);r({target:"Object",stat:!0,sham:!o},{getOwnPropertyDescriptors:function(t){for(var e,n,r=a(t),o=s.f,u=i(r),f={},l=0;u.length>l;)void 0!==(n=o(r,e=u[l++]))&&c(f,e,n);return f}})},function(t,e,n){var r=n(0),o=n(2),i=n(14),a=n(56),s=n(83);r({target:"Object",stat:!0,forced:o((function(){a(1)})),sham:!s},{getPrototypeOf:function(t){return a(i(t))}})},function(t,e,n){"use strict";var r,o=n(0),i=n(20).f,a=n(12),s=n(89),c=n(16),u=n(90),f=n(23),l="".startsWith,p=Math.min,d=u("startsWith");o({target:"String",proto:!0,forced:!!(f||d||(r=i(String.prototype,"startsWith"),!r||r.writable))&&!d},{startsWith:function(t){var e=String(c(this));s(t);var n=a(p(arguments.length>1?arguments[1]:void 0,e.length)),r=String(t);return l?l.call(e,r,n):e.slice(n,n+r.length)===r}})},function(t,e,n){n(0)({target:"Object",stat:!0,sham:!n(6)},{create:n(26)})},function(t,e,n){var r=n(10),o=n(44).f,i={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return a&&"[object Window]"==i.call(t)?function(t){try{return o(t)}catch(t){return a.slice()}}(t):o(r(t))}},function(t,e,n){var r=n(75),o=n(5),i=n(92),a=n(7).f;t.exports=function(t){var e=r.Symbol||(r.Symbol={});o(e,t)||a(e,t,{value:i.f(t)})}},function(t,e,n){"use strict";var r=n(130),o=n(135);t.exports=r("Set",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),o)},function(t,e,n){"use strict";var r=n(0),o=n(3),i=n(62),a=n(13),s=n(59),c=n(94),u=n(95),f=n(4),l=n(2),p=n(134),d=n(36),h=n(109);t.exports=function(t,e,n){var v=-1!==t.indexOf("Map"),y=-1!==t.indexOf("Weak"),m=v?"set":"add",g=o[t],b=g&&g.prototype,_=g,x={},w=function(t){var e=b[t];a(b,t,"add"==t?function(t){return e.call(this,0===t?0:t),this}:"delete"==t?function(t){return!(y&&!f(t))&&e.call(this,0===t?0:t)}:"get"==t?function(t){return y&&!f(t)?void 0:e.call(this,0===t?0:t)}:"has"==t?function(t){return!(y&&!f(t))&&e.call(this,0===t?0:t)}:function(t,n){return e.call(this,0===t?0:t,n),this})};if(i(t,"function"!=typeof g||!(y||b.forEach&&!l((function(){(new g).entries().next()})))))_=n.getConstructor(e,t,v,m),s.REQUIRED=!0;else if(i(t,!0)){var S=new _,O=S[m](y?{}:-0,1)!=S,E=l((function(){S.has(1)})),C=p((function(t){new g(t)})),$=!y&&l((function(){for(var t=new g,e=5;e--;)t[m](e,e);return!t.has(-0)}));C||((_=e((function(e,n){u(e,_,t);var r=h(new g,e,_);return null!=n&&c(n,r[m],r,v),r}))).prototype=b,b.constructor=_),(E||$)&&(w("delete"),w("has"),v&&w("get")),($||O)&&w(m),y&&b.clear&&delete b.clear}return x[t]=_,r({global:!0,forced:_!=g},x),d(_,t),y||n.setStrong(_,t,v),_}},function(t,e,n){var r=n(1),o=n(27),i=r("iterator"),a=Array.prototype;t.exports=function(t){return void 0!==t&&(o.Array===t||a[i]===t)}},function(t,e,n){var r=n(80),o=n(27),i=n(1)("iterator");t.exports=function(t){if(null!=t)return t[i]||t["@@iterator"]||o[r(t)]}},function(t,e,n){var r=n(8);t.exports=function(t,e,n,o){try{return o?e(r(n)[0],n[1]):e(n)}catch(e){var i=t.return;throw void 0!==i&&r(i.call(t)),e}}},function(t,e,n){var r=n(1)("iterator"),o=!1;try{var i=0,a={next:function(){return{done:!!i++}},return:function(){o=!0}};a[r]=function(){return this},Array.from(a,(function(){throw 2}))}catch(t){}t.exports=function(t,e){if(!e&&!o)return!1;var n=!1;try{var i={};i[r]=function(){return{next:function(){return{done:n=!0}}}},t(i)}catch(t){}return n}},function(t,e,n){"use strict";var r=n(7).f,o=n(26),i=n(136),a=n(51),s=n(95),c=n(94),u=n(55),f=n(110),l=n(6),p=n(59).fastKey,d=n(18),h=d.set,v=d.getterFor;t.exports={getConstructor:function(t,e,n,u){var f=t((function(t,r){s(t,f,e),h(t,{type:e,index:o(null),first:void 0,last:void 0,size:0}),l||(t.size=0),null!=r&&c(r,t[u],t,n)})),d=v(e),y=function(t,e,n){var r,o,i=d(t),a=m(t,e);return a?a.value=n:(i.last=a={index:o=p(e,!0),key:e,value:n,previous:r=i.last,next:void 0,removed:!1},i.first||(i.first=a),r&&(r.next=a),l?i.size++:t.size++,"F"!==o&&(i.index[o]=a)),t},m=function(t,e){var n,r=d(t),o=p(e);if("F"!==o)return r.index[o];for(n=r.first;n;n=n.next)if(n.key==e)return n};return i(f.prototype,{clear:function(){for(var t=d(this),e=t.index,n=t.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete e[n.index],n=n.next;t.first=t.last=void 0,l?t.size=0:this.size=0},delete:function(t){var e=d(this),n=m(this,t);if(n){var r=n.next,o=n.previous;delete e.index[n.index],n.removed=!0,o&&(o.next=r),r&&(r.previous=o),e.first==n&&(e.first=r),e.last==n&&(e.last=o),l?e.size--:this.size--}return!!n},forEach:function(t){for(var e,n=d(this),r=a(t,arguments.length>1?arguments[1]:void 0,3);e=e?e.next:n.first;)for(r(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!m(this,t)}}),i(f.prototype,n?{get:function(t){var e=m(this,t);return e&&e.value},set:function(t,e){return y(this,0===t?0:t,e)}}:{add:function(t){return y(this,t=0===t?0:t,t)}}),l&&r(f.prototype,"size",{get:function(){return d(this).size}}),f},setStrong:function(t,e,n){var r=e+" Iterator",o=v(e),i=v(r);u(t,e,(function(t,e){h(this,{type:r,target:t,state:o(t),kind:e,last:void 0})}),(function(){for(var t=i(this),e=t.kind,n=t.last;n&&n.removed;)n=n.previous;return t.target&&(t.last=n=n?n.next:t.state.first)?"keys"==e?{value:n.key,done:!1}:"values"==e?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(t.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),f(e)}}},function(t,e,n){var r=n(13);t.exports=function(t,e,n){for(var o in e)r(t,o,e[o],n);return t}},function(t,e,n){n(15),Promise.all([n.e(0),n.e(17)]).then(n.t.bind(null,141,7))},function(t,e,n){},function(t,e,n){"use strict";var r=n(37);n.n(r).a},function(t,e,n){"use strict";n.r(e);n(17),n(40),n(35),n(15),n(54),n(58),n(86);function r(t,e,n,r,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void n(t)}s.done?e(c):Promise.resolve(c).then(r,o)}function o(t){return function(){var e=this,n=arguments;return new Promise((function(o,i){var a=t.apply(e,n);function s(t){r(a,o,i,s,c,"next",t)}function c(t){r(a,o,i,s,c,"throw",t)}s(void 0)}))}} +/*! + * Vue.js v2.6.11 + * (c) 2014-2019 Evan You + * Released under the MIT License. + */var i=Object.freeze({});function a(t){return null==t}function s(t){return null!=t}function c(t){return!0===t}function u(t){return"string"==typeof t||"number"==typeof t||"symbol"==typeof t||"boolean"==typeof t}function f(t){return null!==t&&"object"==typeof t}var l=Object.prototype.toString;function p(t){return"[object Object]"===l.call(t)}function d(t){return"[object RegExp]"===l.call(t)}function h(t){var e=parseFloat(String(t));return e>=0&&Math.floor(e)===e&&isFinite(t)}function v(t){return s(t)&&"function"==typeof t.then&&"function"==typeof t.catch}function y(t){return null==t?"":Array.isArray(t)||p(t)&&t.toString===l?JSON.stringify(t,null,2):String(t)}function m(t){var e=parseFloat(t);return isNaN(e)?t:e}function g(t,e){for(var n=Object.create(null),r=t.split(","),o=0;o<r.length;o++)n[r[o]]=!0;return e?function(t){return n[t.toLowerCase()]}:function(t){return n[t]}}g("slot,component",!0);var b=g("key,ref,slot,slot-scope,is");function _(t,e){if(t.length){var n=t.indexOf(e);if(n>-1)return t.splice(n,1)}}var x=Object.prototype.hasOwnProperty;function w(t,e){return x.call(t,e)}function S(t){var e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}var O=/-(\w)/g,E=S((function(t){return t.replace(O,(function(t,e){return e?e.toUpperCase():""}))})),C=S((function(t){return t.charAt(0).toUpperCase()+t.slice(1)})),$=/\B([A-Z])/g,k=S((function(t){return t.replace($,"-$1").toLowerCase()}));var A=Function.prototype.bind?function(t,e){return t.bind(e)}:function(t,e){function n(n){var r=arguments.length;return r?r>1?t.apply(e,arguments):t.call(e,n):t.call(e)}return n._length=t.length,n};function j(t,e){e=e||0;for(var n=t.length-e,r=new Array(n);n--;)r[n]=t[n+e];return r}function T(t,e){for(var n in e)t[n]=e[n];return t}function P(t){for(var e={},n=0;n<t.length;n++)t[n]&&T(e,t[n]);return e}function L(t,e,n){}var R=function(t,e,n){return!1},I=function(t){return t};function M(t,e){if(t===e)return!0;var n=f(t),r=f(e);if(!n||!r)return!n&&!r&&String(t)===String(e);try{var o=Array.isArray(t),i=Array.isArray(e);if(o&&i)return t.length===e.length&&t.every((function(t,n){return M(t,e[n])}));if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();if(o||i)return!1;var a=Object.keys(t),s=Object.keys(e);return a.length===s.length&&a.every((function(n){return M(t[n],e[n])}))}catch(t){return!1}}function D(t,e){for(var n=0;n<t.length;n++)if(M(t[n],e))return n;return-1}function N(t){var e=!1;return function(){e||(e=!0,t.apply(this,arguments))}}var F=["component","directive","filter"],U=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeDestroy","destroyed","activated","deactivated","errorCaptured","serverPrefetch"],z={optionMergeStrategies:Object.create(null),silent:!1,productionTip:!1,devtools:!1,performance:!1,errorHandler:null,warnHandler:null,ignoredElements:[],keyCodes:Object.create(null),isReservedTag:R,isReservedAttr:R,isUnknownElement:R,getTagNamespace:L,parsePlatformTagName:I,mustUseProp:R,async:!0,_lifecycleHooks:U},B=/a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;function V(t,e,n,r){Object.defineProperty(t,e,{value:n,enumerable:!!r,writable:!0,configurable:!0})}var q=new RegExp("[^"+B.source+".$_\\d]");var H,W="__proto__"in{},G="undefined"!=typeof window,K="undefined"!=typeof WXEnvironment&&!!WXEnvironment.platform,Q=K&&WXEnvironment.platform.toLowerCase(),X=G&&window.navigator.userAgent.toLowerCase(),Y=X&&/msie|trident/.test(X),J=X&&X.indexOf("msie 9.0")>0,Z=X&&X.indexOf("edge/")>0,tt=(X&&X.indexOf("android"),X&&/iphone|ipad|ipod|ios/.test(X)||"ios"===Q),et=(X&&/chrome\/\d+/.test(X),X&&/phantomjs/.test(X),X&&X.match(/firefox\/(\d+)/)),nt={}.watch,rt=!1;if(G)try{var ot={};Object.defineProperty(ot,"passive",{get:function(){rt=!0}}),window.addEventListener("test-passive",null,ot)}catch(t){}var it=function(){return void 0===H&&(H=!G&&!K&&"undefined"!=typeof global&&(global.process&&"server"===global.process.env.VUE_ENV)),H},at=G&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function st(t){return"function"==typeof t&&/native code/.test(t.toString())}var ct,ut="undefined"!=typeof Symbol&&st(Symbol)&&"undefined"!=typeof Reflect&&st(Reflect.ownKeys);ct="undefined"!=typeof Set&&st(Set)?Set:function(){function t(){this.set=Object.create(null)}return t.prototype.has=function(t){return!0===this.set[t]},t.prototype.add=function(t){this.set[t]=!0},t.prototype.clear=function(){this.set=Object.create(null)},t}();var ft=L,lt=0,pt=function(){this.id=lt++,this.subs=[]};pt.prototype.addSub=function(t){this.subs.push(t)},pt.prototype.removeSub=function(t){_(this.subs,t)},pt.prototype.depend=function(){pt.target&&pt.target.addDep(this)},pt.prototype.notify=function(){var t=this.subs.slice();for(var e=0,n=t.length;e<n;e++)t[e].update()},pt.target=null;var dt=[];function ht(t){dt.push(t),pt.target=t}function vt(){dt.pop(),pt.target=dt[dt.length-1]}var yt=function(t,e,n,r,o,i,a,s){this.tag=t,this.data=e,this.children=n,this.text=r,this.elm=o,this.ns=void 0,this.context=i,this.fnContext=void 0,this.fnOptions=void 0,this.fnScopeId=void 0,this.key=e&&e.key,this.componentOptions=a,this.componentInstance=void 0,this.parent=void 0,this.raw=!1,this.isStatic=!1,this.isRootInsert=!0,this.isComment=!1,this.isCloned=!1,this.isOnce=!1,this.asyncFactory=s,this.asyncMeta=void 0,this.isAsyncPlaceholder=!1},mt={child:{configurable:!0}};mt.child.get=function(){return this.componentInstance},Object.defineProperties(yt.prototype,mt);var gt=function(t){void 0===t&&(t="");var e=new yt;return e.text=t,e.isComment=!0,e};function bt(t){return new yt(void 0,void 0,void 0,String(t))}function _t(t){var e=new yt(t.tag,t.data,t.children&&t.children.slice(),t.text,t.elm,t.context,t.componentOptions,t.asyncFactory);return e.ns=t.ns,e.isStatic=t.isStatic,e.key=t.key,e.isComment=t.isComment,e.fnContext=t.fnContext,e.fnOptions=t.fnOptions,e.fnScopeId=t.fnScopeId,e.asyncMeta=t.asyncMeta,e.isCloned=!0,e}var xt=Array.prototype,wt=Object.create(xt);["push","pop","shift","unshift","splice","sort","reverse"].forEach((function(t){var e=xt[t];V(wt,t,(function(){for(var n=[],r=arguments.length;r--;)n[r]=arguments[r];var o,i=e.apply(this,n),a=this.__ob__;switch(t){case"push":case"unshift":o=n;break;case"splice":o=n.slice(2)}return o&&a.observeArray(o),a.dep.notify(),i}))}));var St=Object.getOwnPropertyNames(wt),Ot=!0;function Et(t){Ot=t}var Ct=function(t){this.value=t,this.dep=new pt,this.vmCount=0,V(t,"__ob__",this),Array.isArray(t)?(W?function(t,e){t.__proto__=e}(t,wt):function(t,e,n){for(var r=0,o=n.length;r<o;r++){var i=n[r];V(t,i,e[i])}}(t,wt,St),this.observeArray(t)):this.walk(t)};function $t(t,e){var n;if(f(t)&&!(t instanceof yt))return w(t,"__ob__")&&t.__ob__ instanceof Ct?n=t.__ob__:Ot&&!it()&&(Array.isArray(t)||p(t))&&Object.isExtensible(t)&&!t._isVue&&(n=new Ct(t)),e&&n&&n.vmCount++,n}function kt(t,e,n,r,o){var i=new pt,a=Object.getOwnPropertyDescriptor(t,e);if(!a||!1!==a.configurable){var s=a&&a.get,c=a&&a.set;s&&!c||2!==arguments.length||(n=t[e]);var u=!o&&$t(n);Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:function(){var e=s?s.call(t):n;return pt.target&&(i.depend(),u&&(u.dep.depend(),Array.isArray(e)&&Tt(e))),e},set:function(e){var r=s?s.call(t):n;e===r||e!=e&&r!=r||s&&!c||(c?c.call(t,e):n=e,u=!o&&$t(e),i.notify())}})}}function At(t,e,n){if(Array.isArray(t)&&h(e))return t.length=Math.max(t.length,e),t.splice(e,1,n),n;if(e in t&&!(e in Object.prototype))return t[e]=n,n;var r=t.__ob__;return t._isVue||r&&r.vmCount?n:r?(kt(r.value,e,n),r.dep.notify(),n):(t[e]=n,n)}function jt(t,e){if(Array.isArray(t)&&h(e))t.splice(e,1);else{var n=t.__ob__;t._isVue||n&&n.vmCount||w(t,e)&&(delete t[e],n&&n.dep.notify())}}function Tt(t){for(var e=void 0,n=0,r=t.length;n<r;n++)(e=t[n])&&e.__ob__&&e.__ob__.dep.depend(),Array.isArray(e)&&Tt(e)}Ct.prototype.walk=function(t){for(var e=Object.keys(t),n=0;n<e.length;n++)kt(t,e[n])},Ct.prototype.observeArray=function(t){for(var e=0,n=t.length;e<n;e++)$t(t[e])};var Pt=z.optionMergeStrategies;function Lt(t,e){if(!e)return t;for(var n,r,o,i=ut?Reflect.ownKeys(e):Object.keys(e),a=0;a<i.length;a++)"__ob__"!==(n=i[a])&&(r=t[n],o=e[n],w(t,n)?r!==o&&p(r)&&p(o)&&Lt(r,o):At(t,n,o));return t}function Rt(t,e,n){return n?function(){var r="function"==typeof e?e.call(n,n):e,o="function"==typeof t?t.call(n,n):t;return r?Lt(r,o):o}:e?t?function(){return Lt("function"==typeof e?e.call(this,this):e,"function"==typeof t?t.call(this,this):t)}:e:t}function It(t,e){var n=e?t?t.concat(e):Array.isArray(e)?e:[e]:t;return n?function(t){for(var e=[],n=0;n<t.length;n++)-1===e.indexOf(t[n])&&e.push(t[n]);return e}(n):n}function Mt(t,e,n,r){var o=Object.create(t||null);return e?T(o,e):o}Pt.data=function(t,e,n){return n?Rt(t,e,n):e&&"function"!=typeof e?t:Rt(t,e)},U.forEach((function(t){Pt[t]=It})),F.forEach((function(t){Pt[t+"s"]=Mt})),Pt.watch=function(t,e,n,r){if(t===nt&&(t=void 0),e===nt&&(e=void 0),!e)return Object.create(t||null);if(!t)return e;var o={};for(var i in T(o,t),e){var a=o[i],s=e[i];a&&!Array.isArray(a)&&(a=[a]),o[i]=a?a.concat(s):Array.isArray(s)?s:[s]}return o},Pt.props=Pt.methods=Pt.inject=Pt.computed=function(t,e,n,r){if(!t)return e;var o=Object.create(null);return T(o,t),e&&T(o,e),o},Pt.provide=Rt;var Dt=function(t,e){return void 0===e?t:e};function Nt(t,e,n){if("function"==typeof e&&(e=e.options),function(t,e){var n=t.props;if(n){var r,o,i={};if(Array.isArray(n))for(r=n.length;r--;)"string"==typeof(o=n[r])&&(i[E(o)]={type:null});else if(p(n))for(var a in n)o=n[a],i[E(a)]=p(o)?o:{type:o};else 0;t.props=i}}(e),function(t,e){var n=t.inject;if(n){var r=t.inject={};if(Array.isArray(n))for(var o=0;o<n.length;o++)r[n[o]]={from:n[o]};else if(p(n))for(var i in n){var a=n[i];r[i]=p(a)?T({from:i},a):{from:a}}else 0}}(e),function(t){var e=t.directives;if(e)for(var n in e){var r=e[n];"function"==typeof r&&(e[n]={bind:r,update:r})}}(e),!e._base&&(e.extends&&(t=Nt(t,e.extends,n)),e.mixins))for(var r=0,o=e.mixins.length;r<o;r++)t=Nt(t,e.mixins[r],n);var i,a={};for(i in t)s(i);for(i in e)w(t,i)||s(i);function s(r){var o=Pt[r]||Dt;a[r]=o(t[r],e[r],n,r)}return a}function Ft(t,e,n,r){if("string"==typeof n){var o=t[e];if(w(o,n))return o[n];var i=E(n);if(w(o,i))return o[i];var a=C(i);return w(o,a)?o[a]:o[n]||o[i]||o[a]}}function Ut(t,e,n,r){var o=e[t],i=!w(n,t),a=n[t],s=Vt(Boolean,o.type);if(s>-1)if(i&&!w(o,"default"))a=!1;else if(""===a||a===k(t)){var c=Vt(String,o.type);(c<0||s<c)&&(a=!0)}if(void 0===a){a=function(t,e,n){if(!w(e,"default"))return;var r=e.default;0;if(t&&t.$options.propsData&&void 0===t.$options.propsData[n]&&void 0!==t._props[n])return t._props[n];return"function"==typeof r&&"Function"!==zt(e.type)?r.call(t):r}(r,o,t);var u=Ot;Et(!0),$t(a),Et(u)}return a}function zt(t){var e=t&&t.toString().match(/^\s*function (\w+)/);return e?e[1]:""}function Bt(t,e){return zt(t)===zt(e)}function Vt(t,e){if(!Array.isArray(e))return Bt(e,t)?0:-1;for(var n=0,r=e.length;n<r;n++)if(Bt(e[n],t))return n;return-1}function qt(t,e,n){ht();try{if(e)for(var r=e;r=r.$parent;){var o=r.$options.errorCaptured;if(o)for(var i=0;i<o.length;i++)try{if(!1===o[i].call(r,t,e,n))return}catch(t){Wt(t,r,"errorCaptured hook")}}Wt(t,e,n)}finally{vt()}}function Ht(t,e,n,r,o){var i;try{(i=n?t.apply(e,n):t.call(e))&&!i._isVue&&v(i)&&!i._handled&&(i.catch((function(t){return qt(t,r,o+" (Promise/async)")})),i._handled=!0)}catch(t){qt(t,r,o)}return i}function Wt(t,e,n){if(z.errorHandler)try{return z.errorHandler.call(null,t,e,n)}catch(e){e!==t&&Gt(e,null,"config.errorHandler")}Gt(t,e,n)}function Gt(t,e,n){if(!G&&!K||"undefined"==typeof console)throw t;console.error(t)}var Kt,Qt=!1,Xt=[],Yt=!1;function Jt(){Yt=!1;var t=Xt.slice(0);Xt.length=0;for(var e=0;e<t.length;e++)t[e]()}if("undefined"!=typeof Promise&&st(Promise)){var Zt=Promise.resolve();Kt=function(){Zt.then(Jt),tt&&setTimeout(L)},Qt=!0}else if(Y||"undefined"==typeof MutationObserver||!st(MutationObserver)&&"[object MutationObserverConstructor]"!==MutationObserver.toString())Kt="undefined"!=typeof setImmediate&&st(setImmediate)?function(){setImmediate(Jt)}:function(){setTimeout(Jt,0)};else{var te=1,ee=new MutationObserver(Jt),ne=document.createTextNode(String(te));ee.observe(ne,{characterData:!0}),Kt=function(){te=(te+1)%2,ne.data=String(te)},Qt=!0}function re(t,e){var n;if(Xt.push((function(){if(t)try{t.call(e)}catch(t){qt(t,e,"nextTick")}else n&&n(e)})),Yt||(Yt=!0,Kt()),!t&&"undefined"!=typeof Promise)return new Promise((function(t){n=t}))}var oe=new ct;function ie(t){!function t(e,n){var r,o,i=Array.isArray(e);if(!i&&!f(e)||Object.isFrozen(e)||e instanceof yt)return;if(e.__ob__){var a=e.__ob__.dep.id;if(n.has(a))return;n.add(a)}if(i)for(r=e.length;r--;)t(e[r],n);else for(o=Object.keys(e),r=o.length;r--;)t(e[o[r]],n)}(t,oe),oe.clear()}var ae=S((function(t){var e="&"===t.charAt(0),n="~"===(t=e?t.slice(1):t).charAt(0),r="!"===(t=n?t.slice(1):t).charAt(0);return{name:t=r?t.slice(1):t,once:n,capture:r,passive:e}}));function se(t,e){function n(){var t=arguments,r=n.fns;if(!Array.isArray(r))return Ht(r,null,arguments,e,"v-on handler");for(var o=r.slice(),i=0;i<o.length;i++)Ht(o[i],null,t,e,"v-on handler")}return n.fns=t,n}function ce(t,e,n,r,o,i){var s,u,f,l;for(s in t)u=t[s],f=e[s],l=ae(s),a(u)||(a(f)?(a(u.fns)&&(u=t[s]=se(u,i)),c(l.once)&&(u=t[s]=o(l.name,u,l.capture)),n(l.name,u,l.capture,l.passive,l.params)):u!==f&&(f.fns=u,t[s]=f));for(s in e)a(t[s])&&r((l=ae(s)).name,e[s],l.capture)}function ue(t,e,n){var r;t instanceof yt&&(t=t.data.hook||(t.data.hook={}));var o=t[e];function i(){n.apply(this,arguments),_(r.fns,i)}a(o)?r=se([i]):s(o.fns)&&c(o.merged)?(r=o).fns.push(i):r=se([o,i]),r.merged=!0,t[e]=r}function fe(t,e,n,r,o){if(s(e)){if(w(e,n))return t[n]=e[n],o||delete e[n],!0;if(w(e,r))return t[n]=e[r],o||delete e[r],!0}return!1}function le(t){return u(t)?[bt(t)]:Array.isArray(t)?function t(e,n){var r,o,i,f,l=[];for(r=0;r<e.length;r++)a(o=e[r])||"boolean"==typeof o||(i=l.length-1,f=l[i],Array.isArray(o)?o.length>0&&(pe((o=t(o,(n||"")+"_"+r))[0])&&pe(f)&&(l[i]=bt(f.text+o[0].text),o.shift()),l.push.apply(l,o)):u(o)?pe(f)?l[i]=bt(f.text+o):""!==o&&l.push(bt(o)):pe(o)&&pe(f)?l[i]=bt(f.text+o.text):(c(e._isVList)&&s(o.tag)&&a(o.key)&&s(n)&&(o.key="__vlist"+n+"_"+r+"__"),l.push(o)));return l}(t):void 0}function pe(t){return s(t)&&s(t.text)&&!1===t.isComment}function de(t,e){if(t){for(var n=Object.create(null),r=ut?Reflect.ownKeys(t):Object.keys(t),o=0;o<r.length;o++){var i=r[o];if("__ob__"!==i){for(var a=t[i].from,s=e;s;){if(s._provided&&w(s._provided,a)){n[i]=s._provided[a];break}s=s.$parent}if(!s)if("default"in t[i]){var c=t[i].default;n[i]="function"==typeof c?c.call(e):c}else 0}}return n}}function he(t,e){if(!t||!t.length)return{};for(var n={},r=0,o=t.length;r<o;r++){var i=t[r],a=i.data;if(a&&a.attrs&&a.attrs.slot&&delete a.attrs.slot,i.context!==e&&i.fnContext!==e||!a||null==a.slot)(n.default||(n.default=[])).push(i);else{var s=a.slot,c=n[s]||(n[s]=[]);"template"===i.tag?c.push.apply(c,i.children||[]):c.push(i)}}for(var u in n)n[u].every(ve)&&delete n[u];return n}function ve(t){return t.isComment&&!t.asyncFactory||" "===t.text}function ye(t,e,n){var r,o=Object.keys(e).length>0,a=t?!!t.$stable:!o,s=t&&t.$key;if(t){if(t._normalized)return t._normalized;if(a&&n&&n!==i&&s===n.$key&&!o&&!n.$hasNormal)return n;for(var c in r={},t)t[c]&&"$"!==c[0]&&(r[c]=me(e,c,t[c]))}else r={};for(var u in e)u in r||(r[u]=ge(e,u));return t&&Object.isExtensible(t)&&(t._normalized=r),V(r,"$stable",a),V(r,"$key",s),V(r,"$hasNormal",o),r}function me(t,e,n){var r=function(){var t=arguments.length?n.apply(null,arguments):n({});return(t=t&&"object"==typeof t&&!Array.isArray(t)?[t]:le(t))&&(0===t.length||1===t.length&&t[0].isComment)?void 0:t};return n.proxy&&Object.defineProperty(t,e,{get:r,enumerable:!0,configurable:!0}),r}function ge(t,e){return function(){return t[e]}}function be(t,e){var n,r,o,i,a;if(Array.isArray(t)||"string"==typeof t)for(n=new Array(t.length),r=0,o=t.length;r<o;r++)n[r]=e(t[r],r);else if("number"==typeof t)for(n=new Array(t),r=0;r<t;r++)n[r]=e(r+1,r);else if(f(t))if(ut&&t[Symbol.iterator]){n=[];for(var c=t[Symbol.iterator](),u=c.next();!u.done;)n.push(e(u.value,n.length)),u=c.next()}else for(i=Object.keys(t),n=new Array(i.length),r=0,o=i.length;r<o;r++)a=i[r],n[r]=e(t[a],a,r);return s(n)||(n=[]),n._isVList=!0,n}function _e(t,e,n,r){var o,i=this.$scopedSlots[t];i?(n=n||{},r&&(n=T(T({},r),n)),o=i(n)||e):o=this.$slots[t]||e;var a=n&&n.slot;return a?this.$createElement("template",{slot:a},o):o}function xe(t){return Ft(this.$options,"filters",t)||I}function we(t,e){return Array.isArray(t)?-1===t.indexOf(e):t!==e}function Se(t,e,n,r,o){var i=z.keyCodes[e]||n;return o&&r&&!z.keyCodes[e]?we(o,r):i?we(i,t):r?k(r)!==e:void 0}function Oe(t,e,n,r,o){if(n)if(f(n)){var i;Array.isArray(n)&&(n=P(n));var a=function(a){if("class"===a||"style"===a||b(a))i=t;else{var s=t.attrs&&t.attrs.type;i=r||z.mustUseProp(e,s,a)?t.domProps||(t.domProps={}):t.attrs||(t.attrs={})}var c=E(a),u=k(a);c in i||u in i||(i[a]=n[a],o&&((t.on||(t.on={}))["update:"+a]=function(t){n[a]=t}))};for(var s in n)a(s)}else;return t}function Ee(t,e){var n=this._staticTrees||(this._staticTrees=[]),r=n[t];return r&&!e||$e(r=n[t]=this.$options.staticRenderFns[t].call(this._renderProxy,null,this),"__static__"+t,!1),r}function Ce(t,e,n){return $e(t,"__once__"+e+(n?"_"+n:""),!0),t}function $e(t,e,n){if(Array.isArray(t))for(var r=0;r<t.length;r++)t[r]&&"string"!=typeof t[r]&&ke(t[r],e+"_"+r,n);else ke(t,e,n)}function ke(t,e,n){t.isStatic=!0,t.key=e,t.isOnce=n}function Ae(t,e){if(e)if(p(e)){var n=t.on=t.on?T({},t.on):{};for(var r in e){var o=n[r],i=e[r];n[r]=o?[].concat(o,i):i}}else;return t}function je(t,e,n,r){e=e||{$stable:!n};for(var o=0;o<t.length;o++){var i=t[o];Array.isArray(i)?je(i,e,n):i&&(i.proxy&&(i.fn.proxy=!0),e[i.key]=i.fn)}return r&&(e.$key=r),e}function Te(t,e){for(var n=0;n<e.length;n+=2){var r=e[n];"string"==typeof r&&r&&(t[e[n]]=e[n+1])}return t}function Pe(t,e){return"string"==typeof t?e+t:t}function Le(t){t._o=Ce,t._n=m,t._s=y,t._l=be,t._t=_e,t._q=M,t._i=D,t._m=Ee,t._f=xe,t._k=Se,t._b=Oe,t._v=bt,t._e=gt,t._u=je,t._g=Ae,t._d=Te,t._p=Pe}function Re(t,e,n,r,o){var a,s=this,u=o.options;w(r,"_uid")?(a=Object.create(r))._original=r:(a=r,r=r._original);var f=c(u._compiled),l=!f;this.data=t,this.props=e,this.children=n,this.parent=r,this.listeners=t.on||i,this.injections=de(u.inject,r),this.slots=function(){return s.$slots||ye(t.scopedSlots,s.$slots=he(n,r)),s.$slots},Object.defineProperty(this,"scopedSlots",{enumerable:!0,get:function(){return ye(t.scopedSlots,this.slots())}}),f&&(this.$options=u,this.$slots=this.slots(),this.$scopedSlots=ye(t.scopedSlots,this.$slots)),u._scopeId?this._c=function(t,e,n,o){var i=ze(a,t,e,n,o,l);return i&&!Array.isArray(i)&&(i.fnScopeId=u._scopeId,i.fnContext=r),i}:this._c=function(t,e,n,r){return ze(a,t,e,n,r,l)}}function Ie(t,e,n,r,o){var i=_t(t);return i.fnContext=n,i.fnOptions=r,e.slot&&((i.data||(i.data={})).slot=e.slot),i}function Me(t,e){for(var n in e)t[E(n)]=e[n]}Le(Re.prototype);var De={init:function(t,e){if(t.componentInstance&&!t.componentInstance._isDestroyed&&t.data.keepAlive){var n=t;De.prepatch(n,n)}else{(t.componentInstance=function(t,e){var n={_isComponent:!0,_parentVnode:t,parent:e},r=t.data.inlineTemplate;s(r)&&(n.render=r.render,n.staticRenderFns=r.staticRenderFns);return new t.componentOptions.Ctor(n)}(t,Ye)).$mount(e?t.elm:void 0,e)}},prepatch:function(t,e){var n=e.componentOptions;!function(t,e,n,r,o){0;var a=r.data.scopedSlots,s=t.$scopedSlots,c=!!(a&&!a.$stable||s!==i&&!s.$stable||a&&t.$scopedSlots.$key!==a.$key),u=!!(o||t.$options._renderChildren||c);t.$options._parentVnode=r,t.$vnode=r,t._vnode&&(t._vnode.parent=r);if(t.$options._renderChildren=o,t.$attrs=r.data.attrs||i,t.$listeners=n||i,e&&t.$options.props){Et(!1);for(var f=t._props,l=t.$options._propKeys||[],p=0;p<l.length;p++){var d=l[p],h=t.$options.props;f[d]=Ut(d,h,e,t)}Et(!0),t.$options.propsData=e}n=n||i;var v=t.$options._parentListeners;t.$options._parentListeners=n,Xe(t,n,v),u&&(t.$slots=he(o,r.context),t.$forceUpdate());0}(e.componentInstance=t.componentInstance,n.propsData,n.listeners,e,n.children)},insert:function(t){var e,n=t.context,r=t.componentInstance;r._isMounted||(r._isMounted=!0,en(r,"mounted")),t.data.keepAlive&&(n._isMounted?((e=r)._inactive=!1,rn.push(e)):tn(r,!0))},destroy:function(t){var e=t.componentInstance;e._isDestroyed||(t.data.keepAlive?function t(e,n){if(n&&(e._directInactive=!0,Ze(e)))return;if(!e._inactive){e._inactive=!0;for(var r=0;r<e.$children.length;r++)t(e.$children[r]);en(e,"deactivated")}}(e,!0):e.$destroy())}},Ne=Object.keys(De);function Fe(t,e,n,r,o){if(!a(t)){var u=n.$options._base;if(f(t)&&(t=u.extend(t)),"function"==typeof t){var l;if(a(t.cid)&&void 0===(t=function(t,e){if(c(t.error)&&s(t.errorComp))return t.errorComp;if(s(t.resolved))return t.resolved;var n=Ve;n&&s(t.owners)&&-1===t.owners.indexOf(n)&&t.owners.push(n);if(c(t.loading)&&s(t.loadingComp))return t.loadingComp;if(n&&!s(t.owners)){var r=t.owners=[n],o=!0,i=null,u=null;n.$on("hook:destroyed",(function(){return _(r,n)}));var l=function(t){for(var e=0,n=r.length;e<n;e++)r[e].$forceUpdate();t&&(r.length=0,null!==i&&(clearTimeout(i),i=null),null!==u&&(clearTimeout(u),u=null))},p=N((function(n){t.resolved=qe(n,e),o?r.length=0:l(!0)})),d=N((function(e){s(t.errorComp)&&(t.error=!0,l(!0))})),h=t(p,d);return f(h)&&(v(h)?a(t.resolved)&&h.then(p,d):v(h.component)&&(h.component.then(p,d),s(h.error)&&(t.errorComp=qe(h.error,e)),s(h.loading)&&(t.loadingComp=qe(h.loading,e),0===h.delay?t.loading=!0:i=setTimeout((function(){i=null,a(t.resolved)&&a(t.error)&&(t.loading=!0,l(!1))}),h.delay||200)),s(h.timeout)&&(u=setTimeout((function(){u=null,a(t.resolved)&&d(null)}),h.timeout)))),o=!1,t.loading?t.loadingComp:t.resolved}}(l=t,u)))return function(t,e,n,r,o){var i=gt();return i.asyncFactory=t,i.asyncMeta={data:e,context:n,children:r,tag:o},i}(l,e,n,r,o);e=e||{},On(t),s(e.model)&&function(t,e){var n=t.model&&t.model.prop||"value",r=t.model&&t.model.event||"input";(e.attrs||(e.attrs={}))[n]=e.model.value;var o=e.on||(e.on={}),i=o[r],a=e.model.callback;s(i)?(Array.isArray(i)?-1===i.indexOf(a):i!==a)&&(o[r]=[a].concat(i)):o[r]=a}(t.options,e);var p=function(t,e,n){var r=e.options.props;if(!a(r)){var o={},i=t.attrs,c=t.props;if(s(i)||s(c))for(var u in r){var f=k(u);fe(o,c,u,f,!0)||fe(o,i,u,f,!1)}return o}}(e,t);if(c(t.options.functional))return function(t,e,n,r,o){var a=t.options,c={},u=a.props;if(s(u))for(var f in u)c[f]=Ut(f,u,e||i);else s(n.attrs)&&Me(c,n.attrs),s(n.props)&&Me(c,n.props);var l=new Re(n,c,o,r,t),p=a.render.call(null,l._c,l);if(p instanceof yt)return Ie(p,n,l.parent,a,l);if(Array.isArray(p)){for(var d=le(p)||[],h=new Array(d.length),v=0;v<d.length;v++)h[v]=Ie(d[v],n,l.parent,a,l);return h}}(t,p,e,n,r);var d=e.on;if(e.on=e.nativeOn,c(t.options.abstract)){var h=e.slot;e={},h&&(e.slot=h)}!function(t){for(var e=t.hook||(t.hook={}),n=0;n<Ne.length;n++){var r=Ne[n],o=e[r],i=De[r];o===i||o&&o._merged||(e[r]=o?Ue(i,o):i)}}(e);var y=t.options.name||o;return new yt("vue-component-"+t.cid+(y?"-"+y:""),e,void 0,void 0,void 0,n,{Ctor:t,propsData:p,listeners:d,tag:o,children:r},l)}}}function Ue(t,e){var n=function(n,r){t(n,r),e(n,r)};return n._merged=!0,n}function ze(t,e,n,r,o,i){return(Array.isArray(n)||u(n))&&(o=r,r=n,n=void 0),c(i)&&(o=2),function(t,e,n,r,o){if(s(n)&&s(n.__ob__))return gt();s(n)&&s(n.is)&&(e=n.is);if(!e)return gt();0;Array.isArray(r)&&"function"==typeof r[0]&&((n=n||{}).scopedSlots={default:r[0]},r.length=0);2===o?r=le(r):1===o&&(r=function(t){for(var e=0;e<t.length;e++)if(Array.isArray(t[e]))return Array.prototype.concat.apply([],t);return t}(r));var i,u;if("string"==typeof e){var l;u=t.$vnode&&t.$vnode.ns||z.getTagNamespace(e),i=z.isReservedTag(e)?new yt(z.parsePlatformTagName(e),n,r,void 0,void 0,t):n&&n.pre||!s(l=Ft(t.$options,"components",e))?new yt(e,n,r,void 0,void 0,t):Fe(l,n,t,r,e)}else i=Fe(e,n,t,r);return Array.isArray(i)?i:s(i)?(s(u)&&function t(e,n,r){e.ns=n,"foreignObject"===e.tag&&(n=void 0,r=!0);if(s(e.children))for(var o=0,i=e.children.length;o<i;o++){var u=e.children[o];s(u.tag)&&(a(u.ns)||c(r)&&"svg"!==u.tag)&&t(u,n,r)}}(i,u),s(n)&&function(t){f(t.style)&&ie(t.style);f(t.class)&&ie(t.class)}(n),i):gt()}(t,e,n,r,o)}var Be,Ve=null;function qe(t,e){return(t.__esModule||ut&&"Module"===t[Symbol.toStringTag])&&(t=t.default),f(t)?e.extend(t):t}function He(t){return t.isComment&&t.asyncFactory}function We(t){if(Array.isArray(t))for(var e=0;e<t.length;e++){var n=t[e];if(s(n)&&(s(n.componentOptions)||He(n)))return n}}function Ge(t,e){Be.$on(t,e)}function Ke(t,e){Be.$off(t,e)}function Qe(t,e){var n=Be;return function r(){var o=e.apply(null,arguments);null!==o&&n.$off(t,r)}}function Xe(t,e,n){Be=t,ce(e,n||{},Ge,Ke,Qe,t),Be=void 0}var Ye=null;function Je(t){var e=Ye;return Ye=t,function(){Ye=e}}function Ze(t){for(;t&&(t=t.$parent);)if(t._inactive)return!0;return!1}function tn(t,e){if(e){if(t._directInactive=!1,Ze(t))return}else if(t._directInactive)return;if(t._inactive||null===t._inactive){t._inactive=!1;for(var n=0;n<t.$children.length;n++)tn(t.$children[n]);en(t,"activated")}}function en(t,e){ht();var n=t.$options[e],r=e+" hook";if(n)for(var o=0,i=n.length;o<i;o++)Ht(n[o],t,null,t,r);t._hasHookEvent&&t.$emit("hook:"+e),vt()}var nn=[],rn=[],on={},an=!1,sn=!1,cn=0;var un=0,fn=Date.now;if(G&&!Y){var ln=window.performance;ln&&"function"==typeof ln.now&&fn()>document.createEvent("Event").timeStamp&&(fn=function(){return ln.now()})}function pn(){var t,e;for(un=fn(),sn=!0,nn.sort((function(t,e){return t.id-e.id})),cn=0;cn<nn.length;cn++)(t=nn[cn]).before&&t.before(),e=t.id,on[e]=null,t.run();var n=rn.slice(),r=nn.slice();cn=nn.length=rn.length=0,on={},an=sn=!1,function(t){for(var e=0;e<t.length;e++)t[e]._inactive=!0,tn(t[e],!0)}(n),function(t){var e=t.length;for(;e--;){var n=t[e],r=n.vm;r._watcher===n&&r._isMounted&&!r._isDestroyed&&en(r,"updated")}}(r),at&&z.devtools&&at.emit("flush")}var dn=0,hn=function(t,e,n,r,o){this.vm=t,o&&(t._watcher=this),t._watchers.push(this),r?(this.deep=!!r.deep,this.user=!!r.user,this.lazy=!!r.lazy,this.sync=!!r.sync,this.before=r.before):this.deep=this.user=this.lazy=this.sync=!1,this.cb=n,this.id=++dn,this.active=!0,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=new ct,this.newDepIds=new ct,this.expression="","function"==typeof e?this.getter=e:(this.getter=function(t){if(!q.test(t)){var e=t.split(".");return function(t){for(var n=0;n<e.length;n++){if(!t)return;t=t[e[n]]}return t}}}(e),this.getter||(this.getter=L)),this.value=this.lazy?void 0:this.get()};hn.prototype.get=function(){var t;ht(this);var e=this.vm;try{t=this.getter.call(e,e)}catch(t){if(!this.user)throw t;qt(t,e,'getter for watcher "'+this.expression+'"')}finally{this.deep&&ie(t),vt(),this.cleanupDeps()}return t},hn.prototype.addDep=function(t){var e=t.id;this.newDepIds.has(e)||(this.newDepIds.add(e),this.newDeps.push(t),this.depIds.has(e)||t.addSub(this))},hn.prototype.cleanupDeps=function(){for(var t=this.deps.length;t--;){var e=this.deps[t];this.newDepIds.has(e.id)||e.removeSub(this)}var n=this.depIds;this.depIds=this.newDepIds,this.newDepIds=n,this.newDepIds.clear(),n=this.deps,this.deps=this.newDeps,this.newDeps=n,this.newDeps.length=0},hn.prototype.update=function(){this.lazy?this.dirty=!0:this.sync?this.run():function(t){var e=t.id;if(null==on[e]){if(on[e]=!0,sn){for(var n=nn.length-1;n>cn&&nn[n].id>t.id;)n--;nn.splice(n+1,0,t)}else nn.push(t);an||(an=!0,re(pn))}}(this)},hn.prototype.run=function(){if(this.active){var t=this.get();if(t!==this.value||f(t)||this.deep){var e=this.value;if(this.value=t,this.user)try{this.cb.call(this.vm,t,e)}catch(t){qt(t,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,t,e)}}},hn.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},hn.prototype.depend=function(){for(var t=this.deps.length;t--;)this.deps[t].depend()},hn.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||_(this.vm._watchers,this);for(var t=this.deps.length;t--;)this.deps[t].removeSub(this);this.active=!1}};var vn={enumerable:!0,configurable:!0,get:L,set:L};function yn(t,e,n){vn.get=function(){return this[e][n]},vn.set=function(t){this[e][n]=t},Object.defineProperty(t,n,vn)}function mn(t){t._watchers=[];var e=t.$options;e.props&&function(t,e){var n=t.$options.propsData||{},r=t._props={},o=t.$options._propKeys=[];t.$parent&&Et(!1);var i=function(i){o.push(i);var a=Ut(i,e,n,t);kt(r,i,a),i in t||yn(t,"_props",i)};for(var a in e)i(a);Et(!0)}(t,e.props),e.methods&&function(t,e){t.$options.props;for(var n in e)t[n]="function"!=typeof e[n]?L:A(e[n],t)}(t,e.methods),e.data?function(t){var e=t.$options.data;p(e=t._data="function"==typeof e?function(t,e){ht();try{return t.call(e,e)}catch(t){return qt(t,e,"data()"),{}}finally{vt()}}(e,t):e||{})||(e={});var n=Object.keys(e),r=t.$options.props,o=(t.$options.methods,n.length);for(;o--;){var i=n[o];0,r&&w(r,i)||(a=void 0,36!==(a=(i+"").charCodeAt(0))&&95!==a&&yn(t,"_data",i))}var a;$t(e,!0)}(t):$t(t._data={},!0),e.computed&&function(t,e){var n=t._computedWatchers=Object.create(null),r=it();for(var o in e){var i=e[o],a="function"==typeof i?i:i.get;0,r||(n[o]=new hn(t,a||L,L,gn)),o in t||bn(t,o,i)}}(t,e.computed),e.watch&&e.watch!==nt&&function(t,e){for(var n in e){var r=e[n];if(Array.isArray(r))for(var o=0;o<r.length;o++)wn(t,n,r[o]);else wn(t,n,r)}}(t,e.watch)}var gn={lazy:!0};function bn(t,e,n){var r=!it();"function"==typeof n?(vn.get=r?_n(e):xn(n),vn.set=L):(vn.get=n.get?r&&!1!==n.cache?_n(e):xn(n.get):L,vn.set=n.set||L),Object.defineProperty(t,e,vn)}function _n(t){return function(){var e=this._computedWatchers&&this._computedWatchers[t];if(e)return e.dirty&&e.evaluate(),pt.target&&e.depend(),e.value}}function xn(t){return function(){return t.call(this,this)}}function wn(t,e,n,r){return p(n)&&(r=n,n=n.handler),"string"==typeof n&&(n=t[n]),t.$watch(e,n,r)}var Sn=0;function On(t){var e=t.options;if(t.super){var n=On(t.super);if(n!==t.superOptions){t.superOptions=n;var r=function(t){var e,n=t.options,r=t.sealedOptions;for(var o in n)n[o]!==r[o]&&(e||(e={}),e[o]=n[o]);return e}(t);r&&T(t.extendOptions,r),(e=t.options=Nt(n,t.extendOptions)).name&&(e.components[e.name]=t)}}return e}function En(t){this._init(t)}function Cn(t){t.cid=0;var e=1;t.extend=function(t){t=t||{};var n=this,r=n.cid,o=t._Ctor||(t._Ctor={});if(o[r])return o[r];var i=t.name||n.options.name;var a=function(t){this._init(t)};return(a.prototype=Object.create(n.prototype)).constructor=a,a.cid=e++,a.options=Nt(n.options,t),a.super=n,a.options.props&&function(t){var e=t.options.props;for(var n in e)yn(t.prototype,"_props",n)}(a),a.options.computed&&function(t){var e=t.options.computed;for(var n in e)bn(t.prototype,n,e[n])}(a),a.extend=n.extend,a.mixin=n.mixin,a.use=n.use,F.forEach((function(t){a[t]=n[t]})),i&&(a.options.components[i]=a),a.superOptions=n.options,a.extendOptions=t,a.sealedOptions=T({},a.options),o[r]=a,a}}function $n(t){return t&&(t.Ctor.options.name||t.tag)}function kn(t,e){return Array.isArray(t)?t.indexOf(e)>-1:"string"==typeof t?t.split(",").indexOf(e)>-1:!!d(t)&&t.test(e)}function An(t,e){var n=t.cache,r=t.keys,o=t._vnode;for(var i in n){var a=n[i];if(a){var s=$n(a.componentOptions);s&&!e(s)&&jn(n,i,r,o)}}}function jn(t,e,n,r){var o=t[e];!o||r&&o.tag===r.tag||o.componentInstance.$destroy(),t[e]=null,_(n,e)}En.prototype._init=function(t){var e=this;e._uid=Sn++,e._isVue=!0,t&&t._isComponent?function(t,e){var n=t.$options=Object.create(t.constructor.options),r=e._parentVnode;n.parent=e.parent,n._parentVnode=r;var o=r.componentOptions;n.propsData=o.propsData,n._parentListeners=o.listeners,n._renderChildren=o.children,n._componentTag=o.tag,e.render&&(n.render=e.render,n.staticRenderFns=e.staticRenderFns)}(e,t):e.$options=Nt(On(e.constructor),t||{},e),e._renderProxy=e,e._self=e,function(t){var e=t.$options,n=e.parent;if(n&&!e.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(t)}t.$parent=n,t.$root=n?n.$root:t,t.$children=[],t.$refs={},t._watcher=null,t._inactive=null,t._directInactive=!1,t._isMounted=!1,t._isDestroyed=!1,t._isBeingDestroyed=!1}(e),function(t){t._events=Object.create(null),t._hasHookEvent=!1;var e=t.$options._parentListeners;e&&Xe(t,e)}(e),function(t){t._vnode=null,t._staticTrees=null;var e=t.$options,n=t.$vnode=e._parentVnode,r=n&&n.context;t.$slots=he(e._renderChildren,r),t.$scopedSlots=i,t._c=function(e,n,r,o){return ze(t,e,n,r,o,!1)},t.$createElement=function(e,n,r,o){return ze(t,e,n,r,o,!0)};var o=n&&n.data;kt(t,"$attrs",o&&o.attrs||i,null,!0),kt(t,"$listeners",e._parentListeners||i,null,!0)}(e),en(e,"beforeCreate"),function(t){var e=de(t.$options.inject,t);e&&(Et(!1),Object.keys(e).forEach((function(n){kt(t,n,e[n])})),Et(!0))}(e),mn(e),function(t){var e=t.$options.provide;e&&(t._provided="function"==typeof e?e.call(t):e)}(e),en(e,"created"),e.$options.el&&e.$mount(e.$options.el)},function(t){var e={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(t.prototype,"$data",e),Object.defineProperty(t.prototype,"$props",n),t.prototype.$set=At,t.prototype.$delete=jt,t.prototype.$watch=function(t,e,n){if(p(e))return wn(this,t,e,n);(n=n||{}).user=!0;var r=new hn(this,t,e,n);if(n.immediate)try{e.call(this,r.value)}catch(t){qt(t,this,'callback for immediate watcher "'+r.expression+'"')}return function(){r.teardown()}}}(En),function(t){var e=/^hook:/;t.prototype.$on=function(t,n){var r=this;if(Array.isArray(t))for(var o=0,i=t.length;o<i;o++)r.$on(t[o],n);else(r._events[t]||(r._events[t]=[])).push(n),e.test(t)&&(r._hasHookEvent=!0);return r},t.prototype.$once=function(t,e){var n=this;function r(){n.$off(t,r),e.apply(n,arguments)}return r.fn=e,n.$on(t,r),n},t.prototype.$off=function(t,e){var n=this;if(!arguments.length)return n._events=Object.create(null),n;if(Array.isArray(t)){for(var r=0,o=t.length;r<o;r++)n.$off(t[r],e);return n}var i,a=n._events[t];if(!a)return n;if(!e)return n._events[t]=null,n;for(var s=a.length;s--;)if((i=a[s])===e||i.fn===e){a.splice(s,1);break}return n},t.prototype.$emit=function(t){var e=this,n=e._events[t];if(n){n=n.length>1?j(n):n;for(var r=j(arguments,1),o='event handler for "'+t+'"',i=0,a=n.length;i<a;i++)Ht(n[i],e,r,e,o)}return e}}(En),function(t){t.prototype._update=function(t,e){var n=this,r=n.$el,o=n._vnode,i=Je(n);n._vnode=t,n.$el=o?n.__patch__(o,t):n.__patch__(n.$el,t,e,!1),i(),r&&(r.__vue__=null),n.$el&&(n.$el.__vue__=n),n.$vnode&&n.$parent&&n.$vnode===n.$parent._vnode&&(n.$parent.$el=n.$el)},t.prototype.$forceUpdate=function(){this._watcher&&this._watcher.update()},t.prototype.$destroy=function(){var t=this;if(!t._isBeingDestroyed){en(t,"beforeDestroy"),t._isBeingDestroyed=!0;var e=t.$parent;!e||e._isBeingDestroyed||t.$options.abstract||_(e.$children,t),t._watcher&&t._watcher.teardown();for(var n=t._watchers.length;n--;)t._watchers[n].teardown();t._data.__ob__&&t._data.__ob__.vmCount--,t._isDestroyed=!0,t.__patch__(t._vnode,null),en(t,"destroyed"),t.$off(),t.$el&&(t.$el.__vue__=null),t.$vnode&&(t.$vnode.parent=null)}}}(En),function(t){Le(t.prototype),t.prototype.$nextTick=function(t){return re(t,this)},t.prototype._render=function(){var t,e=this,n=e.$options,r=n.render,o=n._parentVnode;o&&(e.$scopedSlots=ye(o.data.scopedSlots,e.$slots,e.$scopedSlots)),e.$vnode=o;try{Ve=e,t=r.call(e._renderProxy,e.$createElement)}catch(n){qt(n,e,"render"),t=e._vnode}finally{Ve=null}return Array.isArray(t)&&1===t.length&&(t=t[0]),t instanceof yt||(t=gt()),t.parent=o,t}}(En);var Tn=[String,RegExp,Array],Pn={KeepAlive:{name:"keep-alive",abstract:!0,props:{include:Tn,exclude:Tn,max:[String,Number]},created:function(){this.cache=Object.create(null),this.keys=[]},destroyed:function(){for(var t in this.cache)jn(this.cache,t,this.keys)},mounted:function(){var t=this;this.$watch("include",(function(e){An(t,(function(t){return kn(e,t)}))})),this.$watch("exclude",(function(e){An(t,(function(t){return!kn(e,t)}))}))},render:function(){var t=this.$slots.default,e=We(t),n=e&&e.componentOptions;if(n){var r=$n(n),o=this.include,i=this.exclude;if(o&&(!r||!kn(o,r))||i&&r&&kn(i,r))return e;var a=this.cache,s=this.keys,c=null==e.key?n.Ctor.cid+(n.tag?"::"+n.tag:""):e.key;a[c]?(e.componentInstance=a[c].componentInstance,_(s,c),s.push(c)):(a[c]=e,s.push(c),this.max&&s.length>parseInt(this.max)&&jn(a,s[0],s,this._vnode)),e.data.keepAlive=!0}return e||t&&t[0]}}};!function(t){var e={get:function(){return z}};Object.defineProperty(t,"config",e),t.util={warn:ft,extend:T,mergeOptions:Nt,defineReactive:kt},t.set=At,t.delete=jt,t.nextTick=re,t.observable=function(t){return $t(t),t},t.options=Object.create(null),F.forEach((function(e){t.options[e+"s"]=Object.create(null)})),t.options._base=t,T(t.options.components,Pn),function(t){t.use=function(t){var e=this._installedPlugins||(this._installedPlugins=[]);if(e.indexOf(t)>-1)return this;var n=j(arguments,1);return n.unshift(this),"function"==typeof t.install?t.install.apply(t,n):"function"==typeof t&&t.apply(null,n),e.push(t),this}}(t),function(t){t.mixin=function(t){return this.options=Nt(this.options,t),this}}(t),Cn(t),function(t){F.forEach((function(e){t[e]=function(t,n){return n?("component"===e&&p(n)&&(n.name=n.name||t,n=this.options._base.extend(n)),"directive"===e&&"function"==typeof n&&(n={bind:n,update:n}),this.options[e+"s"][t]=n,n):this.options[e+"s"][t]}}))}(t)}(En),Object.defineProperty(En.prototype,"$isServer",{get:it}),Object.defineProperty(En.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(En,"FunctionalRenderContext",{value:Re}),En.version="2.6.11";var Ln=g("style,class"),Rn=g("input,textarea,option,select,progress"),In=g("contenteditable,draggable,spellcheck"),Mn=g("events,caret,typing,plaintext-only"),Dn=g("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),Nn="http://www.w3.org/1999/xlink",Fn=function(t){return":"===t.charAt(5)&&"xlink"===t.slice(0,5)},Un=function(t){return Fn(t)?t.slice(6,t.length):""},zn=function(t){return null==t||!1===t};function Bn(t){for(var e=t.data,n=t,r=t;s(r.componentInstance);)(r=r.componentInstance._vnode)&&r.data&&(e=Vn(r.data,e));for(;s(n=n.parent);)n&&n.data&&(e=Vn(e,n.data));return function(t,e){if(s(t)||s(e))return qn(t,Hn(e));return""}(e.staticClass,e.class)}function Vn(t,e){return{staticClass:qn(t.staticClass,e.staticClass),class:s(t.class)?[t.class,e.class]:e.class}}function qn(t,e){return t?e?t+" "+e:t:e||""}function Hn(t){return Array.isArray(t)?function(t){for(var e,n="",r=0,o=t.length;r<o;r++)s(e=Hn(t[r]))&&""!==e&&(n&&(n+=" "),n+=e);return n}(t):f(t)?function(t){var e="";for(var n in t)t[n]&&(e&&(e+=" "),e+=n);return e}(t):"string"==typeof t?t:""}var Wn={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"},Gn=g("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,menuitem,summary,content,element,shadow,template,blockquote,iframe,tfoot"),Kn=g("svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view",!0),Qn=function(t){return Gn(t)||Kn(t)};var Xn=Object.create(null);var Yn=g("text,number,password,search,email,tel,url");var Jn=Object.freeze({createElement:function(t,e){var n=document.createElement(t);return"select"!==t||e.data&&e.data.attrs&&void 0!==e.data.attrs.multiple&&n.setAttribute("multiple","multiple"),n},createElementNS:function(t,e){return document.createElementNS(Wn[t],e)},createTextNode:function(t){return document.createTextNode(t)},createComment:function(t){return document.createComment(t)},insertBefore:function(t,e,n){t.insertBefore(e,n)},removeChild:function(t,e){t.removeChild(e)},appendChild:function(t,e){t.appendChild(e)},parentNode:function(t){return t.parentNode},nextSibling:function(t){return t.nextSibling},tagName:function(t){return t.tagName},setTextContent:function(t,e){t.textContent=e},setStyleScope:function(t,e){t.setAttribute(e,"")}}),Zn={create:function(t,e){tr(e)},update:function(t,e){t.data.ref!==e.data.ref&&(tr(t,!0),tr(e))},destroy:function(t){tr(t,!0)}};function tr(t,e){var n=t.data.ref;if(s(n)){var r=t.context,o=t.componentInstance||t.elm,i=r.$refs;e?Array.isArray(i[n])?_(i[n],o):i[n]===o&&(i[n]=void 0):t.data.refInFor?Array.isArray(i[n])?i[n].indexOf(o)<0&&i[n].push(o):i[n]=[o]:i[n]=o}}var er=new yt("",{},[]),nr=["create","activate","update","remove","destroy"];function rr(t,e){return t.key===e.key&&(t.tag===e.tag&&t.isComment===e.isComment&&s(t.data)===s(e.data)&&function(t,e){if("input"!==t.tag)return!0;var n,r=s(n=t.data)&&s(n=n.attrs)&&n.type,o=s(n=e.data)&&s(n=n.attrs)&&n.type;return r===o||Yn(r)&&Yn(o)}(t,e)||c(t.isAsyncPlaceholder)&&t.asyncFactory===e.asyncFactory&&a(e.asyncFactory.error))}function or(t,e,n){var r,o,i={};for(r=e;r<=n;++r)s(o=t[r].key)&&(i[o]=r);return i}var ir={create:ar,update:ar,destroy:function(t){ar(t,er)}};function ar(t,e){(t.data.directives||e.data.directives)&&function(t,e){var n,r,o,i=t===er,a=e===er,s=cr(t.data.directives,t.context),c=cr(e.data.directives,e.context),u=[],f=[];for(n in c)r=s[n],o=c[n],r?(o.oldValue=r.value,o.oldArg=r.arg,fr(o,"update",e,t),o.def&&o.def.componentUpdated&&f.push(o)):(fr(o,"bind",e,t),o.def&&o.def.inserted&&u.push(o));if(u.length){var l=function(){for(var n=0;n<u.length;n++)fr(u[n],"inserted",e,t)};i?ue(e,"insert",l):l()}f.length&&ue(e,"postpatch",(function(){for(var n=0;n<f.length;n++)fr(f[n],"componentUpdated",e,t)}));if(!i)for(n in s)c[n]||fr(s[n],"unbind",t,t,a)}(t,e)}var sr=Object.create(null);function cr(t,e){var n,r,o=Object.create(null);if(!t)return o;for(n=0;n<t.length;n++)(r=t[n]).modifiers||(r.modifiers=sr),o[ur(r)]=r,r.def=Ft(e.$options,"directives",r.name);return o}function ur(t){return t.rawName||t.name+"."+Object.keys(t.modifiers||{}).join(".")}function fr(t,e,n,r,o){var i=t.def&&t.def[e];if(i)try{i(n.elm,t,n,r,o)}catch(r){qt(r,n.context,"directive "+t.name+" "+e+" hook")}}var lr=[Zn,ir];function pr(t,e){var n=e.componentOptions;if(!(s(n)&&!1===n.Ctor.options.inheritAttrs||a(t.data.attrs)&&a(e.data.attrs))){var r,o,i=e.elm,c=t.data.attrs||{},u=e.data.attrs||{};for(r in s(u.__ob__)&&(u=e.data.attrs=T({},u)),u)o=u[r],c[r]!==o&&dr(i,r,o);for(r in(Y||Z)&&u.value!==c.value&&dr(i,"value",u.value),c)a(u[r])&&(Fn(r)?i.removeAttributeNS(Nn,Un(r)):In(r)||i.removeAttribute(r))}}function dr(t,e,n){t.tagName.indexOf("-")>-1?hr(t,e,n):Dn(e)?zn(n)?t.removeAttribute(e):(n="allowfullscreen"===e&&"EMBED"===t.tagName?"true":e,t.setAttribute(e,n)):In(e)?t.setAttribute(e,function(t,e){return zn(e)||"false"===e?"false":"contenteditable"===t&&Mn(e)?e:"true"}(e,n)):Fn(e)?zn(n)?t.removeAttributeNS(Nn,Un(e)):t.setAttributeNS(Nn,e,n):hr(t,e,n)}function hr(t,e,n){if(zn(n))t.removeAttribute(e);else{if(Y&&!J&&"TEXTAREA"===t.tagName&&"placeholder"===e&&""!==n&&!t.__ieph){var r=function(e){e.stopImmediatePropagation(),t.removeEventListener("input",r)};t.addEventListener("input",r),t.__ieph=!0}t.setAttribute(e,n)}}var vr={create:pr,update:pr};function yr(t,e){var n=e.elm,r=e.data,o=t.data;if(!(a(r.staticClass)&&a(r.class)&&(a(o)||a(o.staticClass)&&a(o.class)))){var i=Bn(e),c=n._transitionClasses;s(c)&&(i=qn(i,Hn(c))),i!==n._prevClass&&(n.setAttribute("class",i),n._prevClass=i)}}var mr,gr={create:yr,update:yr};function br(t,e,n){var r=mr;return function o(){var i=e.apply(null,arguments);null!==i&&wr(t,o,n,r)}}var _r=Qt&&!(et&&Number(et[1])<=53);function xr(t,e,n,r){if(_r){var o=un,i=e;e=i._wrapper=function(t){if(t.target===t.currentTarget||t.timeStamp>=o||t.timeStamp<=0||t.target.ownerDocument!==document)return i.apply(this,arguments)}}mr.addEventListener(t,e,rt?{capture:n,passive:r}:n)}function wr(t,e,n,r){(r||mr).removeEventListener(t,e._wrapper||e,n)}function Sr(t,e){if(!a(t.data.on)||!a(e.data.on)){var n=e.data.on||{},r=t.data.on||{};mr=e.elm,function(t){if(s(t.__r)){var e=Y?"change":"input";t[e]=[].concat(t.__r,t[e]||[]),delete t.__r}s(t.__c)&&(t.change=[].concat(t.__c,t.change||[]),delete t.__c)}(n),ce(n,r,xr,wr,br,e.context),mr=void 0}}var Or,Er={create:Sr,update:Sr};function Cr(t,e){if(!a(t.data.domProps)||!a(e.data.domProps)){var n,r,o=e.elm,i=t.data.domProps||{},c=e.data.domProps||{};for(n in s(c.__ob__)&&(c=e.data.domProps=T({},c)),i)n in c||(o[n]="");for(n in c){if(r=c[n],"textContent"===n||"innerHTML"===n){if(e.children&&(e.children.length=0),r===i[n])continue;1===o.childNodes.length&&o.removeChild(o.childNodes[0])}if("value"===n&&"PROGRESS"!==o.tagName){o._value=r;var u=a(r)?"":String(r);$r(o,u)&&(o.value=u)}else if("innerHTML"===n&&Kn(o.tagName)&&a(o.innerHTML)){(Or=Or||document.createElement("div")).innerHTML="<svg>"+r+"</svg>";for(var f=Or.firstChild;o.firstChild;)o.removeChild(o.firstChild);for(;f.firstChild;)o.appendChild(f.firstChild)}else if(r!==i[n])try{o[n]=r}catch(t){}}}}function $r(t,e){return!t.composing&&("OPTION"===t.tagName||function(t,e){var n=!0;try{n=document.activeElement!==t}catch(t){}return n&&t.value!==e}(t,e)||function(t,e){var n=t.value,r=t._vModifiers;if(s(r)){if(r.number)return m(n)!==m(e);if(r.trim)return n.trim()!==e.trim()}return n!==e}(t,e))}var kr={create:Cr,update:Cr},Ar=S((function(t){var e={},n=/:(.+)/;return t.split(/;(?![^(]*\))/g).forEach((function(t){if(t){var r=t.split(n);r.length>1&&(e[r[0].trim()]=r[1].trim())}})),e}));function jr(t){var e=Tr(t.style);return t.staticStyle?T(t.staticStyle,e):e}function Tr(t){return Array.isArray(t)?P(t):"string"==typeof t?Ar(t):t}var Pr,Lr=/^--/,Rr=/\s*!important$/,Ir=function(t,e,n){if(Lr.test(e))t.style.setProperty(e,n);else if(Rr.test(n))t.style.setProperty(k(e),n.replace(Rr,""),"important");else{var r=Dr(e);if(Array.isArray(n))for(var o=0,i=n.length;o<i;o++)t.style[r]=n[o];else t.style[r]=n}},Mr=["Webkit","Moz","ms"],Dr=S((function(t){if(Pr=Pr||document.createElement("div").style,"filter"!==(t=E(t))&&t in Pr)return t;for(var e=t.charAt(0).toUpperCase()+t.slice(1),n=0;n<Mr.length;n++){var r=Mr[n]+e;if(r in Pr)return r}}));function Nr(t,e){var n=e.data,r=t.data;if(!(a(n.staticStyle)&&a(n.style)&&a(r.staticStyle)&&a(r.style))){var o,i,c=e.elm,u=r.staticStyle,f=r.normalizedStyle||r.style||{},l=u||f,p=Tr(e.data.style)||{};e.data.normalizedStyle=s(p.__ob__)?T({},p):p;var d=function(t,e){var n,r={};if(e)for(var o=t;o.componentInstance;)(o=o.componentInstance._vnode)&&o.data&&(n=jr(o.data))&&T(r,n);(n=jr(t.data))&&T(r,n);for(var i=t;i=i.parent;)i.data&&(n=jr(i.data))&&T(r,n);return r}(e,!0);for(i in l)a(d[i])&&Ir(c,i,"");for(i in d)(o=d[i])!==l[i]&&Ir(c,i,null==o?"":o)}}var Fr={create:Nr,update:Nr},Ur=/\s+/;function zr(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(Ur).forEach((function(e){return t.classList.add(e)})):t.classList.add(e);else{var n=" "+(t.getAttribute("class")||"")+" ";n.indexOf(" "+e+" ")<0&&t.setAttribute("class",(n+e).trim())}}function Br(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(Ur).forEach((function(e){return t.classList.remove(e)})):t.classList.remove(e),t.classList.length||t.removeAttribute("class");else{for(var n=" "+(t.getAttribute("class")||"")+" ",r=" "+e+" ";n.indexOf(r)>=0;)n=n.replace(r," ");(n=n.trim())?t.setAttribute("class",n):t.removeAttribute("class")}}function Vr(t){if(t){if("object"==typeof t){var e={};return!1!==t.css&&T(e,qr(t.name||"v")),T(e,t),e}return"string"==typeof t?qr(t):void 0}}var qr=S((function(t){return{enterClass:t+"-enter",enterToClass:t+"-enter-to",enterActiveClass:t+"-enter-active",leaveClass:t+"-leave",leaveToClass:t+"-leave-to",leaveActiveClass:t+"-leave-active"}})),Hr=G&&!J,Wr="transition",Gr="transitionend",Kr="animation",Qr="animationend";Hr&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(Wr="WebkitTransition",Gr="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(Kr="WebkitAnimation",Qr="webkitAnimationEnd"));var Xr=G?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(t){return t()};function Yr(t){Xr((function(){Xr(t)}))}function Jr(t,e){var n=t._transitionClasses||(t._transitionClasses=[]);n.indexOf(e)<0&&(n.push(e),zr(t,e))}function Zr(t,e){t._transitionClasses&&_(t._transitionClasses,e),Br(t,e)}function to(t,e,n){var r=no(t,e),o=r.type,i=r.timeout,a=r.propCount;if(!o)return n();var s="transition"===o?Gr:Qr,c=0,u=function(){t.removeEventListener(s,f),n()},f=function(e){e.target===t&&++c>=a&&u()};setTimeout((function(){c<a&&u()}),i+1),t.addEventListener(s,f)}var eo=/\b(transform|all)(,|$)/;function no(t,e){var n,r=window.getComputedStyle(t),o=(r[Wr+"Delay"]||"").split(", "),i=(r[Wr+"Duration"]||"").split(", "),a=ro(o,i),s=(r[Kr+"Delay"]||"").split(", "),c=(r[Kr+"Duration"]||"").split(", "),u=ro(s,c),f=0,l=0;return"transition"===e?a>0&&(n="transition",f=a,l=i.length):"animation"===e?u>0&&(n="animation",f=u,l=c.length):l=(n=(f=Math.max(a,u))>0?a>u?"transition":"animation":null)?"transition"===n?i.length:c.length:0,{type:n,timeout:f,propCount:l,hasTransform:"transition"===n&&eo.test(r[Wr+"Property"])}}function ro(t,e){for(;t.length<e.length;)t=t.concat(t);return Math.max.apply(null,e.map((function(e,n){return oo(e)+oo(t[n])})))}function oo(t){return 1e3*Number(t.slice(0,-1).replace(",","."))}function io(t,e){var n=t.elm;s(n._leaveCb)&&(n._leaveCb.cancelled=!0,n._leaveCb());var r=Vr(t.data.transition);if(!a(r)&&!s(n._enterCb)&&1===n.nodeType){for(var o=r.css,i=r.type,c=r.enterClass,u=r.enterToClass,l=r.enterActiveClass,p=r.appearClass,d=r.appearToClass,h=r.appearActiveClass,v=r.beforeEnter,y=r.enter,g=r.afterEnter,b=r.enterCancelled,_=r.beforeAppear,x=r.appear,w=r.afterAppear,S=r.appearCancelled,O=r.duration,E=Ye,C=Ye.$vnode;C&&C.parent;)E=C.context,C=C.parent;var $=!E._isMounted||!t.isRootInsert;if(!$||x||""===x){var k=$&&p?p:c,A=$&&h?h:l,j=$&&d?d:u,T=$&&_||v,P=$&&"function"==typeof x?x:y,L=$&&w||g,R=$&&S||b,I=m(f(O)?O.enter:O);0;var M=!1!==o&&!J,D=co(P),F=n._enterCb=N((function(){M&&(Zr(n,j),Zr(n,A)),F.cancelled?(M&&Zr(n,k),R&&R(n)):L&&L(n),n._enterCb=null}));t.data.show||ue(t,"insert",(function(){var e=n.parentNode,r=e&&e._pending&&e._pending[t.key];r&&r.tag===t.tag&&r.elm._leaveCb&&r.elm._leaveCb(),P&&P(n,F)})),T&&T(n),M&&(Jr(n,k),Jr(n,A),Yr((function(){Zr(n,k),F.cancelled||(Jr(n,j),D||(so(I)?setTimeout(F,I):to(n,i,F)))}))),t.data.show&&(e&&e(),P&&P(n,F)),M||D||F()}}}function ao(t,e){var n=t.elm;s(n._enterCb)&&(n._enterCb.cancelled=!0,n._enterCb());var r=Vr(t.data.transition);if(a(r)||1!==n.nodeType)return e();if(!s(n._leaveCb)){var o=r.css,i=r.type,c=r.leaveClass,u=r.leaveToClass,l=r.leaveActiveClass,p=r.beforeLeave,d=r.leave,h=r.afterLeave,v=r.leaveCancelled,y=r.delayLeave,g=r.duration,b=!1!==o&&!J,_=co(d),x=m(f(g)?g.leave:g);0;var w=n._leaveCb=N((function(){n.parentNode&&n.parentNode._pending&&(n.parentNode._pending[t.key]=null),b&&(Zr(n,u),Zr(n,l)),w.cancelled?(b&&Zr(n,c),v&&v(n)):(e(),h&&h(n)),n._leaveCb=null}));y?y(S):S()}function S(){w.cancelled||(!t.data.show&&n.parentNode&&((n.parentNode._pending||(n.parentNode._pending={}))[t.key]=t),p&&p(n),b&&(Jr(n,c),Jr(n,l),Yr((function(){Zr(n,c),w.cancelled||(Jr(n,u),_||(so(x)?setTimeout(w,x):to(n,i,w)))}))),d&&d(n,w),b||_||w())}}function so(t){return"number"==typeof t&&!isNaN(t)}function co(t){if(a(t))return!1;var e=t.fns;return s(e)?co(Array.isArray(e)?e[0]:e):(t._length||t.length)>1}function uo(t,e){!0!==e.data.show&&io(e)}var fo=function(t){var e,n,r={},o=t.modules,i=t.nodeOps;for(e=0;e<nr.length;++e)for(r[nr[e]]=[],n=0;n<o.length;++n)s(o[n][nr[e]])&&r[nr[e]].push(o[n][nr[e]]);function f(t){var e=i.parentNode(t);s(e)&&i.removeChild(e,t)}function l(t,e,n,o,a,u,f){if(s(t.elm)&&s(u)&&(t=u[f]=_t(t)),t.isRootInsert=!a,!function(t,e,n,o){var i=t.data;if(s(i)){var a=s(t.componentInstance)&&i.keepAlive;if(s(i=i.hook)&&s(i=i.init)&&i(t,!1),s(t.componentInstance))return p(t,e),d(n,t.elm,o),c(a)&&function(t,e,n,o){var i,a=t;for(;a.componentInstance;)if(a=a.componentInstance._vnode,s(i=a.data)&&s(i=i.transition)){for(i=0;i<r.activate.length;++i)r.activate[i](er,a);e.push(a);break}d(n,t.elm,o)}(t,e,n,o),!0}}(t,e,n,o)){var l=t.data,v=t.children,g=t.tag;s(g)?(t.elm=t.ns?i.createElementNS(t.ns,g):i.createElement(g,t),m(t),h(t,v,e),s(l)&&y(t,e),d(n,t.elm,o)):c(t.isComment)?(t.elm=i.createComment(t.text),d(n,t.elm,o)):(t.elm=i.createTextNode(t.text),d(n,t.elm,o))}}function p(t,e){s(t.data.pendingInsert)&&(e.push.apply(e,t.data.pendingInsert),t.data.pendingInsert=null),t.elm=t.componentInstance.$el,v(t)?(y(t,e),m(t)):(tr(t),e.push(t))}function d(t,e,n){s(t)&&(s(n)?i.parentNode(n)===t&&i.insertBefore(t,e,n):i.appendChild(t,e))}function h(t,e,n){if(Array.isArray(e)){0;for(var r=0;r<e.length;++r)l(e[r],n,t.elm,null,!0,e,r)}else u(t.text)&&i.appendChild(t.elm,i.createTextNode(String(t.text)))}function v(t){for(;t.componentInstance;)t=t.componentInstance._vnode;return s(t.tag)}function y(t,n){for(var o=0;o<r.create.length;++o)r.create[o](er,t);s(e=t.data.hook)&&(s(e.create)&&e.create(er,t),s(e.insert)&&n.push(t))}function m(t){var e;if(s(e=t.fnScopeId))i.setStyleScope(t.elm,e);else for(var n=t;n;)s(e=n.context)&&s(e=e.$options._scopeId)&&i.setStyleScope(t.elm,e),n=n.parent;s(e=Ye)&&e!==t.context&&e!==t.fnContext&&s(e=e.$options._scopeId)&&i.setStyleScope(t.elm,e)}function b(t,e,n,r,o,i){for(;r<=o;++r)l(n[r],i,t,e,!1,n,r)}function _(t){var e,n,o=t.data;if(s(o))for(s(e=o.hook)&&s(e=e.destroy)&&e(t),e=0;e<r.destroy.length;++e)r.destroy[e](t);if(s(e=t.children))for(n=0;n<t.children.length;++n)_(t.children[n])}function x(t,e,n){for(;e<=n;++e){var r=t[e];s(r)&&(s(r.tag)?(w(r),_(r)):f(r.elm))}}function w(t,e){if(s(e)||s(t.data)){var n,o=r.remove.length+1;for(s(e)?e.listeners+=o:e=function(t,e){function n(){0==--n.listeners&&f(t)}return n.listeners=e,n}(t.elm,o),s(n=t.componentInstance)&&s(n=n._vnode)&&s(n.data)&&w(n,e),n=0;n<r.remove.length;++n)r.remove[n](t,e);s(n=t.data.hook)&&s(n=n.remove)?n(t,e):e()}else f(t.elm)}function S(t,e,n,r){for(var o=n;o<r;o++){var i=e[o];if(s(i)&&rr(t,i))return o}}function O(t,e,n,o,u,f){if(t!==e){s(e.elm)&&s(o)&&(e=o[u]=_t(e));var p=e.elm=t.elm;if(c(t.isAsyncPlaceholder))s(e.asyncFactory.resolved)?$(t.elm,e,n):e.isAsyncPlaceholder=!0;else if(c(e.isStatic)&&c(t.isStatic)&&e.key===t.key&&(c(e.isCloned)||c(e.isOnce)))e.componentInstance=t.componentInstance;else{var d,h=e.data;s(h)&&s(d=h.hook)&&s(d=d.prepatch)&&d(t,e);var y=t.children,m=e.children;if(s(h)&&v(e)){for(d=0;d<r.update.length;++d)r.update[d](t,e);s(d=h.hook)&&s(d=d.update)&&d(t,e)}a(e.text)?s(y)&&s(m)?y!==m&&function(t,e,n,r,o){var c,u,f,p=0,d=0,h=e.length-1,v=e[0],y=e[h],m=n.length-1,g=n[0],_=n[m],w=!o;for(0;p<=h&&d<=m;)a(v)?v=e[++p]:a(y)?y=e[--h]:rr(v,g)?(O(v,g,r,n,d),v=e[++p],g=n[++d]):rr(y,_)?(O(y,_,r,n,m),y=e[--h],_=n[--m]):rr(v,_)?(O(v,_,r,n,m),w&&i.insertBefore(t,v.elm,i.nextSibling(y.elm)),v=e[++p],_=n[--m]):rr(y,g)?(O(y,g,r,n,d),w&&i.insertBefore(t,y.elm,v.elm),y=e[--h],g=n[++d]):(a(c)&&(c=or(e,p,h)),a(u=s(g.key)?c[g.key]:S(g,e,p,h))?l(g,r,t,v.elm,!1,n,d):rr(f=e[u],g)?(O(f,g,r,n,d),e[u]=void 0,w&&i.insertBefore(t,f.elm,v.elm)):l(g,r,t,v.elm,!1,n,d),g=n[++d]);p>h?b(t,a(n[m+1])?null:n[m+1].elm,n,d,m,r):d>m&&x(e,p,h)}(p,y,m,n,f):s(m)?(s(t.text)&&i.setTextContent(p,""),b(p,null,m,0,m.length-1,n)):s(y)?x(y,0,y.length-1):s(t.text)&&i.setTextContent(p,""):t.text!==e.text&&i.setTextContent(p,e.text),s(h)&&s(d=h.hook)&&s(d=d.postpatch)&&d(t,e)}}}function E(t,e,n){if(c(n)&&s(t.parent))t.parent.data.pendingInsert=e;else for(var r=0;r<e.length;++r)e[r].data.hook.insert(e[r])}var C=g("attrs,class,staticClass,staticStyle,key");function $(t,e,n,r){var o,i=e.tag,a=e.data,u=e.children;if(r=r||a&&a.pre,e.elm=t,c(e.isComment)&&s(e.asyncFactory))return e.isAsyncPlaceholder=!0,!0;if(s(a)&&(s(o=a.hook)&&s(o=o.init)&&o(e,!0),s(o=e.componentInstance)))return p(e,n),!0;if(s(i)){if(s(u))if(t.hasChildNodes())if(s(o=a)&&s(o=o.domProps)&&s(o=o.innerHTML)){if(o!==t.innerHTML)return!1}else{for(var f=!0,l=t.firstChild,d=0;d<u.length;d++){if(!l||!$(l,u[d],n,r)){f=!1;break}l=l.nextSibling}if(!f||l)return!1}else h(e,u,n);if(s(a)){var v=!1;for(var m in a)if(!C(m)){v=!0,y(e,n);break}!v&&a.class&&ie(a.class)}}else t.data!==e.text&&(t.data=e.text);return!0}return function(t,e,n,o){if(!a(e)){var u,f=!1,p=[];if(a(t))f=!0,l(e,p);else{var d=s(t.nodeType);if(!d&&rr(t,e))O(t,e,p,null,null,o);else{if(d){if(1===t.nodeType&&t.hasAttribute("data-server-rendered")&&(t.removeAttribute("data-server-rendered"),n=!0),c(n)&&$(t,e,p))return E(e,p,!0),t;u=t,t=new yt(i.tagName(u).toLowerCase(),{},[],void 0,u)}var h=t.elm,y=i.parentNode(h);if(l(e,p,h._leaveCb?null:y,i.nextSibling(h)),s(e.parent))for(var m=e.parent,g=v(e);m;){for(var b=0;b<r.destroy.length;++b)r.destroy[b](m);if(m.elm=e.elm,g){for(var w=0;w<r.create.length;++w)r.create[w](er,m);var S=m.data.hook.insert;if(S.merged)for(var C=1;C<S.fns.length;C++)S.fns[C]()}else tr(m);m=m.parent}s(y)?x([t],0,0):s(t.tag)&&_(t)}}return E(e,p,f),e.elm}s(t)&&_(t)}}({nodeOps:Jn,modules:[vr,gr,Er,kr,Fr,G?{create:uo,activate:uo,remove:function(t,e){!0!==t.data.show?ao(t,e):e()}}:{}].concat(lr)});J&&document.addEventListener("selectionchange",(function(){var t=document.activeElement;t&&t.vmodel&&bo(t,"input")}));var lo={inserted:function(t,e,n,r){"select"===n.tag?(r.elm&&!r.elm._vOptions?ue(n,"postpatch",(function(){lo.componentUpdated(t,e,n)})):po(t,e,n.context),t._vOptions=[].map.call(t.options,yo)):("textarea"===n.tag||Yn(t.type))&&(t._vModifiers=e.modifiers,e.modifiers.lazy||(t.addEventListener("compositionstart",mo),t.addEventListener("compositionend",go),t.addEventListener("change",go),J&&(t.vmodel=!0)))},componentUpdated:function(t,e,n){if("select"===n.tag){po(t,e,n.context);var r=t._vOptions,o=t._vOptions=[].map.call(t.options,yo);if(o.some((function(t,e){return!M(t,r[e])})))(t.multiple?e.value.some((function(t){return vo(t,o)})):e.value!==e.oldValue&&vo(e.value,o))&&bo(t,"change")}}};function po(t,e,n){ho(t,e,n),(Y||Z)&&setTimeout((function(){ho(t,e,n)}),0)}function ho(t,e,n){var r=e.value,o=t.multiple;if(!o||Array.isArray(r)){for(var i,a,s=0,c=t.options.length;s<c;s++)if(a=t.options[s],o)i=D(r,yo(a))>-1,a.selected!==i&&(a.selected=i);else if(M(yo(a),r))return void(t.selectedIndex!==s&&(t.selectedIndex=s));o||(t.selectedIndex=-1)}}function vo(t,e){return e.every((function(e){return!M(e,t)}))}function yo(t){return"_value"in t?t._value:t.value}function mo(t){t.target.composing=!0}function go(t){t.target.composing&&(t.target.composing=!1,bo(t.target,"input"))}function bo(t,e){var n=document.createEvent("HTMLEvents");n.initEvent(e,!0,!0),t.dispatchEvent(n)}function _o(t){return!t.componentInstance||t.data&&t.data.transition?t:_o(t.componentInstance._vnode)}var xo={model:lo,show:{bind:function(t,e,n){var r=e.value,o=(n=_o(n)).data&&n.data.transition,i=t.__vOriginalDisplay="none"===t.style.display?"":t.style.display;r&&o?(n.data.show=!0,io(n,(function(){t.style.display=i}))):t.style.display=r?i:"none"},update:function(t,e,n){var r=e.value;!r!=!e.oldValue&&((n=_o(n)).data&&n.data.transition?(n.data.show=!0,r?io(n,(function(){t.style.display=t.__vOriginalDisplay})):ao(n,(function(){t.style.display="none"}))):t.style.display=r?t.__vOriginalDisplay:"none")},unbind:function(t,e,n,r,o){o||(t.style.display=t.__vOriginalDisplay)}}},wo={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function So(t){var e=t&&t.componentOptions;return e&&e.Ctor.options.abstract?So(We(e.children)):t}function Oo(t){var e={},n=t.$options;for(var r in n.propsData)e[r]=t[r];var o=n._parentListeners;for(var i in o)e[E(i)]=o[i];return e}function Eo(t,e){if(/\d-keep-alive$/.test(e.tag))return t("keep-alive",{props:e.componentOptions.propsData})}var Co=function(t){return t.tag||He(t)},$o=function(t){return"show"===t.name},ko={name:"transition",props:wo,abstract:!0,render:function(t){var e=this,n=this.$slots.default;if(n&&(n=n.filter(Co)).length){0;var r=this.mode;0;var o=n[0];if(function(t){for(;t=t.parent;)if(t.data.transition)return!0}(this.$vnode))return o;var i=So(o);if(!i)return o;if(this._leaving)return Eo(t,o);var a="__transition-"+this._uid+"-";i.key=null==i.key?i.isComment?a+"comment":a+i.tag:u(i.key)?0===String(i.key).indexOf(a)?i.key:a+i.key:i.key;var s=(i.data||(i.data={})).transition=Oo(this),c=this._vnode,f=So(c);if(i.data.directives&&i.data.directives.some($o)&&(i.data.show=!0),f&&f.data&&!function(t,e){return e.key===t.key&&e.tag===t.tag}(i,f)&&!He(f)&&(!f.componentInstance||!f.componentInstance._vnode.isComment)){var l=f.data.transition=T({},s);if("out-in"===r)return this._leaving=!0,ue(l,"afterLeave",(function(){e._leaving=!1,e.$forceUpdate()})),Eo(t,o);if("in-out"===r){if(He(i))return c;var p,d=function(){p()};ue(s,"afterEnter",d),ue(s,"enterCancelled",d),ue(l,"delayLeave",(function(t){p=t}))}}return o}}},Ao=T({tag:String,moveClass:String},wo);function jo(t){t.elm._moveCb&&t.elm._moveCb(),t.elm._enterCb&&t.elm._enterCb()}function To(t){t.data.newPos=t.elm.getBoundingClientRect()}function Po(t){var e=t.data.pos,n=t.data.newPos,r=e.left-n.left,o=e.top-n.top;if(r||o){t.data.moved=!0;var i=t.elm.style;i.transform=i.WebkitTransform="translate("+r+"px,"+o+"px)",i.transitionDuration="0s"}}delete Ao.mode;var Lo={Transition:ko,TransitionGroup:{props:Ao,beforeMount:function(){var t=this,e=this._update;this._update=function(n,r){var o=Je(t);t.__patch__(t._vnode,t.kept,!1,!0),t._vnode=t.kept,o(),e.call(t,n,r)}},render:function(t){for(var e=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,o=this.$slots.default||[],i=this.children=[],a=Oo(this),s=0;s<o.length;s++){var c=o[s];if(c.tag)if(null!=c.key&&0!==String(c.key).indexOf("__vlist"))i.push(c),n[c.key]=c,(c.data||(c.data={})).transition=a;else;}if(r){for(var u=[],f=[],l=0;l<r.length;l++){var p=r[l];p.data.transition=a,p.data.pos=p.elm.getBoundingClientRect(),n[p.key]?u.push(p):f.push(p)}this.kept=t(e,null,u),this.removed=f}return t(e,null,i)},updated:function(){var t=this.prevChildren,e=this.moveClass||(this.name||"v")+"-move";t.length&&this.hasMove(t[0].elm,e)&&(t.forEach(jo),t.forEach(To),t.forEach(Po),this._reflow=document.body.offsetHeight,t.forEach((function(t){if(t.data.moved){var n=t.elm,r=n.style;Jr(n,e),r.transform=r.WebkitTransform=r.transitionDuration="",n.addEventListener(Gr,n._moveCb=function t(r){r&&r.target!==n||r&&!/transform$/.test(r.propertyName)||(n.removeEventListener(Gr,t),n._moveCb=null,Zr(n,e))})}})))},methods:{hasMove:function(t,e){if(!Hr)return!1;if(this._hasMove)return this._hasMove;var n=t.cloneNode();t._transitionClasses&&t._transitionClasses.forEach((function(t){Br(n,t)})),zr(n,e),n.style.display="none",this.$el.appendChild(n);var r=no(n);return this.$el.removeChild(n),this._hasMove=r.hasTransform}}}};En.config.mustUseProp=function(t,e,n){return"value"===n&&Rn(t)&&"button"!==e||"selected"===n&&"option"===t||"checked"===n&&"input"===t||"muted"===n&&"video"===t},En.config.isReservedTag=Qn,En.config.isReservedAttr=Ln,En.config.getTagNamespace=function(t){return Kn(t)?"svg":"math"===t?"math":void 0},En.config.isUnknownElement=function(t){if(!G)return!0;if(Qn(t))return!1;if(t=t.toLowerCase(),null!=Xn[t])return Xn[t];var e=document.createElement(t);return t.indexOf("-")>-1?Xn[t]=e.constructor===window.HTMLUnknownElement||e.constructor===window.HTMLElement:Xn[t]=/HTMLUnknownElement/.test(e.toString())},T(En.options.directives,xo),T(En.options.components,Lo),En.prototype.__patch__=G?fo:L,En.prototype.$mount=function(t,e){return function(t,e,n){var r;return t.$el=e,t.$options.render||(t.$options.render=gt),en(t,"beforeMount"),r=function(){t._update(t._render(),n)},new hn(t,r,L,{before:function(){t._isMounted&&!t._isDestroyed&&en(t,"beforeUpdate")}},!0),n=!1,null==t.$vnode&&(t._isMounted=!0,en(t,"mounted")),t}(this,t=t&&G?function(t){if("string"==typeof t){var e=document.querySelector(t);return e||document.createElement("div")}return t}(t):void 0,e)},G&&setTimeout((function(){z.devtools&&at&&at.emit("init",En)}),0);var Ro=En; +/*! + * vue-router v3.1.5 + * (c) 2020 Evan You + * @license MIT + */function Io(t){return Object.prototype.toString.call(t).indexOf("Error")>-1}function Mo(t,e){return e instanceof t||e&&(e.name===t.name||e._name===t._name)}function Do(t,e){for(var n in e)t[n]=e[n];return t}var No={name:"RouterView",functional:!0,props:{name:{type:String,default:"default"}},render:function(t,e){var n=e.props,r=e.children,o=e.parent,i=e.data;i.routerView=!0;for(var a=o.$createElement,s=n.name,c=o.$route,u=o._routerViewCache||(o._routerViewCache={}),f=0,l=!1;o&&o._routerRoot!==o;){var p=o.$vnode?o.$vnode.data:{};p.routerView&&f++,p.keepAlive&&o._directInactive&&o._inactive&&(l=!0),o=o.$parent}if(i.routerViewDepth=f,l){var d=u[s],h=d&&d.component;return h?(d.configProps&&Fo(h,i,d.route,d.configProps),a(h,i,r)):a()}var v=c.matched[f],y=v&&v.components[s];if(!v||!y)return u[s]=null,a();u[s]={component:y},i.registerRouteInstance=function(t,e){var n=v.instances[s];(e&&n!==t||!e&&n===t)&&(v.instances[s]=e)},(i.hook||(i.hook={})).prepatch=function(t,e){v.instances[s]=e.componentInstance},i.hook.init=function(t){t.data.keepAlive&&t.componentInstance&&t.componentInstance!==v.instances[s]&&(v.instances[s]=t.componentInstance)};var m=v.props&&v.props[s];return m&&(Do(u[s],{route:c,configProps:m}),Fo(y,i,c,m)),a(y,i,r)}};function Fo(t,e,n,r){var o=e.props=function(t,e){switch(typeof e){case"undefined":return;case"object":return e;case"function":return e(t);case"boolean":return e?t.params:void 0;default:0}}(n,r);if(o){o=e.props=Do({},o);var i=e.attrs=e.attrs||{};for(var a in o)t.props&&a in t.props||(i[a]=o[a],delete o[a])}}var Uo=/[!'()*]/g,zo=function(t){return"%"+t.charCodeAt(0).toString(16)},Bo=/%2C/g,Vo=function(t){return encodeURIComponent(t).replace(Uo,zo).replace(Bo,",")},qo=decodeURIComponent;function Ho(t){var e={};return(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach((function(t){var n=t.replace(/\+/g," ").split("="),r=qo(n.shift()),o=n.length>0?qo(n.join("=")):null;void 0===e[r]?e[r]=o:Array.isArray(e[r])?e[r].push(o):e[r]=[e[r],o]})),e):e}function Wo(t){var e=t?Object.keys(t).map((function(e){var n=t[e];if(void 0===n)return"";if(null===n)return Vo(e);if(Array.isArray(n)){var r=[];return n.forEach((function(t){void 0!==t&&(null===t?r.push(Vo(e)):r.push(Vo(e)+"="+Vo(t)))})),r.join("&")}return Vo(e)+"="+Vo(n)})).filter((function(t){return t.length>0})).join("&"):null;return e?"?"+e:""}var Go=/\/?$/;function Ko(t,e,n,r){var o=r&&r.options.stringifyQuery,i=e.query||{};try{i=Qo(i)}catch(t){}var a={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:i,params:e.params||{},fullPath:Jo(e,o),matched:t?Yo(t):[]};return n&&(a.redirectedFrom=Jo(n,o)),Object.freeze(a)}function Qo(t){if(Array.isArray(t))return t.map(Qo);if(t&&"object"==typeof t){var e={};for(var n in t)e[n]=Qo(t[n]);return e}return t}var Xo=Ko(null,{path:"/"});function Yo(t){for(var e=[];t;)e.unshift(t),t=t.parent;return e}function Jo(t,e){var n=t.path,r=t.query;void 0===r&&(r={});var o=t.hash;return void 0===o&&(o=""),(n||"/")+(e||Wo)(r)+o}function Zo(t,e){return e===Xo?t===e:!!e&&(t.path&&e.path?t.path.replace(Go,"")===e.path.replace(Go,"")&&t.hash===e.hash&&ti(t.query,e.query):!(!t.name||!e.name)&&(t.name===e.name&&t.hash===e.hash&&ti(t.query,e.query)&&ti(t.params,e.params)))}function ti(t,e){if(void 0===t&&(t={}),void 0===e&&(e={}),!t||!e)return t===e;var n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every((function(n){var r=t[n],o=e[n];return"object"==typeof r&&"object"==typeof o?ti(r,o):String(r)===String(o)}))}function ei(t,e,n){var r=t.charAt(0);if("/"===r)return t;if("?"===r||"#"===r)return e+t;var o=e.split("/");n&&o[o.length-1]||o.pop();for(var i=t.replace(/^\//,"").split("/"),a=0;a<i.length;a++){var s=i[a];".."===s?o.pop():"."!==s&&o.push(s)}return""!==o[0]&&o.unshift(""),o.join("/")}function ni(t){return t.replace(/\/\//g,"/")}var ri=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},oi=gi,ii=fi,ai=function(t,e){return pi(fi(t,e))},si=pi,ci=mi,ui=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function fi(t,e){for(var n,r=[],o=0,i=0,a="",s=e&&e.delimiter||"/";null!=(n=ui.exec(t));){var c=n[0],u=n[1],f=n.index;if(a+=t.slice(i,f),i=f+c.length,u)a+=u[1];else{var l=t[i],p=n[2],d=n[3],h=n[4],v=n[5],y=n[6],m=n[7];a&&(r.push(a),a="");var g=null!=p&&null!=l&&l!==p,b="+"===y||"*"===y,_="?"===y||"*"===y,x=n[2]||s,w=h||v;r.push({name:d||o++,prefix:p||"",delimiter:x,optional:_,repeat:b,partial:g,asterisk:!!m,pattern:w?hi(w):m?".*":"[^"+di(x)+"]+?"})}}return i<t.length&&(a+=t.substr(i)),a&&r.push(a),r}function li(t){return encodeURI(t).replace(/[\/?#]/g,(function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()}))}function pi(t){for(var e=new Array(t.length),n=0;n<t.length;n++)"object"==typeof t[n]&&(e[n]=new RegExp("^(?:"+t[n].pattern+")$"));return function(n,r){for(var o="",i=n||{},a=(r||{}).pretty?li:encodeURIComponent,s=0;s<t.length;s++){var c=t[s];if("string"!=typeof c){var u,f=i[c.name];if(null==f){if(c.optional){c.partial&&(o+=c.prefix);continue}throw new TypeError('Expected "'+c.name+'" to be defined')}if(ri(f)){if(!c.repeat)throw new TypeError('Expected "'+c.name+'" to not repeat, but received `'+JSON.stringify(f)+"`");if(0===f.length){if(c.optional)continue;throw new TypeError('Expected "'+c.name+'" to not be empty')}for(var l=0;l<f.length;l++){if(u=a(f[l]),!e[s].test(u))throw new TypeError('Expected all "'+c.name+'" to match "'+c.pattern+'", but received `'+JSON.stringify(u)+"`");o+=(0===l?c.prefix:c.delimiter)+u}}else{if(u=c.asterisk?encodeURI(f).replace(/[?#]/g,(function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})):a(f),!e[s].test(u))throw new TypeError('Expected "'+c.name+'" to match "'+c.pattern+'", but received "'+u+'"');o+=c.prefix+u}}else o+=c}return o}}function di(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function hi(t){return t.replace(/([=!:$\/()])/g,"\\$1")}function vi(t,e){return t.keys=e,t}function yi(t){return t.sensitive?"":"i"}function mi(t,e,n){ri(e)||(n=e||n,e=[]);for(var r=(n=n||{}).strict,o=!1!==n.end,i="",a=0;a<t.length;a++){var s=t[a];if("string"==typeof s)i+=di(s);else{var c=di(s.prefix),u="(?:"+s.pattern+")";e.push(s),s.repeat&&(u+="(?:"+c+u+")*"),i+=u=s.optional?s.partial?c+"("+u+")?":"(?:"+c+"("+u+"))?":c+"("+u+")"}}var f=di(n.delimiter||"/"),l=i.slice(-f.length)===f;return r||(i=(l?i.slice(0,-f.length):i)+"(?:"+f+"(?=$))?"),i+=o?"$":r&&l?"":"(?="+f+"|$)",vi(new RegExp("^"+i,yi(n)),e)}function gi(t,e,n){return ri(e)||(n=e||n,e=[]),n=n||{},t instanceof RegExp?function(t,e){var n=t.source.match(/\((?!\?)/g);if(n)for(var r=0;r<n.length;r++)e.push({name:r,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return vi(t,e)}(t,e):ri(t)?function(t,e,n){for(var r=[],o=0;o<t.length;o++)r.push(gi(t[o],e,n).source);return vi(new RegExp("(?:"+r.join("|")+")",yi(n)),e)}(t,e,n):function(t,e,n){return mi(fi(t,n),e,n)}(t,e,n)}oi.parse=ii,oi.compile=ai,oi.tokensToFunction=si,oi.tokensToRegExp=ci;var bi=Object.create(null);function _i(t,e,n){e=e||{};try{var r=bi[t]||(bi[t]=oi.compile(t));return e.pathMatch&&(e[0]=e.pathMatch),r(e,{pretty:!0})}catch(t){return""}finally{delete e[0]}}function xi(t,e,n,r){var o="string"==typeof t?{path:t}:t;if(o._normalized)return o;if(o.name){var i=(o=Do({},t)).params;return i&&"object"==typeof i&&(o.params=Do({},i)),o}if(!o.path&&o.params&&e){(o=Do({},o))._normalized=!0;var a=Do(Do({},e.params),o.params);if(e.name)o.name=e.name,o.params=a;else if(e.matched.length){var s=e.matched[e.matched.length-1].path;o.path=_i(s,a,e.path)}else 0;return o}var c=function(t){var e="",n="",r=t.indexOf("#");r>=0&&(e=t.slice(r),t=t.slice(0,r));var o=t.indexOf("?");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{path:t,query:n,hash:e}}(o.path||""),u=e&&e.path||"/",f=c.path?ei(c.path,u,n||o.append):u,l=function(t,e,n){void 0===e&&(e={});var r,o=n||Ho;try{r=o(t||"")}catch(t){r={}}for(var i in e)r[i]=e[i];return r}(c.query,o.query,r&&r.options.parseQuery),p=o.hash||c.hash;return p&&"#"!==p.charAt(0)&&(p="#"+p),{_normalized:!0,path:f,query:l,hash:p}}var wi,Si=function(){},Oi={name:"RouterLink",props:{to:{type:[String,Object],required:!0},tag:{type:String,default:"a"},exact:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String,event:{type:[String,Array],default:"click"}},render:function(t){var e=this,n=this.$router,r=this.$route,o=n.resolve(this.to,r,this.append),i=o.location,a=o.route,s=o.href,c={},u=n.options.linkActiveClass,f=n.options.linkExactActiveClass,l=null==u?"router-link-active":u,p=null==f?"router-link-exact-active":f,d=null==this.activeClass?l:this.activeClass,h=null==this.exactActiveClass?p:this.exactActiveClass,v=a.redirectedFrom?Ko(null,xi(a.redirectedFrom),null,n):a;c[h]=Zo(r,v),c[d]=this.exact?c[h]:function(t,e){return 0===t.path.replace(Go,"/").indexOf(e.path.replace(Go,"/"))&&(!e.hash||t.hash===e.hash)&&function(t,e){for(var n in e)if(!(n in t))return!1;return!0}(t.query,e.query)}(r,v);var y=function(t){Ei(t)&&(e.replace?n.replace(i,Si):n.push(i,Si))},m={click:Ei};Array.isArray(this.event)?this.event.forEach((function(t){m[t]=y})):m[this.event]=y;var g={class:c},b=!this.$scopedSlots.$hasNormal&&this.$scopedSlots.default&&this.$scopedSlots.default({href:s,route:a,navigate:y,isActive:c[d],isExactActive:c[h]});if(b){if(1===b.length)return b[0];if(b.length>1||!b.length)return 0===b.length?t():t("span",{},b)}if("a"===this.tag)g.on=m,g.attrs={href:s};else{var _=function t(e){var n;if(e)for(var r=0;r<e.length;r++){if("a"===(n=e[r]).tag)return n;if(n.children&&(n=t(n.children)))return n}}(this.$slots.default);if(_){_.isStatic=!1;var x=_.data=Do({},_.data);for(var w in x.on=x.on||{},x.on){var S=x.on[w];w in m&&(x.on[w]=Array.isArray(S)?S:[S])}for(var O in m)O in x.on?x.on[O].push(m[O]):x.on[O]=y;(_.data.attrs=Do({},_.data.attrs)).href=s}else g.on=m}return t(this.tag,g,this.$slots.default)}};function Ei(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||t.defaultPrevented||void 0!==t.button&&0!==t.button)){if(t.currentTarget&&t.currentTarget.getAttribute){var e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}var Ci="undefined"!=typeof window;function $i(t,e,n,r){var o=e||[],i=n||Object.create(null),a=r||Object.create(null);t.forEach((function(t){!function t(e,n,r,o,i,a){var s=o.path,c=o.name;0;var u=o.pathToRegexpOptions||{},f=function(t,e,n){n||(t=t.replace(/\/$/,""));if("/"===t[0])return t;if(null==e)return t;return ni(e.path+"/"+t)}(s,i,u.strict);"boolean"==typeof o.caseSensitive&&(u.sensitive=o.caseSensitive);var l={path:f,regex:ki(f,u),components:o.components||{default:o.component},instances:{},name:c,parent:i,matchAs:a,redirect:o.redirect,beforeEnter:o.beforeEnter,meta:o.meta||{},props:null==o.props?{}:o.components?o.props:{default:o.props}};o.children&&o.children.forEach((function(o){var i=a?ni(a+"/"+o.path):void 0;t(e,n,r,o,l,i)}));n[l.path]||(e.push(l.path),n[l.path]=l);if(void 0!==o.alias)for(var p=Array.isArray(o.alias)?o.alias:[o.alias],d=0;d<p.length;++d){0;var h={path:p[d],children:o.children};t(e,n,r,h,i,l.path||"/")}c&&(r[c]||(r[c]=l))}(o,i,a,t)}));for(var s=0,c=o.length;s<c;s++)"*"===o[s]&&(o.push(o.splice(s,1)[0]),c--,s--);return{pathList:o,pathMap:i,nameMap:a}}function ki(t,e){return oi(t,[],e)}function Ai(t,e){var n=$i(t),r=n.pathList,o=n.pathMap,i=n.nameMap;function a(t,n,a){var s=xi(t,n,!1,e),u=s.name;if(u){var f=i[u];if(!f)return c(null,s);var l=f.regex.keys.filter((function(t){return!t.optional})).map((function(t){return t.name}));if("object"!=typeof s.params&&(s.params={}),n&&"object"==typeof n.params)for(var p in n.params)!(p in s.params)&&l.indexOf(p)>-1&&(s.params[p]=n.params[p]);return s.path=_i(f.path,s.params),c(f,s,a)}if(s.path){s.params={};for(var d=0;d<r.length;d++){var h=r[d],v=o[h];if(ji(v.regex,s.path,s.params))return c(v,s,a)}}return c(null,s)}function s(t,n){var r=t.redirect,o="function"==typeof r?r(Ko(t,n,null,e)):r;if("string"==typeof o&&(o={path:o}),!o||"object"!=typeof o)return c(null,n);var s=o,u=s.name,f=s.path,l=n.query,p=n.hash,d=n.params;if(l=s.hasOwnProperty("query")?s.query:l,p=s.hasOwnProperty("hash")?s.hash:p,d=s.hasOwnProperty("params")?s.params:d,u){i[u];return a({_normalized:!0,name:u,query:l,hash:p,params:d},void 0,n)}if(f){var h=function(t,e){return ei(t,e.parent?e.parent.path:"/",!0)}(f,t);return a({_normalized:!0,path:_i(h,d),query:l,hash:p},void 0,n)}return c(null,n)}function c(t,n,r){return t&&t.redirect?s(t,r||n):t&&t.matchAs?function(t,e,n){var r=a({_normalized:!0,path:_i(n,e.params)});if(r){var o=r.matched,i=o[o.length-1];return e.params=r.params,c(i,e)}return c(null,e)}(0,n,t.matchAs):Ko(t,n,r,e)}return{match:a,addRoutes:function(t){$i(t,r,o,i)}}}function ji(t,e,n){var r=e.match(t);if(!r)return!1;if(!n)return!0;for(var o=1,i=r.length;o<i;++o){var a=t.keys[o-1],s="string"==typeof r[o]?decodeURIComponent(r[o]):r[o];a&&(n[a.name||"pathMatch"]=s)}return!0}var Ti=Ci&&window.performance&&window.performance.now?window.performance:Date;function Pi(){return Ti.now().toFixed(3)}var Li=Pi();function Ri(){return Li}function Ii(t){return Li=t}var Mi=Object.create(null);function Di(){var t=window.location.protocol+"//"+window.location.host,e=window.location.href.replace(t,"");window.history.replaceState({key:Ri()},"",e),window.addEventListener("popstate",(function(t){Fi(),t.state&&t.state.key&&Ii(t.state.key)}))}function Ni(t,e,n,r){if(t.app){var o=t.options.scrollBehavior;o&&t.app.$nextTick((function(){var i=function(){var t=Ri();if(t)return Mi[t]}(),a=o.call(t,e,n,r?i:null);a&&("function"==typeof a.then?a.then((function(t){qi(t,i)})).catch((function(t){0})):qi(a,i))}))}}function Fi(){var t=Ri();t&&(Mi[t]={x:window.pageXOffset,y:window.pageYOffset})}function Ui(t){return Bi(t.x)||Bi(t.y)}function zi(t){return{x:Bi(t.x)?t.x:window.pageXOffset,y:Bi(t.y)?t.y:window.pageYOffset}}function Bi(t){return"number"==typeof t}var Vi=/^#\d/;function qi(t,e){var n,r="object"==typeof t;if(r&&"string"==typeof t.selector){var o=Vi.test(t.selector)?document.getElementById(t.selector.slice(1)):document.querySelector(t.selector);if(o){var i=t.offset&&"object"==typeof t.offset?t.offset:{};e=function(t,e){var n=document.documentElement.getBoundingClientRect(),r=t.getBoundingClientRect();return{x:r.left-n.left-e.x,y:r.top-n.top-e.y}}(o,i={x:Bi((n=i).x)?n.x:0,y:Bi(n.y)?n.y:0})}else Ui(t)&&(e=zi(t))}else r&&Ui(t)&&(e=zi(t));e&&window.scrollTo(e.x,e.y)}var Hi,Wi=Ci&&((-1===(Hi=window.navigator.userAgent).indexOf("Android 2.")&&-1===Hi.indexOf("Android 4.0")||-1===Hi.indexOf("Mobile Safari")||-1!==Hi.indexOf("Chrome")||-1!==Hi.indexOf("Windows Phone"))&&window.history&&"pushState"in window.history);function Gi(t,e){Fi();var n=window.history;try{if(e){var r=Do({},n.state);r.key=Ri(),n.replaceState(r,"",t)}else n.pushState({key:Ii(Pi())},"",t)}catch(n){window.location[e?"replace":"assign"](t)}}function Ki(t){Gi(t,!0)}function Qi(t,e,n){var r=function(o){o>=t.length?n():t[o]?e(t[o],(function(){r(o+1)})):r(o+1)};r(0)}function Xi(t){return function(e,n,r){var o=!1,i=0,a=null;Yi(t,(function(t,e,n,s){if("function"==typeof t&&void 0===t.cid){o=!0,i++;var c,u=ta((function(e){var o;((o=e).__esModule||Zi&&"Module"===o[Symbol.toStringTag])&&(e=e.default),t.resolved="function"==typeof e?e:wi.extend(e),n.components[s]=e,--i<=0&&r()})),f=ta((function(t){var e="Failed to resolve async component "+s+": "+t;a||(a=Io(t)?t:new Error(e),r(a))}));try{c=t(u,f)}catch(t){f(t)}if(c)if("function"==typeof c.then)c.then(u,f);else{var l=c.component;l&&"function"==typeof l.then&&l.then(u,f)}}})),o||r()}}function Yi(t,e){return Ji(t.map((function(t){return Object.keys(t.components).map((function(n){return e(t.components[n],t.instances[n],t,n)}))})))}function Ji(t){return Array.prototype.concat.apply([],t)}var Zi="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;function ta(t){var e=!1;return function(){for(var n=[],r=arguments.length;r--;)n[r]=arguments[r];if(!e)return e=!0,t.apply(this,n)}}var ea=function(t){function e(e){t.call(this),this.name=this._name="NavigationDuplicated",this.message='Navigating to current location ("'+e.fullPath+'") is not allowed',Object.defineProperty(this,"stack",{value:(new t).stack,writable:!0,configurable:!0})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error);ea._name="NavigationDuplicated";var na=function(t,e){this.router=t,this.base=function(t){if(!t)if(Ci){var e=document.querySelector("base");t=(t=e&&e.getAttribute("href")||"/").replace(/^https?:\/\/[^\/]+/,"")}else t="/";"/"!==t.charAt(0)&&(t="/"+t);return t.replace(/\/$/,"")}(e),this.current=Xo,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[]};function ra(t,e,n,r){var o=Yi(t,(function(t,r,o,i){var a=function(t,e){"function"!=typeof t&&(t=wi.extend(t));return t.options[e]}(t,e);if(a)return Array.isArray(a)?a.map((function(t){return n(t,r,o,i)})):n(a,r,o,i)}));return Ji(r?o.reverse():o)}function oa(t,e){if(e)return function(){return t.apply(e,arguments)}}na.prototype.listen=function(t){this.cb=t},na.prototype.onReady=function(t,e){this.ready?t():(this.readyCbs.push(t),e&&this.readyErrorCbs.push(e))},na.prototype.onError=function(t){this.errorCbs.push(t)},na.prototype.transitionTo=function(t,e,n){var r=this,o=this.router.match(t,this.current);this.confirmTransition(o,(function(){r.updateRoute(o),e&&e(o),r.ensureURL(),r.ready||(r.ready=!0,r.readyCbs.forEach((function(t){t(o)})))}),(function(t){n&&n(t),t&&!r.ready&&(r.ready=!0,r.readyErrorCbs.forEach((function(e){e(t)})))}))},na.prototype.confirmTransition=function(t,e,n){var r=this,o=this.current,i=function(t){!Mo(ea,t)&&Io(t)&&(r.errorCbs.length?r.errorCbs.forEach((function(e){e(t)})):console.error(t)),n&&n(t)};if(Zo(t,o)&&t.matched.length===o.matched.length)return this.ensureURL(),i(new ea(t));var a=function(t,e){var n,r=Math.max(t.length,e.length);for(n=0;n<r&&t[n]===e[n];n++);return{updated:e.slice(0,n),activated:e.slice(n),deactivated:t.slice(n)}}(this.current.matched,t.matched),s=a.updated,c=a.deactivated,u=a.activated,f=[].concat(function(t){return ra(t,"beforeRouteLeave",oa,!0)}(c),this.router.beforeHooks,function(t){return ra(t,"beforeRouteUpdate",oa)}(s),u.map((function(t){return t.beforeEnter})),Xi(u));this.pending=t;var l=function(e,n){if(r.pending!==t)return i();try{e(t,o,(function(t){!1===t||Io(t)?(r.ensureURL(!0),i(t)):"string"==typeof t||"object"==typeof t&&("string"==typeof t.path||"string"==typeof t.name)?(i(),"object"==typeof t&&t.replace?r.replace(t):r.push(t)):n(t)}))}catch(t){i(t)}};Qi(f,l,(function(){var n=[];Qi(function(t,e,n){return ra(t,"beforeRouteEnter",(function(t,r,o,i){return function(t,e,n,r,o){return function(i,a,s){return t(i,a,(function(t){"function"==typeof t&&r.push((function(){!function t(e,n,r,o){n[r]&&!n[r]._isBeingDestroyed?e(n[r]):o()&&setTimeout((function(){t(e,n,r,o)}),16)}(t,e.instances,n,o)})),s(t)}))}}(t,o,i,e,n)}))}(u,n,(function(){return r.current===t})).concat(r.router.resolveHooks),l,(function(){if(r.pending!==t)return i();r.pending=null,e(t),r.router.app&&r.router.app.$nextTick((function(){n.forEach((function(t){t()}))}))}))}))},na.prototype.updateRoute=function(t){var e=this.current;this.current=t,this.cb&&this.cb(t),this.router.afterHooks.forEach((function(n){n&&n(t,e)}))};var ia=function(t){function e(e,n){var r=this;t.call(this,e,n);var o=e.options.scrollBehavior,i=Wi&&o;i&&Di();var a=aa(this.base);window.addEventListener("popstate",(function(t){var n=r.current,o=aa(r.base);r.current===Xo&&o===a||r.transitionTo(o,(function(t){i&&Ni(e,t,n,!0)}))}))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.go=function(t){window.history.go(t)},e.prototype.push=function(t,e,n){var r=this,o=this.current;this.transitionTo(t,(function(t){Gi(ni(r.base+t.fullPath)),Ni(r.router,t,o,!1),e&&e(t)}),n)},e.prototype.replace=function(t,e,n){var r=this,o=this.current;this.transitionTo(t,(function(t){Ki(ni(r.base+t.fullPath)),Ni(r.router,t,o,!1),e&&e(t)}),n)},e.prototype.ensureURL=function(t){if(aa(this.base)!==this.current.fullPath){var e=ni(this.base+this.current.fullPath);t?Gi(e):Ki(e)}},e.prototype.getCurrentLocation=function(){return aa(this.base)},e}(na);function aa(t){var e=decodeURI(window.location.pathname);return t&&0===e.indexOf(t)&&(e=e.slice(t.length)),(e||"/")+window.location.search+window.location.hash}var sa=function(t){function e(e,n,r){t.call(this,e,n),r&&function(t){var e=aa(t);if(!/^\/#/.test(e))return window.location.replace(ni(t+"/#"+e)),!0}(this.base)||ca()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setupListeners=function(){var t=this,e=this.router.options.scrollBehavior,n=Wi&&e;n&&Di(),window.addEventListener(Wi?"popstate":"hashchange",(function(){var e=t.current;ca()&&t.transitionTo(ua(),(function(r){n&&Ni(t.router,r,e,!0),Wi||pa(r.fullPath)}))}))},e.prototype.push=function(t,e,n){var r=this,o=this.current;this.transitionTo(t,(function(t){la(t.fullPath),Ni(r.router,t,o,!1),e&&e(t)}),n)},e.prototype.replace=function(t,e,n){var r=this,o=this.current;this.transitionTo(t,(function(t){pa(t.fullPath),Ni(r.router,t,o,!1),e&&e(t)}),n)},e.prototype.go=function(t){window.history.go(t)},e.prototype.ensureURL=function(t){var e=this.current.fullPath;ua()!==e&&(t?la(e):pa(e))},e.prototype.getCurrentLocation=function(){return ua()},e}(na);function ca(){var t=ua();return"/"===t.charAt(0)||(pa("/"+t),!1)}function ua(){var t=window.location.href,e=t.indexOf("#");if(e<0)return"";var n=(t=t.slice(e+1)).indexOf("?");if(n<0){var r=t.indexOf("#");t=r>-1?decodeURI(t.slice(0,r))+t.slice(r):decodeURI(t)}else t=decodeURI(t.slice(0,n))+t.slice(n);return t}function fa(t){var e=window.location.href,n=e.indexOf("#");return(n>=0?e.slice(0,n):e)+"#"+t}function la(t){Wi?Gi(fa(t)):window.location.hash=t}function pa(t){Wi?Ki(fa(t)):window.location.replace(fa(t))}var da=function(t){function e(e,n){t.call(this,e,n),this.stack=[],this.index=-1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.push=function(t,e,n){var r=this;this.transitionTo(t,(function(t){r.stack=r.stack.slice(0,r.index+1).concat(t),r.index++,e&&e(t)}),n)},e.prototype.replace=function(t,e,n){var r=this;this.transitionTo(t,(function(t){r.stack=r.stack.slice(0,r.index).concat(t),e&&e(t)}),n)},e.prototype.go=function(t){var e=this,n=this.index+t;if(!(n<0||n>=this.stack.length)){var r=this.stack[n];this.confirmTransition(r,(function(){e.index=n,e.updateRoute(r)}),(function(t){Mo(ea,t)&&(e.index=n)}))}},e.prototype.getCurrentLocation=function(){var t=this.stack[this.stack.length-1];return t?t.fullPath:"/"},e.prototype.ensureURL=function(){},e}(na),ha=function(t){void 0===t&&(t={}),this.app=null,this.apps=[],this.options=t,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=Ai(t.routes||[],this);var e=t.mode||"hash";switch(this.fallback="history"===e&&!Wi&&!1!==t.fallback,this.fallback&&(e="hash"),Ci||(e="abstract"),this.mode=e,e){case"history":this.history=new ia(this,t.base);break;case"hash":this.history=new sa(this,t.base,this.fallback);break;case"abstract":this.history=new da(this,t.base);break;default:0}},va={currentRoute:{configurable:!0}};function ya(t,e){return t.push(e),function(){var n=t.indexOf(e);n>-1&&t.splice(n,1)}}ha.prototype.match=function(t,e,n){return this.matcher.match(t,e,n)},va.currentRoute.get=function(){return this.history&&this.history.current},ha.prototype.init=function(t){var e=this;if(this.apps.push(t),t.$once("hook:destroyed",(function(){var n=e.apps.indexOf(t);n>-1&&e.apps.splice(n,1),e.app===t&&(e.app=e.apps[0]||null)})),!this.app){this.app=t;var n=this.history;if(n instanceof ia)n.transitionTo(n.getCurrentLocation());else if(n instanceof sa){var r=function(){n.setupListeners()};n.transitionTo(n.getCurrentLocation(),r,r)}n.listen((function(t){e.apps.forEach((function(e){e._route=t}))}))}},ha.prototype.beforeEach=function(t){return ya(this.beforeHooks,t)},ha.prototype.beforeResolve=function(t){return ya(this.resolveHooks,t)},ha.prototype.afterEach=function(t){return ya(this.afterHooks,t)},ha.prototype.onReady=function(t,e){this.history.onReady(t,e)},ha.prototype.onError=function(t){this.history.onError(t)},ha.prototype.push=function(t,e,n){var r=this;if(!e&&!n&&"undefined"!=typeof Promise)return new Promise((function(e,n){r.history.push(t,e,n)}));this.history.push(t,e,n)},ha.prototype.replace=function(t,e,n){var r=this;if(!e&&!n&&"undefined"!=typeof Promise)return new Promise((function(e,n){r.history.replace(t,e,n)}));this.history.replace(t,e,n)},ha.prototype.go=function(t){this.history.go(t)},ha.prototype.back=function(){this.go(-1)},ha.prototype.forward=function(){this.go(1)},ha.prototype.getMatchedComponents=function(t){var e=t?t.matched?t:this.resolve(t).route:this.currentRoute;return e?[].concat.apply([],e.matched.map((function(t){return Object.keys(t.components).map((function(e){return t.components[e]}))}))):[]},ha.prototype.resolve=function(t,e,n){var r=xi(t,e=e||this.history.current,n,this),o=this.match(r,e),i=o.redirectedFrom||o.fullPath;return{location:r,route:o,href:function(t,e,n){var r="hash"===n?"#"+e:e;return t?ni(t+"/"+r):r}(this.history.base,i,this.mode),normalizedTo:r,resolved:o}},ha.prototype.addRoutes=function(t){this.matcher.addRoutes(t),this.history.current!==Xo&&this.history.transitionTo(this.history.getCurrentLocation())},Object.defineProperties(ha.prototype,va),ha.install=function t(e){if(!t.installed||wi!==e){t.installed=!0,wi=e;var n=function(t){return void 0!==t},r=function(t,e){var r=t.$options._parentVnode;n(r)&&n(r=r.data)&&n(r=r.registerRouteInstance)&&r(t,e)};e.mixin({beforeCreate:function(){n(this.$options.router)?(this._routerRoot=this,this._router=this.$options.router,this._router.init(this),e.util.defineReactive(this,"_route",this._router.history.current)):this._routerRoot=this.$parent&&this.$parent._routerRoot||this,r(this,this)},destroyed:function(){r(this)}}),Object.defineProperty(e.prototype,"$router",{get:function(){return this._routerRoot._router}}),Object.defineProperty(e.prototype,"$route",{get:function(){return this._routerRoot._route}}),e.component("RouterView",No),e.component("RouterLink",Oi);var o=e.config.optionMergeStrategies;o.beforeRouteEnter=o.beforeRouteLeave=o.beforeRouteUpdate=o.created}},ha.version="3.1.5",Ci&&window.Vue&&window.Vue.use(ha);var ma=ha;n(66),n(120),n(122),n(123),n(124),n(61),n(125),n(67);function ga(t){t.locales&&Object.keys(t.locales).forEach((function(e){t.locales[e].path=e})),Object.freeze(t)}n(106),n(126),n(29),n(108),n(41);function ba(t){return(ba="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var _a=n(38),xa={NotFound:function(){return n.e(4).then(n.bind(null,203))},Layout:function(){return Promise.all([n.e(0),n.e(2)]).then(n.bind(null,202))}},wa={"v-3c88bbf2":function(){return n.e(5).then(n.bind(null,204))},"v-0decf914":function(){return n.e(6).then(n.bind(null,205))},"v-4419f5c9":function(){return n.e(9).then(n.bind(null,206))},"v-d7e5bcfc":function(){return n.e(7).then(n.bind(null,207))},"v-23f0ba6e":function(){return n.e(8).then(n.bind(null,208))},"v-70457f72":function(){return n.e(11).then(n.bind(null,209))},"v-2bf9c0ae":function(){return n.e(12).then(n.bind(null,210))},"v-1c00b5c9":function(){return n.e(13).then(n.bind(null,211))},"v-6d148503":function(){return n.e(10).then(n.bind(null,212))},"v-300a59ee":function(){return n.e(15).then(n.bind(null,213))},"v-7bafdcee":function(){return n.e(14).then(n.bind(null,214))},"v-a971ed74":function(){return n.e(16).then(n.bind(null,215))}};function Sa(t){var e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}var Oa=/-(\w)/g,Ea=Sa((function(t){return t.replace(Oa,(function(t,e){return e?e.toUpperCase():""}))})),Ca=/\B([A-Z])/g,$a=Sa((function(t){return t.replace(Ca,"-$1").toLowerCase()})),ka=Sa((function(t){return t.charAt(0).toUpperCase()+t.slice(1)}));function Aa(t,e){if(e)return t(e)?t(e):e.includes("-")?t(ka(Ea(e))):t(ka(e))||t($a(e))}var ja=Object.assign({},xa,wa),Ta=function(t){return ja[t]},Pa=function(t){return wa[t]},La=function(t){return xa[t]},Ra=function(t){return Ro.component(t)};function Ia(t){return Aa(Pa,t)}function Ma(t){return Aa(La,t)}function Da(t){return Aa(Ta,t)}function Na(t){return Aa(Ra,t)}function Fa(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Promise.all(e.filter((function(t){return t})).map(function(){var t=o(regeneratorRuntime.mark((function t(e){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Na(e)||!Da(e)){t.next=5;break}return t.next=3,Da(e)();case 3:n=t.sent,Ro.component(e,n.default);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()))}function Ua(t,e){"undefined"!=typeof window&&window.__VUEPRESS__&&(window.__VUEPRESS__[t]=e)}n(91),n(93),n(60),n(129);var za={created:function(){this.$ssrContext&&(this.$ssrContext.title=this.$title,this.$ssrContext.lang=this.$lang,this.$ssrContext.description=this.$page.description||this.$description)},mounted:function(){this.currentMetaTags=new Set,this.updateMeta()},methods:{updateMeta:function(){var t=this;document.title=this.$title,document.documentElement.lang=this.$lang;var e=this.$page.frontmatter.meta||[],n=e.slice(0);0===e.filter((function(t){return"description"===t.name})).length&&n.push({name:"description",content:this.$description});var r=document.querySelectorAll('meta[name="description"]');r.length&&r.forEach((function(e){return t.currentMetaTags.add(e)})),this.currentMetaTags=new Set(Ba(n,this.currentMetaTags))}},watch:{$page:function(){this.updateMeta()}},beforeDestroy:function(){Ba(null,this.currentMetaTags)}};function Ba(t,e){if(e&&Object(_a.a)(e).forEach((function(t){document.head.removeChild(t)})),t)return t.map((function(t){var e=document.createElement("meta");return Object.keys(t).forEach((function(n){e.setAttribute(n,t[n])})),document.head.appendChild(e),e}))}n(97);var Va=n(96),qa={mounted:function(){window.addEventListener("scroll",this.onScroll)},methods:{onScroll:n.n(Va)()((function(){this.setActiveHash()}),300),setActiveHash:function(){for(var t=this,e=[].slice.call(document.querySelectorAll(".sidebar-link")),n=[].slice.call(document.querySelectorAll(".header-anchor")).filter((function(t){return e.some((function(e){return e.hash===t.hash}))})),r=Math.max(window.pageYOffset,document.documentElement.scrollTop,document.body.scrollTop),o=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),i=window.innerHeight+r,a=0;a<n.length;a++){var s=n[a],c=n[a+1],u=0===a&&0===r||r>=s.parentElement.offsetTop+10&&(!c||r<c.parentElement.offsetTop-10),f=decodeURIComponent(this.$route.hash);if(u&&f!==decodeURIComponent(s.hash)){var l=s;if(i===o)for(var p=a+1;p<n.length;p++)if(f===decodeURIComponent(n[p].hash))return;return this.$vuepress.$set("disableScrollBehavior",!0),void this.$router.replace(decodeURIComponent(l.hash),(function(){t.$nextTick((function(){t.$vuepress.$set("disableScrollBehavior",!1)}))}))}}}},beforeDestroy:function(){window.removeEventListener("scroll",this.onScroll)}},Ha=n(39),Wa=n.n(Ha),Ga=[za,qa,{mounted:function(){var t=this;Wa.a.configure({showSpinner:!1}),this.$router.beforeEach((function(t,e,n){t.path===e.path||Ro.component(t.name)||Wa.a.start(),n()})),this.$router.afterEach((function(){Wa.a.done(),t.isSidebarOpen=!1}))}}],Ka={name:"GlobalLayout",computed:{layout:function(){var t=this.getLayout();return Ua("layout",t),Ro.component(t)}},methods:{getLayout:function(){if(this.$page.path){var t=this.$page.frontmatter.layout;return t&&(this.$vuepress.getLayoutAsyncComponent(t)||this.$vuepress.getVueComponent(t))?t:"Layout"}return"NotFound"}}},Qa=n(28),Xa=Object(Qa.a)(Ka,(function(){var t=this.$createElement;return(this._self._c||t)(this.layout,{tag:"component"})}),[],!1,null,null,null).exports;!function(t,e,n){var r;switch(e){case"components":t[e]||(t[e]={}),Object.assign(t[e],n);break;case"mixins":t[e]||(t[e]=[]),(r=t[e]).push.apply(r,Object(_a.a)(n));break;default:throw new Error("Unknown option name.")}}(Xa,"mixins",Ga);var Ya=[{name:"v-3c88bbf2",path:"/",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-3c88bbf2").then(n)}},{path:"/index.html",redirect:"/"},{name:"v-0decf914",path:"/about/",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-0decf914").then(n)}},{path:"/about/index.html",redirect:"/about/"},{name:"v-4419f5c9",path:"/docs/examples.html",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-4419f5c9").then(n)}},{name:"v-d7e5bcfc",path:"/docs/",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-d7e5bcfc").then(n)}},{path:"/docs/index.html",redirect:"/docs/"},{name:"v-23f0ba6e",path:"/docs/client.html",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-23f0ba6e").then(n)}},{name:"v-70457f72",path:"/docs/introspection.html",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-70457f72").then(n)}},{name:"v-2bf9c0ae",path:"/docs/middleware.html",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-2bf9c0ae").then(n)}},{name:"v-1c00b5c9",path:"/docs/optimization.html",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-1c00b5c9").then(n)}},{name:"v-6d148503",path:"/docs/interop.html",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-6d148503").then(n)}},{name:"v-300a59ee",path:"/docs/validation.html",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-300a59ee").then(n)}},{name:"v-7bafdcee",path:"/docs/schema.html",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-7bafdcee").then(n)}},{name:"v-a971ed74",path:"/resources/",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-a971ed74").then(n)}},{path:"/resources/index.html",redirect:"/resources/"},{path:"*",component:Xa}],Ja={title:"",description:"",base:"/caliban/",pages:[{title:"Home",frontmatter:{home:!0,heroImage:"/caliban.svg",actionText:"Get Started →",actionLink:"/docs/",features:[{title:"Purely functional",details:"All interfaces are pure and types are referentially transparent."},{title:"Minimal boilerplate",details:"No need to manually define a schema for every type in your API."},{title:"Type safe schema",details:"Schema is derived at compile-time. Resolver is provided at runtime."}]},regularPath:"/",relativePath:"README.md",key:"v-3c88bbf2",path:"/"},{title:"About",frontmatter:{},regularPath:"/about/",relativePath:"about/README.md",key:"v-0decf914",path:"/about/"},{title:"Examples",frontmatter:{},regularPath:"/docs/examples.html",relativePath:"docs/examples.md",key:"v-4419f5c9",path:"/docs/examples.html"},{title:"Getting Started",frontmatter:{},regularPath:"/docs/",relativePath:"docs/README.md",key:"v-d7e5bcfc",path:"/docs/",headers:[{level:2,title:"Dependencies",slug:"dependencies"},{level:2,title:"A simple example",slug:"a-simple-example"},{level:2,title:"Mutations",slug:"mutations"},{level:2,title:"Subscriptions",slug:"subscriptions"}]},{title:"GraphQL Client",frontmatter:{},regularPath:"/docs/client.html",relativePath:"docs/client.md",key:"v-23f0ba6e",path:"/docs/client.html",headers:[{level:2,title:"Dependencies",slug:"dependencies"},{level:2,title:"Code generation",slug:"code-generation"},{level:2,title:"Query building",slug:"query-building"},{level:2,title:"Request execution",slug:"request-execution"}]},{title:"Introspection",frontmatter:{},regularPath:"/docs/introspection.html",relativePath:"docs/introspection.md",key:"v-70457f72",path:"/docs/introspection.html"},{title:"Middleware",frontmatter:{},regularPath:"/docs/middleware.html",relativePath:"docs/middleware.md",key:"v-2bf9c0ae",path:"/docs/middleware.html",headers:[{level:2,title:"Wrapper types",slug:"wrapper-types"},{level:2,title:"Pre-defined wrappers",slug:"pre-defined-wrappers"},{level:2,title:"Wrapping the interpreter",slug:"wrapping-the-interpreter"}]},{title:"Query optimization",frontmatter:{},regularPath:"/docs/optimization.html",relativePath:"docs/optimization.md",key:"v-1c00b5c9",path:"/docs/optimization.html",headers:[{level:2,title:"Introducing ZQuery",slug:"introducing-zquery"},{level:2,title:"Building a DataSource",slug:"building-a-datasource"},{level:2,title:"ZQuery constructors and operators",slug:"zquery-constructors-and-operators"},{level:2,title:"Using ZQuery with Caliban",slug:"using-zquery-with-caliban"}]},{title:"Interop (Cats, Monix)",frontmatter:{},regularPath:"/docs/interop.html",relativePath:"docs/interop.md",key:"v-6d148503",path:"/docs/interop.html",headers:[{level:2,title:"Cats Effect",slug:"cats-effect"},{level:2,title:"Monix",slug:"monix"}]},{title:"Validation",frontmatter:{},regularPath:"/docs/validation.html",relativePath:"docs/validation.md",key:"v-300a59ee",path:"/docs/validation.html"},{title:"Schemas",frontmatter:{},regularPath:"/docs/schema.html",relativePath:"docs/schema.md",key:"v-7bafdcee",path:"/docs/schema.html",headers:[{level:2,title:"Enums, unions, interfaces",slug:"enums-unions-interfaces"},{level:2,title:"Arguments",slug:"arguments"},{level:2,title:"Effects",slug:"effects"},{level:2,title:"Annotations",slug:"annotations"},{level:2,title:"Custom types",slug:"custom-types"},{level:2,title:"Code generation",slug:"code-generation"}]},{title:"Resources",frontmatter:{},regularPath:"/resources/",relativePath:"resources/README.md",key:"v-a971ed74",path:"/resources/",headers:[{level:2,title:"Talks",slug:"talks"},{level:2,title:"Blog Articles",slug:"blog-articles"}]}],themeConfig:{logo:"/caliban.svg",locales:{"/":{selectText:"Language",label:"English",nav:[{text:"Documentation",link:"/docs/"},{text:"Resources",link:"/resources/"},{text:"About",link:"/about/"},{text:"Github",link:"https://github.com/ghostdogpr/caliban"},{text:"Scaladoc",link:"https://javadoc.io/doc/com.github.ghostdogpr/caliban_2.12/"}],sidebar:{"/docs/":[{title:"Caliban",collapsable:!1,sidebarDepth:2,children:["","schema","middleware","optimization","validation","introspection","interop","client","examples"]}]}}}},locales:{"/":{lang:"en-US",title:"Caliban",description:"Functional GraphQL library for Scala",path:"/"}}};n(137);Ro.component("Badge",(function(){return Promise.all([n.e(0),n.e(3)]).then(n.bind(null,216))}));n(138);var Za=[{},function(t){t.Vue.mixin({computed:{$dataBlock:function(){return this.$options.__data__block__}}})},{},{}],ts=[];n(103);function es(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ns(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function rs(t,e,n){return e&&ns(t.prototype,e),n&&ns(t,n),t}function os(t,e){return!e||"object"!==ba(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function is(t){return(is=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function as(t,e){return(as=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var ss=function(t){function e(){return es(this,e),os(this,is(e).apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&as(t,e)}(e,t),e}(function(){function t(){es(this,t),this.store=new Ro({data:{state:{}}})}return rs(t,[{key:"$get",value:function(t){return this.store.state[t]}},{key:"$set",value:function(t,e){Ro.set(this.store.state,t,e)}},{key:"$emit",value:function(){var t;(t=this.store).$emit.apply(t,arguments)}},{key:"$on",value:function(){var t;(t=this.store).$on.apply(t,arguments)}}]),t}());Object.assign(ss.prototype,{getPageAsyncComponent:Ia,getLayoutAsyncComponent:Ma,getAsyncComponent:Da,getVueComponent:Na});var cs={install:function(t){var e=new ss;t.$vuepress=e,t.prototype.$vuepress=e}};function us(t){t.beforeEach((function(e,n,r){if(fs(t,e.path))r();else if(/(\/|\.html)$/.test(e.path))if(/\/$/.test(e.path)){var o=e.path.replace(/\/$/,"")+".html";fs(t,o)?r(o):r()}else r();else{var i=e.path+"/",a=e.path+".html";fs(t,a)?r(a):fs(t,i)?r(i):r()}}))}function fs(t,e){return t.options.routes.filter((function(t){return t.path.toLowerCase()===e.toLowerCase()})).length>0}var ls={props:{pageKey:String,slotKey:{type:String,default:"default"}},render:function(t){var e=this.pageKey||this.$parent.$page.key;return Ua("pageKey",e),Ro.component(e)||Ro.component(e,Ia(e)),Ro.component(e)?t(e):t("")}},ps={functional:!0,props:{slotKey:String,required:!0},render:function(t,e){var n=e.props,r=e.slots;return t("div",{class:["content__".concat(n.slotKey)]},r()[n.slotKey])}},ds=(n(139),Object(Qa.a)({},(function(t,e){var n=e._c;return n("svg",{staticClass:"icon outbound",attrs:{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",x:"0px",y:"0px",viewBox:"0 0 100 100",width:"15",height:"15"}},[n("path",{attrs:{fill:"currentColor",d:"M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"}}),e._v(" "),n("polygon",{attrs:{fill:"currentColor",points:"45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"}})])}),[],!0,null,null,null).exports);function hs(){return(hs=o(regeneratorRuntime.mark((function t(e){var n,r,o,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n="undefined"!=typeof window&&window.__VUEPRESS_ROUTER_BASE__?window.__VUEPRESS_ROUTER_BASE__:Ja.routerBase||Ja.base,us(r=new ma({base:n,mode:"history",fallback:!1,routes:Ya,scrollBehavior:function(t,e,n){return n||(t.hash?!Ro.$vuepress.$get("disableScrollBehavior")&&{selector:t.hash}:{x:0,y:0})}})),o={},t.prev=4,t.next=7,Promise.all(Za.filter((function(t){return"function"==typeof t})).map((function(t){return t({Vue:Ro,options:o,router:r,siteData:Ja,isServer:e})})));case 7:t.next=12;break;case 9:t.prev=9,t.t0=t.catch(4),console.error(t.t0);case 12:return i=new Ro(Object.assign(o,{router:r,render:function(t){return t("div",{attrs:{id:"app"}},[t("RouterView",{ref:"layout"}),t("div",{class:"global-ui"},ts.map((function(e){return t(e)})))])}})),t.abrupt("return",{app:i,router:r});case 14:case"end":return t.stop()}}),t,null,[[4,9]])})))).apply(this,arguments)}Ro.config.productionTip=!1,Ro.use(ma),Ro.use(cs),Ro.mixin(function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ro;ga(e),n.$vuepress.$set("siteData",e);var r=t(n.$vuepress.$get("siteData")),o=new r,i=Object.getOwnPropertyDescriptors(Object.getPrototypeOf(o)),a={};return Object.keys(i).reduce((function(t,e){return e.startsWith("$")&&(t[e]=i[e].get),t}),a),{computed:a}}((function(t){return function(){function e(){es(this,e)}return rs(e,[{key:"setPage",value:function(t){this.__page=t}},{key:"$site",get:function(){return t}},{key:"$themeConfig",get:function(){return this.$site.themeConfig}},{key:"$frontmatter",get:function(){return this.$page.frontmatter}},{key:"$localeConfig",get:function(){var t,e,n=this.$site.locales,r=void 0===n?{}:n;for(var o in r)"/"===o?e=r[o]:0===this.$page.path.indexOf(o)&&(t=r[o]);return t||e||{}}},{key:"$siteTitle",get:function(){return this.$localeConfig.title||this.$site.title||""}},{key:"$title",get:function(){var t=this.$page,e=this.$page.frontmatter.metaTitle;if("string"==typeof e)return e;var n=this.$siteTitle,r=t.frontmatter.home?null:t.frontmatter.title||t.title;return n?r?r+" | "+n:n:r||"VuePress"}},{key:"$description",get:function(){var t=function(t){if(t){var e=t.filter((function(t){return"description"===t.name}))[0];if(e)return e.content}}(this.$page.frontmatter.meta);return t||(this.$page.frontmatter.description||this.$localeConfig.description||this.$site.description||"")}},{key:"$lang",get:function(){return this.$page.frontmatter.lang||this.$localeConfig.lang||"en-US"}},{key:"$localePath",get:function(){return this.$localeConfig.path||"/"}},{key:"$themeLocaleConfig",get:function(){return(this.$site.themeConfig.locales||{})[this.$localePath]||{}}},{key:"$page",get:function(){return this.__page?this.__page:function(t,e){for(var n=0;n<t.length;n++){var r=t[n];if(r.path.toLowerCase()===e.toLowerCase())return r}return{path:"",frontmatter:{}}}(this.$site.pages,this.$route.path)}}]),e}()}),Ja)),Ro.component("Content",ls),Ro.component("ContentSlotsDistributor",ps),Ro.component("OutboundLink",ds),Ro.component("ClientOnly",{functional:!0,render:function(t,e){var n=e.parent,r=e.children;if(n._isMounted)return r;n.$once("hook:mounted",(function(){n.$forceUpdate()}))}}),Ro.component("Layout",Ma("Layout")),Ro.component("NotFound",Ma("NotFound")),Ro.prototype.$withBase=function(t){var e=this.$site.base;return"/"===t.charAt(0)?e+t.slice(1):t},window.__VUEPRESS__={version:"1.3.1",hash:"a21c617"},function(t){return hs.apply(this,arguments)}(!1).then((function(t){var e=t.app;t.router.onReady((function(){e.$mount("#app")}))}))}]); \ No newline at end of file diff --git a/docs/docs/client.html b/docs/docs/client.html new file mode 100644 index 000000000..13ee0723e --- /dev/null +++ b/docs/docs/client.html @@ -0,0 +1,98 @@ +<!DOCTYPE html> +<html lang="en-US"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width,initial-scale=1"> + <title>GraphQL Client | Caliban</title> + <meta name="description" content="Functional GraphQL library for Scala"> + <meta name="generator" content="VuePress 1.3.1"> + <link rel="icon" href="/caliban/caliban.png"> + + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/8.6272775d.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.5f8b2c07.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.bc45abe0.js"><link rel="prefetch" href="/caliban/assets/js/13.d315a1c7.js"><link rel="prefetch" href="/caliban/assets/js/14.b8b8c6ff.js"><link rel="prefetch" href="/caliban/assets/js/15.23ceaf26.js"><link rel="prefetch" href="/caliban/assets/js/16.f357ff30.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.57a8ce51.js"><link rel="prefetch" href="/caliban/assets/js/9.417f11bf.js"> + <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> + </head> + <body> + <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/caliban/" class="home-link router-link-active"><img src="/caliban/caliban.svg" alt="Caliban" class="logo"> <span class="site-name can-hide">Caliban</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/caliban/docs/" class="nav-link router-link-active"> + Documentation +</a></div><div class="nav-item"><a href="/caliban/resources/" class="nav-link"> + Resources +</a></div><div class="nav-item"><a href="/caliban/about/" class="nav-link"> + About +</a></div><div class="nav-item"><a href="https://github.com/ghostdogpr/caliban" target="_blank" rel="noopener noreferrer" class="nav-link external"> + Github + <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div><div class="nav-item"><a href="https://javadoc.io/doc/com.github.ghostdogpr/caliban_2.12/" target="_blank" rel="noopener noreferrer" class="nav-link external"> + Scaladoc + <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/caliban/docs/" class="nav-link router-link-active"> + Documentation +</a></div><div class="nav-item"><a href="/caliban/resources/" class="nav-link"> + Resources +</a></div><div class="nav-item"><a href="/caliban/about/" class="nav-link"> + About +</a></div><div class="nav-item"><a href="https://github.com/ghostdogpr/caliban" target="_blank" rel="noopener noreferrer" class="nav-link external"> + Github + <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div><div class="nav-item"><a href="https://javadoc.io/doc/com.github.ghostdogpr/caliban_2.12/" target="_blank" rel="noopener noreferrer" class="nav-link external"> + Scaladoc + <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>Caliban</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/caliban/docs/" class="sidebar-link">Getting Started</a></li><li><a href="/caliban/docs/schema.html" class="sidebar-link">Schemas</a></li><li><a href="/caliban/docs/middleware.html" class="sidebar-link">Middleware</a></li><li><a href="/caliban/docs/optimization.html" class="sidebar-link">Query optimization</a></li><li><a href="/caliban/docs/validation.html" class="sidebar-link">Validation</a></li><li><a href="/caliban/docs/introspection.html" class="sidebar-link">Introspection</a></li><li><a href="/caliban/docs/interop.html" class="sidebar-link">Interop (Cats, Monix)</a></li><li><a href="/caliban/docs/client.html" class="active sidebar-link">GraphQL Client</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/caliban/docs/client.html#dependencies" class="sidebar-link">Dependencies</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/client.html#code-generation" class="sidebar-link">Code generation</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/client.html#query-building" class="sidebar-link">Query building</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/client.html#request-execution" class="sidebar-link">Request execution</a></li></ul></li><li><a href="/caliban/docs/examples.html" class="sidebar-link">Examples</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="graphql-client"><a href="#graphql-client" class="header-anchor">#</a> GraphQL Client</h1> <p><strong>Caliban-client</strong> is a module independent from Caliban that makes it possible to write GraphQL queries using Scala code in a type-safe and functional fashion. It is built on top of <a href="https://github.com/softwaremill/sttp" target="_blank" rel="noopener noreferrer">sttp<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>, which means you can run requests using the backend of your choice.</p> <p>Just like Caliban, <code>caliban-client</code> offers a purely functional interface and keeps the boilerplate minimal. It works as follows:</p> <ol><li>Use the <code>caliban-codegen</code> tool to generate boilerplate code from a given GraphQL schema</li> <li>Write your GraphQL query/mutation by combining helpers from the generated code</li> <li>Transform your query/mutation into an <code>sttp</code> request and run it with your preferred backend</li></ol> <h2 id="dependencies"><a href="#dependencies" class="header-anchor">#</a> Dependencies</h2> <p>To use <code>caliban-client</code>, add the following line in your <code>build.sbt</code> file:</p> <div class="language- extra-class"><pre class="language-text"><code>libraryDependencies += "com.github.ghostdogpr" %% "caliban-client" % "0.6.0" +</code></pre></div><p>Caliban-client is available for ScalaJS.</p> <h2 id="code-generation"><a href="#code-generation" class="header-anchor">#</a> Code generation</h2> <p>The first step for building GraphQL queries with <code>caliban-client</code> is to generate boilerplate code from a GraphQL schema. For that, you need a file containing your schema (if your backend uses <code>caliban</code>, you can get it by calling <code>GraphQL#render</code> on your API).</p> <p>To use this feature, add the <code>caliban-codegen</code> sbt plugin to your project and enable it.</p> <div class="language-scala extra-class"><pre class="language-scala"><code>addSbtPlugin<span class="token punctuation">(</span><span class="token string">"com.github.ghostdogpr"</span> <span class="token operator">%</span> <span class="token string">"caliban-codegen"</span> <span class="token operator">%</span> <span class="token string">"0.6.0"</span><span class="token punctuation">)</span> +enablePlugins<span class="token punctuation">(</span>CodegenPlugin<span class="token punctuation">)</span> +</code></pre></div><p>Then call the <code>calibanGenClient</code> sbt command.</p> <div class="language-scala extra-class"><pre class="language-scala"><code>calibanGenClient schemaPath outPath <span class="token operator">?</span>scalafmtPath + +calibanGenClient project<span class="token operator">/</span>schema<span class="token punctuation">.</span>graphql src<span class="token operator">/</span>main<span class="token operator">/</span>Client<span class="token punctuation">.</span>scala +</code></pre></div><p>This command will generate a Scala file in <code>outputPath</code> containing helper functions for all the types defined in the provided GraphQL schema defined at <code>schemaPath</code>. The generated code will be formatted with Scalafmt using the configuration defined by <code>scalafmtPath</code> (default: <code>.scalafmt.conf</code>).</p> <h2 id="query-building"><a href="#query-building" class="header-anchor">#</a> Query building</h2> <p>Once the boilerplate code is generated, you can start building queries. For each <em>type</em> in your schema, a corresponding Scala object has been created. For each <em>field</em> in your schema, a corresponding Scala function has been created.</p> <p>For example, given the following schema:</p> <div class="language-graphql extra-class"><pre class="language-graphql"><code><span class="token keyword">type</span> <span class="token class-name">Character</span> <span class="token punctuation">{</span> + <span class="token attr-name">name</span><span class="token punctuation">:</span> String<span class="token operator">!</span> + <span class="token attr-name">nicknames</span><span class="token punctuation">:</span> <span class="token punctuation">[</span>String<span class="token operator">!</span><span class="token punctuation">]</span><span class="token operator">!</span> + <span class="token attr-name">origin</span><span class="token punctuation">:</span> Origin<span class="token operator">!</span> +<span class="token punctuation">}</span> +</code></pre></div><p>Your generated code will have the following:</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">object</span> Character <span class="token punctuation">{</span> + <span class="token keyword">def</span> name<span class="token operator">:</span> SelectionBuilder<span class="token punctuation">[</span>Character<span class="token punctuation">,</span> <span class="token builtin">String</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token operator">?</span><span class="token operator">?</span><span class="token operator">?</span> + <span class="token keyword">def</span> nicknames<span class="token operator">:</span> SelectionBuilder<span class="token punctuation">[</span>Character<span class="token punctuation">,</span> List<span class="token punctuation">[</span><span class="token builtin">String</span><span class="token punctuation">]</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token operator">?</span><span class="token operator">?</span><span class="token operator">?</span> + <span class="token keyword">def</span> origin<span class="token operator">:</span> SelectionBuilder<span class="token punctuation">[</span>Character<span class="token punctuation">,</span> Origin<span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token operator">?</span><span class="token operator">?</span><span class="token operator">?</span> +<span class="token punctuation">}</span> +</code></pre></div><p>A <code>SelectionBuilder[Origin, A]</code> is a selection from a parent type <code>Origin</code> that returns a result of type <code>A</code>. In this example, <code>name</code> is a selection from a <code>Character</code> that returns a <code>String</code>.</p> <p>You can combine multiple selections using the <code>~</code> operator. The new result type will be a tuple from the 2 combined result types. Note that you can only combine selections that have the same origin.</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">val</span> selection<span class="token operator">:</span> SelectionBuilder<span class="token punctuation">[</span>Character<span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token builtin">String</span><span class="token punctuation">,</span> List<span class="token punctuation">[</span><span class="token builtin">String</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">]</span> <span class="token operator">=</span> + Character<span class="token punctuation">.</span>name <span class="token operator">~</span> Character<span class="token punctuation">.</span>nicknames +</code></pre></div><p>If you combine multiple fields, it is more convenient to have a case class to represent your data (to avoid seeing nested tuples). You can use <code>mapN</code> to map a nested tuple to a case class.</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">case</span> <span class="token keyword">class</span> CharacterView<span class="token punctuation">(</span>name<span class="token operator">:</span> <span class="token builtin">String</span><span class="token punctuation">,</span> nickname<span class="token operator">:</span> List<span class="token punctuation">[</span><span class="token builtin">String</span><span class="token punctuation">]</span><span class="token punctuation">,</span> origin<span class="token operator">:</span> Origin<span class="token punctuation">)</span> + +<span class="token keyword">val</span> character<span class="token operator">:</span> SelectionBuilder<span class="token punctuation">[</span>Character<span class="token punctuation">,</span> CharacterView<span class="token punctuation">]</span> <span class="token operator">=</span> + <span class="token punctuation">(</span>Character<span class="token punctuation">.</span>name <span class="token operator">~</span> Character<span class="token punctuation">.</span>nicknames <span class="token operator">~</span> Character<span class="token punctuation">.</span>origin<span class="token punctuation">)</span> + <span class="token punctuation">.</span>mapN<span class="token punctuation">(</span>CharacterView<span class="token punctuation">)</span> +</code></pre></div><p>Fields that return an object type will require an inner selection, which is another <code>SelectionBuilder</code>. Let's consider the following <code>Query</code> type.</p> <div class="language-graphql extra-class"><pre class="language-graphql"><code><span class="token keyword">type</span> <span class="token class-name">Query</span> <span class="token punctuation">{</span> + <span class="token attr-name">characters</span><span class="token punctuation">:</span> <span class="token punctuation">[</span>Character<span class="token operator">!</span><span class="token punctuation">]</span><span class="token operator">!</span> +<span class="token punctuation">}</span> +</code></pre></div><p>When calling <code>characters</code>, we need to provide a <code>SelectionBuilder[Character, ?]</code> to indicate which fields to select on the returned <code>Character</code>.</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">val</span> query<span class="token operator">:</span> SelectionBuilder<span class="token punctuation">[</span>RootQuery<span class="token punctuation">,</span> List<span class="token punctuation">[</span>CharacterView<span class="token punctuation">]</span><span class="token punctuation">]</span> <span class="token operator">=</span> + Query<span class="token punctuation">.</span>characters <span class="token punctuation">{</span> + <span class="token punctuation">(</span>Character<span class="token punctuation">.</span>name <span class="token operator">~</span> Character<span class="token punctuation">.</span>nicknames <span class="token operator">~</span> Character<span class="token punctuation">.</span>origin<span class="token punctuation">)</span> + <span class="token punctuation">.</span>mapN<span class="token punctuation">(</span>CharacterView<span class="token punctuation">)</span> + <span class="token punctuation">}</span> +</code></pre></div><p>Or if we reuse the <code>character</code> selection we just created:</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">val</span> query<span class="token operator">:</span> SelectionBuilder<span class="token punctuation">[</span>RootQuery<span class="token punctuation">,</span> List<span class="token punctuation">[</span>CharacterView<span class="token punctuation">]</span><span class="token punctuation">]</span> <span class="token operator">=</span> + Query<span class="token punctuation">.</span>characters <span class="token punctuation">{</span> + character + <span class="token punctuation">}</span> +</code></pre></div><p>Because this is Scala code, you can easily reuse a selection in multiple places without having to worry about GraphQL fragments. The Scala compiler will also make sure that you only combine fields that make sense.</p> <p>When a field requires an argument, the helper method for the field will require one as well. Let's enrich our query:</p> <div class="language-graphql extra-class"><pre class="language-graphql"><code><span class="token keyword">type</span> <span class="token class-name">Query</span> <span class="token punctuation">{</span> + <span class="token attr-name">characters</span><span class="token punctuation">(</span><span class="token attr-name">origin</span><span class="token punctuation">:</span> Origin<span class="token operator">!</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token punctuation">[</span>Character<span class="token operator">!</span><span class="token punctuation">]</span><span class="token operator">!</span> +<span class="token punctuation">}</span> +</code></pre></div><p>You now need to provide an <code>Origin</code> when calling <code>characters</code>:</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">val</span> query<span class="token operator">:</span> SelectionBuilder<span class="token punctuation">[</span>RootQuery<span class="token punctuation">,</span> List<span class="token punctuation">[</span>CharacterView<span class="token punctuation">]</span><span class="token punctuation">]</span> <span class="token operator">=</span> + Query<span class="token punctuation">.</span>characters<span class="token punctuation">(</span>Origin<span class="token punctuation">.</span>MARS<span class="token punctuation">)</span> <span class="token punctuation">{</span> + character + <span class="token punctuation">}</span> +</code></pre></div><h2 id="request-execution"><a href="#request-execution" class="header-anchor">#</a> Request execution</h2> <p>Once your query or mutation is created, it is time to execute it. To do that, you can transform your <code>SelectionBuilder</code> into an <code>sttp</code> request by calling <code>.toRequest</code>. This function takes the URL of your GraphQL server and an optional boolean <code>useVariables</code> that determines if arguments should be using variables or not (default: false).</p> <p>You can then simply run the <code>sttp</code> request with the backend of your choice. See the <a href="https://sttp.readthedocs.io/en/latest/" target="_blank" rel="noopener noreferrer">sttp docs<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> if you are not familiar with it.</p> <p>Here is an example using the <code>AsyncHttpClient</code> backend for <code>ZIO</code>:</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">import</span> <span class="token namespace">sttp<span class="token punctuation">.</span>client</span><span class="token punctuation">.</span>_ +<span class="token keyword">import</span> <span class="token namespace">sttp<span class="token punctuation">.</span>client<span class="token punctuation">.</span>asynchttpclient<span class="token punctuation">.</span>zio</span><span class="token punctuation">.</span>AsyncHttpClientZioBackend + +AsyncHttpClientZioBackend<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span>flatMap <span class="token punctuation">{</span> <span class="token keyword">implicit</span> backend <span class="token keyword">=></span> + <span class="token keyword">val</span> serverUrl <span class="token operator">=</span> uri<span class="token string">"http://localhost:8088/api/graphql"</span> + <span class="token keyword">val</span> result<span class="token operator">:</span> Task<span class="token punctuation">[</span>List<span class="token punctuation">[</span>CharacterView<span class="token punctuation">]</span><span class="token punctuation">]</span> <span class="token operator">=</span> + query<span class="token punctuation">.</span>toRequest<span class="token punctuation">(</span>serverUrl<span class="token punctuation">)</span><span class="token punctuation">.</span>send<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span>map<span class="token punctuation">(</span>_<span class="token punctuation">.</span>body<span class="token punctuation">)</span><span class="token punctuation">.</span>absolve + <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span> +<span class="token punctuation">}</span> +</code></pre></div><p>As a result, we get a ZIO <code>Task</code> whose return type is the same as our <code>SelectionBuilder</code>. The sttp request does not only contain the request to send, but also takes care of parsing the response into the expected type.</p> <p>The <a href="https://github.com/ghostdogpr/caliban/tree/master/examples/" target="_blank" rel="noopener noreferrer">examples<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> project contains a runnable sample code that queries the example GraphQL backend.</p> <div class="custom-block warning"><p class="custom-block-title">Limitations</p> <p>Only Queries and Mutations are supported. Subscriptions support will be added in the future. +Type extensions are not supported by the codegen tool.</p></div></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev"> + ← + <a href="/caliban/docs/interop.html" class="prev"> + Interop (Cats, Monix) + </a></span> <span class="next"><a href="/caliban/docs/examples.html"> + Examples + </a> + → + </span></p></div> </main></div><div class="global-ui"></div></div> + <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/8.6272775d.js" defer></script> + </body> +</html> diff --git a/docs/docs/examples.html b/docs/docs/examples.html index 9a1e14fdf..5df8b7bc3 100644 --- a/docs/docs/examples.html +++ b/docs/docs/examples.html @@ -4,12 +4,12 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>Examples | Caliban</title> - <meta name="description" content="Functional GraphQL backend in Scala"> - <meta name="generator" content="VuePress 1.3.0"> + <meta name="description" content="Functional GraphQL library for Scala"> + <meta name="generator" content="VuePress 1.3.1"> <link rel="icon" href="/caliban/caliban.png"> - <link rel="preload" href="/caliban/assets/css/0.styles.ce455d84.css" as="style"><link rel="preload" href="/caliban/assets/js/app.098f98e8.js" as="script"><link rel="preload" href="/caliban/assets/js/2.fa272699.js" as="script"><link rel="preload" href="/caliban/assets/js/8.abf14876.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.b8fd5856.js"><link rel="prefetch" href="/caliban/assets/js/11.151b57de.js"><link rel="prefetch" href="/caliban/assets/js/12.40588870.js"><link rel="prefetch" href="/caliban/assets/js/13.a0ebd332.js"><link rel="prefetch" href="/caliban/assets/js/14.fe3db0cd.js"><link rel="prefetch" href="/caliban/assets/js/15.a58fc205.js"><link rel="prefetch" href="/caliban/assets/js/16.09e4e2e8.js"><link rel="prefetch" href="/caliban/assets/js/3.af853996.js"><link rel="prefetch" href="/caliban/assets/js/4.b0dd307f.js"><link rel="prefetch" href="/caliban/assets/js/5.e6948aea.js"><link rel="prefetch" href="/caliban/assets/js/6.e0cf4477.js"><link rel="prefetch" href="/caliban/assets/js/7.a06094f2.js"><link rel="prefetch" href="/caliban/assets/js/9.9cf833f6.js"> - <link rel="stylesheet" href="/caliban/assets/css/0.styles.ce455d84.css"> + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/9.417f11bf.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.5f8b2c07.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.bc45abe0.js"><link rel="prefetch" href="/caliban/assets/js/13.d315a1c7.js"><link rel="prefetch" href="/caliban/assets/js/14.b8b8c6ff.js"><link rel="prefetch" href="/caliban/assets/js/15.23ceaf26.js"><link rel="prefetch" href="/caliban/assets/js/16.f357ff30.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.57a8ce51.js"><link rel="prefetch" href="/caliban/assets/js/8.6272775d.js"> + <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> </head> <body> <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/caliban/" class="home-link router-link-active"><img src="/caliban/caliban.svg" alt="Caliban" class="logo"> <span class="site-name can-hide">Caliban</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/caliban/docs/" class="nav-link router-link-active"> @@ -32,11 +32,16 @@ Github <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div><div class="nav-item"><a href="https://javadoc.io/doc/com.github.ghostdogpr/caliban_2.12/" target="_blank" rel="noopener noreferrer" class="nav-link external"> Scaladoc - <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>Caliban</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/caliban/docs/" class="sidebar-link">Getting Started</a></li><li><a href="/caliban/docs/schema.html" class="sidebar-link">Schemas</a></li><li><a href="/caliban/docs/middleware.html" class="sidebar-link">Middleware</a></li><li><a href="/caliban/docs/optimization.html" class="sidebar-link">Query optimization</a></li><li><a href="/caliban/docs/validation.html" class="sidebar-link">Validation</a></li><li><a href="/caliban/docs/introspection.html" class="sidebar-link">Introspection</a></li><li><a href="/caliban/docs/interop.html" class="sidebar-link">Interop (Cats, Monix)</a></li><li><a href="/caliban/docs/examples.html" class="active sidebar-link">Examples</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="examples"><a href="#examples" class="header-anchor">#</a> Examples</h1> <p>A sample project showing how to serve a simple GraphQL schema over HTTP and WebSocket using <a href="https://github.com/http4s/http4s" target="_blank" rel="noopener noreferrer">http4s<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> or <a href="https://doc.akka.io/docs/akka-http/current/index.html" target="_blank" rel="noopener noreferrer">Akka HTTP<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> is available in the <a href="https://github.com/ghostdogpr/caliban/tree/master/examples/" target="_blank" rel="noopener noreferrer">examples<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> folder.</p></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev"> + <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>Caliban</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/caliban/docs/" class="sidebar-link">Getting Started</a></li><li><a href="/caliban/docs/schema.html" class="sidebar-link">Schemas</a></li><li><a href="/caliban/docs/middleware.html" class="sidebar-link">Middleware</a></li><li><a href="/caliban/docs/optimization.html" class="sidebar-link">Query optimization</a></li><li><a href="/caliban/docs/validation.html" class="sidebar-link">Validation</a></li><li><a href="/caliban/docs/introspection.html" class="sidebar-link">Introspection</a></li><li><a href="/caliban/docs/interop.html" class="sidebar-link">Interop (Cats, Monix)</a></li><li><a href="/caliban/docs/client.html" class="sidebar-link">GraphQL Client</a></li><li><a href="/caliban/docs/examples.html" class="active sidebar-link">Examples</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="examples"><a href="#examples" class="header-anchor">#</a> Examples</h1> <p>A sample project showing how to serve a simple GraphQL schema over HTTP and WebSocket using +<a href="https://github.com/http4s/http4s" target="_blank" rel="noopener noreferrer">http4s<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> or +<a href="https://doc.akka.io/docs/akka-http/current/index.html" target="_blank" rel="noopener noreferrer">Akka HTTP<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> or +<a href="https://finagle.github.io/finch/" target="_blank" rel="noopener noreferrer">Finch<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> is available in +the +<a href="https://github.com/ghostdogpr/caliban/tree/master/examples/" target="_blank" rel="noopener noreferrer">examples<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> folder.</p></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev"> ← - <a href="/caliban/docs/interop.html" class="prev"> - Interop (Cats, Monix) + <a href="/caliban/docs/client.html" class="prev"> + GraphQL Client </a></span> <!----></p></div> </main></div><div class="global-ui"></div></div> - <script src="/caliban/assets/js/app.098f98e8.js" defer></script><script src="/caliban/assets/js/2.fa272699.js" defer></script><script src="/caliban/assets/js/8.abf14876.js" defer></script> + <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/9.417f11bf.js" defer></script> </body> </html> diff --git a/docs/docs/index.html b/docs/docs/index.html index 023a44b60..0379c2b53 100644 --- a/docs/docs/index.html +++ b/docs/docs/index.html @@ -4,12 +4,12 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>Getting Started | Caliban</title> - <meta name="description" content="Functional GraphQL backend in Scala"> - <meta name="generator" content="VuePress 1.3.0"> + <meta name="description" content="Functional GraphQL library for Scala"> + <meta name="generator" content="VuePress 1.3.1"> <link rel="icon" href="/caliban/caliban.png"> - <link rel="preload" href="/caliban/assets/css/0.styles.ce455d84.css" as="style"><link rel="preload" href="/caliban/assets/js/app.098f98e8.js" as="script"><link rel="preload" href="/caliban/assets/js/2.fa272699.js" as="script"><link rel="preload" href="/caliban/assets/js/7.a06094f2.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.b8fd5856.js"><link rel="prefetch" href="/caliban/assets/js/11.151b57de.js"><link rel="prefetch" href="/caliban/assets/js/12.40588870.js"><link rel="prefetch" href="/caliban/assets/js/13.a0ebd332.js"><link rel="prefetch" href="/caliban/assets/js/14.fe3db0cd.js"><link rel="prefetch" href="/caliban/assets/js/15.a58fc205.js"><link rel="prefetch" href="/caliban/assets/js/16.09e4e2e8.js"><link rel="prefetch" href="/caliban/assets/js/3.af853996.js"><link rel="prefetch" href="/caliban/assets/js/4.b0dd307f.js"><link rel="prefetch" href="/caliban/assets/js/5.e6948aea.js"><link rel="prefetch" href="/caliban/assets/js/6.e0cf4477.js"><link rel="prefetch" href="/caliban/assets/js/8.abf14876.js"><link rel="prefetch" href="/caliban/assets/js/9.9cf833f6.js"> - <link rel="stylesheet" href="/caliban/assets/css/0.styles.ce455d84.css"> + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/7.57a8ce51.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.5f8b2c07.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.bc45abe0.js"><link rel="prefetch" href="/caliban/assets/js/13.d315a1c7.js"><link rel="prefetch" href="/caliban/assets/js/14.b8b8c6ff.js"><link rel="prefetch" href="/caliban/assets/js/15.23ceaf26.js"><link rel="prefetch" href="/caliban/assets/js/16.f357ff30.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/8.6272775d.js"><link rel="prefetch" href="/caliban/assets/js/9.417f11bf.js"> + <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> </head> <body> <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/caliban/" class="home-link router-link-active"><img src="/caliban/caliban.svg" alt="Caliban" class="logo"> <span class="site-name can-hide">Caliban</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/caliban/docs/" class="nav-link router-link-exact-active router-link-active"> @@ -32,12 +32,12 @@ Github <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div><div class="nav-item"><a href="https://javadoc.io/doc/com.github.ghostdogpr/caliban_2.12/" target="_blank" rel="noopener noreferrer" class="nav-link external"> Scaladoc - <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>Caliban</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/caliban/docs/" class="active sidebar-link">Getting Started</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/caliban/docs/#dependencies" class="sidebar-link">Dependencies</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/#a-simple-example" class="sidebar-link">A simple example</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/#mutations" class="sidebar-link">Mutations</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/#subscriptions" class="sidebar-link">Subscriptions</a></li></ul></li><li><a href="/caliban/docs/schema.html" class="sidebar-link">Schemas</a></li><li><a href="/caliban/docs/middleware.html" class="sidebar-link">Middleware</a></li><li><a href="/caliban/docs/optimization.html" class="sidebar-link">Query optimization</a></li><li><a href="/caliban/docs/validation.html" class="sidebar-link">Validation</a></li><li><a href="/caliban/docs/introspection.html" class="sidebar-link">Introspection</a></li><li><a href="/caliban/docs/interop.html" class="sidebar-link">Interop (Cats, Monix)</a></li><li><a href="/caliban/docs/examples.html" class="sidebar-link">Examples</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="getting-started"><a href="#getting-started" class="header-anchor">#</a> Getting Started</h1> <p><strong>Caliban</strong> is a purely functional library for creating GraphQL backends in Scala. -It relies on <a href="https://github.com/propensive/magnolia" target="_blank" rel="noopener noreferrer">Magnolia<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> to automatically derives GraphQL schemas from your data types, <a href="https://github.com/lihaoyi/fastparse" target="_blank" rel="noopener noreferrer">Fastparse<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> to parse queries and <a href="https://github.com/zio/zio" target="_blank" rel="noopener noreferrer">ZIO<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> to handle various effects.</p> <p>The design principles behind the library are the following:</p> <ul><li>pure interface: errors and effects are returned explicitly (no exceptions thrown), all returned types are referentially transparent (no <code>Future</code>).</li> <li>clean separation between schema definition and implementation: schema is defined and validated at compile-time (no reflection) using Scala standard types, resolver is a simple value provided at runtime.</li> <li>minimal amount of boilerplate: no need to manually define a schema for every type in your API.</li></ul> <h2 id="dependencies"><a href="#dependencies" class="header-anchor">#</a> Dependencies</h2> <p>To use <code>caliban</code>, add the following line in your <code>build.sbt</code> file:</p> <div class="language- extra-class"><pre class="language-text"><code>libraryDependencies += "com.github.ghostdogpr" %% "caliban" % "0.5.2" -</code></pre></div><p>The following modules are optional:</p> <div class="language- extra-class"><pre class="language-text"><code>libraryDependencies += "com.github.ghostdogpr" %% "caliban-http4s" % "0.5.2" // routes for http4s -libraryDependencies += "com.github.ghostdogpr" %% "caliban-akka-http" % "0.5.2" // routes for akka-http -libraryDependencies += "com.github.ghostdogpr" %% "caliban-cats" % "0.5.2" // interop with cats effect -libraryDependencies += "com.github.ghostdogpr" %% "caliban-monix" % "0.5.2" // interop with monix + <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>Caliban</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/caliban/docs/" class="active sidebar-link">Getting Started</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/caliban/docs/#dependencies" class="sidebar-link">Dependencies</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/#a-simple-example" class="sidebar-link">A simple example</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/#mutations" class="sidebar-link">Mutations</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/#subscriptions" class="sidebar-link">Subscriptions</a></li></ul></li><li><a href="/caliban/docs/schema.html" class="sidebar-link">Schemas</a></li><li><a href="/caliban/docs/middleware.html" class="sidebar-link">Middleware</a></li><li><a href="/caliban/docs/optimization.html" class="sidebar-link">Query optimization</a></li><li><a href="/caliban/docs/validation.html" class="sidebar-link">Validation</a></li><li><a href="/caliban/docs/introspection.html" class="sidebar-link">Introspection</a></li><li><a href="/caliban/docs/interop.html" class="sidebar-link">Interop (Cats, Monix)</a></li><li><a href="/caliban/docs/client.html" class="sidebar-link">GraphQL Client</a></li><li><a href="/caliban/docs/examples.html" class="sidebar-link">Examples</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="getting-started"><a href="#getting-started" class="header-anchor">#</a> Getting Started</h1> <p><strong>Caliban</strong> is a purely functional library for creating GraphQL backends in Scala. +It relies on <a href="https://github.com/propensive/magnolia" target="_blank" rel="noopener noreferrer">Magnolia<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> to automatically derives GraphQL schemas from your data types, <a href="https://github.com/lihaoyi/fastparse" target="_blank" rel="noopener noreferrer">Fastparse<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> to parse queries and <a href="https://github.com/zio/zio" target="_blank" rel="noopener noreferrer">ZIO<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> to handle various effects.</p> <p>The design principles behind the library are the following:</p> <ul><li>pure interface: errors and effects are returned explicitly (no exceptions thrown), all returned types are referentially transparent (no <code>Future</code>).</li> <li>clean separation between schema definition and implementation: schema is defined and validated at compile-time (no reflection) using Scala standard types, resolver is a simple value provided at runtime.</li> <li>minimal amount of boilerplate: no need to manually define a schema for every type in your API.</li></ul> <p>Caliban can also be used to build GraphQL frontends: see the <a href="/caliban/docs/client.html">dedicated section</a> for more details.</p> <h2 id="dependencies"><a href="#dependencies" class="header-anchor">#</a> Dependencies</h2> <p>To use <code>caliban</code>, add the following line in your <code>build.sbt</code> file:</p> <div class="language- extra-class"><pre class="language-text"><code>libraryDependencies += "com.github.ghostdogpr" %% "caliban" % "0.6.0" +</code></pre></div><p>The following modules are optional:</p> <div class="language- extra-class"><pre class="language-text"><code>libraryDependencies += "com.github.ghostdogpr" %% "caliban-http4s" % "0.6.0" // routes for http4s +libraryDependencies += "com.github.ghostdogpr" %% "caliban-akka-http" % "0.6.0" // routes for akka-http +libraryDependencies += "com.github.ghostdogpr" %% "caliban-cats" % "0.6.0" // interop with cats effect +libraryDependencies += "com.github.ghostdogpr" %% "caliban-monix" % "0.6.0" // interop with monix </code></pre></div><p>Note that Caliban is also available for ScalaJS.</p> <h2 id="a-simple-example"><a href="#a-simple-example" class="header-anchor">#</a> A simple example</h2> <p>Creating a GraphQL API with Caliban is as simple as creating a case class. Indeed, the whole GraphQL schema will be derived from a case class structure (its fields and the other types it references), and the resolver is just an instance of that case class.</p> <p>Let's say we have a class <code>Character</code> and 2 functions: <code>getCharacters</code> and <code>getCharacter</code>:</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">case</span> <span class="token keyword">class</span> Character<span class="token punctuation">(</span>name<span class="token operator">:</span> <span class="token builtin">String</span><span class="token punctuation">,</span> age<span class="token operator">:</span> <span class="token builtin">Int</span><span class="token punctuation">)</span> <span class="token keyword">def</span> getCharacters<span class="token operator">:</span> List<span class="token punctuation">[</span>Character<span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token operator">?</span><span class="token operator">?</span><span class="token operator">?</span> @@ -64,7 +64,10 @@ <span class="token attr-name">character</span><span class="token punctuation">(</span><span class="token attr-name">name</span><span class="token punctuation">:</span> String<span class="token operator">!</span><span class="token punctuation">)</span><span class="token punctuation">:</span> Character <span class="token punctuation">}</span> </code></pre></div><p>In order to process requests, you need to turn your API into an interpreter, which can be done easily by calling <code>.interpreter</code>. -An interpreter is a light wrapper around the API definition that allows plugging in some middleware and possibly modifying the environment and error types (see <a href="/caliban/docs/middleware.html">Middleware</a> for more info).</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">val</span> interpreter <span class="token operator">=</span> api<span class="token punctuation">.</span>interpreter +An interpreter is a light wrapper around the API definition that allows plugging in some middleware and possibly modifying the environment and error types (see <a href="/caliban/docs/middleware.html">Middleware</a> for more info). +Creating the interpreter may fail with a <code>ValidationError</code> if some type is found invalid.</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">for</span> <span class="token punctuation">{</span> + interpreter <span class="token keyword"><-</span> api<span class="token punctuation">.</span>interpreter +<span class="token punctuation">}</span> <span class="token keyword">yield</span> interpreter </code></pre></div><p>Now you can call <code>interpreter.execute</code> with a given GraphQL query, and you will get an <code>ZIO[R, Nothing, GraphQLResponse[CalibanError]]</code> as a response, with <code>GraphQLResponse</code> defined as follows:</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">case</span> <span class="token keyword">class</span> GraphQLResponse<span class="token punctuation">[</span><span class="token operator">+</span>E<span class="token punctuation">]</span><span class="token punctuation">(</span>data<span class="token operator">:</span> ResponseValue<span class="token punctuation">,</span> errors<span class="token operator">:</span> List<span class="token punctuation">[</span>E<span class="token punctuation">]</span><span class="token punctuation">)</span> </code></pre></div><p>Use <code>ResponseValue#toString</code> to get the JSON representation of the result.</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">val</span> query <span class="token operator">=</span> <span class="token triple-quoted-string string">""" { @@ -93,6 +96,6 @@ </a> → </span></p></div> </main></div><div class="global-ui"></div></div> - <script src="/caliban/assets/js/app.098f98e8.js" defer></script><script src="/caliban/assets/js/2.fa272699.js" defer></script><script src="/caliban/assets/js/7.a06094f2.js" defer></script> + <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/7.57a8ce51.js" defer></script> </body> </html> diff --git a/docs/docs/interop.html b/docs/docs/interop.html index 4c008ee9b..f543b55e8 100644 --- a/docs/docs/interop.html +++ b/docs/docs/interop.html @@ -4,12 +4,12 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>Interop (Cats, Monix) | Caliban</title> - <meta name="description" content="Functional GraphQL backend in Scala"> - <meta name="generator" content="VuePress 1.3.0"> + <meta name="description" content="Functional GraphQL library for Scala"> + <meta name="generator" content="VuePress 1.3.1"> <link rel="icon" href="/caliban/caliban.png"> - <link rel="preload" href="/caliban/assets/css/0.styles.ce455d84.css" as="style"><link rel="preload" href="/caliban/assets/js/app.098f98e8.js" as="script"><link rel="preload" href="/caliban/assets/js/2.fa272699.js" as="script"><link rel="preload" href="/caliban/assets/js/9.9cf833f6.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.b8fd5856.js"><link rel="prefetch" href="/caliban/assets/js/11.151b57de.js"><link rel="prefetch" href="/caliban/assets/js/12.40588870.js"><link rel="prefetch" href="/caliban/assets/js/13.a0ebd332.js"><link rel="prefetch" href="/caliban/assets/js/14.fe3db0cd.js"><link rel="prefetch" href="/caliban/assets/js/15.a58fc205.js"><link rel="prefetch" href="/caliban/assets/js/16.09e4e2e8.js"><link rel="prefetch" href="/caliban/assets/js/3.af853996.js"><link rel="prefetch" href="/caliban/assets/js/4.b0dd307f.js"><link rel="prefetch" href="/caliban/assets/js/5.e6948aea.js"><link rel="prefetch" href="/caliban/assets/js/6.e0cf4477.js"><link rel="prefetch" href="/caliban/assets/js/7.a06094f2.js"><link rel="prefetch" href="/caliban/assets/js/8.abf14876.js"> - <link rel="stylesheet" href="/caliban/assets/css/0.styles.ce455d84.css"> + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/10.5f8b2c07.js" as="script"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.bc45abe0.js"><link rel="prefetch" href="/caliban/assets/js/13.d315a1c7.js"><link rel="prefetch" href="/caliban/assets/js/14.b8b8c6ff.js"><link rel="prefetch" href="/caliban/assets/js/15.23ceaf26.js"><link rel="prefetch" href="/caliban/assets/js/16.f357ff30.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.57a8ce51.js"><link rel="prefetch" href="/caliban/assets/js/8.6272775d.js"><link rel="prefetch" href="/caliban/assets/js/9.417f11bf.js"> + <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> </head> <body> <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/caliban/" class="home-link router-link-active"><img src="/caliban/caliban.svg" alt="Caliban" class="logo"> <span class="site-name can-hide">Caliban</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/caliban/docs/" class="nav-link router-link-active"> @@ -32,7 +32,7 @@ Github <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div><div class="nav-item"><a href="https://javadoc.io/doc/com.github.ghostdogpr/caliban_2.12/" target="_blank" rel="noopener noreferrer" class="nav-link external"> Scaladoc - <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>Caliban</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/caliban/docs/" class="sidebar-link">Getting Started</a></li><li><a href="/caliban/docs/schema.html" class="sidebar-link">Schemas</a></li><li><a href="/caliban/docs/middleware.html" class="sidebar-link">Middleware</a></li><li><a href="/caliban/docs/optimization.html" class="sidebar-link">Query optimization</a></li><li><a href="/caliban/docs/validation.html" class="sidebar-link">Validation</a></li><li><a href="/caliban/docs/introspection.html" class="sidebar-link">Introspection</a></li><li><a href="/caliban/docs/interop.html" class="active sidebar-link">Interop (Cats, Monix)</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/caliban/docs/interop.html#cats-effect" class="sidebar-link">Cats Effect</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/interop.html#monix" class="sidebar-link">Monix</a></li></ul></li><li><a href="/caliban/docs/examples.html" class="sidebar-link">Examples</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="interop-cats-monix"><a href="#interop-cats-monix" class="header-anchor">#</a> Interop (Cats, Monix)</h1> <p>If you prefer using <a href="https://github.com/typelevel/cats-effect" target="_blank" rel="noopener noreferrer">Cats Effect<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> or <a href="https://github.com/monix/monix" target="_blank" rel="noopener noreferrer">Monix<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> rather than ZIO, you can use the respective <code>caliban-cats</code> and <code>caliban-monix</code> modules.</p> <h2 id="cats-effect"><a href="#cats-effect" class="header-anchor">#</a> Cats Effect</h2> <p>You first need to import <code>caliban.interop.cats.implicits._</code> and have an implicit <code>zio.Runtime</code> in scope. Then a few helpers are available:</p> <ul><li>the GraphQL object is enriched with <code>executeAsync</code> and <code>checkAsync</code>, variants of <code>execute</code> and <code>check</code> that return an <code>F[_]: Async</code> instead of a <code>ZIO</code>.</li> <li>the <code>Http4sAdapter</code> also has cats-effect variants named <code>makeRestServiceF</code> and <code>makeWebSocketServiceF</code>.</li></ul> <p>In addition to that, a <code>Schema</code> for any <code>F[_]: Effect</code> is provided. That means you can include fields returning Monix Task for Cats IO in your queries, mutations or subscriptions.</p> <p>The following example shows how to create an interpreter and run a query while only using Cats IO.</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">import</span> caliban<span class="token punctuation">.</span>GraphQL<span class="token punctuation">.</span>graphQL + <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>Caliban</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/caliban/docs/" class="sidebar-link">Getting Started</a></li><li><a href="/caliban/docs/schema.html" class="sidebar-link">Schemas</a></li><li><a href="/caliban/docs/middleware.html" class="sidebar-link">Middleware</a></li><li><a href="/caliban/docs/optimization.html" class="sidebar-link">Query optimization</a></li><li><a href="/caliban/docs/validation.html" class="sidebar-link">Validation</a></li><li><a href="/caliban/docs/introspection.html" class="sidebar-link">Introspection</a></li><li><a href="/caliban/docs/interop.html" class="active sidebar-link">Interop (Cats, Monix)</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/caliban/docs/interop.html#cats-effect" class="sidebar-link">Cats Effect</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/interop.html#monix" class="sidebar-link">Monix</a></li></ul></li><li><a href="/caliban/docs/client.html" class="sidebar-link">GraphQL Client</a></li><li><a href="/caliban/docs/examples.html" class="sidebar-link">Examples</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="interop-cats-monix"><a href="#interop-cats-monix" class="header-anchor">#</a> Interop (Cats, Monix)</h1> <p>If you prefer using <a href="https://github.com/typelevel/cats-effect" target="_blank" rel="noopener noreferrer">Cats Effect<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> or <a href="https://github.com/monix/monix" target="_blank" rel="noopener noreferrer">Monix<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> rather than ZIO, you can use the respective <code>caliban-cats</code> and <code>caliban-monix</code> modules.</p> <h2 id="cats-effect"><a href="#cats-effect" class="header-anchor">#</a> Cats Effect</h2> <p>You first need to import <code>caliban.interop.cats.implicits._</code> and have an implicit <code>zio.Runtime</code> in scope. Then a few helpers are available:</p> <ul><li>the GraphQL object is enriched with <code>interpreterAsync</code>, <code>executeAsync</code> and <code>checkAsync</code>, variants of <code>interpreter</code>, <code>execute</code> and <code>check</code> that return an <code>F[_]: Async</code> instead of a <code>ZIO</code>.</li> <li>the <code>Http4sAdapter</code> also has cats-effect variants named <code>makeRestServiceF</code> and <code>makeWebSocketServiceF</code>.</li></ul> <p>In addition to that, a <code>Schema</code> for any <code>F[_]: Effect</code> is provided. That means you can include fields returning Monix Task for Cats IO in your queries, mutations or subscriptions.</p> <p>The following example shows how to create an interpreter and run a query while only using Cats IO.</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">import</span> caliban<span class="token punctuation">.</span>GraphQL<span class="token punctuation">.</span>graphQL <span class="token keyword">import</span> caliban<span class="token punctuation">.</span>RootResolver <span class="token keyword">import</span> <span class="token namespace">caliban<span class="token punctuation">.</span>interop<span class="token punctuation">.</span>cats<span class="token punctuation">.</span>implicits</span><span class="token punctuation">.</span>_ <span class="token keyword">import</span> <span class="token namespace">cats<span class="token punctuation">.</span>effect</span><span class="token punctuation">.</span><span class="token punctuation">{</span> ExitCode<span class="token punctuation">,</span> IO<span class="token punctuation">,</span> IOApp <span class="token punctuation">}</span> @@ -45,7 +45,7 @@ <span class="token keyword">case</span> <span class="token keyword">class</span> Queries<span class="token punctuation">(</span>numbers<span class="token operator">:</span> List<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span><span class="token punctuation">,</span> randomNumber<span class="token operator">:</span> IO<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token keyword">val</span> queries <span class="token operator">=</span> Queries<span class="token punctuation">(</span>List<span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">,</span> IO<span class="token punctuation">(</span>scala<span class="token punctuation">.</span>util<span class="token punctuation">.</span>Random<span class="token punctuation">.</span>nextInt<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span> - <span class="token keyword">val</span> interpreter <span class="token operator">=</span> graphQL<span class="token punctuation">(</span>RootResolver<span class="token punctuation">(</span>queries<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">.</span>interpreter + <span class="token keyword">val</span> api <span class="token operator">=</span> graphQL<span class="token punctuation">(</span>RootResolver<span class="token punctuation">(</span>queries<span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token keyword">val</span> query <span class="token operator">=</span> <span class="token triple-quoted-string string">""" { @@ -55,11 +55,12 @@ <span class="token keyword">override</span> <span class="token keyword">def</span> run<span class="token punctuation">(</span>args<span class="token operator">:</span> List<span class="token punctuation">[</span><span class="token builtin">String</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token operator">:</span> IO<span class="token punctuation">[</span>ExitCode<span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token keyword">for</span> <span class="token punctuation">{</span> - result <span class="token keyword"><-</span> interpreter<span class="token punctuation">.</span>executeAsync<span class="token punctuation">[</span>IO<span class="token punctuation">]</span><span class="token punctuation">(</span>query<span class="token punctuation">)</span> - _ <span class="token keyword"><-</span> IO<span class="token punctuation">(</span>println<span class="token punctuation">(</span>result<span class="token punctuation">.</span>data<span class="token punctuation">)</span><span class="token punctuation">)</span> + interpreter <span class="token keyword"><-</span> api<span class="token punctuation">.</span>interpreterAsync<span class="token punctuation">[</span>IO<span class="token punctuation">]</span> + result <span class="token keyword"><-</span> interpreter<span class="token punctuation">.</span>executeAsync<span class="token punctuation">[</span>IO<span class="token punctuation">]</span><span class="token punctuation">(</span>query<span class="token punctuation">)</span> + _ <span class="token keyword"><-</span> IO<span class="token punctuation">(</span>println<span class="token punctuation">(</span>result<span class="token punctuation">.</span>data<span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token punctuation">}</span> <span class="token keyword">yield</span> ExitCode<span class="token punctuation">.</span>Success <span class="token punctuation">}</span> -</code></pre></div><p>You can find this example within the <a href="https://github.com/ghostdogpr/caliban/blob/master/examples/src/main/scala/caliban/interop/cats/ExampleCatsInterop.scala" target="_blank" rel="noopener noreferrer">examples<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> project.</p> <h2 id="monix"><a href="#monix" class="header-anchor">#</a> Monix</h2> <p>You first need to import <code>caliban.interop.monix.implicits._</code> and have an implicit <code>zio.Runtime</code> in scope. Then a few helpers are available:</p> <ul><li>the GraphQL object is enriched with <code>executeAsync</code> and <code>checkAsync</code>, variants of <code>execute</code> and <code>check</code> that return a Monix <code>Task</code> instead of a <code>ZIO</code>.</li></ul> <p>In addition to that, a <code>Schema</code> for any Monix <code>Task</code> as well as <code>Observable</code> is provided.</p> <p>The following example shows how to create an interpreter and run a query while only using Monix Task.</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">import</span> caliban<span class="token punctuation">.</span>GraphQL<span class="token punctuation">.</span>graphQL +</code></pre></div><p>You can find this example within the <a href="https://github.com/ghostdogpr/caliban/blob/master/examples/src/main/scala/caliban/interop/cats/ExampleCatsInterop.scala" target="_blank" rel="noopener noreferrer">examples<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> project.</p> <h2 id="monix"><a href="#monix" class="header-anchor">#</a> Monix</h2> <p>You first need to import <code>caliban.interop.monix.implicits._</code> and have an implicit <code>zio.Runtime</code> in scope. Then a few helpers are available:</p> <ul><li>the GraphQL object is enriched with <code>interpreterAsync</code>, <code>executeAsync</code> and <code>checkAsync</code>, variants of <code>interpreter</code>, <code>execute</code> and <code>check</code> that return a Monix <code>Task</code> instead of a <code>ZIO</code>.</li></ul> <p>In addition to that, a <code>Schema</code> for any Monix <code>Task</code> as well as <code>Observable</code> is provided.</p> <p>The following example shows how to create an interpreter and run a query while only using Monix Task.</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">import</span> caliban<span class="token punctuation">.</span>GraphQL<span class="token punctuation">.</span>graphQL <span class="token keyword">import</span> caliban<span class="token punctuation">.</span>RootResolver <span class="token keyword">import</span> <span class="token namespace">caliban<span class="token punctuation">.</span>interop<span class="token punctuation">.</span>monix<span class="token punctuation">.</span>implicits</span><span class="token punctuation">.</span>_ <span class="token keyword">import</span> <span class="token namespace">cats<span class="token punctuation">.</span>effect</span><span class="token punctuation">.</span>ExitCode @@ -75,7 +76,7 @@ <span class="token keyword">case</span> <span class="token keyword">class</span> Queries<span class="token punctuation">(</span>numbers<span class="token operator">:</span> List<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span><span class="token punctuation">,</span> randomNumber<span class="token operator">:</span> Task<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token keyword">val</span> queries <span class="token operator">=</span> Queries<span class="token punctuation">(</span>List<span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">,</span> Task<span class="token punctuation">.</span>eval<span class="token punctuation">(</span>scala<span class="token punctuation">.</span>util<span class="token punctuation">.</span>Random<span class="token punctuation">.</span>nextInt<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span> - <span class="token keyword">val</span> interpreter <span class="token operator">=</span> graphQL<span class="token punctuation">(</span>RootResolver<span class="token punctuation">(</span>queries<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">.</span>interpreter + <span class="token keyword">val</span> api <span class="token operator">=</span> graphQL<span class="token punctuation">(</span>RootResolver<span class="token punctuation">(</span>queries<span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token keyword">val</span> query <span class="token operator">=</span> <span class="token triple-quoted-string string">""" { @@ -85,19 +86,20 @@ <span class="token keyword">override</span> <span class="token keyword">def</span> run<span class="token punctuation">(</span>args<span class="token operator">:</span> List<span class="token punctuation">[</span><span class="token builtin">String</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token operator">:</span> Task<span class="token punctuation">[</span>ExitCode<span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token keyword">for</span> <span class="token punctuation">{</span> - result <span class="token keyword"><-</span> interpreter<span class="token punctuation">.</span>executeAsync<span class="token punctuation">(</span>query<span class="token punctuation">)</span> - _ <span class="token keyword"><-</span> Task<span class="token punctuation">.</span>eval<span class="token punctuation">(</span>println<span class="token punctuation">(</span>result<span class="token punctuation">.</span>data<span class="token punctuation">)</span><span class="token punctuation">)</span> + interpreter <span class="token keyword"><-</span> api<span class="token punctuation">.</span>interpreterAsync + result <span class="token keyword"><-</span> interpreter<span class="token punctuation">.</span>executeAsync<span class="token punctuation">(</span>query<span class="token punctuation">)</span> + _ <span class="token keyword"><-</span> Task<span class="token punctuation">.</span>eval<span class="token punctuation">(</span>println<span class="token punctuation">(</span>result<span class="token punctuation">.</span>data<span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token punctuation">}</span> <span class="token keyword">yield</span> ExitCode<span class="token punctuation">.</span>Success <span class="token punctuation">}</span> </code></pre></div><p>You can find this example within the <a href="https://github.com/ghostdogpr/caliban/blob/master/examples/src/main/scala/caliban/interop/monix/ExampleMonixInterop.scala" target="_blank" rel="noopener noreferrer">examples<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> project.</p></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev"> ← <a href="/caliban/docs/introspection.html" class="prev"> Introspection - </a></span> <span class="next"><a href="/caliban/docs/examples.html"> - Examples + </a></span> <span class="next"><a href="/caliban/docs/client.html"> + GraphQL Client </a> → </span></p></div> </main></div><div class="global-ui"></div></div> - <script src="/caliban/assets/js/app.098f98e8.js" defer></script><script src="/caliban/assets/js/2.fa272699.js" defer></script><script src="/caliban/assets/js/9.9cf833f6.js" defer></script> + <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/10.5f8b2c07.js" defer></script> </body> </html> diff --git a/docs/docs/introspection.html b/docs/docs/introspection.html index 385c5ee3a..25c897f7c 100644 --- a/docs/docs/introspection.html +++ b/docs/docs/introspection.html @@ -4,12 +4,12 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>Introspection | Caliban</title> - <meta name="description" content="Functional GraphQL backend in Scala"> - <meta name="generator" content="VuePress 1.3.0"> + <meta name="description" content="Functional GraphQL library for Scala"> + <meta name="generator" content="VuePress 1.3.1"> <link rel="icon" href="/caliban/caliban.png"> - <link rel="preload" href="/caliban/assets/css/0.styles.ce455d84.css" as="style"><link rel="preload" href="/caliban/assets/js/app.098f98e8.js" as="script"><link rel="preload" href="/caliban/assets/js/2.fa272699.js" as="script"><link rel="preload" href="/caliban/assets/js/10.b8fd5856.js" as="script"><link rel="prefetch" href="/caliban/assets/js/11.151b57de.js"><link rel="prefetch" href="/caliban/assets/js/12.40588870.js"><link rel="prefetch" href="/caliban/assets/js/13.a0ebd332.js"><link rel="prefetch" href="/caliban/assets/js/14.fe3db0cd.js"><link rel="prefetch" href="/caliban/assets/js/15.a58fc205.js"><link rel="prefetch" href="/caliban/assets/js/16.09e4e2e8.js"><link rel="prefetch" href="/caliban/assets/js/3.af853996.js"><link rel="prefetch" href="/caliban/assets/js/4.b0dd307f.js"><link rel="prefetch" href="/caliban/assets/js/5.e6948aea.js"><link rel="prefetch" href="/caliban/assets/js/6.e0cf4477.js"><link rel="prefetch" href="/caliban/assets/js/7.a06094f2.js"><link rel="prefetch" href="/caliban/assets/js/8.abf14876.js"><link rel="prefetch" href="/caliban/assets/js/9.9cf833f6.js"> - <link rel="stylesheet" href="/caliban/assets/css/0.styles.ce455d84.css"> + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/11.5f34d6b0.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.5f8b2c07.js"><link rel="prefetch" href="/caliban/assets/js/12.bc45abe0.js"><link rel="prefetch" href="/caliban/assets/js/13.d315a1c7.js"><link rel="prefetch" href="/caliban/assets/js/14.b8b8c6ff.js"><link rel="prefetch" href="/caliban/assets/js/15.23ceaf26.js"><link rel="prefetch" href="/caliban/assets/js/16.f357ff30.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.57a8ce51.js"><link rel="prefetch" href="/caliban/assets/js/8.6272775d.js"><link rel="prefetch" href="/caliban/assets/js/9.417f11bf.js"> + <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> </head> <body> <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/caliban/" class="home-link router-link-active"><img src="/caliban/caliban.svg" alt="Caliban" class="logo"> <span class="site-name can-hide">Caliban</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/caliban/docs/" class="nav-link router-link-active"> @@ -32,7 +32,7 @@ Github <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div><div class="nav-item"><a href="https://javadoc.io/doc/com.github.ghostdogpr/caliban_2.12/" target="_blank" rel="noopener noreferrer" class="nav-link external"> Scaladoc - <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>Caliban</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/caliban/docs/" class="sidebar-link">Getting Started</a></li><li><a href="/caliban/docs/schema.html" class="sidebar-link">Schemas</a></li><li><a href="/caliban/docs/middleware.html" class="sidebar-link">Middleware</a></li><li><a href="/caliban/docs/optimization.html" class="sidebar-link">Query optimization</a></li><li><a href="/caliban/docs/validation.html" class="sidebar-link">Validation</a></li><li><a href="/caliban/docs/introspection.html" class="active sidebar-link">Introspection</a></li><li><a href="/caliban/docs/interop.html" class="sidebar-link">Interop (Cats, Monix)</a></li><li><a href="/caliban/docs/examples.html" class="sidebar-link">Examples</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="introspection"><a href="#introspection" class="header-anchor">#</a> Introspection</h1> <p>Introspection queries are fully supported, which means you can use your favorite tool to inspect your schema and generate documentation for free.</p> <p>Here's an example of documentation generated by introspection in <a href="https://altair.sirmuel.design/" target="_blank" rel="noopener noreferrer">Altair GraphQL Client<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>:</p> <p><img src="/caliban/altair.png" alt="altair screenshot"></p></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev"> + <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>Caliban</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/caliban/docs/" class="sidebar-link">Getting Started</a></li><li><a href="/caliban/docs/schema.html" class="sidebar-link">Schemas</a></li><li><a href="/caliban/docs/middleware.html" class="sidebar-link">Middleware</a></li><li><a href="/caliban/docs/optimization.html" class="sidebar-link">Query optimization</a></li><li><a href="/caliban/docs/validation.html" class="sidebar-link">Validation</a></li><li><a href="/caliban/docs/introspection.html" class="active sidebar-link">Introspection</a></li><li><a href="/caliban/docs/interop.html" class="sidebar-link">Interop (Cats, Monix)</a></li><li><a href="/caliban/docs/client.html" class="sidebar-link">GraphQL Client</a></li><li><a href="/caliban/docs/examples.html" class="sidebar-link">Examples</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="introspection"><a href="#introspection" class="header-anchor">#</a> Introspection</h1> <p>Introspection queries are fully supported, which means you can use your favorite tool to inspect your schema and generate documentation for free.</p> <p>Here's an example of documentation generated by introspection in <a href="https://altair.sirmuel.design/" target="_blank" rel="noopener noreferrer">Altair GraphQL Client<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>:</p> <p><img src="/caliban/altair.png" alt="altair screenshot"></p></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev"> ← <a href="/caliban/docs/validation.html" class="prev"> Validation @@ -41,6 +41,6 @@ </a> → </span></p></div> </main></div><div class="global-ui"></div></div> - <script src="/caliban/assets/js/app.098f98e8.js" defer></script><script src="/caliban/assets/js/2.fa272699.js" defer></script><script src="/caliban/assets/js/10.b8fd5856.js" defer></script> + <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/11.5f34d6b0.js" defer></script> </body> </html> diff --git a/docs/docs/middleware.html b/docs/docs/middleware.html index ea8cc968c..9c121cda8 100644 --- a/docs/docs/middleware.html +++ b/docs/docs/middleware.html @@ -4,12 +4,12 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>Middleware | Caliban</title> - <meta name="description" content="Functional GraphQL backend in Scala"> - <meta name="generator" content="VuePress 1.3.0"> + <meta name="description" content="Functional GraphQL library for Scala"> + <meta name="generator" content="VuePress 1.3.1"> <link rel="icon" href="/caliban/caliban.png"> - <link rel="preload" href="/caliban/assets/css/0.styles.ce455d84.css" as="style"><link rel="preload" href="/caliban/assets/js/app.098f98e8.js" as="script"><link rel="preload" href="/caliban/assets/js/2.fa272699.js" as="script"><link rel="preload" href="/caliban/assets/js/11.151b57de.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.b8fd5856.js"><link rel="prefetch" href="/caliban/assets/js/12.40588870.js"><link rel="prefetch" href="/caliban/assets/js/13.a0ebd332.js"><link rel="prefetch" href="/caliban/assets/js/14.fe3db0cd.js"><link rel="prefetch" href="/caliban/assets/js/15.a58fc205.js"><link rel="prefetch" href="/caliban/assets/js/16.09e4e2e8.js"><link rel="prefetch" href="/caliban/assets/js/3.af853996.js"><link rel="prefetch" href="/caliban/assets/js/4.b0dd307f.js"><link rel="prefetch" href="/caliban/assets/js/5.e6948aea.js"><link rel="prefetch" href="/caliban/assets/js/6.e0cf4477.js"><link rel="prefetch" href="/caliban/assets/js/7.a06094f2.js"><link rel="prefetch" href="/caliban/assets/js/8.abf14876.js"><link rel="prefetch" href="/caliban/assets/js/9.9cf833f6.js"> - <link rel="stylesheet" href="/caliban/assets/css/0.styles.ce455d84.css"> + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/12.bc45abe0.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.5f8b2c07.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/13.d315a1c7.js"><link rel="prefetch" href="/caliban/assets/js/14.b8b8c6ff.js"><link rel="prefetch" href="/caliban/assets/js/15.23ceaf26.js"><link rel="prefetch" href="/caliban/assets/js/16.f357ff30.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.57a8ce51.js"><link rel="prefetch" href="/caliban/assets/js/8.6272775d.js"><link rel="prefetch" href="/caliban/assets/js/9.417f11bf.js"> + <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> </head> <body> <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/caliban/" class="home-link router-link-active"><img src="/caliban/caliban.svg" alt="Caliban" class="logo"> <span class="site-name can-hide">Caliban</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/caliban/docs/" class="nav-link router-link-active"> @@ -32,7 +32,7 @@ Github <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div><div class="nav-item"><a href="https://javadoc.io/doc/com.github.ghostdogpr/caliban_2.12/" target="_blank" rel="noopener noreferrer" class="nav-link external"> Scaladoc - <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>Caliban</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/caliban/docs/" class="sidebar-link">Getting Started</a></li><li><a href="/caliban/docs/schema.html" class="sidebar-link">Schemas</a></li><li><a href="/caliban/docs/middleware.html" class="active sidebar-link">Middleware</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/caliban/docs/middleware.html#wrapper-types" class="sidebar-link">Wrapper types</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/middleware.html#pre-defined-wrappers" class="sidebar-link">Pre-defined wrappers</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/middleware.html#wrapping-the-interpreter" class="sidebar-link">Wrapping the interpreter</a></li></ul></li><li><a href="/caliban/docs/optimization.html" class="sidebar-link">Query optimization</a></li><li><a href="/caliban/docs/validation.html" class="sidebar-link">Validation</a></li><li><a href="/caliban/docs/introspection.html" class="sidebar-link">Introspection</a></li><li><a href="/caliban/docs/interop.html" class="sidebar-link">Interop (Cats, Monix)</a></li><li><a href="/caliban/docs/examples.html" class="sidebar-link">Examples</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="middleware"><a href="#middleware" class="header-anchor">#</a> Middleware</h1> <p>Caliban allows you to perform additional actions at various levels of a query processing, via the concept of <code>Wrapper</code>. Using wrappers, you can:</p> <ul><li>verify that a query doesn't reach some limit (e.g. depth, complexity)</li> <li>modify a query before it's executed</li> <li>add timeouts to queries or fields</li> <li>log each field execution time</li> <li>support <a href="https://github.com/apollographql/apollo-tracing" target="_blank" rel="noopener noreferrer">Apollo Tracing<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> or anything similar</li> <li>etc.</li></ul> <h2 id="wrapper-types"><a href="#wrapper-types" class="header-anchor">#</a> Wrapper types</h2> <p>There are 5 basic types of wrappers:</p> <ul><li><code>OverallWrapper</code> to wrap the whole query processing</li> <li><code>ParsingWrapper</code> to wrap the query parsing only</li> <li><code>ValidationWrapper</code> to wrap the query validation only</li> <li><code>ExecutionWrapper</code> to wrap the query execution only</li> <li><code>FieldWrapper</code> to wrap each field execution</li></ul> <p>Each one requires a function that takes a <code>ZIO</code> or <code>ZQuery</code> computation together with some contextual information (e.g. the query string) and should return another computation.</p> <p>Let's see how to implement a wrapper that times out the whole query if its processing takes longer that 1 minute.</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">val</span> wrapper <span class="token operator">=</span> OverallWrapper <span class="token punctuation">{</span> + <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>Caliban</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/caliban/docs/" class="sidebar-link">Getting Started</a></li><li><a href="/caliban/docs/schema.html" class="sidebar-link">Schemas</a></li><li><a href="/caliban/docs/middleware.html" class="active sidebar-link">Middleware</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/caliban/docs/middleware.html#wrapper-types" class="sidebar-link">Wrapper types</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/middleware.html#pre-defined-wrappers" class="sidebar-link">Pre-defined wrappers</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/middleware.html#wrapping-the-interpreter" class="sidebar-link">Wrapping the interpreter</a></li></ul></li><li><a href="/caliban/docs/optimization.html" class="sidebar-link">Query optimization</a></li><li><a href="/caliban/docs/validation.html" class="sidebar-link">Validation</a></li><li><a href="/caliban/docs/introspection.html" class="sidebar-link">Introspection</a></li><li><a href="/caliban/docs/interop.html" class="sidebar-link">Interop (Cats, Monix)</a></li><li><a href="/caliban/docs/client.html" class="sidebar-link">GraphQL Client</a></li><li><a href="/caliban/docs/examples.html" class="sidebar-link">Examples</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="middleware"><a href="#middleware" class="header-anchor">#</a> Middleware</h1> <p>Caliban allows you to perform additional actions at various levels of a query processing, via the concept of <code>Wrapper</code>. Using wrappers, you can:</p> <ul><li>verify that a query doesn't reach some limit (e.g. depth, complexity)</li> <li>modify a query before it's executed</li> <li>add timeouts to queries or fields</li> <li>log each field execution time</li> <li>support <a href="https://github.com/apollographql/apollo-tracing" target="_blank" rel="noopener noreferrer">Apollo Tracing<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>, <a href="https://github.com/apollographql/apollo-cache-control" target="_blank" rel="noopener noreferrer">Apollo Caching<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> or anything similar</li> <li>etc.</li></ul> <h2 id="wrapper-types"><a href="#wrapper-types" class="header-anchor">#</a> Wrapper types</h2> <p>There are 5 basic types of wrappers:</p> <ul><li><code>OverallWrapper</code> to wrap the whole query processing</li> <li><code>ParsingWrapper</code> to wrap the query parsing only</li> <li><code>ValidationWrapper</code> to wrap the query validation only</li> <li><code>ExecutionWrapper</code> to wrap the query execution only</li> <li><code>FieldWrapper</code> to wrap each field execution</li></ul> <p>Each one requires a function that takes a <code>ZIO</code> or <code>ZQuery</code> computation together with some contextual information (e.g. the query string) and should return another computation.</p> <p>Let's see how to implement a wrapper that times out the whole query if its processing takes longer that 1 minute.</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">val</span> wrapper <span class="token operator">=</span> OverallWrapper <span class="token punctuation">{</span> <span class="token keyword">case</span> <span class="token punctuation">(</span>io<span class="token punctuation">,</span> query<span class="token punctuation">)</span> <span class="token keyword">=></span> io<span class="token punctuation">.</span>timeout<span class="token punctuation">(</span><span class="token number">1</span> minute<span class="token punctuation">)</span> <span class="token punctuation">.</span>map<span class="token punctuation">(</span> @@ -47,14 +47,14 @@ </code></pre></div><p>You can also combine wrappers using <code>|+|</code> and create a wrapper that requires an effect to be run at each query using <code>EffectfulWrapper</code>.</p> <p>To use your wrapper, call <code>GraphQL#withWrapper</code> or its alias <code>@@</code>.</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">val</span> api <span class="token operator">=</span> graphQL<span class="token punctuation">(</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">)</span><span class="token punctuation">.</span>withWrapper<span class="token punctuation">(</span>wrapper<span class="token punctuation">)</span> <span class="token comment">// or</span> <span class="token keyword">val</span> api <span class="token operator">=</span> graphQL<span class="token punctuation">(</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">)</span> @@ wrapper -</code></pre></div><h2 id="pre-defined-wrappers"><a href="#pre-defined-wrappers" class="header-anchor">#</a> Pre-defined wrappers</h2> <p>Caliban comes with a few pre-made wrappers in <code>caliban.wrappers.Wrappers</code>:</p> <ul><li><code>maxDepth</code> returns a wrapper that fails queries whose depth is higher than a given value</li> <li><code>maxFields</code> returns a wrapper that fails queries whose number of fields is higher than a given value</li> <li><code>timeout</code> returns a wrapper that fails queries taking more than a specified time</li> <li><code>printSlowQueries</code> returns a wrapper that prints slow queries</li> <li><code>onSlowQueries</code> returns a wrapper that can run a given function on slow queries</li></ul> <p>In addition to those, <code>caliban.wrappers.ApolloTracing.apolloTracing</code> returns a wrapper that adds tracing data into the <code>extensions</code> field of each response following <a href="https://github.com/apollographql/apollo-tracing" target="_blank" rel="noopener noreferrer">Apollo Tracing<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> format.</p> <p>They can be used like this:</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">val</span> api <span class="token operator">=</span> +</code></pre></div><h2 id="pre-defined-wrappers"><a href="#pre-defined-wrappers" class="header-anchor">#</a> Pre-defined wrappers</h2> <p>Caliban comes with a few pre-made wrappers in <code>caliban.wrappers.Wrappers</code>:</p> <ul><li><code>maxDepth</code> returns a wrapper that fails queries whose depth is higher than a given value</li> <li><code>maxFields</code> returns a wrapper that fails queries whose number of fields is higher than a given value</li> <li><code>timeout</code> returns a wrapper that fails queries taking more than a specified time</li> <li><code>printSlowQueries</code> returns a wrapper that prints slow queries</li> <li><code>onSlowQueries</code> returns a wrapper that can run a given function on slow queries</li></ul> <p>In addition to those, Caliban also ships with some non-spec but standard wrappers</p> <ul><li><code>caliban.wrappers.ApolloTracing.apolloTracing</code> returns a wrapper that adds tracing data into the <code>extensions</code> field of each response following <a href="https://github.com/apollographql/apollo-tracing" target="_blank" rel="noopener noreferrer">Apollo Tracing<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> format.</li> <li><code>caliban.wrappers.ApolloCaching.apolloCaching</code> returns a wrapper that adds caching hints to properly annotated fields using the <a href="https://github.com/apollographql/apollo-cache-control" target="_blank" rel="noopener noreferrer">Apollo Caching<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> format.</li></ul> <p>They can be used like this:</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">val</span> api <span class="token operator">=</span> graphQL<span class="token punctuation">(</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">)</span> @@ maxDepth<span class="token punctuation">(</span><span class="token number">50</span><span class="token punctuation">)</span> @@ timeout<span class="token punctuation">(</span><span class="token number">3</span> seconds<span class="token punctuation">)</span> @@ printSlowQueries<span class="token punctuation">(</span><span class="token number">500</span> millis<span class="token punctuation">)</span> @@ - apolloTracing -</code></pre></div><h2 id="wrapping-the-interpreter"><a href="#wrapping-the-interpreter" class="header-anchor">#</a> Wrapping the interpreter</h2> <p>All the wrappers mentioned above require that you don't modify the environment <code>R</code> and the error type which is always a <code>CalibanError</code>. It is also possible to wrap your <code>GraphQLInterpreter</code> by calling <code>wrapExecutionWith</code> on it. This method takes in a function <code>f</code> and returns a new <code>GraphQLInterpreter</code> that will wrap the <code>execute</code> method with this function <code>f</code>.</p> <p>It is used internally to implement <code>mapError</code> (customize errors) and <code>provide</code> (eliminate the environment), but you can use it for other purposes such as adding a general timeout, logging response times, etc.</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token comment">// create an interpreter</span> -<span class="token keyword">val</span> i<span class="token operator">:</span> GraphQLInterpreter<span class="token punctuation">[</span>MyEnv<span class="token punctuation">,</span> CalibanError<span class="token punctuation">]</span> <span class="token operator">=</span> graphqQL<span class="token punctuation">(</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">)</span><span class="token punctuation">.</span>interpreter + apolloTracing @@ + apolloCaching +</code></pre></div><h2 id="wrapping-the-interpreter"><a href="#wrapping-the-interpreter" class="header-anchor">#</a> Wrapping the interpreter</h2> <p>All the wrappers mentioned above require that you don't modify the environment <code>R</code> and the error type which is always a <code>CalibanError</code>. It is also possible to wrap your <code>GraphQLInterpreter</code> by calling <code>wrapExecutionWith</code> on it. This method takes in a function <code>f</code> and returns a new <code>GraphQLInterpreter</code> that will wrap the <code>execute</code> method with this function <code>f</code>.</p> <p>It is used internally to implement <code>mapError</code> (customize errors) and <code>provide</code> (eliminate the environment), but you can use it for other purposes such as adding a general timeout, logging response times, etc.</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">val</span> i<span class="token operator">:</span> GraphQLInterpreter<span class="token punctuation">[</span>MyEnv<span class="token punctuation">,</span> CalibanError<span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token operator">?</span><span class="token operator">?</span><span class="token operator">?</span> <span class="token comment">// change error type to String</span> <span class="token keyword">val</span> i2<span class="token operator">:</span> GraphQLInterpreter<span class="token punctuation">[</span>MyEnv<span class="token punctuation">,</span> <span class="token builtin">String</span><span class="token punctuation">]</span> <span class="token operator">=</span> i<span class="token punctuation">.</span>mapError<span class="token punctuation">(</span>_<span class="token punctuation">.</span>toString<span class="token punctuation">)</span> @@ -78,6 +78,6 @@ </a> → </span></p></div> </main></div><div class="global-ui"></div></div> - <script src="/caliban/assets/js/app.098f98e8.js" defer></script><script src="/caliban/assets/js/2.fa272699.js" defer></script><script src="/caliban/assets/js/11.151b57de.js" defer></script> + <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/12.bc45abe0.js" defer></script> </body> </html> diff --git a/docs/docs/optimization.html b/docs/docs/optimization.html index 79d646b06..2a26af17c 100644 --- a/docs/docs/optimization.html +++ b/docs/docs/optimization.html @@ -4,12 +4,12 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>Query optimization | Caliban</title> - <meta name="description" content="Functional GraphQL backend in Scala"> - <meta name="generator" content="VuePress 1.3.0"> + <meta name="description" content="Functional GraphQL library for Scala"> + <meta name="generator" content="VuePress 1.3.1"> <link rel="icon" href="/caliban/caliban.png"> - <link rel="preload" href="/caliban/assets/css/0.styles.ce455d84.css" as="style"><link rel="preload" href="/caliban/assets/js/app.098f98e8.js" as="script"><link rel="preload" href="/caliban/assets/js/2.fa272699.js" as="script"><link rel="preload" href="/caliban/assets/js/12.40588870.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.b8fd5856.js"><link rel="prefetch" href="/caliban/assets/js/11.151b57de.js"><link rel="prefetch" href="/caliban/assets/js/13.a0ebd332.js"><link rel="prefetch" href="/caliban/assets/js/14.fe3db0cd.js"><link rel="prefetch" href="/caliban/assets/js/15.a58fc205.js"><link rel="prefetch" href="/caliban/assets/js/16.09e4e2e8.js"><link rel="prefetch" href="/caliban/assets/js/3.af853996.js"><link rel="prefetch" href="/caliban/assets/js/4.b0dd307f.js"><link rel="prefetch" href="/caliban/assets/js/5.e6948aea.js"><link rel="prefetch" href="/caliban/assets/js/6.e0cf4477.js"><link rel="prefetch" href="/caliban/assets/js/7.a06094f2.js"><link rel="prefetch" href="/caliban/assets/js/8.abf14876.js"><link rel="prefetch" href="/caliban/assets/js/9.9cf833f6.js"> - <link rel="stylesheet" href="/caliban/assets/css/0.styles.ce455d84.css"> + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/13.d315a1c7.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.5f8b2c07.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.bc45abe0.js"><link rel="prefetch" href="/caliban/assets/js/14.b8b8c6ff.js"><link rel="prefetch" href="/caliban/assets/js/15.23ceaf26.js"><link rel="prefetch" href="/caliban/assets/js/16.f357ff30.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.57a8ce51.js"><link rel="prefetch" href="/caliban/assets/js/8.6272775d.js"><link rel="prefetch" href="/caliban/assets/js/9.417f11bf.js"> + <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> </head> <body> <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/caliban/" class="home-link router-link-active"><img src="/caliban/caliban.svg" alt="Caliban" class="logo"> <span class="site-name can-hide">Caliban</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/caliban/docs/" class="nav-link router-link-active"> @@ -32,7 +32,7 @@ Github <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div><div class="nav-item"><a href="https://javadoc.io/doc/com.github.ghostdogpr/caliban_2.12/" target="_blank" rel="noopener noreferrer" class="nav-link external"> Scaladoc - <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>Caliban</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/caliban/docs/" class="sidebar-link">Getting Started</a></li><li><a href="/caliban/docs/schema.html" class="sidebar-link">Schemas</a></li><li><a href="/caliban/docs/middleware.html" class="sidebar-link">Middleware</a></li><li><a href="/caliban/docs/optimization.html" class="active sidebar-link">Query optimization</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/caliban/docs/optimization.html#introducing-zquery" class="sidebar-link">Introducing ZQuery</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/optimization.html#building-a-datasource" class="sidebar-link">Building a DataSource</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/optimization.html#zquery-constructors-and-operators" class="sidebar-link">ZQuery constructors and operators</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/optimization.html#using-zquery-with-caliban" class="sidebar-link">Using ZQuery with Caliban</a></li></ul></li><li><a href="/caliban/docs/validation.html" class="sidebar-link">Validation</a></li><li><a href="/caliban/docs/introspection.html" class="sidebar-link">Introspection</a></li><li><a href="/caliban/docs/interop.html" class="sidebar-link">Interop (Cats, Monix)</a></li><li><a href="/caliban/docs/examples.html" class="sidebar-link">Examples</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="query-optimization"><a href="#query-optimization" class="header-anchor">#</a> Query optimization</h1> <p>A GraphQL query may request multiple fields that are using the same resolver. It's not a problem if the resolver is a simple value, but it can be less than optimal when the resolver runs an effect (such as reading from a database).</p> <p>We might want to:</p> <ul><li><strong>cache</strong> identical queries (deduplication)</li> <li><strong>batch</strong> queries to the same source</li></ul> <p>This is possible in Caliban using the <code>ZQuery</code> data type.</p> <h2 id="introducing-zquery"><a href="#introducing-zquery" class="header-anchor">#</a> Introducing ZQuery</h2> <p>A <code>ZQuery[R, E, A]</code> is a purely functional description of an effectual query that may contain requests to one or more data sources. Similarly to <code>ZIO[R, E, A]</code>, it requires an environment <code>R</code>, may fail with an <code>E</code> or succeed with an <code>A</code>. All requests that do not need to be performed sequentially will automatically be batched, allowing for aggressive data source specific optimizations. Requests will also automatically be deduplicated and cached.</p> <p>This allows for writing queries in a high level, compositional style, with confidence that they will automatically be optimized. For example, consider the following query from a user service.</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">val</span> getAllUserIds<span class="token operator">:</span> ZQuery<span class="token punctuation">[</span><span class="token builtin">Any</span><span class="token punctuation">,</span> <span class="token builtin">Nothing</span><span class="token punctuation">,</span> List<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token operator">?</span><span class="token operator">?</span><span class="token operator">?</span> + <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>Caliban</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/caliban/docs/" class="sidebar-link">Getting Started</a></li><li><a href="/caliban/docs/schema.html" class="sidebar-link">Schemas</a></li><li><a href="/caliban/docs/middleware.html" class="sidebar-link">Middleware</a></li><li><a href="/caliban/docs/optimization.html" class="active sidebar-link">Query optimization</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/caliban/docs/optimization.html#introducing-zquery" class="sidebar-link">Introducing ZQuery</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/optimization.html#building-a-datasource" class="sidebar-link">Building a DataSource</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/optimization.html#zquery-constructors-and-operators" class="sidebar-link">ZQuery constructors and operators</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/optimization.html#using-zquery-with-caliban" class="sidebar-link">Using ZQuery with Caliban</a></li></ul></li><li><a href="/caliban/docs/validation.html" class="sidebar-link">Validation</a></li><li><a href="/caliban/docs/introspection.html" class="sidebar-link">Introspection</a></li><li><a href="/caliban/docs/interop.html" class="sidebar-link">Interop (Cats, Monix)</a></li><li><a href="/caliban/docs/client.html" class="sidebar-link">GraphQL Client</a></li><li><a href="/caliban/docs/examples.html" class="sidebar-link">Examples</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="query-optimization"><a href="#query-optimization" class="header-anchor">#</a> Query optimization</h1> <p>A GraphQL query may request multiple fields that are using the same resolver. It's not a problem if the resolver is a simple value, but it can be less than optimal when the resolver runs an effect (such as reading from a database).</p> <p>We might want to:</p> <ul><li><strong>cache</strong> identical queries (deduplication)</li> <li><strong>batch</strong> queries to the same source</li></ul> <p>This is possible in Caliban using the <code>ZQuery</code> data type.</p> <h2 id="introducing-zquery"><a href="#introducing-zquery" class="header-anchor">#</a> Introducing ZQuery</h2> <p>A <code>ZQuery[R, E, A]</code> is a purely functional description of an effectual query that may contain requests to one or more data sources. Similarly to <code>ZIO[R, E, A]</code>, it requires an environment <code>R</code>, may fail with an <code>E</code> or succeed with an <code>A</code>. All requests that do not need to be performed sequentially will automatically be batched, allowing for aggressive data source specific optimizations. Requests will also automatically be deduplicated and cached.</p> <p>This allows for writing queries in a high level, compositional style, with confidence that they will automatically be optimized. For example, consider the following query from a user service.</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">val</span> getAllUserIds<span class="token operator">:</span> ZQuery<span class="token punctuation">[</span><span class="token builtin">Any</span><span class="token punctuation">,</span> <span class="token builtin">Nothing</span><span class="token punctuation">,</span> List<span class="token punctuation">[</span><span class="token builtin">Int</span><span class="token punctuation">]</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token operator">?</span><span class="token operator">?</span><span class="token operator">?</span> <span class="token keyword">def</span> getUserNameById<span class="token punctuation">(</span>id<span class="token operator">:</span> <span class="token builtin">Int</span><span class="token punctuation">)</span><span class="token operator">:</span> ZQuery<span class="token punctuation">[</span><span class="token builtin">Any</span><span class="token punctuation">,</span> <span class="token builtin">Nothing</span><span class="token punctuation">,</span> <span class="token builtin">String</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token operator">?</span><span class="token operator">?</span><span class="token operator">?</span> <span class="token keyword">for</span> <span class="token punctuation">{</span> @@ -76,6 +76,6 @@ </a> → </span></p></div> </main></div><div class="global-ui"></div></div> - <script src="/caliban/assets/js/app.098f98e8.js" defer></script><script src="/caliban/assets/js/2.fa272699.js" defer></script><script src="/caliban/assets/js/12.40588870.js" defer></script> + <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/13.d315a1c7.js" defer></script> </body> </html> diff --git a/docs/docs/schema.html b/docs/docs/schema.html index e7d5a58ff..51a92e084 100644 --- a/docs/docs/schema.html +++ b/docs/docs/schema.html @@ -4,12 +4,12 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>Schemas | Caliban</title> - <meta name="description" content="Functional GraphQL backend in Scala"> - <meta name="generator" content="VuePress 1.3.0"> + <meta name="description" content="Functional GraphQL library for Scala"> + <meta name="generator" content="VuePress 1.3.1"> <link rel="icon" href="/caliban/caliban.png"> - <link rel="preload" href="/caliban/assets/css/0.styles.ce455d84.css" as="style"><link rel="preload" href="/caliban/assets/js/app.098f98e8.js" as="script"><link rel="preload" href="/caliban/assets/js/2.fa272699.js" as="script"><link rel="preload" href="/caliban/assets/js/13.a0ebd332.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.b8fd5856.js"><link rel="prefetch" href="/caliban/assets/js/11.151b57de.js"><link rel="prefetch" href="/caliban/assets/js/12.40588870.js"><link rel="prefetch" href="/caliban/assets/js/14.fe3db0cd.js"><link rel="prefetch" href="/caliban/assets/js/15.a58fc205.js"><link rel="prefetch" href="/caliban/assets/js/16.09e4e2e8.js"><link rel="prefetch" href="/caliban/assets/js/3.af853996.js"><link rel="prefetch" href="/caliban/assets/js/4.b0dd307f.js"><link rel="prefetch" href="/caliban/assets/js/5.e6948aea.js"><link rel="prefetch" href="/caliban/assets/js/6.e0cf4477.js"><link rel="prefetch" href="/caliban/assets/js/7.a06094f2.js"><link rel="prefetch" href="/caliban/assets/js/8.abf14876.js"><link rel="prefetch" href="/caliban/assets/js/9.9cf833f6.js"> - <link rel="stylesheet" href="/caliban/assets/css/0.styles.ce455d84.css"> + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/14.b8b8c6ff.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.5f8b2c07.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.bc45abe0.js"><link rel="prefetch" href="/caliban/assets/js/13.d315a1c7.js"><link rel="prefetch" href="/caliban/assets/js/15.23ceaf26.js"><link rel="prefetch" href="/caliban/assets/js/16.f357ff30.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.57a8ce51.js"><link rel="prefetch" href="/caliban/assets/js/8.6272775d.js"><link rel="prefetch" href="/caliban/assets/js/9.417f11bf.js"> + <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> </head> <body> <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/caliban/" class="home-link router-link-active"><img src="/caliban/caliban.svg" alt="Caliban" class="logo"> <span class="site-name can-hide">Caliban</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/caliban/docs/" class="nav-link router-link-active"> @@ -32,12 +32,12 @@ Github <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div><div class="nav-item"><a href="https://javadoc.io/doc/com.github.ghostdogpr/caliban_2.12/" target="_blank" rel="noopener noreferrer" class="nav-link external"> Scaladoc - <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>Caliban</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/caliban/docs/" class="sidebar-link">Getting Started</a></li><li><a href="/caliban/docs/schema.html" class="active sidebar-link">Schemas</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/caliban/docs/schema.html#enum-and-union" class="sidebar-link">Enum and union</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/schema.html#arguments" class="sidebar-link">Arguments</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/schema.html#effects" class="sidebar-link">Effects</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/schema.html#annotations" class="sidebar-link">Annotations</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/schema.html#custom-types" class="sidebar-link">Custom types</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/schema.html#code-generation" class="sidebar-link">Code generation</a></li></ul></li><li><a href="/caliban/docs/middleware.html" class="sidebar-link">Middleware</a></li><li><a href="/caliban/docs/optimization.html" class="sidebar-link">Query optimization</a></li><li><a href="/caliban/docs/validation.html" class="sidebar-link">Validation</a></li><li><a href="/caliban/docs/introspection.html" class="sidebar-link">Introspection</a></li><li><a href="/caliban/docs/interop.html" class="sidebar-link">Interop (Cats, Monix)</a></li><li><a href="/caliban/docs/examples.html" class="sidebar-link">Examples</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="schemas"><a href="#schemas" class="header-anchor">#</a> Schemas</h1> <p>A GraphQL schema will be derived automatically at compile-time (no reflection) from the types present in your resolver. + <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>Caliban</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/caliban/docs/" class="sidebar-link">Getting Started</a></li><li><a href="/caliban/docs/schema.html" class="active sidebar-link">Schemas</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/caliban/docs/schema.html#enums-unions-interfaces" class="sidebar-link">Enums, unions, interfaces</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/schema.html#arguments" class="sidebar-link">Arguments</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/schema.html#effects" class="sidebar-link">Effects</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/schema.html#annotations" class="sidebar-link">Annotations</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/schema.html#custom-types" class="sidebar-link">Custom types</a></li><li class="sidebar-sub-header"><a href="/caliban/docs/schema.html#code-generation" class="sidebar-link">Code generation</a></li></ul></li><li><a href="/caliban/docs/middleware.html" class="sidebar-link">Middleware</a></li><li><a href="/caliban/docs/optimization.html" class="sidebar-link">Query optimization</a></li><li><a href="/caliban/docs/validation.html" class="sidebar-link">Validation</a></li><li><a href="/caliban/docs/introspection.html" class="sidebar-link">Introspection</a></li><li><a href="/caliban/docs/interop.html" class="sidebar-link">Interop (Cats, Monix)</a></li><li><a href="/caliban/docs/client.html" class="sidebar-link">GraphQL Client</a></li><li><a href="/caliban/docs/examples.html" class="sidebar-link">Examples</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="schemas"><a href="#schemas" class="header-anchor">#</a> Schemas</h1> <p>A GraphQL schema will be derived automatically at compile-time (no reflection) from the types present in your resolver. The table below shows how common Scala types are converted to GraphQL types.</p> <table><thead><tr><th>Scala Type</th> <th>GraphQL Type</th></tr></thead> <tbody><tr><td>Boolean</td> <td>Boolean</td></tr> <tr><td>Int</td> <td>Int</td></tr> <tr><td>Float</td> <td>Float</td></tr> <tr><td>Double</td> <td>Float</td></tr> <tr><td>String</td> <td>String</td></tr> <tr><td>java.util.UUID</td> <td>ID</td></tr> <tr><td>Unit</td> <td>Unit (custom scalar)</td></tr> <tr><td>Long</td> <td>Long (custom scalar)</td></tr> <tr><td>BigInt</td> <td>BigInt (custom scalar)</td></tr> <tr><td>BigDecimal</td> <td>BigDecimal (custom scalar)</td></tr> <tr><td>Case Class</td> <td>Object</td></tr> <tr><td>Sealed Trait</td> <td>Enum or Union</td></tr> <tr><td>Option[A]</td> <td>Nullable A</td></tr> <tr><td>List[A]</td> <td>List of A</td></tr> <tr><td>Set[A]</td> <td>List of A</td></tr> <tr><td>A => B</td> <td>A and B</td></tr> <tr><td>(A, B)</td> <td>Object with 2 fields <code>_1</code> and <code>_2</code></td></tr> <tr><td>Either[A, B]</td> <td>Object with 2 nullable fields <code>left</code> and <code>right</code></td></tr> <tr><td>Map[A, B]</td> <td>List of Object with 2 fields <code>key</code> and <code>value</code></td></tr> <tr><td>ZIO[R, Nothing, A]</td> <td>A</td></tr> <tr><td>ZIO[R, E, A]</td> <td>Nullable A</td></tr> <tr><td>Future[A]</td> <td>Nullable A</td></tr> <tr><td>ZStream[R, E, A]</td> <td>A (subscription) or List of A (query, mutation)</td></tr> <tr><td>Json (from <a href="https://github.com/circe/circe" target="_blank" rel="noopener noreferrer">Circe<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>)</td> <td>Json (custom scalar, need <code>import caliban.interop.circe.json._</code>)</td></tr></tbody></table> <p>See the <a href="#custom-types">Custom Types</a> section to find out how to support your own types.</p> <p>If you want Caliban to support other standard types, feel free to <a href="https://github.com/ghostdogpr/caliban/issues" target="_blank" rel="noopener noreferrer">file an issue<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> or even a PR.</p> <div class="custom-block warning"><p class="custom-block-title">Schema derivation issues</p> <p>Magnolia (the library used to derive the schema at compile-time) sometimes has some trouble generating schemas with a lot of nested types, or types reused in multiple places. to deal with this, you can declare schemas for your case classes and sealed traits explicitly:</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">implicit</span> <span class="token keyword">val</span> roleSchema <span class="token operator">=</span> Schema<span class="token punctuation">.</span>gen<span class="token punctuation">[</span>Role<span class="token punctuation">]</span> <span class="token keyword">implicit</span> <span class="token keyword">val</span> characterSchema <span class="token operator">=</span> Schema<span class="token punctuation">.</span>gen<span class="token punctuation">[</span>Character<span class="token punctuation">]</span> </code></pre></div><p>Make sure those implicits are in scope when you call <code>graphQL(...)</code>. This will make Magnolia's job easier by pre-generating schemas for those classes and re-using them when needed. -This will also improve compilation times and generate less bytecode.</p></div> <h2 id="enum-and-union"><a href="#enum-and-union" class="header-anchor">#</a> Enum and union</h2> <p>A sealed trait will be converted to a different GraphQL type depending on its content:</p> <ul><li>a sealed trait with only case objects will be converted to an <code>ENUM</code></li> <li>a sealed trait with only case classes will be converted to a <code>UNION</code></li></ul> <p>GraphQL does not support empty objects, so in case a sealed trait mixes case classes and case objects, a union type will be created and the case objects will have a "fake" field named <code>_</code> which is not queryable.</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">sealed</span> <span class="token keyword">trait</span> ORIGIN +This will also improve compilation times and generate less bytecode.</p></div> <h2 id="enums-unions-interfaces"><a href="#enums-unions-interfaces" class="header-anchor">#</a> Enums, unions, interfaces</h2> <p>A sealed trait will be converted to a different GraphQL type depending on its content:</p> <ul><li>a sealed trait with only case objects will be converted to an <code>ENUM</code></li> <li>a sealed trait with only case classes will be converted to a <code>UNION</code></li></ul> <p>GraphQL does not support empty objects, so in case a sealed trait mixes case classes and case objects, a union type will be created and the case objects will have a "fake" field named <code>_</code> which is not queryable.</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">sealed</span> <span class="token keyword">trait</span> ORIGIN <span class="token keyword">object</span> ORIGIN <span class="token punctuation">{</span> <span class="token keyword">case</span> <span class="token keyword">object</span> EARTH <span class="token keyword">extends</span> ORIGIN <span class="token keyword">case</span> <span class="token keyword">object</span> MARS <span class="token keyword">extends</span> ORIGIN @@ -67,7 +67,8 @@ <span class="token keyword">type</span> <span class="token class-name">Mechanic</span> <span class="token punctuation">{</span> <span class="token attr-name">_</span><span class="token punctuation">:</span> Boolean<span class="token operator">!</span> <span class="token punctuation">}</span> -</code></pre></div><h2 id="arguments"><a href="#arguments" class="header-anchor">#</a> Arguments</h2> <p>To declare a field that take arguments, create a dedicated case class representing the arguments and make the field a <em>function</em> from this class to the result type.</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">case</span> <span class="token keyword">class</span> FilterArgs<span class="token punctuation">(</span>origin<span class="token operator">:</span> Option<span class="token punctuation">[</span>Origin<span class="token punctuation">]</span><span class="token punctuation">)</span> +</code></pre></div><p>If you prefer an <code>Interface</code> instead of a <code>Union</code> type, add the <code>@GQLInterface</code> annotation to your sealed trait. +An interface will be created with all the fields that are common to the case classes extending the sealed trait.</p> <h2 id="arguments"><a href="#arguments" class="header-anchor">#</a> Arguments</h2> <p>To declare a field that take arguments, create a dedicated case class representing the arguments and make the field a <em>function</em> from this class to the result type.</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">case</span> <span class="token keyword">class</span> FilterArgs<span class="token punctuation">(</span>origin<span class="token operator">:</span> Option<span class="token punctuation">[</span>Origin<span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token keyword">case</span> <span class="token keyword">class</span> Queries<span class="token punctuation">(</span>characters<span class="token operator">:</span> FilterArgs <span class="token keyword">=></span> List<span class="token punctuation">[</span>Character<span class="token punctuation">]</span><span class="token punctuation">)</span> </code></pre></div><p>The snippet above will produce the following GraphQL type:</p> <div class="language-graphql extra-class"><pre class="language-graphql"><code><span class="token keyword">type</span> <span class="token class-name">Queries</span> <span class="token punctuation">{</span> <span class="token attr-name">characters</span><span class="token punctuation">(</span><span class="token attr-name">origin</span><span class="token punctuation">:</span> Origin<span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token punctuation">[</span>Character<span class="token operator">!</span><span class="token punctuation">]</span><span class="token operator">!</span> @@ -76,16 +77,16 @@ character<span class="token operator">:</span> CharacterName <span class="token keyword">=></span> RIO<span class="token punctuation">[</span>Console<span class="token punctuation">,</span> Character<span class="token punctuation">]</span><span class="token punctuation">)</span> </code></pre></div><p>If you don't use ZIO environment (<code>R</code> = <code>Any</code>), there is nothing special to do to get it working.</p> <p>If you require a ZIO environment, you will need to have the content of <code>caliban.schema.GenericSchema[R]</code> for your custom <code>R</code> in scope when you call <code>graphQL(...)</code>.</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">object</span> schema <span class="token keyword">extends</span> GenericSchema<span class="token punctuation">[</span>MyEnv<span class="token punctuation">]</span> <span class="token keyword">import</span> schema<span class="token punctuation">.</span>_ -</code></pre></div><h2 id="annotations"><a href="#annotations" class="header-anchor">#</a> Annotations</h2> <p>Caliban supports a few annotations to enrich data types:</p> <ul><li><code>@GQLName("name")</code> allows you to specify a different name for a data type or a field.</li> <li><code>@GQLInputName("name")</code> allows you to specify a different name for a data type used as an input (by default, the suffix <code>Input</code> is appended to the type name).</li> <li><code>@GQLDescription("description")</code> lets you provide a description for a data type or field. This description will be visible when your schema is introspected.</li> <li><code>@GQLDeprecated("reason")</code> allows deprecating a field or an enum value.</li></ul> <h2 id="custom-types"><a href="#custom-types" class="header-anchor">#</a> Custom types</h2> <p>Caliban provides auto-derivation for common types such as <code>Int</code>, <code>String</code>, <code>List</code>, <code>Option</code>, etc. but you can also support your own types by providing an implicit instance of <code>caliban.schema.Schema</code>.</p> <p>An easy way to do this is to reuse existing instances and use <code>contramap</code> to map from your type to the original type. Here's an example of creating an instance for <a href="https://github.com/fthomas/refined" target="_blank" rel="noopener noreferrer">refined<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>'s <code>NonEmptyString</code> reusing existing instance for <code>String</code>:</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">import</span> <span class="token namespace">caliban<span class="token punctuation">.</span>schema</span><span class="token punctuation">.</span>_ +</code></pre></div><h2 id="annotations"><a href="#annotations" class="header-anchor">#</a> Annotations</h2> <p>Caliban supports a few annotations to enrich data types:</p> <ul><li><code>@GQLName("name")</code> allows you to specify a different name for a data type or a field.</li> <li><code>@GQLInputName("name")</code> allows you to specify a different name for a data type used as an input (by default, the suffix <code>Input</code> is appended to the type name).</li> <li><code>@GQLDescription("description")</code> lets you provide a description for a data type or field. This description will be visible when your schema is introspected.</li> <li><code>@GQLDeprecated("reason")</code> allows deprecating a field or an enum value.</li> <li><code>@GQLInterface</code> to force a sealed trait generating an interface instead of a union.</li> <li><code>@GQLDirective(directive: Directive)</code> to add a directive to a field or type.</li></ul> <h2 id="custom-types"><a href="#custom-types" class="header-anchor">#</a> Custom types</h2> <p>Caliban provides auto-derivation for common types such as <code>Int</code>, <code>String</code>, <code>List</code>, <code>Option</code>, etc. but you can also support your own types by providing an implicit instance of <code>caliban.schema.Schema</code>.</p> <p>An easy way to do this is to reuse existing instances and use <code>contramap</code> to map from your type to the original type. Here's an example of creating an instance for <a href="https://github.com/fthomas/refined" target="_blank" rel="noopener noreferrer">refined<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>'s <code>NonEmptyString</code> reusing existing instance for <code>String</code>:</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">import</span> <span class="token namespace">caliban<span class="token punctuation">.</span>schema</span><span class="token punctuation">.</span>_ <span class="token keyword">implicit</span> <span class="token keyword">val</span> nonEmptyStringSchema<span class="token operator">:</span> Schema<span class="token punctuation">[</span><span class="token builtin">Any</span><span class="token punctuation">,</span> NonEmptyString<span class="token punctuation">]</span> <span class="token operator">=</span> Schema<span class="token punctuation">.</span>stringSchema<span class="token punctuation">.</span>contramap<span class="token punctuation">(</span>_<span class="token punctuation">.</span>value<span class="token punctuation">)</span> </code></pre></div><p>You can also use the <code>scalarSchema</code> helper to create your own scalar types, providing a name, an optional description, and a function from your type to a <code>ResponseValue</code>:</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">import</span> <span class="token namespace">caliban<span class="token punctuation">.</span>schema</span><span class="token punctuation">.</span>_ <span class="token keyword">implicit</span> <span class="token keyword">val</span> unitSchema<span class="token operator">:</span> Schema<span class="token punctuation">[</span><span class="token builtin">Any</span><span class="token punctuation">,</span> <span class="token builtin">Unit</span><span class="token punctuation">]</span> <span class="token operator">=</span> scalarSchema<span class="token punctuation">(</span><span class="token string">"Unit"</span><span class="token punctuation">,</span> None<span class="token punctuation">,</span> _ <span class="token keyword">=></span> ObjectValue<span class="token punctuation">(</span>Nil<span class="token punctuation">)</span><span class="token punctuation">)</span> -</code></pre></div><h2 id="code-generation"><a href="#code-generation" class="header-anchor">#</a> Code generation</h2> <p>Caliban can automatically generate Scala code from a GraphQL schema.</p> <p>In order to use this feature, add the <code>caliban-codegen</code> sbt plugin to your project and enable it.</p> <div class="language-scala extra-class"><pre class="language-scala"><code>addSbtPlugin<span class="token punctuation">(</span><span class="token string">"com.github.ghostdogpr"</span> <span class="token operator">%</span> <span class="token string">"caliban-codegen"</span> <span class="token operator">%</span> <span class="token string">"0.5.2"</span><span class="token punctuation">)</span> +</code></pre></div><h2 id="code-generation"><a href="#code-generation" class="header-anchor">#</a> Code generation</h2> <p>Caliban can automatically generate Scala code from a GraphQL schema.</p> <p>In order to use this feature, add the <code>caliban-codegen</code> sbt plugin to your project and enable it.</p> <div class="language-scala extra-class"><pre class="language-scala"><code>addSbtPlugin<span class="token punctuation">(</span><span class="token string">"com.github.ghostdogpr"</span> <span class="token operator">%</span> <span class="token string">"caliban-codegen"</span> <span class="token operator">%</span> <span class="token string">"0.6.0"</span><span class="token punctuation">)</span> enablePlugins<span class="token punctuation">(</span>CodegenPlugin<span class="token punctuation">)</span> -</code></pre></div><p>Then call the <code>codegen</code> sbt command.</p> <div class="language-scala extra-class"><pre class="language-scala"><code>calibanGenSchema schemaPath outPath <span class="token operator">?</span>scalafmtPath +</code></pre></div><p>Then call the <code>calibanGenSchema</code> sbt command.</p> <div class="language-scala extra-class"><pre class="language-scala"><code>calibanGenSchema schemaPath outPath <span class="token operator">?</span>scalafmtPath -calibanGenSchema project<span class="token operator">/</span>schema<span class="token punctuation">.</span>json src<span class="token operator">/</span>main<span class="token operator">/</span>GQLSchema<span class="token punctuation">.</span>scala -</code></pre></div><p>This command will create a Scala file in <code>outputPath</code> containing all the types defined in the provided GraphQL schema defined at <code>schemaPath</code>. The generated code will be formatted with Scalafmt using the configuration defined by <code>scalafmtPath</code>.</p> <div class="custom-block warning"><p class="custom-block-title">Unsupported features</p> <p>Some features are not supported by Caliban and will cause an error during code generation:</p> <ul><li>interfaces</li> <li>extensions</li></ul></div></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev"> +calibanGenSchema project<span class="token operator">/</span>schema<span class="token punctuation">.</span>graphql src<span class="token operator">/</span>main<span class="token operator">/</span>MyAPI<span class="token punctuation">.</span>scala +</code></pre></div><p>This command will create a Scala file in <code>outputPath</code> containing all the types defined in the provided GraphQL schema defined at <code>schemaPath</code>. The generated code will be formatted with Scalafmt using the configuration defined by <code>scalafmtPath</code> (default: <code>.scalafmt.conf</code>).</p> <div class="custom-block warning"><p class="custom-block-title">Unsupported features</p> <p>Some features are not supported by Caliban and will cause an error during code generation:</p> <ul><li>interfaces</li> <li>extensions</li></ul></div></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev"> ← <a href="/caliban/docs/" class="prev router-link-active"> Getting Started @@ -94,6 +95,6 @@ </a> → </span></p></div> </main></div><div class="global-ui"></div></div> - <script src="/caliban/assets/js/app.098f98e8.js" defer></script><script src="/caliban/assets/js/2.fa272699.js" defer></script><script src="/caliban/assets/js/13.a0ebd332.js" defer></script> + <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/14.b8b8c6ff.js" defer></script> </body> </html> diff --git a/docs/docs/validation.html b/docs/docs/validation.html index ca25936c7..dc522ee89 100644 --- a/docs/docs/validation.html +++ b/docs/docs/validation.html @@ -4,12 +4,12 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>Validation | Caliban</title> - <meta name="description" content="Functional GraphQL backend in Scala"> - <meta name="generator" content="VuePress 1.3.0"> + <meta name="description" content="Functional GraphQL library for Scala"> + <meta name="generator" content="VuePress 1.3.1"> <link rel="icon" href="/caliban/caliban.png"> - <link rel="preload" href="/caliban/assets/css/0.styles.ce455d84.css" as="style"><link rel="preload" href="/caliban/assets/js/app.098f98e8.js" as="script"><link rel="preload" href="/caliban/assets/js/2.fa272699.js" as="script"><link rel="preload" href="/caliban/assets/js/14.fe3db0cd.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.b8fd5856.js"><link rel="prefetch" href="/caliban/assets/js/11.151b57de.js"><link rel="prefetch" href="/caliban/assets/js/12.40588870.js"><link rel="prefetch" href="/caliban/assets/js/13.a0ebd332.js"><link rel="prefetch" href="/caliban/assets/js/15.a58fc205.js"><link rel="prefetch" href="/caliban/assets/js/16.09e4e2e8.js"><link rel="prefetch" href="/caliban/assets/js/3.af853996.js"><link rel="prefetch" href="/caliban/assets/js/4.b0dd307f.js"><link rel="prefetch" href="/caliban/assets/js/5.e6948aea.js"><link rel="prefetch" href="/caliban/assets/js/6.e0cf4477.js"><link rel="prefetch" href="/caliban/assets/js/7.a06094f2.js"><link rel="prefetch" href="/caliban/assets/js/8.abf14876.js"><link rel="prefetch" href="/caliban/assets/js/9.9cf833f6.js"> - <link rel="stylesheet" href="/caliban/assets/css/0.styles.ce455d84.css"> + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/15.23ceaf26.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.5f8b2c07.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.bc45abe0.js"><link rel="prefetch" href="/caliban/assets/js/13.d315a1c7.js"><link rel="prefetch" href="/caliban/assets/js/14.b8b8c6ff.js"><link rel="prefetch" href="/caliban/assets/js/16.f357ff30.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.57a8ce51.js"><link rel="prefetch" href="/caliban/assets/js/8.6272775d.js"><link rel="prefetch" href="/caliban/assets/js/9.417f11bf.js"> + <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> </head> <body> <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/caliban/" class="home-link router-link-active"><img src="/caliban/caliban.svg" alt="Caliban" class="logo"> <span class="site-name can-hide">Caliban</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/caliban/docs/" class="nav-link router-link-active"> @@ -32,7 +32,7 @@ Github <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div><div class="nav-item"><a href="https://javadoc.io/doc/com.github.ghostdogpr/caliban_2.12/" target="_blank" rel="noopener noreferrer" class="nav-link external"> Scaladoc - <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>Caliban</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/caliban/docs/" class="sidebar-link">Getting Started</a></li><li><a href="/caliban/docs/schema.html" class="sidebar-link">Schemas</a></li><li><a href="/caliban/docs/middleware.html" class="sidebar-link">Middleware</a></li><li><a href="/caliban/docs/optimization.html" class="sidebar-link">Query optimization</a></li><li><a href="/caliban/docs/validation.html" class="active sidebar-link">Validation</a></li><li><a href="/caliban/docs/introspection.html" class="sidebar-link">Introspection</a></li><li><a href="/caliban/docs/interop.html" class="sidebar-link">Interop (Cats, Monix)</a></li><li><a href="/caliban/docs/examples.html" class="sidebar-link">Examples</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="validation"><a href="#validation" class="header-anchor">#</a> Validation</h1> <p>Caliban provides a little macro called <code>gqldoc</code> that can check at <strong>compile-time</strong> that a GraphQL query (a <em>document</em> to be exact) has valid syntax.</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">import</span> caliban<span class="token punctuation">.</span>Macros<span class="token punctuation">.</span>gqldoc + <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>Caliban</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/caliban/docs/" class="sidebar-link">Getting Started</a></li><li><a href="/caliban/docs/schema.html" class="sidebar-link">Schemas</a></li><li><a href="/caliban/docs/middleware.html" class="sidebar-link">Middleware</a></li><li><a href="/caliban/docs/optimization.html" class="sidebar-link">Query optimization</a></li><li><a href="/caliban/docs/validation.html" class="active sidebar-link">Validation</a></li><li><a href="/caliban/docs/introspection.html" class="sidebar-link">Introspection</a></li><li><a href="/caliban/docs/interop.html" class="sidebar-link">Interop (Cats, Monix)</a></li><li><a href="/caliban/docs/client.html" class="sidebar-link">GraphQL Client</a></li><li><a href="/caliban/docs/examples.html" class="sidebar-link">Examples</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="validation"><a href="#validation" class="header-anchor">#</a> Validation</h1> <p>Caliban provides a little macro called <code>gqldoc</code> that can check at <strong>compile-time</strong> that a GraphQL query (a <em>document</em> to be exact) has valid syntax.</p> <div class="language-scala extra-class"><pre class="language-scala"><code><span class="token keyword">import</span> caliban<span class="token punctuation">.</span>Macros<span class="token punctuation">.</span>gqldoc <span class="token keyword">val</span> query <span class="token operator">=</span> gqldoc<span class="token punctuation">(</span><span class="token triple-quoted-string string">""" query test { @@ -50,6 +50,6 @@ </a> → </span></p></div> </main></div><div class="global-ui"></div></div> - <script src="/caliban/assets/js/app.098f98e8.js" defer></script><script src="/caliban/assets/js/2.fa272699.js" defer></script><script src="/caliban/assets/js/14.fe3db0cd.js" defer></script> + <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/15.23ceaf26.js" defer></script> </body> </html> diff --git a/docs/index.html b/docs/index.html index e676493f1..428fd6690 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,12 +4,12 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>Caliban</title> - <meta name="description" content="Functional GraphQL backend in Scala"> - <meta name="generator" content="VuePress 1.3.0"> + <meta name="description" content="Functional GraphQL library for Scala"> + <meta name="generator" content="VuePress 1.3.1"> <link rel="icon" href="/caliban/caliban.png"> - <link rel="preload" href="/caliban/assets/css/0.styles.ce455d84.css" as="style"><link rel="preload" href="/caliban/assets/js/app.098f98e8.js" as="script"><link rel="preload" href="/caliban/assets/js/2.fa272699.js" as="script"><link rel="preload" href="/caliban/assets/js/5.e6948aea.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.b8fd5856.js"><link rel="prefetch" href="/caliban/assets/js/11.151b57de.js"><link rel="prefetch" href="/caliban/assets/js/12.40588870.js"><link rel="prefetch" href="/caliban/assets/js/13.a0ebd332.js"><link rel="prefetch" href="/caliban/assets/js/14.fe3db0cd.js"><link rel="prefetch" href="/caliban/assets/js/15.a58fc205.js"><link rel="prefetch" href="/caliban/assets/js/16.09e4e2e8.js"><link rel="prefetch" href="/caliban/assets/js/3.af853996.js"><link rel="prefetch" href="/caliban/assets/js/4.b0dd307f.js"><link rel="prefetch" href="/caliban/assets/js/6.e0cf4477.js"><link rel="prefetch" href="/caliban/assets/js/7.a06094f2.js"><link rel="prefetch" href="/caliban/assets/js/8.abf14876.js"><link rel="prefetch" href="/caliban/assets/js/9.9cf833f6.js"> - <link rel="stylesheet" href="/caliban/assets/css/0.styles.ce455d84.css"> + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/5.5defc76c.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.5f8b2c07.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.bc45abe0.js"><link rel="prefetch" href="/caliban/assets/js/13.d315a1c7.js"><link rel="prefetch" href="/caliban/assets/js/14.b8b8c6ff.js"><link rel="prefetch" href="/caliban/assets/js/15.23ceaf26.js"><link rel="prefetch" href="/caliban/assets/js/16.f357ff30.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.57a8ce51.js"><link rel="prefetch" href="/caliban/assets/js/8.6272775d.js"><link rel="prefetch" href="/caliban/assets/js/9.417f11bf.js"> + <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> </head> <body> <div id="app" data-server-rendered="true"><div class="theme-container no-sidebar"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/caliban/" class="home-link router-link-exact-active router-link-active"><img src="/caliban/caliban.svg" alt="Caliban" class="logo"> <span class="site-name can-hide">Caliban</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/caliban/docs/" class="nav-link"> @@ -35,10 +35,10 @@ <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <!----> </aside> <main aria-labelledby="main-title" class="home"><header class="hero"><img src="/caliban/caliban.svg" alt="hero"> <h1 id="main-title"> Caliban </h1> <p class="description"> - Functional GraphQL backend in Scala + Functional GraphQL library for Scala </p> <p class="action"><a href="/caliban/docs/" class="nav-link action-button"> Get Started → </a></p></header> <div class="features"><div class="feature"><h2>Purely functional</h2> <p>All interfaces are pure and types are referentially transparent.</p></div><div class="feature"><h2>Minimal boilerplate</h2> <p>No need to manually define a schema for every type in your API.</p></div><div class="feature"><h2>Type safe schema</h2> <p>Schema is derived at compile-time. Resolver is provided at runtime.</p></div></div> <div class="theme-default-content custom content__default"></div> <!----></main></div><div class="global-ui"></div></div> - <script src="/caliban/assets/js/app.098f98e8.js" defer></script><script src="/caliban/assets/js/2.fa272699.js" defer></script><script src="/caliban/assets/js/5.e6948aea.js" defer></script> + <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/5.5defc76c.js" defer></script> </body> </html> diff --git a/docs/resources/index.html b/docs/resources/index.html index 9e1595401..28b6d28f3 100644 --- a/docs/resources/index.html +++ b/docs/resources/index.html @@ -4,12 +4,12 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>Resources | Caliban</title> - <meta name="description" content="Functional GraphQL backend in Scala"> - <meta name="generator" content="VuePress 1.3.0"> + <meta name="description" content="Functional GraphQL library for Scala"> + <meta name="generator" content="VuePress 1.3.1"> <link rel="icon" href="/caliban/caliban.png"> - <link rel="preload" href="/caliban/assets/css/0.styles.ce455d84.css" as="style"><link rel="preload" href="/caliban/assets/js/app.098f98e8.js" as="script"><link rel="preload" href="/caliban/assets/js/2.fa272699.js" as="script"><link rel="preload" href="/caliban/assets/js/15.a58fc205.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.b8fd5856.js"><link rel="prefetch" href="/caliban/assets/js/11.151b57de.js"><link rel="prefetch" href="/caliban/assets/js/12.40588870.js"><link rel="prefetch" href="/caliban/assets/js/13.a0ebd332.js"><link rel="prefetch" href="/caliban/assets/js/14.fe3db0cd.js"><link rel="prefetch" href="/caliban/assets/js/16.09e4e2e8.js"><link rel="prefetch" href="/caliban/assets/js/3.af853996.js"><link rel="prefetch" href="/caliban/assets/js/4.b0dd307f.js"><link rel="prefetch" href="/caliban/assets/js/5.e6948aea.js"><link rel="prefetch" href="/caliban/assets/js/6.e0cf4477.js"><link rel="prefetch" href="/caliban/assets/js/7.a06094f2.js"><link rel="prefetch" href="/caliban/assets/js/8.abf14876.js"><link rel="prefetch" href="/caliban/assets/js/9.9cf833f6.js"> - <link rel="stylesheet" href="/caliban/assets/css/0.styles.ce455d84.css"> + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/16.f357ff30.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.5f8b2c07.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.bc45abe0.js"><link rel="prefetch" href="/caliban/assets/js/13.d315a1c7.js"><link rel="prefetch" href="/caliban/assets/js/14.b8b8c6ff.js"><link rel="prefetch" href="/caliban/assets/js/15.23ceaf26.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.57a8ce51.js"><link rel="prefetch" href="/caliban/assets/js/8.6272775d.js"><link rel="prefetch" href="/caliban/assets/js/9.417f11bf.js"> + <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> </head> <body> <div id="app" data-server-rendered="true"><div class="theme-container no-sidebar"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/caliban/" class="home-link router-link-active"><img src="/caliban/caliban.svg" alt="Caliban" class="logo"> <span class="site-name can-hide">Caliban</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/caliban/docs/" class="nav-link"> @@ -34,6 +34,6 @@ Scaladoc <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <!----> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="resources"><a href="#resources" class="header-anchor">#</a> Resources</h1> <h2 id="talks"><a href="#talks" class="header-anchor">#</a> Talks</h2> <ul><li><a href="https://www.youtube.com/watch?v=OC8PbviYUlQ" target="_blank" rel="noopener noreferrer">Caliban: Designing a Functional GraphQL Library<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> by Pierre Ricadat at <a href="https://www.functionalscala.com/" target="_blank" rel="noopener noreferrer">Functional Scala<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> in December 2019 (slides available <a href="https://www.slideshare.net/PierreRicadat/designing-a-functional-graphql-library-204680947" target="_blank" rel="noopener noreferrer">here<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>)</li></ul> <h2 id="blog-articles"><a href="#blog-articles" class="header-anchor">#</a> Blog Articles</h2> <ul><li><strong><em>GraphQL in Scala with Caliban</em></strong> by Pierre Ricadat (February 2020) <ul><li><a href="https://medium.com/@ghostdogpr/graphql-in-scala-with-caliban-part-1-8ceb6099c3c2" target="_blank" rel="noopener noreferrer">Part 1: Turn a simple API into GraphQL<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li> <li><a href="https://medium.com/@ghostdogpr/graphql-in-scala-with-caliban-part-2-c7762110c0f9" target="_blank" rel="noopener noreferrer">Part 2: Query optimization<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li> <li><a href="https://medium.com/@ghostdogpr/graphql-in-scala-with-caliban-part-3-8962a02d5d64" target="_blank" rel="noopener noreferrer">Part 3: Customization<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li></ul></li> <li><a href="http://fokot.github.io/post/caliban-auth.html" target="_blank" rel="noopener noreferrer">Authentication in Caliban<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> by František Kocun (December 2019)</li></ul></div> <footer class="page-edit"><!----> <!----></footer> <!----> </main></div><div class="global-ui"></div></div> - <script src="/caliban/assets/js/app.098f98e8.js" defer></script><script src="/caliban/assets/js/2.fa272699.js" defer></script><script src="/caliban/assets/js/15.a58fc205.js" defer></script> + <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/16.f357ff30.js" defer></script> </body> </html> From d467e9173b92eb9a6b30312d2c57e59172bfdd7d Mon Sep 17 00:00:00 2001 From: Pierre Ricadat <ghostdogpr@gmail.com> Date: Wed, 26 Feb 2020 11:13:48 +0900 Subject: [PATCH 4/7] Add blog post to resources --- vuepress/docs/resources/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vuepress/docs/resources/README.md b/vuepress/docs/resources/README.md index 98469a6a0..5b3fbb5a9 100644 --- a/vuepress/docs/resources/README.md +++ b/vuepress/docs/resources/README.md @@ -5,8 +5,9 @@ ## Blog Articles +- [Caliban Client: a type-safe GraphQL Client for Scala and Scala.js](https://medium.com/@ghostdogpr/caliban-client-a-type-safe-graphql-client-for-scala-and-scala-js-718aa42c5ef7) by Pierre Ricadat (February 2020) - __*GraphQL in Scala with Caliban*__ by Pierre Ricadat (February 2020) - [Part 1: Turn a simple API into GraphQL](https://medium.com/@ghostdogpr/graphql-in-scala-with-caliban-part-1-8ceb6099c3c2) - [Part 2: Query optimization](https://medium.com/@ghostdogpr/graphql-in-scala-with-caliban-part-2-c7762110c0f9) - - [Part 3: Customization](https://medium.com/@ghostdogpr/graphql-in-scala-with-caliban-part-3-8962a02d5d64) + - [Part 3: Customization using wrappers](https://medium.com/@ghostdogpr/graphql-in-scala-with-caliban-part-3-8962a02d5d64) - [Authentication in Caliban](http://fokot.github.io/post/caliban-auth.html) by František Kocun (December 2019) \ No newline at end of file From ef5ae3fd40c9f57109c97b61bccc0d4a27f78f97 Mon Sep 17 00:00:00 2001 From: Pierre Ricadat <ghostdogpr@gmail.com> Date: Wed, 26 Feb 2020 02:15:04 +0000 Subject: [PATCH 5/7] [ci skip] update docs --- docs/404.html | 6 +++--- docs/about/index.html | 4 ++-- docs/assets/js/{10.5f8b2c07.js => 10.56cd42ab.js} | 2 +- docs/assets/js/{12.bc45abe0.js => 12.381b7c5a.js} | 2 +- docs/assets/js/{13.d315a1c7.js => 13.1c02ea8d.js} | 2 +- docs/assets/js/{14.b8b8c6ff.js => 14.0bd8bec9.js} | 2 +- docs/assets/js/{15.23ceaf26.js => 15.1f4e823e.js} | 2 +- docs/assets/js/16.285ebbb2.js | 1 + docs/assets/js/16.f357ff30.js | 1 - docs/assets/js/{7.57a8ce51.js => 7.16ad04b7.js} | 2 +- docs/assets/js/{8.6272775d.js => 8.4c5efb33.js} | 2 +- docs/assets/js/{9.417f11bf.js => 9.08ac8c9e.js} | 2 +- docs/assets/js/{app.d7caee50.js => app.3687d251.js} | 4 ++-- docs/docs/client.html | 4 ++-- docs/docs/examples.html | 4 ++-- docs/docs/index.html | 4 ++-- docs/docs/interop.html | 4 ++-- docs/docs/introspection.html | 4 ++-- docs/docs/middleware.html | 4 ++-- docs/docs/optimization.html | 4 ++-- docs/docs/schema.html | 4 ++-- docs/docs/validation.html | 4 ++-- docs/index.html | 4 ++-- docs/resources/index.html | 8 ++++---- 24 files changed, 40 insertions(+), 40 deletions(-) rename docs/assets/js/{10.5f8b2c07.js => 10.56cd42ab.js} (99%) rename docs/assets/js/{12.bc45abe0.js => 12.381b7c5a.js} (99%) rename docs/assets/js/{13.d315a1c7.js => 13.1c02ea8d.js} (99%) rename docs/assets/js/{14.b8b8c6ff.js => 14.0bd8bec9.js} (99%) rename docs/assets/js/{15.23ceaf26.js => 15.1f4e823e.js} (97%) create mode 100644 docs/assets/js/16.285ebbb2.js delete mode 100644 docs/assets/js/16.f357ff30.js rename docs/assets/js/{7.57a8ce51.js => 7.16ad04b7.js} (99%) rename docs/assets/js/{8.6272775d.js => 8.4c5efb33.js} (99%) rename docs/assets/js/{9.417f11bf.js => 9.08ac8c9e.js} (94%) rename docs/assets/js/{app.d7caee50.js => app.3687d251.js} (97%) diff --git a/docs/404.html b/docs/404.html index 4fc8410b3..d62617e79 100644 --- a/docs/404.html +++ b/docs/404.html @@ -8,13 +8,13 @@ <meta name="generator" content="VuePress 1.3.1"> <link rel="icon" href="/caliban/caliban.png"> - <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/4.f03b7f8e.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.5f8b2c07.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.bc45abe0.js"><link rel="prefetch" href="/caliban/assets/js/13.d315a1c7.js"><link rel="prefetch" href="/caliban/assets/js/14.b8b8c6ff.js"><link rel="prefetch" href="/caliban/assets/js/15.23ceaf26.js"><link rel="prefetch" href="/caliban/assets/js/16.f357ff30.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/2.07c68b8b.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.57a8ce51.js"><link rel="prefetch" href="/caliban/assets/js/8.6272775d.js"><link rel="prefetch" href="/caliban/assets/js/9.417f11bf.js"> + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.3687d251.js" as="script"><link rel="preload" href="/caliban/assets/js/4.f03b7f8e.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.56cd42ab.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.381b7c5a.js"><link rel="prefetch" href="/caliban/assets/js/13.1c02ea8d.js"><link rel="prefetch" href="/caliban/assets/js/14.0bd8bec9.js"><link rel="prefetch" href="/caliban/assets/js/15.1f4e823e.js"><link rel="prefetch" href="/caliban/assets/js/16.285ebbb2.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/2.07c68b8b.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.16ad04b7.js"><link rel="prefetch" href="/caliban/assets/js/8.4c5efb33.js"><link rel="prefetch" href="/caliban/assets/js/9.08ac8c9e.js"> <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> </head> <body> - <div id="app" data-server-rendered="true"><div class="theme-container"><div class="theme-default-content"><h1>404</h1> <blockquote>How did we get here?</blockquote> <a href="/caliban/" class="router-link-active"> + <div id="app" data-server-rendered="true"><div class="theme-container"><div class="theme-default-content"><h1>404</h1> <blockquote>Looks like we've got some broken links.</blockquote> <a href="/caliban/" class="router-link-active"> Take me home. </a></div></div><div class="global-ui"></div></div> - <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/4.f03b7f8e.js" defer></script> + <script src="/caliban/assets/js/app.3687d251.js" defer></script><script src="/caliban/assets/js/4.f03b7f8e.js" defer></script> </body> </html> diff --git a/docs/about/index.html b/docs/about/index.html index cf474a0c4..38e14b774 100644 --- a/docs/about/index.html +++ b/docs/about/index.html @@ -8,7 +8,7 @@ <meta name="generator" content="VuePress 1.3.1"> <link rel="icon" href="/caliban/caliban.png"> - <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/6.d222e5e8.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.5f8b2c07.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.bc45abe0.js"><link rel="prefetch" href="/caliban/assets/js/13.d315a1c7.js"><link rel="prefetch" href="/caliban/assets/js/14.b8b8c6ff.js"><link rel="prefetch" href="/caliban/assets/js/15.23ceaf26.js"><link rel="prefetch" href="/caliban/assets/js/16.f357ff30.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/7.57a8ce51.js"><link rel="prefetch" href="/caliban/assets/js/8.6272775d.js"><link rel="prefetch" href="/caliban/assets/js/9.417f11bf.js"> + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.3687d251.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/6.d222e5e8.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.56cd42ab.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.381b7c5a.js"><link rel="prefetch" href="/caliban/assets/js/13.1c02ea8d.js"><link rel="prefetch" href="/caliban/assets/js/14.0bd8bec9.js"><link rel="prefetch" href="/caliban/assets/js/15.1f4e823e.js"><link rel="prefetch" href="/caliban/assets/js/16.285ebbb2.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/7.16ad04b7.js"><link rel="prefetch" href="/caliban/assets/js/8.4c5efb33.js"><link rel="prefetch" href="/caliban/assets/js/9.08ac8c9e.js"> <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> </head> <body> @@ -33,6 +33,6 @@ <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div><div class="nav-item"><a href="https://javadoc.io/doc/com.github.ghostdogpr/caliban_2.12/" target="_blank" rel="noopener noreferrer" class="nav-link external"> Scaladoc <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <!----> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="about"><a href="#about" class="header-anchor">#</a> About</h1> <p>Caliban is a project developed by Pierre Ricadat aka <a href="https://github.com/ghostdogpr" target="_blank" rel="noopener noreferrer">@ghostdogpr<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>.</p> <p>The name is inspired by the SF novel and tv series <a href="https://en.wikipedia.org/wiki/Caliban%27s_War" target="_blank" rel="noopener noreferrer">The Expanse<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>.</p> <p><strong>Thanks</strong>:</p> <ul><li><a href="https://github.com/deckerst" target="_blank" rel="noopener noreferrer">@deckerst<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> for the logo</li> <li><a href="https://github.com/yoohaemin" target="_blank" rel="noopener noreferrer">@yoohaemin<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>, <a href="https://github.com/adamgfraser" target="_blank" rel="noopener noreferrer">@adamgfraser<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> and <a href="https://github.com/jdegoes" target="_blank" rel="noopener noreferrer">@jdegoes<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> for the early feedback</li> <li>the <a href="https://morpheusgraphql.com/" target="_blank" rel="noopener noreferrer">Morpheus<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> library in Haskell for the inspiration leading to the GraphQL backend implementation</li> <li>the <a href="https://github.com/dillonkearns/elm-graphql" target="_blank" rel="noopener noreferrer">elm-graphql<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> library for the inspiration leading to the GraphQL client implementation</li> <li>all Caliban's <a href="https://github.com/ghostdogpr/caliban/graphs/contributors" target="_blank" rel="noopener noreferrer">contributors<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>!</li></ul></div> <footer class="page-edit"><!----> <!----></footer> <!----> </main></div><div class="global-ui"></div></div> - <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/6.d222e5e8.js" defer></script> + <script src="/caliban/assets/js/app.3687d251.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/6.d222e5e8.js" defer></script> </body> </html> diff --git a/docs/assets/js/10.5f8b2c07.js b/docs/assets/js/10.56cd42ab.js similarity index 99% rename from docs/assets/js/10.5f8b2c07.js rename to docs/assets/js/10.56cd42ab.js index 9b3f7ff54..3f7cc3292 100644 --- a/docs/assets/js/10.5f8b2c07.js +++ b/docs/assets/js/10.56cd42ab.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[10],{212:function(t,a,s){"use strict";s.r(a);var n=s(28),e=Object(n.a)({},(function(){var t=this,a=t.$createElement,s=t._self._c||a;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"interop-cats-monix"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#interop-cats-monix"}},[t._v("#")]),t._v(" Interop (Cats, Monix)")]),t._v(" "),s("p",[t._v("If you prefer using "),s("a",{attrs:{href:"https://github.com/typelevel/cats-effect",target:"_blank",rel:"noopener noreferrer"}},[t._v("Cats Effect"),s("OutboundLink")],1),t._v(" or "),s("a",{attrs:{href:"https://github.com/monix/monix",target:"_blank",rel:"noopener noreferrer"}},[t._v("Monix"),s("OutboundLink")],1),t._v(" rather than ZIO, you can use the respective "),s("code",[t._v("caliban-cats")]),t._v(" and "),s("code",[t._v("caliban-monix")]),t._v(" modules.")]),t._v(" "),s("h2",{attrs:{id:"cats-effect"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#cats-effect"}},[t._v("#")]),t._v(" Cats Effect")]),t._v(" "),s("p",[t._v("You first need to import "),s("code",[t._v("caliban.interop.cats.implicits._")]),t._v(" and have an implicit "),s("code",[t._v("zio.Runtime")]),t._v(" in scope. Then a few helpers are available:")]),t._v(" "),s("ul",[s("li",[t._v("the GraphQL object is enriched with "),s("code",[t._v("interpreterAsync")]),t._v(", "),s("code",[t._v("executeAsync")]),t._v(" and "),s("code",[t._v("checkAsync")]),t._v(", variants of "),s("code",[t._v("interpreter")]),t._v(", "),s("code",[t._v("execute")]),t._v(" and "),s("code",[t._v("check")]),t._v(" that return an "),s("code",[t._v("F[_]: Async")]),t._v(" instead of a "),s("code",[t._v("ZIO")]),t._v(".")]),t._v(" "),s("li",[t._v("the "),s("code",[t._v("Http4sAdapter")]),t._v(" also has cats-effect variants named "),s("code",[t._v("makeRestServiceF")]),t._v(" and "),s("code",[t._v("makeWebSocketServiceF")]),t._v(".")])]),t._v(" "),s("p",[t._v("In addition to that, a "),s("code",[t._v("Schema")]),t._v(" for any "),s("code",[t._v("F[_]: Effect")]),t._v(" is provided. That means you can include fields returning Monix Task for Cats IO in your queries, mutations or subscriptions.")]),t._v(" "),s("p",[t._v("The following example shows how to create an interpreter and run a query while only using Cats IO.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("GraphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("graphQL\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("RootResolver\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("interop"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("cats"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("implicits")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("cats"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("effect")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" ExitCode"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" IOApp "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" zio"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("DefaultRuntime\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" ExampleCatsInterop "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" IOApp "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" runtime "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" DefaultRuntime "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("numbers"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" randomNumber"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" queries "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("2")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("3")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("scala"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("util"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Random"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("nextInt"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("RootResolver"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" query "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token triple-quoted-string string"}},[t._v('"""\n {\n numbers\n randomNumber\n }"""')]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("override")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" run"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("args"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("ExitCode"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n interpreter "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" api"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("interpreterAsync"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n result "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" interpreter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("executeAsync"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("query"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n _ "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("println"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("result"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("yield")]),t._v(" ExitCode"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Success\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("You can find this example within the "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/blob/master/examples/src/main/scala/caliban/interop/cats/ExampleCatsInterop.scala",target:"_blank",rel:"noopener noreferrer"}},[t._v("examples"),s("OutboundLink")],1),t._v(" project.")]),t._v(" "),s("h2",{attrs:{id:"monix"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#monix"}},[t._v("#")]),t._v(" Monix")]),t._v(" "),s("p",[t._v("You first need to import "),s("code",[t._v("caliban.interop.monix.implicits._")]),t._v(" and have an implicit "),s("code",[t._v("zio.Runtime")]),t._v(" in scope. Then a few helpers are available:")]),t._v(" "),s("ul",[s("li",[t._v("the GraphQL object is enriched with "),s("code",[t._v("interpreterAsync")]),t._v(", "),s("code",[t._v("executeAsync")]),t._v(" and "),s("code",[t._v("checkAsync")]),t._v(", variants of "),s("code",[t._v("interpreter")]),t._v(", "),s("code",[t._v("execute")]),t._v(" and "),s("code",[t._v("check")]),t._v(" that return a Monix "),s("code",[t._v("Task")]),t._v(" instead of a "),s("code",[t._v("ZIO")]),t._v(".")])]),t._v(" "),s("p",[t._v("In addition to that, a "),s("code",[t._v("Schema")]),t._v(" for any Monix "),s("code",[t._v("Task")]),t._v(" as well as "),s("code",[t._v("Observable")]),t._v(" is provided.")]),t._v(" "),s("p",[t._v("The following example shows how to create an interpreter and run a query while only using Monix Task.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("GraphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("graphQL\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("RootResolver\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("interop"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("monix"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("implicits")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("cats"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("effect")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("ExitCode\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("monix"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("eval")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" TaskApp "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("monix"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("execution")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Scheduler\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" zio"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("DefaultRuntime\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" ExampleMonixInterop "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" TaskApp "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" runtime "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" DefaultRuntime "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" monixScheduler"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Scheduler "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" scheduler\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("numbers"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" randomNumber"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" queries "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("2")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("3")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("eval"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("scala"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("util"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Random"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("nextInt"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("RootResolver"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" query "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token triple-quoted-string string"}},[t._v('"""\n {\n numbers\n randomNumber\n }"""')]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("override")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" run"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("args"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("ExitCode"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n interpreter "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" api"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("interpreterAsync\n result "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" interpreter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("executeAsync"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("query"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n _ "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("eval"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("println"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("result"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("yield")]),t._v(" ExitCode"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Success\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("You can find this example within the "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/blob/master/examples/src/main/scala/caliban/interop/monix/ExampleMonixInterop.scala",target:"_blank",rel:"noopener noreferrer"}},[t._v("examples"),s("OutboundLink")],1),t._v(" project.")])])}),[],!1,null,null,null);a.default=e.exports}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[10],{210:function(t,a,s){"use strict";s.r(a);var n=s(28),e=Object(n.a)({},(function(){var t=this,a=t.$createElement,s=t._self._c||a;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"interop-cats-monix"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#interop-cats-monix"}},[t._v("#")]),t._v(" Interop (Cats, Monix)")]),t._v(" "),s("p",[t._v("If you prefer using "),s("a",{attrs:{href:"https://github.com/typelevel/cats-effect",target:"_blank",rel:"noopener noreferrer"}},[t._v("Cats Effect"),s("OutboundLink")],1),t._v(" or "),s("a",{attrs:{href:"https://github.com/monix/monix",target:"_blank",rel:"noopener noreferrer"}},[t._v("Monix"),s("OutboundLink")],1),t._v(" rather than ZIO, you can use the respective "),s("code",[t._v("caliban-cats")]),t._v(" and "),s("code",[t._v("caliban-monix")]),t._v(" modules.")]),t._v(" "),s("h2",{attrs:{id:"cats-effect"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#cats-effect"}},[t._v("#")]),t._v(" Cats Effect")]),t._v(" "),s("p",[t._v("You first need to import "),s("code",[t._v("caliban.interop.cats.implicits._")]),t._v(" and have an implicit "),s("code",[t._v("zio.Runtime")]),t._v(" in scope. Then a few helpers are available:")]),t._v(" "),s("ul",[s("li",[t._v("the GraphQL object is enriched with "),s("code",[t._v("interpreterAsync")]),t._v(", "),s("code",[t._v("executeAsync")]),t._v(" and "),s("code",[t._v("checkAsync")]),t._v(", variants of "),s("code",[t._v("interpreter")]),t._v(", "),s("code",[t._v("execute")]),t._v(" and "),s("code",[t._v("check")]),t._v(" that return an "),s("code",[t._v("F[_]: Async")]),t._v(" instead of a "),s("code",[t._v("ZIO")]),t._v(".")]),t._v(" "),s("li",[t._v("the "),s("code",[t._v("Http4sAdapter")]),t._v(" also has cats-effect variants named "),s("code",[t._v("makeRestServiceF")]),t._v(" and "),s("code",[t._v("makeWebSocketServiceF")]),t._v(".")])]),t._v(" "),s("p",[t._v("In addition to that, a "),s("code",[t._v("Schema")]),t._v(" for any "),s("code",[t._v("F[_]: Effect")]),t._v(" is provided. That means you can include fields returning Monix Task for Cats IO in your queries, mutations or subscriptions.")]),t._v(" "),s("p",[t._v("The following example shows how to create an interpreter and run a query while only using Cats IO.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("GraphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("graphQL\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("RootResolver\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("interop"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("cats"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("implicits")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("cats"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("effect")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" ExitCode"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" IOApp "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" zio"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("DefaultRuntime\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" ExampleCatsInterop "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" IOApp "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" runtime "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" DefaultRuntime "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("numbers"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" randomNumber"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" queries "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("2")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("3")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("scala"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("util"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Random"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("nextInt"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("RootResolver"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" query "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token triple-quoted-string string"}},[t._v('"""\n {\n numbers\n randomNumber\n }"""')]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("override")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" run"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("args"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("ExitCode"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n interpreter "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" api"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("interpreterAsync"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n result "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" interpreter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("executeAsync"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("query"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n _ "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("println"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("result"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("yield")]),t._v(" ExitCode"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Success\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("You can find this example within the "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/blob/master/examples/src/main/scala/caliban/interop/cats/ExampleCatsInterop.scala",target:"_blank",rel:"noopener noreferrer"}},[t._v("examples"),s("OutboundLink")],1),t._v(" project.")]),t._v(" "),s("h2",{attrs:{id:"monix"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#monix"}},[t._v("#")]),t._v(" Monix")]),t._v(" "),s("p",[t._v("You first need to import "),s("code",[t._v("caliban.interop.monix.implicits._")]),t._v(" and have an implicit "),s("code",[t._v("zio.Runtime")]),t._v(" in scope. Then a few helpers are available:")]),t._v(" "),s("ul",[s("li",[t._v("the GraphQL object is enriched with "),s("code",[t._v("interpreterAsync")]),t._v(", "),s("code",[t._v("executeAsync")]),t._v(" and "),s("code",[t._v("checkAsync")]),t._v(", variants of "),s("code",[t._v("interpreter")]),t._v(", "),s("code",[t._v("execute")]),t._v(" and "),s("code",[t._v("check")]),t._v(" that return a Monix "),s("code",[t._v("Task")]),t._v(" instead of a "),s("code",[t._v("ZIO")]),t._v(".")])]),t._v(" "),s("p",[t._v("In addition to that, a "),s("code",[t._v("Schema")]),t._v(" for any Monix "),s("code",[t._v("Task")]),t._v(" as well as "),s("code",[t._v("Observable")]),t._v(" is provided.")]),t._v(" "),s("p",[t._v("The following example shows how to create an interpreter and run a query while only using Monix Task.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("GraphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("graphQL\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("RootResolver\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("interop"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("monix"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("implicits")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("cats"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("effect")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("ExitCode\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("monix"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("eval")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" TaskApp "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("monix"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("execution")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Scheduler\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" zio"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("DefaultRuntime\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" ExampleMonixInterop "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" TaskApp "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" runtime "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" DefaultRuntime "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" monixScheduler"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Scheduler "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" scheduler\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("numbers"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" randomNumber"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" queries "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("2")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("3")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("eval"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("scala"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("util"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Random"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("nextInt"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("RootResolver"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" query "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token triple-quoted-string string"}},[t._v('"""\n {\n numbers\n randomNumber\n }"""')]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("override")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" run"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("args"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("ExitCode"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n interpreter "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" api"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("interpreterAsync\n result "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" interpreter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("executeAsync"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("query"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n _ "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("eval"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("println"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("result"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("yield")]),t._v(" ExitCode"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Success\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("You can find this example within the "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/blob/master/examples/src/main/scala/caliban/interop/monix/ExampleMonixInterop.scala",target:"_blank",rel:"noopener noreferrer"}},[t._v("examples"),s("OutboundLink")],1),t._v(" project.")])])}),[],!1,null,null,null);a.default=e.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/12.bc45abe0.js b/docs/assets/js/12.381b7c5a.js similarity index 99% rename from docs/assets/js/12.bc45abe0.js rename to docs/assets/js/12.381b7c5a.js index 8702eb593..f77e36b82 100644 --- a/docs/assets/js/12.bc45abe0.js +++ b/docs/assets/js/12.381b7c5a.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[12],{210:function(t,a,e){"use strict";e.r(a);var s=e(28),n=Object(s.a)({},(function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[e("h1",{attrs:{id:"middleware"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#middleware"}},[t._v("#")]),t._v(" Middleware")]),t._v(" "),e("p",[t._v("Caliban allows you to perform additional actions at various levels of a query processing, via the concept of "),e("code",[t._v("Wrapper")]),t._v(". Using wrappers, you can:")]),t._v(" "),e("ul",[e("li",[t._v("verify that a query doesn't reach some limit (e.g. depth, complexity)")]),t._v(" "),e("li",[t._v("modify a query before it's executed")]),t._v(" "),e("li",[t._v("add timeouts to queries or fields")]),t._v(" "),e("li",[t._v("log each field execution time")]),t._v(" "),e("li",[t._v("support "),e("a",{attrs:{href:"https://github.com/apollographql/apollo-tracing",target:"_blank",rel:"noopener noreferrer"}},[t._v("Apollo Tracing"),e("OutboundLink")],1),t._v(", "),e("a",{attrs:{href:"https://github.com/apollographql/apollo-cache-control",target:"_blank",rel:"noopener noreferrer"}},[t._v("Apollo Caching"),e("OutboundLink")],1),t._v(" or anything similar")]),t._v(" "),e("li",[t._v("etc.")])]),t._v(" "),e("h2",{attrs:{id:"wrapper-types"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#wrapper-types"}},[t._v("#")]),t._v(" Wrapper types")]),t._v(" "),e("p",[t._v("There are 5 basic types of wrappers:")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("OverallWrapper")]),t._v(" to wrap the whole query processing")]),t._v(" "),e("li",[e("code",[t._v("ParsingWrapper")]),t._v(" to wrap the query parsing only")]),t._v(" "),e("li",[e("code",[t._v("ValidationWrapper")]),t._v(" to wrap the query validation only")]),t._v(" "),e("li",[e("code",[t._v("ExecutionWrapper")]),t._v(" to wrap the query execution only")]),t._v(" "),e("li",[e("code",[t._v("FieldWrapper")]),t._v(" to wrap each field execution")])]),t._v(" "),e("p",[t._v("Each one requires a function that takes a "),e("code",[t._v("ZIO")]),t._v(" or "),e("code",[t._v("ZQuery")]),t._v(" computation together with some contextual information (e.g. the query string) and should return another computation.")]),t._v(" "),e("p",[t._v("Let's see how to implement a wrapper that times out the whole query if its processing takes longer that 1 minute.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" wrapper "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" OverallWrapper "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("io"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" query"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v("\n io"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("timeout"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),t._v(" minute"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("map"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n _"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("getOrElse"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n GraphQLResponse"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n NullValue"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("ExecutionError"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("s"),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Query was interrupted after timeout of ${duration.render}:\\n$query"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("You can also combine wrappers using "),e("code",[t._v("|+|")]),t._v(" and create a wrapper that requires an effect to be run at each query using "),e("code",[t._v("EffectfulWrapper")]),t._v(".")]),t._v(" "),e("p",[t._v("To use your wrapper, call "),e("code",[t._v("GraphQL#withWrapper")]),t._v(" or its alias "),e("code",[t._v("@@")]),t._v(".")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("withWrapper"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("wrapper"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// or")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" @@ wrapper\n")])])]),e("h2",{attrs:{id:"pre-defined-wrappers"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#pre-defined-wrappers"}},[t._v("#")]),t._v(" Pre-defined wrappers")]),t._v(" "),e("p",[t._v("Caliban comes with a few pre-made wrappers in "),e("code",[t._v("caliban.wrappers.Wrappers")]),t._v(":")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("maxDepth")]),t._v(" returns a wrapper that fails queries whose depth is higher than a given value")]),t._v(" "),e("li",[e("code",[t._v("maxFields")]),t._v(" returns a wrapper that fails queries whose number of fields is higher than a given value")]),t._v(" "),e("li",[e("code",[t._v("timeout")]),t._v(" returns a wrapper that fails queries taking more than a specified time")]),t._v(" "),e("li",[e("code",[t._v("printSlowQueries")]),t._v(" returns a wrapper that prints slow queries")]),t._v(" "),e("li",[e("code",[t._v("onSlowQueries")]),t._v(" returns a wrapper that can run a given function on slow queries")])]),t._v(" "),e("p",[t._v("In addition to those, Caliban also ships with some non-spec but standard wrappers")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("caliban.wrappers.ApolloTracing.apolloTracing")]),t._v(" returns a wrapper that adds tracing data into the "),e("code",[t._v("extensions")]),t._v(" field of each response following "),e("a",{attrs:{href:"https://github.com/apollographql/apollo-tracing",target:"_blank",rel:"noopener noreferrer"}},[t._v("Apollo Tracing"),e("OutboundLink")],1),t._v(" format.")]),t._v(" "),e("li",[e("code",[t._v("caliban.wrappers.ApolloCaching.apolloCaching")]),t._v(" returns a wrapper that adds caching hints to properly annotated fields using the "),e("a",{attrs:{href:"https://github.com/apollographql/apollo-cache-control",target:"_blank",rel:"noopener noreferrer"}},[t._v("Apollo Caching"),e("OutboundLink")],1),t._v(" format.")])]),t._v(" "),e("p",[t._v("They can be used like this:")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n graphQL"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" @@\n maxDepth"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("50")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" @@\n timeout"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("3")]),t._v(" seconds"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" @@\n printSlowQueries"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("500")]),t._v(" millis"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" @@\n apolloTracing @@\n apolloCaching\n")])])]),e("h2",{attrs:{id:"wrapping-the-interpreter"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#wrapping-the-interpreter"}},[t._v("#")]),t._v(" Wrapping the interpreter")]),t._v(" "),e("p",[t._v("All the wrappers mentioned above require that you don't modify the environment "),e("code",[t._v("R")]),t._v(" and the error type which is always a "),e("code",[t._v("CalibanError")]),t._v(". It is also possible to wrap your "),e("code",[t._v("GraphQLInterpreter")]),t._v(" by calling "),e("code",[t._v("wrapExecutionWith")]),t._v(" on it. This method takes in a function "),e("code",[t._v("f")]),t._v(" and returns a new "),e("code",[t._v("GraphQLInterpreter")]),t._v(" that will wrap the "),e("code",[t._v("execute")]),t._v(" method with this function "),e("code",[t._v("f")]),t._v(".")]),t._v(" "),e("p",[t._v("It is used internally to implement "),e("code",[t._v("mapError")]),t._v(" (customize errors) and "),e("code",[t._v("provide")]),t._v(" (eliminate the environment), but you can use it for other purposes such as adding a general timeout, logging response times, etc.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" i"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" GraphQLInterpreter"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("MyEnv"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" CalibanError"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// change error type to String")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" i2"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" GraphQLInterpreter"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("MyEnv"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" i"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mapError"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("_"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("toString"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// provide the environment")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" i3"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" GraphQLInterpreter"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" CalibanError"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" i"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("provide"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("myEnv"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// add a timeout on every query execution")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" i4"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" GraphQLInterpreter"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("MyEnv "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("with")]),t._v(" Clock"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" CalibanError"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n i"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("wrapExecutionWith"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n _"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("timeout"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("30")]),t._v(" seconds"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("map"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n _"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("getOrElse"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("GraphQLResponse"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("NullValue"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("ExecutionError"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Timeout!"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])])])}),[],!1,null,null,null);a.default=n.exports}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[12],{211:function(t,a,e){"use strict";e.r(a);var s=e(28),n=Object(s.a)({},(function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[e("h1",{attrs:{id:"middleware"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#middleware"}},[t._v("#")]),t._v(" Middleware")]),t._v(" "),e("p",[t._v("Caliban allows you to perform additional actions at various levels of a query processing, via the concept of "),e("code",[t._v("Wrapper")]),t._v(". Using wrappers, you can:")]),t._v(" "),e("ul",[e("li",[t._v("verify that a query doesn't reach some limit (e.g. depth, complexity)")]),t._v(" "),e("li",[t._v("modify a query before it's executed")]),t._v(" "),e("li",[t._v("add timeouts to queries or fields")]),t._v(" "),e("li",[t._v("log each field execution time")]),t._v(" "),e("li",[t._v("support "),e("a",{attrs:{href:"https://github.com/apollographql/apollo-tracing",target:"_blank",rel:"noopener noreferrer"}},[t._v("Apollo Tracing"),e("OutboundLink")],1),t._v(", "),e("a",{attrs:{href:"https://github.com/apollographql/apollo-cache-control",target:"_blank",rel:"noopener noreferrer"}},[t._v("Apollo Caching"),e("OutboundLink")],1),t._v(" or anything similar")]),t._v(" "),e("li",[t._v("etc.")])]),t._v(" "),e("h2",{attrs:{id:"wrapper-types"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#wrapper-types"}},[t._v("#")]),t._v(" Wrapper types")]),t._v(" "),e("p",[t._v("There are 5 basic types of wrappers:")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("OverallWrapper")]),t._v(" to wrap the whole query processing")]),t._v(" "),e("li",[e("code",[t._v("ParsingWrapper")]),t._v(" to wrap the query parsing only")]),t._v(" "),e("li",[e("code",[t._v("ValidationWrapper")]),t._v(" to wrap the query validation only")]),t._v(" "),e("li",[e("code",[t._v("ExecutionWrapper")]),t._v(" to wrap the query execution only")]),t._v(" "),e("li",[e("code",[t._v("FieldWrapper")]),t._v(" to wrap each field execution")])]),t._v(" "),e("p",[t._v("Each one requires a function that takes a "),e("code",[t._v("ZIO")]),t._v(" or "),e("code",[t._v("ZQuery")]),t._v(" computation together with some contextual information (e.g. the query string) and should return another computation.")]),t._v(" "),e("p",[t._v("Let's see how to implement a wrapper that times out the whole query if its processing takes longer that 1 minute.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" wrapper "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" OverallWrapper "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("io"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" query"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v("\n io"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("timeout"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),t._v(" minute"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("map"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n _"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("getOrElse"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n GraphQLResponse"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n NullValue"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("ExecutionError"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("s"),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Query was interrupted after timeout of ${duration.render}:\\n$query"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("You can also combine wrappers using "),e("code",[t._v("|+|")]),t._v(" and create a wrapper that requires an effect to be run at each query using "),e("code",[t._v("EffectfulWrapper")]),t._v(".")]),t._v(" "),e("p",[t._v("To use your wrapper, call "),e("code",[t._v("GraphQL#withWrapper")]),t._v(" or its alias "),e("code",[t._v("@@")]),t._v(".")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("withWrapper"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("wrapper"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// or")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" @@ wrapper\n")])])]),e("h2",{attrs:{id:"pre-defined-wrappers"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#pre-defined-wrappers"}},[t._v("#")]),t._v(" Pre-defined wrappers")]),t._v(" "),e("p",[t._v("Caliban comes with a few pre-made wrappers in "),e("code",[t._v("caliban.wrappers.Wrappers")]),t._v(":")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("maxDepth")]),t._v(" returns a wrapper that fails queries whose depth is higher than a given value")]),t._v(" "),e("li",[e("code",[t._v("maxFields")]),t._v(" returns a wrapper that fails queries whose number of fields is higher than a given value")]),t._v(" "),e("li",[e("code",[t._v("timeout")]),t._v(" returns a wrapper that fails queries taking more than a specified time")]),t._v(" "),e("li",[e("code",[t._v("printSlowQueries")]),t._v(" returns a wrapper that prints slow queries")]),t._v(" "),e("li",[e("code",[t._v("onSlowQueries")]),t._v(" returns a wrapper that can run a given function on slow queries")])]),t._v(" "),e("p",[t._v("In addition to those, Caliban also ships with some non-spec but standard wrappers")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("caliban.wrappers.ApolloTracing.apolloTracing")]),t._v(" returns a wrapper that adds tracing data into the "),e("code",[t._v("extensions")]),t._v(" field of each response following "),e("a",{attrs:{href:"https://github.com/apollographql/apollo-tracing",target:"_blank",rel:"noopener noreferrer"}},[t._v("Apollo Tracing"),e("OutboundLink")],1),t._v(" format.")]),t._v(" "),e("li",[e("code",[t._v("caliban.wrappers.ApolloCaching.apolloCaching")]),t._v(" returns a wrapper that adds caching hints to properly annotated fields using the "),e("a",{attrs:{href:"https://github.com/apollographql/apollo-cache-control",target:"_blank",rel:"noopener noreferrer"}},[t._v("Apollo Caching"),e("OutboundLink")],1),t._v(" format.")])]),t._v(" "),e("p",[t._v("They can be used like this:")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n graphQL"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" @@\n maxDepth"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("50")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" @@\n timeout"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("3")]),t._v(" seconds"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" @@\n printSlowQueries"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("500")]),t._v(" millis"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" @@\n apolloTracing @@\n apolloCaching\n")])])]),e("h2",{attrs:{id:"wrapping-the-interpreter"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#wrapping-the-interpreter"}},[t._v("#")]),t._v(" Wrapping the interpreter")]),t._v(" "),e("p",[t._v("All the wrappers mentioned above require that you don't modify the environment "),e("code",[t._v("R")]),t._v(" and the error type which is always a "),e("code",[t._v("CalibanError")]),t._v(". It is also possible to wrap your "),e("code",[t._v("GraphQLInterpreter")]),t._v(" by calling "),e("code",[t._v("wrapExecutionWith")]),t._v(" on it. This method takes in a function "),e("code",[t._v("f")]),t._v(" and returns a new "),e("code",[t._v("GraphQLInterpreter")]),t._v(" that will wrap the "),e("code",[t._v("execute")]),t._v(" method with this function "),e("code",[t._v("f")]),t._v(".")]),t._v(" "),e("p",[t._v("It is used internally to implement "),e("code",[t._v("mapError")]),t._v(" (customize errors) and "),e("code",[t._v("provide")]),t._v(" (eliminate the environment), but you can use it for other purposes such as adding a general timeout, logging response times, etc.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" i"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" GraphQLInterpreter"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("MyEnv"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" CalibanError"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// change error type to String")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" i2"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" GraphQLInterpreter"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("MyEnv"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" i"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mapError"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("_"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("toString"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// provide the environment")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" i3"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" GraphQLInterpreter"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" CalibanError"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" i"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("provide"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("myEnv"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// add a timeout on every query execution")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" i4"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" GraphQLInterpreter"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("MyEnv "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("with")]),t._v(" Clock"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" CalibanError"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n i"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("wrapExecutionWith"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n _"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("timeout"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token number"}},[t._v("30")]),t._v(" seconds"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("map"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n _"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("getOrElse"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("GraphQLResponse"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("NullValue"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("ExecutionError"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Timeout!"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])])])}),[],!1,null,null,null);a.default=n.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/13.d315a1c7.js b/docs/assets/js/13.1c02ea8d.js similarity index 99% rename from docs/assets/js/13.d315a1c7.js rename to docs/assets/js/13.1c02ea8d.js index ddc850c26..9e944669f 100644 --- a/docs/assets/js/13.d315a1c7.js +++ b/docs/assets/js/13.1c02ea8d.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[13],{211:function(t,a,s){"use strict";s.r(a);var e=s(28),n=Object(e.a)({},(function(){var t=this,a=t.$createElement,s=t._self._c||a;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"query-optimization"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#query-optimization"}},[t._v("#")]),t._v(" Query optimization")]),t._v(" "),s("p",[t._v("A GraphQL query may request multiple fields that are using the same resolver. It's not a problem if the resolver is a simple value, but it can be less than optimal when the resolver runs an effect (such as reading from a database).")]),t._v(" "),s("p",[t._v("We might want to:")]),t._v(" "),s("ul",[s("li",[s("strong",[t._v("cache")]),t._v(" identical queries (deduplication)")]),t._v(" "),s("li",[s("strong",[t._v("batch")]),t._v(" queries to the same source")])]),t._v(" "),s("p",[t._v("This is possible in Caliban using the "),s("code",[t._v("ZQuery")]),t._v(" data type.")]),t._v(" "),s("h2",{attrs:{id:"introducing-zquery"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#introducing-zquery"}},[t._v("#")]),t._v(" Introducing ZQuery")]),t._v(" "),s("p",[t._v("A "),s("code",[t._v("ZQuery[R, E, A]")]),t._v(" is a purely functional description of an effectual query that may contain requests to one or more data sources. Similarly to "),s("code",[t._v("ZIO[R, E, A]")]),t._v(", it requires an environment "),s("code",[t._v("R")]),t._v(", may fail with an "),s("code",[t._v("E")]),t._v(" or succeed with an "),s("code",[t._v("A")]),t._v(". All requests that do not need to be performed sequentially will automatically be batched, allowing for aggressive data source specific optimizations. Requests will also automatically be deduplicated and cached.")]),t._v(" "),s("p",[t._v("This allows for writing queries in a high level, compositional style, with confidence that they will automatically be optimized. For example, consider the following query from a user service.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" getAllUserIds"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Nothing")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" getUserNameById"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Nothing")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n userIds "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" getAllUserIds\n userNames "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("foreachPar"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("userIds"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("getUserNameById"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("yield")]),t._v(" userNames\n")])])]),s("p",[t._v("This would normally require N + 1 queries, one for "),s("code",[t._v("getAllUserIds")]),t._v(" and one for each call to "),s("code",[t._v("getUserNameById")]),t._v(". In contrast, "),s("code",[t._v("ZQuery")]),t._v(" will automatically optimize this to two queries, one for "),s("code",[t._v("userIds")]),t._v(" and one for "),s("code",[t._v("userNames")]),t._v(", assuming an implementation of the user service that supports batching.")]),t._v(" "),s("h2",{attrs:{id:"building-a-datasource"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#building-a-datasource"}},[t._v("#")]),t._v(" Building a DataSource")]),t._v(" "),s("p",[t._v("To build a "),s("code",[t._v("ZQuery")]),t._v(" that executes a request, you first need to build a "),s("code",[t._v("DataSource")]),t._v(". A "),s("code",[t._v("DataSource[R, E, A]")]),t._v(" defines how to execute requests of type "),s("code",[t._v("A")]),t._v(" and it requires 2 things:")]),t._v(" "),s("ul",[s("li",[t._v("an "),s("code",[t._v("identifier")]),t._v(" that uniquely identifies the data source (requests from "),s("em",[t._v("different")]),t._v(" data sources will "),s("em",[t._v("not")]),t._v(" be batched together)")]),t._v(" "),s("li",[t._v("a effectful function "),s("code",[t._v("run")]),t._v(" from an "),s("code",[t._v("Iterable")]),t._v(" of requests to a "),s("code",[t._v("Map")]),t._v(" of requests and results")])]),t._v(" "),s("p",[t._v("Let's consider "),s("code",[t._v("getUserNameById")]),t._v(" from the previous example. We need to define a corresponding request type that extends "),s("code",[t._v("zquery.Request")]),t._v(" for a given response type:")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" GetUserName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" Request"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Throwable"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n")])])]),s("p",[t._v("Now let's build the corresponding "),s("code",[t._v("DataSource")]),t._v(". We need to implement the following functions:")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" UserDataSource "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" DataSource"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" GetUserName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("override")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" identifier"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("override")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" run"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("requests"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Iterable"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("GetUserName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZIO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Throwable"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" CompletedRequestMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v('We will use "UserDataSource" as our identifier. This name should not be reused for other data sources.')]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("override")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" identifier"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"UserDataSource"')]),t._v("\n")])])]),s("p",[t._v("We will define two different behaviors depending on whether we receive a single request or multiple requests at once.\nFor each request, we need to insert into the result map a value of type "),s("code",[t._v("Either")]),t._v(" ("),s("code",[t._v("Left")]),t._v(" for an error and "),s("code",[t._v("Right")]),t._v(" for a success).")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("override")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" run"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("requests"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Iterable"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("GetUserName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZIO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Nothing")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" CompletedRequestMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" resultMap "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" CompletedRequestMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("empty\n requests"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("toList "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("match")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" request "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("::")]),t._v(" Nil "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// get user by ID e.g. SELECT name FROM users WHERE id = $id")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" result"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n result"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("either"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("map"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("resultMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("insert"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("request"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" batch "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// get multiple users at once e.g. SELECT id, name FROM users WHERE id IN ($ids)")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" result"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n result"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("fold"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n err "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" requests"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("foldLeft"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("resultMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("map"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" req"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" map"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("insert"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("req"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("Left"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("err"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n _"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("foldLeft"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("resultMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("map"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" name"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" map"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("insert"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("GetUserName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("Right"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("name"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("Now to build a "),s("code",[t._v("ZQuery")]),t._v(" from it, we can use "),s("code",[t._v("ZQuery.fromRequest")]),t._v(" and just pass the request and the data source:")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" getUserNameById"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Throwable"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("fromRequest"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("GetUserName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("UserDataSource"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("To run a "),s("code",[t._v("ZQuery")]),t._v(", simply use "),s("code",[t._v("ZQuery#run")]),t._v(" which will return a "),s("code",[t._v("ZIO[R, E, A]")]),t._v(".")]),t._v(" "),s("h2",{attrs:{id:"zquery-constructors-and-operators"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#zquery-constructors-and-operators"}},[t._v("#")]),t._v(" ZQuery constructors and operators")]),t._v(" "),s("p",[t._v("There are several ways to create a "),s("code",[t._v("ZQuery")]),t._v(". We've seen "),s("code",[t._v("ZQuery.fromRequest")]),t._v(", but you can also:")]),t._v(" "),s("ul",[s("li",[t._v("create from a pure value with "),s("code",[t._v("ZQuery.succeed")])]),t._v(" "),s("li",[t._v("create from an effect value with "),s("code",[t._v("ZQuery.fromEffect")])]),t._v(" "),s("li",[t._v("create from multiple queries with "),s("code",[t._v("ZQuery.collectAllPar")]),t._v(" and "),s("code",[t._v("ZQuery.foreachPar")]),t._v(" and their sequential equivalents "),s("code",[t._v("ZQuery.collectAll")]),t._v(" and "),s("code",[t._v("ZQuery.foreach")])])]),t._v(" "),s("p",[t._v("If you have a "),s("code",[t._v("ZQuery")]),t._v(" object, you can use:")]),t._v(" "),s("ul",[s("li",[s("code",[t._v("map")]),t._v(" and "),s("code",[t._v("mapError")]),t._v(" to modify the returned result or error")]),t._v(" "),s("li",[s("code",[t._v("flatMap")]),t._v(" or "),s("code",[t._v("zip")]),t._v(" to combine it with other "),s("code",[t._v("ZQuery")]),t._v(" objects")]),t._v(" "),s("li",[s("code",[t._v("provide")]),t._v(" and "),s("code",[t._v("provideSome")]),t._v(" to eliminate some of the "),s("code",[t._v("R")]),t._v(" requirements")])]),t._v(" "),s("p",[t._v("There are several ways to run a "),s("code",[t._v("ZQuery")]),t._v(":")]),t._v(" "),s("ul",[s("li",[s("code",[t._v("runCache")]),t._v(' runs the query using a given pre-populated cache. This can be useful for deterministically "replaying" a query without executing any new requests.')]),t._v(" "),s("li",[s("code",[t._v("runLog")]),t._v(" runs the query and returns its result along with the cache containing a complete log of all requests executed and their results. This can be useful for logging or analysis of query execution.")]),t._v(" "),s("li",[s("code",[t._v("run")]),t._v(" runs the query and returns its result.")])]),t._v(" "),s("h2",{attrs:{id:"using-zquery-with-caliban"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#using-zquery-with-caliban"}},[t._v("#")]),t._v(" Using ZQuery with Caliban")]),t._v(" "),s("p",[t._v("To use "),s("code",[t._v("ZQuery")]),t._v(" with Caliban, you can simply include fields of type "),s("code",[t._v("ZQuery")]),t._v(" in your API definition.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n users"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Nothing")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("User"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n user"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" UserArgs "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Nothing")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" User"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("During the query execution, Caliban will merge all the requested fields that return a "),s("code",[t._v("ZQuery")]),t._v(" into a single "),s("code",[t._v("ZQuery")]),t._v(" and run it, so that all the possible optimizations are applied.")]),t._v(" "),s("p",[t._v("The "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/examples",target:"_blank",rel:"noopener noreferrer"}},[t._v("examples"),s("OutboundLink")],1),t._v(" project provides 2 versions of the problem described in "),s("a",{attrs:{href:"https://blog.apollographql.com/optimizing-your-graphql-request-waterfalls-7c3f3360b051",target:"_blank",rel:"noopener noreferrer"}},[t._v("this article about GraphQL query optimization"),s("OutboundLink")],1),t._v(":")]),t._v(" "),s("ul",[s("li",[t._v("a "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/examples/src/main/scala/caliban/optimizations/NaiveTest.scala",target:"_blank",rel:"noopener noreferrer"}},[t._v("naive"),s("OutboundLink")],1),t._v(" version where fields are just returning "),s("code",[t._v("IO")]),t._v(", resulting in 47 requests")]),t._v(" "),s("li",[t._v("an "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/examples/src/main/scala/caliban/optimizations/OptimizedTest.scala",target:"_blank",rel:"noopener noreferrer"}},[t._v("optimized"),s("OutboundLink")],1),t._v(" version where fields are returning "),s("code",[t._v("ZQuery")]),t._v(", resulting in 8 requests only")])])])}),[],!1,null,null,null);a.default=n.exports}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[13],{212:function(t,a,s){"use strict";s.r(a);var e=s(28),n=Object(e.a)({},(function(){var t=this,a=t.$createElement,s=t._self._c||a;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"query-optimization"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#query-optimization"}},[t._v("#")]),t._v(" Query optimization")]),t._v(" "),s("p",[t._v("A GraphQL query may request multiple fields that are using the same resolver. It's not a problem if the resolver is a simple value, but it can be less than optimal when the resolver runs an effect (such as reading from a database).")]),t._v(" "),s("p",[t._v("We might want to:")]),t._v(" "),s("ul",[s("li",[s("strong",[t._v("cache")]),t._v(" identical queries (deduplication)")]),t._v(" "),s("li",[s("strong",[t._v("batch")]),t._v(" queries to the same source")])]),t._v(" "),s("p",[t._v("This is possible in Caliban using the "),s("code",[t._v("ZQuery")]),t._v(" data type.")]),t._v(" "),s("h2",{attrs:{id:"introducing-zquery"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#introducing-zquery"}},[t._v("#")]),t._v(" Introducing ZQuery")]),t._v(" "),s("p",[t._v("A "),s("code",[t._v("ZQuery[R, E, A]")]),t._v(" is a purely functional description of an effectual query that may contain requests to one or more data sources. Similarly to "),s("code",[t._v("ZIO[R, E, A]")]),t._v(", it requires an environment "),s("code",[t._v("R")]),t._v(", may fail with an "),s("code",[t._v("E")]),t._v(" or succeed with an "),s("code",[t._v("A")]),t._v(". All requests that do not need to be performed sequentially will automatically be batched, allowing for aggressive data source specific optimizations. Requests will also automatically be deduplicated and cached.")]),t._v(" "),s("p",[t._v("This allows for writing queries in a high level, compositional style, with confidence that they will automatically be optimized. For example, consider the following query from a user service.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" getAllUserIds"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Nothing")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" getUserNameById"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Nothing")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n userIds "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" getAllUserIds\n userNames "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("foreachPar"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("userIds"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("getUserNameById"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("yield")]),t._v(" userNames\n")])])]),s("p",[t._v("This would normally require N + 1 queries, one for "),s("code",[t._v("getAllUserIds")]),t._v(" and one for each call to "),s("code",[t._v("getUserNameById")]),t._v(". In contrast, "),s("code",[t._v("ZQuery")]),t._v(" will automatically optimize this to two queries, one for "),s("code",[t._v("userIds")]),t._v(" and one for "),s("code",[t._v("userNames")]),t._v(", assuming an implementation of the user service that supports batching.")]),t._v(" "),s("h2",{attrs:{id:"building-a-datasource"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#building-a-datasource"}},[t._v("#")]),t._v(" Building a DataSource")]),t._v(" "),s("p",[t._v("To build a "),s("code",[t._v("ZQuery")]),t._v(" that executes a request, you first need to build a "),s("code",[t._v("DataSource")]),t._v(". A "),s("code",[t._v("DataSource[R, E, A]")]),t._v(" defines how to execute requests of type "),s("code",[t._v("A")]),t._v(" and it requires 2 things:")]),t._v(" "),s("ul",[s("li",[t._v("an "),s("code",[t._v("identifier")]),t._v(" that uniquely identifies the data source (requests from "),s("em",[t._v("different")]),t._v(" data sources will "),s("em",[t._v("not")]),t._v(" be batched together)")]),t._v(" "),s("li",[t._v("a effectful function "),s("code",[t._v("run")]),t._v(" from an "),s("code",[t._v("Iterable")]),t._v(" of requests to a "),s("code",[t._v("Map")]),t._v(" of requests and results")])]),t._v(" "),s("p",[t._v("Let's consider "),s("code",[t._v("getUserNameById")]),t._v(" from the previous example. We need to define a corresponding request type that extends "),s("code",[t._v("zquery.Request")]),t._v(" for a given response type:")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" GetUserName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" Request"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Throwable"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n")])])]),s("p",[t._v("Now let's build the corresponding "),s("code",[t._v("DataSource")]),t._v(". We need to implement the following functions:")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" UserDataSource "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" DataSource"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" GetUserName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("override")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" identifier"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("override")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" run"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("requests"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Iterable"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("GetUserName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZIO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Throwable"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" CompletedRequestMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v('We will use "UserDataSource" as our identifier. This name should not be reused for other data sources.')]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("override")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" identifier"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"UserDataSource"')]),t._v("\n")])])]),s("p",[t._v("We will define two different behaviors depending on whether we receive a single request or multiple requests at once.\nFor each request, we need to insert into the result map a value of type "),s("code",[t._v("Either")]),t._v(" ("),s("code",[t._v("Left")]),t._v(" for an error and "),s("code",[t._v("Right")]),t._v(" for a success).")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("override")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" run"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("requests"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Iterable"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("GetUserName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZIO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Nothing")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" CompletedRequestMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" resultMap "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" CompletedRequestMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("empty\n requests"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("toList "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("match")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" request "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("::")]),t._v(" Nil "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// get user by ID e.g. SELECT name FROM users WHERE id = $id")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" result"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n result"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("either"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("map"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("resultMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("insert"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("request"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" batch "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// get multiple users at once e.g. SELECT id, name FROM users WHERE id IN ($ids)")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" result"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n result"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("fold"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n err "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" requests"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("foldLeft"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("resultMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("map"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" req"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" map"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("insert"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("req"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("Left"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("err"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n _"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("foldLeft"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("resultMap"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("map"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" name"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" map"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("insert"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("GetUserName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("Right"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("name"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("Now to build a "),s("code",[t._v("ZQuery")]),t._v(" from it, we can use "),s("code",[t._v("ZQuery.fromRequest")]),t._v(" and just pass the request and the data source:")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" getUserNameById"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Throwable"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("fromRequest"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("GetUserName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("id"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("UserDataSource"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("To run a "),s("code",[t._v("ZQuery")]),t._v(", simply use "),s("code",[t._v("ZQuery#run")]),t._v(" which will return a "),s("code",[t._v("ZIO[R, E, A]")]),t._v(".")]),t._v(" "),s("h2",{attrs:{id:"zquery-constructors-and-operators"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#zquery-constructors-and-operators"}},[t._v("#")]),t._v(" ZQuery constructors and operators")]),t._v(" "),s("p",[t._v("There are several ways to create a "),s("code",[t._v("ZQuery")]),t._v(". We've seen "),s("code",[t._v("ZQuery.fromRequest")]),t._v(", but you can also:")]),t._v(" "),s("ul",[s("li",[t._v("create from a pure value with "),s("code",[t._v("ZQuery.succeed")])]),t._v(" "),s("li",[t._v("create from an effect value with "),s("code",[t._v("ZQuery.fromEffect")])]),t._v(" "),s("li",[t._v("create from multiple queries with "),s("code",[t._v("ZQuery.collectAllPar")]),t._v(" and "),s("code",[t._v("ZQuery.foreachPar")]),t._v(" and their sequential equivalents "),s("code",[t._v("ZQuery.collectAll")]),t._v(" and "),s("code",[t._v("ZQuery.foreach")])])]),t._v(" "),s("p",[t._v("If you have a "),s("code",[t._v("ZQuery")]),t._v(" object, you can use:")]),t._v(" "),s("ul",[s("li",[s("code",[t._v("map")]),t._v(" and "),s("code",[t._v("mapError")]),t._v(" to modify the returned result or error")]),t._v(" "),s("li",[s("code",[t._v("flatMap")]),t._v(" or "),s("code",[t._v("zip")]),t._v(" to combine it with other "),s("code",[t._v("ZQuery")]),t._v(" objects")]),t._v(" "),s("li",[s("code",[t._v("provide")]),t._v(" and "),s("code",[t._v("provideSome")]),t._v(" to eliminate some of the "),s("code",[t._v("R")]),t._v(" requirements")])]),t._v(" "),s("p",[t._v("There are several ways to run a "),s("code",[t._v("ZQuery")]),t._v(":")]),t._v(" "),s("ul",[s("li",[s("code",[t._v("runCache")]),t._v(' runs the query using a given pre-populated cache. This can be useful for deterministically "replaying" a query without executing any new requests.')]),t._v(" "),s("li",[s("code",[t._v("runLog")]),t._v(" runs the query and returns its result along with the cache containing a complete log of all requests executed and their results. This can be useful for logging or analysis of query execution.")]),t._v(" "),s("li",[s("code",[t._v("run")]),t._v(" runs the query and returns its result.")])]),t._v(" "),s("h2",{attrs:{id:"using-zquery-with-caliban"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#using-zquery-with-caliban"}},[t._v("#")]),t._v(" Using ZQuery with Caliban")]),t._v(" "),s("p",[t._v("To use "),s("code",[t._v("ZQuery")]),t._v(" with Caliban, you can simply include fields of type "),s("code",[t._v("ZQuery")]),t._v(" in your API definition.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n users"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Nothing")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("User"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n user"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" UserArgs "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" ZQuery"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Nothing")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" User"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("During the query execution, Caliban will merge all the requested fields that return a "),s("code",[t._v("ZQuery")]),t._v(" into a single "),s("code",[t._v("ZQuery")]),t._v(" and run it, so that all the possible optimizations are applied.")]),t._v(" "),s("p",[t._v("The "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/examples",target:"_blank",rel:"noopener noreferrer"}},[t._v("examples"),s("OutboundLink")],1),t._v(" project provides 2 versions of the problem described in "),s("a",{attrs:{href:"https://blog.apollographql.com/optimizing-your-graphql-request-waterfalls-7c3f3360b051",target:"_blank",rel:"noopener noreferrer"}},[t._v("this article about GraphQL query optimization"),s("OutboundLink")],1),t._v(":")]),t._v(" "),s("ul",[s("li",[t._v("a "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/examples/src/main/scala/caliban/optimizations/NaiveTest.scala",target:"_blank",rel:"noopener noreferrer"}},[t._v("naive"),s("OutboundLink")],1),t._v(" version where fields are just returning "),s("code",[t._v("IO")]),t._v(", resulting in 47 requests")]),t._v(" "),s("li",[t._v("an "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/examples/src/main/scala/caliban/optimizations/OptimizedTest.scala",target:"_blank",rel:"noopener noreferrer"}},[t._v("optimized"),s("OutboundLink")],1),t._v(" version where fields are returning "),s("code",[t._v("ZQuery")]),t._v(", resulting in 8 requests only")])])])}),[],!1,null,null,null);a.default=n.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/14.b8b8c6ff.js b/docs/assets/js/14.0bd8bec9.js similarity index 99% rename from docs/assets/js/14.b8b8c6ff.js rename to docs/assets/js/14.0bd8bec9.js index 7d70ef829..244c8f4d5 100644 --- a/docs/assets/js/14.b8b8c6ff.js +++ b/docs/assets/js/14.0bd8bec9.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[14],{214:function(t,a,e){"use strict";e.r(a);var s=e(28),n=Object(s.a)({},(function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[e("h1",{attrs:{id:"schemas"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#schemas"}},[t._v("#")]),t._v(" Schemas")]),t._v(" "),e("p",[t._v("A GraphQL schema will be derived automatically at compile-time (no reflection) from the types present in your resolver.\nThe table below shows how common Scala types are converted to GraphQL types.")]),t._v(" "),e("table",[e("thead",[e("tr",[e("th",[t._v("Scala Type")]),t._v(" "),e("th",[t._v("GraphQL Type")])])]),t._v(" "),e("tbody",[e("tr",[e("td",[t._v("Boolean")]),t._v(" "),e("td",[t._v("Boolean")])]),t._v(" "),e("tr",[e("td",[t._v("Int")]),t._v(" "),e("td",[t._v("Int")])]),t._v(" "),e("tr",[e("td",[t._v("Float")]),t._v(" "),e("td",[t._v("Float")])]),t._v(" "),e("tr",[e("td",[t._v("Double")]),t._v(" "),e("td",[t._v("Float")])]),t._v(" "),e("tr",[e("td",[t._v("String")]),t._v(" "),e("td",[t._v("String")])]),t._v(" "),e("tr",[e("td",[t._v("java.util.UUID")]),t._v(" "),e("td",[t._v("ID")])]),t._v(" "),e("tr",[e("td",[t._v("Unit")]),t._v(" "),e("td",[t._v("Unit (custom scalar)")])]),t._v(" "),e("tr",[e("td",[t._v("Long")]),t._v(" "),e("td",[t._v("Long (custom scalar)")])]),t._v(" "),e("tr",[e("td",[t._v("BigInt")]),t._v(" "),e("td",[t._v("BigInt (custom scalar)")])]),t._v(" "),e("tr",[e("td",[t._v("BigDecimal")]),t._v(" "),e("td",[t._v("BigDecimal (custom scalar)")])]),t._v(" "),e("tr",[e("td",[t._v("Case Class")]),t._v(" "),e("td",[t._v("Object")])]),t._v(" "),e("tr",[e("td",[t._v("Sealed Trait")]),t._v(" "),e("td",[t._v("Enum or Union")])]),t._v(" "),e("tr",[e("td",[t._v("Option[A]")]),t._v(" "),e("td",[t._v("Nullable A")])]),t._v(" "),e("tr",[e("td",[t._v("List[A]")]),t._v(" "),e("td",[t._v("List of A")])]),t._v(" "),e("tr",[e("td",[t._v("Set[A]")]),t._v(" "),e("td",[t._v("List of A")])]),t._v(" "),e("tr",[e("td",[t._v("A => B")]),t._v(" "),e("td",[t._v("A and B")])]),t._v(" "),e("tr",[e("td",[t._v("(A, B)")]),t._v(" "),e("td",[t._v("Object with 2 fields "),e("code",[t._v("_1")]),t._v(" and "),e("code",[t._v("_2")])])]),t._v(" "),e("tr",[e("td",[t._v("Either[A, B]")]),t._v(" "),e("td",[t._v("Object with 2 nullable fields "),e("code",[t._v("left")]),t._v(" and "),e("code",[t._v("right")])])]),t._v(" "),e("tr",[e("td",[t._v("Map[A, B]")]),t._v(" "),e("td",[t._v("List of Object with 2 fields "),e("code",[t._v("key")]),t._v(" and "),e("code",[t._v("value")])])]),t._v(" "),e("tr",[e("td",[t._v("ZIO[R, Nothing, A]")]),t._v(" "),e("td",[t._v("A")])]),t._v(" "),e("tr",[e("td",[t._v("ZIO[R, E, A]")]),t._v(" "),e("td",[t._v("Nullable A")])]),t._v(" "),e("tr",[e("td",[t._v("Future[A]")]),t._v(" "),e("td",[t._v("Nullable A")])]),t._v(" "),e("tr",[e("td",[t._v("ZStream[R, E, A]")]),t._v(" "),e("td",[t._v("A (subscription) or List of A (query, mutation)")])]),t._v(" "),e("tr",[e("td",[t._v("Json (from "),e("a",{attrs:{href:"https://github.com/circe/circe",target:"_blank",rel:"noopener noreferrer"}},[t._v("Circe"),e("OutboundLink")],1),t._v(")")]),t._v(" "),e("td",[t._v("Json (custom scalar, need "),e("code",[t._v("import caliban.interop.circe.json._")]),t._v(")")])])])]),t._v(" "),e("p",[t._v("See the "),e("a",{attrs:{href:"#custom-types"}},[t._v("Custom Types")]),t._v(" section to find out how to support your own types.")]),t._v(" "),e("p",[t._v("If you want Caliban to support other standard types, feel free to "),e("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/issues",target:"_blank",rel:"noopener noreferrer"}},[t._v("file an issue"),e("OutboundLink")],1),t._v(" or even a PR.")]),t._v(" "),e("div",{staticClass:"custom-block warning"},[e("p",{staticClass:"custom-block-title"},[t._v("Schema derivation issues")]),t._v(" "),e("p",[t._v("Magnolia (the library used to derive the schema at compile-time) sometimes has some trouble generating schemas with a lot of nested types, or types reused in multiple places.\nto deal with this, you can declare schemas for your case classes and sealed traits explicitly:")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" roleSchema "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Schema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("gen"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Role"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" characterSchema "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Schema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("gen"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n")])])]),e("p",[t._v("Make sure those implicits are in scope when you call "),e("code",[t._v("graphQL(...)")]),t._v(". This will make Magnolia's job easier by pre-generating schemas for those classes and re-using them when needed.\nThis will also improve compilation times and generate less bytecode.")])]),t._v(" "),e("h2",{attrs:{id:"enums-unions-interfaces"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#enums-unions-interfaces"}},[t._v("#")]),t._v(" Enums, unions, interfaces")]),t._v(" "),e("p",[t._v("A sealed trait will be converted to a different GraphQL type depending on its content:")]),t._v(" "),e("ul",[e("li",[t._v("a sealed trait with only case objects will be converted to an "),e("code",[t._v("ENUM")])]),t._v(" "),e("li",[t._v("a sealed trait with only case classes will be converted to a "),e("code",[t._v("UNION")])])]),t._v(" "),e("p",[t._v('GraphQL does not support empty objects, so in case a sealed trait mixes case classes and case objects, a union type will be created and the case objects will have a "fake" field named '),e("code",[t._v("_")]),t._v(" which is not queryable.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("sealed")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("trait")]),t._v(" ORIGIN\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" ORIGIN "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" EARTH "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" ORIGIN\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" MARS "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" ORIGIN\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" BELT "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" ORIGIN\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("The snippet above will produce the following GraphQL type:")]),t._v(" "),e("div",{staticClass:"language-graphql extra-class"},[e("pre",{pre:!0,attrs:{class:"language-graphql"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("enum")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Origin")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token constant"}},[t._v("BELT")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token constant"}},[t._v("EARTH")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token constant"}},[t._v("MARS")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("Here's an example of union:")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("sealed")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("trait")]),t._v(" Role\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" Role "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Captain"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("shipName"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" Role\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Engineer"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("specialty"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" Role\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" Mechanic "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" Role\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("The snippet above will produce the following GraphQL type:")]),t._v(" "),e("div",{staticClass:"language-graphql extra-class"},[e("pre",{pre:!0,attrs:{class:"language-graphql"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("union")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Role")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Captain "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),t._v(" Engineer "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),t._v(" Mechanic\n\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Captain")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("shipName")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" String"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Engineer")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("specialty")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" String"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Mechanic")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("_")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" Boolean"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("If you prefer an "),e("code",[t._v("Interface")]),t._v(" instead of a "),e("code",[t._v("Union")]),t._v(" type, add the "),e("code",[t._v("@GQLInterface")]),t._v(" annotation to your sealed trait.\nAn interface will be created with all the fields that are common to the case classes extending the sealed trait.")]),t._v(" "),e("h2",{attrs:{id:"arguments"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#arguments"}},[t._v("#")]),t._v(" Arguments")]),t._v(" "),e("p",[t._v("To declare a field that take arguments, create a dedicated case class representing the arguments and make the field a "),e("em",[t._v("function")]),t._v(" from this class to the result type.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" FilterArgs"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("origin"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Option"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Origin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Queries"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("characters"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" FilterArgs "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("p",[t._v("The snippet above will produce the following GraphQL type:")]),t._v(" "),e("div",{staticClass:"language-graphql extra-class"},[e("pre",{pre:!0,attrs:{class:"language-graphql"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Queries")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("characters")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("origin")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" Origin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("Caliban provides auto-derivation for common types such as "),e("code",[t._v("Int")]),t._v(", "),e("code",[t._v("String")]),t._v(", "),e("code",[t._v("List")]),t._v(", "),e("code",[t._v("Option")]),t._v(", etc. but you can also support your own types by providing an implicit instance of "),e("code",[t._v("caliban.schema.ArgBuilder")]),t._v(".")]),t._v(" "),e("div",{staticClass:"custom-block tip"},[e("p",{staticClass:"custom-block-title"},[t._v("TIP")]),t._v(" "),e("p",[t._v("There is no "),e("code",[t._v("ArgBuilder")]),t._v(" for tuples. If you have multiple arguments, use a case class containing all of them instead of a tuple.")])]),t._v(" "),e("h2",{attrs:{id:"effects"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#effects"}},[t._v("#")]),t._v(" Effects")]),t._v(" "),e("p",[t._v("Fields can return ZIO effects. This allows you to leverage all the features provided by ZIO: timeouts, retries, access to ZIO environment, memoizing, etc. An effect will be run every time a query requiring the corresponding field is executed.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Queries"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("characters"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Task"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n character"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" CharacterName "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" RIO"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Console"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("p",[t._v("If you don't use ZIO environment ("),e("code",[t._v("R")]),t._v(" = "),e("code",[t._v("Any")]),t._v("), there is nothing special to do to get it working.")]),t._v(" "),e("p",[t._v("If you require a ZIO environment, you will need to have the content of "),e("code",[t._v("caliban.schema.GenericSchema[R]")]),t._v(" for your custom "),e("code",[t._v("R")]),t._v(" in scope when you call "),e("code",[t._v("graphQL(...)")]),t._v(".")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" schema "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" GenericSchema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("MyEnv"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" schema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_\n")])])]),e("h2",{attrs:{id:"annotations"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#annotations"}},[t._v("#")]),t._v(" Annotations")]),t._v(" "),e("p",[t._v("Caliban supports a few annotations to enrich data types:")]),t._v(" "),e("ul",[e("li",[e("code",[t._v('@GQLName("name")')]),t._v(" allows you to specify a different name for a data type or a field.")]),t._v(" "),e("li",[e("code",[t._v('@GQLInputName("name")')]),t._v(" allows you to specify a different name for a data type used as an input (by default, the suffix "),e("code",[t._v("Input")]),t._v(" is appended to the type name).")]),t._v(" "),e("li",[e("code",[t._v('@GQLDescription("description")')]),t._v(" lets you provide a description for a data type or field. This description will be visible when your schema is introspected.")]),t._v(" "),e("li",[e("code",[t._v('@GQLDeprecated("reason")')]),t._v(" allows deprecating a field or an enum value.")]),t._v(" "),e("li",[e("code",[t._v("@GQLInterface")]),t._v(" to force a sealed trait generating an interface instead of a union.")]),t._v(" "),e("li",[e("code",[t._v("@GQLDirective(directive: Directive)")]),t._v(" to add a directive to a field or type.")])]),t._v(" "),e("h2",{attrs:{id:"custom-types"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#custom-types"}},[t._v("#")]),t._v(" Custom types")]),t._v(" "),e("p",[t._v("Caliban provides auto-derivation for common types such as "),e("code",[t._v("Int")]),t._v(", "),e("code",[t._v("String")]),t._v(", "),e("code",[t._v("List")]),t._v(", "),e("code",[t._v("Option")]),t._v(", etc. but you can also support your own types by providing an implicit instance of "),e("code",[t._v("caliban.schema.Schema")]),t._v(".")]),t._v(" "),e("p",[t._v("An easy way to do this is to reuse existing instances and use "),e("code",[t._v("contramap")]),t._v(" to map from your type to the original type. Here's an example of creating an instance for "),e("a",{attrs:{href:"https://github.com/fthomas/refined",target:"_blank",rel:"noopener noreferrer"}},[t._v("refined"),e("OutboundLink")],1),t._v("'s "),e("code",[t._v("NonEmptyString")]),t._v(" reusing existing instance for "),e("code",[t._v("String")]),t._v(":")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("caliban"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("schema")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" nonEmptyStringSchema"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Schema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" NonEmptyString"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Schema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("stringSchema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("contramap"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("_"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("value"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("p",[t._v("You can also use the "),e("code",[t._v("scalarSchema")]),t._v(" helper to create your own scalar types, providing a name, an optional description, and a function from your type to a "),e("code",[t._v("ResponseValue")]),t._v(":")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("caliban"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("schema")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" unitSchema"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Schema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Unit")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" scalarSchema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Unit"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" None"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" _ "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" ObjectValue"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("Nil"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("h2",{attrs:{id:"code-generation"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#code-generation"}},[t._v("#")]),t._v(" Code generation")]),t._v(" "),e("p",[t._v("Caliban can automatically generate Scala code from a GraphQL schema.")]),t._v(" "),e("p",[t._v("In order to use this feature, add the "),e("code",[t._v("caliban-codegen")]),t._v(" sbt plugin to your project and enable it.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[t._v("addSbtPlugin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"com.github.ghostdogpr"')]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("%")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"caliban-codegen"')]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("%")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"0.6.0"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\nenablePlugins"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("CodegenPlugin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("p",[t._v("Then call the "),e("code",[t._v("calibanGenSchema")]),t._v(" sbt command.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[t._v("calibanGenSchema schemaPath outPath "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("scalafmtPath\n\ncalibanGenSchema project"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("schema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("graphql src"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("main"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("MyAPI"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("scala\n")])])]),e("p",[t._v("This command will create a Scala file in "),e("code",[t._v("outputPath")]),t._v(" containing all the types defined in the provided GraphQL schema defined at "),e("code",[t._v("schemaPath")]),t._v(". The generated code will be formatted with Scalafmt using the configuration defined by "),e("code",[t._v("scalafmtPath")]),t._v(" (default: "),e("code",[t._v(".scalafmt.conf")]),t._v(").")]),t._v(" "),e("div",{staticClass:"custom-block warning"},[e("p",{staticClass:"custom-block-title"},[t._v("Unsupported features")]),t._v(" "),e("p",[t._v("Some features are not supported by Caliban and will cause an error during code generation:")]),t._v(" "),e("ul",[e("li",[t._v("interfaces")]),t._v(" "),e("li",[t._v("extensions")])])])])}),[],!1,null,null,null);a.default=n.exports}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[14],{213:function(t,a,e){"use strict";e.r(a);var s=e(28),n=Object(s.a)({},(function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[e("h1",{attrs:{id:"schemas"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#schemas"}},[t._v("#")]),t._v(" Schemas")]),t._v(" "),e("p",[t._v("A GraphQL schema will be derived automatically at compile-time (no reflection) from the types present in your resolver.\nThe table below shows how common Scala types are converted to GraphQL types.")]),t._v(" "),e("table",[e("thead",[e("tr",[e("th",[t._v("Scala Type")]),t._v(" "),e("th",[t._v("GraphQL Type")])])]),t._v(" "),e("tbody",[e("tr",[e("td",[t._v("Boolean")]),t._v(" "),e("td",[t._v("Boolean")])]),t._v(" "),e("tr",[e("td",[t._v("Int")]),t._v(" "),e("td",[t._v("Int")])]),t._v(" "),e("tr",[e("td",[t._v("Float")]),t._v(" "),e("td",[t._v("Float")])]),t._v(" "),e("tr",[e("td",[t._v("Double")]),t._v(" "),e("td",[t._v("Float")])]),t._v(" "),e("tr",[e("td",[t._v("String")]),t._v(" "),e("td",[t._v("String")])]),t._v(" "),e("tr",[e("td",[t._v("java.util.UUID")]),t._v(" "),e("td",[t._v("ID")])]),t._v(" "),e("tr",[e("td",[t._v("Unit")]),t._v(" "),e("td",[t._v("Unit (custom scalar)")])]),t._v(" "),e("tr",[e("td",[t._v("Long")]),t._v(" "),e("td",[t._v("Long (custom scalar)")])]),t._v(" "),e("tr",[e("td",[t._v("BigInt")]),t._v(" "),e("td",[t._v("BigInt (custom scalar)")])]),t._v(" "),e("tr",[e("td",[t._v("BigDecimal")]),t._v(" "),e("td",[t._v("BigDecimal (custom scalar)")])]),t._v(" "),e("tr",[e("td",[t._v("Case Class")]),t._v(" "),e("td",[t._v("Object")])]),t._v(" "),e("tr",[e("td",[t._v("Sealed Trait")]),t._v(" "),e("td",[t._v("Enum or Union")])]),t._v(" "),e("tr",[e("td",[t._v("Option[A]")]),t._v(" "),e("td",[t._v("Nullable A")])]),t._v(" "),e("tr",[e("td",[t._v("List[A]")]),t._v(" "),e("td",[t._v("List of A")])]),t._v(" "),e("tr",[e("td",[t._v("Set[A]")]),t._v(" "),e("td",[t._v("List of A")])]),t._v(" "),e("tr",[e("td",[t._v("A => B")]),t._v(" "),e("td",[t._v("A and B")])]),t._v(" "),e("tr",[e("td",[t._v("(A, B)")]),t._v(" "),e("td",[t._v("Object with 2 fields "),e("code",[t._v("_1")]),t._v(" and "),e("code",[t._v("_2")])])]),t._v(" "),e("tr",[e("td",[t._v("Either[A, B]")]),t._v(" "),e("td",[t._v("Object with 2 nullable fields "),e("code",[t._v("left")]),t._v(" and "),e("code",[t._v("right")])])]),t._v(" "),e("tr",[e("td",[t._v("Map[A, B]")]),t._v(" "),e("td",[t._v("List of Object with 2 fields "),e("code",[t._v("key")]),t._v(" and "),e("code",[t._v("value")])])]),t._v(" "),e("tr",[e("td",[t._v("ZIO[R, Nothing, A]")]),t._v(" "),e("td",[t._v("A")])]),t._v(" "),e("tr",[e("td",[t._v("ZIO[R, E, A]")]),t._v(" "),e("td",[t._v("Nullable A")])]),t._v(" "),e("tr",[e("td",[t._v("Future[A]")]),t._v(" "),e("td",[t._v("Nullable A")])]),t._v(" "),e("tr",[e("td",[t._v("ZStream[R, E, A]")]),t._v(" "),e("td",[t._v("A (subscription) or List of A (query, mutation)")])]),t._v(" "),e("tr",[e("td",[t._v("Json (from "),e("a",{attrs:{href:"https://github.com/circe/circe",target:"_blank",rel:"noopener noreferrer"}},[t._v("Circe"),e("OutboundLink")],1),t._v(")")]),t._v(" "),e("td",[t._v("Json (custom scalar, need "),e("code",[t._v("import caliban.interop.circe.json._")]),t._v(")")])])])]),t._v(" "),e("p",[t._v("See the "),e("a",{attrs:{href:"#custom-types"}},[t._v("Custom Types")]),t._v(" section to find out how to support your own types.")]),t._v(" "),e("p",[t._v("If you want Caliban to support other standard types, feel free to "),e("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/issues",target:"_blank",rel:"noopener noreferrer"}},[t._v("file an issue"),e("OutboundLink")],1),t._v(" or even a PR.")]),t._v(" "),e("div",{staticClass:"custom-block warning"},[e("p",{staticClass:"custom-block-title"},[t._v("Schema derivation issues")]),t._v(" "),e("p",[t._v("Magnolia (the library used to derive the schema at compile-time) sometimes has some trouble generating schemas with a lot of nested types, or types reused in multiple places.\nto deal with this, you can declare schemas for your case classes and sealed traits explicitly:")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" roleSchema "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Schema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("gen"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Role"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" characterSchema "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Schema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("gen"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n")])])]),e("p",[t._v("Make sure those implicits are in scope when you call "),e("code",[t._v("graphQL(...)")]),t._v(". This will make Magnolia's job easier by pre-generating schemas for those classes and re-using them when needed.\nThis will also improve compilation times and generate less bytecode.")])]),t._v(" "),e("h2",{attrs:{id:"enums-unions-interfaces"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#enums-unions-interfaces"}},[t._v("#")]),t._v(" Enums, unions, interfaces")]),t._v(" "),e("p",[t._v("A sealed trait will be converted to a different GraphQL type depending on its content:")]),t._v(" "),e("ul",[e("li",[t._v("a sealed trait with only case objects will be converted to an "),e("code",[t._v("ENUM")])]),t._v(" "),e("li",[t._v("a sealed trait with only case classes will be converted to a "),e("code",[t._v("UNION")])])]),t._v(" "),e("p",[t._v('GraphQL does not support empty objects, so in case a sealed trait mixes case classes and case objects, a union type will be created and the case objects will have a "fake" field named '),e("code",[t._v("_")]),t._v(" which is not queryable.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("sealed")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("trait")]),t._v(" ORIGIN\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" ORIGIN "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" EARTH "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" ORIGIN\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" MARS "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" ORIGIN\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" BELT "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" ORIGIN\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("The snippet above will produce the following GraphQL type:")]),t._v(" "),e("div",{staticClass:"language-graphql extra-class"},[e("pre",{pre:!0,attrs:{class:"language-graphql"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("enum")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Origin")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token constant"}},[t._v("BELT")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token constant"}},[t._v("EARTH")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token constant"}},[t._v("MARS")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("Here's an example of union:")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("sealed")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("trait")]),t._v(" Role\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" Role "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Captain"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("shipName"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" Role\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Engineer"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("specialty"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" Role\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" Mechanic "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" Role\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("The snippet above will produce the following GraphQL type:")]),t._v(" "),e("div",{staticClass:"language-graphql extra-class"},[e("pre",{pre:!0,attrs:{class:"language-graphql"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("union")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Role")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Captain "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),t._v(" Engineer "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),t._v(" Mechanic\n\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Captain")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("shipName")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" String"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Engineer")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("specialty")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" String"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Mechanic")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("_")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" Boolean"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("If you prefer an "),e("code",[t._v("Interface")]),t._v(" instead of a "),e("code",[t._v("Union")]),t._v(" type, add the "),e("code",[t._v("@GQLInterface")]),t._v(" annotation to your sealed trait.\nAn interface will be created with all the fields that are common to the case classes extending the sealed trait.")]),t._v(" "),e("h2",{attrs:{id:"arguments"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#arguments"}},[t._v("#")]),t._v(" Arguments")]),t._v(" "),e("p",[t._v("To declare a field that take arguments, create a dedicated case class representing the arguments and make the field a "),e("em",[t._v("function")]),t._v(" from this class to the result type.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" FilterArgs"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("origin"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Option"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Origin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Queries"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("characters"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" FilterArgs "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("p",[t._v("The snippet above will produce the following GraphQL type:")]),t._v(" "),e("div",{staticClass:"language-graphql extra-class"},[e("pre",{pre:!0,attrs:{class:"language-graphql"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Queries")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("characters")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("origin")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" Origin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("Caliban provides auto-derivation for common types such as "),e("code",[t._v("Int")]),t._v(", "),e("code",[t._v("String")]),t._v(", "),e("code",[t._v("List")]),t._v(", "),e("code",[t._v("Option")]),t._v(", etc. but you can also support your own types by providing an implicit instance of "),e("code",[t._v("caliban.schema.ArgBuilder")]),t._v(".")]),t._v(" "),e("div",{staticClass:"custom-block tip"},[e("p",{staticClass:"custom-block-title"},[t._v("TIP")]),t._v(" "),e("p",[t._v("There is no "),e("code",[t._v("ArgBuilder")]),t._v(" for tuples. If you have multiple arguments, use a case class containing all of them instead of a tuple.")])]),t._v(" "),e("h2",{attrs:{id:"effects"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#effects"}},[t._v("#")]),t._v(" Effects")]),t._v(" "),e("p",[t._v("Fields can return ZIO effects. This allows you to leverage all the features provided by ZIO: timeouts, retries, access to ZIO environment, memoizing, etc. An effect will be run every time a query requiring the corresponding field is executed.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Queries"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("characters"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Task"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n character"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" CharacterName "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" RIO"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Console"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("p",[t._v("If you don't use ZIO environment ("),e("code",[t._v("R")]),t._v(" = "),e("code",[t._v("Any")]),t._v("), there is nothing special to do to get it working.")]),t._v(" "),e("p",[t._v("If you require a ZIO environment, you will need to have the content of "),e("code",[t._v("caliban.schema.GenericSchema[R]")]),t._v(" for your custom "),e("code",[t._v("R")]),t._v(" in scope when you call "),e("code",[t._v("graphQL(...)")]),t._v(".")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" schema "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("extends")]),t._v(" GenericSchema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("MyEnv"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" schema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_\n")])])]),e("h2",{attrs:{id:"annotations"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#annotations"}},[t._v("#")]),t._v(" Annotations")]),t._v(" "),e("p",[t._v("Caliban supports a few annotations to enrich data types:")]),t._v(" "),e("ul",[e("li",[e("code",[t._v('@GQLName("name")')]),t._v(" allows you to specify a different name for a data type or a field.")]),t._v(" "),e("li",[e("code",[t._v('@GQLInputName("name")')]),t._v(" allows you to specify a different name for a data type used as an input (by default, the suffix "),e("code",[t._v("Input")]),t._v(" is appended to the type name).")]),t._v(" "),e("li",[e("code",[t._v('@GQLDescription("description")')]),t._v(" lets you provide a description for a data type or field. This description will be visible when your schema is introspected.")]),t._v(" "),e("li",[e("code",[t._v('@GQLDeprecated("reason")')]),t._v(" allows deprecating a field or an enum value.")]),t._v(" "),e("li",[e("code",[t._v("@GQLInterface")]),t._v(" to force a sealed trait generating an interface instead of a union.")]),t._v(" "),e("li",[e("code",[t._v("@GQLDirective(directive: Directive)")]),t._v(" to add a directive to a field or type.")])]),t._v(" "),e("h2",{attrs:{id:"custom-types"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#custom-types"}},[t._v("#")]),t._v(" Custom types")]),t._v(" "),e("p",[t._v("Caliban provides auto-derivation for common types such as "),e("code",[t._v("Int")]),t._v(", "),e("code",[t._v("String")]),t._v(", "),e("code",[t._v("List")]),t._v(", "),e("code",[t._v("Option")]),t._v(", etc. but you can also support your own types by providing an implicit instance of "),e("code",[t._v("caliban.schema.Schema")]),t._v(".")]),t._v(" "),e("p",[t._v("An easy way to do this is to reuse existing instances and use "),e("code",[t._v("contramap")]),t._v(" to map from your type to the original type. Here's an example of creating an instance for "),e("a",{attrs:{href:"https://github.com/fthomas/refined",target:"_blank",rel:"noopener noreferrer"}},[t._v("refined"),e("OutboundLink")],1),t._v("'s "),e("code",[t._v("NonEmptyString")]),t._v(" reusing existing instance for "),e("code",[t._v("String")]),t._v(":")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("caliban"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("schema")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" nonEmptyStringSchema"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Schema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" NonEmptyString"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Schema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("stringSchema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("contramap"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("_"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("value"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("p",[t._v("You can also use the "),e("code",[t._v("scalarSchema")]),t._v(" helper to create your own scalar types, providing a name, an optional description, and a function from your type to a "),e("code",[t._v("ResponseValue")]),t._v(":")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("caliban"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("schema")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" unitSchema"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Schema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Unit")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" scalarSchema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Unit"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" None"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" _ "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" ObjectValue"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("Nil"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("h2",{attrs:{id:"code-generation"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#code-generation"}},[t._v("#")]),t._v(" Code generation")]),t._v(" "),e("p",[t._v("Caliban can automatically generate Scala code from a GraphQL schema.")]),t._v(" "),e("p",[t._v("In order to use this feature, add the "),e("code",[t._v("caliban-codegen")]),t._v(" sbt plugin to your project and enable it.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[t._v("addSbtPlugin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"com.github.ghostdogpr"')]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("%")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"caliban-codegen"')]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("%")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"0.6.0"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\nenablePlugins"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("CodegenPlugin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("p",[t._v("Then call the "),e("code",[t._v("calibanGenSchema")]),t._v(" sbt command.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[t._v("calibanGenSchema schemaPath outPath "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("scalafmtPath\n\ncalibanGenSchema project"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("schema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("graphql src"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("main"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("MyAPI"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("scala\n")])])]),e("p",[t._v("This command will create a Scala file in "),e("code",[t._v("outputPath")]),t._v(" containing all the types defined in the provided GraphQL schema defined at "),e("code",[t._v("schemaPath")]),t._v(". The generated code will be formatted with Scalafmt using the configuration defined by "),e("code",[t._v("scalafmtPath")]),t._v(" (default: "),e("code",[t._v(".scalafmt.conf")]),t._v(").")]),t._v(" "),e("div",{staticClass:"custom-block warning"},[e("p",{staticClass:"custom-block-title"},[t._v("Unsupported features")]),t._v(" "),e("p",[t._v("Some features are not supported by Caliban and will cause an error during code generation:")]),t._v(" "),e("ul",[e("li",[t._v("interfaces")]),t._v(" "),e("li",[t._v("extensions")])])])])}),[],!1,null,null,null);a.default=n.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/15.23ceaf26.js b/docs/assets/js/15.1f4e823e.js similarity index 97% rename from docs/assets/js/15.23ceaf26.js rename to docs/assets/js/15.1f4e823e.js index cb750db92..4d0cdd90e 100644 --- a/docs/assets/js/15.23ceaf26.js +++ b/docs/assets/js/15.1f4e823e.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[15],{213:function(a,t,s){"use strict";s.r(t);var e=s(28),n=Object(e.a)({},(function(){var a=this,t=a.$createElement,s=a._self._c||t;return s("ContentSlotsDistributor",{attrs:{"slot-key":a.$parent.slotKey}},[s("h1",{attrs:{id:"validation"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#validation"}},[a._v("#")]),a._v(" Validation")]),a._v(" "),s("p",[a._v("Caliban provides a little macro called "),s("code",[a._v("gqldoc")]),a._v(" that can check at "),s("strong",[a._v("compile-time")]),a._v(" that a GraphQL query (a "),s("em",[a._v("document")]),a._v(" to be exact) has valid syntax.")]),a._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("import")]),a._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("Macros"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("gqldoc\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("val")]),a._v(" query "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("=")]),a._v(" gqldoc"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token triple-quoted-string string"}},[a._v('"""\n query test {\n amos: character(name: "Amos Burton") {\n name\n }\n }"""')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n")])])]),s("p",[a._v("At "),s("strong",[a._v("runtime")]),a._v(", it is possible to validate a query against your schema by calling the method "),s("code",[a._v("check")]),a._v(" on your API.")]),a._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("def")]),a._v(" check"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("query"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[a._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),a._v(" IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("[")]),a._v("CalibanError"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(",")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[a._v("Unit")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("]")]),a._v("\n")])])]),s("p",[a._v("It is also possible to skip validation when executing a query by passing "),s("code",[a._v("skipValidation = true")]),a._v(" when calling "),s("code",[a._v("execute")]),a._v(". This will slightly improve performance.")])])}),[],!1,null,null,null);t.default=n.exports}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[15],{214:function(a,t,s){"use strict";s.r(t);var e=s(28),n=Object(e.a)({},(function(){var a=this,t=a.$createElement,s=a._self._c||t;return s("ContentSlotsDistributor",{attrs:{"slot-key":a.$parent.slotKey}},[s("h1",{attrs:{id:"validation"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#validation"}},[a._v("#")]),a._v(" Validation")]),a._v(" "),s("p",[a._v("Caliban provides a little macro called "),s("code",[a._v("gqldoc")]),a._v(" that can check at "),s("strong",[a._v("compile-time")]),a._v(" that a GraphQL query (a "),s("em",[a._v("document")]),a._v(" to be exact) has valid syntax.")]),a._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("import")]),a._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("Macros"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(".")]),a._v("gqldoc\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("val")]),a._v(" query "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("=")]),a._v(" gqldoc"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),s("span",{pre:!0,attrs:{class:"token triple-quoted-string string"}},[a._v('"""\n query test {\n amos: character(name: "Amos Burton") {\n name\n }\n }"""')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),a._v("\n")])])]),s("p",[a._v("At "),s("strong",[a._v("runtime")]),a._v(", it is possible to validate a query against your schema by calling the method "),s("code",[a._v("check")]),a._v(" on your API.")]),a._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("def")]),a._v(" check"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("(")]),a._v("query"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[a._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(":")]),a._v(" IO"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("[")]),a._v("CalibanError"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v(",")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[a._v("Unit")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("]")]),a._v("\n")])])]),s("p",[a._v("It is also possible to skip validation when executing a query by passing "),s("code",[a._v("skipValidation = true")]),a._v(" when calling "),s("code",[a._v("execute")]),a._v(". This will slightly improve performance.")])])}),[],!1,null,null,null);t.default=n.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/16.285ebbb2.js b/docs/assets/js/16.285ebbb2.js new file mode 100644 index 000000000..2e4c7cf58 --- /dev/null +++ b/docs/assets/js/16.285ebbb2.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[16],{215:function(a,r,t){"use strict";t.r(r);var e=t(28),n=Object(e.a)({},(function(){var a=this,r=a.$createElement,t=a._self._c||r;return t("ContentSlotsDistributor",{attrs:{"slot-key":a.$parent.slotKey}},[t("h1",{attrs:{id:"resources"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#resources"}},[a._v("#")]),a._v(" Resources")]),a._v(" "),t("h2",{attrs:{id:"talks"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#talks"}},[a._v("#")]),a._v(" Talks")]),a._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://www.youtube.com/watch?v=OC8PbviYUlQ",target:"_blank",rel:"noopener noreferrer"}},[a._v("Caliban: Designing a Functional GraphQL Library"),t("OutboundLink")],1),a._v(" by Pierre Ricadat at "),t("a",{attrs:{href:"https://www.functionalscala.com/",target:"_blank",rel:"noopener noreferrer"}},[a._v("Functional Scala"),t("OutboundLink")],1),a._v(" in December 2019 (slides available "),t("a",{attrs:{href:"https://www.slideshare.net/PierreRicadat/designing-a-functional-graphql-library-204680947",target:"_blank",rel:"noopener noreferrer"}},[a._v("here"),t("OutboundLink")],1),a._v(")")])]),a._v(" "),t("h2",{attrs:{id:"blog-articles"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#blog-articles"}},[a._v("#")]),a._v(" Blog Articles")]),a._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://medium.com/@ghostdogpr/caliban-client-a-type-safe-graphql-client-for-scala-and-scala-js-718aa42c5ef7",target:"_blank",rel:"noopener noreferrer"}},[a._v("Caliban Client: a type-safe GraphQL Client for Scala and Scala.js"),t("OutboundLink")],1),a._v(" by Pierre Ricadat (February 2020)")]),a._v(" "),t("li",[t("strong",[t("em",[a._v("GraphQL in Scala with Caliban")])]),a._v(" by Pierre Ricadat (February 2020)\n"),t("ul",[t("li",[t("a",{attrs:{href:"https://medium.com/@ghostdogpr/graphql-in-scala-with-caliban-part-1-8ceb6099c3c2",target:"_blank",rel:"noopener noreferrer"}},[a._v("Part 1: Turn a simple API into GraphQL"),t("OutboundLink")],1)]),a._v(" "),t("li",[t("a",{attrs:{href:"https://medium.com/@ghostdogpr/graphql-in-scala-with-caliban-part-2-c7762110c0f9",target:"_blank",rel:"noopener noreferrer"}},[a._v("Part 2: Query optimization"),t("OutboundLink")],1)]),a._v(" "),t("li",[t("a",{attrs:{href:"https://medium.com/@ghostdogpr/graphql-in-scala-with-caliban-part-3-8962a02d5d64",target:"_blank",rel:"noopener noreferrer"}},[a._v("Part 3: Customization using wrappers"),t("OutboundLink")],1)])])]),a._v(" "),t("li",[t("a",{attrs:{href:"http://fokot.github.io/post/caliban-auth.html",target:"_blank",rel:"noopener noreferrer"}},[a._v("Authentication in Caliban"),t("OutboundLink")],1),a._v(" by František Kocun (December 2019)")])])])}),[],!1,null,null,null);r.default=n.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/16.f357ff30.js b/docs/assets/js/16.f357ff30.js deleted file mode 100644 index 61e14bfb6..000000000 --- a/docs/assets/js/16.f357ff30.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[16],{215:function(r,t,a){"use strict";a.r(t);var e=a(28),n=Object(e.a)({},(function(){var r=this,t=r.$createElement,a=r._self._c||t;return a("ContentSlotsDistributor",{attrs:{"slot-key":r.$parent.slotKey}},[a("h1",{attrs:{id:"resources"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#resources"}},[r._v("#")]),r._v(" Resources")]),r._v(" "),a("h2",{attrs:{id:"talks"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#talks"}},[r._v("#")]),r._v(" Talks")]),r._v(" "),a("ul",[a("li",[a("a",{attrs:{href:"https://www.youtube.com/watch?v=OC8PbviYUlQ",target:"_blank",rel:"noopener noreferrer"}},[r._v("Caliban: Designing a Functional GraphQL Library"),a("OutboundLink")],1),r._v(" by Pierre Ricadat at "),a("a",{attrs:{href:"https://www.functionalscala.com/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Functional Scala"),a("OutboundLink")],1),r._v(" in December 2019 (slides available "),a("a",{attrs:{href:"https://www.slideshare.net/PierreRicadat/designing-a-functional-graphql-library-204680947",target:"_blank",rel:"noopener noreferrer"}},[r._v("here"),a("OutboundLink")],1),r._v(")")])]),r._v(" "),a("h2",{attrs:{id:"blog-articles"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#blog-articles"}},[r._v("#")]),r._v(" Blog Articles")]),r._v(" "),a("ul",[a("li",[a("strong",[a("em",[r._v("GraphQL in Scala with Caliban")])]),r._v(" by Pierre Ricadat (February 2020)\n"),a("ul",[a("li",[a("a",{attrs:{href:"https://medium.com/@ghostdogpr/graphql-in-scala-with-caliban-part-1-8ceb6099c3c2",target:"_blank",rel:"noopener noreferrer"}},[r._v("Part 1: Turn a simple API into GraphQL"),a("OutboundLink")],1)]),r._v(" "),a("li",[a("a",{attrs:{href:"https://medium.com/@ghostdogpr/graphql-in-scala-with-caliban-part-2-c7762110c0f9",target:"_blank",rel:"noopener noreferrer"}},[r._v("Part 2: Query optimization"),a("OutboundLink")],1)]),r._v(" "),a("li",[a("a",{attrs:{href:"https://medium.com/@ghostdogpr/graphql-in-scala-with-caliban-part-3-8962a02d5d64",target:"_blank",rel:"noopener noreferrer"}},[r._v("Part 3: Customization"),a("OutboundLink")],1)])])]),r._v(" "),a("li",[a("a",{attrs:{href:"http://fokot.github.io/post/caliban-auth.html",target:"_blank",rel:"noopener noreferrer"}},[r._v("Authentication in Caliban"),a("OutboundLink")],1),r._v(" by František Kocun (December 2019)")])])])}),[],!1,null,null,null);t.default=n.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/7.57a8ce51.js b/docs/assets/js/7.16ad04b7.js similarity index 99% rename from docs/assets/js/7.57a8ce51.js rename to docs/assets/js/7.16ad04b7.js index 745a33bb8..45d0c2bb9 100644 --- a/docs/assets/js/7.57a8ce51.js +++ b/docs/assets/js/7.16ad04b7.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[7],{207:function(t,a,s){"use strict";s.r(a);var e=s(28),n=Object(e.a)({},(function(){var t=this,a=t.$createElement,s=t._self._c||a;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"getting-started"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#getting-started"}},[t._v("#")]),t._v(" Getting Started")]),t._v(" "),s("p",[s("strong",[t._v("Caliban")]),t._v(" is a purely functional library for creating GraphQL backends in Scala.\nIt relies on "),s("a",{attrs:{href:"https://github.com/propensive/magnolia",target:"_blank",rel:"noopener noreferrer"}},[t._v("Magnolia"),s("OutboundLink")],1),t._v(" to automatically derives GraphQL schemas from your data types, "),s("a",{attrs:{href:"https://github.com/lihaoyi/fastparse",target:"_blank",rel:"noopener noreferrer"}},[t._v("Fastparse"),s("OutboundLink")],1),t._v(" to parse queries and "),s("a",{attrs:{href:"https://github.com/zio/zio",target:"_blank",rel:"noopener noreferrer"}},[t._v("ZIO"),s("OutboundLink")],1),t._v(" to handle various effects.")]),t._v(" "),s("p",[t._v("The design principles behind the library are the following:")]),t._v(" "),s("ul",[s("li",[t._v("pure interface: errors and effects are returned explicitly (no exceptions thrown), all returned types are referentially transparent (no "),s("code",[t._v("Future")]),t._v(").")]),t._v(" "),s("li",[t._v("clean separation between schema definition and implementation: schema is defined and validated at compile-time (no reflection) using Scala standard types, resolver is a simple value provided at runtime.")]),t._v(" "),s("li",[t._v("minimal amount of boilerplate: no need to manually define a schema for every type in your API.")])]),t._v(" "),s("p",[t._v("Caliban can also be used to build GraphQL frontends: see the "),s("RouterLink",{attrs:{to:"/docs/client.html"}},[t._v("dedicated section")]),t._v(" for more details.")],1),t._v(" "),s("h2",{attrs:{id:"dependencies"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#dependencies"}},[t._v("#")]),t._v(" Dependencies")]),t._v(" "),s("p",[t._v("To use "),s("code",[t._v("caliban")]),t._v(", add the following line in your "),s("code",[t._v("build.sbt")]),t._v(" file:")]),t._v(" "),s("div",{staticClass:"language- extra-class"},[s("pre",{pre:!0,attrs:{class:"language-text"}},[s("code",[t._v('libraryDependencies += "com.github.ghostdogpr" %% "caliban" % "0.6.0"\n')])])]),s("p",[t._v("The following modules are optional:")]),t._v(" "),s("div",{staticClass:"language- extra-class"},[s("pre",{pre:!0,attrs:{class:"language-text"}},[s("code",[t._v('libraryDependencies += "com.github.ghostdogpr" %% "caliban-http4s" % "0.6.0" // routes for http4s\nlibraryDependencies += "com.github.ghostdogpr" %% "caliban-akka-http" % "0.6.0" // routes for akka-http\nlibraryDependencies += "com.github.ghostdogpr" %% "caliban-cats" % "0.6.0" // interop with cats effect\nlibraryDependencies += "com.github.ghostdogpr" %% "caliban-monix" % "0.6.0" // interop with monix\n')])])]),s("p",[t._v("Note that Caliban is also available for ScalaJS.")]),t._v(" "),s("h2",{attrs:{id:"a-simple-example"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#a-simple-example"}},[t._v("#")]),t._v(" A simple example")]),t._v(" "),s("p",[t._v("Creating a GraphQL API with Caliban is as simple as creating a case class. Indeed, the whole GraphQL schema will be derived from a case class structure (its fields and the other types it references), and the resolver is just an instance of that case class.")]),t._v(" "),s("p",[t._v("Let's say we have a class "),s("code",[t._v("Character")]),t._v(" and 2 functions: "),s("code",[t._v("getCharacters")]),t._v(" and "),s("code",[t._v("getCharacter")]),t._v(":")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("name"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" age"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" getCharacters"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" getCharacter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("name"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Option"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n")])])]),s("p",[t._v("Let's create a case class named "),s("code",[t._v("Queries")]),t._v(" that will represent our API, with 2 fields named and modeled after the functions we want to expose (a "),s("em",[t._v("record of functions")]),t._v("). We then create a value of this class that calls our actual functions. This is our resolver.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// schema")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" CharacterName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("name"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("characters"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n character"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" CharacterName "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" Option"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// resolver")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" queries "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("getCharacters"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" args "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" getCharacter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("args"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("name"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("The next step is creating our GraphQL API definition. First, we wrap our query resolver inside a "),s("code",[t._v("RootResolver")]),t._v(", the root object that contains queries, mutations and subscriptions. Only queries are mandatory.\nThen we can call the "),s("code",[t._v("graphQL")]),t._v(" function which will turn our simple resolver value into a GraphQL API definition.\nThe whole schema will be derived at compile time, meaning that if it compiles, it will be able to serve it.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("GraphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("graphQL\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("RootResolver\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("RootResolver"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("You can use "),s("code",[t._v("api.render")]),t._v(" to visualize the schema generated, in this case:")]),t._v(" "),s("div",{staticClass:"language-graphql extra-class"},[s("pre",{pre:!0,attrs:{class:"language-graphql"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Character")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("name")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" String"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("age")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" Int"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Queries")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("characters")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("character")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("name")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" String"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" Character\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("In order to process requests, you need to turn your API into an interpreter, which can be done easily by calling "),s("code",[t._v(".interpreter")]),t._v(".\nAn interpreter is a light wrapper around the API definition that allows plugging in some middleware and possibly modifying the environment and error types (see "),s("RouterLink",{attrs:{to:"/docs/middleware.html"}},[t._v("Middleware")]),t._v(" for more info).\nCreating the interpreter may fail with a "),s("code",[t._v("ValidationError")]),t._v(" if some type is found invalid.")],1),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n interpreter "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" api"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("interpreter\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("yield")]),t._v(" interpreter\n")])])]),s("p",[t._v("Now you can call "),s("code",[t._v("interpreter.execute")]),t._v(" with a given GraphQL query, and you will get an "),s("code",[t._v("ZIO[R, Nothing, GraphQLResponse[CalibanError]]")]),t._v(" as a response, with "),s("code",[t._v("GraphQLResponse")]),t._v(" defined as follows:")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" GraphQLResponse"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v("E"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("data"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ResponseValue"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" errors"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("E"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("Use "),s("code",[t._v("ResponseValue#toString")]),t._v(" to get the JSON representation of the result.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" query "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token triple-quoted-string string"}},[t._v('"""\n {\n characters {\n name\n }\n }"""')]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n result "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" interpreter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("execute"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("query"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n _ "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" zio"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("putStrLn"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("result"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("toString"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("yield")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("A "),s("code",[t._v("CalibanError")]),t._v(" can be:")]),t._v(" "),s("ul",[s("li",[t._v("a "),s("code",[t._v("ParsingError")]),t._v(": the query has invalid syntax")]),t._v(" "),s("li",[t._v("a "),s("code",[t._v("ValidationError")]),t._v(": the query was parsed but does not match the schema")]),t._v(" "),s("li",[t._v("an "),s("code",[t._v("ExecutionError")]),t._v(": an error happened while executing the query")])]),t._v(" "),s("p",[t._v("Caliban itself is not tied to any web framework, you are free to expose this function using the protocol and library of your choice. The "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/http4s",target:"_blank",rel:"noopener noreferrer"}},[t._v("caliban-http4s"),s("OutboundLink")],1),t._v(" module provides an "),s("code",[t._v("Http4sAdapter")]),t._v(" that exposes an interpreter over HTTP and WebSocket using http4s. There is also a "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/akka-http",target:"_blank",rel:"noopener noreferrer"}},[t._v("caliban-akka-http"),s("OutboundLink")],1),t._v(" that provides similar functionality for Akka HTTP.")]),t._v(" "),s("div",{staticClass:"custom-block tip"},[s("p",{staticClass:"custom-block-title"},[t._v("Combining GraphQL APIs")]),t._v(" "),s("p",[t._v("You don't have to define all your root fields into a single case class: you can use smaller case classes and combine "),s("code",[t._v("GraphQL")]),t._v(" objects using the "),s("code",[t._v("|+|")]),t._v(" operator.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api1 "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api2 "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" api1 "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),t._v(" api2\n")])])]),s("p",[t._v("You can use "),s("code",[t._v(".rename")]),t._v(" to change the names of the generated root types.")])]),t._v(" "),s("h2",{attrs:{id:"mutations"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#mutations"}},[t._v("#")]),t._v(" Mutations")]),t._v(" "),s("p",[t._v("Creating mutations is the same as queries, except you pass them as the second argument to "),s("code",[t._v("RootResolver")]),t._v(":")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" CharacterArgs"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("name"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Mutations"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("deleteCharacter"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" CharacterArgs "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Boolean")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" mutations "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Mutations"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("RootResolver"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" mutations"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("h2",{attrs:{id:"subscriptions"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#subscriptions"}},[t._v("#")]),t._v(" Subscriptions")]),t._v(" "),s("p",[t._v("Similarly, subscriptions are passed as the third argument to "),s("code",[t._v("RootResolver")]),t._v(":")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Subscriptions"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("deletedCharacter"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZStream"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Nothing")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" subscriptions "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Subscriptions"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("RootResolver"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" mutations"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" subscriptions"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("All the fields of the subscription root case class MUST return "),s("code",[t._v("ZStream")]),t._v(" or "),s("code",[t._v("? => ZStream")]),t._v(" objects. When a subscription request is received, an output stream of "),s("code",[t._v("ResponseValue")]),t._v(" (a "),s("code",[t._v("StreamValue")]),t._v(") will be returned wrapped inside an "),s("code",[t._v("ObjectValue")]),t._v(".")])])}),[],!1,null,null,null);a.default=n.exports}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[7],{206:function(t,a,s){"use strict";s.r(a);var e=s(28),n=Object(e.a)({},(function(){var t=this,a=t.$createElement,s=t._self._c||a;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"getting-started"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#getting-started"}},[t._v("#")]),t._v(" Getting Started")]),t._v(" "),s("p",[s("strong",[t._v("Caliban")]),t._v(" is a purely functional library for creating GraphQL backends in Scala.\nIt relies on "),s("a",{attrs:{href:"https://github.com/propensive/magnolia",target:"_blank",rel:"noopener noreferrer"}},[t._v("Magnolia"),s("OutboundLink")],1),t._v(" to automatically derives GraphQL schemas from your data types, "),s("a",{attrs:{href:"https://github.com/lihaoyi/fastparse",target:"_blank",rel:"noopener noreferrer"}},[t._v("Fastparse"),s("OutboundLink")],1),t._v(" to parse queries and "),s("a",{attrs:{href:"https://github.com/zio/zio",target:"_blank",rel:"noopener noreferrer"}},[t._v("ZIO"),s("OutboundLink")],1),t._v(" to handle various effects.")]),t._v(" "),s("p",[t._v("The design principles behind the library are the following:")]),t._v(" "),s("ul",[s("li",[t._v("pure interface: errors and effects are returned explicitly (no exceptions thrown), all returned types are referentially transparent (no "),s("code",[t._v("Future")]),t._v(").")]),t._v(" "),s("li",[t._v("clean separation between schema definition and implementation: schema is defined and validated at compile-time (no reflection) using Scala standard types, resolver is a simple value provided at runtime.")]),t._v(" "),s("li",[t._v("minimal amount of boilerplate: no need to manually define a schema for every type in your API.")])]),t._v(" "),s("p",[t._v("Caliban can also be used to build GraphQL frontends: see the "),s("RouterLink",{attrs:{to:"/docs/client.html"}},[t._v("dedicated section")]),t._v(" for more details.")],1),t._v(" "),s("h2",{attrs:{id:"dependencies"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#dependencies"}},[t._v("#")]),t._v(" Dependencies")]),t._v(" "),s("p",[t._v("To use "),s("code",[t._v("caliban")]),t._v(", add the following line in your "),s("code",[t._v("build.sbt")]),t._v(" file:")]),t._v(" "),s("div",{staticClass:"language- extra-class"},[s("pre",{pre:!0,attrs:{class:"language-text"}},[s("code",[t._v('libraryDependencies += "com.github.ghostdogpr" %% "caliban" % "0.6.0"\n')])])]),s("p",[t._v("The following modules are optional:")]),t._v(" "),s("div",{staticClass:"language- extra-class"},[s("pre",{pre:!0,attrs:{class:"language-text"}},[s("code",[t._v('libraryDependencies += "com.github.ghostdogpr" %% "caliban-http4s" % "0.6.0" // routes for http4s\nlibraryDependencies += "com.github.ghostdogpr" %% "caliban-akka-http" % "0.6.0" // routes for akka-http\nlibraryDependencies += "com.github.ghostdogpr" %% "caliban-cats" % "0.6.0" // interop with cats effect\nlibraryDependencies += "com.github.ghostdogpr" %% "caliban-monix" % "0.6.0" // interop with monix\n')])])]),s("p",[t._v("Note that Caliban is also available for ScalaJS.")]),t._v(" "),s("h2",{attrs:{id:"a-simple-example"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#a-simple-example"}},[t._v("#")]),t._v(" A simple example")]),t._v(" "),s("p",[t._v("Creating a GraphQL API with Caliban is as simple as creating a case class. Indeed, the whole GraphQL schema will be derived from a case class structure (its fields and the other types it references), and the resolver is just an instance of that case class.")]),t._v(" "),s("p",[t._v("Let's say we have a class "),s("code",[t._v("Character")]),t._v(" and 2 functions: "),s("code",[t._v("getCharacters")]),t._v(" and "),s("code",[t._v("getCharacter")]),t._v(":")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("name"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" age"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" getCharacters"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" getCharacter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("name"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Option"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n")])])]),s("p",[t._v("Let's create a case class named "),s("code",[t._v("Queries")]),t._v(" that will represent our API, with 2 fields named and modeled after the functions we want to expose (a "),s("em",[t._v("record of functions")]),t._v("). We then create a value of this class that calls our actual functions. This is our resolver.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// schema")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" CharacterName"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("name"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("characters"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n character"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" CharacterName "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" Option"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// resolver")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" queries "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("getCharacters"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" args "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" getCharacter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("args"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("name"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("The next step is creating our GraphQL API definition. First, we wrap our query resolver inside a "),s("code",[t._v("RootResolver")]),t._v(", the root object that contains queries, mutations and subscriptions. Only queries are mandatory.\nThen we can call the "),s("code",[t._v("graphQL")]),t._v(" function which will turn our simple resolver value into a GraphQL API definition.\nThe whole schema will be derived at compile time, meaning that if it compiles, it will be able to serve it.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("GraphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("graphQL\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" caliban"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("RootResolver\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("RootResolver"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("You can use "),s("code",[t._v("api.render")]),t._v(" to visualize the schema generated, in this case:")]),t._v(" "),s("div",{staticClass:"language-graphql extra-class"},[s("pre",{pre:!0,attrs:{class:"language-graphql"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Character")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("name")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" String"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("age")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" Int"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Queries")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("characters")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("character")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("name")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" String"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" Character\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("In order to process requests, you need to turn your API into an interpreter, which can be done easily by calling "),s("code",[t._v(".interpreter")]),t._v(".\nAn interpreter is a light wrapper around the API definition that allows plugging in some middleware and possibly modifying the environment and error types (see "),s("RouterLink",{attrs:{to:"/docs/middleware.html"}},[t._v("Middleware")]),t._v(" for more info).\nCreating the interpreter may fail with a "),s("code",[t._v("ValidationError")]),t._v(" if some type is found invalid.")],1),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n interpreter "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" api"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("interpreter\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("yield")]),t._v(" interpreter\n")])])]),s("p",[t._v("Now you can call "),s("code",[t._v("interpreter.execute")]),t._v(" with a given GraphQL query, and you will get an "),s("code",[t._v("ZIO[R, Nothing, GraphQLResponse[CalibanError]]")]),t._v(" as a response, with "),s("code",[t._v("GraphQLResponse")]),t._v(" defined as follows:")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" GraphQLResponse"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v("E"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("data"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ResponseValue"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" errors"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("E"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("Use "),s("code",[t._v("ResponseValue#toString")]),t._v(" to get the JSON representation of the result.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" query "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token triple-quoted-string string"}},[t._v('"""\n {\n characters {\n name\n }\n }"""')]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n result "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" interpreter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("execute"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("query"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n _ "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("<-")]),t._v(" zio"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("console"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("putStrLn"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("result"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("toString"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("yield")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("A "),s("code",[t._v("CalibanError")]),t._v(" can be:")]),t._v(" "),s("ul",[s("li",[t._v("a "),s("code",[t._v("ParsingError")]),t._v(": the query has invalid syntax")]),t._v(" "),s("li",[t._v("a "),s("code",[t._v("ValidationError")]),t._v(": the query was parsed but does not match the schema")]),t._v(" "),s("li",[t._v("an "),s("code",[t._v("ExecutionError")]),t._v(": an error happened while executing the query")])]),t._v(" "),s("p",[t._v("Caliban itself is not tied to any web framework, you are free to expose this function using the protocol and library of your choice. The "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/http4s",target:"_blank",rel:"noopener noreferrer"}},[t._v("caliban-http4s"),s("OutboundLink")],1),t._v(" module provides an "),s("code",[t._v("Http4sAdapter")]),t._v(" that exposes an interpreter over HTTP and WebSocket using http4s. There is also a "),s("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/akka-http",target:"_blank",rel:"noopener noreferrer"}},[t._v("caliban-akka-http"),s("OutboundLink")],1),t._v(" that provides similar functionality for Akka HTTP.")]),t._v(" "),s("div",{staticClass:"custom-block tip"},[s("p",{staticClass:"custom-block-title"},[t._v("Combining GraphQL APIs")]),t._v(" "),s("p",[t._v("You don't have to define all your root fields into a single case class: you can use smaller case classes and combine "),s("code",[t._v("GraphQL")]),t._v(" objects using the "),s("code",[t._v("|+|")]),t._v(" operator.")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api1 "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api2 "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" api1 "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("|")]),t._v(" api2\n")])])]),s("p",[t._v("You can use "),s("code",[t._v(".rename")]),t._v(" to change the names of the generated root types.")])]),t._v(" "),s("h2",{attrs:{id:"mutations"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#mutations"}},[t._v("#")]),t._v(" Mutations")]),t._v(" "),s("p",[t._v("Creating mutations is the same as queries, except you pass them as the second argument to "),s("code",[t._v("RootResolver")]),t._v(":")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" CharacterArgs"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("name"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Mutations"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("deleteCharacter"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" CharacterArgs "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v(" Task"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Boolean")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" mutations "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Mutations"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("RootResolver"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" mutations"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("h2",{attrs:{id:"subscriptions"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#subscriptions"}},[t._v("#")]),t._v(" Subscriptions")]),t._v(" "),s("p",[t._v("Similarly, subscriptions are passed as the third argument to "),s("code",[t._v("RootResolver")]),t._v(":")]),t._v(" "),s("div",{staticClass:"language-scala extra-class"},[s("pre",{pre:!0,attrs:{class:"language-scala"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" Subscriptions"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("deletedCharacter"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" ZStream"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Any")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("Nothing")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Character"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" subscriptions "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Subscriptions"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" api "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" graphQL"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("RootResolver"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("queries"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" mutations"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" subscriptions"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),s("p",[t._v("All the fields of the subscription root case class MUST return "),s("code",[t._v("ZStream")]),t._v(" or "),s("code",[t._v("? => ZStream")]),t._v(" objects. When a subscription request is received, an output stream of "),s("code",[t._v("ResponseValue")]),t._v(" (a "),s("code",[t._v("StreamValue")]),t._v(") will be returned wrapped inside an "),s("code",[t._v("ObjectValue")]),t._v(".")])])}),[],!1,null,null,null);a.default=n.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/8.6272775d.js b/docs/assets/js/8.4c5efb33.js similarity index 99% rename from docs/assets/js/8.6272775d.js rename to docs/assets/js/8.4c5efb33.js index cee574a9e..6fc7bbda5 100644 --- a/docs/assets/js/8.6272775d.js +++ b/docs/assets/js/8.4c5efb33.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[8],{208:function(t,a,e){"use strict";e.r(a);var s=e(28),n=Object(s.a)({},(function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[e("h1",{attrs:{id:"graphql-client"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#graphql-client"}},[t._v("#")]),t._v(" GraphQL Client")]),t._v(" "),e("p",[e("strong",[t._v("Caliban-client")]),t._v(" is a module independent from Caliban that makes it possible to write GraphQL queries using Scala code in a type-safe and functional fashion. It is built on top of "),e("a",{attrs:{href:"https://github.com/softwaremill/sttp",target:"_blank",rel:"noopener noreferrer"}},[t._v("sttp"),e("OutboundLink")],1),t._v(", which means you can run requests using the backend of your choice.")]),t._v(" "),e("p",[t._v("Just like Caliban, "),e("code",[t._v("caliban-client")]),t._v(" offers a purely functional interface and keeps the boilerplate minimal. It works as follows:")]),t._v(" "),e("ol",[e("li",[t._v("Use the "),e("code",[t._v("caliban-codegen")]),t._v(" tool to generate boilerplate code from a given GraphQL schema")]),t._v(" "),e("li",[t._v("Write your GraphQL query/mutation by combining helpers from the generated code")]),t._v(" "),e("li",[t._v("Transform your query/mutation into an "),e("code",[t._v("sttp")]),t._v(" request and run it with your preferred backend")])]),t._v(" "),e("h2",{attrs:{id:"dependencies"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#dependencies"}},[t._v("#")]),t._v(" Dependencies")]),t._v(" "),e("p",[t._v("To use "),e("code",[t._v("caliban-client")]),t._v(", add the following line in your "),e("code",[t._v("build.sbt")]),t._v(" file:")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v('libraryDependencies += "com.github.ghostdogpr" %% "caliban-client" % "0.6.0"\n')])])]),e("p",[t._v("Caliban-client is available for ScalaJS.")]),t._v(" "),e("h2",{attrs:{id:"code-generation"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#code-generation"}},[t._v("#")]),t._v(" Code generation")]),t._v(" "),e("p",[t._v("The first step for building GraphQL queries with "),e("code",[t._v("caliban-client")]),t._v(" is to generate boilerplate code from a GraphQL schema. For that, you need a file containing your schema (if your backend uses "),e("code",[t._v("caliban")]),t._v(", you can get it by calling "),e("code",[t._v("GraphQL#render")]),t._v(" on your API).")]),t._v(" "),e("p",[t._v("To use this feature, add the "),e("code",[t._v("caliban-codegen")]),t._v(" sbt plugin to your project and enable it.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[t._v("addSbtPlugin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"com.github.ghostdogpr"')]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("%")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"caliban-codegen"')]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("%")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"0.6.0"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\nenablePlugins"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("CodegenPlugin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("p",[t._v("Then call the "),e("code",[t._v("calibanGenClient")]),t._v(" sbt command.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[t._v("calibanGenClient schemaPath outPath "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("scalafmtPath\n\ncalibanGenClient project"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("schema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("graphql src"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("main"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("Client"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("scala\n")])])]),e("p",[t._v("This command will generate a Scala file in "),e("code",[t._v("outputPath")]),t._v(" containing helper functions for all the types defined in the provided GraphQL schema defined at "),e("code",[t._v("schemaPath")]),t._v(". The generated code will be formatted with Scalafmt using the configuration defined by "),e("code",[t._v("scalafmtPath")]),t._v(" (default: "),e("code",[t._v(".scalafmt.conf")]),t._v(").")]),t._v(" "),e("h2",{attrs:{id:"query-building"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#query-building"}},[t._v("#")]),t._v(" Query building")]),t._v(" "),e("p",[t._v("Once the boilerplate code is generated, you can start building queries. For each "),e("em",[t._v("type")]),t._v(" in your schema, a corresponding Scala object has been created. For each "),e("em",[t._v("field")]),t._v(" in your schema, a corresponding Scala function has been created.")]),t._v(" "),e("p",[t._v("For example, given the following schema:")]),t._v(" "),e("div",{staticClass:"language-graphql extra-class"},[e("pre",{pre:!0,attrs:{class:"language-graphql"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Character")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("name")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" String"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("nicknames")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("String"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("origin")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" Origin"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("Your generated code will have the following:")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" Character "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" name"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SelectionBuilder"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" nicknames"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SelectionBuilder"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" origin"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SelectionBuilder"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Origin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("A "),e("code",[t._v("SelectionBuilder[Origin, A]")]),t._v(" is a selection from a parent type "),e("code",[t._v("Origin")]),t._v(" that returns a result of type "),e("code",[t._v("A")]),t._v(". In this example, "),e("code",[t._v("name")]),t._v(" is a selection from a "),e("code",[t._v("Character")]),t._v(" that returns a "),e("code",[t._v("String")]),t._v(".")]),t._v(" "),e("p",[t._v("You can combine multiple selections using the "),e("code",[t._v("~")]),t._v(" operator. The new result type will be a tuple from the 2 combined result types. Note that you can only combine selections that have the same origin.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" selection"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SelectionBuilder"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("name "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("~")]),t._v(" Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("nicknames\n")])])]),e("p",[t._v("If you combine multiple fields, it is more convenient to have a case class to represent your data (to avoid seeing nested tuples). You can use "),e("code",[t._v("mapN")]),t._v(" to map a nested tuple to a case class.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" CharacterView"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("name"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" nickname"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" origin"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Origin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" character"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SelectionBuilder"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" CharacterView"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("name "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("~")]),t._v(" Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("nicknames "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("~")]),t._v(" Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("origin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mapN"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("CharacterView"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("p",[t._v("Fields that return an object type will require an inner selection, which is another "),e("code",[t._v("SelectionBuilder")]),t._v(". Let's consider the following "),e("code",[t._v("Query")]),t._v(" type.")]),t._v(" "),e("div",{staticClass:"language-graphql extra-class"},[e("pre",{pre:!0,attrs:{class:"language-graphql"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Query")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("characters")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("When calling "),e("code",[t._v("characters")]),t._v(", we need to provide a "),e("code",[t._v("SelectionBuilder[Character, ?]")]),t._v(" to indicate which fields to select on the returned "),e("code",[t._v("Character")]),t._v(".")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" query"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SelectionBuilder"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("RootQuery"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("CharacterView"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" \n Query"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("characters "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("name "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("~")]),t._v(" Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("nicknames "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("~")]),t._v(" Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("origin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mapN"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("CharacterView"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("Or if we reuse the "),e("code",[t._v("character")]),t._v(" selection we just created:")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" query"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SelectionBuilder"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("RootQuery"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("CharacterView"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" \n Query"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("characters "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n character\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("Because this is Scala code, you can easily reuse a selection in multiple places without having to worry about GraphQL fragments. The Scala compiler will also make sure that you only combine fields that make sense.")]),t._v(" "),e("p",[t._v("When a field requires an argument, the helper method for the field will require one as well. Let's enrich our query:")]),t._v(" "),e("div",{staticClass:"language-graphql extra-class"},[e("pre",{pre:!0,attrs:{class:"language-graphql"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Query")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("characters")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("origin")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" Origin"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("You now need to provide an "),e("code",[t._v("Origin")]),t._v(" when calling "),e("code",[t._v("characters")]),t._v(":")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" query"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SelectionBuilder"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("RootQuery"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("CharacterView"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" \n Query"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("characters"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("Origin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("MARS"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n character\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("h2",{attrs:{id:"request-execution"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#request-execution"}},[t._v("#")]),t._v(" Request execution")]),t._v(" "),e("p",[t._v("Once your query or mutation is created, it is time to execute it. To do that, you can transform your "),e("code",[t._v("SelectionBuilder")]),t._v(" into an "),e("code",[t._v("sttp")]),t._v(" request by calling "),e("code",[t._v(".toRequest")]),t._v(". This function takes the URL of your GraphQL server and an optional boolean "),e("code",[t._v("useVariables")]),t._v(" that determines if arguments should be using variables or not (default: false).")]),t._v(" "),e("p",[t._v("You can then simply run the "),e("code",[t._v("sttp")]),t._v(" request with the backend of your choice. See the "),e("a",{attrs:{href:"https://sttp.readthedocs.io/en/latest/",target:"_blank",rel:"noopener noreferrer"}},[t._v("sttp docs"),e("OutboundLink")],1),t._v(" if you are not familiar with it.")]),t._v(" "),e("p",[t._v("Here is an example using the "),e("code",[t._v("AsyncHttpClient")]),t._v(" backend for "),e("code",[t._v("ZIO")]),t._v(":")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("sttp"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("client")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("sttp"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("client"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("asynchttpclient"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("zio")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("AsyncHttpClientZioBackend\n\nAsyncHttpClientZioBackend"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("flatMap "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" backend "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" serverUrl "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" uri"),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"http://localhost:8088/api/graphql"')]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" result"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Task"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("CharacterView"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" \n query"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("toRequest"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("serverUrl"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("send"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("map"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("_"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("body"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("absolve\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("As a result, we get a ZIO "),e("code",[t._v("Task")]),t._v(" whose return type is the same as our "),e("code",[t._v("SelectionBuilder")]),t._v(". The sttp request does not only contain the request to send, but also takes care of parsing the response into the expected type.")]),t._v(" "),e("p",[t._v("The "),e("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/examples/",target:"_blank",rel:"noopener noreferrer"}},[t._v("examples"),e("OutboundLink")],1),t._v(" project contains a runnable sample code that queries the example GraphQL backend.")]),t._v(" "),e("div",{staticClass:"custom-block warning"},[e("p",{staticClass:"custom-block-title"},[t._v("Limitations")]),t._v(" "),e("p",[t._v("Only Queries and Mutations are supported. Subscriptions support will be added in the future.\nType extensions are not supported by the codegen tool.")])])])}),[],!1,null,null,null);a.default=n.exports}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[8],{207:function(t,a,e){"use strict";e.r(a);var s=e(28),n=Object(s.a)({},(function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[e("h1",{attrs:{id:"graphql-client"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#graphql-client"}},[t._v("#")]),t._v(" GraphQL Client")]),t._v(" "),e("p",[e("strong",[t._v("Caliban-client")]),t._v(" is a module independent from Caliban that makes it possible to write GraphQL queries using Scala code in a type-safe and functional fashion. It is built on top of "),e("a",{attrs:{href:"https://github.com/softwaremill/sttp",target:"_blank",rel:"noopener noreferrer"}},[t._v("sttp"),e("OutboundLink")],1),t._v(", which means you can run requests using the backend of your choice.")]),t._v(" "),e("p",[t._v("Just like Caliban, "),e("code",[t._v("caliban-client")]),t._v(" offers a purely functional interface and keeps the boilerplate minimal. It works as follows:")]),t._v(" "),e("ol",[e("li",[t._v("Use the "),e("code",[t._v("caliban-codegen")]),t._v(" tool to generate boilerplate code from a given GraphQL schema")]),t._v(" "),e("li",[t._v("Write your GraphQL query/mutation by combining helpers from the generated code")]),t._v(" "),e("li",[t._v("Transform your query/mutation into an "),e("code",[t._v("sttp")]),t._v(" request and run it with your preferred backend")])]),t._v(" "),e("h2",{attrs:{id:"dependencies"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#dependencies"}},[t._v("#")]),t._v(" Dependencies")]),t._v(" "),e("p",[t._v("To use "),e("code",[t._v("caliban-client")]),t._v(", add the following line in your "),e("code",[t._v("build.sbt")]),t._v(" file:")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v('libraryDependencies += "com.github.ghostdogpr" %% "caliban-client" % "0.6.0"\n')])])]),e("p",[t._v("Caliban-client is available for ScalaJS.")]),t._v(" "),e("h2",{attrs:{id:"code-generation"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#code-generation"}},[t._v("#")]),t._v(" Code generation")]),t._v(" "),e("p",[t._v("The first step for building GraphQL queries with "),e("code",[t._v("caliban-client")]),t._v(" is to generate boilerplate code from a GraphQL schema. For that, you need a file containing your schema (if your backend uses "),e("code",[t._v("caliban")]),t._v(", you can get it by calling "),e("code",[t._v("GraphQL#render")]),t._v(" on your API).")]),t._v(" "),e("p",[t._v("To use this feature, add the "),e("code",[t._v("caliban-codegen")]),t._v(" sbt plugin to your project and enable it.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[t._v("addSbtPlugin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"com.github.ghostdogpr"')]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("%")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"caliban-codegen"')]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("%")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"0.6.0"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\nenablePlugins"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("CodegenPlugin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("p",[t._v("Then call the "),e("code",[t._v("calibanGenClient")]),t._v(" sbt command.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[t._v("calibanGenClient schemaPath outPath "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("scalafmtPath\n\ncalibanGenClient project"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("schema"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("graphql src"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("main"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("Client"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("scala\n")])])]),e("p",[t._v("This command will generate a Scala file in "),e("code",[t._v("outputPath")]),t._v(" containing helper functions for all the types defined in the provided GraphQL schema defined at "),e("code",[t._v("schemaPath")]),t._v(". The generated code will be formatted with Scalafmt using the configuration defined by "),e("code",[t._v("scalafmtPath")]),t._v(" (default: "),e("code",[t._v(".scalafmt.conf")]),t._v(").")]),t._v(" "),e("h2",{attrs:{id:"query-building"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#query-building"}},[t._v("#")]),t._v(" Query building")]),t._v(" "),e("p",[t._v("Once the boilerplate code is generated, you can start building queries. For each "),e("em",[t._v("type")]),t._v(" in your schema, a corresponding Scala object has been created. For each "),e("em",[t._v("field")]),t._v(" in your schema, a corresponding Scala function has been created.")]),t._v(" "),e("p",[t._v("For example, given the following schema:")]),t._v(" "),e("div",{staticClass:"language-graphql extra-class"},[e("pre",{pre:!0,attrs:{class:"language-graphql"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Character")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("name")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" String"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("nicknames")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("String"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("origin")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" Origin"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("Your generated code will have the following:")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("object")]),t._v(" Character "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" name"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SelectionBuilder"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" nicknames"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SelectionBuilder"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("def")]),t._v(" origin"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SelectionBuilder"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Origin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("A "),e("code",[t._v("SelectionBuilder[Origin, A]")]),t._v(" is a selection from a parent type "),e("code",[t._v("Origin")]),t._v(" that returns a result of type "),e("code",[t._v("A")]),t._v(". In this example, "),e("code",[t._v("name")]),t._v(" is a selection from a "),e("code",[t._v("Character")]),t._v(" that returns a "),e("code",[t._v("String")]),t._v(".")]),t._v(" "),e("p",[t._v("You can combine multiple selections using the "),e("code",[t._v("~")]),t._v(" operator. The new result type will be a tuple from the 2 combined result types. Note that you can only combine selections that have the same origin.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" selection"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SelectionBuilder"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("name "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("~")]),t._v(" Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("nicknames\n")])])]),e("p",[t._v("If you combine multiple fields, it is more convenient to have a case class to represent your data (to avoid seeing nested tuples). You can use "),e("code",[t._v("mapN")]),t._v(" to map a nested tuple to a case class.")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("case")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" CharacterView"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("name"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" nickname"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),e("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("String")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" origin"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Origin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" character"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SelectionBuilder"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" CharacterView"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("name "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("~")]),t._v(" Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("nicknames "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("~")]),t._v(" Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("origin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mapN"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("CharacterView"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),e("p",[t._v("Fields that return an object type will require an inner selection, which is another "),e("code",[t._v("SelectionBuilder")]),t._v(". Let's consider the following "),e("code",[t._v("Query")]),t._v(" type.")]),t._v(" "),e("div",{staticClass:"language-graphql extra-class"},[e("pre",{pre:!0,attrs:{class:"language-graphql"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Query")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("characters")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("When calling "),e("code",[t._v("characters")]),t._v(", we need to provide a "),e("code",[t._v("SelectionBuilder[Character, ?]")]),t._v(" to indicate which fields to select on the returned "),e("code",[t._v("Character")]),t._v(".")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" query"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SelectionBuilder"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("RootQuery"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("CharacterView"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" \n Query"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("characters "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("name "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("~")]),t._v(" Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("nicknames "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("~")]),t._v(" Character"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("origin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("mapN"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("CharacterView"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("Or if we reuse the "),e("code",[t._v("character")]),t._v(" selection we just created:")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" query"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SelectionBuilder"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("RootQuery"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("CharacterView"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" \n Query"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("characters "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n character\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("Because this is Scala code, you can easily reuse a selection in multiple places without having to worry about GraphQL fragments. The Scala compiler will also make sure that you only combine fields that make sense.")]),t._v(" "),e("p",[t._v("When a field requires an argument, the helper method for the field will require one as well. Let's enrich our query:")]),t._v(" "),e("div",{staticClass:"language-graphql extra-class"},[e("pre",{pre:!0,attrs:{class:"language-graphql"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("type")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Query")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("characters")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("origin")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" Origin"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("Character"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("You now need to provide an "),e("code",[t._v("Origin")]),t._v(" when calling "),e("code",[t._v("characters")]),t._v(":")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" query"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SelectionBuilder"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("RootQuery"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("CharacterView"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" \n Query"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("characters"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("Origin"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("MARS"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n character\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("h2",{attrs:{id:"request-execution"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#request-execution"}},[t._v("#")]),t._v(" Request execution")]),t._v(" "),e("p",[t._v("Once your query or mutation is created, it is time to execute it. To do that, you can transform your "),e("code",[t._v("SelectionBuilder")]),t._v(" into an "),e("code",[t._v("sttp")]),t._v(" request by calling "),e("code",[t._v(".toRequest")]),t._v(". This function takes the URL of your GraphQL server and an optional boolean "),e("code",[t._v("useVariables")]),t._v(" that determines if arguments should be using variables or not (default: false).")]),t._v(" "),e("p",[t._v("You can then simply run the "),e("code",[t._v("sttp")]),t._v(" request with the backend of your choice. See the "),e("a",{attrs:{href:"https://sttp.readthedocs.io/en/latest/",target:"_blank",rel:"noopener noreferrer"}},[t._v("sttp docs"),e("OutboundLink")],1),t._v(" if you are not familiar with it.")]),t._v(" "),e("p",[t._v("Here is an example using the "),e("code",[t._v("AsyncHttpClient")]),t._v(" backend for "),e("code",[t._v("ZIO")]),t._v(":")]),t._v(" "),e("div",{staticClass:"language-scala extra-class"},[e("pre",{pre:!0,attrs:{class:"language-scala"}},[e("code",[e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("sttp"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("client")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("_\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("sttp"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("client"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("asynchttpclient"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("zio")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("AsyncHttpClientZioBackend\n\nAsyncHttpClientZioBackend"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("flatMap "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("implicit")]),t._v(" backend "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("=>")]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" serverUrl "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" uri"),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"http://localhost:8088/api/graphql"')]),t._v("\n "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("val")]),t._v(" result"),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" Task"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("List"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("CharacterView"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" \n query"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("toRequest"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("serverUrl"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("send"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("map"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("_"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("body"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("absolve\n "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("As a result, we get a ZIO "),e("code",[t._v("Task")]),t._v(" whose return type is the same as our "),e("code",[t._v("SelectionBuilder")]),t._v(". The sttp request does not only contain the request to send, but also takes care of parsing the response into the expected type.")]),t._v(" "),e("p",[t._v("The "),e("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/examples/",target:"_blank",rel:"noopener noreferrer"}},[t._v("examples"),e("OutboundLink")],1),t._v(" project contains a runnable sample code that queries the example GraphQL backend.")]),t._v(" "),e("div",{staticClass:"custom-block warning"},[e("p",{staticClass:"custom-block-title"},[t._v("Limitations")]),t._v(" "),e("p",[t._v("Only Queries and Mutations are supported. Subscriptions support will be added in the future.\nType extensions are not supported by the codegen tool.")])])])}),[],!1,null,null,null);a.default=n.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/9.417f11bf.js b/docs/assets/js/9.08ac8c9e.js similarity index 94% rename from docs/assets/js/9.417f11bf.js rename to docs/assets/js/9.08ac8c9e.js index 77a886e84..dcb716f07 100644 --- a/docs/assets/js/9.417f11bf.js +++ b/docs/assets/js/9.08ac8c9e.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[9],{206:function(e,t,r){"use strict";r.r(t);var n=r(28),a=Object(n.a)({},(function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("ContentSlotsDistributor",{attrs:{"slot-key":e.$parent.slotKey}},[r("h1",{attrs:{id:"examples"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#examples"}},[e._v("#")]),e._v(" Examples")]),e._v(" "),r("p",[e._v("A sample project showing how to serve a simple GraphQL schema over HTTP and WebSocket using\n"),r("a",{attrs:{href:"https://github.com/http4s/http4s",target:"_blank",rel:"noopener noreferrer"}},[e._v("http4s"),r("OutboundLink")],1),e._v(" or\n"),r("a",{attrs:{href:"https://doc.akka.io/docs/akka-http/current/index.html",target:"_blank",rel:"noopener noreferrer"}},[e._v("Akka HTTP"),r("OutboundLink")],1),e._v(" or\n"),r("a",{attrs:{href:"https://finagle.github.io/finch/",target:"_blank",rel:"noopener noreferrer"}},[e._v("Finch"),r("OutboundLink")],1),e._v(" is available in\nthe\n"),r("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/examples/",target:"_blank",rel:"noopener noreferrer"}},[e._v("examples"),r("OutboundLink")],1),e._v(" folder.")])])}),[],!1,null,null,null);t.default=a.exports}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[9],{208:function(e,t,r){"use strict";r.r(t);var n=r(28),a=Object(n.a)({},(function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("ContentSlotsDistributor",{attrs:{"slot-key":e.$parent.slotKey}},[r("h1",{attrs:{id:"examples"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#examples"}},[e._v("#")]),e._v(" Examples")]),e._v(" "),r("p",[e._v("A sample project showing how to serve a simple GraphQL schema over HTTP and WebSocket using\n"),r("a",{attrs:{href:"https://github.com/http4s/http4s",target:"_blank",rel:"noopener noreferrer"}},[e._v("http4s"),r("OutboundLink")],1),e._v(" or\n"),r("a",{attrs:{href:"https://doc.akka.io/docs/akka-http/current/index.html",target:"_blank",rel:"noopener noreferrer"}},[e._v("Akka HTTP"),r("OutboundLink")],1),e._v(" or\n"),r("a",{attrs:{href:"https://finagle.github.io/finch/",target:"_blank",rel:"noopener noreferrer"}},[e._v("Finch"),r("OutboundLink")],1),e._v(" is available in\nthe\n"),r("a",{attrs:{href:"https://github.com/ghostdogpr/caliban/tree/master/examples/",target:"_blank",rel:"noopener noreferrer"}},[e._v("examples"),r("OutboundLink")],1),e._v(" folder.")])])}),[],!1,null,null,null);t.default=a.exports}}]); \ No newline at end of file diff --git a/docs/assets/js/app.d7caee50.js b/docs/assets/js/app.3687d251.js similarity index 97% rename from docs/assets/js/app.d7caee50.js rename to docs/assets/js/app.3687d251.js index d3608c40d..ba8fcee74 100644 --- a/docs/assets/js/app.d7caee50.js +++ b/docs/assets/js/app.3687d251.js @@ -1,4 +1,4 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[0],[]]);!function(t){function e(e){for(var r,a,s=e[0],c=e[1],u=e[2],l=0,p=[];l<s.length;l++)a=s[l],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&p.push(o[a][0]),o[a]=0;for(r in c)Object.prototype.hasOwnProperty.call(c,r)&&(t[r]=c[r]);for(f&&f(e);p.length;)p.shift()();return i.push.apply(i,u||[]),n()}function n(){for(var t,e=0;e<i.length;e++){for(var n=i[e],r=!0,s=1;s<n.length;s++){var c=n[s];0!==o[c]&&(r=!1)}r&&(i.splice(e--,1),t=a(a.s=n[0]))}return t}var r={},o={1:0},i=[];function a(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.e=function(t){var e=[],n=o[t];if(0!==n)if(n)e.push(n[2]);else{var r=new Promise((function(e,r){n=o[t]=[e,r]}));e.push(n[2]=r);var i,s=document.createElement("script");s.charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.src=function(t){return a.p+"assets/js/"+({}[t]||t)+"."+{2:"07c68b8b",3:"865f603a",4:"f03b7f8e",5:"5defc76c",6:"d222e5e8",7:"57a8ce51",8:"6272775d",9:"417f11bf",10:"5f8b2c07",11:"5f34d6b0",12:"bc45abe0",13:"d315a1c7",14:"b8b8c6ff",15:"23ceaf26",16:"f357ff30",17:"fa6e8c03"}[t]+".js"}(t);var c=new Error;i=function(e){s.onerror=s.onload=null,clearTimeout(u);var n=o[t];if(0!==n){if(n){var r=e&&("load"===e.type?"missing":e.type),i=e&&e.target&&e.target.src;c.message="Loading chunk "+t+" failed.\n("+r+": "+i+")",c.name="ChunkLoadError",c.type=r,c.request=i,n[1](c)}o[t]=void 0}};var u=setTimeout((function(){i({type:"timeout",target:s})}),12e4);s.onerror=s.onload=i,document.head.appendChild(s)}return Promise.all(e)},a.m=t,a.c=r,a.d=function(t,e,n){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)a.d(n,r,function(e){return t[e]}.bind(null,r));return n},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="/caliban/",a.oe=function(t){throw console.error(t),t};var s=window.webpackJsonp=window.webpackJsonp||[],c=s.push.bind(s);s.push=e,s=s.slice();for(var u=0;u<s.length;u++)e(s[u]);var f=c;i.push([111,0]),n()}([function(t,e,n){var r=n(3),o=n(20).f,i=n(9),a=n(13),s=n(47),c=n(73),u=n(62);t.exports=function(t,e){var n,f,l,p,d,h=t.target,v=t.global,y=t.stat;if(n=v?r:y?r[h]||s(h,{}):(r[h]||{}).prototype)for(f in e){if(p=e[f],l=t.noTargetGet?(d=o(n,f))&&d.value:n[f],!u(v?f:h+(y?".":"#")+f,t.forced)&&void 0!==l){if(typeof p==typeof l)continue;c(p,l)}(t.sham||l&&l.sham)&&i(p,"sham",!0),a(n,f,p,t)}}},function(t,e,n){var r=n(3),o=n(48),i=n(5),a=n(33),s=n(52),c=n(79),u=o("wks"),f=r.Symbol,l=c?f:f&&f.withoutSetter||a;t.exports=function(t){return i(u,t)||(s&&i(f,t)?u[t]=f[t]:u[t]=l("Symbol."+t)),u[t]}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){var n=function(t){return t&&t.Math==Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof global&&global)||Function("return this")()},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var r=n(2);t.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(t,e,n){var r=n(6),o=n(69),i=n(8),a=n(31),s=Object.defineProperty;e.f=r?s:function(t,e,n){if(i(t),e=a(e,!0),i(n),o)try{return s(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){var r=n(4);t.exports=function(t){if(!r(t))throw TypeError(String(t)+" is not an object");return t}},function(t,e,n){var r=n(6),o=n(7),i=n(21);t.exports=r?function(t,e,n){return o.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(43),o=n(16);t.exports=function(t){return r(o(t))}},function(t,e,n){var r=n(6),o=n(2),i=n(5),a=Object.defineProperty,s={},c=function(t){throw t};t.exports=function(t,e){if(i(s,t))return s[t];e||(e={});var n=[][t],u=!!i(e,"ACCESSORS")&&e.ACCESSORS,f=i(e,0)?e[0]:c,l=i(e,1)?e[1]:void 0;return s[t]=!!n&&!o((function(){if(u&&!r)return!0;var t={length:-1};u?a(t,1,{enumerable:!0,get:c}):t[1]=1,n.call(t,f,l)}))}},function(t,e,n){var r=n(34),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,e,n){var r=n(3),o=n(9),i=n(5),a=n(47),s=n(71),c=n(18),u=c.get,f=c.enforce,l=String(String).split("String");(t.exports=function(t,e,n,s){var c=!!s&&!!s.unsafe,u=!!s&&!!s.enumerable,p=!!s&&!!s.noTargetGet;"function"==typeof n&&("string"!=typeof e||i(n,"name")||o(n,"name",e),f(n).source=l.join("string"==typeof e?e:"")),t!==r?(c?!p&&t[e]&&(u=!0):delete t[e],u?t[e]=n:o(t,e,n)):u?t[e]=n:a(e,n)})(Function.prototype,"toString",(function(){return"function"==typeof this&&u(this).source||s(this)}))},function(t,e,n){var r=n(16);t.exports=function(t){return Object(r(t))}},function(t,e,n){var r=n(53),o=n(13),i=n(114);r||o(Object.prototype,"toString",i,{unsafe:!0})},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){"use strict";var r=n(0),o=n(19).filter,i=n(45),a=n(11),s=i("filter"),c=a("filter");r({target:"Array",proto:!0,forced:!s||!c},{filter:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){var r,o,i,a=n(112),s=n(3),c=n(4),u=n(9),f=n(5),l=n(32),p=n(24),d=s.WeakMap;if(a){var h=new d,v=h.get,y=h.has,m=h.set;r=function(t,e){return m.call(h,t,e),e},o=function(t){return v.call(h,t)||{}},i=function(t){return y.call(h,t)}}else{var g=l("state");p[g]=!0,r=function(t,e){return u(t,g,e),e},o=function(t){return f(t,g)?t[g]:{}},i=function(t){return f(t,g)}}t.exports={set:r,get:o,has:i,enforce:function(t){return i(t)?o(t):r(t,{})},getterFor:function(t){return function(e){var n;if(!c(e)||(n=o(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}}}},function(t,e,n){var r=n(51),o=n(43),i=n(14),a=n(12),s=n(104),c=[].push,u=function(t){var e=1==t,n=2==t,u=3==t,f=4==t,l=6==t,p=5==t||l;return function(d,h,v,y){for(var m,g,b=i(d),_=o(b),x=r(h,v,3),w=a(_.length),S=0,O=y||s,E=e?O(d,w):n?O(d,0):void 0;w>S;S++)if((p||S in _)&&(g=x(m=_[S],S,b),t))if(e)E[S]=g;else if(g)switch(t){case 3:return!0;case 5:return m;case 6:return S;case 2:c.call(E,m)}else if(f)return!1;return l?-1:u||f?f:E}};t.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6)}},function(t,e,n){var r=n(6),o=n(68),i=n(21),a=n(10),s=n(31),c=n(5),u=n(69),f=Object.getOwnPropertyDescriptor;e.f=r?f:function(t,e){if(t=a(t),e=s(e,!0),u)try{return f(t,e)}catch(t){}if(c(t,e))return i(!o.f.call(t,e),t[e])}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e){t.exports=!1},function(t,e){t.exports={}},function(t,e,n){var r=n(75),o=n(3),i=function(t){return"function"==typeof t?t:void 0};t.exports=function(t,e){return arguments.length<2?i(r[t])||i(o[t]):r[t]&&r[t][e]||o[t]&&o[t][e]}},function(t,e,n){var r,o=n(8),i=n(116),a=n(50),s=n(24),c=n(117),u=n(70),f=n(32),l=f("IE_PROTO"),p=function(){},d=function(t){return"<script>"+t+"<\/script>"},h=function(){try{r=document.domain&&new ActiveXObject("htmlfile")}catch(t){}var t,e;h=r?function(t){t.write(d("")),t.close();var e=t.parentWindow.Object;return t=null,e}(r):((e=u("iframe")).style.display="none",c.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(d("document.F=Object")),t.close(),t.F);for(var n=a.length;n--;)delete h.prototype[a[n]];return h()};s[l]=!0,t.exports=Object.create||function(t,e){var n;return null!==t?(p.prototype=o(t),n=new p,p.prototype=null,n[l]=t):n=h(),void 0===e?n:i(n,e)}},function(t,e){t.exports={}},function(t,e,n){"use strict";function r(t,e,n,r,o,i,a,s){var c,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),r&&(u.functional=!0),i&&(u._scopeId="data-v-"+i),a?(c=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},u._ssrRegister=c):o&&(c=s?function(){o.call(this,this.$root.$options.shadowRoot)}:o),c)if(u.functional){u._injectStyles=c;var f=u.render;u.render=function(t,e){return c.call(e),f(t,e)}}else{var l=u.beforeCreate;u.beforeCreate=l?[].concat(l,c):[c]}return{exports:t,options:u}}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";var r=n(0),o=n(46);r({target:"RegExp",proto:!0,forced:/./.exec!==o},{exec:o})},function(t,e,n){"use strict";var r=n(2);t.exports=function(t,e){var n=[][t];return!!n&&r((function(){n.call(null,e||function(){throw 1},1)}))}},function(t,e,n){var r=n(4);t.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e,n){var r=n(48),o=n(33),i=r("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++n+r).toString(36)}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e,n){"use strict";var r=n(0),o=n(4),i=n(42),a=n(77),s=n(12),c=n(10),u=n(64),f=n(1),l=n(45),p=n(11),d=l("slice"),h=p("slice",{ACCESSORS:!0,0:0,1:2}),v=f("species"),y=[].slice,m=Math.max;r({target:"Array",proto:!0,forced:!d||!h},{slice:function(t,e){var n,r,f,l=c(this),p=s(l.length),d=a(t,p),h=a(void 0===e?p:e,p);if(i(l)&&("function"!=typeof(n=l.constructor)||n!==Array&&!i(n.prototype)?o(n)&&null===(n=n[v])&&(n=void 0):n=void 0,n===Array||void 0===n))return y.call(l,d,h);for(r=new(void 0===n?Array:n)(m(h-d,0)),f=0;d<h;d++,f++)d in l&&u(r,f,l[d]);return r.length=f,r}})},function(t,e,n){var r=n(7).f,o=n(5),i=n(1)("toStringTag");t.exports=function(t,e,n){t&&!o(t=n?t:t.prototype,i)&&r(t,i,{configurable:!0,value:e})}},function(t,e,n){},function(t,e,n){"use strict";function r(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}n.d(e,"a",(function(){return r}))},function(t,e,n){var r,o; +(window.webpackJsonp=window.webpackJsonp||[]).push([[0],[]]);!function(t){function e(e){for(var r,a,s=e[0],c=e[1],u=e[2],l=0,p=[];l<s.length;l++)a=s[l],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&p.push(o[a][0]),o[a]=0;for(r in c)Object.prototype.hasOwnProperty.call(c,r)&&(t[r]=c[r]);for(f&&f(e);p.length;)p.shift()();return i.push.apply(i,u||[]),n()}function n(){for(var t,e=0;e<i.length;e++){for(var n=i[e],r=!0,s=1;s<n.length;s++){var c=n[s];0!==o[c]&&(r=!1)}r&&(i.splice(e--,1),t=a(a.s=n[0]))}return t}var r={},o={1:0},i=[];function a(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.e=function(t){var e=[],n=o[t];if(0!==n)if(n)e.push(n[2]);else{var r=new Promise((function(e,r){n=o[t]=[e,r]}));e.push(n[2]=r);var i,s=document.createElement("script");s.charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.src=function(t){return a.p+"assets/js/"+({}[t]||t)+"."+{2:"07c68b8b",3:"865f603a",4:"f03b7f8e",5:"5defc76c",6:"d222e5e8",7:"16ad04b7",8:"4c5efb33",9:"08ac8c9e",10:"56cd42ab",11:"5f34d6b0",12:"381b7c5a",13:"1c02ea8d",14:"0bd8bec9",15:"1f4e823e",16:"285ebbb2",17:"fa6e8c03"}[t]+".js"}(t);var c=new Error;i=function(e){s.onerror=s.onload=null,clearTimeout(u);var n=o[t];if(0!==n){if(n){var r=e&&("load"===e.type?"missing":e.type),i=e&&e.target&&e.target.src;c.message="Loading chunk "+t+" failed.\n("+r+": "+i+")",c.name="ChunkLoadError",c.type=r,c.request=i,n[1](c)}o[t]=void 0}};var u=setTimeout((function(){i({type:"timeout",target:s})}),12e4);s.onerror=s.onload=i,document.head.appendChild(s)}return Promise.all(e)},a.m=t,a.c=r,a.d=function(t,e,n){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)a.d(n,r,function(e){return t[e]}.bind(null,r));return n},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="/caliban/",a.oe=function(t){throw console.error(t),t};var s=window.webpackJsonp=window.webpackJsonp||[],c=s.push.bind(s);s.push=e,s=s.slice();for(var u=0;u<s.length;u++)e(s[u]);var f=c;i.push([111,0]),n()}([function(t,e,n){var r=n(3),o=n(20).f,i=n(9),a=n(13),s=n(47),c=n(73),u=n(62);t.exports=function(t,e){var n,f,l,p,d,h=t.target,v=t.global,y=t.stat;if(n=v?r:y?r[h]||s(h,{}):(r[h]||{}).prototype)for(f in e){if(p=e[f],l=t.noTargetGet?(d=o(n,f))&&d.value:n[f],!u(v?f:h+(y?".":"#")+f,t.forced)&&void 0!==l){if(typeof p==typeof l)continue;c(p,l)}(t.sham||l&&l.sham)&&i(p,"sham",!0),a(n,f,p,t)}}},function(t,e,n){var r=n(3),o=n(48),i=n(5),a=n(33),s=n(52),c=n(79),u=o("wks"),f=r.Symbol,l=c?f:f&&f.withoutSetter||a;t.exports=function(t){return i(u,t)||(s&&i(f,t)?u[t]=f[t]:u[t]=l("Symbol."+t)),u[t]}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){var n=function(t){return t&&t.Math==Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof global&&global)||Function("return this")()},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var r=n(2);t.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(t,e,n){var r=n(6),o=n(69),i=n(8),a=n(31),s=Object.defineProperty;e.f=r?s:function(t,e,n){if(i(t),e=a(e,!0),i(n),o)try{return s(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){var r=n(4);t.exports=function(t){if(!r(t))throw TypeError(String(t)+" is not an object");return t}},function(t,e,n){var r=n(6),o=n(7),i=n(21);t.exports=r?function(t,e,n){return o.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(43),o=n(16);t.exports=function(t){return r(o(t))}},function(t,e,n){var r=n(6),o=n(2),i=n(5),a=Object.defineProperty,s={},c=function(t){throw t};t.exports=function(t,e){if(i(s,t))return s[t];e||(e={});var n=[][t],u=!!i(e,"ACCESSORS")&&e.ACCESSORS,f=i(e,0)?e[0]:c,l=i(e,1)?e[1]:void 0;return s[t]=!!n&&!o((function(){if(u&&!r)return!0;var t={length:-1};u?a(t,1,{enumerable:!0,get:c}):t[1]=1,n.call(t,f,l)}))}},function(t,e,n){var r=n(34),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,e,n){var r=n(3),o=n(9),i=n(5),a=n(47),s=n(71),c=n(18),u=c.get,f=c.enforce,l=String(String).split("String");(t.exports=function(t,e,n,s){var c=!!s&&!!s.unsafe,u=!!s&&!!s.enumerable,p=!!s&&!!s.noTargetGet;"function"==typeof n&&("string"!=typeof e||i(n,"name")||o(n,"name",e),f(n).source=l.join("string"==typeof e?e:"")),t!==r?(c?!p&&t[e]&&(u=!0):delete t[e],u?t[e]=n:o(t,e,n)):u?t[e]=n:a(e,n)})(Function.prototype,"toString",(function(){return"function"==typeof this&&u(this).source||s(this)}))},function(t,e,n){var r=n(16);t.exports=function(t){return Object(r(t))}},function(t,e,n){var r=n(53),o=n(13),i=n(114);r||o(Object.prototype,"toString",i,{unsafe:!0})},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){"use strict";var r=n(0),o=n(19).filter,i=n(45),a=n(11),s=i("filter"),c=a("filter");r({target:"Array",proto:!0,forced:!s||!c},{filter:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){var r,o,i,a=n(112),s=n(3),c=n(4),u=n(9),f=n(5),l=n(32),p=n(24),d=s.WeakMap;if(a){var h=new d,v=h.get,y=h.has,m=h.set;r=function(t,e){return m.call(h,t,e),e},o=function(t){return v.call(h,t)||{}},i=function(t){return y.call(h,t)}}else{var g=l("state");p[g]=!0,r=function(t,e){return u(t,g,e),e},o=function(t){return f(t,g)?t[g]:{}},i=function(t){return f(t,g)}}t.exports={set:r,get:o,has:i,enforce:function(t){return i(t)?o(t):r(t,{})},getterFor:function(t){return function(e){var n;if(!c(e)||(n=o(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}}}},function(t,e,n){var r=n(51),o=n(43),i=n(14),a=n(12),s=n(104),c=[].push,u=function(t){var e=1==t,n=2==t,u=3==t,f=4==t,l=6==t,p=5==t||l;return function(d,h,v,y){for(var m,g,b=i(d),_=o(b),x=r(h,v,3),w=a(_.length),S=0,O=y||s,E=e?O(d,w):n?O(d,0):void 0;w>S;S++)if((p||S in _)&&(g=x(m=_[S],S,b),t))if(e)E[S]=g;else if(g)switch(t){case 3:return!0;case 5:return m;case 6:return S;case 2:c.call(E,m)}else if(f)return!1;return l?-1:u||f?f:E}};t.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6)}},function(t,e,n){var r=n(6),o=n(68),i=n(21),a=n(10),s=n(31),c=n(5),u=n(69),f=Object.getOwnPropertyDescriptor;e.f=r?f:function(t,e){if(t=a(t),e=s(e,!0),u)try{return f(t,e)}catch(t){}if(c(t,e))return i(!o.f.call(t,e),t[e])}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e){t.exports=!1},function(t,e){t.exports={}},function(t,e,n){var r=n(75),o=n(3),i=function(t){return"function"==typeof t?t:void 0};t.exports=function(t,e){return arguments.length<2?i(r[t])||i(o[t]):r[t]&&r[t][e]||o[t]&&o[t][e]}},function(t,e,n){var r,o=n(8),i=n(116),a=n(50),s=n(24),c=n(117),u=n(70),f=n(32),l=f("IE_PROTO"),p=function(){},d=function(t){return"<script>"+t+"<\/script>"},h=function(){try{r=document.domain&&new ActiveXObject("htmlfile")}catch(t){}var t,e;h=r?function(t){t.write(d("")),t.close();var e=t.parentWindow.Object;return t=null,e}(r):((e=u("iframe")).style.display="none",c.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(d("document.F=Object")),t.close(),t.F);for(var n=a.length;n--;)delete h.prototype[a[n]];return h()};s[l]=!0,t.exports=Object.create||function(t,e){var n;return null!==t?(p.prototype=o(t),n=new p,p.prototype=null,n[l]=t):n=h(),void 0===e?n:i(n,e)}},function(t,e){t.exports={}},function(t,e,n){"use strict";function r(t,e,n,r,o,i,a,s){var c,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),r&&(u.functional=!0),i&&(u._scopeId="data-v-"+i),a?(c=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},u._ssrRegister=c):o&&(c=s?function(){o.call(this,this.$root.$options.shadowRoot)}:o),c)if(u.functional){u._injectStyles=c;var f=u.render;u.render=function(t,e){return c.call(e),f(t,e)}}else{var l=u.beforeCreate;u.beforeCreate=l?[].concat(l,c):[c]}return{exports:t,options:u}}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";var r=n(0),o=n(46);r({target:"RegExp",proto:!0,forced:/./.exec!==o},{exec:o})},function(t,e,n){"use strict";var r=n(2);t.exports=function(t,e){var n=[][t];return!!n&&r((function(){n.call(null,e||function(){throw 1},1)}))}},function(t,e,n){var r=n(4);t.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e,n){var r=n(48),o=n(33),i=r("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++n+r).toString(36)}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e,n){"use strict";var r=n(0),o=n(4),i=n(42),a=n(77),s=n(12),c=n(10),u=n(64),f=n(1),l=n(45),p=n(11),d=l("slice"),h=p("slice",{ACCESSORS:!0,0:0,1:2}),v=f("species"),y=[].slice,m=Math.max;r({target:"Array",proto:!0,forced:!d||!h},{slice:function(t,e){var n,r,f,l=c(this),p=s(l.length),d=a(t,p),h=a(void 0===e?p:e,p);if(i(l)&&("function"!=typeof(n=l.constructor)||n!==Array&&!i(n.prototype)?o(n)&&null===(n=n[v])&&(n=void 0):n=void 0,n===Array||void 0===n))return y.call(l,d,h);for(r=new(void 0===n?Array:n)(m(h-d,0)),f=0;d<h;d++,f++)d in l&&u(r,f,l[d]);return r.length=f,r}})},function(t,e,n){var r=n(7).f,o=n(5),i=n(1)("toStringTag");t.exports=function(t,e,n){t&&!o(t=n?t:t.prototype,i)&&r(t,i,{configurable:!0,value:e})}},function(t,e,n){},function(t,e,n){"use strict";function r(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}n.d(e,"a",(function(){return r}))},function(t,e,n){var r,o; /* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress * @license MIT */void 0===(o="function"==typeof(r=function(){var t,e,n={version:"0.2.0"},r=n.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'};function o(t,e,n){return t<e?e:t>n?n:t}function i(t){return 100*(-1+t)}n.configure=function(t){var e,n;for(e in t)void 0!==(n=t[e])&&t.hasOwnProperty(e)&&(r[e]=n);return this},n.status=null,n.set=function(t){var e=n.isStarted();t=o(t,r.minimum,1),n.status=1===t?null:t;var c=n.render(!e),u=c.querySelector(r.barSelector),f=r.speed,l=r.easing;return c.offsetWidth,a((function(e){""===r.positionUsing&&(r.positionUsing=n.getPositioningCSS()),s(u,function(t,e,n){var o;return(o="translate3d"===r.positionUsing?{transform:"translate3d("+i(t)+"%,0,0)"}:"translate"===r.positionUsing?{transform:"translate("+i(t)+"%,0)"}:{"margin-left":i(t)+"%"}).transition="all "+e+"ms "+n,o}(t,f,l)),1===t?(s(c,{transition:"none",opacity:1}),c.offsetWidth,setTimeout((function(){s(c,{transition:"all "+f+"ms linear",opacity:0}),setTimeout((function(){n.remove(),e()}),f)}),f)):setTimeout(e,f)})),this},n.isStarted=function(){return"number"==typeof n.status},n.start=function(){n.status||n.set(0);var t=function(){setTimeout((function(){n.status&&(n.trickle(),t())}),r.trickleSpeed)};return r.trickle&&t(),this},n.done=function(t){return t||n.status?n.inc(.3+.5*Math.random()).set(1):this},n.inc=function(t){var e=n.status;return e?("number"!=typeof t&&(t=(1-e)*o(Math.random()*e,.1,.95)),e=o(e+t,0,.994),n.set(e)):n.start()},n.trickle=function(){return n.inc(Math.random()*r.trickleRate)},t=0,e=0,n.promise=function(r){return r&&"resolved"!==r.state()?(0===e&&n.start(),t++,e++,r.always((function(){0==--e?(t=0,n.done()):n.set((t-e)/t)})),this):this},n.render=function(t){if(n.isRendered())return document.getElementById("nprogress");u(document.documentElement,"nprogress-busy");var e=document.createElement("div");e.id="nprogress",e.innerHTML=r.template;var o,a=e.querySelector(r.barSelector),c=t?"-100":i(n.status||0),f=document.querySelector(r.parent);return s(a,{transition:"all 0 linear",transform:"translate3d("+c+"%,0,0)"}),r.showSpinner||(o=e.querySelector(r.spinnerSelector))&&p(o),f!=document.body&&u(f,"nprogress-custom-parent"),f.appendChild(e),e},n.remove=function(){f(document.documentElement,"nprogress-busy"),f(document.querySelector(r.parent),"nprogress-custom-parent");var t=document.getElementById("nprogress");t&&p(t)},n.isRendered=function(){return!!document.getElementById("nprogress")},n.getPositioningCSS=function(){var t=document.body.style,e="WebkitTransform"in t?"Webkit":"MozTransform"in t?"Moz":"msTransform"in t?"ms":"OTransform"in t?"O":"";return e+"Perspective"in t?"translate3d":e+"Transform"in t?"translate":"margin"};var a=function(){var t=[];function e(){var n=t.shift();n&&n(e)}return function(n){t.push(n),1==t.length&&e()}}(),s=function(){var t=["Webkit","O","Moz","ms"],e={};function n(n){return n=n.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,(function(t,e){return e.toUpperCase()})),e[n]||(e[n]=function(e){var n=document.body.style;if(e in n)return e;for(var r,o=t.length,i=e.charAt(0).toUpperCase()+e.slice(1);o--;)if((r=t[o]+i)in n)return r;return e}(n))}function r(t,e,r){e=n(e),t.style[e]=r}return function(t,e){var n,o,i=arguments;if(2==i.length)for(n in e)void 0!==(o=e[n])&&e.hasOwnProperty(n)&&r(t,n,o);else r(t,i[1],i[2])}}();function c(t,e){return("string"==typeof t?t:l(t)).indexOf(" "+e+" ")>=0}function u(t,e){var n=l(t),r=n+e;c(n,e)||(t.className=r.substring(1))}function f(t,e){var n,r=l(t);c(t,e)&&(n=r.replace(" "+e+" "," "),t.className=n.substring(1,n.length-1))}function l(t){return(" "+(t.className||"")+" ").replace(/\s+/gi," ")}function p(t){t&&t.parentNode&&t.parentNode.removeChild(t)}return n})?r.call(e,n,e,t):r)||(t.exports=o)},function(t,e,n){"use strict";var r=n(0),o=n(19).map,i=n(45),a=n(11),s=i("map"),c=a("map");r({target:"Array",proto:!0,forced:!s||!c},{map:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){"use strict";var r=n(100),o=n(8),i=n(14),a=n(12),s=n(34),c=n(16),u=n(101),f=n(102),l=Math.max,p=Math.min,d=Math.floor,h=/\$([$&'`]|\d\d?|<[^>]*>)/g,v=/\$([$&'`]|\d\d?)/g;r("replace",2,(function(t,e,n,r){var y=r.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,m=r.REPLACE_KEEPS_$0,g=y?"$":"$0";return[function(n,r){var o=c(this),i=null==n?void 0:n[t];return void 0!==i?i.call(n,o,r):e.call(String(o),n,r)},function(t,r){if(!y&&m||"string"==typeof r&&-1===r.indexOf(g)){var i=n(e,t,this,r);if(i.done)return i.value}var c=o(t),d=String(this),h="function"==typeof r;h||(r=String(r));var v=c.global;if(v){var _=c.unicode;c.lastIndex=0}for(var x=[];;){var w=f(c,d);if(null===w)break;if(x.push(w),!v)break;""===String(w[0])&&(c.lastIndex=u(d,a(c.lastIndex),_))}for(var S,O="",E=0,C=0;C<x.length;C++){w=x[C];for(var $=String(w[0]),k=l(p(s(w.index),d.length),0),A=[],j=1;j<w.length;j++)A.push(void 0===(S=w[j])?S:String(S));var T=w.groups;if(h){var P=[$].concat(A,k,d);void 0!==T&&P.push(T);var L=String(r.apply(void 0,P))}else L=b($,d,k,A,T,r);k>=E&&(O+=d.slice(E,k)+L,E=k+$.length)}return O+d.slice(E)}];function b(t,n,r,o,a,s){var c=r+t.length,u=o.length,f=v;return void 0!==a&&(a=i(a),f=h),e.call(s,f,(function(e,i){var s;switch(i.charAt(0)){case"$":return"$";case"&":return t;case"`":return n.slice(0,r);case"'":return n.slice(c);case"<":s=a[i.slice(1,-1)];break;default:var f=+i;if(0===f)return e;if(f>u){var l=d(f/10);return 0===l?e:l<=u?void 0===o[l-1]?i.charAt(1):o[l-1]+i.charAt(1):e}s=o[f-1]}return void 0===s?"":s}))}}))},function(t,e,n){var r=n(22);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,e,n){var r=n(2),o=n(22),i="".split;t.exports=r((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==o(t)?i.call(t,""):Object(t)}:Object},function(t,e,n){var r=n(76),o=n(50).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,o)}},function(t,e,n){var r=n(2),o=n(1),i=n(105),a=o("species");t.exports=function(t){return i>=51||!r((function(){var e=[];return(e.constructor={})[a]=function(){return{foo:1}},1!==e[t](Boolean).foo}))}},function(t,e,n){"use strict";var r,o,i=n(99),a=n(107),s=RegExp.prototype.exec,c=String.prototype.replace,u=s,f=(r=/a/,o=/b*/g,s.call(r,"a"),s.call(o,"a"),0!==r.lastIndex||0!==o.lastIndex),l=a.UNSUPPORTED_Y||a.BROKEN_CARET,p=void 0!==/()??/.exec("")[1];(f||p||l)&&(u=function(t){var e,n,r,o,a=this,u=l&&a.sticky,d=i.call(a),h=a.source,v=0,y=t;return u&&(-1===(d=d.replace("y","")).indexOf("g")&&(d+="g"),y=String(t).slice(a.lastIndex),a.lastIndex>0&&(!a.multiline||a.multiline&&"\n"!==t[a.lastIndex-1])&&(h="(?: "+h+")",y=" "+y,v++),n=new RegExp("^(?:"+h+")",d)),p&&(n=new RegExp("^"+h+"$(?!\\s)",d)),f&&(e=a.lastIndex),r=s.call(u?n:a,y),u?r?(r.input=r.input.slice(v),r[0]=r[0].slice(v),r.index=a.lastIndex,a.lastIndex+=r[0].length):a.lastIndex=0:f&&r&&(a.lastIndex=a.global?r.index+r[0].length:e),p&&r&&r.length>1&&c.call(r[0],n,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(r[o]=void 0)})),r}),t.exports=u},function(t,e,n){var r=n(3),o=n(9);t.exports=function(t,e){try{o(r,t,e)}catch(n){r[t]=e}return e}},function(t,e,n){var r=n(23),o=n(72);(t.exports=function(t,e){return o[t]||(o[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.4",mode:r?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(t,e,n){var r=n(10),o=n(12),i=n(77),a=function(t){return function(e,n,a){var s,c=r(e),u=o(c.length),f=i(a,u);if(t&&n!=n){for(;u>f;)if((s=c[f++])!=s)return!0}else for(;u>f;f++)if((t||f in c)&&c[f]===n)return t||f||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},function(t,e){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(t,e,n){var r=n(63);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 0:return function(){return t.call(e)};case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},function(t,e,n){var r=n(2);t.exports=!!Object.getOwnPropertySymbols&&!r((function(){return!String(Symbol())}))},function(t,e,n){var r={};r[n(1)("toStringTag")]="z",t.exports="[object z]"===String(r)},function(t,e,n){"use strict";var r=n(81).charAt,o=n(18),i=n(55),a=o.set,s=o.getterFor("String Iterator");i(String,"String",(function(t){a(this,{type:"String Iterator",string:String(t),index:0})}),(function(){var t,e=s(this),n=e.string,o=e.index;return o>=n.length?{value:void 0,done:!0}:(t=r(n,o),e.index+=t.length,{value:t,done:!1})}))},function(t,e,n){"use strict";var r=n(0),o=n(115),i=n(56),a=n(84),s=n(36),c=n(9),u=n(13),f=n(1),l=n(23),p=n(27),d=n(82),h=d.IteratorPrototype,v=d.BUGGY_SAFARI_ITERATORS,y=f("iterator"),m=function(){return this};t.exports=function(t,e,n,f,d,g,b){o(n,e,f);var _,x,w,S=function(t){if(t===d&&k)return k;if(!v&&t in C)return C[t];switch(t){case"keys":case"values":case"entries":return function(){return new n(this,t)}}return function(){return new n(this)}},O=e+" Iterator",E=!1,C=t.prototype,$=C[y]||C["@@iterator"]||d&&C[d],k=!v&&$||S(d),A="Array"==e&&C.entries||$;if(A&&(_=i(A.call(new t)),h!==Object.prototype&&_.next&&(l||i(_)===h||(a?a(_,h):"function"!=typeof _[y]&&c(_,y,m)),s(_,O,!0,!0),l&&(p[O]=m))),"values"==d&&$&&"values"!==$.name&&(E=!0,k=function(){return $.call(this)}),l&&!b||C[y]===k||c(C,y,k),p[e]=k,d)if(x={values:S("values"),keys:g?k:S("keys"),entries:S("entries")},b)for(w in x)!v&&!E&&w in C||u(C,w,x[w]);else r({target:e,proto:!0,forced:v||E},x);return x}},function(t,e,n){var r=n(5),o=n(14),i=n(32),a=n(83),s=i("IE_PROTO"),c=Object.prototype;t.exports=a?Object.getPrototypeOf:function(t){return t=o(t),r(t,s)?t[s]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?c:null}},function(t,e,n){var r=n(76),o=n(50);t.exports=Object.keys||function(t){return r(t,o)}},function(t,e,n){var r=n(3),o=n(85),i=n(119),a=n(9),s=n(1),c=s("iterator"),u=s("toStringTag"),f=i.values;for(var l in o){var p=r[l],d=p&&p.prototype;if(d){if(d[c]!==f)try{a(d,c,f)}catch(t){d[c]=f}if(d[u]||a(d,u,l),o[l])for(var h in i)if(d[h]!==i[h])try{a(d,h,i[h])}catch(t){d[h]=i[h]}}}},function(t,e,n){var r=n(24),o=n(4),i=n(5),a=n(7).f,s=n(33),c=n(88),u=s("meta"),f=0,l=Object.isExtensible||function(){return!0},p=function(t){a(t,u,{value:{objectID:"O"+ ++f,weakData:{}}})},d=t.exports={REQUIRED:!1,fastKey:function(t,e){if(!o(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!i(t,u)){if(!l(t))return"F";if(!e)return"E";p(t)}return t[u].objectID},getWeakData:function(t,e){if(!i(t,u)){if(!l(t))return!0;if(!e)return!1;p(t)}return t[u].weakData},onFreeze:function(t){return c&&d.REQUIRED&&l(t)&&!i(t,u)&&p(t),t}};r[u]=!0},function(t,e,n){var r=n(6),o=n(7).f,i=Function.prototype,a=i.toString,s=/^\s*function ([^ (]*)/;!r||"name"in i||o(i,"name",{configurable:!0,get:function(){try{return a.call(this).match(s)[1]}catch(t){return""}}})},function(t,e,n){var r=n(0),o=n(14),i=n(57);r({target:"Object",stat:!0,forced:n(2)((function(){i(1)}))},{keys:function(t){return i(o(t))}})},function(t,e,n){var r=n(2),o=/#|\.prototype\./,i=function(t,e){var n=s[a(t)];return n==u||n!=c&&("function"==typeof e?r(e):!!e)},a=i.normalize=function(t){return String(t).replace(o,".").toLowerCase()},s=i.data={},c=i.NATIVE="N",u=i.POLYFILL="P";t.exports=i},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}},function(t,e,n){"use strict";var r=n(31),o=n(7),i=n(21);t.exports=function(t,e,n){var a=r(e);a in t?o.f(t,a,i(0,n)):t[a]=n}},function(t,e,n){var r=n(1),o=n(26),i=n(7),a=r("unscopables"),s=Array.prototype;null==s[a]&&i.f(s,a,{configurable:!0,value:o(null)}),t.exports=function(t){s[a][t]=!0}},function(t,e,n){"use strict";var r=n(0),o=n(87);r({target:"Array",proto:!0,forced:[].forEach!=o},{forEach:o})},function(t,e,n){var r=n(3),o=n(85),i=n(87),a=n(9);for(var s in o){var c=r[s],u=c&&c.prototype;if(u&&u.forEach!==i)try{a(u,"forEach",i)}catch(t){u.forEach=i}}},function(t,e,n){"use strict";var r={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i=o&&!r.call({1:2},1);e.f=i?function(t){var e=o(this,t);return!!e&&e.enumerable}:r},function(t,e,n){var r=n(6),o=n(2),i=n(70);t.exports=!r&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},function(t,e,n){var r=n(3),o=n(4),i=r.document,a=o(i)&&o(i.createElement);t.exports=function(t){return a?i.createElement(t):{}}},function(t,e,n){var r=n(72),o=Function.toString;"function"!=typeof r.inspectSource&&(r.inspectSource=function(t){return o.call(t)}),t.exports=r.inspectSource},function(t,e,n){var r=n(3),o=n(47),i=r["__core-js_shared__"]||o("__core-js_shared__",{});t.exports=i},function(t,e,n){var r=n(5),o=n(74),i=n(20),a=n(7);t.exports=function(t,e){for(var n=o(e),s=a.f,c=i.f,u=0;u<n.length;u++){var f=n[u];r(t,f)||s(t,f,c(e,f))}}},function(t,e,n){var r=n(25),o=n(44),i=n(78),a=n(8);t.exports=r("Reflect","ownKeys")||function(t){var e=o.f(a(t)),n=i.f;return n?e.concat(n(t)):e}},function(t,e,n){var r=n(3);t.exports=r},function(t,e,n){var r=n(5),o=n(10),i=n(49).indexOf,a=n(24);t.exports=function(t,e){var n,s=o(t),c=0,u=[];for(n in s)!r(a,n)&&r(s,n)&&u.push(n);for(;e.length>c;)r(s,n=e[c++])&&(~i(u,n)||u.push(n));return u}},function(t,e,n){var r=n(34),o=Math.max,i=Math.min;t.exports=function(t,e){var n=r(t);return n<0?o(n+e,0):i(n,e)}},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e,n){var r=n(52);t.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(t,e,n){var r=n(53),o=n(22),i=n(1)("toStringTag"),a="Arguments"==o(function(){return arguments}());t.exports=r?o:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),i))?n:a?o(e):"Object"==(r=o(e))&&"function"==typeof e.callee?"Arguments":r}},function(t,e,n){var r=n(34),o=n(16),i=function(t){return function(e,n){var i,a,s=String(o(e)),c=r(n),u=s.length;return c<0||c>=u?t?"":void 0:(i=s.charCodeAt(c))<55296||i>56319||c+1===u||(a=s.charCodeAt(c+1))<56320||a>57343?t?s.charAt(c):i:t?s.slice(c,c+2):a-56320+(i-55296<<10)+65536}};t.exports={codeAt:i(!1),charAt:i(!0)}},function(t,e,n){"use strict";var r,o,i,a=n(56),s=n(9),c=n(5),u=n(1),f=n(23),l=u("iterator"),p=!1;[].keys&&("next"in(i=[].keys())?(o=a(a(i)))!==Object.prototype&&(r=o):p=!0),null==r&&(r={}),f||c(r,l)||s(r,l,(function(){return this})),t.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:p}},function(t,e,n){var r=n(2);t.exports=!r((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}))},function(t,e,n){var r=n(8),o=n(118);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),e=n instanceof Array}catch(t){}return function(n,i){return r(n),o(i),e?t.call(n,i):n.__proto__=i,n}}():void 0)},function(t,e){t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(t,e,n){var r=function(t){"use strict";var e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function s(t,e,n,r){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new w(r||[]);return i._invoke=function(t,e,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return O()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var s=b(a,n);if(s){if(s===u)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var f=c(t,e,n);if("normal"===f.type){if(r=n.done?"completed":"suspendedYield",f.arg===u)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(r="completed",n.method="throw",n.arg=f.arg)}}}(t,n,a),i}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var u={};function f(){}function l(){}function p(){}var d={};d[o]=function(){return this};var h=Object.getPrototypeOf,v=h&&h(h(S([])));v&&v!==e&&n.call(v,o)&&(d=v);var y=p.prototype=f.prototype=Object.create(d);function m(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function g(t){var e;this._invoke=function(r,o){function i(){return new Promise((function(e,i){!function e(r,o,i,a){var s=c(t[r],t,o);if("throw"!==s.type){var u=s.arg,f=u.value;return f&&"object"==typeof f&&n.call(f,"__await")?Promise.resolve(f.__await).then((function(t){e("next",t,i,a)}),(function(t){e("throw",t,i,a)})):Promise.resolve(f).then((function(t){u.value=t,i(u)}),(function(t){return e("throw",t,i,a)}))}a(s.arg)}(r,o,e,i)}))}return e=e?e.then(i,i):i()}}function b(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var r=c(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,u;var o=r.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function w(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function S(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return l.prototype=y.constructor=p,p.constructor=l,p[a]=l.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===l||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,a in t||(t[a]="GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},m(g.prototype),g.prototype[i]=function(){return this},t.AsyncIterator=g,t.async=function(e,n,r,o){var i=new g(s(e,n,r,o));return t.isGeneratorFunction(n)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},m(y),y[a]="Generator",y[o]=function(){return this},y.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=S,w.prototype={constructor:w,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,u):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),u},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),x(n),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;x(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:S(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},t}(t.exports);try{regeneratorRuntime=r}catch(t){Function("r","regeneratorRuntime = r")(r)}},function(t,e,n){"use strict";var r=n(19).forEach,o=n(30),i=n(11),a=o("forEach"),s=i("forEach");t.exports=a&&s?[].forEach:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}},function(t,e,n){var r=n(2);t.exports=!r((function(){return Object.isExtensible(Object.preventExtensions({}))}))},function(t,e,n){var r=n(98);t.exports=function(t){if(r(t))throw TypeError("The method doesn't accept regular expressions");return t}},function(t,e,n){var r=n(1)("match");t.exports=function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[r]=!1,"/./"[t](e)}catch(t){}}return!1}},function(t,e,n){"use strict";var r=n(0),o=n(3),i=n(25),a=n(23),s=n(6),c=n(52),u=n(79),f=n(2),l=n(5),p=n(42),d=n(4),h=n(8),v=n(14),y=n(10),m=n(31),g=n(21),b=n(26),_=n(57),x=n(44),w=n(127),S=n(78),O=n(20),E=n(7),C=n(68),$=n(9),k=n(13),A=n(48),j=n(32),T=n(24),P=n(33),L=n(1),R=n(92),I=n(128),M=n(36),D=n(18),N=n(19).forEach,F=j("hidden"),U=L("toPrimitive"),z=D.set,B=D.getterFor("Symbol"),V=Object.prototype,q=o.Symbol,H=i("JSON","stringify"),W=O.f,G=E.f,K=w.f,Q=C.f,X=A("symbols"),Y=A("op-symbols"),J=A("string-to-symbol-registry"),Z=A("symbol-to-string-registry"),tt=A("wks"),et=o.QObject,nt=!et||!et.prototype||!et.prototype.findChild,rt=s&&f((function(){return 7!=b(G({},"a",{get:function(){return G(this,"a",{value:7}).a}})).a}))?function(t,e,n){var r=W(V,e);r&&delete V[e],G(t,e,n),r&&t!==V&&G(V,e,r)}:G,ot=function(t,e){var n=X[t]=b(q.prototype);return z(n,{type:"Symbol",tag:t,description:e}),s||(n.description=e),n},it=u?function(t){return"symbol"==typeof t}:function(t){return Object(t)instanceof q},at=function(t,e,n){t===V&&at(Y,e,n),h(t);var r=m(e,!0);return h(n),l(X,r)?(n.enumerable?(l(t,F)&&t[F][r]&&(t[F][r]=!1),n=b(n,{enumerable:g(0,!1)})):(l(t,F)||G(t,F,g(1,{})),t[F][r]=!0),rt(t,r,n)):G(t,r,n)},st=function(t,e){h(t);var n=y(e),r=_(n).concat(lt(n));return N(r,(function(e){s&&!ct.call(n,e)||at(t,e,n[e])})),t},ct=function(t){var e=m(t,!0),n=Q.call(this,e);return!(this===V&&l(X,e)&&!l(Y,e))&&(!(n||!l(this,e)||!l(X,e)||l(this,F)&&this[F][e])||n)},ut=function(t,e){var n=y(t),r=m(e,!0);if(n!==V||!l(X,r)||l(Y,r)){var o=W(n,r);return!o||!l(X,r)||l(n,F)&&n[F][r]||(o.enumerable=!0),o}},ft=function(t){var e=K(y(t)),n=[];return N(e,(function(t){l(X,t)||l(T,t)||n.push(t)})),n},lt=function(t){var e=t===V,n=K(e?Y:y(t)),r=[];return N(n,(function(t){!l(X,t)||e&&!l(V,t)||r.push(X[t])})),r};(c||(k((q=function(){if(this instanceof q)throw TypeError("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,e=P(t),n=function(t){this===V&&n.call(Y,t),l(this,F)&&l(this[F],e)&&(this[F][e]=!1),rt(this,e,g(1,t))};return s&&nt&&rt(V,e,{configurable:!0,set:n}),ot(e,t)}).prototype,"toString",(function(){return B(this).tag})),k(q,"withoutSetter",(function(t){return ot(P(t),t)})),C.f=ct,E.f=at,O.f=ut,x.f=w.f=ft,S.f=lt,R.f=function(t){return ot(L(t),t)},s&&(G(q.prototype,"description",{configurable:!0,get:function(){return B(this).description}}),a||k(V,"propertyIsEnumerable",ct,{unsafe:!0}))),r({global:!0,wrap:!0,forced:!c,sham:!c},{Symbol:q}),N(_(tt),(function(t){I(t)})),r({target:"Symbol",stat:!0,forced:!c},{for:function(t){var e=String(t);if(l(J,e))return J[e];var n=q(e);return J[e]=n,Z[n]=e,n},keyFor:function(t){if(!it(t))throw TypeError(t+" is not a symbol");if(l(Z,t))return Z[t]},useSetter:function(){nt=!0},useSimple:function(){nt=!1}}),r({target:"Object",stat:!0,forced:!c,sham:!s},{create:function(t,e){return void 0===e?b(t):st(b(t),e)},defineProperty:at,defineProperties:st,getOwnPropertyDescriptor:ut}),r({target:"Object",stat:!0,forced:!c},{getOwnPropertyNames:ft,getOwnPropertySymbols:lt}),r({target:"Object",stat:!0,forced:f((function(){S.f(1)}))},{getOwnPropertySymbols:function(t){return S.f(v(t))}}),H)&&r({target:"JSON",stat:!0,forced:!c||f((function(){var t=q();return"[null]"!=H([t])||"{}"!=H({a:t})||"{}"!=H(Object(t))}))},{stringify:function(t,e,n){for(var r,o=[t],i=1;arguments.length>i;)o.push(arguments[i++]);if(r=e,(d(e)||void 0!==t)&&!it(t))return p(e)||(e=function(t,e){if("function"==typeof r&&(e=r.call(this,t,e)),!it(e))return e}),o[1]=e,H.apply(null,o)}});q.prototype[U]||$(q.prototype,U,q.prototype.valueOf),M(q,"Symbol"),T[F]=!0},function(t,e,n){var r=n(1);e.f=r},function(t,e,n){"use strict";var r=n(0),o=n(6),i=n(3),a=n(5),s=n(4),c=n(7).f,u=n(73),f=i.Symbol;if(o&&"function"==typeof f&&(!("description"in f.prototype)||void 0!==f().description)){var l={},p=function(){var t=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),e=this instanceof p?new f(t):void 0===t?f():f(t);return""===t&&(l[e]=!0),e};u(p,f);var d=p.prototype=f.prototype;d.constructor=p;var h=d.toString,v="Symbol(test)"==String(f("test")),y=/^Symbol\((.*)\)[^)]+$/;c(d,"description",{configurable:!0,get:function(){var t=s(this)?this.valueOf():this,e=h.call(t);if(a(l,t))return"";var n=v?e.slice(7,-1):e.replace(y,"$1");return""===n?void 0:n}}),r({global:!0,forced:!0},{Symbol:p})}},function(t,e,n){var r=n(8),o=n(131),i=n(12),a=n(51),s=n(132),c=n(133),u=function(t,e){this.stopped=t,this.result=e};(t.exports=function(t,e,n,f,l){var p,d,h,v,y,m,g,b=a(e,n,f?2:1);if(l)p=t;else{if("function"!=typeof(d=s(t)))throw TypeError("Target is not iterable");if(o(d)){for(h=0,v=i(t.length);v>h;h++)if((y=f?b(r(g=t[h])[0],g[1]):b(t[h]))&&y instanceof u)return y;return new u(!1)}p=d.call(t)}for(m=p.next;!(g=m.call(p)).done;)if("object"==typeof(y=c(p,b,g.value,f))&&y&&y instanceof u)return y;return new u(!1)}).stop=function(t){return new u(!0,t)}},function(t,e){t.exports=function(t,e,n){if(!(t instanceof e))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return t}},function(t,e){var n=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt,s="object"==typeof global&&global&&global.Object===Object&&global,c="object"==typeof self&&self&&self.Object===Object&&self,u=s||c||Function("return this")(),f=Object.prototype.toString,l=Math.max,p=Math.min,d=function(){return u.Date.now()};function h(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function v(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==f.call(t)}(t))return NaN;if(h(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=h(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(n,"");var s=o.test(t);return s||i.test(t)?a(t.slice(2),s?2:8):r.test(t)?NaN:+t}t.exports=function(t,e,n){var r,o,i,a,s,c,u=0,f=!1,y=!1,m=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function g(e){var n=r,i=o;return r=o=void 0,u=e,a=t.apply(i,n)}function b(t){return u=t,s=setTimeout(x,e),f?g(t):a}function _(t){var n=t-c;return void 0===c||n>=e||n<0||y&&t-u>=i}function x(){var t=d();if(_(t))return w(t);s=setTimeout(x,function(t){var n=e-(t-c);return y?p(n,i-(t-u)):n}(t))}function w(t){return s=void 0,m&&r?g(t):(r=o=void 0,a)}function S(){var t=d(),n=_(t);if(r=arguments,o=this,c=t,n){if(void 0===s)return b(c);if(y)return s=setTimeout(x,e),g(c)}return void 0===s&&(s=setTimeout(x,e)),a}return e=v(e)||0,h(n)&&(f=!!n.leading,i=(y="maxWait"in n)?l(v(n.maxWait)||0,e):i,m="trailing"in n?!!n.trailing:m),S.cancel=function(){void 0!==s&&clearTimeout(s),u=0,r=c=o=s=void 0},S.flush=function(){return void 0===s?a:w(d())},S}},function(t,e,n){"use strict";var r=n(0),o=n(19).some,i=n(30),a=n(11),s=i("some"),c=a("some");r({target:"Array",proto:!0,forced:!s||!c},{some:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){var r=n(4),o=n(22),i=n(1)("match");t.exports=function(t){var e;return r(t)&&(void 0!==(e=t[i])?!!e:"RegExp"==o(t))}},function(t,e,n){"use strict";var r=n(8);t.exports=function(){var t=r(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},function(t,e,n){"use strict";n(29);var r=n(13),o=n(2),i=n(1),a=n(46),s=n(9),c=i("species"),u=!o((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")})),f="$0"==="a".replace(/./,"$0"),l=i("replace"),p=!!/./[l]&&""===/./[l]("a","$0"),d=!o((function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));t.exports=function(t,e,n,l){var h=i(t),v=!o((function(){var e={};return e[h]=function(){return 7},7!=""[t](e)})),y=v&&!o((function(){var e=!1,n=/a/;return"split"===t&&((n={}).constructor={},n.constructor[c]=function(){return n},n.flags="",n[h]=/./[h]),n.exec=function(){return e=!0,null},n[h](""),!e}));if(!v||!y||"replace"===t&&(!u||!f||p)||"split"===t&&!d){var m=/./[h],g=n(h,""[t],(function(t,e,n,r,o){return e.exec===a?v&&!o?{done:!0,value:m.call(e,n,r)}:{done:!0,value:t.call(n,e,r)}:{done:!1}}),{REPLACE_KEEPS_$0:f,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:p}),b=g[0],_=g[1];r(String.prototype,t,b),r(RegExp.prototype,h,2==e?function(t,e){return _.call(t,this,e)}:function(t){return _.call(t,this)})}l&&s(RegExp.prototype[h],"sham",!0)}},function(t,e,n){"use strict";var r=n(81).charAt;t.exports=function(t,e,n){return e+(n?r(t,e).length:1)}},function(t,e,n){var r=n(22),o=n(46);t.exports=function(t,e){var n=t.exec;if("function"==typeof n){var i=n.call(t,e);if("object"!=typeof i)throw TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==r(t))throw TypeError("RegExp#exec called on incompatible receiver");return o.call(t,e)}},function(t,e,n){"use strict";var r=n(0),o=n(49).indexOf,i=n(30),a=n(11),s=[].indexOf,c=!!s&&1/[1].indexOf(1,-0)<0,u=i("indexOf"),f=a("indexOf",{ACCESSORS:!0,1:0});r({target:"Array",proto:!0,forced:c||!u||!f},{indexOf:function(t){return c?s.apply(this,arguments)||0:o(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){var r=n(4),o=n(42),i=n(1)("species");t.exports=function(t,e){var n;return o(t)&&("function"!=typeof(n=t.constructor)||n!==Array&&!o(n.prototype)?r(n)&&null===(n=n[i])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===e?0:e)}},function(t,e,n){var r,o,i=n(3),a=n(113),s=i.process,c=s&&s.versions,u=c&&c.v8;u?o=(r=u.split("."))[0]+r[1]:a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(o=r[1]),t.exports=o&&+o},function(t,e,n){"use strict";var r=n(0),o=n(49).includes,i=n(65);r({target:"Array",proto:!0,forced:!n(11)("indexOf",{ACCESSORS:!0,1:0})},{includes:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),i("includes")},function(t,e,n){"use strict";var r=n(2);function o(t,e){return RegExp(t,e)}e.UNSUPPORTED_Y=r((function(){var t=o("a","y");return t.lastIndex=2,null!=t.exec("abcd")})),e.BROKEN_CARET=r((function(){var t=o("^r","gy");return t.lastIndex=2,null!=t.exec("str")}))},function(t,e,n){"use strict";var r=n(0),o=n(89),i=n(16);r({target:"String",proto:!0,forced:!n(90)("includes")},{includes:function(t){return!!~String(i(this)).indexOf(o(t),arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){var r=n(4),o=n(84);t.exports=function(t,e,n){var i,a;return o&&"function"==typeof(i=e.constructor)&&i!==n&&r(a=i.prototype)&&a!==n.prototype&&o(t,a),t}},function(t,e,n){"use strict";var r=n(25),o=n(7),i=n(1),a=n(6),s=i("species");t.exports=function(t){var e=r(t),n=o.f;a&&e&&!e[s]&&n(e,s,{configurable:!0,get:function(){return this}})}},function(t,e,n){t.exports=n(140)},function(t,e,n){var r=n(3),o=n(71),i=r.WeakMap;t.exports="function"==typeof i&&/native code/.test(o(i))},function(t,e,n){var r=n(25);t.exports=r("navigator","userAgent")||""},function(t,e,n){"use strict";var r=n(53),o=n(80);t.exports=r?{}.toString:function(){return"[object "+o(this)+"]"}},function(t,e,n){"use strict";var r=n(82).IteratorPrototype,o=n(26),i=n(21),a=n(36),s=n(27),c=function(){return this};t.exports=function(t,e,n){var u=e+" Iterator";return t.prototype=o(r,{next:i(1,n)}),a(t,u,!1,!0),s[u]=c,t}},function(t,e,n){var r=n(6),o=n(7),i=n(8),a=n(57);t.exports=r?Object.defineProperties:function(t,e){i(t);for(var n,r=a(e),s=r.length,c=0;s>c;)o.f(t,n=r[c++],e[n]);return t}},function(t,e,n){var r=n(25);t.exports=r("document","documentElement")},function(t,e,n){var r=n(4);t.exports=function(t){if(!r(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype");return t}},function(t,e,n){"use strict";var r=n(10),o=n(65),i=n(27),a=n(18),s=n(55),c=a.set,u=a.getterFor("Array Iterator");t.exports=s(Array,"Array",(function(t,e){c(this,{type:"Array Iterator",target:r(t),index:0,kind:e})}),(function(){var t=u(this),e=t.target,n=t.kind,r=t.index++;return!e||r>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:e[r],done:!1}:{value:[r,e[r]],done:!1}}),"values"),i.Arguments=i.Array,o("keys"),o("values"),o("entries")},function(t,e,n){"use strict";var r=n(0),o=n(121).left,i=n(30),a=n(11),s=i("reduce"),c=a("reduce",{1:0});r({target:"Array",proto:!0,forced:!s||!c},{reduce:function(t){return o(this,t,arguments.length,arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){var r=n(63),o=n(14),i=n(43),a=n(12),s=function(t){return function(e,n,s,c){r(n);var u=o(e),f=i(u),l=a(u.length),p=t?l-1:0,d=t?-1:1;if(s<2)for(;;){if(p in f){c=f[p],p+=d;break}if(p+=d,t?p<0:l<=p)throw TypeError("Reduce of empty array with no initial value")}for(;t?p>=0:l>p;p+=d)p in f&&(c=n(c,f[p],p,u));return c}};t.exports={left:s(!1),right:s(!0)}},function(t,e,n){var r=n(0),o=n(88),i=n(2),a=n(4),s=n(59).onFreeze,c=Object.freeze;r({target:"Object",stat:!0,forced:i((function(){c(1)})),sham:!o},{freeze:function(t){return c&&a(t)?c(s(t)):t}})},function(t,e,n){var r=n(0),o=n(6),i=n(74),a=n(10),s=n(20),c=n(64);r({target:"Object",stat:!0,sham:!o},{getOwnPropertyDescriptors:function(t){for(var e,n,r=a(t),o=s.f,u=i(r),f={},l=0;u.length>l;)void 0!==(n=o(r,e=u[l++]))&&c(f,e,n);return f}})},function(t,e,n){var r=n(0),o=n(2),i=n(14),a=n(56),s=n(83);r({target:"Object",stat:!0,forced:o((function(){a(1)})),sham:!s},{getPrototypeOf:function(t){return a(i(t))}})},function(t,e,n){"use strict";var r,o=n(0),i=n(20).f,a=n(12),s=n(89),c=n(16),u=n(90),f=n(23),l="".startsWith,p=Math.min,d=u("startsWith");o({target:"String",proto:!0,forced:!!(f||d||(r=i(String.prototype,"startsWith"),!r||r.writable))&&!d},{startsWith:function(t){var e=String(c(this));s(t);var n=a(p(arguments.length>1?arguments[1]:void 0,e.length)),r=String(t);return l?l.call(e,r,n):e.slice(n,n+r.length)===r}})},function(t,e,n){n(0)({target:"Object",stat:!0,sham:!n(6)},{create:n(26)})},function(t,e,n){var r=n(10),o=n(44).f,i={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return a&&"[object Window]"==i.call(t)?function(t){try{return o(t)}catch(t){return a.slice()}}(t):o(r(t))}},function(t,e,n){var r=n(75),o=n(5),i=n(92),a=n(7).f;t.exports=function(t){var e=r.Symbol||(r.Symbol={});o(e,t)||a(e,t,{value:i.f(t)})}},function(t,e,n){"use strict";var r=n(130),o=n(135);t.exports=r("Set",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),o)},function(t,e,n){"use strict";var r=n(0),o=n(3),i=n(62),a=n(13),s=n(59),c=n(94),u=n(95),f=n(4),l=n(2),p=n(134),d=n(36),h=n(109);t.exports=function(t,e,n){var v=-1!==t.indexOf("Map"),y=-1!==t.indexOf("Weak"),m=v?"set":"add",g=o[t],b=g&&g.prototype,_=g,x={},w=function(t){var e=b[t];a(b,t,"add"==t?function(t){return e.call(this,0===t?0:t),this}:"delete"==t?function(t){return!(y&&!f(t))&&e.call(this,0===t?0:t)}:"get"==t?function(t){return y&&!f(t)?void 0:e.call(this,0===t?0:t)}:"has"==t?function(t){return!(y&&!f(t))&&e.call(this,0===t?0:t)}:function(t,n){return e.call(this,0===t?0:t,n),this})};if(i(t,"function"!=typeof g||!(y||b.forEach&&!l((function(){(new g).entries().next()})))))_=n.getConstructor(e,t,v,m),s.REQUIRED=!0;else if(i(t,!0)){var S=new _,O=S[m](y?{}:-0,1)!=S,E=l((function(){S.has(1)})),C=p((function(t){new g(t)})),$=!y&&l((function(){for(var t=new g,e=5;e--;)t[m](e,e);return!t.has(-0)}));C||((_=e((function(e,n){u(e,_,t);var r=h(new g,e,_);return null!=n&&c(n,r[m],r,v),r}))).prototype=b,b.constructor=_),(E||$)&&(w("delete"),w("has"),v&&w("get")),($||O)&&w(m),y&&b.clear&&delete b.clear}return x[t]=_,r({global:!0,forced:_!=g},x),d(_,t),y||n.setStrong(_,t,v),_}},function(t,e,n){var r=n(1),o=n(27),i=r("iterator"),a=Array.prototype;t.exports=function(t){return void 0!==t&&(o.Array===t||a[i]===t)}},function(t,e,n){var r=n(80),o=n(27),i=n(1)("iterator");t.exports=function(t){if(null!=t)return t[i]||t["@@iterator"]||o[r(t)]}},function(t,e,n){var r=n(8);t.exports=function(t,e,n,o){try{return o?e(r(n)[0],n[1]):e(n)}catch(e){var i=t.return;throw void 0!==i&&r(i.call(t)),e}}},function(t,e,n){var r=n(1)("iterator"),o=!1;try{var i=0,a={next:function(){return{done:!!i++}},return:function(){o=!0}};a[r]=function(){return this},Array.from(a,(function(){throw 2}))}catch(t){}t.exports=function(t,e){if(!e&&!o)return!1;var n=!1;try{var i={};i[r]=function(){return{next:function(){return{done:n=!0}}}},t(i)}catch(t){}return n}},function(t,e,n){"use strict";var r=n(7).f,o=n(26),i=n(136),a=n(51),s=n(95),c=n(94),u=n(55),f=n(110),l=n(6),p=n(59).fastKey,d=n(18),h=d.set,v=d.getterFor;t.exports={getConstructor:function(t,e,n,u){var f=t((function(t,r){s(t,f,e),h(t,{type:e,index:o(null),first:void 0,last:void 0,size:0}),l||(t.size=0),null!=r&&c(r,t[u],t,n)})),d=v(e),y=function(t,e,n){var r,o,i=d(t),a=m(t,e);return a?a.value=n:(i.last=a={index:o=p(e,!0),key:e,value:n,previous:r=i.last,next:void 0,removed:!1},i.first||(i.first=a),r&&(r.next=a),l?i.size++:t.size++,"F"!==o&&(i.index[o]=a)),t},m=function(t,e){var n,r=d(t),o=p(e);if("F"!==o)return r.index[o];for(n=r.first;n;n=n.next)if(n.key==e)return n};return i(f.prototype,{clear:function(){for(var t=d(this),e=t.index,n=t.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete e[n.index],n=n.next;t.first=t.last=void 0,l?t.size=0:this.size=0},delete:function(t){var e=d(this),n=m(this,t);if(n){var r=n.next,o=n.previous;delete e.index[n.index],n.removed=!0,o&&(o.next=r),r&&(r.previous=o),e.first==n&&(e.first=r),e.last==n&&(e.last=o),l?e.size--:this.size--}return!!n},forEach:function(t){for(var e,n=d(this),r=a(t,arguments.length>1?arguments[1]:void 0,3);e=e?e.next:n.first;)for(r(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!m(this,t)}}),i(f.prototype,n?{get:function(t){var e=m(this,t);return e&&e.value},set:function(t,e){return y(this,0===t?0:t,e)}}:{add:function(t){return y(this,t=0===t?0:t,t)}}),l&&r(f.prototype,"size",{get:function(){return d(this).size}}),f},setStrong:function(t,e,n){var r=e+" Iterator",o=v(e),i=v(r);u(t,e,(function(t,e){h(this,{type:r,target:t,state:o(t),kind:e,last:void 0})}),(function(){for(var t=i(this),e=t.kind,n=t.last;n&&n.removed;)n=n.previous;return t.target&&(t.last=n=n?n.next:t.state.first)?"keys"==e?{value:n.key,done:!1}:"values"==e?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(t.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),f(e)}}},function(t,e,n){var r=n(13);t.exports=function(t,e,n){for(var o in e)r(t,o,e[o],n);return t}},function(t,e,n){n(15),Promise.all([n.e(0),n.e(17)]).then(n.t.bind(null,141,7))},function(t,e,n){},function(t,e,n){"use strict";var r=n(37);n.n(r).a},function(t,e,n){"use strict";n.r(e);n(17),n(40),n(35),n(15),n(54),n(58),n(86);function r(t,e,n,r,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void n(t)}s.done?e(c):Promise.resolve(c).then(r,o)}function o(t){return function(){var e=this,n=arguments;return new Promise((function(o,i){var a=t.apply(e,n);function s(t){r(a,o,i,s,c,"next",t)}function c(t){r(a,o,i,s,c,"throw",t)}s(void 0)}))}} /*! @@ -10,4 +10,4 @@ * vue-router v3.1.5 * (c) 2020 Evan You * @license MIT - */function Io(t){return Object.prototype.toString.call(t).indexOf("Error")>-1}function Mo(t,e){return e instanceof t||e&&(e.name===t.name||e._name===t._name)}function Do(t,e){for(var n in e)t[n]=e[n];return t}var No={name:"RouterView",functional:!0,props:{name:{type:String,default:"default"}},render:function(t,e){var n=e.props,r=e.children,o=e.parent,i=e.data;i.routerView=!0;for(var a=o.$createElement,s=n.name,c=o.$route,u=o._routerViewCache||(o._routerViewCache={}),f=0,l=!1;o&&o._routerRoot!==o;){var p=o.$vnode?o.$vnode.data:{};p.routerView&&f++,p.keepAlive&&o._directInactive&&o._inactive&&(l=!0),o=o.$parent}if(i.routerViewDepth=f,l){var d=u[s],h=d&&d.component;return h?(d.configProps&&Fo(h,i,d.route,d.configProps),a(h,i,r)):a()}var v=c.matched[f],y=v&&v.components[s];if(!v||!y)return u[s]=null,a();u[s]={component:y},i.registerRouteInstance=function(t,e){var n=v.instances[s];(e&&n!==t||!e&&n===t)&&(v.instances[s]=e)},(i.hook||(i.hook={})).prepatch=function(t,e){v.instances[s]=e.componentInstance},i.hook.init=function(t){t.data.keepAlive&&t.componentInstance&&t.componentInstance!==v.instances[s]&&(v.instances[s]=t.componentInstance)};var m=v.props&&v.props[s];return m&&(Do(u[s],{route:c,configProps:m}),Fo(y,i,c,m)),a(y,i,r)}};function Fo(t,e,n,r){var o=e.props=function(t,e){switch(typeof e){case"undefined":return;case"object":return e;case"function":return e(t);case"boolean":return e?t.params:void 0;default:0}}(n,r);if(o){o=e.props=Do({},o);var i=e.attrs=e.attrs||{};for(var a in o)t.props&&a in t.props||(i[a]=o[a],delete o[a])}}var Uo=/[!'()*]/g,zo=function(t){return"%"+t.charCodeAt(0).toString(16)},Bo=/%2C/g,Vo=function(t){return encodeURIComponent(t).replace(Uo,zo).replace(Bo,",")},qo=decodeURIComponent;function Ho(t){var e={};return(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach((function(t){var n=t.replace(/\+/g," ").split("="),r=qo(n.shift()),o=n.length>0?qo(n.join("=")):null;void 0===e[r]?e[r]=o:Array.isArray(e[r])?e[r].push(o):e[r]=[e[r],o]})),e):e}function Wo(t){var e=t?Object.keys(t).map((function(e){var n=t[e];if(void 0===n)return"";if(null===n)return Vo(e);if(Array.isArray(n)){var r=[];return n.forEach((function(t){void 0!==t&&(null===t?r.push(Vo(e)):r.push(Vo(e)+"="+Vo(t)))})),r.join("&")}return Vo(e)+"="+Vo(n)})).filter((function(t){return t.length>0})).join("&"):null;return e?"?"+e:""}var Go=/\/?$/;function Ko(t,e,n,r){var o=r&&r.options.stringifyQuery,i=e.query||{};try{i=Qo(i)}catch(t){}var a={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:i,params:e.params||{},fullPath:Jo(e,o),matched:t?Yo(t):[]};return n&&(a.redirectedFrom=Jo(n,o)),Object.freeze(a)}function Qo(t){if(Array.isArray(t))return t.map(Qo);if(t&&"object"==typeof t){var e={};for(var n in t)e[n]=Qo(t[n]);return e}return t}var Xo=Ko(null,{path:"/"});function Yo(t){for(var e=[];t;)e.unshift(t),t=t.parent;return e}function Jo(t,e){var n=t.path,r=t.query;void 0===r&&(r={});var o=t.hash;return void 0===o&&(o=""),(n||"/")+(e||Wo)(r)+o}function Zo(t,e){return e===Xo?t===e:!!e&&(t.path&&e.path?t.path.replace(Go,"")===e.path.replace(Go,"")&&t.hash===e.hash&&ti(t.query,e.query):!(!t.name||!e.name)&&(t.name===e.name&&t.hash===e.hash&&ti(t.query,e.query)&&ti(t.params,e.params)))}function ti(t,e){if(void 0===t&&(t={}),void 0===e&&(e={}),!t||!e)return t===e;var n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every((function(n){var r=t[n],o=e[n];return"object"==typeof r&&"object"==typeof o?ti(r,o):String(r)===String(o)}))}function ei(t,e,n){var r=t.charAt(0);if("/"===r)return t;if("?"===r||"#"===r)return e+t;var o=e.split("/");n&&o[o.length-1]||o.pop();for(var i=t.replace(/^\//,"").split("/"),a=0;a<i.length;a++){var s=i[a];".."===s?o.pop():"."!==s&&o.push(s)}return""!==o[0]&&o.unshift(""),o.join("/")}function ni(t){return t.replace(/\/\//g,"/")}var ri=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},oi=gi,ii=fi,ai=function(t,e){return pi(fi(t,e))},si=pi,ci=mi,ui=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function fi(t,e){for(var n,r=[],o=0,i=0,a="",s=e&&e.delimiter||"/";null!=(n=ui.exec(t));){var c=n[0],u=n[1],f=n.index;if(a+=t.slice(i,f),i=f+c.length,u)a+=u[1];else{var l=t[i],p=n[2],d=n[3],h=n[4],v=n[5],y=n[6],m=n[7];a&&(r.push(a),a="");var g=null!=p&&null!=l&&l!==p,b="+"===y||"*"===y,_="?"===y||"*"===y,x=n[2]||s,w=h||v;r.push({name:d||o++,prefix:p||"",delimiter:x,optional:_,repeat:b,partial:g,asterisk:!!m,pattern:w?hi(w):m?".*":"[^"+di(x)+"]+?"})}}return i<t.length&&(a+=t.substr(i)),a&&r.push(a),r}function li(t){return encodeURI(t).replace(/[\/?#]/g,(function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()}))}function pi(t){for(var e=new Array(t.length),n=0;n<t.length;n++)"object"==typeof t[n]&&(e[n]=new RegExp("^(?:"+t[n].pattern+")$"));return function(n,r){for(var o="",i=n||{},a=(r||{}).pretty?li:encodeURIComponent,s=0;s<t.length;s++){var c=t[s];if("string"!=typeof c){var u,f=i[c.name];if(null==f){if(c.optional){c.partial&&(o+=c.prefix);continue}throw new TypeError('Expected "'+c.name+'" to be defined')}if(ri(f)){if(!c.repeat)throw new TypeError('Expected "'+c.name+'" to not repeat, but received `'+JSON.stringify(f)+"`");if(0===f.length){if(c.optional)continue;throw new TypeError('Expected "'+c.name+'" to not be empty')}for(var l=0;l<f.length;l++){if(u=a(f[l]),!e[s].test(u))throw new TypeError('Expected all "'+c.name+'" to match "'+c.pattern+'", but received `'+JSON.stringify(u)+"`");o+=(0===l?c.prefix:c.delimiter)+u}}else{if(u=c.asterisk?encodeURI(f).replace(/[?#]/g,(function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})):a(f),!e[s].test(u))throw new TypeError('Expected "'+c.name+'" to match "'+c.pattern+'", but received "'+u+'"');o+=c.prefix+u}}else o+=c}return o}}function di(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function hi(t){return t.replace(/([=!:$\/()])/g,"\\$1")}function vi(t,e){return t.keys=e,t}function yi(t){return t.sensitive?"":"i"}function mi(t,e,n){ri(e)||(n=e||n,e=[]);for(var r=(n=n||{}).strict,o=!1!==n.end,i="",a=0;a<t.length;a++){var s=t[a];if("string"==typeof s)i+=di(s);else{var c=di(s.prefix),u="(?:"+s.pattern+")";e.push(s),s.repeat&&(u+="(?:"+c+u+")*"),i+=u=s.optional?s.partial?c+"("+u+")?":"(?:"+c+"("+u+"))?":c+"("+u+")"}}var f=di(n.delimiter||"/"),l=i.slice(-f.length)===f;return r||(i=(l?i.slice(0,-f.length):i)+"(?:"+f+"(?=$))?"),i+=o?"$":r&&l?"":"(?="+f+"|$)",vi(new RegExp("^"+i,yi(n)),e)}function gi(t,e,n){return ri(e)||(n=e||n,e=[]),n=n||{},t instanceof RegExp?function(t,e){var n=t.source.match(/\((?!\?)/g);if(n)for(var r=0;r<n.length;r++)e.push({name:r,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return vi(t,e)}(t,e):ri(t)?function(t,e,n){for(var r=[],o=0;o<t.length;o++)r.push(gi(t[o],e,n).source);return vi(new RegExp("(?:"+r.join("|")+")",yi(n)),e)}(t,e,n):function(t,e,n){return mi(fi(t,n),e,n)}(t,e,n)}oi.parse=ii,oi.compile=ai,oi.tokensToFunction=si,oi.tokensToRegExp=ci;var bi=Object.create(null);function _i(t,e,n){e=e||{};try{var r=bi[t]||(bi[t]=oi.compile(t));return e.pathMatch&&(e[0]=e.pathMatch),r(e,{pretty:!0})}catch(t){return""}finally{delete e[0]}}function xi(t,e,n,r){var o="string"==typeof t?{path:t}:t;if(o._normalized)return o;if(o.name){var i=(o=Do({},t)).params;return i&&"object"==typeof i&&(o.params=Do({},i)),o}if(!o.path&&o.params&&e){(o=Do({},o))._normalized=!0;var a=Do(Do({},e.params),o.params);if(e.name)o.name=e.name,o.params=a;else if(e.matched.length){var s=e.matched[e.matched.length-1].path;o.path=_i(s,a,e.path)}else 0;return o}var c=function(t){var e="",n="",r=t.indexOf("#");r>=0&&(e=t.slice(r),t=t.slice(0,r));var o=t.indexOf("?");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{path:t,query:n,hash:e}}(o.path||""),u=e&&e.path||"/",f=c.path?ei(c.path,u,n||o.append):u,l=function(t,e,n){void 0===e&&(e={});var r,o=n||Ho;try{r=o(t||"")}catch(t){r={}}for(var i in e)r[i]=e[i];return r}(c.query,o.query,r&&r.options.parseQuery),p=o.hash||c.hash;return p&&"#"!==p.charAt(0)&&(p="#"+p),{_normalized:!0,path:f,query:l,hash:p}}var wi,Si=function(){},Oi={name:"RouterLink",props:{to:{type:[String,Object],required:!0},tag:{type:String,default:"a"},exact:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String,event:{type:[String,Array],default:"click"}},render:function(t){var e=this,n=this.$router,r=this.$route,o=n.resolve(this.to,r,this.append),i=o.location,a=o.route,s=o.href,c={},u=n.options.linkActiveClass,f=n.options.linkExactActiveClass,l=null==u?"router-link-active":u,p=null==f?"router-link-exact-active":f,d=null==this.activeClass?l:this.activeClass,h=null==this.exactActiveClass?p:this.exactActiveClass,v=a.redirectedFrom?Ko(null,xi(a.redirectedFrom),null,n):a;c[h]=Zo(r,v),c[d]=this.exact?c[h]:function(t,e){return 0===t.path.replace(Go,"/").indexOf(e.path.replace(Go,"/"))&&(!e.hash||t.hash===e.hash)&&function(t,e){for(var n in e)if(!(n in t))return!1;return!0}(t.query,e.query)}(r,v);var y=function(t){Ei(t)&&(e.replace?n.replace(i,Si):n.push(i,Si))},m={click:Ei};Array.isArray(this.event)?this.event.forEach((function(t){m[t]=y})):m[this.event]=y;var g={class:c},b=!this.$scopedSlots.$hasNormal&&this.$scopedSlots.default&&this.$scopedSlots.default({href:s,route:a,navigate:y,isActive:c[d],isExactActive:c[h]});if(b){if(1===b.length)return b[0];if(b.length>1||!b.length)return 0===b.length?t():t("span",{},b)}if("a"===this.tag)g.on=m,g.attrs={href:s};else{var _=function t(e){var n;if(e)for(var r=0;r<e.length;r++){if("a"===(n=e[r]).tag)return n;if(n.children&&(n=t(n.children)))return n}}(this.$slots.default);if(_){_.isStatic=!1;var x=_.data=Do({},_.data);for(var w in x.on=x.on||{},x.on){var S=x.on[w];w in m&&(x.on[w]=Array.isArray(S)?S:[S])}for(var O in m)O in x.on?x.on[O].push(m[O]):x.on[O]=y;(_.data.attrs=Do({},_.data.attrs)).href=s}else g.on=m}return t(this.tag,g,this.$slots.default)}};function Ei(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||t.defaultPrevented||void 0!==t.button&&0!==t.button)){if(t.currentTarget&&t.currentTarget.getAttribute){var e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}var Ci="undefined"!=typeof window;function $i(t,e,n,r){var o=e||[],i=n||Object.create(null),a=r||Object.create(null);t.forEach((function(t){!function t(e,n,r,o,i,a){var s=o.path,c=o.name;0;var u=o.pathToRegexpOptions||{},f=function(t,e,n){n||(t=t.replace(/\/$/,""));if("/"===t[0])return t;if(null==e)return t;return ni(e.path+"/"+t)}(s,i,u.strict);"boolean"==typeof o.caseSensitive&&(u.sensitive=o.caseSensitive);var l={path:f,regex:ki(f,u),components:o.components||{default:o.component},instances:{},name:c,parent:i,matchAs:a,redirect:o.redirect,beforeEnter:o.beforeEnter,meta:o.meta||{},props:null==o.props?{}:o.components?o.props:{default:o.props}};o.children&&o.children.forEach((function(o){var i=a?ni(a+"/"+o.path):void 0;t(e,n,r,o,l,i)}));n[l.path]||(e.push(l.path),n[l.path]=l);if(void 0!==o.alias)for(var p=Array.isArray(o.alias)?o.alias:[o.alias],d=0;d<p.length;++d){0;var h={path:p[d],children:o.children};t(e,n,r,h,i,l.path||"/")}c&&(r[c]||(r[c]=l))}(o,i,a,t)}));for(var s=0,c=o.length;s<c;s++)"*"===o[s]&&(o.push(o.splice(s,1)[0]),c--,s--);return{pathList:o,pathMap:i,nameMap:a}}function ki(t,e){return oi(t,[],e)}function Ai(t,e){var n=$i(t),r=n.pathList,o=n.pathMap,i=n.nameMap;function a(t,n,a){var s=xi(t,n,!1,e),u=s.name;if(u){var f=i[u];if(!f)return c(null,s);var l=f.regex.keys.filter((function(t){return!t.optional})).map((function(t){return t.name}));if("object"!=typeof s.params&&(s.params={}),n&&"object"==typeof n.params)for(var p in n.params)!(p in s.params)&&l.indexOf(p)>-1&&(s.params[p]=n.params[p]);return s.path=_i(f.path,s.params),c(f,s,a)}if(s.path){s.params={};for(var d=0;d<r.length;d++){var h=r[d],v=o[h];if(ji(v.regex,s.path,s.params))return c(v,s,a)}}return c(null,s)}function s(t,n){var r=t.redirect,o="function"==typeof r?r(Ko(t,n,null,e)):r;if("string"==typeof o&&(o={path:o}),!o||"object"!=typeof o)return c(null,n);var s=o,u=s.name,f=s.path,l=n.query,p=n.hash,d=n.params;if(l=s.hasOwnProperty("query")?s.query:l,p=s.hasOwnProperty("hash")?s.hash:p,d=s.hasOwnProperty("params")?s.params:d,u){i[u];return a({_normalized:!0,name:u,query:l,hash:p,params:d},void 0,n)}if(f){var h=function(t,e){return ei(t,e.parent?e.parent.path:"/",!0)}(f,t);return a({_normalized:!0,path:_i(h,d),query:l,hash:p},void 0,n)}return c(null,n)}function c(t,n,r){return t&&t.redirect?s(t,r||n):t&&t.matchAs?function(t,e,n){var r=a({_normalized:!0,path:_i(n,e.params)});if(r){var o=r.matched,i=o[o.length-1];return e.params=r.params,c(i,e)}return c(null,e)}(0,n,t.matchAs):Ko(t,n,r,e)}return{match:a,addRoutes:function(t){$i(t,r,o,i)}}}function ji(t,e,n){var r=e.match(t);if(!r)return!1;if(!n)return!0;for(var o=1,i=r.length;o<i;++o){var a=t.keys[o-1],s="string"==typeof r[o]?decodeURIComponent(r[o]):r[o];a&&(n[a.name||"pathMatch"]=s)}return!0}var Ti=Ci&&window.performance&&window.performance.now?window.performance:Date;function Pi(){return Ti.now().toFixed(3)}var Li=Pi();function Ri(){return Li}function Ii(t){return Li=t}var Mi=Object.create(null);function Di(){var t=window.location.protocol+"//"+window.location.host,e=window.location.href.replace(t,"");window.history.replaceState({key:Ri()},"",e),window.addEventListener("popstate",(function(t){Fi(),t.state&&t.state.key&&Ii(t.state.key)}))}function Ni(t,e,n,r){if(t.app){var o=t.options.scrollBehavior;o&&t.app.$nextTick((function(){var i=function(){var t=Ri();if(t)return Mi[t]}(),a=o.call(t,e,n,r?i:null);a&&("function"==typeof a.then?a.then((function(t){qi(t,i)})).catch((function(t){0})):qi(a,i))}))}}function Fi(){var t=Ri();t&&(Mi[t]={x:window.pageXOffset,y:window.pageYOffset})}function Ui(t){return Bi(t.x)||Bi(t.y)}function zi(t){return{x:Bi(t.x)?t.x:window.pageXOffset,y:Bi(t.y)?t.y:window.pageYOffset}}function Bi(t){return"number"==typeof t}var Vi=/^#\d/;function qi(t,e){var n,r="object"==typeof t;if(r&&"string"==typeof t.selector){var o=Vi.test(t.selector)?document.getElementById(t.selector.slice(1)):document.querySelector(t.selector);if(o){var i=t.offset&&"object"==typeof t.offset?t.offset:{};e=function(t,e){var n=document.documentElement.getBoundingClientRect(),r=t.getBoundingClientRect();return{x:r.left-n.left-e.x,y:r.top-n.top-e.y}}(o,i={x:Bi((n=i).x)?n.x:0,y:Bi(n.y)?n.y:0})}else Ui(t)&&(e=zi(t))}else r&&Ui(t)&&(e=zi(t));e&&window.scrollTo(e.x,e.y)}var Hi,Wi=Ci&&((-1===(Hi=window.navigator.userAgent).indexOf("Android 2.")&&-1===Hi.indexOf("Android 4.0")||-1===Hi.indexOf("Mobile Safari")||-1!==Hi.indexOf("Chrome")||-1!==Hi.indexOf("Windows Phone"))&&window.history&&"pushState"in window.history);function Gi(t,e){Fi();var n=window.history;try{if(e){var r=Do({},n.state);r.key=Ri(),n.replaceState(r,"",t)}else n.pushState({key:Ii(Pi())},"",t)}catch(n){window.location[e?"replace":"assign"](t)}}function Ki(t){Gi(t,!0)}function Qi(t,e,n){var r=function(o){o>=t.length?n():t[o]?e(t[o],(function(){r(o+1)})):r(o+1)};r(0)}function Xi(t){return function(e,n,r){var o=!1,i=0,a=null;Yi(t,(function(t,e,n,s){if("function"==typeof t&&void 0===t.cid){o=!0,i++;var c,u=ta((function(e){var o;((o=e).__esModule||Zi&&"Module"===o[Symbol.toStringTag])&&(e=e.default),t.resolved="function"==typeof e?e:wi.extend(e),n.components[s]=e,--i<=0&&r()})),f=ta((function(t){var e="Failed to resolve async component "+s+": "+t;a||(a=Io(t)?t:new Error(e),r(a))}));try{c=t(u,f)}catch(t){f(t)}if(c)if("function"==typeof c.then)c.then(u,f);else{var l=c.component;l&&"function"==typeof l.then&&l.then(u,f)}}})),o||r()}}function Yi(t,e){return Ji(t.map((function(t){return Object.keys(t.components).map((function(n){return e(t.components[n],t.instances[n],t,n)}))})))}function Ji(t){return Array.prototype.concat.apply([],t)}var Zi="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;function ta(t){var e=!1;return function(){for(var n=[],r=arguments.length;r--;)n[r]=arguments[r];if(!e)return e=!0,t.apply(this,n)}}var ea=function(t){function e(e){t.call(this),this.name=this._name="NavigationDuplicated",this.message='Navigating to current location ("'+e.fullPath+'") is not allowed',Object.defineProperty(this,"stack",{value:(new t).stack,writable:!0,configurable:!0})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error);ea._name="NavigationDuplicated";var na=function(t,e){this.router=t,this.base=function(t){if(!t)if(Ci){var e=document.querySelector("base");t=(t=e&&e.getAttribute("href")||"/").replace(/^https?:\/\/[^\/]+/,"")}else t="/";"/"!==t.charAt(0)&&(t="/"+t);return t.replace(/\/$/,"")}(e),this.current=Xo,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[]};function ra(t,e,n,r){var o=Yi(t,(function(t,r,o,i){var a=function(t,e){"function"!=typeof t&&(t=wi.extend(t));return t.options[e]}(t,e);if(a)return Array.isArray(a)?a.map((function(t){return n(t,r,o,i)})):n(a,r,o,i)}));return Ji(r?o.reverse():o)}function oa(t,e){if(e)return function(){return t.apply(e,arguments)}}na.prototype.listen=function(t){this.cb=t},na.prototype.onReady=function(t,e){this.ready?t():(this.readyCbs.push(t),e&&this.readyErrorCbs.push(e))},na.prototype.onError=function(t){this.errorCbs.push(t)},na.prototype.transitionTo=function(t,e,n){var r=this,o=this.router.match(t,this.current);this.confirmTransition(o,(function(){r.updateRoute(o),e&&e(o),r.ensureURL(),r.ready||(r.ready=!0,r.readyCbs.forEach((function(t){t(o)})))}),(function(t){n&&n(t),t&&!r.ready&&(r.ready=!0,r.readyErrorCbs.forEach((function(e){e(t)})))}))},na.prototype.confirmTransition=function(t,e,n){var r=this,o=this.current,i=function(t){!Mo(ea,t)&&Io(t)&&(r.errorCbs.length?r.errorCbs.forEach((function(e){e(t)})):console.error(t)),n&&n(t)};if(Zo(t,o)&&t.matched.length===o.matched.length)return this.ensureURL(),i(new ea(t));var a=function(t,e){var n,r=Math.max(t.length,e.length);for(n=0;n<r&&t[n]===e[n];n++);return{updated:e.slice(0,n),activated:e.slice(n),deactivated:t.slice(n)}}(this.current.matched,t.matched),s=a.updated,c=a.deactivated,u=a.activated,f=[].concat(function(t){return ra(t,"beforeRouteLeave",oa,!0)}(c),this.router.beforeHooks,function(t){return ra(t,"beforeRouteUpdate",oa)}(s),u.map((function(t){return t.beforeEnter})),Xi(u));this.pending=t;var l=function(e,n){if(r.pending!==t)return i();try{e(t,o,(function(t){!1===t||Io(t)?(r.ensureURL(!0),i(t)):"string"==typeof t||"object"==typeof t&&("string"==typeof t.path||"string"==typeof t.name)?(i(),"object"==typeof t&&t.replace?r.replace(t):r.push(t)):n(t)}))}catch(t){i(t)}};Qi(f,l,(function(){var n=[];Qi(function(t,e,n){return ra(t,"beforeRouteEnter",(function(t,r,o,i){return function(t,e,n,r,o){return function(i,a,s){return t(i,a,(function(t){"function"==typeof t&&r.push((function(){!function t(e,n,r,o){n[r]&&!n[r]._isBeingDestroyed?e(n[r]):o()&&setTimeout((function(){t(e,n,r,o)}),16)}(t,e.instances,n,o)})),s(t)}))}}(t,o,i,e,n)}))}(u,n,(function(){return r.current===t})).concat(r.router.resolveHooks),l,(function(){if(r.pending!==t)return i();r.pending=null,e(t),r.router.app&&r.router.app.$nextTick((function(){n.forEach((function(t){t()}))}))}))}))},na.prototype.updateRoute=function(t){var e=this.current;this.current=t,this.cb&&this.cb(t),this.router.afterHooks.forEach((function(n){n&&n(t,e)}))};var ia=function(t){function e(e,n){var r=this;t.call(this,e,n);var o=e.options.scrollBehavior,i=Wi&&o;i&&Di();var a=aa(this.base);window.addEventListener("popstate",(function(t){var n=r.current,o=aa(r.base);r.current===Xo&&o===a||r.transitionTo(o,(function(t){i&&Ni(e,t,n,!0)}))}))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.go=function(t){window.history.go(t)},e.prototype.push=function(t,e,n){var r=this,o=this.current;this.transitionTo(t,(function(t){Gi(ni(r.base+t.fullPath)),Ni(r.router,t,o,!1),e&&e(t)}),n)},e.prototype.replace=function(t,e,n){var r=this,o=this.current;this.transitionTo(t,(function(t){Ki(ni(r.base+t.fullPath)),Ni(r.router,t,o,!1),e&&e(t)}),n)},e.prototype.ensureURL=function(t){if(aa(this.base)!==this.current.fullPath){var e=ni(this.base+this.current.fullPath);t?Gi(e):Ki(e)}},e.prototype.getCurrentLocation=function(){return aa(this.base)},e}(na);function aa(t){var e=decodeURI(window.location.pathname);return t&&0===e.indexOf(t)&&(e=e.slice(t.length)),(e||"/")+window.location.search+window.location.hash}var sa=function(t){function e(e,n,r){t.call(this,e,n),r&&function(t){var e=aa(t);if(!/^\/#/.test(e))return window.location.replace(ni(t+"/#"+e)),!0}(this.base)||ca()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setupListeners=function(){var t=this,e=this.router.options.scrollBehavior,n=Wi&&e;n&&Di(),window.addEventListener(Wi?"popstate":"hashchange",(function(){var e=t.current;ca()&&t.transitionTo(ua(),(function(r){n&&Ni(t.router,r,e,!0),Wi||pa(r.fullPath)}))}))},e.prototype.push=function(t,e,n){var r=this,o=this.current;this.transitionTo(t,(function(t){la(t.fullPath),Ni(r.router,t,o,!1),e&&e(t)}),n)},e.prototype.replace=function(t,e,n){var r=this,o=this.current;this.transitionTo(t,(function(t){pa(t.fullPath),Ni(r.router,t,o,!1),e&&e(t)}),n)},e.prototype.go=function(t){window.history.go(t)},e.prototype.ensureURL=function(t){var e=this.current.fullPath;ua()!==e&&(t?la(e):pa(e))},e.prototype.getCurrentLocation=function(){return ua()},e}(na);function ca(){var t=ua();return"/"===t.charAt(0)||(pa("/"+t),!1)}function ua(){var t=window.location.href,e=t.indexOf("#");if(e<0)return"";var n=(t=t.slice(e+1)).indexOf("?");if(n<0){var r=t.indexOf("#");t=r>-1?decodeURI(t.slice(0,r))+t.slice(r):decodeURI(t)}else t=decodeURI(t.slice(0,n))+t.slice(n);return t}function fa(t){var e=window.location.href,n=e.indexOf("#");return(n>=0?e.slice(0,n):e)+"#"+t}function la(t){Wi?Gi(fa(t)):window.location.hash=t}function pa(t){Wi?Ki(fa(t)):window.location.replace(fa(t))}var da=function(t){function e(e,n){t.call(this,e,n),this.stack=[],this.index=-1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.push=function(t,e,n){var r=this;this.transitionTo(t,(function(t){r.stack=r.stack.slice(0,r.index+1).concat(t),r.index++,e&&e(t)}),n)},e.prototype.replace=function(t,e,n){var r=this;this.transitionTo(t,(function(t){r.stack=r.stack.slice(0,r.index).concat(t),e&&e(t)}),n)},e.prototype.go=function(t){var e=this,n=this.index+t;if(!(n<0||n>=this.stack.length)){var r=this.stack[n];this.confirmTransition(r,(function(){e.index=n,e.updateRoute(r)}),(function(t){Mo(ea,t)&&(e.index=n)}))}},e.prototype.getCurrentLocation=function(){var t=this.stack[this.stack.length-1];return t?t.fullPath:"/"},e.prototype.ensureURL=function(){},e}(na),ha=function(t){void 0===t&&(t={}),this.app=null,this.apps=[],this.options=t,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=Ai(t.routes||[],this);var e=t.mode||"hash";switch(this.fallback="history"===e&&!Wi&&!1!==t.fallback,this.fallback&&(e="hash"),Ci||(e="abstract"),this.mode=e,e){case"history":this.history=new ia(this,t.base);break;case"hash":this.history=new sa(this,t.base,this.fallback);break;case"abstract":this.history=new da(this,t.base);break;default:0}},va={currentRoute:{configurable:!0}};function ya(t,e){return t.push(e),function(){var n=t.indexOf(e);n>-1&&t.splice(n,1)}}ha.prototype.match=function(t,e,n){return this.matcher.match(t,e,n)},va.currentRoute.get=function(){return this.history&&this.history.current},ha.prototype.init=function(t){var e=this;if(this.apps.push(t),t.$once("hook:destroyed",(function(){var n=e.apps.indexOf(t);n>-1&&e.apps.splice(n,1),e.app===t&&(e.app=e.apps[0]||null)})),!this.app){this.app=t;var n=this.history;if(n instanceof ia)n.transitionTo(n.getCurrentLocation());else if(n instanceof sa){var r=function(){n.setupListeners()};n.transitionTo(n.getCurrentLocation(),r,r)}n.listen((function(t){e.apps.forEach((function(e){e._route=t}))}))}},ha.prototype.beforeEach=function(t){return ya(this.beforeHooks,t)},ha.prototype.beforeResolve=function(t){return ya(this.resolveHooks,t)},ha.prototype.afterEach=function(t){return ya(this.afterHooks,t)},ha.prototype.onReady=function(t,e){this.history.onReady(t,e)},ha.prototype.onError=function(t){this.history.onError(t)},ha.prototype.push=function(t,e,n){var r=this;if(!e&&!n&&"undefined"!=typeof Promise)return new Promise((function(e,n){r.history.push(t,e,n)}));this.history.push(t,e,n)},ha.prototype.replace=function(t,e,n){var r=this;if(!e&&!n&&"undefined"!=typeof Promise)return new Promise((function(e,n){r.history.replace(t,e,n)}));this.history.replace(t,e,n)},ha.prototype.go=function(t){this.history.go(t)},ha.prototype.back=function(){this.go(-1)},ha.prototype.forward=function(){this.go(1)},ha.prototype.getMatchedComponents=function(t){var e=t?t.matched?t:this.resolve(t).route:this.currentRoute;return e?[].concat.apply([],e.matched.map((function(t){return Object.keys(t.components).map((function(e){return t.components[e]}))}))):[]},ha.prototype.resolve=function(t,e,n){var r=xi(t,e=e||this.history.current,n,this),o=this.match(r,e),i=o.redirectedFrom||o.fullPath;return{location:r,route:o,href:function(t,e,n){var r="hash"===n?"#"+e:e;return t?ni(t+"/"+r):r}(this.history.base,i,this.mode),normalizedTo:r,resolved:o}},ha.prototype.addRoutes=function(t){this.matcher.addRoutes(t),this.history.current!==Xo&&this.history.transitionTo(this.history.getCurrentLocation())},Object.defineProperties(ha.prototype,va),ha.install=function t(e){if(!t.installed||wi!==e){t.installed=!0,wi=e;var n=function(t){return void 0!==t},r=function(t,e){var r=t.$options._parentVnode;n(r)&&n(r=r.data)&&n(r=r.registerRouteInstance)&&r(t,e)};e.mixin({beforeCreate:function(){n(this.$options.router)?(this._routerRoot=this,this._router=this.$options.router,this._router.init(this),e.util.defineReactive(this,"_route",this._router.history.current)):this._routerRoot=this.$parent&&this.$parent._routerRoot||this,r(this,this)},destroyed:function(){r(this)}}),Object.defineProperty(e.prototype,"$router",{get:function(){return this._routerRoot._router}}),Object.defineProperty(e.prototype,"$route",{get:function(){return this._routerRoot._route}}),e.component("RouterView",No),e.component("RouterLink",Oi);var o=e.config.optionMergeStrategies;o.beforeRouteEnter=o.beforeRouteLeave=o.beforeRouteUpdate=o.created}},ha.version="3.1.5",Ci&&window.Vue&&window.Vue.use(ha);var ma=ha;n(66),n(120),n(122),n(123),n(124),n(61),n(125),n(67);function ga(t){t.locales&&Object.keys(t.locales).forEach((function(e){t.locales[e].path=e})),Object.freeze(t)}n(106),n(126),n(29),n(108),n(41);function ba(t){return(ba="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var _a=n(38),xa={NotFound:function(){return n.e(4).then(n.bind(null,203))},Layout:function(){return Promise.all([n.e(0),n.e(2)]).then(n.bind(null,202))}},wa={"v-3c88bbf2":function(){return n.e(5).then(n.bind(null,204))},"v-0decf914":function(){return n.e(6).then(n.bind(null,205))},"v-4419f5c9":function(){return n.e(9).then(n.bind(null,206))},"v-d7e5bcfc":function(){return n.e(7).then(n.bind(null,207))},"v-23f0ba6e":function(){return n.e(8).then(n.bind(null,208))},"v-70457f72":function(){return n.e(11).then(n.bind(null,209))},"v-2bf9c0ae":function(){return n.e(12).then(n.bind(null,210))},"v-1c00b5c9":function(){return n.e(13).then(n.bind(null,211))},"v-6d148503":function(){return n.e(10).then(n.bind(null,212))},"v-300a59ee":function(){return n.e(15).then(n.bind(null,213))},"v-7bafdcee":function(){return n.e(14).then(n.bind(null,214))},"v-a971ed74":function(){return n.e(16).then(n.bind(null,215))}};function Sa(t){var e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}var Oa=/-(\w)/g,Ea=Sa((function(t){return t.replace(Oa,(function(t,e){return e?e.toUpperCase():""}))})),Ca=/\B([A-Z])/g,$a=Sa((function(t){return t.replace(Ca,"-$1").toLowerCase()})),ka=Sa((function(t){return t.charAt(0).toUpperCase()+t.slice(1)}));function Aa(t,e){if(e)return t(e)?t(e):e.includes("-")?t(ka(Ea(e))):t(ka(e))||t($a(e))}var ja=Object.assign({},xa,wa),Ta=function(t){return ja[t]},Pa=function(t){return wa[t]},La=function(t){return xa[t]},Ra=function(t){return Ro.component(t)};function Ia(t){return Aa(Pa,t)}function Ma(t){return Aa(La,t)}function Da(t){return Aa(Ta,t)}function Na(t){return Aa(Ra,t)}function Fa(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Promise.all(e.filter((function(t){return t})).map(function(){var t=o(regeneratorRuntime.mark((function t(e){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Na(e)||!Da(e)){t.next=5;break}return t.next=3,Da(e)();case 3:n=t.sent,Ro.component(e,n.default);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()))}function Ua(t,e){"undefined"!=typeof window&&window.__VUEPRESS__&&(window.__VUEPRESS__[t]=e)}n(91),n(93),n(60),n(129);var za={created:function(){this.$ssrContext&&(this.$ssrContext.title=this.$title,this.$ssrContext.lang=this.$lang,this.$ssrContext.description=this.$page.description||this.$description)},mounted:function(){this.currentMetaTags=new Set,this.updateMeta()},methods:{updateMeta:function(){var t=this;document.title=this.$title,document.documentElement.lang=this.$lang;var e=this.$page.frontmatter.meta||[],n=e.slice(0);0===e.filter((function(t){return"description"===t.name})).length&&n.push({name:"description",content:this.$description});var r=document.querySelectorAll('meta[name="description"]');r.length&&r.forEach((function(e){return t.currentMetaTags.add(e)})),this.currentMetaTags=new Set(Ba(n,this.currentMetaTags))}},watch:{$page:function(){this.updateMeta()}},beforeDestroy:function(){Ba(null,this.currentMetaTags)}};function Ba(t,e){if(e&&Object(_a.a)(e).forEach((function(t){document.head.removeChild(t)})),t)return t.map((function(t){var e=document.createElement("meta");return Object.keys(t).forEach((function(n){e.setAttribute(n,t[n])})),document.head.appendChild(e),e}))}n(97);var Va=n(96),qa={mounted:function(){window.addEventListener("scroll",this.onScroll)},methods:{onScroll:n.n(Va)()((function(){this.setActiveHash()}),300),setActiveHash:function(){for(var t=this,e=[].slice.call(document.querySelectorAll(".sidebar-link")),n=[].slice.call(document.querySelectorAll(".header-anchor")).filter((function(t){return e.some((function(e){return e.hash===t.hash}))})),r=Math.max(window.pageYOffset,document.documentElement.scrollTop,document.body.scrollTop),o=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),i=window.innerHeight+r,a=0;a<n.length;a++){var s=n[a],c=n[a+1],u=0===a&&0===r||r>=s.parentElement.offsetTop+10&&(!c||r<c.parentElement.offsetTop-10),f=decodeURIComponent(this.$route.hash);if(u&&f!==decodeURIComponent(s.hash)){var l=s;if(i===o)for(var p=a+1;p<n.length;p++)if(f===decodeURIComponent(n[p].hash))return;return this.$vuepress.$set("disableScrollBehavior",!0),void this.$router.replace(decodeURIComponent(l.hash),(function(){t.$nextTick((function(){t.$vuepress.$set("disableScrollBehavior",!1)}))}))}}}},beforeDestroy:function(){window.removeEventListener("scroll",this.onScroll)}},Ha=n(39),Wa=n.n(Ha),Ga=[za,qa,{mounted:function(){var t=this;Wa.a.configure({showSpinner:!1}),this.$router.beforeEach((function(t,e,n){t.path===e.path||Ro.component(t.name)||Wa.a.start(),n()})),this.$router.afterEach((function(){Wa.a.done(),t.isSidebarOpen=!1}))}}],Ka={name:"GlobalLayout",computed:{layout:function(){var t=this.getLayout();return Ua("layout",t),Ro.component(t)}},methods:{getLayout:function(){if(this.$page.path){var t=this.$page.frontmatter.layout;return t&&(this.$vuepress.getLayoutAsyncComponent(t)||this.$vuepress.getVueComponent(t))?t:"Layout"}return"NotFound"}}},Qa=n(28),Xa=Object(Qa.a)(Ka,(function(){var t=this.$createElement;return(this._self._c||t)(this.layout,{tag:"component"})}),[],!1,null,null,null).exports;!function(t,e,n){var r;switch(e){case"components":t[e]||(t[e]={}),Object.assign(t[e],n);break;case"mixins":t[e]||(t[e]=[]),(r=t[e]).push.apply(r,Object(_a.a)(n));break;default:throw new Error("Unknown option name.")}}(Xa,"mixins",Ga);var Ya=[{name:"v-3c88bbf2",path:"/",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-3c88bbf2").then(n)}},{path:"/index.html",redirect:"/"},{name:"v-0decf914",path:"/about/",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-0decf914").then(n)}},{path:"/about/index.html",redirect:"/about/"},{name:"v-4419f5c9",path:"/docs/examples.html",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-4419f5c9").then(n)}},{name:"v-d7e5bcfc",path:"/docs/",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-d7e5bcfc").then(n)}},{path:"/docs/index.html",redirect:"/docs/"},{name:"v-23f0ba6e",path:"/docs/client.html",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-23f0ba6e").then(n)}},{name:"v-70457f72",path:"/docs/introspection.html",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-70457f72").then(n)}},{name:"v-2bf9c0ae",path:"/docs/middleware.html",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-2bf9c0ae").then(n)}},{name:"v-1c00b5c9",path:"/docs/optimization.html",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-1c00b5c9").then(n)}},{name:"v-6d148503",path:"/docs/interop.html",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-6d148503").then(n)}},{name:"v-300a59ee",path:"/docs/validation.html",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-300a59ee").then(n)}},{name:"v-7bafdcee",path:"/docs/schema.html",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-7bafdcee").then(n)}},{name:"v-a971ed74",path:"/resources/",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-a971ed74").then(n)}},{path:"/resources/index.html",redirect:"/resources/"},{path:"*",component:Xa}],Ja={title:"",description:"",base:"/caliban/",pages:[{title:"Home",frontmatter:{home:!0,heroImage:"/caliban.svg",actionText:"Get Started →",actionLink:"/docs/",features:[{title:"Purely functional",details:"All interfaces are pure and types are referentially transparent."},{title:"Minimal boilerplate",details:"No need to manually define a schema for every type in your API."},{title:"Type safe schema",details:"Schema is derived at compile-time. Resolver is provided at runtime."}]},regularPath:"/",relativePath:"README.md",key:"v-3c88bbf2",path:"/"},{title:"About",frontmatter:{},regularPath:"/about/",relativePath:"about/README.md",key:"v-0decf914",path:"/about/"},{title:"Examples",frontmatter:{},regularPath:"/docs/examples.html",relativePath:"docs/examples.md",key:"v-4419f5c9",path:"/docs/examples.html"},{title:"Getting Started",frontmatter:{},regularPath:"/docs/",relativePath:"docs/README.md",key:"v-d7e5bcfc",path:"/docs/",headers:[{level:2,title:"Dependencies",slug:"dependencies"},{level:2,title:"A simple example",slug:"a-simple-example"},{level:2,title:"Mutations",slug:"mutations"},{level:2,title:"Subscriptions",slug:"subscriptions"}]},{title:"GraphQL Client",frontmatter:{},regularPath:"/docs/client.html",relativePath:"docs/client.md",key:"v-23f0ba6e",path:"/docs/client.html",headers:[{level:2,title:"Dependencies",slug:"dependencies"},{level:2,title:"Code generation",slug:"code-generation"},{level:2,title:"Query building",slug:"query-building"},{level:2,title:"Request execution",slug:"request-execution"}]},{title:"Introspection",frontmatter:{},regularPath:"/docs/introspection.html",relativePath:"docs/introspection.md",key:"v-70457f72",path:"/docs/introspection.html"},{title:"Middleware",frontmatter:{},regularPath:"/docs/middleware.html",relativePath:"docs/middleware.md",key:"v-2bf9c0ae",path:"/docs/middleware.html",headers:[{level:2,title:"Wrapper types",slug:"wrapper-types"},{level:2,title:"Pre-defined wrappers",slug:"pre-defined-wrappers"},{level:2,title:"Wrapping the interpreter",slug:"wrapping-the-interpreter"}]},{title:"Query optimization",frontmatter:{},regularPath:"/docs/optimization.html",relativePath:"docs/optimization.md",key:"v-1c00b5c9",path:"/docs/optimization.html",headers:[{level:2,title:"Introducing ZQuery",slug:"introducing-zquery"},{level:2,title:"Building a DataSource",slug:"building-a-datasource"},{level:2,title:"ZQuery constructors and operators",slug:"zquery-constructors-and-operators"},{level:2,title:"Using ZQuery with Caliban",slug:"using-zquery-with-caliban"}]},{title:"Interop (Cats, Monix)",frontmatter:{},regularPath:"/docs/interop.html",relativePath:"docs/interop.md",key:"v-6d148503",path:"/docs/interop.html",headers:[{level:2,title:"Cats Effect",slug:"cats-effect"},{level:2,title:"Monix",slug:"monix"}]},{title:"Validation",frontmatter:{},regularPath:"/docs/validation.html",relativePath:"docs/validation.md",key:"v-300a59ee",path:"/docs/validation.html"},{title:"Schemas",frontmatter:{},regularPath:"/docs/schema.html",relativePath:"docs/schema.md",key:"v-7bafdcee",path:"/docs/schema.html",headers:[{level:2,title:"Enums, unions, interfaces",slug:"enums-unions-interfaces"},{level:2,title:"Arguments",slug:"arguments"},{level:2,title:"Effects",slug:"effects"},{level:2,title:"Annotations",slug:"annotations"},{level:2,title:"Custom types",slug:"custom-types"},{level:2,title:"Code generation",slug:"code-generation"}]},{title:"Resources",frontmatter:{},regularPath:"/resources/",relativePath:"resources/README.md",key:"v-a971ed74",path:"/resources/",headers:[{level:2,title:"Talks",slug:"talks"},{level:2,title:"Blog Articles",slug:"blog-articles"}]}],themeConfig:{logo:"/caliban.svg",locales:{"/":{selectText:"Language",label:"English",nav:[{text:"Documentation",link:"/docs/"},{text:"Resources",link:"/resources/"},{text:"About",link:"/about/"},{text:"Github",link:"https://github.com/ghostdogpr/caliban"},{text:"Scaladoc",link:"https://javadoc.io/doc/com.github.ghostdogpr/caliban_2.12/"}],sidebar:{"/docs/":[{title:"Caliban",collapsable:!1,sidebarDepth:2,children:["","schema","middleware","optimization","validation","introspection","interop","client","examples"]}]}}}},locales:{"/":{lang:"en-US",title:"Caliban",description:"Functional GraphQL library for Scala",path:"/"}}};n(137);Ro.component("Badge",(function(){return Promise.all([n.e(0),n.e(3)]).then(n.bind(null,216))}));n(138);var Za=[{},function(t){t.Vue.mixin({computed:{$dataBlock:function(){return this.$options.__data__block__}}})},{},{}],ts=[];n(103);function es(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ns(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function rs(t,e,n){return e&&ns(t.prototype,e),n&&ns(t,n),t}function os(t,e){return!e||"object"!==ba(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function is(t){return(is=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function as(t,e){return(as=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var ss=function(t){function e(){return es(this,e),os(this,is(e).apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&as(t,e)}(e,t),e}(function(){function t(){es(this,t),this.store=new Ro({data:{state:{}}})}return rs(t,[{key:"$get",value:function(t){return this.store.state[t]}},{key:"$set",value:function(t,e){Ro.set(this.store.state,t,e)}},{key:"$emit",value:function(){var t;(t=this.store).$emit.apply(t,arguments)}},{key:"$on",value:function(){var t;(t=this.store).$on.apply(t,arguments)}}]),t}());Object.assign(ss.prototype,{getPageAsyncComponent:Ia,getLayoutAsyncComponent:Ma,getAsyncComponent:Da,getVueComponent:Na});var cs={install:function(t){var e=new ss;t.$vuepress=e,t.prototype.$vuepress=e}};function us(t){t.beforeEach((function(e,n,r){if(fs(t,e.path))r();else if(/(\/|\.html)$/.test(e.path))if(/\/$/.test(e.path)){var o=e.path.replace(/\/$/,"")+".html";fs(t,o)?r(o):r()}else r();else{var i=e.path+"/",a=e.path+".html";fs(t,a)?r(a):fs(t,i)?r(i):r()}}))}function fs(t,e){return t.options.routes.filter((function(t){return t.path.toLowerCase()===e.toLowerCase()})).length>0}var ls={props:{pageKey:String,slotKey:{type:String,default:"default"}},render:function(t){var e=this.pageKey||this.$parent.$page.key;return Ua("pageKey",e),Ro.component(e)||Ro.component(e,Ia(e)),Ro.component(e)?t(e):t("")}},ps={functional:!0,props:{slotKey:String,required:!0},render:function(t,e){var n=e.props,r=e.slots;return t("div",{class:["content__".concat(n.slotKey)]},r()[n.slotKey])}},ds=(n(139),Object(Qa.a)({},(function(t,e){var n=e._c;return n("svg",{staticClass:"icon outbound",attrs:{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",x:"0px",y:"0px",viewBox:"0 0 100 100",width:"15",height:"15"}},[n("path",{attrs:{fill:"currentColor",d:"M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"}}),e._v(" "),n("polygon",{attrs:{fill:"currentColor",points:"45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"}})])}),[],!0,null,null,null).exports);function hs(){return(hs=o(regeneratorRuntime.mark((function t(e){var n,r,o,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n="undefined"!=typeof window&&window.__VUEPRESS_ROUTER_BASE__?window.__VUEPRESS_ROUTER_BASE__:Ja.routerBase||Ja.base,us(r=new ma({base:n,mode:"history",fallback:!1,routes:Ya,scrollBehavior:function(t,e,n){return n||(t.hash?!Ro.$vuepress.$get("disableScrollBehavior")&&{selector:t.hash}:{x:0,y:0})}})),o={},t.prev=4,t.next=7,Promise.all(Za.filter((function(t){return"function"==typeof t})).map((function(t){return t({Vue:Ro,options:o,router:r,siteData:Ja,isServer:e})})));case 7:t.next=12;break;case 9:t.prev=9,t.t0=t.catch(4),console.error(t.t0);case 12:return i=new Ro(Object.assign(o,{router:r,render:function(t){return t("div",{attrs:{id:"app"}},[t("RouterView",{ref:"layout"}),t("div",{class:"global-ui"},ts.map((function(e){return t(e)})))])}})),t.abrupt("return",{app:i,router:r});case 14:case"end":return t.stop()}}),t,null,[[4,9]])})))).apply(this,arguments)}Ro.config.productionTip=!1,Ro.use(ma),Ro.use(cs),Ro.mixin(function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ro;ga(e),n.$vuepress.$set("siteData",e);var r=t(n.$vuepress.$get("siteData")),o=new r,i=Object.getOwnPropertyDescriptors(Object.getPrototypeOf(o)),a={};return Object.keys(i).reduce((function(t,e){return e.startsWith("$")&&(t[e]=i[e].get),t}),a),{computed:a}}((function(t){return function(){function e(){es(this,e)}return rs(e,[{key:"setPage",value:function(t){this.__page=t}},{key:"$site",get:function(){return t}},{key:"$themeConfig",get:function(){return this.$site.themeConfig}},{key:"$frontmatter",get:function(){return this.$page.frontmatter}},{key:"$localeConfig",get:function(){var t,e,n=this.$site.locales,r=void 0===n?{}:n;for(var o in r)"/"===o?e=r[o]:0===this.$page.path.indexOf(o)&&(t=r[o]);return t||e||{}}},{key:"$siteTitle",get:function(){return this.$localeConfig.title||this.$site.title||""}},{key:"$title",get:function(){var t=this.$page,e=this.$page.frontmatter.metaTitle;if("string"==typeof e)return e;var n=this.$siteTitle,r=t.frontmatter.home?null:t.frontmatter.title||t.title;return n?r?r+" | "+n:n:r||"VuePress"}},{key:"$description",get:function(){var t=function(t){if(t){var e=t.filter((function(t){return"description"===t.name}))[0];if(e)return e.content}}(this.$page.frontmatter.meta);return t||(this.$page.frontmatter.description||this.$localeConfig.description||this.$site.description||"")}},{key:"$lang",get:function(){return this.$page.frontmatter.lang||this.$localeConfig.lang||"en-US"}},{key:"$localePath",get:function(){return this.$localeConfig.path||"/"}},{key:"$themeLocaleConfig",get:function(){return(this.$site.themeConfig.locales||{})[this.$localePath]||{}}},{key:"$page",get:function(){return this.__page?this.__page:function(t,e){for(var n=0;n<t.length;n++){var r=t[n];if(r.path.toLowerCase()===e.toLowerCase())return r}return{path:"",frontmatter:{}}}(this.$site.pages,this.$route.path)}}]),e}()}),Ja)),Ro.component("Content",ls),Ro.component("ContentSlotsDistributor",ps),Ro.component("OutboundLink",ds),Ro.component("ClientOnly",{functional:!0,render:function(t,e){var n=e.parent,r=e.children;if(n._isMounted)return r;n.$once("hook:mounted",(function(){n.$forceUpdate()}))}}),Ro.component("Layout",Ma("Layout")),Ro.component("NotFound",Ma("NotFound")),Ro.prototype.$withBase=function(t){var e=this.$site.base;return"/"===t.charAt(0)?e+t.slice(1):t},window.__VUEPRESS__={version:"1.3.1",hash:"a21c617"},function(t){return hs.apply(this,arguments)}(!1).then((function(t){var e=t.app;t.router.onReady((function(){e.$mount("#app")}))}))}]); \ No newline at end of file + */function Io(t){return Object.prototype.toString.call(t).indexOf("Error")>-1}function Mo(t,e){return e instanceof t||e&&(e.name===t.name||e._name===t._name)}function Do(t,e){for(var n in e)t[n]=e[n];return t}var No={name:"RouterView",functional:!0,props:{name:{type:String,default:"default"}},render:function(t,e){var n=e.props,r=e.children,o=e.parent,i=e.data;i.routerView=!0;for(var a=o.$createElement,s=n.name,c=o.$route,u=o._routerViewCache||(o._routerViewCache={}),f=0,l=!1;o&&o._routerRoot!==o;){var p=o.$vnode?o.$vnode.data:{};p.routerView&&f++,p.keepAlive&&o._directInactive&&o._inactive&&(l=!0),o=o.$parent}if(i.routerViewDepth=f,l){var d=u[s],h=d&&d.component;return h?(d.configProps&&Fo(h,i,d.route,d.configProps),a(h,i,r)):a()}var v=c.matched[f],y=v&&v.components[s];if(!v||!y)return u[s]=null,a();u[s]={component:y},i.registerRouteInstance=function(t,e){var n=v.instances[s];(e&&n!==t||!e&&n===t)&&(v.instances[s]=e)},(i.hook||(i.hook={})).prepatch=function(t,e){v.instances[s]=e.componentInstance},i.hook.init=function(t){t.data.keepAlive&&t.componentInstance&&t.componentInstance!==v.instances[s]&&(v.instances[s]=t.componentInstance)};var m=v.props&&v.props[s];return m&&(Do(u[s],{route:c,configProps:m}),Fo(y,i,c,m)),a(y,i,r)}};function Fo(t,e,n,r){var o=e.props=function(t,e){switch(typeof e){case"undefined":return;case"object":return e;case"function":return e(t);case"boolean":return e?t.params:void 0;default:0}}(n,r);if(o){o=e.props=Do({},o);var i=e.attrs=e.attrs||{};for(var a in o)t.props&&a in t.props||(i[a]=o[a],delete o[a])}}var Uo=/[!'()*]/g,zo=function(t){return"%"+t.charCodeAt(0).toString(16)},Bo=/%2C/g,Vo=function(t){return encodeURIComponent(t).replace(Uo,zo).replace(Bo,",")},qo=decodeURIComponent;function Ho(t){var e={};return(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach((function(t){var n=t.replace(/\+/g," ").split("="),r=qo(n.shift()),o=n.length>0?qo(n.join("=")):null;void 0===e[r]?e[r]=o:Array.isArray(e[r])?e[r].push(o):e[r]=[e[r],o]})),e):e}function Wo(t){var e=t?Object.keys(t).map((function(e){var n=t[e];if(void 0===n)return"";if(null===n)return Vo(e);if(Array.isArray(n)){var r=[];return n.forEach((function(t){void 0!==t&&(null===t?r.push(Vo(e)):r.push(Vo(e)+"="+Vo(t)))})),r.join("&")}return Vo(e)+"="+Vo(n)})).filter((function(t){return t.length>0})).join("&"):null;return e?"?"+e:""}var Go=/\/?$/;function Ko(t,e,n,r){var o=r&&r.options.stringifyQuery,i=e.query||{};try{i=Qo(i)}catch(t){}var a={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:i,params:e.params||{},fullPath:Jo(e,o),matched:t?Yo(t):[]};return n&&(a.redirectedFrom=Jo(n,o)),Object.freeze(a)}function Qo(t){if(Array.isArray(t))return t.map(Qo);if(t&&"object"==typeof t){var e={};for(var n in t)e[n]=Qo(t[n]);return e}return t}var Xo=Ko(null,{path:"/"});function Yo(t){for(var e=[];t;)e.unshift(t),t=t.parent;return e}function Jo(t,e){var n=t.path,r=t.query;void 0===r&&(r={});var o=t.hash;return void 0===o&&(o=""),(n||"/")+(e||Wo)(r)+o}function Zo(t,e){return e===Xo?t===e:!!e&&(t.path&&e.path?t.path.replace(Go,"")===e.path.replace(Go,"")&&t.hash===e.hash&&ti(t.query,e.query):!(!t.name||!e.name)&&(t.name===e.name&&t.hash===e.hash&&ti(t.query,e.query)&&ti(t.params,e.params)))}function ti(t,e){if(void 0===t&&(t={}),void 0===e&&(e={}),!t||!e)return t===e;var n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every((function(n){var r=t[n],o=e[n];return"object"==typeof r&&"object"==typeof o?ti(r,o):String(r)===String(o)}))}function ei(t,e,n){var r=t.charAt(0);if("/"===r)return t;if("?"===r||"#"===r)return e+t;var o=e.split("/");n&&o[o.length-1]||o.pop();for(var i=t.replace(/^\//,"").split("/"),a=0;a<i.length;a++){var s=i[a];".."===s?o.pop():"."!==s&&o.push(s)}return""!==o[0]&&o.unshift(""),o.join("/")}function ni(t){return t.replace(/\/\//g,"/")}var ri=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},oi=gi,ii=fi,ai=function(t,e){return pi(fi(t,e))},si=pi,ci=mi,ui=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function fi(t,e){for(var n,r=[],o=0,i=0,a="",s=e&&e.delimiter||"/";null!=(n=ui.exec(t));){var c=n[0],u=n[1],f=n.index;if(a+=t.slice(i,f),i=f+c.length,u)a+=u[1];else{var l=t[i],p=n[2],d=n[3],h=n[4],v=n[5],y=n[6],m=n[7];a&&(r.push(a),a="");var g=null!=p&&null!=l&&l!==p,b="+"===y||"*"===y,_="?"===y||"*"===y,x=n[2]||s,w=h||v;r.push({name:d||o++,prefix:p||"",delimiter:x,optional:_,repeat:b,partial:g,asterisk:!!m,pattern:w?hi(w):m?".*":"[^"+di(x)+"]+?"})}}return i<t.length&&(a+=t.substr(i)),a&&r.push(a),r}function li(t){return encodeURI(t).replace(/[\/?#]/g,(function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()}))}function pi(t){for(var e=new Array(t.length),n=0;n<t.length;n++)"object"==typeof t[n]&&(e[n]=new RegExp("^(?:"+t[n].pattern+")$"));return function(n,r){for(var o="",i=n||{},a=(r||{}).pretty?li:encodeURIComponent,s=0;s<t.length;s++){var c=t[s];if("string"!=typeof c){var u,f=i[c.name];if(null==f){if(c.optional){c.partial&&(o+=c.prefix);continue}throw new TypeError('Expected "'+c.name+'" to be defined')}if(ri(f)){if(!c.repeat)throw new TypeError('Expected "'+c.name+'" to not repeat, but received `'+JSON.stringify(f)+"`");if(0===f.length){if(c.optional)continue;throw new TypeError('Expected "'+c.name+'" to not be empty')}for(var l=0;l<f.length;l++){if(u=a(f[l]),!e[s].test(u))throw new TypeError('Expected all "'+c.name+'" to match "'+c.pattern+'", but received `'+JSON.stringify(u)+"`");o+=(0===l?c.prefix:c.delimiter)+u}}else{if(u=c.asterisk?encodeURI(f).replace(/[?#]/g,(function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})):a(f),!e[s].test(u))throw new TypeError('Expected "'+c.name+'" to match "'+c.pattern+'", but received "'+u+'"');o+=c.prefix+u}}else o+=c}return o}}function di(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function hi(t){return t.replace(/([=!:$\/()])/g,"\\$1")}function vi(t,e){return t.keys=e,t}function yi(t){return t.sensitive?"":"i"}function mi(t,e,n){ri(e)||(n=e||n,e=[]);for(var r=(n=n||{}).strict,o=!1!==n.end,i="",a=0;a<t.length;a++){var s=t[a];if("string"==typeof s)i+=di(s);else{var c=di(s.prefix),u="(?:"+s.pattern+")";e.push(s),s.repeat&&(u+="(?:"+c+u+")*"),i+=u=s.optional?s.partial?c+"("+u+")?":"(?:"+c+"("+u+"))?":c+"("+u+")"}}var f=di(n.delimiter||"/"),l=i.slice(-f.length)===f;return r||(i=(l?i.slice(0,-f.length):i)+"(?:"+f+"(?=$))?"),i+=o?"$":r&&l?"":"(?="+f+"|$)",vi(new RegExp("^"+i,yi(n)),e)}function gi(t,e,n){return ri(e)||(n=e||n,e=[]),n=n||{},t instanceof RegExp?function(t,e){var n=t.source.match(/\((?!\?)/g);if(n)for(var r=0;r<n.length;r++)e.push({name:r,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return vi(t,e)}(t,e):ri(t)?function(t,e,n){for(var r=[],o=0;o<t.length;o++)r.push(gi(t[o],e,n).source);return vi(new RegExp("(?:"+r.join("|")+")",yi(n)),e)}(t,e,n):function(t,e,n){return mi(fi(t,n),e,n)}(t,e,n)}oi.parse=ii,oi.compile=ai,oi.tokensToFunction=si,oi.tokensToRegExp=ci;var bi=Object.create(null);function _i(t,e,n){e=e||{};try{var r=bi[t]||(bi[t]=oi.compile(t));return e.pathMatch&&(e[0]=e.pathMatch),r(e,{pretty:!0})}catch(t){return""}finally{delete e[0]}}function xi(t,e,n,r){var o="string"==typeof t?{path:t}:t;if(o._normalized)return o;if(o.name){var i=(o=Do({},t)).params;return i&&"object"==typeof i&&(o.params=Do({},i)),o}if(!o.path&&o.params&&e){(o=Do({},o))._normalized=!0;var a=Do(Do({},e.params),o.params);if(e.name)o.name=e.name,o.params=a;else if(e.matched.length){var s=e.matched[e.matched.length-1].path;o.path=_i(s,a,e.path)}else 0;return o}var c=function(t){var e="",n="",r=t.indexOf("#");r>=0&&(e=t.slice(r),t=t.slice(0,r));var o=t.indexOf("?");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{path:t,query:n,hash:e}}(o.path||""),u=e&&e.path||"/",f=c.path?ei(c.path,u,n||o.append):u,l=function(t,e,n){void 0===e&&(e={});var r,o=n||Ho;try{r=o(t||"")}catch(t){r={}}for(var i in e)r[i]=e[i];return r}(c.query,o.query,r&&r.options.parseQuery),p=o.hash||c.hash;return p&&"#"!==p.charAt(0)&&(p="#"+p),{_normalized:!0,path:f,query:l,hash:p}}var wi,Si=function(){},Oi={name:"RouterLink",props:{to:{type:[String,Object],required:!0},tag:{type:String,default:"a"},exact:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String,event:{type:[String,Array],default:"click"}},render:function(t){var e=this,n=this.$router,r=this.$route,o=n.resolve(this.to,r,this.append),i=o.location,a=o.route,s=o.href,c={},u=n.options.linkActiveClass,f=n.options.linkExactActiveClass,l=null==u?"router-link-active":u,p=null==f?"router-link-exact-active":f,d=null==this.activeClass?l:this.activeClass,h=null==this.exactActiveClass?p:this.exactActiveClass,v=a.redirectedFrom?Ko(null,xi(a.redirectedFrom),null,n):a;c[h]=Zo(r,v),c[d]=this.exact?c[h]:function(t,e){return 0===t.path.replace(Go,"/").indexOf(e.path.replace(Go,"/"))&&(!e.hash||t.hash===e.hash)&&function(t,e){for(var n in e)if(!(n in t))return!1;return!0}(t.query,e.query)}(r,v);var y=function(t){Ei(t)&&(e.replace?n.replace(i,Si):n.push(i,Si))},m={click:Ei};Array.isArray(this.event)?this.event.forEach((function(t){m[t]=y})):m[this.event]=y;var g={class:c},b=!this.$scopedSlots.$hasNormal&&this.$scopedSlots.default&&this.$scopedSlots.default({href:s,route:a,navigate:y,isActive:c[d],isExactActive:c[h]});if(b){if(1===b.length)return b[0];if(b.length>1||!b.length)return 0===b.length?t():t("span",{},b)}if("a"===this.tag)g.on=m,g.attrs={href:s};else{var _=function t(e){var n;if(e)for(var r=0;r<e.length;r++){if("a"===(n=e[r]).tag)return n;if(n.children&&(n=t(n.children)))return n}}(this.$slots.default);if(_){_.isStatic=!1;var x=_.data=Do({},_.data);for(var w in x.on=x.on||{},x.on){var S=x.on[w];w in m&&(x.on[w]=Array.isArray(S)?S:[S])}for(var O in m)O in x.on?x.on[O].push(m[O]):x.on[O]=y;(_.data.attrs=Do({},_.data.attrs)).href=s}else g.on=m}return t(this.tag,g,this.$slots.default)}};function Ei(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||t.defaultPrevented||void 0!==t.button&&0!==t.button)){if(t.currentTarget&&t.currentTarget.getAttribute){var e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}var Ci="undefined"!=typeof window;function $i(t,e,n,r){var o=e||[],i=n||Object.create(null),a=r||Object.create(null);t.forEach((function(t){!function t(e,n,r,o,i,a){var s=o.path,c=o.name;0;var u=o.pathToRegexpOptions||{},f=function(t,e,n){n||(t=t.replace(/\/$/,""));if("/"===t[0])return t;if(null==e)return t;return ni(e.path+"/"+t)}(s,i,u.strict);"boolean"==typeof o.caseSensitive&&(u.sensitive=o.caseSensitive);var l={path:f,regex:ki(f,u),components:o.components||{default:o.component},instances:{},name:c,parent:i,matchAs:a,redirect:o.redirect,beforeEnter:o.beforeEnter,meta:o.meta||{},props:null==o.props?{}:o.components?o.props:{default:o.props}};o.children&&o.children.forEach((function(o){var i=a?ni(a+"/"+o.path):void 0;t(e,n,r,o,l,i)}));n[l.path]||(e.push(l.path),n[l.path]=l);if(void 0!==o.alias)for(var p=Array.isArray(o.alias)?o.alias:[o.alias],d=0;d<p.length;++d){0;var h={path:p[d],children:o.children};t(e,n,r,h,i,l.path||"/")}c&&(r[c]||(r[c]=l))}(o,i,a,t)}));for(var s=0,c=o.length;s<c;s++)"*"===o[s]&&(o.push(o.splice(s,1)[0]),c--,s--);return{pathList:o,pathMap:i,nameMap:a}}function ki(t,e){return oi(t,[],e)}function Ai(t,e){var n=$i(t),r=n.pathList,o=n.pathMap,i=n.nameMap;function a(t,n,a){var s=xi(t,n,!1,e),u=s.name;if(u){var f=i[u];if(!f)return c(null,s);var l=f.regex.keys.filter((function(t){return!t.optional})).map((function(t){return t.name}));if("object"!=typeof s.params&&(s.params={}),n&&"object"==typeof n.params)for(var p in n.params)!(p in s.params)&&l.indexOf(p)>-1&&(s.params[p]=n.params[p]);return s.path=_i(f.path,s.params),c(f,s,a)}if(s.path){s.params={};for(var d=0;d<r.length;d++){var h=r[d],v=o[h];if(ji(v.regex,s.path,s.params))return c(v,s,a)}}return c(null,s)}function s(t,n){var r=t.redirect,o="function"==typeof r?r(Ko(t,n,null,e)):r;if("string"==typeof o&&(o={path:o}),!o||"object"!=typeof o)return c(null,n);var s=o,u=s.name,f=s.path,l=n.query,p=n.hash,d=n.params;if(l=s.hasOwnProperty("query")?s.query:l,p=s.hasOwnProperty("hash")?s.hash:p,d=s.hasOwnProperty("params")?s.params:d,u){i[u];return a({_normalized:!0,name:u,query:l,hash:p,params:d},void 0,n)}if(f){var h=function(t,e){return ei(t,e.parent?e.parent.path:"/",!0)}(f,t);return a({_normalized:!0,path:_i(h,d),query:l,hash:p},void 0,n)}return c(null,n)}function c(t,n,r){return t&&t.redirect?s(t,r||n):t&&t.matchAs?function(t,e,n){var r=a({_normalized:!0,path:_i(n,e.params)});if(r){var o=r.matched,i=o[o.length-1];return e.params=r.params,c(i,e)}return c(null,e)}(0,n,t.matchAs):Ko(t,n,r,e)}return{match:a,addRoutes:function(t){$i(t,r,o,i)}}}function ji(t,e,n){var r=e.match(t);if(!r)return!1;if(!n)return!0;for(var o=1,i=r.length;o<i;++o){var a=t.keys[o-1],s="string"==typeof r[o]?decodeURIComponent(r[o]):r[o];a&&(n[a.name||"pathMatch"]=s)}return!0}var Ti=Ci&&window.performance&&window.performance.now?window.performance:Date;function Pi(){return Ti.now().toFixed(3)}var Li=Pi();function Ri(){return Li}function Ii(t){return Li=t}var Mi=Object.create(null);function Di(){var t=window.location.protocol+"//"+window.location.host,e=window.location.href.replace(t,"");window.history.replaceState({key:Ri()},"",e),window.addEventListener("popstate",(function(t){Fi(),t.state&&t.state.key&&Ii(t.state.key)}))}function Ni(t,e,n,r){if(t.app){var o=t.options.scrollBehavior;o&&t.app.$nextTick((function(){var i=function(){var t=Ri();if(t)return Mi[t]}(),a=o.call(t,e,n,r?i:null);a&&("function"==typeof a.then?a.then((function(t){qi(t,i)})).catch((function(t){0})):qi(a,i))}))}}function Fi(){var t=Ri();t&&(Mi[t]={x:window.pageXOffset,y:window.pageYOffset})}function Ui(t){return Bi(t.x)||Bi(t.y)}function zi(t){return{x:Bi(t.x)?t.x:window.pageXOffset,y:Bi(t.y)?t.y:window.pageYOffset}}function Bi(t){return"number"==typeof t}var Vi=/^#\d/;function qi(t,e){var n,r="object"==typeof t;if(r&&"string"==typeof t.selector){var o=Vi.test(t.selector)?document.getElementById(t.selector.slice(1)):document.querySelector(t.selector);if(o){var i=t.offset&&"object"==typeof t.offset?t.offset:{};e=function(t,e){var n=document.documentElement.getBoundingClientRect(),r=t.getBoundingClientRect();return{x:r.left-n.left-e.x,y:r.top-n.top-e.y}}(o,i={x:Bi((n=i).x)?n.x:0,y:Bi(n.y)?n.y:0})}else Ui(t)&&(e=zi(t))}else r&&Ui(t)&&(e=zi(t));e&&window.scrollTo(e.x,e.y)}var Hi,Wi=Ci&&((-1===(Hi=window.navigator.userAgent).indexOf("Android 2.")&&-1===Hi.indexOf("Android 4.0")||-1===Hi.indexOf("Mobile Safari")||-1!==Hi.indexOf("Chrome")||-1!==Hi.indexOf("Windows Phone"))&&window.history&&"pushState"in window.history);function Gi(t,e){Fi();var n=window.history;try{if(e){var r=Do({},n.state);r.key=Ri(),n.replaceState(r,"",t)}else n.pushState({key:Ii(Pi())},"",t)}catch(n){window.location[e?"replace":"assign"](t)}}function Ki(t){Gi(t,!0)}function Qi(t,e,n){var r=function(o){o>=t.length?n():t[o]?e(t[o],(function(){r(o+1)})):r(o+1)};r(0)}function Xi(t){return function(e,n,r){var o=!1,i=0,a=null;Yi(t,(function(t,e,n,s){if("function"==typeof t&&void 0===t.cid){o=!0,i++;var c,u=ta((function(e){var o;((o=e).__esModule||Zi&&"Module"===o[Symbol.toStringTag])&&(e=e.default),t.resolved="function"==typeof e?e:wi.extend(e),n.components[s]=e,--i<=0&&r()})),f=ta((function(t){var e="Failed to resolve async component "+s+": "+t;a||(a=Io(t)?t:new Error(e),r(a))}));try{c=t(u,f)}catch(t){f(t)}if(c)if("function"==typeof c.then)c.then(u,f);else{var l=c.component;l&&"function"==typeof l.then&&l.then(u,f)}}})),o||r()}}function Yi(t,e){return Ji(t.map((function(t){return Object.keys(t.components).map((function(n){return e(t.components[n],t.instances[n],t,n)}))})))}function Ji(t){return Array.prototype.concat.apply([],t)}var Zi="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;function ta(t){var e=!1;return function(){for(var n=[],r=arguments.length;r--;)n[r]=arguments[r];if(!e)return e=!0,t.apply(this,n)}}var ea=function(t){function e(e){t.call(this),this.name=this._name="NavigationDuplicated",this.message='Navigating to current location ("'+e.fullPath+'") is not allowed',Object.defineProperty(this,"stack",{value:(new t).stack,writable:!0,configurable:!0})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error);ea._name="NavigationDuplicated";var na=function(t,e){this.router=t,this.base=function(t){if(!t)if(Ci){var e=document.querySelector("base");t=(t=e&&e.getAttribute("href")||"/").replace(/^https?:\/\/[^\/]+/,"")}else t="/";"/"!==t.charAt(0)&&(t="/"+t);return t.replace(/\/$/,"")}(e),this.current=Xo,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[]};function ra(t,e,n,r){var o=Yi(t,(function(t,r,o,i){var a=function(t,e){"function"!=typeof t&&(t=wi.extend(t));return t.options[e]}(t,e);if(a)return Array.isArray(a)?a.map((function(t){return n(t,r,o,i)})):n(a,r,o,i)}));return Ji(r?o.reverse():o)}function oa(t,e){if(e)return function(){return t.apply(e,arguments)}}na.prototype.listen=function(t){this.cb=t},na.prototype.onReady=function(t,e){this.ready?t():(this.readyCbs.push(t),e&&this.readyErrorCbs.push(e))},na.prototype.onError=function(t){this.errorCbs.push(t)},na.prototype.transitionTo=function(t,e,n){var r=this,o=this.router.match(t,this.current);this.confirmTransition(o,(function(){r.updateRoute(o),e&&e(o),r.ensureURL(),r.ready||(r.ready=!0,r.readyCbs.forEach((function(t){t(o)})))}),(function(t){n&&n(t),t&&!r.ready&&(r.ready=!0,r.readyErrorCbs.forEach((function(e){e(t)})))}))},na.prototype.confirmTransition=function(t,e,n){var r=this,o=this.current,i=function(t){!Mo(ea,t)&&Io(t)&&(r.errorCbs.length?r.errorCbs.forEach((function(e){e(t)})):console.error(t)),n&&n(t)};if(Zo(t,o)&&t.matched.length===o.matched.length)return this.ensureURL(),i(new ea(t));var a=function(t,e){var n,r=Math.max(t.length,e.length);for(n=0;n<r&&t[n]===e[n];n++);return{updated:e.slice(0,n),activated:e.slice(n),deactivated:t.slice(n)}}(this.current.matched,t.matched),s=a.updated,c=a.deactivated,u=a.activated,f=[].concat(function(t){return ra(t,"beforeRouteLeave",oa,!0)}(c),this.router.beforeHooks,function(t){return ra(t,"beforeRouteUpdate",oa)}(s),u.map((function(t){return t.beforeEnter})),Xi(u));this.pending=t;var l=function(e,n){if(r.pending!==t)return i();try{e(t,o,(function(t){!1===t||Io(t)?(r.ensureURL(!0),i(t)):"string"==typeof t||"object"==typeof t&&("string"==typeof t.path||"string"==typeof t.name)?(i(),"object"==typeof t&&t.replace?r.replace(t):r.push(t)):n(t)}))}catch(t){i(t)}};Qi(f,l,(function(){var n=[];Qi(function(t,e,n){return ra(t,"beforeRouteEnter",(function(t,r,o,i){return function(t,e,n,r,o){return function(i,a,s){return t(i,a,(function(t){"function"==typeof t&&r.push((function(){!function t(e,n,r,o){n[r]&&!n[r]._isBeingDestroyed?e(n[r]):o()&&setTimeout((function(){t(e,n,r,o)}),16)}(t,e.instances,n,o)})),s(t)}))}}(t,o,i,e,n)}))}(u,n,(function(){return r.current===t})).concat(r.router.resolveHooks),l,(function(){if(r.pending!==t)return i();r.pending=null,e(t),r.router.app&&r.router.app.$nextTick((function(){n.forEach((function(t){t()}))}))}))}))},na.prototype.updateRoute=function(t){var e=this.current;this.current=t,this.cb&&this.cb(t),this.router.afterHooks.forEach((function(n){n&&n(t,e)}))};var ia=function(t){function e(e,n){var r=this;t.call(this,e,n);var o=e.options.scrollBehavior,i=Wi&&o;i&&Di();var a=aa(this.base);window.addEventListener("popstate",(function(t){var n=r.current,o=aa(r.base);r.current===Xo&&o===a||r.transitionTo(o,(function(t){i&&Ni(e,t,n,!0)}))}))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.go=function(t){window.history.go(t)},e.prototype.push=function(t,e,n){var r=this,o=this.current;this.transitionTo(t,(function(t){Gi(ni(r.base+t.fullPath)),Ni(r.router,t,o,!1),e&&e(t)}),n)},e.prototype.replace=function(t,e,n){var r=this,o=this.current;this.transitionTo(t,(function(t){Ki(ni(r.base+t.fullPath)),Ni(r.router,t,o,!1),e&&e(t)}),n)},e.prototype.ensureURL=function(t){if(aa(this.base)!==this.current.fullPath){var e=ni(this.base+this.current.fullPath);t?Gi(e):Ki(e)}},e.prototype.getCurrentLocation=function(){return aa(this.base)},e}(na);function aa(t){var e=decodeURI(window.location.pathname);return t&&0===e.indexOf(t)&&(e=e.slice(t.length)),(e||"/")+window.location.search+window.location.hash}var sa=function(t){function e(e,n,r){t.call(this,e,n),r&&function(t){var e=aa(t);if(!/^\/#/.test(e))return window.location.replace(ni(t+"/#"+e)),!0}(this.base)||ca()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setupListeners=function(){var t=this,e=this.router.options.scrollBehavior,n=Wi&&e;n&&Di(),window.addEventListener(Wi?"popstate":"hashchange",(function(){var e=t.current;ca()&&t.transitionTo(ua(),(function(r){n&&Ni(t.router,r,e,!0),Wi||pa(r.fullPath)}))}))},e.prototype.push=function(t,e,n){var r=this,o=this.current;this.transitionTo(t,(function(t){la(t.fullPath),Ni(r.router,t,o,!1),e&&e(t)}),n)},e.prototype.replace=function(t,e,n){var r=this,o=this.current;this.transitionTo(t,(function(t){pa(t.fullPath),Ni(r.router,t,o,!1),e&&e(t)}),n)},e.prototype.go=function(t){window.history.go(t)},e.prototype.ensureURL=function(t){var e=this.current.fullPath;ua()!==e&&(t?la(e):pa(e))},e.prototype.getCurrentLocation=function(){return ua()},e}(na);function ca(){var t=ua();return"/"===t.charAt(0)||(pa("/"+t),!1)}function ua(){var t=window.location.href,e=t.indexOf("#");if(e<0)return"";var n=(t=t.slice(e+1)).indexOf("?");if(n<0){var r=t.indexOf("#");t=r>-1?decodeURI(t.slice(0,r))+t.slice(r):decodeURI(t)}else t=decodeURI(t.slice(0,n))+t.slice(n);return t}function fa(t){var e=window.location.href,n=e.indexOf("#");return(n>=0?e.slice(0,n):e)+"#"+t}function la(t){Wi?Gi(fa(t)):window.location.hash=t}function pa(t){Wi?Ki(fa(t)):window.location.replace(fa(t))}var da=function(t){function e(e,n){t.call(this,e,n),this.stack=[],this.index=-1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.push=function(t,e,n){var r=this;this.transitionTo(t,(function(t){r.stack=r.stack.slice(0,r.index+1).concat(t),r.index++,e&&e(t)}),n)},e.prototype.replace=function(t,e,n){var r=this;this.transitionTo(t,(function(t){r.stack=r.stack.slice(0,r.index).concat(t),e&&e(t)}),n)},e.prototype.go=function(t){var e=this,n=this.index+t;if(!(n<0||n>=this.stack.length)){var r=this.stack[n];this.confirmTransition(r,(function(){e.index=n,e.updateRoute(r)}),(function(t){Mo(ea,t)&&(e.index=n)}))}},e.prototype.getCurrentLocation=function(){var t=this.stack[this.stack.length-1];return t?t.fullPath:"/"},e.prototype.ensureURL=function(){},e}(na),ha=function(t){void 0===t&&(t={}),this.app=null,this.apps=[],this.options=t,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=Ai(t.routes||[],this);var e=t.mode||"hash";switch(this.fallback="history"===e&&!Wi&&!1!==t.fallback,this.fallback&&(e="hash"),Ci||(e="abstract"),this.mode=e,e){case"history":this.history=new ia(this,t.base);break;case"hash":this.history=new sa(this,t.base,this.fallback);break;case"abstract":this.history=new da(this,t.base);break;default:0}},va={currentRoute:{configurable:!0}};function ya(t,e){return t.push(e),function(){var n=t.indexOf(e);n>-1&&t.splice(n,1)}}ha.prototype.match=function(t,e,n){return this.matcher.match(t,e,n)},va.currentRoute.get=function(){return this.history&&this.history.current},ha.prototype.init=function(t){var e=this;if(this.apps.push(t),t.$once("hook:destroyed",(function(){var n=e.apps.indexOf(t);n>-1&&e.apps.splice(n,1),e.app===t&&(e.app=e.apps[0]||null)})),!this.app){this.app=t;var n=this.history;if(n instanceof ia)n.transitionTo(n.getCurrentLocation());else if(n instanceof sa){var r=function(){n.setupListeners()};n.transitionTo(n.getCurrentLocation(),r,r)}n.listen((function(t){e.apps.forEach((function(e){e._route=t}))}))}},ha.prototype.beforeEach=function(t){return ya(this.beforeHooks,t)},ha.prototype.beforeResolve=function(t){return ya(this.resolveHooks,t)},ha.prototype.afterEach=function(t){return ya(this.afterHooks,t)},ha.prototype.onReady=function(t,e){this.history.onReady(t,e)},ha.prototype.onError=function(t){this.history.onError(t)},ha.prototype.push=function(t,e,n){var r=this;if(!e&&!n&&"undefined"!=typeof Promise)return new Promise((function(e,n){r.history.push(t,e,n)}));this.history.push(t,e,n)},ha.prototype.replace=function(t,e,n){var r=this;if(!e&&!n&&"undefined"!=typeof Promise)return new Promise((function(e,n){r.history.replace(t,e,n)}));this.history.replace(t,e,n)},ha.prototype.go=function(t){this.history.go(t)},ha.prototype.back=function(){this.go(-1)},ha.prototype.forward=function(){this.go(1)},ha.prototype.getMatchedComponents=function(t){var e=t?t.matched?t:this.resolve(t).route:this.currentRoute;return e?[].concat.apply([],e.matched.map((function(t){return Object.keys(t.components).map((function(e){return t.components[e]}))}))):[]},ha.prototype.resolve=function(t,e,n){var r=xi(t,e=e||this.history.current,n,this),o=this.match(r,e),i=o.redirectedFrom||o.fullPath;return{location:r,route:o,href:function(t,e,n){var r="hash"===n?"#"+e:e;return t?ni(t+"/"+r):r}(this.history.base,i,this.mode),normalizedTo:r,resolved:o}},ha.prototype.addRoutes=function(t){this.matcher.addRoutes(t),this.history.current!==Xo&&this.history.transitionTo(this.history.getCurrentLocation())},Object.defineProperties(ha.prototype,va),ha.install=function t(e){if(!t.installed||wi!==e){t.installed=!0,wi=e;var n=function(t){return void 0!==t},r=function(t,e){var r=t.$options._parentVnode;n(r)&&n(r=r.data)&&n(r=r.registerRouteInstance)&&r(t,e)};e.mixin({beforeCreate:function(){n(this.$options.router)?(this._routerRoot=this,this._router=this.$options.router,this._router.init(this),e.util.defineReactive(this,"_route",this._router.history.current)):this._routerRoot=this.$parent&&this.$parent._routerRoot||this,r(this,this)},destroyed:function(){r(this)}}),Object.defineProperty(e.prototype,"$router",{get:function(){return this._routerRoot._router}}),Object.defineProperty(e.prototype,"$route",{get:function(){return this._routerRoot._route}}),e.component("RouterView",No),e.component("RouterLink",Oi);var o=e.config.optionMergeStrategies;o.beforeRouteEnter=o.beforeRouteLeave=o.beforeRouteUpdate=o.created}},ha.version="3.1.5",Ci&&window.Vue&&window.Vue.use(ha);var ma=ha;n(66),n(120),n(122),n(123),n(124),n(61),n(125),n(67);function ga(t){t.locales&&Object.keys(t.locales).forEach((function(e){t.locales[e].path=e})),Object.freeze(t)}n(106),n(126),n(29),n(108),n(41);function ba(t){return(ba="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var _a=n(38),xa={NotFound:function(){return n.e(4).then(n.bind(null,203))},Layout:function(){return Promise.all([n.e(0),n.e(2)]).then(n.bind(null,202))}},wa={"v-3c88bbf2":function(){return n.e(5).then(n.bind(null,204))},"v-0decf914":function(){return n.e(6).then(n.bind(null,205))},"v-d7e5bcfc":function(){return n.e(7).then(n.bind(null,206))},"v-23f0ba6e":function(){return n.e(8).then(n.bind(null,207))},"v-4419f5c9":function(){return n.e(9).then(n.bind(null,208))},"v-70457f72":function(){return n.e(11).then(n.bind(null,209))},"v-6d148503":function(){return n.e(10).then(n.bind(null,210))},"v-2bf9c0ae":function(){return n.e(12).then(n.bind(null,211))},"v-1c00b5c9":function(){return n.e(13).then(n.bind(null,212))},"v-7bafdcee":function(){return n.e(14).then(n.bind(null,213))},"v-300a59ee":function(){return n.e(15).then(n.bind(null,214))},"v-a971ed74":function(){return n.e(16).then(n.bind(null,215))}};function Sa(t){var e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}var Oa=/-(\w)/g,Ea=Sa((function(t){return t.replace(Oa,(function(t,e){return e?e.toUpperCase():""}))})),Ca=/\B([A-Z])/g,$a=Sa((function(t){return t.replace(Ca,"-$1").toLowerCase()})),ka=Sa((function(t){return t.charAt(0).toUpperCase()+t.slice(1)}));function Aa(t,e){if(e)return t(e)?t(e):e.includes("-")?t(ka(Ea(e))):t(ka(e))||t($a(e))}var ja=Object.assign({},xa,wa),Ta=function(t){return ja[t]},Pa=function(t){return wa[t]},La=function(t){return xa[t]},Ra=function(t){return Ro.component(t)};function Ia(t){return Aa(Pa,t)}function Ma(t){return Aa(La,t)}function Da(t){return Aa(Ta,t)}function Na(t){return Aa(Ra,t)}function Fa(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Promise.all(e.filter((function(t){return t})).map(function(){var t=o(regeneratorRuntime.mark((function t(e){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Na(e)||!Da(e)){t.next=5;break}return t.next=3,Da(e)();case 3:n=t.sent,Ro.component(e,n.default);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()))}function Ua(t,e){"undefined"!=typeof window&&window.__VUEPRESS__&&(window.__VUEPRESS__[t]=e)}n(91),n(93),n(60),n(129);var za={created:function(){this.$ssrContext&&(this.$ssrContext.title=this.$title,this.$ssrContext.lang=this.$lang,this.$ssrContext.description=this.$page.description||this.$description)},mounted:function(){this.currentMetaTags=new Set,this.updateMeta()},methods:{updateMeta:function(){var t=this;document.title=this.$title,document.documentElement.lang=this.$lang;var e=this.$page.frontmatter.meta||[],n=e.slice(0);0===e.filter((function(t){return"description"===t.name})).length&&n.push({name:"description",content:this.$description});var r=document.querySelectorAll('meta[name="description"]');r.length&&r.forEach((function(e){return t.currentMetaTags.add(e)})),this.currentMetaTags=new Set(Ba(n,this.currentMetaTags))}},watch:{$page:function(){this.updateMeta()}},beforeDestroy:function(){Ba(null,this.currentMetaTags)}};function Ba(t,e){if(e&&Object(_a.a)(e).forEach((function(t){document.head.removeChild(t)})),t)return t.map((function(t){var e=document.createElement("meta");return Object.keys(t).forEach((function(n){e.setAttribute(n,t[n])})),document.head.appendChild(e),e}))}n(97);var Va=n(96),qa={mounted:function(){window.addEventListener("scroll",this.onScroll)},methods:{onScroll:n.n(Va)()((function(){this.setActiveHash()}),300),setActiveHash:function(){for(var t=this,e=[].slice.call(document.querySelectorAll(".sidebar-link")),n=[].slice.call(document.querySelectorAll(".header-anchor")).filter((function(t){return e.some((function(e){return e.hash===t.hash}))})),r=Math.max(window.pageYOffset,document.documentElement.scrollTop,document.body.scrollTop),o=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),i=window.innerHeight+r,a=0;a<n.length;a++){var s=n[a],c=n[a+1],u=0===a&&0===r||r>=s.parentElement.offsetTop+10&&(!c||r<c.parentElement.offsetTop-10),f=decodeURIComponent(this.$route.hash);if(u&&f!==decodeURIComponent(s.hash)){var l=s;if(i===o)for(var p=a+1;p<n.length;p++)if(f===decodeURIComponent(n[p].hash))return;return this.$vuepress.$set("disableScrollBehavior",!0),void this.$router.replace(decodeURIComponent(l.hash),(function(){t.$nextTick((function(){t.$vuepress.$set("disableScrollBehavior",!1)}))}))}}}},beforeDestroy:function(){window.removeEventListener("scroll",this.onScroll)}},Ha=n(39),Wa=n.n(Ha),Ga=[za,qa,{mounted:function(){var t=this;Wa.a.configure({showSpinner:!1}),this.$router.beforeEach((function(t,e,n){t.path===e.path||Ro.component(t.name)||Wa.a.start(),n()})),this.$router.afterEach((function(){Wa.a.done(),t.isSidebarOpen=!1}))}}],Ka={name:"GlobalLayout",computed:{layout:function(){var t=this.getLayout();return Ua("layout",t),Ro.component(t)}},methods:{getLayout:function(){if(this.$page.path){var t=this.$page.frontmatter.layout;return t&&(this.$vuepress.getLayoutAsyncComponent(t)||this.$vuepress.getVueComponent(t))?t:"Layout"}return"NotFound"}}},Qa=n(28),Xa=Object(Qa.a)(Ka,(function(){var t=this.$createElement;return(this._self._c||t)(this.layout,{tag:"component"})}),[],!1,null,null,null).exports;!function(t,e,n){var r;switch(e){case"components":t[e]||(t[e]={}),Object.assign(t[e],n);break;case"mixins":t[e]||(t[e]=[]),(r=t[e]).push.apply(r,Object(_a.a)(n));break;default:throw new Error("Unknown option name.")}}(Xa,"mixins",Ga);var Ya=[{name:"v-3c88bbf2",path:"/",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-3c88bbf2").then(n)}},{path:"/index.html",redirect:"/"},{name:"v-0decf914",path:"/about/",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-0decf914").then(n)}},{path:"/about/index.html",redirect:"/about/"},{name:"v-d7e5bcfc",path:"/docs/",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-d7e5bcfc").then(n)}},{path:"/docs/index.html",redirect:"/docs/"},{name:"v-23f0ba6e",path:"/docs/client.html",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-23f0ba6e").then(n)}},{name:"v-4419f5c9",path:"/docs/examples.html",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-4419f5c9").then(n)}},{name:"v-70457f72",path:"/docs/introspection.html",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-70457f72").then(n)}},{name:"v-6d148503",path:"/docs/interop.html",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-6d148503").then(n)}},{name:"v-2bf9c0ae",path:"/docs/middleware.html",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-2bf9c0ae").then(n)}},{name:"v-1c00b5c9",path:"/docs/optimization.html",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-1c00b5c9").then(n)}},{name:"v-7bafdcee",path:"/docs/schema.html",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-7bafdcee").then(n)}},{name:"v-300a59ee",path:"/docs/validation.html",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-300a59ee").then(n)}},{name:"v-a971ed74",path:"/resources/",component:Xa,beforeEnter:function(t,e,n){Fa("Layout","v-a971ed74").then(n)}},{path:"/resources/index.html",redirect:"/resources/"},{path:"*",component:Xa}],Ja={title:"",description:"",base:"/caliban/",pages:[{title:"Home",frontmatter:{home:!0,heroImage:"/caliban.svg",actionText:"Get Started →",actionLink:"/docs/",features:[{title:"Purely functional",details:"All interfaces are pure and types are referentially transparent."},{title:"Minimal boilerplate",details:"No need to manually define a schema for every type in your API."},{title:"Type safe schema",details:"Schema is derived at compile-time. Resolver is provided at runtime."}]},regularPath:"/",relativePath:"README.md",key:"v-3c88bbf2",path:"/"},{title:"About",frontmatter:{},regularPath:"/about/",relativePath:"about/README.md",key:"v-0decf914",path:"/about/"},{title:"Getting Started",frontmatter:{},regularPath:"/docs/",relativePath:"docs/README.md",key:"v-d7e5bcfc",path:"/docs/",headers:[{level:2,title:"Dependencies",slug:"dependencies"},{level:2,title:"A simple example",slug:"a-simple-example"},{level:2,title:"Mutations",slug:"mutations"},{level:2,title:"Subscriptions",slug:"subscriptions"}]},{title:"GraphQL Client",frontmatter:{},regularPath:"/docs/client.html",relativePath:"docs/client.md",key:"v-23f0ba6e",path:"/docs/client.html",headers:[{level:2,title:"Dependencies",slug:"dependencies"},{level:2,title:"Code generation",slug:"code-generation"},{level:2,title:"Query building",slug:"query-building"},{level:2,title:"Request execution",slug:"request-execution"}]},{title:"Examples",frontmatter:{},regularPath:"/docs/examples.html",relativePath:"docs/examples.md",key:"v-4419f5c9",path:"/docs/examples.html"},{title:"Introspection",frontmatter:{},regularPath:"/docs/introspection.html",relativePath:"docs/introspection.md",key:"v-70457f72",path:"/docs/introspection.html"},{title:"Interop (Cats, Monix)",frontmatter:{},regularPath:"/docs/interop.html",relativePath:"docs/interop.md",key:"v-6d148503",path:"/docs/interop.html",headers:[{level:2,title:"Cats Effect",slug:"cats-effect"},{level:2,title:"Monix",slug:"monix"}]},{title:"Middleware",frontmatter:{},regularPath:"/docs/middleware.html",relativePath:"docs/middleware.md",key:"v-2bf9c0ae",path:"/docs/middleware.html",headers:[{level:2,title:"Wrapper types",slug:"wrapper-types"},{level:2,title:"Pre-defined wrappers",slug:"pre-defined-wrappers"},{level:2,title:"Wrapping the interpreter",slug:"wrapping-the-interpreter"}]},{title:"Query optimization",frontmatter:{},regularPath:"/docs/optimization.html",relativePath:"docs/optimization.md",key:"v-1c00b5c9",path:"/docs/optimization.html",headers:[{level:2,title:"Introducing ZQuery",slug:"introducing-zquery"},{level:2,title:"Building a DataSource",slug:"building-a-datasource"},{level:2,title:"ZQuery constructors and operators",slug:"zquery-constructors-and-operators"},{level:2,title:"Using ZQuery with Caliban",slug:"using-zquery-with-caliban"}]},{title:"Schemas",frontmatter:{},regularPath:"/docs/schema.html",relativePath:"docs/schema.md",key:"v-7bafdcee",path:"/docs/schema.html",headers:[{level:2,title:"Enums, unions, interfaces",slug:"enums-unions-interfaces"},{level:2,title:"Arguments",slug:"arguments"},{level:2,title:"Effects",slug:"effects"},{level:2,title:"Annotations",slug:"annotations"},{level:2,title:"Custom types",slug:"custom-types"},{level:2,title:"Code generation",slug:"code-generation"}]},{title:"Validation",frontmatter:{},regularPath:"/docs/validation.html",relativePath:"docs/validation.md",key:"v-300a59ee",path:"/docs/validation.html"},{title:"Resources",frontmatter:{},regularPath:"/resources/",relativePath:"resources/README.md",key:"v-a971ed74",path:"/resources/",headers:[{level:2,title:"Talks",slug:"talks"},{level:2,title:"Blog Articles",slug:"blog-articles"}]}],themeConfig:{logo:"/caliban.svg",locales:{"/":{selectText:"Language",label:"English",nav:[{text:"Documentation",link:"/docs/"},{text:"Resources",link:"/resources/"},{text:"About",link:"/about/"},{text:"Github",link:"https://github.com/ghostdogpr/caliban"},{text:"Scaladoc",link:"https://javadoc.io/doc/com.github.ghostdogpr/caliban_2.12/"}],sidebar:{"/docs/":[{title:"Caliban",collapsable:!1,sidebarDepth:2,children:["","schema","middleware","optimization","validation","introspection","interop","client","examples"]}]}}}},locales:{"/":{lang:"en-US",title:"Caliban",description:"Functional GraphQL library for Scala",path:"/"}}};n(137);Ro.component("Badge",(function(){return Promise.all([n.e(0),n.e(3)]).then(n.bind(null,216))}));n(138);var Za=[{},function(t){t.Vue.mixin({computed:{$dataBlock:function(){return this.$options.__data__block__}}})},{},{}],ts=[];n(103);function es(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ns(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function rs(t,e,n){return e&&ns(t.prototype,e),n&&ns(t,n),t}function os(t,e){return!e||"object"!==ba(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function is(t){return(is=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function as(t,e){return(as=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var ss=function(t){function e(){return es(this,e),os(this,is(e).apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&as(t,e)}(e,t),e}(function(){function t(){es(this,t),this.store=new Ro({data:{state:{}}})}return rs(t,[{key:"$get",value:function(t){return this.store.state[t]}},{key:"$set",value:function(t,e){Ro.set(this.store.state,t,e)}},{key:"$emit",value:function(){var t;(t=this.store).$emit.apply(t,arguments)}},{key:"$on",value:function(){var t;(t=this.store).$on.apply(t,arguments)}}]),t}());Object.assign(ss.prototype,{getPageAsyncComponent:Ia,getLayoutAsyncComponent:Ma,getAsyncComponent:Da,getVueComponent:Na});var cs={install:function(t){var e=new ss;t.$vuepress=e,t.prototype.$vuepress=e}};function us(t){t.beforeEach((function(e,n,r){if(fs(t,e.path))r();else if(/(\/|\.html)$/.test(e.path))if(/\/$/.test(e.path)){var o=e.path.replace(/\/$/,"")+".html";fs(t,o)?r(o):r()}else r();else{var i=e.path+"/",a=e.path+".html";fs(t,a)?r(a):fs(t,i)?r(i):r()}}))}function fs(t,e){return t.options.routes.filter((function(t){return t.path.toLowerCase()===e.toLowerCase()})).length>0}var ls={props:{pageKey:String,slotKey:{type:String,default:"default"}},render:function(t){var e=this.pageKey||this.$parent.$page.key;return Ua("pageKey",e),Ro.component(e)||Ro.component(e,Ia(e)),Ro.component(e)?t(e):t("")}},ps={functional:!0,props:{slotKey:String,required:!0},render:function(t,e){var n=e.props,r=e.slots;return t("div",{class:["content__".concat(n.slotKey)]},r()[n.slotKey])}},ds=(n(139),Object(Qa.a)({},(function(t,e){var n=e._c;return n("svg",{staticClass:"icon outbound",attrs:{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",x:"0px",y:"0px",viewBox:"0 0 100 100",width:"15",height:"15"}},[n("path",{attrs:{fill:"currentColor",d:"M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"}}),e._v(" "),n("polygon",{attrs:{fill:"currentColor",points:"45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"}})])}),[],!0,null,null,null).exports);function hs(){return(hs=o(regeneratorRuntime.mark((function t(e){var n,r,o,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n="undefined"!=typeof window&&window.__VUEPRESS_ROUTER_BASE__?window.__VUEPRESS_ROUTER_BASE__:Ja.routerBase||Ja.base,us(r=new ma({base:n,mode:"history",fallback:!1,routes:Ya,scrollBehavior:function(t,e,n){return n||(t.hash?!Ro.$vuepress.$get("disableScrollBehavior")&&{selector:t.hash}:{x:0,y:0})}})),o={},t.prev=4,t.next=7,Promise.all(Za.filter((function(t){return"function"==typeof t})).map((function(t){return t({Vue:Ro,options:o,router:r,siteData:Ja,isServer:e})})));case 7:t.next=12;break;case 9:t.prev=9,t.t0=t.catch(4),console.error(t.t0);case 12:return i=new Ro(Object.assign(o,{router:r,render:function(t){return t("div",{attrs:{id:"app"}},[t("RouterView",{ref:"layout"}),t("div",{class:"global-ui"},ts.map((function(e){return t(e)})))])}})),t.abrupt("return",{app:i,router:r});case 14:case"end":return t.stop()}}),t,null,[[4,9]])})))).apply(this,arguments)}Ro.config.productionTip=!1,Ro.use(ma),Ro.use(cs),Ro.mixin(function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ro;ga(e),n.$vuepress.$set("siteData",e);var r=t(n.$vuepress.$get("siteData")),o=new r,i=Object.getOwnPropertyDescriptors(Object.getPrototypeOf(o)),a={};return Object.keys(i).reduce((function(t,e){return e.startsWith("$")&&(t[e]=i[e].get),t}),a),{computed:a}}((function(t){return function(){function e(){es(this,e)}return rs(e,[{key:"setPage",value:function(t){this.__page=t}},{key:"$site",get:function(){return t}},{key:"$themeConfig",get:function(){return this.$site.themeConfig}},{key:"$frontmatter",get:function(){return this.$page.frontmatter}},{key:"$localeConfig",get:function(){var t,e,n=this.$site.locales,r=void 0===n?{}:n;for(var o in r)"/"===o?e=r[o]:0===this.$page.path.indexOf(o)&&(t=r[o]);return t||e||{}}},{key:"$siteTitle",get:function(){return this.$localeConfig.title||this.$site.title||""}},{key:"$title",get:function(){var t=this.$page,e=this.$page.frontmatter.metaTitle;if("string"==typeof e)return e;var n=this.$siteTitle,r=t.frontmatter.home?null:t.frontmatter.title||t.title;return n?r?r+" | "+n:n:r||"VuePress"}},{key:"$description",get:function(){var t=function(t){if(t){var e=t.filter((function(t){return"description"===t.name}))[0];if(e)return e.content}}(this.$page.frontmatter.meta);return t||(this.$page.frontmatter.description||this.$localeConfig.description||this.$site.description||"")}},{key:"$lang",get:function(){return this.$page.frontmatter.lang||this.$localeConfig.lang||"en-US"}},{key:"$localePath",get:function(){return this.$localeConfig.path||"/"}},{key:"$themeLocaleConfig",get:function(){return(this.$site.themeConfig.locales||{})[this.$localePath]||{}}},{key:"$page",get:function(){return this.__page?this.__page:function(t,e){for(var n=0;n<t.length;n++){var r=t[n];if(r.path.toLowerCase()===e.toLowerCase())return r}return{path:"",frontmatter:{}}}(this.$site.pages,this.$route.path)}}]),e}()}),Ja)),Ro.component("Content",ls),Ro.component("ContentSlotsDistributor",ps),Ro.component("OutboundLink",ds),Ro.component("ClientOnly",{functional:!0,render:function(t,e){var n=e.parent,r=e.children;if(n._isMounted)return r;n.$once("hook:mounted",(function(){n.$forceUpdate()}))}}),Ro.component("Layout",Ma("Layout")),Ro.component("NotFound",Ma("NotFound")),Ro.prototype.$withBase=function(t){var e=this.$site.base;return"/"===t.charAt(0)?e+t.slice(1):t},window.__VUEPRESS__={version:"1.3.1",hash:"d467e91"},function(t){return hs.apply(this,arguments)}(!1).then((function(t){var e=t.app;t.router.onReady((function(){e.$mount("#app")}))}))}]); \ No newline at end of file diff --git a/docs/docs/client.html b/docs/docs/client.html index 13ee0723e..4386524fb 100644 --- a/docs/docs/client.html +++ b/docs/docs/client.html @@ -8,7 +8,7 @@ <meta name="generator" content="VuePress 1.3.1"> <link rel="icon" href="/caliban/caliban.png"> - <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/8.6272775d.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.5f8b2c07.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.bc45abe0.js"><link rel="prefetch" href="/caliban/assets/js/13.d315a1c7.js"><link rel="prefetch" href="/caliban/assets/js/14.b8b8c6ff.js"><link rel="prefetch" href="/caliban/assets/js/15.23ceaf26.js"><link rel="prefetch" href="/caliban/assets/js/16.f357ff30.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.57a8ce51.js"><link rel="prefetch" href="/caliban/assets/js/9.417f11bf.js"> + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.3687d251.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/8.4c5efb33.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.56cd42ab.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.381b7c5a.js"><link rel="prefetch" href="/caliban/assets/js/13.1c02ea8d.js"><link rel="prefetch" href="/caliban/assets/js/14.0bd8bec9.js"><link rel="prefetch" href="/caliban/assets/js/15.1f4e823e.js"><link rel="prefetch" href="/caliban/assets/js/16.285ebbb2.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.16ad04b7.js"><link rel="prefetch" href="/caliban/assets/js/9.08ac8c9e.js"> <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> </head> <body> @@ -93,6 +93,6 @@ </a> → </span></p></div> </main></div><div class="global-ui"></div></div> - <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/8.6272775d.js" defer></script> + <script src="/caliban/assets/js/app.3687d251.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/8.4c5efb33.js" defer></script> </body> </html> diff --git a/docs/docs/examples.html b/docs/docs/examples.html index 5df8b7bc3..bdb4aa6cf 100644 --- a/docs/docs/examples.html +++ b/docs/docs/examples.html @@ -8,7 +8,7 @@ <meta name="generator" content="VuePress 1.3.1"> <link rel="icon" href="/caliban/caliban.png"> - <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/9.417f11bf.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.5f8b2c07.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.bc45abe0.js"><link rel="prefetch" href="/caliban/assets/js/13.d315a1c7.js"><link rel="prefetch" href="/caliban/assets/js/14.b8b8c6ff.js"><link rel="prefetch" href="/caliban/assets/js/15.23ceaf26.js"><link rel="prefetch" href="/caliban/assets/js/16.f357ff30.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.57a8ce51.js"><link rel="prefetch" href="/caliban/assets/js/8.6272775d.js"> + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.3687d251.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/9.08ac8c9e.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.56cd42ab.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.381b7c5a.js"><link rel="prefetch" href="/caliban/assets/js/13.1c02ea8d.js"><link rel="prefetch" href="/caliban/assets/js/14.0bd8bec9.js"><link rel="prefetch" href="/caliban/assets/js/15.1f4e823e.js"><link rel="prefetch" href="/caliban/assets/js/16.285ebbb2.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.16ad04b7.js"><link rel="prefetch" href="/caliban/assets/js/8.4c5efb33.js"> <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> </head> <body> @@ -42,6 +42,6 @@ <a href="/caliban/docs/client.html" class="prev"> GraphQL Client </a></span> <!----></p></div> </main></div><div class="global-ui"></div></div> - <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/9.417f11bf.js" defer></script> + <script src="/caliban/assets/js/app.3687d251.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/9.08ac8c9e.js" defer></script> </body> </html> diff --git a/docs/docs/index.html b/docs/docs/index.html index 0379c2b53..7350eccd9 100644 --- a/docs/docs/index.html +++ b/docs/docs/index.html @@ -8,7 +8,7 @@ <meta name="generator" content="VuePress 1.3.1"> <link rel="icon" href="/caliban/caliban.png"> - <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/7.57a8ce51.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.5f8b2c07.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.bc45abe0.js"><link rel="prefetch" href="/caliban/assets/js/13.d315a1c7.js"><link rel="prefetch" href="/caliban/assets/js/14.b8b8c6ff.js"><link rel="prefetch" href="/caliban/assets/js/15.23ceaf26.js"><link rel="prefetch" href="/caliban/assets/js/16.f357ff30.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/8.6272775d.js"><link rel="prefetch" href="/caliban/assets/js/9.417f11bf.js"> + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.3687d251.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/7.16ad04b7.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.56cd42ab.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.381b7c5a.js"><link rel="prefetch" href="/caliban/assets/js/13.1c02ea8d.js"><link rel="prefetch" href="/caliban/assets/js/14.0bd8bec9.js"><link rel="prefetch" href="/caliban/assets/js/15.1f4e823e.js"><link rel="prefetch" href="/caliban/assets/js/16.285ebbb2.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/8.4c5efb33.js"><link rel="prefetch" href="/caliban/assets/js/9.08ac8c9e.js"> <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> </head> <body> @@ -96,6 +96,6 @@ </a> → </span></p></div> </main></div><div class="global-ui"></div></div> - <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/7.57a8ce51.js" defer></script> + <script src="/caliban/assets/js/app.3687d251.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/7.16ad04b7.js" defer></script> </body> </html> diff --git a/docs/docs/interop.html b/docs/docs/interop.html index f543b55e8..f659a9587 100644 --- a/docs/docs/interop.html +++ b/docs/docs/interop.html @@ -8,7 +8,7 @@ <meta name="generator" content="VuePress 1.3.1"> <link rel="icon" href="/caliban/caliban.png"> - <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/10.5f8b2c07.js" as="script"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.bc45abe0.js"><link rel="prefetch" href="/caliban/assets/js/13.d315a1c7.js"><link rel="prefetch" href="/caliban/assets/js/14.b8b8c6ff.js"><link rel="prefetch" href="/caliban/assets/js/15.23ceaf26.js"><link rel="prefetch" href="/caliban/assets/js/16.f357ff30.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.57a8ce51.js"><link rel="prefetch" href="/caliban/assets/js/8.6272775d.js"><link rel="prefetch" href="/caliban/assets/js/9.417f11bf.js"> + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.3687d251.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/10.56cd42ab.js" as="script"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.381b7c5a.js"><link rel="prefetch" href="/caliban/assets/js/13.1c02ea8d.js"><link rel="prefetch" href="/caliban/assets/js/14.0bd8bec9.js"><link rel="prefetch" href="/caliban/assets/js/15.1f4e823e.js"><link rel="prefetch" href="/caliban/assets/js/16.285ebbb2.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.16ad04b7.js"><link rel="prefetch" href="/caliban/assets/js/8.4c5efb33.js"><link rel="prefetch" href="/caliban/assets/js/9.08ac8c9e.js"> <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> </head> <body> @@ -100,6 +100,6 @@ </a> → </span></p></div> </main></div><div class="global-ui"></div></div> - <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/10.5f8b2c07.js" defer></script> + <script src="/caliban/assets/js/app.3687d251.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/10.56cd42ab.js" defer></script> </body> </html> diff --git a/docs/docs/introspection.html b/docs/docs/introspection.html index 25c897f7c..7f005dbb4 100644 --- a/docs/docs/introspection.html +++ b/docs/docs/introspection.html @@ -8,7 +8,7 @@ <meta name="generator" content="VuePress 1.3.1"> <link rel="icon" href="/caliban/caliban.png"> - <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/11.5f34d6b0.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.5f8b2c07.js"><link rel="prefetch" href="/caliban/assets/js/12.bc45abe0.js"><link rel="prefetch" href="/caliban/assets/js/13.d315a1c7.js"><link rel="prefetch" href="/caliban/assets/js/14.b8b8c6ff.js"><link rel="prefetch" href="/caliban/assets/js/15.23ceaf26.js"><link rel="prefetch" href="/caliban/assets/js/16.f357ff30.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.57a8ce51.js"><link rel="prefetch" href="/caliban/assets/js/8.6272775d.js"><link rel="prefetch" href="/caliban/assets/js/9.417f11bf.js"> + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.3687d251.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/11.5f34d6b0.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.56cd42ab.js"><link rel="prefetch" href="/caliban/assets/js/12.381b7c5a.js"><link rel="prefetch" href="/caliban/assets/js/13.1c02ea8d.js"><link rel="prefetch" href="/caliban/assets/js/14.0bd8bec9.js"><link rel="prefetch" href="/caliban/assets/js/15.1f4e823e.js"><link rel="prefetch" href="/caliban/assets/js/16.285ebbb2.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.16ad04b7.js"><link rel="prefetch" href="/caliban/assets/js/8.4c5efb33.js"><link rel="prefetch" href="/caliban/assets/js/9.08ac8c9e.js"> <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> </head> <body> @@ -41,6 +41,6 @@ </a> → </span></p></div> </main></div><div class="global-ui"></div></div> - <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/11.5f34d6b0.js" defer></script> + <script src="/caliban/assets/js/app.3687d251.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/11.5f34d6b0.js" defer></script> </body> </html> diff --git a/docs/docs/middleware.html b/docs/docs/middleware.html index 9c121cda8..69e4b5e58 100644 --- a/docs/docs/middleware.html +++ b/docs/docs/middleware.html @@ -8,7 +8,7 @@ <meta name="generator" content="VuePress 1.3.1"> <link rel="icon" href="/caliban/caliban.png"> - <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/12.bc45abe0.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.5f8b2c07.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/13.d315a1c7.js"><link rel="prefetch" href="/caliban/assets/js/14.b8b8c6ff.js"><link rel="prefetch" href="/caliban/assets/js/15.23ceaf26.js"><link rel="prefetch" href="/caliban/assets/js/16.f357ff30.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.57a8ce51.js"><link rel="prefetch" href="/caliban/assets/js/8.6272775d.js"><link rel="prefetch" href="/caliban/assets/js/9.417f11bf.js"> + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.3687d251.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/12.381b7c5a.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.56cd42ab.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/13.1c02ea8d.js"><link rel="prefetch" href="/caliban/assets/js/14.0bd8bec9.js"><link rel="prefetch" href="/caliban/assets/js/15.1f4e823e.js"><link rel="prefetch" href="/caliban/assets/js/16.285ebbb2.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.16ad04b7.js"><link rel="prefetch" href="/caliban/assets/js/8.4c5efb33.js"><link rel="prefetch" href="/caliban/assets/js/9.08ac8c9e.js"> <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> </head> <body> @@ -78,6 +78,6 @@ </a> → </span></p></div> </main></div><div class="global-ui"></div></div> - <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/12.bc45abe0.js" defer></script> + <script src="/caliban/assets/js/app.3687d251.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/12.381b7c5a.js" defer></script> </body> </html> diff --git a/docs/docs/optimization.html b/docs/docs/optimization.html index 2a26af17c..3c35828ac 100644 --- a/docs/docs/optimization.html +++ b/docs/docs/optimization.html @@ -8,7 +8,7 @@ <meta name="generator" content="VuePress 1.3.1"> <link rel="icon" href="/caliban/caliban.png"> - <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/13.d315a1c7.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.5f8b2c07.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.bc45abe0.js"><link rel="prefetch" href="/caliban/assets/js/14.b8b8c6ff.js"><link rel="prefetch" href="/caliban/assets/js/15.23ceaf26.js"><link rel="prefetch" href="/caliban/assets/js/16.f357ff30.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.57a8ce51.js"><link rel="prefetch" href="/caliban/assets/js/8.6272775d.js"><link rel="prefetch" href="/caliban/assets/js/9.417f11bf.js"> + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.3687d251.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/13.1c02ea8d.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.56cd42ab.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.381b7c5a.js"><link rel="prefetch" href="/caliban/assets/js/14.0bd8bec9.js"><link rel="prefetch" href="/caliban/assets/js/15.1f4e823e.js"><link rel="prefetch" href="/caliban/assets/js/16.285ebbb2.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.16ad04b7.js"><link rel="prefetch" href="/caliban/assets/js/8.4c5efb33.js"><link rel="prefetch" href="/caliban/assets/js/9.08ac8c9e.js"> <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> </head> <body> @@ -76,6 +76,6 @@ </a> → </span></p></div> </main></div><div class="global-ui"></div></div> - <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/13.d315a1c7.js" defer></script> + <script src="/caliban/assets/js/app.3687d251.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/13.1c02ea8d.js" defer></script> </body> </html> diff --git a/docs/docs/schema.html b/docs/docs/schema.html index 51a92e084..f179f64da 100644 --- a/docs/docs/schema.html +++ b/docs/docs/schema.html @@ -8,7 +8,7 @@ <meta name="generator" content="VuePress 1.3.1"> <link rel="icon" href="/caliban/caliban.png"> - <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/14.b8b8c6ff.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.5f8b2c07.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.bc45abe0.js"><link rel="prefetch" href="/caliban/assets/js/13.d315a1c7.js"><link rel="prefetch" href="/caliban/assets/js/15.23ceaf26.js"><link rel="prefetch" href="/caliban/assets/js/16.f357ff30.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.57a8ce51.js"><link rel="prefetch" href="/caliban/assets/js/8.6272775d.js"><link rel="prefetch" href="/caliban/assets/js/9.417f11bf.js"> + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.3687d251.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/14.0bd8bec9.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.56cd42ab.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.381b7c5a.js"><link rel="prefetch" href="/caliban/assets/js/13.1c02ea8d.js"><link rel="prefetch" href="/caliban/assets/js/15.1f4e823e.js"><link rel="prefetch" href="/caliban/assets/js/16.285ebbb2.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.16ad04b7.js"><link rel="prefetch" href="/caliban/assets/js/8.4c5efb33.js"><link rel="prefetch" href="/caliban/assets/js/9.08ac8c9e.js"> <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> </head> <body> @@ -95,6 +95,6 @@ </a> → </span></p></div> </main></div><div class="global-ui"></div></div> - <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/14.b8b8c6ff.js" defer></script> + <script src="/caliban/assets/js/app.3687d251.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/14.0bd8bec9.js" defer></script> </body> </html> diff --git a/docs/docs/validation.html b/docs/docs/validation.html index dc522ee89..524fe62b2 100644 --- a/docs/docs/validation.html +++ b/docs/docs/validation.html @@ -8,7 +8,7 @@ <meta name="generator" content="VuePress 1.3.1"> <link rel="icon" href="/caliban/caliban.png"> - <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/15.23ceaf26.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.5f8b2c07.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.bc45abe0.js"><link rel="prefetch" href="/caliban/assets/js/13.d315a1c7.js"><link rel="prefetch" href="/caliban/assets/js/14.b8b8c6ff.js"><link rel="prefetch" href="/caliban/assets/js/16.f357ff30.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.57a8ce51.js"><link rel="prefetch" href="/caliban/assets/js/8.6272775d.js"><link rel="prefetch" href="/caliban/assets/js/9.417f11bf.js"> + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.3687d251.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/15.1f4e823e.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.56cd42ab.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.381b7c5a.js"><link rel="prefetch" href="/caliban/assets/js/13.1c02ea8d.js"><link rel="prefetch" href="/caliban/assets/js/14.0bd8bec9.js"><link rel="prefetch" href="/caliban/assets/js/16.285ebbb2.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.16ad04b7.js"><link rel="prefetch" href="/caliban/assets/js/8.4c5efb33.js"><link rel="prefetch" href="/caliban/assets/js/9.08ac8c9e.js"> <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> </head> <body> @@ -50,6 +50,6 @@ </a> → </span></p></div> </main></div><div class="global-ui"></div></div> - <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/15.23ceaf26.js" defer></script> + <script src="/caliban/assets/js/app.3687d251.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/15.1f4e823e.js" defer></script> </body> </html> diff --git a/docs/index.html b/docs/index.html index 428fd6690..0db5f79ca 100644 --- a/docs/index.html +++ b/docs/index.html @@ -8,7 +8,7 @@ <meta name="generator" content="VuePress 1.3.1"> <link rel="icon" href="/caliban/caliban.png"> - <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/5.5defc76c.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.5f8b2c07.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.bc45abe0.js"><link rel="prefetch" href="/caliban/assets/js/13.d315a1c7.js"><link rel="prefetch" href="/caliban/assets/js/14.b8b8c6ff.js"><link rel="prefetch" href="/caliban/assets/js/15.23ceaf26.js"><link rel="prefetch" href="/caliban/assets/js/16.f357ff30.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.57a8ce51.js"><link rel="prefetch" href="/caliban/assets/js/8.6272775d.js"><link rel="prefetch" href="/caliban/assets/js/9.417f11bf.js"> + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.3687d251.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/5.5defc76c.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.56cd42ab.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.381b7c5a.js"><link rel="prefetch" href="/caliban/assets/js/13.1c02ea8d.js"><link rel="prefetch" href="/caliban/assets/js/14.0bd8bec9.js"><link rel="prefetch" href="/caliban/assets/js/15.1f4e823e.js"><link rel="prefetch" href="/caliban/assets/js/16.285ebbb2.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.16ad04b7.js"><link rel="prefetch" href="/caliban/assets/js/8.4c5efb33.js"><link rel="prefetch" href="/caliban/assets/js/9.08ac8c9e.js"> <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> </head> <body> @@ -39,6 +39,6 @@ </p> <p class="action"><a href="/caliban/docs/" class="nav-link action-button"> Get Started → </a></p></header> <div class="features"><div class="feature"><h2>Purely functional</h2> <p>All interfaces are pure and types are referentially transparent.</p></div><div class="feature"><h2>Minimal boilerplate</h2> <p>No need to manually define a schema for every type in your API.</p></div><div class="feature"><h2>Type safe schema</h2> <p>Schema is derived at compile-time. Resolver is provided at runtime.</p></div></div> <div class="theme-default-content custom content__default"></div> <!----></main></div><div class="global-ui"></div></div> - <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/5.5defc76c.js" defer></script> + <script src="/caliban/assets/js/app.3687d251.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/5.5defc76c.js" defer></script> </body> </html> diff --git a/docs/resources/index.html b/docs/resources/index.html index 28b6d28f3..d58619815 100644 --- a/docs/resources/index.html +++ b/docs/resources/index.html @@ -8,7 +8,7 @@ <meta name="generator" content="VuePress 1.3.1"> <link rel="icon" href="/caliban/caliban.png"> - <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.d7caee50.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/16.f357ff30.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.5f8b2c07.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.bc45abe0.js"><link rel="prefetch" href="/caliban/assets/js/13.d315a1c7.js"><link rel="prefetch" href="/caliban/assets/js/14.b8b8c6ff.js"><link rel="prefetch" href="/caliban/assets/js/15.23ceaf26.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.57a8ce51.js"><link rel="prefetch" href="/caliban/assets/js/8.6272775d.js"><link rel="prefetch" href="/caliban/assets/js/9.417f11bf.js"> + <link rel="preload" href="/caliban/assets/css/0.styles.3f660e69.css" as="style"><link rel="preload" href="/caliban/assets/js/app.3687d251.js" as="script"><link rel="preload" href="/caliban/assets/js/2.07c68b8b.js" as="script"><link rel="preload" href="/caliban/assets/js/16.285ebbb2.js" as="script"><link rel="prefetch" href="/caliban/assets/js/10.56cd42ab.js"><link rel="prefetch" href="/caliban/assets/js/11.5f34d6b0.js"><link rel="prefetch" href="/caliban/assets/js/12.381b7c5a.js"><link rel="prefetch" href="/caliban/assets/js/13.1c02ea8d.js"><link rel="prefetch" href="/caliban/assets/js/14.0bd8bec9.js"><link rel="prefetch" href="/caliban/assets/js/15.1f4e823e.js"><link rel="prefetch" href="/caliban/assets/js/17.fa6e8c03.js"><link rel="prefetch" href="/caliban/assets/js/3.865f603a.js"><link rel="prefetch" href="/caliban/assets/js/4.f03b7f8e.js"><link rel="prefetch" href="/caliban/assets/js/5.5defc76c.js"><link rel="prefetch" href="/caliban/assets/js/6.d222e5e8.js"><link rel="prefetch" href="/caliban/assets/js/7.16ad04b7.js"><link rel="prefetch" href="/caliban/assets/js/8.4c5efb33.js"><link rel="prefetch" href="/caliban/assets/js/9.08ac8c9e.js"> <link rel="stylesheet" href="/caliban/assets/css/0.styles.3f660e69.css"> </head> <body> @@ -32,8 +32,8 @@ Github <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div><div class="nav-item"><a href="https://javadoc.io/doc/com.github.ghostdogpr/caliban_2.12/" target="_blank" rel="noopener noreferrer" class="nav-link external"> Scaladoc - <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <!----> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="resources"><a href="#resources" class="header-anchor">#</a> Resources</h1> <h2 id="talks"><a href="#talks" class="header-anchor">#</a> Talks</h2> <ul><li><a href="https://www.youtube.com/watch?v=OC8PbviYUlQ" target="_blank" rel="noopener noreferrer">Caliban: Designing a Functional GraphQL Library<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> by Pierre Ricadat at <a href="https://www.functionalscala.com/" target="_blank" rel="noopener noreferrer">Functional Scala<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> in December 2019 (slides available <a href="https://www.slideshare.net/PierreRicadat/designing-a-functional-graphql-library-204680947" target="_blank" rel="noopener noreferrer">here<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>)</li></ul> <h2 id="blog-articles"><a href="#blog-articles" class="header-anchor">#</a> Blog Articles</h2> <ul><li><strong><em>GraphQL in Scala with Caliban</em></strong> by Pierre Ricadat (February 2020) -<ul><li><a href="https://medium.com/@ghostdogpr/graphql-in-scala-with-caliban-part-1-8ceb6099c3c2" target="_blank" rel="noopener noreferrer">Part 1: Turn a simple API into GraphQL<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li> <li><a href="https://medium.com/@ghostdogpr/graphql-in-scala-with-caliban-part-2-c7762110c0f9" target="_blank" rel="noopener noreferrer">Part 2: Query optimization<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li> <li><a href="https://medium.com/@ghostdogpr/graphql-in-scala-with-caliban-part-3-8962a02d5d64" target="_blank" rel="noopener noreferrer">Part 3: Customization<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li></ul></li> <li><a href="http://fokot.github.io/post/caliban-auth.html" target="_blank" rel="noopener noreferrer">Authentication in Caliban<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> by František Kocun (December 2019)</li></ul></div> <footer class="page-edit"><!----> <!----></footer> <!----> </main></div><div class="global-ui"></div></div> - <script src="/caliban/assets/js/app.d7caee50.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/16.f357ff30.js" defer></script> + <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav> <!----> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="resources"><a href="#resources" class="header-anchor">#</a> Resources</h1> <h2 id="talks"><a href="#talks" class="header-anchor">#</a> Talks</h2> <ul><li><a href="https://www.youtube.com/watch?v=OC8PbviYUlQ" target="_blank" rel="noopener noreferrer">Caliban: Designing a Functional GraphQL Library<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> by Pierre Ricadat at <a href="https://www.functionalscala.com/" target="_blank" rel="noopener noreferrer">Functional Scala<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> in December 2019 (slides available <a href="https://www.slideshare.net/PierreRicadat/designing-a-functional-graphql-library-204680947" target="_blank" rel="noopener noreferrer">here<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>)</li></ul> <h2 id="blog-articles"><a href="#blog-articles" class="header-anchor">#</a> Blog Articles</h2> <ul><li><a href="https://medium.com/@ghostdogpr/caliban-client-a-type-safe-graphql-client-for-scala-and-scala-js-718aa42c5ef7" target="_blank" rel="noopener noreferrer">Caliban Client: a type-safe GraphQL Client for Scala and Scala.js<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> by Pierre Ricadat (February 2020)</li> <li><strong><em>GraphQL in Scala with Caliban</em></strong> by Pierre Ricadat (February 2020) +<ul><li><a href="https://medium.com/@ghostdogpr/graphql-in-scala-with-caliban-part-1-8ceb6099c3c2" target="_blank" rel="noopener noreferrer">Part 1: Turn a simple API into GraphQL<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li> <li><a href="https://medium.com/@ghostdogpr/graphql-in-scala-with-caliban-part-2-c7762110c0f9" target="_blank" rel="noopener noreferrer">Part 2: Query optimization<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li> <li><a href="https://medium.com/@ghostdogpr/graphql-in-scala-with-caliban-part-3-8962a02d5d64" target="_blank" rel="noopener noreferrer">Part 3: Customization using wrappers<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></li></ul></li> <li><a href="http://fokot.github.io/post/caliban-auth.html" target="_blank" rel="noopener noreferrer">Authentication in Caliban<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> by František Kocun (December 2019)</li></ul></div> <footer class="page-edit"><!----> <!----></footer> <!----> </main></div><div class="global-ui"></div></div> + <script src="/caliban/assets/js/app.3687d251.js" defer></script><script src="/caliban/assets/js/2.07c68b8b.js" defer></script><script src="/caliban/assets/js/16.285ebbb2.js" defer></script> </body> </html> From 4cc97099e231019f1ccbb1d5dcbacc398907f397 Mon Sep 17 00:00:00 2001 From: Pierre Ricadat <ghostdogpr@gmail.com> Date: Fri, 28 Feb 2020 16:03:31 +0900 Subject: [PATCH 6/7] Move some versions on top --- build.sbt | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/build.sbt b/build.sbt index 927a02444..e8480a92d 100644 --- a/build.sbt +++ b/build.sbt @@ -1,9 +1,13 @@ import sbtcrossproject.CrossPlugin.autoImport.{ crossProject, CrossType } -val mainScala = "2.12.10" -val allScala = Seq("2.13.1", mainScala) +val mainScala = "2.12.10" +val allScala = Seq("2.13.1", mainScala) + val http4sVersion = "0.21.1" val silencerVersion = "1.6.0" +val sttpVersion = "2.0.1" +val zioVersion = "1.0.0-RC17" + inThisBuild( List( organization := "com.github.ghostdogpr", @@ -71,10 +75,10 @@ lazy val core = crossProject(JSPlatform, JVMPlatform) "com.lihaoyi" %%% "fastparse" % "2.2.4", "com.propensive" %%% "magnolia" % "0.12.7", "com.propensive" %%% "mercator" % "0.2.1", - "dev.zio" %%% "zio" % "1.0.0-RC17", - "dev.zio" %%% "zio-streams" % "1.0.0-RC17", - "dev.zio" %%% "zio-test" % "1.0.0-RC17" % "test", - "dev.zio" %%% "zio-test-sbt" % "1.0.0-RC17" % "test", + "dev.zio" %%% "zio" % zioVersion, + "dev.zio" %%% "zio-streams" % zioVersion, + "dev.zio" %%% "zio-test" % zioVersion % "test", + "dev.zio" %%% "zio-test-sbt" % zioVersion % "test", "io.circe" %%% "circe-derivation" % "0.12.0-M7" % Optional, compilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.1") ) @@ -98,8 +102,8 @@ lazy val codegen = project libraryDependencies ++= Seq( "org.scalameta" %% "scalafmt-dynamic" % "2.4.2", "org.scalameta" %% "scalafmt-core" % "2.4.2", - "dev.zio" %% "zio-test" % "1.0.0-RC17" % "test", - "dev.zio" %% "zio-test-sbt" % "1.0.0-RC17" % "test" + "dev.zio" %% "zio-test" % zioVersion % "test", + "dev.zio" %% "zio-test-sbt" % zioVersion % "test" ) ) .dependsOn(coreJVM) @@ -196,10 +200,10 @@ lazy val client = crossProject(JSPlatform, JVMPlatform) testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework")), libraryDependencies ++= Seq( "io.circe" %%% "circe-derivation" % "0.12.0-M7", - "com.softwaremill.sttp.client" %%% "core" % "2.0.0", - "com.softwaremill.sttp.client" %%% "circe" % "2.0.0", - "dev.zio" %%% "zio-test" % "1.0.0-RC17" % "test", - "dev.zio" %%% "zio-test-sbt" % "1.0.0-RC17" % "test" + "com.softwaremill.sttp.client" %%% "core" % sttpVersion, + "com.softwaremill.sttp.client" %%% "circe" % sttpVersion, + "dev.zio" %%% "zio-test" % zioVersion % "test", + "dev.zio" %%% "zio-test-sbt" % zioVersion % "test" ) ) lazy val clientJVM = client.jvm @@ -211,7 +215,7 @@ lazy val examples = project .settings(skip in publish := true) .settings( libraryDependencies ++= Seq( - "com.softwaremill.sttp.client" %% "async-http-client-backend-zio" % "2.0.0" + "com.softwaremill.sttp.client" %% "async-http-client-backend-zio" % sttpVersion ) ) .dependsOn(akkaHttp, http4s, catsInteropJVM, finch, monixInterop, clientJVM) From b466e7b52a34e3dfc82e8f711bdc386dd6550c8b Mon Sep 17 00:00:00 2001 From: Enrico <enrico.vanghetti@scout24.com> Date: Fri, 28 Feb 2020 11:13:24 +0100 Subject: [PATCH 7/7] Add validation for input objects (#244) * Add validation for input objects and tests * Use failValidation * Use <* instead of flatMap+unit * Add new CharacterInput without Role union * Remove duplicate fields test * Use infix notation --- .../scala/caliban/validation/Validator.scala | 285 +++++++++--------- .../test/scala/caliban/RenderingSpec.scala | 1 - core/src/test/scala/caliban/TestUtils.scala | 35 ++- .../validation/ValidationSchemaSpec.scala | 32 ++ 4 files changed, 212 insertions(+), 141 deletions(-) create mode 100644 core/src/test/scala/caliban/validation/ValidationSchemaSpec.scala diff --git a/core/src/main/scala/caliban/validation/Validator.scala b/core/src/main/scala/caliban/validation/Validator.scala index 6f887ddcf..369ad7dc2 100644 --- a/core/src/main/scala/caliban/validation/Validator.scala +++ b/core/src/main/scala/caliban/validation/Validator.scala @@ -31,13 +31,17 @@ object Validator { def validateSchema(rootType: RootType): IO[ValidationError, Unit] = IO.foreach(rootType.types.values) { t => t.kind match { - case __TypeKind.ENUM => validateEnum(t) - case __TypeKind.UNION => validateUnion(t) - case _ => IO.unit + case __TypeKind.ENUM => validateEnum(t) + case __TypeKind.UNION => validateUnion(t) + case __TypeKind.INPUT_OBJECT => validateInputObject(t) + case _ => IO.unit } } .unit + def failValidation[T](msg: String, explanatoryText: String): IO[ValidationError, T] = + IO.fail(ValidationError(msg, explanatoryText)) + /** * Prepare the request for execution. * Fails with a [[caliban.CalibanError.ValidationError]] otherwise. @@ -69,19 +73,19 @@ object Validator { } operation match { - case Left(error) => IO.fail(ValidationError(error, "")) + case Left(error) => failValidation(error, "") case Right(op) => (op.operationType match { case Query => IO.succeed(rootSchema.query) case Mutation => rootSchema.mutation match { case Some(m) => IO.succeed(m) - case None => IO.fail(ValidationError("Mutations are not supported on this schema", "")) + case None => failValidation("Mutations are not supported on this schema", "") } case Subscription => rootSchema.subscription match { case Some(m) => IO.succeed(m) - case None => IO.fail(ValidationError("Subscriptions are not supported on this schema", "")) + case None => failValidation("Subscriptions are not supported on this schema", "") } }).map(operation => ExecutionRequest( @@ -182,11 +186,9 @@ object Validator { private def checkDirectivesUniqueness(directives: List[Directive]): IO[ValidationError, Unit] = IO.whenCase(directives.groupBy(_.name).find { case (_, v) => v.length > 1 }) { case Some((name, _)) => - IO.fail( - ValidationError( - s"Directive '$name' is defined twice.", - "Directives are used to describe some metadata or behavioral change on the definition they apply to. When more than one directive of the same name is used, the expected metadata or behavior becomes ambiguous, therefore only one of each directive is allowed per location." - ) + failValidation( + s"Directive '$name' is defined twice.", + "Directives are used to describe some metadata or behavioral change on the definition they apply to. When more than one directive of the same name is used, the expected metadata or behavior becomes ambiguous, therefore only one of each directive is allowed per location." ) } @@ -197,19 +199,15 @@ object Validator { case (d, location) => Introspector.directives.find(_.name == d.name) match { case None => - IO.fail( - ValidationError( - s"Directive '${d.name}' is not supported.", - "GraphQL servers define what directives they support. For each usage of a directive, the directive must be available on that server." - ) + failValidation( + s"Directive '${d.name}' is not supported.", + "GraphQL servers define what directives they support. For each usage of a directive, the directive must be available on that server." ) case Some(directive) => IO.when(!directive.locations.contains(location))( - IO.fail( - ValidationError( - s"Directive '${d.name}' is used in invalid location '$location'.", - "GraphQL servers define what directives they support and where they support them. For each usage of a directive, the directive must be used in a location that the server has declared support for." - ) + failValidation( + s"Directive '${d.name}' is used in invalid location '$location'.", + "GraphQL servers define what directives they support and where they support them. For each usage of a directive, the directive must be used in a location that the server has declared support for." ) ) } @@ -221,42 +219,34 @@ object Validator { IO.foreach(op.variableDefinitions.groupBy(_.name)) { case (name, variables) => IO.when(variables.length > 1)( - IO.fail( - ValidationError( - s"Variable '$name' is defined more than once.", - "If any operation defines more than one variable with the same name, it is ambiguous and invalid. It is invalid even if the type of the duplicate variable is the same." - ) + failValidation( + s"Variable '$name' is defined more than once.", + "If any operation defines more than one variable with the same name, it is ambiguous and invalid. It is invalid even if the type of the duplicate variable is the same." ) ) } *> IO.foreach(op.variableDefinitions) { v => val t = Type.innerType(v.variableType) IO.whenCase(context.rootType.types.get(t).map(_.kind)) { case Some(__TypeKind.OBJECT) | Some(__TypeKind.UNION) | Some(__TypeKind.INTERFACE) => - IO.fail( - ValidationError( - s"Type of variable '${v.name}' is not a valid input type.", - "Variables can only be input types. Objects, unions, and interfaces cannot be used as inputs." - ) + failValidation( + s"Type of variable '${v.name}' is not a valid input type.", + "Variables can only be input types. Objects, unions, and interfaces cannot be used as inputs." ) } } *> { val variableUsages = collectVariablesUsed(context, op.selectionSet) IO.foreach(variableUsages)(v => IO.when(!op.variableDefinitions.exists(_.name == v))( - IO.fail( - ValidationError( - s"Variable '$v' is not defined.", - "Variables are scoped on a per‐operation basis. That means that any variable used within the context of an operation must be defined at the top level of that operation" - ) + failValidation( + s"Variable '$v' is not defined.", + "Variables are scoped on a per‐operation basis. That means that any variable used within the context of an operation must be defined at the top level of that operation" ) ) ) *> IO.foreach(op.variableDefinitions)(v => IO.when(!variableUsages.contains(v.name))( - IO.fail( - ValidationError( - s"Variable '${v.name}' is not used.", - "All variables defined by an operation must be used in that operation or a fragment transitively included by that operation. Unused variables cause a validation error." - ) + failValidation( + s"Variable '${v.name}' is not used.", + "All variables defined by an operation must be used in that operation or a fragment transitively included by that operation. Unused variables cause a validation error." ) ) ) @@ -272,20 +262,15 @@ object Validator { val spreadNames = spreads.map(_.name).toSet IO.foreach(context.fragments.values)(f => if (!spreadNames.contains(f.name)) - IO.fail( - ValidationError( - s"Fragment '${f.name}' is not used in any spread.", - "Defined fragments must be used within a document." - ) + failValidation( + s"Fragment '${f.name}' is not used in any spread.", + "Defined fragments must be used within a document." ) else - IO.fail( - ValidationError( - s"Fragment '${f.name}' forms a cycle.", - "The graph of fragment spreads must not form any cycles including spreading itself. Otherwise an operation could infinitely spread or infinitely execute on cycles in the underlying data." - ) - ) - .when(detectCycles(context, f)) + failValidation( + s"Fragment '${f.name}' forms a cycle.", + "The graph of fragment spreads must not form any cycles including spreading itself. Otherwise an operation could infinitely spread or infinitely execute on cycles in the underlying data." + ).when(detectCycles(context, f)) ) .unit } @@ -306,11 +291,11 @@ object Validator { case OperationType.Query => validateFields(context, selectionSet, context.rootType.queryType) case OperationType.Mutation => context.rootType.mutationType.fold[IO[ValidationError, Unit]]( - IO.fail(ValidationError("Mutation operations are not supported on this schema.", "")) + failValidation("Mutation operations are not supported on this schema.", "") )(validateFields(context, selectionSet, _)) case OperationType.Subscription => context.rootType.subscriptionType.fold[IO[ValidationError, Unit]]( - IO.fail(ValidationError("Subscription operations are not supported on this schema.", "")) + failValidation("Subscription operations are not supported on this schema.", "") )(validateFields(context, selectionSet, _)) } case _: FragmentDefinition => IO.unit @@ -328,11 +313,9 @@ object Validator { case FragmentSpread(name, _) => context.fragments.get(name) match { case None => - IO.fail( - ValidationError( - s"Fragment spread '$name' is not defined.", - "Named fragment spreads must refer to fragments defined within the document. It is a validation error if the target of a spread is not defined." - ) + failValidation( + s"Fragment spread '$name' is not defined.", + "Named fragment spreads must refer to fragments defined within the document. It is a validation error if the target of a spread is not defined." ) case Some(fragment) => validateSpread(context, Some(name), currentType, Some(fragment.typeCondition), fragment.selectionSet) @@ -355,22 +338,18 @@ object Validator { val possibleFragmentTypes = getPossibleTypes(fragmentType).flatMap(_.name) val applicableTypes = possibleTypes intersect possibleFragmentTypes IO.when(applicableTypes.isEmpty)( - IO.fail( - ValidationError( - s"${name.fold("Inline fragment spread")(n => s"Fragment spread '$n'")} is not possible: possible types are '${possibleTypes - .mkString(", ")}' and possible fragment types are '${possibleFragmentTypes.mkString(", ")}'.", - "Fragments are declared on a type and will only apply when the runtime object type matches the type condition. They also are spread within the context of a parent type. A fragment spread is only valid if its type condition could ever apply within the parent type." - ) + failValidation( + s"${name.fold("Inline fragment spread")(n => s"Fragment spread '$n'")} is not possible: possible types are '${possibleTypes + .mkString(", ")}' and possible fragment types are '${possibleFragmentTypes.mkString(", ")}'.", + "Fragments are declared on a type and will only apply when the runtime object type matches the type condition. They also are spread within the context of a parent type. A fragment spread is only valid if its type condition could ever apply within the parent type." ) ) *> validateFields(context, selectionSet, fragmentType) } case None => lazy val typeConditionName = typeCondition.fold("?")(_.name) - IO.fail( - ValidationError( - s"${name.fold("Inline fragment spread")(n => s"Fragment spread '$n'")} targets an invalid type: '$typeConditionName'.", - "Fragments must be specified on types that exist in the schema. This applies for both named and inline fragments. If they are not defined in the schema, the query does not validate." - ) + failValidation( + s"${name.fold("Inline fragment spread")(n => s"Fragment spread '$n'")} targets an invalid type: '$typeConditionName'.", + "Fragments must be specified on types that exist in the schema. This applies for both named and inline fragments. If they are not defined in the schema, the query does not validate." ) } @@ -401,23 +380,19 @@ object Validator { case (arg, argValue) => f.args.find(_.name == arg) match { case None => - IO.fail( - ValidationError( - s"Argument '$arg' is not defined on field '${field.name}' of type '${currentType.name.getOrElse("")}'.", - "Every argument provided to a field or directive must be defined in the set of possible arguments of that field or directive." - ) + failValidation( + s"Argument '$arg' is not defined on field '${field.name}' of type '${currentType.name.getOrElse("")}'.", + "Every argument provided to a field or directive must be defined in the set of possible arguments of that field or directive." ) case Some(inputValue) => validateInputValues(inputValue, argValue) } } *> IO.foreach(f.args.filter(a => a.`type`().kind == __TypeKind.NON_NULL && a.defaultValue.isEmpty))(arg => IO.when(field.arguments.get(arg.name).forall(_ == NullValue))( - IO.fail( - ValidationError( - s"Required argument '${arg.name}' is null or missing on field '${field.name}' of type '${currentType.name - .getOrElse("")}'.", - "Arguments can be required. An argument is required if the argument type is non‐null and does not have a default value. Otherwise, the argument is optional." - ) + failValidation( + s"Required argument '${arg.name}' is null or missing on field '${field.name}' of type '${currentType.name + .getOrElse("")}'.", + "Arguments can be required. An argument is required if the argument type is non‐null and does not have a default value. Otherwise, the argument is optional." ) ) ) @@ -432,11 +407,9 @@ object Validator { case (k, v) => inputFields.find(_.name == k) match { case None => - IO.fail( - ValidationError( - s"Input field '$k' is not defined on type '${inputType.name.getOrElse("?")}'.", - "Every input field provided in an input object value must be defined in the set of possible fields of that input object’s expected type." - ) + failValidation( + s"Input field '$k' is not defined on type '${inputType.name.getOrElse("?")}'.", + "Every input field provided in an input object value must be defined in the set of possible fields of that input object’s expected type." ) case Some(value) => validateInputValues(value, v) } @@ -447,11 +420,9 @@ object Validator { inputField.`type`().kind == __TypeKind.NON_NULL && !fields.contains(inputField.name) )( - IO.fail( - ValidationError( - s"Required field '${inputField.name}' on object '${inputType.name.getOrElse("?")}' was not provided.", - "Input object fields may be required. Much like a field may have required arguments, an input object may have required fields. An input field is required if it has a non‐null type and does not have a default value. Otherwise, the input object field is optional." - ) + failValidation( + s"Required field '${inputField.name}' on object '${inputType.name.getOrElse("?")}' was not provided.", + "Input object fields may be required. Much like a field may have required arguments, an input object may have required fields. An input field is required if it has a non‐null type and does not have a default value. Otherwise, the input object field is optional." ) ) ) @@ -463,18 +434,14 @@ object Validator { private def validateLeafFieldSelection(selections: List[Selection], currentType: __Type): IO[ValidationError, Unit] = IO.whenCase(currentType.kind) { case __TypeKind.SCALAR | __TypeKind.ENUM if selections.nonEmpty => - IO.fail( - ValidationError( - s"Field selection is impossible on type '${currentType.name.getOrElse("")}'.", - "Field selections on scalars or enums are never allowed, because they are the leaf nodes of any GraphQL query." - ) + failValidation( + s"Field selection is impossible on type '${currentType.name.getOrElse("")}'.", + "Field selections on scalars or enums are never allowed, because they are the leaf nodes of any GraphQL query." ) case __TypeKind.INTERFACE | __TypeKind.UNION | __TypeKind.OBJECT if selections.isEmpty => - IO.fail( - ValidationError( - s"Field selection is mandatory on type '${currentType.name.getOrElse("")}'.", - "Leaf selections on objects, interfaces, and unions without subfields are disallowed." - ) + failValidation( + s"Field selection is mandatory on type '${currentType.name.getOrElse("")}'.", + "Leaf selections on objects, interfaces, and unions without subfields are disallowed." ) } @@ -482,11 +449,9 @@ object Validator { val names = operations.flatMap(_.name).groupBy(identity) val repeatedNames = names.collect { case (name, items) if items.length > 1 => name } IO.when(repeatedNames.nonEmpty)( - IO.fail( - ValidationError( - s"Multiple operations have the same name: ${repeatedNames.mkString(", ")}.", - "Each named operation definition must be unique within a document when referred to by its name." - ) + failValidation( + s"Multiple operations have the same name: ${repeatedNames.mkString(", ")}.", + "Each named operation definition must be unique within a document when referred to by its name." ) ) } @@ -494,11 +459,9 @@ object Validator { private def validateLoneAnonymousOperation(operations: List[OperationDefinition]): IO[ValidationError, Unit] = { val anonymous = operations.filter(_.name.isEmpty) IO.when(operations.length > 1 && anonymous.nonEmpty)( - IO.fail( - ValidationError( - "Found both anonymous and named operations.", - "GraphQL allows a short‐hand form for defining query operations when only that one operation exists in the document." - ) + failValidation( + "Found both anonymous and named operations.", + "GraphQL allows a short‐hand form for defining query operations when only that one operation exists in the document." ) ) } @@ -509,11 +472,9 @@ object Validator { IO.foldLeft(fragments)(Map.empty[String, FragmentDefinition]) { case (fragmentMap, fragment) => if (fragmentMap.contains(fragment.name)) { - IO.fail( - ValidationError( - s"Fragment '${fragment.name}' is defined more than once.", - "Fragment definitions are referenced in fragment spreads by name. To avoid ambiguity, each fragment’s name must be unique within a document." - ) + failValidation( + s"Fragment '${fragment.name}' is defined more than once.", + "Fragment definitions are referenced in fragment spreads by name. To avoid ambiguity, each fragment’s name must be unique within a document." ) } else IO.succeed(fragmentMap.updated(fragment.name, fragment)) } @@ -543,11 +504,9 @@ object Validator { case __TypeKind.UNION | __TypeKind.INTERFACE | __TypeKind.OBJECT => IO.unit case _ => val targetTypeName = targetType.name.getOrElse("") - IO.fail( - ValidationError( - s"${name.fold("Inline fragment")(n => s"Fragment '$n'")} is defined on invalid type '$targetTypeName'", - "Fragments can only be declared on unions, interfaces, and objects. They are invalid on scalars. They can only be applied on non‐leaf fields. This rule applies to both inline and named fragments." - ) + failValidation( + s"${name.fold("Inline fragment")(n => s"Fragment '$n'")} is defined on invalid type '$targetTypeName'", + "Fragments can only be declared on unions, interfaces, and objects. They are invalid on scalars. They can only be applied on non‐leaf fields. This rule applies to both inline and named fragments." ) } @@ -555,11 +514,9 @@ object Validator { t.enumValues(__DeprecatedArgs(Some(true))) match { case Some(_ :: _) => IO.unit case _ => - IO.fail( - ValidationError( - s"Enum ${t.name.getOrElse("")} doesn't contain any values", - "An Enum type must define one or more unique enum values." - ) + failValidation( + s"Enum ${t.name.getOrElse("")} doesn't contain any values", + "An Enum type must define one or more unique enum values." ) } @@ -572,25 +529,77 @@ object Validator { t.possibleTypes match { case None | Some(Nil) => - IO.fail( - ValidationError( - s"Union ${t.name.getOrElse("")} doesn't contain any type.", - "A Union type must include one or more unique member types." - ) + failValidation( + s"Union ${t.name.getOrElse("")} doesn't contain any type.", + "A Union type must include one or more unique member types." ) case Some(types) if !types.forall(isObject) => - IO.fail( - ValidationError( - s"Union ${t.name.getOrElse("")} contains the following non Object types: " + - types.filterNot(isObject).map(_.name.getOrElse("")).filterNot(_.isEmpty).mkString("", ", ", "."), - s"The member types of a Union type must all be Object base types." - ) + failValidation( + s"Union ${t.name.getOrElse("")} contains the following non Object types: " + + types.filterNot(isObject).map(_.name.getOrElse("")).filterNot(_.isEmpty).mkString("", ", ", "."), + s"The member types of a Union type must all be Object base types." ) case _ => IO.unit } } + private def validateInputObject(t: __Type): IO[ValidationError, Unit] = { + // https://spec.graphql.org/June2018/#IsInputType() + def isInputType(t: __Type): Either[__Type, Unit] = t.kind match { + case __TypeKind.LIST | __TypeKind.NON_NULL => t.ofType.fold[Either[__Type, Unit]](Left(t))(isInputType) + case __TypeKind.SCALAR | __TypeKind.ENUM | __TypeKind.INPUT_OBJECT => Right(()) + case _ => Left(t) + } + + def validateFields(fields: List[__InputValue]): IO[ValidationError, Unit] = + duplicateFieldName(fields) <* + IO.foreach(fields)(field => + for { + _ <- doesNotStartWithUnderscore(field) + _ <- onlyInputFieldType(field) + } yield () + ) + + def duplicateFieldName(fields: List[__InputValue]): IO[ValidationError, Unit] = + fields + .groupBy(_.name) + .collectFirst { case (_, f :: _ :: _) => f } + .fold[IO[ValidationError, Unit]](IO.unit)(duplicateField => + failValidation( + s"InputObject has repeated fields: ${duplicateField.name}", + "The input field must have a unique name within that Input Object type; no two input fields may share the same name" + ) + ) + + def doesNotStartWithUnderscore(field: __InputValue): IO[ValidationError, Unit] = + IO.when(field.name.startsWith("__"))( + failValidation( + s"InputObject can't start with '__': ${field.name}", + """The input field must not have a name which begins with the +characters {"__"} (two underscores)""" + ) + ) + + def onlyInputFieldType(field: __InputValue): IO[ValidationError, Unit] = + IO.whenCase(isInputType(field.`type`())) { + case Left(errorType) => + failValidation( + s"${errorType.name.getOrElse("")} is of kind ${errorType.kind}, must be an InputType", + """The input field must accept a type where IsInputType(inputFieldType) returns true, https://spec.graphql.org/June2018/#IsInputType()""" + ) + } + + t.inputFields match { + case None | Some(Nil) => + failValidation( + s"InputObject ${t.name.getOrElse("")} does not have fields", + "An Input Object type must define one or more input fields" + ) + case Some(fields) => validateFields(fields) + } + } + case class Context( document: Document, rootType: RootType, diff --git a/core/src/test/scala/caliban/RenderingSpec.scala b/core/src/test/scala/caliban/RenderingSpec.scala index 58357853a..58ac23200 100644 --- a/core/src/test/scala/caliban/RenderingSpec.scala +++ b/core/src/test/scala/caliban/RenderingSpec.scala @@ -27,7 +27,6 @@ object RenderingSpec | name: String! @external | nicknames: [String!]! @required | origin: Origin! - | role: Role |} | |type Captain { diff --git a/core/src/test/scala/caliban/TestUtils.scala b/core/src/test/scala/caliban/TestUtils.scala index 90b362a61..81dfc425c 100644 --- a/core/src/test/scala/caliban/TestUtils.scala +++ b/core/src/test/scala/caliban/TestUtils.scala @@ -4,7 +4,7 @@ import caliban.TestUtils.Origin._ import caliban.TestUtils.Role._ import caliban.Value.StringValue import caliban.parsing.adt.Directive -import caliban.schema.Annotations.{ GQLDeprecated, GQLDescription, GQLDirective, GQLInterface } +import caliban.schema.Annotations.{ GQLDeprecated, GQLDescription, GQLDirective, GQLInputName, GQLInterface } import caliban.schema.Schema import zio.UIO import zio.stream.ZStream @@ -44,6 +44,13 @@ object TestUtils { role: Option[Role] ) + @GQLInputName("CharacterInput") + case class CharacterInput( + @GQLDirective(Directive("external")) name: String, + @GQLDirective(Directive("required")) nicknames: List[String], + origin: Origin + ) + object Character { implicit val schema: Schema[Any, Character] = Schema.gen[Character] } @@ -61,7 +68,7 @@ object TestUtils { case class CharactersArgs(origin: Option[Origin]) case class CharacterArgs(name: String) case class CharacterInArgs(@GQLDirective(Directive("lowercase")) names: List[String]) - case class CharacterObjectArgs(character: Character) + case class CharacterObjectArgs(character: CharacterInput) @GQLDescription("Queries") case class Query( @@ -107,4 +114,28 @@ object TestUtils { SubscriptionIO(ZStream.empty) ) + object InvalidSchemas { + case class DoubleUnderscoreArg(__name: String) + case class DoubleUnderscoreInputObjectArg(wrong: DoubleUnderscoreArg) + case class WrongMutationUnderscore(w: DoubleUnderscoreInputObjectArg => UIO[Unit]) + + val resolverWrongMutationUnderscore = RootResolver( + resolverIO.queryResolver, + WrongMutationUnderscore(_ => UIO.unit) + ) + + sealed trait UnionInput + object UnionInput { + case class A(value: String) extends UnionInput + case class B(value: String) extends UnionInput + } + case class UnionArg(union: UnionInput) + case class UnionInputObjectArg(wrong: UnionArg) + case class WrongMutationUnion(w: UnionInputObjectArg => UIO[Unit]) + + val resolverWrongMutationUnion = RootResolver( + resolverIO.queryResolver, + WrongMutationUnion(_ => UIO.unit) + ) + } } diff --git a/core/src/test/scala/caliban/validation/ValidationSchemaSpec.scala b/core/src/test/scala/caliban/validation/ValidationSchemaSpec.scala new file mode 100644 index 000000000..80a5c2249 --- /dev/null +++ b/core/src/test/scala/caliban/validation/ValidationSchemaSpec.scala @@ -0,0 +1,32 @@ +package caliban.validation + +import caliban.CalibanError.ValidationError +import caliban.GraphQL +import caliban.GraphQL.graphQL +import caliban.TestUtils.InvalidSchemas._ +import zio.IO +import zio.test.Assertion._ +import zio.test._ + +object ValidationSchemaSpec + extends DefaultRunnableSpec({ + def check(gql: GraphQL[Any], expectedMessage: String): IO[ValidationError, TestResult] = + assertM(gql.interpreter.run, fails[ValidationError](hasField("msg", _.msg, equalTo(expectedMessage)))) + + suite("ValidationSchemaSpec")({ + suite("InputObjects")( + testM("name can't start with '__'") { + check( + graphQL(resolverWrongMutationUnderscore), + "InputObject can't start with '__': __name" + ) + }, + testM("should only contain types for which IsInputType(type) is true") { + check( + graphQL(resolverWrongMutationUnion), + "UnionInput is of kind UNION, must be an InputType" + ) + } + ) + }) + })