Zach Daniel
079b941e90
chore: release version v1.50.18
2022-02-07 15:39:12 -05:00
Zach Daniel
1b2d28eb90
fix: no IO.inspect, and log errors from formatting
2022-02-02 17:14:29 -05:00
Zach Daniel
4138bd4934
improvement: initial implementation of ash resource formatter
2022-02-02 17:02:43 -05:00
Zach Daniel
9eff65758c
improvement: ensure no reserved names can be used as constraints
2022-02-02 17:02:43 -05:00
Zach Daniel
9143cf2359
chore: release version v1.50.17
2022-01-31 15:05:43 -05:00
Zach Daniel
5ba1cf5a1e
improvement: optimize if
and is_nil
functions
...
chore: change alpha -> beta
2022-01-27 15:17:21 -05:00
Zach Daniel
7a7cb12de7
fix: use ash_struct_fields
to accumulate schema struct field defaults
2022-01-24 14:36:08 -05:00
Zach Daniel
7174fa8583
improvement: add where
to change
2022-01-19 16:33:01 -05:00
Zach Daniel
501f375e60
fix: don't call add_aggregates w/ a map
2022-01-19 16:32:44 -05:00
Zach Daniel
101628471e
improvement: support data layers bulk adding aggregates
2022-01-12 13:47:01 -05:00
Zach Daniel
ef81843240
fix: allow new filter
pattern in typespec
2021-12-21 13:06:19 -05:00
Zach Daniel
ce3ae44a4c
improvement: add more authorizer state management
...
Added more opportunities for authorizers to pass back state.
This is being used to ensure that ash policy authorizer errors
can always have enough information to provide a policy breakdown
2021-12-21 12:24:12 -05:00
Zach Daniel
6b95dec339
improvement: customizable exception for authorizers
2021-12-21 01:07:06 -05:00
Zach Daniel
77f5e69c8c
fix: fix recursion in do_reverse_relationship_path/3
2021-12-20 22:13:52 -05:00
Zach Daniel
f0870461a4
fix: properly construct reverse relationship paths
2021-12-20 21:13:14 -05:00
Zach Daniel
e40806e021
improvement: cover more potential cases in filter parsing
2021-12-19 15:39:31 -05:00
Zach Daniel
2986838a19
fix: support new versions of ecto's struct fields
...
fix: fixes for elixir_sense plugin
2021-12-19 00:12:10 -05:00
Zach Daniel
6c5198eea4
improvement: add elixir_sense extension, to be merged when ready ( #275 )
2021-12-13 18:17:34 -05:00
Zach Daniel
88168de320
improvement: add Ash.DataLayer.Simple.set_data/2
...
docs: add data-layer-less resource guide
2021-12-07 21:39:07 -05:00
Zach Daniel
3ee5b059b0
improvement: complete mutually_exclusive_and_collectively_exhaustive logic
2021-12-07 15:08:50 -05:00
Zach Daniel
4448a4eeb7
improvement: catch more equivalencey cases around is_nil in sat solver
2021-12-06 16:50:33 -05:00
Zach Daniel
e1cd19950e
fix: undo an unnecessary contains
change
2021-12-06 00:33:25 -05:00
Zach Daniel
9fdb56587c
fix: WIP attempt to resolve ci_string typing errors
2021-12-06 00:25:07 -05:00
Zach Daniel
d9ce401bb4
fix: case clause error in Query.equivalent_to?
2021-12-01 14:59:23 -05:00
Zach Daniel
48d88151ba
fix: missing rename on refactor
2021-12-01 14:04:14 -05:00
Zach Daniel
6fcff37659
fix: typo in unquote
2021-12-01 14:03:48 -05:00
Zach Daniel
a5b130e5f4
improvement: expose small filter helpers
2021-12-01 14:02:44 -05:00
Zach Daniel
a46b5268d1
fix: mark contains
as a predicate
...
improvement: make to_simple_filter fail better, add failure option
2021-11-29 14:06:31 -05:00
Zach Daniel
df306ef2ad
improvement: add Transformer.eval/3
(for special use cases only)
2021-11-26 14:59:37 -05:00
Zach Daniel
83b2d13910
improvement: track defaults being set
2021-11-24 19:09:39 -05:00
Zach Daniel
2dbdc06536
improvement: add Ash.Query.equivalent_to/2
...
docs: small documentation tweaks
2021-11-16 22:46:14 -05:00
Zach Daniel
b6094b1e9c
improvement: add subset_of?
and superset_of?
query macros
2021-11-16 19:17:57 -05:00
Zach Daniel
b26e272bb4
fix: run calculations inline by default
2021-11-13 14:43:51 -05:00
Michael St Clair
f9b7223d91
fix: use Date.add when using LessThanOrEqual with date value ( #281 )
2021-11-13 14:11:32 -05:00
Zach Daniel
7cb4401d8e
improvement: support do/else blocks in if
...
improvement: support `cond`
2021-11-13 13:48:25 -05:00
Zach Daniel
f124e9bf7c
fix: cast nil input on strings
...
docs: add line on multitenancy
2021-11-11 14:27:57 -05:00
Zach Daniel
034ed97efe
fix: simplify and improve allow_nil checking
2021-11-09 03:26:50 -05:00
Zach Daniel
f16ffb3782
improvement!: breaking!: explicitly setting a value to nil on create no longer falls back to the default value
...
This behavior is more expected than silently switching back to the default, but it does have the potential
to cause issues for those relying on the old behavior. To get the *old* behavior, you'd want to add a change
that does something like `if is_nil(Ash.Changeset.get_attribute(changeset, :attribute)) do` to check if
it should set the value, and then uses `Ash.Changeset.change_attribute/2` to make the change
2021-11-09 00:39:19 -05:00
Zach Daniel
1d68df5cd3
improvement: add set_new_attribute/2
2021-11-09 00:01:59 -05:00
Zach Daniel
23dfebc59f
chore: add code interface docs
2021-11-07 01:24:45 -04:00
Zach Daniel
629708eecc
improvement: still filter in cases w/o a lateral join on load
...
fix: don't ask the data layer to sort if no sort is applied
2021-11-03 17:21:29 -04:00
kernel-io
3b06998df5
fix: set tenant at start of query build ( #278 )
2021-11-02 16:59:55 -04:00
Zach Daniel
ca631d27da
improvement: only_when_valid?
on changes
...
fix: set storage_type to `:uuid` for Ash.Type.UUID
2021-11-01 04:39:13 -04:00
Zach Daniel
68d7d10877
fix: remove IO.inspect
2021-10-29 19:53:24 -04:00
Zach Daniel
cd70686a4e
fix: add changes from last release that I forgot
2021-10-29 18:39:13 -04:00
Zach Daniel
ea73432ff1
improvement: compile time optimizations via configuration
...
improvement: breaking change! if you were previously relying on the undocumented
ability to configure resources using application config, you will no longer configure
them as `config :ash, DslEntity`, but rather you will set an otp_app on the entity,
e.g `use Ash.Resource, otp_app: :otp_app`, and then you'll configure that via
`config :otp_app, MyApp.Resource, ...`
2021-10-29 17:21:05 -04:00
kernel-io
4113595f69
fix: correctly handle errors in validate_required_belongs_to ( #276 )
2021-10-28 17:38:14 -04:00
Zach Daniel
9613ab812c
fix: set actor when loading to manage belongs_to
...
improvement: set `action` into data layer context
2021-10-28 16:11:11 -04:00
Zach Daniel
dc25e9d7e4
fix: cast to string before concatenating
2021-10-26 11:54:44 -04:00
Zach Daniel
13cffc852c
fix: always lateral join for many to many relationships
...
improvement: add `default` option for aggregates
2021-10-25 18:48:35 -04:00
Zach Daniel
05d8eb1741
improvement: add allow_async?
to calculations, default to false
...
improvement: add elixir evaluation step to expression calculations
2021-10-25 17:53:51 -04:00
Zach Daniel
e17daf6b02
improvement: global resource preparations
...
fix: unset `load` when running calculation queries
2021-10-25 16:59:11 -04:00
Zach Daniel
358a1b5cae
fix: breaking change! disambiguating functions in keyword filter syntax
...
it was possible to call functions in the form of `[function_name: [...args]]`,
but if you had relationships that overlapped w/ the function name that would cause problems.
To disambiguate, function arguments must now be provided as a tuple, e.g
`[function_name: {...args}]`.
2021-10-24 14:19:38 -04:00
Zach Daniel
e765eb5e10
fix: use correct typespec for Ash.Sort.parse_input/2
2021-10-23 02:51:49 -04:00
Zach Daniel
8683ca46c9
chore: set default for get?
2021-10-21 22:13:10 -04:00
Zach Daniel
0e66801ebe
improvement: add get? metadata
2021-10-21 22:12:28 -04:00
Zach Daniel
f0ab170b5d
chore: remove IO.inspect
2021-10-21 18:11:35 -04:00
Zach Daniel
1805c21075
improvement: custom error paths for managed relationships
2021-10-21 18:09:13 -04:00
Zach Daniel
d8f6aaedf2
fix: honor get_by
and get_by_identity
on bang (!) interfaces
2021-10-20 01:43:31 -04:00
Zach Daniel
5e6442c3e4
improvement: add get_by
and get_by_identity
to code interface
...
improvement: compile time validations for managed relationships
2021-10-19 21:39:30 -04:00
Zach Daniel
a4fef11c6e
fix: don't require primary actions if disabled
2021-10-19 05:25:33 -04:00
Zach Daniel
3bad25c1e0
improvement: add primary_actions?
option
2021-10-19 04:42:35 -04:00
Zach Daniel
38b357ade9
fix: don't validate allow_nil in attribute casting
2021-10-15 17:13:01 -04:00
Zach Daniel
1f2f9802a3
fix: fix code interface on resources
...
improvement: breaking change! api level code interface *removed*, contact me on discord if you want a way to avoid changing to resource-based interface, but otherwise
switch to the resource based one by specifying `define_for YourApp.YourApi` in the `code_interface` block of each resource.
improvement: use proper equality checking in places where we were using simple elixir equality checking
2021-10-13 18:42:42 -04:00
Zach Daniel
863ed1520f
fix: honor base query still when removing filters
2021-10-11 20:06:13 -04:00
Zach Daniel
922c87ea85
improvement: add resource registry validation
...
fix: move related field validations to resource
fix: remove join_attributes, which didn't do anything anyway
2021-10-11 15:14:33 -04:00
Zach Daniel
028c0c6c32
improvement: support module_prefix
for dsl extensions
...
fix: handle errors when validation calculation constraints
2021-10-08 15:59:15 -04:00
Zach Daniel
9fbc2921f9
fix: remove certain modules from avoiding recompilation
2021-10-07 13:37:37 -04:00
Zach Daniel
ff756b72a7
improvement: deprecation!
...
A deprecation warning will be shown at compile time to illustrate
a change from listing all of your resources in an api to listing
them in a registry and connecting that registry to the api
2021-10-07 02:41:02 -04:00
Zach Daniel
87627993b8
improvement: breaking change! don't define code interface by default
...
In an effort to improve compile times in general, and remove unnecessary
compile time dependencies, the code interface is not defined by default.
It is also now possible to define the code interface directly in the resource module,
via
```elixir
code_interface do
define_for ApiModule
end
```
If you need to reenable the code interface, simply add the following to your api module:
```elixir
resources do
define_interfaces? true
...
end
```
2021-10-06 17:43:22 -04:00
Zach Daniel
a955d89b8f
fix: make arrays default to nil_items?: false
2021-10-04 13:23:23 -04:00
Michael St Clair
8af32a0053
chore: Bring over changes committed to master branch ( #271 )
...
Co-authored-by: kernel-io <git@omnium.co>
Co-authored-by: Zach Daniel <zach@zachdaniel.dev>
Co-authored-by: kernel-io <kernel-io@users.noreply.github.com>
2021-10-01 23:27:35 -04:00
Zach Daniel
c19acf767c
fix: support on
for global changes
...
improvement: skip resource action if no changes have been made
improvement: add `changing_attributes?/1` to determine if any attributes are chaning
2021-09-20 16:30:30 -04:00
Zach Daniel
61dcd56d0e
fix: return proper result when input is struct
2021-09-19 14:17:14 -04:00
Zach Daniel
bead3f528e
improvement: add global changes
2021-09-18 21:57:44 -04:00
Zach Daniel
63b141a0b8
fix: remove File.read! from docs
2021-09-17 17:51:31 -04:00
Zach Daniel
1f47e63c0c
improvement: upgrade docs/tooling for elixir_sense
2021-09-17 17:44:11 -04:00
Zach Daniel
b2fea24a25
improvement: set docs statically
2021-09-17 01:43:18 -04:00
Zach Daniel
294130e3f3
improvement: improvements for elixirsense integration
2021-09-17 01:22:55 -04:00
Zach Daniel
3aaba3f340
improvement: transformer/extension improvements
...
improvement: add path to errors
2021-09-16 03:41:33 -04:00
Zach Daniel
3a284bb644
improvement: remove IO.inspect :*( and fix sobelow
2021-09-15 13:51:46 -04:00
Zach Daniel
c2bd76cba2
fix: set tenant properly on create interface
2021-09-15 13:50:11 -04:00
Zach Daniel
4e23e63428
improvement: support non-endpoint pubsub adapters
2021-09-14 17:17:56 -04:00
kernel-io
63a16be5de
fix: update type spec for Ash.Sort to include single atom instead of only list. ( #263 )
2021-09-13 21:52:48 -04:00
Zach Daniel
78aabebc38
fix: check action type properly in attribute validations
2021-09-13 16:18:17 -04:00
Zach Daniel
05b279a029
improvement: use paramaterized types under the hood
...
improvement!: update ecto version
fix: pass constraints to sub-fields loaded in embeddable resources
2021-09-13 11:46:11 -04:00
Zach Daniel
3ce4e68c80
fix: take creates into account w/ attribute_equals and attribute_does_not_equal
2021-09-12 22:31:11 -04:00
Zach Daniel
86e2648c91
fix: set changeset in destroy authorization request
2021-09-12 16:55:31 -04:00
Zach Daniel
a55696ef57
improvement: add after_action
option to create/update
2021-09-12 02:03:41 -04:00
Zach Daniel
bb0dda0f11
fix: return not found in all cases on get
2021-09-09 00:10:15 -04:00
Zach Daniel
97e08f7b92
fix: don't allow get! to return nil
...
fix: don't do db filters on creation
2021-09-08 23:57:45 -04:00
Zach Daniel
64ec412e5d
improvement: add config :ash, disable_async?: true
2021-09-08 22:55:22 -04:00
Zach Daniel
c7cfa878e7
docs: update description of allow_nil_input
2021-09-08 22:52:18 -04:00
Zach Daniel
d200d354e7
fix: honor allow_nil_input
in required validations
2021-09-08 22:51:22 -04:00
Zach Daniel
008ee84ddb
improvement: add meta[:order]
option for managed relationships
2021-09-02 12:45:38 -04:00
Zach Daniel
541545baa3
fix: hydrate metadata types
2021-08-29 15:14:29 -04:00
Zach Daniel
f4899a72f4
improvement: remove metadata from read actions
2021-08-29 14:20:02 -04:00
Zach Daniel
47bacbfe84
chore: fix lint/format
2021-08-27 20:35:25 -04:00
Zach Daniel
a22b689b07
improvement: support action level metadata
2021-08-27 20:34:20 -04:00
Zach Daniel
d786aadec7
improvement: add on_match: :destroy
option
2021-08-27 01:45:13 -04:00
Zach Daniel
fed720bb59
fix: cast nil
enum values propertly
...
improvement: if a map is given for a list, take it's keys
2021-08-22 03:54:11 -04:00
Zach Daniel
c6cafd94cc
fix: set api in destroy action hooks
...
improvement: set better error paths for invalid relationships
improvement: include api in changeset inspect
2021-08-16 10:55:15 -04:00
Zach Daniel
ad2f678b7e
fix: set argument defaults early
...
fix: don't add indices to non-list inputs in managed relationships
2021-08-11 10:43:21 -04:00
Zach Daniel
7ae048ac9d
fix: stop managed relationships from sourcing wrong data
...
This one took a while to finally figure out! Because belongs_to
relationships are managed *before* the action, and the data coming
into the calls to `manage_relationship` already has the new related
value, we need to use the original data from `changeset.data`. But
when I "fixed" it the first time, I made *everything* do that, which
is not correct, because the original data for the rest of the
relationships has not been loaded at that point yet. So belongs_to
gets its original data from `changeset.data` and the rest gets it
from the result of running the action.
2021-08-05 01:43:40 -04:00
Zach Daniel
1d6d5c8542
fix: redact fields in the resource struct as well
2021-08-04 19:16:49 -04:00
Zach Daniel
1c83f96d27
fix: allow before_action
to manage belongs_to
relationships
2021-08-04 11:35:32 -04:00
Zach Daniel
8e11a63e83
fix: load belongs to relationships before managing them
2021-08-03 03:26:01 -04:00
Zach Daniel
4e11e3f0ac
fix: don't lookup nil input
2021-08-03 00:50:45 -04:00
Zach Daniel
202c3344dc
chore: proper case clause syntax
2021-08-03 00:34:26 -04:00
Zach Daniel
e81028170d
fix: don't look for matches for nil
2021-08-03 00:17:36 -04:00
Zach Daniel
d82ea58dbe
fix: don't accept list inputs for managed belongs_to
2021-08-03 00:12:05 -04:00
Zach Daniel
a382a8ae20
fix: don't use list inputs in belongs_to managed
2021-08-03 00:00:37 -04:00
Zach Daniel
80cedce2a2
fix: remove belongs to related after action
2021-08-02 11:02:38 -04:00
Zach Daniel
a3ee29c433
fix: fix more cases where belongs_to isn't replaced
2021-08-01 18:48:12 -04:00
Zach Daniel
4872e357ed
chore: format code
2021-08-01 14:08:03 -04:00
Zach Daniel
288cf49153
fix: honor on_missing:
behavior for belongs_to relationships
2021-07-31 16:07:51 -04:00
Zach Daniel
9e5e958feb
fix: properly remove old belongs_to records
2021-07-30 12:42:24 -04:00
Zach Daniel
73578f6806
chore: remove IO.inspect
2021-07-27 23:04:22 -04:00
Zach Daniel
1f5538c7f0
fix: set source_query tenant in lateral join
2021-07-27 22:58:45 -04:00
Zach Daniel
13e06524a7
improvement: add belongs_to
attributes *after* the others
2021-07-26 20:55:44 -04:00
Zach Daniel
8f88cca020
improvement: pull relationship paths out of functions
2021-07-25 17:58:27 -04:00
Zach Daniel
dd7f5a8e8b
fix: no need to trap exits anymore
2021-07-23 13:16:42 -04:00
Zach Daniel
80e64ee4ad
fix: don't match on explicitly :exit
2021-07-23 12:12:37 -04:00
Zach Daniel
e0605f2bf0
fix: catch normal exit message from engine
2021-07-23 09:53:25 -04:00
Zach Daniel
b2ae6dc3ea
fix: flush engine state always
2021-07-23 09:45:47 -04:00
Zach Daniel
4ea0e62a79
chore: ensure compiled in a different place
...
chore: credo
2021-07-22 16:26:02 -04:00
Frank Dugan III
8ba1a9a4c8
feat(Ash.Resource.Info): add &public_field/2 helper ( #254 )
...
feat(Ash.Resource.Info): add &sortable?/3 helper
2021-07-22 16:23:54 -04:00
Zach Daniel
d95a0e1662
fix: load calculations from sorts properly
2021-07-22 15:22:53 -04:00
Zach Daniel
11c1762f82
fix: fix complex attribute check
2021-07-22 13:20:42 -04:00
Zach Daniel
579c83e20c
fix: disallow aggregate/calculation sorting w/ keyset pagination
...
This can be fixed by configuring pagination to fetch the resource by keyset
(so keyset is only ever primary key), but will perform worse because
we have to fetch the record. If someone would like to implement this,
let me know.
2021-07-22 12:47:43 -04:00
Zach Daniel
64568e5526
imrovement: handle sorts w/o an order in keyset pagination
2021-07-22 11:24:42 -04:00
Zach Daniel
0b8b704e2c
fix: ensure calculation compiled
2021-07-21 00:07:35 -04:00
Zach Daniel
247abbb833
fix: don't limit/offset aggregate queries
2021-07-19 22:07:00 -04:00
Zach Daniel
857b0d0a12
fix: call get_type
in cast_stored again
2021-07-19 20:58:18 -04:00
Zach Daniel
42aa56237b
improvement: speed up type loading
...
improvement: add `__order__` field to be used by data layers
chore: fix typespec for aggregates
2021-07-19 13:52:49 -04:00
Zach Daniel
1df33b7efd
improvement: add force?
option to apply_attributes/2
2021-07-18 19:25:54 -04:00
Zach Daniel
e306e1d7fc
fix: missing apply_attributes clause
2021-07-18 18:22:59 -04:00
Zach Daniel
2d9d96e699
fix: demonitor engine pid after run
2021-07-18 03:26:57 -04:00
Zach Daniel
0427a7a7c4
fix: on_lookup read is always on destination
2021-07-18 02:30:04 -04:00
Zach Daniel
e6010816c3
chore: fix dialyzer
2021-07-16 20:09:40 -04:00
Zach Daniel
03e5ae4a7a
fix: set item constraints properly
...
improvement: add on_lookup_read_action
2021-07-16 20:01:36 -04:00
Zach Daniel
19199f5b00
improvement: add in error paths for managed relationships
2021-07-14 20:14:40 -04:00
Zach Daniel
38a08bf2a6
improvement: set error paths on managed rels
2021-07-14 01:47:45 -04:00
Zach Daniel
409e47e02c
fix: fix simple data layer filtering
2021-07-11 19:18:43 -04:00
Zach Daniel
50b23a1656
improvement: always replace error message vars
...
improvement: minimize relationship source changeset context inspect size
2021-07-09 13:07:49 -04:00
Darren Black
6b6062ace6
Fix atom casting more ( #253 )
2021-07-08 00:39:01 -04:00
Darren Black
57da53a7bc
Fix atom casting when empty string ( #252 )
2021-07-08 00:24:05 -04:00
Zach Daniel
678533a8cb
chore: remove unused variable
2021-07-07 23:52:33 -04:00
Zach Daniel
c9a19a7c2c
fix: cast empty string to nil in atom
2021-07-07 23:51:54 -04:00
Zach Daniel
e2cd33fac3
fix: accept strings for atom types again
2021-07-07 22:25:41 -04:00