@splitsoftware/splitio-commons 1.6.2-rc.3 → 1.6.2-rc.4
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.
- package/cjs/sdkClient/clientAttributesDecoration.js +1 -1
- package/cjs/storages/inMemory/AttributesCacheInMemory.js +1 -1
- package/esm/sdkClient/clientAttributesDecoration.js +1 -1
- package/esm/storages/inMemory/AttributesCacheInMemory.js +1 -1
- package/package.json +4 -5
- package/src/sdkClient/clientAttributesDecoration.ts +6 -6
- package/src/sdkClient/clientCS.ts +3 -3
- package/src/sdkClient/sdkClientMethodCSWithTT.ts +3 -3
- package/src/storages/inMemory/AttributesCacheInMemory.ts +13 -12
- package/src/types.d.ts +5 -70
- package/types/consent/index.d.ts +0 -2
- package/types/consent/sdkUserConsent.d.ts +0 -6
- package/types/dtos/types.d.ts +0 -166
- package/types/evaluator/Engine.d.ts +0 -15
- package/types/evaluator/combiners/and.d.ts +0 -4
- package/types/evaluator/combiners/ifelseif.d.ts +0 -3
- package/types/evaluator/condition/engineUtils.d.ts +0 -11
- package/types/evaluator/condition/index.d.ts +0 -6
- package/types/evaluator/convertions/index.d.ts +0 -2
- package/types/evaluator/index.d.ts +0 -7
- package/types/evaluator/matchers/all.d.ts +0 -2
- package/types/evaluator/matchers/between.d.ts +0 -3
- package/types/evaluator/matchers/boolean.d.ts +0 -2
- package/types/evaluator/matchers/cont_all.d.ts +0 -2
- package/types/evaluator/matchers/cont_any.d.ts +0 -2
- package/types/evaluator/matchers/cont_str.d.ts +0 -2
- package/types/evaluator/matchers/dependency.d.ts +0 -5
- package/types/evaluator/matchers/eq.d.ts +0 -2
- package/types/evaluator/matchers/eq_set.d.ts +0 -2
- package/types/evaluator/matchers/ew.d.ts +0 -2
- package/types/evaluator/matchers/gte.d.ts +0 -2
- package/types/evaluator/matchers/index.d.ts +0 -7
- package/types/evaluator/matchers/lte.d.ts +0 -2
- package/types/evaluator/matchers/matcherTypes.d.ts +0 -10
- package/types/evaluator/matchers/part_of.d.ts +0 -2
- package/types/evaluator/matchers/segment.d.ts +0 -6
- package/types/evaluator/matchers/string.d.ts +0 -2
- package/types/evaluator/matchers/sw.d.ts +0 -2
- package/types/evaluator/matchers/whitelist.d.ts +0 -3
- package/types/evaluator/matchersTransform/index.d.ts +0 -6
- package/types/evaluator/matchersTransform/segment.d.ts +0 -5
- package/types/evaluator/matchersTransform/set.d.ts +0 -5
- package/types/evaluator/matchersTransform/unaryNumeric.d.ts +0 -5
- package/types/evaluator/matchersTransform/whitelist.d.ts +0 -5
- package/types/evaluator/parser/index.d.ts +0 -5
- package/types/evaluator/treatments/index.d.ts +0 -8
- package/types/evaluator/types.d.ts +0 -28
- package/types/evaluator/value/index.d.ts +0 -7
- package/types/evaluator/value/sanitize.d.ts +0 -7
- package/types/index.d.ts +0 -5
- package/types/integrations/browser.d.ts +0 -12
- package/types/integrations/ga/GaToSplit.d.ts +0 -40
- package/types/integrations/ga/GoogleAnalyticsToSplit.d.ts +0 -3
- package/types/integrations/ga/SplitToGa.d.ts +0 -34
- package/types/integrations/ga/SplitToGoogleAnalytics.d.ts +0 -3
- package/types/integrations/ga/types.d.ts +0 -148
- package/types/integrations/pluggable.d.ts +0 -11
- package/types/integrations/types.d.ts +0 -17
- package/types/listeners/browser.d.ts +0 -40
- package/types/listeners/node.d.ts +0 -22
- package/types/listeners/types.d.ts +0 -4
- package/types/logger/browser/DebugLogger.d.ts +0 -2
- package/types/logger/browser/ErrorLogger.d.ts +0 -2
- package/types/logger/browser/InfoLogger.d.ts +0 -2
- package/types/logger/browser/WarnLogger.d.ts +0 -2
- package/types/logger/constants.d.ts +0 -141
- package/types/logger/index.d.ts +0 -20
- package/types/logger/messages/debug.d.ts +0 -1
- package/types/logger/messages/error.d.ts +0 -1
- package/types/logger/messages/info.d.ts +0 -1
- package/types/logger/messages/warn.d.ts +0 -1
- package/types/logger/sdkLogger.d.ts +0 -7
- package/types/logger/types.d.ts +0 -6
- package/types/readiness/constants.d.ts +0 -7
- package/types/readiness/readinessManager.d.ts +0 -6
- package/types/readiness/sdkReadinessManager.d.ts +0 -11
- package/types/readiness/types.d.ts +0 -54
- package/types/sdkClient/client.d.ts +0 -6
- package/types/sdkClient/clientAttributesDecoration.d.ts +0 -51
- package/types/sdkClient/clientCS.d.ts +0 -9
- package/types/sdkClient/clientInputValidation.d.ts +0 -7
- package/types/sdkClient/sdkClient.d.ts +0 -6
- package/types/sdkClient/sdkClientMethod.d.ts +0 -6
- package/types/sdkClient/sdkClientMethodCS.d.ts +0 -7
- package/types/sdkClient/sdkClientMethodCSWithTT.d.ts +0 -8
- package/types/sdkFactory/index.d.ts +0 -6
- package/types/sdkFactory/types.d.ts +0 -80
- package/types/sdkManager/index.d.ts +0 -5
- package/types/services/splitApi.d.ts +0 -11
- package/types/services/splitHttpClient.d.ts +0 -10
- package/types/services/types.d.ts +0 -50
- package/types/storages/AbstractSegmentsCacheSync.d.ts +0 -55
- package/types/storages/AbstractSplitsCacheAsync.d.ts +0 -36
- package/types/storages/AbstractSplitsCacheSync.d.ts +0 -42
- package/types/storages/KeyBuilder.d.ts +0 -14
- package/types/storages/KeyBuilderCS.d.ts +0 -16
- package/types/storages/KeyBuilderSS.d.ts +0 -15
- package/types/storages/dataLoader.d.ts +0 -10
- package/types/storages/findLatencyIndex.d.ts +0 -7
- package/types/storages/inLocalStorage/MySegmentsCacheInLocal.d.ts +0 -25
- package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +0 -50
- package/types/storages/inLocalStorage/constants.d.ts +0 -2
- package/types/storages/inLocalStorage/index.d.ts +0 -8
- package/types/storages/inMemory/AttributesCacheInMemory.d.ts +0 -43
- package/types/storages/inMemory/EventsCacheInMemory.d.ts +0 -35
- package/types/storages/inMemory/ImpressionCountsCacheInMemory.d.ts +0 -24
- package/types/storages/inMemory/ImpressionsCacheInMemory.d.ts +0 -30
- package/types/storages/inMemory/InMemoryStorage.d.ts +0 -10
- package/types/storages/inMemory/InMemoryStorageCS.d.ts +0 -10
- package/types/storages/inMemory/MySegmentsCacheInMemory.d.ts +0 -22
- package/types/storages/inMemory/SegmentsCacheInMemory.d.ts +0 -19
- package/types/storages/inMemory/SplitsCacheInMemory.d.ts +0 -20
- package/types/storages/inMemory/TelemetryCacheInMemory.d.ts +0 -53
- package/types/storages/inRedis/EventsCacheInRedis.d.ts +0 -32
- package/types/storages/inRedis/ImpressionsCacheInRedis.d.ts +0 -18
- package/types/storages/inRedis/RedisAdapter.d.ts +0 -24
- package/types/storages/inRedis/SegmentsCacheInRedis.d.ts +0 -18
- package/types/storages/inRedis/SplitsCacheInRedis.d.ts +0 -91
- package/types/storages/inRedis/TelemetryCacheInRedis.d.ts +0 -20
- package/types/storages/inRedis/constants.d.ts +0 -1
- package/types/storages/inRedis/index.d.ts +0 -10
- package/types/storages/metadataBuilder.d.ts +0 -3
- package/types/storages/pluggable/EventsCachePluggable.d.ts +0 -38
- package/types/storages/pluggable/ImpressionsCachePluggable.d.ts +0 -35
- package/types/storages/pluggable/SegmentsCachePluggable.d.ts +0 -54
- package/types/storages/pluggable/SplitsCachePluggable.d.ts +0 -89
- package/types/storages/pluggable/TelemetryCachePluggable.d.ts +0 -18
- package/types/storages/pluggable/constants.d.ts +0 -1
- package/types/storages/pluggable/inMemoryWrapper.d.ts +0 -13
- package/types/storages/pluggable/index.d.ts +0 -10
- package/types/storages/pluggable/wrapperAdapter.d.ts +0 -12
- package/types/storages/types.d.ts +0 -430
- package/types/sync/offline/LocalhostFromObject.d.ts +0 -2
- package/types/sync/offline/splitsParser/parseCondition.d.ts +0 -7
- package/types/sync/offline/splitsParser/splitsParserFromSettings.d.ts +0 -3
- package/types/sync/offline/splitsParser/types.d.ts +0 -3
- package/types/sync/offline/syncManagerOffline.d.ts +0 -10
- package/types/sync/offline/syncTasks/fromObjectSyncTask.d.ts +0 -17
- package/types/sync/polling/fetchers/mySegmentsFetcher.d.ts +0 -7
- package/types/sync/polling/fetchers/segmentChangesFetcher.d.ts +0 -7
- package/types/sync/polling/fetchers/splitChangesFetcher.d.ts +0 -7
- package/types/sync/polling/fetchers/types.d.ts +0 -5
- package/types/sync/polling/pollingManagerCS.d.ts +0 -7
- package/types/sync/polling/pollingManagerSS.d.ts +0 -6
- package/types/sync/polling/syncTasks/mySegmentsSyncTask.d.ts +0 -9
- package/types/sync/polling/syncTasks/segmentsSyncTask.d.ts +0 -9
- package/types/sync/polling/syncTasks/splitsSyncTask.d.ts +0 -9
- package/types/sync/polling/types.d.ts +0 -26
- package/types/sync/polling/updaters/mySegmentsUpdater.d.ts +0 -13
- package/types/sync/polling/updaters/segmentChangesUpdater.d.ts +0 -18
- package/types/sync/polling/updaters/splitChangesUpdater.d.ts +0 -39
- package/types/sync/streaming/AuthClient/index.d.ts +0 -12
- package/types/sync/streaming/AuthClient/types.d.ts +0 -17
- package/types/sync/streaming/SSEClient/index.d.ts +0 -34
- package/types/sync/streaming/SSEClient/types.d.ts +0 -11
- package/types/sync/streaming/SSEHandler/NotificationKeeper.d.ts +0 -14
- package/types/sync/streaming/SSEHandler/NotificationParser.d.ts +0 -20
- package/types/sync/streaming/SSEHandler/index.d.ts +0 -11
- package/types/sync/streaming/SSEHandler/types.d.ts +0 -67
- package/types/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.d.ts +0 -6
- package/types/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.d.ts +0 -8
- package/types/sync/streaming/UpdateWorkers/SplitsUpdateWorker.d.ts +0 -12
- package/types/sync/streaming/UpdateWorkers/constants.d.ts +0 -3
- package/types/sync/streaming/UpdateWorkers/types.d.ts +0 -4
- package/types/sync/streaming/constants.d.ts +0 -34
- package/types/sync/streaming/mySegmentsV2utils.d.ts +0 -27
- package/types/sync/streaming/pushManager.d.ts +0 -9
- package/types/sync/streaming/types.d.ts +0 -35
- package/types/sync/submitters/eventsSubmitter.d.ts +0 -5
- package/types/sync/submitters/impressionCountsSubmitter.d.ts +0 -10
- package/types/sync/submitters/impressionsSubmitter.d.ts +0 -11
- package/types/sync/submitters/submitter.d.ts +0 -12
- package/types/sync/submitters/submitterManager.d.ts +0 -3
- package/types/sync/submitters/telemetrySubmitter.d.ts +0 -25
- package/types/sync/submitters/types.d.ts +0 -177
- package/types/sync/syncManagerOnline.d.ts +0 -13
- package/types/sync/syncTask.d.ts +0 -13
- package/types/sync/types.d.ts +0 -43
- package/types/trackers/eventTracker.d.ts +0 -10
- package/types/trackers/impressionObserver/ImpressionObserver.d.ts +0 -8
- package/types/trackers/impressionObserver/buildKey.d.ts +0 -2
- package/types/trackers/impressionObserver/impressionObserverCS.d.ts +0 -4
- package/types/trackers/impressionObserver/impressionObserverSS.d.ts +0 -4
- package/types/trackers/impressionObserver/types.d.ts +0 -4
- package/types/trackers/impressionObserver/utils.d.ts +0 -13
- package/types/trackers/impressionsTracker.d.ts +0 -15
- package/types/trackers/telemetryTracker.d.ts +0 -3
- package/types/trackers/types.d.ts +0 -36
- package/types/utils/Backoff.d.ts +0 -25
- package/types/utils/LRUCache/LinkedList.d.ts +0 -34
- package/types/utils/LRUCache/index.d.ts +0 -16
- package/types/utils/MinEventEmitter.d.ts +0 -12
- package/types/utils/MinEvents.d.ts +0 -4
- package/types/utils/base64/index.d.ts +0 -30
- package/types/utils/constants/browser.d.ts +0 -3
- package/types/utils/constants/index.d.ts +0 -62
- package/types/utils/decompress/index.d.ts +0 -16
- package/types/utils/env/isLocalStorageAvailable.d.ts +0 -1
- package/types/utils/env/isNode.d.ts +0 -5
- package/types/utils/inputValidation/apiKey.d.ts +0 -7
- package/types/utils/inputValidation/attribute.d.ts +0 -2
- package/types/utils/inputValidation/attributes.d.ts +0 -4
- package/types/utils/inputValidation/event.d.ts +0 -2
- package/types/utils/inputValidation/eventProperties.d.ts +0 -6
- package/types/utils/inputValidation/eventValue.d.ts +0 -2
- package/types/utils/inputValidation/index.d.ts +0 -13
- package/types/utils/inputValidation/isOperational.d.ts +0 -4
- package/types/utils/inputValidation/key.d.ts +0 -3
- package/types/utils/inputValidation/preloadedData.d.ts +0 -3
- package/types/utils/inputValidation/split.d.ts +0 -2
- package/types/utils/inputValidation/splitExistance.d.ts +0 -7
- package/types/utils/inputValidation/splits.d.ts +0 -2
- package/types/utils/inputValidation/trafficType.d.ts +0 -2
- package/types/utils/inputValidation/trafficTypeExistance.d.ts +0 -9
- package/types/utils/jwt/index.d.ts +0 -5
- package/types/utils/jwt/types.d.ts +0 -5
- package/types/utils/key/index.d.ts +0 -8
- package/types/utils/labels/index.d.ts +0 -7
- package/types/utils/lang/binarySearch.d.ts +0 -9
- package/types/utils/lang/getFnName.d.ts +0 -4
- package/types/utils/lang/getGlobal.d.ts +0 -4
- package/types/utils/lang/index.d.ts +0 -105
- package/types/utils/lang/maps.d.ts +0 -55
- package/types/utils/lang/objectAssign.d.ts +0 -3
- package/types/utils/lang/sets.d.ts +0 -60
- package/types/utils/murmur3/common.d.ts +0 -12
- package/types/utils/murmur3/legacy.d.ts +0 -2
- package/types/utils/murmur3/murmur3.d.ts +0 -2
- package/types/utils/murmur3/murmur3_128.d.ts +0 -6
- package/types/utils/murmur3/murmur3_128_x86.d.ts +0 -7
- package/types/utils/murmur3/murmur3_64.d.ts +0 -10
- package/types/utils/murmur3/utfx.d.ts +0 -27
- package/types/utils/promise/thenable.d.ts +0 -1
- package/types/utils/promise/timeout.d.ts +0 -1
- package/types/utils/promise/wrapper.d.ts +0 -21
- package/types/utils/settingsValidation/consent.d.ts +0 -5
- package/types/utils/settingsValidation/impressionsMode.d.ts +0 -3
- package/types/utils/settingsValidation/index.d.ts +0 -51
- package/types/utils/settingsValidation/integrations/common.d.ts +0 -14
- package/types/utils/settingsValidation/integrations/configurable.d.ts +0 -13
- package/types/utils/settingsValidation/integrations/pluggable.d.ts +0 -12
- package/types/utils/settingsValidation/localhost/builtin.d.ts +0 -15
- package/types/utils/settingsValidation/localhost/pluggable.d.ts +0 -15
- package/types/utils/settingsValidation/logger/builtinLogger.d.ts +0 -10
- package/types/utils/settingsValidation/logger/commons.d.ts +0 -9
- package/types/utils/settingsValidation/logger/pluggableLogger.d.ts +0 -11
- package/types/utils/settingsValidation/mode.d.ts +0 -1
- package/types/utils/settingsValidation/runtime.d.ts +0 -2
- package/types/utils/settingsValidation/splitFilters.d.ts +0 -15
- package/types/utils/settingsValidation/storage/storageCS.d.ts +0 -20
- package/types/utils/settingsValidation/types.d.ts +0 -32
- package/types/utils/settingsValidation/url.d.ts +0 -10
- package/types/utils/time/index.d.ts +0 -4
- package/types/utils/timeTracker/now/browser.d.ts +0 -1
- package/types/utils/timeTracker/now/node.d.ts +0 -1
- package/types/utils/timeTracker/timer.d.ts +0 -1
|
@@ -47,7 +47,7 @@ function clientAttributesDecoration(log, client) {
|
|
|
47
47
|
* Add an attribute to client's in memory attributes storage
|
|
48
48
|
*
|
|
49
49
|
* @param {string} attributeName Attrinute name
|
|
50
|
-
* @param {
|
|
50
|
+
* @param {AttributeType} attributeValue Attribute value
|
|
51
51
|
* @returns {boolean} true if the attribute was stored and false otherways
|
|
52
52
|
*/
|
|
53
53
|
setAttribute: function (attributeName, attributeValue) {
|
|
@@ -39,7 +39,7 @@ var AttributesCacheInMemory = /** @class */ (function () {
|
|
|
39
39
|
/**
|
|
40
40
|
* Retrieve the full attributes map
|
|
41
41
|
*
|
|
42
|
-
* @returns {Map<string,
|
|
42
|
+
* @returns {Map<string, AttributeType>} stored attributes
|
|
43
43
|
*/
|
|
44
44
|
AttributesCacheInMemory.prototype.getAll = function () {
|
|
45
45
|
return this.attributesCache;
|
|
@@ -44,7 +44,7 @@ export function clientAttributesDecoration(log, client) {
|
|
|
44
44
|
* Add an attribute to client's in memory attributes storage
|
|
45
45
|
*
|
|
46
46
|
* @param {string} attributeName Attrinute name
|
|
47
|
-
* @param {
|
|
47
|
+
* @param {AttributeType} attributeValue Attribute value
|
|
48
48
|
* @returns {boolean} true if the attribute was stored and false otherways
|
|
49
49
|
*/
|
|
50
50
|
setAttribute: function (attributeName, attributeValue) {
|
|
@@ -36,7 +36,7 @@ var AttributesCacheInMemory = /** @class */ (function () {
|
|
|
36
36
|
/**
|
|
37
37
|
* Retrieve the full attributes map
|
|
38
38
|
*
|
|
39
|
-
* @returns {Map<string,
|
|
39
|
+
* @returns {Map<string, AttributeType>} stored attributes
|
|
40
40
|
*/
|
|
41
41
|
AttributesCacheInMemory.prototype.getAll = function () {
|
|
42
42
|
return this.attributesCache;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splitsoftware/splitio-commons",
|
|
3
|
-
"version": "1.6.2-rc.
|
|
3
|
+
"version": "1.6.2-rc.4",
|
|
4
4
|
"description": "Split Javascript SDK common components",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
7
|
-
"types": "types",
|
|
7
|
+
"types": "src/types.d.ts",
|
|
8
8
|
"files": [
|
|
9
9
|
"README.md",
|
|
10
10
|
"CONTRIBUTORS-GUIDE.md",
|
|
@@ -12,15 +12,14 @@
|
|
|
12
12
|
"CHANGES.txt",
|
|
13
13
|
"cjs",
|
|
14
14
|
"esm",
|
|
15
|
-
"src"
|
|
16
|
-
"types"
|
|
15
|
+
"src"
|
|
17
16
|
],
|
|
18
17
|
"scripts": {
|
|
19
18
|
"check": "npm run check:lint && npm run check:types",
|
|
20
19
|
"check:lint": "eslint src --ext .js,.ts",
|
|
21
20
|
"check:types": "tsc --noEmit",
|
|
22
21
|
"build": "npm run build:cjs && npm run build:esm",
|
|
23
|
-
"build:esm": "rimraf esm types && tsc -m es2015 --outDir esm
|
|
22
|
+
"build:esm": "rimraf esm types && tsc -m es2015 --outDir esm",
|
|
24
23
|
"build:cjs": "rimraf cjs && tsc -m CommonJS --outDir cjs",
|
|
25
24
|
"test": "jest",
|
|
26
25
|
"test:coverage": "jest --coverage",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AttributesCacheInMemory } from '../storages/inMemory/AttributesCacheInMemory';
|
|
2
2
|
import { validateAttributesDeep } from '../utils/inputValidation/attributes';
|
|
3
|
-
import { Attributes, IAsyncClientSS, IClientSS, Properties, SplitKey } from '../types';
|
|
3
|
+
import { Attributes, AttributeType, IAsyncClientSS, IClientSS, Properties, SplitKey } from '../types';
|
|
4
4
|
import { ILogger } from '../types';
|
|
5
5
|
import { objectAssign } from '../utils/lang/objectAssign';
|
|
6
6
|
|
|
@@ -38,7 +38,7 @@ export function clientAttributesDecoration(log: ILogger, client: IClientSS | IAs
|
|
|
38
38
|
return clientTrack(maybeKey, maybeTT, maybeEvent, maybeEventValue, maybeProperties);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
function combineAttributes(maybeAttributes: Attributes | undefined): Attributes | undefined{
|
|
41
|
+
function combineAttributes(maybeAttributes: Attributes | undefined): Attributes | undefined {
|
|
42
42
|
const storedAttributes = attributeStorage.getAll();
|
|
43
43
|
if (Object.keys(storedAttributes).length > 0) {
|
|
44
44
|
return objectAssign({}, storedAttributes, maybeAttributes);
|
|
@@ -57,10 +57,10 @@ export function clientAttributesDecoration(log: ILogger, client: IClientSS | IAs
|
|
|
57
57
|
* Add an attribute to client's in memory attributes storage
|
|
58
58
|
*
|
|
59
59
|
* @param {string} attributeName Attrinute name
|
|
60
|
-
* @param {
|
|
60
|
+
* @param {AttributeType} attributeValue Attribute value
|
|
61
61
|
* @returns {boolean} true if the attribute was stored and false otherways
|
|
62
62
|
*/
|
|
63
|
-
setAttribute(attributeName: string, attributeValue:
|
|
63
|
+
setAttribute(attributeName: string, attributeValue: AttributeType) {
|
|
64
64
|
const attribute: Record<string, Object> = {};
|
|
65
65
|
attribute[attributeName] = attributeValue;
|
|
66
66
|
if (!validateAttributesDeep(log, attribute, 'setAttribute')) return false;
|
|
@@ -85,7 +85,7 @@ export function clientAttributesDecoration(log: ILogger, client: IClientSS | IAs
|
|
|
85
85
|
* @param {Object} attributes Object with attributes to store
|
|
86
86
|
* @returns true if attributes were stored an false otherways
|
|
87
87
|
*/
|
|
88
|
-
setAttributes(attributes: Record<string,
|
|
88
|
+
setAttributes(attributes: Record<string, AttributeType>) {
|
|
89
89
|
if (!validateAttributesDeep(log, attributes, 'setAttributes')) return false;
|
|
90
90
|
return attributeStorage.setAttributes(attributes);
|
|
91
91
|
},
|
|
@@ -95,7 +95,7 @@ export function clientAttributesDecoration(log: ILogger, client: IClientSS | IAs
|
|
|
95
95
|
*
|
|
96
96
|
* @returns {Object} returns all the stored attributes
|
|
97
97
|
*/
|
|
98
|
-
getAttributes(): Record<string,
|
|
98
|
+
getAttributes(): Record<string, AttributeType> {
|
|
99
99
|
return attributeStorage.getAll();
|
|
100
100
|
},
|
|
101
101
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { objectAssign } from '../utils/lang/objectAssign';
|
|
2
|
-
import { IClientSS,
|
|
2
|
+
import { IClientSS, IClientWithKey, ILogger, SplitKey } from '../types';
|
|
3
3
|
import { clientAttributesDecoration } from './clientAttributesDecoration';
|
|
4
4
|
|
|
5
5
|
|
|
@@ -10,7 +10,7 @@ import { clientAttributesDecoration } from './clientAttributesDecoration';
|
|
|
10
10
|
* @param key validated split key
|
|
11
11
|
* @param trafficType validated traffic type
|
|
12
12
|
*/
|
|
13
|
-
export function clientCSDecorator(log: ILogger, client: IClientSS, key: SplitKey, trafficType?: string)
|
|
13
|
+
export function clientCSDecorator(log: ILogger, client: IClientSS, key: SplitKey, trafficType?: string) {
|
|
14
14
|
|
|
15
15
|
let clientCS = clientAttributesDecoration(log, client);
|
|
16
16
|
|
|
@@ -25,5 +25,5 @@ export function clientCSDecorator(log: ILogger, client: IClientSS, key: SplitKey
|
|
|
25
25
|
track: trafficType ? clientCS.track.bind(clientCS, key, trafficType) : clientCS.track.bind(clientCS, key),
|
|
26
26
|
|
|
27
27
|
isClientSide: true
|
|
28
|
-
}) as
|
|
28
|
+
}) as IClientWithKey;
|
|
29
29
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { clientCSDecorator } from './clientCS';
|
|
2
|
-
import { IClientSS,
|
|
2
|
+
import { IClientSS, IClientWithKey, SplitKey } from '../types';
|
|
3
3
|
import { validateKey } from '../utils/inputValidation/key';
|
|
4
4
|
import { validateTrafficType } from '../utils/inputValidation/trafficType';
|
|
5
5
|
import { getMatching, keyParser } from '../utils/key';
|
|
@@ -22,7 +22,7 @@ const method = 'Client instantiation';
|
|
|
22
22
|
* where clients can have a binded TT for the track method, which is provided via the settings
|
|
23
23
|
* (default client) or the client method (shared clients).
|
|
24
24
|
*/
|
|
25
|
-
export function sdkClientMethodCSFactory(params: ISdkFactoryContext): (key?: SplitKey, trafficType?: string) =>
|
|
25
|
+
export function sdkClientMethodCSFactory(params: ISdkFactoryContext): (key?: SplitKey, trafficType?: string) => IClientWithKey {
|
|
26
26
|
const { storage, syncManager, sdkReadinessManager, settings: { core: { key, trafficType }, startup: { readyTimeout }, log } } = params;
|
|
27
27
|
|
|
28
28
|
const mainClientInstance = clientCSDecorator(
|
|
@@ -36,7 +36,7 @@ export function sdkClientMethodCSFactory(params: ISdkFactoryContext): (key?: Spl
|
|
|
36
36
|
const defaultInstanceId = buildInstanceId(parsedDefaultKey, trafficType);
|
|
37
37
|
|
|
38
38
|
// Cache instances created per factory.
|
|
39
|
-
const clientInstances: Record<string,
|
|
39
|
+
const clientInstances: Record<string, IClientWithKey> = {};
|
|
40
40
|
clientInstances[defaultInstanceId] = mainClientInstance;
|
|
41
41
|
|
|
42
42
|
return function client(key?: SplitKey, trafficType?: string) {
|
|
@@ -1,35 +1,36 @@
|
|
|
1
|
+
import { AttributeType } from '../../types';
|
|
1
2
|
import { objectAssign } from '../../utils/lang/objectAssign';
|
|
2
3
|
|
|
3
4
|
export class AttributesCacheInMemory {
|
|
4
5
|
|
|
5
|
-
private attributesCache: Record<string,
|
|
6
|
+
private attributesCache: Record<string, AttributeType> = {};
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Create or update the value for the given attribute
|
|
10
|
-
*
|
|
11
|
+
*
|
|
11
12
|
* @param {string} attributeName attribute name
|
|
12
13
|
* @param {Object} attributeValue attribute value
|
|
13
|
-
* @returns {boolean} the attribute was stored
|
|
14
|
+
* @returns {boolean} the attribute was stored
|
|
14
15
|
*/
|
|
15
|
-
setAttribute(attributeName: string, attributeValue:
|
|
16
|
+
setAttribute(attributeName: string, attributeValue: AttributeType): boolean {
|
|
16
17
|
this.attributesCache[attributeName] = attributeValue;
|
|
17
18
|
return true;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Retrieves the value of a given attribute
|
|
22
|
-
*
|
|
23
|
+
*
|
|
23
24
|
* @param {string} attributeName attribute name
|
|
24
25
|
* @returns {Object?} stored attribute value
|
|
25
26
|
*/
|
|
26
|
-
getAttribute(attributeName: string):
|
|
27
|
+
getAttribute(attributeName: string): AttributeType {
|
|
27
28
|
return this.attributesCache[attributeName];
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* Create or update all the given attributes
|
|
32
|
-
*
|
|
33
|
+
*
|
|
33
34
|
* @param {[string, Object]} attributes attributes to create or update
|
|
34
35
|
* @returns {boolean} attributes were stored
|
|
35
36
|
*/
|
|
@@ -40,16 +41,16 @@ export class AttributesCacheInMemory {
|
|
|
40
41
|
|
|
41
42
|
/**
|
|
42
43
|
* Retrieve the full attributes map
|
|
43
|
-
*
|
|
44
|
-
* @returns {Map<string,
|
|
44
|
+
*
|
|
45
|
+
* @returns {Map<string, AttributeType>} stored attributes
|
|
45
46
|
*/
|
|
46
|
-
getAll(): Record<string,
|
|
47
|
+
getAll(): Record<string, AttributeType> {
|
|
47
48
|
return this.attributesCache;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
/**
|
|
51
52
|
* Removes a given attribute from the map
|
|
52
|
-
*
|
|
53
|
+
*
|
|
53
54
|
* @param {string} attributeName attribute to remove
|
|
54
55
|
* @returns {boolean} attribute removed
|
|
55
56
|
*/
|
|
@@ -63,7 +64,7 @@ export class AttributesCacheInMemory {
|
|
|
63
64
|
|
|
64
65
|
/**
|
|
65
66
|
* Clears all attributes stored in the SDK
|
|
66
|
-
*
|
|
67
|
+
*
|
|
67
68
|
*/
|
|
68
69
|
clear() {
|
|
69
70
|
this.attributesCache = {};
|
package/src/types.d.ts
CHANGED
|
@@ -28,29 +28,6 @@ declare namespace SplitIO {
|
|
|
28
28
|
removeAllListeners(event?: string): this
|
|
29
29
|
emit(event: string, ...args: any[]): boolean
|
|
30
30
|
}
|
|
31
|
-
/**
|
|
32
|
-
* NodeJS.EventEmitter interface
|
|
33
|
-
* @see {@link https://nodejs.org/api/events.html}
|
|
34
|
-
*/
|
|
35
|
-
interface EventEmitter extends IEventEmitter {
|
|
36
|
-
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
37
|
-
on(event: string, listener: (...args: any[]) => void): this;
|
|
38
|
-
once(event: string, listener: (...args: any[]) => void): this;
|
|
39
|
-
removeListener(event: string, listener: (...args: any[]) => void): this;
|
|
40
|
-
off(event: string, listener: (...args: any[]) => void): this;
|
|
41
|
-
removeAllListeners(event?: string): this;
|
|
42
|
-
setMaxListeners(n: number): this;
|
|
43
|
-
getMaxListeners(): number;
|
|
44
|
-
listeners(event: string): Function[];
|
|
45
|
-
rawListeners(event: string): Function[];
|
|
46
|
-
emit(event: string, ...args: any[]): boolean;
|
|
47
|
-
listenerCount(type: string): number;
|
|
48
|
-
// Added in Node 6...
|
|
49
|
-
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
50
|
-
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
51
|
-
eventNames(): Array<string | symbol>;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
31
|
/**
|
|
55
32
|
* impression DTO generated by the Sdk client when processing evaluations
|
|
56
33
|
*/
|
|
@@ -319,7 +296,6 @@ declare namespace SplitIO {
|
|
|
319
296
|
*/
|
|
320
297
|
urls?: UrlSettings,
|
|
321
298
|
}
|
|
322
|
-
// @TODO Should extends IEventEmitter for React Native and JS Browser SDK
|
|
323
299
|
/**
|
|
324
300
|
* Common API for entities that expose status handlers.
|
|
325
301
|
* @interface IStatusInterface
|
|
@@ -911,7 +887,6 @@ declare namespace SplitIO {
|
|
|
911
887
|
/**
|
|
912
888
|
* Common settings interface with non-pluggable API (JS SDK).
|
|
913
889
|
* @interface IStaticSettings
|
|
914
|
-
* @extends ISharedSettings
|
|
915
890
|
*/
|
|
916
891
|
interface IStaticSettings {
|
|
917
892
|
/**
|
|
@@ -924,13 +899,13 @@ declare namespace SplitIO {
|
|
|
924
899
|
/**
|
|
925
900
|
* Common settings interface with pluggable API (JS Browser and React Native SDKs).
|
|
926
901
|
* @interface IPluggableSettings
|
|
927
|
-
* @extends ISharedSettings
|
|
928
902
|
*/
|
|
929
903
|
interface IPluggableSettings {
|
|
930
904
|
/**
|
|
931
905
|
* Boolean value to indicate whether the logger should be enabled or disabled by default, or a log level string or a Logger object.
|
|
932
906
|
* Passing a logger object is required to get descriptive log messages. Otherwise most logs will print with message codes.
|
|
933
907
|
* @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#logging}
|
|
908
|
+
* @see {@link https://help.split.io/hc/en-us/articles/4406066357901-React-Native-SDK#logging}
|
|
934
909
|
*
|
|
935
910
|
* Examples:
|
|
936
911
|
* ```typescript
|
|
@@ -942,19 +917,6 @@ declare namespace SplitIO {
|
|
|
942
917
|
* @default false
|
|
943
918
|
*/
|
|
944
919
|
debug?: boolean | LogLevel | ILogger,
|
|
945
|
-
/**
|
|
946
|
-
* Defines an optional list of factory functions used to instantiate SDK integrations.
|
|
947
|
-
*
|
|
948
|
-
* Example:
|
|
949
|
-
* ```typescript
|
|
950
|
-
* SplitFactory({
|
|
951
|
-
* ...
|
|
952
|
-
* integrations: [SplitToGoogleAnalytics(), GoogleAnalyticsToSplit()]
|
|
953
|
-
* })
|
|
954
|
-
* ```
|
|
955
|
-
* @property {Object} integrations
|
|
956
|
-
*/
|
|
957
|
-
integrations?: IntegrationFactory[],
|
|
958
920
|
}
|
|
959
921
|
/**
|
|
960
922
|
* Common settings interface for SDK instances on NodeJS.
|
|
@@ -1272,13 +1234,13 @@ declare namespace SplitIO {
|
|
|
1272
1234
|
/**
|
|
1273
1235
|
* Returns the default client instance of the SDK.
|
|
1274
1236
|
* @function client
|
|
1275
|
-
* @returns {
|
|
1237
|
+
* @returns {TClient} The client instance.
|
|
1276
1238
|
*/
|
|
1277
1239
|
client(): TClient,
|
|
1278
1240
|
/**
|
|
1279
1241
|
* Returns a manager instance of the SDK to explore available information.
|
|
1280
1242
|
* @function manager
|
|
1281
|
-
* @returns {
|
|
1243
|
+
* @returns {TManager} The manager instance.
|
|
1282
1244
|
*/
|
|
1283
1245
|
manager(): TManager
|
|
1284
1246
|
/**
|
|
@@ -1450,7 +1412,7 @@ declare namespace SplitIO {
|
|
|
1450
1412
|
* Add to client's in memory attributes storage the attributes in 'attributes'.
|
|
1451
1413
|
*
|
|
1452
1414
|
* @param {Attributes} attributes Object with attributes to store
|
|
1453
|
-
* @returns true if attributes were stored an false otherwise
|
|
1415
|
+
* @returns {boolean} true if attributes were stored an false otherwise
|
|
1454
1416
|
*/
|
|
1455
1417
|
setAttributes(attributes: Attributes): boolean,
|
|
1456
1418
|
/**
|
|
@@ -1515,33 +1477,6 @@ declare namespace SplitIO {
|
|
|
1515
1477
|
*/
|
|
1516
1478
|
track(trafficType: string, eventType: string, value?: number, properties?: Properties): boolean,
|
|
1517
1479
|
}
|
|
1518
|
-
/**
|
|
1519
|
-
* This represents the interface for the Client instance with attributes binding, synchronous method calls, and client-side API, where each client has a key associated and optionally a traffic type.
|
|
1520
|
-
* @interface IClientWithKeyLegacy
|
|
1521
|
-
* @extends IClientWithKey
|
|
1522
|
-
*/
|
|
1523
|
-
interface IClientWithKeyLegacy extends IClientWithKey {
|
|
1524
|
-
/**
|
|
1525
|
-
* Tracks an event to be fed to the results product on Split Webconsole.
|
|
1526
|
-
* @function track
|
|
1527
|
-
* @param {string} trafficType - The traffic type of the entity related to this event.
|
|
1528
|
-
* @param {string} eventType - The event type corresponding to this event.
|
|
1529
|
-
* @param {number=} value - The value of this event.
|
|
1530
|
-
* @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
|
|
1531
|
-
* @returns {boolean} Whether the event was added to the queue successfully or not.
|
|
1532
|
-
*/
|
|
1533
|
-
track(trafficType: string, eventType: string, value?: number, properties?: Properties): boolean,
|
|
1534
|
-
/**
|
|
1535
|
-
* Tracks an event to be fed to the results product on Split Webconsole.
|
|
1536
|
-
* For usage on the Browser if we defined the key and also the trafficType on the settings.
|
|
1537
|
-
* @function track
|
|
1538
|
-
* @param {string} eventType - The event type corresponding to this event.
|
|
1539
|
-
* @param {number=} value - The value of this event.
|
|
1540
|
-
* @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
|
|
1541
|
-
* @returns {boolean} Whether the event was added to the queue successfully or not.
|
|
1542
|
-
*/
|
|
1543
|
-
track(eventType: string, value?: number, properties?: Properties): boolean
|
|
1544
|
-
}
|
|
1545
1480
|
/**
|
|
1546
1481
|
* This represents the interface for the Client instance with attributes binding, asynchronous method calls, and client-side API, where each client has a key associated.
|
|
1547
1482
|
* @interface IAsyncClientWithKey
|
|
@@ -1587,7 +1522,7 @@ declare namespace SplitIO {
|
|
|
1587
1522
|
* @param {string} eventType - The event type corresponding to this event.
|
|
1588
1523
|
* @param {number=} value - The value of this event.
|
|
1589
1524
|
* @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
|
|
1590
|
-
* @returns {boolean} A promise that resolves to a boolean indicating if the event was added to the queue successfully or not.
|
|
1525
|
+
* @returns {Promise<boolean>} A promise that resolves to a boolean indicating if the event was added to the queue successfully or not.
|
|
1591
1526
|
*/
|
|
1592
1527
|
track(trafficType: string, eventType: string, value?: number, properties?: Properties): Promise<boolean>,
|
|
1593
1528
|
}
|
package/types/consent/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ISdkFactoryContext } from '../sdkFactory/types';
|
|
2
|
-
import { IUserConsentAPI } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* The public user consent API exposed via SplitFactory, used to control if the SDK tracks and sends impressions and events or not.
|
|
5
|
-
*/
|
|
6
|
-
export declare function createUserConsentAPI(params: ISdkFactoryContext): IUserConsentAPI;
|
package/types/dtos/types.d.ts
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
export declare type MaybeThenable<T> = T | Promise<T>;
|
|
2
|
-
/** Split Matchers */
|
|
3
|
-
export declare type IMatcherDataType = null | 'DATETIME' | 'NUMBER';
|
|
4
|
-
export interface IUnaryNumericMatcherData {
|
|
5
|
-
dataType: IMatcherDataType;
|
|
6
|
-
value: number;
|
|
7
|
-
}
|
|
8
|
-
export interface IBetweenMatcherData {
|
|
9
|
-
dataType: IMatcherDataType;
|
|
10
|
-
start: number;
|
|
11
|
-
end: number;
|
|
12
|
-
}
|
|
13
|
-
export interface IWhitelistMatcherData {
|
|
14
|
-
whitelist: string[];
|
|
15
|
-
}
|
|
16
|
-
export interface IInSegmentMatcherData {
|
|
17
|
-
segmentName: string;
|
|
18
|
-
}
|
|
19
|
-
export interface IDependencyMatcherData {
|
|
20
|
-
split: string;
|
|
21
|
-
treatments: string[];
|
|
22
|
-
}
|
|
23
|
-
interface ISplitMatcherBase {
|
|
24
|
-
matcherType: string;
|
|
25
|
-
negate: boolean;
|
|
26
|
-
keySelector: null | {
|
|
27
|
-
trafficType: string;
|
|
28
|
-
attribute: string | null;
|
|
29
|
-
};
|
|
30
|
-
userDefinedSegmentMatcherData?: null | IInSegmentMatcherData;
|
|
31
|
-
whitelistMatcherData?: null | IWhitelistMatcherData;
|
|
32
|
-
unaryNumericMatcherData?: null | IUnaryNumericMatcherData;
|
|
33
|
-
betweenMatcherData?: null | IBetweenMatcherData;
|
|
34
|
-
dependencyMatcherData?: null | IDependencyMatcherData;
|
|
35
|
-
booleanMatcherData?: null | boolean;
|
|
36
|
-
stringMatcherData?: null | string;
|
|
37
|
-
}
|
|
38
|
-
interface IAllKeysMatcher extends ISplitMatcherBase {
|
|
39
|
-
matcherType: 'ALL_KEYS';
|
|
40
|
-
}
|
|
41
|
-
interface IInSegmentMatcher extends ISplitMatcherBase {
|
|
42
|
-
matcherType: 'IN_SEGMENT';
|
|
43
|
-
userDefinedSegmentMatcherData: IInSegmentMatcherData;
|
|
44
|
-
}
|
|
45
|
-
interface IWhitelistMatcher extends ISplitMatcherBase {
|
|
46
|
-
matcherType: 'WHITELIST';
|
|
47
|
-
whitelistMatcherData: IWhitelistMatcherData;
|
|
48
|
-
}
|
|
49
|
-
interface IEqualToMatcher extends ISplitMatcherBase {
|
|
50
|
-
matcherType: 'EQUAL_TO';
|
|
51
|
-
unaryNumericMatcherData: IUnaryNumericMatcherData;
|
|
52
|
-
}
|
|
53
|
-
interface IGreaterThanOrEqualToMatcher extends ISplitMatcherBase {
|
|
54
|
-
matcherType: 'GREATER_THAN_OR_EQUAL_TO';
|
|
55
|
-
unaryNumericMatcherData: IUnaryNumericMatcherData;
|
|
56
|
-
}
|
|
57
|
-
interface ILessThanOrEqualToMatcher extends ISplitMatcherBase {
|
|
58
|
-
matcherType: 'LESS_THAN_OR_EQUAL_TO';
|
|
59
|
-
unaryNumericMatcherData: IUnaryNumericMatcherData;
|
|
60
|
-
}
|
|
61
|
-
interface IBetweenMatcher extends ISplitMatcherBase {
|
|
62
|
-
matcherType: 'BETWEEN';
|
|
63
|
-
betweenMatcherData: IBetweenMatcherData;
|
|
64
|
-
}
|
|
65
|
-
interface IEqualToSetMatcher extends ISplitMatcherBase {
|
|
66
|
-
matcherType: 'EQUAL_TO_SET';
|
|
67
|
-
whitelistMatcherData: IWhitelistMatcherData;
|
|
68
|
-
}
|
|
69
|
-
interface IContainsAnyOfSetMatcher extends ISplitMatcherBase {
|
|
70
|
-
matcherType: 'CONTAINS_ANY_OF_SET';
|
|
71
|
-
whitelistMatcherData: IWhitelistMatcherData;
|
|
72
|
-
}
|
|
73
|
-
interface IContainsAllOfSetMatcher extends ISplitMatcherBase {
|
|
74
|
-
matcherType: 'CONTAINS_ALL_OF_SET';
|
|
75
|
-
whitelistMatcherData: IWhitelistMatcherData;
|
|
76
|
-
}
|
|
77
|
-
interface IPartOfSetMatcher extends ISplitMatcherBase {
|
|
78
|
-
matcherType: 'PART_OF_SET';
|
|
79
|
-
whitelistMatcherData: IWhitelistMatcherData;
|
|
80
|
-
}
|
|
81
|
-
interface IStartsWithMatcher extends ISplitMatcherBase {
|
|
82
|
-
matcherType: 'STARTS_WITH';
|
|
83
|
-
whitelistMatcherData: IWhitelistMatcherData;
|
|
84
|
-
}
|
|
85
|
-
interface IEndsWithMatcher extends ISplitMatcherBase {
|
|
86
|
-
matcherType: 'ENDS_WITH';
|
|
87
|
-
whitelistMatcherData: IWhitelistMatcherData;
|
|
88
|
-
}
|
|
89
|
-
interface IContainsStringMatcher extends ISplitMatcherBase {
|
|
90
|
-
matcherType: 'CONTAINS_STRING';
|
|
91
|
-
whitelistMatcherData: IWhitelistMatcherData;
|
|
92
|
-
}
|
|
93
|
-
interface IInSplitTreatmentMatcher extends ISplitMatcherBase {
|
|
94
|
-
matcherType: 'IN_SPLIT_TREATMENT';
|
|
95
|
-
dependencyMatcherData: IDependencyMatcherData;
|
|
96
|
-
}
|
|
97
|
-
interface IEqualToBooleanMatcher extends ISplitMatcherBase {
|
|
98
|
-
matcherType: 'EQUAL_TO_BOOLEAN';
|
|
99
|
-
booleanMatcherData: boolean;
|
|
100
|
-
}
|
|
101
|
-
interface IMatchesStringMatcher extends ISplitMatcherBase {
|
|
102
|
-
matcherType: 'MATCHES_STRING';
|
|
103
|
-
stringMatcherData: string;
|
|
104
|
-
}
|
|
105
|
-
export declare type ISplitMatcher = IAllKeysMatcher | IInSegmentMatcher | IWhitelistMatcher | IEqualToMatcher | IGreaterThanOrEqualToMatcher | ILessThanOrEqualToMatcher | IBetweenMatcher | IEqualToSetMatcher | IContainsAnyOfSetMatcher | IContainsAllOfSetMatcher | IPartOfSetMatcher | IStartsWithMatcher | IEndsWithMatcher | IContainsStringMatcher | IInSplitTreatmentMatcher | IEqualToBooleanMatcher | IMatchesStringMatcher;
|
|
106
|
-
/** Split object */
|
|
107
|
-
export interface ISplitPartition {
|
|
108
|
-
treatment: string;
|
|
109
|
-
size: number;
|
|
110
|
-
}
|
|
111
|
-
export interface ISplitCondition {
|
|
112
|
-
matcherGroup: {
|
|
113
|
-
combiner: 'AND';
|
|
114
|
-
matchers: ISplitMatcher[];
|
|
115
|
-
};
|
|
116
|
-
partitions: ISplitPartition[];
|
|
117
|
-
label: string;
|
|
118
|
-
conditionType: 'ROLLOUT' | 'WHITELIST';
|
|
119
|
-
}
|
|
120
|
-
export interface ISplit {
|
|
121
|
-
name: string;
|
|
122
|
-
changeNumber: number;
|
|
123
|
-
killed: boolean;
|
|
124
|
-
defaultTreatment: string;
|
|
125
|
-
trafficTypeName: string;
|
|
126
|
-
conditions: ISplitCondition[];
|
|
127
|
-
status: 'ACTIVE' | 'ARCHIVED';
|
|
128
|
-
seed: number;
|
|
129
|
-
trafficAllocation?: number;
|
|
130
|
-
trafficAllocationSeed?: number;
|
|
131
|
-
configurations?: {
|
|
132
|
-
[treatmentName: string]: string;
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
export declare type ISplitPartial = Pick<ISplit, 'conditions' | 'configurations' | 'trafficTypeName'>;
|
|
136
|
-
/** Interface of the parsed JSON response of `/splitChanges` */
|
|
137
|
-
export interface ISplitChangesResponse {
|
|
138
|
-
till: number;
|
|
139
|
-
splits: ISplit[];
|
|
140
|
-
}
|
|
141
|
-
/** Interface of the parsed JSON response of `/segmentChanges/{segmentName}` */
|
|
142
|
-
export interface ISegmentChangesResponse {
|
|
143
|
-
name: string;
|
|
144
|
-
added: string[];
|
|
145
|
-
removed: string[];
|
|
146
|
-
since: number;
|
|
147
|
-
till: number;
|
|
148
|
-
}
|
|
149
|
-
export interface IMySegmentsResponseItem {
|
|
150
|
-
id: string;
|
|
151
|
-
name: string;
|
|
152
|
-
}
|
|
153
|
-
/** Interface of the parsed JSON response of `/mySegments/{userKey}` */
|
|
154
|
-
export interface IMySegmentsResponse {
|
|
155
|
-
mySegments: IMySegmentsResponseItem[];
|
|
156
|
-
}
|
|
157
|
-
/** Metadata internal type for storages */
|
|
158
|
-
export interface IMetadata {
|
|
159
|
-
/** SDK version */
|
|
160
|
-
s: string;
|
|
161
|
-
/** host IP */
|
|
162
|
-
i: string;
|
|
163
|
-
/** host name */
|
|
164
|
-
n: string;
|
|
165
|
-
}
|
|
166
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ISplit, MaybeThenable } from '../dtos/types';
|
|
2
|
-
import { SplitKey, Attributes } from '../types';
|
|
3
|
-
import { IStorageAsync, IStorageSync } from '../storages/types';
|
|
4
|
-
import { IEvaluationResult, IEvaluator, ISplitEvaluator } from './types';
|
|
5
|
-
import { ILogger } from '../types';
|
|
6
|
-
export declare class Engine {
|
|
7
|
-
private baseInfo;
|
|
8
|
-
private evaluator;
|
|
9
|
-
constructor(baseInfo: ISplit, evaluator: IEvaluator);
|
|
10
|
-
static parse(log: ILogger, splitFlatStructure: ISplit, storage: IStorageSync | IStorageAsync): Engine;
|
|
11
|
-
getKey(): string;
|
|
12
|
-
getTreatment(key: SplitKey, attributes: Attributes | undefined, splitEvaluator: ISplitEvaluator): MaybeThenable<IEvaluationResult>;
|
|
13
|
-
isGarbage(): boolean;
|
|
14
|
-
getChangeNumber(): number;
|
|
15
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ILogger } from '../../types';
|
|
2
|
-
/**
|
|
3
|
-
* Get the treatment name given a key, a seed, and the percentage of each treatment.
|
|
4
|
-
*/
|
|
5
|
-
export declare function getTreatment(log: ILogger, key: string, seed: number, treatments: {
|
|
6
|
-
getTreatmentFor: (x: number) => string;
|
|
7
|
-
}): string;
|
|
8
|
-
/**
|
|
9
|
-
* Evaluates the traffic allocation to see if we should apply rollout conditions or not.
|
|
10
|
-
*/
|
|
11
|
-
export declare function shouldApplyRollout(trafficAllocation: number, key: string, trafficAllocationSeed: number): boolean;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { MaybeThenable } from '../../dtos/types';
|
|
2
|
-
import { IEvaluator } from '../types';
|
|
3
|
-
import { ILogger } from '../../types';
|
|
4
|
-
export declare function conditionContext(log: ILogger, matcherEvaluator: (...args: any) => MaybeThenable<boolean>, treatments: {
|
|
5
|
-
getTreatmentFor: (x: number) => string;
|
|
6
|
-
}, label: string, conditionType: 'ROLLOUT' | 'WHITELIST'): IEvaluator;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { MaybeThenable } from '../dtos/types';
|
|
2
|
-
import { IStorageAsync, IStorageSync } from '../storages/types';
|
|
3
|
-
import { IEvaluationResult } from './types';
|
|
4
|
-
import { SplitKey, Attributes } from '../types';
|
|
5
|
-
import { ILogger } from '../types';
|
|
6
|
-
export declare function evaluateFeature(log: ILogger, key: SplitKey, splitName: string, attributes: Attributes | undefined, storage: IStorageSync | IStorageAsync): MaybeThenable<IEvaluationResult>;
|
|
7
|
-
export declare function evaluateFeatures(log: ILogger, key: SplitKey, splitNames: string[], attributes: Attributes | undefined, storage: IStorageSync | IStorageAsync): MaybeThenable<Record<string, IEvaluationResult>>;
|