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,65 @@
1
+ # Generated from lib/paper_trail_diff/prepared_edge_loader.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Loads every historical identity that can participate in one association edge.
5
+ class PreparedEdgeLoader
6
+ EDGE_LOADERS: untyped
7
+
8
+ # : (PreparedRecordIndex, Array[untyped]) -> void
9
+ def initialize: (PreparedRecordIndex, Array[untyped]) -> void
10
+
11
+ # : (untyped, Array[untyped], untyped) -> [Hash[String, Hash[Symbol, untyped]], Hash[String, Array[untyped]]?]
12
+ def call: (untyped, Array[untyped], untyped) -> [ Hash[String, Hash[Symbol, untyped]], Hash[String, Array[untyped]]? ]
13
+
14
+ private
15
+
16
+ @records: PreparedRecordIndex
17
+
18
+ @transaction_ids: Array[untyped]
19
+
20
+ # : (untyped, Array[untyped], untyped) -> [Hash[String, Hash[Symbol, untyped]], nil]
21
+ def belongs_to_edge: (untyped, Array[untyped], untyped) -> [ Hash[String, Hash[Symbol, untyped]], nil ]
22
+
23
+ # : (untyped, Array[untyped], untyped) -> [Hash[String, Hash[Symbol, untyped]], nil]
24
+ def child_edge: (untyped, Array[untyped], untyped) -> [ Hash[String, Hash[Symbol, untyped]], nil ]
25
+
26
+ # : (untyped, Array[untyped], untyped) -> [Hash[String, Hash[Symbol, untyped]], Hash[String, Array[untyped]]]
27
+ def habtm_edge: (untyped, Array[untyped], untyped) -> [ Hash[String, Hash[Symbol, untyped]], Hash[String, Array[untyped]] ]
28
+
29
+ # : (untyped, Array[untyped], untyped) -> Hash[String, Hash[Symbol, untyped]]
30
+ def belongs_to_groups: (untyped, Array[untyped], untyped) -> Hash[String, Hash[Symbol, untyped]]
31
+
32
+ # : (untyped, Array[untyped], untyped) -> Hash[String, Hash[Symbol, untyped]]
33
+ def child_groups: (untyped, Array[untyped], untyped) -> Hash[String, Hash[Symbol, untyped]]
34
+
35
+ # : (untyped, untyped) -> [Hash[String, Hash[Symbol, untyped]], Hash[String, Array[untyped]]]
36
+ def habtm_groups: (untyped, untyped) -> [ Hash[String, Hash[Symbol, untyped]], Hash[String, Array[untyped]] ]
37
+
38
+ # : (untyped, untyped) -> Array[untyped]
39
+ def habtm_rows: (untyped, untyped) -> Array[untyped]
40
+
41
+ # : (Array[untyped], untyped) -> Array[untyped]
42
+ def membership_ids: (Array[untyped], untyped) -> Array[untyped]
43
+
44
+ # : (untyped, Array[untyped], untyped, String) -> Array[untyped]
45
+ def historical_child_ids: (untyped, Array[untyped], untyped, String) -> Array[untyped]
46
+
47
+ # : (untyped, Array[untyped], untyped, String) -> Array[untyped]
48
+ def live_child_ids: (untyped, Array[untyped], untyped, String) -> Array[untyped]
49
+
50
+ # : (untyped, untyped) -> untyped
51
+ def target_class: (untyped, untyped) -> untyped
52
+
53
+ # : (Hash[String, Hash[Symbol, untyped]], untyped, untyped) -> void
54
+ def add_identity: (Hash[String, Hash[Symbol, untyped]], untyped, untyped) -> void
55
+
56
+ # : (untyped, Array[untyped]) -> Hash[String, Hash[Symbol, untyped]]
57
+ def group_for: (untyped, Array[untyped]) -> Hash[String, Hash[Symbol, untyped]]
58
+
59
+ # : (untyped) -> String?
60
+ def scalar_foreign_key: (untyped) -> String?
61
+
62
+ # : (untyped) -> Array[String?]
63
+ def parent_types: (untyped) -> Array[String?]
64
+ end
65
+ end
@@ -0,0 +1,93 @@
1
+ # Generated from lib/paper_trail_diff/prepared_history.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Batched record states and relationship candidates for one activity range.
5
+ class PreparedHistory
6
+ DIRECT_RESOLVERS: untyped
7
+
8
+ # : (PreparedRecordIndex) -> void
9
+ def initialize: (PreparedRecordIndex) -> void
10
+
11
+ # : (untyped, untyped, Hash[String, Hash[Symbol, untyped]]) -> void
12
+ def merge_edge: (untyped, untyped, Hash[String, Hash[Symbol, untyped]]) -> void
13
+
14
+ # : (untyped, untyped) -> Hash[String, Hash[Symbol, untyped]]
15
+ def edge: (untyped, untyped) -> Hash[String, Hash[Symbol, untyped]]
16
+
17
+ # : (untyped, untyped) -> void
18
+ def mark_unsupported: (untyped, untyped) -> void
19
+
20
+ # : (untyped, untyped, Hash[String, Array[untyped]]) -> void
21
+ def register_habtm: (untyped, untyped, Hash[String, Array[untyped]]) -> void
22
+
23
+ # : (untyped, untyped, untyped, habtm_boundary: untyped) -> [bool, Array[untyped]]
24
+ def resolve: (untyped, untyped, untyped, habtm_boundary: untyped) -> [ bool, Array[untyped] ]
25
+
26
+ private
27
+
28
+ @edges: Hash[Array[String], Hash[String, Hash[Symbol, untyped]]]
29
+
30
+ @habtm: Hash[Array[String], Hash[String, Array[untyped]]]
31
+
32
+ @records: PreparedRecordIndex
33
+
34
+ @unsupported: Hash[Array[String], bool]
35
+
36
+ # : (untyped, untyped) -> bool
37
+ def supported?: (untyped, untyped) -> bool
38
+
39
+ # : (untyped) -> bool
40
+ def default_scoped?: (untyped) -> bool
41
+
42
+ # : (untyped, untyped, untyped, untyped) -> Array[untyped]?
43
+ def direct_records: (untyped, untyped, untyped, untyped) -> Array[untyped]?
44
+
45
+ # : (untyped, untyped, untyped, untyped) -> Array[untyped]?
46
+ def resolve_belongs_to: (untyped, untyped, untyped, untyped) -> Array[untyped]?
47
+
48
+ # : (untyped, untyped, untyped, untyped) -> Array[untyped]
49
+ def resolve_children: (untyped, untyped, untyped, untyped) -> Array[untyped]
50
+
51
+ # : (untyped, untyped, untyped, untyped) -> Array[untyped]?
52
+ def resolve_habtm: (untyped, untyped, untyped, untyped) -> Array[untyped]?
53
+
54
+ # : (untyped, untyped, untyped) -> Array[untyped]?
55
+ def belongs_to_records: (untyped, untyped, untyped) -> Array[untyped]?
56
+
57
+ # : (untyped, untyped, untyped) -> Array[untyped]
58
+ def child_records: (untyped, untyped, untyped) -> Array[untyped]
59
+
60
+ # : (untyped, untyped, untyped, untyped) -> Array[untyped]?
61
+ def habtm_records: (untyped, untyped, untyped, untyped) -> Array[untyped]?
62
+
63
+ # : (untyped, untyped, untyped, untyped) -> Array[untyped]?
64
+ def through_records: (untyped, untyped, untyped, untyped) -> Array[untyped]?
65
+
66
+ # : (Array[untyped], untyped, untyped, untyped) -> Array[[bool, Array[untyped]]]
67
+ def resolve_sources: (Array[untyped], untyped, untyped, untyped) -> Array[[ bool, Array[untyped] ]]
68
+
69
+ # : (untyped, untyped, untyped) -> bool
70
+ def member_of?: (untyped, untyped, untyped) -> bool
71
+
72
+ # : (untyped) -> String?
73
+ def scalar_foreign_key: (untyped) -> String?
74
+
75
+ # : (untyped, untyped) -> untyped
76
+ def belongs_to_class: (untyped, untyped) -> untyped
77
+
78
+ # : (untyped, untyped) -> Array[String]
79
+ def owner_types: (untyped, untyped) -> Array[String]
80
+
81
+ # : (untyped) -> untyped
82
+ def transaction_id_for: (untyped) -> untyped
83
+
84
+ # : (Array[untyped]) -> Array[untyped]
85
+ def unique_records: (Array[untyped]) -> Array[untyped]
86
+
87
+ # : (untyped, untyped) -> Array[String]
88
+ def edge_key: (untyped, untyped) -> Array[String]
89
+
90
+ # : (Hash[String, Hash[Symbol, untyped]], Hash[String, Hash[Symbol, untyped]]) -> Hash[String, Hash[Symbol, untyped]]
91
+ def merge_groups: (Hash[String, Hash[Symbol, untyped]], Hash[String, Hash[Symbol, untyped]]) -> Hash[String, Hash[Symbol, untyped]]
92
+ end
93
+ end
@@ -0,0 +1,67 @@
1
+ # Generated from lib/paper_trail_diff/prepared_history_loader.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Expands the explicit association tree into a request-scoped PreparedHistory.
5
+ class PreparedHistoryLoader
6
+ # : (untyped, root_versions: Array[untyped], tree: AssociationTree, traversal: AssociationTraversal) -> void
7
+ def initialize: (untyped, root_versions: Array[untyped], tree: AssociationTree, traversal: AssociationTraversal) -> void
8
+
9
+ # : () -> PreparedHistory
10
+ def call: () -> PreparedHistory
11
+
12
+ private
13
+
14
+ @edges: PreparedEdgeLoader
15
+
16
+ @history: PreparedHistory
17
+
18
+ @prepared: Hash[Array[String], Array[String]]
19
+
20
+ @record: untyped
21
+
22
+ @records: PreparedRecordIndex
23
+
24
+ @traversal: AssociationTraversal
25
+
26
+ @tree: AssociationTree
27
+
28
+ # : (untyped, Array[untyped], AssociationTree, path: String) -> void
29
+ def load_node: (untyped, Array[untyped], AssociationTree, path: String) -> void
30
+
31
+ # : (untyped, Array[untyped], untyped) -> Hash[String, Hash[Symbol, untyped]]
32
+ def prepare_reflection: (untyped, Array[untyped], untyped) -> Hash[String, Hash[Symbol, untyped]]
33
+
34
+ # : (untyped, Array[untyped], untyped) -> Hash[String, Hash[Symbol, untyped]]
35
+ def prepare_through: (untyped, Array[untyped], untyped) -> Hash[String, Hash[Symbol, untyped]]
36
+
37
+ # : (untyped, Array[untyped], untyped) -> Hash[String, Hash[Symbol, untyped]]
38
+ def prepare_edge: (untyped, Array[untyped], untyped) -> Hash[String, Hash[Symbol, untyped]]
39
+
40
+ # : (untyped, Array[untyped], untyped) -> Array[untyped]
41
+ def unprepared_ids: (untyped, Array[untyped], untyped) -> Array[untyped]
42
+
43
+ # : (untyped, Array[untyped], untyped) -> void
44
+ def mark_prepared: (untyped, Array[untyped], untyped) -> void
45
+
46
+ # : (untyped, untyped, Hash[String, Hash[Symbol, untyped]]) -> void
47
+ def mark_unsupported: (untyped, untyped, Hash[String, Hash[Symbol, untyped]]) -> void
48
+
49
+ # : (untyped) -> bool
50
+ def deferred_macro?: (untyped) -> bool
51
+
52
+ # : (Hash[String, Hash[Symbol, untyped]]) -> void
53
+ def load_groups: (Hash[String, Hash[Symbol, untyped]]) -> void
54
+
55
+ # : (untyped, Array[untyped]) -> void
56
+ def load_records: (untyped, Array[untyped]) -> void
57
+
58
+ # : (untyped) -> bool
59
+ def versioned?: (untyped) -> bool
60
+
61
+ # : (untyped, untyped) -> Array[String]
62
+ def edge_key: (untyped, untyped) -> Array[String]
63
+
64
+ # : (Hash[String, Hash[Symbol, untyped]], Hash[String, Hash[Symbol, untyped]]) -> Hash[String, Hash[Symbol, untyped]]
65
+ def merge_groups: (Hash[String, Hash[Symbol, untyped]], Hash[String, Hash[Symbol, untyped]]) -> Hash[String, Hash[Symbol, untyped]]
66
+ end
67
+ end
@@ -0,0 +1,84 @@
1
+ # Generated from lib/paper_trail_diff/prepared_record_index.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Immutable scalar state from a PaperTrail version or live-record fallback.
5
+ class PreparedRecordState
6
+ # : (untyped) -> void
7
+ def initialize: (untyped) -> void
8
+
9
+ # : () -> untyped
10
+ def instantiate: () -> untyped
11
+
12
+ @attributes: Hash[untyped, untyped]
13
+
14
+ @model_class: untyped
15
+ end
16
+
17
+ # Versions and live fallback for one model identity.
18
+ class PreparedRecordSeries
19
+ attr_reader versions: Array[untyped]
20
+
21
+ # : (versions: Array[untyped], live: PreparedRecordState?) -> void
22
+ def initialize: (versions: Array[untyped], live: PreparedRecordState?) -> void
23
+
24
+ # : (untyped) -> untyped
25
+ def record_before: (untyped) -> untyped
26
+
27
+ # : () -> Array[untyped]
28
+ def records: () -> Array[untyped]
29
+
30
+ private
31
+
32
+ @live: PreparedRecordState?
33
+
34
+ @states: Hash[untyped, PreparedRecordState?]
35
+
36
+ # : (untyped, untyped) -> bool
37
+ def eligible?: (untyped, untyped) -> bool
38
+
39
+ # : (untyped, untyped) -> bool
40
+ def same_transaction?: (untyped, untyped) -> bool
41
+
42
+ # : (untyped) -> PreparedRecordState?
43
+ def state_for: (untyped) -> PreparedRecordState?
44
+ end
45
+
46
+ # Request-scoped scalar history loaded once per model identity.
47
+ class PreparedRecordIndex
48
+ # : (untyped) -> void
49
+ def initialize: (untyped) -> void
50
+
51
+ # : (untyped, Array[untyped]) -> void
52
+ def load: (untyped, Array[untyped]) -> void
53
+
54
+ # : (untyped, untyped, untyped) -> untyped
55
+ def record_before: (untyped, untyped, untyped) -> untyped
56
+
57
+ # : (untyped, Array[untyped]) -> Array[untyped]
58
+ def records_for: (untyped, Array[untyped]) -> Array[untyped]
59
+
60
+ # : (untyped, untyped) -> bool
61
+ def loaded?: (untyped, untyped) -> bool
62
+
63
+ private
64
+
65
+ @series: Hash[Array[String], PreparedRecordSeries]
66
+
67
+ @start_time: untyped
68
+
69
+ # : (untyped, untyped) -> Array[String]
70
+ def identity: (untyped, untyped) -> Array[String]
71
+
72
+ # : (untyped, Array[untyped]) -> Array[untyped]
73
+ def missing_ids: (untyped, Array[untyped]) -> Array[untyped]
74
+
75
+ # : (untyped, untyped, Hash[String, Array[untyped]], Hash[String, untyped]) -> void
76
+ def add_series: (untyped, untyped, Hash[String, Array[untyped]], Hash[String, untyped]) -> void
77
+
78
+ # : (untyped, Array[untyped]) -> Array[untyped]
79
+ def versions_for: (untyped, Array[untyped]) -> Array[untyped]
80
+
81
+ # : (untyped, Array[untyped]) -> Array[untyped]
82
+ def live_records_for: (untyped, Array[untyped]) -> Array[untyped]
83
+ end
84
+ end
@@ -0,0 +1,69 @@
1
+ # Generated from lib/paper_trail_diff/snapshot.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Immutable identity shared by snapshots and stable-record changes.
5
+ class RecordReference
6
+ attr_reader type: String
7
+
8
+ attr_reader id: untyped
9
+
10
+ # : (type: String, id: untyped) -> void
11
+ def initialize: (type: String, id: untyped) -> void
12
+
13
+ # : (reference_key) -> untyped
14
+ def []: (reference_key) -> untyped
15
+
16
+ # : (reference_key) -> untyped
17
+ def fetch: (reference_key) -> untyped
18
+
19
+ # : () -> Hash[Symbol, untyped]
20
+ def to_h: () -> Hash[Symbol, untyped]
21
+ end
22
+
23
+ # A normalized association in a bounded record snapshot tree.
24
+ class AssociationSnapshot
25
+ COLLECTION_KINDS: untyped
26
+
27
+ SUPPORTED_KINDS: untyped
28
+
29
+ # : (Symbol) -> bool
30
+ def self.collection_kind?: (Symbol) -> bool
31
+
32
+ attr_reader kind: Symbol
33
+
34
+ attr_reader records: Array[RecordSnapshot]
35
+
36
+ # : (kind: Symbol, records: Array[RecordSnapshot]) -> void
37
+ def initialize: (kind: Symbol, records: Array[RecordSnapshot]) -> void
38
+
39
+ # : () -> Hash[Symbol, untyped]
40
+ def to_h: () -> Hash[Symbol, untyped]
41
+ end
42
+
43
+ # An immutable, ActiveRecord-independent representation of a reified record.
44
+ class RecordSnapshot
45
+ attr_reader type: String
46
+
47
+ attr_reader id: untyped
48
+
49
+ attr_reader identity: Array[untyped]
50
+
51
+ attr_reader attributes: Hash[String, untyped]
52
+
53
+ attr_reader associations: Hash[String, AssociationSnapshot]
54
+
55
+ # : (type: String, id: untyped, attributes: snapshot_attributes, ?associations: snapshot_associations) -> void
56
+ def initialize: (type: String, id: untyped, attributes: snapshot_attributes, ?associations: snapshot_associations) -> void
57
+
58
+ # : () -> RecordReference
59
+ def reference: () -> RecordReference
60
+
61
+ # : () -> Hash[Symbol, untyped]
62
+ def to_h: () -> Hash[Symbol, untyped]
63
+
64
+ private
65
+
66
+ # : (Hash[untyped, untyped]) -> Hash[String, untyped]
67
+ def normalize_hash: (Hash[untyped, untyped]) -> Hash[String, untyped]
68
+ end
69
+ end
@@ -0,0 +1,76 @@
1
+ # Generated from lib/paper_trail_diff/snapshot_normalizer.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Reuses immutable nodes whose normalized state did not change at a selected path.
5
+ class SnapshotPool
6
+ def initialize: () -> untyped
7
+
8
+ # : (String, RecordSnapshot) -> RecordSnapshot
9
+ def record: (String, RecordSnapshot) -> RecordSnapshot
10
+
11
+ # : (String, AssociationSnapshot) -> AssociationSnapshot
12
+ def association: (String, AssociationSnapshot) -> AssociationSnapshot
13
+
14
+ private
15
+
16
+ @associations: Hash[String, AssociationSnapshot]
17
+
18
+ @records: Hash[Array[untyped], RecordSnapshot]
19
+
20
+ # : (RecordSnapshot, RecordSnapshot) -> bool
21
+ def equivalent_record?: (RecordSnapshot, RecordSnapshot) -> bool
22
+ end
23
+
24
+ # Converts an ActiveRecord graph into immutable, persistence-independent snapshots.
25
+ class SnapshotNormalizer
26
+ # : (tree: AssociationTree, ignore_policy: IgnorePolicy, traversal: AssociationTraversal, ?pool: SnapshotPool) -> void
27
+ def initialize: (tree: AssociationTree, ignore_policy: IgnorePolicy, traversal: AssociationTraversal, ?pool: SnapshotPool) -> void
28
+
29
+ # : (untyped, reifier: untyped) -> RecordSnapshot?
30
+ def call: (untyped, reifier: untyped) -> RecordSnapshot?
31
+
32
+ # Normalizes one member of an already selected association branch.
33
+ # : (untyped, tree: AssociationTree, path: String, incoming: untyped, reifier: untyped) -> RecordSnapshot?
34
+ def call_child: (untyped, tree: AssociationTree, path: String, incoming: untyped, reifier: untyped) -> RecordSnapshot?
35
+
36
+ # Normalizes scalar attributes without traversing or loading associations.
37
+ # : (untyped, tree: AssociationTree, path: String) -> snapshot_attributes
38
+ def attributes_for: (untyped, tree: AssociationTree, path: String) -> snapshot_attributes
39
+
40
+ private
41
+
42
+ @ignore_policy: IgnorePolicy
43
+
44
+ @pool: SnapshotPool
45
+
46
+ @structural_columns: Hash[String, Array[String]]
47
+
48
+ @traversal: AssociationTraversal
49
+
50
+ @tree: AssociationTree
51
+
52
+ # : (untyped, AssociationTree, String, untyped, Array[untyped]) -> RecordSnapshot?
53
+ def normalize_record: (untyped, AssociationTree, String, untyped, Array[untyped]) -> RecordSnapshot?
54
+
55
+ # : (untyped, Array[untyped], String) -> snapshot_attributes
56
+ def normalized_attributes: (untyped, Array[untyped], String) -> snapshot_attributes
57
+
58
+ # : (untyped, Array[untyped], String) -> Array[String]
59
+ def excluded_attributes: (untyped, Array[untyped], String) -> Array[String]
60
+
61
+ # : (Array[untyped]) -> Array[String]
62
+ def relationship_columns: (Array[untyped]) -> Array[String]
63
+
64
+ # : (untyped, AssociationTree, String, untyped, Array[untyped]) -> Hash[String, AssociationSnapshot]
65
+ def normalize_associations: (untyped, AssociationTree, String, untyped, Array[untyped]) -> Hash[String, AssociationSnapshot]
66
+
67
+ # : (untyped, untyped, AssociationTree, String, untyped) -> AssociationSnapshot
68
+ def association_snapshot: (untyped, untyped, AssociationTree, String, untyped) -> AssociationSnapshot
69
+
70
+ # : (Array[untyped], AssociationTree, String, untyped) -> Array[RecordSnapshot]
71
+ def normalize_children: (Array[untyped], AssociationTree, String, untyped) -> Array[RecordSnapshot]
72
+
73
+ # : (untyped, AssociationTree, String) -> Array[untyped]
74
+ def reflections_for: (untyped, AssociationTree, String) -> Array[untyped]
75
+ end
76
+ end
@@ -0,0 +1,18 @@
1
+ # Generated from lib/paper_trail_diff/step.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # One adjacent transition in a PaperTrail timeline.
5
+ class Step
6
+ attr_reader from_version: untyped
7
+
8
+ attr_reader to_version: untyped
9
+
10
+ attr_reader diff: Diff
11
+
12
+ # : (from_version: untyped, to_version: untyped, diff: Diff) -> void
13
+ def initialize: (from_version: untyped, to_version: untyped, diff: Diff) -> void
14
+
15
+ # : () -> Hash[Symbol, untyped]
16
+ def to_h: () -> Hash[Symbol, untyped]
17
+ end
18
+ end
@@ -0,0 +1,30 @@
1
+ # Generated from lib/paper_trail_diff/support.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Internal helpers for isolating and serializing values held by result objects.
5
+ module Support
6
+ # : (untyped) -> untyped
7
+ def self?.immutable_copy: (untyped) -> untyped
8
+
9
+ # : (Hash[untyped, untyped]) -> Hash[untyped, untyped]
10
+ def self?.immutable_hash: (Hash[untyped, untyped]) -> Hash[untyped, untyped]
11
+
12
+ # : (untyped) -> untyped
13
+ def self?.serialize: (untyped) -> untyped
14
+
15
+ # : (untyped) -> Array[untyped]
16
+ def self?.chronological_version_key: (untyped) -> Array[untyped]
17
+
18
+ # : (untyped, untyped) -> Integer
19
+ def self?.compare_versions: (untyped, untyped) -> Integer
20
+
21
+ # : (String, String) -> String
22
+ def self?.association_path: (String, String) -> String
23
+
24
+ # : (untyped) -> untyped
25
+ def self?.duplicate_and_freeze: (untyped) -> untyped
26
+
27
+ # : (untyped) -> bool
28
+ def self?.paper_trail_diff_value?: (untyped) -> bool
29
+ end
30
+ end
@@ -0,0 +1,31 @@
1
+ # Generated from lib/paper_trail_diff/timeline_builder.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Selects and compares a chronological slice of a record's version history.
5
+ class TimelineBuilder
6
+ # : (untyped, from: untyped, to: untyped, snapshotter: untyped) -> void
7
+ def initialize: (untyped, from: untyped, to: untyped, snapshotter: untyped) -> void
8
+
9
+ # : () -> Array[Step]
10
+ def build: () -> Array[Step]
11
+
12
+ # : () -> Analysis
13
+ def analyze: () -> Analysis
14
+
15
+ private
16
+
17
+ @from: untyped
18
+
19
+ @record: untyped
20
+
21
+ @snapshotter: untyped
22
+
23
+ @to: untyped
24
+
25
+ # : (Array[untyped]) -> [Array[Step], RecordSnapshot?, RecordSnapshot?]
26
+ def compare_history: (Array[untyped]) -> [ Array[Step], RecordSnapshot?, RecordSnapshot? ]
27
+
28
+ # : () -> Array[untyped]
29
+ def selected_versions: () -> Array[untyped]
30
+ end
31
+ end
@@ -0,0 +1,17 @@
1
+ # Generated from lib/paper_trail_diff/timeline_snapshot_provider.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Gives TimelineBuilder one-argument access to a range-prepared snapshot store.
5
+ class TimelineSnapshotProvider
6
+ # : (HistoricalSnapshotStore) -> void
7
+ def initialize: (HistoricalSnapshotStore) -> void
8
+
9
+ # : (untyped, Array[untyped]) -> void
10
+ def prepare: (untyped, Array[untyped]) -> void
11
+
12
+ # : (untyped) -> RecordSnapshot?
13
+ def call: (untyped) -> RecordSnapshot?
14
+
15
+ @store: HistoricalSnapshotStore
16
+ end
17
+ end
@@ -0,0 +1,87 @@
1
+ # Generated from lib/paper_trail_diff/value_objects.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # A directional change between two structured values.
5
+ class ValueChange
6
+ attr_reader from: untyped
7
+
8
+ attr_reader to: untyped
9
+
10
+ # : (from: untyped, to: untyped) -> void
11
+ def initialize: (from: untyped, to: untyped) -> void
12
+
13
+ # : () -> Hash[Symbol, untyped]
14
+ def to_h: () -> Hash[Symbol, untyped]
15
+ end
16
+
17
+ # Attribute and nested-association changes for a record whose identity did not change.
18
+ class RecordChange
19
+ attr_reader record: RecordReference
20
+
21
+ attr_reader attributes: Hash[String, ValueChange]
22
+
23
+ attr_reader associations: Hash[String, ToOneAssociationDiff | CollectionAssociationDiff]
24
+
25
+ # : (record: RecordSnapshot, attributes: attribute_changes, ?associations: association_diffs) -> void
26
+ def initialize: (record: RecordSnapshot, attributes: attribute_changes, ?associations: association_diffs) -> void
27
+
28
+ # : () -> Hash[Symbol, untyped]
29
+ def to_h: () -> Hash[Symbol, untyped]
30
+ end
31
+
32
+ # Relationship and associated-record changes for belongs_to or has_one.
33
+ class ToOneAssociationDiff
34
+ attr_reader kind: Symbol
35
+
36
+ attr_reader relationship: ValueChange?
37
+
38
+ attr_reader changed: RecordChange?
39
+
40
+ # : (kind: Symbol, relationship: ValueChange?, changed: RecordChange?) -> void
41
+ def initialize: (kind: Symbol, relationship: ValueChange?, changed: RecordChange?) -> void
42
+
43
+ # : () -> bool
44
+ def empty?: () -> bool
45
+
46
+ # : () -> Hash[Symbol, untyped]
47
+ def to_h: () -> Hash[Symbol, untyped]
48
+ end
49
+
50
+ # Membership and associated-record changes for has_many.
51
+ class CollectionAssociationDiff
52
+ attr_reader kind: Symbol
53
+
54
+ attr_reader added: Array[RecordSnapshot]
55
+
56
+ attr_reader removed: Array[RecordSnapshot]
57
+
58
+ attr_reader changed: Array[RecordChange]
59
+
60
+ # : (kind: Symbol, added: Array[RecordSnapshot], removed: Array[RecordSnapshot], changed: Array[RecordChange]) -> void
61
+ def initialize: (kind: Symbol, added: Array[RecordSnapshot], removed: Array[RecordSnapshot], changed: Array[RecordChange]) -> void
62
+
63
+ # : () -> bool
64
+ def empty?: () -> bool
65
+
66
+ # : () -> Hash[Symbol, untyped]
67
+ def to_h: () -> Hash[Symbol, untyped]
68
+ end
69
+
70
+ # The complete structured difference between two normalized endpoints.
71
+ class Diff
72
+ attr_reader record_presence_change: ValueChange?
73
+
74
+ attr_reader attributes: Hash[String, ValueChange]
75
+
76
+ attr_reader associations: Hash[String, ToOneAssociationDiff | CollectionAssociationDiff]
77
+
78
+ # : (?record_presence_change: ValueChange?, ?attributes: attribute_changes, ?associations: association_diffs) -> void
79
+ def initialize: (?record_presence_change: ValueChange?, ?attributes: attribute_changes, ?associations: association_diffs) -> void
80
+
81
+ # : () -> bool
82
+ def empty?: () -> bool
83
+
84
+ # : () -> Hash[Symbol, untyped]
85
+ def to_h: () -> Hash[Symbol, untyped]
86
+ end
87
+ end
@@ -0,0 +1,5 @@
1
+ # Generated from lib/paper_trail_diff/version.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ VERSION: ::String
5
+ end
@@ -0,0 +1,35 @@
1
+ # Generated from lib/paper_trail_diff/version_range.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # Selects an inclusive, chronological range from a record's root versions.
5
+ class VersionRange
6
+ # : (untyped, from: untyped, to: untyped) -> void
7
+ def initialize: (untyped, from: untyped, to: untyped) -> void
8
+
9
+ # : () -> Array[untyped]
10
+ def select: () -> Array[untyped]
11
+
12
+ # : () -> Array[untyped]
13
+ def select_through_latest: () -> Array[untyped]
14
+
15
+ private
16
+
17
+ @from: untyped
18
+
19
+ @record: untyped
20
+
21
+ @to: untyped
22
+
23
+ # : () -> untyped
24
+ def versions_relation: () -> untyped
25
+
26
+ # : (untyped, ?through: untyped) -> Array[untyped]
27
+ def select_relation: (untyped, ?through: untyped) -> Array[untyped]
28
+
29
+ # : (untyped, untyped, boundary: Symbol) -> void
30
+ def validate_boundary!: (untyped, untyped, boundary: Symbol) -> void
31
+
32
+ # : (untyped, untyped) -> bool
33
+ def valid_boundary?: (untyped, untyped) -> bool
34
+ end
35
+ end