Commit graph

180 commits

Author SHA1 Message Date
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
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
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
Zach Daniel
5c71e3b6bc fix: properly handle allow_nil fields in keyset pagination 2023-02-27 12:18:18 -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
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
22e07c06b5 improvement: don't load dependencies for calcs in query 2023-01-17 01:46:33 -05:00
Maxim Martynov
7841075f35
improvement: Add Ash.Error.Invalid.TenantRequired error (#471) 2022-12-29 23:05:41 -05:00
Zach Daniel
55b3590f42 fix: more matching fixes on manual relationships 2022-12-07 01:10:34 -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
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
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
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
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
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
zimt28
fc4c60b125
improvement: Allow a single where condition for validations (#407) 2022-10-07 11:24:04 -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
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
650d8920e4 fix: switch from no_depend_modules in most places 2022-10-03 21:47:45 -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
2c2c207e68 fix: use Comp.equal?/2 when finding loaded data matches 2022-09-15 00:55:04 -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
c380cc1a14 docs: sanitize things for docs 2022-08-30 16:45:55 -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
917131c21f improvement: handle required but not accepted values better 2022-08-17 12:58:43 -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
Zach Daniel
ba559936d8 improvement: code_interface optional arguments
test: add some load tests
2022-07-11 22:59:51 -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
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