typelizer 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/README.md +1 -1
- data/lib/typelizer/model_plugins/active_record.rb +14 -0
- data/lib/typelizer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 719de4da27cc15319b98f6d99e12d58d5d52a6b7122de2e5af4e25682ff0cc09
|
4
|
+
data.tar.gz: 4b81f4e2ac3efa868c62a56d2a64d39dcedfe3d3a89f27b60d1266ea49977260
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fb14ceadab2c34ee2d346cdd3ccaaff5c42b8c867a8bb4b49bf5a5142cbfdaf07cabfb9cbccc647709712fd6fd0a2e917eac8037d01af663c9762b506c66101
|
7
|
+
data.tar.gz: a81bd63f919c2f7d7620fc5a13edcb94bfce4099e3a77e3d1096060b8f6a25bb9c0d640ff75259b2afa531b5388d2a362a10985676d878eb3f7f3a16c26c053e
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning].
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [0.5.2] - 2025-10-06
|
11
|
+
|
12
|
+
- Infer type for `<relation>_ids`. ([@skryukov])
|
13
|
+
|
10
14
|
## [0.5.1] - 2025-09-11
|
11
15
|
|
12
16
|
### Fixed
|
@@ -195,7 +199,8 @@ and this project adheres to [Semantic Versioning].
|
|
195
199
|
[@prog-supdex]: https://github.com/prog-supdex
|
196
200
|
[@ventsislaf]: https://github.com/ventsislaf
|
197
201
|
|
198
|
-
[Unreleased]: https://github.com/skryukov/typelizer/compare/v0.5.
|
202
|
+
[Unreleased]: https://github.com/skryukov/typelizer/compare/v0.5.2...HEAD
|
203
|
+
[0.5.2]: https://github.com/skryukov/typelizer/compare/v0.5.1...v0.5.2
|
199
204
|
[0.5.1]: https://github.com/skryukov/typelizer/compare/v0.5.0...v0.5.1
|
200
205
|
[0.5.0]: https://github.com/skryukov/typelizer/compare/v0.4.2...v0.5.0
|
201
206
|
[0.4.2]: https://github.com/skryukov/typelizer/compare/v0.4.1...v0.4.2
|
data/README.md
CHANGED
@@ -421,7 +421,7 @@ Typelizer.configure do |config|
|
|
421
421
|
|
422
422
|
# List of type names that should be considered global in TypeScript
|
423
423
|
# (i.e. not prefixed with the import path)
|
424
|
-
config.types_global
|
424
|
+
config.types_global = %w[Array Date Record File FileList]
|
425
425
|
|
426
426
|
# Support TypeScript's Verbatim module syntax option (default: false)
|
427
427
|
# Will change imports and exports of types from default to support this syntax option
|
@@ -11,6 +11,7 @@ module Typelizer
|
|
11
11
|
def infer_types(prop)
|
12
12
|
infer_types_for_association(prop) ||
|
13
13
|
infer_types_for_column(prop) ||
|
14
|
+
infer_types_for_association_ids(prop) ||
|
14
15
|
infer_types_for_attribute(prop)
|
15
16
|
|
16
17
|
prop
|
@@ -84,6 +85,19 @@ module Typelizer
|
|
84
85
|
prop
|
85
86
|
end
|
86
87
|
|
88
|
+
def infer_types_for_association_ids(prop)
|
89
|
+
column_name = prop.column_name.to_s
|
90
|
+
return nil unless column_name.end_with?("_ids")
|
91
|
+
|
92
|
+
base_name = column_name.chomp("_ids").pluralize
|
93
|
+
association = model_class&.reflect_on_association(base_name.to_sym)
|
94
|
+
return nil unless association
|
95
|
+
|
96
|
+
prop.type = :number
|
97
|
+
prop.multi = true
|
98
|
+
prop
|
99
|
+
end
|
100
|
+
|
87
101
|
def infer_types_for_attribute(prop)
|
88
102
|
return nil unless model_class.respond_to?(:attribute_types)
|
89
103
|
|
data/lib/typelizer/version.rb
CHANGED