-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathindex.ts
More file actions
108 lines (94 loc) · 2.81 KB
/
index.ts
File metadata and controls
108 lines (94 loc) · 2.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/**
* Copyright 2016-2025, Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Contains global enums used throughout the library
*/
export const LOG_LEVEL = {
NOTSET: 0,
DEBUG: 1,
INFO: 2,
WARNING: 3,
ERROR: 4,
};
export const enum RESERVED_EVENT_KEYWORDS {
REVENUE = 'revenue',
VALUE = 'value',
}
export const CONTROL_ATTRIBUTES = {
BOT_FILTERING: '$opt_bot_filtering',
BUCKETING_ID: '$opt_bucketing_id',
STICKY_BUCKETING_KEY: '$opt_experiment_bucket_map',
USER_AGENT: '$opt_user_agent',
};
export const JAVASCRIPT_CLIENT_ENGINE = 'javascript-sdk';
export const NODE_CLIENT_ENGINE = 'node-sdk';
export const REACT_NATIVE_JS_CLIENT_ENGINE = 'react-native-js-sdk';
export const CLIENT_VERSION = '6.3.0';
/*
* Represents the source of a decision for feature management. When a feature
* is accessed through isFeatureEnabled or getVariableValue APIs, the decision
* source is used to decide whether to dispatch an impression event to
* Optimizely.
*/
export const DECISION_SOURCES = {
FEATURE_TEST: 'feature-test',
ROLLOUT: 'rollout',
EXPERIMENT: 'experiment',
HOLDOUT: 'holdout',
} as const;
export type DecisionSource = typeof DECISION_SOURCES[keyof typeof DECISION_SOURCES];
export const AUDIENCE_EVALUATION_TYPES = {
RULE: 'rule',
EXPERIMENT: 'experiment',
};
/*
* Possible types of variables attached to features
*/
export const FEATURE_VARIABLE_TYPES = {
BOOLEAN: 'boolean',
DOUBLE: 'double',
INTEGER: 'integer',
STRING: 'string',
JSON: 'json',
};
/*
* Supported datafile versions
*/
export const DATAFILE_VERSIONS = {
V2: '2',
V3: '3',
V4: '4',
};
/*
* Pre-Release and Build symbols
*/
export const enum VERSION_TYPE {
PRE_RELEASE_VERSION_DELIMITER = '-',
BUILD_VERSION_DELIMITER = '+',
}
export const DECISION_MESSAGES = {
SDK_NOT_READY: 'Optimizely SDK not configured properly yet.',
FLAG_KEY_INVALID: 'No flag was found for key "%s".',
VARIABLE_VALUE_INVALID: 'Variable value for key "%s" is invalid or wrong type.',
};
/**
* Default milliseconds before request timeout
*/
export const REQUEST_TIMEOUT_MS = 60 * 1000; // 1 minute
export const DEFAULT_CMAB_CACHE_TIMEOUT_MS = 30 * 60 * 1000; // 30 minutes
export const DEFAULT_CMAB_CACHE_SIZE = 10_000;
export const DEFAULT_CMAB_RETRIES = 1;
export const DEFAULT_CMAB_BACKOFF_MS = 100; // 100 milliseconds