typelizer 0.11.0 → 0.13.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6dbce7bf8d558500341875958f875183e18668765f812d1ef8110f51c521cc7d
4
- data.tar.gz: c297302a9425f27f0491307d7597201430ddf94eff38d80cf0b0760f16186296
3
+ metadata.gz: a9a7d9dfc60b5b5b8432575016f4f63697b6c6e356d74044abf6646b7d8e10a6
4
+ data.tar.gz: 374654bfb99f5bb3363b7a21174bb4c4a52718d2b852d4597e80aa155ce6fa34
5
5
  SHA512:
6
- metadata.gz: 5509e82f421cc1f52411b073431a246134d5bdcfe53eb5f308554492da3f2dbc78c708cf45c89651a749d5ad2aa1e0a59c119287f0c0ce8af19a10e374d4efbb
7
- data.tar.gz: 37ba94237e3992f96542f33ef4376db48a1c5397907d01fbd7a619102a412db58418e36822d46f522f2ebeb672922591a46cbb112e0be2103bf7119d241e2bbe
6
+ metadata.gz: 3886301d0db29ef0ed101f5edf76e6228501672f5750c0109a854e142f880c1cd24a71fea9ca352caa888697f801302283b679e36ac61ea19c87e8c9b73ecfb4
7
+ data.tar.gz: bf5b5cdc3748500355aa1bac6d2f0dc035a4776080e06bee523c369cf33177ed24f1e92702e42366e5a7b1e72994696ff32dc52f55295f66bbf48f7961c5e2a5
data/CHANGELOG.md CHANGED
@@ -7,6 +7,47 @@ and this project adheres to [Semantic Versioning].
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.13.0] - 2026-05-01
11
+
12
+ ### Added
13
+
14
+ - **Runtime enums** (`config.enum_runtime = true`, default `false`): emit an `as const` object alongside each named enum type in `Enums.ts` and re-export it as a value from `index.ts`. Lets consumers compare against enum values at runtime (`if (user.role === UserRole.admin)`) without hand-maintaining a parallel constants file. Existing type-only output is unchanged when the flag is off. ([@skryukov])
15
+
16
+ - **Inline object types**: pass a positional hash to `typelize` to describe an inline TypeScript object type. Nested hashes nest, and options like `multi:`/`nullable:` compose. Useful for JSON columns and ad-hoc computed shapes that don't warrant a separate resource. ([@skryukov])
17
+
18
+ ```ruby
19
+ typelize({id: :number, label?: :string})
20
+ attribute :category
21
+ # → category: { id: number; label?: string }
22
+ ```
23
+
24
+ - **`?` suffix on attribute keys** as a shorthand for `optional: true`, mirroring TypeScript's own syntax. Works both in keyed `typelize` calls and inside inline shape hashes. ([@skryukov])
25
+
26
+ ```ruby
27
+ typelize name?: :string
28
+ # → name?: string
29
+ ```
30
+
31
+ ### Changed
32
+
33
+ - [BREAKING] Type generation is now deferred to the first HTTP request via a Rack middleware, instead of running during Rails boot. Boot no longer touches the database, so a missing or pending-migration database no longer crashes server startup. Generation failures raise `Typelizer::TypeGenerationError` (rendered like the standard pending-migrations page) and are retried on the next request. Rake tasks are unaffected. ([@julik])
34
+ - [BREAKING] Bumped `railties` requirement to `>= 6.1.0` to use the `server` Railtie block. ([@julik])
35
+ - [BREAKING] Dropped `DISABLE_TYPELIZER` environment variable support (deprecated since 0.12.0). Use `TYPELIZER=false` instead. ([@skryukov])
36
+ - [BREAKING] Removed the `.form` route variant, `FormDefinition` type, and `formAction` runtime helper. ([@skryukov])
37
+
38
+ ### Fixed
39
+
40
+ - `typelize` declarations silently dropped during rake tasks, producing `unknown` for every field. ([#114](https://github.com/skryukov/typelizer/issues/114)) ([@skryukov])
41
+ - `properties_transformer` now applied to nested attribute sub-properties, meta nested blocks, and Alba trait properties. Previously only top-level keys were transformed, producing inconsistent output. ([#89](https://github.com/skryukov/typelizer/issues/89)) ([@skryukov])
42
+ - `typelize "Name[]"` paired with `with_traits:` no longer emits a phantom trait intersection with a missing import. Explicit `typelize` overrides are now trusted as-is — the generated type is exactly what you wrote. ([#113](https://github.com/skryukov/typelizer/issues/113)) ([@skryukov])
43
+ - ActiveRecord models whose tables don't exist yet (fresh checkout, pending migration) are now skipped during type inference instead of issuing live DB queries. ([@julik])
44
+
45
+ ## [0.12.0] - 2026-03-29
46
+
47
+ ### Added
48
+
49
+ - **Route generation**: Generate typed TypeScript (or JavaScript) route helpers from Rails routes. Enable with `config.routes.enabled = true`. ([@skryukov])
50
+
10
51
  ## [0.11.0] - 2026-03-26
11
52
 
12
53
  ### Added
@@ -449,6 +490,7 @@ and this project adheres to [Semantic Versioning].
449
490
  [@Envek]: https://github.com/Envek
450
491
  [@hkamberovic]: https://github.com/hkamberovic
451
492
  [@jonmarkgo]: https://github.com/jonmarkgo
493
+ [@julik]: https://github.com/julik
452
494
  [@kristinemcbride]: https://github.com/kristinemcbride
453
495
  [@nkriege]: https://github.com/nkriege
454
496
  [@NOX73]: https://github.com/NOX73
@@ -461,7 +503,9 @@ and this project adheres to [Semantic Versioning].
461
503
  [@skryukov]: https://github.com/skryukov
462
504
  [@ventsislaf]: https://github.com/ventsislaf
463
505
 
464
- [Unreleased]: https://github.com/skryukov/typelizer/compare/v0.11.0...HEAD
506
+ [Unreleased]: https://github.com/skryukov/typelizer/compare/v0.13.0...HEAD
507
+ [0.13.0]: https://github.com/skryukov/typelizer/compare/v0.12.0...v0.13.0
508
+ [0.12.0]: https://github.com/skryukov/typelizer/compare/v0.11.0...v0.12.0
465
509
  [0.11.0]: https://github.com/skryukov/typelizer/compare/v0.10.0...v0.11.0
466
510
  [0.10.0]: https://github.com/skryukov/typelizer/compare/v0.9.3...v0.10.0
467
511
  [0.9.3]: https://github.com/skryukov/typelizer/compare/v0.9.2...v0.9.3