Commit graph

4534 commits

Author SHA1 Message Date
Zach Daniel
3fce3bf485 chore: release version v3.4.1 2024-08-13 11:22:09 -04:00
Zach Daniel
1654ccdead fix: properly pass actor, action, tenant etc. to lazy loaded relationships 2024-08-13 11:16:00 -04:00
Zach Daniel
622561dc90 chore: add actor to policy errors for later use 2024-08-13 10:10:49 -04:00
Zach Daniel
f0c6e86d45 chore: remove unnecessary line in docs 2024-08-12 16:01:58 -04:00
Zach Daniel
542179c50e chore: changelog formatting 2024-08-12 15:54:43 -04:00
Zach Daniel
a7a3a7d3df chore: update changelog 2024-08-12 15:53:21 -04:00
Zach Daniel
fb55cee295 chore: release version v3.4.0 2024-08-12 15:46:36 -04:00
Rebecca Le
074b65ed7d
chore: Report which module is at fault, when raising an error about relationship domain inclusion (#1384) 2024-08-12 08:47:18 -04:00
Zach Daniel
5b40040c76 chore: fix recent calculation optimization to never prune authorization calcs 2024-08-09 17:28:44 -04:00
Zach Daniel
7991d84b0b chore: don't enumerate empty list 2024-08-09 17:19:28 -04:00
Zach Daniel
dc73c3a3d5 feat: add policy groups
Policy groups allow you to group policies by shared conditions.
This can help simplify the mental overhead of large sets of policies.

For example:

```elixir
policies do
  policy_group actor_attribute_equals(:role, :owner) do
    policy action_type(:read) do
      authorize_if expr(owner_id == ^actor(:id))
    end

    policy action_type([:create, :update, :destroy]) do
      forbid_if
      authorize_if expr(owner_id == ^actor(:id))
    end
  end
end
```
2024-08-09 16:48:54 -04:00
Zach Daniel
5a4864650b improvement: prune calculations made unnecessary by field policies
closes #1356
2024-08-09 13:46:02 -04:00
Zach Daniel
dc3f921d33 fix: remove pattern match error when exceptions come from calculations 2024-08-09 10:07:54 -04:00
Zach Daniel
2f22905ff3 chore: add better errors to help debug strange path/field errors in sort code 2024-08-08 20:26:53 -04:00
Jinkyou Son
b9a094dddd
docs: Fix typo (#1381) 2024-08-08 20:15:43 -04:00
Jinkyou Son
2fc934fb61
fix: Fix error with nil value on structure types (#1380)
* Fix no cond clause evaluated to a truthy value error

* Fix error with nil value

* Add tests
2024-08-08 20:15:20 -04:00
dependabot[bot]
ba6b7b708a
chore(deps): bump igniter in the production-dependencies group (#1379)
Bumps the production-dependencies group with 1 update: [igniter](https://github.com/ash-project/igniter).


Updates `igniter` from 0.3.17 to 0.3.18
- [Changelog](https://github.com/ash-project/igniter/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ash-project/igniter/compare/v0.3.17...v0.3.18)

---
updated-dependencies:
- dependency-name: igniter
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: production-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-08 18:48:58 -04:00
Zach Daniel
ea85829d98 improvement: add "hints" to NoSuchInput errors to make any errors clearer
closes #1352
2024-08-08 14:16:09 -04:00
Zach Daniel
e44d97bd25 fix: show proper error message when trying to accept non-writable attributes 2024-08-08 13:48:36 -04:00
Zach Daniel
793cd715a7 improvement: warn on usage of == nil 2024-08-08 13:05:39 -04:00
Zach Daniel
e4dcd1c397 improvement: implement Comp for atoms & strings, comparing atoms as strings 2024-08-08 11:38:16 -04:00
Zach Daniel
da91e2891e
fix: Pass options without :templated tuple to after_batch (#1376)
* Pass options without :templated tuple to after_batch

* fix: properly iterate non templated opts

---------

Co-authored-by: Jonatan Männchen <jonatan@maennchen.ch>
2024-08-08 10:14:06 -04:00
Zach Daniel
c0843b3eb7 chore: update igniter & fix warnings 2024-08-08 09:18:03 -04:00
Zach Daniel
a65a84fe83 chore: format 2024-08-08 09:07:59 -04:00
Jonatan Männchen
68ef4d3144
chore: Dialyzer Fixes (#1374) 2024-08-08 09:07:18 -04:00
Zach Daniel
b5d45325c5 chore: properly set atom keys & set error paths on embeddable types 2024-08-07 23:21:46 -04:00
Zach Daniel
4278660c9c chore: format 2024-08-07 23:02:05 -04:00
Zach Daniel
beb8ff7602 chore: fix error code in embeddable type 2024-08-07 22:57:31 -04:00
Zach Daniel
201687163f chore: update erorr message 2024-08-07 22:54:28 -04:00
Zach Daniel
823a9fbf4b chore: update error message 2024-08-07 22:53:10 -04:00
Zach Daniel
365ecffb5b improvement: increase cases where embedded attribute can be updated atomically 2024-08-07 22:45:38 -04:00
Zach Daniel
e86c5bce56 chore: follow up fixes for optimized embed creation 2024-08-07 22:16:19 -04:00
Zach Daniel
9a9e0c4e32 chore: properly set non-matched defaults in embeddable type 2024-08-07 21:36:37 -04:00
Zach Daniel
c8e1cddb2b fix: check for nil resource_calculation in Ash.Resource.loaded?/2 2024-08-07 21:35:42 -04:00
Zach Daniel
ac14b750d5 chore: add back in accidentally removed struct callbacks 2024-08-07 20:49:44 -04:00
Zach Daniel
1f056646a3 chore: set defaults in embedded attribute shortcut 2024-08-07 20:33:03 -04:00
Zach Daniel
763b0c59ed chore: update tests to avoid flakiness 2024-08-07 19:44:01 -04:00
Zach Daniel
ae2b737e87 fix: optimizations around allocating strings
fix: optimizations around list operations for embedded resources
2024-08-07 19:35:22 -04:00
Zach Daniel
a719c791ba improvement: add optimized path for casting embeds when they are simple
improvement: add `include_embedded_source_by_default?` config to optimize embeds
improvement: support `:fields` constraint on `:struct` type, enabling persistence
2024-08-07 16:47:01 -04:00
Zach Daniel
1711ecf574 chore: split on specifically run_calculate/4 2024-08-07 16:47:01 -04:00
Jonatan Männchen
d1efc3fb6c
fix: after_batch arguments for bulk_create with return_records? disabled (#1371)
Fixes #1369
2024-08-07 16:17:40 -04:00
Jonatan Männchen
4efe51418e
improvement: Warn on bulk action return_stream? without any other return_*? options enabled. (#1370)
Resolves #1368
2024-08-07 14:51:15 -04:00
Zach Daniel
5684b5784a improvement: add stacktrace information 2024-08-06 21:38:08 -04:00
Zach Daniel
0576c8c602 fix: set upsert? option when managing relationships in bulk creation 2024-08-06 12:45:23 -04:00
Zach Daniel
40a832019e fix: resolve nested expression calculation references in runtime filters
fix: properly consider not-loaded record calculations as `:unknown`
2024-08-06 08:44:49 -04:00
Minsub Kim
ad1a634fc0
test: use other resource's calculation in expr (#1365) 2024-08-06 08:44:15 -04:00
Zach Daniel
960af4b887 fix: handle nil in atomic array casting 2024-08-06 07:11:56 -04:00
Zach Daniel
58065c31cd improvement: remove :comparable as a dependency
It all compiles conditionally, so that if an explicit dependency exists
on `comp` it will still be used
2024-08-05 16:04:47 -04:00
Zach Daniel
e94e484885 chore: remove IO.inspect 2024-08-05 12:37:28 -04:00
Zach Daniel
c4a910a5d1 improvement: support authorize_with option on Ash.read 2024-08-05 12:36:19 -04:00