Commit graph

162 commits

Author SHA1 Message Date
Zach Daniel
b1ab52959d fix: don't assume filter is non-nil for gets 2024-06-21 15:11:22 -04:00
Zach Daniel
d49fc5a488 fix: honor read_action for update/destroy mutations
closes #169
2024-06-02 11:28:06 -04:00
Riccardo Binetti
62940c31ec
feat: relationship pagination (#166) 2024-05-26 09:50:54 -04:00
Zach Daniel
a6ca7fea67 feat: support queries/mutations on the domain 2024-05-24 15:51:19 -04:00
Zach Daniel
019632c420 fix: properly set actor on bulk action calls 2024-04-27 09:27:00 -04:00
Zach Daniel
fb74c2a4f3 improvement: use bulk actions for create/destroy 2024-04-25 23:28:37 -04:00
Zach Daniel
ee43ec4a26 fix: tag union values with their type before casting 2024-04-23 19:54:00 -04:00
Zach Daniel
bd9562a9fa fix: ensure type is set when using find_manage_relationship
closes #132
2024-04-20 16:24:05 +01:00
Zach Daniel
1c4cf1969c fix: properly honor new pagination config everywhere
fixes #130
2024-04-20 16:18:52 +01:00
Zach Daniel
d692c931c2 chore: format 2024-04-01 16:16:05 -04:00
Zach Daniel
180d05545c improvement!: auto? managed_relationships by default
imporovement!: remove deprecated configuration
2024-04-01 16:02:30 -04:00
Zach Daniel
349086fbb8 improvement!: No longer automagically derive types 2024-04-01 15:27:43 -04:00
Riccardo Binetti
513c1ac68f
improvement!: port AshGraphql to Ash 3.0 (#123)
Step 1: update Ash

Step 2: mass rename Api to Domain

Step 3: Ash.Query.expr -> Ash.Expr.expr

Also change ref interpolation

Step 4: remove all warnings

Step 5: remove registries from tests

Step 6: fix filter

Step 7: private? -> !public?

Step 8: Ash.Calculation -> Ash.Resource.Calculation

Step 9: use depend_on_resources/1 -> resources/1

Step 10: add Domain to all resources

Step 11: use Ash module for all actions

Step 12: add public? true all around

Step 13: remove verbose? from options passed during Domain calls

Step 14: add simple_sat

Step 15: Ash.ErrorKind is no more, so remove code from errors

Step 16: sprinkle default_accept :* around tests

Step 17: replace Ash.Changeset.new/2 with Ash.Changeset.for_*

Step 18: calculation fixups

- Context is now a struct and arguments go under the arguments key
- Function based calculations receive a list of records
- Add a select to query-based loads
- select -> load

Step 19: pass the correct name to pass the policy in tests

Step 20: Ash.Query.new/2 is no more

Step 21: add AshGraphql.Resource.embedded? utility function

Use that instead of Ash.Type.embedded_type?(resource_or_type) since resources
are not types anymore

Step 22: handle struct + instance_of: Resource in unions

Resources are not type anymore so they need to be passed this way in unions

Step 23: ensure we only check GraphQL actions for pagination

All reads are now paginated by default, so this triggered a compilation error

Step 24: swap arguments for sort on calculations

Step 25: remove unused debug? option
2024-04-01 14:03:06 -04:00
Zach Daniel
22034fd47a chore: credo 2024-02-11 14:41:24 -05:00
Zach Daniel
328618fa94 fix: handle unions containing maps and vice versa 2024-02-11 14:10:20 -05:00
Riccardo Binetti
66d2f44443
feat: add Relay ID translation in mutation and queries (#109)
Adds a new option for queries and mutations that defines which arguments or
attributes will use a global Relay ID and their type. This allows automatically
decoding them before hitting their action.

This paves the way to automatic translation derived from the arguments, which
will be implemented subsequently.

---------

Co-authored-by: Zach Daniel <zachary.s.daniel@gmail.com>
2024-02-06 09:46:09 -05:00
Zach Daniel
d00ae4e315 fix: define map input types w/ nested input types 2024-02-05 13:48:22 -05:00
Riccardo Binetti
afa4ae66a0
improvement: return a map from decode_relay_id/1 (#107)
Slight API improvement over #106.

This makes it more ergonomic to partially match on the return value (and it also
makes it more explicit by explicitly labeling the two parts).

Also add tests for relay id encoding/decoding.
2024-01-25 10:47:15 -05:00
Riccardo Binetti
365b3aedc6
feat: Relay refetching support (#106)
* feat: add support for relay global IDs

* improvement: use the GraphQL type when projecting fields

This allows picking also up fields coming from fragments in queries returning an
interface

* feat: add relay node query

Allow retrieving a resource implementing the Node interface given its Relay
global id.
2024-01-24 14:59:12 -05:00
Zach Daniel
67fe4d64ec improvement: support latest ash 2024-01-19 00:13:39 -05:00
Zach Daniel
88aff4369d fix: properly transform not found errors 2023-12-05 16:44:21 -05:00
Zach Daniel
f83c447267 fix: respond with proper error on not found for get 2023-12-05 16:07:07 -05:00
Zach Daniel
51428483ef chore: raise error to help debugging 2023-12-05 15:32:47 -05:00
Zach Daniel
e16592f592 improvement: handle nil parent 2023-12-05 12:46:38 -05:00
Barnabas Jovanovics
b9a3051e88
fix: make sure generic actions are authorized (#100) 2023-11-24 05:29:01 -05:00
Zach Daniel
1401de6727 fix: pass context into loading and generate related query with it 2023-10-27 00:29:03 -04:00
Zach Daniel
58a038e609 fix: generic action mutations need to use the input object 2023-10-02 19:44:19 -04:00
Zach Daniel
1950581f83 chore: attempt to fix an issue w/ incorrect action call 2023-09-17 19:17:13 -04:00
Zach Daniel
49c6534d73 improvement: generic action support
docs: better docs
2023-09-15 13:45:12 -04:00
Zach Daniel
8f9e79e273 fix: pass arguments to related read action 2023-08-03 19:49:59 -04:00
Zach Daniel
fe85aab53a fix: properly display forbidden field errors
fixes #84
2023-07-13 09:23:17 -04:00
Zach Daniel
d2f1f321f6 fix: handle detection of fields nested in aliases 2023-06-23 10:53:24 -04:00
Zach Daniel
bb96354470 improvement: support ForbiddenField 2023-06-23 10:10:39 -04:00
Alan Heywood
1c9c173631
fix: fix Logger deprecations for elixir 1.15 (#79)
Use Logger.warning instead of Logger.warn, which is deprecated
2023-06-22 17:38:24 -04:00
Zach Daniel
c70e7dec7d improvement: use parse_input for filters 2023-06-19 15:09:32 -04:00
Zach Daniel
1f6e87ff01 fix: properly resolve arrays of unions from calculations 2023-06-15 13:04:45 -04:00
Zach Daniel
102bf96221 improvement: use new can_load?/2 2023-06-12 16:59:05 -04:00
Zach Daniel
74211ef3f4 fix: properly fetch aliased all attributes 2023-06-12 13:19:07 -04:00
Zach Daniel
3570c477f0 improvement: finalize Subscription.query_for_subscription args 2023-06-09 12:01:21 -04:00
Zach Daniel
087579a062 fix: fixes for resolvers 2023-06-09 10:19:31 -04:00
Zach Daniel
05be948204 improvement: revamp data loading to be a single load statement 2023-06-09 00:45:39 -04:00
Zach Daniel
0caf5365f7 improvement: use Ash.Changeset.load 2023-06-05 14:04:53 -04:00
Zach Daniel
a00c55c749 improvement: load calculations using Ash.Query.load 2023-06-05 10:41:36 -04:00
Zach Daniel
d8cf992370 improvement: set actor when building loaded read query 2023-06-04 16:09:55 -04:00
Zach Daniel
d8b73b56e4 fix: properly use primary read as default read_action 2023-05-22 16:20:46 -04:00
Zach Daniel
20ce8b505e fix: properly thread read action arguments through on updates 2023-05-19 18:01:33 -04:00
Zach Daniel
db23b32552 fix: various problems with resolving unions in relationship changes 2023-05-17 22:41:24 -04:00
Zach Daniel
7e8c02343c chore: remove inspect 2023-05-01 18:47:14 -04:00
Zach Daniel
cccac9034a improvement: handle nil values in union types 2023-05-01 18:38:58 -04:00
Zach Daniel
0a6051469f chore: remove TODO 2023-04-23 07:03:26 -06:00