1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', { value: true });
|
4 |
|
5 | require('../utilities/globals');
|
6 | var context = require('./context');
|
7 | var hooks = require('./hooks');
|
8 | var parser = require('./parser');
|
9 | var tslib = require('tslib');
|
10 | var internal = require('./internal');
|
11 |
|
12 | var wrapperSymbol = Symbol.for("apollo.hook.wrappers");
|
13 | function wrapHook(hookName, useHook, clientOrObsQuery) {
|
14 | var queryManager = clientOrObsQuery["queryManager"];
|
15 | var wrappers = queryManager && queryManager[wrapperSymbol];
|
16 | var wrapper = wrappers && wrappers[hookName];
|
17 | return wrapper ? wrapper(useHook) : useHook;
|
18 | }
|
19 |
|
20 | function createQueryPreloader(client) {
|
21 | return wrapHook("createQueryPreloader", _createQueryPreloader, client)(client);
|
22 | }
|
23 | var _createQueryPreloader = function (client) {
|
24 | return function preloadQuery(query, options) {
|
25 | var _a, _b;
|
26 | if (options === void 0) { options = Object.create(null); }
|
27 | var queryRef = new internal.InternalQueryReference(client.watchQuery(tslib.__assign(tslib.__assign({}, options), { query: query })), {
|
28 | autoDisposeTimeoutMs: (_b = (_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense) === null || _b === void 0 ? void 0 : _b.autoDisposeTimeoutMs,
|
29 | });
|
30 | return internal.wrapQueryRef(queryRef);
|
31 | };
|
32 | };
|
33 |
|
34 | exports.ApolloConsumer = context.ApolloConsumer;
|
35 | exports.ApolloProvider = context.ApolloProvider;
|
36 | exports.getApolloContext = context.getApolloContext;
|
37 | exports.resetApolloContext = context.resetApolloContext;
|
38 | exports.DocumentType = parser.DocumentType;
|
39 | exports.operationName = parser.operationName;
|
40 | exports.parser = parser.parser;
|
41 | exports.createQueryPreloader = createQueryPreloader;
|
42 | for (var k in hooks) {
|
43 | if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = hooks[k];
|
44 | }
|
45 |
|