paper_trail_diff 0.2.0 → 0.3.1

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.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +62 -0
  3. data/QUICKSTART.md +44 -2
  4. data/README.md +188 -14
  5. data/lib/paper_trail_diff/activity_belongs_to_event_applier.rb +126 -0
  6. data/lib/paper_trail_diff/activity_child_candidate_loader.rb +73 -0
  7. data/lib/paper_trail_diff/activity_collection_event_applier.rb +137 -0
  8. data/lib/paper_trail_diff/activity_collection_record_updater.rb +67 -0
  9. data/lib/paper_trail_diff/activity_collection_route_change.rb +21 -0
  10. data/lib/paper_trail_diff/activity_collection_route_updater.rb +128 -0
  11. data/lib/paper_trail_diff/activity_event_record_normalizer.rb +42 -0
  12. data/lib/paper_trail_diff/activity_event_record_resolver.rb +120 -0
  13. data/lib/paper_trail_diff/activity_event_route_finder.rb +112 -0
  14. data/lib/paper_trail_diff/activity_event_snapshot_refresher.rb +59 -437
  15. data/lib/paper_trail_diff/activity_history.rb +136 -0
  16. data/lib/paper_trail_diff/activity_range.rb +28 -12
  17. data/lib/paper_trail_diff/activity_relationship.rb +55 -0
  18. data/lib/paper_trail_diff/activity_snapshot_delta.rb +64 -0
  19. data/lib/paper_trail_diff/activity_snapshot_sequence.rb +3 -3
  20. data/lib/paper_trail_diff/activity_timeline_builder.rb +54 -45
  21. data/lib/paper_trail_diff/activity_version_collector.rb +14 -17
  22. data/lib/paper_trail_diff/branch_snapshot_refresher.rb +7 -3
  23. data/lib/paper_trail_diff/collection_comparator.rb +155 -0
  24. data/lib/paper_trail_diff/collection_identity_index.rb +53 -0
  25. data/lib/paper_trail_diff/collection_transition.rb +25 -0
  26. data/lib/paper_trail_diff/comparison_batch.rb +151 -0
  27. data/lib/paper_trail_diff/engine.rb +5 -45
  28. data/lib/paper_trail_diff/errors.rb +9 -0
  29. data/lib/paper_trail_diff/historical_snapshot_store.rb +55 -3
  30. data/lib/paper_trail_diff/instrumentation.rb +30 -0
  31. data/lib/paper_trail_diff/live_endpoint_batch_loader.rb +133 -0
  32. data/lib/paper_trail_diff/live_endpoint_provider.rb +48 -0
  33. data/lib/paper_trail_diff/live_graph_collector.rb +52 -0
  34. data/lib/paper_trail_diff/paper_trail_adapter.rb +61 -34
  35. data/lib/paper_trail_diff/preloaded_endpoint_batch_loader.rb +48 -0
  36. data/lib/paper_trail_diff/prepared_edge_loader.rb +54 -17
  37. data/lib/paper_trail_diff/prepared_history.rb +14 -4
  38. data/lib/paper_trail_diff/prepared_history_loader.rb +17 -9
  39. data/lib/paper_trail_diff/prepared_record_index.rb +138 -10
  40. data/lib/paper_trail_diff/snapshot.rb +66 -3
  41. data/lib/paper_trail_diff/support.rb +18 -0
  42. data/lib/paper_trail_diff/time_activity_timeline_builder.rb +111 -0
  43. data/lib/paper_trail_diff/time_range.rb +85 -0
  44. data/lib/paper_trail_diff/time_version_range.rb +53 -0
  45. data/lib/paper_trail_diff/timeline_builder.rb +13 -7
  46. data/lib/paper_trail_diff/timeline_range.rb +72 -0
  47. data/lib/paper_trail_diff/version.rb +1 -1
  48. data/lib/paper_trail_diff/version_association_candidate_scope.rb +73 -0
  49. data/lib/paper_trail_diff.rb +83 -12
  50. data/sig/generated/paper_trail_diff/activity_belongs_to_event_applier.rbs +41 -0
  51. data/sig/generated/paper_trail_diff/activity_child_candidate_loader.rbs +40 -0
  52. data/sig/generated/paper_trail_diff/activity_collection_event_applier.rbs +46 -0
  53. data/sig/generated/paper_trail_diff/activity_collection_record_updater.rbs +25 -0
  54. data/sig/generated/paper_trail_diff/activity_collection_route_change.rbs +17 -0
  55. data/sig/generated/paper_trail_diff/activity_collection_route_updater.rbs +44 -0
  56. data/sig/generated/paper_trail_diff/activity_event_record_normalizer.rbs +19 -0
  57. data/sig/generated/paper_trail_diff/activity_event_record_resolver.rbs +44 -0
  58. data/sig/generated/paper_trail_diff/activity_event_route_finder.rbs +54 -0
  59. data/sig/generated/paper_trail_diff/activity_event_snapshot_refresher.rbs +20 -71
  60. data/sig/generated/paper_trail_diff/activity_history.rbs +79 -0
  61. data/sig/generated/paper_trail_diff/activity_range.rbs +14 -5
  62. data/sig/generated/paper_trail_diff/activity_relationship.rbs +23 -0
  63. data/sig/generated/paper_trail_diff/activity_snapshot_delta.rbs +33 -0
  64. data/sig/generated/paper_trail_diff/activity_snapshot_sequence.rbs +2 -2
  65. data/sig/generated/paper_trail_diff/activity_timeline_builder.rbs +15 -10
  66. data/sig/generated/paper_trail_diff/activity_version_collector.rbs +2 -5
  67. data/sig/generated/paper_trail_diff/branch_snapshot_refresher.rbs +2 -2
  68. data/sig/generated/paper_trail_diff/collection_comparator.rbs +59 -0
  69. data/sig/generated/paper_trail_diff/collection_identity_index.rbs +29 -0
  70. data/sig/generated/paper_trail_diff/collection_transition.rbs +18 -0
  71. data/sig/generated/paper_trail_diff/comparison_batch.rbs +65 -0
  72. data/sig/generated/paper_trail_diff/engine.rbs +0 -12
  73. data/sig/generated/paper_trail_diff/errors.rbs +12 -0
  74. data/sig/generated/paper_trail_diff/historical_snapshot_store.rbs +22 -2
  75. data/sig/generated/paper_trail_diff/instrumentation.rbs +12 -0
  76. data/sig/generated/paper_trail_diff/live_endpoint_batch_loader.rbs +52 -0
  77. data/sig/generated/paper_trail_diff/live_endpoint_provider.rbs +23 -0
  78. data/sig/generated/paper_trail_diff/live_graph_collector.rbs +27 -0
  79. data/sig/generated/paper_trail_diff/paper_trail_adapter.rbs +21 -10
  80. data/sig/generated/paper_trail_diff/preloaded_endpoint_batch_loader.rbs +24 -0
  81. data/sig/generated/paper_trail_diff/prepared_edge_loader.rbs +22 -8
  82. data/sig/generated/paper_trail_diff/prepared_history.rbs +6 -0
  83. data/sig/generated/paper_trail_diff/prepared_history_loader.rbs +4 -2
  84. data/sig/generated/paper_trail_diff/prepared_record_index.rbs +61 -6
  85. data/sig/generated/paper_trail_diff/snapshot.rbs +37 -2
  86. data/sig/generated/paper_trail_diff/support.rbs +6 -0
  87. data/sig/generated/paper_trail_diff/time_activity_timeline_builder.rbs +46 -0
  88. data/sig/generated/paper_trail_diff/time_range.rbs +41 -0
  89. data/sig/generated/paper_trail_diff/time_version_range.rbs +27 -0
  90. data/sig/generated/paper_trail_diff/timeline_builder.rbs +6 -5
  91. data/sig/generated/paper_trail_diff/timeline_range.rbs +41 -0
  92. data/sig/generated/paper_trail_diff/version_association_candidate_scope.rbs +32 -0
  93. data/sig/generated/paper_trail_diff.rbs +16 -8
  94. metadata +56 -4
@@ -5,30 +5,50 @@ require 'paper_trail'
5
5
 
6
6
  require_relative 'paper_trail_diff/version'
7
7
  require_relative 'paper_trail_diff/support'
8
+ require_relative 'paper_trail_diff/instrumentation'
8
9
  require_relative 'paper_trail_diff/errors'
9
10
  require_relative 'paper_trail_diff/configuration'
10
11
  require_relative 'paper_trail_diff/endpoint'
11
12
  require_relative 'paper_trail_diff/association_traversal'
12
13
  require_relative 'paper_trail_diff/association_discovery'
13
14
  require_relative 'paper_trail_diff/diagnostics'
15
+ require_relative 'paper_trail_diff/collection_identity_index'
16
+ require_relative 'paper_trail_diff/collection_transition'
14
17
  require_relative 'paper_trail_diff/snapshot'
18
+ require_relative 'paper_trail_diff/activity_snapshot_delta'
15
19
  require_relative 'paper_trail_diff/value_objects'
16
20
  require_relative 'paper_trail_diff/traversal_entry'
17
21
  require_relative 'paper_trail_diff/traversal_emitter'
18
22
  require_relative 'paper_trail_diff/snapshot_traversal'
19
23
  require_relative 'paper_trail_diff/association_diff_traversal'
20
24
  require_relative 'paper_trail_diff/traversal'
25
+ require_relative 'paper_trail_diff/collection_comparator'
21
26
  require_relative 'paper_trail_diff/engine'
22
27
  require_relative 'paper_trail_diff/historical_association_reifier'
23
28
  require_relative 'paper_trail_diff/prepared_record_index'
24
29
  require_relative 'paper_trail_diff/prepared_history'
30
+ require_relative 'paper_trail_diff/version_association_candidate_scope'
25
31
  require_relative 'paper_trail_diff/prepared_edge_loader'
26
32
  require_relative 'paper_trail_diff/prepared_history_loader'
27
33
  require_relative 'paper_trail_diff/prepared_association_reifier'
28
34
  require_relative 'paper_trail_diff/live_association_reader'
35
+ require_relative 'paper_trail_diff/live_endpoint_batch_loader'
36
+ require_relative 'paper_trail_diff/preloaded_endpoint_batch_loader'
37
+ require_relative 'paper_trail_diff/live_endpoint_provider'
38
+ require_relative 'paper_trail_diff/live_graph_collector'
39
+ require_relative 'paper_trail_diff/comparison_batch'
29
40
  require_relative 'paper_trail_diff/snapshot_normalizer'
30
41
  require_relative 'paper_trail_diff/historical_snapshot_store'
31
42
  require_relative 'paper_trail_diff/timeline_snapshot_provider'
43
+ require_relative 'paper_trail_diff/activity_event_record_resolver'
44
+ require_relative 'paper_trail_diff/activity_event_route_finder'
45
+ require_relative 'paper_trail_diff/activity_relationship'
46
+ require_relative 'paper_trail_diff/activity_collection_route_change'
47
+ require_relative 'paper_trail_diff/activity_collection_record_updater'
48
+ require_relative 'paper_trail_diff/activity_collection_route_updater'
49
+ require_relative 'paper_trail_diff/activity_event_record_normalizer'
50
+ require_relative 'paper_trail_diff/activity_collection_event_applier'
51
+ require_relative 'paper_trail_diff/activity_belongs_to_event_applier'
32
52
  require_relative 'paper_trail_diff/activity_event_snapshot_refresher'
33
53
  require_relative 'paper_trail_diff/activity_root_snapshot_refresher'
34
54
  require_relative 'paper_trail_diff/branch_snapshot_refresher'
@@ -36,11 +56,17 @@ require_relative 'paper_trail_diff/activity_boundary'
36
56
  require_relative 'paper_trail_diff/step'
37
57
  require_relative 'paper_trail_diff/analysis'
38
58
  require_relative 'paper_trail_diff/version_range'
59
+ require_relative 'paper_trail_diff/time_range'
60
+ require_relative 'paper_trail_diff/time_version_range'
61
+ require_relative 'paper_trail_diff/timeline_range'
39
62
  require_relative 'paper_trail_diff/timeline_builder'
40
63
  require_relative 'paper_trail_diff/activity_range'
41
64
  require_relative 'paper_trail_diff/activity_event'
65
+ require_relative 'paper_trail_diff/activity_child_candidate_loader'
42
66
  require_relative 'paper_trail_diff/activity_version_collector'
43
67
  require_relative 'paper_trail_diff/activity_snapshot_sequence'
68
+ require_relative 'paper_trail_diff/activity_history'
69
+ require_relative 'paper_trail_diff/time_activity_timeline_builder'
44
70
  require_relative 'paper_trail_diff/activity_timeline_builder'
45
71
  require_relative 'paper_trail_diff/paper_trail_adapter'
46
72
 
@@ -53,6 +79,8 @@ require_relative 'paper_trail_diff/paper_trail_adapter'
53
79
  # type association_diffs = Hash[String, association_diff]
54
80
  # type association_snapshots = Hash[String, AssociationSnapshot]
55
81
  # type identity = Array[untyped]
82
+ # type comparison_input = Hash[String | Symbol, untyped]
83
+ # type comparison_results = Hash[identity, Diff]
56
84
  # type ignore_option = Array[String | Symbol] | Hash[String | Symbol, untyped]
57
85
  # type reference_key = :type | :id | "type" | "id"
58
86
  # type traversal_context = :change | :included_state
@@ -73,40 +101,82 @@ module PaperTrailDiff
73
101
 
74
102
  class << self
75
103
  # Compares net state between explicit PaperTrail-version or current-record endpoints.
76
- #: (untyped, untyped, ?associations: Array[String | Symbol], ?ignore: ignore_option) -> Diff
77
- def compare(from_version, to_version, associations: [], ignore: DEFAULT_IGNORED_ATTRIBUTES)
78
- PaperTrailAdapter.new(associations: associations, ignore: ignore).compare(
104
+ #: (untyped, untyped, ?associations: Array[String | Symbol], ?ignore: ignore_option, ?reload_live_endpoints: bool) -> Diff
105
+ def compare(
106
+ from_version,
107
+ to_version,
108
+ associations: [],
109
+ ignore: DEFAULT_IGNORED_ATTRIBUTES,
110
+ reload_live_endpoints: true
111
+ )
112
+ PaperTrailAdapter.new(
113
+ associations: associations,
114
+ ignore: ignore,
115
+ reload_live_endpoints: reload_live_endpoints
116
+ ).compare(
79
117
  from_version,
80
118
  to_version
81
119
  )
82
120
  end
83
121
 
122
+ # Compares many independent endpoint pairs while batching current-record loading.
123
+ #: (Array[comparison_input], ?associations: Array[String | Symbol], ?ignore: ignore_option, ?reload_live_endpoints: bool) -> comparison_results
124
+ def compare_many(
125
+ comparisons,
126
+ associations: [],
127
+ ignore: DEFAULT_IGNORED_ATTRIBUTES,
128
+ reload_live_endpoints: true
129
+ )
130
+ PaperTrailAdapter.new(
131
+ associations: associations,
132
+ ignore: ignore,
133
+ reload_live_endpoints: reload_live_endpoints
134
+ ).compare_many(comparisons)
135
+ end
136
+
84
137
  # Compares every adjacent reconstructed state in an inclusive version range.
85
- #: (untyped, from: untyped, to: untyped, ?associations: Array[String | Symbol], ?ignore: ignore_option) -> Array[Step]
86
- def timeline(record, from:, to:, associations: [], ignore: DEFAULT_IGNORED_ATTRIBUTES)
138
+ #: (untyped, ?from: untyped, ?to: untyped, ?within: untyped, ?associations: Array[String | Symbol], ?ignore: ignore_option) -> Array[Step]
139
+ def timeline( # rubocop:disable Metrics/ParameterLists
140
+ record,
141
+ from: nil,
142
+ to: nil,
143
+ within: nil,
144
+ associations: [],
145
+ ignore: DEFAULT_IGNORED_ATTRIBUTES
146
+ )
87
147
  PaperTrailAdapter.new(associations: associations, ignore: ignore).timeline(
88
148
  record,
89
149
  from: from,
90
- to: to
150
+ to: to,
151
+ within: within
91
152
  )
92
153
  end
93
154
 
94
155
  # Compares adjacent root and selected-descendant activity boundaries.
95
- #: (untyped, from: untyped, to: untyped, ?associations: Array[String | Symbol], ?ignore: ignore_option) -> Array[ActivityStep]
96
- def activity_timeline(record, from:, to:, associations: [], ignore: DEFAULT_IGNORED_ATTRIBUTES)
156
+ #: (untyped, ?from: untyped, ?to: untyped, ?within: untyped, ?associations: Array[String | Symbol], ?ignore: ignore_option) -> Array[ActivityStep]
157
+ def activity_timeline( # rubocop:disable Metrics/ParameterLists
158
+ record,
159
+ from: nil,
160
+ to: nil,
161
+ within: nil,
162
+ associations: [],
163
+ ignore: DEFAULT_IGNORED_ATTRIBUTES
164
+ )
97
165
  PaperTrailAdapter.new(associations: associations, ignore: ignore).activity_timeline(
98
166
  record,
99
167
  from: from,
100
- to: to
168
+ to: to,
169
+ within: within
101
170
  )
102
171
  end
103
172
 
104
173
  # Builds an endpoint diff and root-checkpoint timeline while normalizing each version once.
105
- #: (untyped, from: untyped, to: untyped, ?associations: Array[String | Symbol], ?ignore: ignore_option, ?activity: bool) -> Analysis
174
+ #: (untyped, ?from: untyped, ?to: untyped, ?within: untyped, ?associations: Array[String | Symbol], ?ignore: ignore_option, ?activity: bool) -> Analysis
106
175
  def analyze( # rubocop:disable Metrics/ParameterLists
107
176
  record,
108
- from:,
109
- to:,
177
+ from: nil,
178
+ to: nil,
179
+ within: nil,
110
180
  associations: [],
111
181
  ignore: DEFAULT_IGNORED_ATTRIBUTES,
112
182
  activity: false
@@ -115,6 +185,7 @@ module PaperTrailDiff
115
185
  record,
116
186
  from: from,
117
187
  to: to,
188
+ within: within,
118
189
  activity: activity
119
190
  )
120
191
  end
@@ -0,0 +1,41 @@
1
+ # Generated from lib/paper_trail_diff/activity_belongs_to_event_applier.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Applies selected non-polymorphic belongs-to target updates to a snapshot.
5
+ class ActivityBelongsToEventApplier
6
+ # : (route_finder: ActivityEventRouteFinder, record_resolver: ActivityEventRecordResolver, record_normalizer: ActivityEventRecordNormalizer) -> void
7
+ def initialize: (route_finder: ActivityEventRouteFinder, record_resolver: ActivityEventRecordResolver, record_normalizer: ActivityEventRecordNormalizer) -> void
8
+
9
+ # : (untyped, untyped, RecordSnapshot, AssociationTree, SnapshotNormalizer, untyped) -> [bool, RecordSnapshot?]
10
+ def call: (untyped, untyped, RecordSnapshot, AssociationTree, SnapshotNormalizer, untyped) -> [ bool, RecordSnapshot? ]
11
+
12
+ private
13
+
14
+ @record_normalizer: ActivityEventRecordNormalizer
15
+
16
+ @record_resolver: ActivityEventRecordResolver
17
+
18
+ @route_finder: ActivityEventRouteFinder
19
+
20
+ # : (Array[untyped], untyped, SnapshotNormalizer, untyped, untyped) -> RecordSnapshot?
21
+ def normalized_route_record: (Array[untyped], untyped, SnapshotNormalizer, untyped, untyped) -> RecordSnapshot?
22
+
23
+ # : (RecordSnapshot, Array[untyped], untyped, RecordSnapshot?, ?depth: Integer) -> [RecordSnapshot, bool]
24
+ def replace_route: (RecordSnapshot, Array[untyped], untyped, RecordSnapshot?, ?depth: Integer) -> [ RecordSnapshot, bool ]
25
+
26
+ # : (Array[RecordSnapshot], Array[untyped], untyped, RecordSnapshot?, Integer) -> [Array[RecordSnapshot], bool]
27
+ def replacement_records: (Array[RecordSnapshot], Array[untyped], untyped, RecordSnapshot?, Integer) -> [ Array[RecordSnapshot], bool ]
28
+
29
+ # : (Array[RecordSnapshot], untyped, RecordSnapshot?) -> [Array[RecordSnapshot], bool]
30
+ def replace_existing_target: (Array[RecordSnapshot], untyped, RecordSnapshot?) -> [ Array[RecordSnapshot], bool ]
31
+
32
+ # : (RecordSnapshot, String, AssociationSnapshot) -> RecordSnapshot
33
+ def replace_association: (RecordSnapshot, String, AssociationSnapshot) -> RecordSnapshot
34
+
35
+ # : (untyped, RecordSnapshot?) -> String
36
+ def replacement_type: (untyped, RecordSnapshot?) -> String
37
+
38
+ # : (untyped) -> untyped
39
+ def endpoint_model_class: (untyped) -> untyped
40
+ end
41
+ end
@@ -0,0 +1,40 @@
1
+ # Generated from lib/paper_trail_diff/activity_child_candidate_loader.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Loads direct-child identities active at or after one activity boundary.
5
+ class ActivityChildCandidateLoader
6
+ # : (untyped, Array[untyped], untyped, ActivityRange) -> void
7
+ def initialize: (untyped, Array[untyped], untyped, ActivityRange) -> void
8
+
9
+ # : () -> Array[untyped]
10
+ def call: () -> Array[untyped]
11
+
12
+ private
13
+
14
+ @parent_class: untyped
15
+
16
+ @parent_ids: Array[untyped]
17
+
18
+ @range: ActivityRange
19
+
20
+ @reflection: untyped
21
+
22
+ # : () -> Array[untyped]
23
+ def historical_ids: () -> Array[untyped]
24
+
25
+ # : (untyped) -> untyped
26
+ def historical_relation: (untyped) -> untyped
27
+
28
+ # : (untyped) -> VersionAssociationCandidateScope
29
+ def candidate_scope: (untyped) -> VersionAssociationCandidateScope
30
+
31
+ # : () -> Array[untyped]
32
+ def current_ids: () -> Array[untyped]
33
+
34
+ # : () -> String
35
+ def child_item_type: () -> String
36
+
37
+ # : () -> Array[String?]
38
+ def parent_types: () -> Array[String?]
39
+ end
40
+ end
@@ -0,0 +1,46 @@
1
+ # Generated from lib/paper_trail_diff/activity_collection_event_applier.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Applies a safe collection event across every selected route for its record type.
5
+ class ActivityCollectionEventApplier
6
+ # : (record_resolver: ActivityEventRecordResolver, record_normalizer: ActivityEventRecordNormalizer, route_updater: ActivityCollectionRouteUpdater, relationship: ActivityRelationship) -> void
7
+ def initialize: (record_resolver: ActivityEventRecordResolver, record_normalizer: ActivityEventRecordNormalizer, route_updater: ActivityCollectionRouteUpdater, relationship: ActivityRelationship) -> void
8
+
9
+ # : (Array[Array[untyped]], untyped, ActivitySnapshotDelta?) -> bool
10
+ def safe?: (Array[Array[untyped]], untyped, ActivitySnapshotDelta?) -> bool
11
+
12
+ # : (untyped, untyped, RecordSnapshot, SnapshotNormalizer, Array[Array[untyped]], untyped, ActivitySnapshotDelta?) -> [bool, RecordSnapshot]
13
+ def call: (untyped, untyped, RecordSnapshot, SnapshotNormalizer, Array[Array[untyped]], untyped, ActivitySnapshotDelta?) -> [ bool, RecordSnapshot ]
14
+
15
+ private
16
+
17
+ @record_normalizer: ActivityEventRecordNormalizer
18
+
19
+ @record_resolver: ActivityEventRecordResolver
20
+
21
+ @relationship: ActivityRelationship
22
+
23
+ @route_updater: ActivityCollectionRouteUpdater
24
+
25
+ # : (RecordSnapshot, Array[untyped], untyped, ActivitySnapshotDelta?, Array[untyped], SnapshotNormalizer, Array[untyped]) -> RecordSnapshot
26
+ def apply_route: (RecordSnapshot, Array[untyped], untyped, ActivitySnapshotDelta?, Array[untyped], SnapshotNormalizer, Array[untyped]) -> RecordSnapshot
27
+
28
+ # : (Array[Array[untyped]], untyped) -> bool
29
+ def unsafe_through_membership_event?: (Array[Array[untyped]], untyped) -> bool
30
+
31
+ # : (Array[Array[untyped]], ActivitySnapshotDelta?) -> bool
32
+ def unsafe_nested_membership_delta?: (Array[Array[untyped]], ActivitySnapshotDelta?) -> bool
33
+
34
+ # : (RecordSnapshot, Array[untyped], untyped, ActivitySnapshotDelta?, Array[untyped], SnapshotNormalizer, Array[untyped]) -> [untyped, RecordSnapshot?]
35
+ def route_event_state: (RecordSnapshot, Array[untyped], untyped, ActivitySnapshotDelta?, Array[untyped], SnapshotNormalizer, Array[untyped]) -> [ untyped, RecordSnapshot? ]
36
+
37
+ # : (untyped, Array[untyped], SnapshotNormalizer, Array[untyped]) -> RecordSnapshot?
38
+ def normalized_event_record: (untyped, Array[untyped], SnapshotNormalizer, Array[untyped]) -> RecordSnapshot?
39
+
40
+ # : (RecordSnapshot, Array[untyped], untyped, ActivitySnapshotDelta?) -> RecordSnapshot?
41
+ def existing_delta_record: (RecordSnapshot, Array[untyped], untyped, ActivitySnapshotDelta?) -> RecordSnapshot?
42
+
43
+ # : (RecordSnapshot, Array[untyped], ActivitySnapshotDelta) -> RecordSnapshot?
44
+ def nested_delta_owner: (RecordSnapshot, Array[untyped], ActivitySnapshotDelta) -> RecordSnapshot?
45
+ end
46
+ end
@@ -0,0 +1,25 @@
1
+ # Generated from lib/paper_trail_diff/activity_collection_record_updater.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Applies one event to the leaf records of a collection association snapshot.
5
+ class ActivityCollectionRecordUpdater
6
+ # : (ActivityRelationship) -> void
7
+ def initialize: (ActivityRelationship) -> void
8
+
9
+ # : (AssociationSnapshot, ActivityCollectionRouteChange, untyped, RecordSnapshot) -> RecordSnapshot?
10
+ def event_child: (AssociationSnapshot, ActivityCollectionRouteChange, untyped, RecordSnapshot) -> RecordSnapshot?
11
+
12
+ # : (AssociationSnapshot, untyped, RecordSnapshot?) -> [Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot?, bool]
13
+ def call: (AssociationSnapshot, untyped, RecordSnapshot?) -> [ Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot?, bool ]
14
+
15
+ # : (untyped, RecordSnapshot?) -> String
16
+ def replacement_type: (untyped, RecordSnapshot?) -> String
17
+
18
+ private
19
+
20
+ @relationship: ActivityRelationship
21
+
22
+ # : (Array[RecordSnapshot], Integer?, RecordSnapshot?) -> Array[RecordSnapshot]
23
+ def replacement_records: (Array[RecordSnapshot], Integer?, RecordSnapshot?) -> Array[RecordSnapshot]
24
+ end
25
+ end
@@ -0,0 +1,17 @@
1
+ # Generated from lib/paper_trail_diff/activity_collection_route_change.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Carries one collection event through recursive immutable route replacement.
5
+ class ActivityCollectionRouteChange
6
+ attr_reader route: Array[untyped]
7
+
8
+ attr_reader version: untyped
9
+
10
+ attr_reader record: untyped
11
+
12
+ attr_reader replacement: RecordSnapshot?
13
+
14
+ # : (route: Array[untyped], version: untyped, record: untyped, replacement: RecordSnapshot?) -> void
15
+ def initialize: (route: Array[untyped], version: untyped, record: untyped, replacement: RecordSnapshot?) -> void
16
+ end
17
+ end
@@ -0,0 +1,44 @@
1
+ # Generated from lib/paper_trail_diff/activity_collection_route_updater.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Replaces a collection event record along one explicit immutable snapshot route.
5
+ class ActivityCollectionRouteUpdater
6
+ # : (pool: SnapshotPool, relationship: ActivityRelationship) -> void
7
+ def initialize: (pool: SnapshotPool, relationship: ActivityRelationship) -> void
8
+
9
+ # : (RecordSnapshot, ActivityCollectionRouteChange, ?depth: Integer) -> [RecordSnapshot, bool]
10
+ def call: (RecordSnapshot, ActivityCollectionRouteChange, ?depth: Integer) -> [ RecordSnapshot, bool ]
11
+
12
+ private
13
+
14
+ @pool: SnapshotPool
15
+
16
+ @record_updater: ActivityCollectionRecordUpdater
17
+
18
+ @relationship: ActivityRelationship
19
+
20
+ # : (AssociationSnapshot, RecordSnapshot, ActivityCollectionRouteChange, Integer) -> [Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot?, bool, bool]
21
+ def updated_records: (AssociationSnapshot, RecordSnapshot, ActivityCollectionRouteChange, Integer) -> [ Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot?, bool, bool ]
22
+
23
+ # : (AssociationSnapshot, RecordSnapshot, ActivityCollectionRouteChange) -> [Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot?, bool, bool]
24
+ def leaf_records: (AssociationSnapshot, RecordSnapshot, ActivityCollectionRouteChange) -> [ Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot?, bool, bool ]
25
+
26
+ # : (AssociationSnapshot, ActivityCollectionRouteChange, Integer) -> [Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot?, bool]?
27
+ def targeted_parent: (AssociationSnapshot, ActivityCollectionRouteChange, Integer) -> [ Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot?, bool ]?
28
+
29
+ # : (AssociationSnapshot, ActivityCollectionRouteChange, Integer) -> [Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot?, bool, bool]
30
+ def recursive_records: (AssociationSnapshot, ActivityCollectionRouteChange, Integer) -> [ Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot?, bool, bool ]
31
+
32
+ # : ([RecordSnapshot?, RecordSnapshot?, bool], RecordSnapshot, RecordSnapshot, bool) -> [RecordSnapshot?, RecordSnapshot?, bool]
33
+ def recursive_transition: ([ RecordSnapshot?, RecordSnapshot?, bool ], RecordSnapshot, RecordSnapshot, bool) -> [ RecordSnapshot?, RecordSnapshot?, bool ]
34
+
35
+ # : (Array[RecordSnapshot], Integer, RecordSnapshot, RecordSnapshot, bool) -> [Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot?, bool]
36
+ def targeted_parent_replacement: (Array[RecordSnapshot], Integer, RecordSnapshot, RecordSnapshot, bool) -> [ Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot?, bool ]
37
+
38
+ # : (AssociationSnapshot, untyped, ActivityCollectionRouteChange) -> Integer?
39
+ def nested_owner_position: (AssociationSnapshot, untyped, ActivityCollectionRouteChange) -> Integer?
40
+
41
+ # : (RecordSnapshot, String, AssociationSnapshot) -> RecordSnapshot
42
+ def replace_association: (RecordSnapshot, String, AssociationSnapshot) -> RecordSnapshot
43
+ end
44
+ end
@@ -0,0 +1,19 @@
1
+ # Generated from lib/paper_trail_diff/activity_event_record_normalizer.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Normalizes one event record with the historical reader for its boundary.
5
+ class ActivityEventRecordNormalizer
6
+ # : (?association_reader: untyped) -> void
7
+ def initialize: (?association_reader: untyped) -> void
8
+
9
+ # : (untyped, reflection: untyped, subtree: AssociationTree, path: String, normalizer: SnapshotNormalizer, root_endpoint: untyped, context_endpoint: untyped) -> RecordSnapshot?
10
+ def call: (untyped, reflection: untyped, subtree: AssociationTree, path: String, normalizer: SnapshotNormalizer, root_endpoint: untyped, context_endpoint: untyped) -> RecordSnapshot?
11
+
12
+ private
13
+
14
+ @association_reader: untyped
15
+
16
+ # : (untyped, habtm_version: untyped) -> HistoricalAssociationReifier
17
+ def historical_reader: (untyped, habtm_version: untyped) -> HistoricalAssociationReifier
18
+ end
19
+ end
@@ -0,0 +1,44 @@
1
+ # Generated from lib/paper_trail_diff/activity_event_record_resolver.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Reconstructs an event's post-change record or immutable scalar delta.
5
+ class ActivityEventRecordResolver
6
+ RECORD_AFTER_HANDLERS: untyped
7
+
8
+ # : (?record_transition: untyped) -> void
9
+ def initialize: (?record_transition: untyped) -> void
10
+
11
+ # : (untyped) -> untyped
12
+ def record_after: (untyped) -> untyped
13
+
14
+ # : (untyped) -> ActivitySnapshotDelta?
15
+ def snapshot_delta: (untyped) -> ActivitySnapshotDelta?
16
+
17
+ # : (untyped) -> untyped
18
+ def changed_record_after: (untyped) -> untyped
19
+
20
+ # : (untyped) -> untyped
21
+ def created_record_after: (untyped) -> untyped
22
+
23
+ # : (untyped) -> untyped
24
+ def updated_record_after: (untyped) -> untyped
25
+
26
+ # Mirrors PaperTrail's changeset deserialization without resolving
27
+ # +version.item+, which would issue one live-record query per event.
28
+ # : (untyped, untyped) -> untyped
29
+ def deserialized_changeset: (untyped, untyped) -> untyped
30
+
31
+ private
32
+
33
+ @record_transition: untyped
34
+
35
+ # : (untyped, untyped) -> Hash[untyped, untyped]
36
+ def after_attributes: (untyped, untyped) -> Hash[untyped, untyped]
37
+
38
+ # : (untyped, untyped) -> untyped
39
+ def apply_changes: (untyped, untyped) -> untyped
40
+
41
+ # : (untyped, untyped, untyped) -> untyped
42
+ def standard_changeset: (untyped, untyped, untyped) -> untyped
43
+ end
44
+ end
@@ -0,0 +1,54 @@
1
+ # Generated from lib/paper_trail_diff/activity_event_route_finder.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Finds explicitly selected collection and belongs-to routes for one event type.
5
+ class ActivityEventRouteFinder
6
+ # : (AssociationTraversal) -> void
7
+ def initialize: (AssociationTraversal) -> void
8
+
9
+ # : (untyped, AssociationTree, String, ?path: String) -> Array[Array[untyped]]
10
+ def collection_routes: (untyped, AssociationTree, String, ?path: String) -> Array[Array[untyped]]
11
+
12
+ # : (untyped, AssociationTree, String, ?path: String) -> Array[Array[untyped]]
13
+ def belongs_to_routes: (untyped, AssociationTree, String, ?path: String) -> Array[Array[untyped]]
14
+
15
+ private
16
+
17
+ @belongs_to_model: untyped
18
+
19
+ @belongs_to_path: String?
20
+
21
+ @belongs_to_routes: Array[Array[untyped]]?
22
+
23
+ @belongs_to_tree: AssociationTree?
24
+
25
+ @belongs_to_type: String?
26
+
27
+ @collection_model: untyped
28
+
29
+ @collection_path: String?
30
+
31
+ @collection_routes: Array[Array[untyped]]?
32
+
33
+ @collection_tree: AssociationTree?
34
+
35
+ @collection_type: String?
36
+
37
+ @traversal: AssociationTraversal
38
+
39
+ # : (Array[Array[untyped]]) -> Array[Array[untyped]]
40
+ def freeze_routes: (Array[Array[untyped]]) -> Array[Array[untyped]]
41
+
42
+ # : (untyped, AssociationTree, String, Symbol, path: String) -> Array[Array[untyped]]
43
+ def routes: (untyped, AssociationTree, String, Symbol, path: String) -> Array[Array[untyped]]
44
+
45
+ # : (untyped, AssociationTree, String, Symbol, String) -> Array[Array[untyped]]
46
+ def routes_for_reflection: (untyped, AssociationTree, String, Symbol, String) -> Array[Array[untyped]]
47
+
48
+ # : (untyped, String, Symbol) -> bool
49
+ def direct_route?: (untyped, String, Symbol) -> bool
50
+
51
+ # : (untyped, Symbol) -> bool
52
+ def supported_direct_reflection?: (untyped, Symbol) -> bool
53
+ end
54
+ end
@@ -1,97 +1,46 @@
1
1
  # Generated from lib/paper_trail_diff/activity_event_snapshot_refresher.rb with RBS::Inline
2
2
 
3
3
  module PaperTrailDiff
4
- # Applies safe descendant event deltas without rebuilding an entire selected branch.
5
- # rubocop:disable Metrics/ClassLength
4
+ # Dispatches safe descendant events to focused immutable snapshot appliers.
6
5
  class ActivityEventSnapshotRefresher
7
- RECORD_AFTER_HANDLERS: untyped
6
+ # : (traversal: AssociationTraversal, pool: SnapshotPool, components: untyped, ?association_reader: untyped, ?record_transition: untyped) -> void
7
+ def initialize: (traversal: AssociationTraversal, pool: SnapshotPool, components: untyped, ?association_reader: untyped, ?record_transition: untyped) -> void
8
8
 
9
- # : (traversal: AssociationTraversal, pool: SnapshotPool, components: untyped, ?association_reader: untyped) -> void
10
- def initialize: (traversal: AssociationTraversal, pool: SnapshotPool, components: untyped, ?association_reader: untyped) -> void
9
+ # : (SnapshotPool, untyped) -> void
10
+ def configure_appliers: (SnapshotPool, untyped) -> void
11
11
 
12
- # : (untyped, untyped, RecordSnapshot, Array[String], ActivityEvent?) -> [bool, RecordSnapshot?]
13
- def call: (untyped, untyped, RecordSnapshot, Array[String], ActivityEvent?) -> [ bool, RecordSnapshot? ]
14
-
15
- private
16
-
17
- @association_reader: untyped
18
-
19
- @components: untyped
12
+ # : (SnapshotPool) -> ActivityCollectionRouteUpdater
13
+ def collection_updater: (SnapshotPool) -> ActivityCollectionRouteUpdater
20
14
 
21
- @pool: SnapshotPool
15
+ # : (ActivityEventRecordNormalizer, ActivityCollectionRouteUpdater) -> ActivityCollectionEventApplier
16
+ def collection_applier: (ActivityEventRecordNormalizer, ActivityCollectionRouteUpdater) -> ActivityCollectionEventApplier
22
17
 
23
- @traversal: AssociationTraversal
18
+ # : (ActivityEventRecordNormalizer) -> ActivityBelongsToEventApplier
19
+ def belongs_to_applier: (ActivityEventRecordNormalizer) -> ActivityBelongsToEventApplier
24
20
 
25
- # : (Array[Array[untyped]], untyped) -> bool
26
- def unsafe_through_membership_event?: (Array[Array[untyped]], untyped) -> bool
27
-
28
- # : (untyped, untyped, RecordSnapshot, SnapshotNormalizer, Array[Array[untyped]], untyped) -> [bool, RecordSnapshot]
29
- def collection_target_snapshot: (untyped, untyped, RecordSnapshot, SnapshotNormalizer, Array[Array[untyped]], untyped) -> [ bool, RecordSnapshot ]
21
+ # : (untyped, untyped, RecordSnapshot, Array[String], ActivityEvent?) -> [bool, RecordSnapshot?]
22
+ def call: (untyped, untyped, RecordSnapshot, Array[String], ActivityEvent?) -> [ bool, RecordSnapshot? ]
30
23
 
31
- # : (untyped, AssociationTree, String, ?path: String) -> Array[Array[untyped]]
32
- def direct_collection_routes: (untyped, AssociationTree, String, ?path: String) -> Array[Array[untyped]]
24
+ private
33
25
 
34
- # : (RecordSnapshot, Array[untyped], untyped, untyped, RecordSnapshot?, ?depth: Integer) -> [RecordSnapshot, bool]
35
- def replace_collection_route: (RecordSnapshot, Array[untyped], untyped, untyped, RecordSnapshot?, ?depth: Integer) -> [ RecordSnapshot, bool ]
26
+ @belongs_to_applier: ActivityBelongsToEventApplier
36
27
 
37
- # : (untyped, untyped, RecordSnapshot, AssociationTree, SnapshotNormalizer, untyped) -> [bool, RecordSnapshot?]
38
- def belongs_to_target_snapshot: (untyped, untyped, RecordSnapshot, AssociationTree, SnapshotNormalizer, untyped) -> [ bool, RecordSnapshot? ]
28
+ @collection_applier: ActivityCollectionEventApplier
39
29
 
40
- # : (untyped, AssociationTree, String, ?path: String) -> Array[Array[untyped]]
41
- def belongs_to_routes: (untyped, AssociationTree, String, ?path: String) -> Array[Array[untyped]]
30
+ @components: untyped
42
31
 
43
- # : (Array[untyped], untyped, SnapshotNormalizer, untyped, untyped) -> RecordSnapshot?
44
- def normalized_route_record: (Array[untyped], untyped, SnapshotNormalizer, untyped, untyped) -> RecordSnapshot?
32
+ @record_resolver: ActivityEventRecordResolver
45
33
 
46
- # : (RecordSnapshot, Array[untyped], untyped, RecordSnapshot?, ?depth: Integer) -> [RecordSnapshot, bool]
47
- def replace_route: (RecordSnapshot, Array[untyped], untyped, RecordSnapshot?, ?depth: Integer) -> [ RecordSnapshot, bool ]
34
+ @relationship: ActivityRelationship
48
35
 
49
- # : (Array[RecordSnapshot], untyped, RecordSnapshot?) -> Array[RecordSnapshot]
50
- def replace_existing_target: (Array[RecordSnapshot], untyped, RecordSnapshot?) -> Array[RecordSnapshot]
36
+ @route_finder: ActivityEventRouteFinder
51
37
 
52
38
  # : (untyped) -> untyped
53
39
  def record_after: (untyped) -> untyped
54
40
 
55
- # PaperTrail create/update versions contain deserialized change pairs, so
56
- # their post-event records need no successor query.
57
- # : (untyped) -> untyped
58
- def changed_record_after: (untyped) -> untyped
59
-
60
- # : (untyped) -> untyped
61
- def created_record_after: (untyped) -> untyped
62
-
63
- # : (untyped) -> untyped
64
- def updated_record_after: (untyped) -> untyped
65
-
66
- # : (untyped, untyped) -> Hash[untyped, untyped]
67
- def after_attributes: (untyped, untyped) -> Hash[untyped, untyped]
68
-
69
- # : (untyped, untyped) -> untyped
70
- def apply_changes: (untyped, untyped) -> untyped
71
-
72
- # Mirrors PaperTrail's changeset deserialization without resolving
73
- # +version.item+, which would issue one live-record query per event.
74
41
  # : (untyped, untyped) -> untyped
75
42
  def deserialized_changeset: (untyped, untyped) -> untyped
76
43
 
77
- # : (untyped, untyped, untyped) -> untyped
78
- def standard_changeset: (untyped, untyped, untyped) -> untyped
79
-
80
- # : (untyped, untyped, RecordSnapshot) -> bool
81
- def member_of_owner?: (untyped, untyped, RecordSnapshot) -> bool
82
-
83
- # : (untyped, untyped, AssociationTree, String, SnapshotNormalizer, untyped, untyped) -> RecordSnapshot?
84
- def normalize_event_record: (untyped, untyped, AssociationTree, String, SnapshotNormalizer, untyped, untyped) -> RecordSnapshot?
85
-
86
- # : (untyped, habtm_version: untyped) -> HistoricalAssociationReifier
87
- def historical_reader: (untyped, habtm_version: untyped) -> HistoricalAssociationReifier
88
-
89
- # : (Array[RecordSnapshot], untyped, RecordSnapshot?) -> Array[RecordSnapshot]
90
- def replace_collection_record: (Array[RecordSnapshot], untyped, RecordSnapshot?) -> Array[RecordSnapshot]
91
-
92
- # : (untyped, RecordSnapshot?) -> String
93
- def replacement_type: (untyped, RecordSnapshot?) -> String
94
-
95
44
  # : (untyped) -> untyped
96
45
  def endpoint_model_class: (untyped) -> untyped
97
46
  end