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,63 @@
1
+ # Generated from lib/paper_trail_diff/association_discovery.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # One discoverable ActiveRecord association path.
5
+ class AssociationDescriptor
6
+ attr_reader path: String
7
+
8
+ attr_reader kind: Symbol
9
+
10
+ attr_reader target_type: String?
11
+
12
+ attr_reader through: String?
13
+
14
+ attr_reader polymorphic: bool
15
+
16
+ attr_reader cycle: bool
17
+
18
+ # : (path: String, kind: Symbol, target_type: String?, ?through: String?, ?flags: Array[Symbol]) -> void
19
+ def initialize: (path: String, kind: Symbol, target_type: String?, ?through: String?, ?flags: Array[Symbol]) -> void
20
+
21
+ # : () -> Hash[Symbol, untyped]
22
+ def to_h: () -> Hash[Symbol, untyped]
23
+ end
24
+
25
+ # Discovers finite, supported association paths for configuration UIs.
26
+ class AssociationDiscovery
27
+ # : (untyped, max_depth: Integer) -> void
28
+ def initialize: (untyped, max_depth: Integer) -> void
29
+
30
+ # : () -> Array[AssociationDescriptor]
31
+ def call: () -> Array[AssociationDescriptor]
32
+
33
+ private
34
+
35
+ @max_depth: Integer
36
+
37
+ @model_class: untyped
38
+
39
+ # : (untyped, prefix: String, ancestry: Array[untyped], depth: Integer) -> Array[AssociationDescriptor]
40
+ def discover: (untyped, prefix: String, ancestry: Array[untyped], depth: Integer) -> Array[AssociationDescriptor]
41
+
42
+ # : (untyped, prefix: String, ancestry: Array[untyped], depth: Integer) -> Array[AssociationDescriptor]
43
+ def describe_and_descend: (untyped, prefix: String, ancestry: Array[untyped], depth: Integer) -> Array[AssociationDescriptor]
44
+
45
+ # : (untyped, String, untyped, bool) -> AssociationDescriptor
46
+ def descriptor_for: (untyped, String, untyped, bool) -> AssociationDescriptor
47
+
48
+ # : (untyped) -> Array[untyped]
49
+ def supported_reflections: (untyped) -> Array[untyped]
50
+
51
+ # : (untyped, untyped) -> bool
52
+ def paper_trail_versions?: (untyped, untyped) -> bool
53
+
54
+ # : (untyped) -> untyped
55
+ def reflection_target: (untyped) -> untyped
56
+
57
+ # : (untyped) -> String?
58
+ def reflection_target_name: (untyped) -> String?
59
+
60
+ # : (String, String) -> String
61
+ def association_path: (String, String) -> String
62
+ end
63
+ end
@@ -0,0 +1,54 @@
1
+ # Generated from lib/paper_trail_diff/association_traversal.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Resolves and validates ActiveRecord reflections for a bounded association tree.
5
+ class AssociationTraversal
6
+ # : (AssociationTree) -> void
7
+ def initialize: (AssociationTree) -> void
8
+
9
+ # : (untyped) -> void
10
+ def validate!: (untyped) -> void
11
+
12
+ # : (untyped) -> Array[Array[untyped]]
13
+ def selected_reflections: (untyped) -> Array[Array[untyped]]
14
+
15
+ # : (untyped, untyped) -> void
16
+ def ensure_habtm_history!: (untyped, untyped) -> void
17
+
18
+ # : (untyped) -> Array[String]
19
+ def habtm_paths: (untyped) -> Array[String]
20
+
21
+ # : (untyped, AssociationTree, path: String) -> Array[untyped]
22
+ def reflections_for: (untyped, AssociationTree, path: String) -> Array[untyped]
23
+
24
+ # : (untyped) -> Array[String]
25
+ def incoming_relationship_columns: (untyped) -> Array[String]
26
+
27
+ private
28
+
29
+ @reflection_cache: Hash[Array[untyped], Array[untyped]]
30
+
31
+ @tree: AssociationTree
32
+
33
+ # : (untyped, AssociationTree, path: String) -> Array[Array[untyped]]
34
+ def collect_reflections: (untyped, AssociationTree, path: String) -> Array[Array[untyped]]
35
+
36
+ # : (untyped, AssociationTree, path: String) -> void
37
+ def validate_tree!: (untyped, AssociationTree, path: String) -> void
38
+
39
+ # : (untyped, AssociationTree, String) -> Array[untyped]
40
+ def requested_reflections: (untyped, AssociationTree, String) -> Array[untyped]
41
+
42
+ # : (untyped, String, String) -> untyped
43
+ def resolve_reflection: (untyped, String, String) -> untyped
44
+
45
+ # : (untyped, untyped) -> bool
46
+ def paper_trail_versions?: (untyped, untyped) -> bool
47
+
48
+ # : (untyped) -> bool
49
+ def habtm_reflection?: (untyped) -> bool
50
+
51
+ # : (String, String) -> String
52
+ def join_path: (String, String) -> String
53
+ end
54
+ end
@@ -0,0 +1,56 @@
1
+ # Generated from lib/paper_trail_diff/branch_snapshot_refresher.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Reconstructs selected root branches and merges them into a prior immutable snapshot.
5
+ class BranchSnapshotRefresher
6
+ # : (tree: AssociationTree, ignore_policy: IgnorePolicy, traversal: AssociationTraversal, pool: SnapshotPool, normalizer: SnapshotNormalizer, full_snapshotter: untyped, partial_snapshotter: untyped, association_reader: untyped) -> void
7
+ def initialize: (tree: AssociationTree, ignore_policy: IgnorePolicy, traversal: AssociationTraversal, pool: SnapshotPool, normalizer: SnapshotNormalizer, full_snapshotter: untyped, partial_snapshotter: untyped, association_reader: untyped) -> void
8
+
9
+ # : (untyped, untyped, RecordSnapshot?, event: ActivityEvent) -> RecordSnapshot?
10
+ def advance_root: (untyped, untyped, RecordSnapshot?, event: ActivityEvent) -> RecordSnapshot?
11
+
12
+ # : (untyped, untyped, RecordSnapshot?, Array[String], ?event: ActivityEvent?, ?isolated: bool) -> RecordSnapshot?
13
+ def call: (untyped, untyped, RecordSnapshot?, Array[String], ?event: ActivityEvent?, ?isolated: bool) -> RecordSnapshot?
14
+
15
+ private
16
+
17
+ @components: Hash[Array[String], [ AssociationTree, SnapshotNormalizer ]]
18
+
19
+ @event_refresher: ActivityEventSnapshotRefresher
20
+
21
+ @full_snapshotter: untyped
22
+
23
+ @ignore_policy: IgnorePolicy
24
+
25
+ @partial_snapshotter: untyped
26
+
27
+ @pool: SnapshotPool
28
+
29
+ @root_refresher: ActivityRootSnapshotRefresher
30
+
31
+ @traversal: AssociationTraversal
32
+
33
+ @tree: AssociationTree
34
+
35
+ # : (Array[untyped], RecordSnapshot, Array[String], ActivityEvent?, bool) -> [bool, RecordSnapshot?]
36
+ def incremental_event: (Array[untyped], RecordSnapshot, Array[String], ActivityEvent?, bool) -> [ bool, RecordSnapshot? ]
37
+
38
+ # : (untyped, untyped, RecordSnapshot, Array[String], ActivityEvent) -> RecordSnapshot?
39
+ def refresh_independent_branches: (untyped, untyped, RecordSnapshot, Array[String], ActivityEvent) -> RecordSnapshot?
40
+
41
+ # : (untyped, untyped, Array[String]) -> RecordSnapshot?
42
+ def partial_snapshot: (untyped, untyped, Array[String]) -> RecordSnapshot?
43
+
44
+ # : (Array[String]) -> [AssociationTree, SnapshotNormalizer]
45
+ def components: (Array[String]) -> [ AssociationTree, SnapshotNormalizer ]
46
+
47
+ # : (Array[String]) -> [AssociationTree, SnapshotNormalizer]
48
+ def build_components: (Array[String]) -> [ AssociationTree, SnapshotNormalizer ]
49
+
50
+ # : (untyped, untyped) -> RecordSnapshot?
51
+ def full_snapshot: (untyped, untyped) -> RecordSnapshot?
52
+
53
+ # : (RecordSnapshot, RecordSnapshot) -> RecordSnapshot
54
+ def merge: (RecordSnapshot, RecordSnapshot) -> RecordSnapshot
55
+ end
56
+ end
@@ -0,0 +1,67 @@
1
+ # Generated from lib/paper_trail_diff/configuration.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # An immutable, bounded tree built from explicit association paths.
5
+ class AssociationTree
6
+ attr_reader children: Hash[String, AssociationTree]
7
+
8
+ # : (untyped) -> AssociationTree
9
+ def self.build: (untyped) -> AssociationTree
10
+
11
+ # : (Hash[String, untyped], String) -> void
12
+ private def self.add_path: (Hash[String, untyped], String) -> void
13
+
14
+ # : (Hash[String, untyped]) -> AssociationTree
15
+ private def self.from_hash: (Hash[String, untyped]) -> AssociationTree
16
+
17
+ # : (untyped) -> bool
18
+ private def self.valid_values?: (untyped) -> bool
19
+
20
+ # : (Hash[String, AssociationTree]) -> void
21
+ def initialize: (Hash[String, AssociationTree]) -> void
22
+
23
+ # : () -> bool
24
+ def empty?: () -> bool
25
+
26
+ # : (String | Symbol) -> AssociationTree?
27
+ def child: (String | Symbol) -> AssociationTree?
28
+
29
+ # : (Array[String]) -> AssociationTree
30
+ def select: (Array[String]) -> AssociationTree
31
+
32
+ # : (?prefix: String) -> Array[String]
33
+ def paths: (?prefix: String) -> Array[String]
34
+ end
35
+
36
+ # Immutable rules for globally and path-specifically excluded attributes.
37
+ class IgnorePolicy
38
+ ROOT_PATH: ::String
39
+
40
+ VALID_KEYS: untyped
41
+
42
+ # : (untyped, association_paths: Array[String]) -> IgnorePolicy
43
+ def self.build: (untyped, association_paths: Array[String]) -> IgnorePolicy
44
+
45
+ # : (Hash[untyped, untyped]) -> Hash[String, untyped]
46
+ private def self.normalize_options: (Hash[untyped, untyped]) -> Hash[String, untyped]
47
+
48
+ # : (untyped, Array[String]) -> Hash[String, Array[String]]
49
+ private def self.normalize_paths: (untyped, Array[String]) -> Hash[String, Array[String]]
50
+
51
+ # : (Hash[String, Array[String]], untyped, untyped, Array[String]) -> void
52
+ private def self.add_path_rule: (Hash[String, Array[String]], untyped, untyped, Array[String]) -> void
53
+
54
+ # : (untyped, context: String) -> Array[String]
55
+ private def self.normalize_names: (untyped, context: String) -> Array[String]
56
+
57
+ attr_reader all: Array[String]
58
+
59
+ attr_reader paths: Hash[String, Array[String]]
60
+
61
+ # : (all: Array[String], paths: Hash[String, Array[String]]) -> void
62
+ def initialize: (all: Array[String], paths: Hash[String, Array[String]]) -> void
63
+
64
+ # : (String) -> Array[String]
65
+ def attributes_for: (String) -> Array[String]
66
+ end
67
+ end
@@ -0,0 +1,109 @@
1
+ # Generated from lib/paper_trail_diff/diagnostics.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # One immutable historical-reconstruction setup finding.
5
+ class DiagnosticIssue
6
+ attr_reader severity: Symbol
7
+
8
+ attr_reader code: Symbol
9
+
10
+ attr_reader message: String
11
+
12
+ attr_reader path: String?
13
+
14
+ attr_reader version_id: untyped
15
+
16
+ # : (severity: Symbol, code: Symbol, message: String, ?path: String?, ?version_id: untyped) -> void
17
+ def initialize: (severity: Symbol, code: Symbol, message: String, ?path: String?, ?version_id: untyped) -> void
18
+
19
+ # : () -> Hash[Symbol, untyped]
20
+ def to_h: () -> Hash[Symbol, untyped]
21
+ end
22
+
23
+ # Immutable diagnostics for a requested historical association comparison.
24
+ class DiagnosticReport
25
+ attr_reader issues: Array[DiagnosticIssue]
26
+
27
+ # : (issues: Array[DiagnosticIssue]) -> void
28
+ def initialize: (issues: Array[DiagnosticIssue]) -> void
29
+
30
+ # : () -> Array[DiagnosticIssue]
31
+ def errors: () -> Array[DiagnosticIssue]
32
+
33
+ # : () -> Array[DiagnosticIssue]
34
+ def warnings: () -> Array[DiagnosticIssue]
35
+
36
+ # : () -> bool
37
+ def ok?: () -> bool
38
+
39
+ # : () -> Hash[Symbol, untyped]
40
+ def to_h: () -> Hash[Symbol, untyped]
41
+ end
42
+
43
+ # Performs read-only checks for known PaperTrail/PT-AT reconstruction hazards.
44
+ class HistoryDiagnostics
45
+ # : (untyped, untyped, associations: Array[String | Symbol]) -> void
46
+ def initialize: (untyped, untyped, associations: Array[String | Symbol]) -> void
47
+
48
+ # : () -> DiagnosticReport
49
+ def call: () -> DiagnosticReport
50
+
51
+ private
52
+
53
+ @from_version: untyped
54
+
55
+ @issues: Array[DiagnosticIssue]
56
+
57
+ @to_version: untyped
58
+
59
+ @tree: AssociationTree
60
+
61
+ # : () -> untyped
62
+ def validated_model_class: () -> untyped
63
+
64
+ # : (Array[Array[untyped]]) -> void
65
+ def inspect_targets: (Array[Array[untyped]]) -> void
66
+
67
+ # : (Array[Array[untyped]]) -> void
68
+ def inspect_habtm: (Array[Array[untyped]]) -> void
69
+
70
+ # : (untyped) -> void
71
+ def inspect_checkpoint_timestamp: (untyped) -> void
72
+
73
+ # : (Array[String]) -> void
74
+ def inspect_transaction_metadata: (Array[String]) -> void
75
+
76
+ # : (untyped, String) -> void
77
+ def inspect_versioned_model: (untyped, String) -> void
78
+
79
+ # : (untyped, String) -> void
80
+ def inspect_through_model: (untyped, String) -> void
81
+
82
+ # : (untyped) -> bool
83
+ def model_versioned?: (untyped) -> bool
84
+
85
+ # : (untyped) -> bool
86
+ def synchronized_timestamp_disabled?: (untyped) -> bool
87
+
88
+ # : () -> bool
89
+ def association_tracking_available?: () -> bool
90
+
91
+ # : (untyped) -> Array[String]
92
+ def version_identity: (untyped) -> Array[String]
93
+
94
+ # : (untyped) -> String
95
+ def version_type: (untyped) -> String
96
+
97
+ # : () -> String
98
+ def tracking_unavailable_message: () -> String
99
+
100
+ # : (Symbol, String, ?String?, ?untyped) -> void
101
+ def add_error: (Symbol, String, ?String?, ?untyped) -> void
102
+
103
+ # : (Symbol, String, ?String?) -> void
104
+ def add_warning: (Symbol, String, ?String?) -> void
105
+
106
+ # : (Symbol, Symbol, String, String?, untyped) -> void
107
+ def add_issue: (Symbol, Symbol, String, String?, untyped) -> void
108
+ end
109
+ end
@@ -0,0 +1,30 @@
1
+ # Generated from lib/paper_trail_diff/endpoint.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Validates and describes explicit PaperTrail-version and live-record endpoints.
5
+ module Endpoint
6
+ # : (untyped, untyped) -> void
7
+ def self?.validate_pair!: (untyped, untyped) -> void
8
+
9
+ # : (untyped) -> void
10
+ def self?.validate!: (untyped) -> void
11
+
12
+ # : (untyped) -> bool
13
+ def self?.version?: (untyped) -> bool
14
+
15
+ # : (untyped) -> bool
16
+ def self?.record?: (untyped) -> bool
17
+
18
+ # : (untyped) -> Array[String]
19
+ def self?.identity: (untyped) -> Array[String]
20
+
21
+ # : (untyped) -> untyped
22
+ def self?.model_class: (untyped) -> untyped
23
+
24
+ # : (untyped) -> untyped
25
+ def self?.reload_record: (untyped) -> untyped
26
+
27
+ # : (untyped) -> void
28
+ def self?.validate_record!: (untyped) -> void
29
+ end
30
+ end
@@ -0,0 +1,54 @@
1
+ # Generated from lib/paper_trail_diff/engine.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Pure snapshot comparison. This class has no ActiveRecord or PaperTrail dependencies.
5
+ class Engine
6
+ # : (RecordSnapshot?, RecordSnapshot?) -> Diff
7
+ def self.compare: (RecordSnapshot?, RecordSnapshot?) -> Diff
8
+
9
+ # : (Hash[String, untyped], Hash[String, untyped]) -> Hash[String, ValueChange]
10
+ private def self.compare_attributes: (Hash[String, untyped], Hash[String, untyped]) -> Hash[String, ValueChange]
11
+
12
+ # : (association_snapshots, association_snapshots) -> association_diffs
13
+ private def self.compare_associations: (association_snapshots, association_snapshots) -> association_diffs
14
+
15
+ # : (AssociationSnapshot?, AssociationSnapshot?) -> [AssociationSnapshot, AssociationSnapshot]
16
+ private def self.association_pair: (AssociationSnapshot?, AssociationSnapshot?) -> [ AssociationSnapshot, AssociationSnapshot ]
17
+
18
+ # : (AssociationSnapshot?, AssociationSnapshot?) -> void
19
+ private def self.validate_association_kinds!: (AssociationSnapshot?, AssociationSnapshot?) -> void
20
+
21
+ # : (AssociationSnapshot?, AssociationSnapshot?) -> bool
22
+ private def self.kinds_differ?: (AssociationSnapshot?, AssociationSnapshot?) -> bool
23
+
24
+ # : (AssociationSnapshot, AssociationSnapshot) -> association_diff
25
+ private def self.compare_association: (AssociationSnapshot, AssociationSnapshot) -> association_diff
26
+
27
+ # : (AssociationSnapshot, AssociationSnapshot) -> ToOneAssociationDiff
28
+ private def self.compare_to_one: (AssociationSnapshot, AssociationSnapshot) -> ToOneAssociationDiff
29
+
30
+ # : (RecordSnapshot?, RecordSnapshot?) -> ValueChange?
31
+ private def self.relationship_change: (RecordSnapshot?, RecordSnapshot?) -> ValueChange?
32
+
33
+ # : (RecordSnapshot, RecordSnapshot) -> RecordChange?
34
+ private def self.compare_record: (RecordSnapshot, RecordSnapshot) -> RecordChange?
35
+
36
+ # : (AssociationSnapshot, AssociationSnapshot) -> CollectionAssociationDiff
37
+ private def self.compare_collection: (AssociationSnapshot, AssociationSnapshot) -> CollectionAssociationDiff
38
+
39
+ # : (Hash[identity, RecordSnapshot], Hash[identity, RecordSnapshot]) -> Array[RecordSnapshot]
40
+ private def self.records_missing_from: (Hash[identity, RecordSnapshot], Hash[identity, RecordSnapshot]) -> Array[RecordSnapshot]
41
+
42
+ # : (Hash[identity, RecordSnapshot], Hash[identity, RecordSnapshot]) -> Array[RecordChange]
43
+ private def self.changed_records: (Hash[identity, RecordSnapshot], Hash[identity, RecordSnapshot]) -> Array[RecordChange]
44
+
45
+ # : (Array[RecordSnapshot]) -> Hash[Array[untyped], RecordSnapshot]
46
+ private def self.index_records: (Array[RecordSnapshot]) -> Hash[Array[untyped], RecordSnapshot]
47
+
48
+ # : (Array[Array[untyped]]) -> Array[Array[untyped]]
49
+ private def self.sorted_identities: (Array[Array[untyped]]) -> Array[Array[untyped]]
50
+
51
+ # : (RecordSnapshot?, RecordSnapshot?) -> bool
52
+ private def self.same_identity?: (RecordSnapshot?, RecordSnapshot?) -> bool
53
+ end
54
+ end
@@ -0,0 +1,43 @@
1
+ # Generated from lib/paper_trail_diff/errors.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Base error for failures detected by paper_trail_diff.
5
+ class Error < StandardError
6
+ end
7
+
8
+ # Raised when a public option has an invalid type, key, value, or path.
9
+ class ConfigurationError < Error
10
+ end
11
+
12
+ # Raised when compare endpoints do not belong to the same PaperTrail item.
13
+ class VersionMismatchError < Error
14
+ end
15
+
16
+ # Raised when a live endpoint is not a clean, persisted ActiveRecord record.
17
+ class InvalidEndpointError < Error
18
+ end
19
+
20
+ # Raised when a timeline boundary is absent or the requested range is reversed.
21
+ class InvalidTimelineRangeError < Error
22
+ end
23
+
24
+ # Raised when a requested ActiveRecord association does not exist.
25
+ class UnknownAssociationError < Error
26
+ end
27
+
28
+ # Raised when a requested association macro is not supported.
29
+ class UnsupportedAssociationError < Error
30
+ end
31
+
32
+ # Raised when association comparison is requested without an available PT-AT setup.
33
+ class AssociationTrackingUnavailableError < Error
34
+ end
35
+
36
+ # Raised when recorded PT-AT metadata cannot reliably reconstruct a selected association.
37
+ class IncompleteAssociationHistoryError < Error
38
+ end
39
+
40
+ # Raised when current-ended activity cannot be reconstructed for a selected association.
41
+ class UnsupportedLiveActivityError < Error
42
+ end
43
+ end
@@ -0,0 +1,37 @@
1
+ # Generated from lib/paper_trail_diff/historical_association_reifier.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Reconstructs selected nested edges at one root PaperTrail endpoint.
5
+ class HistoricalAssociationReifier
6
+ # : (untyped, ?habtm_version: untyped) -> void
7
+ def initialize: (untyped, ?habtm_version: untyped) -> void
8
+
9
+ # : (untyped, Array[untyped]) -> void
10
+ def reify: (untyped, Array[untyped]) -> void
11
+
12
+ private
13
+
14
+ @habtm_transaction_id: untyped
15
+
16
+ @reified_associations: Hash[Array[untyped], bool]
17
+
18
+ @transaction_id: untyped
19
+
20
+ @version_at: untyped
21
+
22
+ # : (untyped, untyped) -> void
23
+ def reify_association: (untyped, untyped) -> void
24
+
25
+ # : (untyped, untyped) -> void
26
+ def reify_has_many: (untyped, untyped) -> void
27
+
28
+ # : (untyped, untyped) -> void
29
+ def reify_habtm: (untyped, untyped) -> void
30
+
31
+ # : () -> Hash[Symbol, untyped]
32
+ def options: () -> Hash[Symbol, untyped]
33
+
34
+ # : (Symbol) -> untyped
35
+ def reifier: (Symbol) -> untyped
36
+ end
37
+ end
@@ -0,0 +1,50 @@
1
+ # Generated from lib/paper_trail_diff/historical_snapshot_store.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Reconstructs and caches immutable historical snapshots for one adapter configuration.
5
+ class HistoricalSnapshotStore
6
+ # : (tree: AssociationTree, traversal: AssociationTraversal, normalizer: SnapshotNormalizer, preparer: untyped) -> void
7
+ def initialize: (tree: AssociationTree, traversal: AssociationTraversal, normalizer: SnapshotNormalizer, 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?
16
+ def uncached: (untyped, untyped) -> RecordSnapshot?
17
+
18
+ # : (untyped, untyped, tree: AssociationTree, normalizer: SnapshotNormalizer) -> RecordSnapshot?
19
+ def custom: (untyped, untyped, tree: AssociationTree, normalizer: SnapshotNormalizer) -> RecordSnapshot?
20
+
21
+ # : (untyped, habtm_version: untyped) -> untyped
22
+ def association_reader: (untyped, habtm_version: untyped) -> untyped
23
+
24
+ private
25
+
26
+ @normalizer: SnapshotNormalizer
27
+
28
+ @prepared_history: PreparedHistory?
29
+
30
+ @preparer: untyped
31
+
32
+ @snapshots: Hash[Array[untyped], RecordSnapshot?]
33
+
34
+ @traversal: AssociationTraversal
35
+
36
+ @tree: AssociationTree
37
+
38
+ # : (untyped, untyped, tree: AssociationTree, normalizer: SnapshotNormalizer) -> RecordSnapshot?
39
+ def snapshot_from_version: (untyped, untyped, tree: AssociationTree, normalizer: SnapshotNormalizer) -> RecordSnapshot?
40
+
41
+ # : (untyped, untyped, tree: AssociationTree, normalizer: SnapshotNormalizer) -> RecordSnapshot?
42
+ def snapshot_from_live_root: (untyped, untyped, tree: AssociationTree, normalizer: SnapshotNormalizer) -> RecordSnapshot?
43
+
44
+ # : (untyped, untyped, tree: AssociationTree, normalizer: SnapshotNormalizer, habtm_version: untyped) -> RecordSnapshot?
45
+ def normalize: (untyped, untyped, tree: AssociationTree, normalizer: SnapshotNormalizer, habtm_version: untyped) -> RecordSnapshot?
46
+
47
+ # : (untyped, untyped) -> Array[untyped]
48
+ def snapshot_key: (untyped, untyped) -> Array[untyped]
49
+ end
50
+ end
@@ -0,0 +1,9 @@
1
+ # Generated from lib/paper_trail_diff/live_association_reader.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Leaves live ActiveRecord associations untouched while sharing snapshot normalization.
5
+ class LiveAssociationReader
6
+ # : (untyped, Array[untyped]) -> void
7
+ def reify: (untyped, Array[untyped]) -> void
8
+ end
9
+ end
@@ -0,0 +1,72 @@
1
+ # Generated from lib/paper_trail_diff/paper_trail_adapter.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # PaperTrail/ActiveRecord boundary that produces plain record snapshots.
5
+ class PaperTrailAdapter
6
+ # : (associations: Array[String | Symbol], ignore: ignore_option) -> void
7
+ def initialize: (associations: Array[String | Symbol], ignore: ignore_option) -> void
8
+
9
+ # : (untyped, untyped) -> Diff
10
+ def compare: (untyped, untyped) -> Diff
11
+
12
+ # : (untyped, from: untyped, to: untyped) -> Array[Step]
13
+ def timeline: (untyped, from: untyped, to: untyped) -> Array[Step]
14
+
15
+ # : (untyped, from: untyped, to: untyped) -> Array[ActivityStep]
16
+ def activity_timeline: (untyped, from: untyped, to: untyped) -> Array[ActivityStep]
17
+
18
+ # : (untyped, from: untyped, to: untyped, ?activity: bool) -> Analysis
19
+ def analyze: (untyped, from: untyped, to: untyped, ?activity: bool) -> Analysis
20
+
21
+ private
22
+
23
+ @activity_snapshotter: ActivitySnapshotProvider
24
+
25
+ @association_tree: AssociationTree
26
+
27
+ @historical_store: HistoricalSnapshotStore
28
+
29
+ @ignore_policy: IgnorePolicy
30
+
31
+ @normalizer: SnapshotNormalizer
32
+
33
+ @snapshot_pool: SnapshotPool
34
+
35
+ @timeline_snapshotter: TimelineSnapshotProvider
36
+
37
+ @traversal: AssociationTraversal
38
+
39
+ # : () -> HistoricalSnapshotStore
40
+ def build_historical_store: () -> HistoricalSnapshotStore
41
+
42
+ # : () -> ActivitySnapshotProvider
43
+ def build_activity_snapshotter: () -> ActivitySnapshotProvider
44
+
45
+ # : (untyped, from: untyped, to: untyped) -> ActivityTimelineBuilder
46
+ def activity_builder: (untyped, from: untyped, to: untyped) -> ActivityTimelineBuilder
47
+
48
+ # : (untyped) -> void
49
+ def reject_live_habtm_activity!: (untyped) -> void
50
+
51
+ # : (untyped) -> RecordSnapshot?
52
+ def snapshot_for_endpoint: (untyped) -> RecordSnapshot?
53
+
54
+ # : (untyped) -> RecordSnapshot?
55
+ def historical_snapshot: (untyped) -> RecordSnapshot?
56
+
57
+ # : (untyped) -> RecordSnapshot?
58
+ def uncached_historical_snapshot: (untyped) -> RecordSnapshot?
59
+
60
+ # : (untyped, untyped) -> RecordSnapshot?
61
+ def snapshot_at: (untyped, untyped) -> RecordSnapshot?
62
+
63
+ # : (untyped) -> RecordSnapshot
64
+ def live_snapshot: (untyped) -> RecordSnapshot
65
+
66
+ # : (untyped, historical: bool) -> void
67
+ def prepare_traversal!: (untyped, historical: bool) -> void
68
+
69
+ # : () -> void
70
+ def ensure_association_tracking!: () -> void
71
+ end
72
+ end
@@ -0,0 +1,27 @@
1
+ # Generated from lib/paper_trail_diff/prepared_association_reifier.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Resolves indexed associations and delegates unsupported reflections to PT-AT.
5
+ class PreparedAssociationReifier
6
+ # : (PreparedHistory, untyped, habtm_boundary: untyped, fallback: HistoricalAssociationReifier) -> void
7
+ def initialize: (PreparedHistory, untyped, habtm_boundary: untyped, fallback: HistoricalAssociationReifier) -> void
8
+
9
+ # : (untyped, Array[untyped]) -> void
10
+ def reify: (untyped, Array[untyped]) -> void
11
+
12
+ private
13
+
14
+ @boundary: untyped
15
+
16
+ @fallback: HistoricalAssociationReifier
17
+
18
+ @habtm_boundary: untyped
19
+
20
+ @history: PreparedHistory
21
+
22
+ @reified: Hash[Array[untyped], bool]
23
+
24
+ # : (untyped, untyped) -> void
25
+ def reify_association: (untyped, untyped) -> void
26
+ end
27
+ end