Page Not Found
We could not find what you were looking for.
Please contact the owner of the site that linked you to the original URL and let them know their link is broken.
├── docs
├── .nojekyll
├── img
│ ├── logo.png
│ ├── favicon.ico
│ └── small_logo.png
├── assets
│ └── js
│ │ ├── 1643892c.ed9e524c.js
│ │ ├── 777256b9.b09fbcfb.js
│ │ ├── 774.7c8c4613.js
│ │ ├── c4f5d8e4.2a22f74f.js
│ │ ├── main.8b8ea7e0.js.LICENSE.txt
│ │ ├── 935f2afb.b95b99fe.js
│ │ ├── b2dbe049.067aca93.js
│ │ ├── 9beb87c2.5fb59ad0.js
│ │ ├── runtime~main.b58f8f74.js
│ │ └── 3b8c55ea.6167ef36.js
├── sitemap.xml
├── 404.html
├── docs
│ ├── gotchas
│ │ └── index.html
│ └── changelog
│ │ └── index.html
└── index.html
├── documentationWebsite
├── docs
│ ├── gotchas.md
│ ├── changelog.md
│ ├── installation.md
│ ├── subscriptions.md
│ ├── client-configuration.md
│ ├── mutations.md
│ ├── queries.md
│ └── overview.md
├── static
│ ├── .nojekyll
│ └── img
│ │ ├── logo.png
│ │ ├── favicon.ico
│ │ └── small_logo.png
├── babel.config.js
├── sidebars.js
├── .gitignore
├── src
│ ├── css
│ │ └── custom.css
│ └── pages
│ │ ├── index.js
│ │ └── styles.module.css
├── README.md
├── package.json
└── docusaurus.config.js
├── EXAMPLES
├── src
│ ├── Ignore.res
│ ├── WebpackEntry.res
│ ├── index.html
│ ├── caching
│ │ ├── Pagination.res
│ │ └── LocalStateManagement.res
│ ├── fragmentsUsage
│ │ ├── Fragments.res
│ │ └── Query_Fragments.res
│ ├── hooksUsage
│ │ ├── Subscription.res
│ │ ├── Query_OverlySimple.res
│ │ ├── Query_Lazy.res
│ │ ├── Query_Typical.res
│ │ ├── Query_SubscribeToMore.res
│ │ └── Mutation.res
│ ├── App.res
│ ├── clientUsage
│ │ ├── AsyncAwait.res
│ │ ├── PromiseChaining.res
│ │ └── ClientBasics.res
│ └── Apollo.res
├── README.md
├── webpack.config.js
├── package.json
└── bsconfig.json
├── src
├── @apollo
│ └── client
│ │ ├── errors
│ │ ├── ApolloClient__Errors.res
│ │ └── __tests__
│ │ │ └── ApolloClient__Errors_ApolloError.test.js
│ │ ├── link
│ │ ├── retry
│ │ │ ├── ApolloClient__Link_Retry.res
│ │ │ ├── ApolloClient__Link_Retry_DelayFunction.res
│ │ │ ├── ApolloClient__Link_Retry_RetryFunction.res
│ │ │ └── ApolloClient__Link_Retry_RetryLink.res
│ │ ├── utils
│ │ │ ├── ApolloClient__Link_Utils.res
│ │ │ └── ApolloClient__Link_Utils_ThrowServerError.res
│ │ ├── core
│ │ │ ├── ApolloClient__Link_Core.res
│ │ │ ├── ApolloClient__Link_Core_ApolloLink.res
│ │ │ └── ApolloClient__Link_Core_Types.res
│ │ ├── ApolloClient__Link.res
│ │ ├── http
│ │ │ ├── ApolloClient__Link_Http.res
│ │ │ ├── ApolloClient__Link_Http_CreateHttpLink.res
│ │ │ ├── ApolloClient__Link_Http_ParseAndCheckHttpResponse.res
│ │ │ ├── ApolloClient__Link_Http_HttpLink.res
│ │ │ └── ApolloClient__Link_Http_SelectHttpOptionsAndBody.res
│ │ ├── ws
│ │ │ └── ApolloClient__Link_Ws.res
│ │ ├── context
│ │ │ └── ApolloClient__Link_Context.res
│ │ └── error
│ │ │ └── ApolloClient__Link_Error.res
│ │ ├── react
│ │ ├── context
│ │ │ ├── ApolloClient__React_Context.res
│ │ │ └── ApolloClient__React_Context_ApolloProvider.res
│ │ ├── hooks
│ │ │ ├── ApolloClient__React_Hooks_UseApolloClient.res
│ │ │ ├── ApolloClient__React_Hooks.res
│ │ │ ├── ApolloClient__React_Hooks_UseSubscription.res
│ │ │ └── ApolloClient__React_Hooks_UseLazyQuery.res
│ │ └── ApolloClient__React.res
│ │ ├── testing
│ │ ├── react
│ │ │ ├── ApolloClient__Testing_React.res
│ │ │ └── ApolloClient__Testing_React_MockedProvider.res
│ │ ├── ApolloClient__Testing.res
│ │ ├── core
│ │ │ └── ApolloClient__Testing_Core.res
│ │ └── ApolloClient__Testing_Types.res
│ │ ├── cache
│ │ ├── ApolloClient__Cache.res
│ │ ├── core
│ │ │ ├── ApolloClient__Cache_Core.res
│ │ │ └── types
│ │ │ │ ├── ApolloClient__Cache_Core_Types.res
│ │ │ │ └── ApolloClient__Cache_Core_Types_Common.res
│ │ └── inmemory
│ │ │ ├── ApolloClient__Cache_InMemory.res
│ │ │ ├── ApolloClient__Cache_InMemory_ReactiveVars.res
│ │ │ ├── ApolloClient__Cache_InMemory_InMemoryCache.res
│ │ │ └── ApolloClient__Cache_InMemory_Policies.res
│ │ ├── utilities
│ │ ├── policies
│ │ │ ├── ApolloClient__Utilities_Policies.res
│ │ │ └── ApolloClient__Utilities_Policies_Pagination.res
│ │ ├── observables
│ │ │ ├── ApolloClient__Utilities_Observables.res
│ │ │ └── ApolloClient__Utilities_Observables_Observable.res
│ │ ├── graphql
│ │ │ ├── ApolloClient__Utilities_Graphql.res
│ │ │ ├── ApolloClient__Utilities_Graphql_GetFromAst.res
│ │ │ ├── ApolloClient__Utilities_Graphql_Fragments.res
│ │ │ └── ApolloClient__Utilities_Graphql_StoreUtils.res
│ │ └── ApolloClient__Utilities.res
│ │ ├── core
│ │ ├── ApolloClient__Core.res
│ │ ├── ApolloClient__Core_NetworkStatus.res
│ │ ├── ApolloClient__Core_LocalState.res
│ │ └── ApolloClient__Core_Types.res
│ │ └── ApolloClient__Client.res
├── graphql
│ ├── error
│ │ ├── ApolloClient__Graphql_Error.res
│ │ └── ApolloClient__Graphql_Error_GraphQLError.res
│ ├── execution
│ │ ├── ApolloClient__Graphql_Execution.res
│ │ └── ApolloClient__Graphql_Execution_Execute.res
│ ├── location
│ │ └── ApolloClient__Graphql_Location.res
│ ├── language
│ │ ├── ApolloClient__Graphql_Language.res
│ │ ├── ApolloClient__Graphql_Language_Source.res
│ │ └── ApolloClient__Graphql_Language_Ast.res
│ └── ApolloClient__Graphql.res
├── graphql-tag
│ └── ApolloClient__GraphqlTag.res
├── ApolloClient.res
├── ApolloClient__Types.res
├── ApolloClient__Utils.res
├── graphql-ws
│ └── ApolloClient__GraphqlWs_Common.res
└── zen-observable
│ └── ApolloClient__ZenObservable.res
├── .gitattributes
├── .gitignore
├── .npmignore
├── bsconfig.json
├── README.md
├── .github
└── workflows
│ ├── tests.yml
│ ├── releasePublish.yml
│ └── prereleasePublish.yml
├── LICENSE
├── package.json
└── CODE_OF_CONDUCT.md
/docs/.nojekyll:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/documentationWebsite/docs/gotchas.md:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/documentationWebsite/static/.nojekyll:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/EXAMPLES/src/Ignore.res:
--------------------------------------------------------------------------------
1 | let promise: Js.Promise.t<'a> => unit = ignore
2 |
--------------------------------------------------------------------------------
/docs/img/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeddeloh/rescript-apollo-client/HEAD/docs/img/logo.png
--------------------------------------------------------------------------------
/docs/img/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeddeloh/rescript-apollo-client/HEAD/docs/img/favicon.ico
--------------------------------------------------------------------------------
/src/@apollo/client/errors/ApolloClient__Errors.res:
--------------------------------------------------------------------------------
1 | module ApolloError = ApolloClient__Errors_ApolloError
2 |
--------------------------------------------------------------------------------
/docs/img/small_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeddeloh/rescript-apollo-client/HEAD/docs/img/small_logo.png
--------------------------------------------------------------------------------
/src/@apollo/client/link/retry/ApolloClient__Link_Retry.res:
--------------------------------------------------------------------------------
1 | module RetryLink = ApolloClient__Link_Retry_RetryLink
2 |
--------------------------------------------------------------------------------
/src/graphql/error/ApolloClient__Graphql_Error.res:
--------------------------------------------------------------------------------
1 | module GraphQLError = ApolloClient__Graphql_Error_GraphQLError
2 |
--------------------------------------------------------------------------------
/src/graphql/execution/ApolloClient__Graphql_Execution.res:
--------------------------------------------------------------------------------
1 | module Execute = ApolloClient__Graphql_Execution_Execute
2 |
--------------------------------------------------------------------------------
/src/graphql/location/ApolloClient__Graphql_Location.res:
--------------------------------------------------------------------------------
1 | type sourceLocation = {
2 | line: int,
3 | column: int,
4 | }
5 |
--------------------------------------------------------------------------------
/src/@apollo/client/link/utils/ApolloClient__Link_Utils.res:
--------------------------------------------------------------------------------
1 | module ThrowServerError = ApolloClient__Link_Utils_ThrowServerError
2 |
--------------------------------------------------------------------------------
/documentationWebsite/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3 | };
4 |
--------------------------------------------------------------------------------
/src/@apollo/client/react/context/ApolloClient__React_Context.res:
--------------------------------------------------------------------------------
1 | module ApolloProvider = ApolloClient__React_Context_ApolloProvider
2 |
--------------------------------------------------------------------------------
/src/@apollo/client/testing/react/ApolloClient__Testing_React.res:
--------------------------------------------------------------------------------
1 | module MockedProvider = ApolloClient__Testing_React_MockedProvider
2 |
--------------------------------------------------------------------------------
/src/graphql/language/ApolloClient__Graphql_Language.res:
--------------------------------------------------------------------------------
1 | module Ast = ApolloClient__Graphql_Language_Ast
2 |
3 | type documentNode
4 |
--------------------------------------------------------------------------------
/src/@apollo/client/cache/ApolloClient__Cache.res:
--------------------------------------------------------------------------------
1 | module Core = ApolloClient__Cache_Core
2 | module InMemory = ApolloClient__Cache_InMemory
3 |
--------------------------------------------------------------------------------
/src/@apollo/client/utilities/policies/ApolloClient__Utilities_Policies.res:
--------------------------------------------------------------------------------
1 | module Pagination = ApolloClient__Utilities_Policies_Pagination
2 |
--------------------------------------------------------------------------------
/documentationWebsite/static/img/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeddeloh/rescript-apollo-client/HEAD/documentationWebsite/static/img/logo.png
--------------------------------------------------------------------------------
/documentationWebsite/static/img/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeddeloh/rescript-apollo-client/HEAD/documentationWebsite/static/img/favicon.ico
--------------------------------------------------------------------------------
/src/@apollo/client/utilities/observables/ApolloClient__Utilities_Observables.res:
--------------------------------------------------------------------------------
1 | module Observable = ApolloClient__Utilities_Observables_Observable
2 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.re linguist-language=Reason
2 | *.rei linguist-language=Reason
3 | *.res linguist-language=ReScript
4 | *.resi linguist-language=ReScript
5 |
--------------------------------------------------------------------------------
/src/@apollo/client/cache/core/ApolloClient__Cache_Core.res:
--------------------------------------------------------------------------------
1 | module Cache = ApolloClient__Cache_Core_Cache
2 | module Types = ApolloClient__Cache_Core_Types
3 |
--------------------------------------------------------------------------------
/src/@apollo/client/utilities/observables/ApolloClient__Utilities_Observables_Observable.res:
--------------------------------------------------------------------------------
1 | module Observable = ApolloClient__ZenObservable.Observable
2 |
--------------------------------------------------------------------------------
/src/graphql-tag/ApolloClient__GraphqlTag.res:
--------------------------------------------------------------------------------
1 | @module("@apollo/client")
2 | external gql: string => ApolloClient__Graphql.Language.documentNode = "gql"
3 |
--------------------------------------------------------------------------------
/documentationWebsite/static/img/small_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeddeloh/rescript-apollo-client/HEAD/documentationWebsite/static/img/small_logo.png
--------------------------------------------------------------------------------
/src/@apollo/client/link/core/ApolloClient__Link_Core.res:
--------------------------------------------------------------------------------
1 | module ApolloLink = ApolloClient__Link_Core_ApolloLink
2 | module Types = ApolloClient__Link_Core_Types
3 |
--------------------------------------------------------------------------------
/src/ApolloClient.res:
--------------------------------------------------------------------------------
1 | // We provide this file as a convenience but the main module is namespaced so you can do what you want
2 | include ReasonMLCommunity__ApolloClient
3 |
--------------------------------------------------------------------------------
/src/@apollo/client/cache/core/types/ApolloClient__Cache_Core_Types.res:
--------------------------------------------------------------------------------
1 | module DataProxy = ApolloClient__Cache_Core_Types_DataProxy
2 | module Common = ApolloClient__Cache_Core_Types_Common
3 |
--------------------------------------------------------------------------------
/src/@apollo/client/cache/inmemory/ApolloClient__Cache_InMemory.res:
--------------------------------------------------------------------------------
1 | module InMemoryCache = ApolloClient__Cache_InMemory_InMemoryCache
2 | module Policies = ApolloClient__Cache_InMemory_Policies
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .bsb.lock
2 | .merlin
3 | package-lock.json
4 | yarn.lock
5 | yarn-error.log
6 | *.bs.js
7 | .graphql_ppx_cache/
8 | .vscode/
9 | lib/
10 | node_modules/
11 | .yarn/install-state.gz
--------------------------------------------------------------------------------
/docs/assets/js/1643892c.ed9e524c.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[561],{1966:s=>{s.exports=JSON.parse('{"name":"docusaurus-plugin-content-docs","id":"default"}')}}]);
--------------------------------------------------------------------------------
/docs/assets/js/777256b9.b09fbcfb.js:
--------------------------------------------------------------------------------
1 | "use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[296],{4061:s=>{s.exports=JSON.parse('{"name":"docusaurus-plugin-content-pages","id":"default"}')}}]);
--------------------------------------------------------------------------------
/documentationWebsite/docs/changelog.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: changelog
3 | title: Changelog
4 | ---
5 |
6 | **Tags:**
7 |
8 | - :rocket: - New Feature
9 | - :boom: - Breaking Change
10 | - :bug: - Bug Fix
--------------------------------------------------------------------------------
/src/@apollo/client/react/hooks/ApolloClient__React_Hooks_UseApolloClient.res:
--------------------------------------------------------------------------------
1 | module ApolloClient = ApolloClient__Core_ApolloClient
2 |
3 | @module("@apollo/client")
4 | external useApolloClient: unit => ApolloClient.t = "useApolloClient"
5 |
--------------------------------------------------------------------------------
/src/@apollo/client/testing/ApolloClient__Testing.res:
--------------------------------------------------------------------------------
1 | module Core = ApolloClient__Testing_Core
2 | module Types = ApolloClient__Testing_Types
3 | module MockedProvider = ApolloClient__Testing_React.MockedProvider
4 |
5 | let makeResult = Types.makeResult
6 |
--------------------------------------------------------------------------------
/EXAMPLES/src/WebpackEntry.res:
--------------------------------------------------------------------------------
1 | @@warning("-3")
2 | switch ReactDOM.querySelector("#root") {
3 | | Some(el) =>
4 | ReactDOM.render(
5 |
{"[ Not functional, but the examples are still valid ]"->React.string}
12 | {switch SorryItsNotASubscriptionForTodos.use() { 13 | | {data: Some({siteStatisticsUpdated: Some({currentVisitorsOnline})})} => 14 |15 | {React.string("There are " ++ (string_of_int(currentVisitorsOnline) ++ " visitors online"))} 16 |
17 | | _ignoredForExample => React.null 18 | }} 19 | > 20 | -------------------------------------------------------------------------------- /src/@apollo/client/core/ApolloClient__Core_NetworkStatus.res: -------------------------------------------------------------------------------- 1 | module NetworkStatus = { 2 | module Js_ = { 3 | type t = int 4 | } 5 | 6 | type t = 7 | | Loading 8 | | SetVariables 9 | | FetchMore 10 | | Refetch 11 | | Poll 12 | | Ready 13 | | Error 14 | | // Apollo types are not accurate. See: 15 | // https://github.com/reasonml-community/rescript-apollo-client/issues/68 16 | SkippedOrNotPresent 17 | 18 | let fromJs: Js_.t => t = js => 19 | switch js { 20 | | 1 => Loading 21 | | 2 => SetVariables 22 | | 3 => FetchMore 23 | | 4 => Refetch 24 | | 6 => Poll 25 | | 7 => Ready 26 | | 8 => Error 27 | | _ => SkippedOrNotPresent 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /EXAMPLES/src/hooksUsage/Query_OverlySimple.res: -------------------------------------------------------------------------------- 1 | module TodosQuery = %graphql(` 2 | query TodosQuery { 3 | todos: allTodos { 4 | id 5 | text 6 | completed 7 | } 8 | } 9 | `) 10 | 11 | @react.component 12 | let make = () => 13 | switch TodosQuery.use() { 14 | | {loading: true} => "Loading..."->React.string 15 | | {error: Some(_error)} => "Error loading data"->React.string 16 | | {data: Some({todos})} => 17 |
2 |
3 |
4 | ReScript bindings for the Apollo Client ecosystem
5 |
8 |
9 |
10 |
11 |
14 | Documentation • 15 | Installation • 16 | Examples • 17 | Contributing 18 |
19 | -------------------------------------------------------------------------------- /documentationWebsite/src/css/custom.css: -------------------------------------------------------------------------------- 1 | /* stylelint-disable docusaurus/copyright-header */ 2 | /** 3 | * Any CSS included here will be global. The classic template 4 | * bundles Infima by default. Infima is a CSS framework designed to 5 | * work well for content-centric websites. 6 | */ 7 | 8 | /* You can override the default Infima variables here. */ 9 | :root { 10 | --ifm-color-primary: #933485; 11 | --ifm-color-primary-dark: #842f78; 12 | --ifm-color-primary-darker: #7d2c71; 13 | --ifm-color-primary-darkest: #67245d; 14 | --ifm-color-primary-light: #a23992; 15 | --ifm-color-primary-lighter: #a93c99; 16 | --ifm-color-primary-lightest: #bd45ac; 17 | --ifm-code-font-size: 95%; 18 | } 19 | 20 | .white-bg { 21 | background: white; 22 | } -------------------------------------------------------------------------------- /src/@apollo/client/link/ws/ApolloClient__Link_Ws.res: -------------------------------------------------------------------------------- 1 | module ApolloLink = ApolloClient__Link_Core_ApolloLink 2 | module Graphql = ApolloClient__Graphql 3 | 4 | module WebSocketLink = { 5 | module ClientOptions = ApolloClient__GraphqlWs.ClientOptions 6 | module Client = ApolloClient__GraphqlWs.Client 7 | 8 | module Js_ = { 9 | // export class GraphQLWsLink extends ApolloLink { 10 | // constructor(public readonly client: Client); 11 | // request(operation: Operation): Observable{"Loading"->React.string}
24 | | Executed({loading, data: Some({todos}), error}) => 25 | <> 26 | 33 |34 | {React.string("There are " ++ (todos->Belt.Array.length->string_of_int ++ " To-Dos"))} 35 |
36 | > 37 | | Executed({loading: false, data: None}) =>{"Error loading data"->React.string}
38 | }} 39 |{React.string("There are " ++ (todos->Belt.Array.length->string_of_int ++ " To-Dos"))}
18 | } 19 | 20 | @react.component 21 | let make = () => { 22 | let queryResult = TodosQuery.use() 23 | 24 |{"Loading"->React.string}
27 | | {loading, data: Some({todos}), error} => 28 | <> 29 | 36 |{"Error loading data"->React.string}
39 | }} 40 |{"Loading"->React.string}
18 | | {loading, data: Some({todos}), error, fetchMore} => 19 |28 | {React.string("There are " ++ (todos->Belt.Array.length->string_of_int ++ " To-Dos"))} 29 |
30 |31 | 51 |
52 |{"Error loading data"->React.string}
54 | }} 55 |{"[ Not functional, but the examples are still valid ]"->React.string}
59 | {switch queryResult { 60 | | {data: Some({todos})} => 61 |62 | {React.string("There are " ++ (todos->Belt.Array.length->string_of_int ++ " To-Dos"))} 63 |
64 | | _ignoredForExample => React.null 65 | }} 66 | > 67 | } 68 | -------------------------------------------------------------------------------- /src/ApolloClient__Utils.res: -------------------------------------------------------------------------------- 1 | module ApolloError = ApolloClient__Errors_ApolloError 2 | module Graphql = ApolloClient__Graphql 3 | module Types = ApolloClient__Types 4 | 5 | @new external makeError: string => Js.Exn.t = "Error" 6 | 7 | let ensureError = ApolloError.ensureError 8 | 9 | external asJson: 'any => Js.Json.t = "%identity" 10 | 11 | let safeParse: (. 'jsData => 'data) => Types.safeParse<'data, 'jsData> = (. parse) => 12 | (. jsData) => 13 | switch parse(jsData) { 14 | | data => Ok(data) 15 | | exception Js.Exn.Error(error) => Error({value: jsData->asJson, error}) 16 | } 17 | 18 | let safeParseAndLiftToCommonResultProps: ( 19 | ~jsData: option<'jsData>, 20 | ~graphQLErrors: array{description}
20 |
37 | {siteConfig.tagline}
39 | 40 |77 | 78 |
79 |80 | 81 |
82 |{"[ To-Dos also logged in console with watchQuery ]"->React.string}
83 |34 | {React.string("There are " ++ (string_of_int(currentVisitorsOnline) ++ " visitors online"))} 35 |
36 | | _ignoredForExample => React.null 37 | }} 38 |{React.string("To-Do added: \"" ++ (text ++ "\""))}
93 | | {error} => 94 | <> 95 | {"Error loading data"->React.string} 96 | {switch error { 97 | | Some(error) => React.string(": " ++ error.message) 98 | | None => React.null 99 | }} 100 | > 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /src/@apollo/client/cache/inmemory/ApolloClient__Cache_InMemory_InMemoryCache.res: -------------------------------------------------------------------------------- 1 | module ApolloCache = ApolloClient__Cache_Core_Cache.ApolloCache 2 | module KeyFieldsFunction = ApolloClient__Cache_InMemory_Policies.KeyFieldsFunction 3 | module PossibleTypesMap = ApolloClient__Cache_InMemory_Policies.PossibleTypesMap 4 | module TypePolicy = ApolloClient__Cache_InMemory_Policies.TypePolicy 5 | module TypePolicies = ApolloClient__Cache_InMemory_Policies.TypePolicies 6 | 7 | module InMemoryCacheConfig = { 8 | module Js_ = { 9 | // export interface InMemoryCacheConfig extends ApolloReducerConfig { 10 | // resultCaching?: boolean; 11 | // possibleTypes?: PossibleTypesMap; 12 | // typePolicies?: TypePolicies; 13 | // } 14 | type t = { 15 | resultCaching?: bool, 16 | possibleTypes?: PossibleTypesMap.Js_.t, 17 | typePolicies?: TypePolicies.Js_.t, 18 | // ...extends ApolloReducerConfig 19 | dataIdFromObject?: KeyFieldsFunction.Js_.t, 20 | addTypename?: bool, 21 | } 22 | } 23 | type t = Js_.t 24 | } 25 | 26 | module Js_ = { 27 | // export declare class InMemoryCache extends ApolloCache{React.string("To-Do added: \"" ++ (text ++ "\""))}
108 | | {error} => <> 109 | {"Error loading data"->React.string} 110 | {switch error { 111 | | Some(error) => React.string(": " ++ error.message) 112 | | None => React.null 113 | }} 114 | > 115 | } 116 | } 117 | ``` 118 | 119 | ## Directly Via the Apollo Client 120 | 121 | ```reason 122 | let addTodo = _ => 123 | // This assumes you've set up a Client module as in the Getting Started section 124 | Apollo.client.mutate(~mutation=module(AddTodoMutation), {text: "Another To-Do"}) 125 | ->Promise.map(result => 126 | switch result { 127 | | Ok({data}) => Js.log2("mutate result: ", data) 128 | | Error(error) => Js.log2("Error: ", error) 129 | } 130 | ) 131 | ->ignore 132 | ``` 133 | -------------------------------------------------------------------------------- /src/zen-observable/ApolloClient__ZenObservable.res: -------------------------------------------------------------------------------- 1 | // interface SubscriptionObserverWe could not find what you were looking for.
Please contact the owner of the site that linked you to the original URL and let them know their link is broken.
{"Loading"->React.string}
56 | | {loading, data: Some({todos}), error, fetchMore} => 57 |66 | {React.string("There are " ++ (todos->Belt.Array.length->string_of_int ++ " To-Dos"))} 67 |
68 |69 | 72 |
73 |{"Error loading data"->React.string}
75 | }} 76 |{"Loading"->React.string}
93 | | Executed({loading, data: Some({todos}), error}) => <> 94 | 101 |102 | {React.string("There are " ++ (todos->Belt.Array.length->string_of_int ++ " To-Dos"))} 103 |
104 | > 105 | | Executed({loading: false, data: None}) =>{"Error loading data"->React.string}
106 | }} 107 |graphql-ppx",id:"1-graphql-ppx",level:3},{value:"2. Apollo Client",id:"2-apollo-client",level:3},{value:"3. Apollo-Specific graphql-ppx Configuration",id:"3-apollo-specific-graphql-ppx-configuration",level:3}],d={toc:u},g="wrapper";function m(e){let{components:n}=e,t=(0,o.A)(e,a);return(0,r.yg)(g,(0,l.A)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,r.yg)("h3",{id:"1-graphql-ppx"},"1. ",(0,r.yg)("inlineCode",{parentName:"h3"},"graphql-ppx")),(0,r.yg)("p",null,"We rely on Graphql-ppx for typesafe GraphQL operations and fragments in ReasonML. ",(0,r.yg)("a",{parentName:"p",href:"https://beta.graphql-ppx.com"},"Go to the official documentation")," for installation instructions."),(0,r.yg)("p",null,"You should now have a ",(0,r.yg)("inlineCode",{parentName:"p"},"graphql_schema.json")," in your project somewhere. Make sure it's always up-to-date!"),(0,r.yg)("h3",{id:"2-apollo-client"},"2. Apollo Client"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-sh"},"npm install rescript-apollo-client @apollo/client\n")),(0,r.yg)("h3",{id:"3-apollo-specific-graphql-ppx-configuration"},"3. Apollo-Specific ",(0,r.yg)("inlineCode",{parentName:"h3"},"graphql-ppx")," Configuration"),(0,r.yg)("p",null,"Add the following under ",(0,r.yg)("inlineCode",{parentName:"p"},"bs-dependencies")," and ",(0,r.yg)("inlineCode",{parentName:"p"},"graphql"),", in your ",(0,r.yg)("inlineCode",{parentName:"p"},"bsconfig.json")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-diff"},'{\n "graphql": {\n+ "apolloMode": true,\n+ "extendMutation": "ApolloClient.GraphQL_PPX.ExtendMutation",\n+ "extendQuery": "ApolloClient.GraphQL_PPX.ExtendQuery",\n+ "extendSubscription": "ApolloClient.GraphQL_PPX.ExtendSubscription",\n+ "templateTagReturnType": "ApolloClient.GraphQL_PPX.templateTagReturnType",\n+ "templateTagImport": "gql",\n+ "templateTagLocation": "@apollo/client"\n },\n "ppx-flags": ["@reasonml-community/graphql-ppx/ppx"],\n "bs-dependencies: [\n "@reasonml-community/graphql-ppx"\n+ "rescript-apollo-client"\n ]\n}\n')),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},'"apolloMode"')," automaticaly sprinkles ",(0,r.yg)("inlineCode",{parentName:"li"},"__typename")," throughout our operation and fragment definitions"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},'"templateTag*"')," is how we tell ",(0,r.yg)("inlineCode",{parentName:"li"},"graphql-ppx")," to wrap every operation with ",(0,r.yg)("inlineCode",{parentName:"li"},"gql")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},'"extend*"')," allows ",(0,r.yg)("inlineCode",{parentName:"li"},"rescript-apollo-client")," to automatically decorate the generated modules with Apollo-specific things like the correct hook for that operation!")))}m.isMDXComponent=!0}}]);
--------------------------------------------------------------------------------
/src/@apollo/client/react/hooks/ApolloClient__React_Hooks_UseLazyQuery.res:
--------------------------------------------------------------------------------
1 | module ApolloClient = ApolloClient__Core_ApolloClient
2 | module ApolloError = ApolloClient__Errors_ApolloError
3 | module ErrorPolicy = ApolloClient__Core_WatchQueryOptions.ErrorPolicy
4 | module Graphql = ApolloClient__Graphql
5 | module LazyQueryHookOptions = ApolloClient__React_Types.LazyQueryHookOptions
6 | module QueryTuple = ApolloClient__React_Types.QueryTuple
7 | module QueryTuple__noVariables = ApolloClient__React_Types.QueryTuple__noVariables
8 | module Types = ApolloClient__Types
9 | module Utils = ApolloClient__Utils
10 | module WatchQueryFetchPolicy = ApolloClient__Core_WatchQueryOptions.WatchQueryFetchPolicy
11 |
12 | module type Operation = Types.Operation
13 | module type OperationNoRequiredVars = Types.OperationNoRequiredVars
14 |
15 | module Js_ = {
16 | // export declare function useLazyQueryTags: