Commit graph

4416 commits

Author SHA1 Message Date
Zach Daniel
05feea14ef chore: avoid emitting read spans when only loading data 2024-08-21 20:47:37 -04:00
Dmitry Maganov
8d4a4b055a
fix: do not call tracer set_metadata with span type that it ignores (#1400) 2024-08-21 19:43:40 -04:00
Zach Daniel
1f3059b5bf fix: traverse calculated relationships when rewriting transient calculation values
chore: clean up sort call to `function_exported?`
2024-08-21 19:34:19 -04:00
Zach Daniel
b841eaf54c chore: add tests for accept & some opts improvements 2024-08-21 11:58:11 -04:00
Zach Daniel
d593e3cee9 improvement: error at compile for bypasses that will have no effect
chore: remove unused `checks` field from `%Ash.Policy.Authorizer.Policy{}`
2024-08-20 21:30:55 -04:00
Zach Daniel
7cf38273fa improvement: prevent unnecessary calls to Ash.load 2024-08-20 11:55:46 -04:00
Zach Daniel
48507eac13 chore: run proper callback and test that we call the loading callback 2024-08-20 10:25:50 -04:00
Zach Daniel
51f57b6390 chore: pass context to load relationships 2024-08-20 10:18:01 -04:00
Zach Daniel
79c456f9fd chore: properly detect presense of load relationships 2024-08-20 09:39:48 -04:00
Zach Daniel
705e6b56e2 improvement: add load_relationships/5 callback to manual reads 2024-08-20 09:25:21 -04:00
Zach Daniel
f78d3ea7e5 chore: add final clause for uuid cast input 2024-08-19 22:05:30 -04:00
Zach Daniel
5fc5d32508 improvement: cache action known inputs individually
improvement: cache action required inputs all together
2024-08-19 21:49:34 -04:00
Zach Daniel
29e3a35d4c improvement: optimize to avoid inspects in changesets
improvement: optimize to avoid expensive `String.valid?` check in uuid type
2024-08-19 20:59:02 -04:00
Zach Daniel
d2d4be19fe improvement: add async? option to calculations, default to false
the vast majority of calculations will not benefit from being run
in a separate process, so the framework now defaults to running
them synchronously unless explicitly requested
2024-08-19 17:19:21 -04:00
Zach Daniel
a43624c9f3
improvement: add cascade update built in change (#1398)
---------

Co-authored-by: Alykhan Jetha <aj@marketcircle.com>
2024-08-19 11:34:38 -04:00
Zach Daniel
69b5e20b2f improvement: add uuid-v7-primary-key option to mix ash.gen.resource
closes #1396
2024-08-19 11:14:47 -04:00
Rebecca Le
057abfef18
docs: Stop the * in Ash.Type.* italicising everything when converted to Markdown (#1397) 2024-08-19 10:43:57 -04:00
Rebecca Le
4b42ef2e41
docs: Replace incorrect attribute policy check in Policies guide with an expr (#1393)
There is no built-in check for `attribute` - but the same logic can be expressed readably with a call to `expr`.
2024-08-17 11:00:42 -04:00
Zach Daniel
5500d65ddc ci: add optional codegen step to CI 2024-08-16 14:31:41 -04:00
Rebecca Le
707de0d664
docs: Fix code typo in Policies guide (#1392) 2024-08-16 08:15:33 -04:00
Zach Daniel
7071884d05 improvement: optimize field checking for loading fields in query
improvement: allow functions in tracers for lazy loading metadata
2024-08-15 21:19:23 -04:00
Zach Daniel
5a6583a019 fix: optimize filter expr traversal 2024-08-15 19:37:42 -04:00
dependabot[bot]
a86ef00521
chore(deps): bump the production-dependencies group with 2 updates (#1391)
Bumps the production-dependencies group with 2 updates: [ecto](https://github.com/elixir-ecto/ecto) and [reactor](https://github.com/ash-project/reactor).


Updates `ecto` from 3.11.2 to 3.12.1
- [Release notes](https://github.com/elixir-ecto/ecto/releases)
- [Changelog](https://github.com/elixir-ecto/ecto/blob/master/CHANGELOG.md)
- [Commits](https://github.com/elixir-ecto/ecto/compare/v3.11.2...v3.12.1)

Updates `reactor` from 0.9.0 to 0.9.1
- [Changelog](https://github.com/ash-project/reactor/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ash-project/reactor/compare/v0.9.0...v0.9.1)

---
updated-dependencies:
- dependency-name: ecto
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: production-dependencies
- dependency-name: reactor
  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-15 19:03:01 -04:00
Zach Daniel
2e13d2b0df improvement: add read_action option to cascade_destroy 2024-08-15 10:49:36 -04:00
Zach Daniel
ce5c080492 improvement: don't start processes for single items in list
chore: add some benchmarks/flame files
2024-08-15 09:14:43 -04:00
Jonatan Männchen
e200b5b9d1
chore: Implement upsert_condition for bulk create (#1389) 2024-08-14 20:26:03 -04:00
Zach Daniel
87d8263abb improvement: support expr and expr_type options when building aggregates
for example:

```elixir
calculate(
  :max_comment_similarity,
  :float,
  expr(max(comments, expr_type: :float, expr: fragment("similarity(?, ?)", title, ^arg(:to))))
) do
  argument(:to, :string, allow_nil?: false)
end
```
2024-08-14 20:11:58 -04:00
Alex Slade
61387e6ba0
docs: using multitenancy with code interfaces (#1388)
---------

Co-authored-by: Zach Daniel <zachary.s.daniel@gmail.com>
2024-08-14 18:42:56 -04:00
Zach Daniel
ba30ec880e chore: clean up tests 2024-08-14 11:46:18 -04:00
Zach Daniel
7cb3e04b2a fix: fix ets lateral join source field usage
fix: properly apply distinct in ets
2024-08-14 11:11:03 -04:00
Jonatan Männchen
93775109c7
improvement: Implement condition for upsert (#1386)
Resolves #1385
2024-08-13 19:19:13 -04:00
Zach Daniel
545b7a60f2
improvement: Optimize option validation with compile time validators (#1387)
A user doing load testing of their Ash application is seeing *wildly* significant performance improvements from this change. Unexpected, but naturally very pleasing.
2024-08-13 19:04:58 -04:00
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