Commit graph

152 commits

Author SHA1 Message Date
Abhishek Tripathi
06329b97cf
improvement: add verifier for identity fields. (#626)
* improvement: adds verifier for identity fields.
---------

Co-authored-by: abhishek <abhishek.tripathi@tinymesh.in>
2023-06-20 01:05:41 -04:00
RaspberryLambda
ffaf6d57df
* improvement: add data layer introspection to Ash.Resource.Info (#610)
---------

Co-authored-by: Daniel Stewart <mgdog1@googlemail.com>
2023-06-10 13:17:17 -04:00
Zach Daniel
907aec5e82 improvement: support loading through types
Will document this in a separate PR. The broad strokes are this:

1. to load through an attribtue, `load(attribute: [:nested: :stuff])`
2. to load through a calculation, `load(calculation: {:%{...input}, nested: :stuff})`
3. union types support loading through them, and is done first by keying by the type name, i.e: `load(union: [type_name: [nested: :stuff])`.
4. union types support specifying a load statement for all types with `load(union: [*: [nested: :stuff]])`
2023-06-07 21:54:17 -04:00
Adam Harris
87045f3984
chore: add failing test to illustrate calculation issue 2023-06-07 10:13:08 -04:00
Dmitry Maganov
adb6cefac1
fix: remove field name from string length error message (#594)
* fix: remove field name from string length error message

* fix: remove old unused `Error.Changes.UnknownError`

* fix: do not capitalize ash error messages

* fix: change error kind code for `Ash.Error.Forbidden.Policy`
2023-06-01 02:29:19 -04:00
Zach Daniel
f04ffd5ebd improvement: support bulk upserts 2023-05-02 21:56:15 -04:00
Zach Daniel
38ec164e3e improvement: include resource validations by default
improvement: validate explicit api configurations, with good error messages
2023-04-25 21:31:01 -06:00
Frank Dugan III
2e5f045f72
feat: add fields/1 and public_fields/1 to Ash.Resource.Info (#569) 2023-04-20 12:27:13 -06:00
Zach Daniel
a20ee0abf7 chore: fix tests/stacktrace setting 2023-04-06 10:23:17 -04:00
Zach Daniel
80616781d6 Revert "chore: fix tests"
This reverts commit 67305a6ec8.
2023-04-06 09:38:21 -04:00
Zach Daniel
67305a6ec8 chore: fix tests 2023-04-06 09:32:10 -04:00
Zach Daniel
92208d8f84 chore: fix tests and add_expression_part 2023-04-05 20:49:28 -04:00
Mariusz Morawski
a0287f96a0
fix: Fix set_new_attribute by adding missing option to set_attribute (#553) 2023-04-04 10:35:30 -04:00
Alan Heywood
698cbd1f4c
improvement: Add :field option to relate_actor change (#546) 2023-04-02 21:50:32 -04:00
James Harton
a8346907c1
improvement: Add before_action/1 and after_action/1 to Ash.Resource.Preparations.Builtins. (#526) 2023-03-13 19:20:41 -04:00
James Harton
ee99bf367f
improvement: Add builtin changes for lifecycle hooks. (#523) 2023-03-09 19:59:39 -05:00
Zach Daniel
93cfe6c97e chore: remove test that produces warning because there is no way to silence it 2023-01-03 10:54:35 -05:00
Zach Daniel
c32d3cc49a improvement: warn on potentially incompatible relationship attributes
improvement: add `default_belongs_to_type` configuration
2023-01-03 10:52:19 -05:00
Zach Daniel
d6f1361979 improvement: fix tests to handle new defaults 2022-12-22 01:28:50 -05:00
Zach Daniel
34c33c7247 improvement: dep updates & new aggregate types avg/min/max/custom 2022-12-07 20:35:32 -05:00
Frank Dugan III
e691222af0
fix: destroy action types default to accepts [] (#453) 2022-11-18 18:40:56 -05:00
Zach Daniel
27ca1d2f3c fix: properly raise error on invalid type.
closes #422
2022-11-03 16:06:26 -07:00
Michael St Clair
5626c8be2c
fix: don't add required belongs_to error if changeset is invalid (#437) 2022-10-30 17:40:10 -04:00
Zach Daniel
d70a05c805 fix: don't lazy load when managing relationships
if a relationship was loaded previously we were just using that relationship value.
However, this has a chance to cause incorrect behavior in edge cases. One such
edge case is illustrated here: https://github.com/ash-project/ash/pull/434 We can return to the
more optimized behavior when lazy loading is improved via https://github.com/ash-project/ash/issues/438
2022-10-30 10:36:26 -04:00
oco-adam
2c85e325cd
test: Add test demonstrating minimal example of strange upsert behaviour (#434) 2022-10-29 19:33:19 -04:00
Zach Daniel
986e08e0c2 fix: properly compare against decimal values
improvement: support floats & decimals in the `compare` validation
2022-10-21 10:46:46 -04:00
Nelson Bassett
8378722244
improvement: Improve error when actions reject and accept keys overlap (#405)
* Test for overlapping action keys, and initial solution.

* Merged ValidateAcceptRejectpOverlap transformer into existing DefaultAccept transformer.

* Corrected formatting using mix format.
2022-10-09 18:05:54 -04:00
Zach Daniel
e9ca762e34 improvement: update to latest spark
chore: clean up tests & remove warnings
2022-10-08 14:00:08 -04:00
George Rodrigues
1f685a1413
docs: fix typos (#402) 2022-10-04 16:01:42 -04:00
Juha
fdebbeb242
improvement: Forbid reserved field names (#388)
Co-authored-by: Juha Lehtonen <juha.lehtonen@relexsolutions.com>
2022-10-03 16:19:16 -04:00
SpaceEEC
ace38cd31f
improvement: validate accepted and rejected attributes in actions (#395) 2022-10-03 12:16:53 -04:00
Zach Daniel
3b803d4c55 fix: various fixes with complex policy statements
improvement: simplify filter statements further
improvement: don't overconstraint filters on related data
test: get started on some more complex policy tests
2022-09-25 13:21:17 -04:00
Zach Daniel
1f6fb8d7af chore: fix tests 2022-09-20 19:44:04 -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
f9941a6c75 improvement: update spark, use new transformer style 2022-08-28 19:27:44 -06:00
Zach Daniel
6c79519b6c improvement: make long-awaited DSL name changes 2022-08-28 19:27:44 -06:00
Zach Daniel
a5f616812b improvement: replace Ash DSL underpinnings with Spark 2022-08-28 19:27:44 -06:00
Zach Daniel
98a64577d9 improvement: add || and && operators
improvement: sort parsing helpers
test: fix flaky test
2022-07-19 19:15:23 -04:00
zimt28
81c085b9a3
improvemtn: Add accept_default option (#351)
* Add accept_default option
2022-07-19 10:03:23 -04:00
Zach Daniel
40904cae80 fix: add back in writable? option to relationships, and add attribute_writable? to belongs_to 2022-07-06 08:30:13 -04:00
Simon Bergström
4273a5d23a
improvement: added options to the built-in function relate_actor/1 (#332) 2022-05-28 21:21:14 -04:00
Zach Daniel
02b1194062 chore: fix tests/transformers 2022-05-28 11:22:43 -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
dbe2e9a818 fix: flaky test issue 2022-04-07 01:52:59 -04:00
Joe Cole
6dcbe26abe
fix: Enforce unique action names (#308)
Co-authored-by: Joe Cole <{ID}+{username}@users.noreply.github.com>
2022-04-07 01:14:07 -04:00
Zach Daniel
be9e564d57 chore: fix identity docs/tests 2022-04-06 12:22:34 -04:00
Zach Daniel
4fc53baf5f improvement: add eager validate identities
improvement: percolate `nil` values in operators in ash expresion language (like SQL)
chore: more docs work
2022-04-06 12:00:32 -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
tlietz
da5306c773
improve: Provide api read error message on no data set (#302) 2022-03-29 21:07:44 -04:00
tlietz
12cfe0d848
improvement: validates attributes and relationships have unique names (#300) 2022-03-27 20:00:19 -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
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
13e06524a7 improvement: add belongs_to attributes *after* the others 2021-07-26 20:55:44 -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
kernel-io
35af220d9d
feat: add compare validator (#242)
Co-authored-by: David Culina <git@omnium.co>
2021-06-01 13:32:22 -04:00
Zach Daniel
593b111069 improvement: add read_action option
feat: rework lateral joins for many to many performance boost
2021-05-03 16:21:29 -04:00
Zach Daniel
e353ea49c3 fix: allow api.load/2 to load calculations
improvement: add `allow_nil_input` to create actions for api layers
improvement: add `load/1` builtin change
feat: change `get?: true` interface functions to raise on `nil`
2021-04-13 15:49:42 -04:00
Michael St Clair
6805d431ac
improvement: add sum aggregate (#221) 2021-04-04 16:00:53 -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
d42c778a0d improvement: many compile time fixes via code splitting
feat: refactored manage_relationship options/behavior
2021-02-22 20:44:03 -05:00
zimt28
db533450ed
improvement: Guess destination_field for has many relationships (#187) 2021-02-15 13:32:44 -05:00
Darren Black
983a711837
improvement: Implement string length validation (#183)
Co-authored-by: Darren Black <darren@ifixsystems.com.au>
2021-02-08 18:16:32 -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
Zach Daniel
6a26a583de
feat: Add Embedded Resources (#170) 2021-01-12 15:05:56 -05:00
Zach Daniel
250f51f14e chore: formatting 2020-12-30 12:53:24 -05:00
Zach Daniel
c1767e79b2 improvement: default actions 2020-12-30 11:55:40 -05:00
Zach Daniel
c6ea07896b test: various testing improvements 2020-12-01 00:51:24 -05:00
Zach Daniel
0e3333c05f chore: update tests 2020-11-30 23:23:34 -05:00
Zach Daniel
7c977d10c5 chore: update calculation tests 2020-11-30 23:18:39 -05:00
Kyle Nguyen
c732099240
feat: Add property: private? for attributes, relationships, aggregates, and calculations (#140) 2020-11-02 15:33:14 -05:00
WolfDan
1d6066f247
fix: add module name to errors (#127) 2020-10-05 10:40:22 -04:00
mario
6d719516c2
feat: added description for missing resources (#117) 2020-09-25 08:20:58 -04:00
Zach Daniel
12891c3f38
test: add basic tests for resource entities 2020-09-23 21:26:16 -04:00
Zach Daniel
a84ded1c72
test: add data_layer to resource tests 2020-08-19 00:49:41 -04:00
Zach Daniel
b549337dc2
fix: use proper errors everywhere 2020-07-15 17:06:27 -04:00
Zach Daniel
28982f03fd
feat: various small refactors + validations 2020-07-15 01:38:42 -04:00
Zach Daniel
2cf41b966e
feat: refactor changes into changesets 2020-07-12 02:25:53 -04:00
Zach Daniel
41b8c94964
feat: validate relationship keys 2020-07-09 00:20:32 -04:00
Zach Daniel
05848d5f4a
feat: refactor ash types to modules, add constraints 2020-06-30 17:29:43 -04:00
Zach Daniel
8438795f96
fix: require that resources have primary keys 2020-06-30 00:31:07 -04:00
Zach Daniel
c89acce635
fix: remove reverse relationships 2020-06-22 00:34:44 -04:00
Zach Daniel
6dc699d8a6
feat: rebuild DSL inner workings for extensibility (#70) 2020-06-14 02:39:11 -04:00
Zach Daniel
1cc143e7fa
test: adjust tests for removal of name/type (and defaults) 2020-06-04 23:34:44 -04:00
Zach Daniel
7c987b32bb
chore: wrap up remaining lint errors 2020-06-02 01:47:25 -04:00
Zach Daniel
b5c2fe6cf6
chore: remove ashton in favor of nimble_options 2020-06-01 01:14:23 -04:00
Zach Daniel
1ed9d3c5fa
WIP 2020-05-27 00:29:54 -04:00
Zach Daniel
7a28c7b9bd
feat: add timestamps/0 to attributes 2020-05-01 10:22:31 -04:00
Zach Daniel
2dea5d6d33
WIP on new error system. Only a few tests left to fix 2020-05-01 02:21:46 -04:00
Zach Daniel
24d1bd03c4
WIP 2020-04-19 23:15:52 -04:00
Zach Daniel
ebd8291631
WIP 2020-01-11 00:09:52 -05:00
Zach Daniel
b1a997ea55
WIP 2019-12-29 17:28:28 -05:00
Zach Daniel
694b7b362e
WIP 2019-12-26 03:42:35 -05:00
Zach Daniel
a93c1b60cb
WIP, making filters work, for the most part 2019-12-22 03:17:29 -05:00
Zach Daniel
d29afca057
WIP 2019-12-10 00:08:59 -05:00
Zach Daniel
b861568321
WIP 2019-12-08 23:05:56 -05:00
Zach Daniel
ee05955af8
WIP 2019-12-08 14:02:09 -05:00
Zach Daniel
a2e007697a
working on defaults, updating error messages 2019-12-08 01:21:09 -05:00