From aec0b6f77d2e91d46ac02e7fb7a3ec557d66cdcc Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Wed, 31 Jan 2024 08:46:39 -0500 Subject: [PATCH] chore: release version v0.1.0 --- CHANGELOG.md | 43 ++ README.md | 2 +- config/config.exs | 2 +- .../dsls/DSL:-AshPaperTrail.Api.cheatmd | 10 - .../dsls/DSL:-AshPaperTrail.Registry.cheatmd | 9 - .../dsls/DSL:-AshPaperTrail.Resource.cheatmd | 413 ------------------ mix.exs | 4 +- 7 files changed, 48 insertions(+), 435 deletions(-) create mode 100644 CHANGELOG.md delete mode 100644 documentation/dsls/DSL:-AshPaperTrail.Api.cheatmd delete mode 100644 documentation/dsls/DSL:-AshPaperTrail.Registry.cheatmd delete mode 100644 documentation/dsls/DSL:-AshPaperTrail.Resource.cheatmd diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..21d7f1b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,43 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](Https://conventionalcommits.org) for commit guidelines. + + + +## [v0.1.0](https://github.com/ash-project/ash_paper_trail/compare/v0.1.0...v0.1.0) (2024-01-31) +### Breaking Changes: + +* remove defaults for ignored_attributes (#27) + + + +### Features: + +* Full diff change tracking mode (#18) + +### Bug Fixes: + +* Honour upstream attribute constraints. (#31) + +* properly set added relationship sources + +* take only existing attributes for private attributes + +* update deps and fix introspection + +### Improvements: + +* belongs_to_actor (#16) + +* add store_action_name option (#14) + +* support embedded resources (#10) + +* use api resources or registry (#6) + +* update to latest ash and use new docs + +* flesh out options/tools + +* make it all work, add some tests diff --git a/README.md b/README.md index 1caa84a..ae1c019 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ First, add `ash_paper_trail` dependency def deps do [ ... - {:ash_paper_trail, git: "https://github.com/ash-project/ash_paper_trail"} + {:ash_paper_trail, "~> 0.1.0"} ] end ``` diff --git a/config/config.exs b/config/config.exs index 618328d..849bf24 100644 --- a/config/config.exs +++ b/config/config.exs @@ -2,7 +2,7 @@ import Config if Mix.env() == :dev do config :git_ops, - mix_project: Ash.MixProject, + mix_project: AshPaperTrail.MixProject, changelog_file: "CHANGELOG.md", repository_url: "https://github.com/ash-project/ash_paper_trail", # Instructs the tool to manage your mix version in your `mix.exs` file diff --git a/documentation/dsls/DSL:-AshPaperTrail.Api.cheatmd b/documentation/dsls/DSL:-AshPaperTrail.Api.cheatmd deleted file mode 100644 index 1c7935f..0000000 --- a/documentation/dsls/DSL:-AshPaperTrail.Api.cheatmd +++ /dev/null @@ -1,10 +0,0 @@ - -# DSL: AshPaperTrail.Api - -Documentation for `AshPaperTrail.Api`. - - - - diff --git a/documentation/dsls/DSL:-AshPaperTrail.Registry.cheatmd b/documentation/dsls/DSL:-AshPaperTrail.Registry.cheatmd deleted file mode 100644 index 303233e..0000000 --- a/documentation/dsls/DSL:-AshPaperTrail.Registry.cheatmd +++ /dev/null @@ -1,9 +0,0 @@ - -# DSL: AshPaperTrail.Registry - -Deprecated in favor of `AshPaperTrail.Api`. Extends a registry to include the versions of paper trail resources. - - - diff --git a/documentation/dsls/DSL:-AshPaperTrail.Resource.cheatmd b/documentation/dsls/DSL:-AshPaperTrail.Resource.cheatmd deleted file mode 100644 index 8c54cd2..0000000 --- a/documentation/dsls/DSL:-AshPaperTrail.Resource.cheatmd +++ /dev/null @@ -1,413 +0,0 @@ - -# DSL: AshPaperTrail.Resource - -Documentation for `AshPaperTrail.Resource`. - - -## paper_trail -A section for configuring how versioning is derived for the resource. - - -### Nested DSLs - * [belongs_to_actor](#paper_trail-belongs_to_actor) - - - - - -### Options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDefaultDocs
- - - attributes_as_attributes - - - - - list(atom) - - [] - - A set of attributes that should be set as attributes on the version resource, instead of stored in the freeform `changes` map attribute. - -
- - - change_tracking_mode - - - - - :snapshot | :changes_only | :full_diff - - :snapshot - - Changes are stored in a map attribute called `changes`. The `change_tracking_mode` -determines what's stored. Valid options are `:snapshot` and `:changes_only` and `:full_diff`. - -:snapshot will json dump the contents of every attribute whether they changed or not. - -`{ subject: "new subject", body: "unchanged body", author: { name: "bob"}}` - -:changes_only will json dump the contents of only the attributes that have changed. -Note if any part of an embedded attribute and array of embedded attributes, changes then -the entire top level attribute is dumped. - -`{ subject: "new subject" }` - -:full_diff will json dump the contents of each attribute. -`{ subject: { from: "subject", to: "new subject" }, body: { unchanged: "unchanged_body" }}, author: { changes: { unchanged: "bob" }}` - - -
- - - ignore_attributes - - - - - list(atom) - - [] - - A list of attributes that should be ignored. Typically you'll want to ignore your timestamps. The primary key is always ignored. - -
- - - mixin - - - - - atom - - - - A module that defines a `using` macro that will be mixed into the version resource. - -
- - - on_actions - - - - - list(atom) - - - - Which actions should produce new versions. By default, all create/update actions will produce new versions. - -
- - - reference_source? - - - - - boolean - - true - - Whether or not to create a foreign key reference from the version to the source. -This should be set to `false` if you are allowing actual deletion of data. Pair -this extension with `AshArchival` to get soft destroys and referential integrity. - -Only relevant for resources using the AshPostgres data layer. - -
- - - store_action_name? - - - - - boolean - - false - - Whether or not to add the `version_action_name` attribute to the version resource. This is -useful for auditing purposes. The `version_action_type` attribute is always stored. - -
- - - version_extensions - - - - - Keyword.t - - [] - - Extensions that should be used by the version resource. For example: `extensions: [AshGraphql.Resource], notifier: [Ash.Notifiers.PubSub]` - -
- - - -## paper_trail.belongs_to_actor -```elixir -belongs_to_actor name, destination -``` - - -Creates a belongs_to relationship for the actor resource. When creating a new version, if the actor on the action is set and -matches the resource type, the version will be related to the actor. If your actors are polymorphic or varying types, declare a -belongs_to_actor for each type. - -A reference is also created with `on_delete: :nilify` and `on_update: :update` - -If you need more complex relationships, set `define_attribute? false` and add the relationship via a mixin. - -If your actor is not a resource, add a mixin and with a change for all creates that sets the actor's to one your attributes. -The actor on the version changeset is set. - - - - -### Examples -``` -belongs_to_actor :user, MyApp.Users.User, api: MyApp.Users -``` - - - -### Arguments - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDefaultDocs
- - - name - - - * - - - atom - - - - The name of the relationship to use for the actor (e.g. :user) -
- - - destination - - - - - module - - - - The resource of the actor (e.g. MyApp.Users.User) -
-### Options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDefaultDocs
- - - allow_nil? - - - - - boolean - - true - - Whether this relationship must always be present, e.g: must be included on creation, and never removed (it may be modified). The generated attribute will not allow nil values. -
- - - api - - - - - atom - - - - The API module to use when working with the related entity. - -
- - - attribute_type - - - - - `any` - - :uuid - - The type of the generated created attribute. See `Ash.Type` for more. -
- - - define_attribute? - - - - - boolean - - true - - If set to `false` an attribute is not created on the resource for this relationship, and one must be manually added in `attributes`, invalidating many other options. -
- - - - - -### Introspection - -Target: `AshPaperTrail.Resource.BelongsToActor` - - - - diff --git a/mix.exs b/mix.exs index d9e4992..abbcf57 100644 --- a/mix.exs +++ b/mix.exs @@ -1,10 +1,12 @@ defmodule AshPaperTrail.MixProject do use Mix.Project + @version "0.1.0" + def project do [ app: :ash_paper_trail, - version: "0.1.0", + version: @version, elixir: "~> 1.14", aliases: aliases(), start_permanent: Mix.env() == :prod,