@graphql-box/cache-manager 3.2.0 → 3.2.1
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/browser/index.js +1 -1
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/production.analysis.txt +30 -30
- package/lib/main/debug/log-cache-entry/index.js +8 -3
- package/lib/main/debug/log-cache-entry/index.js.map +1 -1
- package/lib/main/debug/log-cache-query/index.js +8 -3
- package/lib/main/debug/log-cache-query/index.js.map +1 -1
- package/lib/main/main/index.js +16 -7
- package/lib/main/main/index.js.map +1 -1
- package/lib/module/debug/log-cache-entry/index.js +8 -3
- package/lib/module/debug/log-cache-entry/index.js.map +1 -1
- package/lib/module/debug/log-cache-query/index.js +8 -3
- package/lib/module/debug/log-cache-query/index.js.map +1 -1
- package/lib/module/main/index.js +16 -7
- package/lib/module/main/index.js.map +1 -1
- package/lib/types/debug/log-cache-entry/index.d.ts.map +1 -1
- package/lib/types/debug/log-cache-query/index.d.ts.map +1 -1
- package/lib/types/main/index.d.ts +3 -1
- package/lib/types/main/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/debug/log-cache-entry/index.ts +8 -3
- package/src/debug/log-cache-query/index.ts +8 -3
- package/src/main/index.ts +17 -10
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
-----------------------------
|
|
2
2
|
Rollup File Analysis
|
|
3
3
|
-----------------------------
|
|
4
|
-
bundle size:
|
|
5
|
-
original size:
|
|
4
|
+
bundle size: 94.706 KB
|
|
5
|
+
original size: 63.429 KB
|
|
6
6
|
code reduction: 0 %
|
|
7
7
|
module count: 24
|
|
8
8
|
|
|
9
9
|
███████████████████████████████████░░░░░░░░░░░░░░░
|
|
10
10
|
file: /src/main/index.ts
|
|
11
|
-
bundle space:
|
|
12
|
-
rendered size:
|
|
13
|
-
original size: 38.
|
|
11
|
+
bundle space: 70.35 %
|
|
12
|
+
rendered size: 66.625 KB
|
|
13
|
+
original size: 38.471 KB
|
|
14
14
|
code reduction: 0 %
|
|
15
15
|
dependents: 1
|
|
16
16
|
- /src/index.ts
|
|
17
17
|
|
|
18
18
|
██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
19
19
|
file: /src/debug/log-cache-query/index.ts
|
|
20
|
-
bundle space:
|
|
21
|
-
rendered size:
|
|
22
|
-
original size: 1.
|
|
20
|
+
bundle space: 5.31 %
|
|
21
|
+
rendered size: 5.03 KB
|
|
22
|
+
original size: 1.489 KB
|
|
23
23
|
code reduction: 0 %
|
|
24
24
|
dependents: 1
|
|
25
25
|
- /src/debug/index.ts
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
28
28
|
file: /src/debug/log-cache-entry/index.ts
|
|
29
|
-
bundle space:
|
|
30
|
-
rendered size:
|
|
31
|
-
original size: 1.
|
|
29
|
+
bundle space: 4.89 %
|
|
30
|
+
rendered size: 4.632 KB
|
|
31
|
+
original size: 1.396 KB
|
|
32
32
|
code reduction: 0 %
|
|
33
33
|
dependents: 1
|
|
34
34
|
- /src/debug/index.ts
|
|
35
35
|
|
|
36
36
|
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
37
37
|
file: /src/debug/log-partial-compiled/index.ts
|
|
38
|
-
bundle space: 3.
|
|
38
|
+
bundle space: 3.56 %
|
|
39
39
|
rendered size: 3.37 KB
|
|
40
40
|
original size: 1.161 KB
|
|
41
41
|
code reduction: 0 %
|
|
@@ -44,7 +44,7 @@ dependents: 1
|
|
|
44
44
|
|
|
45
45
|
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
46
46
|
file: /src/helpers/filterField.ts
|
|
47
|
-
bundle space:
|
|
47
|
+
bundle space: 2.99 %
|
|
48
48
|
rendered size: 2.834 KB
|
|
49
49
|
original size: 2.94 KB
|
|
50
50
|
code reduction: 3.61 %
|
|
@@ -54,8 +54,8 @@ dependents: 2
|
|
|
54
54
|
|
|
55
55
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
56
56
|
file: /src/helpers/mergeResponseDataSets.ts
|
|
57
|
-
bundle space: 1.
|
|
58
|
-
rendered size: 1.
|
|
57
|
+
bundle space: 1.82 %
|
|
58
|
+
rendered size: 1.728 KB
|
|
59
59
|
original size: 907 Bytes
|
|
60
60
|
code reduction: 0 %
|
|
61
61
|
dependents: 1
|
|
@@ -63,7 +63,7 @@ dependents: 1
|
|
|
63
63
|
|
|
64
64
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
65
65
|
file: /src/helpers/filterFragmentDefinitions.ts
|
|
66
|
-
bundle space: 1.
|
|
66
|
+
bundle space: 1.54 %
|
|
67
67
|
rendered size: 1.462 KB
|
|
68
68
|
original size: 1.517 KB
|
|
69
69
|
code reduction: 3.63 %
|
|
@@ -72,7 +72,7 @@ dependents: 1
|
|
|
72
72
|
|
|
73
73
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
74
74
|
file: /src/helpers/normalizePatchResponseData.ts
|
|
75
|
-
bundle space: 1.
|
|
75
|
+
bundle space: 1.38 %
|
|
76
76
|
rendered size: 1.309 KB
|
|
77
77
|
original size: 478 Bytes
|
|
78
78
|
code reduction: 0 %
|
|
@@ -81,7 +81,7 @@ dependents: 1
|
|
|
81
81
|
|
|
82
82
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
83
83
|
file: /src/helpers/filterQuery.ts
|
|
84
|
-
bundle space: 1.
|
|
84
|
+
bundle space: 1.18 %
|
|
85
85
|
rendered size: 1.117 KB
|
|
86
86
|
original size: 1.49 KB
|
|
87
87
|
code reduction: 25.03 %
|
|
@@ -90,7 +90,7 @@ dependents: 1
|
|
|
90
90
|
|
|
91
91
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
92
92
|
file: /src/helpers/filterIDsAndTypeNames.ts
|
|
93
|
-
bundle space: 1.
|
|
93
|
+
bundle space: 1.05 %
|
|
94
94
|
rendered size: 998 Bytes
|
|
95
95
|
original size: 1.165 KB
|
|
96
96
|
code reduction: 14.33 %
|
|
@@ -99,7 +99,7 @@ dependents: 1
|
|
|
99
99
|
|
|
100
100
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
101
101
|
file: /src/helpers/checkFieldPathChecklist.ts
|
|
102
|
-
bundle space: 1.
|
|
102
|
+
bundle space: 1.01 %
|
|
103
103
|
rendered size: 957 Bytes
|
|
104
104
|
original size: 828 Bytes
|
|
105
105
|
code reduction: 0 %
|
|
@@ -108,7 +108,7 @@ dependents: 1
|
|
|
108
108
|
|
|
109
109
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
110
110
|
file: /src/helpers/filterOutPropsWithArgsOrDirectives.ts
|
|
111
|
-
bundle space:
|
|
111
|
+
bundle space: 0.98 %
|
|
112
112
|
rendered size: 927 Bytes
|
|
113
113
|
original size: 1.081 KB
|
|
114
114
|
code reduction: 14.25 %
|
|
@@ -117,7 +117,7 @@ dependents: 1
|
|
|
117
117
|
|
|
118
118
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
119
119
|
file: /src/helpers/filterInlineFragments.ts
|
|
120
|
-
bundle space: 0.
|
|
120
|
+
bundle space: 0.83 %
|
|
121
121
|
rendered size: 788 Bytes
|
|
122
122
|
original size: 999 Bytes
|
|
123
123
|
code reduction: 21.12 %
|
|
@@ -126,7 +126,7 @@ dependents: 1
|
|
|
126
126
|
|
|
127
127
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
128
128
|
file: /src/helpers/deriveOpCacheability.ts
|
|
129
|
-
bundle space: 0.
|
|
129
|
+
bundle space: 0.83 %
|
|
130
130
|
rendered size: 786 Bytes
|
|
131
131
|
original size: 858 Bytes
|
|
132
132
|
code reduction: 8.39 %
|
|
@@ -135,7 +135,7 @@ dependents: 1
|
|
|
135
135
|
|
|
136
136
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
137
137
|
file: /src/helpers/filterFragmentSpreads.ts
|
|
138
|
-
bundle space: 0.
|
|
138
|
+
bundle space: 0.65 %
|
|
139
139
|
rendered size: 616 Bytes
|
|
140
140
|
original size: 942 Bytes
|
|
141
141
|
code reduction: 34.61 %
|
|
@@ -144,7 +144,7 @@ dependents: 1
|
|
|
144
144
|
|
|
145
145
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
146
146
|
file: /src/helpers/createFragmentSpreadChecklist.ts
|
|
147
|
-
bundle space: 0.
|
|
147
|
+
bundle space: 0.48 %
|
|
148
148
|
rendered size: 457 Bytes
|
|
149
149
|
original size: 572 Bytes
|
|
150
150
|
code reduction: 20.1 %
|
|
@@ -153,7 +153,7 @@ dependents: 1
|
|
|
153
153
|
|
|
154
154
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
155
155
|
file: /src/consts/index.ts
|
|
156
|
-
bundle space: 0.
|
|
156
|
+
bundle space: 0.33 %
|
|
157
157
|
rendered size: 315 Bytes
|
|
158
158
|
original size: 390 Bytes
|
|
159
159
|
code reduction: 19.23 %
|
|
@@ -167,7 +167,7 @@ dependents: 6
|
|
|
167
167
|
|
|
168
168
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
169
169
|
file: /src/helpers/validTypeIDValue.ts
|
|
170
|
-
bundle space: 0.
|
|
170
|
+
bundle space: 0.33 %
|
|
171
171
|
rendered size: 309 Bytes
|
|
172
172
|
original size: 426 Bytes
|
|
173
173
|
code reduction: 27.46 %
|
|
@@ -185,7 +185,7 @@ dependents: 1
|
|
|
185
185
|
|
|
186
186
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
187
187
|
file: /src/helpers/isLastResponseChunk.ts
|
|
188
|
-
bundle space: 0.
|
|
188
|
+
bundle space: 0.16 %
|
|
189
189
|
rendered size: 156 Bytes
|
|
190
190
|
original size: 304 Bytes
|
|
191
191
|
code reduction: 48.68 %
|
|
@@ -194,7 +194,7 @@ dependents: 1
|
|
|
194
194
|
|
|
195
195
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
196
196
|
file: /src/helpers/isNotLastResponseChunk.ts
|
|
197
|
-
bundle space: 0.
|
|
197
|
+
bundle space: 0.14 %
|
|
198
198
|
rendered size: 133 Bytes
|
|
199
199
|
original size: 278 Bytes
|
|
200
200
|
code reduction: 52.16 %
|
|
@@ -18,6 +18,7 @@ function logCacheEntry() {
|
|
|
18
18
|
return new Promise(async resolve => {
|
|
19
19
|
const {
|
|
20
20
|
debugManager,
|
|
21
|
+
requestFieldCacheKey,
|
|
21
22
|
...otherContext
|
|
22
23
|
} = args[5];
|
|
23
24
|
|
|
@@ -32,7 +33,7 @@ function logCacheEntry() {
|
|
|
32
33
|
const endTime = debugManager.now();
|
|
33
34
|
const duration = endTime - startTime;
|
|
34
35
|
resolve();
|
|
35
|
-
|
|
36
|
+
const payload = {
|
|
36
37
|
cachemapOptions: args[3],
|
|
37
38
|
cacheType: args[0],
|
|
38
39
|
context: otherContext,
|
|
@@ -43,8 +44,12 @@ function logCacheEntry() {
|
|
|
43
44
|
endTime,
|
|
44
45
|
startTime
|
|
45
46
|
},
|
|
46
|
-
value: args[2]
|
|
47
|
-
|
|
47
|
+
value: args[2],
|
|
48
|
+
...(requestFieldCacheKey ? {
|
|
49
|
+
decryptedCacheKey: requestFieldCacheKey
|
|
50
|
+
} : {})
|
|
51
|
+
};
|
|
52
|
+
debugManager.emit(_consts.CACHE_ENTRY_ADDED, payload);
|
|
48
53
|
});
|
|
49
54
|
};
|
|
50
55
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/debug/log-cache-entry/index.ts"],"names":["logCacheEntry","_target","_propertyName","descriptor","method","value","descriptorValue","args","Promise","resolve","debugManager","otherContext","apply","startTime","now","endTime","duration","
|
|
1
|
+
{"version":3,"sources":["../../../../src/debug/log-cache-entry/index.ts"],"names":["logCacheEntry","_target","_propertyName","descriptor","method","value","descriptorValue","args","Promise","resolve","debugManager","requestFieldCacheKey","otherContext","apply","startTime","now","endTime","duration","payload","cachemapOptions","cacheType","context","hash","options","stats","decryptedCacheKey","emit","CACHE_ENTRY_ADDED"],"mappings":";;;;;;;;;AACA;;AAEe,SAASA,aAAT,GAAyB;AACtC,SAAO,CACLC,OADK,EAELC,aAFK,EAGLC,UAHK,KAII;AACT,UAAMC,MAAM,GAAGD,UAAU,CAACE,KAA1B;AACA,QAAI,CAACD,MAAL,EAAa;;AAEbD,IAAAA,UAAU,CAACE,KAAX,GAAmB,eAAeC,eAAf,CAA+B,GAAGC,IAAlC,EAA6D;AAC9E,aAAO,IAAIC,OAAJ,CAAkB,MAAMC,OAAN,IAAiB;AACxC,cAAM;AAAEC,UAAAA,YAAF;AAAgBC,UAAAA,oBAAhB;AAAsC,aAAGC;AAAzC,YAA0DL,IAAI,CAAC,CAAD,CAApE;;AAIA,YAAI,CAACG,YAAL,EAAmB;AACjB,gBAAMN,MAAM,CAACS,KAAP,CAAa,IAAb,EAAmBN,IAAnB,CAAN;AACAE,UAAAA,OAAO;AACP;AACD;;AAED,cAAMK,SAAS,GAAGJ,YAAY,CAACK,GAAb,EAAlB;AACA,cAAMX,MAAM,CAACS,KAAP,CAAa,IAAb,EAAmBN,IAAnB,CAAN;AACA,cAAMS,OAAO,GAAGN,YAAY,CAACK,GAAb,EAAhB;AACA,cAAME,QAAQ,GAAGD,OAAO,GAAGF,SAA3B;AACAL,QAAAA,OAAO;AAEP,cAAMS,OAAO,GAAG;AACdC,UAAAA,eAAe,EAAEZ,IAAI,CAAC,CAAD,CADP;AAEda,UAAAA,SAAS,EAAEb,IAAI,CAAC,CAAD,CAFD;AAGdc,UAAAA,OAAO,EAAET,YAHK;AAIdU,UAAAA,IAAI,EAAEf,IAAI,CAAC,CAAD,CAJI;AAKdgB,UAAAA,OAAO,EAAEhB,IAAI,CAAC,CAAD,CALC;AAMdiB,UAAAA,KAAK,EAAE;AAAEP,YAAAA,QAAF;AAAYD,YAAAA,OAAZ;AAAqBF,YAAAA;AAArB,WANO;AAOdT,UAAAA,KAAK,EAAEE,IAAI,CAAC,CAAD,CAPG;AAQd,cAAII,oBAAoB,GAAG;AAAEc,YAAAA,iBAAiB,EAAEd;AAArB,WAAH,GAAiD,EAAzE;AARc,SAAhB;AAWAD,QAAAA,YAAY,CAACgB,IAAb,CAAkBC,yBAAlB,EAAqCT,OAArC;AACD,OA7BM,CAAP;AA8BD,KA/BD;AAgCD,GAxCD;AAyCD","sourcesContent":["import { RequestContext } from \"@graphql-box/core\";\nimport { CACHE_ENTRY_ADDED } from \"../../consts\";\n\nexport default function logCacheEntry() {\n return (\n _target: any,\n _propertyName: string,\n descriptor: TypedPropertyDescriptor<(...args: any[]) => Promise<any>>,\n ): void => {\n const method = descriptor.value;\n if (!method) return;\n\n descriptor.value = async function descriptorValue(...args: any[]): Promise<any> {\n return new Promise<void>(async resolve => {\n const { debugManager, requestFieldCacheKey, ...otherContext } = args[5] as RequestContext & {\n requestFieldCacheKey?: string;\n };\n\n if (!debugManager) {\n await method.apply(this, args);\n resolve();\n return;\n }\n\n const startTime = debugManager.now();\n await method.apply(this, args);\n const endTime = debugManager.now();\n const duration = endTime - startTime;\n resolve();\n\n const payload = {\n cachemapOptions: args[3],\n cacheType: args[0],\n context: otherContext,\n hash: args[1],\n options: args[4],\n stats: { duration, endTime, startTime },\n value: args[2],\n ...(requestFieldCacheKey ? { decryptedCacheKey: requestFieldCacheKey } : {}),\n };\n\n debugManager.emit(CACHE_ENTRY_ADDED, payload);\n });\n };\n };\n}\n"],"file":"index.js"}
|
|
@@ -19,6 +19,7 @@ function logCacheQuery() {
|
|
|
19
19
|
return new Promise(async resolve => {
|
|
20
20
|
const {
|
|
21
21
|
debugManager,
|
|
22
|
+
requestFieldCacheKey,
|
|
22
23
|
...otherContext
|
|
23
24
|
} = args[3];
|
|
24
25
|
|
|
@@ -32,7 +33,7 @@ function logCacheQuery() {
|
|
|
32
33
|
const endTime = debugManager.now();
|
|
33
34
|
const duration = endTime - startTime;
|
|
34
35
|
resolve(result);
|
|
35
|
-
|
|
36
|
+
const payload = {
|
|
36
37
|
cacheType: args[0],
|
|
37
38
|
context: otherContext,
|
|
38
39
|
hash: args[1],
|
|
@@ -42,8 +43,12 @@ function logCacheQuery() {
|
|
|
42
43
|
duration,
|
|
43
44
|
endTime,
|
|
44
45
|
startTime
|
|
45
|
-
}
|
|
46
|
-
|
|
46
|
+
},
|
|
47
|
+
...(requestFieldCacheKey ? {
|
|
48
|
+
decryptedCacheKey: requestFieldCacheKey
|
|
49
|
+
} : {})
|
|
50
|
+
};
|
|
51
|
+
debugManager.emit(_consts.CACHE_ENTRY_QUERIED, payload);
|
|
47
52
|
});
|
|
48
53
|
} catch (error) {
|
|
49
54
|
return Promise.reject(error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/debug/log-cache-query/index.ts"],"names":["logCacheQuery","_target","_propertyName","descriptor","method","value","descriptorValue","args","Promise","resolve","debugManager","otherContext","apply","startTime","now","result","endTime","duration","
|
|
1
|
+
{"version":3,"sources":["../../../../src/debug/log-cache-query/index.ts"],"names":["logCacheQuery","_target","_propertyName","descriptor","method","value","descriptorValue","args","Promise","resolve","debugManager","requestFieldCacheKey","otherContext","apply","startTime","now","result","endTime","duration","payload","cacheType","context","hash","options","stats","decryptedCacheKey","emit","CACHE_ENTRY_QUERIED","error","reject"],"mappings":";;;;;;;;;AACA;;AAEe,SAASA,aAAT,GAAyB;AACtC,SAAO,CACLC,OADK,EAELC,aAFK,EAGLC,UAHK,KAII;AACT,UAAMC,MAAM,GAAGD,UAAU,CAACE,KAA1B;AACA,QAAI,CAACD,MAAL,EAAa;;AAEbD,IAAAA,UAAU,CAACE,KAAX,GAAmB,eAAeC,eAAf,CAA+B,GAAGC,IAAlC,EAA6D;AAC9E,UAAI;AACF,eAAO,IAAIC,OAAJ,CAAY,MAAMC,OAAN,IAAiB;AAClC,gBAAM;AAAEC,YAAAA,YAAF;AAAgBC,YAAAA,oBAAhB;AAAsC,eAAGC;AAAzC,cAA0DL,IAAI,CAAC,CAAD,CAApE;;AAIA,cAAI,CAACG,YAAL,EAAmB;AACjBD,YAAAA,OAAO,CAAC,MAAML,MAAM,CAACS,KAAP,CAAa,IAAb,EAAmBN,IAAnB,CAAP,CAAP;AACA;AACD;;AAED,gBAAMO,SAAS,GAAGJ,YAAY,CAACK,GAAb,EAAlB;AACA,gBAAMC,MAAM,GAAG,MAAMZ,MAAM,CAACS,KAAP,CAAa,IAAb,EAAmBN,IAAnB,CAArB;AACA,gBAAMU,OAAO,GAAGP,YAAY,CAACK,GAAb,EAAhB;AACA,gBAAMG,QAAQ,GAAGD,OAAO,GAAGH,SAA3B;AACAL,UAAAA,OAAO,CAACO,MAAD,CAAP;AAEA,gBAAMG,OAAO,GAAG;AACdC,YAAAA,SAAS,EAAEb,IAAI,CAAC,CAAD,CADD;AAEdc,YAAAA,OAAO,EAAET,YAFK;AAGdU,YAAAA,IAAI,EAAEf,IAAI,CAAC,CAAD,CAHI;AAIdgB,YAAAA,OAAO,EAAEhB,IAAI,CAAC,CAAD,CAJC;AAKdS,YAAAA,MALc;AAMdQ,YAAAA,KAAK,EAAE;AAAEN,cAAAA,QAAF;AAAYD,cAAAA,OAAZ;AAAqBH,cAAAA;AAArB,aANO;AAOd,gBAAIH,oBAAoB,GAAG;AAAEc,cAAAA,iBAAiB,EAAEd;AAArB,aAAH,GAAiD,EAAzE;AAPc,WAAhB;AAUAD,UAAAA,YAAY,CAACgB,IAAb,CAAkBC,2BAAlB,EAAuCR,OAAvC;AACD,SA3BM,CAAP;AA4BD,OA7BD,CA6BE,OAAOS,KAAP,EAAc;AACd,eAAOpB,OAAO,CAACqB,MAAR,CAAeD,KAAf,CAAP;AACD;AACF,KAjCD;AAkCD,GA1CD;AA2CD","sourcesContent":["import { RequestContext } from \"@graphql-box/core\";\nimport { CACHE_ENTRY_QUERIED } from \"../../consts\";\n\nexport default function logCacheQuery() {\n return (\n _target: any,\n _propertyName: string,\n descriptor: TypedPropertyDescriptor<(...args: any[]) => Promise<any>>,\n ): void => {\n const method = descriptor.value;\n if (!method) return;\n\n descriptor.value = async function descriptorValue(...args: any[]): Promise<any> {\n try {\n return new Promise(async resolve => {\n const { debugManager, requestFieldCacheKey, ...otherContext } = args[3] as RequestContext & {\n requestFieldCacheKey?: string;\n };\n\n if (!debugManager) {\n resolve(await method.apply(this, args));\n return;\n }\n\n const startTime = debugManager.now();\n const result = await method.apply(this, args);\n const endTime = debugManager.now();\n const duration = endTime - startTime;\n resolve(result);\n\n const payload = {\n cacheType: args[0],\n context: otherContext,\n hash: args[1],\n options: args[2],\n result,\n stats: { duration, endTime, startTime },\n ...(requestFieldCacheKey ? { decryptedCacheKey: requestFieldCacheKey } : {}),\n };\n\n debugManager.emit(CACHE_ENTRY_QUERIED, payload);\n });\n } catch (error) {\n return Promise.reject(error);\n }\n };\n };\n}\n"],"file":"index.js"}
|
package/lib/main/main/index.js
CHANGED
|
@@ -368,6 +368,7 @@ let CacheManager = (_dec = (0, _debug.logCacheQuery)(), _dec2 = (0, _debug.logCa
|
|
|
368
368
|
const {
|
|
369
369
|
hashedRequestFieldCacheKey,
|
|
370
370
|
propNameOrIndex,
|
|
371
|
+
requestFieldCacheKey,
|
|
371
372
|
requestFieldPath
|
|
372
373
|
} = keysAndPaths;
|
|
373
374
|
const fieldTypeInfo = context.fieldTypeMap.get(requestFieldPath);
|
|
@@ -389,7 +390,7 @@ let CacheManager = (_dec = (0, _debug.logCacheQuery)(), _dec2 = (0, _debug.logCa
|
|
|
389
390
|
const {
|
|
390
391
|
cacheability,
|
|
391
392
|
entry
|
|
392
|
-
} = await this._retrieveCachedRequestFieldPathData(hashedRequestFieldCacheKey, options, context);
|
|
393
|
+
} = await this._retrieveCachedRequestFieldPathData(hashedRequestFieldCacheKey, requestFieldCacheKey, options, context);
|
|
393
394
|
|
|
394
395
|
CacheManager._setCachedResponseData({
|
|
395
396
|
cacheability,
|
|
@@ -742,7 +743,8 @@ let CacheManager = (_dec = (0, _debug.logCacheQuery)(), _dec2 = (0, _debug.logCa
|
|
|
742
743
|
requestFieldPathData: ancestorRequestFieldPathData
|
|
743
744
|
}, {
|
|
744
745
|
hashedRequestFieldCacheKey,
|
|
745
|
-
propNameOrIndex
|
|
746
|
+
propNameOrIndex,
|
|
747
|
+
requestFieldCacheKey
|
|
746
748
|
}, fieldTypeInfo, options, context) {
|
|
747
749
|
var _entityData;
|
|
748
750
|
|
|
@@ -756,7 +758,7 @@ let CacheManager = (_dec = (0, _debug.logCacheQuery)(), _dec2 = (0, _debug.logCa
|
|
|
756
758
|
const {
|
|
757
759
|
cacheability: entryCacheability,
|
|
758
760
|
entry
|
|
759
|
-
} = await this._retrieveCachedRequestFieldPathData(hashedRequestFieldCacheKey, options, context);
|
|
761
|
+
} = await this._retrieveCachedRequestFieldPathData(hashedRequestFieldCacheKey, requestFieldCacheKey, options, context);
|
|
760
762
|
|
|
761
763
|
if (entry) {
|
|
762
764
|
requestFieldPathData = this._mergeObjects(requestFieldPathData, entry);
|
|
@@ -795,8 +797,10 @@ let CacheManager = (_dec = (0, _debug.logCacheQuery)(), _dec2 = (0, _debug.logCa
|
|
|
795
797
|
};
|
|
796
798
|
}
|
|
797
799
|
|
|
798
|
-
async _retrieveCachedRequestFieldPathData(hash, options, context) {
|
|
799
|
-
return this._checkCacheEntry(_core.REQUEST_FIELD_PATHS, hash, options, context
|
|
800
|
+
async _retrieveCachedRequestFieldPathData(hash, requestFieldCacheKey, options, context) {
|
|
801
|
+
return this._checkCacheEntry(_core.REQUEST_FIELD_PATHS, hash, options, { ...context,
|
|
802
|
+
requestFieldCacheKey
|
|
803
|
+
}) || {};
|
|
800
804
|
}
|
|
801
805
|
|
|
802
806
|
async _retrieveCachedResponseData({
|
|
@@ -1018,6 +1022,7 @@ let CacheManager = (_dec = (0, _debug.logCacheQuery)(), _dec2 = (0, _debug.logCa
|
|
|
1018
1022
|
}, options, context) {
|
|
1019
1023
|
const {
|
|
1020
1024
|
hashedRequestFieldCacheKey,
|
|
1025
|
+
requestFieldCacheKey,
|
|
1021
1026
|
responseDataPath
|
|
1022
1027
|
} = keysAndPaths;
|
|
1023
1028
|
let fieldData = (0, _get2.default)(data, responseDataPath);
|
|
@@ -1033,7 +1038,9 @@ let CacheManager = (_dec = (0, _debug.logCacheQuery)(), _dec2 = (0, _debug.logCa
|
|
|
1033
1038
|
fieldData = (0, _filterOutPropsWithArgsOrDirectives.default)(fieldData, field.selectionSet.selections, keysAndPaths, context);
|
|
1034
1039
|
}
|
|
1035
1040
|
|
|
1036
|
-
const result = await this._checkCacheEntry(_core.REQUEST_FIELD_PATHS, hashedRequestFieldCacheKey, options, context
|
|
1041
|
+
const result = await this._checkCacheEntry(_core.REQUEST_FIELD_PATHS, hashedRequestFieldCacheKey, options, { ...context,
|
|
1042
|
+
requestFieldCacheKey
|
|
1043
|
+
});
|
|
1037
1044
|
|
|
1038
1045
|
if (result && (0, _isObjectLike2.default)(fieldData)) {
|
|
1039
1046
|
fieldData = this._mergeObjects(result.entry, fieldData);
|
|
@@ -1044,7 +1051,9 @@ let CacheManager = (_dec = (0, _debug.logCacheQuery)(), _dec2 = (0, _debug.logCa
|
|
|
1044
1051
|
cacheControl: cacheability.printCacheControl()
|
|
1045
1052
|
},
|
|
1046
1053
|
tag: options.tag
|
|
1047
|
-
}, options, context
|
|
1054
|
+
}, options, { ...context,
|
|
1055
|
+
requestFieldCacheKey
|
|
1056
|
+
});
|
|
1048
1057
|
|
|
1049
1058
|
if ((0, _helpers.hasChildFields)(field, {
|
|
1050
1059
|
fragmentDefinitions: context.fragmentDefinitions
|