paper_trail_diff 0.1.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.
Files changed (77) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +45 -0
  3. data/LICENSE +22 -0
  4. data/README.md +473 -0
  5. data/lib/paper_trail_diff/activity_boundary.rb +82 -0
  6. data/lib/paper_trail_diff/activity_event.rb +128 -0
  7. data/lib/paper_trail_diff/activity_event_snapshot_refresher.rb +493 -0
  8. data/lib/paper_trail_diff/activity_range.rb +58 -0
  9. data/lib/paper_trail_diff/activity_root_snapshot_refresher.rb +156 -0
  10. data/lib/paper_trail_diff/activity_snapshot_sequence.rb +161 -0
  11. data/lib/paper_trail_diff/activity_timeline_builder.rb +177 -0
  12. data/lib/paper_trail_diff/activity_version_collector.rb +196 -0
  13. data/lib/paper_trail_diff/analysis.rb +26 -0
  14. data/lib/paper_trail_diff/association_discovery.rb +132 -0
  15. data/lib/paper_trail_diff/association_traversal.rb +131 -0
  16. data/lib/paper_trail_diff/branch_snapshot_refresher.rb +191 -0
  17. data/lib/paper_trail_diff/configuration.rb +170 -0
  18. data/lib/paper_trail_diff/diagnostics.rb +242 -0
  19. data/lib/paper_trail_diff/endpoint.rb +87 -0
  20. data/lib/paper_trail_diff/engine.rb +180 -0
  21. data/lib/paper_trail_diff/errors.rb +34 -0
  22. data/lib/paper_trail_diff/historical_association_reifier.rb +103 -0
  23. data/lib/paper_trail_diff/historical_snapshot_store.rb +144 -0
  24. data/lib/paper_trail_diff/live_association_reader.rb +10 -0
  25. data/lib/paper_trail_diff/paper_trail_adapter.rb +182 -0
  26. data/lib/paper_trail_diff/prepared_association_reifier.rb +48 -0
  27. data/lib/paper_trail_diff/prepared_edge_loader.rb +155 -0
  28. data/lib/paper_trail_diff/prepared_history.rb +217 -0
  29. data/lib/paper_trail_diff/prepared_history_loader.rb +136 -0
  30. data/lib/paper_trail_diff/prepared_record_index.rb +154 -0
  31. data/lib/paper_trail_diff/snapshot.rb +120 -0
  32. data/lib/paper_trail_diff/snapshot_normalizer.rb +182 -0
  33. data/lib/paper_trail_diff/step.rb +28 -0
  34. data/lib/paper_trail_diff/support.rb +80 -0
  35. data/lib/paper_trail_diff/timeline_builder.rb +60 -0
  36. data/lib/paper_trail_diff/timeline_snapshot_provider.rb +24 -0
  37. data/lib/paper_trail_diff/value_objects.rb +134 -0
  38. data/lib/paper_trail_diff/version.rb +6 -0
  39. data/lib/paper_trail_diff/version_range.rb +81 -0
  40. data/lib/paper_trail_diff.rb +131 -0
  41. data/sig/generated/paper_trail_diff/activity_boundary.rbs +43 -0
  42. data/sig/generated/paper_trail_diff/activity_event.rbs +64 -0
  43. data/sig/generated/paper_trail_diff/activity_event_snapshot_refresher.rbs +98 -0
  44. data/sig/generated/paper_trail_diff/activity_range.rbs +36 -0
  45. data/sig/generated/paper_trail_diff/activity_root_snapshot_refresher.rbs +54 -0
  46. data/sig/generated/paper_trail_diff/activity_snapshot_sequence.rbs +71 -0
  47. data/sig/generated/paper_trail_diff/activity_timeline_builder.rbs +61 -0
  48. data/sig/generated/paper_trail_diff/activity_version_collector.rbs +71 -0
  49. data/sig/generated/paper_trail_diff/analysis.rbs +18 -0
  50. data/sig/generated/paper_trail_diff/association_discovery.rbs +63 -0
  51. data/sig/generated/paper_trail_diff/association_traversal.rbs +54 -0
  52. data/sig/generated/paper_trail_diff/branch_snapshot_refresher.rbs +56 -0
  53. data/sig/generated/paper_trail_diff/configuration.rbs +67 -0
  54. data/sig/generated/paper_trail_diff/diagnostics.rbs +109 -0
  55. data/sig/generated/paper_trail_diff/endpoint.rbs +30 -0
  56. data/sig/generated/paper_trail_diff/engine.rbs +54 -0
  57. data/sig/generated/paper_trail_diff/errors.rbs +43 -0
  58. data/sig/generated/paper_trail_diff/historical_association_reifier.rbs +37 -0
  59. data/sig/generated/paper_trail_diff/historical_snapshot_store.rbs +50 -0
  60. data/sig/generated/paper_trail_diff/live_association_reader.rbs +9 -0
  61. data/sig/generated/paper_trail_diff/paper_trail_adapter.rbs +72 -0
  62. data/sig/generated/paper_trail_diff/prepared_association_reifier.rbs +27 -0
  63. data/sig/generated/paper_trail_diff/prepared_edge_loader.rbs +65 -0
  64. data/sig/generated/paper_trail_diff/prepared_history.rbs +93 -0
  65. data/sig/generated/paper_trail_diff/prepared_history_loader.rbs +67 -0
  66. data/sig/generated/paper_trail_diff/prepared_record_index.rbs +84 -0
  67. data/sig/generated/paper_trail_diff/snapshot.rbs +69 -0
  68. data/sig/generated/paper_trail_diff/snapshot_normalizer.rbs +76 -0
  69. data/sig/generated/paper_trail_diff/step.rbs +18 -0
  70. data/sig/generated/paper_trail_diff/support.rbs +30 -0
  71. data/sig/generated/paper_trail_diff/timeline_builder.rbs +31 -0
  72. data/sig/generated/paper_trail_diff/timeline_snapshot_provider.rbs +17 -0
  73. data/sig/generated/paper_trail_diff/value_objects.rbs +87 -0
  74. data/sig/generated/paper_trail_diff/version.rbs +5 -0
  75. data/sig/generated/paper_trail_diff/version_range.rbs +35 -0
  76. data/sig/generated/paper_trail_diff.rbs +56 -0
  77. metadata +144 -0
@@ -0,0 +1,131 @@
1
+ # frozen_string_literal: true
2
+ # rbs_inline: enabled
3
+
4
+ require 'paper_trail'
5
+
6
+ require_relative 'paper_trail_diff/version'
7
+ require_relative 'paper_trail_diff/support'
8
+ require_relative 'paper_trail_diff/errors'
9
+ require_relative 'paper_trail_diff/configuration'
10
+ require_relative 'paper_trail_diff/endpoint'
11
+ require_relative 'paper_trail_diff/association_traversal'
12
+ require_relative 'paper_trail_diff/association_discovery'
13
+ require_relative 'paper_trail_diff/diagnostics'
14
+ require_relative 'paper_trail_diff/snapshot'
15
+ require_relative 'paper_trail_diff/value_objects'
16
+ require_relative 'paper_trail_diff/engine'
17
+ require_relative 'paper_trail_diff/historical_association_reifier'
18
+ require_relative 'paper_trail_diff/prepared_record_index'
19
+ require_relative 'paper_trail_diff/prepared_history'
20
+ require_relative 'paper_trail_diff/prepared_edge_loader'
21
+ require_relative 'paper_trail_diff/prepared_history_loader'
22
+ require_relative 'paper_trail_diff/prepared_association_reifier'
23
+ require_relative 'paper_trail_diff/live_association_reader'
24
+ require_relative 'paper_trail_diff/snapshot_normalizer'
25
+ require_relative 'paper_trail_diff/historical_snapshot_store'
26
+ require_relative 'paper_trail_diff/timeline_snapshot_provider'
27
+ require_relative 'paper_trail_diff/activity_event_snapshot_refresher'
28
+ require_relative 'paper_trail_diff/activity_root_snapshot_refresher'
29
+ require_relative 'paper_trail_diff/branch_snapshot_refresher'
30
+ require_relative 'paper_trail_diff/step'
31
+ require_relative 'paper_trail_diff/activity_boundary'
32
+ require_relative 'paper_trail_diff/analysis'
33
+ require_relative 'paper_trail_diff/version_range'
34
+ require_relative 'paper_trail_diff/timeline_builder'
35
+ require_relative 'paper_trail_diff/activity_range'
36
+ require_relative 'paper_trail_diff/activity_event'
37
+ require_relative 'paper_trail_diff/activity_version_collector'
38
+ require_relative 'paper_trail_diff/activity_snapshot_sequence'
39
+ require_relative 'paper_trail_diff/activity_timeline_builder'
40
+ require_relative 'paper_trail_diff/paper_trail_adapter'
41
+
42
+ # @rbs!
43
+ # module PaperTrailDiff
44
+ # type snapshot_attributes = Hash[untyped, untyped]
45
+ # type snapshot_associations = Hash[untyped, AssociationSnapshot]
46
+ # type attribute_changes = Hash[String, ValueChange]
47
+ # type association_diff = ToOneAssociationDiff | CollectionAssociationDiff
48
+ # type association_diffs = Hash[String, association_diff]
49
+ # type association_snapshots = Hash[String, AssociationSnapshot]
50
+ # type identity = Array[untyped]
51
+ # type ignore_option = Array[String | Symbol] | Hash[String | Symbol, untyped]
52
+ # type reference_key = :type | :id | "type" | "id"
53
+ # end
54
+
55
+ # Structured version comparison for PaperTrail.
56
+ module PaperTrailDiff
57
+ DEFAULT_IGNORED_ATTRIBUTES = ['updated_at'].freeze
58
+ SUPPORTED_ASSOCIATION_MACROS = %i[
59
+ belongs_to
60
+ has_one
61
+ has_many
62
+ has_and_belongs_to_many
63
+ ].freeze
64
+
65
+ class << self
66
+ # Compares net state between explicit PaperTrail-version or current-record endpoints.
67
+ #: (untyped, untyped, ?associations: Array[String | Symbol], ?ignore: ignore_option) -> Diff
68
+ def compare(from_version, to_version, associations: [], ignore: DEFAULT_IGNORED_ATTRIBUTES)
69
+ PaperTrailAdapter.new(associations: associations, ignore: ignore).compare(
70
+ from_version,
71
+ to_version
72
+ )
73
+ end
74
+
75
+ # Compares every adjacent reconstructed state in an inclusive version range.
76
+ #: (untyped, from: untyped, to: untyped, ?associations: Array[String | Symbol], ?ignore: ignore_option) -> Array[Step]
77
+ def timeline(record, from:, to:, associations: [], ignore: DEFAULT_IGNORED_ATTRIBUTES)
78
+ PaperTrailAdapter.new(associations: associations, ignore: ignore).timeline(
79
+ record,
80
+ from: from,
81
+ to: to
82
+ )
83
+ end
84
+
85
+ # Compares adjacent root and selected-descendant activity boundaries.
86
+ #: (untyped, from: untyped, to: untyped, ?associations: Array[String | Symbol], ?ignore: ignore_option) -> Array[ActivityStep]
87
+ def activity_timeline(record, from:, to:, associations: [], ignore: DEFAULT_IGNORED_ATTRIBUTES)
88
+ PaperTrailAdapter.new(associations: associations, ignore: ignore).activity_timeline(
89
+ record,
90
+ from: from,
91
+ to: to
92
+ )
93
+ end
94
+
95
+ # Builds an endpoint diff and root-checkpoint timeline while normalizing each version once.
96
+ #: (untyped, from: untyped, to: untyped, ?associations: Array[String | Symbol], ?ignore: ignore_option, ?activity: bool) -> Analysis
97
+ def analyze( # rubocop:disable Metrics/ParameterLists
98
+ record,
99
+ from:,
100
+ to:,
101
+ associations: [],
102
+ ignore: DEFAULT_IGNORED_ATTRIBUTES,
103
+ activity: false
104
+ )
105
+ PaperTrailAdapter.new(associations: associations, ignore: ignore).analyze(
106
+ record,
107
+ from: from,
108
+ to: to,
109
+ activity: activity
110
+ )
111
+ end
112
+
113
+ # Returns the association macros this release can normalize.
114
+ #: () -> Array[Symbol]
115
+ def supported_association_macros
116
+ SUPPORTED_ASSOCIATION_MACROS
117
+ end
118
+
119
+ # Discovers supported, finite association paths for a model or record.
120
+ #: (untyped, ?max_depth: Integer) -> Array[AssociationDescriptor]
121
+ def association_paths(model_or_record, max_depth: 1)
122
+ AssociationDiscovery.new(model_or_record, max_depth: max_depth).call
123
+ end
124
+
125
+ # Reports known reconstruction hazards without mutating application state.
126
+ #: (untyped, untyped, ?associations: Array[String | Symbol]) -> DiagnosticReport
127
+ def diagnose(from_version, to_version, associations: [])
128
+ HistoryDiagnostics.new(from_version, to_version, associations: associations).call
129
+ end
130
+ end
131
+ end
@@ -0,0 +1,43 @@
1
+ # Generated from lib/paper_trail_diff/activity_boundary.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Immutable metadata identifying one historical or current activity boundary.
5
+ class ActivityBoundary
6
+ attr_reader kind: Symbol
7
+
8
+ attr_reader version_id: untyped
9
+
10
+ attr_reader item_type: String
11
+
12
+ attr_reader item_id: untyped
13
+
14
+ attr_reader recorded_at: untyped
15
+
16
+ # : (untyped) -> ActivityBoundary
17
+ def self.from_version: (untyped) -> ActivityBoundary
18
+
19
+ # : (untyped, captured_at: untyped) -> ActivityBoundary
20
+ def self.current: (untyped, captured_at: untyped) -> ActivityBoundary
21
+
22
+ # : (kind: Symbol, version_id: untyped, item_type: untyped, item_id: untyped, recorded_at: untyped) -> void
23
+ def initialize: (kind: Symbol, version_id: untyped, item_type: untyped, item_id: untyped, recorded_at: untyped) -> void
24
+
25
+ # : () -> Hash[Symbol, untyped]
26
+ def to_h: () -> Hash[Symbol, untyped]
27
+ end
28
+
29
+ # One adjacent transition in a descendant-aware activity timeline.
30
+ class ActivityStep
31
+ attr_reader from_boundary: ActivityBoundary
32
+
33
+ attr_reader to_boundary: ActivityBoundary
34
+
35
+ attr_reader diff: Diff
36
+
37
+ # : (from_boundary: ActivityBoundary, to_boundary: ActivityBoundary, diff: Diff) -> void
38
+ def initialize: (from_boundary: ActivityBoundary, to_boundary: ActivityBoundary, diff: Diff) -> void
39
+
40
+ # : () -> Hash[Symbol, untyped]
41
+ def to_h: () -> Hash[Symbol, untyped]
42
+ end
43
+ end
@@ -0,0 +1,64 @@
1
+ # Generated from lib/paper_trail_diff/activity_event.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Internal activity boundary plus the selected root branches affected by its event.
5
+ class ActivityEvent
6
+ attr_reader version: untyped
7
+
8
+ attr_reader branches: Array[String]?
9
+
10
+ # : (version: untyped, branches: Array[String]?) -> void
11
+ def initialize: (version: untyped, branches: Array[String]?) -> void
12
+
13
+ # : () -> bool
14
+ def root?: () -> bool
15
+ end
16
+
17
+ # Accumulates each version once while retaining every selected root branch.
18
+ class ActivityEventRegistry
19
+ def initialize: () -> untyped
20
+
21
+ # : (Array[untyped], ?branch: String?) -> void
22
+ def add: (Array[untyped], ?branch: String?) -> void
23
+
24
+ # : () -> Array[ActivityEvent]
25
+ def to_a: () -> Array[ActivityEvent]
26
+
27
+ private
28
+
29
+ @events: Hash[Array[untyped], Hash[Symbol, untyped]]
30
+
31
+ # : (Hash[Symbol, untyped]?, String?) -> Array[String]?
32
+ def merged_branches: (Hash[Symbol, untyped]?, String?) -> Array[String]?
33
+ end
34
+
35
+ # Resolves the branch union that PT-AT exposes atomically for one transaction.
36
+ class ActivityTransactionGroups
37
+ # : (Array[ActivityEvent]) -> void
38
+ def initialize: (Array[ActivityEvent]) -> void
39
+
40
+ # : (ActivityEvent) -> Array[String]?
41
+ def branches_for: (ActivityEvent) -> Array[String]?
42
+
43
+ # : (ActivityEvent) -> bool
44
+ def isolated?: (ActivityEvent) -> bool
45
+
46
+ private
47
+
48
+ @branches: Hash[Array[untyped], Array[String]?]
49
+
50
+ @group_sizes: Hash[Array[untyped], Integer]
51
+
52
+ # : (Hash[Array[untyped], Array[ActivityEvent]]) -> Hash[Array[untyped], Array[String]?]
53
+ def build_groups: (Hash[Array[untyped], Array[ActivityEvent]]) -> Hash[Array[untyped], Array[String]?]
54
+
55
+ # : (Array[ActivityEvent]) -> Hash[Array[untyped], Array[ActivityEvent]]
56
+ def grouped_events: (Array[ActivityEvent]) -> Hash[Array[untyped], Array[ActivityEvent]]
57
+
58
+ # : (Array[ActivityEvent]) -> Array[String]?
59
+ def group_branches: (Array[ActivityEvent]) -> Array[String]?
60
+
61
+ # : (ActivityEvent) -> Array[untyped]?
62
+ def transaction_key: (ActivityEvent) -> Array[untyped]?
63
+ end
64
+ end
@@ -0,0 +1,98 @@
1
+ # Generated from lib/paper_trail_diff/activity_event_snapshot_refresher.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Applies safe descendant event deltas without rebuilding an entire selected branch.
5
+ # rubocop:disable Metrics/ClassLength
6
+ class ActivityEventSnapshotRefresher
7
+ RECORD_AFTER_HANDLERS: untyped
8
+
9
+ # : (traversal: AssociationTraversal, pool: SnapshotPool, components: untyped, ?association_reader: untyped) -> void
10
+ def initialize: (traversal: AssociationTraversal, pool: SnapshotPool, components: untyped, ?association_reader: untyped) -> void
11
+
12
+ # : (untyped, untyped, RecordSnapshot, Array[String], ActivityEvent?) -> [bool, RecordSnapshot?]
13
+ def call: (untyped, untyped, RecordSnapshot, Array[String], ActivityEvent?) -> [ bool, RecordSnapshot? ]
14
+
15
+ private
16
+
17
+ @association_reader: untyped
18
+
19
+ @components: untyped
20
+
21
+ @pool: SnapshotPool
22
+
23
+ @traversal: AssociationTraversal
24
+
25
+ # : (Array[Array[untyped]], untyped) -> bool
26
+ def unsafe_through_membership_event?: (Array[Array[untyped]], untyped) -> bool
27
+
28
+ # : (untyped, untyped, RecordSnapshot, SnapshotNormalizer, Array[Array[untyped]], untyped) -> [bool, RecordSnapshot]
29
+ def collection_target_snapshot: (untyped, untyped, RecordSnapshot, SnapshotNormalizer, Array[Array[untyped]], untyped) -> [ bool, RecordSnapshot ]
30
+
31
+ # : (untyped, AssociationTree, String, ?path: String) -> Array[Array[untyped]]
32
+ def direct_collection_routes: (untyped, AssociationTree, String, ?path: String) -> Array[Array[untyped]]
33
+
34
+ # : (RecordSnapshot, Array[untyped], untyped, untyped, RecordSnapshot?, ?depth: Integer) -> [RecordSnapshot, bool]
35
+ def replace_collection_route: (RecordSnapshot, Array[untyped], untyped, untyped, RecordSnapshot?, ?depth: Integer) -> [ RecordSnapshot, bool ]
36
+
37
+ # : (untyped, untyped, RecordSnapshot, AssociationTree, SnapshotNormalizer, untyped) -> [bool, RecordSnapshot?]
38
+ def belongs_to_target_snapshot: (untyped, untyped, RecordSnapshot, AssociationTree, SnapshotNormalizer, untyped) -> [ bool, RecordSnapshot? ]
39
+
40
+ # : (untyped, AssociationTree, String, ?path: String) -> Array[Array[untyped]]
41
+ def belongs_to_routes: (untyped, AssociationTree, String, ?path: String) -> Array[Array[untyped]]
42
+
43
+ # : (Array[untyped], untyped, SnapshotNormalizer, untyped, untyped) -> RecordSnapshot?
44
+ def normalized_route_record: (Array[untyped], untyped, SnapshotNormalizer, untyped, untyped) -> RecordSnapshot?
45
+
46
+ # : (RecordSnapshot, Array[untyped], untyped, RecordSnapshot?, ?depth: Integer) -> [RecordSnapshot, bool]
47
+ def replace_route: (RecordSnapshot, Array[untyped], untyped, RecordSnapshot?, ?depth: Integer) -> [ RecordSnapshot, bool ]
48
+
49
+ # : (Array[RecordSnapshot], untyped, RecordSnapshot?) -> Array[RecordSnapshot]
50
+ def replace_existing_target: (Array[RecordSnapshot], untyped, RecordSnapshot?) -> Array[RecordSnapshot]
51
+
52
+ # : (untyped) -> untyped
53
+ def record_after: (untyped) -> untyped
54
+
55
+ # PaperTrail create/update versions contain deserialized change pairs, so
56
+ # their post-event records need no successor query.
57
+ # : (untyped) -> untyped
58
+ def changed_record_after: (untyped) -> untyped
59
+
60
+ # : (untyped) -> untyped
61
+ def created_record_after: (untyped) -> untyped
62
+
63
+ # : (untyped) -> untyped
64
+ def updated_record_after: (untyped) -> untyped
65
+
66
+ # : (untyped, untyped) -> Hash[untyped, untyped]
67
+ def after_attributes: (untyped, untyped) -> Hash[untyped, untyped]
68
+
69
+ # : (untyped, untyped) -> untyped
70
+ def apply_changes: (untyped, untyped) -> untyped
71
+
72
+ # Mirrors PaperTrail's changeset deserialization without resolving
73
+ # +version.item+, which would issue one live-record query per event.
74
+ # : (untyped, untyped) -> untyped
75
+ def deserialized_changeset: (untyped, untyped) -> untyped
76
+
77
+ # : (untyped, untyped, untyped) -> untyped
78
+ def standard_changeset: (untyped, untyped, untyped) -> untyped
79
+
80
+ # : (untyped, untyped, RecordSnapshot) -> bool
81
+ def member_of_owner?: (untyped, untyped, RecordSnapshot) -> bool
82
+
83
+ # : (untyped, untyped, AssociationTree, String, SnapshotNormalizer, untyped, untyped) -> RecordSnapshot?
84
+ def normalize_event_record: (untyped, untyped, AssociationTree, String, SnapshotNormalizer, untyped, untyped) -> RecordSnapshot?
85
+
86
+ # : (untyped, habtm_version: untyped) -> HistoricalAssociationReifier
87
+ def historical_reader: (untyped, habtm_version: untyped) -> HistoricalAssociationReifier
88
+
89
+ # : (Array[RecordSnapshot], untyped, RecordSnapshot?) -> Array[RecordSnapshot]
90
+ def replace_collection_record: (Array[RecordSnapshot], untyped, RecordSnapshot?) -> Array[RecordSnapshot]
91
+
92
+ # : (untyped, RecordSnapshot?) -> String
93
+ def replacement_type: (untyped, RecordSnapshot?) -> String
94
+
95
+ # : (untyped) -> untyped
96
+ def endpoint_model_class: (untyped) -> untyped
97
+ end
98
+ end
@@ -0,0 +1,36 @@
1
+ # Generated from lib/paper_trail_diff/activity_range.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Tests activity versions against a historical-version or wall-clock range end.
5
+ class ActivityRange
6
+ # : (untyped, untyped) -> void
7
+ def initialize: (untyped, untyped) -> void
8
+
9
+ # : (untyped) -> bool
10
+ def include?: (untyped) -> bool
11
+
12
+ # Narrows an Active Record version relation by timestamp. Exact tie-breaking
13
+ # remains in #include? so this works for integer, UUID, and custom version IDs.
14
+ # : (untyped) -> untyped
15
+ def scope: (untyped) -> untyped
16
+
17
+ private
18
+
19
+ @end_boundary: untyped
20
+
21
+ @end_key: Array[untyped]?
22
+
23
+ @start_key: Array[untyped]
24
+
25
+ @start_version: untyped
26
+
27
+ # : (untyped, Array[untyped]) -> bool
28
+ def before_end?: (untyped, Array[untyped]) -> bool
29
+
30
+ # : () -> untyped
31
+ def end_time: () -> untyped
32
+
33
+ # : (Array[untyped], Array[untyped]) -> bool
34
+ def key_before_or_equal?: (Array[untyped], Array[untyped]) -> bool
35
+ end
36
+ end
@@ -0,0 +1,54 @@
1
+ # Generated from lib/paper_trail_diff/activity_root_snapshot_refresher.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Advances scalar-only root events while retaining already reconstructed associations.
5
+ class ActivityRootSnapshotRefresher
6
+ # : (tree: AssociationTree, traversal: AssociationTraversal, normalizer: SnapshotNormalizer, record_after: untyped, changeset: untyped, partial_snapshotter: untyped) -> void
7
+ def initialize: (tree: AssociationTree, traversal: AssociationTraversal, normalizer: SnapshotNormalizer, record_after: untyped, changeset: untyped, partial_snapshotter: untyped) -> void
8
+
9
+ # : (untyped, untyped, RecordSnapshot?, ActivityEvent) -> [bool, RecordSnapshot?]
10
+ def call: (untyped, untyped, RecordSnapshot?, ActivityEvent) -> [ bool, RecordSnapshot? ]
11
+
12
+ private
13
+
14
+ @changeset: untyped
15
+
16
+ @normalizer: SnapshotNormalizer
17
+
18
+ @partial_snapshotter: untyped
19
+
20
+ @record_after: untyped
21
+
22
+ @relationship_reflections: Hash[String, Array[untyped]]
23
+
24
+ @traversal: AssociationTraversal
25
+
26
+ @tree: AssociationTree
27
+
28
+ @unsupported_branches: Hash[String, Array[String]]
29
+
30
+ # : (RecordSnapshot, untyped, untyped) -> snapshot_attributes?
31
+ def advanced_attributes: (RecordSnapshot, untyped, untyped) -> snapshot_attributes?
32
+
33
+ # : (untyped, untyped) -> Array[String]
34
+ def branches_to_refresh: (untyped, untyped) -> Array[String]
35
+
36
+ # : (untyped) -> Array[String]
37
+ def unsupported_branches: (untyped) -> Array[String]
38
+
39
+ # : (untyped) -> bool
40
+ def direct_versioned_reflection?: (untyped) -> bool
41
+
42
+ # : (RecordSnapshot, untyped) -> bool
43
+ def same_record?: (RecordSnapshot, untyped) -> bool
44
+
45
+ # : (untyped, untyped) -> Array[String]
46
+ def changed_relationship_branches: (untyped, untyped) -> Array[String]
47
+
48
+ # : (untyped) -> Array[untyped]
49
+ def root_relationship_reflections: (untyped) -> Array[untyped]
50
+
51
+ # : (untyped) -> Array[String]
52
+ def relationship_columns: (untyped) -> Array[String]
53
+ end
54
+ end
@@ -0,0 +1,71 @@
1
+ # Generated from lib/paper_trail_diff/activity_snapshot_sequence.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Optional full/partial snapshot operations consumed by the activity sequence.
5
+ class ActivitySnapshotProvider
6
+ # : (snapshotter: untyped, refresher: untyped, preparer: untyped) -> void
7
+ def initialize: (snapshotter: untyped, refresher: untyped, preparer: untyped) -> void
8
+
9
+ # : (untyped, Array[untyped]) -> void
10
+ def prepare: (untyped, Array[untyped]) -> void
11
+
12
+ # : (untyped, untyped) -> RecordSnapshot?
13
+ def call: (untyped, untyped) -> RecordSnapshot?
14
+
15
+ # : (untyped, untyped, RecordSnapshot?, Array[String], event: ActivityEvent, isolated: bool) -> RecordSnapshot?
16
+ def refresh: (untyped, untyped, RecordSnapshot?, Array[String], event: ActivityEvent, isolated: bool) -> RecordSnapshot?
17
+
18
+ # : (untyped, untyped, RecordSnapshot?, event: ActivityEvent) -> RecordSnapshot?
19
+ def advance_root: (untyped, untyped, RecordSnapshot?, event: ActivityEvent) -> RecordSnapshot?
20
+
21
+ @preparer: untyped
22
+
23
+ @refresher: untyped
24
+
25
+ @snapshotter: untyped
26
+ end
27
+
28
+ # Builds chronological snapshots, refreshing only branches affected by prior events.
29
+ class ActivitySnapshotSequence
30
+ # : (Array[untyped], Array[ActivityEvent], untyped, ?current: untyped) -> void
31
+ def initialize: (Array[untyped], Array[ActivityEvent], untyped, ?current: untyped) -> void
32
+
33
+ # : () -> Array[RecordSnapshot?]
34
+ def call: () -> Array[RecordSnapshot?]
35
+
36
+ # : () { (ActivityEvent, RecordSnapshot?) -> void } -> void
37
+ def each: () { (ActivityEvent, RecordSnapshot?) -> void } -> void
38
+
39
+ private
40
+
41
+ @current: untyped
42
+
43
+ @events: Array[ActivityEvent]
44
+
45
+ @root_endpoints: Hash[untyped, untyped]
46
+
47
+ @root_versions: Array[untyped]
48
+
49
+ @snapshotter: untyped
50
+
51
+ @transaction_groups: ActivityTransactionGroups
52
+
53
+ # : (ActivityEvent, ActivityEvent, RecordSnapshot?) -> RecordSnapshot?
54
+ def transition_snapshot: (ActivityEvent, ActivityEvent, RecordSnapshot?) -> RecordSnapshot?
55
+
56
+ # : (ActivityEvent) -> bool
57
+ def incremental_root?: (ActivityEvent) -> bool
58
+
59
+ # : (ActivityEvent, ActivityEvent, RecordSnapshot?) -> RecordSnapshot?
60
+ def advance_root: (ActivityEvent, ActivityEvent, RecordSnapshot?) -> RecordSnapshot?
61
+
62
+ # : (ActivityEvent) -> RecordSnapshot?
63
+ def full_snapshot: (ActivityEvent) -> RecordSnapshot?
64
+
65
+ # : (untyped) -> untyped
66
+ def root_endpoint: (untyped) -> untyped
67
+
68
+ # : () -> Hash[untyped, untyped]
69
+ def build_root_endpoints: () -> Hash[untyped, untyped]
70
+ end
71
+ end
@@ -0,0 +1,61 @@
1
+ # Generated from lib/paper_trail_diff/activity_timeline_builder.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Compares adjacent root and selected-descendant activity boundaries.
5
+ class ActivityTimelineBuilder
6
+ # : (untyped, from: untyped, to: untyped, tree: AssociationTree, snapshotter: untyped) -> void
7
+ def initialize: (untyped, from: untyped, to: untyped, tree: AssociationTree, snapshotter: untyped) -> void
8
+
9
+ # : () -> Array[ActivityStep]
10
+ def build: () -> Array[ActivityStep]
11
+
12
+ # Builds all three version-bounded views from one activity snapshot pass.
13
+ # : () -> Analysis
14
+ def analyze: () -> Analysis
15
+
16
+ private
17
+
18
+ @from: untyped
19
+
20
+ @record: untyped
21
+
22
+ @snapshotter: untyped
23
+
24
+ @to: untyped
25
+
26
+ @tree: AssociationTree
27
+
28
+ # : () -> Array[ActivityStep]
29
+ def build_between_versions: () -> Array[ActivityStep]
30
+
31
+ # : () -> Array[ActivityStep]
32
+ def build_to_current: () -> Array[ActivityStep]
33
+
34
+ # : () -> [RecordSnapshot?, untyped]
35
+ def capture_current: () -> [ RecordSnapshot?, untyped ]
36
+
37
+ # : () -> void
38
+ def validate_current_range!: () -> void
39
+
40
+ # : (Array[untyped], ?range_end: untyped) -> Array[ActivityEvent]
41
+ def collect_events: (Array[untyped], ?range_end: untyped) -> Array[ActivityEvent]
42
+
43
+ # : (Array[untyped]) -> void
44
+ def prepare_history: (Array[untyped]) -> void
45
+
46
+ # : (Array[untyped], Array[ActivityEvent], ?current: untyped, ?final_boundary: ActivityBoundary?, ?final_snapshot: RecordSnapshot?) -> Array[ActivityStep]
47
+ def build_event_steps: (Array[untyped], Array[ActivityEvent], ?current: untyped, ?final_boundary: ActivityBoundary?, ?final_snapshot: RecordSnapshot?) -> Array[ActivityStep]
48
+
49
+ # : (Array[untyped], Array[ActivityEvent], ?current: untyped) -> [Array[ActivityStep], Hash[Array[untyped], RecordSnapshot?], RecordSnapshot?]
50
+ def event_history: (Array[untyped], Array[ActivityEvent], ?current: untyped) -> [ Array[ActivityStep], Hash[Array[untyped], RecordSnapshot?], RecordSnapshot? ]
51
+
52
+ # : (Array[untyped], Hash[Array[untyped], RecordSnapshot?], Array[ActivityStep]) -> Analysis
53
+ def build_analysis: (Array[untyped], Hash[Array[untyped], RecordSnapshot?], Array[ActivityStep]) -> Analysis
54
+
55
+ # : (Array[untyped], Array[RecordSnapshot?]) -> Array[Step]
56
+ def build_root_steps: (Array[untyped], Array[RecordSnapshot?]) -> Array[Step]
57
+
58
+ # : (untyped) -> Array[untyped]
59
+ def version_key: (untyped) -> Array[untyped]
60
+ end
61
+ end
@@ -0,0 +1,71 @@
1
+ # Generated from lib/paper_trail_diff/activity_version_collector.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Collects root and selected-descendant versions relevant to one root history range.
5
+ class ActivityVersionCollector
6
+ # : (untyped, root_versions: Array[untyped], tree: AssociationTree, traversal: AssociationTraversal, ?range_end: untyped) -> void
7
+ def initialize: (untyped, root_versions: Array[untyped], tree: AssociationTree, traversal: AssociationTraversal, ?range_end: untyped) -> void
8
+
9
+ # : () -> Array[ActivityEvent]
10
+ def call: () -> Array[ActivityEvent]
11
+
12
+ private
13
+
14
+ @range: ActivityRange
15
+
16
+ @record: untyped
17
+
18
+ @registry: ActivityEventRegistry
19
+
20
+ @root_versions: Array[untyped]
21
+
22
+ @traversal: AssociationTraversal
23
+
24
+ @tree: AssociationTree
25
+
26
+ # : (untyped, Array[untyped], AssociationTree, path: String, branch: String?) -> void
27
+ def collect_tree: (untyped, Array[untyped], AssociationTree, path: String, branch: String?) -> void
28
+
29
+ # : (Hash[Symbol, untyped], untyped, AssociationTree, String, String) -> void
30
+ def collect_reflection: (Hash[Symbol, untyped], untyped, AssociationTree, String, String) -> void
31
+
32
+ # : (Hash[Symbol, untyped], untyped, String) -> Hash[String, untyped]
33
+ def edge_groups: (Hash[Symbol, untyped], untyped, String) -> Hash[String, untyped]
34
+
35
+ # : (Hash[Symbol, untyped], untyped, String) -> Hash[String, untyped]
36
+ def through_groups: (Hash[Symbol, untyped], untyped, String) -> Hash[String, untyped]
37
+
38
+ # : (untyped, Array[untyped], untyped) -> Hash[String, untyped]
39
+ def belongs_to_groups: (untyped, Array[untyped], untyped) -> Hash[String, untyped]
40
+
41
+ # : (untyped, Array[untyped], untyped) -> Hash[String, untyped]
42
+ def direct_child_groups: (untyped, Array[untyped], untyped) -> Hash[String, untyped]
43
+
44
+ # : (untyped, Array[untyped], untyped) -> Hash[String, untyped]
45
+ def habtm_groups: (untyped, Array[untyped], untyped) -> Hash[String, untyped]
46
+
47
+ # : (Array[untyped], untyped) -> Hash[String, untyped]
48
+ def identity_groups: (Array[untyped], untyped) -> Hash[String, untyped]
49
+
50
+ # : (untyped, Array[untyped]) -> Hash[Symbol, untyped]
51
+ def group: (untyped, Array[untyped]) -> Hash[Symbol, untyped]
52
+
53
+ # : (Hash[String, untyped], Hash[String, untyped]) -> void
54
+ def merge_groups!: (Hash[String, untyped], Hash[String, untyped]) -> void
55
+
56
+ # : (untyped, Array[untyped]) -> Array[untyped]
57
+ def versions_for: (untyped, Array[untyped]) -> Array[untyped]
58
+
59
+ # : (untyped, untyped) -> untyped
60
+ def target_class: (untyped, untyped) -> untyped
61
+
62
+ # : (untyped) -> Array[String?]
63
+ def related_parent_types: (untyped) -> Array[String?]
64
+
65
+ # : (untyped) -> bool
66
+ def in_range?: (untyped) -> bool
67
+
68
+ # : (String, String) -> String
69
+ def join_path: (String, String) -> String
70
+ end
71
+ end
@@ -0,0 +1,18 @@
1
+ # Generated from lib/paper_trail_diff/analysis.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Endpoint and root-checkpoint timeline results built from one normalized history.
5
+ class Analysis
6
+ attr_reader diff: Diff
7
+
8
+ attr_reader timeline: Array[Step]
9
+
10
+ attr_reader activity_timeline: Array[ActivityStep]?
11
+
12
+ # : (diff: Diff, timeline: Array[Step], ?activity_timeline: Array[ActivityStep]?) -> void
13
+ def initialize: (diff: Diff, timeline: Array[Step], ?activity_timeline: Array[ActivityStep]?) -> void
14
+
15
+ # : () -> Hash[Symbol, untyped]
16
+ def to_h: () -> Hash[Symbol, untyped]
17
+ end
18
+ end