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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa25b7b1816ce597e18fd9914b7f9434a4f9cbc4e5e7dcb80c783850a0e3d99c
4
- data.tar.gz: 882d39a7faffcec6d7911c646a5a82a5164be04943c5f109b3c245f03728bcb8
3
+ metadata.gz: 719de4da27cc15319b98f6d99e12d58d5d52a6b7122de2e5af4e25682ff0cc09
4
+ data.tar.gz: 4b81f4e2ac3efa868c62a56d2a64d39dcedfe3d3a89f27b60d1266ea49977260
5
5
  SHA512:
6
- metadata.gz: c99a3bc8dd6bbeaeed50394963d5a7081ebf3d1d837c9fa0b3bff6e4bd822974c8953fa355b22b07539736f18f2f7cf7f998e1bb68bdb01785a18bc1a6e5e0b7
7
- data.tar.gz: 7b041dc084316a0ce823150b32c6af5555abacf15aaa99f4a286eec87d4a7f5b7ada172dcf3b45735139574647c91e7e5fe722d5da0a1959305a4e87d093157d
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.1...HEAD
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 << %w[Array Date Record File FileList]
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Typelizer
4
- VERSION = "0.5.1"
4
+ VERSION = "0.5.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typelizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Svyatoslav Kryukov