Commit graph

40 commits

Author SHA1 Message Date
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
7225d5fd28 test: test loading through w/ nil values 2024-01-21 12:06:48 -05:00
Zach Daniel
1d69d8ef33 fix: support aggregates over calculations 2023-08-29 21:32:22 -04:00
Alan Heywood
0c869aa522
test: add failing test for an aggregate of a calculation (#92)
An error occurs at compile time:

== Compilation error in file test/support/schema.ex ==
** (MatchError) no match of right hand side value: {:error, "Must provide field type for max"}
    lib/resource/resource.ex:2278: AshGraphql.Resource.filterable?/2
    (elixir 1.15.4) lib/enum.ex:4265: Enum.filter_list/2
    (elixir 1.15.4) lib/enum.ex:4266: Enum.filter_list/2
    lib/resource/resource.ex:2229: AshGraphql.Resource.aggregate_filter_fields/2
    lib/resource/resource.ex:2195: AshGraphql.Resource.resource_filter_fields/2
    lib/resource/resource.ex:1159: AshGraphql.Resource.args/5
    lib/resource/resource.ex:425: anonymous fn/6 in AshGraphql.Resource.queries/5
    (elixir 1.15.4) lib/enum.ex:1693: Enum."-map/2-lists^map/1-1-"/2
2023-08-29 21:30:06 -04:00
Zach Daniel
7e46a627b8 chore: format 2023-07-31 15:32:02 -04:00
Zach Daniel
fe85aab53a fix: properly display forbidden field errors
fixes #84
2023-07-13 09:23:17 -04:00
Barnabas Jovanovics
e11deb07aa
test: update field policy test (#83) 2023-07-13 08:46:26 -04:00
Zach Daniel
60517e6e20 chore: update tests, the fix is in main, just need to wait for release 2023-06-28 14:35:18 -04:00
Barnabas Jovanovics
14a5898958
test: add test for loading stuff through unions with fragments (#81) 2023-06-28 11:14:50 -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
Barnabas Jovanovics
7f504bbf17
test: add engine deadlock test (#78) 2023-06-16 10:51:50 -04:00
Zach Daniel
1f6e87ff01 fix: properly resolve arrays of unions from calculations 2023-06-15 13:04:45 -04:00
Barnabas Jovanovics
6c073e746d
test: add new calculate union tests with real resources (#77) 2023-06-15 10:36:20 -04:00
Zach Daniel
045426c629 fix: account for lists of newtype unions 2023-06-14 10:21:20 -04:00
Zach Daniel
05be948204 improvement: revamp data loading to be a single load statement 2023-06-09 00:45:39 -04:00
Alan Heywood
d89a14175c
improvement: support manual relationships (#66) 2023-04-13 01:42:45 -04:00
Zach Daniel
cf8267123e improvement: support new union types in ash 2023-02-15 08:20:35 -05:00
Zach Daniel
f0836f18b6 improvement: support metadata on read actions
metadata on read actions is merged with the rest of the fields on the query, so must have a name unique from the attributes/calculations/aggregates.

The system will warn you if there is metadata on the underlying action that is being ignored, and will tell you how to fix it.
2023-01-28 12:32:21 -05:00
Alan Heywood
d9e17ed42b
fix: map uuid action arguments to ID type (#52) 2023-01-18 19:07:53 -05:00
Zach Daniel
9cc9da0f2e improvement: support calculation sort input
closes #31
2022-10-12 21:15:42 -04:00
Zach Daniel
3a11d988ab improvement: support encode_primary_key? false, and set single managed relationship primary keys do :id type when its true
closes #28
2022-10-12 19:02:04 -04:00
Zach Daniel
e8486deaa3 chore: warning on errors when stopping storage in test 2022-09-28 02:48:08 -04:00
Zach Daniel
93fc0c9ffd chore: stop all ETS resources in tests 2022-09-28 02:28:44 -04:00
Zach Daniel
92631f91b6 improvement: add options for remapping field/argument names
fix: use the dataloader for loading calculations, to allow for aliases
2022-09-26 00:12:10 -04:00
Zach Daniel
9095a5ae45 improvement: add attribute_types and attribute_input_types
improvement: require configuration of datetime types
2022-09-22 13:31:40 -04:00
Maxim Martynov
e40e7c573c
improvement: Implement GraphQL Relay support (#36) 2022-09-20 23:07:30 -04:00
Zach Daniel
d70c68eed9 fix: error when selecting only the count for pagination 2022-09-12 12:23:58 -04:00
Zach Daniel
c54bcdfdda chore: fix tests 2022-05-28 21:19:11 -04:00
Maxim Martynov
cc5f3a31f2
fix: Handle error if multitenant resource was fetched without tenant being set (#33) 2022-05-11 12:45:49 -04:00
Zach Daniel
d8a3e1b155 improvement: add groundwork for relay support 2021-08-03 18:56:08 -04:00
Zach Daniel
dffe4de9f5 improvement: update to latest rc
improvement: add `short_message` and `vars` to errors
2021-06-28 13:33:01 -04:00
WolfDan
c530245295
improvement: Add float type (#20) 2021-05-05 16:15:01 -04:00
Zach Daniel
405264911c fix: properly support limit/offset on relationships 2021-05-04 09:31:39 -04:00
Zach Daniel
1f098c5fa1 fix: load fields required for relationship 2021-04-15 16:28:04 -04:00
Michael St Clair
596dc90381
feat: add read_one query (#13) 2021-04-04 03:10:50 -04:00
Zach Daniel
004c69c291 feat: support custom types, add custom type test 2021-03-28 12:30:28 -04:00
Zach Daniel
69f34ba55b fix: select fields/aggregates/calculations 2021-03-22 13:03:18 -04:00
Zach Daniel
fbfdb7faf8 feat: update to latest ash
feat: support query arguments
2021-01-21 23:06:06 -05:00