foobara-typescript-react-command-form-generator 0.0.12 → 1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 89eda43a93ac1f7704e90f6505078d6dca634f8e327836ad27559cfdfd3abc05
4
- data.tar.gz: 04befdc1aabc41b17ede232116cb34382a187e414b1da4194a1a16f91eed1dd8
3
+ metadata.gz: c99e472546e0fda03a331ad3762f3517d7ec51bab2215c5ff1b6266cfceafed5
4
+ data.tar.gz: 8ef847d0884a39d1397a05abc62a1458465326502990384f71af6054a4f09be9
5
5
  SHA512:
6
- metadata.gz: d3f84bb2d7d26485ab18b697f1bc90354632a7f94f89a4800252f50dc90601970e48753b4712be5af5727ee17fe921d57b9f79f42e6abf173acf1f3e3dd54b3d
7
- data.tar.gz: 916539dcd2b832027969f7c191a67e9bc5878a32a60d7210b30d919ea569da2930cb9d556301c59fbd70a7a365f2b963a5aa1deb028ce83835cadc24d094a63b
6
+ metadata.gz: 56fac14ad332146943050f8e63b19ae26fcf970a433df9f801c1371dfac6d7de3e495615af8a42b93f1f12ae43cddfb379c427fde0ba9dd1722acca591bb7f21
7
+ data.tar.gz: c3be48447e0f655c046c21440da5eda655d8fa592845e8727ea9b3730d248e1b234ac0212ae6361a61d92161437448ac12316a24f278ca91ec73d14e064dbcf5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [1.1.0] - 2025-08-22
2
+
3
+ - Handle new Foobara 0.1.0 type declarations
4
+
5
+ ## [0.0.13] - 2025-08-05
6
+
7
+ - Properly cast values passed to set<State> functions
8
+ - Properly build forms for detached entities as if they were proper entities
9
+
1
10
  ## [0.0.12] - 2025-04-15
2
11
 
3
12
  - Fix non-camelized get/set useState names for nested types
@@ -35,11 +35,14 @@ module Foobara
35
35
  def type_generators(type_declaration = inputs_type, initial = true)
36
36
  return @type_generators if defined?(@type_generators)
37
37
 
38
- generators = if type_declaration.entity?
38
+ generators = if type_declaration.detached_entity?
39
39
  # For now, we'll not bother with entity/model classes in the inputs.
40
40
  # This simplifies things a bit re: form generation and setting UI
41
41
  # inputs into the inputs value.
42
+ # TODO: test this path or delete it if unreachable!
43
+ # :nocov:
42
44
  type_generators(type_declaration.to_type.primary_key_type, false)
45
+ # :nocov:
43
46
  # generator_class = RemoteGenerator::Services::UnloadedEntityGenerator
44
47
  # [generator_class.new(type_declaration.to_entity)]
45
48
  elsif type_declaration.model?
@@ -107,9 +110,12 @@ module Foobara
107
110
  type_declaration.attribute_declarations.each_pair do |attribute_name, attribute_declaration|
108
111
  non_colliding_inputs(attribute_declaration, result, [*path, attribute_name])
109
112
  end
110
- elsif type_declaration.entity?
113
+ elsif type_declaration.detached_entity?
111
114
  # TODO: figure out how to not pass self here...
115
+ # TODO: test this path or delete it if unreachable!
116
+ # :nocov:
112
117
  result << FlattenedAttribute.new(self, path, type_declaration.to_type.primary_key_type)
118
+ # :nocov:
113
119
  elsif type_declaration.model?
114
120
  non_colliding_inputs(type_declaration.to_type.attributes_type, result, path)
115
121
  elsif type_declaration.array?
@@ -181,14 +187,15 @@ module Foobara
181
187
  end
182
188
 
183
189
  def one_of
184
- real_type_declaration.one_of
190
+ unless real_type_declaration.primitive?
191
+ real_type_declaration.one_of
192
+ end
185
193
  end
186
194
 
187
195
  def sensitive?
188
196
  type_declaration.sensitive?
189
197
  end
190
198
 
191
- # TODO: something feels kind of wrong here, hmmm
192
199
  def real_type_declaration
193
200
  @real_type_declaration ||= if custom?
194
201
  # We are dealing with a reference to a registered type
@@ -257,7 +264,8 @@ module Foobara
257
264
  "parseFloat(e.target.value)"
258
265
  # :nocov:
259
266
  else
260
- "e.target.value"
267
+ ts_type = generator.foobara_type_to_ts_type(type_declaration)
268
+ "e.target.value as #{ts_type}"
261
269
  end
262
270
 
263
271
  "<input
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara-typescript-react-command-form-generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi
@@ -9,20 +9,40 @@ bindir: bin
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: foobara
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: 0.1.1
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: 2.0.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ version: 0.1.1
29
+ - - "<"
30
+ - !ruby/object:Gem::Version
31
+ version: 2.0.0
12
32
  - !ruby/object:Gem::Dependency
13
33
  name: foobara-typescript-remote-command-generator
14
34
  requirement: !ruby/object:Gem::Requirement
15
35
  requirements:
16
- - - "~>"
36
+ - - "<"
17
37
  - !ruby/object:Gem::Version
18
- version: 0.0.1
38
+ version: 2.0.0
19
39
  type: :runtime
20
40
  prerelease: false
21
41
  version_requirements: !ruby/object:Gem::Requirement
22
42
  requirements:
23
- - - "~>"
43
+ - - "<"
24
44
  - !ruby/object:Gem::Version
25
- version: 0.0.1
45
+ version: 2.0.0
26
46
  email:
27
47
  - azimux@gmail.com
28
48
  executables: []
@@ -60,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
80
  - !ruby/object:Gem::Version
61
81
  version: '0'
62
82
  requirements: []
63
- rubygems_version: 3.6.7
83
+ rubygems_version: 3.6.9
64
84
  specification_version: 4
65
85
  summary: Generates Typescript React forms for Foobara remote commands
66
86
  test_files: []