paper_trail_diff 0.15.0 → 0.16.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 +159 -1
- data/README.md +1 -1
- data/docs/performance.md +9 -0
- data/docs/reference.md +142 -28
- data/docs/testing.md +23 -3
- data/lib/paper_trail_diff/activity_collection_event_applier.rb +33 -1
- data/lib/paper_trail_diff/activity_event_route_finder.rb +31 -0
- data/lib/paper_trail_diff/activity_event_snapshot_refresher.rb +12 -1
- data/lib/paper_trail_diff/activity_root_snapshot_refresher.rb +43 -25
- data/lib/paper_trail_diff/activity_timeline_builder.rb +6 -0
- data/lib/paper_trail_diff/analysis.rb +25 -6
- data/lib/paper_trail_diff/analysis_batch.rb +2 -2
- data/lib/paper_trail_diff/batched_root_analyzer.rb +6 -0
- data/lib/paper_trail_diff/branch_snapshot_refresher.rb +19 -16
- data/lib/paper_trail_diff/deleted_analysis_batch.rb +7 -3
- data/lib/paper_trail_diff/deleted_root_filter.rb +30 -8
- data/lib/paper_trail_diff/diagnostics.rb +7 -5
- data/lib/paper_trail_diff/paper_trail_adapter.rb +96 -59
- data/lib/paper_trail_diff/prepared_activity_index.rb +16 -12
- data/lib/paper_trail_diff/prepared_history.rb +11 -5
- data/lib/paper_trail_diff/prepared_history_loader.rb +1 -3
- data/lib/paper_trail_diff/prepared_record_index.rb +6 -2
- data/lib/paper_trail_diff/read_snapshot.rb +77 -0
- data/lib/paper_trail_diff/scope_condition.rb +85 -15
- data/lib/paper_trail_diff/scope_ranking.rb +11 -12
- data/lib/paper_trail_diff/scoped_analysis_builder.rb +17 -7
- data/lib/paper_trail_diff/scoped_root_selection.rb +11 -4
- data/lib/paper_trail_diff/time_range.rb +7 -6
- data/lib/paper_trail_diff/timeline_builder.rb +6 -0
- data/lib/paper_trail_diff/transaction_cut.rb +100 -41
- data/lib/paper_trail_diff/version.rb +1 -1
- data/lib/paper_trail_diff/version_boundary.rb +4 -2
- data/lib/paper_trail_diff/version_sequence_diagnostics.rb +4 -1
- data/lib/paper_trail_diff.rb +7 -5
- data/sig/generated/paper_trail_diff/activity_collection_event_applier.rbs +13 -0
- data/sig/generated/paper_trail_diff/activity_event_route_finder.rbs +14 -0
- data/sig/generated/paper_trail_diff/activity_event_snapshot_refresher.rbs +6 -0
- data/sig/generated/paper_trail_diff/activity_root_snapshot_refresher.rbs +21 -10
- data/sig/generated/paper_trail_diff/activity_timeline_builder.rbs +4 -0
- data/sig/generated/paper_trail_diff/analysis.rbs +17 -5
- data/sig/generated/paper_trail_diff/batched_root_analyzer.rbs +4 -0
- data/sig/generated/paper_trail_diff/branch_snapshot_refresher.rbs +6 -0
- data/sig/generated/paper_trail_diff/deleted_analysis_batch.rbs +3 -0
- data/sig/generated/paper_trail_diff/deleted_root_filter.rbs +11 -3
- data/sig/generated/paper_trail_diff/paper_trail_adapter.rbs +10 -0
- data/sig/generated/paper_trail_diff/prepared_activity_index.rbs +11 -4
- data/sig/generated/paper_trail_diff/prepared_history.rbs +6 -1
- data/sig/generated/paper_trail_diff/prepared_record_index.rbs +2 -1
- data/sig/generated/paper_trail_diff/read_snapshot.rbs +43 -0
- data/sig/generated/paper_trail_diff/scope_condition.rbs +39 -7
- data/sig/generated/paper_trail_diff/scope_ranking.rbs +6 -6
- data/sig/generated/paper_trail_diff/scoped_analysis_builder.rbs +9 -2
- data/sig/generated/paper_trail_diff/scoped_root_selection.rbs +8 -3
- data/sig/generated/paper_trail_diff/time_range.rbs +4 -3
- data/sig/generated/paper_trail_diff/timeline_builder.rbs +4 -0
- data/sig/generated/paper_trail_diff/transaction_cut.rbs +46 -14
- data/sig/generated/paper_trail_diff/version_boundary.rbs +2 -0
- data/sig/generated/paper_trail_diff/version_sequence_diagnostics.rbs +3 -0
- data/sig/generated/paper_trail_diff.rbs +2 -2
- metadata +7 -5
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Generated from lib/paper_trail_diff/read_snapshot.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module PaperTrailDiff
|
|
4
|
+
# Runs one read's statements inside one database snapshot. Without one, a row
|
|
5
|
+
# that commits between two statements of the read can be seen by one of them
|
|
6
|
+
# and missed by another: an activity read then found a comment whose versions
|
|
7
|
+
# it had not read yet, and raised `KeyError`.
|
|
8
|
+
#
|
|
9
|
+
# PostgreSQL and MySQL (through mysql2 or trilogy), and adapters built on
|
|
10
|
+
# them such as PostGIS, run the read at REPEATABLE READ, which gives every
|
|
11
|
+
# statement of the transaction the same view. Other adapters get no snapshot;
|
|
12
|
+
# docs/reference.md lists them under limitations.
|
|
13
|
+
module ReadSnapshot
|
|
14
|
+
# The adapters whose subclasses take a snapshot, by name, since an
|
|
15
|
+
# application loads only the adapters it uses.
|
|
16
|
+
SNAPSHOT_ADAPTERS: untyped
|
|
17
|
+
|
|
18
|
+
# Yields once. Each connection the values read through gets a snapshot
|
|
19
|
+
# transaction first, unless that connection already has a transaction open:
|
|
20
|
+
# its isolation level belongs to the caller, and this gem cannot change it.
|
|
21
|
+
# A value may be a model class, a relation, a record, or a version. Any
|
|
22
|
+
# other value reads no table and is ignored.
|
|
23
|
+
# : (Array[untyped]) { () -> untyped } -> untyped
|
|
24
|
+
def self?.call: (Array[untyped]) { () -> untyped } -> untyped
|
|
25
|
+
|
|
26
|
+
# : (untyped) -> bool
|
|
27
|
+
def self?.snapshot?: (untyped) -> bool
|
|
28
|
+
|
|
29
|
+
# One class per connection: each read model and its version class, with the
|
|
30
|
+
# repeats through a shared connection dropped. An associated model on
|
|
31
|
+
# another database is not among them, so it is read outside the snapshot.
|
|
32
|
+
# : (Array[untyped]) -> Array[untyped]
|
|
33
|
+
def self?.connection_classes: (Array[untyped]) -> Array[untyped]
|
|
34
|
+
|
|
35
|
+
# The versioned model a value reads from, or nil.
|
|
36
|
+
# : (untyped) -> untyped
|
|
37
|
+
def self?.model_for: (untyped) -> untyped
|
|
38
|
+
|
|
39
|
+
# A version reads the model of its item; a record reads its own class.
|
|
40
|
+
# : (untyped) -> untyped
|
|
41
|
+
def self?.endpoint_model: (untyped) -> untyped
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -55,10 +55,15 @@ module PaperTrailDiff
|
|
|
55
55
|
# limit, and offset choose a page of current rows rather than membership,
|
|
56
56
|
# and loading or selecting columns changes neither, so they are left out.
|
|
57
57
|
# A single-table subclass's type condition is left to the caller, as for
|
|
58
|
-
# an association.
|
|
58
|
+
# an association. `none` selects nothing, whatever it is chained to.
|
|
59
59
|
# : (untyped, untyped) -> ScopeCondition?
|
|
60
60
|
def self.for_relation: (untyped, untyped) -> ScopeCondition?
|
|
61
61
|
|
|
62
|
+
# A relation `none` built, whose where clause is SQL text. A condition
|
|
63
|
+
# that matches nothing reads no attribute, so it names no model.
|
|
64
|
+
# : () -> ScopeCondition
|
|
65
|
+
def self.nothing: () -> ScopeCondition
|
|
66
|
+
|
|
62
67
|
# nil when the relation picks its members by conditions alone.
|
|
63
68
|
# : (untyped, untyped, untyped) -> ScopeRanking?
|
|
64
69
|
def self.ranking: (untyped, untyped, untyped) -> ScopeRanking?
|
|
@@ -83,9 +88,9 @@ module PaperTrailDiff
|
|
|
83
88
|
def self.scoped_relation: (untyped, untyped) -> untyped
|
|
84
89
|
|
|
85
90
|
# Some parts, such as the having clause `or` sets, may be present but
|
|
86
|
-
# empty.
|
|
87
|
-
# : (untyped) -> bool
|
|
88
|
-
def self.plain_relation?: (untyped) -> bool
|
|
91
|
+
# empty. `allowed` names the parts that may hold values.
|
|
92
|
+
# : (untyped, Array[Symbol]) -> bool
|
|
93
|
+
def self.plain_relation?: (untyped, Array[Symbol]) -> bool
|
|
89
94
|
|
|
90
95
|
# : (untyped, Array[untyped], ?ScopeRanking?) -> void
|
|
91
96
|
def initialize: (untyped, Array[untyped], ?ScopeRanking?) -> void
|
|
@@ -95,6 +100,10 @@ module PaperTrailDiff
|
|
|
95
100
|
# : (Hash[String, untyped]) -> bool
|
|
96
101
|
def matches?: (Hash[String, untyped]) -> bool
|
|
97
102
|
|
|
103
|
+
# Whether no record can match, as for a relation `none` built.
|
|
104
|
+
# : () -> bool
|
|
105
|
+
def none?: () -> bool
|
|
106
|
+
|
|
98
107
|
# The members among records that are each the owner's by key: those that
|
|
99
108
|
# meet the conditions, then ranked.
|
|
100
109
|
# : (Array[untyped]) -> Array[untyped]
|
|
@@ -111,6 +120,9 @@ module PaperTrailDiff
|
|
|
111
120
|
# unknown where false would become true.
|
|
112
121
|
COMPARISONS: untyped
|
|
113
122
|
|
|
123
|
+
# Comparisons that order values, which read them as ScopeRanking sorts.
|
|
124
|
+
ORDERED: untyped
|
|
125
|
+
|
|
114
126
|
private
|
|
115
127
|
|
|
116
128
|
@model_class: untyped
|
|
@@ -134,9 +146,11 @@ module PaperTrailDiff
|
|
|
134
146
|
# : (bool?) -> bool?
|
|
135
147
|
def negate: (bool?) -> bool?
|
|
136
148
|
|
|
137
|
-
# The form the database holds, as the scope's own values were cast.
|
|
138
|
-
# :
|
|
139
|
-
|
|
149
|
+
# The form the database holds, as the scope's own values were cast. An
|
|
150
|
+
# order reads the value the database sorts by instead: SQL Server holds a
|
|
151
|
+
# time or date in a wrapper that only compares for equality.
|
|
152
|
+
# : (Symbol, String, Hash[String, untyped]) -> untyped
|
|
153
|
+
def stored: (Symbol, String, Hash[String, untyped]) -> untyped
|
|
140
154
|
|
|
141
155
|
# Builds each reflection's condition once per target class.
|
|
142
156
|
class Cache
|
|
@@ -174,6 +188,24 @@ module PaperTrailDiff
|
|
|
174
188
|
# : (untyped) -> Array[untyped]
|
|
175
189
|
def comparison: (untyped) -> Array[untyped]
|
|
176
190
|
|
|
191
|
+
RANGES: untyped
|
|
192
|
+
|
|
193
|
+
# A range, as `where(created_at: 1.day.ago..)` writes it, on a column
|
|
194
|
+
# whose values sort in Ruby as the database sorts them.
|
|
195
|
+
# : (untyped) -> Array[untyped]
|
|
196
|
+
def range: (untyped) -> Array[untyped]
|
|
197
|
+
|
|
198
|
+
# : (untyped) -> Array[untyped]
|
|
199
|
+
def between: (untyped) -> Array[untyped]
|
|
200
|
+
|
|
201
|
+
# : (Symbol, untyped, untyped) -> Array[untyped]
|
|
202
|
+
def bound: (Symbol, untyped, untyped) -> Array[untyped]
|
|
203
|
+
|
|
204
|
+
# A bound in the form the database holds, read back as the value the
|
|
205
|
+
# database sorts by. Reading it back unwraps what an adapter wraps.
|
|
206
|
+
# : (String, untyped) -> untyped
|
|
207
|
+
def sort_value: (String, untyped) -> untyped
|
|
208
|
+
|
|
177
209
|
# Whether a value is NULL compares alike on every type.
|
|
178
210
|
# : (Symbol, untyped) -> Array[untyped]
|
|
179
211
|
def binary: (Symbol, untyped) -> Array[untyped]
|
|
@@ -71,6 +71,12 @@ module PaperTrailDiff
|
|
|
71
71
|
# : (untyped, String) -> bool
|
|
72
72
|
def self.orderable?: (untyped, String) -> bool
|
|
73
73
|
|
|
74
|
+
# The value the database sorts by, as the column's type casts it. An enum
|
|
75
|
+
# sorts by the integer it stores; other types are compared cast, since an
|
|
76
|
+
# adapter may serialize a time or date as a wrapper, as SQL Server does.
|
|
77
|
+
# : (untyped, String, untyped) -> untyped
|
|
78
|
+
def self.sort_value: (untyped, String, untyped) -> untyped
|
|
79
|
+
|
|
74
80
|
# The type of the value a column stores, under an enum or time zone wrapper.
|
|
75
81
|
# : (untyped) -> untyped
|
|
76
82
|
def self.stored_type: (untyped) -> untyped
|
|
@@ -115,11 +121,5 @@ module PaperTrailDiff
|
|
|
115
121
|
# A time as its seconds, exactly, and a date as its day number.
|
|
116
122
|
# : (untyped) -> Numeric
|
|
117
123
|
def number: (untyped) -> Numeric
|
|
118
|
-
|
|
119
|
-
# The value the database sorts by, as the key's type casts it. An enum
|
|
120
|
-
# sorts by the integer it stores; other types are compared cast, since an
|
|
121
|
-
# adapter may serialize a time or date as a wrapper, as SQL Server does.
|
|
122
|
-
# : (String, Hash[String, untyped]) -> untyped
|
|
123
|
-
def stored: (String, Hash[String, untyped]) -> untyped
|
|
124
124
|
end
|
|
125
125
|
end
|
|
@@ -3,14 +3,19 @@
|
|
|
3
3
|
module PaperTrailDiff
|
|
4
4
|
# Selects both populations and checks their shared ceiling before analysis.
|
|
5
5
|
class ScopedAnalysisBuilder
|
|
6
|
-
# : (untyped, limit: Integer?, within: untyped, historical_filter: untyped, max_filter_versions: Integer, include_deleted: bool, analyzer: untyped, deleted_analyzer: untyped, ?activity_tree: AssociationTree?) -> void
|
|
7
|
-
def initialize: (untyped, limit: Integer?, within: untyped, historical_filter: untyped, max_filter_versions: Integer, include_deleted: bool, analyzer: untyped, deleted_analyzer: untyped, ?activity_tree: AssociationTree?) -> void
|
|
6
|
+
# : (untyped, limit: Integer?, within: untyped, historical_filter: untyped, max_filter_versions: Integer, include_deleted: bool, analyzer: untyped, deleted_analyzer: untyped, ?activity_tree: AssociationTree?, ?version_scope: untyped) -> void
|
|
7
|
+
def initialize: (untyped, limit: Integer?, within: untyped, historical_filter: untyped, max_filter_versions: Integer, include_deleted: bool, analyzer: untyped, deleted_analyzer: untyped, ?activity_tree: AssociationTree?, ?version_scope: untyped) -> void
|
|
8
8
|
|
|
9
9
|
# : () -> ScopedAnalysis
|
|
10
10
|
def call: () -> ScopedAnalysis
|
|
11
11
|
|
|
12
12
|
private
|
|
13
13
|
|
|
14
|
+
# Without the option, the deleted roots are still tested when the
|
|
15
|
+
# relation can be read, so that another selection's are not listed.
|
|
16
|
+
# : (untyped, bool) -> DeletedRootFilter?
|
|
17
|
+
def deleted_filter: (untyped, bool) -> DeletedRootFilter?
|
|
18
|
+
|
|
14
19
|
# : (ScopedRootSelection::Result, Array[Array[String]], Hash[Array[String], Analysis?]) -> ScopedAnalysis
|
|
15
20
|
def analysis: (ScopedRootSelection::Result, Array[Array[String]], Hash[Array[String], Analysis?]) -> ScopedAnalysis
|
|
16
21
|
|
|
@@ -20,6 +25,8 @@ module PaperTrailDiff
|
|
|
20
25
|
|
|
21
26
|
@deleted_filter: DeletedRootFilter?
|
|
22
27
|
|
|
28
|
+
@include_deleted: bool
|
|
29
|
+
|
|
23
30
|
@limit: Integer
|
|
24
31
|
|
|
25
32
|
@selection: ScopedRootSelection
|
|
@@ -40,9 +40,10 @@ module PaperTrailDiff
|
|
|
40
40
|
|
|
41
41
|
# `activity_tree` names the association paths whose changes also select a
|
|
42
42
|
# root, as an activity analysis reports them. Without one, only a root's
|
|
43
|
-
# own versions select it.
|
|
44
|
-
#
|
|
45
|
-
|
|
43
|
+
# own versions select it. `version_scope` narrows which of those count,
|
|
44
|
+
# as it narrows which are reported.
|
|
45
|
+
# : (untyped, time_range: TimeRange?, limit: Integer, ?historical_filter: untyped, ?max_filter_versions: Integer, ?activity_tree: AssociationTree?, ?version_scope: untyped) -> void
|
|
46
|
+
def initialize: (untyped, time_range: TimeRange?, limit: Integer, ?historical_filter: untyped, ?max_filter_versions: Integer, ?activity_tree: AssociationTree?, ?version_scope: untyped) -> void
|
|
46
47
|
|
|
47
48
|
# : () -> Result
|
|
48
49
|
def call: () -> Result
|
|
@@ -59,6 +60,8 @@ module PaperTrailDiff
|
|
|
59
60
|
|
|
60
61
|
@time_range: TimeRange?
|
|
61
62
|
|
|
63
|
+
@version_scope: untyped
|
|
64
|
+
|
|
62
65
|
# Leaves the candidate set in the database. Plucking every root changed in
|
|
63
66
|
# the window would cost memory and a statement proportional to all activity
|
|
64
67
|
# in the window -- not to the relation or `limit:` -- so a report on one
|
|
@@ -97,6 +100,8 @@ module PaperTrailDiff
|
|
|
97
100
|
# : () -> Array[String]
|
|
98
101
|
def missing_ids: () -> Array[String]
|
|
99
102
|
|
|
103
|
+
# Only the versions `version_scope` keeps select a root: one whose versions
|
|
104
|
+
# in the window it drops would have nothing to report.
|
|
100
105
|
# : () -> untyped
|
|
101
106
|
def window_versions: () -> untyped
|
|
102
107
|
|
|
@@ -23,6 +23,10 @@ module PaperTrailDiff
|
|
|
23
23
|
# : (untyped) -> untyped
|
|
24
24
|
def scope: (untyped) -> untyped
|
|
25
25
|
|
|
26
|
+
# The window as a Ruby range, its end included or left out as given.
|
|
27
|
+
# : () -> Range[Time]
|
|
28
|
+
def to_range: () -> Range[Time]
|
|
29
|
+
|
|
26
30
|
# : (untyped) -> untyped
|
|
27
31
|
def trailing_scope: (untyped) -> untyped
|
|
28
32
|
|
|
@@ -39,9 +43,6 @@ module PaperTrailDiff
|
|
|
39
43
|
# : (untyped) -> untyped
|
|
40
44
|
def after_end: (untyped) -> untyped
|
|
41
45
|
|
|
42
|
-
# : () -> Range[Time]
|
|
43
|
-
def query_range: () -> Range[Time]
|
|
44
|
-
|
|
45
46
|
# : (untyped, boundary: Symbol) -> Time
|
|
46
47
|
def coerce_time: (untyped, boundary: Symbol) -> Time
|
|
47
48
|
|
|
@@ -9,6 +9,10 @@ module PaperTrailDiff
|
|
|
9
9
|
# : () -> Array[Step]
|
|
10
10
|
def build: () -> Array[Step]
|
|
11
11
|
|
|
12
|
+
# The window the range covers once its edges have moved to transactions.
|
|
13
|
+
# : () -> TimeRange?
|
|
14
|
+
def window: () -> TimeRange?
|
|
15
|
+
|
|
12
16
|
# : () -> Analysis
|
|
13
17
|
def analyze: () -> Analysis
|
|
14
18
|
|
|
@@ -31,16 +31,14 @@ module PaperTrailDiff
|
|
|
31
31
|
# : (untyped) -> untyped
|
|
32
32
|
def right: (untyped) -> untyped
|
|
33
33
|
|
|
34
|
-
# : (untyped, later: bool) -> untyped
|
|
35
|
-
def side: (untyped, later: bool) -> untyped
|
|
36
|
-
|
|
37
34
|
@strict: bool
|
|
38
35
|
|
|
39
36
|
@time: Time
|
|
40
37
|
end
|
|
41
38
|
|
|
42
|
-
# Roots per statement
|
|
43
|
-
#
|
|
39
|
+
# Roots, or transactions, per statement. SQL Server compiles every
|
|
40
|
+
# statement afresh, since its ids are written into it, in time that grows
|
|
41
|
+
# with their number; fewer statements than this cost more than they save.
|
|
44
42
|
SLICE: ::Integer
|
|
45
43
|
|
|
46
44
|
# The same as `windows` for a batch of roots, keyed by identity.
|
|
@@ -56,6 +54,13 @@ module PaperTrailDiff
|
|
|
56
54
|
# : (untyped, Array[untyped], TimeRange) -> Hash[String, TimeRange]
|
|
57
55
|
def self.windows: (untyped, Array[untyped], TimeRange) -> Hash[String, TimeRange]
|
|
58
56
|
|
|
57
|
+
# A transaction holds its rows only while it runs, so in history as an
|
|
58
|
+
# application saves it an edge moves by moments. A longer move means a
|
|
59
|
+
# long transaction or rewritten times, which only the application can
|
|
60
|
+
# judge, so each move is reported rather than logged or refused.
|
|
61
|
+
# : (untyped, String, TimeRange, Time?, Time?) -> TimeRange
|
|
62
|
+
def self.moved_window: (untyped, String, TimeRange, Time?, Time?) -> TimeRange
|
|
63
|
+
|
|
59
64
|
# : (untyped) -> untyped
|
|
60
65
|
def self.transaction_versions: (untyped) -> untyped
|
|
61
66
|
|
|
@@ -69,25 +74,52 @@ module PaperTrailDiff
|
|
|
69
74
|
|
|
70
75
|
# Each root's nearest versions on either side of an edge, as [id,
|
|
71
76
|
# transaction] pairs; versions tied at the nearest instant are all kept.
|
|
72
|
-
# One
|
|
73
|
-
#
|
|
74
|
-
#
|
|
75
|
-
#
|
|
77
|
+
# One statement per slice: a grouped pass over the roots' versions finds
|
|
78
|
+
# both instants, and a join reads the versions saved at either. A lookup
|
|
79
|
+
# per root, joined by UNION ALL, took SQL Server about a second per 200
|
|
80
|
+
# roots to compile. Rows read without a model come back as the adapter
|
|
76
81
|
# returns them, so the transaction is cast as the grouped query's keys are.
|
|
77
82
|
# : (untyped, Array[untyped], Edge) -> Array[[String, untyped]]
|
|
78
83
|
def self.nearest: (untyped, Array[untyped], Edge) -> Array[[ String, untyped ]]
|
|
79
84
|
|
|
80
|
-
#
|
|
81
|
-
# : (untyped, Edge) -> String
|
|
82
|
-
def self.
|
|
85
|
+
# The roots' versions saved in a transaction at either nearest instant.
|
|
86
|
+
# : (untyped, Array[untyped], Edge) -> String
|
|
87
|
+
def self.nearest_sql: (untyped, Array[untyped], Edge) -> String
|
|
88
|
+
|
|
89
|
+
# Each root's latest instant before the edge and earliest after it, from
|
|
90
|
+
# every version, saved in a transaction or not.
|
|
91
|
+
# : (untyped, Edge) -> untyped
|
|
92
|
+
def self.nearest_instants: (untyped, Edge) -> untyped
|
|
93
|
+
|
|
94
|
+
# The latest or earliest of the times on one side of the edge.
|
|
95
|
+
# : (untyped, untyped, untyped) -> untyped
|
|
96
|
+
def self.side_instant: (untyped, untyped, untyped) -> untyped
|
|
83
97
|
|
|
84
|
-
#
|
|
85
|
-
|
|
98
|
+
# The same root's versions saved at either of its instants.
|
|
99
|
+
# : (untyped, untyped) -> untyped
|
|
100
|
+
def self.at_either: (untyped, untyped) -> untyped
|
|
86
101
|
|
|
87
102
|
# Where each transaction that has versions on both sides of the edge began.
|
|
88
103
|
# : (untyped, Array[untyped], Edge) -> Hash[untyped, Time]
|
|
89
104
|
def self.crossing_starts: (untyped, Array[untyped], Edge) -> Hash[untyped, Time]
|
|
90
105
|
|
|
106
|
+
# Another version of the same transaction on the edge's later side.
|
|
107
|
+
# : (untyped, Edge) -> untyped
|
|
108
|
+
def self.later_version: (untyped, Edge) -> untyped
|
|
109
|
+
|
|
110
|
+
# The version table under a second name, for a subquery over it. Any name
|
|
111
|
+
# serves, and SQLite even accepts an empty one other databases refuse, so
|
|
112
|
+
# no spec can tell the mutations apart.
|
|
113
|
+
# mutant:disable
|
|
114
|
+
# : (untyped) -> untyped
|
|
115
|
+
def self.other_versions: (untyped) -> untyped
|
|
116
|
+
|
|
117
|
+
# Arel ships no signatures; see VersionQuery. Any spelling of the constant
|
|
118
|
+
# finds the same module.
|
|
119
|
+
# mutant:disable
|
|
120
|
+
# : () -> untyped
|
|
121
|
+
def self.arel: () -> untyped
|
|
122
|
+
|
|
91
123
|
# : (TimeRange, Time?, Time?) -> TimeRange
|
|
92
124
|
def self.moved: (TimeRange, Time?, Time?) -> TimeRange
|
|
93
125
|
end
|
|
@@ -34,6 +34,8 @@ module PaperTrailDiff
|
|
|
34
34
|
# : (untyped) -> bool
|
|
35
35
|
def self?.version_record?: (untyped) -> bool
|
|
36
36
|
|
|
37
|
+
# The same row of the same version table. A record or instant is never a
|
|
38
|
+
# version.
|
|
37
39
|
# : (untyped, untyped) -> bool
|
|
38
40
|
def self?.same_version?: (untyped, untyped) -> bool
|
|
39
41
|
end
|
|
@@ -8,6 +8,9 @@ module PaperTrailDiff
|
|
|
8
8
|
# : (untyped, untyped, ?fallback_selected: bool) -> void
|
|
9
9
|
def initialize: (untyped, untyped, ?fallback_selected: bool) -> void
|
|
10
10
|
|
|
11
|
+
# The read runs in a savepoint, so that a query that fails here leaves a
|
|
12
|
+
# snapshot transaction around it usable: PostgreSQL refuses every later
|
|
13
|
+
# statement of a transaction once one has failed.
|
|
11
14
|
# : () -> Array[DiagnosticIssue]
|
|
12
15
|
def call: () -> Array[DiagnosticIssue]
|
|
13
16
|
|
|
@@ -70,8 +70,8 @@ module PaperTrailDiff
|
|
|
70
70
|
# for every root that changed or whose requested associations did.
|
|
71
71
|
# Historical windows remain explicit on analyze_scope; this entry point is
|
|
72
72
|
# deliberately named for a report through now rather than an as-of query.
|
|
73
|
-
# : (untyped, since: untyped, limit: Integer, ?associations: association_option, ?ignore: ignore_option, ?snapshots: bool, ?group: Symbol?, ?include_deleted: bool, ?historical_filter: untyped, ?max_filter_versions: Integer, ?allow_expensive: bool?, ?recorded_changes: bool, ?allow_approximate: bool) -> ScopedAnalysis
|
|
74
|
-
def self.report: (untyped, since: untyped, limit: Integer, ?associations: association_option, ?ignore: ignore_option, ?snapshots: bool, ?group: Symbol?, ?include_deleted: bool, ?historical_filter: untyped, ?max_filter_versions: Integer, ?allow_expensive: bool?, ?recorded_changes: bool, ?allow_approximate: bool) -> ScopedAnalysis
|
|
73
|
+
# : (untyped, since: untyped, limit: Integer, ?associations: association_option, ?ignore: ignore_option, ?version_scope: untyped, ?snapshots: bool, ?group: Symbol?, ?include_deleted: bool, ?historical_filter: untyped, ?max_filter_versions: Integer, ?allow_expensive: bool?, ?recorded_changes: bool, ?allow_approximate: bool) -> ScopedAnalysis
|
|
74
|
+
def self.report: (untyped, since: untyped, limit: Integer, ?associations: association_option, ?ignore: ignore_option, ?version_scope: untyped, ?snapshots: bool, ?group: Symbol?, ?include_deleted: bool, ?historical_filter: untyped, ?max_filter_versions: Integer, ?allow_expensive: bool?, ?recorded_changes: bool, ?allow_approximate: bool) -> ScopedAnalysis
|
|
75
75
|
|
|
76
76
|
# Warns about deprecated options; see Deprecation.
|
|
77
77
|
# : () -> untyped
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: paper_trail_diff
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.16.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alex Williams
|
|
@@ -50,7 +50,7 @@ dependencies:
|
|
|
50
50
|
- !ruby/object:Gem::Version
|
|
51
51
|
version: '18'
|
|
52
52
|
description: |
|
|
53
|
-
paper_trail_diff compares
|
|
53
|
+
paper_trail_diff compares records across their PaperTrail history and returns structured
|
|
54
54
|
attribute and explicitly selected association changes.
|
|
55
55
|
email:
|
|
56
56
|
- alex.williams.dev@gmail.com
|
|
@@ -141,6 +141,7 @@ files:
|
|
|
141
141
|
- lib/paper_trail_diff/prepared_record_index.rb
|
|
142
142
|
- lib/paper_trail_diff/prepared_snapshot_builder.rb
|
|
143
143
|
- lib/paper_trail_diff/prepared_state_association_reader.rb
|
|
144
|
+
- lib/paper_trail_diff/read_snapshot.rb
|
|
144
145
|
- lib/paper_trail_diff/recorded_changes.rb
|
|
145
146
|
- lib/paper_trail_diff/recorded_class.rb
|
|
146
147
|
- lib/paper_trail_diff/root_version_plan.rb
|
|
@@ -250,6 +251,7 @@ files:
|
|
|
250
251
|
- sig/generated/paper_trail_diff/prepared_record_index.rbs
|
|
251
252
|
- sig/generated/paper_trail_diff/prepared_snapshot_builder.rbs
|
|
252
253
|
- sig/generated/paper_trail_diff/prepared_state_association_reader.rbs
|
|
254
|
+
- sig/generated/paper_trail_diff/read_snapshot.rbs
|
|
253
255
|
- sig/generated/paper_trail_diff/recorded_changes.rbs
|
|
254
256
|
- sig/generated/paper_trail_diff/recorded_class.rbs
|
|
255
257
|
- sig/generated/paper_trail_diff/root_version_plan.rbs
|
|
@@ -290,11 +292,11 @@ licenses:
|
|
|
290
292
|
metadata:
|
|
291
293
|
allowed_push_host: https://rubygems.org
|
|
292
294
|
bug_tracker_uri: https://github.com/aheathwilliams/paper_trail_diff/issues
|
|
293
|
-
changelog_uri: https://github.com/aheathwilliams/paper_trail_diff/blob/v0.
|
|
294
|
-
documentation_uri: https://github.com/aheathwilliams/paper_trail_diff/blob/v0.
|
|
295
|
+
changelog_uri: https://github.com/aheathwilliams/paper_trail_diff/blob/v0.16.0/CHANGELOG.md
|
|
296
|
+
documentation_uri: https://github.com/aheathwilliams/paper_trail_diff/blob/v0.16.0/README.md
|
|
295
297
|
homepage_uri: https://github.com/aheathwilliams/paper_trail_diff
|
|
296
298
|
rubygems_mfa_required: 'true'
|
|
297
|
-
source_code_uri: https://github.com/aheathwilliams/paper_trail_diff/tree/v0.
|
|
299
|
+
source_code_uri: https://github.com/aheathwilliams/paper_trail_diff/tree/v0.16.0
|
|
298
300
|
rdoc_options: []
|
|
299
301
|
require_paths:
|
|
300
302
|
- lib
|