Commit graph

906 commits

Author SHA1 Message Date
Jechol Lee
7b70c3a58e
test: Fix ParentTest (#793) 2023-12-05 01:36:40 -05:00
Jechol Lee
86e171a0c1
test: various test improvements (#795) 2023-12-05 01:34:21 -05:00
Jechol Lee
728226bfee
test: Fix typo in MultitenancyTest (#789) 2023-12-01 13:02:06 -05:00
Darren Black
7106c61545
test: Failing test for Api.get (#786) 2023-11-29 20:05:36 -05:00
Zach Daniel
be935723d2 fix: properly resolve nested calculation dependencies 2023-11-24 07:23:38 -05:00
Jeremy Grant
1ce05562aa
fix: change_attribute failing on a union attribute (#778) 2023-11-20 19:10:35 -05:00
Zach Daniel
b9f804db10 fix: properly set actor context on calc expressions in ets data layer 2023-11-16 08:18:39 -05:00
Daniel Newman
8103831cf6 Bug: Actor not being passed 2023-11-15 17:05:31 -05:00
Simon Bergström
b0d5c08f5d
fix: properly include relationship name message when relationship cannot be found (#770) 2023-11-13 17:04:35 -05:00
Barnabas Jovanovics
abb0854ae9
fix: remove destroyed or unrelated data from the relationship (#767) 2023-11-13 13:58:09 -05:00
Eduardo B. A
1775ab5a14
feat: Expand upsert_fields option (#761)
With this change, upsert_fields accepts the following options:

* `nil`: upsert fields not set;
* `:replace_all`: all fields from resource will be updated;
* `{:replace_all_except, [fields]}`: all fields from resource except fields inside `fields` will be updated;
* `{:replace, [fields]}`: only fields inside `fields` will be updated.
2023-11-13 13:23:16 -05:00
Zach Daniel
7b50a401d8 fix: optimize and make Ash.Type more consistent 2023-10-26 22:04:57 -04:00
Robert Graff
a48d43e79d
fix more handle change use cases (#757) 2023-10-25 17:47:50 -04:00
Zach Daniel
539f5a1727 fix: remove invalid usages of unsafe_change_attribute/3
ci: test against `ash_paper_trail`
2023-10-25 13:06:04 -04:00
Robert Graff
0e538470a2
test: regression test for Ash.Changeset.changing_attribute?/2 (#755) 2023-10-25 12:56:45 -04:00
Robert Graff
f03b6a4370
fix: handle builtin types in unions (#752) 2023-10-25 08:31:25 -04:00
Frédérick Capovilla
76783b355b
feat: Add unknown argument error when passing an unknown key to an action. (#750)
* improvement: Add ash_three? feature flag for Ash 3.0 related behaviors.

* test: Add the ash_three test tag to exclude tests targetting Ash 3.0
2023-10-24 12:27:33 -04:00
Zach Daniel
7eac076581 chore: update dialyzer & cleanup dead code 2023-10-21 23:30:33 -04:00
Zach Daniel
63dbf2603f chore: format 2023-10-21 23:20:13 -04:00
Zach Daniel
9ad876af20 improvement: add Ash.Test.assert_has_error and Ash.Test.refute_has_error 2023-10-21 23:14:45 -04:00
Zach Daniel
dec32f47ee improvement: support to_error_class taking changeset/query/input 2023-10-21 22:55:45 -04:00
Frédérick Capovilla
60d12f86da
fix: Change heading levels in generated livebook to have only one H1 (#747) 2023-10-21 22:32:46 -04:00
Jordan Hewitt
003d5eb0e3
fix: code gen interfaces check type first argument (#749)
* reproduced reported error message.

* remove path matching from code interface in order to make error error from issue 679 more clear.

---------

Co-authored-by: Jordan <srcrr-gitlab@ipriva.com>
2023-10-21 19:52:37 -04:00
Zach Daniel
2dbebf39e1 fix: properly determine resource from Ash.get!/2 2023-10-20 06:22:32 -04:00
Zach Daniel
1ab5a35d7f
improvement: support an api option to use Ash.Resource (#715)
* improvement: support an `api` option to `use Ash.Resource`
improvement: add functions to `Ash` for resources w/ configured apis
improvement: default code_interface.define_for to resource's ash api
2023-10-20 06:07:34 -04:00
Zach Daniel
ff88ce68b4
improvement: rewrite bulk creates, optimize changeset functions (#744) 2023-10-18 14:07:44 -04:00
Zach Daniel
d9bacc1554 fix: handle new type constraints properly 2023-10-17 12:50:14 -04:00
Pierre Le Gall
e14e1b2e29
improvement: set default many to many options (#737)
Many to many relationship `source_attribute_on_join_resource`
and `destination_attribute_on_join_resource` are now guessed
by there module name if not explicitly set in the relationship.
2023-10-17 10:03:21 -04:00
Zach Daniel
52337b7bff improvement: various optimizations for bulk create actions 2023-10-16 23:50:05 -04:00
Zach Daniel
f53626e65d improvement: support max_concurrency option on bulk creates
improvement: better error message on missing identities
improvement: better error message on invalid data passed to `YourApi.load`
2023-10-16 14:53:27 -04:00
Zach Daniel
6e0be43c51 fix: properly authorize access to query aggregates in all cases 2023-10-11 19:44:50 -04:00
Zach Daniel
1ab4b6e69a improvement: support atomics on upserts 2023-10-11 15:09:06 -04:00
Zach Daniel
3782f1cfe2 fix: honor authorize? option for calls to aggregate 2023-10-10 11:10:58 -04:00
Zach Daniel
fbe6b21bf0 improvement: support to-one reference paths in calculations 2023-10-09 18:50:15 -04:00
Zach Daniel
06d152c415 chore: remove IO.inspect 2023-10-07 17:08:12 -04:00
Zach Daniel
32620dfd52 improvement: add Ash.Sort.expr_sort. In 3.0 sort should be a macro 2023-10-07 09:16:52 -04:00
Zach Daniel
04c9249f24 fix: properly perform field authorization on loaded through types 2023-09-28 10:23:16 -04:00
Barnabas Jovanovics
4fb6da6eee
test: update test to load forbidden field through union (#713) 2023-09-28 08:36:37 -04:00
Zach Daniel
a00806eeb0 fix: static checks with conditions could be overly or insufficiently restrictive 2023-09-27 14:40:40 -04:00
Barnabas Jovanovics
a1ad5d5476
add test showing the problem with expressions in field_policy conditions (#710) 2023-09-27 18:58:25 +02:00
Barnabas Jovanovics
9e16109950
feat: expose query or changeset to field policies (#701) 2023-09-25 11:13:36 -04:00
Zach Daniel
93fc4a35b2 improvement: rework utc_datetime to datetime
the old types are now newtypes over the new type

fixes: #704
2023-09-25 11:11:56 -04:00
Zach Daniel
2d9f9ee362 improvement: deprecate old school manual actions
note: these have been deprecated for a very long time, removing them will not
be considered a breaking change (and there will be clear compile errors)
2023-09-25 09:40:29 -04:00
Zach Daniel
b7b2f586a1 chore: format test 2023-09-22 17:05:07 -04:00
Zach Daniel
b13c7f0e53 improvement: add Ash.Query.around_transaction/2 2023-09-22 16:46:43 -04:00
Zach Daniel
1d43b26127 chore: move validate_relationship_attributes to a verifier 2023-09-20 16:51:38 -04:00
Zach Daniel
b0bd2d23d9 improvement: support map_with_tag storage mode for Ash.Union.
closes #694
2023-09-18 10:13:22 -04:00
Zach Daniel
9102966d05 test: update tests to account for no authorizers == authorized 2023-09-18 10:09:27 -04:00
Zach Daniel
91013c2de0 improvement: support stacktraces in set_error 2023-09-12 11:26:11 -04:00
James Harton
5f6920ef92
improvement: Allow resources to opt out of the primary key requirement. (#687)
This is experimental and will likely cause breakages. It's to support time series tables.
2023-09-06 10:21:42 +12:00
Zach Daniel
567dcf6372 fix: better handling for negate error messages 2023-09-04 16:01:48 -04:00
Zach Daniel
69623a1efe chore: cleanups for new mix task 2023-09-04 01:23:57 -04:00
Barnabas Jovanovics
b661022736
fix: sort operator names in keyset (#684) 2023-09-01 06:53:01 -04:00
Zach Daniel
c5ea541b2d chore: rework atomics to atomic_update change and function
improvement: add `Ash.context_to_opts/1-2`
2023-08-29 14:39:38 -04:00
Zach Daniel
18cb24e7f7
improvement: implement atomics, expression-based changes (#682)
there is still a lot of potential work that needs to be on this front.
1. supporting atomics on create actions.
2. supporting atomics in upserts (this one may actually be much easier than the first one, for postgres specifically, due to ecto implementation details)
3. discovering places atomics can be more nicely integrated into existing changes, validations, policies
2023-08-28 16:05:26 -04:00
Zach Daniel
7d5fd04e5c fix: ensure that errors/records return the proper value in bulk creates
closes #681
2023-08-25 08:59:24 -04:00
James Harton
269889c34b
fix(Ash.Filter): Don't overly constrain related references. (#678)
We now only apply related policies to filter statements based on references
that are explicitly annotated as inputs.  This is the same logic that backs
protecting access in filters for field policies.
2023-08-21 19:39:07 -04:00
Tchowa Franck A
7e47bfb60f
improvement: validate all actions and accept/reject fields at once. (#674) 2023-08-18 20:47:35 -04:00
Tchowa Franck A
f302dca003
Feature: Ensure aggregate field is attribute or calculation. (#671) 2023-08-17 18:02:05 -04:00
Zach Daniel
b51dbe49c9 improvement: storage_type/0 -> storage_type/1 2023-08-17 17:52:00 -04:00
Zach Daniel
8233634bb1 improvement: properly set path into error instead of on error messages
TBD: this may break some people's tests, and so may need to be
reverted or released as part of 3.0
2023-08-15 16:23:06 -07:00
Zach Daniel
8c1f334075 improvement: expose union errors with path when tag is set 2023-08-15 14:07:28 -07:00
Barnabas Jovanovics
f85bc95ff5
chore: release version v2.14.0 (#669) 2023-08-09 19:43:55 +02:00
Zach Daniel
7ae9244d01 fix: don't optimized in/== predicates across incorrect boolean expressions 2023-08-08 12:17:07 -07:00
Zach Daniel
6daae630f4 fix: various fixes with runtime evaluation of aggregates
fix: handle mnesia transaction errors properly
2023-08-06 00:41:29 -04:00
Zach Daniel
cf99929230 improvement: initialize change opts in bulk actions
fix: better error message in `validate_related_resource_inclusion`
test: add test for arguments in bulk create actions
2023-08-02 12:41:54 -04:00
Zach Daniel
bda7c56543 improvement: support parent/1 in relationships 2023-07-26 16:46:22 -04:00
Zach Daniel
da73502a2f fix: before/after batch callbacks are no longer broken
test: add tests for those callbacks being executed
2023-07-22 19:51:27 -04:00
Zach Daniel
e5563ce664 fix: Keyword.fetch on keywords, fix test name 2023-07-19 11:18:20 -04:00
Zach Daniel
7f3ec1b8bf improvement: support distinct_sort 2023-07-19 11:06:01 -04:00
Zach Daniel
3c42062861 fix: allow the query & related fields to be read before authorization status is complete 2023-07-18 15:23:27 -04:00
Mariusz Morawski
e356691765
test: Add test that covers issue 652 (#657) 2023-07-18 14:48:26 -04:00
Zach Daniel
5b2efe5e5c improvement: support distincting on calculations
improvement: support distinct in ets data layer for testing
2023-07-18 14:35:25 -04:00
Zach Daniel
c0d8a86987 improvement: support resources directly in API modules
improvement: compile time warning on resources not detected in any apis
2023-07-13 01:38:21 -04:00
Zach Daniel
7114b5efbb improvement: exists type aggregate 2023-07-13 00:08:51 -04:00
Zach Daniel
2634d3d830 improvement: add at/2 function 2023-07-12 16:53:43 -04:00
Zach Daniel
d27e871b8f improvement: add string_split expression 2023-07-12 15:11:21 -04:00
skanderm
925f5c1f9a
fix: incorrect error for casting binary UUID (#653) 2023-07-11 20:35:01 -04:00
Zach Daniel
8e12a14b25 improvement: add field_policy_bypass
fix: fix and improve policy breakdown logs
improvement: optimize field selection/loading when possible
2023-07-11 10:28:07 -04:00
Barnabas Jovanovics
c442d83534
test: add test for aggregate field policy (#644) 2023-07-10 09:00:55 -04:00
Zach Daniel
be75743b13 fix: properly detect selected attributes for changeset field policies 2023-07-06 10:58:09 -04:00
Barnabas Jovanovics
8837bb0b0d
test: add test case for create action (#641) 2023-07-06 10:39:24 -04:00
Mariusz Morawski
5ed2109e33
improvement: Add Negate validation (#636)
* Add `Negate` validation
---------

Co-authored-by: Zach Daniel <zachary.s.daniel@gmail.com>
2023-07-05 16:25:51 -04:00
Alan Heywood
4ab7e84e4f
fix: typo in at_most validation message (#640) 2023-07-04 08:59:12 -04:00
Eduardo B. A
5fe72d4703
feat: Adds Ash.Changeset around_transaction (#632) 2023-06-27 22:13:50 -04:00
Zach Daniel
25f899d6f4 improvement: support specifying calculation as an option 2023-06-24 06:55:38 -05:00
Zach Daniel
51a86cd58d fix: fix field policy expressions
fix: handle various inconsistencies in runtime expression runner
2023-06-22 16:26:03 -04:00
Zach Daniel
4376cf9adb chore: fix reserved name test 2023-06-22 14:24:50 -04:00
Zach Daniel
c93c4b88f7 chore: fix credo/dialyzer 2023-06-22 14:19:40 -04:00
Zach Daniel
0b6d93c7c4 feat: add field_policies
see included documentation for more information on how field policies
work.
2023-06-22 14:00:11 -04:00
Zach Daniel
1a9b2c8406 improvement: fix loading w/ only nil values 2023-06-22 10:37:25 -04:00
Abhishek Tripathi
06329b97cf
improvement: add verifier for identity fields. (#626)
* improvement: adds verifier for identity fields.
---------

Co-authored-by: abhishek <abhishek.tripathi@tinymesh.in>
2023-06-20 01:05:41 -04:00
Zach Daniel
a7d069ae30 fix: properly set notification_data from loaded record 2023-06-14 20:40:04 -04:00
Zach Daniel
3f3a588df8 fix: properly handle lazy loaded many to many relationships 2023-06-14 19:52:05 -04:00
Dmitry Maganov
1ca4d9870a
fix: honor not_found_error?: true opt in code interface get actions (#620) 2023-06-14 09:43:51 -04:00
Zach Daniel
0e12686c61 fix: ensure attributes for keyset pagination are selected 2023-06-14 07:38:43 -04:00
Dmitry Maganov
984968d8ba
improvement: add support for generic actions in api.can (#617) 2023-06-13 09:35:27 -04:00
Dmitry Maganov
939b25d727
feat: generate some action helpers with code interface (#614) 2023-06-12 22:59:17 -04:00
Zach Daniel
d47dbe239c improvement: properly pass calculation args in keyset filters 2023-06-11 20:48:42 -04:00
RaspberryLambda
ffaf6d57df
* improvement: add data layer introspection to Ash.Resource.Info (#610)
---------

Co-authored-by: Daniel Stewart <mgdog1@googlemail.com>
2023-06-10 13:17:17 -04:00
Zach Daniel
be57b909b5 fix: honor query limit when streaming 2023-06-10 13:09:45 -04:00
Zach Daniel
25acc2d793 improvement: better keyset pagination behavior on first and last pages 2023-06-09 15:08:49 -04:00
Zach Daniel
6320dad188 fix: various fixes to data loading
improvement: `Ash.Query.accessing/2` to get a list of fields being accessed
improvement: builting `LoadAttribute` and `LoadRelationship` calculations
2023-06-09 00:16:27 -04:00
Zach Daniel
907aec5e82 improvement: support loading through types
Will document this in a separate PR. The broad strokes are this:

1. to load through an attribtue, `load(attribute: [:nested: :stuff])`
2. to load through a calculation, `load(calculation: {:%{...input}, nested: :stuff})`
3. union types support loading through them, and is done first by keying by the type name, i.e: `load(union: [type_name: [nested: :stuff])`.
4. union types support specifying a load statement for all types with `load(union: [*: [nested: :stuff]])`
2023-06-07 21:54:17 -04:00
Adam Harris
87045f3984
chore: add failing test to illustrate calculation issue 2023-06-07 10:13:08 -04:00
Zach Daniel
8e7815388e improvement: handle nils in memory the same way sql would have 2023-06-05 16:50:27 -04:00
Barnabas Jovanovics
5477102104
fix: also do not autogenerate values for optional fields that have a generator (#599) 2023-06-05 08:57:22 -04:00
Barnabas Jovanovics
1185b615f8
fix: Only create values for attributes that did not get a generator (#595) 2023-06-02 08:18:02 -04:00
Dmitry Maganov
adb6cefac1
fix: remove field name from string length error message (#594)
* fix: remove field name from string length error message

* fix: remove old unused `Error.Changes.UnknownError`

* fix: do not capitalize ash error messages

* fix: change error kind code for `Ash.Error.Forbidden.Policy`
2023-06-01 02:29:19 -04:00
Zach Daniel
5af9dc6696 fix: properly honor the return_errors? option 2023-05-25 09:46:27 -04:00
James Harton
7326ca330e
improvement(Ash.Type.Module): Add :module type. (#578) 2023-05-15 07:26:52 -04:00
Zach Daniel
f04ffd5ebd improvement: support bulk upserts 2023-05-02 21:56:15 -04:00
Zach Daniel
523452cb94 docs: basic actions -> generic actions 2023-05-02 20:00:18 -04:00
Zach Daniel
1e61ae2d3c improvement: finishing initial touches on bulk actions 2023-05-02 17:24:24 -04:00
Zach Daniel
0ced9c7639 fix: assorted bulk create fixes 2023-05-02 14:04:08 -04:00
Zach Daniel
80f696417d improvement: bulk create actions
This is not currently supported by any data layer other than ETS
2023-05-02 13:19:00 -04:00
Zach Daniel
2843224f06 fix: handle invalid input in basic actions 2023-05-02 02:07:53 -04:00
Zach Daniel
49949ff58f improvement: initial support for basic actions 2023-05-02 01:54:53 -04:00
Zach Daniel
fbd2b2f50c fix: set flow argument defaults 2023-04-27 13:42:18 -04:00
Zach Daniel
fbc341b3a0 feat: add Api.stream!/1 2023-04-26 17:12:21 -04:00
Zach Daniel
38ec164e3e improvement: include resource validations by default
improvement: validate explicit api configurations, with good error messages
2023-04-25 21:31:01 -06:00
Frank Dugan III
2e5f045f72
feat: add fields/1 and public_fields/1 to Ash.Resource.Info (#569) 2023-04-20 12:27:13 -06:00
Zach Daniel
ba5a7e2cb7 improvement: automatically gather up notifications 2023-04-12 17:35:17 -04:00
Zach Daniel
29096c27ae fix: properly return errors on invalid calculation arguments 2023-04-08 03:39:41 -04:00
Barnabas Jovanovics
b5e0cbb3cc
improvement: add constraints to maps (#556) 2023-04-07 09:53:41 -04:00
Zach Daniel
a20ee0abf7 chore: fix tests/stacktrace setting 2023-04-06 10:23:17 -04:00
Zach Daniel
80616781d6 Revert "chore: fix tests"
This reverts commit 67305a6ec8.
2023-04-06 09:38:21 -04:00
Zach Daniel
67305a6ec8 chore: fix tests 2023-04-06 09:32:10 -04:00
Zach Daniel
92208d8f84 chore: fix tests and add_expression_part 2023-04-05 20:49:28 -04:00
Zach Daniel
1ecde072f0 chore: consider strings in ref 2023-04-05 18:37:42 -04:00
Zach Daniel
a6e3ff233e fix: various ash flow return value fixes 2023-04-04 15:36:08 -04:00
Tommaso Patrizi
ad0a0ee8f7
test: tests for custom steps returning nil even when there is a right result (#552)
Co-authored-by: Tommaso Patrizi <tommasop@gmail.com>
2023-04-04 13:33:07 -04:00
Mariusz Morawski
a0287f96a0
fix: Fix set_new_attribute by adding missing option to set_attribute (#553) 2023-04-04 10:35:30 -04:00
Alan Heywood
698cbd1f4c
improvement: Add :field option to relate_actor change (#546) 2023-04-02 21:50:32 -04:00
Zach Daniel
a9db35e79f fix: properly handle nested calculation selects 2023-03-31 12:36:20 -04:00
Zach Daniel
7f1ee67dde improvement: update spark to fix deeply nested DSLs 2023-03-31 11:54:44 -04:00
Zach Daniel
648572386a improvement: properly set related resource 2023-03-30 08:27:37 -04:00
Zach Daniel
43d0233ae9 chore: fix test 2023-03-29 21:46:30 -04:00
Zach Daniel
1db7025b41 test: add a test for calc -> calc -> attribute chain
chore: simplify some code
2023-03-29 21:34:50 -04:00
Alan Heywood
6e76a91215
improvement: add :subfield option to relates_to_actor_via (#540) 2023-03-29 12:11:23 -04:00
Zach Daniel
b4163127f9 improvement: add accessing_from/2 builtin check 2023-03-29 09:19:49 -04:00
Zach Daniel
24d802cd4b fix: use values when already loading aggregates 2023-03-29 08:02:10 -04:00
Zach Daniel
ad347ca38b improvement: rewrite calculation loader
Calculation loading is complex because different calculations can
depend on differently parameterized things. FOr example:

```elixir
def load(_, _, _), do: [foo: %{arg: 1}]
def load(_, _, _), do: [foo: %{arg: 2}]
```

The previous naive implementation would simply merge all of the calculation loads, which naturally would not work. Now we ensure that we load each requirement in isolation.
2023-03-28 20:34:15 -04:00
Zach Daniel
ed45a72ea6 improvement: add skip_global_validations? option for actions 2023-03-21 13:33:48 -04:00
Zach Daniel
65f21e76be fix: datetime_add was actually datetime_subtract in elixir 2023-03-21 09:37:10 -04:00
James Harton
171967d6de
improvement: Add get_by option to read actions. (#530) 2023-03-21 18:03:06 +13:00
Zach Daniel
8b722e6460 fix: various fixes in aggregate authorization behavior
improvement: add `:read_action` and `:authorize?` configurations for resource aggregates
2023-03-17 12:02:37 -04:00
James Harton
a8346907c1
improvement: Add before_action/1 and after_action/1 to Ash.Resource.Preparations.Builtins. (#526) 2023-03-13 19:20:41 -04:00
Zach Daniel
5e5511aa60 chore: fix tests 2023-03-13 18:41:38 -04:00
Zach Daniel
a559a0cd3f improvement: add Ash.Type.NewType 2023-03-13 17:44:27 -04:00
Zach Daniel
b899a6ecf3 improvement: optimize policy check running with laziness
Implemented lazy evaluation of individual checks, so that checks that
are demonstrably irrelevant when building policies are not checked at all.
This will often mean no need to visit the sat solver at all, or only with
a very minimal set of filter checks.
2023-03-10 13:29:29 -05:00
James Harton
ee99bf367f
improvement: Add builtin changes for lifecycle hooks. (#523) 2023-03-09 19:59:39 -05:00
Zach Daniel
c643e9a88f improvement: add Api.can? and Api.can 2023-03-08 16:34:44 -05:00
Zach Daniel
5addfb37fb fix: calc loading in keyset pagination 2023-02-28 10:11:48 -05:00
Barnabas Jovanovics
f312d53eab
test: pass in arguments to validation (#518) 2023-02-28 10:03:35 -05:00
Zach Daniel
5c71e3b6bc fix: properly handle allow_nil fields in keyset pagination 2023-02-27 12:18:18 -05:00
Zach Daniel
41ea63aed3 improvement: support record's as calculate arguments 2023-02-24 10:54:25 -05:00
Zach Daniel
f060a2bdc4 improvement: include actor in all calculation context 2023-02-23 09:45:27 -05:00
Zach Daniel
2a6fe49348 fix: properly support calc expansion in policies
fix: support `nil` cast for resource type
2023-02-22 22:28:15 -05:00
Zach Daniel
005c1bc6c1 fix: allow argument references in policies 2023-02-22 20:12:08 -05:00
Zach Daniel
007e0fb081 improvement: don't eager load sort data 2023-02-21 19:05:40 -05:00
Darren Black
bc1f8382ab
improvement: Implement string_join expr function (#515) 2023-02-21 09:40:58 -05:00
Zach Daniel
f58752353a fix: set query context from before_action hooks into initial query 2023-02-21 09:29:08 -05:00
Zach Daniel
f53ca78f5c fix: various union fixes 2023-02-14 13:34:35 -05:00
Zach Daniel
0c767d0fa1 chore: allow page: [] in new pagination error 2023-02-13 23:44:58 -05:00
Zach Daniel
9924cfc7c0 chore: fix page detection error 2023-02-13 23:38:02 -05:00
Kevin Mathew
0e6763d8cc
improvement: Add error message when page is added but pagination is not enabled (#511) 2023-02-13 23:20:40 -05:00
Zach Daniel
0de50e132b improvement: add union type and some tests around it 2023-02-13 22:59:39 -05:00
Zach Daniel
8ad1778763 fix: pagination behavior is incorrect 2023-02-09 21:21:58 -05:00
Zach Daniel
30eaf1c6e8 feat: initial (and slightly experimental) Api.aggregate support 2023-02-04 00:47:15 -05:00
Zach Daniel
a043e26116 fix: properly handle nested array type constraint validation 2023-02-03 10:32:05 -05:00
Zach Daniel
28b7def5c9 improvement: no async loads except when loading on initial data 2023-01-30 00:06:34 -05:00
Zach Daniel
d7841a90db improvement: support length constraints on array embeds 2023-01-29 20:46:56 -05:00
Zach Daniel
22e07c06b5 improvement: don't load dependencies for calcs in query 2023-01-17 01:46:33 -05:00
Zach Daniel
36948d5047
test: created minimal test for the issue (#481)
Co-authored-by: Tommaso Patrizi <tommasop@gmail.com>
2023-01-16 10:04:09 -05:00
Barnabas Jovanovics
0e2dcd5771
fix: only pass action name in Ash.Changeset.for_action (#476) 2023-01-12 09:20:46 -05:00
Zach Daniel
70bc983b17 improvement: add Api.calculate/3 and define_calculation code interface builder 2023-01-08 23:39:12 -05:00
Zach Daniel
e804566cbf improvement: rename this to parent for clarity 2023-01-05 12:25:55 -05:00
Zach Daniel
c962bc7aa7 feat: add this/1 for use inside exists/2 (and other places eventually)
fix: various fixes to expression syntax
2023-01-04 12:17:40 -05:00
Zach Daniel
93cfe6c97e chore: remove test that produces warning because there is no way to silence it 2023-01-03 10:54:35 -05:00
Zach Daniel
c32d3cc49a improvement: warn on potentially incompatible relationship attributes
improvement: add `default_belongs_to_type` configuration
2023-01-03 10:52:19 -05:00
Zach Daniel
aedad5eae2 improvement: loading an attribute is now equivalent to ensure_selected
fix: calculations depending on aggregates were not including those dependencies properly
2022-12-30 14:40:36 -05:00
Maxim Martynov
7841075f35
improvement: Add Ash.Error.Invalid.TenantRequired error (#471) 2022-12-29 23:05:41 -05:00
Zach Daniel
d6f1361979 improvement: fix tests to handle new defaults 2022-12-22 01:28:50 -05:00
Zach Daniel
5da64349c6 fix: add test for string generator, and fix it 2022-12-20 20:42:41 -05:00
Barnabas Jovanovics
7689e8e531
fix: respect selects in related_query (#464) 2022-12-20 03:12:40 -05:00
Zach Daniel
c4b2701d65 fix: support dependencies on pruned branch steps 2022-12-19 01:49:36 -05:00
Zach Daniel
96409416cf improvement: more dependable notifications, support custom notifications better 2022-12-09 22:55:51 -05:00
Zach Daniel
34c33c7247 improvement: dep updates & new aggregate types avg/min/max/custom 2022-12-07 20:35:32 -05:00
Zach Daniel
55b3590f42 fix: more matching fixes on manual relationships 2022-12-07 01:10:34 -05:00
Zach Daniel
e403728cf4 fix: properly authorize manage relationship calls
improvement: don't run queries with `limit: 0`
2022-11-30 02:18:13 -05:00
Zach Daniel
52e7c133a6 fix: don't revisit nodes in the ash engine
fix: properly map to `:destroy` step names
2022-11-25 14:09:30 -05:00
Zach Daniel
2f3fcbad13 improvement: optimize various solver boolean optimizations
improvement: more comprehensively remove unnecessary clauses
fix: resolve issue with `authorize_unless` and filter checks
improvement: prevent changing attributes and arguments after action validation

We allow for these changes inside of `before_action` calls, but otherwise
require that `force_change_attribute` is used, for example. This prevents
accidentally validating a changeset and then changing an attribute.
2022-11-23 03:39:00 -05:00
Robert Ellen
59ddb5f5af
improvement: add error context to error creation / normalisation (#440) 2022-11-21 18:32:25 -05:00
Zach Daniel
865f9aa253 improvement: return invalid primary key errors for Api.get when the input can't be cast 2022-11-21 02:51:37 -05:00
Zach Daniel
a479970e23 improvement: much more readable errors when building loads 2022-11-21 01:37:58 -05:00
Frank Dugan III
e691222af0
fix: destroy action types default to accepts [] (#453) 2022-11-18 18:40:56 -05:00
Zach Daniel
c8d08a3265 fix: handle tuples properly in some cases in expression syntax 2022-11-16 12:00:43 -05:00
Kyle Grinstead
c0efa2ae1f
chore: add failing test for invalid syntax error (#444) 2022-11-16 11:47:43 -05:00
Zach Daniel
27ca1d2f3c fix: properly raise error on invalid type.
closes #422
2022-11-03 16:06:26 -07:00
Zach Daniel
cb192517c7 fix: allow references on both sides of in 2022-10-31 12:08:24 -04:00
Zach Daniel
6994295a8f fix: properly upsert all explicitly changed fields
fix: traverse maps for `template_references_actor?/1`
docs: various doc fixes
2022-10-31 11:33:51 -04:00
Zach Daniel
113d2452d2 improvement: replace templates in change/preparation/validation opts
Previously, only a few specific changes supported using `arg/1` or `context/1`
in their options. Now, those templates can be used in any change options,
built-in or not.
2022-10-31 02:25:01 -04:00
Zach Daniel
8cbd766172 feat: support anonymous functions in DSL
improvement: add more ergonomic manual action definitions.

The old method will likely be deprecated some time in the future (there is no rush really, they both work).
2022-10-30 21:00:57 -04:00
Michael St Clair
5626c8be2c
fix: don't add required belongs_to error if changeset is invalid (#437) 2022-10-30 17:40:10 -04:00
Zach Daniel
d70a05c805 fix: don't lazy load when managing relationships
if a relationship was loaded previously we were just using that relationship value.
However, this has a chance to cause incorrect behavior in edge cases. One such
edge case is illustrated here: https://github.com/ash-project/ash/pull/434 We can return to the
more optimized behavior when lazy loading is improved via https://github.com/ash-project/ash/issues/438
2022-10-30 10:36:26 -04:00
oco-adam
2c85e325cd
test: Add test demonstrating minimal example of strange upsert behaviour (#434) 2022-10-29 19:33:19 -04:00
Zach Daniel
e52d7187d8 improvement: more additions to the resource builder, update spark
test: add a test for loading many to many relationships on code interface actions
2022-10-28 10:18:01 -05:00
James Harton
2d6762ae61
feat(Ash.PlugHelpers): standardise conn interface for actors/tenants. (#432) 2022-10-27 17:52:42 -05:00
Zach Daniel
8c0e4de6bd improvement: allow using get_path/2 by name, as well as bracket access
prior to this, you had to say `map[:foo][:bar]`, but now you can also say
`get_path(map, [:foo, :bar])`. This makes certain things much clearer, i.e
`^arg(:foo)[:foo]`, which is problematic, would normally need to be written
as `(^arg(:foo))[:foo]` so that the pin only applied to the `arg/1` call.
This looks much nicer as `get_path(^arg(:foo), [:foo])`.
2022-10-24 07:57:21 -06:00
Zach Daniel
67814a2160 docs: add more context to manual relationship guide
docs: add a "Defining Idiomatic Actions" guide

chore: fix flaky tests
2022-10-23 23:08:17 -06:00
Zach Daniel
5e3b71e79b fix: properly load manual to_one relationships 2022-10-23 22:16:50 -06:00
Zach Daniel
986e08e0c2 fix: properly compare against decimal values
improvement: support floats & decimals in the `compare` validation
2022-10-21 10:46:46 -04:00
Zach Daniel
d1f05b6c42 fix: don't attempt to re-authorize access to already retrieved records in Api.load/2
improvement: show conditions in policy breakdowns
2022-10-20 13:00:23 -04:00
Zach Daniel
235e965627 improvement: sort relationship in order of input when managing it
This helps with things like https://github.com/ash-project/ash_phoenix/issues/57
which involve rendering the relationship value after editing it. Retaining
the order allows direct reuse without any gymnastics
2022-10-19 00:39:10 -04:00
Zach Daniel
4ca69be25e improvement: generate example class/er diagrams 2022-10-18 14:26:42 -05:00
Zach Daniel
4915e5d583 improvement: add now() to expression syntax 2022-10-18 14:19:28 -05:00
Zach Daniel
8474e60828 chore: more livebook cleanup 2022-10-17 11:04:28 -05:00
Zach Daniel
a365103087 clean up livebook/mermaid diagrams 2022-10-17 10:18:47 -05:00
Josh Price
3f572c65a2
feat: basic livebook generator and mix task (#420) 2022-10-17 08:52:24 -05:00
Zach Daniel
1e6be17618 fix: properly lateral join when possible
improvement: add `prepend?: true` option to sort
fix: use `prepend?: true` when applying relationship sorts
fix: don't miss dependencies in flow diagrams
improvement: use `simple_equality?/0` to allow for optimized equality checking
2022-10-15 00:03:03 -05:00
Zach Daniel
b0f245b961 chore: update flow pdfs 2022-10-14 01:26:16 -04:00
Josh Price
d1a49276b8
improvement: mermaid mix task for ER diagrams (#415) 2022-10-14 01:07:05 -04:00
Zach Daniel
362180190c fix: properly load calcs/aggs on manual relationships
It needs to be optimized, but it will do the trick for now.
2022-10-13 00:36:29 -04:00
Zach Daniel
48d96fc417 fix: properly load nested manual relationships 2022-10-12 21:30:48 -04:00
Zach Daniel
7f07f0d173 improvement: try to resolve flaky tests by not using named tables for private ets resources 2022-10-12 15:26:43 -04:00
Rebecca Le
491c88cacd
fix: allow overriding validation message on a list of errors (#412) 2022-10-12 11:44:32 -04:00
Frank Dugan III
62805fcce9
improvement: allow passing query or changeset in can/can?/4 (#410) 2022-10-10 11:50:13 -04:00
Zach Daniel
ae8e0e356b fix: don't show dependencies for run_flow steps in expanded view(they are duplicates) 2022-10-10 01:28:32 -04:00
Nelson Bassett
8378722244
improvement: Improve error when actions reject and accept keys overlap (#405)
* Test for overlapping action keys, and initial solution.

* Merged ValidateAcceptRejectpOverlap transformer into existing DefaultAccept transformer.

* Corrected formatting using mix format.
2022-10-09 18:05:54 -04:00
Zach Daniel
e9ca762e34 improvement: update to latest spark
chore: clean up tests & remove warnings
2022-10-08 14:00:08 -04:00
zimt28
fc4c60b125
improvement: Allow a single where condition for validations (#407) 2022-10-07 11:24:04 -04:00
Zach Daniel
b20c4afd9b improvement: haltable flows, branch step type
fix: fix chart links rendering
2022-10-06 17:04:44 -04:00
Ali Ahmed
0b7db5f3fb
feat: list arguments for resource actions in class diagrams (#399) 2022-10-06 02:04:21 -04:00
Zach Daniel
41b4b7fdbb improvement: simplify async task strategy
We now only start tasks once the synchronous work is done as anything
synchronous should be fast, generally.

Additionally, if there is only one task that we are about to start,
we can be confident that all we're going to do is wait for it,
so we can simply run it synchronously
2022-10-06 01:54:44 -04:00
Zach Daniel
c591bf6746 improvement: clean up new create authorization simplification 2022-10-05 20:08:36 -04:00
Zach Daniel
0efad5ae4e improvement: various Ash.Flow improvements, including returning the new Ash.Flow.Result 2022-10-04 16:21:38 -04:00
George Rodrigues
1f685a1413
docs: fix typos (#402) 2022-10-04 16:01:42 -04:00
Zach Daniel
c24d8e6d21 Revert "fix: switch from no_depend_modules in most places"
This reverts commit 650d8920e4.
2022-10-04 11:22:24 -04:00
Zach Daniel
dd6fd1fbc3 improvement: allow select/load callbacks for calcs to return irrelevant keys
test: add a test case for nested required calculations
2022-10-04 00:22:40 -04:00
Zach Daniel
650d8920e4 fix: switch from no_depend_modules in most places 2022-10-03 21:47:45 -04:00
Juha
fdebbeb242
improvement: Forbid reserved field names (#388)
Co-authored-by: Juha Lehtonen <juha.lehtonen@relexsolutions.com>
2022-10-03 16:19:16 -04:00
SpaceEEC
ace38cd31f
improvement: validate accepted and rejected attributes in actions (#395) 2022-10-03 12:16:53 -04:00
SpaceEEC
14a1b92963
feat: show_private? option for diagrams (#396) 2022-10-03 11:30:10 -04:00
Josh Price
3d2f8277ad feat: generate mermaid entity relationship diagrams from a given api (#376) 2022-10-01 22:22:00 -04:00
Zach Daniel
95a4aa3708 improvement: optimize for relates_to_actor_via 2022-09-30 15:13:04 -04:00
Zach Daniel
0e13456eb0 improvement: optimize relates_to_actor_via checks 2022-09-28 20:37:19 -04:00
Zach Daniel
b12b5e34bb fix: properly require a condition of a following bypasses 2022-09-28 16:38:32 -04:00
Zach Daniel
24bdf9058e improvement: catch more cases in preflight authorization checks 2022-09-27 14:58:48 -04:00
zimt28
33a6438f00
test: Add test for strict_check with filter policy (#387) 2022-09-27 14:43:29 -04:00
Zach Daniel
a8bce0ab23 improvement: lazily set required loads/selects for calcs/sorts 2022-09-26 18:08:18 -04:00
Zach Daniel
3b803d4c55 fix: various fixes with complex policy statements
improvement: simplify filter statements further
improvement: don't overconstraint filters on related data
test: get started on some more complex policy tests
2022-09-25 13:21:17 -04:00
Zach Daniel
fbcd745401 improvement: properly mark conditions w/ access_type
fix: handle statically false conditions in filter logic
2022-09-22 21:03:33 -04:00
Zach Daniel
1f6fb8d7af chore: fix tests 2022-09-20 19:44:04 -04:00
Zach Daniel
87f20369bc improvement: deprecate :replace in favor of :relate_and_unrelate 2022-09-19 15:44:06 -04:00
Zach Daniel
2ca0f09444 improvement: add loading?/1 query helper
improvement: add `loading/1` built in check
2022-09-19 10:14:08 -04:00
Zach Daniel
003ba3246b fix: add a case for calculations as tuples in expr filters 2022-09-16 03:47:12 -04:00
Zach Daniel
2c2c207e68 fix: use Comp.equal?/2 when finding loaded data matches 2022-09-15 00:55:04 -04:00
Darren Black
865d028667
chore: Guard length function for invalid input (#380) 2022-09-15 00:10:01 -04:00
Zach Daniel
a5f51e8f1b fix: properly error on types when evaluating expressions at runtime 2022-09-14 22:31:32 -04:00
Darren Black
a572099e24
improvement: Implement length function (#379) 2022-09-14 13:28:42 -04:00
Zach Daniel
e36f8c3e59 improvement: add filterable? option to relationships
improvement: add data layer capability for aggregate relationships & filter relationships
improvement: add guide on manual relationships
2022-09-13 13:53:05 -04:00
Zach Daniel
dc154596f4 chore: add in commented test 2022-09-12 13:38:00 -04:00
Zach Daniel
f583ababbc fix: fix keyset pagination ordering bug
fix: short names are snake cased
2022-09-12 11:17:44 -04:00
Zach Daniel
5c81d2b4a7 fix: properly do pagination
docs: fix some docs, add some guides
2022-09-11 22:19:37 -04:00
Zach Daniel
3644d05cd6 Revert "improvement: make two queries for full keyset pagination support"
This reverts commit 64b3312cb9.
2022-09-11 18:35:02 -04:00
Zach Daniel
64b3312cb9 improvement: make two queries for full keyset pagination support
docs: add store context in process guide
2022-09-11 16:07:21 -04:00
Zach Daniel
619adcee93 improvement: add exists/2 expression 2022-09-06 18:02:01 -04:00
Zach Daniel
c380cc1a14 docs: sanitize things for docs 2022-08-30 16:45:55 -06:00
Zach Daniel
6c40747320 improvement: options for prepending/appending hooks
docs: guides improvements
2022-08-28 19:27:44 -06:00
Zach Daniel
1bb3468851 improvement: add tracing and telemetry 2022-08-28 19:27:44 -06:00
Zach Daniel
f9941a6c75 improvement: update spark, use new transformer style 2022-08-28 19:27:44 -06:00
Zach Daniel
04744f395f improvement: move functions to more conventional places
improvement: move ash.formatter task to `spark.formatter`
2022-08-28 19:27:44 -06:00
Zach Daniel
6c79519b6c improvement: make long-awaited DSL name changes 2022-08-28 19:27:44 -06:00
Zach Daniel
a5f616812b improvement: replace Ash DSL underpinnings with Spark 2022-08-28 19:27:44 -06:00
Zach Daniel
584a927776 improvement: add value_is_key option for managed relationships 2022-08-22 12:26:31 -04:00
Darren Black
548247a8b7
fix: False default value for argument is nil in changeset (#364) 2022-08-22 10:41:25 -04:00
Mike Buhot
150f7178b8
improvement: Replace usage of Timex.shift with builtin Calendar functions (#362) 2022-08-17 19:18:03 -04:00
Zach Daniel
917131c21f improvement: handle required but not accepted values better 2022-08-17 12:58:43 -04:00
Zach Daniel
b9675295e6 improvement: support authorize? as a changeset option 2022-08-09 20:25:43 -04:00
Zach Daniel
ca9c80b6b0 improvement: better sanitization around sensitive attributes in filters
docs: general doc improvements
2022-07-25 18:47:30 -04:00
Zach Daniel
347907029b improvement: change always_authorize? to authorize for multiple options 2022-07-21 22:23:18 -04:00
zimt28
ed44036400
Improve module names (#357) 2022-07-21 10:19:47 -04:00
Zach Daniel
98a64577d9 improvement: add || and && operators
improvement: sort parsing helpers
test: fix flaky test
2022-07-19 19:15:23 -04:00
zimt28
81c085b9a3
improvemtn: Add accept_default option (#351)
* Add accept_default option
2022-07-19 10:03:23 -04:00
Zach Daniel
c9f20f1488 improvement: add process-based actor, tenant and query/changeset context
improvement: add `always_authorize?` and `require_actor?` to api config
2022-07-19 00:49:05 -04:00
Frank Dugan III
3776af9f85
feat: add can?/4 policy utility (#349)
* feat: add can?/4 policy utility

* refactor: change defaults and add can/4

* refactor: add typespecs, rename test
2022-07-14 10:05:51 -04:00
Zach Daniel
a023aaff95 fix: make mnesia and ets work properly when sharing tables
fix: make updates properly merge with mnesia and ets
fix: `attribute_writable?` also makes it public
2022-07-13 15:05:55 -04:00
Zach Daniel
ba559936d8 improvement: code_interface optional arguments
test: add some load tests
2022-07-11 22:59:51 -04:00
Zach Daniel
0f3521b2f4 improvement: improve behavior of lazy?: true option
before, any calculation that determined that it needed to load
would always load its dependencies, but now if they are already loaded
then dependencies won't be reloaded
2022-07-11 21:31:50 -04:00
Maciej Malecki
9707b4b7fe
Use a proper operator in the attribute_does_not_equal validation (#348)
Previously, it was using `if current != expected do raise` while it
needs to do the opposite. Also, simplify the logic by making `update`
work in the same way as `create` (compare upcoming value - not the
original one).
2022-07-07 14:12:32 -04:00
Zach Daniel
40904cae80 fix: add back in writable? option to relationships, and add attribute_writable? to belongs_to 2022-07-06 08:30:13 -04:00
Zach Daniel
394e2d089a improvement: add match_other_defaults? to attribute 2022-07-05 10:18:50 -04:00
Zach Daniel
ac4590a0ca improvement: remove relationship writability, as it all happens through arguments now
improvement: repurpose `writable?` on `belongs_to` to make the attribute writable
2022-07-05 08:16:38 -04:00
Zach Daniel
f718ee94e7 improvement: new timeout error message and test it 2022-06-27 15:57:30 -04:00
Zach Daniel
ef3d1ea398 improvement: Ash.Generator 2022-06-21 21:00:47 -04:00
Zach Daniel
1d50c7aa79 improvement: add Ash.Seed module with seed helpers 2022-06-20 17:01:28 -04:00
Zach Daniel
e19ca1ec66 fix: always return all notifications if return_notifications?: true 2022-06-09 13:52:32 -04:00
Zach Daniel
ae823e3539 improvement: add from to notification, and notification_metadata to api 2022-06-08 13:16:42 -04:00
Zach Daniel
93424fd16a fix: keyset pagination counts all rows 2022-05-31 11:56:15 -04:00
Zach Daniel
6d0cbec244 fix: fetch items closest to cursor by reversing keyset sort 2022-05-31 11:17:14 -04:00
Zach Daniel
669c98b379 fix: keyset + before results must be reversed 2022-05-31 10:34:35 -04:00
Zach Daniel
7a0cfd3ab1 improvement: better error message on invalid keyset
closes #336
2022-05-30 16:32:17 -04:00
Simon Bergström
4273a5d23a
improvement: added options to the built-in function relate_actor/1 (#332) 2022-05-28 21:21:14 -04:00
Zach Daniel
02b1194062 chore: fix tests/transformers 2022-05-28 11:22:43 -04:00
Zach Daniel
8b10b892ef improvement: add :_pkey shortcut in pub_sub
improvement: validate `pre_check_with` is set for ets/mnesia identities
improvement: clearer and raised error message on changeset action mismatch
2022-05-28 11:12:08 -04:00
Darren Black
35a19f800d
fix: Make get and get! consistent with what they raise when no record found (#325) 2022-05-18 21:37:04 -04:00
Zach Daniel
44a72226da fix: don't ignore lazy load option 2022-05-18 13:11:30 -04:00
Zach Daniel
b3e0632792 improvement: move ash_policy_authorizer into core as Ash.Policy.Authorizer 2022-05-17 15:56:40 -04:00
Zach Daniel
5e270288e6 fix: require calculations specified on resource load 2022-05-17 11:54:02 -04:00
Zach Daniel
c71587642d chore: QoL improvements 2022-05-09 17:48:50 -04:00
Zach Daniel
904968b936 improvement: add no_fields? relationships 2022-05-03 18:56:37 -04:00
Zach Daniel
6e4ecc62e3 fix: run calc in data layer if it returns :unknown 2022-04-28 20:12:54 -04:00
Zach Daniel
6ce1b6e642 test: add a test on loading nested calculations in calculations 2022-04-28 18:17:59 -04:00
Zach Daniel
74cc7c4ad5 fix: don't ignore lexical tracker on modules in DSL
improvement: add manual read actions
fix: don't treat single actions of a type as primary
2022-04-28 18:08:00 -04:00
Zach Daniel
e502f51470 fix: properly load from load statement in calculations 2022-04-26 22:57:07 -04:00
Zach Daniel
d16432750f fix: use unpaginated read when loading 2022-04-20 19:43:41 -04:00
Zach Daniel
29ffdf9c5c chore: WIP on tests 2022-04-20 14:38:35 -04:00
Zach Daniel
4e19223173 improvement: tons of engine/timeout improvements 2022-04-17 23:56:01 -04:00
Josh Price
c03c3d6175
improvement: implement NaiveDateTime type (#312) 2022-04-16 22:09:44 -04:00
Josh Price
cf314d5a6b
improvement: Add time type matching existing date type (#310) 2022-04-16 09:31:31 -04:00
Zach Daniel
dbe2e9a818 fix: flaky test issue 2022-04-07 01:52:59 -04:00
Joe Cole
6dcbe26abe
fix: Enforce unique action names (#308)
Co-authored-by: Joe Cole <{ID}+{username}@users.noreply.github.com>
2022-04-07 01:14:07 -04:00
Zach Daniel
be9e564d57 chore: fix identity docs/tests 2022-04-06 12:22:34 -04:00
Zach Daniel
4fc53baf5f improvement: add eager validate identities
improvement: percolate `nil` values in operators in ash expresion language (like SQL)
chore: more docs work
2022-04-06 12:00:32 -04:00
Zach Daniel
7c13322aa4 improvement: add return_destroyed? option 2022-04-05 12:42:50 -04:00
Zach Daniel
84ed398980 chore: docs/ci work 2022-04-05 03:59:34 -04:00
Zach Daniel
6c523b9752 continue working on docs 2022-04-04 14:55:05 -04:00
Zach Daniel
022708c6b5 improvement: add api option to relationships
improvement: make default actions and primary actions far more explicit

this begins the official 2.0.0 work
2022-04-04 01:48:37 -04:00
Zach Daniel
8aa71c1e2c fix: fix paths for load in flow
improvement: better error messages on unknown
2022-04-02 02:39:55 -04:00
tlietz
da5306c773
improve: Provide api read error message on no data set (#302) 2022-03-29 21:07:44 -04:00
tlietz
12cfe0d848
improvement: validates attributes and relationships have unique names (#300) 2022-03-27 20:00:19 -04:00
Zach Daniel
f9734af48c chore: get final tests passing 2022-03-24 23:36:43 -04:00
Zach Daniel
7ba9715f27 fix: fix hanging issue when adding engine requests 2022-03-20 01:08:39 -04:00
Zach Daniel
96c45e1a58 improvement: add transaction steps to flow
fix: don't require `writable?: false` attributes
2022-03-19 23:51:45 -04:00
Zach Daniel
a53b61ddf4 feat: add Ash.Flow
feat: support recursive DSL entities.
improvement: unimport to avoid name collisions in nested DSLs
2022-03-15 17:42:29 -04:00
Zach Daniel
ba1b39536e feat: manual relationships
fix: make the formatter safer, again
2022-02-20 22:46:39 -05:00
Zach Daniel
079b941e90 chore: release version v1.50.18 2022-02-07 15:39:12 -05:00
Zach Daniel
2986838a19 fix: support new versions of ecto's struct fields
fix: fixes for elixir_sense plugin
2021-12-19 00:12:10 -05:00
Zach Daniel
4448a4eeb7 improvement: catch more equivalencey cases around is_nil in sat solver 2021-12-06 16:50:33 -05:00
Zach Daniel
83b2d13910 improvement: track defaults being set 2021-11-24 19:09:39 -05:00
Zach Daniel
2dbdc06536 improvement: add Ash.Query.equivalent_to/2
docs: small documentation tweaks
2021-11-16 22:46:14 -05:00
Zach Daniel
b6094b1e9c improvement: add subset_of? and superset_of? query macros 2021-11-16 19:17:57 -05:00
Michael St Clair
f9b7223d91
fix: use Date.add when using LessThanOrEqual with date value (#281) 2021-11-13 14:11:32 -05:00
Zach Daniel
7cb4401d8e improvement: support do/else blocks in if
improvement: support `cond`
2021-11-13 13:48:25 -05:00
Zach Daniel
034ed97efe fix: simplify and improve allow_nil checking 2021-11-09 03:26:50 -05:00
Zach Daniel
f16ffb3782 improvement!: breaking!: explicitly setting a value to nil on create no longer falls back to the default value
This behavior is more expected than silently switching back to the default, but it does have the potential
to cause issues for those relying on the old behavior. To get the *old* behavior, you'd want to add a change
that does something like `if is_nil(Ash.Changeset.get_attribute(changeset, :attribute)) do` to check if
it should set the value, and then uses `Ash.Changeset.change_attribute/2` to make the change
2021-11-09 00:39:19 -05:00
Zach Daniel
05d8eb1741 improvement: add allow_async? to calculations, default to false
improvement: add elixir evaluation step to expression calculations
2021-10-25 17:53:51 -04:00
Zach Daniel
5e6442c3e4 improvement: add get_by and get_by_identity to code interface
improvement: compile time validations for managed relationships
2021-10-19 21:39:30 -04:00
Zach Daniel
1f2f9802a3 fix: fix code interface on resources
improvement: breaking change! api level code interface *removed*, contact me on discord if you want a way to avoid changing to resource-based interface, but otherwise
switch to the resource based one by specifying `define_for YourApp.YourApi` in the `code_interface` block of each resource.
improvement: use proper equality checking in places where we were using simple elixir equality checking
2021-10-13 18:42:42 -04:00
Zach Daniel
922c87ea85 improvement: add resource registry validation
fix: move related field validations to resource
fix: remove join_attributes, which didn't do anything anyway
2021-10-11 15:14:33 -04:00
Zach Daniel
ff756b72a7 improvement: deprecation!
A deprecation warning will be shown at compile time to illustrate
a change from listing all of your resources in an api to listing
them in a registry and connecting that registry to the api
2021-10-07 02:41:02 -04:00
Zach Daniel
87627993b8 improvement: breaking change! don't define code interface by default
In an effort to improve compile times in general, and remove unnecessary
compile time dependencies, the code interface is not defined by default.
It is also now possible to define the code interface directly in the resource module,
via

```elixir
code_interface do
  define_for ApiModule
end
```

If you need to reenable the code interface, simply add the following to your api module:
```elixir
resources do
  define_interfaces? true
  ...
end
```
2021-10-06 17:43:22 -04:00
Michael St Clair
8af32a0053
chore: Bring over changes committed to master branch (#271)
Co-authored-by: kernel-io <git@omnium.co>
Co-authored-by: Zach Daniel <zach@zachdaniel.dev>
Co-authored-by: kernel-io <kernel-io@users.noreply.github.com>
2021-10-01 23:27:35 -04:00
Zach Daniel
05b279a029 improvement: use paramaterized types under the hood
improvement!: update ecto version
fix: pass constraints to sub-fields loaded in embeddable resources
2021-09-13 11:46:11 -04:00
Zach Daniel
650b256b2a test: fix tests w/ new get change 2021-09-09 02:18:26 -04:00
Zach Daniel
46f17dcc51 test: test manage_relationship on update 2021-08-05 00:46:53 -04:00
Zach Daniel
1c83f96d27 fix: allow before_action to manage belongs_to relationships 2021-08-04 11:35:32 -04:00
Darren Black
f3b622744d
chore: Failing test for updating a relation in a change (#258) 2021-08-04 10:53:55 -04:00
Zach Daniel
8e11a63e83 fix: load belongs to relationships before managing them 2021-08-03 03:26:01 -04:00
Zach Daniel
288cf49153 fix: honor on_missing: behavior for belongs_to relationships 2021-07-31 16:07:51 -04:00
Zach Daniel
13e06524a7 improvement: add belongs_to attributes *after* the others 2021-07-26 20:55:44 -04:00
Zach Daniel
4ea0e62a79 chore: ensure compiled in a different place
chore: credo
2021-07-22 16:26:02 -04:00
Frank Dugan III
8ba1a9a4c8
feat(Ash.Resource.Info): add &public_field/2 helper (#254)
feat(Ash.Resource.Info): add &sortable?/3 helper
2021-07-22 16:23:54 -04:00
Zach Daniel
759ef25577 fix: rename conflicting test name 2021-07-22 13:36:59 -04:00
Zach Daniel
9477f0e82a improvement: add {:arg, :name} input for set_attribute 2021-06-25 13:51:17 -04:00
Zach Daniel
d45a9dbbfa improvement: support calculation sorts 2021-06-05 18:11:09 -04:00
Zach Daniel
d247004610 feat: expression based calculations for filterable/sortable calculations
fix: aggregate authorization issues
improvement: tons of improvements across the board
2021-06-04 01:40:11 -04:00
Zach Daniel
231eeafd30 feat: expression calculations for sorting/filtering
improvement: small improvements/fixes across the board
2021-06-04 01:37:11 -04:00
kernel-io
35af220d9d
feat: add compare validator (#242)
Co-authored-by: David Culina <git@omnium.co>
2021-06-01 13:32:22 -04:00
Zach Daniel
d9debc07f1 fix: properly process managed belongs to relationships 2021-05-28 03:12:14 -04:00
Zach Daniel
4662c23f68 improvement: calculation.select/2 + select calculation option 2021-05-20 16:42:26 -04:00
Zach Daniel
dd40b24bf9 improvement: transactions for reads, notifications from read callbacks 2021-05-14 11:25:42 -04:00
Zach Daniel
69afdfce25 improvement: utility manage_relationship_source context 2021-05-10 18:03:36 -04:00
Frank Dugan III
a796e0d308
refactor: remove references to "side loading" (#236) 2021-05-09 17:24:48 -04:00
Zach Daniel
097447bf38 fix: run action changes on destroy
test: test manual actions
fix: pattern match manage_relationship notifications fix
2021-05-09 16:56:44 -04:00
Zach Daniel
1412052ff6 improvement: fix data-based side loads 2021-05-07 11:57:59 -04:00
Zach Daniel
f8604717bd fix: limit 1 on to one side load queries 2021-05-07 01:07:01 -04:00
Zach Daniel
46fb08f085 improvement: support sorted relationships 2021-05-07 00:28:51 -04:00
Zach Daniel
593b111069 improvement: add read_action option
feat: rework lateral joins for many to many performance boost
2021-05-03 16:21:29 -04:00
Zach Daniel
3de71bc7f1 chore: fix test + compile 2021-04-28 17:43:02 -04:00
Zach Daniel
9da95e6d75 improvement: support relationship filters 2021-04-28 17:39:30 -04:00
Zach Daniel
9df3803492 fix: don't include NotLoaded in manage_relationship 2021-04-25 18:35:19 -04:00
Zach Daniel
53ceb5b753 fix: compile time fixes
improvement: add `require_attributes` to create/update/destroy
2021-04-23 11:41:13 -04:00
Zach Daniel
143557e55c chore: fix lint 2021-04-22 12:03:18 -04:00
Zach Daniel
dd82fcc53b improvement: add first class support for enum types 2021-04-21 13:32:25 -04:00
Jason Axelson
f6fa5a98dd
improvement: Add detailed parameter checking for Api read functions (#229) 2021-04-18 19:45:38 -04:00
Jason Axelson
a4262965ea
chore: Enable Credo's Readability.StrictModuleLayout (#228)
Enforce layout of module parts
2021-04-18 19:41:49 -04:00
Zach Daniel
a6b880ce86 fix: handle no key provided to NotFound
chore: add tests for `get!`
2021-04-14 14:18:05 -04:00
Zach Daniel
e353ea49c3 fix: allow api.load/2 to load calculations
improvement: add `allow_nil_input` to create actions for api layers
improvement: add `load/1` builtin change
feat: change `get?: true` interface functions to raise on `nil`
2021-04-13 15:49:42 -04:00
Michael St Clair
6805d431ac
improvement: add sum aggregate (#221) 2021-04-04 16:00:53 -04:00
Zach Daniel
d6ee71ce53 feat: support Ash.Query.distinct/2
feat: add `build/2` query preparation
fix: manage_relationships *before* after_action callbacks
2021-03-31 17:13:20 -04:00
Zach Daniel
29b2c821fe fix: don't overwrite managed belongs_to relationships 2021-03-29 14:48:42 -04:00
Zach Daniel
11d658d077 fix: fix required relationships and add test 2021-03-28 13:44:21 -04:00
Zach Daniel
2f9fafcbc7 feat: add manage relationship types
improvement: don't accept relationships on actions anymore

improvement: require arguments

This probably broke a lot of people's setups, but it was a
necessary change. Better to get this stuff out while we're
still beta
2021-03-25 11:33:32 -04:00
Zach Daniel
4e8bd5bfbc fix: exception on invalid query arguments 2021-03-21 14:19:45 -04:00
Zach Daniel
b98650aeb7 fix: avoid exception in Changeset.new/2 for bad attribute 2021-03-20 17:16:57 -04:00
Zach Daniel
a1c5f1d06f fix: validate required attributes *after* before_action hooks 2021-03-16 23:09:36 -04:00
Zach Daniel
f6026c6895 fix: allow_nil?: false + default interaction 2021-03-14 23:06:18 -04:00
Zach Daniel
db47a15cf7 fix: properly validate allow_nil?: false on update
fix: properly validate `allow_nil?: false` private attributes
2021-03-13 09:25:13 -05:00