foobara-typescript-remote-command-generator 1.2.3 → 1.2.4

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: a05ca67a91d4783f58462b104e7fe231916bbb7bb6b2d54138f5ea4a924c8653
4
- data.tar.gz: b889694f3237d501fd5ff8a9504dbb70be5389f7b1223a0134dc4e76eb7ea1c2
3
+ metadata.gz: 7d547512385bac27319b644bb141ab01c46a53020b10e8aaf59f97f281733bc4
4
+ data.tar.gz: 0b5156e84353c299cd9b9076ad416f420306993181d9984e01b62fbbb2b4dbbe
5
5
  SHA512:
6
- metadata.gz: 81e53ffa5b4dd3eed11873aead7ad5e7edfb76dcf8487525306a33e0e93692b8a525b46602634477e70798ea886a3990a5bd53c2d7a6013ded7c3dcff0dc1110
7
- data.tar.gz: 9377c12ceea5f00184d8c0ca380b7be7a5d26c5dc79e25021a1c656f756a643542b6940edbfedcb25b7daffa202e610c6696f295d9b8500654bd41c44eee2fc6
6
+ metadata.gz: 076de1fb493fa9ad32f00fce13fef08f92da9dd9864efb17dd9137ea939737ada06485c0de0552d4d6ef59b7e4c5ae5ea541d3bc122bd8a088dbdfcd510efd42
7
+ data.tar.gz: 378f783a3dba0e843b5409414f2eb553aab1099555a9443c48d2ccdd3c8d67ef54b8d473c780bc83c44a469250445f9a624546915cde317d5ffc3fd6fc2d2e15
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [1.2.4] - 2026-01-26
2
+
3
+ - Fix bug where we include models/entities from command inputs
4
+
1
5
  ## [1.2.3] - 2026-01-24
2
6
 
3
7
  - Default the project_directory to "." instead of the output_directory
@@ -28,9 +28,9 @@ module Foobara
28
28
  end
29
29
  end
30
30
 
31
- def entity_generators
32
- @entity_generators ||= domain_manifest.entities.map do |entity_manifest|
33
- EntityGenerator.new(entity_manifest)
31
+ def detached_entity_generators
32
+ @detached_entity_generators ||= domain_manifest.detached_entities.flat_map do |entity_manifest|
33
+ EntityVariantsGenerator.new(entity_manifest).dependencies.to_a
34
34
  end
35
35
  end
36
36
 
@@ -47,19 +47,55 @@ module Foobara
47
47
  end
48
48
 
49
49
  def model_generators
50
- # HERE!!!
51
50
  @model_generators ||= begin
52
51
  only_models = domain_manifest.models.reject(&:detached_entity?)
53
52
 
54
- only_models.map do |model_manifest|
55
- ModelGenerator.new(model_manifest)
53
+ only_models.flat_map do |model_manifest|
54
+ ModelVariantsGenerator.new(model_manifest).dependencies.to_a
56
55
  end
57
56
  end
58
57
  end
59
58
 
59
+ def all_type_generators
60
+ all_type_generators = []
61
+
62
+ generators_allowed_for_inputs = [*type_generators, *model_generators]
63
+ generators_allowed_for_errors_or_result = [*generators_allowed_for_inputs, *detached_entity_generators]
64
+
65
+ Manifest::RootManifest.new(root_manifest).commands.each do |command_manifest|
66
+ command_generator = CommandGenerator.new(command_manifest)
67
+
68
+ command_generator.inputs_types_depended_on.each do |type_manifest|
69
+ next unless type_manifest.domain == relevant_manifest
70
+
71
+ generators_allowed_for_inputs.each do |generator|
72
+ if generator.relevant_manifest == type_manifest
73
+ all_type_generators << generator
74
+ end
75
+ end
76
+ end
77
+
78
+ [
79
+ *command_generator.result_type&.to_type,
80
+ *command_generator.result_types_depended_on.each,
81
+ *command_generator.errors_types_depended_on
82
+ ].each do |type_manifest|
83
+ next unless type_manifest.domain == relevant_manifest
84
+
85
+ generators_allowed_for_errors_or_result.each do |generator|
86
+ if generator.relevant_manifest == type_manifest
87
+ all_type_generators << generator
88
+ end
89
+ end
90
+ end
91
+ end
92
+
93
+ all_type_generators.uniq!
94
+ all_type_generators
95
+ end
96
+
60
97
  def dependencies
61
- @dependencies ||= [*command_generators, *model_generators, *entity_generators, *type_generators,
62
- *organization]
98
+ @dependencies ||= [*command_generators, *all_type_generators, organization]
63
99
  end
64
100
 
65
101
  def domain_name
@@ -12,6 +12,6 @@ export <%= command.command_errors_index_generator.import_destructure %> from "<%
12
12
  <% end %>
13
13
 
14
14
  // TODO: put these on an entities module so that commands can be the only top-level interface.
15
- <% entity_generators.each do |entity| %>
15
+ <% all_type_generators.each do |entity| %>
16
16
  export <%= entity.import_destructure %> from "<%= path_to_root %><%= entity.import_path %>"
17
17
  <% end %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara-typescript-remote-command-generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi