@graphql-box/connection-resolver 5.4.2 → 5.4.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/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/production.analysis.txt +54 -54
- package/dist/types/cjs/helpers/requestAndCachePages.d.cts +4 -2
- package/dist/types/cjs/helpers/requestAndCachePages.d.cts.map +1 -1
- package/dist/types/cjs/helpers/resolveConnection.d.cts +6 -2
- package/dist/types/cjs/helpers/resolveConnection.d.cts.map +1 -1
- package/dist/types/cjs/main/index.d.cts +2 -2
- package/dist/types/cjs/main/index.d.cts.map +1 -1
- package/dist/types/cjs/types.d.cts +10 -4
- package/dist/types/cjs/types.d.cts.map +1 -1
- package/dist/types/esm/helpers/requestAndCachePages.d.ts +4 -2
- package/dist/types/esm/helpers/requestAndCachePages.d.ts.map +1 -1
- package/dist/types/esm/helpers/resolveConnection.d.ts +6 -2
- package/dist/types/esm/helpers/resolveConnection.d.ts.map +1 -1
- package/dist/types/esm/main/index.d.ts +2 -2
- package/dist/types/esm/main/index.d.ts.map +1 -1
- package/dist/types/esm/types.d.ts +10 -4
- package/dist/types/esm/types.d.ts.map +1 -1
- package/dist/types/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +5 -3
- package/src/helpers/requestAndCachePages.ts +16 -2
- package/src/helpers/resolveConnection.ts +18 -1
- package/src/main/index.ts +30 -1
- package/src/types.ts +12 -4
@@ -1,14 +1,23 @@
|
|
1
1
|
-----------------------------
|
2
2
|
Rollup File Analysis
|
3
3
|
-----------------------------
|
4
|
-
bundle size:
|
5
|
-
original size:
|
6
|
-
code reduction:
|
4
|
+
bundle size: 20.289 KB
|
5
|
+
original size: 28.27 KB
|
6
|
+
code reduction: 28.23 %
|
7
7
|
module count: 33
|
8
8
|
|
9
|
-
|
9
|
+
███████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
10
|
+
file: /src/main/index.ts
|
11
|
+
bundle space: 14.88 %
|
12
|
+
rendered size: 3.02 KB
|
13
|
+
original size: 3.435 KB
|
14
|
+
code reduction: 12.08 %
|
15
|
+
dependents: 1
|
16
|
+
- /src/index.ts
|
17
|
+
|
18
|
+
█████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
10
19
|
file: /src/helpers/getStartAndEndIndexes.ts
|
11
|
-
bundle space:
|
20
|
+
bundle space: 11.63 %
|
12
21
|
rendered size: 2.36 KB
|
13
22
|
original size: 2.807 KB
|
14
23
|
code reduction: 15.92 %
|
@@ -17,25 +26,16 @@ dependents: 1
|
|
17
26
|
|
18
27
|
█████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
19
28
|
file: /src/helpers/validateCursor.ts
|
20
|
-
bundle space:
|
29
|
+
bundle space: 10.9 %
|
21
30
|
rendered size: 2.211 KB
|
22
31
|
original size: 2.535 KB
|
23
32
|
code reduction: 12.78 %
|
24
33
|
dependents: 1
|
25
34
|
- /src/main/index.ts
|
26
35
|
|
27
|
-
|
28
|
-
file: /src/main/index.ts
|
29
|
-
bundle space: 10.96 %
|
30
|
-
rendered size: 2.082 KB
|
31
|
-
original size: 2.668 KB
|
32
|
-
code reduction: 21.96 %
|
33
|
-
dependents: 1
|
34
|
-
- /src/index.ts
|
35
|
-
|
36
|
-
█████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
36
|
+
████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
37
37
|
file: /src/helpers/retrieveCachedConnection.ts
|
38
|
-
bundle space:
|
38
|
+
bundle space: 9.86 %
|
39
39
|
rendered size: 2.001 KB
|
40
40
|
original size: 2.519 KB
|
41
41
|
code reduction: 20.56 %
|
@@ -44,35 +44,35 @@ dependents: 1
|
|
44
44
|
|
45
45
|
████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
46
46
|
file: /src/helpers/resolveConnection.ts
|
47
|
-
bundle space: 8.
|
48
|
-
rendered size: 1.
|
49
|
-
original size: 2.
|
50
|
-
code reduction: 38
|
47
|
+
bundle space: 8.66 %
|
48
|
+
rendered size: 1.758 KB
|
49
|
+
original size: 2.9 KB
|
50
|
+
code reduction: 39.38 %
|
51
51
|
dependents: 1
|
52
52
|
- /src/main/index.ts
|
53
53
|
|
54
54
|
███░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
55
55
|
file: /src/helpers/requestAndCachePages.ts
|
56
|
-
bundle space: 6.
|
57
|
-
rendered size: 1.
|
58
|
-
original size: 1.
|
59
|
-
code reduction:
|
56
|
+
bundle space: 6.45 %
|
57
|
+
rendered size: 1.309 KB
|
58
|
+
original size: 1.967 KB
|
59
|
+
code reduction: 33.45 %
|
60
60
|
dependents: 2
|
61
61
|
- /src/helpers/resolveConnection.ts
|
62
62
|
- /src/main/index.ts
|
63
63
|
|
64
|
-
|
64
|
+
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
65
65
|
file: /src/helpers/getStartAndEndPageNumbers.ts
|
66
|
-
bundle space:
|
66
|
+
bundle space: 3.85 %
|
67
67
|
rendered size: 782 Bytes
|
68
68
|
original size: 1.332 KB
|
69
69
|
code reduction: 41.29 %
|
70
70
|
dependents: 1
|
71
71
|
- /src/helpers/getPageNumbersToRequest.ts
|
72
72
|
|
73
|
-
|
73
|
+
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
74
74
|
file: /src/helpers/getInRangeCachedEdges.ts
|
75
|
-
bundle space:
|
75
|
+
bundle space: 3.78 %
|
76
76
|
rendered size: 767 Bytes
|
77
77
|
original size: 979 Bytes
|
78
78
|
code reduction: 21.65 %
|
@@ -82,7 +82,7 @@ dependents: 2
|
|
82
82
|
|
83
83
|
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
84
84
|
file: /src/helpers/retrieveCachedEdgesByPage.ts
|
85
|
-
bundle space: 3.
|
85
|
+
bundle space: 3.6 %
|
86
86
|
rendered size: 730 Bytes
|
87
87
|
original size: 760 Bytes
|
88
88
|
code reduction: 3.95 %
|
@@ -91,7 +91,7 @@ dependents: 1
|
|
91
91
|
|
92
92
|
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
93
93
|
file: /src/helpers/cacheCursors.ts
|
94
|
-
bundle space: 2.
|
94
|
+
bundle space: 2.8 %
|
95
95
|
rendered size: 569 Bytes
|
96
96
|
original size: 726 Bytes
|
97
97
|
code reduction: 21.63 %
|
@@ -100,7 +100,7 @@ dependents: 1
|
|
100
100
|
|
101
101
|
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
102
102
|
file: /src/helpers/getPageNumbersToRequest.ts
|
103
|
-
bundle space: 2.
|
103
|
+
bundle space: 2.77 %
|
104
104
|
rendered size: 562 Bytes
|
105
105
|
original size: 993 Bytes
|
106
106
|
code reduction: 43.4 %
|
@@ -109,7 +109,7 @@ dependents: 1
|
|
109
109
|
|
110
110
|
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
111
111
|
file: /src/helpers/mergeCachedEdges.ts
|
112
|
-
bundle space: 2.
|
112
|
+
bundle space: 2.76 %
|
113
113
|
rendered size: 560 Bytes
|
114
114
|
original size: 538 Bytes
|
115
115
|
code reduction: 0 %
|
@@ -118,16 +118,16 @@ dependents: 1
|
|
118
118
|
|
119
119
|
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
120
120
|
file: /src/helpers/hasPreviousNextPage.ts
|
121
|
-
bundle space: 2.
|
121
|
+
bundle space: 2.48 %
|
122
122
|
rendered size: 503 Bytes
|
123
123
|
original size: 994 Bytes
|
124
124
|
code reduction: 49.4 %
|
125
125
|
dependents: 1
|
126
126
|
- /src/helpers/retrieveCachedConnection.ts
|
127
127
|
|
128
|
-
|
128
|
+
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
129
129
|
file: /src/helpers/makeEntry.ts
|
130
|
-
bundle space:
|
130
|
+
bundle space: 1.88 %
|
131
131
|
rendered size: 381 Bytes
|
132
132
|
original size: 615 Bytes
|
133
133
|
code reduction: 38.05 %
|
@@ -136,7 +136,7 @@ dependents: 1
|
|
136
136
|
|
137
137
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
138
138
|
file: /src/helpers/retrieveEntry.ts
|
139
|
-
bundle space: 1.
|
139
|
+
bundle space: 1.79 %
|
140
140
|
rendered size: 364 Bytes
|
141
141
|
original size: 801 Bytes
|
142
142
|
code reduction: 54.56 %
|
@@ -145,7 +145,7 @@ dependents: 1
|
|
145
145
|
|
146
146
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
147
147
|
file: /src/helpers/getPagesMissingFromCache.ts
|
148
|
-
bundle space: 1.
|
148
|
+
bundle space: 1.35 %
|
149
149
|
rendered size: 274 Bytes
|
150
150
|
original size: 339 Bytes
|
151
151
|
code reduction: 19.17 %
|
@@ -154,7 +154,7 @@ dependents: 1
|
|
154
154
|
|
155
155
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
156
156
|
file: /src/helpers/getCurrentPageStartAndEndIndexes.ts
|
157
|
-
bundle space: 1.
|
157
|
+
bundle space: 1.35 %
|
158
158
|
rendered size: 273 Bytes
|
159
159
|
original size: 592 Bytes
|
160
160
|
code reduction: 53.89 %
|
@@ -163,7 +163,7 @@ dependents: 1
|
|
163
163
|
|
164
164
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
165
165
|
file: /src/helpers/isCursorLast.ts
|
166
|
-
bundle space: 1.
|
166
|
+
bundle space: 1.18 %
|
167
167
|
rendered size: 239 Bytes
|
168
168
|
original size: 525 Bytes
|
169
169
|
code reduction: 54.48 %
|
@@ -172,7 +172,7 @@ dependents: 1
|
|
172
172
|
|
173
173
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
174
174
|
file: /src/helpers/removeConnectionInputOptions.ts
|
175
|
-
bundle space: 1.
|
175
|
+
bundle space: 1.04 %
|
176
176
|
rendered size: 212 Bytes
|
177
177
|
original size: 258 Bytes
|
178
178
|
code reduction: 17.83 %
|
@@ -181,7 +181,7 @@ dependents: 1
|
|
181
181
|
|
182
182
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
183
183
|
file: /src/helpers/getCount.ts
|
184
|
-
bundle space: 1.
|
184
|
+
bundle space: 1.04 %
|
185
185
|
rendered size: 211 Bytes
|
186
186
|
original size: 306 Bytes
|
187
187
|
code reduction: 31.05 %
|
@@ -190,7 +190,7 @@ dependents: 1
|
|
190
190
|
|
191
191
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
192
192
|
file: /src/helpers/getResultsOnLastPage.ts
|
193
|
-
bundle space: 0.
|
193
|
+
bundle space: 0.88 %
|
194
194
|
rendered size: 179 Bytes
|
195
195
|
original size: 270 Bytes
|
196
196
|
code reduction: 33.7 %
|
@@ -199,7 +199,7 @@ dependents: 1
|
|
199
199
|
|
200
200
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
201
201
|
file: /src/helpers/getStartAndEndCursors.ts
|
202
|
-
bundle space: 0.
|
202
|
+
bundle space: 0.73 %
|
203
203
|
rendered size: 148 Bytes
|
204
204
|
original size: 222 Bytes
|
205
205
|
code reduction: 33.33 %
|
@@ -208,7 +208,7 @@ dependents: 1
|
|
208
208
|
|
209
209
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
210
210
|
file: /src/helpers/extractEdges.ts
|
211
|
-
bundle space: 0.
|
211
|
+
bundle space: 0.72 %
|
212
212
|
rendered size: 147 Bytes
|
213
213
|
original size: 210 Bytes
|
214
214
|
code reduction: 30 %
|
@@ -217,7 +217,7 @@ dependents: 1
|
|
217
217
|
|
218
218
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
219
219
|
file: /src/helpers/getIndexesOnLastPage.ts
|
220
|
-
bundle space: 0.
|
220
|
+
bundle space: 0.71 %
|
221
221
|
rendered size: 144 Bytes
|
222
222
|
original size: 224 Bytes
|
223
223
|
code reduction: 35.71 %
|
@@ -229,7 +229,7 @@ dependents: 4
|
|
229
229
|
|
230
230
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
231
231
|
file: /src/helpers/makeEdges.ts
|
232
|
-
bundle space: 0.
|
232
|
+
bundle space: 0.63 %
|
233
233
|
rendered size: 127 Bytes
|
234
234
|
original size: 181 Bytes
|
235
235
|
code reduction: 29.83 %
|
@@ -238,7 +238,7 @@ dependents: 1
|
|
238
238
|
|
239
239
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
240
240
|
file: /src/helpers/isCursorFirst.ts
|
241
|
-
bundle space: 0.
|
241
|
+
bundle space: 0.58 %
|
242
242
|
rendered size: 117 Bytes
|
243
243
|
original size: 285 Bytes
|
244
244
|
code reduction: 58.95 %
|
@@ -247,7 +247,7 @@ dependents: 1
|
|
247
247
|
|
248
248
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
249
249
|
file: /src/helpers/isCursorSupplied.ts
|
250
|
-
bundle space: 0.
|
250
|
+
bundle space: 0.33 %
|
251
251
|
rendered size: 66 Bytes
|
252
252
|
original size: 228 Bytes
|
253
253
|
code reduction: 71.05 %
|
@@ -256,7 +256,7 @@ dependents: 1
|
|
256
256
|
|
257
257
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
258
258
|
file: /src/helpers/isLastPage.ts
|
259
|
-
bundle space: 0.
|
259
|
+
bundle space: 0.31 %
|
260
260
|
rendered size: 63 Bytes
|
261
261
|
original size: 146 Bytes
|
262
262
|
code reduction: 56.85 %
|
@@ -266,7 +266,7 @@ dependents: 2
|
|
266
266
|
|
267
267
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
268
268
|
file: /src/helpers/extractNodes.ts
|
269
|
-
bundle space: 0.
|
269
|
+
bundle space: 0.29 %
|
270
270
|
rendered size: 59 Bytes
|
271
271
|
original size: 119 Bytes
|
272
272
|
code reduction: 50.42 %
|
@@ -275,7 +275,7 @@ dependents: 1
|
|
275
275
|
|
276
276
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
277
277
|
file: /src/helpers/getDirection.ts
|
278
|
-
bundle space: 0.
|
278
|
+
bundle space: 0.29 %
|
279
279
|
rendered size: 59 Bytes
|
280
280
|
original size: 138 Bytes
|
281
281
|
code reduction: 57.25 %
|
@@ -287,7 +287,7 @@ dependents: 4
|
|
287
287
|
|
288
288
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
289
289
|
file: /src/helpers/getCursor.ts
|
290
|
-
bundle space: 0.
|
290
|
+
bundle space: 0.27 %
|
291
291
|
rendered size: 55 Bytes
|
292
292
|
original size: 149 Bytes
|
293
293
|
code reduction: 63.09 %
|
@@ -297,7 +297,7 @@ dependents: 2
|
|
297
297
|
|
298
298
|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
299
299
|
file: /src/helpers/isFirstPage.ts
|
300
|
-
bundle space: 0.
|
300
|
+
bundle space: 0.19 %
|
301
301
|
rendered size: 39 Bytes
|
302
302
|
original size: 57 Bytes
|
303
303
|
code reduction: 31.58 %
|
@@ -1,14 +1,16 @@
|
|
1
1
|
import { type Core } from '@cachemap/core';
|
2
2
|
import { type PlainObject } from '@graphql-box/core';
|
3
|
-
import { type Getters, type Node, type ResourceResolver } from '../types.cts';
|
3
|
+
import { type Getters, type Node, type ResourceResolver, type SetCacheMetadata } from '../types.cts';
|
4
4
|
export type Context<Resource extends PlainObject, ResourceNode extends Node> = {
|
5
5
|
cursorCache: Core;
|
6
|
+
fieldName: string;
|
6
7
|
getters: Getters<Resource, ResourceNode>;
|
7
8
|
groupCursor: string;
|
8
9
|
makeIDCursor: (id: string | number) => string;
|
9
10
|
resourceResolver: ResourceResolver<Resource>;
|
11
|
+
setCacheMetadata: SetCacheMetadata | undefined;
|
10
12
|
};
|
11
|
-
export declare const requestAndCachePages: <Resource extends PlainObject, ResourceNode extends Node>(pages: number[], { cursorCache, getters, groupCursor, makeIDCursor, resourceResolver }: Context<Resource, ResourceNode>) => Promise<{
|
13
|
+
export declare const requestAndCachePages: <Resource extends PlainObject, ResourceNode extends Node>(pages: number[], { cursorCache, fieldName, getters, groupCursor, makeIDCursor, resourceResolver, setCacheMetadata, }: Context<Resource, ResourceNode>) => Promise<{
|
12
14
|
cachedEdges: {
|
13
15
|
edges: {
|
14
16
|
cursor: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"requestAndCachePages.d.cts","sourceRoot":"","sources":["../../../../src/helpers/requestAndCachePages.cts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
1
|
+
{"version":3,"file":"requestAndCachePages.d.cts","sourceRoot":"","sources":["../../../../src/helpers/requestAndCachePages.cts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAIpG,MAAM,MAAM,OAAO,CAAC,QAAQ,SAAS,WAAW,EAAE,YAAY,SAAS,IAAI,IAAI;IAC7E,WAAW,EAAE,IAAI,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,CAAC;IAC9C,gBAAgB,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC7C,gBAAgB,EAAE,gBAAgB,GAAG,SAAS,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAU,QAAQ,SAAS,WAAW,EAAE,YAAY,SAAS,IAAI,SACzF,MAAM,EAAE,uGASZ,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC;;;;;;;;;EA0CnC,CAAC"}
|
@@ -1,15 +1,19 @@
|
|
1
1
|
import { type Core } from '@cachemap/core';
|
2
2
|
import { type PlainObject } from '@graphql-box/core';
|
3
|
-
import { type
|
3
|
+
import { type Logger } from 'winston';
|
4
|
+
import { type ConnectionInputOptions, type Getters, type Node, type ResourceResolver, type SetCacheMetadata } from '../types.cts';
|
4
5
|
export type Context<Resource extends PlainObject, ResourceNode extends Node> = {
|
5
6
|
cursorCache: Core;
|
7
|
+
fieldName: string;
|
6
8
|
getters: Getters<Resource, ResourceNode>;
|
7
9
|
groupCursor: string;
|
10
|
+
logger: Logger | undefined;
|
8
11
|
makeIDCursor: (id: string | number) => string;
|
9
12
|
resourceResolver: ResourceResolver<Resource>;
|
10
13
|
resultsPerPage: number;
|
14
|
+
setCacheMetadata: SetCacheMetadata | undefined;
|
11
15
|
};
|
12
|
-
export declare const resolveConnection: <Resource extends PlainObject, ResourceNode extends Node>(args: PlainObject & ConnectionInputOptions, { cursorCache, getters, groupCursor, makeIDCursor, resourceResolver, resultsPerPage, }: Context<Resource, ResourceNode>) => Promise<{
|
16
|
+
export declare const resolveConnection: <Resource extends PlainObject, ResourceNode extends Node>(args: PlainObject & ConnectionInputOptions, { cursorCache, fieldName, getters, groupCursor, logger, makeIDCursor, resourceResolver, resultsPerPage, setCacheMetadata, }: Context<Resource, ResourceNode>) => Promise<{
|
13
17
|
edges: import("../types.cts").Edge[];
|
14
18
|
errors: Error[];
|
15
19
|
nodes: Node[];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"resolveConnection.d.cts","sourceRoot":"","sources":["../../../../src/helpers/resolveConnection.cts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,KAAK,
|
1
|
+
{"version":3,"file":"resolveConnection.d.cts","sourceRoot":"","sources":["../../../../src/helpers/resolveConnection.cts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACtB,MAAM,aAAa,CAAC;AASrB,MAAM,MAAM,OAAO,CAAC,QAAQ,SAAS,WAAW,EAAE,YAAY,SAAS,IAAI,IAAI;IAC7E,WAAW,EAAE,IAAI,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,CAAC;IAC9C,gBAAgB,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC7C,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,gBAAgB,GAAG,SAAS,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAU,QAAQ,SAAS,WAAW,EAAE,YAAY,SAAS,IAAI,QACvF,WAAW,GAAG,sBAAsB,+HAWvC,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC;;;;;;;;;;;EA0DnC,CAAC"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { type PlainObject } from '@graphql-box/core';
|
2
2
|
import { type GraphQLResolveInfo } from 'graphql';
|
3
|
-
import { type Connection, type ConnectionInputOptions, type ConnectionResolverUserOptions, type Node } from '../types.cts';
|
4
|
-
export declare const makeConnectionResolver: <Source extends PlainObject | undefined, Args extends PlainObject, Ctx extends
|
3
|
+
import { type Connection, type ConnectionInputOptions, type ConnectionResolverUserOptions, type Context, type Node } from '../types.cts';
|
4
|
+
export declare const makeConnectionResolver: <Source extends PlainObject | undefined, Args extends PlainObject, Ctx extends Context, Resource extends PlainObject, ResourceNode extends Node>({ createMakeCursors, createResourceResolver, cursorCache, getters, resolver, resultsPerPage, }: ConnectionResolverUserOptions<Source, Args, Ctx, Resource, ResourceNode>) => (source: Source, args: Args & ConnectionInputOptions, context: Ctx, info: GraphQLResolveInfo) => Promise<Connection>;
|
5
5
|
//# sourceMappingURL=index.d.cts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/main/index.cts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAKlD,OAAO,EACL,KAAK,UAAU,EACf,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,EAClC,KAAK,IAAI,EACV,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,sBAAsB,GAE/B,MAAM,SAAS,WAAW,GAAG,SAAS,EACtC,IAAI,SAAS,WAAW,EACxB,GAAG,SAAS,
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/main/index.cts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAKlD,OAAO,EACL,KAAK,UAAU,EACf,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,EAClC,KAAK,OAAO,EACZ,KAAK,IAAI,EACV,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,sBAAsB,GAE/B,MAAM,SAAS,WAAW,GAAG,SAAS,EACtC,IAAI,SAAS,WAAW,EACxB,GAAG,SAAS,OAAO,EACnB,QAAQ,SAAS,WAAW,EAC5B,YAAY,SAAS,IAAI,kGAQxB,6BAA6B,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,YAAY,CAAC,cAEjE,MAAM,QACR,IAAI,GAAG,sBAAsB,WAC1B,GAAG,QACN,kBAAkB,KACvB,OAAO,CAAC,UAAU,CAgGpB,CAAC"}
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { type Core } from '@cachemap/core';
|
2
2
|
import { type PlainObject } from '@graphql-box/core';
|
3
|
-
import { type GraphQLResolveInfo } from 'graphql';
|
3
|
+
import { type GraphQLResolveInfo, type OperationTypeNode } from 'graphql';
|
4
4
|
import { type SetOptional } from 'type-fest';
|
5
|
+
import { type Logger } from 'winston';
|
5
6
|
export type Direction = 'backward' | 'forward';
|
6
7
|
export type CursorCacheEntry = {
|
7
8
|
group: string;
|
@@ -49,14 +50,19 @@ export interface ResourceResponse<Resource extends PlainObject> extends Response
|
|
49
50
|
export type ResourceResolver<Resource extends PlainObject> = (args: {
|
50
51
|
page: number;
|
51
52
|
}) => Promise<ResourceResponse<Resource>>;
|
52
|
-
export type
|
53
|
+
export type SetCacheMetadata = (key: string, headers: Headers, operation?: OperationTypeNode) => void;
|
54
|
+
export type Context = PlainObject & {
|
55
|
+
logger?: Logger;
|
56
|
+
setCacheMetadata?: SetCacheMetadata;
|
57
|
+
};
|
58
|
+
export type CreateResourceResolver<Source extends PlainObject | undefined, Args extends PlainObject, Ctx extends Context, Resource extends PlainObject> = (source: Source, args: Args, context: Ctx, info: GraphQLResolveInfo) => ResourceResolver<Resource>;
|
53
59
|
export interface Getters<Resource extends PlainObject, ResourceNode extends Node> {
|
54
60
|
nodes: (obj: Resource) => ResourceNode[];
|
55
61
|
page: (obj: Resource) => number;
|
56
62
|
totalPages: (obj: Resource) => number;
|
57
63
|
totalResults: (obj: Resource) => number;
|
58
64
|
}
|
59
|
-
export interface ConnectionResolverUserOptions<Source extends PlainObject | undefined, Args extends PlainObject, Ctx extends
|
65
|
+
export interface ConnectionResolverUserOptions<Source extends PlainObject | undefined, Args extends PlainObject, Ctx extends Context, Resource extends PlainObject, ResourceNode extends Node> {
|
60
66
|
createMakeCursors: (source: Source, args: Args, context: Ctx, info: GraphQLResolveInfo) => {
|
61
67
|
makeGroupCursor: () => string;
|
62
68
|
makeIDCursor: (id: string | number) => string;
|
@@ -67,7 +73,7 @@ export interface ConnectionResolverUserOptions<Source extends PlainObject | unde
|
|
67
73
|
resolver?: (args: Connection) => Connection;
|
68
74
|
resultsPerPage: number;
|
69
75
|
}
|
70
|
-
export type ConnectionResolver = (source: PlainObject, args: PlainObject & ConnectionInputOptions, context:
|
76
|
+
export type ConnectionResolver = (source: PlainObject, args: PlainObject & ConnectionInputOptions, context: Context, info: GraphQLResolveInfo) => Promise<Connection>;
|
71
77
|
export type ConnectionInputOptions = {
|
72
78
|
after?: string;
|
73
79
|
before?: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../../src/types.cts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAC;
|
1
|
+
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../../src/types.cts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;AAE/C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,WAAW,CAAC,gBAAgB,EAAE,OAAO,GAAG,MAAM,CAAC,CAAC;AAEtF,MAAM,MA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AM,KAAK,MAAM,CAAC;KAC/C,CAAC;IACF,sBAAsB,EAAE,sBAAsB,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC5E,WAAW,EAAE,IAAI,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IACzC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,UAAU,CAAC;IAC5C,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,kBAAkB,GAAG,CAC/B,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,WAAW,GAAG,sBAAsB,EAC1C,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,kBAAkB,KACrB,OAAO,CAAC,UAAU,CAAC,CAAC;AAEzB,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC"}
|
@@ -1,14 +1,16 @@
|
|
1
1
|
import { type Core } from '@cachemap/core';
|
2
2
|
import { type PlainObject } from '@graphql-box/core';
|
3
|
-
import { type Getters, type Node, type ResourceResolver } from '../types.ts';
|
3
|
+
import { type Getters, type Node, type ResourceResolver, type SetCacheMetadata } from '../types.ts';
|
4
4
|
export type Context<Resource extends PlainObject, ResourceNode extends Node> = {
|
5
5
|
cursorCache: Core;
|
6
|
+
fieldName: string;
|
6
7
|
getters: Getters<Resource, ResourceNode>;
|
7
8
|
groupCursor: string;
|
8
9
|
makeIDCursor: (id: string | number) => string;
|
9
10
|
resourceResolver: ResourceResolver<Resource>;
|
11
|
+
setCacheMetadata: SetCacheMetadata | undefined;
|
10
12
|
};
|
11
|
-
export declare const requestAndCachePages: <Resource extends PlainObject, ResourceNode extends Node>(pages: number[], { cursorCache, getters, groupCursor, makeIDCursor, resourceResolver }: Context<Resource, ResourceNode>) => Promise<{
|
13
|
+
export declare const requestAndCachePages: <Resource extends PlainObject, ResourceNode extends Node>(pages: number[], { cursorCache, fieldName, getters, groupCursor, makeIDCursor, resourceResolver, setCacheMetadata, }: Context<Resource, ResourceNode>) => Promise<{
|
12
14
|
cachedEdges: {
|
13
15
|
edges: {
|
14
16
|
cursor: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"requestAndCachePages.d.ts","sourceRoot":"","sources":["../../../../src/helpers/requestAndCachePages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
1
|
+
{"version":3,"file":"requestAndCachePages.d.ts","sourceRoot":"","sources":["../../../../src/helpers/requestAndCachePages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAIpG,MAAM,MAAM,OAAO,CAAC,QAAQ,SAAS,WAAW,EAAE,YAAY,SAAS,IAAI,IAAI;IAC7E,WAAW,EAAE,IAAI,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,CAAC;IAC9C,gBAAgB,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC7C,gBAAgB,EAAE,gBAAgB,GAAG,SAAS,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAU,QAAQ,SAAS,WAAW,EAAE,YAAY,SAAS,IAAI,SACzF,MAAM,EAAE,uGASZ,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC;;;;;;;;;EA0CnC,CAAC"}
|
@@ -1,15 +1,19 @@
|
|
1
1
|
import { type Core } from '@cachemap/core';
|
2
2
|
import { type PlainObject } from '@graphql-box/core';
|
3
|
-
import { type
|
3
|
+
import { type Logger } from 'winston';
|
4
|
+
import { type ConnectionInputOptions, type Getters, type Node, type ResourceResolver, type SetCacheMetadata } from '../types.ts';
|
4
5
|
export type Context<Resource extends PlainObject, ResourceNode extends Node> = {
|
5
6
|
cursorCache: Core;
|
7
|
+
fieldName: string;
|
6
8
|
getters: Getters<Resource, ResourceNode>;
|
7
9
|
groupCursor: string;
|
10
|
+
logger: Logger | undefined;
|
8
11
|
makeIDCursor: (id: string | number) => string;
|
9
12
|
resourceResolver: ResourceResolver<Resource>;
|
10
13
|
resultsPerPage: number;
|
14
|
+
setCacheMetadata: SetCacheMetadata | undefined;
|
11
15
|
};
|
12
|
-
export declare const resolveConnection: <Resource extends PlainObject, ResourceNode extends Node>(args: PlainObject & ConnectionInputOptions, { cursorCache, getters, groupCursor, makeIDCursor, resourceResolver, resultsPerPage, }: Context<Resource, ResourceNode>) => Promise<{
|
16
|
+
export declare const resolveConnection: <Resource extends PlainObject, ResourceNode extends Node>(args: PlainObject & ConnectionInputOptions, { cursorCache, fieldName, getters, groupCursor, logger, makeIDCursor, resourceResolver, resultsPerPage, setCacheMetadata, }: Context<Resource, ResourceNode>) => Promise<{
|
13
17
|
edges: import("../types.ts").Edge[];
|
14
18
|
errors: Error[];
|
15
19
|
nodes: Node[];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"resolveConnection.d.ts","sourceRoot":"","sources":["../../../../src/helpers/resolveConnection.ts"],"names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
|
|
1
1
|
import { type PlainObject } from '@graphql-box/core';
|
2
2
|
import { type GraphQLResolveInfo } from 'graphql';
|
3
|
-
import { type Connection, type ConnectionInputOptions, type ConnectionResolverUserOptions, type Node } from '../types.ts';
|
4
|
-
export declare const makeConnectionResolver: <Source extends PlainObject | undefined, Args extends PlainObject, Ctx extends
|
3
|
+
import { type Connection, type ConnectionInputOptions, type ConnectionResolverUserOptions, type Context, type Node } from '../types.ts';
|
4
|
+
export declare const makeConnectionResolver: <Source extends PlainObject | undefined, Args extends PlainObject, Ctx extends Context, Resource extends PlainObject, ResourceNode extends Node>({ createMakeCursors, createResourceResolver, cursorCache, getters, resolver, resultsPerPage, }: ConnectionResolverUserOptions<Source, Args, Ctx, Resource, ResourceNode>) => (source: Source, args: Args & ConnectionInputOptions, context: Ctx, info: GraphQLResolveInfo) => Promise<Connection>;
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/main/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAKlD,OAAO,EACL,KAAK,UAAU,EACf,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,EAClC,KAAK,IAAI,EACV,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,sBAAsB,GAE/B,MAAM,SAAS,WAAW,GAAG,SAAS,EACtC,IAAI,SAAS,WAAW,EACxB,GAAG,SAAS,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/main/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAKlD,OAAO,EACL,KAAK,UAAU,EACf,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,EAClC,KAAK,OAAO,EACZ,KAAK,IAAI,EACV,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,sBAAsB,GAE/B,MAAM,SAAS,WAAW,GAAG,SAAS,EACtC,IAAI,SAAS,WAAW,EACxB,GAAG,SAAS,OAAO,EACnB,QAAQ,SAAS,WAAW,EAC5B,YAAY,SAAS,IAAI,kGAQxB,6BAA6B,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,YAAY,CAAC,cAEjE,MAAM,QACR,IAAI,GAAG,sBAAsB,WAC1B,GAAG,QACN,kBAAkB,KACvB,OAAO,CAAC,UAAU,CAgGpB,CAAC"}
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { type Core } from '@cachemap/core';
|
2
2
|
import { type PlainObject } from '@graphql-box/core';
|
3
|
-
import { type GraphQLResolveInfo } from 'graphql';
|
3
|
+
import { type GraphQLResolveInfo, type OperationTypeNode } from 'graphql';
|
4
4
|
import { type SetOptional } from 'type-fest';
|
5
|
+
import { type Logger } from 'winston';
|
5
6
|
export type Direction = 'backward' | 'forward';
|
6
7
|
export type CursorCacheEntry = {
|
7
8
|
group: string;
|
@@ -49,14 +50,19 @@ export interface ResourceResponse<Resource extends PlainObject> extends Response
|
|
49
50
|
export type ResourceResolver<Resource extends PlainObject> = (args: {
|
50
51
|
page: number;
|
51
52
|
}) => Promise<ResourceResponse<Resource>>;
|
52
|
-
export type
|
53
|
+
export type SetCacheMetadata = (key: string, headers: Headers, operation?: OperationTypeNode) => void;
|
54
|
+
export type Context = PlainObject & {
|
55
|
+
logger?: Logger;
|
56
|
+
setCacheMetadata?: SetCacheMetadata;
|
57
|
+
};
|
58
|
+
export type CreateResourceResolver<Source extends PlainObject | undefined, Args extends PlainObject, Ctx extends Context, Resource extends PlainObject> = (source: Source, args: Args, context: Ctx, info: GraphQLResolveInfo) => ResourceResolver<Resource>;
|
53
59
|
export interface Getters<Resource extends PlainObject, ResourceNode extends Node> {
|
54
60
|
nodes: (obj: Resource) => ResourceNode[];
|
55
61
|
page: (obj: Resource) => number;
|
56
62
|
totalPages: (obj: Resource) => number;
|
57
63
|
totalResults: (obj: Resource) => number;
|
58
64
|
}
|
59
|
-
export interface ConnectionResolverUserOptions<Source extends PlainObject | undefined, Args extends PlainObject, Ctx extends
|
65
|
+
export interface ConnectionResolverUserOptions<Source extends PlainObject | undefined, Args extends PlainObject, Ctx extends Context, Resource extends PlainObject, ResourceNode extends Node> {
|
60
66
|
createMakeCursors: (source: Source, args: Args, context: Ctx, info: GraphQLResolveInfo) => {
|
61
67
|
makeGroupCursor: () => string;
|
62
68
|
makeIDCursor: (id: string | number) => string;
|
@@ -67,7 +73,7 @@ export interface ConnectionResolverUserOptions<Source extends PlainObject | unde
|
|
67
73
|
resolver?: (args: Connection) => Connection;
|
68
74
|
resultsPerPage: number;
|
69
75
|
}
|
70
|
-
export type ConnectionResolver = (source: PlainObject, args: PlainObject & ConnectionInputOptions, context:
|
76
|
+
export type ConnectionResolver = (source: PlainObject, args: PlainObject & ConnectionInputOptions, context: Context, info: GraphQLResolveInfo) => Promise<Connection>;
|
71
77
|
export type ConnectionInputOptions = {
|
72
78
|
after?: string;
|
73
79
|
before?: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAC;
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE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