prefab-cloud-ruby 0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -0
- data/Gemfile +9 -22
- data/Gemfile.lock +88 -160
- data/LICENSE.txt +1 -1
- data/Rakefile +14 -14
- data/VERSION +1 -1
- data/lib/prefab/auth_interceptor.rb +25 -0
- data/lib/prefab/client.rb +34 -139
- data/lib/prefab/config_client.rb +23 -275
- data/lib/prefab/config_loader.rb +27 -60
- data/lib/prefab/config_resolver.rb +40 -53
- data/lib/prefab/noop_cache.rb +13 -0
- data/lib/prefab/noop_stats.rb +8 -0
- data/lib/prefab/prefab_pb.rb +39 -0
- data/lib/prefab/prefab_services_pb.rb +37 -0
- data/lib/prefab/ratelimit_client.rb +58 -0
- data/lib/prefab/ratelimit_pb.rb +125 -0
- data/lib/prefab/store.rb +29 -0
- data/lib/prefab_client.rb +35 -0
- metadata +36 -198
- data/.envrc.sample +0 -3
- data/.github/workflows/ruby.yml +0 -46
- data/.gitmodules +0 -3
- data/.rubocop.yml +0 -13
- data/.tool-versions +0 -1
- data/CHANGELOG.md +0 -169
- data/CODEOWNERS +0 -1
- data/README.md +0 -94
- data/bin/console +0 -21
- data/compile_protos.sh +0 -18
- data/lib/prefab/config_client_presenter.rb +0 -18
- data/lib/prefab/config_value_unwrapper.rb +0 -115
- data/lib/prefab/config_value_wrapper.rb +0 -18
- data/lib/prefab/context.rb +0 -179
- data/lib/prefab/context_shape.rb +0 -20
- data/lib/prefab/context_shape_aggregator.rb +0 -65
- data/lib/prefab/criteria_evaluator.rb +0 -136
- data/lib/prefab/encryption.rb +0 -65
- data/lib/prefab/error.rb +0 -6
- data/lib/prefab/errors/env_var_parse_error.rb +0 -11
- data/lib/prefab/errors/initialization_timeout_error.rb +0 -13
- data/lib/prefab/errors/invalid_api_key_error.rb +0 -19
- data/lib/prefab/errors/missing_default_error.rb +0 -13
- data/lib/prefab/errors/missing_env_var_error.rb +0 -11
- data/lib/prefab/errors/uninitialized_error.rb +0 -13
- data/lib/prefab/evaluation.rb +0 -52
- data/lib/prefab/evaluation_summary_aggregator.rb +0 -87
- data/lib/prefab/example_contexts_aggregator.rb +0 -78
- data/lib/prefab/exponential_backoff.rb +0 -21
- data/lib/prefab/feature_flag_client.rb +0 -42
- data/lib/prefab/http_connection.rb +0 -41
- data/lib/prefab/internal_logger.rb +0 -16
- data/lib/prefab/local_config_parser.rb +0 -151
- data/lib/prefab/log_path_aggregator.rb +0 -69
- data/lib/prefab/logger_client.rb +0 -264
- data/lib/prefab/murmer3.rb +0 -50
- data/lib/prefab/options.rb +0 -208
- data/lib/prefab/periodic_sync.rb +0 -69
- data/lib/prefab/prefab.rb +0 -56
- data/lib/prefab/rate_limit_cache.rb +0 -41
- data/lib/prefab/resolved_config_presenter.rb +0 -86
- data/lib/prefab/time_helpers.rb +0 -7
- data/lib/prefab/weighted_value_resolver.rb +0 -42
- data/lib/prefab/yaml_config_parser.rb +0 -34
- data/lib/prefab-cloud-ruby.rb +0 -57
- data/lib/prefab_pb.rb +0 -93
- data/prefab-cloud-ruby.gemspec +0 -155
- data/test/.prefab.default.config.yaml +0 -2
- data/test/.prefab.unit_tests.config.yaml +0 -28
- data/test/integration_test.rb +0 -150
- data/test/integration_test_helpers.rb +0 -151
- data/test/support/common_helpers.rb +0 -180
- data/test/support/mock_base_client.rb +0 -42
- data/test/support/mock_config_client.rb +0 -19
- data/test/support/mock_config_loader.rb +0 -1
- data/test/test_client.rb +0 -444
- data/test/test_config_client.rb +0 -109
- data/test/test_config_loader.rb +0 -117
- data/test/test_config_resolver.rb +0 -430
- data/test/test_config_value_unwrapper.rb +0 -224
- data/test/test_config_value_wrapper.rb +0 -42
- data/test/test_context.rb +0 -203
- data/test/test_context_shape.rb +0 -50
- data/test/test_context_shape_aggregator.rb +0 -147
- data/test/test_criteria_evaluator.rb +0 -726
- data/test/test_encryption.rb +0 -16
- data/test/test_evaluation_summary_aggregator.rb +0 -162
- data/test/test_example_contexts_aggregator.rb +0 -238
- data/test/test_exponential_backoff.rb +0 -18
- data/test/test_feature_flag_client.rb +0 -48
- data/test/test_helper.rb +0 -17
- data/test/test_integration.rb +0 -58
- data/test/test_local_config_parser.rb +0 -147
- data/test/test_log_path_aggregator.rb +0 -62
- data/test/test_logger.rb +0 -621
- data/test/test_logger_initialization.rb +0 -12
- data/test/test_options.rb +0 -75
- data/test/test_prefab.rb +0 -12
- data/test/test_rate_limit_cache.rb +0 -44
- data/test/test_weighted_value_resolver.rb +0 -71
data/lib/prefab_pb.rb
DELETED
@@ -1,93 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
-
# source: prefab.proto
|
4
|
-
|
5
|
-
require 'google/protobuf'
|
6
|
-
|
7
|
-
|
8
|
-
descriptor_data = "\n\x0cprefab.proto\x12\x06prefab\"W\n\x14\x43onfigServicePointer\x12\x12\n\nproject_id\x18\x01 \x01(\x03\x12\x13\n\x0bstart_at_id\x18\x02 \x01(\x03\x12\x16\n\x0eproject_env_id\x18\x03 \x01(\x03\"\xc8\x03\n\x0b\x43onfigValue\x12\r\n\x03int\x18\x01 \x01(\x03H\x00\x12\x10\n\x06string\x18\x02 \x01(\tH\x00\x12\x0f\n\x05\x62ytes\x18\x03 \x01(\x0cH\x00\x12\x10\n\x06\x64ouble\x18\x04 \x01(\x01H\x00\x12\x0e\n\x04\x62ool\x18\x05 \x01(\x08H\x00\x12\x31\n\x0fweighted_values\x18\x06 \x01(\x0b\x32\x16.prefab.WeightedValuesH\x00\x12\x33\n\x10limit_definition\x18\x07 \x01(\x0b\x32\x17.prefab.LimitDefinitionH\x00\x12%\n\tlog_level\x18\t \x01(\x0e\x32\x10.prefab.LogLevelH\x00\x12)\n\x0bstring_list\x18\n \x01(\x0b\x32\x12.prefab.StringListH\x00\x12%\n\tint_range\x18\x0b \x01(\x0b\x32\x10.prefab.IntRangeH\x00\x12$\n\x08provided\x18\x0c \x01(\x0b\x32\x10.prefab.ProvidedH\x00\x12\x19\n\x0c\x63onfidential\x18\r \x01(\x08H\x01\x88\x01\x01\x12\x19\n\x0c\x64\x65\x63rypt_with\x18\x0e \x01(\tH\x02\x88\x01\x01\x42\x06\n\x04typeB\x0f\n\r_confidentialB\x0f\n\r_decrypt_with\"b\n\x08Provided\x12+\n\x06source\x18\x01 \x01(\x0e\x32\x16.prefab.ProvidedSourceH\x00\x88\x01\x01\x12\x13\n\x06lookup\x18\x02 \x01(\tH\x01\x88\x01\x01\x42\t\n\x07_sourceB\t\n\x07_lookup\"B\n\x08IntRange\x12\x12\n\x05start\x18\x01 \x01(\x03H\x00\x88\x01\x01\x12\x10\n\x03\x65nd\x18\x02 \x01(\x03H\x01\x88\x01\x01\x42\x08\n\x06_startB\x06\n\x04_end\"\x1c\n\nStringList\x12\x0e\n\x06values\x18\x01 \x03(\t\"C\n\rWeightedValue\x12\x0e\n\x06weight\x18\x01 \x01(\x05\x12\"\n\x05value\x18\x02 \x01(\x0b\x32\x13.prefab.ConfigValue\"~\n\x0eWeightedValues\x12.\n\x0fweighted_values\x18\x01 \x03(\x0b\x32\x15.prefab.WeightedValue\x12\"\n\x15hash_by_property_name\x18\x02 \x01(\tH\x00\x88\x01\x01\x42\x18\n\x16_hash_by_property_name\"X\n\x0e\x41piKeyMetadata\x12\x13\n\x06key_id\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x14\n\x07user_id\x18\x03 \x01(\tH\x01\x88\x01\x01\x42\t\n\x07_key_idB\n\n\x08_user_idJ\x04\x08\x02\x10\x03\"\xa0\x02\n\x07\x43onfigs\x12\x1f\n\x07\x63onfigs\x18\x01 \x03(\x0b\x32\x0e.prefab.Config\x12<\n\x16\x63onfig_service_pointer\x18\x02 \x01(\x0b\x32\x1c.prefab.ConfigServicePointer\x12\x34\n\x0f\x61pikey_metadata\x18\x03 \x01(\x0b\x32\x16.prefab.ApiKeyMetadataH\x00\x88\x01\x01\x12\x30\n\x0f\x64\x65\x66\x61ult_context\x18\x04 \x01(\x0b\x32\x12.prefab.ContextSetH\x01\x88\x01\x01\x12\x17\n\nkeep_alive\x18\x05 \x01(\x08H\x02\x88\x01\x01\x42\x12\n\x10_apikey_metadataB\x12\n\x10_default_contextB\r\n\x0b_keep_alive\"\xe4\x03\n\x06\x43onfig\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x12\n\nproject_id\x18\x02 \x01(\x03\x12\x0b\n\x03key\x18\x03 \x01(\t\x12%\n\nchanged_by\x18\x04 \x01(\x0b\x32\x11.prefab.ChangedBy\x12\x1f\n\x04rows\x18\x05 \x03(\x0b\x32\x11.prefab.ConfigRow\x12-\n\x10\x61llowable_values\x18\x06 \x03(\x0b\x32\x13.prefab.ConfigValue\x12\'\n\x0b\x63onfig_type\x18\x07 \x01(\x0e\x32\x12.prefab.ConfigType\x12\x15\n\x08\x64raft_id\x18\x08 \x01(\x03H\x00\x88\x01\x01\x12,\n\nvalue_type\x18\t \x01(\x0e\x32\x18.prefab.Config.ValueType\x12\x1a\n\x12send_to_client_sdk\x18\n \x01(\x08\"\x9e\x01\n\tValueType\x12\x16\n\x12NOT_SET_VALUE_TYPE\x10\x00\x12\x07\n\x03INT\x10\x01\x12\n\n\x06STRING\x10\x02\x12\t\n\x05\x42YTES\x10\x03\x12\n\n\x06\x44OUBLE\x10\x04\x12\x08\n\x04\x42OOL\x10\x05\x12\x14\n\x10LIMIT_DEFINITION\x10\x07\x12\r\n\tLOG_LEVEL\x10\t\x12\x0f\n\x0bSTRING_LIST\x10\n\x12\r\n\tINT_RANGE\x10\x0b\x42\x0b\n\t_draft_id\"?\n\tChangedBy\x12\x0f\n\x07user_id\x18\x01 \x01(\x03\x12\r\n\x05\x65mail\x18\x02 \x01(\t\x12\x12\n\napi_key_id\x18\x03 \x01(\t\"\xe4\x01\n\tConfigRow\x12\x1b\n\x0eproject_env_id\x18\x01 \x01(\x03H\x00\x88\x01\x01\x12(\n\x06values\x18\x02 \x03(\x0b\x32\x18.prefab.ConditionalValue\x12\x35\n\nproperties\x18\x03 \x03(\x0b\x32!.prefab.ConfigRow.PropertiesEntry\x1a\x46\n\x0fPropertiesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\"\n\x05value\x18\x02 \x01(\x0b\x32\x13.prefab.ConfigValue:\x02\x38\x01\x42\x11\n\x0f_project_env_id\"[\n\x10\x43onditionalValue\x12#\n\x08\x63riteria\x18\x01 \x03(\x0b\x32\x11.prefab.Criterion\x12\"\n\x05value\x18\x02 \x01(\x0b\x32\x13.prefab.ConfigValue\"\x94\x03\n\tCriterion\x12\x15\n\rproperty_name\x18\x01 \x01(\t\x12\x35\n\x08operator\x18\x02 \x01(\x0e\x32#.prefab.Criterion.CriterionOperator\x12+\n\x0evalue_to_match\x18\x03 \x01(\x0b\x32\x13.prefab.ConfigValue\"\x8b\x02\n\x11\x43riterionOperator\x12\x0b\n\x07NOT_SET\x10\x00\x12\x11\n\rLOOKUP_KEY_IN\x10\x01\x12\x15\n\x11LOOKUP_KEY_NOT_IN\x10\x02\x12\n\n\x06IN_SEG\x10\x03\x12\x0e\n\nNOT_IN_SEG\x10\x04\x12\x0f\n\x0b\x41LWAYS_TRUE\x10\x05\x12\x12\n\x0ePROP_IS_ONE_OF\x10\x06\x12\x16\n\x12PROP_IS_NOT_ONE_OF\x10\x07\x12\x19\n\x15PROP_ENDS_WITH_ONE_OF\x10\x08\x12!\n\x1dPROP_DOES_NOT_END_WITH_ONE_OF\x10\t\x12\x16\n\x12HIERARCHICAL_MATCH\x10\n\x12\x10\n\x0cIN_INT_RANGE\x10\x0b\"\x89\x01\n\x07Loggers\x12\x1f\n\x07loggers\x18\x01 \x03(\x0b\x32\x0e.prefab.Logger\x12\x10\n\x08start_at\x18\x02 \x01(\x03\x12\x0e\n\x06\x65nd_at\x18\x03 \x01(\x03\x12\x15\n\rinstance_hash\x18\x04 \x01(\t\x12\x16\n\tnamespace\x18\x05 \x01(\tH\x00\x88\x01\x01\x42\x0c\n\n_namespace\"\xd9\x01\n\x06Logger\x12\x13\n\x0blogger_name\x18\x01 \x01(\t\x12\x13\n\x06traces\x18\x02 \x01(\x03H\x00\x88\x01\x01\x12\x13\n\x06\x64\x65\x62ugs\x18\x03 \x01(\x03H\x01\x88\x01\x01\x12\x12\n\x05infos\x18\x04 \x01(\x03H\x02\x88\x01\x01\x12\x12\n\x05warns\x18\x05 \x01(\x03H\x03\x88\x01\x01\x12\x13\n\x06\x65rrors\x18\x06 \x01(\x03H\x04\x88\x01\x01\x12\x13\n\x06\x66\x61tals\x18\x07 \x01(\x03H\x05\x88\x01\x01\x42\t\n\x07_tracesB\t\n\x07_debugsB\x08\n\x06_infosB\x08\n\x06_warnsB\t\n\x07_errorsB\t\n\x07_fatals\"\x16\n\x14LoggerReportResponse\"\xdb\x03\n\rLimitResponse\x12\x0e\n\x06passed\x18\x01 \x01(\x08\x12\x12\n\nexpires_at\x18\x02 \x01(\x03\x12\x16\n\x0e\x65nforced_group\x18\x03 \x01(\t\x12\x16\n\x0e\x63urrent_bucket\x18\x04 \x01(\x03\x12\x14\n\x0cpolicy_group\x18\x05 \x01(\t\x12;\n\x0bpolicy_name\x18\x06 \x01(\x0e\x32&.prefab.LimitResponse.LimitPolicyNames\x12\x14\n\x0cpolicy_limit\x18\x07 \x01(\x05\x12\x0e\n\x06\x61mount\x18\x08 \x01(\x03\x12\x16\n\x0elimit_reset_at\x18\t \x01(\x03\x12\x39\n\x0csafety_level\x18\n \x01(\x0e\x32#.prefab.LimitDefinition.SafetyLevel\"\xa9\x01\n\x10LimitPolicyNames\x12\x0b\n\x07NOT_SET\x10\x00\x12\x14\n\x10SECONDLY_ROLLING\x10\x01\x12\x14\n\x10MINUTELY_ROLLING\x10\x03\x12\x12\n\x0eHOURLY_ROLLING\x10\x05\x12\x11\n\rDAILY_ROLLING\x10\x07\x12\x13\n\x0fMONTHLY_ROLLING\x10\x08\x12\x0c\n\x08INFINITE\x10\t\x12\x12\n\x0eYEARLY_ROLLING\x10\n\"\x99\x02\n\x0cLimitRequest\x12\x12\n\naccount_id\x18\x01 \x01(\x03\x12\x16\n\x0e\x61\x63quire_amount\x18\x02 \x01(\x05\x12\x0e\n\x06groups\x18\x03 \x03(\t\x12:\n\x0elimit_combiner\x18\x04 \x01(\x0e\x32\".prefab.LimitRequest.LimitCombiner\x12\x1e\n\x16\x61llow_partial_response\x18\x05 \x01(\x08\x12\x39\n\x0csafety_level\x18\x06 \x01(\x0e\x32#.prefab.LimitDefinition.SafetyLevel\"6\n\rLimitCombiner\x12\x0b\n\x07NOT_SET\x10\x00\x12\x0b\n\x07MINIMUM\x10\x01\x12\x0b\n\x07MAXIMUM\x10\x02\"/\n\nContextSet\x12!\n\x08\x63ontexts\x18\x01 \x03(\x0b\x32\x0f.prefab.Context\"\x96\x01\n\x07\x43ontext\x12\x11\n\x04type\x18\x01 \x01(\tH\x00\x88\x01\x01\x12+\n\x06values\x18\x02 \x03(\x0b\x32\x1b.prefab.Context.ValuesEntry\x1a\x42\n\x0bValuesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\"\n\x05value\x18\x02 \x01(\x0b\x32\x13.prefab.ConfigValue:\x02\x38\x01\x42\x07\n\x05_type\"\x93\x01\n\x08Identity\x12\x13\n\x06lookup\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x34\n\nattributes\x18\x02 \x03(\x0b\x32 .prefab.Identity.AttributesEntry\x1a\x31\n\x0f\x41ttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\t\n\x07_lookup\"\xd6\x02\n\x18\x43onfigEvaluationMetaData\x12\x1d\n\x10\x63onfig_row_index\x18\x01 \x01(\x03H\x00\x88\x01\x01\x12$\n\x17\x63onditional_value_index\x18\x02 \x01(\x03H\x01\x88\x01\x01\x12!\n\x14weighted_value_index\x18\x03 \x01(\x03H\x02\x88\x01\x01\x12%\n\x04type\x18\x04 \x01(\x0e\x32\x12.prefab.ConfigTypeH\x03\x88\x01\x01\x12\x0f\n\x02id\x18\x05 \x01(\x03H\x04\x88\x01\x01\x12\x31\n\nvalue_type\x18\x06 \x01(\x0e\x32\x18.prefab.Config.ValueTypeH\x05\x88\x01\x01\x42\x13\n\x11_config_row_indexB\x1a\n\x18_conditional_value_indexB\x17\n\x15_weighted_value_indexB\x07\n\x05_typeB\x05\n\x03_idB\r\n\x0b_value_type\"\xc1\x02\n\x11\x43lientConfigValue\x12\r\n\x03int\x18\x01 \x01(\x03H\x00\x12\x10\n\x06string\x18\x02 \x01(\tH\x00\x12\x10\n\x06\x64ouble\x18\x03 \x01(\x01H\x00\x12\x0e\n\x04\x62ool\x18\x04 \x01(\x08H\x00\x12%\n\tlog_level\x18\x05 \x01(\x0e\x32\x10.prefab.LogLevelH\x00\x12)\n\x0bstring_list\x18\x07 \x01(\x0b\x32\x12.prefab.StringListH\x00\x12%\n\tint_range\x18\x08 \x01(\x0b\x32\x10.prefab.IntRangeH\x00\x12I\n\x1a\x63onfig_evaluation_metadata\x18\x06 \x01(\x0b\x32 .prefab.ConfigEvaluationMetaDataH\x01\x88\x01\x01\x42\x06\n\x04typeB\x1d\n\x1b_config_evaluation_metadata\"\xa4\x02\n\x11\x43onfigEvaluations\x12\x35\n\x06values\x18\x01 \x03(\x0b\x32%.prefab.ConfigEvaluations.ValuesEntry\x12\x34\n\x0f\x61pikey_metadata\x18\x02 \x01(\x0b\x32\x16.prefab.ApiKeyMetadataH\x00\x88\x01\x01\x12\x30\n\x0f\x64\x65\x66\x61ult_context\x18\x03 \x01(\x0b\x32\x12.prefab.ContextSetH\x01\x88\x01\x01\x1aH\n\x0bValuesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12(\n\x05value\x18\x02 \x01(\x0b\x32\x19.prefab.ClientConfigValue:\x02\x38\x01\x42\x12\n\x10_apikey_metadataB\x12\n\x10_default_context\"\xa8\x02\n\x0fLimitDefinition\x12;\n\x0bpolicy_name\x18\x02 \x01(\x0e\x32&.prefab.LimitResponse.LimitPolicyNames\x12\r\n\x05limit\x18\x03 \x01(\x05\x12\r\n\x05\x62urst\x18\x04 \x01(\x05\x12\x12\n\naccount_id\x18\x05 \x01(\x03\x12\x15\n\rlast_modified\x18\x06 \x01(\x03\x12\x12\n\nreturnable\x18\x07 \x01(\x08\x12\x39\n\x0csafety_level\x18\x08 \x01(\x0e\x32#.prefab.LimitDefinition.SafetyLevel\"@\n\x0bSafetyLevel\x12\x0b\n\x07NOT_SET\x10\x00\x12\x12\n\x0eL4_BEST_EFFORT\x10\x04\x12\x10\n\x0cL5_BOMBPROOF\x10\x05\"@\n\x10LimitDefinitions\x12,\n\x0b\x64\x65\x66initions\x18\x01 \x03(\x0b\x32\x17.prefab.LimitDefinition\"\x8a\x01\n\x0f\x42ufferedRequest\x12\x12\n\naccount_id\x18\x01 \x01(\x03\x12\x0e\n\x06method\x18\x02 \x01(\t\x12\x0b\n\x03uri\x18\x03 \x01(\t\x12\x0c\n\x04\x62ody\x18\x04 \x01(\t\x12\x14\n\x0climit_groups\x18\x05 \x03(\t\x12\x14\n\x0c\x63ontent_type\x18\x06 \x01(\t\x12\x0c\n\x04\x66ifo\x18\x07 \x01(\x08\"\x94\x01\n\x0c\x42\x61tchRequest\x12\x12\n\naccount_id\x18\x01 \x01(\x03\x12\x0e\n\x06method\x18\x02 \x01(\t\x12\x0b\n\x03uri\x18\x03 \x01(\t\x12\x0c\n\x04\x62ody\x18\x04 \x01(\t\x12\x14\n\x0climit_groups\x18\x05 \x03(\t\x12\x16\n\x0e\x62\x61tch_template\x18\x06 \x01(\t\x12\x17\n\x0f\x62\x61tch_separator\x18\x07 \x01(\t\" \n\rBasicResponse\x12\x0f\n\x07message\x18\x01 \x01(\t\"3\n\x10\x43reationResponse\x12\x0f\n\x07message\x18\x01 \x01(\t\x12\x0e\n\x06new_id\x18\x02 \x01(\x03\"h\n\x07IdBlock\x12\x12\n\nproject_id\x18\x01 \x01(\x03\x12\x16\n\x0eproject_env_id\x18\x02 \x01(\x03\x12\x15\n\rsequence_name\x18\x03 \x01(\t\x12\r\n\x05start\x18\x04 \x01(\x03\x12\x0b\n\x03\x65nd\x18\x05 \x01(\x03\"a\n\x0eIdBlockRequest\x12\x12\n\nproject_id\x18\x01 \x01(\x03\x12\x16\n\x0eproject_env_id\x18\x02 \x01(\x03\x12\x15\n\rsequence_name\x18\x03 \x01(\t\x12\x0c\n\x04size\x18\x04 \x01(\x03\"\x8a\x01\n\x0c\x43ontextShape\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x39\n\x0b\x66ield_types\x18\x02 \x03(\x0b\x32$.prefab.ContextShape.FieldTypesEntry\x1a\x31\n\x0f\x46ieldTypesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\"[\n\rContextShapes\x12$\n\x06shapes\x18\x01 \x03(\x0b\x32\x14.prefab.ContextShape\x12\x16\n\tnamespace\x18\x02 \x01(\tH\x00\x88\x01\x01\x42\x0c\n\n_namespace\"C\n\rEvaluatedKeys\x12\x0c\n\x04keys\x18\x01 \x03(\t\x12\x16\n\tnamespace\x18\x02 \x01(\tH\x00\x88\x01\x01\x42\x0c\n\n_namespace\"\x93\x01\n\x0f\x45valuatedConfig\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x16\n\x0e\x63onfig_version\x18\x02 \x01(\x03\x12#\n\x06result\x18\x03 \x01(\x0b\x32\x13.prefab.ConfigValue\x12#\n\x07\x63ontext\x18\x04 \x01(\x0b\x32\x12.prefab.ContextSet\x12\x11\n\ttimestamp\x18\x05 \x01(\x03\"<\n\x10\x45valuatedConfigs\x12(\n\x07\x63onfigs\x18\x01 \x03(\x0b\x32\x17.prefab.EvaluatedConfig\"\xc4\x03\n\x17\x43onfigEvaluationCounter\x12\r\n\x05\x63ount\x18\x01 \x01(\x03\x12\x16\n\tconfig_id\x18\x02 \x01(\x03H\x00\x88\x01\x01\x12\x1b\n\x0eselected_index\x18\x03 \x01(\rH\x01\x88\x01\x01\x12\x30\n\x0eselected_value\x18\x04 \x01(\x0b\x32\x13.prefab.ConfigValueH\x02\x88\x01\x01\x12\x1d\n\x10\x63onfig_row_index\x18\x05 \x01(\rH\x03\x88\x01\x01\x12$\n\x17\x63onditional_value_index\x18\x06 \x01(\rH\x04\x88\x01\x01\x12!\n\x14weighted_value_index\x18\x07 \x01(\rH\x05\x88\x01\x01\x12\x36\n\x06reason\x18\x08 \x01(\x0e\x32&.prefab.ConfigEvaluationCounter.Reason\"\x15\n\x06Reason\x12\x0b\n\x07UNKNOWN\x10\x00\x42\x0c\n\n_config_idB\x11\n\x0f_selected_indexB\x11\n\x0f_selected_valueB\x13\n\x11_config_row_indexB\x1a\n\x18_conditional_value_indexB\x17\n\x15_weighted_value_index\"{\n\x17\x43onfigEvaluationSummary\x12\x0b\n\x03key\x18\x01 \x01(\t\x12 \n\x04type\x18\x02 \x01(\x0e\x32\x12.prefab.ConfigType\x12\x31\n\x08\x63ounters\x18\x03 \x03(\x0b\x32\x1f.prefab.ConfigEvaluationCounter\"k\n\x19\x43onfigEvaluationSummaries\x12\r\n\x05start\x18\x01 \x01(\x03\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x03\x12\x32\n\tsummaries\x18\x03 \x03(\x0b\x32\x1f.prefab.ConfigEvaluationSummary\"Z\n\x15LoggersTelemetryEvent\x12\x1f\n\x07loggers\x18\x01 \x03(\x0b\x32\x0e.prefab.Logger\x12\x10\n\x08start_at\x18\x02 \x01(\x03\x12\x0e\n\x06\x65nd_at\x18\x03 \x01(\x03\"\x98\x02\n\x0eTelemetryEvent\x12\x36\n\tsummaries\x18\x02 \x01(\x0b\x32!.prefab.ConfigEvaluationSummariesH\x00\x12\x33\n\x10\x65xample_contexts\x18\x03 \x01(\x0b\x32\x17.prefab.ExampleContextsH\x00\x12+\n\x0c\x63lient_stats\x18\x04 \x01(\x0b\x32\x13.prefab.ClientStatsH\x00\x12\x30\n\x07loggers\x18\x05 \x01(\x0b\x32\x1d.prefab.LoggersTelemetryEventH\x00\x12/\n\x0e\x63ontext_shapes\x18\x06 \x01(\x0b\x32\x15.prefab.ContextShapesH\x00\x42\t\n\x07payload\"P\n\x0fTelemetryEvents\x12\x15\n\rinstance_hash\x18\x01 \x01(\t\x12&\n\x06\x65vents\x18\x02 \x03(\x0b\x32\x16.prefab.TelemetryEvent\"*\n\x17TelemetryEventsResponse\x12\x0f\n\x07success\x18\x01 \x01(\x08\";\n\x0f\x45xampleContexts\x12(\n\x08\x65xamples\x18\x01 \x03(\x0b\x32\x16.prefab.ExampleContext\"K\n\x0e\x45xampleContext\x12\x11\n\ttimestamp\x18\x01 \x01(\x03\x12&\n\ncontextSet\x18\x02 \x01(\x0b\x32\x12.prefab.ContextSet\"F\n\x0b\x43lientStats\x12\r\n\x05start\x18\x01 \x01(\x03\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x03\x12\x1b\n\x13\x64ropped_event_count\x18\x03 \x01(\x04*:\n\x0eProvidedSource\x12\x1b\n\x17PROVIDED_SOURCE_NOT_SET\x10\x00\x12\x0b\n\x07\x45NV_VAR\x10\x01*\x82\x01\n\nConfigType\x12\x17\n\x13NOT_SET_CONFIG_TYPE\x10\x00\x12\n\n\x06\x43ONFIG\x10\x01\x12\x10\n\x0c\x46\x45\x41TURE_FLAG\x10\x02\x12\r\n\tLOG_LEVEL\x10\x03\x12\x0b\n\x07SEGMENT\x10\x04\x12\x14\n\x10LIMIT_DEFINITION\x10\x05\x12\x0b\n\x07\x44\x45LETED\x10\x06*a\n\x08LogLevel\x12\x15\n\x11NOT_SET_LOG_LEVEL\x10\x00\x12\t\n\x05TRACE\x10\x01\x12\t\n\x05\x44\x45\x42UG\x10\x02\x12\x08\n\x04INFO\x10\x03\x12\x08\n\x04WARN\x10\x05\x12\t\n\x05\x45RROR\x10\x06\x12\t\n\x05\x46\x41TAL\x10\t*G\n\tOnFailure\x12\x0b\n\x07NOT_SET\x10\x00\x12\x10\n\x0cLOG_AND_PASS\x10\x01\x12\x10\n\x0cLOG_AND_FAIL\x10\x02\x12\t\n\x05THROW\x10\x03\x42\x1d\n\x13\x63loud.prefab.domainB\x06Prefabb\x06proto3"
|
9
|
-
|
10
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
11
|
-
|
12
|
-
begin
|
13
|
-
pool.add_serialized_file(descriptor_data)
|
14
|
-
rescue TypeError
|
15
|
-
# Compatibility code: will be removed in the next major version.
|
16
|
-
require 'google/protobuf/descriptor_pb'
|
17
|
-
parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
|
18
|
-
parsed.clear_dependency
|
19
|
-
serialized = parsed.class.encode(parsed)
|
20
|
-
file = pool.add_serialized_file(serialized)
|
21
|
-
warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
|
22
|
-
imports = [
|
23
|
-
]
|
24
|
-
imports.each do |type_name, expected_filename|
|
25
|
-
import_file = pool.lookup(type_name).file_descriptor
|
26
|
-
if import_file.name != expected_filename
|
27
|
-
warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
warn "Each proto file must use a consistent fully-qualified name."
|
31
|
-
warn "This will become an error in the next major version."
|
32
|
-
end
|
33
|
-
|
34
|
-
module PrefabProto
|
35
|
-
ConfigServicePointer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ConfigServicePointer").msgclass
|
36
|
-
ConfigValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ConfigValue").msgclass
|
37
|
-
Provided = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.Provided").msgclass
|
38
|
-
IntRange = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.IntRange").msgclass
|
39
|
-
StringList = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.StringList").msgclass
|
40
|
-
WeightedValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.WeightedValue").msgclass
|
41
|
-
WeightedValues = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.WeightedValues").msgclass
|
42
|
-
ApiKeyMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ApiKeyMetadata").msgclass
|
43
|
-
Configs = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.Configs").msgclass
|
44
|
-
Config = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.Config").msgclass
|
45
|
-
Config::ValueType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.Config.ValueType").enummodule
|
46
|
-
ChangedBy = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ChangedBy").msgclass
|
47
|
-
ConfigRow = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ConfigRow").msgclass
|
48
|
-
ConditionalValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ConditionalValue").msgclass
|
49
|
-
Criterion = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.Criterion").msgclass
|
50
|
-
Criterion::CriterionOperator = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.Criterion.CriterionOperator").enummodule
|
51
|
-
Loggers = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.Loggers").msgclass
|
52
|
-
Logger = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.Logger").msgclass
|
53
|
-
LoggerReportResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.LoggerReportResponse").msgclass
|
54
|
-
LimitResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.LimitResponse").msgclass
|
55
|
-
LimitResponse::LimitPolicyNames = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.LimitResponse.LimitPolicyNames").enummodule
|
56
|
-
LimitRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.LimitRequest").msgclass
|
57
|
-
LimitRequest::LimitCombiner = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.LimitRequest.LimitCombiner").enummodule
|
58
|
-
ContextSet = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ContextSet").msgclass
|
59
|
-
Context = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.Context").msgclass
|
60
|
-
Identity = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.Identity").msgclass
|
61
|
-
ConfigEvaluationMetaData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ConfigEvaluationMetaData").msgclass
|
62
|
-
ClientConfigValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ClientConfigValue").msgclass
|
63
|
-
ConfigEvaluations = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ConfigEvaluations").msgclass
|
64
|
-
LimitDefinition = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.LimitDefinition").msgclass
|
65
|
-
LimitDefinition::SafetyLevel = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.LimitDefinition.SafetyLevel").enummodule
|
66
|
-
LimitDefinitions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.LimitDefinitions").msgclass
|
67
|
-
BufferedRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.BufferedRequest").msgclass
|
68
|
-
BatchRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.BatchRequest").msgclass
|
69
|
-
BasicResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.BasicResponse").msgclass
|
70
|
-
CreationResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.CreationResponse").msgclass
|
71
|
-
IdBlock = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.IdBlock").msgclass
|
72
|
-
IdBlockRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.IdBlockRequest").msgclass
|
73
|
-
ContextShape = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ContextShape").msgclass
|
74
|
-
ContextShapes = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ContextShapes").msgclass
|
75
|
-
EvaluatedKeys = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.EvaluatedKeys").msgclass
|
76
|
-
EvaluatedConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.EvaluatedConfig").msgclass
|
77
|
-
EvaluatedConfigs = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.EvaluatedConfigs").msgclass
|
78
|
-
ConfigEvaluationCounter = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ConfigEvaluationCounter").msgclass
|
79
|
-
ConfigEvaluationCounter::Reason = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ConfigEvaluationCounter.Reason").enummodule
|
80
|
-
ConfigEvaluationSummary = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ConfigEvaluationSummary").msgclass
|
81
|
-
ConfigEvaluationSummaries = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ConfigEvaluationSummaries").msgclass
|
82
|
-
LoggersTelemetryEvent = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.LoggersTelemetryEvent").msgclass
|
83
|
-
TelemetryEvent = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.TelemetryEvent").msgclass
|
84
|
-
TelemetryEvents = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.TelemetryEvents").msgclass
|
85
|
-
TelemetryEventsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.TelemetryEventsResponse").msgclass
|
86
|
-
ExampleContexts = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ExampleContexts").msgclass
|
87
|
-
ExampleContext = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ExampleContext").msgclass
|
88
|
-
ClientStats = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ClientStats").msgclass
|
89
|
-
ProvidedSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ProvidedSource").enummodule
|
90
|
-
ConfigType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.ConfigType").enummodule
|
91
|
-
LogLevel = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.LogLevel").enummodule
|
92
|
-
OnFailure = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("prefab.OnFailure").enummodule
|
93
|
-
end
|
data/prefab-cloud-ruby.gemspec
DELETED
@@ -1,155 +0,0 @@
|
|
1
|
-
# Generated by juwelier
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: prefab-cloud-ruby 0 ruby lib
|
6
|
-
|
7
|
-
Gem::Specification.new do |s|
|
8
|
-
s.name = "prefab-cloud-ruby".freeze
|
9
|
-
s.version = "0"
|
10
|
-
|
11
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
|
-
s.require_paths = ["lib".freeze]
|
13
|
-
s.authors = ["Jeff Dwyer".freeze]
|
14
|
-
s.date = "2024-02-22"
|
15
|
-
s.description = "Feature Flags, Live Config, and Dynamic Log Levels as a service".freeze
|
16
|
-
s.email = "jdwyer@prefab.cloud".freeze
|
17
|
-
s.executables = ["console".freeze]
|
18
|
-
s.extra_rdoc_files = [
|
19
|
-
"CHANGELOG.md",
|
20
|
-
"LICENSE.txt",
|
21
|
-
"README.md"
|
22
|
-
]
|
23
|
-
s.files = [
|
24
|
-
".envrc.sample",
|
25
|
-
".github/workflows/ruby.yml",
|
26
|
-
".gitmodules",
|
27
|
-
".rubocop.yml",
|
28
|
-
".tool-versions",
|
29
|
-
"CHANGELOG.md",
|
30
|
-
"CODEOWNERS",
|
31
|
-
"Gemfile",
|
32
|
-
"Gemfile.lock",
|
33
|
-
"LICENSE.txt",
|
34
|
-
"README.md",
|
35
|
-
"Rakefile",
|
36
|
-
"VERSION",
|
37
|
-
"bin/console",
|
38
|
-
"compile_protos.sh",
|
39
|
-
"lib/prefab-cloud-ruby.rb",
|
40
|
-
"lib/prefab/client.rb",
|
41
|
-
"lib/prefab/config_client.rb",
|
42
|
-
"lib/prefab/config_client_presenter.rb",
|
43
|
-
"lib/prefab/config_loader.rb",
|
44
|
-
"lib/prefab/config_resolver.rb",
|
45
|
-
"lib/prefab/config_value_unwrapper.rb",
|
46
|
-
"lib/prefab/config_value_wrapper.rb",
|
47
|
-
"lib/prefab/context.rb",
|
48
|
-
"lib/prefab/context_shape.rb",
|
49
|
-
"lib/prefab/context_shape_aggregator.rb",
|
50
|
-
"lib/prefab/criteria_evaluator.rb",
|
51
|
-
"lib/prefab/encryption.rb",
|
52
|
-
"lib/prefab/error.rb",
|
53
|
-
"lib/prefab/errors/env_var_parse_error.rb",
|
54
|
-
"lib/prefab/errors/initialization_timeout_error.rb",
|
55
|
-
"lib/prefab/errors/invalid_api_key_error.rb",
|
56
|
-
"lib/prefab/errors/missing_default_error.rb",
|
57
|
-
"lib/prefab/errors/missing_env_var_error.rb",
|
58
|
-
"lib/prefab/errors/uninitialized_error.rb",
|
59
|
-
"lib/prefab/evaluation.rb",
|
60
|
-
"lib/prefab/evaluation_summary_aggregator.rb",
|
61
|
-
"lib/prefab/example_contexts_aggregator.rb",
|
62
|
-
"lib/prefab/exponential_backoff.rb",
|
63
|
-
"lib/prefab/feature_flag_client.rb",
|
64
|
-
"lib/prefab/http_connection.rb",
|
65
|
-
"lib/prefab/internal_logger.rb",
|
66
|
-
"lib/prefab/local_config_parser.rb",
|
67
|
-
"lib/prefab/log_path_aggregator.rb",
|
68
|
-
"lib/prefab/logger_client.rb",
|
69
|
-
"lib/prefab/murmer3.rb",
|
70
|
-
"lib/prefab/options.rb",
|
71
|
-
"lib/prefab/periodic_sync.rb",
|
72
|
-
"lib/prefab/prefab.rb",
|
73
|
-
"lib/prefab/rate_limit_cache.rb",
|
74
|
-
"lib/prefab/resolved_config_presenter.rb",
|
75
|
-
"lib/prefab/time_helpers.rb",
|
76
|
-
"lib/prefab/weighted_value_resolver.rb",
|
77
|
-
"lib/prefab/yaml_config_parser.rb",
|
78
|
-
"lib/prefab_pb.rb",
|
79
|
-
"prefab-cloud-ruby.gemspec",
|
80
|
-
"test/.prefab.default.config.yaml",
|
81
|
-
"test/.prefab.unit_tests.config.yaml",
|
82
|
-
"test/integration_test.rb",
|
83
|
-
"test/integration_test_helpers.rb",
|
84
|
-
"test/support/common_helpers.rb",
|
85
|
-
"test/support/mock_base_client.rb",
|
86
|
-
"test/support/mock_config_client.rb",
|
87
|
-
"test/support/mock_config_loader.rb",
|
88
|
-
"test/test_client.rb",
|
89
|
-
"test/test_config_client.rb",
|
90
|
-
"test/test_config_loader.rb",
|
91
|
-
"test/test_config_resolver.rb",
|
92
|
-
"test/test_config_value_unwrapper.rb",
|
93
|
-
"test/test_config_value_wrapper.rb",
|
94
|
-
"test/test_context.rb",
|
95
|
-
"test/test_context_shape.rb",
|
96
|
-
"test/test_context_shape_aggregator.rb",
|
97
|
-
"test/test_criteria_evaluator.rb",
|
98
|
-
"test/test_encryption.rb",
|
99
|
-
"test/test_evaluation_summary_aggregator.rb",
|
100
|
-
"test/test_example_contexts_aggregator.rb",
|
101
|
-
"test/test_exponential_backoff.rb",
|
102
|
-
"test/test_feature_flag_client.rb",
|
103
|
-
"test/test_helper.rb",
|
104
|
-
"test/test_integration.rb",
|
105
|
-
"test/test_local_config_parser.rb",
|
106
|
-
"test/test_log_path_aggregator.rb",
|
107
|
-
"test/test_logger.rb",
|
108
|
-
"test/test_logger_initialization.rb",
|
109
|
-
"test/test_options.rb",
|
110
|
-
"test/test_prefab.rb",
|
111
|
-
"test/test_rate_limit_cache.rb",
|
112
|
-
"test/test_weighted_value_resolver.rb"
|
113
|
-
]
|
114
|
-
s.homepage = "http://github.com/prefab-cloud/prefab-cloud-ruby".freeze
|
115
|
-
s.licenses = ["MIT".freeze]
|
116
|
-
s.rubygems_version = "3.2.32".freeze
|
117
|
-
s.summary = "Prefab Ruby Infrastructure".freeze
|
118
|
-
|
119
|
-
if s.respond_to? :specification_version then
|
120
|
-
s.specification_version = 4
|
121
|
-
end
|
122
|
-
|
123
|
-
if s.respond_to? :add_runtime_dependency then
|
124
|
-
s.add_runtime_dependency(%q<concurrent-ruby>.freeze, ["~> 1.0", ">= 1.0.5"])
|
125
|
-
s.add_runtime_dependency(%q<faraday>.freeze, [">= 0"])
|
126
|
-
s.add_runtime_dependency(%q<googleapis-common-protos-types>.freeze, [">= 0"])
|
127
|
-
s.add_runtime_dependency(%q<google-protobuf>.freeze, [">= 0"])
|
128
|
-
s.add_runtime_dependency(%q<ld-eventsource>.freeze, [">= 0"])
|
129
|
-
s.add_runtime_dependency(%q<uuid>.freeze, [">= 0"])
|
130
|
-
s.add_runtime_dependency(%q<activesupport>.freeze, [">= 4"])
|
131
|
-
s.add_runtime_dependency(%q<actionpack>.freeze, [">= 4"])
|
132
|
-
s.add_runtime_dependency(%q<semantic_logger>.freeze, [">= 0"])
|
133
|
-
s.add_development_dependency(%q<benchmark-ips>.freeze, [">= 0"])
|
134
|
-
s.add_development_dependency(%q<bundler>.freeze, [">= 0"])
|
135
|
-
s.add_development_dependency(%q<juwelier>.freeze, ["~> 2.4.9"])
|
136
|
-
s.add_development_dependency(%q<rdoc>.freeze, [">= 0"])
|
137
|
-
s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
|
138
|
-
else
|
139
|
-
s.add_dependency(%q<concurrent-ruby>.freeze, ["~> 1.0", ">= 1.0.5"])
|
140
|
-
s.add_dependency(%q<faraday>.freeze, [">= 0"])
|
141
|
-
s.add_dependency(%q<googleapis-common-protos-types>.freeze, [">= 0"])
|
142
|
-
s.add_dependency(%q<google-protobuf>.freeze, [">= 0"])
|
143
|
-
s.add_dependency(%q<ld-eventsource>.freeze, [">= 0"])
|
144
|
-
s.add_dependency(%q<uuid>.freeze, [">= 0"])
|
145
|
-
s.add_dependency(%q<activesupport>.freeze, [">= 4"])
|
146
|
-
s.add_dependency(%q<actionpack>.freeze, [">= 4"])
|
147
|
-
s.add_dependency(%q<semantic_logger>.freeze, [">= 0"])
|
148
|
-
s.add_dependency(%q<benchmark-ips>.freeze, [">= 0"])
|
149
|
-
s.add_dependency(%q<bundler>.freeze, [">= 0"])
|
150
|
-
s.add_dependency(%q<juwelier>.freeze, ["~> 2.4.9"])
|
151
|
-
s.add_dependency(%q<rdoc>.freeze, [">= 0"])
|
152
|
-
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
@@ -1,28 +0,0 @@
|
|
1
|
-
sample_int: 123
|
2
|
-
sample_double: 12.12
|
3
|
-
sample_bool: true
|
4
|
-
false_value: false
|
5
|
-
zero_value: 0
|
6
|
-
sample_to_override: Foo
|
7
|
-
prefab.log_level: debug
|
8
|
-
sample: test sample value
|
9
|
-
enabled_flag: true
|
10
|
-
disabled_flag: false
|
11
|
-
flag_with_a_value: { "feature_flag": "true", value: "all-features" }
|
12
|
-
user_key_match: { "feature_flag": "true", value: true, criterion: { operator: PROP_IS_ONE_OF, values: [ "abc123", "xyz987" ], property: "user.key" } }
|
13
|
-
just_my_domain: { "feature_flag": "true", value: "new-version", criterion: { operator: PROP_IS_ONE_OF, property: "user.domain", values: [ "prefab.cloud", "example.com" ] } }
|
14
|
-
deprecated_no_dot_notation: { "feature_flag": "true", value: true, criterion: { operator: PROP_IS_ONE_OF, property: "domain", values: [ "prefab.cloud", "example.com" ] } }
|
15
|
-
|
16
|
-
nested:
|
17
|
-
values:
|
18
|
-
_: top level
|
19
|
-
string: nested value
|
20
|
-
|
21
|
-
log-level:
|
22
|
-
app:
|
23
|
-
_: error
|
24
|
-
controller:
|
25
|
-
hello:
|
26
|
-
_: warn
|
27
|
-
index: info
|
28
|
-
invalid: not a valid log level
|
data/test/integration_test.rb
DELETED
@@ -1,150 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class IntegrationTest
|
4
|
-
attr_reader :func, :input, :expected, :data, :expected_data, :aggregator, :endpoint, :test_client
|
5
|
-
|
6
|
-
def initialize(test_data)
|
7
|
-
@client_overrides = parse_client_overrides(test_data['client_overrides'])
|
8
|
-
@func = parse_function(test_data['function'])
|
9
|
-
@input = parse_input(test_data['input'])
|
10
|
-
@expected = parse_expected(test_data['expected'])
|
11
|
-
@data = test_data['data']
|
12
|
-
@expected_data = test_data['expected_data'] || []
|
13
|
-
@aggregator = test_data['aggregator']
|
14
|
-
@endpoint = test_data['endpoint']
|
15
|
-
@test_client = capture_telemetry(base_client)
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_type
|
19
|
-
if @data
|
20
|
-
:telemetry
|
21
|
-
elsif @input[0] && @input[0].start_with?('log-level.')
|
22
|
-
:log_level
|
23
|
-
elsif @expected[:status] == 'raise'
|
24
|
-
:raise
|
25
|
-
elsif @expected[:value].nil?
|
26
|
-
:nil
|
27
|
-
else
|
28
|
-
:simple_equality
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def last_data_sent
|
33
|
-
test_client.last_data_sent
|
34
|
-
end
|
35
|
-
|
36
|
-
def last_post_result
|
37
|
-
test_client.last_post_result
|
38
|
-
end
|
39
|
-
|
40
|
-
def last_post_endpoint
|
41
|
-
test_client.last_post_endpoint
|
42
|
-
end
|
43
|
-
|
44
|
-
private
|
45
|
-
|
46
|
-
def parse_client_overrides(overrides)
|
47
|
-
Hash[
|
48
|
-
(overrides || {}).map do |(k, v)|
|
49
|
-
[k.to_sym, v]
|
50
|
-
end
|
51
|
-
]
|
52
|
-
end
|
53
|
-
|
54
|
-
def parse_function(function)
|
55
|
-
case function
|
56
|
-
when 'get_or_raise' then :get
|
57
|
-
when 'enabled' then :enabled?
|
58
|
-
else :"#{function}"
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def parse_input(input)
|
63
|
-
return nil if input.nil?
|
64
|
-
|
65
|
-
if input['key']
|
66
|
-
parse_config_input(input)
|
67
|
-
elsif input['flag']
|
68
|
-
parse_ff_input(input)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def parse_config_input(input)
|
73
|
-
if !input['default'].nil?
|
74
|
-
[input['key'], input['default']]
|
75
|
-
else
|
76
|
-
[input['key']]
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
def parse_ff_input(input)
|
81
|
-
[input['flag'], input['default'], input['context']]
|
82
|
-
end
|
83
|
-
|
84
|
-
def parse_expected(expected)
|
85
|
-
return {} if expected.nil?
|
86
|
-
|
87
|
-
{
|
88
|
-
status: expected['status'],
|
89
|
-
error: parse_error_type(expected['error']),
|
90
|
-
message: expected['message'],
|
91
|
-
value: expected['value']
|
92
|
-
}
|
93
|
-
end
|
94
|
-
|
95
|
-
def parse_error_type(error_type)
|
96
|
-
case error_type
|
97
|
-
when 'missing_default' then Prefab::Errors::MissingDefaultError
|
98
|
-
when 'initialization_timeout' then Prefab::Errors::InitializationTimeoutError
|
99
|
-
when 'unable_to_decrypt' then OpenSSL::Cipher::CipherError
|
100
|
-
when 'missing_env_var' then Prefab::Errors::MissingEnvVarError
|
101
|
-
when 'unable_to_coerce_env_var' then Prefab::Errors::EnvVarParseError
|
102
|
-
else
|
103
|
-
unless error_type.nil?
|
104
|
-
throw "Unknown error type: #{error_type}"
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
def base_client
|
110
|
-
@_base_client ||= Prefab::Client.new(base_client_options)
|
111
|
-
end
|
112
|
-
|
113
|
-
def base_client_options
|
114
|
-
@_options ||= Prefab::Options.new(**{
|
115
|
-
prefab_config_override_dir: 'none',
|
116
|
-
prefab_config_classpath_dir: 'test',
|
117
|
-
prefab_envs: ['unit_tests'],
|
118
|
-
prefab_datasources: Prefab::Options::DATASOURCES::ALL,
|
119
|
-
api_key: ENV['PREFAB_INTEGRATION_TEST_API_KEY'],
|
120
|
-
prefab_api_url: 'https://api.staging-prefab.cloud',
|
121
|
-
}.merge(@client_overrides))
|
122
|
-
end
|
123
|
-
|
124
|
-
def capture_telemetry(client)
|
125
|
-
client.define_singleton_method(:post) do |url, data|
|
126
|
-
client.instance_variable_set(:@last_data_sent, data)
|
127
|
-
client.instance_variable_set(:@last_post_endpoint, url)
|
128
|
-
|
129
|
-
result = super(url, data)
|
130
|
-
|
131
|
-
client.instance_variable_set(:@last_post_result, result)
|
132
|
-
|
133
|
-
result
|
134
|
-
end
|
135
|
-
|
136
|
-
client.define_singleton_method(:last_data_sent) do
|
137
|
-
client.instance_variable_get(:@last_data_sent)
|
138
|
-
end
|
139
|
-
|
140
|
-
client.define_singleton_method(:last_post_endpoint) do
|
141
|
-
client.instance_variable_get(:@last_post_endpoint)
|
142
|
-
end
|
143
|
-
|
144
|
-
client.define_singleton_method(:last_post_result) do
|
145
|
-
client.instance_variable_get(:@last_post_result)
|
146
|
-
end
|
147
|
-
|
148
|
-
client
|
149
|
-
end
|
150
|
-
end
|
@@ -1,151 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module IntegrationTestHelpers
|
4
|
-
SUBMODULE_PATH = 'test/prefab-cloud-integration-test-data'
|
5
|
-
RAISE_IF_NO_TESTS_FOUND = ENV['PREFAB_INTEGRATION_TEST_RAISE'] == 'true'
|
6
|
-
|
7
|
-
def self.find_integration_tests
|
8
|
-
version = find_integration_test_version
|
9
|
-
|
10
|
-
files = find_versioned_test_files(version)
|
11
|
-
|
12
|
-
if files.none?
|
13
|
-
message = "No integration tests found for version: #{version}"
|
14
|
-
raise message if RAISE_IF_NO_TESTS_FOUND
|
15
|
-
|
16
|
-
puts message
|
17
|
-
end
|
18
|
-
|
19
|
-
files
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.find_integration_test_version
|
23
|
-
File.read(File.join(SUBMODULE_PATH, 'version')).strip
|
24
|
-
rescue StandardError => e
|
25
|
-
puts "No version found for integration tests: #{e.message}"
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.find_versioned_test_files(version)
|
29
|
-
if version.nil?
|
30
|
-
[]
|
31
|
-
else
|
32
|
-
Dir[File.join(SUBMODULE_PATH, "tests/#{version}/**/*")]
|
33
|
-
.select { |file| file =~ /\.ya?ml$/ }
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
SEVERITY_LOOKUP = Prefab::LogPathAggregator::SEVERITY_KEY.invert
|
38
|
-
|
39
|
-
def self.prepare_post_data(it)
|
40
|
-
case it.aggregator
|
41
|
-
when "log_path"
|
42
|
-
aggregator = it.test_client.log_path_aggregator
|
43
|
-
|
44
|
-
it.data.each do |data|
|
45
|
-
data['counts'].each_pair do |severity, count|
|
46
|
-
count.times { aggregator.push(data['logger_name'], SEVERITY_LOOKUP[severity]) }
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
expected_loggers = Hash.new { |h, k| h[k] = PrefabProto::Logger.new }
|
51
|
-
|
52
|
-
it.expected_data.each do |data|
|
53
|
-
data["counts"].each do |(severity, count)|
|
54
|
-
expected_loggers[data["logger_name"]][severity] = count
|
55
|
-
expected_loggers[data["logger_name"]]["logger_name"] = data["logger_name"]
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
[aggregator, ->(data) { data.loggers }, expected_loggers.values]
|
60
|
-
when "context_shape"
|
61
|
-
aggregator = it.test_client.context_shape_aggregator
|
62
|
-
|
63
|
-
context = Prefab::Context.new(it.data)
|
64
|
-
|
65
|
-
aggregator.push(context)
|
66
|
-
|
67
|
-
expected = it.expected_data.map do |data|
|
68
|
-
PrefabProto::ContextShape.new(
|
69
|
-
name: data["name"],
|
70
|
-
field_types: data["field_types"]
|
71
|
-
)
|
72
|
-
end
|
73
|
-
|
74
|
-
[aggregator, ->(data) { data.shapes }, expected]
|
75
|
-
when "evaluation_summary"
|
76
|
-
aggregator = it.test_client.evaluation_summary_aggregator
|
77
|
-
|
78
|
-
aggregator.instance_variable_set("@data", Concurrent::Hash.new)
|
79
|
-
|
80
|
-
it.data.each do |key|
|
81
|
-
it.test_client.get(key)
|
82
|
-
end
|
83
|
-
|
84
|
-
expected_data = []
|
85
|
-
it.expected_data.each do |data|
|
86
|
-
value = if data["value_type"] == "string_list"
|
87
|
-
PrefabProto::StringList.new(values: data["value"])
|
88
|
-
else
|
89
|
-
data["value"]
|
90
|
-
end
|
91
|
-
expected_data << PrefabProto::ConfigEvaluationSummary.new(
|
92
|
-
key: data["key"],
|
93
|
-
type: data["type"].to_sym,
|
94
|
-
counters: [
|
95
|
-
PrefabProto::ConfigEvaluationCounter.new(
|
96
|
-
count: data["count"],
|
97
|
-
config_id: 0,
|
98
|
-
selected_value: PrefabProto::ConfigValue.new(data["value_type"] => value),
|
99
|
-
config_row_index: data["summary"]["config_row_index"],
|
100
|
-
conditional_value_index: data["summary"]["conditional_value_index"] || 0,
|
101
|
-
weighted_value_index: data["summary"]["weighted_value_index"],
|
102
|
-
reason: :UNKNOWN
|
103
|
-
)
|
104
|
-
]
|
105
|
-
)
|
106
|
-
end
|
107
|
-
|
108
|
-
[aggregator, ->(data) {
|
109
|
-
data.events[0].summaries.summaries.each { |e|
|
110
|
-
e.counters.each { |c|
|
111
|
-
c.config_id = 0
|
112
|
-
}
|
113
|
-
}
|
114
|
-
}, expected_data]
|
115
|
-
when "example_contexts"
|
116
|
-
aggregator = it.test_client.example_contexts_aggregator
|
117
|
-
|
118
|
-
it.data.each do |key, values|
|
119
|
-
aggregator.record(Prefab::Context.new({ key => values }))
|
120
|
-
end
|
121
|
-
|
122
|
-
expected_data = []
|
123
|
-
it.expected_data.each do |k, vs|
|
124
|
-
expected_data << PrefabProto::ExampleContext.new(
|
125
|
-
timestamp: 0,
|
126
|
-
contextSet: PrefabProto::ContextSet.new(
|
127
|
-
contexts: [
|
128
|
-
PrefabProto::Context.new(
|
129
|
-
type: k,
|
130
|
-
values: vs.each_pair.map do |key, value|
|
131
|
-
[key, Prefab::ConfigValueWrapper.wrap(value)]
|
132
|
-
end.to_h
|
133
|
-
)
|
134
|
-
]
|
135
|
-
)
|
136
|
-
)
|
137
|
-
end
|
138
|
-
[aggregator, ->(data) { data.events[0].example_contexts.examples.each { |e| e.timestamp = 0 } }, expected_data]
|
139
|
-
else
|
140
|
-
puts "unknown aggregator #{it.aggregator}"
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
def self.with_parent_context_maybe(context, &block)
|
145
|
-
if context
|
146
|
-
Prefab::Context.with_context(context, &block)
|
147
|
-
else
|
148
|
-
yield
|
149
|
-
end
|
150
|
-
end
|
151
|
-
end
|