UNPKG

5.56 kBJavaScriptView Raw
1'use strict';
2
3exports.Cache = require('./Cache');
4exports.CacheContext = require('./CacheContext');
5exports.cacheDelete = require('./cacheDelete');
6exports.cacheEntryDelete = require('./cacheEntryDelete');
7exports.cacheEntryPrune = require('./cacheEntryPrune');
8exports.cacheEntrySet = require('./cacheEntrySet');
9exports.cacheEntryStale = require('./cacheEntryStale');
10exports.cachePrune = require('./cachePrune');
11exports.cacheStale = require('./cacheStale');
12exports.fetchGraphQL = require('./fetchGraphQL');
13exports.fetchOptionsGraphQL = require('./fetchOptionsGraphQL');
14exports.HYDRATION_TIME_MS = require('./HYDRATION_TIME_MS');
15exports.HydrationTimeStampContext = require('./HydrationTimeStampContext');
16exports.Loading = require('./Loading');
17exports.LoadingCacheValue = require('./LoadingCacheValue');
18exports.LoadingContext = require('./LoadingContext');
19exports.Provider = require('./Provider');
20exports.useAutoAbortLoad = require('./useAutoAbortLoad');
21exports.useAutoLoad = require('./useAutoLoad');
22exports.useCache = require('./useCache');
23exports.useCacheEntry = require('./useCacheEntry');
24exports.useCacheEntryPrunePrevention = require('./useCacheEntryPrunePrevention');
25exports.useLoadGraphQL = require('./useLoadGraphQL');
26exports.useLoading = require('./useLoading');
27exports.useLoadingEntry = require('./useLoadingEntry');
28exports.useLoadOnDelete = require('./useLoadOnDelete');
29exports.useLoadOnMount = require('./useLoadOnMount');
30exports.useLoadOnStale = require('./useLoadOnStale');
31exports.useWaterfallLoad = require('./useWaterfallLoad');
32
33/**
34 * A unique key to access a [cache value]{@link CacheValue}.
35 * @kind typedef
36 * @name CacheKey
37 * @type {string}
38 */
39
40/**
41 * A [cache]{@link Cache#store} value. If server side rendering, it should be
42 * JSON serializable for client hydration. It should contain information about
43 * any errors that occurred during loading so they can be rendered, and if
44 * server side rendering, be hydrated on the client.
45 * @kind typedef
46 * @name CacheValue
47 * @type {*}
48 */
49
50/**
51 * Matches a [cache key]{@link CacheKey} against a custom condition.
52 * @kind typedef
53 * @name CacheKeyMatcher
54 * @type {Function}
55 * @param {CacheKey} cacheKey Cache key.
56 * @returns {boolean} Does the [cache key]{@link CacheKey} match the custom condition.
57 */
58
59/**
60 * [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch)
61 * options, called `init` in official specs.
62 * @kind typedef
63 * @name FetchOptions
64 * @type {object}
65 * @see [MDN `fetch` parameters docs](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).
66 * @see [Polyfillable `fetch` options](https://github.github.io/fetch/#options). Don’t use other options if `fetch` is polyfilled for Node.js or legacy browsers.
67 */
68
69/**
70 * A GraphQL operation. Additional properties may be used; all are sent to the
71 * GraphQL server.
72 * @kind typedef
73 * @name GraphQLOperation
74 * @type {object}
75 * @prop {string} query GraphQL queries or mutations.
76 * @prop {object} [variables] Variables used in the `query`.
77 */
78
79/**
80 * A GraphQL result.
81 * @kind typedef
82 * @name GraphQLResult
83 * @type {object}
84 * @prop {object} [data] GraphQL response data.
85 * @prop {Array<GraphQLResultError>} [errors] GraphQL response errors from the server, along with any loading errors added on the client.
86 * @see [GraphQL spec for a response](https://spec.graphql.org/June2018/#sec-Response).
87 */
88
89/**
90 * A GraphQL result error; either created by the GraphQL server, or by whatever
91 * loaded the GraphQL on the client (e.g. [`fetchGraphQL`]{@link fetchGraphQL}).
92 * @kind typedef
93 * @name GraphQLResultError
94 * @type {object}
95 * @prop {object} message Error message.
96 * @prop {Array<{line: number, column: number}>} [locations] GraphQL query locations related to the error.
97 * @prop {Array<string>} [path] [GraphQL result]{@link GraphQLResult} `data` field path related to the error.
98 * @prop {object} [extensions] Custom error data. If the error was created on the client and not the GraphQL server, this property should be present and contain at least `client: true`, although `code` and error specific properties may be present.
99 * @see [GraphQL spec for response errors](https://spec.graphql.org/June2018/#sec-Errors).
100 */
101
102/**
103 * Milliseconds since the
104 * [performance time origin](https://developer.mozilla.org/en-US/docs/Web/API/Performance/timeOrigin)
105 * (when the current JavaScript environment started running).
106 * @kind typedef
107 * @name HighResTimeStamp
108 * @type {number}
109 * @see [MDN `DOMHighResTimeStamp` docs](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp).
110 */
111
112/**
113 * Starts [loading a cache value]{@link LoadingCacheValue}.
114 * @kind typedef
115 * @name Loader
116 * @type {Function}
117 * @returns {LoadingCacheValue} The loading cache value.
118 */
119
120/**
121 * Loads a GraphQL operation, using the [GraphQL fetcher]{@link fetchGraphQL}.
122 * @kind typedef
123 * @name LoadGraphQL
124 * @type {Loader}
125 * @param {CacheKey} cacheKey Cache key to store the loading result under.
126 * @param {string} fetchUri [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch) URI.
127 * @param {FetchOptions} fetchOptions [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch) options.
128 * @returns {LoadingCacheValue} The loading cache value.
129 */
130
131/**
132 * A React virtual DOM node; anything that can be rendered.
133 * @kind typedef
134 * @name ReactNode
135 * @type {undefined|null|boolean|number|string|React.Element|Array<ReactNode>}
136 */