tucana 0.0.25 → 0.0.26
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 +4 -4
- data/lib/tucana/generated/shared/shared.data_type_pb.rb +4 -1
- data/lib/tucana/generated/shared/shared.flow_definition_pb.rb +1 -2
- data/lib/tucana/generated/shared/shared.flow_pb.rb +2 -1
- data/lib/tucana/generated/shared/shared.runtime_function_pb.rb +2 -1
- data/lib/tucana/shared/shared.data_type.rb +117 -3
- data/lib/tucana/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f07ea8a7d06a2c7a7d07d9576d416e657e80d07ad5ebff41204af2e0125f4bab
|
4
|
+
data.tar.gz: ef9d0c2fdfae9534b2eec20f61a80cdc0498f9335f49094e8f56a91a694fc090
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c62af9482b6f95215c9f0f63d0919f54d9a555d278b921cb0801f1346d7ed786bcf2c47a1ee0f6463db47a4a5e86c1412fc457f6b422f85271030f545e3259c4
|
7
|
+
data.tar.gz: 50373c9f56b863ba7a387ecfe31375c61ef65906a0782027422add55ee01e8afb59258e7118837c45857845eeddf1fbb1e97e74c5af3700af74aa03f73eca38c
|
@@ -8,7 +8,7 @@ require_relative '../shared/shared.struct_pb'
|
|
8
8
|
require_relative '../shared/shared.translation_pb'
|
9
9
|
|
10
10
|
|
11
|
-
descriptor_data = "\n\x16shared.data_type.proto\x12\x06shared\x1a\x13shared.struct.proto\x1a\x18shared.translation.proto\"\
|
11
|
+
descriptor_data = "\n\x16shared.data_type.proto\x12\x06shared\x1a\x13shared.struct.proto\x1a\x18shared.translation.proto\"\xd8\x02\n\x08\x44\x61taType\x12)\n\x07variant\x18\x01 \x01(\x0e\x32\x18.shared.DataType.Variant\x12\x12\n\nidentifier\x18\x02 \x01(\t\x12!\n\x04name\x18\x03 \x03(\x0b\x32\x13.shared.Translation\x12#\n\x05rules\x18\x04 \x03(\x0b\x32\x14.shared.DataTypeRule\x12#\n\x16parent_type_identifier\x18\x05 \x01(\tH\x00\x88\x01\x01\x12\x14\n\x0cgeneric_keys\x18\x06 \x03(\t\"o\n\x07Variant\x12\x0b\n\x07UNKNOWN\x10\x00\x12\r\n\tPRIMITIVE\x10\x01\x12\x08\n\x04TYPE\x10\x02\x12\n\n\x06OBJECT\x10\x03\x12\x0c\n\x08\x44\x41TATYPE\x10\x04\x12\t\n\x05\x41RRAY\x10\x05\x12\x0b\n\x07GENERIC\x10\x06\x12\x0c\n\x08\x46UNCTION\x10\x07\x42\x19\n\x17_parent_type_identifier\"\xcd\x03\n\x0c\x44\x61taTypeRule\x12=\n\x0c\x63ontains_key\x18\x01 \x01(\x0b\x32%.shared.DataTypeContainsKeyRuleConfigH\x00\x12?\n\rcontains_type\x18\x02 \x01(\x0b\x32&.shared.DataTypeContainsTypeRuleConfigH\x00\x12H\n\x12item_of_collection\x18\x03 \x01(\x0b\x32*.shared.DataTypeItemOfCollectionRuleConfigH\x00\x12=\n\x0cnumber_range\x18\x04 \x01(\x0b\x32%.shared.DataTypeNumberRangeRuleConfigH\x00\x12\x30\n\x05regex\x18\x05 \x01(\x0b\x32\x1f.shared.DataTypeRegexRuleConfigH\x00\x12;\n\x0binput_types\x18\x06 \x01(\x0b\x32$.shared.DataTypeInputTypesRuleConfigH\x00\x12;\n\x0breturn_type\x18\x07 \x01(\x0b\x32$.shared.DataTypeReturnTypeRuleConfigH\x00\x42\x08\n\x06\x63onfig\"f\n\x1d\x44\x61taTypeContainsKeyRuleConfig\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x38\n\x14\x64\x61ta_type_identifier\x18\x02 \x01(\x0b\x32\x1a.shared.DataTypeIdentifier\"Z\n\x1e\x44\x61taTypeContainsTypeRuleConfig\x12\x38\n\x14\x64\x61ta_type_identifier\x18\x01 \x01(\x0b\x32\x1a.shared.DataTypeIdentifier\"B\n\"DataTypeItemOfCollectionRuleConfig\x12\x1c\n\x05items\x18\x01 \x03(\x0b\x32\r.shared.Value\"W\n\x1d\x44\x61taTypeNumberRangeRuleConfig\x12\x0c\n\x04\x66rom\x18\x01 \x01(\x03\x12\n\n\x02to\x18\x02 \x01(\x03\x12\x12\n\x05steps\x18\x03 \x01(\x03H\x00\x88\x01\x01\x42\x08\n\x06_steps\"*\n\x17\x44\x61taTypeRegexRuleConfig\x12\x0f\n\x07pattern\x18\x01 \x01(\t\"\xd4\x01\n\x1c\x44\x61taTypeInputTypesRuleConfig\x12K\n\x0binput_types\x18\x01 \x03(\x0b\x32\x36.shared.DataTypeInputTypesRuleConfig.DataTypeInputType\x1ag\n\x11\x44\x61taTypeInputType\x12\x38\n\x14\x64\x61ta_type_identifier\x18\x01 \x01(\x0b\x32\x1a.shared.DataTypeIdentifier\x12\x18\n\x10input_identifier\x18\x02 \x01(\t\"X\n\x1c\x44\x61taTypeReturnTypeRuleConfig\x12\x38\n\x14\x64\x61ta_type_identifier\x18\x01 \x01(\x0b\x32\x1a.shared.DataTypeIdentifier\"\x80\x01\n\x12\x44\x61taTypeIdentifier\x12\x1e\n\x14\x64\x61ta_type_identifier\x18\x01 \x01(\tH\x00\x12+\n\x0cgeneric_type\x18\x02 \x01(\x0b\x32\x13.shared.GenericTypeH\x00\x12\x15\n\x0bgeneric_key\x18\x03 \x01(\tH\x00\x42\x06\n\x04type\"v\n\x0bGenericType\x12\x38\n\x14\x64\x61ta_type_identifier\x18\x01 \x01(\x0b\x32\x1a.shared.DataTypeIdentifier\x12-\n\x0egeneric_mapper\x18\x02 \x03(\x0b\x32\x15.shared.GenericMapper\"|\n\rGenericMapper\x12:\n\x14\x64\x61ta_type_identifier\x18\x01 \x01(\x0b\x32\x1a.shared.DataTypeIdentifierH\x00\x12\x15\n\x0bgeneric_key\x18\x02 \x01(\tH\x00\x12\x0e\n\x06target\x18\x03 \x01(\tB\x08\n\x06sourceB\x11\xea\x02\x0eTucana::Sharedb\x06proto3"
|
12
12
|
|
13
13
|
pool = Google::Protobuf::DescriptorPool.generated_pool
|
14
14
|
pool.add_serialized_file(descriptor_data)
|
@@ -26,5 +26,8 @@ module Tucana
|
|
26
26
|
DataTypeInputTypesRuleConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("shared.DataTypeInputTypesRuleConfig").msgclass
|
27
27
|
DataTypeInputTypesRuleConfig::DataTypeInputType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("shared.DataTypeInputTypesRuleConfig.DataTypeInputType").msgclass
|
28
28
|
DataTypeReturnTypeRuleConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("shared.DataTypeReturnTypeRuleConfig").msgclass
|
29
|
+
DataTypeIdentifier = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("shared.DataTypeIdentifier").msgclass
|
30
|
+
GenericType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("shared.GenericType").msgclass
|
31
|
+
GenericMapper = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("shared.GenericMapper").msgclass
|
29
32
|
end
|
30
33
|
end
|
@@ -6,10 +6,9 @@ require 'google/protobuf'
|
|
6
6
|
|
7
7
|
require_relative '../shared/shared.translation_pb'
|
8
8
|
require_relative '../shared/shared.struct_pb'
|
9
|
-
require_relative '../shared/shared.flow_pb'
|
10
9
|
|
11
10
|
|
12
|
-
descriptor_data = "\n\x1cshared.flow_definition.proto\x12\x06shared\x1a\x18shared.translation.proto\x1a\x13shared.struct.proto\
|
11
|
+
descriptor_data = "\n\x1cshared.flow_definition.proto\x12\x06shared\x1a\x18shared.translation.proto\x1a\x13shared.struct.proto\"\xa6\x02\n\x08\x46lowType\x12\x12\n\nidentifier\x18\x01 \x01(\t\x12)\n\x08settings\x18\x02 \x03(\x0b\x32\x17.shared.FlowTypeSetting\x12\"\n\x15input_type_identifier\x18\x03 \x01(\tH\x00\x88\x01\x01\x12#\n\x16return_type_identifier\x18\x04 \x01(\tH\x01\x88\x01\x01\x12\x10\n\x08\x65\x64itable\x18\x05 \x01(\x08\x12!\n\x04name\x18\x06 \x03(\x0b\x32\x13.shared.Translation\x12(\n\x0b\x64\x65scription\x18\x07 \x03(\x0b\x32\x13.shared.TranslationB\x18\n\x16_input_type_identifierB\x19\n\x17_return_type_identifier\"\xdd\x01\n\x0f\x46lowTypeSetting\x12\x12\n\nidentifier\x18\x01 \x01(\t\x12\x0e\n\x06unique\x18\x02 \x01(\x08\x12\x1c\n\x14\x64\x61ta_type_identifier\x18\x03 \x01(\t\x12)\n\rdefault_value\x18\x04 \x01(\x0b\x32\r.shared.ValueH\x00\x88\x01\x01\x12!\n\x04name\x18\x05 \x03(\x0b\x32\x13.shared.Translation\x12(\n\x0b\x64\x65scription\x18\x06 \x03(\x0b\x32\x13.shared.TranslationB\x10\n\x0e_default_valueB\x11\xea\x02\x0eTucana::Sharedb\x06proto3"
|
13
12
|
|
14
13
|
pool = Google::Protobuf::DescriptorPool.generated_pool
|
15
14
|
pool.add_serialized_file(descriptor_data)
|
@@ -8,7 +8,7 @@ require_relative '../shared/shared.struct_pb'
|
|
8
8
|
require_relative '../shared/shared.data_type_pb'
|
9
9
|
|
10
10
|
|
11
|
-
descriptor_data = "\n\x11shared.flow.proto\x12\x06shared\x1a\x13shared.struct.proto\x1a\x16shared.data_type.proto\"\xb1\x02\n\x04\x46low\x12\x0f\n\x07\x66low_id\x18\x01 \x01(\x03\x12\x12\n\nproject_id\x18\x02 \x01(\x03\x12\x0c\n\x04type\x18\x03 \x01(\t\x12$\n\ndata_types\x18\x04 \x03(\x0b\x32\x10.shared.DataType\x12\"\n\x15input_type_identifier\x18\x05 \x01(\tH\x00\x88\x01\x01\x12#\n\x16return_type_identifier\x18\x06 \x01(\tH\x01\x88\x01\x01\x12%\n\x08settings\x18\x07 \x03(\x0b\x32\x13.shared.FlowSetting\x12+\n\rstarting_node\x18\x08 \x01(\x0b\x32\x14.shared.NodeFunctionB\x18\n\x16_input_type_identifierB\x19\n\x17_return_type_identifier\"`\n\x0b\x46lowSetting\x12\x31\n\ndefinition\x18\x01 \x01(\x0b\x32\x1d.shared.FlowSettingDefinition\x12\x1e\n\x06object\x18\x02 \x01(\x0b\x32\x0e.shared.Struct\"0\n\x15\x46lowSettingDefinition\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0b\n\x03key\x18\x02 \x01(\t\"\xa9\x01\n\x0cNodeFunction\x12\x32\n\ndefinition\x18\x01 \x01(\x0b\x32\x1e.shared.NodeFunctionDefinition\x12)\n\nparameters\x18\x02 \x03(\x0b\x32\x15.shared.NodeParameter\x12,\n\tnext_node\x18\x03 \x01(\x0b\x32\x14.shared.NodeFunctionH\x00\x88\x01\x01\x42\x0c\n\n_next_node\"\xd8\x01\n\rNodeParameter\x12\x33\n\ndefinition\x18\x01 \x01(\x0b\x32\x1f.shared.NodeParameterDefinition\x12&\n\rliteral_value\x18\x02 \x01(\x0b\x32\r.shared.ValueH\x00\x12\x31\n\x0freference_value\x18\x03 \x01(\x0b\x32\x16.shared.ReferenceValueH\x00\x12.\n\x0e\x66unction_value\x18\x04 \x01(\x0b\x32\x14.shared.NodeFunctionH\x00\x42\x07\n\x05value\"\
|
11
|
+
descriptor_data = "\n\x11shared.flow.proto\x12\x06shared\x1a\x13shared.struct.proto\x1a\x16shared.data_type.proto\"\xb1\x02\n\x04\x46low\x12\x0f\n\x07\x66low_id\x18\x01 \x01(\x03\x12\x12\n\nproject_id\x18\x02 \x01(\x03\x12\x0c\n\x04type\x18\x03 \x01(\t\x12$\n\ndata_types\x18\x04 \x03(\x0b\x32\x10.shared.DataType\x12\"\n\x15input_type_identifier\x18\x05 \x01(\tH\x00\x88\x01\x01\x12#\n\x16return_type_identifier\x18\x06 \x01(\tH\x01\x88\x01\x01\x12%\n\x08settings\x18\x07 \x03(\x0b\x32\x13.shared.FlowSetting\x12+\n\rstarting_node\x18\x08 \x01(\x0b\x32\x14.shared.NodeFunctionB\x18\n\x16_input_type_identifierB\x19\n\x17_return_type_identifier\"`\n\x0b\x46lowSetting\x12\x31\n\ndefinition\x18\x01 \x01(\x0b\x32\x1d.shared.FlowSettingDefinition\x12\x1e\n\x06object\x18\x02 \x01(\x0b\x32\x0e.shared.Struct\"0\n\x15\x46lowSettingDefinition\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0b\n\x03key\x18\x02 \x01(\t\"\xa9\x01\n\x0cNodeFunction\x12\x32\n\ndefinition\x18\x01 \x01(\x0b\x32\x1e.shared.NodeFunctionDefinition\x12)\n\nparameters\x18\x02 \x03(\x0b\x32\x15.shared.NodeParameter\x12,\n\tnext_node\x18\x03 \x01(\x0b\x32\x14.shared.NodeFunctionH\x00\x88\x01\x01\x42\x0c\n\n_next_node\"\xd8\x01\n\rNodeParameter\x12\x33\n\ndefinition\x18\x01 \x01(\x0b\x32\x1f.shared.NodeParameterDefinition\x12&\n\rliteral_value\x18\x02 \x01(\x0b\x32\r.shared.ValueH\x00\x12\x31\n\x0freference_value\x18\x03 \x01(\x0b\x32\x16.shared.ReferenceValueH\x00\x12.\n\x0e\x66unction_value\x18\x04 \x01(\x0b\x32\x14.shared.NodeFunctionH\x00\x42\x07\n\x05value\"\xcb\x01\n\x0eReferenceValue\x12\x33\n\x0ftype_identifier\x18\x01 \x01(\x0b\x32\x1a.shared.DataTypeIdentifier\x12\x15\n\rprimary_level\x18\x02 \x01(\x05\x12\x17\n\x0fsecondary_level\x18\x03 \x01(\x05\x12\x1b\n\x0etertiary_level\x18\x04 \x01(\x05H\x00\x88\x01\x01\x12$\n\x05paths\x18\x05 \x03(\x0b\x32\x15.shared.ReferencePathB\x11\n\x0f_tertiary_level\"U\n\rReferencePath\x12\x11\n\x04path\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x18\n\x0b\x61rray_index\x18\x02 \x01(\tH\x01\x88\x01\x01\x42\x07\n\x05_pathB\x0e\n\x0c_array_index\"M\n\x17NodeParameterDefinition\x12\x14\n\x0cparameter_id\x18\x01 \x01(\t\x12\x1c\n\x14runtime_parameter_id\x18\x02 \x01(\t\"J\n\x16NodeFunctionDefinition\x12\x13\n\x0b\x66unction_id\x18\x01 \x01(\t\x12\x1b\n\x13runtime_function_id\x18\x02 \x01(\t\"$\n\x05\x46lows\x12\x1b\n\x05\x66lows\x18\x01 \x03(\x0b\x32\x0c.shared.FlowB\x11\xea\x02\x0eTucana::Sharedb\x06proto3"
|
12
12
|
|
13
13
|
pool = Google::Protobuf::DescriptorPool.generated_pool
|
14
14
|
pool.add_serialized_file(descriptor_data)
|
@@ -21,6 +21,7 @@ module Tucana
|
|
21
21
|
NodeFunction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("shared.NodeFunction").msgclass
|
22
22
|
NodeParameter = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("shared.NodeParameter").msgclass
|
23
23
|
ReferenceValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("shared.ReferenceValue").msgclass
|
24
|
+
ReferencePath = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("shared.ReferencePath").msgclass
|
24
25
|
NodeParameterDefinition = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("shared.NodeParameterDefinition").msgclass
|
25
26
|
NodeFunctionDefinition = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("shared.NodeFunctionDefinition").msgclass
|
26
27
|
Flows = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("shared.Flows").msgclass
|
@@ -9,13 +9,14 @@ require_relative '../shared/shared.data_type_pb'
|
|
9
9
|
require_relative '../shared/shared.struct_pb'
|
10
10
|
|
11
11
|
|
12
|
-
descriptor_data = "\n\x1dshared.runtime_function.proto\x12\x06shared\x1a\x18shared.translation.proto\x1a\x16shared.data_type.proto\x1a\x13shared.struct.proto\"\
|
12
|
+
descriptor_data = "\n\x1dshared.runtime_function.proto\x12\x06shared\x1a\x18shared.translation.proto\x1a\x16shared.data_type.proto\x1a\x13shared.struct.proto\"\xae\x01\n\x15\x46unctionGenericMapper\x12:\n\x14\x64\x61ta_type_identifier\x18\x01 \x01(\x0b\x32\x1a.shared.DataTypeIdentifierH\x00\x12\x15\n\x0bgeneric_key\x18\x02 \x01(\tH\x00\x12\x0e\n\x06target\x18\x03 \x01(\t\x12\x18\n\x0bparamter_id\x18\x04 \x01(\tH\x01\x88\x01\x01\x42\x08\n\x06sourceB\x0e\n\x0c_paramter_id\"\xf1\x03\n\x19RuntimeFunctionDefinition\x12\x14\n\x0cruntime_name\x18\x01 \x01(\t\x12I\n\x1druntime_parameter_definitions\x18\x02 \x03(\x0b\x32\".shared.RuntimeParameterDefinition\x12?\n\x16return_type_identifier\x18\x03 \x01(\x0b\x32\x1a.shared.DataTypeIdentifierH\x00\x88\x01\x01\x12\x1e\n\x16\x65rror_type_identifiers\x18\x04 \x03(\t\x12\x14\n\x0cgeneric_keys\x18\x05 \x03(\t\x12\x36\n\x0fgeneric_mappers\x18\x06 \x03(\x0b\x32\x1d.shared.FunctionGenericMapper\x12!\n\x04name\x18\x07 \x03(\x0b\x32\x13.shared.Translation\x12(\n\x0b\x64\x65scription\x18\x08 \x03(\x0b\x32\x13.shared.Translation\x12*\n\rdocumentation\x18\t \x03(\x0b\x32\x13.shared.Translation\x12\x30\n\x13\x64\x65precation_message\x18\n \x03(\x0b\x32\x13.shared.TranslationB\x19\n\x17_return_type_identifier\"\xa2\x02\n\x1aRuntimeParameterDefinition\x12\x38\n\x14\x64\x61ta_type_identifier\x18\x01 \x01(\x0b\x32\x1a.shared.DataTypeIdentifier\x12\x14\n\x0cruntime_name\x18\x02 \x01(\t\x12)\n\rdefault_value\x18\x03 \x01(\x0b\x32\r.shared.ValueH\x00\x88\x01\x01\x12!\n\x04name\x18\x04 \x03(\x0b\x32\x13.shared.Translation\x12(\n\x0b\x64\x65scription\x18\x05 \x03(\x0b\x32\x13.shared.Translation\x12*\n\rdocumentation\x18\x06 \x03(\x0b\x32\x13.shared.TranslationB\x10\n\x0e_default_valueB\x11\xea\x02\x0eTucana::Sharedb\x06proto3"
|
13
13
|
|
14
14
|
pool = Google::Protobuf::DescriptorPool.generated_pool
|
15
15
|
pool.add_serialized_file(descriptor_data)
|
16
16
|
|
17
17
|
module Tucana
|
18
18
|
module Shared
|
19
|
+
FunctionGenericMapper = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("shared.FunctionGenericMapper").msgclass
|
19
20
|
RuntimeFunctionDefinition = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("shared.RuntimeFunctionDefinition").msgclass
|
20
21
|
RuntimeParameterDefinition = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("shared.RuntimeParameterDefinition").msgclass
|
21
22
|
end
|
@@ -3,6 +3,7 @@
|
|
3
3
|
module Tucana
|
4
4
|
module Shared
|
5
5
|
UnexpectedRuleType = Class.new(Tucana::Error)
|
6
|
+
UnexpectedType = Class.new(Tucana::Error)
|
6
7
|
|
7
8
|
DataTypeRule.class_eval do
|
8
9
|
def variant
|
@@ -54,7 +55,7 @@ module Tucana
|
|
54
55
|
end
|
55
56
|
|
56
57
|
def self.create(variant, config)
|
57
|
-
|
58
|
+
new.create(variant, config)
|
58
59
|
end
|
59
60
|
end
|
60
61
|
|
@@ -62,17 +63,28 @@ module Tucana
|
|
62
63
|
def to_h
|
63
64
|
{
|
64
65
|
key: self.key,
|
65
|
-
data_type_identifier: self.data_type_identifier,
|
66
|
+
data_type_identifier: self.data_type_identifier.to_h,
|
66
67
|
}
|
67
68
|
end
|
69
|
+
|
70
|
+
def self.from_hash(config)
|
71
|
+
new(
|
72
|
+
key: config[:key],
|
73
|
+
data_type_identifier: DataTypeIdentifier.from_hash(config[:data_type_identifier])
|
74
|
+
)
|
75
|
+
end
|
68
76
|
end
|
69
77
|
|
70
78
|
DataTypeContainsTypeRuleConfig.class_eval do
|
71
79
|
def to_h
|
72
80
|
{
|
73
|
-
data_type_identifier: self.data_type_identifier,
|
81
|
+
data_type_identifier: self.data_type_identifier.to_h,
|
74
82
|
}
|
75
83
|
end
|
84
|
+
|
85
|
+
def self.from_hash(config)
|
86
|
+
new(data_type_identifier: DataTypeIdentifier.from_hash(config[:data_type_identifier]))
|
87
|
+
end
|
76
88
|
end
|
77
89
|
|
78
90
|
DataTypeItemOfCollectionRuleConfig.class_eval do
|
@@ -111,6 +123,12 @@ module Tucana
|
|
111
123
|
input_types: self.input_types.map { |input_type| input_type.to_h }
|
112
124
|
}
|
113
125
|
end
|
126
|
+
|
127
|
+
def self.from_hash(hash)
|
128
|
+
new(
|
129
|
+
input_types: hash.fetch(:input_types).map { |input_type| DataTypeInputType.from_hash(input_type) }
|
130
|
+
)
|
131
|
+
end
|
114
132
|
end
|
115
133
|
|
116
134
|
DataTypeInputTypesRuleConfig::DataTypeInputType.class_eval do
|
@@ -120,6 +138,13 @@ module Tucana
|
|
120
138
|
input_identifier: self.input_identifier,
|
121
139
|
}
|
122
140
|
end
|
141
|
+
|
142
|
+
def self.from_hash(config)
|
143
|
+
new(
|
144
|
+
input_identifier: config[:input_identifier],
|
145
|
+
data_type_identifier: DataTypeIdentifier.from_hash(config[:data_type_identifier])
|
146
|
+
)
|
147
|
+
end
|
123
148
|
end
|
124
149
|
|
125
150
|
DataTypeReturnTypeRuleConfig.class_eval do
|
@@ -128,6 +153,95 @@ module Tucana
|
|
128
153
|
data_type_identifier: self.data_type_identifier,
|
129
154
|
}
|
130
155
|
end
|
156
|
+
|
157
|
+
def self.from_hash(config)
|
158
|
+
new(data_type_identifier: DataTypeIdentifier.from_hash(config[:data_type_identifier]))
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
DataTypeIdentifier.class_eval do
|
163
|
+
def to_h
|
164
|
+
{
|
165
|
+
data_type_identifier: self.data_type_identifier,
|
166
|
+
generic_type: self.generic_type ? self.generic_type.to_h : nil,
|
167
|
+
generic_key: self.generic_key,
|
168
|
+
}
|
169
|
+
end
|
170
|
+
|
171
|
+
def from_hash(config)
|
172
|
+
if config.keys.intersection([:data_type_identifier, :generic_type, :generic_key]).count > 1
|
173
|
+
raise UnexpectedType, "Cannot have more than one type"
|
174
|
+
end
|
175
|
+
|
176
|
+
if config.key?(:data_type_identifier)
|
177
|
+
self.data_type_identifier = config
|
178
|
+
elsif config.key?(:generic_type)
|
179
|
+
self.generic_type = GenericType.new(config)
|
180
|
+
elsif config.key?(:generic_key)
|
181
|
+
self.generic_key = config
|
182
|
+
else
|
183
|
+
raise UnexpectedType, "Unknown type"
|
184
|
+
end
|
185
|
+
|
186
|
+
self
|
187
|
+
end
|
188
|
+
|
189
|
+
def self.from_hash(config)
|
190
|
+
new.from_hash(config)
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
GenericType.class_eval do
|
195
|
+
def to_h
|
196
|
+
{
|
197
|
+
data_type_identifier: self.data_type_identifier.to_h,
|
198
|
+
generic_mapper: self.generic_mapper ? self.generic_mapper.to_h : nil,
|
199
|
+
}
|
200
|
+
end
|
201
|
+
|
202
|
+
def from_hash(config)
|
203
|
+
if config.key?(:data_type_identifier)
|
204
|
+
self.data_type_identifier = DataTypeIdentifier.from_hash(config.fetch(:data_type_identifier))
|
205
|
+
end
|
206
|
+
|
207
|
+
if config.key?(:generic_mapper)
|
208
|
+
self.generic_mapper = GenericMapper.from_hash(config.fetch(:generic_mapper))
|
209
|
+
end
|
210
|
+
|
211
|
+
self
|
212
|
+
end
|
213
|
+
|
214
|
+
def self.from_hash(config)
|
215
|
+
new.from_hash(config)
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
GenericMapper.class_eval do
|
220
|
+
def to_h
|
221
|
+
{
|
222
|
+
data_type_identifier: self.data_type_identifier.to_h,
|
223
|
+
generic_key: self.generic_key,
|
224
|
+
source: self.source,
|
225
|
+
}
|
226
|
+
end
|
227
|
+
|
228
|
+
def from_hash(config)
|
229
|
+
if config.keys.intersection([:data_type_identifier, :generic_key]).count > 1
|
230
|
+
raise UnexpectedType, "Cannot have more than one type"
|
231
|
+
end
|
232
|
+
|
233
|
+
if config.key?(:data_type_identifier)
|
234
|
+
self.data_type_identifier = DataTypeIdentifier.new(config.fetch(:data_type_identifier))
|
235
|
+
elsif config.key?(:generic_key)
|
236
|
+
self.generic_key = config.fetch(:generic_key)
|
237
|
+
end
|
238
|
+
|
239
|
+
self.source = config[:source]
|
240
|
+
end
|
241
|
+
|
242
|
+
def self.from_hash(config)
|
243
|
+
new.from_hash(config)
|
244
|
+
end
|
131
245
|
end
|
132
246
|
end
|
133
247
|
end
|
data/lib/tucana/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tucana
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Niklas van Schrick
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-05-
|
11
|
+
date: 2025-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grpc
|