Zach Daniel
82ae1d8754
chore: update version in readme
2023-02-05 12:42:16 -05:00
Zach Daniel
93e2a786f4
improvement: authorization filters are now attached by ash core
2023-02-04 01:56:06 -05:00
Zach Daniel
7dd1681b0f
chore: release version v1.3.6
2023-02-03 11:44:49 -05:00
Zach Daniel
dc74dd534c
fix: properly set next migration name
2023-02-03 11:44:34 -05:00
Zach Daniel
cc643393d9
improvement: add migration_ignore_attributes
...
chore: update ash, fix ci
2023-02-01 02:05:04 -05:00
Zach Daniel
c3979377bd
ci: use new postgres flag in CI
2023-01-31 22:47:08 -05:00
Zach Daniel
85e6ba9598
chore: add tool-versions
2023-01-31 22:35:24 -05:00
Zach Daniel
45e88e8405
chore: use new ci
2023-01-31 22:35:12 -05:00
Alan Heywood
09092cc051
test: demonstrate issue loading aggregate
...
Calling Api.load! to load an aggregate on an existing record, where
the aggregated record has a relates_to_actor_via policy on it causes
the following error. Note that this error was recently fixed when
loading the aggregate as part of the query.
1) test relates to actor via has_many and with an aggregate (AshPostgres.AggregateTest)
test/aggregate_test.exs:8
** (RuntimeError) Could not determined related for `exists/2` expression.
Context Resource: %{aggregates: %{}, calculations: %{}, data_layer: AshPostgres.DataLayer, public?: false, relationship_path: [], resource: AshPostgres.Test.Comment, root_resource: AshPostgres.Test.Comment}
Context Relationship Path: []
At Path: []
Path: [:organization, :users]
Related: nil
Expression: exists(organization.users, [id: "df84db36-b8de-485b-8e47-a86307588f79"])
code: |> Api.load!(:count_of_comments, actor: user)
stacktrace:
(ash 2.5.13) lib/ash/filter/filter.ex:2121: Ash.Filter.add_expression_part/3
(ash 2.5.13) lib/ash/filter/filter.ex:2037: anonymous fn/3 in Ash.Filter.parse_expression/2
(elixir 1.14.2) lib/enum.ex:4751: Enumerable.List.reduce/3
(elixir 1.14.2) lib/enum.ex:2514: Enum.reduce_while/3
(ash 2.5.13) lib/ash/filter/filter.ex:295: Ash.Filter.parse/5
(ash 2.5.13) lib/ash/query/query.ex:1803: Ash.Query.do_filter/2
(elixir 1.14.2) lib/map.ex:883: Map.update!/3
(ash 2.5.13) lib/ash/engine/request.ex:654: Ash.Engine.Request.apply_filter/4
(ash 2.5.13) lib/ash/engine/request.ex:561: Ash.Engine.Request.do_strict_check/3
(ash 2.5.13) lib/ash/engine/request.ex:522: anonymous fn/2 in Ash.Engine.Request.strict_check/2
(elixir 1.14.2) lib/enum.ex:4751: Enumerable.List.reduce/3
(elixir 1.14.2) lib/enum.ex:2514: Enum.reduce_while/3
(ash 2.5.13) lib/ash/engine/request.ex:255: Ash.Engine.Request.do_next/1
(ash 2.5.13) lib/ash/engine/request.ex:211: Ash.Engine.Request.next/1
(ash 2.5.13) lib/ash/engine/engine.ex:650: Ash.Engine.advance_request/2
(ash 2.5.13) lib/ash/engine/engine.ex:556: Ash.Engine.fully_advance_request/2
(ash 2.5.13) lib/ash/engine/engine.ex:497: Ash.Engine.do_run_iteration/2
(elixir 1.14.2) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
(ash 2.5.13) lib/ash/engine/engine.ex:440: Ash.Engine.run_iteration/1
(ash 2.5.13) lib/ash/engine/engine.ex:257: Ash.Engine.run_to_completion/1
(ash 2.5.13) lib/ash/engine/engine.ex:202: Ash.Engine.do_run/2
(ash 2.5.13) lib/ash/engine/engine.ex:141: Ash.Engine.run/2
(ash 2.5.13) lib/ash/actions/read.ex:170: Ash.Actions.Read.do_run/3
(ash 2.5.13) lib/ash/actions/read.ex:90: Ash.Actions.Read.run/3
(ash 2.5.13) lib/ash/api/api.ex:928: Ash.Api.load/4
(ash 2.5.13) lib/ash/api/api.ex:902: Ash.Api.load!/4
test/aggregate_test.exs:48: (test)
2023-01-31 10:35:33 +10:00
Zach Daniel
5875b68484
chore: update ash in CI and mix.lock
2023-01-30 13:45:21 -05:00
Alan Heywood
1dbd7f619d
Update test to demo issue with policy on aggregate
...
The issue occurs when an aggregate is loaded, and the aggregated
resource itself has a relates_to_actor_via policy.
The following error is produced at test/aggregate_test.exs:42
1) test relates to actor via has_many and with an aggregate (AshPostgres.AggregateTest)
test/aggregate_test.exs:8
** (RuntimeError) Could not determined related for `exists/2` expression.
Context Resource: %{aggregates: %{count_of_comments: #count<comments from #Ash.Query<resource: AshPostgres.Test.Comment>>}, calculations: %{}, data_layer: AshPostgres.DataLayer, public?: false, relationship_path: [], resource: AshPostgres.Test.Post, root_resource: AshPostgres.Test.Post}
Context Relationship Path: []
At Path: []
Path: [:post, :organization, :users]
Related: nil
Expression: exists(post.organization.users, [id: "236f08bc-6a3a-4a78-9911-2c24189dafac"])
code: |> Api.read_one!()
stacktrace:
(ash 2.5.12) lib/ash/filter/filter.ex:2121: Ash.Filter.add_expression_part/3
(ash 2.5.12) lib/ash/filter/filter.ex:2037: anonymous fn/3 in Ash.Filter.parse_expression/2
(elixir 1.14.2) lib/enum.ex:4751: Enumerable.List.reduce/3
(elixir 1.14.2) lib/enum.ex:2514: Enum.reduce_while/3
(ash 2.5.12) lib/ash/filter/filter.ex:295: Ash.Filter.parse/5
(ash 2.5.12) lib/ash/filter/filter.ex:995: Ash.Filter.add_to_filter/6
(ash 2.5.12) lib/ash/query/query.ex:1797: Ash.Query.do_filter/2
(elixir 1.14.2) lib/map.ex:883: Map.update!/3
(ash 2.5.12) lib/ash/engine/request.ex:650: Ash.Engine.Request.apply_filter/4
(ash 2.5.12) lib/ash/engine/request.ex:557: Ash.Engine.Request.do_strict_check/3
(ash 2.5.12) lib/ash/engine/request.ex:518: anonymous fn/2 in Ash.Engine.Request.strict_check/2
(elixir 1.14.2) lib/enum.ex:4751: Enumerable.List.reduce/3
(elixir 1.14.2) lib/enum.ex:2514: Enum.reduce_while/3
(ash 2.5.12) lib/ash/engine/request.ex:255: Ash.Engine.Request.do_next/1
(ash 2.5.12) lib/ash/engine/request.ex:211: Ash.Engine.Request.next/1
(ash 2.5.12) lib/ash/engine/engine.ex:650: Ash.Engine.advance_request/2
(ash 2.5.12) lib/ash/engine/engine.ex:556: Ash.Engine.fully_advance_request/2
(ash 2.5.12) lib/ash/engine/engine.ex:497: Ash.Engine.do_run_iteration/2
(elixir 1.14.2) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
(ash 2.5.12) lib/ash/engine/engine.ex:257: Ash.Engine.run_to_completion/1
(ash 2.5.12) lib/ash/engine/engine.ex:202: Ash.Engine.do_run/2
(ash 2.5.12) lib/ash/engine/engine.ex:141: Ash.Engine.run/2
(ash 2.5.12) lib/ash/actions/read.ex:170: Ash.Actions.Read.do_run/3
(ash 2.5.12) lib/ash/actions/read.ex:90: Ash.Actions.Read.run/3
(ash 2.5.12) lib/ash/api/api.ex:1005: Ash.Api.read_one/3
(ash 2.5.12) lib/ash/api/api.ex:998: Ash.Api.read_one!/3
test/aggregate_test.exs:43: (test)
2023-01-30 16:09:48 +10:00
Zach Daniel
42ec9cf46a
fix: override insert
function for proper ecto interop
2023-01-29 20:27:43 -05:00
Alan Heywood
acc947292d
Add failing test for inserting via Ecto.Repo.insert!
...
It should be possible to use this function, and it did work as of ash
v2.5.9. This test fails as of ash v2.5.10, which introduced adding
relationships to underlying ecto schemas. The bug is related to a
has_many relationship being present on the resource.
The test fails with:
1) test call Ecto.Repo.insert! via Ash Repo (AshPostgres.EctoCompatibilityTest)
test/ecto_compatibility_test.exs:6
** (Ecto.InvalidChangesetError) could not perform insert because changeset is invalid.
Errors
%{posts: [{"is invalid", [type: {:array, :map}]}]}
Applied changes
%{name: "The Org"}
Params
nil
Changeset
#Ecto.Changeset<
action: :insert,
changes: %{name: "The Org"},
errors: [posts: {"is invalid", [type: {:array, :map}]}],
data: #AshPostgres.Test.Organization<>,
valid?: false
>
code: |> AshPostgres.TestRepo.insert!()
stacktrace:
(ecto 3.9.4) lib/ecto/repo/schema.ex:270: Ecto.Repo.Schema.insert!/4
test/ecto_compatibility_test.exs:9: (test)
2023-01-30 10:40:45 +10:00
Zach Daniel
568fdb3330
ci: update ash version in CI
2023-01-29 18:43:57 -05:00
Zach Daniel
14d1f04a24
chore: update ash to latest version
2023-01-29 18:42:40 -05:00
Zach Daniel
4ee02a03b1
chore: release version v1.3.5
2023-01-29 18:24:19 -05:00
Zach Daniel
04a64b8b94
chore: credo
2023-01-29 18:24:11 -05:00
Zach Daniel
b52da94b32
fix: properly convert to/from ecto, only when necessary
2023-01-29 18:20:59 -05:00
Alan Heywood
f290ae47b8
Add failing test for policy + aggregate issue
...
The conditions for this issue to occur seem to be:
- DataLayer is Postgres
- Resource has a relates_to_actor_via policy on read
- The relates_to_actor_via path includes a has_many relationship
- An aggregate is loaded
The following error is produced:
1) test relates to actor via has_many and with an aggregate (AshPostgres.AggregateTest)
test/aggregate_test.exs:8
** (Ash.Error.Unknown.UnknownError) ** (ArgumentError) No such entity nil found.
code: |> Api.read_one!(actor: user)
stacktrace:
nil.spark_dsl_config()
(spark 0.3.8) lib/spark/dsl/extension.ex:129: Spark.Dsl.Extension.dsl!/1
(spark 0.3.8) lib/spark/dsl/extension.ex:158: Spark.Dsl.Extension.get_persisted/3
(ash 2.5.10) lib/ash/filter/filter.ex:2986: Ash.Filter.do_hydrate_refs/2
(ash 2.5.10) lib/ash/policy/check/relates_to_actor_via.ex:3: Ash.Policy.Check.RelatesToActorVia.try_eval/2
(ash 2.5.10) lib/ash/policy/check/relates_to_actor_via.ex:3: Ash.Policy.Check.RelatesToActorVia.try_strict_check/3
(ash 2.5.10) lib/ash/policy/checker.ex:63: Ash.Policy.Checker.do_strict_check_facts/3
(ash 2.5.10) lib/ash/policy/checker.ex:88: anonymous fn/2 in Ash.Policy.Checker.strict_check_policies/3
(elixir 1.14.2) lib/enum.ex:4751: Enumerable.List.reduce/3
(elixir 1.14.2) lib/enum.ex:2514: Enum.reduce_while/3
(ash 2.5.10) lib/ash/policy/checker.ex:9: anonymous fn/2 in Ash.Policy.Checker.strict_check_facts/1
(elixir 1.14.2) lib/enum.ex:4751: Enumerable.List.reduce/3
(elixir 1.14.2) lib/enum.ex:2514: Enum.reduce_while/3
(ash 2.5.10) lib/ash/policy/authorizer.ex:790: Ash.Policy.Authorizer.do_strict_check_facts/1
(ash 2.5.10) lib/ash/policy/authorizer.ex:372: Ash.Policy.Authorizer.strict_check/2
(ash 2.5.10) lib/ash/engine/request.ex:550: Ash.Engine.Request.do_strict_check/3
(ash 2.5.10) lib/ash/engine/request.ex:518: anonymous fn/2 in Ash.Engine.Request.strict_check/2
(elixir 1.14.2) lib/enum.ex:4751: Enumerable.List.reduce/3
(elixir 1.14.2) lib/enum.ex:2514: Enum.reduce_while/3
(ash 2.5.10) lib/ash/engine/request.ex:255: Ash.Engine.Request.do_next/1
(ash 2.5.10) lib/ash/engine/request.ex:211: Ash.Engine.Request.next/1
(ash 2.5.10) lib/ash/engine/engine.ex:650: Ash.Engine.advance_request/2
(ash 2.5.10) lib/ash/engine/engine.ex:556: Ash.Engine.fully_advance_request/2
(ash 2.5.10) lib/ash/engine/engine.ex:497: Ash.Engine.do_run_iteration/2
(elixir 1.14.2) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
(ash 2.5.10) lib/ash/engine/engine.ex:440: Ash.Engine.run_iteration/1
(ash 2.5.10) lib/ash/engine/engine.ex:257: Ash.Engine.run_to_completion/1
(ash 2.5.10) lib/ash/engine/engine.ex:202: Ash.Engine.do_run/2
(ash 2.5.10) lib/ash/engine/engine.ex:141: Ash.Engine.run/2
(ash 2.5.10) lib/ash/actions/read.ex:170: Ash.Actions.Read.do_run/3
(ash 2.5.10) lib/ash/actions/read.ex:90: Ash.Actions.Read.run/3
(ash 2.5.10) lib/ash/api/api.ex:1005: Ash.Api.read_one/3
(ash 2.5.10) lib/ash/api/api.ex:998: Ash.Api.read_one!/3
test/aggregate_test.exs:44: (test)
2023-01-29 16:15:16 +10:00
Zach Daniel
613e06c2d6
chore: release version v1.3.4
2023-01-27 20:54:52 -05:00
Zach Daniel
ce3cb0f2df
fix: support latest ecto interop changes in ash core
2023-01-27 20:54:40 -05:00
Zach Daniel
49c55eaac4
improvement: properly cast division to floats for elixir-y behavior
2023-01-26 23:48:19 -05:00
Zach Daniel
492d8e88e9
docs: add a comment about config added earlier
2023-01-25 10:15:01 -05:00
Zach Daniel
a9d46e0163
improvement: support for dynamically set repo
2023-01-19 09:33:19 -05:00
Zach Daniel
2c788ddb06
improvement: update ash
2023-01-18 01:05:28 -05:00
Zach Daniel
c9abef6e2c
chore: remove doc index
2023-01-18 01:00:23 -05:00
Zach Daniel
0dc741041f
chore: release version v1.3.3
2023-01-18 00:53:39 -05:00
Zach Daniel
ec2ccedeb6
improvement: update to new docs patterns
2023-01-18 00:53:21 -05:00
Zach Daniel
7bf4cf80b1
chore: release version v1.3.2
2023-01-17 09:58:14 -05:00
Zach Daniel
ee97fde9dc
fix: nest subqueries when required for distinct
...
fix: replace `{:in, ...}` type with `{:array, ...}`
2023-01-17 09:57:05 -05:00
Zach Daniel
0d52f27011
ci: upgrade beam versions
2023-01-11 08:10:54 -05:00
Zach Daniel
a9fec8bfa4
ci: update ash version in CI
2023-01-11 07:53:47 -05:00
Zach Daniel
954638f67f
chore: release version v1.3.1
2023-01-11 07:53:33 -05:00
Zach Daniel
91f9d9b9b2
fix: allow for non attribute aggregate references for first/list
2023-01-11 07:51:12 -05:00
Zach Daniel
0a6940eee4
chore: release version v1.3.0
2023-01-10 21:55:20 -05:00
Zach Daniel
a3577479e3
improvement: update to latest ash
2023-01-10 21:54:28 -05:00
Zach Daniel
41bfff4bf8
chore: release version v1.3.0-rc.4
2023-01-09 13:56:23 -05:00
Zach Daniel
79f84041ae
fix: properly join to all required relationships
2023-01-09 13:56:05 -05:00
Zach Daniel
d4ad6ce989
ci: fix build
2023-01-09 11:10:01 -05:00
Zach Daniel
e61fd377fe
chore: release version v1.3.0-rc.3
2023-01-09 10:41:46 -05:00
Zach Daniel
1aab3dd7e3
fix: properly type cast in fragments (and elsewhere)
2023-01-09 09:48:25 -05:00
Zach Daniel
9428f68ccf
chore: release version v1.3.0-rc.2
2023-01-06 17:46:38 -05:00
Zach Daniel
7ee60c76b1
chore: release version v1.3.0-rc.1
2023-01-06 17:46:23 -05:00
Zach Daniel
c15a6e4613
fix: undo changes that caused type casting bugs
2023-01-06 17:45:10 -05:00
Zach Daniel
f65c936a54
chore: release version v1.3.0-rc.1
2023-01-06 17:06:10 -05:00
Zach Daniel
3c496512e2
fix: use parent_expr
instead of this
...
fix: various expression & type building fixes
2023-01-06 17:05:23 -05:00
Zach Daniel
3e75d562ec
chore: release version v1.3.0-rc.0
2023-01-04 12:36:35 -05:00
Zach Daniel
475ec0f1ca
feat: support latest ash
2023-01-04 12:36:18 -05:00
Zach Daniel
7f3f02fc44
chore: optimize binding calculation
2022-12-31 09:22:12 -05:00
Zach Daniel
5a7f42fac1
improvement: support calc constraints
2022-12-28 23:11:55 -05:00