Commit graph

80 commits

Author SHA1 Message Date
Zach Daniel
8a368c0fcd fix: fix behavior of synthesized joins across data layers
test: fix our testing set up so its actually testing join synthesizer

closes #1354
2024-07-30 22:11:32 -04:00
Andreas Donig
28c1aa4f30
improvement: don't refer to private attributes when parsing filter inputs that refer to relationships (#1280)
---------

Co-authored-by: Andreas Donig <git@innwiese.de>
2024-07-10 12:14:27 -04:00
Andreas Donig
d436278616
fix: filter parsing cases (#1261)
* Fix the issue with the order of cases

* Make it pass all tests

* Add a test case for the new feature

---------

Co-authored-by: Andreas Donig <git@innwiese.de>
2024-06-30 07:26:25 -04:00
Zach Daniel
2681684922 improvement: add can_return_nil?/1 callback to Ash expressions 2024-05-14 17:58:13 -04:00
Zach Daniel
3263ec2ee9 fix: don't show a type error on nil for lists
closes #1166
2024-05-14 17:09:34 -04:00
Zach Daniel
5967ed3a48 improvement!: 3.0 (#955)
* improvement!: use `%Ash.NotSelected{}` for unselected values

* improvement!: default `require_atomic?` to `true`

* improvement!: raise errors on unknown generic action arguments

* improvement!: default bulk strategy to `:atomic`

* improvement!: warnings on `require_atomic?` `true` actions
improvement!: revise `Ash.NotSelected` to `Ash.NotLoaded`
improvement!: errors on unknown action inputs across the board

* doc: clarify wording in notifiers.md

closes #889

* improvement!: default `api.authorization.authorize` to `:by_default`

* improvement!: require the api when constructing changesets

this commit also fixes some work from prior commits around
the default value for the `authorize` option

* improvement!: code_interface.define_for -> code_interface.api

`code_interface.define_for` is now `code_interface.api`. Additionally, it is set automatically if the `api` option is specified on `use Ash.Resource`.

* improvement!: remove registries

* improvement!: pubsub notifier default to `previous_values?: false`
improvement!: requires_original_data? callback defaults to false

* improvement!: rename Ash.Calculation -> Ash.Resource.Calculation
improvement!: improve `Ash.Query.Calculation.new` signature
improvement!: anonymous function calculations now take lists and return lists
improvement!: make callback contexts into structs
improvement!: pass context to builtin lifecycle hook changes
improvement!: calculation arguments are now in the `arguments` key of the context

* chore: fix build

* improvement!: remove `aggregates` and `calculations` from `Filter.parse` and `Filter.parse_input`

* improvement: update spark to 2.0

* improvement!: make picosat_elixir optional with `simple_sat`

* improvement!: rename api to domain

* docs: add more info to upgrading guide

* docs: tweak docs formatting

* improvement!: remove `Ash.Changeset.new!`

* docs: update docs for `Ash.Changeset.new/1`

* improvement!: deprecate `private?: false` in favor of `public?: true`

* doc: add upgrade guide for private -> public

* improvement: update reactor to 3.0

* improvement!: default `default_accept` is now `[]`

* improvement!: `Ash.CiString.new/1` returns `nil` on `nil` input

* improvement!(Ash.Reactor): Improve integration with Ash 3.0 changes.

* improvement!: clean up and reorganize `Ash` functions

this is in preparation of deprecating the functions that are defined
on the api

improvement!: remove context-based functionality

* chore: update docs references from `Ash.Domain` to `Ash`

* chore: fix bad merge

* chore: fix context access in atomic changes

* improvement!: Deprecate calling functions on (domain) api in favor of `Ash`

* improvement!: add `attribute_public?` and update `attribute_writable?` behavior

* improvement!: update atomic behaviors, default to invalid

* chore: update downcase docs

* improvement!: changeset.filters -> changeset.filter

* improvement!: remove deprecated functions

* improvement!: remove and simplify `Ash.Filter.TemplateHelpers`

* improvement: import Ash.Expr in modules where it is used
improvement: require Ash.QUery in modules where it makes sense

* fix!: keyword lists are no longer special cased in ash expressions

* improvement: add structs for more context implementations

* chore: small tweaks, finish `:all` -> `:*` conversion

* chore: update DSL docs for multitenancy.global?

* improvement: ensure selects are applied on destroys
chore: remove TODOs

* chore: some docs changes

* improvement!: introduce strict mode to calculations

* chore: update tests

* improvement: support custom expressions

* docs: document custom expressions

* chore: fix and test custom expressions and function fragments
docs: update relevant docs w/ the changes

* improvement!: reverse order of before action & before transaction hooks

* improvement!: default read actions are now paginatable

* improvement!: require explicit accept lists in default actions

* chore: update docs

* improvement!: remove Ash.Flow and Ash.Engine

* chore: unlock unused deps

* chore: don't use unused variable

* chore: include ash flow change in upgrade guide

* improvement!: standardize various exception keys and names

* improvement!: use `Splode` for errors

* improvement: update upgrade guide to include Splode

* feat: code interface on the domain

* improvement: only require primary key if resource has actions or fields
improvement: only build schema if resource has actions or fields
improvement: verify primary key in its own verifier

* improvement: add `resource/1` builtin check

* improvement!: move simple_notifiers to an option instead of a DSL builder
improvement!: update spark for better autocomplete, configure autocomplete for key functions
docs: replace `an domain` with `a domain`

* improvement: better code interface documentation

* fix: set tenant on query so that root calles to Api.aggreagte work as expected (#929)

* chore: fixes from previous improvements

* chore: update splode

* chore: update splode

* improvement!: swap position of sort order and arguments in calculation sorting

* improvement!: add `include_nil?` aggregate option, and default it to `false`

* improvement: support notifiers within actions

* improvement: support specifying multiple filters

* improvement: add `sortable?` flags to all fields
improvement: support multiple filters on relationships

* improvement: support sensitive? on calculations and arguments

* improvement: validate resources in inputs to code interface

* chore: don't require explicit accept lists when using `default_accept :*`

* chore: update spark

* chore: update public attribute handling per 3.0

* improvement: update reactor and tests

* chore: better error message

* chore: fix rebase issue

* chore: handle merge issues
improvement: don't require domain on relationships if destination has domain

* improvement!: errors on unknown inputs for calculations

* improvement: always choose to cast atomic

* improvement: support casting some embeds atomically

* improvement: various 3.0 updates, documented in upgrade.md

* chore: Add failing tests for loads with with explicit domains. (#948)

Co-authored-by: James Harton <james@harton.nz>

* improvement: ensure non-static dynamic domains works

* improvement: add Ash.ToTenant protocol

* chore: add docs for no ToTenant option

* fix: properly construct new query in `build/3`

* chore: update simple_sat dependency

* chore: don't reselect when missing primary keys

* chore: remove IO.inspect

* chore: update spark

* chore: update spark

* improvement: use `Keyword.put_new` in `Ash.Context.to_opts` (#953)

* improvement: support bulk and atomic operations in code interfaces

---------

Co-authored-by: James Harton <james@harton.nz>
Co-authored-by: WIGGLES <55168935+WIGGLES-dev@users.noreply.github.com>
Co-authored-by: Dmitry Maganov <vonagam@gmail.com>
2024-03-27 16:31:59 -04:00
Zach Daniel
fc3cbc4e2c improvement: change nested field filtering to be done with at_path 2024-01-31 15:41:10 -05:00
Zach Daniel
f7716c5222 improvement: support referencing non-array embeds in input filters 2024-01-31 12:11:36 -05:00
Zach Daniel
3be83d6ca4 improvement: lay the groundwork for fully atomic actions 2023-12-16 10:14:02 -05:00
Jechol Lee
7b70c3a58e
test: Fix ParentTest (#793) 2023-12-05 01:36:40 -05: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
Barnabas Jovanovics
f85bc95ff5
chore: release version v2.14.0 (#669) 2023-08-09 19:43:55 +02:00
Zach Daniel
7ae9244d01 fix: don't optimized in/== predicates across incorrect boolean expressions 2023-08-08 12:17:07 -07:00
Zach Daniel
e804566cbf improvement: rename this to parent for clarity 2023-01-05 12:25:55 -05:00
Zach Daniel
c962bc7aa7 feat: add this/1 for use inside exists/2 (and other places eventually)
fix: various fixes to expression syntax
2023-01-04 12:17:40 -05:00
Robert Ellen
59ddb5f5af
improvement: add error context to error creation / normalisation (#440) 2022-11-21 18:32:25 -05:00
Zach Daniel
c8d08a3265 fix: handle tuples properly in some cases in expression syntax 2022-11-16 12:00:43 -05:00
Kyle Grinstead
c0efa2ae1f
chore: add failing test for invalid syntax error (#444) 2022-11-16 11:47:43 -05:00
Zach Daniel
cb192517c7 fix: allow references on both sides of in 2022-10-31 12:08:24 -04:00
Zach Daniel
8c0e4de6bd improvement: allow using get_path/2 by name, as well as bracket access
prior to this, you had to say `map[:foo][:bar]`, but now you can also say
`get_path(map, [:foo, :bar])`. This makes certain things much clearer, i.e
`^arg(:foo)[:foo]`, which is problematic, would normally need to be written
as `(^arg(:foo))[:foo]` so that the pin only applied to the `arg/1` call.
This looks much nicer as `get_path(^arg(:foo), [:foo])`.
2022-10-24 07:57:21 -06:00
Zach Daniel
4915e5d583 improvement: add now() to expression syntax 2022-10-18 14:19:28 -05:00
Zach Daniel
87f20369bc improvement: deprecate :replace in favor of :relate_and_unrelate 2022-09-19 15:44:06 -04:00
Zach Daniel
003ba3246b fix: add a case for calculations as tuples in expr filters 2022-09-16 03:47:12 -04:00
Darren Black
865d028667
chore: Guard length function for invalid input (#380) 2022-09-15 00:10:01 -04:00
Darren Black
a572099e24
improvement: Implement length function (#379) 2022-09-14 13:28:42 -04:00
Zach Daniel
e36f8c3e59 improvement: add filterable? option to relationships
improvement: add data layer capability for aggregate relationships & filter relationships
improvement: add guide on manual relationships
2022-09-13 13:53:05 -04:00
Zach Daniel
619adcee93 improvement: add exists/2 expression 2022-09-06 18:02:01 -04:00
Zach Daniel
6c79519b6c improvement: make long-awaited DSL name changes 2022-08-28 19:27:44 -06:00
Mike Buhot
150f7178b8
improvement: Replace usage of Timex.shift with builtin Calendar functions (#362) 2022-08-17 19:18:03 -04:00
Zach Daniel
ef3d1ea398 improvement: Ash.Generator 2022-06-21 21:00:47 -04:00
Zach Daniel
74cc7c4ad5 fix: don't ignore lexical tracker on modules in DSL
improvement: add manual read actions
fix: don't treat single actions of a type as primary
2022-04-28 18:08:00 -04:00
Zach Daniel
a53b61ddf4 feat: add Ash.Flow
feat: support recursive DSL entities.
improvement: unimport to avoid name collisions in nested DSLs
2022-03-15 17:42:29 -04:00
Zach Daniel
079b941e90 chore: release version v1.50.18 2022-02-07 15:39:12 -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
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
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
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
d45a9dbbfa improvement: support calculation sorts 2021-06-05 18:11:09 -04:00
Frank Dugan III
a796e0d308
refactor: remove references to "side loading" (#236) 2021-05-09 17:24:48 -04:00
Zach Daniel
3de71bc7f1 chore: fix test + compile 2021-04-28 17:43:02 -04:00
Zach Daniel
9da95e6d75 improvement: support relationship filters 2021-04-28 17:39:30 -04:00
Jason Axelson
a4262965ea
chore: Enable Credo's Readability.StrictModuleLayout (#228)
Enforce layout of module parts
2021-04-18 19:41:49 -04:00
Zach Daniel
72b5a57a25 feat: functional interface on the Api module
feat: resource aliases
improvement: require completely unique action names
2021-03-08 00:59:32 -05:00
Zach Daniel
e60e5bf281 fix: treat empty string as nil in manage_relationship
fix: be more conservative (and more correct) when optimizing predicates
2021-02-24 11:13:35 -05:00
zimt28
e10b273ce4
Ecto.UUID -> Ash.UUID (#188) 2021-02-23 12:27:49 -05:00
Zach Daniel
61e6b7c80c fix: various ci_string improvements
feat: add `contains/2` query function
2021-01-23 22:28:56 -05:00
Zach Daniel
bb91fd4bc7 fix: add action filters in for_read/3
fix: don't let local runner processes mix up messages

fix: runtime filter filters properly
2021-01-22 16:41:32 -05:00
Zach Daniel
f6f5d194bf feat: freeform expressions
feat: validatiosn in actions

feat: query arguments

feat: add `Ash.Query.for_read/3`

feat: return changeset with API errors

feat: add case insensitive string `CiString`/`:ci_string`

feat: support `context/1` and `arg/1` in filter templates

feat: support targeting notifications with the `for` option

feat: add `ago/2` query function

feat: add basic arithmetic operators (+, *, -, /)

feat: `sensitive?` option for attributes

feat: `sensitive?` option for arguments

feat: `private` arguments, which can’t be set using `for_<action>`

feat: add `prevent_change` which will erase changes just before the changeset is committed

feat: add `match?` validation that supports a custom error message

feat: add `interval` type to support `ago/2` function

feat: add `url_encoded_binary` type

feat: add `function` type

improvement: `changing?` is now a validation

improvement: add `Transformer.get_persisted/3`

improvement: add `api` field to `Notification`

improvement: standardize errors, add `to_error_class`

improvement: use `Comp` everywhere

Improvement: use action on changeset if set by `for_<action_type>`

improvement: `action_failed?` field on change sets

improvement: remove ability for data layers to add operators (for now at least)

Improvement: Changeset.apply_attributes/2 now returns an error tuple

Improvement: add a bunch of new/informative errors

improvement: runtime filter now uses left join logic (a naive implementation of it)

improvement: support more filter templates in resources

Improvement: basic/naive type system for operators/functions

Fix: properly expand module aliases for options w/o compile time dependency

chore(engine): track changeset changes for the request with `manage_changeset?: true`
2021-01-21 15:22:50 -05:00
zimt28
31cb4f4be3
improvement: Improve attribute defaults (#164) 2021-01-12 15:40:55 -05:00