0.8.0 • Published 2 years ago

apollo-field-cache-resolver v0.8.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Apollo Cache Field Resolver (WIP)

The aim of this simple resolver wrapper is to enable caching on a field level basis, as apposed to the Apollo Response Cache

Spec

Cache Key Variants

There should be some default(s) for how to generate cache keys, and perhaps the option for a custom function to generate it.

For example:

  • node-id -> the node name + the node id.
  • parent-field -> the parent node name + the field name + the parents id + field arguments.
  • custom -> a function that returns a key given the resolved cache key type, the info object, the parent, and args.

node(definition) - A graphql type with the @key directive.

Issues/Prerequisites

  1. For node-id how to resolve the id before the node is fetched.
  2. For parent-field parent must be a node.

Possible solutions

  1. For __resolveReference fields use @key directives fields argument. to get it from parent.
  2. For any other case assume args contains the fields of the @key directive.
  • Better solution for later could be recursively looking through the input ast to find a single field with type ID!, and/or finding a key id or containing id(respecting snake/camel etc. case)
  1. For parent-field The parent may not exist, like in the case for a query.

TODO

  • Prettify generated .d.ts
  • Improve ID! resolving for node-id cache key variant
  • Improve Docs
  • Validate resulting node's id with resolved cache key
0.8.0

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago