@orion-js/graphql 2.8.3-alpha-1 → 2.8.3
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/lib/startGraphQL.js
CHANGED
|
@@ -25,6 +25,8 @@ var _apolloServerCaching = require("apollo-server-caching");
|
|
|
25
25
|
|
|
26
26
|
var _getOperationName = _interopRequireDefault(require("./getOperationName"));
|
|
27
27
|
|
|
28
|
+
var _storePersistedQuery = _interopRequireDefault(require("./storePersistedQuery"));
|
|
29
|
+
|
|
28
30
|
global.globalMicro = _micro.default;
|
|
29
31
|
|
|
30
32
|
async function _default(options) {
|
|
@@ -68,7 +70,7 @@ async function _default(options) {
|
|
|
68
70
|
const result = await options.executeGraphQLCache(params, fallback);
|
|
69
71
|
|
|
70
72
|
if (result) {
|
|
71
|
-
await
|
|
73
|
+
await (0, _storePersistedQuery.default)(apolloOptions, params);
|
|
72
74
|
|
|
73
75
|
if (result.cacheControl && cacheKey) {
|
|
74
76
|
cacheControlCache.set(cacheKey, result.cacheControl);
|
|
@@ -4,6 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = storePersistedQuery;
|
|
7
|
+
exports.APQ_CACHE_PREFIX = void 0;
|
|
8
|
+
const APQ_CACHE_PREFIX = 'apq:';
|
|
9
|
+
exports.APQ_CACHE_PREFIX = APQ_CACHE_PREFIX;
|
|
7
10
|
|
|
8
11
|
function createSHA(algorithm) {
|
|
9
12
|
return require('crypto').createHash(algorithm);
|
|
@@ -30,7 +33,7 @@ async function storePersistedQuery(apolloConfig, params) {
|
|
|
30
33
|
return;
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
const hash = computeQueryHash(data.query);
|
|
36
|
+
const hash = APQ_CACHE_PREFIX + computeQueryHash(data.query);
|
|
34
37
|
const ttl = apolloConfig.persistedQueries?.ttl !== undefined ? apolloConfig.persistedQueries.ttl : 60 * 15;
|
|
35
38
|
await queryCache.set(hash, data.query, {
|
|
36
39
|
ttl
|