active_version 1.0.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 (76) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +36 -0
  3. data/LICENSE.md +21 -0
  4. data/README.md +492 -0
  5. data/SECURITY.md +29 -0
  6. data/lib/active_version/adapters/active_record/audits.rb +36 -0
  7. data/lib/active_version/adapters/active_record/base.rb +37 -0
  8. data/lib/active_version/adapters/active_record/revisions.rb +49 -0
  9. data/lib/active_version/adapters/active_record/translations.rb +45 -0
  10. data/lib/active_version/adapters/active_record.rb +10 -0
  11. data/lib/active_version/adapters/sequel/versioning.rb +282 -0
  12. data/lib/active_version/adapters/sequel.rb +9 -0
  13. data/lib/active_version/adapters.rb +5 -0
  14. data/lib/active_version/audits/audit_record/callbacks.rb +180 -0
  15. data/lib/active_version/audits/audit_record/serializers.rb +49 -0
  16. data/lib/active_version/audits/audit_record.rb +522 -0
  17. data/lib/active_version/audits/has_audits/audit_callbacks.rb +46 -0
  18. data/lib/active_version/audits/has_audits/audit_combiner.rb +212 -0
  19. data/lib/active_version/audits/has_audits/audit_writer.rb +282 -0
  20. data/lib/active_version/audits/has_audits/change_filters.rb +114 -0
  21. data/lib/active_version/audits/has_audits/database_adapter_helper.rb +86 -0
  22. data/lib/active_version/audits/has_audits.rb +891 -0
  23. data/lib/active_version/audits/sql_builder.rb +263 -0
  24. data/lib/active_version/audits.rb +10 -0
  25. data/lib/active_version/column_mapper.rb +92 -0
  26. data/lib/active_version/configuration.rb +124 -0
  27. data/lib/active_version/database/triggers/postgresql.rb +243 -0
  28. data/lib/active_version/database.rb +7 -0
  29. data/lib/active_version/instrumentation.rb +226 -0
  30. data/lib/active_version/migrators/audited.rb +84 -0
  31. data/lib/active_version/migrators/base.rb +191 -0
  32. data/lib/active_version/migrators.rb +8 -0
  33. data/lib/active_version/query.rb +105 -0
  34. data/lib/active_version/railtie.rb +17 -0
  35. data/lib/active_version/revisions/has_revisions/revision_manipulation.rb +499 -0
  36. data/lib/active_version/revisions/has_revisions/revision_queries.rb +182 -0
  37. data/lib/active_version/revisions/has_revisions.rb +443 -0
  38. data/lib/active_version/revisions/revision_record.rb +287 -0
  39. data/lib/active_version/revisions/sql_builder.rb +266 -0
  40. data/lib/active_version/revisions.rb +10 -0
  41. data/lib/active_version/runtime.rb +148 -0
  42. data/lib/active_version/sharding/connection_router.rb +20 -0
  43. data/lib/active_version/sharding.rb +7 -0
  44. data/lib/active_version/tasks/active_version.rake +29 -0
  45. data/lib/active_version/translations/has_translations.rb +350 -0
  46. data/lib/active_version/translations/translation_record.rb +258 -0
  47. data/lib/active_version/translations.rb +9 -0
  48. data/lib/active_version/version.rb +3 -0
  49. data/lib/active_version/version_registry.rb +87 -0
  50. data/lib/active_version.rb +329 -0
  51. data/lib/generators/active_version/audits/audits_generator.rb +65 -0
  52. data/lib/generators/active_version/audits/templates/audit_model.rb.erb +16 -0
  53. data/lib/generators/active_version/audits/templates/migration_jsonb.rb.erb +33 -0
  54. data/lib/generators/active_version/audits/templates/migration_table.rb.erb +34 -0
  55. data/lib/generators/active_version/install/install_generator.rb +19 -0
  56. data/lib/generators/active_version/install/templates/initializer.rb.erb +38 -0
  57. data/lib/generators/active_version/revisions/revisions_generator.rb +71 -0
  58. data/lib/generators/active_version/revisions/templates/backfill_migration.rb.erb +19 -0
  59. data/lib/generators/active_version/revisions/templates/migration.rb.erb +20 -0
  60. data/lib/generators/active_version/revisions/templates/revision_model.rb.erb +8 -0
  61. data/lib/generators/active_version/translations/templates/migration.rb.erb +16 -0
  62. data/lib/generators/active_version/translations/templates/translation_model.rb.erb +15 -0
  63. data/lib/generators/active_version/translations/translations_generator.rb +73 -0
  64. data/lib/generators/active_version/triggers/templates/migration.rb.erb +100 -0
  65. data/lib/generators/active_version/triggers/triggers_generator.rb +74 -0
  66. data/sig/active_version/advanced.rbs +51 -0
  67. data/sig/active_version/audits.rbs +128 -0
  68. data/sig/active_version/configuration.rbs +38 -0
  69. data/sig/active_version/core.rbs +53 -0
  70. data/sig/active_version/instrumentation.rbs +17 -0
  71. data/sig/active_version/registry_and_mapping.rbs +18 -0
  72. data/sig/active_version/revisions.rbs +70 -0
  73. data/sig/active_version/runtime.rbs +29 -0
  74. data/sig/active_version/translations.rbs +43 -0
  75. data/sig/active_version.rbs +3 -0
  76. metadata +443 -0
@@ -0,0 +1,128 @@
1
+ module ActiveVersion
2
+ module Audits
3
+ module HasAudits
4
+ REDACTED: String
5
+
6
+ module ClassMethods
7
+ def audit_record?: () -> bool
8
+ def audit_class: () -> Class?
9
+ def has_audits: (?Hash[Symbol, untyped] options) -> untyped
10
+ def audited?: () -> bool
11
+ def without_auditing: () { () -> untyped } -> untyped
12
+ def with_auditing: () { () -> untyped } -> untyped
13
+ def revisions: (?Integer from_version) -> Array[untyped]
14
+ def revision_at: (untyped date_or_time) -> untyped
15
+ def with_audited_options: (?Hash[Symbol, untyped] options) { () -> untyped } -> untyped
16
+ def class_auditing_enabled?: () -> bool
17
+ def audit_on_create: () -> untyped
18
+ def audit_on_update: () -> untyped
19
+ def audit_on_destroy: () -> untyped
20
+ def audit_on_touch: () -> untyped
21
+ def revision_with: (Hash[untyped, untyped] attributes, ?id: untyped) -> untyped
22
+ end
23
+
24
+ attr_accessor audit_version: Integer?
25
+ attr_accessor audit_comment: String?
26
+ attr_accessor audit_context: Hash[untyped, untyped]?
27
+
28
+ def audit_revision: (?version: Integer?) -> untyped
29
+ def audit_revision_at: (untyped date_or_time) -> untyped
30
+ def audit_sql: (?destroy: bool) -> String
31
+ def own_and_associated_audits: () -> untyped
32
+ def without_auditing: () { () -> untyped } -> untyped
33
+ def with_auditing: () { () -> untyped } -> untyped
34
+ def should_audit?: () -> bool
35
+ def auditing_enabled: () -> bool
36
+ def audits: () -> untyped
37
+ def active_audits: () -> Array[untyped]
38
+ def audited_changes: (?for_touch: bool, ?exclude_readonly_attrs: bool) -> Hash[String, untyped]
39
+ end
40
+
41
+ module AuditRecord
42
+ module ClassMethods
43
+ def audit_record?: () -> bool
44
+ def dangerous_attribute_method?: (Symbol | String name) -> bool
45
+ def configure_audit: (
46
+ ?storage: Symbol | String?,
47
+ ?action_column: Symbol | String?,
48
+ ?changes_column: Symbol | String?,
49
+ ?context_column: Symbol | String?,
50
+ ?comment_column: Symbol | String?,
51
+ ?version_column: Symbol | String?,
52
+ ?user_column: Symbol | String?,
53
+ ?auditable_column: Symbol | String?,
54
+ ?associated_column: Symbol | String?,
55
+ ?remote_address_column: Symbol | String?,
56
+ ?request_uuid_column: Symbol | String?
57
+ ) -> Hash[Symbol, untyped]
58
+ def audit_storage: (?Symbol | String value) -> Symbol?
59
+ def register_storage_provider: (Symbol | String name, ?untyped provider) { (Class audit_class, String column_name) -> untyped } -> untyped
60
+ def register_audit_storage_provider: (Symbol | String name, ?untyped provider) { (Class audit_class, String column_name) -> untyped } -> untyped
61
+ def storage_provider_registry: () -> Hash[Symbol, untyped]
62
+ def storage_provider_for_column: (Symbol | String column_name) -> untyped
63
+ def audit_action_column: (?Symbol | String value) -> Symbol?
64
+ def audit_changes_column: (?Symbol | String value) -> Symbol?
65
+ def audit_context_column: (?Symbol | String value) -> Symbol?
66
+ def audit_comment_column: (?Symbol | String value) -> Symbol?
67
+ def audit_version_column: (?Symbol | String value) -> Symbol?
68
+ def audit_user_column: (?Symbol | String value) -> Symbol?
69
+ def audit_auditable_column: (?Symbol | String value) -> Symbol?
70
+ def audit_associated_column: (?Symbol | String value) -> Symbol?
71
+ def audit_remote_address_column: (?Symbol | String value) -> Symbol?
72
+ def audit_request_uuid_column: (?Symbol | String value) -> Symbol?
73
+ def audit_storage_mode: () -> Symbol?
74
+ def audit_column_for: (Symbol concept) -> Symbol?
75
+ def source_name: () -> Symbol?
76
+ def source_class: () -> Class
77
+ def source_identity_columns: () -> Array[String]
78
+ def setup_associations: () -> untyped
79
+ def setup_serializers: () -> untyped
80
+ def add_audited_class: (Class audited_class) -> Set[Class]
81
+ def audited_classes: () -> Set[Class]
82
+ def initialize_serializers: () -> untyped
83
+ def reconstruct_attributes: (Array[untyped] audits) -> Hash[Symbol | String, untyped]
84
+ end
85
+
86
+ attr_accessor _allow_update_for_readonly_check: bool?
87
+
88
+ def audited_changes: () -> Hash[untyped, untyped] | Array[untyped] | String | nil
89
+ def audited_changes=: (untyped value) -> untyped
90
+ def audited_context: () -> Hash[untyped, untyped] | Array[untyped] | String | nil
91
+ def audited_context=: (untyped value) -> untyped
92
+ def readonly?: () -> bool
93
+ def save: (*untyped args, **untyped kwargs) -> bool
94
+ def save!: (*untyped args, **untyped kwargs) -> bool
95
+ def destroy: (*untyped args, **untyped kwargs) -> untyped
96
+ def new_attributes: () -> Hash[untyped, untyped]
97
+ def old_attributes: () -> Hash[untyped, untyped]
98
+ def ancestors: () -> untyped
99
+ def revision: () -> untyped
100
+ end
101
+
102
+ module ChangeFilters
103
+ def audited_changes: (?for_touch: bool, ?exclude_readonly_attrs: bool) -> Hash[String, untyped]
104
+ def audited_attributes: () -> Hash[String, untyped]
105
+ def non_audited_columns: () -> Array[String]
106
+ def normalize_enum_changes: (Hash[String, untyped] changes) -> Hash[String, untyped]
107
+ def redact_values: (Hash[String, untyped] filtered_changes) -> Hash[String, untyped]
108
+ def filter_encrypted_attrs: (Hash[String, untyped] filtered_changes) -> Hash[String, untyped]
109
+ def filter_attr_values: (?audited_changes: Hash[String, untyped], ?attrs: Array[Symbol | String], ?placeholder: String) -> Hash[String, untyped]
110
+ def prepare_sql_values: (Hash[untyped, untyped] changes) -> Hash[untyped, untyped]
111
+ end
112
+
113
+ module AuditCallbacks
114
+ def audit_create: () -> untyped
115
+ def audit_update: () -> untyped
116
+ def audit_touch: () -> untyped
117
+ def audit_destroy: () -> untyped
118
+ end
119
+
120
+ module AuditWriter
121
+ def write_audit: (Hash[untyped, untyped] attrs) -> untyped
122
+ end
123
+
124
+ module AuditCombiner
125
+ def combine_audits_if_needed: () -> untyped
126
+ end
127
+ end
128
+ end
@@ -0,0 +1,38 @@
1
+ module ActiveVersion
2
+ class Configuration
3
+ attr_accessor auditing_enabled: bool
4
+ attr_accessor current_user_method: Symbol | String
5
+ attr_accessor ignored_attributes: Array[String]
6
+ attr_accessor ignored_default_callbacks: Array[Symbol | String]
7
+ attr_accessor store_synthesized_enums: bool
8
+ attr_accessor execution_scope: :fiber | :thread
9
+
10
+ attr_accessor translation_locale_column: Symbol | String
11
+ attr_accessor translation_default_locale: Symbol | String
12
+
13
+ attr_accessor revision_version_column: Symbol | String
14
+ attr_accessor revision_foreign_key_suffix: String
15
+
16
+ attr_accessor audit_storage: :json_column | :yaml_column | :mirror_columns
17
+ attr_accessor audit_action_column: Symbol | String
18
+ attr_accessor audit_changes_column: Symbol | String
19
+ attr_accessor audit_context_column: Symbol | String
20
+ attr_accessor audit_comment_column: Symbol | String
21
+ attr_accessor audit_version_column: Symbol | String
22
+ attr_accessor audit_user_column: Symbol | String
23
+ attr_accessor audit_auditable_column: Symbol | String
24
+ attr_accessor audit_associated_column: Symbol | String
25
+ attr_accessor audit_remote_address_column: Symbol | String
26
+ attr_accessor audit_request_uuid_column: Symbol | String
27
+ attr_accessor max_audits: Integer?
28
+ attr_accessor max_revisions: Integer?
29
+ attr_accessor return_self_if_no_revisions: bool
30
+ attr_accessor return_self_if_no_audits: bool
31
+ attr_accessor audit_error_behavior: Symbol
32
+ attr_accessor revision_error_behavior: Symbol
33
+ attr_accessor debounce_time: Numeric?
34
+ attr_accessor partition_schema_guards_enabled: bool
35
+
36
+ def validate!: () -> void
37
+ end
38
+ end
@@ -0,0 +1,53 @@
1
+ module ActiveVersion
2
+ class Error < StandardError
3
+ end
4
+
5
+ class ConfigurationError < Error
6
+ end
7
+
8
+ class VersionNotFoundError < Error
9
+ end
10
+
11
+ class ReadonlyVersionError < Error
12
+ end
13
+
14
+ class FutureTimeError < Error
15
+ end
16
+
17
+ class DeletedColumnError < Error
18
+ end
19
+
20
+ class RequestStore < ActiveSupport::CurrentAttributes
21
+ attr_accessor version_context: Hash[untyped, untyped]?
22
+ attr_accessor audited_user: untyped
23
+ attr_accessor request_uuid: String?
24
+ attr_accessor remote_address: String?
25
+ end
26
+
27
+ def self.config: () -> Configuration
28
+ def self.configure: () { (Configuration) -> void } -> Configuration
29
+ def self.auditing_enabled: () -> bool
30
+ def self.auditing_enabled=: (bool value) -> bool
31
+ def self.runtime_adapter: () -> untyped
32
+ def self.runtime_adapter=: (untyped adapter) -> untyped
33
+ def self.reset_runtime_adapter!: () -> untyped
34
+ def self.context: () -> Hash[untyped, untyped]
35
+ def self.context=: (Hash[untyped, untyped] value) -> Hash[untyped, untyped]
36
+ def self.with_context: (?Hash[untyped, untyped] context, ?transactional: bool, **untyped kwargs) { () -> untyped } -> untyped
37
+ def self.with_context!: (Hash[untyped, untyped] context) -> nil
38
+ def self.clear_context!: () -> nil
39
+ def self.without_auditing: () { () -> untyped } -> untyped
40
+ def self.disable_auditing: () -> bool
41
+ def self.enable_auditing: () -> bool
42
+ def self.registry: () -> VersionRegistry
43
+ def self.column_mapper: () -> ColumnMapper
44
+ def self.parse_time: (Numeric | String | Date | Time | untyped time) -> Time
45
+ def self.parse_time_to_time: (Numeric | String | Date | Time | untyped time) -> Time
46
+ def self.connection_for: (Class model_class, Symbol | String version_type) -> untyped
47
+ def self.adapter_for: (Class model_class, Symbol | String version_type) -> untyped
48
+ def self.with_connection: (Class model_class, Symbol | String version_type) { (untyped) -> untyped } -> untyped
49
+ def self.store_get: (Symbol key) -> untyped
50
+ def self.store_set: (Symbol key, untyped value) -> untyped
51
+ def self.store_delete: (Symbol key) -> untyped
52
+ def self.clear_scoped_keys!: (Regexp pattern) -> void
53
+ end
@@ -0,0 +1,17 @@
1
+ module ActiveVersion
2
+ module Instrumentation
3
+ EVENTS: Hash[Symbol, String]
4
+
5
+ def self.instrument_translation_created: (untyped translation, untyped source) -> untyped
6
+ def self.instrument_translation_updated: (untyped translation, untyped source) -> untyped
7
+ def self.instrument_translation_destroyed: (untyped translation, untyped source) -> untyped
8
+ def self.instrument_translation_fallback_used: (untyped source, attr: untyped, requested_locale: untyped, resolved_locale: untyped) -> untyped
9
+ def self.instrument_revision_created: (untyped revision, untyped source) -> untyped
10
+ def self.instrument_revision_reverted: (untyped source, from_version: untyped, to_version: untyped, ?strategy: Symbol) -> untyped
11
+ def self.instrument_revision_switch_applied: (untyped source, from_version: untyped, to_version: untyped, append: bool) -> untyped
12
+ def self.instrument_revision_write_failed: (untyped source, error: Exception?) -> untyped
13
+ def self.instrument_audit_created: (untyped audit, untyped auditable) -> untyped
14
+ def self.instrument_audit_write_failed: (untyped source, error: Exception?, action: untyped) -> untyped
15
+ def self.instrument_audit_sql_generated: (untyped model, String sql) -> untyped
16
+ end
17
+ end
@@ -0,0 +1,18 @@
1
+ module ActiveVersion
2
+ class ColumnMapper
3
+ def register: (Class model_class, Symbol version_type, Symbol concept, Symbol | String column_name) -> Symbol
4
+ def column_for: (Class model_class, Symbol version_type, Symbol concept) -> Symbol | String
5
+ def mappings_for: (Class model_class, Symbol version_type) -> Hash[Symbol, Symbol]
6
+ end
7
+
8
+ class VersionRegistry
9
+ def register: (Class model_class, Symbol version_type, ?Hash[Symbol, untyped] options) -> Hash[Symbol, untyped]
10
+ def version_class_for: (Class model_class, Symbol version_type) -> Class?
11
+ def register_version_class: (Class model_class, Symbol version_type, Class version_class) -> Class
12
+ def registered?: (Class model_class, Symbol version_type) -> bool
13
+ def models_for_version_type: (Symbol version_type) -> Array[Class]
14
+ def config_for: (Class model_class, Symbol version_type) -> Hash[Symbol, untyped]?
15
+ def config_for_model_name: (String model_name, Symbol version_type) -> Hash[Symbol, untyped]?
16
+ def clear!: () -> void
17
+ end
18
+ end
@@ -0,0 +1,70 @@
1
+ module ActiveVersion
2
+ module Revisions
3
+ module HasRevisions
4
+ module ClassMethods
5
+ def revision_record?: () -> bool
6
+ def revision_class: () -> Class
7
+ def revision_class_name: () -> String
8
+ def setup_revision_associations: () -> untyped
9
+ def has_revisions: (?Hash[Symbol, untyped] options) -> Hash[Symbol, untyped]
10
+ def has_revisions?: () -> bool
11
+ def normalize_revision_options: (Hash[Symbol, untyped] options) -> Hash[Symbol, untyped]
12
+ def setup_revision_callbacks: (Hash[Symbol, untyped] options) -> untyped
13
+ def revision_on_update: () -> untyped
14
+ def create_snapshots: (?Hash[Symbol, untyped] opts) -> untyped
15
+ def without_revisions: () { () -> untyped } -> untyped
16
+ def with_revisions: () { () -> untyped } -> untyped
17
+ def class_revision_enabled?: () -> bool
18
+ end
19
+
20
+ module RevisionQueries
21
+ def revision: (?version: Integer?) -> untyped
22
+ def revision_at: (?time: untyped) -> untyped
23
+ def at: (?time: untyped, ?version: Integer?) -> untyped
24
+ def at!: (?time: untyped, ?version: Integer?) -> untyped
25
+ def at_version!: (Integer version) -> untyped
26
+ def current_version: () -> Integer
27
+ def at_version: (Integer version) -> untyped
28
+ def versions: (?reverse: bool, ?include_self: bool) -> Enumerator[untyped]
29
+ end
30
+
31
+ module RevisionManipulation
32
+ def create_snapshot!: (?Hash[Symbol, untyped] opts) -> untyped
33
+ def revert_to: (version: Integer) -> bool
34
+ def undo!: (?append: bool) -> bool
35
+ def redo!: () -> bool
36
+ def switch_to!: (Integer version, ?append: bool) -> bool
37
+ def diff_from: (?time: untyped, ?version: Integer?) -> Hash[String, untyped]
38
+ end
39
+ end
40
+
41
+ module RevisionRecord
42
+ module ClassMethods
43
+ def revision_record?: () -> bool
44
+ def configure_revision: (
45
+ ?version_column: Symbol | String?,
46
+ ?foreign_key: Symbol | String | Array[Symbol | String]?,
47
+ ?identity_resolver: Symbol | String | Array[Symbol | String]?
48
+ ) { () -> untyped } -> Hash[Symbol, untyped]
49
+ def revision_version_column: (?Symbol | String value) -> Symbol?
50
+ def revision_foreign_key: (?Symbol | String | Array[Symbol | String] value) -> String | Array[String]?
51
+ def revision_identity_resolver: (?Symbol | String | Array[Symbol | String] value) -> String | Array[String]?
52
+ def revision_column_for: (Symbol concept) -> Symbol?
53
+ def source_name: () -> Symbol?
54
+ def source_class: () -> Class
55
+ def source_foreign_key: () -> String | Array[String]
56
+ def source_primary_key: () -> String | Array[String]?
57
+ def setup_associations: () -> untyped
58
+ end
59
+
60
+ attr_accessor _allow_update_for_readonly_check: bool?
61
+
62
+ def readonly?: () -> bool
63
+ def save: (*untyped args, **untyped kwargs) -> bool
64
+ def save!: (*untyped args, **untyped kwargs) -> bool
65
+ def destroy: (*untyped args, **untyped kwargs) -> untyped
66
+ def source: () -> untyped
67
+ def attributes: () -> Hash[String, untyped]
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,29 @@
1
+ module ActiveVersion
2
+ module Runtime
3
+ class NullAdapter
4
+ def base_connection: () -> untyped
5
+ def connection_for: (Class model_class, Symbol | String version_type) -> untyped
6
+ def supports_transactional_context?: (untyped connection) -> bool
7
+ def supports_current_transaction_id?: (untyped connection) -> bool
8
+ def supports_partition_catalog_checks?: (untyped connection) -> bool
9
+ end
10
+
11
+ class ActiveRecordAdapter
12
+ def base_connection: () -> untyped
13
+ def connection_for: (Class model_class, Symbol | String version_type) -> untyped
14
+ def supports_transactional_context?: (untyped connection) -> bool
15
+ def supports_current_transaction_id?: (untyped connection) -> bool
16
+ def supports_partition_catalog_checks?: (untyped connection) -> bool
17
+ end
18
+
19
+ def self.adapter: () -> untyped
20
+ def self.adapter=: (untyped runtime_adapter) -> untyped
21
+ def self.reset_adapter!: () -> untyped
22
+ def self.required_adapter_methods: () -> Array[Symbol]
23
+ def self.valid_adapter?: (untyped runtime_adapter) -> bool
24
+ def self.supports_transactional_context?: (untyped connection) -> bool
25
+ def self.supports_current_transaction_id?: (untyped connection) -> bool
26
+ def self.supports_partition_catalog_checks?: (untyped connection) -> bool
27
+ def self.active_record_connection_errors: () -> Array[untyped]
28
+ end
29
+ end
@@ -0,0 +1,43 @@
1
+ module ActiveVersion
2
+ module Translations
3
+ module HasTranslations
4
+ module ClassMethods
5
+ def translation_record?: () -> bool
6
+ def translation_class: () -> Class
7
+ def translation_class_name: () -> String
8
+ def setup_translation_associations: () -> untyped
9
+ def scope_for_translated_attribute: (Symbol | String attribute_name, untyped value, ?locale: Symbol | String) -> untyped
10
+ def translated_scopes: (*untyped attribute_names) -> untyped
11
+ def translated_copies: (*untyped attribute_names) -> untyped
12
+ end
13
+
14
+ def translate: (Symbol | String attr_name, ?locale: Symbol | String | nil, ?presence_check: Symbol | String | nil, ?fallback: bool) -> untyped
15
+ def translation: (?locale: Symbol | String | nil) -> untyped
16
+ def update_default_translation: () -> untyped
17
+ end
18
+
19
+ module TranslationRecord
20
+ module ClassMethods
21
+ def translation_record?: () -> bool
22
+ def configure_translation: (
23
+ ?locale_column: Symbol | String?,
24
+ ?foreign_key: Symbol | String | Array[Symbol | String]?,
25
+ ?identity_resolver: Symbol | String | Array[Symbol | String]?
26
+ ) { () -> untyped } -> Hash[Symbol, untyped]
27
+ def translation_locale_column: (?Symbol | String value) -> Symbol?
28
+ def translation_foreign_key: (?Symbol | String | Array[Symbol | String] value) -> String | Array[String]?
29
+ def translation_identity_resolver: (?Symbol | String | Array[Symbol | String] value) -> String | Array[String]?
30
+ def source_name: () -> Symbol?
31
+ def source_class: () -> Class
32
+ def source_foreign_key: () -> String | Array[String]
33
+ def source_primary_key: () -> String | Array[String]?
34
+ def locale_column_name: () -> Symbol | String
35
+ def setup_associations: () -> untyped
36
+ def setup_locale_enum: () -> untyped
37
+ end
38
+
39
+ def attr_present_for_locale?: (Symbol | String locale, Symbol | String attr_name, ?untyped presence_check) -> bool
40
+ def source_version: () -> untyped
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,3 @@
1
+ module ActiveVersion
2
+ VERSION: String
3
+ end