paper_trail_diff 0.17.0 → 0.18.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 +4 -4
- data/CHANGELOG.md +663 -0
- data/QUICKSTART.md +12 -14
- data/README.md +32 -30
- data/docs/architecture.md +65 -29
- data/docs/performance.md +161 -46
- data/docs/reference.md +495 -394
- data/docs/testing.md +9 -15
- data/lib/paper_trail_diff/activity_belongs_to_event_applier.rb +42 -9
- data/lib/paper_trail_diff/activity_boundary.rb +15 -6
- data/lib/paper_trail_diff/activity_child_candidate_loader.rb +91 -18
- data/lib/paper_trail_diff/activity_collection_event_applier.rb +14 -15
- data/lib/paper_trail_diff/activity_collection_record_updater.rb +18 -8
- data/lib/paper_trail_diff/activity_collection_route_updater.rb +12 -25
- data/lib/paper_trail_diff/activity_event.rb +53 -34
- data/lib/paper_trail_diff/activity_event_record_normalizer.rb +12 -26
- data/lib/paper_trail_diff/activity_event_record_resolver.rb +45 -32
- data/lib/paper_trail_diff/activity_event_snapshot_refresher.rb +26 -33
- data/lib/paper_trail_diff/activity_history.rb +28 -34
- data/lib/paper_trail_diff/activity_relationship.rb +3 -26
- data/lib/paper_trail_diff/activity_root_snapshot_refresher.rb +14 -8
- data/lib/paper_trail_diff/activity_snapshot_delta.rb +2 -3
- data/lib/paper_trail_diff/activity_snapshot_sequence.rb +92 -25
- data/lib/paper_trail_diff/activity_timeline_builder.rb +128 -77
- data/lib/paper_trail_diff/activity_transaction_applier.rb +49 -0
- data/lib/paper_trail_diff/activity_tree_filter.rb +70 -57
- data/lib/paper_trail_diff/activity_tree_places.rb +76 -0
- data/lib/paper_trail_diff/activity_version_collector.rb +45 -32
- data/lib/paper_trail_diff/activity_view.rb +2 -0
- data/lib/paper_trail_diff/analysis.rb +6 -5
- data/lib/paper_trail_diff/analysis_batch.rb +21 -17
- data/lib/paper_trail_diff/association_activity_edge.rb +99 -85
- data/lib/paper_trail_diff/association_activity_selection.rb +46 -14
- data/lib/paper_trail_diff/association_discovery.rb +4 -4
- data/lib/paper_trail_diff/association_key.rb +10 -18
- data/lib/paper_trail_diff/association_traversal.rb +72 -92
- data/lib/paper_trail_diff/batch_boundary_resolver.rb +1 -7
- data/lib/paper_trail_diff/batch_preload.rb +2 -3
- data/lib/paper_trail_diff/batched_root_analyses.rb +60 -25
- data/lib/paper_trail_diff/batched_root_analyzer.rb +5 -5
- data/lib/paper_trail_diff/batched_root_versions.rb +7 -30
- data/lib/paper_trail_diff/branch_snapshot_refresher.rb +19 -14
- data/lib/paper_trail_diff/candidate_table.rb +160 -0
- data/lib/paper_trail_diff/change_attribution.rb +35 -28
- data/lib/paper_trail_diff/collection_identity_index.rb +68 -24
- data/lib/paper_trail_diff/collection_transition.rb +3 -3
- data/lib/paper_trail_diff/comparison_batch.rb +13 -6
- data/lib/paper_trail_diff/database_time.rb +85 -0
- data/lib/paper_trail_diff/deleted_analysis_batch.rb +22 -23
- data/lib/paper_trail_diff/deleted_root_filter.rb +10 -6
- data/lib/paper_trail_diff/diagnostics.rb +26 -86
- data/lib/paper_trail_diff/endpoint.rb +37 -5
- data/lib/paper_trail_diff/engine.rb +1 -1
- data/lib/paper_trail_diff/errors.rb +0 -6
- data/lib/paper_trail_diff/exact_column_type.rb +96 -0
- data/lib/paper_trail_diff/historical_snapshot_store.rb +88 -83
- data/lib/paper_trail_diff/instrumentation.rb +0 -8
- data/lib/paper_trail_diff/live_endpoint_batch_loader.rb +1 -4
- data/lib/paper_trail_diff/live_graph_collector.rb +1 -3
- data/lib/paper_trail_diff/nested_comparator.rb +42 -10
- data/lib/paper_trail_diff/paper_trail_adapter.rb +55 -98
- data/lib/paper_trail_diff/prepared_activity_index.rb +235 -179
- data/lib/paper_trail_diff/prepared_child_candidates.rb +13 -3
- data/lib/paper_trail_diff/prepared_edge_loader.rb +11 -49
- data/lib/paper_trail_diff/prepared_history.rb +27 -177
- data/lib/paper_trail_diff/prepared_history_loader.rb +39 -57
- data/lib/paper_trail_diff/prepared_record_index.rb +221 -147
- data/lib/paper_trail_diff/prepared_snapshot_builder.rb +47 -42
- data/lib/paper_trail_diff/prepared_state_association_reader.rb +85 -62
- data/lib/paper_trail_diff/recorded_changes.rb +34 -10
- data/lib/paper_trail_diff/recorded_owner.rb +67 -0
- data/lib/paper_trail_diff/root_version_selection.rb +6 -2
- data/lib/paper_trail_diff/scope_condition.rb +120 -80
- data/lib/paper_trail_diff/scope_ranking.rb +14 -32
- data/lib/paper_trail_diff/scoped_analysis.rb +11 -6
- data/lib/paper_trail_diff/scoped_analysis_builder.rb +17 -11
- data/lib/paper_trail_diff/scoped_root_selection.rb +91 -85
- data/lib/paper_trail_diff/selection_window.rb +31 -0
- data/lib/paper_trail_diff/snapshot.rb +60 -58
- data/lib/paper_trail_diff/snapshot_members.rb +115 -0
- data/lib/paper_trail_diff/snapshot_normalizer.rb +0 -11
- data/lib/paper_trail_diff/step.rb +1 -5
- data/lib/paper_trail_diff/stored_form.rb +146 -0
- data/lib/paper_trail_diff/stored_json_values.rb +8 -5
- data/lib/paper_trail_diff/stored_time_precision.rb +67 -33
- data/lib/paper_trail_diff/stored_values.rb +35 -3
- data/lib/paper_trail_diff/support.rb +185 -35
- data/lib/paper_trail_diff/time_of_day.rb +13 -2
- data/lib/paper_trail_diff/time_range.rb +85 -11
- data/lib/paper_trail_diff/time_version_range.rb +5 -1
- data/lib/paper_trail_diff/timeline_builder.rb +5 -11
- data/lib/paper_trail_diff/timeline_range.rb +56 -19
- data/lib/paper_trail_diff/timeline_snapshot_provider.rb +31 -7
- data/lib/paper_trail_diff/total_order.rb +19 -5
- data/lib/paper_trail_diff/transaction_anchors.rb +138 -0
- data/lib/paper_trail_diff/transaction_cut.rb +67 -327
- data/lib/paper_trail_diff/transaction_ends.rb +194 -0
- data/lib/paper_trail_diff/traversal_preparer.rb +12 -24
- data/lib/paper_trail_diff/{approximate_paths.rb → unreadable_paths.rb} +8 -9
- data/lib/paper_trail_diff/value_objects.rb +8 -6
- data/lib/paper_trail_diff/version.rb +1 -1
- data/lib/paper_trail_diff/version_association_candidate_scope.rb +28 -4
- data/lib/paper_trail_diff/version_boundary.rb +0 -29
- data/lib/paper_trail_diff/version_query.rb +49 -1
- data/lib/paper_trail_diff/version_scope_filter.rb +74 -5
- data/lib/paper_trail_diff/version_sequence_diagnostics.rb +4 -31
- data/lib/paper_trail_diff/version_table.rb +8 -1
- data/lib/paper_trail_diff.rb +56 -110
- data/sig/generated/paper_trail_diff/activity_belongs_to_event_applier.rbs +24 -2
- data/sig/generated/paper_trail_diff/activity_boundary.rbs +6 -0
- data/sig/generated/paper_trail_diff/activity_child_candidate_loader.rbs +46 -5
- data/sig/generated/paper_trail_diff/activity_collection_event_applier.rbs +7 -4
- data/sig/generated/paper_trail_diff/activity_collection_record_updater.rbs +11 -2
- data/sig/generated/paper_trail_diff/activity_collection_route_updater.rbs +8 -6
- data/sig/generated/paper_trail_diff/activity_event.rbs +27 -18
- data/sig/generated/paper_trail_diff/activity_event_record_normalizer.rbs +7 -11
- data/sig/generated/paper_trail_diff/activity_event_record_resolver.rbs +26 -8
- data/sig/generated/paper_trail_diff/activity_event_snapshot_refresher.rbs +10 -2
- data/sig/generated/paper_trail_diff/activity_history.rbs +23 -26
- data/sig/generated/paper_trail_diff/activity_relationship.rbs +0 -6
- data/sig/generated/paper_trail_diff/activity_root_snapshot_refresher.rbs +5 -0
- data/sig/generated/paper_trail_diff/activity_snapshot_sequence.rbs +53 -10
- data/sig/generated/paper_trail_diff/activity_timeline_builder.rbs +64 -38
- data/sig/generated/paper_trail_diff/activity_transaction_applier.rbs +28 -0
- data/sig/generated/paper_trail_diff/activity_tree_filter.rbs +46 -38
- data/sig/generated/paper_trail_diff/activity_tree_places.rbs +45 -0
- data/sig/generated/paper_trail_diff/activity_version_collector.rbs +21 -11
- data/sig/generated/paper_trail_diff/analysis.rbs +6 -5
- data/sig/generated/paper_trail_diff/analysis_batch.rbs +8 -6
- data/sig/generated/paper_trail_diff/association_activity_edge.rbs +58 -45
- data/sig/generated/paper_trail_diff/association_activity_selection.rbs +20 -3
- data/sig/generated/paper_trail_diff/association_discovery.rbs +2 -2
- data/sig/generated/paper_trail_diff/association_key.rbs +2 -11
- data/sig/generated/paper_trail_diff/association_traversal.rbs +43 -44
- data/sig/generated/paper_trail_diff/batch_boundary_resolver.rbs +0 -2
- data/sig/generated/paper_trail_diff/batched_root_analyses.rbs +40 -17
- data/sig/generated/paper_trail_diff/batched_root_analyzer.rbs +2 -2
- data/sig/generated/paper_trail_diff/batched_root_versions.rbs +2 -11
- data/sig/generated/paper_trail_diff/branch_snapshot_refresher.rbs +12 -8
- data/sig/generated/paper_trail_diff/candidate_table.rbs +97 -0
- data/sig/generated/paper_trail_diff/change_attribution.rbs +21 -19
- data/sig/generated/paper_trail_diff/collection_identity_index.rbs +33 -13
- data/sig/generated/paper_trail_diff/collection_transition.rbs +2 -2
- data/sig/generated/paper_trail_diff/comparison_batch.rbs +5 -0
- data/sig/generated/paper_trail_diff/database_time.rbs +48 -0
- data/sig/generated/paper_trail_diff/deleted_analysis_batch.rbs +13 -15
- data/sig/generated/paper_trail_diff/deleted_root_filter.rbs +4 -0
- data/sig/generated/paper_trail_diff/diagnostics.rbs +13 -31
- data/sig/generated/paper_trail_diff/endpoint.rbs +14 -1
- data/sig/generated/paper_trail_diff/errors.rbs +0 -8
- data/sig/generated/paper_trail_diff/exact_column_type.rbs +51 -0
- data/sig/generated/paper_trail_diff/historical_snapshot_store.rbs +51 -31
- data/sig/generated/paper_trail_diff/instrumentation.rbs +0 -5
- data/sig/generated/paper_trail_diff/nested_comparator.rbs +21 -0
- data/sig/generated/paper_trail_diff/paper_trail_adapter.rbs +18 -29
- data/sig/generated/paper_trail_diff/prepared_activity_index.rbs +149 -94
- data/sig/generated/paper_trail_diff/prepared_child_candidates.rbs +10 -2
- data/sig/generated/paper_trail_diff/prepared_edge_loader.rbs +4 -21
- data/sig/generated/paper_trail_diff/prepared_history.rbs +22 -79
- data/sig/generated/paper_trail_diff/prepared_history_loader.rbs +24 -32
- data/sig/generated/paper_trail_diff/prepared_record_index.rbs +137 -63
- data/sig/generated/paper_trail_diff/prepared_snapshot_builder.rbs +22 -13
- data/sig/generated/paper_trail_diff/prepared_state_association_reader.rbs +41 -28
- data/sig/generated/paper_trail_diff/recorded_changes.rbs +19 -3
- data/sig/generated/paper_trail_diff/recorded_owner.rbs +39 -0
- data/sig/generated/paper_trail_diff/root_version_selection.rbs +4 -1
- data/sig/generated/paper_trail_diff/scope_condition.rbs +65 -52
- data/sig/generated/paper_trail_diff/scope_ranking.rbs +10 -23
- data/sig/generated/paper_trail_diff/scoped_analysis.rbs +11 -6
- data/sig/generated/paper_trail_diff/scoped_analysis_builder.rbs +7 -2
- data/sig/generated/paper_trail_diff/scoped_root_selection.rbs +49 -43
- data/sig/generated/paper_trail_diff/selection_window.rbs +19 -0
- data/sig/generated/paper_trail_diff/snapshot.rbs +37 -38
- data/sig/generated/paper_trail_diff/snapshot_members.rbs +58 -0
- data/sig/generated/paper_trail_diff/snapshot_normalizer.rbs +0 -4
- data/sig/generated/paper_trail_diff/stored_form.rbs +63 -0
- data/sig/generated/paper_trail_diff/stored_json_values.rbs +0 -2
- data/sig/generated/paper_trail_diff/stored_time_precision.rbs +33 -20
- data/sig/generated/paper_trail_diff/stored_values.rbs +18 -2
- data/sig/generated/paper_trail_diff/support.rbs +96 -16
- data/sig/generated/paper_trail_diff/time_of_day.rbs +4 -0
- data/sig/generated/paper_trail_diff/time_range.rbs +49 -4
- data/sig/generated/paper_trail_diff/time_version_range.rbs +3 -0
- data/sig/generated/paper_trail_diff/timeline_builder.rbs +3 -6
- data/sig/generated/paper_trail_diff/timeline_range.rbs +29 -8
- data/sig/generated/paper_trail_diff/timeline_snapshot_provider.rbs +17 -4
- data/sig/generated/paper_trail_diff/total_order.rbs +9 -3
- data/sig/generated/paper_trail_diff/transaction_anchors.rbs +80 -0
- data/sig/generated/paper_trail_diff/transaction_cut.rbs +43 -176
- data/sig/generated/paper_trail_diff/transaction_ends.rbs +124 -0
- data/sig/generated/paper_trail_diff/traversal_preparer.rbs +6 -11
- data/sig/generated/paper_trail_diff/{approximate_paths.rbs → unreadable_paths.rbs} +6 -7
- data/sig/generated/paper_trail_diff/value_objects.rbs +4 -2
- data/sig/generated/paper_trail_diff/version_association_candidate_scope.rbs +16 -2
- data/sig/generated/paper_trail_diff/version_boundary.rbs +0 -14
- data/sig/generated/paper_trail_diff/version_query.rbs +26 -0
- data/sig/generated/paper_trail_diff/version_scope_filter.rbs +28 -2
- data/sig/generated/paper_trail_diff/version_sequence_diagnostics.rbs +4 -15
- data/sig/generated/paper_trail_diff/version_table.rbs +4 -0
- data/sig/generated/paper_trail_diff.rbs +22 -23
- metadata +28 -20
- data/lib/paper_trail_diff/activity_target_candidate_loader.rb +0 -123
- data/lib/paper_trail_diff/fallback_paths.rb +0 -35
- data/lib/paper_trail_diff/habtm_transaction_owners.rb +0 -70
- data/lib/paper_trail_diff/historical_association_reifier.rb +0 -161
- data/lib/paper_trail_diff/historical_filter.rb +0 -210
- data/lib/paper_trail_diff/own_window.rb +0 -35
- data/lib/paper_trail_diff/prepared_association_reifier.rb +0 -51
- data/sig/generated/paper_trail_diff/activity_target_candidate_loader.rbs +0 -74
- data/sig/generated/paper_trail_diff/fallback_paths.rbs +0 -22
- data/sig/generated/paper_trail_diff/habtm_transaction_owners.rbs +0 -41
- data/sig/generated/paper_trail_diff/historical_association_reifier.rbs +0 -58
- data/sig/generated/paper_trail_diff/historical_filter.rbs +0 -96
- data/sig/generated/paper_trail_diff/own_window.rbs +0 -22
- data/sig/generated/paper_trail_diff/prepared_association_reifier.rbs +0 -27
data/lib/paper_trail_diff.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
# rbs_inline: enabled
|
|
3
3
|
|
|
4
|
+
require 'set' # Ruby 3.1 does not load it by itself
|
|
4
5
|
require 'paper_trail'
|
|
5
6
|
|
|
6
7
|
require_relative 'paper_trail_diff/version'
|
|
@@ -9,6 +10,8 @@ require_relative 'paper_trail_diff/version_query'
|
|
|
9
10
|
require_relative 'paper_trail_diff/stored_time_precision'
|
|
10
11
|
require_relative 'paper_trail_diff/stored_json_values'
|
|
11
12
|
require_relative 'paper_trail_diff/time_of_day'
|
|
13
|
+
require_relative 'paper_trail_diff/database_time'
|
|
14
|
+
require_relative 'paper_trail_diff/stored_form'
|
|
12
15
|
require_relative 'paper_trail_diff/stored_values'
|
|
13
16
|
require_relative 'paper_trail_diff/version_boundary'
|
|
14
17
|
require_relative 'paper_trail_diff/instrumentation'
|
|
@@ -18,12 +21,13 @@ require_relative 'paper_trail_diff/configuration'
|
|
|
18
21
|
require_relative 'paper_trail_diff/endpoint'
|
|
19
22
|
require_relative 'paper_trail_diff/recorded_class'
|
|
20
23
|
require_relative 'paper_trail_diff/association_key'
|
|
24
|
+
require_relative 'paper_trail_diff/recorded_owner'
|
|
21
25
|
require_relative 'paper_trail_diff/version_table'
|
|
22
26
|
require_relative 'paper_trail_diff/association_traversal'
|
|
27
|
+
require_relative 'paper_trail_diff/exact_column_type'
|
|
23
28
|
require_relative 'paper_trail_diff/scope_ranking'
|
|
24
29
|
require_relative 'paper_trail_diff/scope_condition'
|
|
25
|
-
require_relative 'paper_trail_diff/
|
|
26
|
-
require_relative 'paper_trail_diff/fallback_paths'
|
|
30
|
+
require_relative 'paper_trail_diff/unreadable_paths'
|
|
27
31
|
require_relative 'paper_trail_diff/traversal_preparer'
|
|
28
32
|
require_relative 'paper_trail_diff/association_discovery'
|
|
29
33
|
require_relative 'paper_trail_diff/diagnostics'
|
|
@@ -41,8 +45,6 @@ require_relative 'paper_trail_diff/change_row'
|
|
|
41
45
|
require_relative 'paper_trail_diff/collection_comparator'
|
|
42
46
|
require_relative 'paper_trail_diff/nested_comparator'
|
|
43
47
|
require_relative 'paper_trail_diff/engine'
|
|
44
|
-
require_relative 'paper_trail_diff/habtm_transaction_owners'
|
|
45
|
-
require_relative 'paper_trail_diff/historical_association_reifier'
|
|
46
48
|
require_relative 'paper_trail_diff/prepared_record_index'
|
|
47
49
|
require_relative 'paper_trail_diff/direct_record_state_loader'
|
|
48
50
|
require_relative 'paper_trail_diff/prepared_state_association_reader'
|
|
@@ -52,7 +54,6 @@ require_relative 'paper_trail_diff/prepared_history'
|
|
|
52
54
|
require_relative 'paper_trail_diff/version_association_candidate_scope'
|
|
53
55
|
require_relative 'paper_trail_diff/prepared_edge_loader'
|
|
54
56
|
require_relative 'paper_trail_diff/prepared_history_loader'
|
|
55
|
-
require_relative 'paper_trail_diff/prepared_association_reifier'
|
|
56
57
|
require_relative 'paper_trail_diff/live_association_reader'
|
|
57
58
|
require_relative 'paper_trail_diff/batch_preload'
|
|
58
59
|
require_relative 'paper_trail_diff/live_endpoint_batch_loader'
|
|
@@ -63,7 +64,6 @@ require_relative 'paper_trail_diff/comparison_batch'
|
|
|
63
64
|
require_relative 'paper_trail_diff/root_version_plan'
|
|
64
65
|
require_relative 'paper_trail_diff/version_scope_filter'
|
|
65
66
|
require_relative 'paper_trail_diff/root_version_selection'
|
|
66
|
-
require_relative 'paper_trail_diff/own_window'
|
|
67
67
|
require_relative 'paper_trail_diff/batched_root_versions'
|
|
68
68
|
require_relative 'paper_trail_diff/snapshot_normalizer'
|
|
69
69
|
require_relative 'paper_trail_diff/historical_snapshot_store'
|
|
@@ -72,6 +72,7 @@ require_relative 'paper_trail_diff/activity_event_record_resolver'
|
|
|
72
72
|
require_relative 'paper_trail_diff/recorded_changes'
|
|
73
73
|
require_relative 'paper_trail_diff/recorded_changes_reader'
|
|
74
74
|
require_relative 'paper_trail_diff/activity_event_route_finder'
|
|
75
|
+
require_relative 'paper_trail_diff/activity_tree_places'
|
|
75
76
|
require_relative 'paper_trail_diff/activity_relationship'
|
|
76
77
|
require_relative 'paper_trail_diff/activity_collection_route_change'
|
|
77
78
|
require_relative 'paper_trail_diff/activity_collection_record_updater'
|
|
@@ -81,6 +82,7 @@ require_relative 'paper_trail_diff/activity_collection_event_applier'
|
|
|
81
82
|
require_relative 'paper_trail_diff/activity_belongs_to_event_applier'
|
|
82
83
|
require_relative 'paper_trail_diff/activity_event_snapshot_refresher'
|
|
83
84
|
require_relative 'paper_trail_diff/activity_root_snapshot_refresher'
|
|
85
|
+
require_relative 'paper_trail_diff/activity_transaction_applier'
|
|
84
86
|
require_relative 'paper_trail_diff/branch_snapshot_refresher'
|
|
85
87
|
require_relative 'paper_trail_diff/activity_boundary'
|
|
86
88
|
require_relative 'paper_trail_diff/recorded_columns'
|
|
@@ -96,10 +98,10 @@ require_relative 'paper_trail_diff/batched_root_analyses'
|
|
|
96
98
|
require_relative 'paper_trail_diff/analysis_batch'
|
|
97
99
|
require_relative 'paper_trail_diff/deleted_analysis_batch'
|
|
98
100
|
require_relative 'paper_trail_diff/scoped_analysis'
|
|
99
|
-
require_relative 'paper_trail_diff/historical_filter'
|
|
100
101
|
require_relative 'paper_trail_diff/association_activity_edge'
|
|
101
102
|
require_relative 'paper_trail_diff/association_activity_selection'
|
|
102
103
|
require_relative 'paper_trail_diff/total_order'
|
|
104
|
+
require_relative 'paper_trail_diff/candidate_table'
|
|
103
105
|
require_relative 'paper_trail_diff/scoped_root_selection'
|
|
104
106
|
require_relative 'paper_trail_diff/deleted_root_filter'
|
|
105
107
|
require_relative 'paper_trail_diff/scoped_analysis_builder'
|
|
@@ -107,7 +109,9 @@ require_relative 'paper_trail_diff/batched_root_analyzer'
|
|
|
107
109
|
require_relative 'paper_trail_diff/version_range'
|
|
108
110
|
require_relative 'paper_trail_diff/version_sequence_diagnostics'
|
|
109
111
|
require_relative 'paper_trail_diff/time_range'
|
|
112
|
+
require_relative 'paper_trail_diff/selection_window'
|
|
110
113
|
require_relative 'paper_trail_diff/transaction_cut'
|
|
114
|
+
require_relative 'paper_trail_diff/transaction_anchors'
|
|
111
115
|
require_relative 'paper_trail_diff/time_version_range'
|
|
112
116
|
require_relative 'paper_trail_diff/timeline_range'
|
|
113
117
|
require_relative 'paper_trail_diff/timeline_builder'
|
|
@@ -115,9 +119,10 @@ require_relative 'paper_trail_diff/activity_range'
|
|
|
115
119
|
require_relative 'paper_trail_diff/activity_event'
|
|
116
120
|
require_relative 'paper_trail_diff/activity_child_candidate_loader'
|
|
117
121
|
require_relative 'paper_trail_diff/prepared_child_candidates'
|
|
118
|
-
require_relative 'paper_trail_diff/activity_target_candidate_loader'
|
|
119
122
|
require_relative 'paper_trail_diff/activity_version_collector'
|
|
123
|
+
require_relative 'paper_trail_diff/transaction_ends'
|
|
120
124
|
require_relative 'paper_trail_diff/activity_snapshot_sequence'
|
|
125
|
+
require_relative 'paper_trail_diff/snapshot_members'
|
|
121
126
|
require_relative 'paper_trail_diff/activity_tree_filter'
|
|
122
127
|
require_relative 'paper_trail_diff/activity_history'
|
|
123
128
|
require_relative 'paper_trail_diff/activity_timeline_builder'
|
|
@@ -157,92 +162,36 @@ module PaperTrailDiff # rubocop:disable Metrics/ModuleLength
|
|
|
157
162
|
belongs_to
|
|
158
163
|
has_one
|
|
159
164
|
has_many
|
|
160
|
-
has_and_belongs_to_many
|
|
161
165
|
].freeze
|
|
162
166
|
|
|
163
|
-
class << self
|
|
167
|
+
class << self
|
|
164
168
|
# Compares net state between explicit PaperTrail-version or current-record endpoints.
|
|
165
|
-
#: (untyped, untyped, ?associations: association_option, ?ignore: ignore_option
|
|
169
|
+
#: (untyped, untyped, ?associations: association_option, ?ignore: ignore_option) -> Diff
|
|
166
170
|
def compare(
|
|
167
171
|
from_version,
|
|
168
172
|
to_version,
|
|
169
173
|
associations: [],
|
|
170
|
-
ignore: DEFAULT_IGNORED_ATTRIBUTES
|
|
171
|
-
allow_approximate: false
|
|
174
|
+
ignore: DEFAULT_IGNORED_ATTRIBUTES
|
|
172
175
|
)
|
|
173
176
|
PaperTrailAdapter.new(
|
|
174
|
-
associations: associations, ignore: ignore
|
|
177
|
+
associations: associations, ignore: ignore
|
|
175
178
|
).compare(from_version, to_version)
|
|
176
179
|
end
|
|
177
180
|
|
|
178
181
|
# Compares many independent endpoint pairs while batching current-record loading.
|
|
179
|
-
#: (Array[comparison_input], ?associations: association_option, ?ignore: ignore_option
|
|
182
|
+
#: (Array[comparison_input], ?associations: association_option, ?ignore: ignore_option) -> comparison_results
|
|
180
183
|
def compare_many(
|
|
181
184
|
comparisons,
|
|
182
185
|
associations: [],
|
|
183
|
-
ignore: DEFAULT_IGNORED_ATTRIBUTES
|
|
184
|
-
allow_approximate: false
|
|
186
|
+
ignore: DEFAULT_IGNORED_ATTRIBUTES
|
|
185
187
|
)
|
|
186
188
|
PaperTrailAdapter.new(
|
|
187
|
-
associations: associations, ignore: ignore
|
|
189
|
+
associations: associations, ignore: ignore
|
|
188
190
|
).compare_many(comparisons)
|
|
189
191
|
end
|
|
190
192
|
|
|
191
|
-
# Compares every adjacent reconstructed state in an inclusive version range,
|
|
192
|
-
# by default the record's whole history through its current state.
|
|
193
|
-
#: (untyped, ?from: untyped, ?to: untyped, ?within: untyped, ?associations: association_option, ?ignore: ignore_option, ?version_scope: untyped, ?allow_approximate: bool) -> Array[Step]
|
|
194
|
-
def timeline( # rubocop:disable Metrics/ParameterLists
|
|
195
|
-
record,
|
|
196
|
-
from: nil,
|
|
197
|
-
to: nil,
|
|
198
|
-
within: nil,
|
|
199
|
-
associations: [],
|
|
200
|
-
ignore: DEFAULT_IGNORED_ATTRIBUTES,
|
|
201
|
-
version_scope: nil,
|
|
202
|
-
allow_approximate: false
|
|
203
|
-
)
|
|
204
|
-
PaperTrailAdapter.new(
|
|
205
|
-
associations: associations, ignore: ignore, allow_approximate: allow_approximate
|
|
206
|
-
).timeline(
|
|
207
|
-
record,
|
|
208
|
-
from: from,
|
|
209
|
-
to: to,
|
|
210
|
-
within: within,
|
|
211
|
-
version_scope: version_scope
|
|
212
|
-
)
|
|
213
|
-
end
|
|
214
|
-
|
|
215
|
-
# Compares adjacent root and selected-descendant activity boundaries.
|
|
216
|
-
#: (untyped, ?from: untyped, ?to: untyped, ?within: untyped, ?associations: association_option, ?ignore: ignore_option, ?version_scope: untyped, ?snapshots: bool, ?group: Symbol?, ?recorded_changes: bool, ?allow_approximate: bool) -> Array[ActivityStep]
|
|
217
|
-
def activity_timeline( # rubocop:disable Metrics/ParameterLists
|
|
218
|
-
record,
|
|
219
|
-
from: nil,
|
|
220
|
-
to: nil,
|
|
221
|
-
within: nil,
|
|
222
|
-
associations: [],
|
|
223
|
-
ignore: DEFAULT_IGNORED_ATTRIBUTES,
|
|
224
|
-
version_scope: nil,
|
|
225
|
-
snapshots: false,
|
|
226
|
-
group: nil,
|
|
227
|
-
recorded_changes: false,
|
|
228
|
-
allow_approximate: false
|
|
229
|
-
)
|
|
230
|
-
PaperTrailAdapter.new(
|
|
231
|
-
associations: associations, ignore: ignore,
|
|
232
|
-
recorded_changes: recorded_changes, allow_approximate: allow_approximate
|
|
233
|
-
).activity_timeline(
|
|
234
|
-
record,
|
|
235
|
-
from: from,
|
|
236
|
-
to: to,
|
|
237
|
-
within: within,
|
|
238
|
-
version_scope: version_scope,
|
|
239
|
-
group: group,
|
|
240
|
-
snapshots: snapshots
|
|
241
|
-
)
|
|
242
|
-
end
|
|
243
|
-
|
|
244
193
|
# Builds an endpoint diff and root-checkpoint timeline while normalizing each version once.
|
|
245
|
-
#: (untyped, ?from: untyped, ?to: untyped, ?within: untyped, ?associations: association_option, ?ignore: ignore_option, ?activity: bool, ?version_scope: untyped, ?snapshots: bool, ?group: Symbol?, ?recorded_changes: bool
|
|
194
|
+
#: (untyped, ?from: untyped, ?to: untyped, ?within: untyped, ?associations: association_option, ?ignore: ignore_option, ?activity: bool, ?version_scope: untyped, ?snapshots: bool, ?group: Symbol?, ?recorded_changes: bool?) -> Analysis
|
|
246
195
|
def analyze( # rubocop:disable Metrics/ParameterLists
|
|
247
196
|
record,
|
|
248
197
|
from: nil,
|
|
@@ -254,19 +203,17 @@ module PaperTrailDiff # rubocop:disable Metrics/ModuleLength
|
|
|
254
203
|
version_scope: nil,
|
|
255
204
|
snapshots: false,
|
|
256
205
|
group: nil,
|
|
257
|
-
recorded_changes:
|
|
258
|
-
allow_approximate: false
|
|
206
|
+
recorded_changes: nil
|
|
259
207
|
)
|
|
260
208
|
PaperTrailAdapter.new(
|
|
261
|
-
associations: associations, ignore: ignore, recorded_changes: recorded_changes
|
|
262
|
-
allow_approximate: allow_approximate
|
|
209
|
+
associations: associations, ignore: ignore, recorded_changes: recorded_changes
|
|
263
210
|
).analyze(
|
|
264
211
|
record,
|
|
265
212
|
from: from,
|
|
266
213
|
to: to,
|
|
267
214
|
within: within,
|
|
268
215
|
activity: activity,
|
|
269
|
-
version_scope: version_scope,
|
|
216
|
+
version_scope: VersionScopeFilter.checked(version_scope),
|
|
270
217
|
snapshots: snapshots,
|
|
271
218
|
group: group
|
|
272
219
|
)
|
|
@@ -277,7 +224,7 @@ module PaperTrailDiff # rubocop:disable Metrics/ModuleLength
|
|
|
277
224
|
# returns a frozen Hash keyed by identity. Roots with nothing to report in
|
|
278
225
|
# the window return an empty `Analysis`. To let a relation choose the
|
|
279
226
|
# records, use `analyze_scope`.
|
|
280
|
-
#: (Array[untyped], ?within: untyped, ?associations: association_option, ?ignore: ignore_option, ?activity: bool, ?version_scope: untyped, ?snapshots: bool, ?group: Symbol?, ?recorded_changes: bool
|
|
227
|
+
#: (Array[untyped], ?within: untyped, ?associations: association_option, ?ignore: ignore_option, ?activity: bool, ?version_scope: untyped, ?snapshots: bool, ?group: Symbol?, ?recorded_changes: bool?) -> Hash[identity, Analysis]
|
|
281
228
|
def analyze_many( # rubocop:disable Metrics/ParameterLists
|
|
282
229
|
records,
|
|
283
230
|
within: nil,
|
|
@@ -287,14 +234,14 @@ module PaperTrailDiff # rubocop:disable Metrics/ModuleLength
|
|
|
287
234
|
version_scope: nil,
|
|
288
235
|
snapshots: false,
|
|
289
236
|
group: nil,
|
|
290
|
-
recorded_changes:
|
|
291
|
-
allow_approximate: false
|
|
237
|
+
recorded_changes: nil
|
|
292
238
|
)
|
|
293
239
|
PaperTrailAdapter.new(
|
|
294
240
|
associations: associations, ignore: ignore,
|
|
295
|
-
recorded_changes: recorded_changes
|
|
296
|
-
).analyze_many(records, within: within, activity: activity,
|
|
297
|
-
|
|
241
|
+
recorded_changes: recorded_changes
|
|
242
|
+
).analyze_many(records, within: within, activity: activity, snapshots: snapshots,
|
|
243
|
+
group: group,
|
|
244
|
+
version_scope: VersionScopeFilter.checked(version_scope))
|
|
298
245
|
end
|
|
299
246
|
|
|
300
247
|
# Analyzes every root the relation reaches whose history moved inside the
|
|
@@ -323,7 +270,7 @@ module PaperTrailDiff # rubocop:disable Metrics/ModuleLength
|
|
|
323
270
|
# Note also that a relation selects on current state, not on state during
|
|
324
271
|
# the window: `where(status: 'published')` means published *now*, which is a
|
|
325
272
|
# different set from what was published while the window was open.
|
|
326
|
-
#: (untyped, limit: Integer?, ?within: untyped, ?associations: association_option, ?ignore: ignore_option, ?activity: bool, ?version_scope: untyped, ?snapshots: bool, ?group: Symbol?, ?
|
|
273
|
+
#: (untyped, limit: Integer?, ?within: untyped, ?associations: association_option, ?ignore: ignore_option, ?activity: bool, ?version_scope: untyped, ?snapshots: bool, ?group: Symbol?, ?include_deleted: bool, ?recorded_changes: bool?) -> ScopedAnalysis
|
|
327
274
|
def analyze_scope( # rubocop:disable Metrics/ParameterLists
|
|
328
275
|
scope,
|
|
329
276
|
limit:,
|
|
@@ -334,20 +281,15 @@ module PaperTrailDiff # rubocop:disable Metrics/ModuleLength
|
|
|
334
281
|
version_scope: nil,
|
|
335
282
|
snapshots: false,
|
|
336
283
|
group: nil,
|
|
337
|
-
historical_filter: nil,
|
|
338
|
-
max_filter_versions: HistoricalFilter::DEFAULT_VERSION_LIMIT,
|
|
339
284
|
include_deleted: false,
|
|
340
|
-
recorded_changes:
|
|
341
|
-
allow_approximate: false
|
|
285
|
+
recorded_changes: nil
|
|
342
286
|
)
|
|
343
287
|
adapter = PaperTrailAdapter.new(associations: associations, ignore: ignore,
|
|
344
|
-
recorded_changes: recorded_changes
|
|
345
|
-
allow_approximate: allow_approximate)
|
|
288
|
+
recorded_changes: recorded_changes)
|
|
346
289
|
adapter.analyze_scope(
|
|
347
290
|
scope, limit: limit, within: within, activity: activity,
|
|
348
|
-
version_scope: version_scope,
|
|
349
|
-
|
|
350
|
-
include_deleted: include_deleted
|
|
291
|
+
version_scope: VersionScopeFilter.checked(version_scope),
|
|
292
|
+
snapshots: snapshots, group: group, include_deleted: include_deleted
|
|
351
293
|
)
|
|
352
294
|
end
|
|
353
295
|
|
|
@@ -355,28 +297,23 @@ module PaperTrailDiff # rubocop:disable Metrics/ModuleLength
|
|
|
355
297
|
# for every root that changed or whose requested associations did.
|
|
356
298
|
# Historical windows remain explicit on analyze_scope; this entry point is
|
|
357
299
|
# deliberately named for a report through now rather than an as-of query.
|
|
358
|
-
|
|
300
|
+
# With associations, each saved transaction is one step unless `group:
|
|
301
|
+
# nil` asks for every version on its own.
|
|
302
|
+
#: (untyped, since: untyped, limit: Integer, ?associations: association_option, ?ignore: ignore_option, ?version_scope: untyped, ?snapshots: bool, ?group: Symbol?, ?include_deleted: bool, ?recorded_changes: bool?) -> ScopedAnalysis
|
|
359
303
|
def report( # rubocop:disable Metrics/ParameterLists
|
|
360
304
|
scope, since:, limit:, associations: [], ignore: DEFAULT_IGNORED_ATTRIBUTES,
|
|
361
|
-
version_scope: nil, snapshots: false, group:
|
|
362
|
-
|
|
363
|
-
recorded_changes: false, allow_approximate: false
|
|
305
|
+
version_scope: nil, snapshots: false, group: default_group(associations),
|
|
306
|
+
include_deleted: false, recorded_changes: nil
|
|
364
307
|
)
|
|
365
|
-
|
|
366
|
-
if since.nil? || since.is_a?(Range)
|
|
367
|
-
raise InvalidTimeRangeError, '`since` must be a time, date, or string; for a range, ' \
|
|
368
|
-
'pass it as `within:` to analyze_scope'
|
|
369
|
-
end
|
|
370
|
-
|
|
308
|
+
TimeRange.check_since!(since)
|
|
371
309
|
# Endless, so a version a server dated ahead of this one's clock is in it.
|
|
372
310
|
analyze_scope(
|
|
373
311
|
scope,
|
|
374
312
|
within: (since..), limit: limit, associations: associations,
|
|
375
313
|
ignore: ignore, activity: true, version_scope: version_scope, snapshots: snapshots,
|
|
376
314
|
group: group,
|
|
377
|
-
include_deleted: include_deleted,
|
|
378
|
-
|
|
379
|
-
recorded_changes: recorded_changes, allow_approximate: allow_approximate
|
|
315
|
+
include_deleted: include_deleted,
|
|
316
|
+
recorded_changes: recorded_changes
|
|
380
317
|
)
|
|
381
318
|
end
|
|
382
319
|
|
|
@@ -401,10 +338,9 @@ module PaperTrailDiff # rubocop:disable Metrics/ModuleLength
|
|
|
401
338
|
# Reports known reconstruction hazards without mutating application state,
|
|
402
339
|
# for the endpoints `compare` takes: two versions, or a version and the
|
|
403
340
|
# current record. Every reason `compare` would refuse them is an error.
|
|
404
|
-
#: (untyped, untyped, ?associations: association_option
|
|
405
|
-
def diagnose(from, to, associations: []
|
|
406
|
-
HistoryDiagnostics.new(from, to, associations: associations
|
|
407
|
-
allow_approximate: allow_approximate).call
|
|
341
|
+
#: (untyped, untyped, ?associations: association_option) -> DiagnosticReport
|
|
342
|
+
def diagnose(from, to, associations: [])
|
|
343
|
+
HistoryDiagnostics.new(from, to, associations: associations).call
|
|
408
344
|
end
|
|
409
345
|
|
|
410
346
|
# Looks inside an attribute the database stores whole, such as a JSON or
|
|
@@ -449,5 +385,15 @@ module PaperTrailDiff # rubocop:disable Metrics/ModuleLength
|
|
|
449
385
|
def recorded_changes(version, ignore: DEFAULT_IGNORED_ATTRIBUTES)
|
|
450
386
|
RecordedChanges.call(version, ignore: ignore)
|
|
451
387
|
end
|
|
388
|
+
|
|
389
|
+
private
|
|
390
|
+
|
|
391
|
+
# `report` groups by transaction unless it reads no associations. A value
|
|
392
|
+
# that is not a list, such as nil, groups too, and the option's own check
|
|
393
|
+
# then refuses it, naming the option.
|
|
394
|
+
#: (untyped) -> Symbol?
|
|
395
|
+
def default_group(associations)
|
|
396
|
+
:transaction unless associations.respond_to?(:empty?) && associations.empty?
|
|
397
|
+
end
|
|
452
398
|
end
|
|
453
399
|
end
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
module PaperTrailDiff
|
|
4
4
|
# Applies selected non-polymorphic belongs-to target updates to a snapshot.
|
|
5
|
+
# A target created there changes nothing unless an owner already named it,
|
|
6
|
+
# as one can where no foreign key constraint forbids it (see #created).
|
|
5
7
|
class ActivityBelongsToEventApplier
|
|
6
8
|
# : (route_finder: ActivityEventRouteFinder, record_resolver: ActivityEventRecordResolver, record_normalizer: ActivityEventRecordNormalizer) -> void
|
|
7
9
|
def initialize: (route_finder: ActivityEventRouteFinder, record_resolver: ActivityEventRecordResolver, record_normalizer: ActivityEventRecordNormalizer) -> void
|
|
@@ -17,8 +19,28 @@ module PaperTrailDiff
|
|
|
17
19
|
|
|
18
20
|
@route_finder: ActivityEventRouteFinder
|
|
19
21
|
|
|
20
|
-
#
|
|
21
|
-
|
|
22
|
+
# Whether the branch must be read again rather than patched. A target
|
|
23
|
+
# class that is an STI subclass holds a record only while its type names
|
|
24
|
+
# the subclass, so an update that retypes the record moves it in or out,
|
|
25
|
+
# which only the owner's key, read again, can tell.
|
|
26
|
+
# : (Array[Array[untyped]]) -> bool
|
|
27
|
+
def reread?: (Array[Array[untyped]]) -> bool
|
|
28
|
+
|
|
29
|
+
# A created target is new to the snapshot unless an owner named it first.
|
|
30
|
+
# A snapshot leaves out an owner's key, but an owner that names a record
|
|
31
|
+
# holds one, and only an owner holding none can name a record that does
|
|
32
|
+
# not exist yet: the branch is read again only when there is such an
|
|
33
|
+
# owner.
|
|
34
|
+
# : (RecordSnapshot, Array[Array[untyped]]) -> [bool, RecordSnapshot?]
|
|
35
|
+
def created: (RecordSnapshot, Array[Array[untyped]]) -> [ bool, RecordSnapshot? ]
|
|
36
|
+
|
|
37
|
+
# Whether a record along the route holds no target where it ends, or the
|
|
38
|
+
# snapshot does not say.
|
|
39
|
+
# : (RecordSnapshot, Array[untyped], Integer) -> bool
|
|
40
|
+
def vacant?: (RecordSnapshot, Array[untyped], Integer) -> bool
|
|
41
|
+
|
|
42
|
+
# : (Array[untyped], untyped, SnapshotNormalizer, untyped) -> RecordSnapshot?
|
|
43
|
+
def normalized_route_record: (Array[untyped], untyped, SnapshotNormalizer, untyped) -> RecordSnapshot?
|
|
22
44
|
|
|
23
45
|
# : (RecordSnapshot, Array[untyped], untyped, RecordSnapshot?, ?depth: Integer) -> [RecordSnapshot, bool]
|
|
24
46
|
def replace_route: (RecordSnapshot, Array[untyped], untyped, RecordSnapshot?, ?depth: Integer) -> [ RecordSnapshot, bool ]
|
|
@@ -54,6 +54,12 @@ module PaperTrailDiff
|
|
|
54
54
|
# : (item_type: String, item_id: untyped) -> ActivityBoundary
|
|
55
55
|
def self.unversioned: (item_type: String, item_id: untyped) -> ActivityBoundary
|
|
56
56
|
|
|
57
|
+
# The `from`/`to`/`diff` hash that `Step#to_h` and `ActivityStep#to_h`
|
|
58
|
+
# share, so a consumer reads both step types alike.
|
|
59
|
+
# @api private
|
|
60
|
+
# : (ActivityBoundary, ActivityBoundary, Diff, metadata: bool) -> Hash[Symbol, untyped]
|
|
61
|
+
def self.transition_h: (ActivityBoundary, ActivityBoundary, Diff, metadata: bool) -> Hash[Symbol, untyped]
|
|
62
|
+
|
|
57
63
|
# : (untyped, Symbol, RecordedChangesReader?) -> ActivityBoundary
|
|
58
64
|
private def self.of_version: (untyped, Symbol, RecordedChangesReader?) -> ActivityBoundary
|
|
59
65
|
|
|
@@ -3,11 +3,15 @@
|
|
|
3
3
|
module PaperTrailDiff
|
|
4
4
|
# Loads the children of a has_many or has_one that its owners had from a
|
|
5
5
|
# start onward, from PT-AT's version associations and the live rows.
|
|
6
|
-
# Prepared history and activity both read children through it.
|
|
7
|
-
#
|
|
6
|
+
# Prepared history and activity both read children through it.
|
|
7
|
+
#
|
|
8
|
+
# A history that ends leaves out the children created after its end (see
|
|
9
|
+
# VersionQuery.created_after), which no state up to the end holds: read
|
|
10
|
+
# with the rest, each would bring its versions and its row, and a range
|
|
11
|
+
# long past would cost more with every child its owners have gained since.
|
|
8
12
|
class ActivityChildCandidateLoader
|
|
9
|
-
# : (untyped, Array[untyped], untyped, untyped) -> void
|
|
10
|
-
def initialize: (untyped, Array[untyped], untyped, untyped) -> void
|
|
13
|
+
# : (untyped, Array[untyped], untyped, untyped, untyped) -> void
|
|
14
|
+
def initialize: (untyped, Array[untyped], untyped, untyped, untyped) -> void
|
|
11
15
|
|
|
12
16
|
# Queries shared by a batch's roots keep the owner and timestamp needed to
|
|
13
17
|
# partition its candidates back into each root's exact activity range.
|
|
@@ -19,7 +23,9 @@ module PaperTrailDiff
|
|
|
19
23
|
|
|
20
24
|
private
|
|
21
25
|
|
|
22
|
-
@
|
|
26
|
+
@end_at: untyped
|
|
27
|
+
|
|
28
|
+
@foreign_key: String
|
|
23
29
|
|
|
24
30
|
@parent_class: untyped
|
|
25
31
|
|
|
@@ -29,6 +35,26 @@ module PaperTrailDiff
|
|
|
29
35
|
|
|
30
36
|
@start_at: untyped
|
|
31
37
|
|
|
38
|
+
# Every row of the table, as history reads them: an STI subclass's
|
|
39
|
+
# siblings are left out where children are resolved.
|
|
40
|
+
# : (String, Array[untyped]) -> untyped
|
|
41
|
+
def live_relation: (String, Array[untyped]) -> untyped
|
|
42
|
+
|
|
43
|
+
# Any version of a child that was not created after the end. A version
|
|
44
|
+
# saved by the end precedes any create after it, so it is always kept.
|
|
45
|
+
# : (untyped) -> untyped
|
|
46
|
+
def there_by_end: (untyped) -> untyped
|
|
47
|
+
|
|
48
|
+
# The child class is quoted as its name, which its versions record.
|
|
49
|
+
# : () -> untyped
|
|
50
|
+
def live_by_end: () -> untyped
|
|
51
|
+
|
|
52
|
+
# A live row is matched to its versions in the database only where it
|
|
53
|
+
# compares an item_id with a key held as the same type; elsewhere every
|
|
54
|
+
# live child is read, as without an end.
|
|
55
|
+
# : () -> bool
|
|
56
|
+
def comparable_keys?: () -> bool
|
|
57
|
+
|
|
32
58
|
# : (Array[Array[untyped]]) -> Array[Array[untyped]]
|
|
33
59
|
def typed_rows: (Array[Array[untyped]]) -> Array[Array[untyped]]
|
|
34
60
|
|
|
@@ -39,6 +65,21 @@ module PaperTrailDiff
|
|
|
39
65
|
# : (untyped, String, Array[untyped]) -> untyped
|
|
40
66
|
def historical_relation: (untyped, String, Array[untyped]) -> untyped
|
|
41
67
|
|
|
68
|
+
# PT-AT stores the keys a version saved, so the owner a child held before
|
|
69
|
+
# its first version is in no row when that version is not a create: the
|
|
70
|
+
# child was made without one, and its first version's state, which holds
|
|
71
|
+
# that owner, is read instead.
|
|
72
|
+
# : (String) -> Array[Array[untyped]]
|
|
73
|
+
def first_owner_rows: (String) -> Array[Array[untyped]]
|
|
74
|
+
|
|
75
|
+
# The first version of each child since the start, unless it created its
|
|
76
|
+
# child: a create holds no state, and every child created after the
|
|
77
|
+
# range would be read for nothing. One saved after the end holds the
|
|
78
|
+
# state the child had there too. A model PaperTrail does not version has
|
|
79
|
+
# none.
|
|
80
|
+
# : () -> untyped
|
|
81
|
+
def first_versions: () -> untyped
|
|
82
|
+
|
|
42
83
|
# : (untyped, untyped) -> Array[Array[untyped]]
|
|
43
84
|
def pluck_rows: (untyped, untyped) -> Array[Array[untyped]]
|
|
44
85
|
|
|
@@ -22,8 +22,8 @@ module PaperTrailDiff
|
|
|
22
22
|
|
|
23
23
|
@route_updater: ActivityCollectionRouteUpdater
|
|
24
24
|
|
|
25
|
-
# : (RecordSnapshot, Array[untyped], untyped, ActivitySnapshotDelta?, Array[untyped], SnapshotNormalizer, Array[untyped]
|
|
26
|
-
def apply_route: (RecordSnapshot, Array[untyped], untyped, ActivitySnapshotDelta?, Array[untyped], SnapshotNormalizer, Array[untyped]
|
|
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
27
|
|
|
28
28
|
# : (Array[Array[untyped]], untyped) -> bool
|
|
29
29
|
def unsafe_through_membership_event?: (Array[Array[untyped]], untyped) -> bool
|
|
@@ -44,9 +44,12 @@ module PaperTrailDiff
|
|
|
44
44
|
# : (untyped) -> Array[untyped]
|
|
45
45
|
def owned_keys: (untyped) -> Array[untyped]
|
|
46
46
|
|
|
47
|
-
# : (RecordSnapshot, Array[untyped], untyped, ActivitySnapshotDelta?, Array[untyped], SnapshotNormalizer, Array[untyped]
|
|
48
|
-
def route_event_state: (RecordSnapshot, Array[untyped], untyped, ActivitySnapshotDelta?, Array[untyped], SnapshotNormalizer, Array[untyped]
|
|
47
|
+
# : (RecordSnapshot, Array[untyped], untyped, ActivitySnapshotDelta?, Array[untyped], SnapshotNormalizer, Array[untyped]) -> [untyped, RecordSnapshot?]
|
|
48
|
+
def route_event_state: (RecordSnapshot, Array[untyped], untyped, ActivitySnapshotDelta?, Array[untyped], SnapshotNormalizer, Array[untyped]) -> [ untyped, RecordSnapshot? ]
|
|
49
49
|
|
|
50
|
+
# A record the event took out of the association's class, such as an
|
|
51
|
+
# STI row retyped to its base class, is no member to read a subtree for:
|
|
52
|
+
# the subtree can name associations only that class has.
|
|
50
53
|
# : (untyped, Array[untyped], SnapshotNormalizer, Array[untyped]) -> RecordSnapshot?
|
|
51
54
|
def normalized_event_record: (untyped, Array[untyped], SnapshotNormalizer, Array[untyped]) -> RecordSnapshot?
|
|
52
55
|
|
|
@@ -9,8 +9,10 @@ module PaperTrailDiff
|
|
|
9
9
|
# : (AssociationSnapshot, ActivityCollectionRouteChange, untyped, RecordSnapshot) -> RecordSnapshot?
|
|
10
10
|
def event_child: (AssociationSnapshot, ActivityCollectionRouteChange, untyped, RecordSnapshot) -> RecordSnapshot?
|
|
11
11
|
|
|
12
|
-
#
|
|
13
|
-
|
|
12
|
+
# The collection's records after the event, with the record it took out
|
|
13
|
+
# and the one it put in.
|
|
14
|
+
# : (AssociationSnapshot, untyped, RecordSnapshot?) -> [Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot?]
|
|
15
|
+
def call: (AssociationSnapshot, untyped, RecordSnapshot?) -> [ Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot? ]
|
|
14
16
|
|
|
15
17
|
# : (untyped, RecordSnapshot?) -> String
|
|
16
18
|
def replacement_type: (untyped, RecordSnapshot?) -> String
|
|
@@ -24,7 +26,14 @@ module PaperTrailDiff
|
|
|
24
26
|
# : (AssociationSnapshot, untyped) -> Integer?
|
|
25
27
|
def retyped_position: (AssociationSnapshot, untyped) -> Integer?
|
|
26
28
|
|
|
29
|
+
# A record that keeps its identity keeps its place. Any other, one that
|
|
30
|
+
# joined or a row whose type changed, goes where its identity sorts, so
|
|
31
|
+
# the records stay in the order a snapshot holds them in without being
|
|
32
|
+
# sorted again for each event.
|
|
27
33
|
# : (Array[RecordSnapshot], Integer?, RecordSnapshot?) -> Array[RecordSnapshot]
|
|
28
34
|
def replacement_records: (Array[RecordSnapshot], Integer?, RecordSnapshot?) -> Array[RecordSnapshot]
|
|
35
|
+
|
|
36
|
+
# : (Array[RecordSnapshot], RecordSnapshot) -> void
|
|
37
|
+
def insert: (Array[RecordSnapshot], RecordSnapshot) -> void
|
|
29
38
|
end
|
|
30
39
|
end
|
|
@@ -17,17 +17,19 @@ module PaperTrailDiff
|
|
|
17
17
|
|
|
18
18
|
@relationship: ActivityRelationship
|
|
19
19
|
|
|
20
|
-
#
|
|
21
|
-
|
|
20
|
+
# The association's records after the change, the record it took out and
|
|
21
|
+
# the one it put in, and whether anything changed.
|
|
22
|
+
# : (AssociationSnapshot, RecordSnapshot, ActivityCollectionRouteChange, Integer) -> [Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot?, bool]
|
|
23
|
+
def updated_records: (AssociationSnapshot, RecordSnapshot, ActivityCollectionRouteChange, Integer) -> [ Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot?, bool ]
|
|
22
24
|
|
|
23
|
-
# : (AssociationSnapshot, RecordSnapshot, ActivityCollectionRouteChange) -> [Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot?, bool
|
|
24
|
-
def leaf_records: (AssociationSnapshot, RecordSnapshot, ActivityCollectionRouteChange) -> [ Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot?, bool
|
|
25
|
+
# : (AssociationSnapshot, RecordSnapshot, ActivityCollectionRouteChange) -> [Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot?, bool]
|
|
26
|
+
def leaf_records: (AssociationSnapshot, RecordSnapshot, ActivityCollectionRouteChange) -> [ Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot?, bool ]
|
|
25
27
|
|
|
26
28
|
# : (AssociationSnapshot, ActivityCollectionRouteChange, Integer) -> [Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot?, bool]?
|
|
27
29
|
def targeted_parent: (AssociationSnapshot, ActivityCollectionRouteChange, Integer) -> [ Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot?, bool ]?
|
|
28
30
|
|
|
29
|
-
# : (AssociationSnapshot, ActivityCollectionRouteChange, Integer) -> [Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot?, bool
|
|
30
|
-
def recursive_records: (AssociationSnapshot, ActivityCollectionRouteChange, Integer) -> [ Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot?, bool
|
|
31
|
+
# : (AssociationSnapshot, ActivityCollectionRouteChange, Integer) -> [Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot?, bool]
|
|
32
|
+
def recursive_records: (AssociationSnapshot, ActivityCollectionRouteChange, Integer) -> [ Array[RecordSnapshot], RecordSnapshot?, RecordSnapshot?, bool ]
|
|
31
33
|
|
|
32
34
|
# : ([RecordSnapshot?, RecordSnapshot?, bool], RecordSnapshot, RecordSnapshot, bool) -> [RecordSnapshot?, RecordSnapshot?, bool]
|
|
33
35
|
def recursive_transition: ([ RecordSnapshot?, RecordSnapshot?, bool ], RecordSnapshot, RecordSnapshot, bool) -> [ RecordSnapshot?, RecordSnapshot?, bool ]
|