graphql-persisted 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/GraphQLQueryCache.js +16 -10
- package/mjs/GraphQLQueryCache.js +16 -10
- package/package.json +1 -1
package/cjs/GraphQLQueryCache.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _GraphQLQueryCache_instances, _GraphQLQueryCache_fetcher, _GraphQLQueryCache_endpoint, _GraphQLQueryCache_persistedOperations, _GraphQLQueryCache_persistedDocuments, _GraphQLQueryCache_configMeta, _GraphQLQueryCache_subscribedQueries, _GraphQLQueryCache_inFlight, _GraphQLQueryCache_cacheStore, _GraphQLQueryCache_runtimeCache, _GraphQLQueryCache_queryInvalidation, _GraphQLQueryCache_mutationInvalidation, _GraphQLQueryCache_effectsIssued, _GraphQLQueryCache_getKey, _GraphQLQueryCache_executeOperation, _GraphQLQueryCache_getMeta, _GraphQLQueryCache_fetch, _GraphQLQueryCache_shouldRefetchQuery, _GraphQLQueryCache_gcOperations;
|
|
2
|
+
var _GraphQLQueryCache_instances, _GraphQLQueryCache_fetcher, _GraphQLQueryCache_endpoint, _GraphQLQueryCache_persistedOperations, _GraphQLQueryCache_persistedDocuments, _GraphQLQueryCache_configMeta, _GraphQLQueryCache_subscribedQueries, _GraphQLQueryCache_inFlight, _GraphQLQueryCache_cacheStore, _GraphQLQueryCache_runtimeCache, _GraphQLQueryCache_queryInvalidation, _GraphQLQueryCache_mutationInvalidation, _GraphQLQueryCache_effectsIssued, _GraphQLQueryCache_getKey, _GraphQLQueryCache_executeOperation, _GraphQLQueryCache_getMeta, _GraphQLQueryCache_fetch, _GraphQLQueryCache_makeFetch, _GraphQLQueryCache_shouldRefetchQuery, _GraphQLQueryCache_gcOperations;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.GraphQLQueryCache = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
@@ -57,8 +57,8 @@ class GraphQLQueryCache {
|
|
|
57
57
|
* A list of all "effects" that have run, used to keep track of
|
|
58
58
|
*/
|
|
59
59
|
_GraphQLQueryCache_effectsIssued.set(this, []); // TODO: Include subscriptions
|
|
60
|
-
tslib_1.__classPrivateFieldSet(this, _GraphQLQueryCache_fetcher, config.fetcher
|
|
61
|
-
tslib_1.__classPrivateFieldSet(this, _GraphQLQueryCache_endpoint, config.endpoint ||
|
|
60
|
+
tslib_1.__classPrivateFieldSet(this, _GraphQLQueryCache_fetcher, config.fetcher, "f");
|
|
61
|
+
tslib_1.__classPrivateFieldSet(this, _GraphQLQueryCache_endpoint, config.endpoint || `/graphql`, "f");
|
|
62
62
|
tslib_1.__classPrivateFieldSet(this, _GraphQLQueryCache_persistedOperations, config.persistedOperations, "f");
|
|
63
63
|
tslib_1.__classPrivateFieldSet(this, _GraphQLQueryCache_persistedDocuments, config.persistedDocuments, "f");
|
|
64
64
|
tslib_1.__classPrivateFieldSet(this, _GraphQLQueryCache_configMeta, unwrapMeta(config.meta), "f");
|
|
@@ -369,13 +369,7 @@ _GraphQLQueryCache_fetcher = new WeakMap(), _GraphQLQueryCache_endpoint = new We
|
|
|
369
369
|
async function _GraphQLQueryCache_fetch(body) {
|
|
370
370
|
let result;
|
|
371
371
|
try {
|
|
372
|
-
result = await
|
|
373
|
-
method: 'POST',
|
|
374
|
-
body: JSON.stringify(body),
|
|
375
|
-
headers: {
|
|
376
|
-
'content-type': 'application/json',
|
|
377
|
-
},
|
|
378
|
-
});
|
|
372
|
+
result = await tslib_1.__classPrivateFieldGet(this, _GraphQLQueryCache_instances, "m", _GraphQLQueryCache_makeFetch).call(this, body);
|
|
379
373
|
if (result.status === 200) {
|
|
380
374
|
const json = (await result.json());
|
|
381
375
|
return json;
|
|
@@ -403,6 +397,18 @@ async function _GraphQLQueryCache_fetch(body) {
|
|
|
403
397
|
},
|
|
404
398
|
};
|
|
405
399
|
}
|
|
400
|
+
}, _GraphQLQueryCache_makeFetch = function _GraphQLQueryCache_makeFetch(body) {
|
|
401
|
+
const reqInit = {
|
|
402
|
+
method: 'POST',
|
|
403
|
+
body: JSON.stringify(body),
|
|
404
|
+
headers: {
|
|
405
|
+
'content-type': 'application/json',
|
|
406
|
+
},
|
|
407
|
+
};
|
|
408
|
+
if (tslib_1.__classPrivateFieldGet(this, _GraphQLQueryCache_fetcher, "f")) {
|
|
409
|
+
return tslib_1.__classPrivateFieldGet(this, _GraphQLQueryCache_fetcher, "f").call(this, tslib_1.__classPrivateFieldGet(this, _GraphQLQueryCache_endpoint, "f"), reqInit);
|
|
410
|
+
}
|
|
411
|
+
return fetch(tslib_1.__classPrivateFieldGet(this, _GraphQLQueryCache_endpoint, "f"), reqInit);
|
|
406
412
|
}, _GraphQLQueryCache_shouldRefetchQuery = function _GraphQLQueryCache_shouldRefetchQuery() {
|
|
407
413
|
//
|
|
408
414
|
}, _GraphQLQueryCache_gcOperations = function _GraphQLQueryCache_gcOperations() {
|
package/mjs/GraphQLQueryCache.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _GraphQLQueryCache_instances, _GraphQLQueryCache_fetcher, _GraphQLQueryCache_endpoint, _GraphQLQueryCache_persistedOperations, _GraphQLQueryCache_persistedDocuments, _GraphQLQueryCache_configMeta, _GraphQLQueryCache_subscribedQueries, _GraphQLQueryCache_inFlight, _GraphQLQueryCache_cacheStore, _GraphQLQueryCache_runtimeCache, _GraphQLQueryCache_queryInvalidation, _GraphQLQueryCache_mutationInvalidation, _GraphQLQueryCache_effectsIssued, _GraphQLQueryCache_getKey, _GraphQLQueryCache_executeOperation, _GraphQLQueryCache_getMeta, _GraphQLQueryCache_fetch, _GraphQLQueryCache_shouldRefetchQuery, _GraphQLQueryCache_gcOperations;
|
|
1
|
+
var _GraphQLQueryCache_instances, _GraphQLQueryCache_fetcher, _GraphQLQueryCache_endpoint, _GraphQLQueryCache_persistedOperations, _GraphQLQueryCache_persistedDocuments, _GraphQLQueryCache_configMeta, _GraphQLQueryCache_subscribedQueries, _GraphQLQueryCache_inFlight, _GraphQLQueryCache_cacheStore, _GraphQLQueryCache_runtimeCache, _GraphQLQueryCache_queryInvalidation, _GraphQLQueryCache_mutationInvalidation, _GraphQLQueryCache_effectsIssued, _GraphQLQueryCache_getKey, _GraphQLQueryCache_executeOperation, _GraphQLQueryCache_getMeta, _GraphQLQueryCache_fetch, _GraphQLQueryCache_makeFetch, _GraphQLQueryCache_shouldRefetchQuery, _GraphQLQueryCache_gcOperations;
|
|
2
2
|
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
3
3
|
import isEqual from 'lodash.isequal';
|
|
4
4
|
import { graphqlNormalize } from 'graphql-normalize';
|
|
@@ -54,8 +54,8 @@ export class GraphQLQueryCache {
|
|
|
54
54
|
* A list of all "effects" that have run, used to keep track of
|
|
55
55
|
*/
|
|
56
56
|
_GraphQLQueryCache_effectsIssued.set(this, []); // TODO: Include subscriptions
|
|
57
|
-
__classPrivateFieldSet(this, _GraphQLQueryCache_fetcher, config.fetcher
|
|
58
|
-
__classPrivateFieldSet(this, _GraphQLQueryCache_endpoint, config.endpoint ||
|
|
57
|
+
__classPrivateFieldSet(this, _GraphQLQueryCache_fetcher, config.fetcher, "f");
|
|
58
|
+
__classPrivateFieldSet(this, _GraphQLQueryCache_endpoint, config.endpoint || `/graphql`, "f");
|
|
59
59
|
__classPrivateFieldSet(this, _GraphQLQueryCache_persistedOperations, config.persistedOperations, "f");
|
|
60
60
|
__classPrivateFieldSet(this, _GraphQLQueryCache_persistedDocuments, config.persistedDocuments, "f");
|
|
61
61
|
__classPrivateFieldSet(this, _GraphQLQueryCache_configMeta, unwrapMeta(config.meta), "f");
|
|
@@ -365,13 +365,7 @@ _GraphQLQueryCache_fetcher = new WeakMap(), _GraphQLQueryCache_endpoint = new We
|
|
|
365
365
|
async function _GraphQLQueryCache_fetch(body) {
|
|
366
366
|
let result;
|
|
367
367
|
try {
|
|
368
|
-
result = await
|
|
369
|
-
method: 'POST',
|
|
370
|
-
body: JSON.stringify(body),
|
|
371
|
-
headers: {
|
|
372
|
-
'content-type': 'application/json',
|
|
373
|
-
},
|
|
374
|
-
});
|
|
368
|
+
result = await __classPrivateFieldGet(this, _GraphQLQueryCache_instances, "m", _GraphQLQueryCache_makeFetch).call(this, body);
|
|
375
369
|
if (result.status === 200) {
|
|
376
370
|
const json = (await result.json());
|
|
377
371
|
return json;
|
|
@@ -399,6 +393,18 @@ async function _GraphQLQueryCache_fetch(body) {
|
|
|
399
393
|
},
|
|
400
394
|
};
|
|
401
395
|
}
|
|
396
|
+
}, _GraphQLQueryCache_makeFetch = function _GraphQLQueryCache_makeFetch(body) {
|
|
397
|
+
const reqInit = {
|
|
398
|
+
method: 'POST',
|
|
399
|
+
body: JSON.stringify(body),
|
|
400
|
+
headers: {
|
|
401
|
+
'content-type': 'application/json',
|
|
402
|
+
},
|
|
403
|
+
};
|
|
404
|
+
if (__classPrivateFieldGet(this, _GraphQLQueryCache_fetcher, "f")) {
|
|
405
|
+
return __classPrivateFieldGet(this, _GraphQLQueryCache_fetcher, "f").call(this, __classPrivateFieldGet(this, _GraphQLQueryCache_endpoint, "f"), reqInit);
|
|
406
|
+
}
|
|
407
|
+
return fetch(__classPrivateFieldGet(this, _GraphQLQueryCache_endpoint, "f"), reqInit);
|
|
402
408
|
}, _GraphQLQueryCache_shouldRefetchQuery = function _GraphQLQueryCache_shouldRefetchQuery() {
|
|
403
409
|
//
|
|
404
410
|
}, _GraphQLQueryCache_gcOperations = function _GraphQLQueryCache_gcOperations() {
|