Commit graph

809 commits

Author SHA1 Message Date
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