You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/hooks.md
+39
Original file line number
Diff line number
Diff line change
@@ -157,17 +157,20 @@ The result is passed to [the next function in the execution order](/docs/guides/
157
157
|`originalInput`|`Object`| The data received by the GraphQL mutation |
158
158
|`resolvedData`|`Object`| The data received by the GraphQL mutation plus defaults values |
159
159
|`context`|`Apollo Context`| The [Apollo `context` object](https://www.apollographql.com/docs/apollo-server/data/data/#context-argument) for this request |
160
+
|`listKey`|`String`| The key for the list being operated on |
160
161
161
162
#### Usage
162
163
163
164
<!-- prettier-ignore -->
165
+
164
166
```js
165
167
constresolveInput= ({
166
168
operation,
167
169
existingItem,
168
170
originalInput,
169
171
resolvedData,
170
172
context,
173
+
listKey,
171
174
}) => {
172
175
// Input resolution logic. Object returned is used in place of `resolvedData`.
173
176
return resolvedData;
@@ -194,10 +197,12 @@ Return values are ignored.
194
197
|`resolvedData`|`Object`| The data received by the GraphQL mutation plus defaults values |
195
198
|`context`|`Apollo Context`| The [Apollo `context` object](https://www.apollographql.com/docs/apollo-server/data/data/#context-argument) for this request |
196
199
|`addFieldValidationError`|`Function`| Used to set a field validation error; accepts a `String`|
200
+
|`listKey`|`String`| The key for the list being operated on |
197
201
198
202
#### Usage
199
203
200
204
<!-- prettier-ignore -->
205
+
201
206
```js
202
207
constvalidateInput= ({
203
208
operation,
@@ -206,6 +211,7 @@ const validateInput = ({
206
211
resolvedData,
207
212
context,
208
213
addFieldValidationError,
214
+
listKey,
209
215
}) => {
210
216
// Throw error objects or register validation errors with addFieldValidationError(<String>)
211
217
// Return values ignored
@@ -231,17 +237,20 @@ Return values are ignored.
231
237
|`originalInput`|`Object`| The data received by the GraphQL mutation |
232
238
|`resolvedData`|`Object`| The data received by the GraphQL mutation plus defaults values |
233
239
|`context`|`Apollo Context`| The [Apollo `context` object](https://www.apollographql.com/docs/apollo-server/data/data/#context-argument) for this request |
240
+
|`listKey`|`String`| The key for the list being operated on |
234
241
235
242
#### Usage
236
243
237
244
<!-- prettier-ignore -->
245
+
238
246
```js
239
247
constbeforeChange= ({
240
248
operation,
241
249
existingItem,
242
250
originalInput,
243
251
resolvedData,
244
252
context,
253
+
listKey,
245
254
}) => {
246
255
// Perform side effects
247
256
// Return values ignored
@@ -271,17 +280,20 @@ Return values are ignored.
271
280
|`originalInput`|`Object`| The data received by the GraphQL mutation |
272
281
|`updatedItem`|`Object`| The new/currently stored item |
273
282
|`context`|`Apollo Context`| The [Apollo `context` object](https://www.apollographql.com/docs/apollo-server/data/data/#context-argument) for this request |
283
+
|`listKey`|`String`| The key for the list being operated on |
274
284
275
285
#### Usage
276
286
277
287
<!-- prettier-ignore -->
288
+
278
289
```js
279
290
constafterChange= ({
280
291
operation,
281
292
existingItem,
282
293
originalInput,
283
294
updatedItem,
284
295
context,
296
+
listKey,
285
297
}) => {
286
298
// Perform side effects
287
299
// Return values ignored
@@ -305,16 +317,19 @@ Should throw or register errors with `addFieldValidationError(<String>)` if the
305
317
|`existingItem`|`Object`| The current stored item |
306
318
|`context`|`Apollo Context`| The [Apollo `context` object](https://www.apollographql.com/docs/apollo-server/data/data/#context-argument) for this request |
307
319
|`addFieldValidationError`|`Function`| Used to set a field validation error; accepts a `String`|
320
+
|`listKey`|`String`| The key for the list being operated on |
308
321
309
322
#### Usage
310
323
311
324
<!-- prettier-ignore -->
325
+
312
326
```js
313
327
constvalidateDelete= ({
314
328
operation,
315
329
existingItem,
316
330
context,
317
331
addFieldValidationError,
332
+
listKey,
318
333
}) => {
319
334
// Throw error objects or register validation errors with addFieldValidationError(<String>)
320
335
// Return values ignored
@@ -338,15 +353,18 @@ Return values are ignored.
338
353
|`operation`|`String`| The operation being performed (`delete` in this case) |
339
354
|`existingItem`|`Object`| The current stored item |
340
355
|`context`|`Apollo Context`| The [Apollo `context` object](https://www.apollographql.com/docs/apollo-server/data/data/#context-argument) for this request |
356
+
|`listKey`|`String`| The key for the list being operated on |
341
357
342
358
#### Usage
343
359
344
360
<!-- prettier-ignore -->
361
+
345
362
```js
346
363
constbeforeDelete= ({
347
364
operation,
348
365
existingItem,
349
366
context,
367
+
listKey,
350
368
}) => {
351
369
// Perform side effects
352
370
// Return values ignored
@@ -372,15 +390,18 @@ Return values are ignored.
372
390
|`operation`|`String`| The operation being performed (`delete` in this case) |
373
391
|`existingItem`|`Object`| The previously stored item, now deleted |
374
392
|`context`|`Apollo Context`| The [Apollo `context` object](https://www.apollographql.com/docs/apollo-server/data/data/#context-argument) for this request |
393
+
|`listKey`|`String`| The key for the list being operated on |
375
394
376
395
#### Usage
377
396
378
397
<!-- prettier-ignore -->
398
+
379
399
```js
380
400
constafterDelete= ({
381
401
operation,
382
402
existingItem,
383
403
context,
404
+
listKey,
384
405
}) => {
385
406
// Perform side effects
386
407
// Return values ignored
@@ -405,15 +426,18 @@ The result is passed to [the next function in the execution order](/docs/guides/
405
426
|`operation`|`String`| The operation being performed (`authenticate` in this case) |
406
427
|`originalInput`|`Object`| The data received by the GraphQL mutation |
407
428
|`context`|`Apollo Context`| The [Apollo `context` object](https://www.apollographql.com/docs/apollo-server/essentials/data.html#context) for this request |
429
+
|`listKey`|`String`| The key for the list being operated on |
408
430
409
431
#### Usage
410
432
411
433
<!-- prettier-ignore -->
434
+
412
435
```js
413
436
constresolveAuthInput= ({
414
437
operation,
415
438
originalInput,
416
439
context,
440
+
listKey,
417
441
}) => {
418
442
// Input resolution logic
419
443
// Object returned is used in place of resolvedData
@@ -440,17 +464,20 @@ Return values are ignored.
440
464
|`resolvedData`|`Object`| The data received by the GraphQL mutation or returned by `resolveAuthInput`, if defined |
441
465
|`context`|`Apollo Context`| The [Apollo `context` object](https://www.apollographql.com/docs/apollo-server/essentials/data.html#context) for this request |
442
466
|`addValidationError`|`Function`| Used to set a validation error; accepts a message `String`|
467
+
|`listKey`|`String`| The key for the list being operated on |
443
468
444
469
#### Usage
445
470
446
471
<!-- prettier-ignore -->
472
+
447
473
```js
448
474
constvalidateAuthInput= ({
449
475
operation,
450
476
originalInput,
451
477
resolvedData,
452
478
context,
453
479
addFieldValidationError,
480
+
listKey,
454
481
}) => {
455
482
// Throw error objects or register validation errors with addValidationError(<String>)
456
483
// Return values ignored
@@ -475,16 +502,19 @@ Return values are ignored.
475
502
|`originalInput`|`Object`| The data received by the GraphQL mutation |
476
503
|`resolvedData`|`Object`| The data received by the GraphQL mutation or returned by `resolveAuthInput`, if defined |
477
504
|`context`|`Apollo Context`| The [Apollo `context` object](https://www.apollographql.com/docs/apollo-server/essentials/data.html#context) for this request |
505
+
|`listKey`|`String`| The key for the list being operated on |
478
506
479
507
#### Usage
480
508
481
509
<!-- prettier-ignore -->
510
+
482
511
```js
483
512
constbeforeAuth= ({
484
513
operation,
485
514
originalInput,
486
515
resolvedData,
487
516
context,
517
+
listKey,
488
518
}) => {
489
519
// Perform side effects
490
520
// Return values ignored
@@ -515,10 +545,12 @@ Return values are ignored.
515
545
|`originalInput`|`Object`| The data received by the GraphQL mutation |
516
546
|`resolvedData`|`Object`| The data received by the GraphQL mutation or returned by `resolveAuthInput`, if defined |
517
547
|`context`|`Apollo Context`| The [Apollo `context` object](https://www.apollographql.com/docs/apollo-server/essentials/data.html#context) for this request |
548
+
|`listKey`|`String`| The key for the list being operated on |
|`operation`|`String`| The operation being performed (`authenticate` in this case) |
553
586
|`context`|`Apollo Context`| The [Apollo `context` object](https://www.apollographql.com/docs/apollo-server/essentials/data.html#context) for this request |
587
+
|`listKey`|`String`| The key for the list being operated on |
554
588
555
589
#### Usage
556
590
557
591
<!-- prettier-ignore -->
592
+
558
593
```js
559
594
constbeforeUnauth= ({
560
595
operation,
561
596
context,
597
+
listKey,
562
598
}) => {
563
599
// Perform side effects
564
600
// Return values ignored
@@ -586,10 +622,12 @@ Return values are ignored.
586
622
|`listKey`|`String`| The list key of the unauthenticated user (if there was one) |
587
623
|`itemid`|`String`| The item ID of the unauthenticated user (if there was one) |
588
624
|`context`|`Apollo Context`| The [Apollo `context` object](https://www.apollographql.com/docs/apollo-server/essentials/data.html#context) for this request |
625
+
|`listKey`|`String`| The key for the list being operated on |
0 commit comments