paper_trail_diff 0.13.1 → 0.15.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 +630 -0
- data/QUICKSTART.md +30 -10
- data/README.md +91 -13
- data/docs/architecture.md +62 -18
- data/docs/performance.md +116 -298
- data/docs/reference.md +554 -102
- data/docs/testing.md +93 -14
- data/lib/paper_trail_diff/activity_belongs_to_event_applier.rb +19 -9
- data/lib/paper_trail_diff/activity_boundary.rb +83 -26
- data/lib/paper_trail_diff/activity_child_candidate_loader.rb +2 -1
- data/lib/paper_trail_diff/activity_collection_event_applier.rb +11 -1
- data/lib/paper_trail_diff/activity_collection_record_updater.rb +16 -2
- data/lib/paper_trail_diff/activity_event.rb +41 -10
- data/lib/paper_trail_diff/activity_event_record_resolver.rb +20 -1
- data/lib/paper_trail_diff/activity_event_route_finder.rb +2 -1
- data/lib/paper_trail_diff/activity_event_snapshot_refresher.rb +1 -1
- data/lib/paper_trail_diff/activity_history.rb +34 -9
- data/lib/paper_trail_diff/activity_range.rb +32 -5
- data/lib/paper_trail_diff/activity_relationship.rb +12 -0
- data/lib/paper_trail_diff/activity_root_snapshot_refresher.rb +5 -2
- data/lib/paper_trail_diff/activity_snapshot_sequence.rb +76 -37
- data/lib/paper_trail_diff/activity_target_candidate_loader.rb +131 -0
- data/lib/paper_trail_diff/activity_timeline_builder.rb +281 -120
- data/lib/paper_trail_diff/activity_transaction_grouper.rb +2 -1
- data/lib/paper_trail_diff/activity_tree_filter.rb +114 -0
- data/lib/paper_trail_diff/activity_version_collector.rb +37 -24
- data/lib/paper_trail_diff/activity_view.rb +69 -0
- data/lib/paper_trail_diff/analysis.rb +13 -1
- data/lib/paper_trail_diff/analysis_batch.rb +24 -30
- data/lib/paper_trail_diff/approximate_paths.rb +48 -0
- data/lib/paper_trail_diff/association_activity_edge.rb +236 -0
- data/lib/paper_trail_diff/association_activity_selection.rb +197 -0
- data/lib/paper_trail_diff/association_discovery.rb +14 -11
- data/lib/paper_trail_diff/association_key.rb +56 -0
- data/lib/paper_trail_diff/association_traversal.rb +180 -47
- data/lib/paper_trail_diff/batch_boundary_resolver.rb +3 -4
- data/lib/paper_trail_diff/batch_preload.rb +53 -0
- data/lib/paper_trail_diff/batched_root_analyzer.rb +12 -14
- data/lib/paper_trail_diff/batched_root_versions.rb +53 -47
- data/lib/paper_trail_diff/change_row.rb +133 -0
- data/lib/paper_trail_diff/collection_comparator.rb +5 -32
- data/lib/paper_trail_diff/comparison_batch.rb +37 -10
- data/lib/paper_trail_diff/configuration.rb +35 -12
- data/lib/paper_trail_diff/deleted_analysis_batch.rb +45 -27
- data/lib/paper_trail_diff/deleted_root_filter.rb +79 -0
- data/lib/paper_trail_diff/deprecation.rb +61 -0
- data/lib/paper_trail_diff/diagnostics.rb +105 -102
- data/lib/paper_trail_diff/direct_record_state_loader.rb +10 -1
- data/lib/paper_trail_diff/endpoint.rb +26 -3
- data/lib/paper_trail_diff/errors.rb +5 -2
- data/lib/paper_trail_diff/fallback_paths.rb +38 -0
- data/lib/paper_trail_diff/habtm_transaction_owners.rb +68 -0
- data/lib/paper_trail_diff/historical_association_reifier.rb +34 -6
- data/lib/paper_trail_diff/historical_filter.rb +19 -10
- data/lib/paper_trail_diff/historical_snapshot_store.rb +63 -76
- data/lib/paper_trail_diff/live_endpoint_batch_loader.rb +12 -13
- data/lib/paper_trail_diff/live_graph_collector.rb +1 -1
- data/lib/paper_trail_diff/nested_comparator.rb +19 -18
- data/lib/paper_trail_diff/paper_trail_adapter.rb +136 -125
- data/lib/paper_trail_diff/preloaded_endpoint_batch_loader.rb +14 -2
- data/lib/paper_trail_diff/prepared_activity_index.rb +110 -36
- data/lib/paper_trail_diff/prepared_edge_loader.rb +31 -46
- data/lib/paper_trail_diff/prepared_history.rb +70 -53
- data/lib/paper_trail_diff/prepared_history_loader.rb +34 -43
- data/lib/paper_trail_diff/prepared_record_index.rb +64 -7
- data/lib/paper_trail_diff/prepared_snapshot_builder.rb +1 -1
- data/lib/paper_trail_diff/prepared_state_association_reader.rb +119 -29
- data/lib/paper_trail_diff/recorded_changes.rb +83 -0
- data/lib/paper_trail_diff/recorded_class.rb +53 -0
- data/lib/paper_trail_diff/root_version_selection.rb +4 -2
- data/lib/paper_trail_diff/scope_condition.rb +386 -0
- data/lib/paper_trail_diff/scope_ranking.rb +206 -0
- data/lib/paper_trail_diff/scoped_analysis.rb +11 -0
- data/lib/paper_trail_diff/scoped_analysis_builder.rb +20 -11
- data/lib/paper_trail_diff/scoped_root_selection.rb +105 -49
- data/lib/paper_trail_diff/snapshot.rb +16 -1
- data/lib/paper_trail_diff/snapshot_normalizer.rb +10 -3
- data/lib/paper_trail_diff/support.rb +38 -6
- data/lib/paper_trail_diff/time_range.rb +37 -18
- data/lib/paper_trail_diff/time_version_range.rb +5 -5
- data/lib/paper_trail_diff/timeline_builder.rb +7 -7
- data/lib/paper_trail_diff/timeline_range.rb +9 -1
- data/lib/paper_trail_diff/timeline_snapshot_provider.rb +24 -17
- data/lib/paper_trail_diff/transaction_cut.rb +181 -0
- data/lib/paper_trail_diff/traversal_preparer.rb +134 -29
- data/lib/paper_trail_diff/version.rb +1 -1
- data/lib/paper_trail_diff/version_association_candidate_scope.rb +13 -3
- data/lib/paper_trail_diff/version_boundary.rb +37 -8
- data/lib/paper_trail_diff/version_query.rb +34 -10
- data/lib/paper_trail_diff/version_range.rb +8 -15
- data/lib/paper_trail_diff/version_scope_filter.rb +20 -13
- data/lib/paper_trail_diff/version_sequence_diagnostics.rb +31 -16
- data/lib/paper_trail_diff/version_table.rb +60 -0
- data/lib/paper_trail_diff.rb +126 -55
- data/sig/generated/paper_trail_diff/activity_belongs_to_event_applier.rbs +10 -2
- data/sig/generated/paper_trail_diff/activity_boundary.rbs +54 -19
- data/sig/generated/paper_trail_diff/activity_collection_event_applier.rbs +5 -0
- data/sig/generated/paper_trail_diff/activity_collection_record_updater.rbs +5 -0
- data/sig/generated/paper_trail_diff/activity_event.rbs +25 -4
- data/sig/generated/paper_trail_diff/activity_event_record_resolver.rbs +7 -0
- data/sig/generated/paper_trail_diff/activity_history.rbs +21 -6
- data/sig/generated/paper_trail_diff/activity_range.rbs +14 -3
- data/sig/generated/paper_trail_diff/activity_relationship.rbs +3 -0
- data/sig/generated/paper_trail_diff/activity_root_snapshot_refresher.rbs +2 -0
- data/sig/generated/paper_trail_diff/activity_snapshot_sequence.rbs +48 -9
- data/sig/generated/paper_trail_diff/activity_target_candidate_loader.rbs +79 -0
- data/sig/generated/paper_trail_diff/activity_timeline_builder.rbs +138 -28
- data/sig/generated/paper_trail_diff/activity_tree_filter.rbs +73 -0
- data/sig/generated/paper_trail_diff/activity_version_collector.rbs +12 -4
- data/sig/generated/paper_trail_diff/activity_view.rbs +42 -0
- data/sig/generated/paper_trail_diff/analysis.rbs +8 -1
- data/sig/generated/paper_trail_diff/analysis_batch.rbs +8 -15
- data/sig/generated/paper_trail_diff/approximate_paths.rbs +23 -0
- data/sig/generated/paper_trail_diff/association_activity_edge.rbs +148 -0
- data/sig/generated/paper_trail_diff/association_activity_selection.rbs +112 -0
- data/sig/generated/paper_trail_diff/association_discovery.rbs +8 -5
- data/sig/generated/paper_trail_diff/association_key.rbs +29 -0
- data/sig/generated/paper_trail_diff/association_traversal.rbs +88 -9
- data/sig/generated/paper_trail_diff/batch_preload.rbs +29 -0
- data/sig/generated/paper_trail_diff/batched_root_analyzer.rbs +9 -10
- data/sig/generated/paper_trail_diff/batched_root_versions.rbs +14 -10
- data/sig/generated/paper_trail_diff/change_row.rbs +86 -0
- data/sig/generated/paper_trail_diff/collection_comparator.rbs +2 -16
- data/sig/generated/paper_trail_diff/comparison_batch.rbs +22 -4
- data/sig/generated/paper_trail_diff/configuration.rbs +19 -3
- data/sig/generated/paper_trail_diff/deleted_analysis_batch.rbs +20 -8
- data/sig/generated/paper_trail_diff/deleted_root_filter.rbs +48 -0
- data/sig/generated/paper_trail_diff/deprecation.rbs +35 -0
- data/sig/generated/paper_trail_diff/diagnostics.rbs +44 -32
- data/sig/generated/paper_trail_diff/direct_record_state_loader.rbs +6 -0
- data/sig/generated/paper_trail_diff/endpoint.rbs +11 -2
- data/sig/generated/paper_trail_diff/errors.rbs +5 -2
- data/sig/generated/paper_trail_diff/fallback_paths.rbs +22 -0
- data/sig/generated/paper_trail_diff/habtm_transaction_owners.rbs +40 -0
- data/sig/generated/paper_trail_diff/historical_association_reifier.rbs +13 -0
- data/sig/generated/paper_trail_diff/historical_filter.rbs +12 -2
- data/sig/generated/paper_trail_diff/historical_snapshot_store.rbs +36 -30
- data/sig/generated/paper_trail_diff/live_endpoint_batch_loader.rbs +5 -3
- data/sig/generated/paper_trail_diff/nested_comparator.rbs +10 -7
- data/sig/generated/paper_trail_diff/paper_trail_adapter.rbs +55 -48
- data/sig/generated/paper_trail_diff/preloaded_endpoint_batch_loader.rbs +9 -1
- data/sig/generated/paper_trail_diff/prepared_activity_index.rbs +52 -10
- data/sig/generated/paper_trail_diff/prepared_edge_loader.rbs +4 -12
- data/sig/generated/paper_trail_diff/prepared_history.rbs +40 -24
- data/sig/generated/paper_trail_diff/prepared_history_loader.rbs +15 -13
- data/sig/generated/paper_trail_diff/prepared_record_index.rbs +34 -2
- data/sig/generated/paper_trail_diff/prepared_state_association_reader.rbs +56 -11
- data/sig/generated/paper_trail_diff/recorded_changes.rbs +47 -0
- data/sig/generated/paper_trail_diff/recorded_class.rbs +22 -0
- data/sig/generated/paper_trail_diff/root_version_selection.rbs +2 -0
- data/sig/generated/paper_trail_diff/scope_condition.rbs +219 -0
- data/sig/generated/paper_trail_diff/scope_ranking.rbs +125 -0
- data/sig/generated/paper_trail_diff/scoped_analysis.rbs +6 -0
- data/sig/generated/paper_trail_diff/scoped_analysis_builder.rbs +8 -3
- data/sig/generated/paper_trail_diff/scoped_root_selection.rbs +49 -11
- data/sig/generated/paper_trail_diff/snapshot.rbs +8 -0
- data/sig/generated/paper_trail_diff/snapshot_normalizer.rbs +6 -0
- data/sig/generated/paper_trail_diff/support.rbs +20 -2
- data/sig/generated/paper_trail_diff/time_range.rbs +20 -2
- data/sig/generated/paper_trail_diff/time_version_range.rbs +4 -4
- data/sig/generated/paper_trail_diff/timeline_builder.rbs +2 -2
- data/sig/generated/paper_trail_diff/timeline_range.rbs +2 -0
- data/sig/generated/paper_trail_diff/timeline_snapshot_provider.rbs +17 -7
- data/sig/generated/paper_trail_diff/transaction_cut.rbs +94 -0
- data/sig/generated/paper_trail_diff/traversal_preparer.rbs +66 -8
- data/sig/generated/paper_trail_diff/version_association_candidate_scope.rbs +7 -0
- data/sig/generated/paper_trail_diff/version_boundary.rbs +20 -3
- data/sig/generated/paper_trail_diff/version_query.rbs +18 -2
- data/sig/generated/paper_trail_diff/version_range.rbs +4 -2
- data/sig/generated/paper_trail_diff/version_scope_filter.rbs +7 -4
- data/sig/generated/paper_trail_diff/version_sequence_diagnostics.rbs +16 -9
- data/sig/generated/paper_trail_diff/version_table.rbs +30 -0
- data/sig/generated/paper_trail_diff.rbs +47 -25
- metadata +62 -10
- data/lib/paper_trail_diff/activity_grouping.rb +0 -38
- data/lib/paper_trail_diff/batch_safety.rb +0 -55
- data/lib/paper_trail_diff/time_activity_timeline_builder.rb +0 -224
- data/sig/generated/paper_trail_diff/activity_grouping.rbs +0 -22
- data/sig/generated/paper_trail_diff/batch_safety.rbs +0 -24
- data/sig/generated/paper_trail_diff/time_activity_timeline_builder.rbs +0 -92
|
@@ -1,46 +1,54 @@
|
|
|
1
1
|
# Generated from lib/paper_trail_diff/activity_timeline_builder.rb with RBS::Inline
|
|
2
2
|
|
|
3
3
|
module PaperTrailDiff
|
|
4
|
-
# Compares adjacent root and selected-descendant activity boundaries
|
|
4
|
+
# Compares adjacent root and selected-descendant activity boundaries, between
|
|
5
|
+
# explicit endpoints or over a wall-clock window. Both replay the range's
|
|
6
|
+
# events into steps the same way, and close on the live row the same way.
|
|
7
|
+
# They differ in what they report and what closes them: explicit endpoints
|
|
8
|
+
# report every step between them and close on the endpoint asked for; a
|
|
9
|
+
# window reports only the events inside it, and closes on a final destroy,
|
|
10
|
+
# or on the live row when nothing recorded follows it.
|
|
5
11
|
class ActivityTimelineBuilder
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
# : (untyped, range: TimelineRange, tree: AssociationTree, snapshotter: untyped, ?snapshots: bool, ?group: Symbol?) -> void
|
|
9
|
-
def initialize: (untyped, range: TimelineRange, tree: AssociationTree, snapshotter: untyped, ?snapshots: bool, ?group: Symbol?) -> void
|
|
12
|
+
# : (untyped, range: TimelineRange, tree: AssociationTree, snapshotter: untyped, view: ActivityView) -> void
|
|
13
|
+
def initialize: (untyped, range: TimelineRange, tree: AssociationTree, snapshotter: untyped, view: ActivityView) -> void
|
|
10
14
|
|
|
11
15
|
# : () -> Array[ActivityStep]
|
|
12
16
|
def build: () -> Array[ActivityStep]
|
|
13
17
|
|
|
14
|
-
# Builds
|
|
18
|
+
# Builds the endpoint diff, the root timeline, and the activity from one
|
|
19
|
+
# activity snapshot pass.
|
|
15
20
|
# : () -> Analysis
|
|
16
21
|
def analyze: () -> Analysis
|
|
17
22
|
|
|
18
23
|
private
|
|
19
24
|
|
|
20
|
-
@from: untyped
|
|
21
|
-
|
|
22
25
|
@range: TimelineRange
|
|
23
26
|
|
|
24
27
|
@record: untyped
|
|
25
28
|
|
|
26
|
-
@snapshots: bool
|
|
27
|
-
|
|
28
29
|
@snapshotter: untyped
|
|
29
30
|
|
|
30
31
|
@to: untyped
|
|
31
32
|
|
|
32
33
|
@tree: AssociationTree
|
|
33
34
|
|
|
35
|
+
@view: ActivityView
|
|
36
|
+
|
|
34
37
|
# : () -> Array[ActivityStep]
|
|
35
38
|
def no_steps: () -> Array[ActivityStep]
|
|
36
39
|
|
|
37
40
|
# Every boundary in the span, filtered out or not. A filter narrows where the
|
|
38
41
|
# span starts and ends, but the sequence inside it stays complete: dropping
|
|
39
42
|
# boundaries would fold the changes they carried into a neighbouring step and
|
|
40
|
-
# credit them to whoever made that one.
|
|
43
|
+
# credit them to whoever made that one. A filter that keeps no version
|
|
44
|
+
# leaves no span, as it does for a checkpoint timeline.
|
|
41
45
|
# : () -> Array[ActivityStep]
|
|
42
46
|
def build_between_versions: () -> Array[ActivityStep]
|
|
43
47
|
|
|
48
|
+
# Activity from the first to the last of the root versions.
|
|
49
|
+
# : (Array[untyped]) -> ActivityHistory
|
|
50
|
+
def version_history: (Array[untyped]) -> ActivityHistory
|
|
51
|
+
|
|
44
52
|
# : () -> Array[ActivityStep]
|
|
45
53
|
def build_to_current: () -> Array[ActivityStep]
|
|
46
54
|
|
|
@@ -49,8 +57,22 @@ module PaperTrailDiff
|
|
|
49
57
|
|
|
50
58
|
# The explicit live endpoint and a batch's live closing endpoint use the
|
|
51
59
|
# same selected plan. A version filter can close earlier, on its successor.
|
|
52
|
-
# : () -> [RootVersionPlan,
|
|
53
|
-
def current_history: () -> [ RootVersionPlan,
|
|
60
|
+
# : () -> [RootVersionPlan, ActivityHistory, RecordSnapshot?, ActivityBoundary?]
|
|
61
|
+
def current_history: () -> [ RootVersionPlan, ActivityHistory, RecordSnapshot?, ActivityBoundary? ]
|
|
62
|
+
|
|
63
|
+
# Events up to the instant the current record was read. A range that a
|
|
64
|
+
# version filter closes earlier ends at that version, with no snapshot.
|
|
65
|
+
# : (RootVersionPlan, RecordSnapshot?, untyped) -> ActivityHistory
|
|
66
|
+
def history_until: (RootVersionPlan, RecordSnapshot?, untyped) -> ActivityHistory
|
|
67
|
+
|
|
68
|
+
# Without a closing boundary nothing reads the closing pair, so its
|
|
69
|
+
# mutations cannot change an answer.
|
|
70
|
+
# mutant:disable
|
|
71
|
+
# : (RootVersionPlan) -> [RootVersionPlan, ActivityHistory, RecordSnapshot?, ActivityBoundary?]
|
|
72
|
+
def empty_history: (RootVersionPlan) -> [ RootVersionPlan, ActivityHistory, RecordSnapshot?, ActivityBoundary? ]
|
|
73
|
+
|
|
74
|
+
# : (untyped) -> ActivityBoundary
|
|
75
|
+
def current_boundary: (untyped) -> ActivityBoundary
|
|
54
76
|
|
|
55
77
|
# : () -> [RecordSnapshot?, untyped]
|
|
56
78
|
def capture_current: () -> [ RecordSnapshot?, untyped ]
|
|
@@ -58,32 +80,120 @@ module PaperTrailDiff
|
|
|
58
80
|
# : () -> void
|
|
59
81
|
def validate_current_range!: () -> void
|
|
60
82
|
|
|
61
|
-
# : (Array[untyped], ?range_start: untyped, ?range_end: untyped) -> Array[ActivityEvent]
|
|
62
|
-
def collect_events: (Array[untyped], ?range_start: untyped, ?range_end: untyped) -> Array[ActivityEvent]
|
|
63
|
-
|
|
64
|
-
# : (Array[untyped], ?end_at: untyped) -> void
|
|
65
|
-
def prepare_history: (Array[untyped], ?end_at: untyped) -> void
|
|
66
|
-
|
|
67
83
|
# Appends the transition into an explicit closing boundary, which is either
|
|
68
84
|
# a requested current record or the absence a final root destroy leaves.
|
|
69
|
-
#
|
|
70
|
-
|
|
85
|
+
# Either follows the root versions, which are themselves events, so the
|
|
86
|
+
# last boundary the history kept opens it.
|
|
87
|
+
# : (ActivityHistory, ActivityBoundary?, RecordSnapshot?) -> Array[ActivityStep]
|
|
88
|
+
def activity_steps: (ActivityHistory, ActivityBoundary?, RecordSnapshot?) -> Array[ActivityStep]
|
|
71
89
|
|
|
72
90
|
# A destroyed root has no later version, but its own event states that
|
|
73
91
|
# nothing follows it, so the removal can still close the timeline.
|
|
74
92
|
# : (Array[untyped]) -> ActivityBoundary?
|
|
75
93
|
def destroyed_boundary: (Array[untyped]) -> ActivityBoundary?
|
|
76
94
|
|
|
77
|
-
# : (Array[untyped], Array[ActivityEvent], ?current: untyped) -> ActivityHistory
|
|
78
|
-
def event_history: (Array[untyped], Array[ActivityEvent], ?current: untyped) -> ActivityHistory
|
|
79
|
-
|
|
80
95
|
# Only the activity view gains the closing removal. The endpoint diff and
|
|
81
96
|
# the root timeline keep their `compare` and `timeline` semantics, under
|
|
82
97
|
# which the state at a destroy version is the state before the deletion.
|
|
83
|
-
# : (RootVersionPlan,
|
|
84
|
-
def build_analysis: (RootVersionPlan,
|
|
98
|
+
# : (RootVersionPlan, ActivityHistory) -> Analysis
|
|
99
|
+
def build_analysis: (RootVersionPlan, ActivityHistory) -> Analysis
|
|
100
|
+
|
|
101
|
+
# : () -> Array[ActivityStep]
|
|
102
|
+
def window_steps: () -> Array[ActivityStep]
|
|
103
|
+
|
|
104
|
+
# : () -> Analysis
|
|
105
|
+
def analyze_window: () -> Analysis
|
|
106
|
+
|
|
107
|
+
# A window with a closing step ends at what closed it: the live row, or
|
|
108
|
+
# nothing after a destroy, where no live row is read. One that ends before
|
|
109
|
+
# a later event ends at the state that event found.
|
|
110
|
+
# : (ActivityHistory, ActivityStep?, RecordSnapshot?) -> RecordSnapshot?
|
|
111
|
+
def window_final_snapshot: (ActivityHistory, ActivityStep?, RecordSnapshot?) -> RecordSnapshot?
|
|
112
|
+
|
|
113
|
+
# : () -> [ActivityHistory, RootVersionPlan, ActivityStep?, RecordSnapshot?, untyped]
|
|
114
|
+
def window_history: () -> [ ActivityHistory, RootVersionPlan, ActivityStep?, RecordSnapshot?, untyped ]
|
|
115
|
+
|
|
116
|
+
# Nothing reads a window's closing step, live snapshot, or capture time
|
|
117
|
+
# when it reported nothing, so mutations of those cannot change an answer.
|
|
118
|
+
# mutant:disable
|
|
119
|
+
# : (RootVersionPlan) -> [ActivityHistory, RootVersionPlan, ActivityStep?, RecordSnapshot?, untyped]
|
|
120
|
+
def empty_window: (RootVersionPlan) -> [ ActivityHistory, RootVersionPlan, ActivityStep?, RecordSnapshot?, untyped ]
|
|
121
|
+
|
|
122
|
+
# A window with no selected event reports nothing. Any other has a
|
|
123
|
+
# boundary after its last one: the plan refuses a window that has no later
|
|
124
|
+
# version, ends on no destroy, and does not close on the live row.
|
|
125
|
+
# : (RootVersionPlan, untyped) -> [ActivityHistory, RootVersionPlan, ActivityStep?, RecordSnapshot?, untyped]
|
|
126
|
+
def window_replay: (RootVersionPlan, untyped) -> [ ActivityHistory, RootVersionPlan, ActivityStep?, RecordSnapshot?, untyped ]
|
|
127
|
+
|
|
128
|
+
# One live read serves both the closing activity step and the endpoint the
|
|
129
|
+
# analysis reports, which would otherwise reconstruct the graph twice.
|
|
130
|
+
# : (RootVersionPlan) -> RecordSnapshot?
|
|
131
|
+
def window_live_snapshot: (RootVersionPlan) -> RecordSnapshot?
|
|
132
|
+
|
|
133
|
+
# Root versions inside the window that the plan does not report are context
|
|
134
|
+
# rather than mutations: the version appended to reveal the last selected
|
|
135
|
+
# change, and anything a filter excluded but the replay still walks. Neither
|
|
136
|
+
# may be counted as a selected mutation. Descendant events are not filtered,
|
|
137
|
+
# so window membership is the whole test for them.
|
|
138
|
+
# : (Array[ActivityEvent], RootVersionPlan) -> Array[ActivityEvent]
|
|
139
|
+
def selected_events: (Array[ActivityEvent], RootVersionPlan) -> Array[ActivityEvent]
|
|
140
|
+
|
|
141
|
+
# A window either closes on the absence its final destruction leaves, or on
|
|
142
|
+
# current state when it reaches past everything recorded. Both are boundaries
|
|
143
|
+
# no version can supply.
|
|
144
|
+
#
|
|
145
|
+
# Everything recorded means on every requested path, not only the root's
|
|
146
|
+
# own versions. When an association changed after the window, its last
|
|
147
|
+
# step already ends at that change, at the state the window left; closing
|
|
148
|
+
# on current state would add the later change to a window it was not in.
|
|
149
|
+
# : (ActivityHistory, ActivityEvent, RootVersionPlan, untyped, RecordSnapshot?, Array[ActivityEvent]) -> ActivityStep?
|
|
150
|
+
def window_closing: (ActivityHistory, ActivityEvent, RootVersionPlan, untyped, RecordSnapshot?, Array[ActivityEvent]) -> ActivityStep?
|
|
151
|
+
|
|
152
|
+
# : (ActivityHistory, ActivityEvent) -> ActivityStep
|
|
153
|
+
def window_destroyed_step: (ActivityHistory, ActivityEvent) -> ActivityStep
|
|
154
|
+
|
|
155
|
+
# The last boundary reached is where current state is compared from, which
|
|
156
|
+
# is the final event rather than the final root version once descendants
|
|
157
|
+
# have moved since it. A selected event is a boundary the history kept.
|
|
158
|
+
# : (ActivityHistory, untyped, untyped, RecordSnapshot?) -> ActivityStep
|
|
159
|
+
def window_current_step: (ActivityHistory, untyped, untyped, RecordSnapshot?) -> ActivityStep
|
|
160
|
+
|
|
161
|
+
# : (ActivityEvent) -> bool
|
|
162
|
+
def terminal_destroy?: (ActivityEvent) -> bool
|
|
85
163
|
|
|
86
|
-
# : () ->
|
|
87
|
-
def
|
|
164
|
+
# : () -> void
|
|
165
|
+
def reject_live_habtm!: () -> void
|
|
166
|
+
|
|
167
|
+
# : () -> Array[String]?
|
|
168
|
+
def root_recorded: () -> Array[String]?
|
|
169
|
+
|
|
170
|
+
# A window prepares from its start, explicit endpoints from their first
|
|
171
|
+
# version.
|
|
172
|
+
# : (Array[untyped], ?end_at: untyped) -> untyped
|
|
173
|
+
def prepare_history: (Array[untyped], ?end_at: untyped) -> untyped
|
|
174
|
+
|
|
175
|
+
# A window collects from its start, explicit endpoints from their first
|
|
176
|
+
# version. Explicit endpoints also stop before the rest of the closing
|
|
177
|
+
# version's transaction (see ActivityTransactionGroups.before_closing); a
|
|
178
|
+
# window keeps every event it collected and reports only those inside it.
|
|
179
|
+
# : (Array[untyped], untyped, range_end: untyped) -> Array[ActivityEvent]
|
|
180
|
+
def collect_events: (Array[untyped], untyped, range_end: untyped) -> Array[ActivityEvent]
|
|
181
|
+
|
|
182
|
+
# Events after the last root version read the root from the live record
|
|
183
|
+
# when the range closes on it. Explicit endpoints report every step, as
|
|
184
|
+
# their range includes every version.
|
|
185
|
+
# : (Array[untyped], Array[ActivityEvent], untyped, ?current: untyped, ?closing: RecordSnapshot?) -> ActivityHistory
|
|
186
|
+
def replay: (Array[untyped], Array[ActivityEvent], untyped, ?current: untyped, ?closing: RecordSnapshot?) -> ActivityHistory
|
|
187
|
+
|
|
188
|
+
# The step from the last boundary the history reached to one that closes
|
|
189
|
+
# the range.
|
|
190
|
+
# : (ActivityHistory, ActivityBoundary, ActivityBoundary, RecordSnapshot?) -> ActivityStep
|
|
191
|
+
def step_from_last: (ActivityHistory, ActivityBoundary, ActivityBoundary, RecordSnapshot?) -> ActivityStep
|
|
192
|
+
|
|
193
|
+
# : (Array[ActivityStep]) -> Array[ActivityStep]
|
|
194
|
+
def present: (Array[ActivityStep]) -> Array[ActivityStep]
|
|
195
|
+
|
|
196
|
+
# : (RootVersionPlan, ActivityHistory, final: RecordSnapshot?, steps: Array[ActivityStep], ?closing_snapshot: RecordSnapshot?, ?captured_at: untyped) -> Analysis
|
|
197
|
+
def analysis: (RootVersionPlan, ActivityHistory, final: RecordSnapshot?, steps: Array[ActivityStep], ?closing_snapshot: RecordSnapshot?, ?captured_at: untyped) -> Analysis
|
|
88
198
|
end
|
|
89
199
|
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Generated from lib/paper_trail_diff/activity_tree_filter.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module PaperTrailDiff
|
|
4
|
+
# Leaves out the events of records that were outside the root's tree.
|
|
5
|
+
#
|
|
6
|
+
# A record found in the tree at one time in a range brings every version it
|
|
7
|
+
# saved in the range, including those it saved while it belonged elsewhere:
|
|
8
|
+
# a comment edited on another article before it moved to this one, or after
|
|
9
|
+
# it left a scope. Such a version changes nothing the root shows. As a
|
|
10
|
+
# boundary it would open a step of its own, and inside a transaction, where
|
|
11
|
+
# a change surfaces one event late, that step would take the credit for the
|
|
12
|
+
# root's own change.
|
|
13
|
+
#
|
|
14
|
+
# PT-AT reads associations as they were before a transaction, so a record
|
|
15
|
+
# is judged by two snapshots: the one at its transaction's first event, and
|
|
16
|
+
# the one after its last, which is the next event's or what the range
|
|
17
|
+
# closes on. A record in neither was outside the tree throughout.
|
|
18
|
+
#
|
|
19
|
+
# The root's own events are always kept, and so are the versions of a
|
|
20
|
+
# through's join rows, which a snapshot does not hold, and an event whose
|
|
21
|
+
# step is not reported, which only bounds one that is.
|
|
22
|
+
class ActivityTreeFilter
|
|
23
|
+
# `closing` is the snapshot after the last event: the current record's,
|
|
24
|
+
# or nil when nothing follows, as after the root's destruction.
|
|
25
|
+
# : (Array[ActivityEvent], reported: untyped, closing: RecordSnapshot?) -> void
|
|
26
|
+
def initialize: (Array[ActivityEvent], reported: untyped, closing: RecordSnapshot?) -> void
|
|
27
|
+
|
|
28
|
+
# Yields each event of the sequence with its snapshot, and whether to keep
|
|
29
|
+
# it, in order.
|
|
30
|
+
# : (untyped) { (ActivityEvent, RecordSnapshot?, bool) -> void } -> void
|
|
31
|
+
def call: (untyped) { (ActivityEvent, RecordSnapshot?, bool) -> void } -> void
|
|
32
|
+
|
|
33
|
+
private
|
|
34
|
+
|
|
35
|
+
@closing: RecordSnapshot?
|
|
36
|
+
|
|
37
|
+
@ends: Array[Integer]
|
|
38
|
+
|
|
39
|
+
@reported: untyped
|
|
40
|
+
|
|
41
|
+
@starts: Array[Integer]
|
|
42
|
+
|
|
43
|
+
@types: Hash[String, Array[String?]]
|
|
44
|
+
|
|
45
|
+
# : (ActivityEvent, Integer, Array[[ActivityEvent, RecordSnapshot?]]) -> bool
|
|
46
|
+
def keep?: (ActivityEvent, Integer, Array[[ ActivityEvent, RecordSnapshot? ]]) -> bool
|
|
47
|
+
|
|
48
|
+
# : (ActivityEvent) -> bool
|
|
49
|
+
def reported?: (ActivityEvent) -> bool
|
|
50
|
+
|
|
51
|
+
# Where each event's transaction starts, and the position just past its
|
|
52
|
+
# last event. Two transactions can interleave, so a transaction's events
|
|
53
|
+
# need not be adjacent.
|
|
54
|
+
# : (Array[ActivityEvent]) -> [Array[Integer], Array[Integer]]
|
|
55
|
+
def spans: (Array[ActivityEvent]) -> [ Array[Integer], Array[Integer] ]
|
|
56
|
+
|
|
57
|
+
# A version saved outside a transaction is a transaction of its own,
|
|
58
|
+
# keyed by its position.
|
|
59
|
+
# : (Array[ActivityEvent]) -> Array[Array[untyped] | Integer]
|
|
60
|
+
def transaction_keys: (Array[ActivityEvent]) -> Array[Array[untyped] | Integer]
|
|
61
|
+
|
|
62
|
+
# : (RecordSnapshot?, ActivityEvent) -> bool
|
|
63
|
+
def holds?: (RecordSnapshot?, ActivityEvent) -> bool
|
|
64
|
+
|
|
65
|
+
# : (AssociationSnapshot, Array[String?], untyped) -> bool
|
|
66
|
+
def contains?: (AssociationSnapshot, Array[String?], untyped) -> bool
|
|
67
|
+
|
|
68
|
+
# A version names its record's base class, and a snapshot the record's
|
|
69
|
+
# own class, which may be any subclass of it.
|
|
70
|
+
# : (String) -> Array[String?]
|
|
71
|
+
def types: (String) -> Array[String?]
|
|
72
|
+
end
|
|
73
|
+
end
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
module PaperTrailDiff
|
|
4
4
|
# Collects root and selected-descendant versions relevant to one root history range.
|
|
5
5
|
class ActivityVersionCollector
|
|
6
|
-
# : (untyped, root_versions: Array[untyped], tree: AssociationTree,
|
|
7
|
-
def initialize: (untyped, root_versions: Array[untyped], tree: AssociationTree,
|
|
6
|
+
# : (untyped, root_versions: Array[untyped], tree: AssociationTree, ?range_start: untyped, ?range_end: untyped, ?prepared: PreparedActivityIndex?) -> void
|
|
7
|
+
def initialize: (untyped, root_versions: Array[untyped], tree: AssociationTree, ?range_start: untyped, ?range_end: untyped, ?prepared: PreparedActivityIndex?) -> void
|
|
8
8
|
|
|
9
|
+
# A tie between version tables, or between ids that do not count up,
|
|
10
|
+
# raises rather than building a timeline in an arbitrary order.
|
|
9
11
|
# : () -> Array[ActivityEvent]
|
|
10
12
|
def call: () -> Array[ActivityEvent]
|
|
11
13
|
|
|
@@ -37,17 +39,23 @@ module PaperTrailDiff
|
|
|
37
39
|
# : (Hash[Symbol, untyped], untyped, String) -> Hash[String, untyped]
|
|
38
40
|
def through_groups: (Hash[Symbol, untyped], untyped, String) -> Hash[String, untyped]
|
|
39
41
|
|
|
42
|
+
# Every target the owners pointed at in the range, not only those their own
|
|
43
|
+
# changes there recorded: an author renamed under an article nobody edited
|
|
44
|
+
# is still that article's activity.
|
|
40
45
|
# : (untyped, Array[untyped], untyped) -> Hash[String, untyped]
|
|
41
46
|
def belongs_to_groups: (untyped, Array[untyped], untyped) -> Hash[String, untyped]
|
|
42
47
|
|
|
48
|
+
# : (untyped, Array[untyped], untyped) -> Hash[String, untyped]
|
|
49
|
+
def unprepared_belongs_to_groups: (untyped, Array[untyped], untyped) -> Hash[String, untyped]
|
|
50
|
+
|
|
43
51
|
# : (untyped, Array[untyped], untyped) -> Hash[String, untyped]
|
|
44
52
|
def direct_child_groups: (untyped, Array[untyped], untyped) -> Hash[String, untyped]
|
|
45
53
|
|
|
46
54
|
# : (untyped, Array[untyped], untyped) -> Hash[String, untyped]
|
|
47
55
|
def habtm_groups: (untyped, Array[untyped], untyped) -> Hash[String, untyped]
|
|
48
56
|
|
|
49
|
-
# : (Array[untyped], untyped) -> Hash[String, untyped]
|
|
50
|
-
def identity_groups: (Array[untyped], untyped) -> Hash[String, untyped]
|
|
57
|
+
# : (Array[untyped], untyped) ?{ (untyped, untyped) -> bool } -> Hash[String, untyped]
|
|
58
|
+
def identity_groups: (Array[untyped], untyped) ?{ (untyped, untyped) -> bool } -> Hash[String, untyped]
|
|
51
59
|
|
|
52
60
|
# : (untyped, Array[untyped]) -> Hash[Symbol, untyped]
|
|
53
61
|
def group: (untyped, Array[untyped]) -> Hash[Symbol, untyped]
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Generated from lib/paper_trail_diff/activity_view.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module PaperTrailDiff
|
|
4
|
+
# How a request presents its activity steps: whether they keep their
|
|
5
|
+
# snapshots, whether a transaction's steps merge into one, and which of
|
|
6
|
+
# their versions' recorded changes they carry. Built and checked once per
|
|
7
|
+
# request, and read the same way by both activity builders, or the same
|
|
8
|
+
# history would read differently depending on how it was asked for.
|
|
9
|
+
class ActivityView
|
|
10
|
+
# Options only an activity view uses are refused without one.
|
|
11
|
+
# : (activity: bool, snapshots: bool, group: Symbol?, recorded: IgnorePolicy?) -> ActivityView
|
|
12
|
+
def self.build: (activity: bool, snapshots: bool, group: Symbol?, recorded: IgnorePolicy?) -> ActivityView
|
|
13
|
+
|
|
14
|
+
# : (?snapshots: bool, ?group: Symbol?, ?recorded: IgnorePolicy?) -> void
|
|
15
|
+
def initialize: (?snapshots: bool, ?group: Symbol?, ?recorded: IgnorePolicy?) -> void
|
|
16
|
+
|
|
17
|
+
# Merging a group compares its outer states, so the snapshots must survive
|
|
18
|
+
# the build even when the caller did not ask to keep them.
|
|
19
|
+
# : () -> bool
|
|
20
|
+
def retain?: () -> bool
|
|
21
|
+
|
|
22
|
+
# The attributes a boundary's version recorded, when they were asked for.
|
|
23
|
+
# : (root: bool) -> Array[String]?
|
|
24
|
+
def recorded_attributes: (root: bool) -> Array[String]?
|
|
25
|
+
|
|
26
|
+
# Applied last, to finished steps, so grouping sees the same timeline the
|
|
27
|
+
# caller would otherwise have received.
|
|
28
|
+
# : (Array[ActivityStep]) -> Array[ActivityStep]
|
|
29
|
+
def present: (Array[ActivityStep]) -> Array[ActivityStep]
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
@group: Symbol?
|
|
34
|
+
|
|
35
|
+
@recorded: IgnorePolicy?
|
|
36
|
+
|
|
37
|
+
@snapshots: bool
|
|
38
|
+
|
|
39
|
+
# : () -> bool
|
|
40
|
+
def grouping?: () -> bool
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -14,7 +14,9 @@ module PaperTrailDiff
|
|
|
14
14
|
attr_reader to_snapshot: RecordSnapshot?
|
|
15
15
|
|
|
16
16
|
# The result for a record whose requested history contains no versions,
|
|
17
|
-
# which is an empty history rather than a failed request.
|
|
17
|
+
# which is an empty history rather than a failed request. Its snapshots
|
|
18
|
+
# are nil because no state was read, not because the record was absent:
|
|
19
|
+
# reading one would rebuild the whole graph, per record in a batch.
|
|
18
20
|
# : () -> Analysis
|
|
19
21
|
def self.empty: () -> Analysis
|
|
20
22
|
|
|
@@ -23,6 +25,11 @@ module PaperTrailDiff
|
|
|
23
25
|
# : (diff: Diff, timeline: Array[Step], ?activity_timeline: Array[ActivityStep]?, ?from_snapshot: RecordSnapshot?, ?to_snapshot: RecordSnapshot?) -> void
|
|
24
26
|
def initialize: (diff: Diff, timeline: Array[Step], ?activity_timeline: Array[ActivityStep]?, ?from_snapshot: RecordSnapshot?, ?to_snapshot: RecordSnapshot?) -> void
|
|
25
27
|
|
|
28
|
+
# Every activity step's rows, in time order. Only the activity timeline says
|
|
29
|
+
# who made each change, so an analysis built without it has no rows to give.
|
|
30
|
+
# : () -> Array[ChangeRow]
|
|
31
|
+
def change_rows: () -> Array[ChangeRow]
|
|
32
|
+
|
|
26
33
|
# Reconstructed endpoint states are opt-in, because they carry the whole
|
|
27
34
|
# selected graph whether or not anything changed, which dwarfs the rest of
|
|
28
35
|
# the payload for a wide graph.
|
|
@@ -5,8 +5,8 @@ module PaperTrailDiff
|
|
|
5
5
|
# versions and preparing their association history once for the whole batch
|
|
6
6
|
# rather than once per root.
|
|
7
7
|
class AnalysisBatch
|
|
8
|
-
# : (Array[untyped], time_range: TimeRange?, live_loader: untyped, history_preparer: untyped, analyzer: untyped, ?version_scope: untyped, ?
|
|
9
|
-
def initialize: (Array[untyped], time_range: TimeRange?, live_loader: untyped, history_preparer: untyped, analyzer: untyped, ?version_scope: untyped, ?
|
|
8
|
+
# : (Array[untyped], time_range: TimeRange?, live_loader: untyped, history_preparer: untyped, analyzer: untyped, ?version_scope: untyped, ?context_required: bool) -> void
|
|
9
|
+
def initialize: (Array[untyped], time_range: TimeRange?, live_loader: untyped, history_preparer: untyped, analyzer: untyped, ?version_scope: untyped, ?context_required: bool) -> void
|
|
10
10
|
|
|
11
11
|
# : () -> Hash[identity, Analysis]
|
|
12
12
|
def call: () -> Hash[identity, Analysis]
|
|
@@ -15,8 +15,6 @@ module PaperTrailDiff
|
|
|
15
15
|
|
|
16
16
|
@analyzer: untyped
|
|
17
17
|
|
|
18
|
-
@close_on_current: bool
|
|
19
|
-
|
|
20
18
|
@context_required: bool
|
|
21
19
|
|
|
22
20
|
@history_preparer: untyped
|
|
@@ -29,11 +27,6 @@ module PaperTrailDiff
|
|
|
29
27
|
|
|
30
28
|
@version_scope: untyped
|
|
31
29
|
|
|
32
|
-
# A filter is a callable that narrows the version relation, so it is checked
|
|
33
|
-
# up front rather than failing partway through a batch.
|
|
34
|
-
# : (untyped) -> untyped
|
|
35
|
-
def validated_scope: (untyped) -> untyped
|
|
36
|
-
|
|
37
30
|
# : () -> Array[untyped]
|
|
38
31
|
def validated_records: () -> Array[untyped]
|
|
39
32
|
|
|
@@ -42,21 +35,21 @@ module PaperTrailDiff
|
|
|
42
35
|
# The roots are preloaded first, because preparation reads their current
|
|
43
36
|
# association state as a fallback and would otherwise walk it one root at a
|
|
44
37
|
# time.
|
|
45
|
-
# : (Array[untyped], Hash[Array[String], RootVersionPlan], Hash[Array[String], untyped]) -> void
|
|
46
|
-
def prepare: (Array[untyped], Hash[Array[String], RootVersionPlan], Hash[Array[String], untyped]) -> void
|
|
38
|
+
# : (Array[untyped], Hash[Array[String], RootVersionPlan], Hash[Array[String], untyped], Hash[Array[String], TimeRange]) -> void
|
|
39
|
+
def prepare: (Array[untyped], Hash[Array[String], RootVersionPlan], Hash[Array[String], untyped], Hash[Array[String], TimeRange]) -> void
|
|
47
40
|
|
|
48
41
|
# : (Array[untyped], Hash[Array[String], RootVersionPlan]) -> bool
|
|
49
42
|
def closes_live?: (Array[untyped], Hash[Array[String], RootVersionPlan]) -> bool
|
|
50
43
|
|
|
51
44
|
# A plan closing on the live record reads history up to now; the others
|
|
52
45
|
# stop at the window, so a past window does not load everything since.
|
|
53
|
-
# : (Array[untyped],
|
|
54
|
-
def preparation_range: (Array[untyped],
|
|
46
|
+
# : (Array[untyped], Hash[Array[String], TimeRange], live: bool) -> Hash[Symbol, untyped]
|
|
47
|
+
def preparation_range: (Array[untyped], Hash[Array[String], TimeRange], live: bool) -> Hash[Symbol, untyped]
|
|
55
48
|
|
|
56
49
|
# A root with no versions in range has nothing to report, which is an empty
|
|
57
50
|
# result rather than a failed request -- unless an activity view closes it
|
|
58
51
|
# on current state, where its descendants may still have moved.
|
|
59
|
-
# : (untyped, RootVersionPlan) -> Analysis
|
|
60
|
-
def analysis_for: (untyped, RootVersionPlan) -> Analysis
|
|
52
|
+
# : (untyped, RootVersionPlan, TimeRange?) -> Analysis
|
|
53
|
+
def analysis_for: (untyped, RootVersionPlan, TimeRange?) -> Analysis
|
|
61
54
|
end
|
|
62
55
|
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Generated from lib/paper_trail_diff/approximate_paths.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module PaperTrailDiff
|
|
4
|
+
# The requested paths prepared history cannot read exactly, each with why.
|
|
5
|
+
# PT-AT reads such a path instead, one record at a time, when the caller
|
|
6
|
+
# passes `allow_approximate: true`.
|
|
7
|
+
module ApproximatePaths
|
|
8
|
+
# : (AssociationTraversal, untyped) -> Array[[String, String]]
|
|
9
|
+
def self.call: (AssociationTraversal, untyped) -> Array[[ String, String ]]
|
|
10
|
+
|
|
11
|
+
# A has_many through reads its parts' conditions only, at any depth. A
|
|
12
|
+
# has_one through over a ranked part is refused whole, so its parts, too,
|
|
13
|
+
# are checked for conditions alone.
|
|
14
|
+
# : (untyped, ranked: bool) -> String?
|
|
15
|
+
def self.fallback_reason: (untyped, ranked: bool) -> String?
|
|
16
|
+
|
|
17
|
+
# A scope prepared history can read as conditions on stored attributes
|
|
18
|
+
# is batched like any other path. A polymorphic target's class, and so
|
|
19
|
+
# its scope, is known only per record.
|
|
20
|
+
# : (untyped, bool) -> String?
|
|
21
|
+
def self.reason_for: (untyped, bool) -> String?
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Generated from lib/paper_trail_diff/association_activity_edge.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module PaperTrailDiff
|
|
4
|
+
# One association edge read backwards for a window: given the ids of records
|
|
5
|
+
# on its far side, the query for the owners that held them while it was open.
|
|
6
|
+
#
|
|
7
|
+
# `filter_type` is the type of the column those ids are compared with, and
|
|
8
|
+
# `type` that of the owner column the query selects, so a caller can keep a
|
|
9
|
+
# subquery only where the database can compare the two.
|
|
10
|
+
class AssociationActivityEdge
|
|
11
|
+
attr_reader column: untyped
|
|
12
|
+
|
|
13
|
+
attr_reader type: Symbol?
|
|
14
|
+
|
|
15
|
+
attr_reader filter_type: Symbol?
|
|
16
|
+
|
|
17
|
+
# : (untyped, TimeRange?) -> void
|
|
18
|
+
def initialize: (untyped, TimeRange?) -> void
|
|
19
|
+
|
|
20
|
+
# : () -> bool
|
|
21
|
+
def available?: () -> bool
|
|
22
|
+
|
|
23
|
+
# : (untyped) -> untyped
|
|
24
|
+
def relation: (untyped) -> untyped
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
@owner: untyped
|
|
29
|
+
|
|
30
|
+
@reflection: untyped
|
|
31
|
+
|
|
32
|
+
@time_range: TimeRange?
|
|
33
|
+
|
|
34
|
+
# The window plus the state when it opened, which is what
|
|
35
|
+
# VersionAssociationCandidateScope selects for an activity analysis.
|
|
36
|
+
# : (untyped, untyped) -> untyped
|
|
37
|
+
def candidates: (untyped, untyped) -> untyped
|
|
38
|
+
|
|
39
|
+
# : (untyped, String) -> Symbol?
|
|
40
|
+
def column_type: (untyped, String) -> Symbol?
|
|
41
|
+
|
|
42
|
+
# A relation is compared as its SQL; ids are compared as values.
|
|
43
|
+
# : (untyped) -> untyped
|
|
44
|
+
def arel_value: (untyped) -> untyped
|
|
45
|
+
|
|
46
|
+
# The owners a child pointed at when the window opened or after a change
|
|
47
|
+
# inside it, as PT-AT recorded them on the child's own versions.
|
|
48
|
+
class Child < AssociationActivityEdge
|
|
49
|
+
# : (untyped, TimeRange?) -> void
|
|
50
|
+
def initialize: (untyped, TimeRange?) -> void
|
|
51
|
+
|
|
52
|
+
# : (untyped) -> untyped
|
|
53
|
+
def relation: (untyped) -> untyped
|
|
54
|
+
|
|
55
|
+
private
|
|
56
|
+
|
|
57
|
+
@associations: untyped
|
|
58
|
+
|
|
59
|
+
@versions: untyped
|
|
60
|
+
|
|
61
|
+
# : () -> Array[String?]
|
|
62
|
+
def owner_types: () -> Array[String?]
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# The owners that pointed at a target when the window opened or after a
|
|
66
|
+
# change inside it, as PT-AT recorded them on the owners' versions.
|
|
67
|
+
class BelongsTo < AssociationActivityEdge
|
|
68
|
+
# : (untyped, TimeRange?, ?foreign_type: String?) -> void
|
|
69
|
+
def initialize: (untyped, TimeRange?, ?foreign_type: String?) -> void
|
|
70
|
+
|
|
71
|
+
# The types a polymorphic key's rows name, the only way to know its targets.
|
|
72
|
+
# : () -> Array[String]
|
|
73
|
+
def target_types: () -> Array[String]
|
|
74
|
+
|
|
75
|
+
# The owners that pointed at a target of this edge's type when the window
|
|
76
|
+
# opened or after a change inside it, whichever target that was.
|
|
77
|
+
# : () -> untyped
|
|
78
|
+
def typed_owners: () -> untyped
|
|
79
|
+
|
|
80
|
+
# : (untyped) -> untyped
|
|
81
|
+
def relation: (untyped) -> untyped
|
|
82
|
+
|
|
83
|
+
private
|
|
84
|
+
|
|
85
|
+
@associations: untyped
|
|
86
|
+
|
|
87
|
+
@foreign_type: String?
|
|
88
|
+
|
|
89
|
+
@versions: untyped
|
|
90
|
+
|
|
91
|
+
# : (Hash[Symbol, untyped]) -> untyped
|
|
92
|
+
def owner_rows: (Hash[Symbol, untyped]) -> untyped
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# The owners a HABTM join row links to a target now. A join table has no
|
|
96
|
+
# model to type its columns, so the owner column is read by quoted name.
|
|
97
|
+
class LiveHabtm < AssociationActivityEdge
|
|
98
|
+
# : (untyped, TimeRange?) -> void
|
|
99
|
+
def initialize: (untyped, TimeRange?) -> void
|
|
100
|
+
|
|
101
|
+
# : (untyped) -> untyped
|
|
102
|
+
def relation: (untyped) -> untyped
|
|
103
|
+
|
|
104
|
+
private
|
|
105
|
+
|
|
106
|
+
@table: untyped
|
|
107
|
+
|
|
108
|
+
# : () -> Hash[String, Symbol?]
|
|
109
|
+
def join_columns: () -> Hash[String, Symbol?]
|
|
110
|
+
|
|
111
|
+
# Some adapters take the quoted name as a plain string too, but a raw SQL
|
|
112
|
+
# check may not, so it is marked as SQL; no SQLite spec can tell.
|
|
113
|
+
# mutant:disable
|
|
114
|
+
# : () -> untyped
|
|
115
|
+
def quoted_owner_column: () -> untyped
|
|
116
|
+
|
|
117
|
+
# Arel ships no signatures; see VersionQuery. Any spelling of the
|
|
118
|
+
# constant finds the same module.
|
|
119
|
+
# mutant:disable
|
|
120
|
+
# : () -> untyped
|
|
121
|
+
def arel: () -> untyped
|
|
122
|
+
|
|
123
|
+
# Active Record 7.1 has no `with_connection`; see VersionAssociationCandidateScope.
|
|
124
|
+
# Only that version takes the fallback, so no spec run on a newer one can
|
|
125
|
+
# tell its mutations apart.
|
|
126
|
+
# mutant:disable
|
|
127
|
+
# : [T] () { (untyped) -> T } -> T
|
|
128
|
+
def connected: [T] () { (untyped) -> T } -> T
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# The owners whose versions PT-AT recorded a HABTM target with, keyed by
|
|
132
|
+
# the transaction each version was saved in.
|
|
133
|
+
class RecordedHabtm < AssociationActivityEdge
|
|
134
|
+
# : (untyped, TimeRange?) -> void
|
|
135
|
+
def initialize: (untyped, TimeRange?) -> void
|
|
136
|
+
|
|
137
|
+
# : () -> bool
|
|
138
|
+
def available?: () -> bool
|
|
139
|
+
|
|
140
|
+
# : (untyped) -> untyped
|
|
141
|
+
def relation: (untyped) -> untyped
|
|
142
|
+
|
|
143
|
+
@associations: untyped
|
|
144
|
+
|
|
145
|
+
@versions: untyped
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
end
|