@graphql-box/cache-manager 2.4.1 → 3.0.0
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 +64 -28
- package/lib/main/helpers/isFirstResponseChunk.js +11 -0
- package/lib/main/helpers/isFirstResponseChunk.js.map +1 -0
- package/lib/main/helpers/isLastResponseChunk.js +11 -0
- package/lib/main/helpers/isLastResponseChunk.js.map +1 -0
- package/lib/main/helpers/isNotLastResponseChunk.js +11 -0
- package/lib/main/helpers/isNotLastResponseChunk.js.map +1 -0
- package/lib/main/helpers/isNotResponseChunk.js +11 -0
- package/lib/main/helpers/isNotResponseChunk.js.map +1 -0
- package/lib/main/helpers/mergeResponseDataSets.js +53 -0
- package/lib/main/helpers/mergeResponseDataSets.js.map +1 -0
- package/lib/main/helpers/{normalizeResponseData.js → normalizePatchResponseData.js} +11 -6
- package/lib/main/helpers/normalizePatchResponseData.js.map +1 -0
- package/lib/main/main/index.js +145 -121
- package/lib/main/main/index.js.map +1 -1
- package/lib/module/helpers/isFirstResponseChunk.js +2 -0
- package/lib/module/helpers/isFirstResponseChunk.js.map +1 -0
- package/lib/module/helpers/isLastResponseChunk.js +2 -0
- package/lib/module/helpers/isLastResponseChunk.js.map +1 -0
- package/lib/module/helpers/isNotLastResponseChunk.js +2 -0
- package/lib/module/helpers/isNotLastResponseChunk.js.map +1 -0
- package/lib/module/helpers/isNotResponseChunk.js +2 -0
- package/lib/module/helpers/isNotResponseChunk.js.map +1 -0
- package/lib/module/helpers/mergeResponseDataSets.js +41 -0
- package/lib/module/helpers/mergeResponseDataSets.js.map +1 -0
- package/lib/module/helpers/normalizePatchResponseData.js +17 -0
- package/lib/module/helpers/normalizePatchResponseData.js.map +1 -0
- package/lib/module/main/index.js +143 -122
- package/lib/module/main/index.js.map +1 -1
- package/lib/types/defs/index.d.ts +3 -10
- package/lib/types/defs/index.d.ts.map +1 -1
- package/lib/types/helpers/isFirstResponseChunk.d.ts +5 -0
- package/lib/types/helpers/isFirstResponseChunk.d.ts.map +1 -0
- package/lib/types/helpers/isLastResponseChunk.d.ts +5 -0
- package/lib/types/helpers/isLastResponseChunk.d.ts.map +1 -0
- package/lib/types/helpers/isNotLastResponseChunk.d.ts +5 -0
- package/lib/types/helpers/isNotLastResponseChunk.d.ts.map +1 -0
- package/lib/types/helpers/isNotResponseChunk.d.ts +5 -0
- package/lib/types/helpers/isNotResponseChunk.d.ts.map +1 -0
- package/lib/types/helpers/mergeResponseDataSets.d.ts +4 -0
- package/lib/types/helpers/mergeResponseDataSets.d.ts.map +1 -0
- package/lib/types/helpers/normalizePatchResponseData.d.ts +5 -0
- package/lib/types/helpers/normalizePatchResponseData.d.ts.map +1 -0
- package/lib/types/main/index.d.ts +7 -5
- package/lib/types/main/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/__snapshots__/index.test.ts.snap +12481 -11881
- package/src/defs/index.ts +14 -22
- package/src/helpers/isFirstResponseChunk.ts +5 -0
- package/src/helpers/isLastResponseChunk.ts +5 -0
- package/src/helpers/isNotLastResponseChunk.ts +5 -0
- package/src/helpers/isNotResponseChunk.ts +5 -0
- package/src/helpers/mergeResponseDataSets.ts +35 -0
- package/src/helpers/normalizePatchResponseData.ts +17 -0
- package/src/index.test.ts +191 -115
- package/src/main/index.ts +172 -134
- package/lib/main/helpers/normalizeResponseData.js.map +0 -1
- package/lib/module/helpers/normalizeResponseData.js +0 -12
- package/lib/module/helpers/normalizeResponseData.js.map +0 -1
- package/lib/types/helpers/normalizeResponseData.d.ts +0 -11
- package/lib/types/helpers/normalizeResponseData.d.ts.map +0 -1
- package/src/helpers/normalizeResponseData.ts +0 -10
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
-----------------------------
|
|
2
2
|
Rollup File Analysis
|
|
3
3
|
-----------------------------
|
|
4
|
-
bundle size:
|
|
5
|
-
original size:
|
|
4
|
+
bundle size: 93.033 KB
|
|
5
|
+
original size: 64.438 KB
|
|
6
6
|
code reduction: 0 %
|
|
7
|
-
module count:
|
|
7
|
+
module count: 25
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
██████████████████████████████████░░░░░░░░░░░░░░░░
|
|
10
10
|
file: /src/main/index.ts
|
|
11
|
-
bundle space:
|
|
12
|
-
rendered size: 64.
|
|
13
|
-
original size:
|
|
11
|
+
bundle space: 69.84 %
|
|
12
|
+
rendered size: 64.975 KB
|
|
13
|
+
original size: 37.778 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: 4.
|
|
20
|
+
bundle space: 4.13 %
|
|
21
21
|
rendered size: 3.839 KB
|
|
22
22
|
original size: 1.282 KB
|
|
23
23
|
code reduction: 0 %
|
|
@@ -26,7 +26,7 @@ dependents: 1
|
|
|
26
26
|
|
|
27
27
|
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
28
28
|
file: /src/debug/log-cache-entry/index.ts
|
|
29
|
-
bundle space: 3.
|
|
29
|
+
bundle space: 3.71 %
|
|
30
30
|
rendered size: 3.451 KB
|
|
31
31
|
original size: 1.197 KB
|
|
32
32
|
code reduction: 0 %
|
|
@@ -35,7 +35,7 @@ dependents: 1
|
|
|
35
35
|
|
|
36
36
|
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
37
37
|
file: /src/debug/log-partial-compiled/index.ts
|
|
38
|
-
bundle space: 3.
|
|
38
|
+
bundle space: 3.62 %
|
|
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: 3.
|
|
47
|
+
bundle space: 3.05 %
|
|
48
48
|
rendered size: 2.834 KB
|
|
49
49
|
original size: 2.914 KB
|
|
50
50
|
code reduction: 2.75 %
|
|
@@ -54,7 +54,7 @@ dependents: 2
|
|
|
54
54
|
|
|
55
55
|
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
56
56
|
file: /src/helpers/buildKeysAndPaths.ts
|
|
57
|
-
bundle space: 2.
|
|
57
|
+
bundle space: 2.65 %
|
|
58
58
|
rendered size: 2.461 KB
|
|
59
59
|
original size: 2.196 KB
|
|
60
60
|
code reduction: 0 %
|
|
@@ -64,9 +64,18 @@ dependents: 4
|
|
|
64
64
|
- /src/helpers/filterQuery.ts
|
|
65
65
|
- /src/main/index.ts
|
|
66
66
|
|
|
67
|
+
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
68
|
+
file: /src/helpers/mergeResponseDataSets.ts
|
|
69
|
+
bundle space: 1.84 %
|
|
70
|
+
rendered size: 1.716 KB
|
|
71
|
+
original size: 907 Bytes
|
|
72
|
+
code reduction: 0 %
|
|
73
|
+
dependents: 1
|
|
74
|
+
- /src/main/index.ts
|
|
75
|
+
|
|
67
76
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
68
77
|
file: /src/helpers/filterFragmentDefinitions.ts
|
|
69
|
-
bundle space: 1.
|
|
78
|
+
bundle space: 1.55 %
|
|
70
79
|
rendered size: 1.441 KB
|
|
71
80
|
original size: 1.5 KB
|
|
72
81
|
code reduction: 3.93 %
|
|
@@ -74,17 +83,17 @@ dependents: 1
|
|
|
74
83
|
- /src/helpers/filterQuery.ts
|
|
75
84
|
|
|
76
85
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
77
|
-
file: /src/helpers/
|
|
78
|
-
bundle space: 1.
|
|
79
|
-
rendered size: 1.
|
|
80
|
-
original size:
|
|
86
|
+
file: /src/helpers/normalizePatchResponseData.ts
|
|
87
|
+
bundle space: 1.41 %
|
|
88
|
+
rendered size: 1.309 KB
|
|
89
|
+
original size: 478 Bytes
|
|
81
90
|
code reduction: 0 %
|
|
82
91
|
dependents: 1
|
|
83
92
|
- /src/main/index.ts
|
|
84
93
|
|
|
85
94
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
86
95
|
file: /src/helpers/filterQuery.ts
|
|
87
|
-
bundle space: 1.
|
|
96
|
+
bundle space: 1.17 %
|
|
88
97
|
rendered size: 1.088 KB
|
|
89
98
|
original size: 1.467 KB
|
|
90
99
|
code reduction: 25.84 %
|
|
@@ -93,7 +102,7 @@ dependents: 1
|
|
|
93
102
|
|
|
94
103
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
95
104
|
file: /src/helpers/filterIDsAndTypeNames.ts
|
|
96
|
-
bundle space: 1.
|
|
105
|
+
bundle space: 1.07 %
|
|
97
106
|
rendered size: 998 Bytes
|
|
98
107
|
original size: 1.107 KB
|
|
99
108
|
code reduction: 9.85 %
|
|
@@ -102,7 +111,7 @@ dependents: 1
|
|
|
102
111
|
|
|
103
112
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
104
113
|
file: /src/helpers/checkFieldPathChecklist.ts
|
|
105
|
-
bundle space: 1.
|
|
114
|
+
bundle space: 1.03 %
|
|
106
115
|
rendered size: 957 Bytes
|
|
107
116
|
original size: 828 Bytes
|
|
108
117
|
code reduction: 0 %
|
|
@@ -111,7 +120,7 @@ dependents: 1
|
|
|
111
120
|
|
|
112
121
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
113
122
|
file: /src/helpers/filterOutPropsWithArgsOrDirectives.ts
|
|
114
|
-
bundle space: 1
|
|
123
|
+
bundle space: 1 %
|
|
115
124
|
rendered size: 927 Bytes
|
|
116
125
|
original size: 1.119 KB
|
|
117
126
|
code reduction: 17.16 %
|
|
@@ -120,7 +129,7 @@ dependents: 1
|
|
|
120
129
|
|
|
121
130
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
122
131
|
file: /src/helpers/filterInlineFragments.ts
|
|
123
|
-
bundle space: 0.
|
|
132
|
+
bundle space: 0.85 %
|
|
124
133
|
rendered size: 788 Bytes
|
|
125
134
|
original size: 941 Bytes
|
|
126
135
|
code reduction: 16.26 %
|
|
@@ -129,7 +138,7 @@ dependents: 1
|
|
|
129
138
|
|
|
130
139
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
131
140
|
file: /src/helpers/deriveOpCacheability.ts
|
|
132
|
-
bundle space: 0.
|
|
141
|
+
bundle space: 0.84 %
|
|
133
142
|
rendered size: 786 Bytes
|
|
134
143
|
original size: 858 Bytes
|
|
135
144
|
code reduction: 8.39 %
|
|
@@ -138,7 +147,7 @@ dependents: 1
|
|
|
138
147
|
|
|
139
148
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
140
149
|
file: /src/helpers/filterFragmentSpreads.ts
|
|
141
|
-
bundle space: 0.
|
|
150
|
+
bundle space: 0.71 %
|
|
142
151
|
rendered size: 661 Bytes
|
|
143
152
|
original size: 936 Bytes
|
|
144
153
|
code reduction: 29.38 %
|
|
@@ -147,7 +156,7 @@ dependents: 1
|
|
|
147
156
|
|
|
148
157
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
149
158
|
file: /src/helpers/createFragmentSpreadChecklist.ts
|
|
150
|
-
bundle space: 0.
|
|
159
|
+
bundle space: 0.39 %
|
|
151
160
|
rendered size: 362 Bytes
|
|
152
161
|
original size: 470 Bytes
|
|
153
162
|
code reduction: 22.98 %
|
|
@@ -156,7 +165,7 @@ dependents: 1
|
|
|
156
165
|
|
|
157
166
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
158
167
|
file: /src/consts/index.ts
|
|
159
|
-
bundle space: 0.
|
|
168
|
+
bundle space: 0.34 %
|
|
160
169
|
rendered size: 315 Bytes
|
|
161
170
|
original size: 390 Bytes
|
|
162
171
|
code reduction: 19.23 %
|
|
@@ -170,18 +179,45 @@ dependents: 6
|
|
|
170
179
|
|
|
171
180
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
172
181
|
file: /src/helpers/validTypeIDValue.ts
|
|
173
|
-
bundle space: 0.
|
|
182
|
+
bundle space: 0.33 %
|
|
174
183
|
rendered size: 309 Bytes
|
|
175
184
|
original size: 426 Bytes
|
|
176
185
|
code reduction: 27.46 %
|
|
177
186
|
dependents: 1
|
|
178
187
|
- /src/main/index.ts
|
|
179
188
|
|
|
189
|
+
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
190
|
+
file: /src/helpers/isNotResponseChunk.ts
|
|
191
|
+
bundle space: 0.17 %
|
|
192
|
+
rendered size: 157 Bytes
|
|
193
|
+
original size: 306 Bytes
|
|
194
|
+
code reduction: 48.69 %
|
|
195
|
+
dependents: 1
|
|
196
|
+
- /src/main/index.ts
|
|
197
|
+
|
|
198
|
+
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
199
|
+
file: /src/helpers/isLastResponseChunk.ts
|
|
200
|
+
bundle space: 0.17 %
|
|
201
|
+
rendered size: 156 Bytes
|
|
202
|
+
original size: 304 Bytes
|
|
203
|
+
code reduction: 48.68 %
|
|
204
|
+
dependents: 1
|
|
205
|
+
- /src/main/index.ts
|
|
206
|
+
|
|
207
|
+
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
208
|
+
file: /src/helpers/isNotLastResponseChunk.ts
|
|
209
|
+
bundle space: 0.14 %
|
|
210
|
+
rendered size: 133 Bytes
|
|
211
|
+
original size: 278 Bytes
|
|
212
|
+
code reduction: 52.16 %
|
|
213
|
+
dependents: 1
|
|
214
|
+
- /src/main/index.ts
|
|
215
|
+
|
|
180
216
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
181
217
|
file: /src/defs/index.ts
|
|
182
218
|
bundle space: 0 %
|
|
183
219
|
rendered size: 0 Byte
|
|
184
|
-
original size: 5.
|
|
220
|
+
original size: 5.215 KB
|
|
185
221
|
code reduction: 100 %
|
|
186
222
|
dependents: 1
|
|
187
223
|
- /src/index.ts
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _default = (rawResponseData, context) => context.hasDeferOrStream && rawResponseData.hasNext && !rawResponseData.paths;
|
|
9
|
+
|
|
10
|
+
exports.default = _default;
|
|
11
|
+
//# sourceMappingURL=isFirstResponseChunk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/helpers/isFirstResponseChunk.ts"],"names":["rawResponseData","context","hasDeferOrStream","hasNext","paths"],"mappings":";;;;;;;eAGe,CAACA,eAAD,EAAyDC,OAAzD,KACbA,OAAO,CAACC,gBAAR,IAA4BF,eAAe,CAACG,OAA5C,IAAuD,CAACH,eAAe,CAACI,K","sourcesContent":["import { RawResponseDataWithMaybeCacheMetadata } from \"@graphql-box/core\";\nimport { CacheManagerContext } from \"..\";\n\nexport default (rawResponseData: RawResponseDataWithMaybeCacheMetadata, context: CacheManagerContext) =>\n context.hasDeferOrStream && rawResponseData.hasNext && !rawResponseData.paths;\n"],"file":"isFirstResponseChunk.js"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _default = (rawResponseData, context) => context.hasDeferOrStream && !rawResponseData.hasNext && rawResponseData.paths;
|
|
9
|
+
|
|
10
|
+
exports.default = _default;
|
|
11
|
+
//# sourceMappingURL=isLastResponseChunk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/helpers/isLastResponseChunk.ts"],"names":["rawResponseData","context","hasDeferOrStream","hasNext","paths"],"mappings":";;;;;;;eAGe,CAACA,eAAD,EAAyDC,OAAzD,KACbA,OAAO,CAACC,gBAAR,IAA4B,CAACF,eAAe,CAACG,OAA7C,IAAwDH,eAAe,CAACI,K","sourcesContent":["import { RawResponseDataWithMaybeCacheMetadata } from \"@graphql-box/core\";\nimport { CacheManagerContext } from \"..\";\n\nexport default (rawResponseData: RawResponseDataWithMaybeCacheMetadata, context: CacheManagerContext) =>\n context.hasDeferOrStream && !rawResponseData.hasNext && rawResponseData.paths;\n"],"file":"isLastResponseChunk.js"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _default = (rawResponseData, context) => context.hasDeferOrStream && rawResponseData.hasNext;
|
|
9
|
+
|
|
10
|
+
exports.default = _default;
|
|
11
|
+
//# sourceMappingURL=isNotLastResponseChunk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/helpers/isNotLastResponseChunk.ts"],"names":["rawResponseData","context","hasDeferOrStream","hasNext"],"mappings":";;;;;;;eAGe,CAACA,eAAD,EAAyDC,OAAzD,KACbA,OAAO,CAACC,gBAAR,IAA4BF,eAAe,CAACG,O","sourcesContent":["import { RawResponseDataWithMaybeCacheMetadata } from \"@graphql-box/core\";\nimport { CacheManagerContext } from \"..\";\n\nexport default (rawResponseData: RawResponseDataWithMaybeCacheMetadata, context: CacheManagerContext) =>\n context.hasDeferOrStream && rawResponseData.hasNext;\n"],"file":"isNotLastResponseChunk.js"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _default = (rawResponseData, context) => !context.hasDeferOrStream && !rawResponseData.hasNext && !rawResponseData.paths;
|
|
9
|
+
|
|
10
|
+
exports.default = _default;
|
|
11
|
+
//# sourceMappingURL=isNotResponseChunk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/helpers/isNotResponseChunk.ts"],"names":["rawResponseData","context","hasDeferOrStream","hasNext","paths"],"mappings":";;;;;;;eAGe,CAACA,eAAD,EAAyDC,OAAzD,KACb,CAACA,OAAO,CAACC,gBAAT,IAA6B,CAACF,eAAe,CAACG,OAA9C,IAAyD,CAACH,eAAe,CAACI,K","sourcesContent":["import { RawResponseDataWithMaybeCacheMetadata } from \"@graphql-box/core\";\nimport { CacheManagerContext } from \"..\";\n\nexport default (rawResponseData: RawResponseDataWithMaybeCacheMetadata, context: CacheManagerContext) =>\n !context.hasDeferOrStream && !rawResponseData.hasNext && !rawResponseData.paths;\n"],"file":"isNotResponseChunk.js"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _merge2 = _interopRequireDefault(require("lodash/merge"));
|
|
11
|
+
|
|
12
|
+
var _default = responseDataSets => {
|
|
13
|
+
return responseDataSets.reduce((acc, dataSet, index) => {
|
|
14
|
+
const {
|
|
15
|
+
_cacheMetadata,
|
|
16
|
+
data,
|
|
17
|
+
hasNext,
|
|
18
|
+
headers,
|
|
19
|
+
paths
|
|
20
|
+
} = dataSet;
|
|
21
|
+
|
|
22
|
+
if (_cacheMetadata) {
|
|
23
|
+
acc._cacheMetadata = acc._cacheMetadata ? { ...acc._cacheMetadata,
|
|
24
|
+
..._cacheMetadata
|
|
25
|
+
} : _cacheMetadata;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
acc.data = acc.data ? (0, _merge2.default)(acc.data, data) : data;
|
|
29
|
+
|
|
30
|
+
if (index === 0) {
|
|
31
|
+
acc.headers = headers;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (index === responseDataSets.length - 1) {
|
|
35
|
+
acc.hasNext = hasNext;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (paths) {
|
|
39
|
+
if (!acc.paths) {
|
|
40
|
+
acc.paths = [];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
acc.paths.push(paths[0]);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return acc;
|
|
47
|
+
}, {
|
|
48
|
+
data: {}
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
exports.default = _default;
|
|
53
|
+
//# sourceMappingURL=mergeResponseDataSets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/helpers/mergeResponseDataSets.ts"],"names":["responseDataSets","reduce","acc","dataSet","index","_cacheMetadata","data","hasNext","headers","paths","length","push"],"mappings":";;;;;;;;;;;eAGgBA,gBAAD,IAA+D;AAC5E,SAAOA,gBAAgB,CAACC,MAAjB,CACL,CAACC,GAAD,EAA6CC,OAA7C,EAAsDC,KAAtD,KAAgE;AAC9D,UAAM;AAAEC,MAAAA,cAAF;AAAkBC,MAAAA,IAAlB;AAAwBC,MAAAA,OAAxB;AAAiCC,MAAAA,OAAjC;AAA0CC,MAAAA;AAA1C,QAAoDN,OAA1D;;AAEA,QAAIE,cAAJ,EAAoB;AAClBH,MAAAA,GAAG,CAACG,cAAJ,GAAqBH,GAAG,CAACG,cAAJ,GAAqB,EAAE,GAAGH,GAAG,CAACG,cAAT;AAAyB,WAAGA;AAA5B,OAArB,GAAoEA,cAAzF;AACD;;AAEDH,IAAAA,GAAG,CAACI,IAAJ,GAAWJ,GAAG,CAACI,IAAJ,GAAW,qBAAMJ,GAAG,CAACI,IAAV,EAAgBA,IAAhB,CAAX,GAAmCA,IAA9C;;AAEA,QAAIF,KAAK,KAAK,CAAd,EAAiB;AACfF,MAAAA,GAAG,CAACM,OAAJ,GAAcA,OAAd;AACD;;AAED,QAAIJ,KAAK,KAAKJ,gBAAgB,CAACU,MAAjB,GAA0B,CAAxC,EAA2C;AACzCR,MAAAA,GAAG,CAACK,OAAJ,GAAcA,OAAd;AACD;;AAED,QAAIE,KAAJ,EAAW;AACT,UAAI,CAACP,GAAG,CAACO,KAAT,EAAgB;AACdP,QAAAA,GAAG,CAACO,KAAJ,GAAY,EAAZ;AACD;;AAEDP,MAAAA,GAAG,CAACO,KAAJ,CAAUE,IAAV,CAAeF,KAAK,CAAC,CAAD,CAApB;AACD;;AAED,WAAOP,GAAP;AACD,GA3BI,EA4BL;AAAEI,IAAAA,IAAI,EAAE;AAAR,GA5BK,CAAP;AA8BD,C","sourcesContent":["import { RawResponseDataWithMaybeCacheMetadata } from \"@graphql-box/core\";\nimport { merge } from \"lodash\";\n\nexport default (responseDataSets: RawResponseDataWithMaybeCacheMetadata[]) => {\n return responseDataSets.reduce(\n (acc: RawResponseDataWithMaybeCacheMetadata, dataSet, index) => {\n const { _cacheMetadata, data, hasNext, headers, paths } = dataSet;\n\n if (_cacheMetadata) {\n acc._cacheMetadata = acc._cacheMetadata ? { ...acc._cacheMetadata, ..._cacheMetadata } : _cacheMetadata;\n }\n\n acc.data = acc.data ? merge(acc.data, data) : data;\n\n if (index === 0) {\n acc.headers = headers;\n }\n\n if (index === responseDataSets.length - 1) {\n acc.hasNext = hasNext;\n }\n\n if (paths) {\n if (!acc.paths) {\n acc.paths = [];\n }\n\n acc.paths.push(paths[0]);\n }\n\n return acc;\n },\n { data: {} },\n );\n};\n"],"file":"mergeResponseDataSets.js"}
|
|
@@ -9,11 +9,16 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _set2 = _interopRequireDefault(require("lodash/set"));
|
|
11
11
|
|
|
12
|
-
var _default = ({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
var _default = (rawResponseData, context) => {
|
|
13
|
+
if (!context.normalizePatchResponseData) {
|
|
14
|
+
return rawResponseData;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
data,
|
|
19
|
+
paths,
|
|
20
|
+
...rest
|
|
21
|
+
} = rawResponseData;
|
|
17
22
|
return { ...rest,
|
|
18
23
|
data: (0, _set2.default)({}, paths[0], data),
|
|
19
24
|
paths
|
|
@@ -21,4 +26,4 @@ var _default = ({
|
|
|
21
26
|
};
|
|
22
27
|
|
|
23
28
|
exports.default = _default;
|
|
24
|
-
//# sourceMappingURL=
|
|
29
|
+
//# sourceMappingURL=normalizePatchResponseData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/helpers/normalizePatchResponseData.ts"],"names":["rawResponseData","context","normalizePatchResponseData","data","paths","rest"],"mappings":";;;;;;;;;;;eAIe,CAACA,eAAD,EAAyDC,OAAzD,KAA0F;AACvG,MAAI,CAACA,OAAO,CAACC,0BAAb,EAAyC;AACvC,WAAOF,eAAP;AACD;;AAED,QAAM;AAAEG,IAAAA,IAAF;AAAQC,IAAAA,KAAR;AAAe,OAAGC;AAAlB,MAA2BL,eAAjC;AAEA,SAAO,EACL,GAAGK,IADE;AAELF,IAAAA,IAAI,EAAE,mBAAI,EAAJ,EAASC,KAAD,CAAoB,CAApB,CAAR,EAAgCD,IAAhC,CAFD;AAGLC,IAAAA;AAHK,GAAP;AAKD,C","sourcesContent":["import { RawResponseDataWithMaybeCacheMetadata } from \"@graphql-box/core\";\nimport { set } from \"lodash\";\nimport { CacheManagerContext } from \"..\";\n\nexport default (rawResponseData: RawResponseDataWithMaybeCacheMetadata, context: CacheManagerContext) => {\n if (!context.normalizePatchResponseData) {\n return rawResponseData;\n }\n\n const { data, paths, ...rest } = rawResponseData;\n\n return {\n ...rest,\n data: set({}, (paths as string[])[0], data),\n paths,\n };\n};\n"],"file":"normalizePatchResponseData.js"}
|