forest_admin_datasource_customizer 1.47.0 → 1.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c3e274f2abecdaad703c41019aca5deb490bd8d9380c9cb30423a093c488153
4
- data.tar.gz: 6eca54784f4cb65cde55d4816d9a3df3e883abf4e0f801d9b523f638dfc03ab9
3
+ metadata.gz: 411f8de63b704cc4d0bf46bd2cda38fa9d9b54851966fc046bdcf60454ff1d53
4
+ data.tar.gz: e85ca7d7f2bd19ddb578035ba18c0ab1f4342d31cad67ebaf876cd95bc07df62
5
5
  SHA512:
6
- metadata.gz: 873ba01e357d7c2c78307844584b06f1b2e0f96640a9ac7e5eb9fab92754892ac6cf0808a86fa51f94db1ff6336a640d205881c41a96af493bc054d97ec211d9
7
- data.tar.gz: 46cc12b28ff0021231ae87b5bdddcd9a91a495827f6a1b569042026aee747166637097cce7d1663652d35d14e4453369fe9a23b4e4054c239934a2416ae01ae3
6
+ metadata.gz: d400fd3b49530458d29a96ddb3c7125c76f9fb96d1d95e16a495c34dff84bfa4bce82390c5e62c214cd11890b25e09eee87dfdd7d093f1838d5f0f0f8cdd2800
7
+ data.tar.gz: 1fd7e981dd29c701275c9c7ec83e0516581ad58de490c64307815ade0d1899b0e901e861837ee58ba6768120a13f813bdd5f72467671686611f7a97a3ef88f4f
@@ -305,6 +305,13 @@ module ForestAdminDatasourceCustomizer
305
305
  end
306
306
  end
307
307
 
308
+ # Like add_hook, but also fires for writes initiated from inside a smart action. Used by the audit trail.
309
+ def add_internal_hook(position, type, prepend: false, &handler)
310
+ push_customization do
311
+ @stack.internal_hook.get_collection(@name).add_hook(position, type, handler, prepend: prepend)
312
+ end
313
+ end
314
+
308
315
  # Add a new segment on the collection.
309
316
  # @param name the name of the segment
310
317
  # @param definition a function used to generate a condition tree or a condition tree
@@ -5,7 +5,7 @@ module ForestAdminDatasourceCustomizer
5
5
 
6
6
  attr_reader :datasource, :schema, :search, :early_computed, :late_computed, :action, :relation, :late_op_emulate,
7
7
  :early_op_emulate, :validation, :sort, :rename_field, :publication, :write, :chart, :hook, :segment,
8
- :binary, :override, :lazy_join
8
+ :binary, :override, :lazy_join, :internal_hook
9
9
 
10
10
  def initialize(datasource)
11
11
  @customizations = []
@@ -75,6 +75,9 @@ module ForestAdminDatasourceCustomizer
75
75
  last = @sort = DatasourceDecorator.new(last, Sort::SortCollectionDecorator)
76
76
 
77
77
  last = @chart = Chart::ChartDatasourceDecorator.new(last)
78
+ # Below `action` so writes emitted from inside a smart action also traverse it, and its after hooks
79
+ # complete before `hook`'s start: a customization raising in a public after hook can't preempt it.
80
+ last = @internal_hook = DatasourceDecorator.new(last, Hook::HookCollectionDecorator)
78
81
  last = @action = DatasourceDecorator.new(last, Action::ActionCollectionDecorator)
79
82
  last = @schema = DatasourceDecorator.new(last, Schema::SchemaCollectionDecorator)
80
83
  last = @write = Write::WriteDatasourceDecorator.new(last)
@@ -1,3 +1,3 @@
1
1
  module ForestAdminDatasourceCustomizer
2
- VERSION = "1.47.0"
2
+ VERSION = "1.49.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_admin_datasource_customizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.47.0
4
+ version: 1.49.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthieu