foobara-typescript-remote-command-generator 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/src/remote_generator/services/aggregate_entity_generator.rb +1 -1
- data/src/remote_generator/services/aggregate_model_generator.rb +1 -1
- data/src/remote_generator/services/atom_entity_generator.rb +1 -1
- data/src/remote_generator/services/atom_model_generator.rb +1 -1
- data/src/remote_generator/services/command_result_generator.rb +17 -1
- data/src/remote_generator/services/domain_generator.rb +13 -1
- data/src/remote_generator/services/entity_generator.rb +5 -1
- data/src/remote_generator/services/entity_variants_generator.rb +3 -1
- data/src/remote_generator/services/error_generator.rb +1 -0
- data/src/remote_generator/services/loaded_entity_generator.rb +1 -1
- data/src/remote_generator/services/model_generator.rb +9 -1
- data/src/remote_generator/services/model_manifest_generator.rb +16 -1
- data/src/remote_generator/services/model_variants_generator.rb +1 -1
- data/src/remote_generator/services/type_generator.rb +19 -1
- data/src/remote_generator/services/unloaded_entity_generator.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: 69bd175fc5eecad6f5b353135377fcf15d164fa659e2ca130f641853f4b3c5e3
|
4
|
+
data.tar.gz: 38b135625b70aa997cd0744a5b7f1be524212a3257f61f108ed79ee29df6f85d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 163591e591ca0094197ee34e5ad97b4ffde5f8ac122cbbeeb3d10fd460035607c32108935f6d144459d8442bfaac9dafe3fd4283753cf8a1c20d2786d1168fcc
|
7
|
+
data.tar.gz: 9af4d1233e5c649b8e8ced9a6063c9ba1dafb729279308b49bedb570e6ee996aa81feb55e9bd5e313e8a389ad679ea0c89be71024c8e4fc55f6f9e45758e8905
|
data/CHANGELOG.md
CHANGED
@@ -53,6 +53,22 @@ module Foobara
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
+
def type_generators
|
57
|
+
@type_generators ||= begin
|
58
|
+
type = result_type
|
59
|
+
type = type.to_type if result_type.is_a?(Manifest::TypeDeclaration)
|
60
|
+
|
61
|
+
if !type.builtin? && !type.model?
|
62
|
+
# TODO: Test this!!
|
63
|
+
# :nocov:
|
64
|
+
[TypeGenerator.new(type)]
|
65
|
+
# :nocov:
|
66
|
+
else
|
67
|
+
[]
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
56
72
|
def atom?
|
57
73
|
serializers&.any? { |s| s == "Foobara::CommandConnectors::Serializers::AtomicSerializer" }
|
58
74
|
end
|
@@ -72,7 +88,7 @@ module Foobara
|
|
72
88
|
end
|
73
89
|
|
74
90
|
def dependencies
|
75
|
-
model_generators
|
91
|
+
model_generators + type_generators
|
76
92
|
end
|
77
93
|
end
|
78
94
|
end
|
@@ -34,6 +34,18 @@ module Foobara
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
+
def type_generators
|
38
|
+
@type_generators ||= begin
|
39
|
+
# TODO: create a Manifest::Domain#custom_types
|
40
|
+
only_custom_types = domain_manifest.types.reject(&:model?)
|
41
|
+
only_custom_types.reject!(&:builtin?)
|
42
|
+
|
43
|
+
only_custom_types.map do |type|
|
44
|
+
TypeGenerator.new(type)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
37
49
|
def model_generators
|
38
50
|
@model_generators ||= begin
|
39
51
|
only_models = domain_manifest.models.reject(&:entity?)
|
@@ -45,7 +57,7 @@ module Foobara
|
|
45
57
|
end
|
46
58
|
|
47
59
|
def dependencies
|
48
|
-
[*command_generators, *model_generators, *entity_generators, *organization]
|
60
|
+
[*command_generators, *model_generators, *entity_generators, *type_generators, *organization]
|
49
61
|
end
|
50
62
|
|
51
63
|
def domain_name
|
@@ -7,7 +7,7 @@ module Foobara
|
|
7
7
|
alias entity_manifest relevant_manifest
|
8
8
|
|
9
9
|
def target_path
|
10
|
-
[*
|
10
|
+
[*super[..-2], "Ambiguous.ts"]
|
11
11
|
end
|
12
12
|
|
13
13
|
def template_path
|
@@ -18,6 +18,10 @@ module Foobara
|
|
18
18
|
model_name(...)
|
19
19
|
end
|
20
20
|
|
21
|
+
def entity_short_name
|
22
|
+
model_short_name
|
23
|
+
end
|
24
|
+
|
21
25
|
def primary_key_name
|
22
26
|
primary_key_attribute
|
23
27
|
end
|
@@ -5,7 +5,9 @@ module Foobara
|
|
5
5
|
class Services
|
6
6
|
class EntityVariantsGenerator < EntityGenerator
|
7
7
|
def target_path
|
8
|
-
|
8
|
+
*prefix, _entity_name, _file = super
|
9
|
+
|
10
|
+
[*prefix, "#{entity_short_name}.ts"]
|
9
11
|
end
|
10
12
|
|
11
13
|
def template_path
|
@@ -20,13 +20,21 @@ module Foobara
|
|
20
20
|
alias model_manifest relevant_manifest
|
21
21
|
|
22
22
|
def target_path
|
23
|
-
[*domain.scoped_full_path, "
|
23
|
+
[*domain.scoped_full_path, "Types", *model_prefix, model_short_name, "#{model_short_name}.ts"]
|
24
|
+
end
|
25
|
+
|
26
|
+
def model_short_name
|
27
|
+
type_short_name
|
24
28
|
end
|
25
29
|
|
26
30
|
def template_path
|
27
31
|
["Model", "Model.ts.erb"]
|
28
32
|
end
|
29
33
|
|
34
|
+
def model_prefix
|
35
|
+
type_prefix
|
36
|
+
end
|
37
|
+
|
30
38
|
def model_name(points = nil)
|
31
39
|
type_name(points)
|
32
40
|
end
|
@@ -3,7 +3,22 @@ module Foobara
|
|
3
3
|
class Services
|
4
4
|
class ModelManifestGenerator < ManifestGenerator
|
5
5
|
def target_path
|
6
|
-
[*domain.scoped_full_path, "
|
6
|
+
[*domain.scoped_full_path, "Types", *model_prefix, scoped_short_name, "manifest.json"]
|
7
|
+
end
|
8
|
+
|
9
|
+
# TODO: DRY this up
|
10
|
+
def model_prefix
|
11
|
+
path = scoped_prefix
|
12
|
+
|
13
|
+
if path && !path.empty?
|
14
|
+
if path.first == "Types"
|
15
|
+
path[1..]
|
16
|
+
else
|
17
|
+
path
|
18
|
+
end
|
19
|
+
else
|
20
|
+
[]
|
21
|
+
end
|
7
22
|
end
|
8
23
|
end
|
9
24
|
end
|
@@ -21,13 +21,31 @@ module Foobara
|
|
21
21
|
alias type_manifest relevant_manifest
|
22
22
|
|
23
23
|
def target_path
|
24
|
-
[*domain.scoped_full_path, "
|
24
|
+
[*domain.scoped_full_path, "Types", *type_prefix, "#{type_short_name}.ts"]
|
25
|
+
end
|
26
|
+
|
27
|
+
def type_short_name
|
28
|
+
scoped_short_name
|
25
29
|
end
|
26
30
|
|
27
31
|
def template_path
|
28
32
|
["Type", "Type.ts.erb"]
|
29
33
|
end
|
30
34
|
|
35
|
+
def type_prefix
|
36
|
+
path = scoped_prefix
|
37
|
+
|
38
|
+
if path && !path.empty?
|
39
|
+
if path.first == "Types"
|
40
|
+
path[1..]
|
41
|
+
else
|
42
|
+
path
|
43
|
+
end
|
44
|
+
else
|
45
|
+
[]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
31
49
|
def scoped_full_path(points = nil)
|
32
50
|
full_path = type_manifest.scoped_full_path
|
33
51
|
|