wingify-fme-python-sdk 1.70.0__py3-none-any.whl
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.
- tests/data/__init__.py +13 -0
- tests/data/dummy_test_data_reader.py +63 -0
- tests/data/user_storage.py +48 -0
- tests/e2e/__init__.py +13 -0
- tests/e2e/custom_bucketing_test.py +514 -0
- tests/e2e/force_users_test.py +368 -0
- tests/e2e/get_flag_test.py +195 -0
- tests/unit/__init__.py +13 -0
- tests/unit/packages/__init__.py +13 -0
- tests/unit/packages/decision_maker/__init__.py +13 -0
- tests/unit/packages/decision_maker/decision_maker_test.py +83 -0
- tests/unit/packages/segmentation_evaluator/__init__.py +13 -0
- tests/unit/packages/segmentation_evaluator/segmentation_evaluator_test.py +284 -0
- tests/unit/packages/segmentation_evaluator/segmentation_manager_test.py +215 -0
- tests/unit/packages/segmentation_evaluator/web_testing_segment_test.py +216 -0
- tests/unit/services/__init__.py +0 -0
- tests/unit/services/hooks_manager_test.py +80 -0
- tests/unit/services/internal_events_sampling_service_test.py +160 -0
- tests/unit/settings/__init__.py +13 -0
- tests/unit/settings/settings_schema_validation_test.py +67 -0
- tests/unit/utils/__init__.py +0 -0
- tests/unit/utils/campaign_util_test.py +248 -0
- tests/unit/utils/decision_util_force_users_test.py +790 -0
- tests/unit/utils/log_message_test.py +65 -0
- tests/unit/vwo_wingify_test.py +175 -0
- tests/unit/wingify_client_validation_test.py +72 -0
- vwo/__init__.py +35 -0
- vwo/models/__init__.py +13 -0
- vwo/models/batch_event_data.py +19 -0
- vwo/models/user/__init__.py +13 -0
- vwo/models/user/context_vwo_model.py +21 -0
- vwo/models/user/get_flag.py +19 -0
- vwo/models/vwo_options_model.py +21 -0
- vwo/packages/__init__.py +13 -0
- vwo/packages/logger/__init__.py +13 -0
- vwo/packages/logger/enums/__init__.py +13 -0
- vwo/packages/logger/enums/log_level_enum.py +19 -0
- vwo/packages/storage/__init__.py +13 -0
- vwo/packages/storage/connector.py +19 -0
- vwo/vwo.py +58 -0
- vwo/vwo_builder.py +21 -0
- vwo/vwo_client.py +22 -0
- wingify/__init__.py +36 -0
- wingify/api/__init__.py +13 -0
- wingify/api/get_flag_api.py +727 -0
- wingify/api/set_attribute_api.py +60 -0
- wingify/api/track_api.py +99 -0
- wingify/constants/Constants.py +94 -0
- wingify/constants/__init__.py +13 -0
- wingify/constants/sampled_debug_error_template_keys.py +34 -0
- wingify/decorators/__init__.py +13 -0
- wingify/decorators/storage_decorator.py +92 -0
- wingify/enums/__init__.py +13 -0
- wingify/enums/api_enum.py +26 -0
- wingify/enums/campaign_type_enum.py +22 -0
- wingify/enums/debug_category_enum.py +24 -0
- wingify/enums/event_enum.py +26 -0
- wingify/enums/headers_enum.py +21 -0
- wingify/enums/hooks_enum.py +24 -0
- wingify/enums/status_enum.py +21 -0
- wingify/enums/storage_enum.py +25 -0
- wingify/enums/url_enum.py +29 -0
- wingify/models/Alias.py +60 -0
- wingify/models/AliasSetResponse.py +43 -0
- wingify/models/__init__.py +13 -0
- wingify/models/batch_event_data.py +68 -0
- wingify/models/campaign/__init__.py +13 -0
- wingify/models/campaign/campaign_model.py +140 -0
- wingify/models/campaign/feature_model.py +95 -0
- wingify/models/campaign/holdout_model.py +94 -0
- wingify/models/campaign/impact_campaign_model.py +60 -0
- wingify/models/campaign/metric_model.py +42 -0
- wingify/models/campaign/rule_model.py +42 -0
- wingify/models/campaign/variable_model.py +44 -0
- wingify/models/campaign/variation_model.py +109 -0
- wingify/models/gateway_service_model.py +48 -0
- wingify/models/schemas/__init__.py +13 -0
- wingify/models/schemas/campaign_group_schema.py +19 -0
- wingify/models/schemas/campaign_metric_schema.py +26 -0
- wingify/models/schemas/campaign_schema.py +37 -0
- wingify/models/schemas/campaign_variation_schema.py +34 -0
- wingify/models/schemas/empty_object_schema.py +15 -0
- wingify/models/schemas/feature_schema.py +38 -0
- wingify/models/schemas/group_schema.py +37 -0
- wingify/models/schemas/holdout_schema.py +29 -0
- wingify/models/schemas/rule_schema.py +24 -0
- wingify/models/schemas/settings_schema.py +47 -0
- wingify/models/schemas/variable_schema.py +24 -0
- wingify/models/settings/__init__.py +13 -0
- wingify/models/settings/internal_event_sampling_settings_model.py +53 -0
- wingify/models/settings/settings_model.py +127 -0
- wingify/models/storage/__init__.py +13 -0
- wingify/models/storage/storage_model.py +84 -0
- wingify/models/user/__init__.py +13 -0
- wingify/models/user/context_model.py +113 -0
- wingify/models/user/context_vwo_model.py +34 -0
- wingify/models/user/get_flag.py +47 -0
- wingify/models/vwo_options_model.py +21 -0
- wingify/models/wingify_options_model.py +129 -0
- wingify/packages/__init__.py +13 -0
- wingify/packages/decision_maker/__init__.py +13 -0
- wingify/packages/decision_maker/decision_maker.py +89 -0
- wingify/packages/logger/__init__.py +13 -0
- wingify/packages/logger/core/__init__.py +13 -0
- wingify/packages/logger/core/log_manager.py +123 -0
- wingify/packages/logger/core/log_transport_manager.py +57 -0
- wingify/packages/logger/enums/__init__.py +13 -0
- wingify/packages/logger/enums/log_level_enum.py +24 -0
- wingify/packages/logger/enums/log_level_number_enum.py +21 -0
- wingify/packages/logger/log_message_builder.py +70 -0
- wingify/packages/logger/logger.py +38 -0
- wingify/packages/logger/transports/__init__.py +13 -0
- wingify/packages/logger/transports/console_transport.py +43 -0
- wingify/packages/network_layer/__init__.py +13 -0
- wingify/packages/network_layer/client/__init__.py +13 -0
- wingify/packages/network_layer/client/network_client.py +167 -0
- wingify/packages/network_layer/handlers/__init__.py +13 -0
- wingify/packages/network_layer/handlers/request_handler.py +40 -0
- wingify/packages/network_layer/manager/__init__.py +13 -0
- wingify/packages/network_layer/manager/network_manager.py +79 -0
- wingify/packages/network_layer/models/__init__.py +13 -0
- wingify/packages/network_layer/models/global_request_model.py +70 -0
- wingify/packages/network_layer/models/request_model.py +133 -0
- wingify/packages/network_layer/models/response_model.py +55 -0
- wingify/packages/segmentation_evaluator/__init__.py +13 -0
- wingify/packages/segmentation_evaluator/core/__init__.py +13 -0
- wingify/packages/segmentation_evaluator/core/segmentation_manager.py +140 -0
- wingify/packages/segmentation_evaluator/enums/__init__.py +13 -0
- wingify/packages/segmentation_evaluator/enums/segment_operand_regex_enum.py +31 -0
- wingify/packages/segmentation_evaluator/enums/segment_operand_value_enum.py +29 -0
- wingify/packages/segmentation_evaluator/enums/segment_operator_value_enum.py +37 -0
- wingify/packages/segmentation_evaluator/evaluators/__init__.py +13 -0
- wingify/packages/segmentation_evaluator/evaluators/segment_evaluator.py +237 -0
- wingify/packages/segmentation_evaluator/evaluators/segment_operand_evaluator.py +518 -0
- wingify/packages/segmentation_evaluator/utils/__init__.py +13 -0
- wingify/packages/segmentation_evaluator/utils/segment_util.py +33 -0
- wingify/packages/segmentation_evaluator/utils/web_testing_segment_util.py +295 -0
- wingify/packages/storage/__init__.py +13 -0
- wingify/packages/storage/connector.py +25 -0
- wingify/packages/storage/storage.py +39 -0
- wingify/resources/__init__.py +13 -0
- wingify/resources/debug-messages.json +21 -0
- wingify/resources/error-messages.json +62 -0
- wingify/resources/info-message.json +47 -0
- wingify/resources/trace-messages.json +1 -0
- wingify/resources/warn-messages.json +1 -0
- wingify/services/__init__.py +13 -0
- wingify/services/batch_event_queue.py +140 -0
- wingify/services/campaign_decision_service.py +268 -0
- wingify/services/hooks_manager.py +65 -0
- wingify/services/internal_events_sampling_service.py +62 -0
- wingify/services/settings_manager.py +293 -0
- wingify/services/storage_service.py +58 -0
- wingify/services/url_service.py +51 -0
- wingify/utils/__init__.py +13 -0
- wingify/utils/aliasing_util.py +108 -0
- wingify/utils/brand_context.py +26 -0
- wingify/utils/brand_util.py +37 -0
- wingify/utils/campaign_util.py +592 -0
- wingify/utils/data_type_util.py +125 -0
- wingify/utils/debugger_service_util.py +58 -0
- wingify/utils/decision_util.py +589 -0
- wingify/utils/event_util.py +85 -0
- wingify/utils/function_util.py +188 -0
- wingify/utils/gateway_service_util.py +179 -0
- wingify/utils/holdout_util.py +264 -0
- wingify/utils/impression_util.py +151 -0
- wingify/utils/internal_events_sampling_util.py +106 -0
- wingify/utils/log_message_util.py +95 -0
- wingify/utils/meg_util.py +561 -0
- wingify/utils/model_utils.py +136 -0
- wingify/utils/network_util.py +706 -0
- wingify/utils/rule_evaluation_util.py +102 -0
- wingify/utils/settings_util.py +39 -0
- wingify/utils/usage_stats_util.py +116 -0
- wingify/utils/uuid_util.py +81 -0
- wingify/vwo_client.py +21 -0
- wingify/wingify.py +159 -0
- wingify/wingify_builder.py +282 -0
- wingify/wingify_client.py +520 -0
- wingify_fme_python_sdk-1.70.0.dist-info/METADATA +1415 -0
- wingify_fme_python_sdk-1.70.0.dist-info/RECORD +186 -0
- wingify_fme_python_sdk-1.70.0.dist-info/WHEEL +5 -0
- wingify_fme_python_sdk-1.70.0.dist-info/licenses/LICENSE +202 -0
- wingify_fme_python_sdk-1.70.0.dist-info/licenses/NOTICE +18 -0
- wingify_fme_python_sdk-1.70.0.dist-info/top_level.txt +3 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Copyright 2024-2026 Wingify Software Pvt. Ltd.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from typing import Any, Dict
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class VariableModel:
|
|
20
|
+
def __init__(self, id: int, value: Any, type: str, key: str):
|
|
21
|
+
self._id = id
|
|
22
|
+
self._value = value
|
|
23
|
+
self._type = type
|
|
24
|
+
self._key = key
|
|
25
|
+
|
|
26
|
+
def get_id(self) -> int:
|
|
27
|
+
return self._id
|
|
28
|
+
|
|
29
|
+
def get_value(self) -> Any:
|
|
30
|
+
return self._value
|
|
31
|
+
|
|
32
|
+
def get_type(self) -> str:
|
|
33
|
+
return self._type
|
|
34
|
+
|
|
35
|
+
def get_key(self) -> str:
|
|
36
|
+
return self._key
|
|
37
|
+
|
|
38
|
+
def to_dict(self) -> Dict:
|
|
39
|
+
return {
|
|
40
|
+
"id": self._id,
|
|
41
|
+
"value": self._value,
|
|
42
|
+
"type": self._type,
|
|
43
|
+
"key": self._key,
|
|
44
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Copyright 2024-2026 Wingify Software Pvt. Ltd.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from typing import List, Dict, Any
|
|
17
|
+
from .variable_model import VariableModel
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class VariationModel:
|
|
21
|
+
def __init__(
|
|
22
|
+
self,
|
|
23
|
+
id: int,
|
|
24
|
+
segments: Dict[str, Any],
|
|
25
|
+
weight: float,
|
|
26
|
+
name: str,
|
|
27
|
+
variables: List[VariableModel],
|
|
28
|
+
start_range_variation: float,
|
|
29
|
+
end_range_variation: float,
|
|
30
|
+
key: str,
|
|
31
|
+
rule_key: str,
|
|
32
|
+
type: str,
|
|
33
|
+
variations: List["VariationModel"] = [],
|
|
34
|
+
salt: str = None,
|
|
35
|
+
whitelisted_segments: Dict[str, Any] = None,
|
|
36
|
+
):
|
|
37
|
+
self._id = id
|
|
38
|
+
self._segments = segments
|
|
39
|
+
self._weight = weight
|
|
40
|
+
self._name = name
|
|
41
|
+
self._variables = variables
|
|
42
|
+
self._start_range_variation = start_range_variation
|
|
43
|
+
self._end_range_variation = end_range_variation
|
|
44
|
+
self._variations = variations
|
|
45
|
+
self._rule_key = rule_key
|
|
46
|
+
self._type = type
|
|
47
|
+
self._key = key
|
|
48
|
+
self._salt = salt
|
|
49
|
+
self._whitelisted_segments = whitelisted_segments
|
|
50
|
+
|
|
51
|
+
def get_id(self) -> int:
|
|
52
|
+
return self._id
|
|
53
|
+
|
|
54
|
+
def get_segments(self) -> Dict[str, Any]:
|
|
55
|
+
return self._segments
|
|
56
|
+
|
|
57
|
+
def get_rule_key(self) -> str:
|
|
58
|
+
return self._rule_key
|
|
59
|
+
|
|
60
|
+
def get_type(self) -> str:
|
|
61
|
+
return self._type
|
|
62
|
+
|
|
63
|
+
def get_key(self) -> str:
|
|
64
|
+
return self._key
|
|
65
|
+
|
|
66
|
+
def get_weight(self) -> float:
|
|
67
|
+
return self._weight
|
|
68
|
+
|
|
69
|
+
def get_name(self) -> str:
|
|
70
|
+
return self._name
|
|
71
|
+
|
|
72
|
+
def get_variables(self) -> List[VariableModel]:
|
|
73
|
+
return self._variables
|
|
74
|
+
|
|
75
|
+
def get_start_range_variation(self) -> float:
|
|
76
|
+
return self._start_range_variation
|
|
77
|
+
|
|
78
|
+
def get_end_range_variation(self) -> float:
|
|
79
|
+
return self._end_range_variation
|
|
80
|
+
|
|
81
|
+
def get_variations(self) -> List["VariationModel"]:
|
|
82
|
+
return self._variations
|
|
83
|
+
|
|
84
|
+
def set_variations(self, variations: List["VariationModel"]) -> None:
|
|
85
|
+
self._variations = variations
|
|
86
|
+
|
|
87
|
+
def set_start_range_variation(self, start_range_variation: float) -> None:
|
|
88
|
+
self._start_range_variation = start_range_variation
|
|
89
|
+
|
|
90
|
+
def set_end_range_variation(self, end_range_variation: float) -> None:
|
|
91
|
+
self._end_range_variation = end_range_variation
|
|
92
|
+
|
|
93
|
+
def set_weight(self, weight: float) -> None:
|
|
94
|
+
self._weight = weight
|
|
95
|
+
|
|
96
|
+
def set_rule_key(self, rule_key: str) -> None:
|
|
97
|
+
self._rule_key = rule_key
|
|
98
|
+
|
|
99
|
+
def set_type(self, type: str) -> None:
|
|
100
|
+
self._type = type
|
|
101
|
+
|
|
102
|
+
def set_key(self, key: str) -> None:
|
|
103
|
+
self._key = key
|
|
104
|
+
|
|
105
|
+
def get_salt(self) -> str:
|
|
106
|
+
return self._salt
|
|
107
|
+
|
|
108
|
+
def get_whitelisted_segments(self) -> Dict[str, Any]:
|
|
109
|
+
return self._whitelisted_segments
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Copyright 2024-2026 Wingify Software Pvt. Ltd.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from typing import Dict
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class gateway_serviceModel:
|
|
20
|
+
def __init__(self, gateway_service: Dict):
|
|
21
|
+
"""
|
|
22
|
+
Initialize the gateway_serviceModel with a URL and a port number.
|
|
23
|
+
|
|
24
|
+
:param gateway_service: A dictionary containing the URL and port of the gateway service.
|
|
25
|
+
"""
|
|
26
|
+
self.url = gateway_service.get(
|
|
27
|
+
"url", ""
|
|
28
|
+
) # Default to an empty string if url is missing
|
|
29
|
+
# Use get with a default value to handle missing or null 'port'
|
|
30
|
+
self.port = gateway_service.get(
|
|
31
|
+
"port", None
|
|
32
|
+
) # Default to None if port is missing
|
|
33
|
+
|
|
34
|
+
def get_url(self) -> str:
|
|
35
|
+
"""
|
|
36
|
+
Get the URL of the gateway service.
|
|
37
|
+
|
|
38
|
+
:return: The URL as a string.
|
|
39
|
+
"""
|
|
40
|
+
return self.url
|
|
41
|
+
|
|
42
|
+
def get_port(self) -> int:
|
|
43
|
+
"""
|
|
44
|
+
Get the port number of the gateway service.
|
|
45
|
+
|
|
46
|
+
:return: The port number as an integer.
|
|
47
|
+
"""
|
|
48
|
+
return self.port
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Copyright 2024-2026 Wingify Software Pvt. Ltd.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Copyright 2024-2026 Wingify Software Pvt. Ltd.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
CAMPAIGN_GROUP_SCHEMA = {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"patternProperties": {"^[0-9_]+$": {"type": "number"}},
|
|
18
|
+
"additionalProperties": False,
|
|
19
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Copyright 2024-2026 Wingify Software Pvt. Ltd.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
CAMPAIGN_METRIC_SCHEMA = {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"properties": {
|
|
18
|
+
"id": {"type": "number"},
|
|
19
|
+
"type": {"type": "string"},
|
|
20
|
+
"identifier": {"type": "string"},
|
|
21
|
+
"mca": {"type": "number"},
|
|
22
|
+
"hasProps": {"type": "boolean"},
|
|
23
|
+
"revenueProp": {"type": "string"},
|
|
24
|
+
},
|
|
25
|
+
"required": ["id", "type", "identifier"],
|
|
26
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Copyright 2024-2026 Wingify Software Pvt. Ltd.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from .campaign_variation_schema import CAMPAIGN_VARIATION_SCHEMA
|
|
16
|
+
from .empty_object_schema import EMPTY_OBJECT
|
|
17
|
+
|
|
18
|
+
CAMPAIGN_SCHEMA = {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"properties": {
|
|
21
|
+
"id": {"type": ["number", "string"]},
|
|
22
|
+
"type": {"type": "string"},
|
|
23
|
+
"key": {"type": "string"},
|
|
24
|
+
"percentTraffic": {"type": "number"},
|
|
25
|
+
"status": {"type": "string"},
|
|
26
|
+
"variations": {
|
|
27
|
+
"if": {"type": "array"},
|
|
28
|
+
"then": {"items": CAMPAIGN_VARIATION_SCHEMA},
|
|
29
|
+
"else": EMPTY_OBJECT,
|
|
30
|
+
},
|
|
31
|
+
"segments": {"type": "object"},
|
|
32
|
+
"isForcedVariationEnabled": {"type": "boolean"},
|
|
33
|
+
"isAlwaysCheckSegment": {"type": "boolean"},
|
|
34
|
+
"name": {"type": "string"},
|
|
35
|
+
},
|
|
36
|
+
"required": ["id", "type", "key", "status", "variations", "segments", "name"],
|
|
37
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Copyright 2024-2026 Wingify Software Pvt. Ltd.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from .variable_schema import VARIABLE_SCHEMA
|
|
16
|
+
from .empty_object_schema import EMPTY_OBJECT
|
|
17
|
+
|
|
18
|
+
CAMPAIGN_VARIATION_SCHEMA = {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"properties": {
|
|
21
|
+
"id": {"type": ["number", "string"]},
|
|
22
|
+
"name": {"type": "string"},
|
|
23
|
+
"weight": {"type": ["number", "string"]},
|
|
24
|
+
"segments": {"type": "object"},
|
|
25
|
+
"variables": {
|
|
26
|
+
"if": {"type": "array"},
|
|
27
|
+
"then": {"items": VARIABLE_SCHEMA},
|
|
28
|
+
"else": EMPTY_OBJECT,
|
|
29
|
+
},
|
|
30
|
+
"startRangeVariation": {"type": "number"},
|
|
31
|
+
"endRangeVariation": {"type": "number"},
|
|
32
|
+
},
|
|
33
|
+
"required": ["id", "name", "weight"],
|
|
34
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Copyright 2024-2026 Wingify Software Pvt. Ltd.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
EMPTY_OBJECT = {"type": "object", "maxProperties": 0}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Copyright 2024-2026 Wingify Software Pvt. Ltd.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from .campaign_metric_schema import CAMPAIGN_METRIC_SCHEMA
|
|
16
|
+
from .rule_schema import RULE_SCHEMA
|
|
17
|
+
from .variable_schema import VARIABLE_SCHEMA
|
|
18
|
+
from .empty_object_schema import EMPTY_OBJECT
|
|
19
|
+
|
|
20
|
+
FEATURE_SCHEMA = {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"properties": {
|
|
23
|
+
"id": {"type": ["number", "string"]},
|
|
24
|
+
"key": {"type": "string"},
|
|
25
|
+
"status": {"type": "string"},
|
|
26
|
+
"name": {"type": "string"},
|
|
27
|
+
"type": {"type": "string"},
|
|
28
|
+
"metrics": {"type": "array", "items": CAMPAIGN_METRIC_SCHEMA},
|
|
29
|
+
"impactCampaign": {"type": "object"},
|
|
30
|
+
"rules": {"type": "array", "items": RULE_SCHEMA},
|
|
31
|
+
"variables": {
|
|
32
|
+
"if": {"type": "array"},
|
|
33
|
+
"then": {"items": VARIABLE_SCHEMA},
|
|
34
|
+
"else": EMPTY_OBJECT,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
"required": ["id", "key", "status", "name", "type", "metrics"],
|
|
38
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Copyright 2024-2026 Wingify Software Pvt. Ltd.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
GROUP_SCHEMA = {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"patternProperties": {
|
|
18
|
+
"^[0-9]+$": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"properties": {
|
|
21
|
+
"name": {"type": "string"},
|
|
22
|
+
"campaigns": {
|
|
23
|
+
"type": "array",
|
|
24
|
+
"items": {"type": "string"},
|
|
25
|
+
"uniqueItems": True,
|
|
26
|
+
},
|
|
27
|
+
"et": {"type": "number"},
|
|
28
|
+
"p": {"type": "array", "items": {"type": "string"}},
|
|
29
|
+
"wt": {
|
|
30
|
+
"type": "object",
|
|
31
|
+
"patternProperties": {"^[0-9]+$": {"type": "number"}},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"additionalProperties": False,
|
|
37
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Copyright 2024-2026 Wingify Software Pvt. Ltd.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from .campaign_metric_schema import CAMPAIGN_METRIC_SCHEMA
|
|
16
|
+
|
|
17
|
+
HOLDOUT_SCHEMA = {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"properties": {
|
|
20
|
+
"metrics": {"type": "array", "items": CAMPAIGN_METRIC_SCHEMA},
|
|
21
|
+
"segments": {"type": "object"},
|
|
22
|
+
"featureIds": {"type": "array", "items": {"type": "number"}},
|
|
23
|
+
"isGlobal": {"type": "boolean"},
|
|
24
|
+
"name": {"type": "string"},
|
|
25
|
+
"id": {"type": ["number", "string"]},
|
|
26
|
+
"percentTraffic": {"type": "number"},
|
|
27
|
+
},
|
|
28
|
+
"required": ["metrics", "segments", "featureIds", "isGlobal", "name", "id", "percentTraffic"],
|
|
29
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Copyright 2024-2026 Wingify Software Pvt. Ltd.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
RULE_SCHEMA = {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"properties": {
|
|
18
|
+
"type": {"type": "string"},
|
|
19
|
+
"ruleKey": {"type": "string"},
|
|
20
|
+
"campaignId": {"type": "number"},
|
|
21
|
+
"variationId": {"type": "number"},
|
|
22
|
+
},
|
|
23
|
+
"required": ["type", "ruleKey", "campaignId"],
|
|
24
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Copyright 2024-2026 Wingify Software Pvt. Ltd.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from .empty_object_schema import EMPTY_OBJECT
|
|
16
|
+
from .campaign_group_schema import CAMPAIGN_GROUP_SCHEMA
|
|
17
|
+
from .campaign_schema import CAMPAIGN_SCHEMA
|
|
18
|
+
from .feature_schema import FEATURE_SCHEMA
|
|
19
|
+
from .group_schema import GROUP_SCHEMA
|
|
20
|
+
from .holdout_schema import HOLDOUT_SCHEMA
|
|
21
|
+
|
|
22
|
+
SETTINGS_FILE_SCHEMA = {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"properties": {
|
|
25
|
+
"version": {"type": ["number", "string"]},
|
|
26
|
+
"accountId": {"type": ["number", "string"]},
|
|
27
|
+
"campaigns": {
|
|
28
|
+
"if": {"type": "array"},
|
|
29
|
+
"then": {"items": CAMPAIGN_SCHEMA},
|
|
30
|
+
"else": EMPTY_OBJECT,
|
|
31
|
+
},
|
|
32
|
+
"features": {
|
|
33
|
+
"if": {"type": "array"},
|
|
34
|
+
"then": {"items": FEATURE_SCHEMA},
|
|
35
|
+
"else": EMPTY_OBJECT,
|
|
36
|
+
},
|
|
37
|
+
"holdouts": {
|
|
38
|
+
"oneOf": [
|
|
39
|
+
{"type": "array", "items": HOLDOUT_SCHEMA},
|
|
40
|
+
EMPTY_OBJECT,
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"campaignGroups": CAMPAIGN_GROUP_SCHEMA,
|
|
44
|
+
"groups": GROUP_SCHEMA,
|
|
45
|
+
},
|
|
46
|
+
"required": ["version", "accountId", "campaigns", "features"],
|
|
47
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Copyright 2024-2026 Wingify Software Pvt. Ltd.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
VARIABLE_SCHEMA = {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"properties": {
|
|
18
|
+
"id": {"type": ["number", "string"]},
|
|
19
|
+
"type": {"type": "string"},
|
|
20
|
+
"key": {"type": "string"},
|
|
21
|
+
"value": {"type": ["number", "string", "boolean", "object"]},
|
|
22
|
+
},
|
|
23
|
+
"required": ["id", "type", "key", "value"],
|
|
24
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Copyright 2024-2026 Wingify Software Pvt. Ltd.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Copyright 2024-2026 Wingify Software Pvt. Ltd.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from typing import Dict, Any, Optional
|
|
16
|
+
|
|
17
|
+
class PlatformSamplingRates:
|
|
18
|
+
"""
|
|
19
|
+
Holds the sampling percentage for a specific platform (e.g., server).
|
|
20
|
+
Maps to the per-platform object inside `sampling.usage` or `sampling.debug`.
|
|
21
|
+
"""
|
|
22
|
+
def __init__(self, data: Dict[str, Any]):
|
|
23
|
+
self._server = data.get("server")
|
|
24
|
+
|
|
25
|
+
def get_server(self) -> Optional[float]:
|
|
26
|
+
return self._server
|
|
27
|
+
|
|
28
|
+
class EventCategorySamplingRates:
|
|
29
|
+
"""
|
|
30
|
+
Groups sampling rates by event category: `usage` and `debug`.
|
|
31
|
+
Maps to the top-level `sampling` object in the DaCDN settings.
|
|
32
|
+
"""
|
|
33
|
+
def __init__(self, data: Dict[str, Any]):
|
|
34
|
+
self._usage = PlatformSamplingRates(data.get("usage", {})) if data.get("usage") else None
|
|
35
|
+
self._debug = PlatformSamplingRates(data.get("debug", {})) if data.get("debug") else None
|
|
36
|
+
|
|
37
|
+
def get_usage(self) -> Optional[PlatformSamplingRates]:
|
|
38
|
+
return self._usage
|
|
39
|
+
|
|
40
|
+
def get_debug(self) -> Optional[PlatformSamplingRates]:
|
|
41
|
+
return self._debug
|
|
42
|
+
|
|
43
|
+
class AlwaysApplySampling:
|
|
44
|
+
"""
|
|
45
|
+
Controls whether sampling is enforced before sending an event.
|
|
46
|
+
Maps to `alwaysApplySampling` in DaCDN settings.
|
|
47
|
+
When `server` is False (the default), usage-stats and sampled debug events bypass sampling and are always sent.
|
|
48
|
+
"""
|
|
49
|
+
def __init__(self, data: Dict[str, Any]):
|
|
50
|
+
self._server = data.get("server")
|
|
51
|
+
|
|
52
|
+
def get_server(self) -> Optional[bool]:
|
|
53
|
+
return self._server
|