forest_admin_agent 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: 24a29d40927535f076eb8353abd44e1825a64324e102944c250ac882c01a3dcb
4
- data.tar.gz: 2b43060825da0b2fca90393f0b65fa93bc3933e7f410553b8b33d230c1a96ca1
3
+ metadata.gz: b0e9c0e4ccef9a2bb47d3a163c4edcb39a1ced869f3feffa29e9ccca7e6b0c6b
4
+ data.tar.gz: e84a9a42ed64c1818b4be27c9c8fc6abbea2159282603b3f81d7ae2a024a0505
5
5
  SHA512:
6
- metadata.gz: e77e3892dcf0a456a89a1d5199e1f582f33187f64d9c197df556a6fe3c4560adfc10a09e38670cb049e9630820efcf205e5d01165d4335ef0877165624efb848
7
- data.tar.gz: a3ab87f07b033727407a2b4979c8f62c1d8e50c3761cc95224d09efd205119f4a0811a61b1b56dc6bccc9a28816c63104a5f8d4e6a5b8617bd16305a3a5f8a38
6
+ metadata.gz: fa991a8216f7c48c2c4aa68210a366be9dd5cbabd0145b62646b0d44a04e4fe64f11e8ac91ebb263b0abafacbd88676f3f5985d5d312dc7c47631c3fb91caed8
7
+ data.tar.gz: ad81ecd89654847e90ccc66a413c21d0e2df8a4d4d6240f72c1e5b4d4bc954e4738e5656f4c3d7ef4618321a29aafd082978831af9b4084515aebf53222c2509
data/AUDIT_TRAIL.md CHANGED
@@ -340,6 +340,11 @@ the store. A missing `collection` or `recordId` returns **HTTP 400** (`Validatio
340
340
 
341
341
  ## Smart actions
342
342
 
343
+ Writes a smart action makes through Forest (`context.collection` or `context.datasource.get_collection(...)`
344
+ `create` / `update` / `delete`) are audited like any other write, under the same `correlationKey` as the
345
+ action: the audit hooks sit on an internal layer below smart actions. Writes that bypass Forest (raw SQL, a
346
+ direct ActiveRecord call, an external API) only show up through the action row below.
347
+
343
348
  Running a smart action writes one row per selected record, in the same table:
344
349
 
345
350
  | column | value |
@@ -43,19 +43,18 @@ module ForestAdminAgent
43
43
  add_delete_hooks(collection_customizer, target)
44
44
  end
45
45
 
46
- # The "after" hooks are prepended: `execute_after` stops at the first exception, so a customization
47
- # raising in its own after hook would otherwise drop the record of a write that already happened.
48
- # The "before" hooks stay appended, so they read the data, filter and patch every other customization
49
- # has had its say on.
46
+ # Hooks sit on the internal layer, below smart actions, so writes made from an action's `execute` are
47
+ # audited too. The "after" hooks are prepended: `execute_after` stops at the first exception, so another
48
+ # internal hook raising would otherwise drop the record of a write that already happened.
50
49
  def add_create_hooks(collection_customizer, target)
51
- collection_customizer.add_hook('Before', 'Create') do |context|
50
+ collection_customizer.add_internal_hook('Before', 'Create') do |context|
52
51
  # No record id yet — that is what the column being nullable is for.
53
52
  rows = [{ record_id: nil, new_values: pick(context.data, target[:columns]) }]
54
53
 
55
54
  @snapshots.push(context.data, ids: pending_rows(context.caller, 'create', target[:name], rows))
56
55
  end
57
56
 
58
- collection_customizer.add_hook('After', 'Create', prepend: true) do |context|
57
+ collection_customizer.add_internal_hook('After', 'Create', prepend: true) do |context|
59
58
  pending = @snapshots.pop_for(context.data)
60
59
  next unless pending
61
60
 
@@ -66,7 +65,7 @@ module ForestAdminAgent
66
65
  end
67
66
 
68
67
  def add_update_hooks(collection_customizer, target)
69
- collection_customizer.add_hook('Before', 'Update') do |context|
68
+ collection_customizer.add_internal_hook('Before', 'Update') do |context|
70
69
  records = @snapshots.take(context, target[:projection])
71
70
  @snapshots.push(
72
71
  context.filter,
@@ -83,7 +82,7 @@ module ForestAdminAgent
83
82
  )
84
83
  end
85
84
 
86
- collection_customizer.add_hook('After', 'Update', prepend: true) do |context|
85
+ collection_customizer.add_internal_hook('After', 'Update', prepend: true) do |context|
87
86
  pending = @snapshots.pop_for(context.filter)
88
87
  next unless pending
89
88
 
@@ -92,7 +91,7 @@ module ForestAdminAgent
92
91
  end
93
92
 
94
93
  def add_delete_hooks(collection_customizer, target)
95
- collection_customizer.add_hook('Before', 'Delete') do |context|
94
+ collection_customizer.add_internal_hook('Before', 'Delete') do |context|
96
95
  records = @snapshots.take(context, target[:projection])
97
96
  @snapshots.push(
98
97
  context.filter,
@@ -107,7 +106,7 @@ module ForestAdminAgent
107
106
  )
108
107
  end
109
108
 
110
- collection_customizer.add_hook('After', 'Delete', prepend: true) do |context|
109
+ collection_customizer.add_internal_hook('After', 'Delete', prepend: true) do |context|
111
110
  pending = @snapshots.pop_for(context.filter)
112
111
  next unless pending
113
112
 
@@ -6,7 +6,7 @@ module ForestAdminAgent
6
6
  module Schema
7
7
  class SchemaEmitter
8
8
  LIANA_NAME = "agent-ruby"
9
- LIANA_VERSION = "1.47.0"
9
+ LIANA_VERSION = "1.49.0"
10
10
 
11
11
  def self.generate(datasource)
12
12
  datasource.collections
@@ -1,3 +1,3 @@
1
1
  module ForestAdminAgent
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_agent
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