Commit graph

78 commits

Author SHA1 Message Date
Jinkyou Son
2fc934fb61
fix: Fix error with nil value on structure types (#1380)
* Fix no cond clause evaluated to a truthy value error

* Fix error with nil value

* Add tests
2024-08-08 20:15:20 -04:00
Zach Daniel
a719c791ba improvement: add optimized path for casting embeds when they are simple
improvement: add `include_embedded_source_by_default?` config to optimize embeds
improvement: support `:fields` constraint on `:struct` type, enabling persistence
2024-08-07 16:47:01 -04:00
Jonatan Männchen
3de985ccc5
feat: Add Ash.Type.File (#1337) 2024-07-26 07:57:23 -04:00
Riccardo Binetti
df7adce976
fix: apply constraints to NewType even when casting an array (#1341)
The previous implementation was behaving differently when dealing with single
values and arrays.
Close #1342
2024-07-25 10:17:18 -04:00
Zach Daniel
99966d0e57 fix: fix enum typespec generation for strings/mixed types 2024-07-25 09:30:04 -04:00
Zach Daniel
b46e172627 fix: properly generate types for string & mixed enums 2024-07-25 07:34:53 -04:00
Barnabas Jovanovics
8a1c47c131
test: add test for string enum (#1344) 2024-07-25 07:24:50 -04:00
Jonatan Männchen
8d3b0b7246
improvement: Expose type t() on Ash.Type.Enum implementations (#1338) 2024-07-24 07:06:11 -04:00
Jinkyou Son
063e654405
fix: cast_input/2 of Ash.Type.NewType returning :ok (#1324) 2024-07-18 23:07:14 -04:00
Hannes Wüthrich
dad0bfd1c4
fix: handle casting nil vectors (#1316) 2024-07-17 09:52:12 -04:00
Zach Daniel
476dfede63 improvement: add cast_atomic_constraints callback and use it in core typest 2024-07-12 23:12:59 -04:00
Zach Daniel
7cb007d32d test: add tests for integers 2024-07-10 13:13:55 -04:00
Zach Daniel
3e1b15eae4 improvement: remove non-simple equality check for uuidv7 type 2024-07-01 09:38:23 -04:00
Alessio Montagnani
7f2e7d3ec1
improvement: bring uuid version 7 into the core (#1253) 2024-06-23 18:16:20 -04:00
Pierre Cavin
3cf9fcd8e5
feat: add new remove_nil_items? array type constraint (#1116) 2024-05-05 12:05:04 -04:00
Pierre Cavin
c05544663e
fix: run array type nil check after item constraints (#1115) 2024-05-05 11:49:23 -04:00
Jeremy Grant
45b76c209d
fix: union array argument/attribute handling when current attribute is (#1023) 2024-04-29 22:24:44 -04:00
Zach Daniel
c8e93877ea improvement: support atomics, update_query, destroy_query in ETS data layer 2024-04-25 22:18:54 -04:00
Riccardo Binetti
9c74e52bd8
improvement: make match/1 overridable in Ash.Type.Enum (#1020)
Allow handling additional inputs to map them to one of the enum values
2024-04-13 14:07:23 -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
Minsub Kim
75b2d2eb00
feat: add less_than, greater_than constraints to float, decimal (#936) 2024-03-22 02:39:59 -04:00
Riccardo Binetti
23055f0a18
feat: allow providing descriptions to Ash.Type.Enum values (#940)
As discussed in https://github.com/ash-project/ash_graphql/issues/116, this
allows extensions to use the description to use the provided descriptions.

The documentation assumes that if a user provides a description, it does so for
all values (since this seems to be a reasonable assumption and allows the nicer
keyword list syntax). However tests also cover an enum with some missing
descriptions.
2024-03-22 02:38:59 -04:00
Hannes Wüthrich
b398107ca3
fix: don't double-encode vector data (#934) 2024-03-20 16:32:45 -04:00
Alan Heywood
dbb4a38ea3
fix: only put keywords to be interpolated in message in error vars (#821)
* fix: only put keywords to be interpolated in message in error vars
---------

Co-authored-by: Zach Daniel <zachary.s.daniel@gmail.com>
2024-01-08 18:08:17 -05:00
Zach Daniel
3be83d6ca4 improvement: lay the groundwork for fully atomic actions 2023-12-16 10:14:02 -05:00
Robert Graff
014621cc09
test: reproduce bug casting embedded union arguments (#803) 2023-12-14 09:04:56 -05:00
Jeremy Grant
1ce05562aa
fix: change_attribute failing on a union attribute (#778) 2023-11-20 19:10:35 -05:00
Robert Graff
a48d43e79d
fix more handle change use cases (#757) 2023-10-25 17:47:50 -04:00
Robert Graff
f03b6a4370
fix: handle builtin types in unions (#752) 2023-10-25 08:31:25 -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
b51dbe49c9 improvement: storage_type/0 -> storage_type/1 2023-08-17 17:52:00 -04:00
Zach Daniel
8233634bb1 improvement: properly set path into error instead of on error messages
TBD: this may break some people's tests, and so may need to be
reverted or released as part of 3.0
2023-08-15 16:23:06 -07:00
Zach Daniel
8c1f334075 improvement: expose union errors with path when tag is set 2023-08-15 14:07:28 -07:00
Zach Daniel
d27e871b8f improvement: add string_split expression 2023-07-12 15:11:21 -04:00
skanderm
925f5c1f9a
fix: incorrect error for casting binary UUID (#653) 2023-07-11 20:35:01 -04:00
James Harton
7326ca330e
improvement(Ash.Type.Module): Add :module type. (#578) 2023-05-15 07:26:52 -04:00
Barnabas Jovanovics
b5e0cbb3cc
improvement: add constraints to maps (#556) 2023-04-07 09:53:41 -04:00
Zach Daniel
a559a0cd3f improvement: add Ash.Type.NewType 2023-03-13 17:44:27 -04:00
Zach Daniel
f53ca78f5c fix: various union fixes 2023-02-14 13:34:35 -05:00
Zach Daniel
0de50e132b improvement: add union type and some tests around it 2023-02-13 22:59:39 -05:00
Zach Daniel
a023aaff95 fix: make mnesia and ets work properly when sharing tables
fix: make updates properly merge with mnesia and ets
fix: `attribute_writable?` also makes it public
2022-07-13 15:05:55 -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
Josh Price
c03c3d6175
improvement: implement NaiveDateTime type (#312) 2022-04-16 22:09:44 -04:00
Josh Price
cf314d5a6b
improvement: Add time type matching existing date type (#310) 2022-04-16 09:31:31 -04:00
Zach Daniel
022708c6b5 improvement: add api option to relationships
improvement: make default actions and primary actions far more explicit

this begins the official 2.0.0 work
2022-04-04 01:48: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
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
143557e55c chore: fix lint 2021-04-22 12:03:18 -04:00
Zach Daniel
dd82fcc53b improvement: add first class support for enum types 2021-04-21 13:32:25 -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