Commit graph

2062 commits

Author SHA1 Message Date
Zach Daniel
c5f59934d4 fix: dialyzer issues on sort 2023-11-14 10:52:32 -05:00
Zach Daniel
bb9b9aea37 fix: properly return constraints in aggregate get_type 2023-11-13 17:11:43 -05:00
Zach Daniel
1a2dc2a14c chore: format 2023-11-13 17:04:53 -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
Zach Daniel
575b1000d1 fix: properly thread constraints through aggregates 2023-11-13 16:47:24 -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
1470696a73 fix: properly strip extra record requested to detect more? pages. 2023-11-13 13:18:35 -05:00
James Harton
173f4ae5ad
docs: Spelling fix (wether -> whether). (#764)
Wether: noun
  1. A castrated male sheep or goat.

Whether: conjuction
  1. Used to indirect questions to introduce one alternative.
  2. Used to introduce alternative possibilities.
  3. Either.
2023-11-09 15:52:13 +13:00
Zach Daniel
780eae8d69 improvement: honor authorize?: false option in generic actions 2023-10-27 15:28:51 -04:00
Zach Daniel
291dea3de9 docs: update docs for pub sub 2023-10-27 13:22:33 -04:00
Zach Daniel
5ea570591b fix: don't attempt to key a struct 2023-10-27 11:07:11 -04:00
Zach Daniel
0a0148214a fix: ensure item constraints are passed to array casting 2023-10-27 00:37:28 -04:00
Zach Daniel
f7b2af8bcc fix: handle non-list values in Ash.Actions.Sort.process/4 2023-10-26 23:52:25 -04:00
Zach Daniel
348488e377 chore: fix typo copypasta 2023-10-26 22:07:33 -04:00
Zach Daniel
7b50a401d8 fix: optimize and make Ash.Type more consistent 2023-10-26 22:04:57 -04:00
Riccardo Binetti
f12a73ad88
docs: fix Ash.Resource.Preparation moduledoc (#759)
It mentioned changeset and change instead of query and preparation
2023-10-26 19:27:30 -04:00
Zach Daniel
34a4e416b0 fix: fix typespec for include_source/2 2023-10-26 10:11:54 -04:00
Zach Daniel
0988f31811 chore: fix typespec for error class module 2023-10-26 10:05:20 -04:00
Zach Daniel
8a31284015 chore: process sort before checking for parent exprs 2023-10-26 10:02:17 -04:00
Zach Daniel
4797e148ac improvement: detect more parent expressions 2023-10-26 09:58:08 -04:00
Robert Graff
a48d43e79d
fix more handle change use cases (#757) 2023-10-25 17:47:50 -04:00
Zach Daniel
e680867be9 fix: don't reorder global validations/changes
fix: use latest spark, and new persisters callback
fix: properly validate belongs_to relationships
2023-10-25 17:45:55 -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
f03b6a4370
fix: handle builtin types in unions (#752) 2023-10-25 08:31:25 -04:00
Zach Daniel
d6c1445974 chore: update docs 2023-10-24 12:42:35 -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
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
Frédérick Capovilla
5fe3cdc26e
improvement: add "filename" parameter to the livebook generator. (#746) 2023-10-21 22:32:05 -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
Kevin Schweikert
313ec74152
docs: inset code in set_attrbute docs (#745) 2023-10-21 14:13:45 -04:00
Zach Daniel
799a1d1dd3 fix: properly support get in Ash
fix: add back in accidentally removed transformer
2023-10-20 08:09:14 -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
0176958ec0 fix: cast functional default values 2023-10-19 12:06:56 -04:00
Zach Daniel
d5621fbc8c improvement: cast_input for default values at compile time 2023-10-19 11:57:07 -04:00
Zach Daniel
60977a4d6c chore: make credo happy 2023-10-19 11:25:33 -04:00
Zach Daniel
b605232f7e chore: comment out more unnecessary code 2023-10-19 11:14:57 -04:00
Zach Daniel
cb8fc298ae fix: temporarily omit overzealous validation 2023-10-19 11:14:08 -04:00
Zach Daniel
7d06d8fa46 fix: properly honor max_concurrency option
chore: remove IO.inspect
2023-10-18 16:53:12 -04:00
Zach Daniel
381d45a3f8 improvement: optimize bulk creates where results are not returned 2023-10-18 16:18:57 -04:00
Zach Daniel
ff88ce68b4
improvement: rewrite bulk creates, optimize changeset functions (#744) 2023-10-18 14:07:44 -04:00
De Wet Blomerus
52214bd2d9
docs: Remove extra trailing close-paran 🔥 (#743) 2023-10-17 21:38:08 -04:00
Zach Daniel
a92a0b4c9b fix: support tenant option in api.can
closes #736
2023-10-17 21:25:53 -04:00
Zach Daniel
b32f2e55ea fix: properly use constraints when casting expression values 2023-10-17 15:08:54 -04:00
Zach Daniel
ccf635e711 improvement: better storage_type handling, undo function change 2023-10-17 14:46:28 -04:00
Zach Daniel
24ae31c6dd fix: don't re-case constraints in the type function 2023-10-17 14:20:56 -04:00
Zach Daniel
c014fc2f0a chore: release version v2.15.19 2023-10-17 14:08:19 -04:00
Zach Daniel
7849541b29 chore: fix typespec 2023-10-17 13:58:17 -04:00
Zach Daniel
5d85c5be14 improvement: properly honor ecto type init callback 2023-10-17 13:39:21 -04:00
Zach Daniel
d9bacc1554 fix: handle new type constraints properly 2023-10-17 12:50:14 -04:00
Zach Daniel
12840ae235 fix: honor max_concurrency option 2023-10-17 12:24:28 -04:00
Zach Daniel
7301e09654 chore: fetch type in include_source/3 2023-10-17 11:11:18 -04:00
Zach Daniel
eca3b84105 chore: generalize embed type __source__ logic 2023-10-17 11:03:50 -04:00
Zach Daniel
c12f24d55d chore: changeset optimizations
ci: test ash-sqlite subproject
2023-10-17 10:49:37 -04:00
Zach Daniel
4900d69a92 chore: optimize upsert update defaults 2023-10-17 10:39:59 -04:00
Zach Daniel
6e2fa036d7 chore: update docs 2023-10-17 10:37:46 -04:00
Zach Daniel
ae147011ea fix: handle generic actions in list_arguments_and_attributes 2023-10-17 10:36:57 -04:00
Zach Daniel
fcc7e3b08a chore: revert recent change to datetime storage type default 2023-10-17 10:26:05 -04:00
Zach Daniel
20cc1cc24e improvement: various optimizations and compile time caching
fix: fix type casting for embedded resources
2023-10-17 10:18:26 -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
7f7469eb9f improvement: various performance improvements 2023-10-17 01:08:26 -04:00
Zach Daniel
52337b7bff improvement: various optimizations for bulk create actions 2023-10-16 23:50:05 -04:00
Zach Daniel
3dd61a6ff8 fix: ensure after action hooks are run on bulk creates 2023-10-16 17:00:04 -04:00
Zach Daniel
b2c7048359 fix: return records from batches if items have after action hooks 2023-10-16 16:30:15 -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
ecdc4c1c64 fix: don't transform errors to changesets when rolling back in with_hooks 2023-10-13 22:04:44 -04:00
Zach Daniel
931ff30641 fix: undo previous changes where transactional actions might not roll back
instead, I've added a `rollback_on_error?` option to allow more fine grained
control over what happens when you call an individual action and it encounters
an error and would roll back.
2023-10-13 18:12:48 -04:00
Zach Daniel
5a462a3ffc fix: undo regression where errors weren't wrapped in a changeset 2023-10-13 16:51:10 -04:00
Zach Daniel
7ff3a96db2 improvement: better handling of nested errors in transactions
If you call a nested action currently, and anything goes wrong, the whole
transaction is aborted. However, we want to be able to *recover* from
internal errors, and that means allowing things to fail without failing
the entire transaction. If something that *starts* a transaction
encounters an error, then it will rollback the transaction.
2023-10-13 14:33:25 -04:00
Zach Daniel
4fe4411286 fix: provide full constraints when determining Ash.Type.NewType storage types 2023-10-12 10:57:10 -04:00
Zach Daniel
b93cbb9577 fix: go back to original default timestamp behavior
fixes #733
2023-10-12 07:25:46 -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
658f071b81 improvement: move various transformers to be verifiers 2023-10-11 17:58:31 -04:00
Zach Daniel
68ec02a27b chore: update typespec for data layer feature 2023-10-11 15:13:49 -04:00
Zach Daniel
1ab4b6e69a improvement: support atomics on upserts 2023-10-11 15:09:06 -04:00
Zach Daniel
1cfcc296ae improvement: ensure all changesets sent batched to data layer have same set of atomics
this is necessary for upsert atomics
2023-10-11 12:05:17 -04:00
Zach Daniel
2de1e81b3b chore: fix more typespecs 2023-10-11 09:05:56 -04:00
Zach Daniel
c89b680d4b fix: move misplaced file and fix typespecs for Ash.DataLayer.Ets.Info 2023-10-11 09:02:32 -04:00
Zach Daniel
b0a4a23ab2 chore: appease credo 2023-10-10 17:02:11 -04:00
Zach Daniel
05dd361a52 fix: properly set invalid_keys on action inputs 2023-10-10 16:59:28 -04:00
Zach Daniel
be202918ac fix: properly validate required arguments for generic actions 2023-10-10 16:49:47 -04:00
Zach Daniel
c77ad34efb improvement: set storage type for citext to ci_string 2023-10-10 14:12:01 -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
407b09b677 fix: handle false values properly when passed to flows 2023-10-07 16:34:13 -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
49042b737d fix: properly rollback transactions on returned errors in generic actions 2023-10-06 13:39:05 -04:00
Zach Daniel
b8be1123ba fix: generate keysets immediately after read action 2023-10-05 22:50:15 -04:00
Robert Graff
2ad5d451b0
Fixes: casting an array attribute to nil (#723) 2023-10-04 14:55:30 -04:00
Zach Daniel
c2872b5181 fix: prepare_change_array on embedded types needs to handle nil
fix: handle_change_array on embedded types needs to honor `nil`
2023-10-04 13:59:26 -04:00
Zach Daniel
c691eb022c improvement: allow overriding cast_input/2 on NewType 2023-10-04 11:51:59 -04:00
Zach Daniel
3d72e190b2 fix: don't use || when fetching arguments because false || nil is nil
fixes #722
2023-10-03 16:30:50 -04:00
Zach Daniel
1042ea14fd chore: use uuids instead of unique integer for performance reasons 2023-10-03 13:42:18 -04:00
Zach Daniel
1fb169a73b fix: handle exceptions in generic actions
improvement: massage changesets & queries in `Ash.Error.to_ash_error/3`
2023-10-02 18:54:48 -04:00
Dmitry Maganov
6d94582360
fix: fix types for min/max constraints in Type.Float (#718) 2023-10-02 18:01:55 -04:00
Zach Daniel
2cd0ec5884 fix: lower compile time dependencies 2023-10-02 15:54:57 -04:00
Zach Daniel
ed9f0d4beb chore: fix invalid exception raise 2023-10-02 14:24:28 -04:00
Zach Daniel
290a5efbeb fix: raise cleaner error on missing action in bulk creates 2023-10-02 12:04:37 -04:00
Zach Daniel
b3fdea3e53 fix: allow for ref to contain nested templates 2023-10-02 11:24:17 -04:00
Barnabas Jovanovics
7e4caf043f
fix: return unions as is if load is empty (#714)
* return unions as is if load is empty

* do not load on forbidden fields
2023-09-29 10:21:05 -04:00
Zach Daniel
10b1030f5c chore: remove IO.inspect 2023-09-28 20:22:32 -04:00
Zach Daniel
82b9174afe fix: unions, only load through types when loadable 2023-09-28 20:11:29 -04:00
Zach Daniel
851d5a59d1 chore: remove unnecessary case 2023-09-28 19:58:38 -04:00
Zach Daniel
80812b0ced fix: handle empty list loads 2023-09-28 19:56:38 -04:00
Zach Daniel
c6dc97f17c fix: ensure constraints are properly set in map/new_types 2023-09-28 18:51:58 -04:00
Zach Daniel
4d62505f69 improvement: don't double cast ci strings 2023-09-28 17:25:38 -04:00
Zach Daniel
7581234799 fix: only set non-nil values unless __keep_nil__ in seed creation 2023-09-28 16:53:06 -04:00
Zach Daniel
0ce6909939 fix: Ash.Seed extracts attributes from the struct now 2023-09-28 16:12:13 -04:00
Zach Daniel
04c9249f24 fix: properly perform field authorization on loaded through types 2023-09-28 10:23:16 -04:00
Zach Daniel
e7a734f29b chore: support simple filters in runtime filterer 2023-09-28 08:37:07 -04:00
Dmitry Maganov
dedba7f471
fix: usage of get_by with belongs_to attribute (#712) 2023-09-27 22:20:16 -04:00
Zach Daniel
a00806eeb0 fix: static checks with conditions could be overly or insufficiently restrictive 2023-09-27 14:40:40 -04:00
Zach Daniel
00a582fbc1 chore: fix more syntax errors 2023-09-27 13:00:40 -04:00
Zach Daniel
e23c12c1c1 chore: fix syntax typo 2023-09-27 12:59:29 -04:00
Zach Daniel
9f97569dce improvement: add context option to bulk_create 2023-09-27 12:09:37 -04:00
Zach Daniel
c571625557 fix: set field policy opts on field policy conditions 2023-09-27 10:12:13 -04:00
Dmitry Maganov
972207a6da
fix: move Resource.Transformers.BelongsToSourceField into entity (#709) 2023-09-27 09:06:05 -04:00
Zach Daniel
5c8f96231e docs: finalize initial cheat_sheet/docs pattern 2023-09-26 23:13:40 -04:00
Zach Daniel
df2102501c chore: replace_doc_links now doesn't mess up source urls
chore: replace_doc_links now links to spark generated dsl cheat sheets
2023-09-26 22:25:08 -04:00
Zach Daniel
b0115f5116 fix: don't authorize on identity usage validations 2023-09-26 16:09:51 -04:00
Zach Daniel
d07ca084a5 fix: handle empty batches in bulk create 2023-09-26 15:22:37 -04:00
Zach Daniel
ae3125483c chore: fix trace span type dtypespec 2023-09-26 11:29:37 -04:00
Zach Daniel
27a368660f improvement: expose max/min constraints on Ash.Type.Float 2023-09-26 08:26:34 -04:00
Zach Daniel
728a63b416 chore: default Ash.Type.Datetime storage type
I shouldn't have to do this, though?
2023-09-25 11:19:25 -04: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
5466c88d58 improvement: explicitly validate manual action return types 2023-09-25 10:49:34 -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
64f134089b improvement: better UX around nimble options errors
improvement: remove old, now-deprecated config

While we *could* call that a breaking change, there is a warning explaining to users what
they would need to do if they have the deprecated value configured, and it has been in a
deprecation state for many months/releases now.
2023-09-25 09:27:03 -04:00
Zach Daniel
b6ef345936 chore: fix transaction call 2023-09-22 17:16:22 -04:00
Zach Daniel
b13c7f0e53 improvement: add Ash.Query.around_transaction/2 2023-09-22 16:46:43 -04:00
Dmitry Maganov
1aa0c9c84c
fix: revert :wrap_list usage for topic in PubSub, needs recursion (#702) 2023-09-22 06:52:53 -04:00
Zach Daniel
1a307385b5 improvement: add sequence generator utility 2023-09-21 18:51:30 -04:00
Dmitry Maganov
ecd7075fbc
fix: more usages of :wrap_list type (#700) 2023-09-21 08:34:46 -04:00
Zach Daniel
6a2f0e41e5 chore: format 2023-09-20 16:59:56 -04:00
Dmitry Maganov
a0ada2ed7d
fix: add missing usage of :default_belongs_to_type (#699) 2023-09-20 16:59:33 -04:00
Zach Daniel
1d43b26127 chore: move validate_relationship_attributes to a verifier 2023-09-20 16:51:38 -04:00
Zach Daniel
3d2c012189 chore: clean up dialyzer errors 2023-09-20 16:39:28 -04:00
Zach Daniel
05b9ac1f86 improvement: make storage_type overridable by new_types 2023-09-20 16:25:09 -04:00
Zach Daniel
17b1a0b2df fix: properly wrap [tracer] in Ash.Flow 2023-09-20 13:31:58 -04:00
Dmitry Maganov
e0d5a63c65
fix: use :wrap_list type where appropriate (#698) 2023-09-20 10:58:47 -04:00
Dmitry Maganov
77eae2954f
fix: get_by option can accept a single atom (#697) 2023-09-20 10:39:58 -04:00
Zach Daniel
c8e796fbcb fix: properly handle nil values in embedded resources 2023-09-18 20:57:32 -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
08f56eddf4 improvement: if no authorizers are set, anyone can do anything 2023-09-17 16:05:02 -04:00
Zach Daniel
38dc478719 fix: ensure that can always returns an error when asked 2023-09-17 16:03:25 -04:00