@splitsoftware/splitio-browserjs 0.2.0 → 0.2.1-rc.0
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/README.md +1 -1
- package/cjs/full/index.js +3 -1
- package/cjs/index.js +3 -1
- package/cjs/platform/getModules.js +18 -6
- package/cjs/settings/defaults.js +1 -1
- package/esm/full/index.js +1 -0
- package/esm/index.js +1 -0
- package/esm/platform/getModules.js +19 -7
- package/esm/settings/defaults.js +1 -1
- package/package.json +4 -3
- package/src/full/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/platform/getModules.ts +18 -7
- package/src/settings/defaults.ts +1 -1
- package/types/full/index.d.ts +9 -1
- package/types/index.d.ts +9 -1
- package/types/splitio.d.ts +283 -83
package/README.md
CHANGED
|
@@ -67,8 +67,8 @@ Split has built and maintains SDKs for:
|
|
|
67
67
|
* iOS [Github](https://github.com/splitio/ios-client) [Docs](https://help.split.io/hc/en-us/articles/360020401491-iOS-SDK)
|
|
68
68
|
* Java [Github](https://github.com/splitio/java-client) [Docs](https://help.split.io/hc/en-us/articles/360020405151-Java-SDK)
|
|
69
69
|
* Javascript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK)
|
|
70
|
-
* Node [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK)
|
|
71
70
|
* Javascript for Browser [Github](https://github.com/splitio/javascript-browser-client) [Docs](https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK)
|
|
71
|
+
* Node [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK)
|
|
72
72
|
* PHP [Github](https://github.com/splitio/php-client) [Docs](https://help.split.io/hc/en-us/articles/360020350372-PHP-SDK)
|
|
73
73
|
* Python [Github](https://github.com/splitio/python-client) [Docs](https://help.split.io/hc/en-us/articles/360020359652-Python-SDK)
|
|
74
74
|
* React [Github](https://github.com/splitio/react-client) [Docs](https://help.split.io/hc/en-us/articles/360038825091-React-SDK)
|
package/cjs/full/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DebugLogger = exports.InfoLogger = exports.WarnLogger = exports.ErrorLogger = exports.SplitToGoogleAnalytics = exports.GoogleAnalyticsToSplit = exports.InLocalStorage = exports.SplitFactory = void 0;
|
|
3
|
+
exports.PluggableStorage = exports.DebugLogger = exports.InfoLogger = exports.WarnLogger = exports.ErrorLogger = exports.SplitToGoogleAnalytics = exports.GoogleAnalyticsToSplit = exports.InLocalStorage = exports.SplitFactory = void 0;
|
|
4
4
|
var splitFactory_1 = require("./splitFactory");
|
|
5
5
|
Object.defineProperty(exports, "SplitFactory", { enumerable: true, get: function () { return splitFactory_1.SplitFactory; } });
|
|
6
6
|
var index_1 = require("@splitsoftware/splitio-commons/cjs/storages/inLocalStorage/index");
|
|
@@ -17,3 +17,5 @@ var InfoLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/In
|
|
|
17
17
|
Object.defineProperty(exports, "InfoLogger", { enumerable: true, get: function () { return InfoLogger_1.InfoLogger; } });
|
|
18
18
|
var DebugLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/DebugLogger");
|
|
19
19
|
Object.defineProperty(exports, "DebugLogger", { enumerable: true, get: function () { return DebugLogger_1.DebugLogger; } });
|
|
20
|
+
var pluggable_1 = require("@splitsoftware/splitio-commons/cjs/storages/pluggable");
|
|
21
|
+
Object.defineProperty(exports, "PluggableStorage", { enumerable: true, get: function () { return pluggable_1.PluggableStorage; } });
|
package/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LocalhostFromObject = exports.DebugLogger = exports.InfoLogger = exports.WarnLogger = exports.ErrorLogger = exports.SplitToGoogleAnalytics = exports.GoogleAnalyticsToSplit = exports.InLocalStorage = exports.SplitFactory = void 0;
|
|
3
|
+
exports.PluggableStorage = exports.LocalhostFromObject = exports.DebugLogger = exports.InfoLogger = exports.WarnLogger = exports.ErrorLogger = exports.SplitToGoogleAnalytics = exports.GoogleAnalyticsToSplit = exports.InLocalStorage = exports.SplitFactory = void 0;
|
|
4
4
|
var splitFactory_1 = require("./splitFactory");
|
|
5
5
|
Object.defineProperty(exports, "SplitFactory", { enumerable: true, get: function () { return splitFactory_1.SplitFactory; } });
|
|
6
6
|
var index_1 = require("@splitsoftware/splitio-commons/cjs/storages/inLocalStorage/index");
|
|
@@ -19,3 +19,5 @@ var DebugLogger_1 = require("@splitsoftware/splitio-commons/cjs/logger/browser/D
|
|
|
19
19
|
Object.defineProperty(exports, "DebugLogger", { enumerable: true, get: function () { return DebugLogger_1.DebugLogger; } });
|
|
20
20
|
var LocalhostFromObject_1 = require("@splitsoftware/splitio-commons/cjs/sync/offline/LocalhostFromObject");
|
|
21
21
|
Object.defineProperty(exports, "LocalhostFromObject", { enumerable: true, get: function () { return LocalhostFromObject_1.LocalhostFromObject; } });
|
|
22
|
+
var pluggable_1 = require("@splitsoftware/splitio-commons/cjs/storages/pluggable");
|
|
23
|
+
Object.defineProperty(exports, "PluggableStorage", { enumerable: true, get: function () { return pluggable_1.PluggableStorage; } });
|
|
@@ -13,14 +13,17 @@ var impressionObserverCS_1 = require("@splitsoftware/splitio-commons/cjs/tracker
|
|
|
13
13
|
var pluggable_1 = tslib_1.__importDefault(require("@splitsoftware/splitio-commons/cjs/integrations/pluggable"));
|
|
14
14
|
var utils_1 = require("@splitsoftware/splitio-commons/cjs/trackers/impressionObserver/utils");
|
|
15
15
|
var constants_1 = require("@splitsoftware/splitio-commons/cjs/utils/constants");
|
|
16
|
-
var
|
|
16
|
+
var syncManagerStandaloneFactory;
|
|
17
|
+
var syncManagerSubmittersFactory;
|
|
17
18
|
function getModules(settings, platform) {
|
|
19
|
+
if (!syncManagerStandaloneFactory)
|
|
20
|
+
syncManagerStandaloneFactory = syncManagerOnline_1.syncManagerOnlineFactory(pollingManagerCS_1.default, pushManager_1.default);
|
|
18
21
|
var modules = {
|
|
19
22
|
settings: settings,
|
|
20
23
|
platform: platform,
|
|
21
24
|
storageFactory: settings.storage,
|
|
22
25
|
splitApiFactory: splitApi_1.splitApiFactory,
|
|
23
|
-
syncManagerFactory:
|
|
26
|
+
syncManagerFactory: syncManagerStandaloneFactory,
|
|
24
27
|
sdkManagerFactory: index_1.sdkManagerFactory,
|
|
25
28
|
sdkClientMethodFactory: sdkClientMethodCS_1.sdkClientMethodCSFactory,
|
|
26
29
|
SignalListener: browser_1.default,
|
|
@@ -28,10 +31,19 @@ function getModules(settings, platform) {
|
|
|
28
31
|
integrationsManagerFactory: settings.integrations && settings.integrations.length > 0 ? pluggable_1.default.bind(null, settings.integrations) : undefined,
|
|
29
32
|
impressionsObserverFactory: utils_1.shouldAddPt(settings) ? impressionObserverCS_1.impressionObserverCSFactory : undefined,
|
|
30
33
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
switch (settings.mode) {
|
|
35
|
+
case constants_1.LOCALHOST_MODE:
|
|
36
|
+
modules.splitApiFactory = undefined;
|
|
37
|
+
modules.syncManagerFactory = settings.sync.localhostMode;
|
|
38
|
+
modules.SignalListener = undefined;
|
|
39
|
+
break;
|
|
40
|
+
case constants_1.CONSUMER_MODE:
|
|
41
|
+
modules.syncManagerFactory = undefined;
|
|
42
|
+
break;
|
|
43
|
+
case constants_1.CONSUMER_PARTIAL_MODE:
|
|
44
|
+
if (!syncManagerSubmittersFactory)
|
|
45
|
+
syncManagerSubmittersFactory = syncManagerOnline_1.syncManagerOnlineFactory(undefined, undefined);
|
|
46
|
+
modules.syncManagerFactory = syncManagerSubmittersFactory;
|
|
35
47
|
}
|
|
36
48
|
return modules;
|
|
37
49
|
}
|
package/cjs/settings/defaults.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defaults = void 0;
|
|
4
4
|
var index_1 = require("@splitsoftware/splitio-commons/cjs/logger/index");
|
|
5
|
-
var packageVersion = '0.2.0';
|
|
5
|
+
var packageVersion = '0.2.1-rc.0';
|
|
6
6
|
/**
|
|
7
7
|
* In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.
|
|
8
8
|
* Acceptable values are: 'DEBUG', 'INFO', 'WARN', 'ERROR', 'NONE'.
|
package/esm/full/index.js
CHANGED
|
@@ -6,3 +6,4 @@ export { ErrorLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/E
|
|
|
6
6
|
export { WarnLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/WarnLogger';
|
|
7
7
|
export { InfoLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/InfoLogger';
|
|
8
8
|
export { DebugLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/DebugLogger';
|
|
9
|
+
export { PluggableStorage } from '@splitsoftware/splitio-commons/esm/storages/pluggable';
|
package/esm/index.js
CHANGED
|
@@ -7,3 +7,4 @@ export { WarnLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/Wa
|
|
|
7
7
|
export { InfoLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/InfoLogger';
|
|
8
8
|
export { DebugLogger } from '@splitsoftware/splitio-commons/esm/logger/browser/DebugLogger';
|
|
9
9
|
export { LocalhostFromObject } from '@splitsoftware/splitio-commons/esm/sync/offline/LocalhostFromObject';
|
|
10
|
+
export { PluggableStorage } from '@splitsoftware/splitio-commons/esm/storages/pluggable';
|
|
@@ -8,15 +8,18 @@ import BrowserSignalListener from '@splitsoftware/splitio-commons/esm/listeners/
|
|
|
8
8
|
import { impressionObserverCSFactory } from '@splitsoftware/splitio-commons/esm/trackers/impressionObserver/impressionObserverCS';
|
|
9
9
|
import integrationsManagerFactory from '@splitsoftware/splitio-commons/esm/integrations/pluggable';
|
|
10
10
|
import { shouldAddPt } from '@splitsoftware/splitio-commons/esm/trackers/impressionObserver/utils';
|
|
11
|
-
import { LOCALHOST_MODE } from '@splitsoftware/splitio-commons/esm/utils/constants';
|
|
12
|
-
var
|
|
11
|
+
import { CONSUMER_MODE, CONSUMER_PARTIAL_MODE, LOCALHOST_MODE } from '@splitsoftware/splitio-commons/esm/utils/constants';
|
|
12
|
+
var syncManagerStandaloneFactory;
|
|
13
|
+
var syncManagerSubmittersFactory;
|
|
13
14
|
export function getModules(settings, platform) {
|
|
15
|
+
if (!syncManagerStandaloneFactory)
|
|
16
|
+
syncManagerStandaloneFactory = syncManagerOnlineFactory(pollingManagerCSFactory, pushManagerFactory);
|
|
14
17
|
var modules = {
|
|
15
18
|
settings: settings,
|
|
16
19
|
platform: platform,
|
|
17
20
|
storageFactory: settings.storage,
|
|
18
21
|
splitApiFactory: splitApiFactory,
|
|
19
|
-
syncManagerFactory:
|
|
22
|
+
syncManagerFactory: syncManagerStandaloneFactory,
|
|
20
23
|
sdkManagerFactory: sdkManagerFactory,
|
|
21
24
|
sdkClientMethodFactory: sdkClientMethodCSFactory,
|
|
22
25
|
SignalListener: BrowserSignalListener,
|
|
@@ -24,10 +27,19 @@ export function getModules(settings, platform) {
|
|
|
24
27
|
integrationsManagerFactory: settings.integrations && settings.integrations.length > 0 ? integrationsManagerFactory.bind(null, settings.integrations) : undefined,
|
|
25
28
|
impressionsObserverFactory: shouldAddPt(settings) ? impressionObserverCSFactory : undefined,
|
|
26
29
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
switch (settings.mode) {
|
|
31
|
+
case LOCALHOST_MODE:
|
|
32
|
+
modules.splitApiFactory = undefined;
|
|
33
|
+
modules.syncManagerFactory = settings.sync.localhostMode;
|
|
34
|
+
modules.SignalListener = undefined;
|
|
35
|
+
break;
|
|
36
|
+
case CONSUMER_MODE:
|
|
37
|
+
modules.syncManagerFactory = undefined;
|
|
38
|
+
break;
|
|
39
|
+
case CONSUMER_PARTIAL_MODE:
|
|
40
|
+
if (!syncManagerSubmittersFactory)
|
|
41
|
+
syncManagerSubmittersFactory = syncManagerOnlineFactory(undefined, undefined);
|
|
42
|
+
modules.syncManagerFactory = syncManagerSubmittersFactory;
|
|
31
43
|
}
|
|
32
44
|
return modules;
|
|
33
45
|
}
|
package/esm/settings/defaults.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LogLevels, isLogLevelString } from '@splitsoftware/splitio-commons/esm/logger/index';
|
|
2
|
-
var packageVersion = '0.2.0';
|
|
2
|
+
var packageVersion = '0.2.1-rc.0';
|
|
3
3
|
/**
|
|
4
4
|
* In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.
|
|
5
5
|
* Acceptable values are: 'DEBUG', 'INFO', 'WARN', 'ERROR', 'NONE'.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splitsoftware/splitio-browserjs",
|
|
3
|
-
"version": "0.2.0",
|
|
3
|
+
"version": "0.2.1-rc.0",
|
|
4
4
|
"description": "Split SDK for Javascript on Browser",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"build:umd": "rollup --config rollup.ci.config.js --branch=$BUILD_BRANCH --commit_hash=$BUILD_COMMIT",
|
|
29
29
|
"test": "npm run test:unit && npm run test:e2e",
|
|
30
30
|
"test:unit": "jest",
|
|
31
|
-
"test:e2e": "npm run test:e2e-logger && npm run test:e2e-offline && npm run test:e2e-online && npm run test:e2e-destroy && npm run test:e2e-errors && npm run test:e2e-push && npm run test:e2e-gaintegration",
|
|
31
|
+
"test:e2e": "npm run test:e2e-logger && npm run test:e2e-offline && npm run test:e2e-online && npm run test:e2e-destroy && npm run test:e2e-errors && npm run test:e2e-push && npm run test:e2e-gaintegration && npm run test:e2e-consumer",
|
|
32
32
|
"test:e2e-logger": "karma start karma/e2e.logger.karma.conf.js",
|
|
33
33
|
"test:e2e-offline": "karma start karma/e2e.offline.karma.conf.js",
|
|
34
34
|
"test:e2e-online": "karma start karma/e2e.online.karma.conf.js",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"test:e2e-errors": "karma start karma/e2e.errors.karma.conf.js",
|
|
37
37
|
"test:e2e-push": "karma start karma/e2e.push.karma.conf.js",
|
|
38
38
|
"test:e2e-gaintegration": "karma start karma/e2e.gaintegration.karma.conf.js",
|
|
39
|
+
"test:e2e-consumer": "karma start karma/e2e.consumer.karma.conf.js",
|
|
39
40
|
"pretest-ts-decls": "npm run build:esm && npm run build:cjs && npm link",
|
|
40
41
|
"test-ts-decls": "./scripts/ts-tests.sh",
|
|
41
42
|
"posttest-ts-decls": "npm unlink && npm install",
|
|
@@ -60,7 +61,7 @@
|
|
|
60
61
|
"bugs": "https://github.com/splitio/javascript-browser-client/issues",
|
|
61
62
|
"homepage": "https://github.com/splitio/javascript-browser-client#readme",
|
|
62
63
|
"dependencies": {
|
|
63
|
-
"@splitsoftware/splitio-commons": "1.0.
|
|
64
|
+
"@splitsoftware/splitio-commons": "1.0.1-rc.2",
|
|
64
65
|
"@types/google.analytics": "0.0.40"
|
|
65
66
|
},
|
|
66
67
|
"devDependencies": {
|
package/src/full/index.ts
CHANGED
|
@@ -6,3 +6,4 @@ export { ErrorLogger } from '@splitsoftware/splitio-commons/src/logger/browser/E
|
|
|
6
6
|
export { WarnLogger } from '@splitsoftware/splitio-commons/src/logger/browser/WarnLogger';
|
|
7
7
|
export { InfoLogger } from '@splitsoftware/splitio-commons/src/logger/browser/InfoLogger';
|
|
8
8
|
export { DebugLogger } from '@splitsoftware/splitio-commons/src/logger/browser/DebugLogger';
|
|
9
|
+
export { PluggableStorage } from '@splitsoftware/splitio-commons/src/storages/pluggable';
|
package/src/index.ts
CHANGED
|
@@ -7,3 +7,4 @@ export { WarnLogger } from '@splitsoftware/splitio-commons/src/logger/browser/Wa
|
|
|
7
7
|
export { InfoLogger } from '@splitsoftware/splitio-commons/src/logger/browser/InfoLogger';
|
|
8
8
|
export { DebugLogger } from '@splitsoftware/splitio-commons/src/logger/browser/DebugLogger';
|
|
9
9
|
export { LocalhostFromObject } from '@splitsoftware/splitio-commons/src/sync/offline/LocalhostFromObject';
|
|
10
|
+
export { PluggableStorage } from '@splitsoftware/splitio-commons/src/storages/pluggable';
|
|
@@ -11,12 +11,15 @@ import integrationsManagerFactory from '@splitsoftware/splitio-commons/src/integ
|
|
|
11
11
|
import { shouldAddPt } from '@splitsoftware/splitio-commons/src/trackers/impressionObserver/utils';
|
|
12
12
|
import { IPlatform, ISdkFactoryParams } from '@splitsoftware/splitio-commons/src/sdkFactory/types';
|
|
13
13
|
import { SplitIO, ISettings } from '@splitsoftware/splitio-commons/src/types';
|
|
14
|
-
import { LOCALHOST_MODE } from '@splitsoftware/splitio-commons/src/utils/constants';
|
|
14
|
+
import { CONSUMER_MODE, CONSUMER_PARTIAL_MODE, LOCALHOST_MODE } from '@splitsoftware/splitio-commons/src/utils/constants';
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
let syncManagerStandaloneFactory: ISdkFactoryParams['syncManagerFactory'];
|
|
17
|
+
let syncManagerSubmittersFactory: ISdkFactoryParams['syncManagerFactory'];
|
|
17
18
|
|
|
18
19
|
export function getModules(settings: ISettings, platform: IPlatform): ISdkFactoryParams {
|
|
19
20
|
|
|
21
|
+
if (!syncManagerStandaloneFactory) syncManagerStandaloneFactory = syncManagerOnlineFactory(pollingManagerCSFactory, pushManagerFactory);
|
|
22
|
+
|
|
20
23
|
const modules: ISdkFactoryParams = {
|
|
21
24
|
settings,
|
|
22
25
|
|
|
@@ -26,7 +29,7 @@ export function getModules(settings: ISettings, platform: IPlatform): ISdkFactor
|
|
|
26
29
|
|
|
27
30
|
splitApiFactory,
|
|
28
31
|
|
|
29
|
-
syncManagerFactory:
|
|
32
|
+
syncManagerFactory: syncManagerStandaloneFactory,
|
|
30
33
|
|
|
31
34
|
sdkManagerFactory,
|
|
32
35
|
|
|
@@ -41,10 +44,18 @@ export function getModules(settings: ISettings, platform: IPlatform): ISdkFactor
|
|
|
41
44
|
impressionsObserverFactory: shouldAddPt(settings) ? impressionObserverCSFactory : undefined,
|
|
42
45
|
};
|
|
43
46
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
switch (settings.mode) {
|
|
48
|
+
case LOCALHOST_MODE:
|
|
49
|
+
modules.splitApiFactory = undefined;
|
|
50
|
+
modules.syncManagerFactory = settings.sync.localhostMode;
|
|
51
|
+
modules.SignalListener = undefined;
|
|
52
|
+
break;
|
|
53
|
+
case CONSUMER_MODE:
|
|
54
|
+
modules.syncManagerFactory = undefined;
|
|
55
|
+
break;
|
|
56
|
+
case CONSUMER_PARTIAL_MODE:
|
|
57
|
+
if (!syncManagerSubmittersFactory) syncManagerSubmittersFactory = syncManagerOnlineFactory(undefined, undefined);
|
|
58
|
+
modules.syncManagerFactory = syncManagerSubmittersFactory;
|
|
48
59
|
}
|
|
49
60
|
|
|
50
61
|
return modules;
|
package/src/settings/defaults.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LogLevels, isLogLevelString } from '@splitsoftware/splitio-commons/src/logger/index';
|
|
2
2
|
import { LogLevel } from '@splitsoftware/splitio-commons/src/types';
|
|
3
3
|
|
|
4
|
-
const packageVersion = '0.2.0';
|
|
4
|
+
const packageVersion = '0.2.1-rc.0';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.
|
package/types/full/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Declaration file for Javascript Browser Split Software SDK
|
|
1
|
+
// Declaration file for Javascript Browser Split Software SDK
|
|
2
2
|
// Project: http://www.split.io/
|
|
3
3
|
// Definitions by: Nico Zelaya <https://github.com/NicoZelaya/>
|
|
4
4
|
|
|
@@ -16,6 +16,7 @@ declare module JsSdk {
|
|
|
16
16
|
* For more information read the corresponding article: @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#configuration}
|
|
17
17
|
*/
|
|
18
18
|
export function SplitFactory(settings: SplitIO.IBrowserSettings): SplitIO.ISDK;
|
|
19
|
+
export function SplitFactory(settings: SplitIO.IBrowserAsyncSettings): SplitIO.IAsyncSDK;
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Persistent storage based on the LocalStorage Web API for browsers.
|
|
@@ -24,6 +25,13 @@ declare module JsSdk {
|
|
|
24
25
|
*/
|
|
25
26
|
export function InLocalStorage(options?: SplitIO.InLocalStorageOptions): SplitIO.StorageSyncFactory;
|
|
26
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Pluggable storage to use the SDK in consumer mode.
|
|
30
|
+
*
|
|
31
|
+
* @see {@link @TODO}
|
|
32
|
+
*/
|
|
33
|
+
export function PluggableStorage(options: SplitIO.PluggableStorageOptions): SplitIO.StorageAsyncFactory;
|
|
34
|
+
|
|
27
35
|
/**
|
|
28
36
|
* Enable 'Google Analytics to Split' integration, to track Google Analytics hits as Split events.
|
|
29
37
|
*
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Declaration file for Javascript Browser Split Software SDK
|
|
1
|
+
// Declaration file for Javascript Browser Split Software SDK
|
|
2
2
|
// Project: http://www.split.io/
|
|
3
3
|
// Definitions by: Nico Zelaya <https://github.com/NicoZelaya/>
|
|
4
4
|
|
|
@@ -16,6 +16,7 @@ declare module JsSdk {
|
|
|
16
16
|
* For more information read the corresponding article: @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#configuration}
|
|
17
17
|
*/
|
|
18
18
|
export function SplitFactory(settings: SplitIO.IBrowserSettings): SplitIO.ISDK;
|
|
19
|
+
export function SplitFactory(settings: SplitIO.IBrowserAsyncSettings): SplitIO.IAsyncSDK;
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Persistent storage based on the LocalStorage Web API for browsers.
|
|
@@ -24,6 +25,13 @@ declare module JsSdk {
|
|
|
24
25
|
*/
|
|
25
26
|
export function InLocalStorage(options?: SplitIO.InLocalStorageOptions): SplitIO.StorageSyncFactory;
|
|
26
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Pluggable storage to use the SDK in consumer mode.
|
|
30
|
+
*
|
|
31
|
+
* @see {@link @TODO}
|
|
32
|
+
*/
|
|
33
|
+
export function PluggableStorage(options: SplitIO.PluggableStorageOptions): SplitIO.StorageAsyncFactory;
|
|
34
|
+
|
|
27
35
|
/**
|
|
28
36
|
* Enable 'Google Analytics to Split' integration, to track Google Analytics hits as Split events.
|
|
29
37
|
*
|
package/types/splitio.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for Javascript Browser Split Software SDK
|
|
1
|
+
// Type definitions for Javascript Browser Split Software SDK
|
|
2
2
|
// Project: http://www.split.io/
|
|
3
3
|
// Definitions by: Nico Zelaya <https://github.com/NicoZelaya/>
|
|
4
4
|
|
|
@@ -11,11 +11,11 @@ export = SplitIO;
|
|
|
11
11
|
* EventEmitter interface based on a subset of the NodeJS.EventEmitter methods.
|
|
12
12
|
*/
|
|
13
13
|
interface IEventEmitter {
|
|
14
|
-
addListener(event: string, listener: (...args: any[]) => void): this
|
|
14
|
+
addListener(event: string, listener: (...args: any[]) => void): this
|
|
15
15
|
on(event: string, listener: (...args: any[]) => void): this
|
|
16
16
|
once(event: string, listener: (...args: any[]) => void): this
|
|
17
|
-
removeListener(event: string, listener: (...args: any[]) => void): this
|
|
18
|
-
off(event: string, listener: (...args: any[]) => void): this
|
|
17
|
+
removeListener(event: string, listener: (...args: any[]) => void): this
|
|
18
|
+
off(event: string, listener: (...args: any[]) => void): this
|
|
19
19
|
removeAllListeners(event?: string): this
|
|
20
20
|
emit(event: string, ...args: any[]): boolean
|
|
21
21
|
}
|
|
@@ -32,6 +32,11 @@ type EventConsts = {
|
|
|
32
32
|
SDK_READY_TIMED_OUT: 'init::timeout',
|
|
33
33
|
SDK_UPDATE: 'state::update'
|
|
34
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* SDK Modes.
|
|
37
|
+
* @typedef {string} SDKMode
|
|
38
|
+
*/
|
|
39
|
+
type SDKMode = 'standalone' | 'localhost' | 'consumer' | 'consumer_partial';
|
|
35
40
|
/**
|
|
36
41
|
* Storage types.
|
|
37
42
|
* @typedef {string} StorageType
|
|
@@ -49,6 +54,7 @@ interface ISettings {
|
|
|
49
54
|
labelsEnabled: boolean,
|
|
50
55
|
IPAddressesEnabled: boolean
|
|
51
56
|
},
|
|
57
|
+
readonly mode: SDKMode,
|
|
52
58
|
readonly scheduler: {
|
|
53
59
|
featuresRefreshRate: number,
|
|
54
60
|
impressionsRefreshRate: number,
|
|
@@ -64,7 +70,7 @@ interface ISettings {
|
|
|
64
70
|
retriesOnFailureBeforeReady: number,
|
|
65
71
|
eventsFirstPushWindow: number
|
|
66
72
|
},
|
|
67
|
-
readonly storage?: SplitIO.StorageSyncFactory,
|
|
73
|
+
readonly storage?: SplitIO.StorageSyncFactory | SplitIO.StorageAsyncFactory,
|
|
68
74
|
readonly urls: {
|
|
69
75
|
events: string,
|
|
70
76
|
sdk: string,
|
|
@@ -183,7 +189,7 @@ interface ISharedSettings {
|
|
|
183
189
|
*/
|
|
184
190
|
impressionsMode?: SplitIO.ImpressionsMode,
|
|
185
191
|
/**
|
|
186
|
-
* Defines the factory function to
|
|
192
|
+
* Defines the factory function to instantiate the SDK in localhost mode.
|
|
187
193
|
*
|
|
188
194
|
* NOTE: this is only required if using the slim entry point of the library to init the SDK in localhost mode.
|
|
189
195
|
*
|
|
@@ -471,7 +477,7 @@ declare namespace SplitIO {
|
|
|
471
477
|
(params: {}): (StorageSync | undefined)
|
|
472
478
|
}
|
|
473
479
|
/**
|
|
474
|
-
* Configuration params for InLocalStorage
|
|
480
|
+
* Configuration params for `InLocalStorage`
|
|
475
481
|
*/
|
|
476
482
|
type InLocalStorageOptions = {
|
|
477
483
|
/**
|
|
@@ -481,6 +487,35 @@ declare namespace SplitIO {
|
|
|
481
487
|
*/
|
|
482
488
|
prefix?: string
|
|
483
489
|
}
|
|
490
|
+
/**
|
|
491
|
+
* Storage for asynchronous (consumer) SDK.
|
|
492
|
+
* Its interface details are not part of the public API.
|
|
493
|
+
*/
|
|
494
|
+
type StorageAsync = {}
|
|
495
|
+
/**
|
|
496
|
+
* Storage builder for asynchronous (consumer) SDK.
|
|
497
|
+
* Input parameter details are not part of the public API.
|
|
498
|
+
*/
|
|
499
|
+
type StorageAsyncFactory = {
|
|
500
|
+
readonly type: 'PLUGGABLE'
|
|
501
|
+
(params: {}): StorageAsync
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* Configuration params for `PluggableStorage`
|
|
505
|
+
*/
|
|
506
|
+
type PluggableStorageOptions = {
|
|
507
|
+
/**
|
|
508
|
+
* Optional prefix to prevent any kind of data collision when having multiple factories using the same storage wrapper.
|
|
509
|
+
* @property {string} prefix
|
|
510
|
+
* @default SPLITIO
|
|
511
|
+
*/
|
|
512
|
+
prefix?: string,
|
|
513
|
+
/**
|
|
514
|
+
* Storage wrapper.
|
|
515
|
+
* @property {Object} wrapper
|
|
516
|
+
*/
|
|
517
|
+
wrapper: Object
|
|
518
|
+
}
|
|
484
519
|
/**
|
|
485
520
|
* Localhost mode factory.
|
|
486
521
|
* Its interface details are not part of the public API.
|
|
@@ -707,13 +742,87 @@ declare namespace SplitIO {
|
|
|
707
742
|
interface ILogger {
|
|
708
743
|
setLogLevel(logLevel: LogLevel): void
|
|
709
744
|
}
|
|
745
|
+
/**
|
|
746
|
+
* Common settings interface for SDK instances created on the browser.
|
|
747
|
+
* @interface IBrowserBasicSettings
|
|
748
|
+
* @extends ISharedSettings
|
|
749
|
+
*/
|
|
750
|
+
interface IBrowserBasicSettings extends ISharedSettings {
|
|
751
|
+
/**
|
|
752
|
+
* SDK Core settings for the browser.
|
|
753
|
+
* @property {Object} core
|
|
754
|
+
*/
|
|
755
|
+
core: {
|
|
756
|
+
/**
|
|
757
|
+
* Your API key. More information: @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
|
|
758
|
+
* @property {string} authorizationKey
|
|
759
|
+
*/
|
|
760
|
+
authorizationKey: string,
|
|
761
|
+
/**
|
|
762
|
+
* Customer identifier. Whatever this means to you. @see {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
|
|
763
|
+
* @property {SplitKey} key
|
|
764
|
+
*/
|
|
765
|
+
key: SplitKey,
|
|
766
|
+
/**
|
|
767
|
+
* Disable labels from being sent to Split backend. Labels may contain sensitive information.
|
|
768
|
+
* @property {boolean} labelsEnabled
|
|
769
|
+
* @default true
|
|
770
|
+
*/
|
|
771
|
+
labelsEnabled?: boolean
|
|
772
|
+
},
|
|
773
|
+
/**
|
|
774
|
+
* List of URLs that the SDK will use as base for it's synchronization functionalities, applicable only when running as standalone.
|
|
775
|
+
* Do not change these settings unless you're working an advanced use case, like connecting to the Split proxy.
|
|
776
|
+
* @property {Object} urls
|
|
777
|
+
*/
|
|
778
|
+
urls?: UrlSettings,
|
|
779
|
+
/**
|
|
780
|
+
* Defines an optional list of factory functions used to instantiate SDK integrations.
|
|
781
|
+
*
|
|
782
|
+
* Example:
|
|
783
|
+
* ```typescript
|
|
784
|
+
* SplitFactory({
|
|
785
|
+
* ...
|
|
786
|
+
* integrations: [SplitToGoogleAnalytics(), GoogleAnalyticsToSplit()]
|
|
787
|
+
* })
|
|
788
|
+
* ```
|
|
789
|
+
* @property {Object} integrations
|
|
790
|
+
*/
|
|
791
|
+
integrations?: IntegrationFactory[],
|
|
792
|
+
}
|
|
710
793
|
/**
|
|
711
794
|
* Settings interface for SDK instances created on the browser.
|
|
712
795
|
* @interface IBrowserSettings
|
|
713
796
|
* @extends ISharedSettings
|
|
714
797
|
* @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#configuration}
|
|
715
798
|
*/
|
|
716
|
-
interface IBrowserSettings extends
|
|
799
|
+
interface IBrowserSettings extends IBrowserBasicSettings {
|
|
800
|
+
/**
|
|
801
|
+
* The SDK mode. When using the default in memory storage or `InLocalStorage` as storage, the only possible value is "standalone", which is the default.
|
|
802
|
+
* For "localhost" mode, use "localhost" as authorizationKey.
|
|
803
|
+
*
|
|
804
|
+
* @property {'standalone'} mode
|
|
805
|
+
* @default standalone
|
|
806
|
+
*/
|
|
807
|
+
mode?: 'standalone',
|
|
808
|
+
/**
|
|
809
|
+
* Mocked features map. For testing purposses only. For using this you should specify "localhost" as authorizationKey on core settings.
|
|
810
|
+
* @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#localhost-mode}
|
|
811
|
+
*/
|
|
812
|
+
features?: MockedFeaturesMap,
|
|
813
|
+
/**
|
|
814
|
+
* Defines the factory function to instantiate the storage. If not provided, the default IN MEMORY storage is used.
|
|
815
|
+
*
|
|
816
|
+
* Example:
|
|
817
|
+
* ```typescript
|
|
818
|
+
* SplitFactory({
|
|
819
|
+
* ...
|
|
820
|
+
* storage: InLocalStorage()
|
|
821
|
+
* })
|
|
822
|
+
* ```
|
|
823
|
+
* @property {Object} storage
|
|
824
|
+
*/
|
|
825
|
+
storage?: StorageSyncFactory,
|
|
717
826
|
/**
|
|
718
827
|
* SDK Startup settings for the Browser.
|
|
719
828
|
* @property {Object} startup
|
|
@@ -796,66 +905,89 @@ declare namespace SplitIO {
|
|
|
796
905
|
* @default 1
|
|
797
906
|
*/
|
|
798
907
|
pushRetryBackoffBase?: number,
|
|
799
|
-
}
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* Settings interface with async storage for SDK instances created on the browser.
|
|
912
|
+
* If your storage is synchronous (by defaut we use memory, which is sync) use SplitIO.IBrowserSettings instead.
|
|
913
|
+
* @interface IBrowserAsyncSettings
|
|
914
|
+
* @extends IBrowserBasicSettings
|
|
915
|
+
* @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#configuration}
|
|
916
|
+
*/
|
|
917
|
+
interface IBrowserAsyncSettings extends IBrowserBasicSettings {
|
|
800
918
|
/**
|
|
801
|
-
* SDK
|
|
802
|
-
*
|
|
919
|
+
* The SDK mode. When using `PluggableStorage` as storage, the possible values are "consumer" and "consumer_partial".
|
|
920
|
+
*
|
|
921
|
+
* @see {@link @TODO}
|
|
922
|
+
*
|
|
923
|
+
* @property {'consumer' | 'consumer_partial'} mode
|
|
803
924
|
*/
|
|
804
|
-
|
|
805
|
-
/**
|
|
806
|
-
* Your API key. More information: @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
|
|
807
|
-
* @property {string} authorizationKey
|
|
808
|
-
*/
|
|
809
|
-
authorizationKey: string,
|
|
810
|
-
/**
|
|
811
|
-
* Customer identifier. Whatever this means to you. @see {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
|
|
812
|
-
* @property {SplitKey} key
|
|
813
|
-
*/
|
|
814
|
-
key: SplitKey,
|
|
815
|
-
/**
|
|
816
|
-
* Disable labels from being sent to Split backend. Labels may contain sensitive information.
|
|
817
|
-
* @property {boolean} labelsEnabled
|
|
818
|
-
* @default true
|
|
819
|
-
*/
|
|
820
|
-
labelsEnabled?: boolean
|
|
821
|
-
},
|
|
925
|
+
mode: 'consumer' | 'consumer_partial',
|
|
822
926
|
/**
|
|
823
|
-
*
|
|
824
|
-
* @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#localhost-mode}
|
|
825
|
-
*/
|
|
826
|
-
features?: MockedFeaturesMap,
|
|
827
|
-
/**
|
|
828
|
-
* Defines the factory function to instanciate the storage. If not provided, the default IN MEMORY storage is used.
|
|
927
|
+
* Defines the factory function to instantiate the storage.
|
|
829
928
|
*
|
|
830
929
|
* Example:
|
|
831
930
|
* ```typescript
|
|
832
931
|
* SplitFactory({
|
|
833
932
|
* ...
|
|
834
|
-
* storage:
|
|
933
|
+
* storage: PluggableStorage({ wrapper: SomeWrapper })
|
|
835
934
|
* })
|
|
836
935
|
* ```
|
|
837
936
|
* @property {Object} storage
|
|
838
937
|
*/
|
|
839
|
-
storage
|
|
938
|
+
storage: StorageAsyncFactory,
|
|
840
939
|
/**
|
|
841
|
-
*
|
|
842
|
-
*
|
|
843
|
-
* @property {Object} urls
|
|
940
|
+
* SDK Startup settings for the Browser.
|
|
941
|
+
* @property {Object} startup
|
|
844
942
|
*/
|
|
845
|
-
|
|
943
|
+
startup?: {
|
|
944
|
+
/**
|
|
945
|
+
* Maximum amount of time used before notify a timeout.
|
|
946
|
+
* @property {number} readyTimeout
|
|
947
|
+
* @default 1.5
|
|
948
|
+
*/
|
|
949
|
+
readyTimeout?: number,
|
|
950
|
+
/**
|
|
951
|
+
* For SDK posts the queued events data in bulks with a given rate, but the first push window is defined separately,
|
|
952
|
+
* to better control on browsers. This number defines that window before the first events push.
|
|
953
|
+
*
|
|
954
|
+
* NOTE: this param is ignored in 'consumer' mode.
|
|
955
|
+
* @property {number} eventsFirstPushWindow
|
|
956
|
+
* @default 10
|
|
957
|
+
*/
|
|
958
|
+
eventsFirstPushWindow?: number,
|
|
959
|
+
},
|
|
846
960
|
/**
|
|
847
|
-
*
|
|
848
|
-
*
|
|
849
|
-
* Example:
|
|
850
|
-
* ```typescript
|
|
851
|
-
* SplitFactory({
|
|
852
|
-
* ...
|
|
853
|
-
* integrations: [SplitToGoogleAnalytics(), GoogleAnalyticsToSplit()]
|
|
854
|
-
* })
|
|
855
|
-
* ```
|
|
856
|
-
* @property {Object} integrations
|
|
961
|
+
* SDK scheduler settings.
|
|
962
|
+
* @property {Object} scheduler
|
|
857
963
|
*/
|
|
858
|
-
|
|
964
|
+
scheduler?: {
|
|
965
|
+
/**
|
|
966
|
+
* The SDK sends information on who got what treatment at what time back to Split servers to power analytics. This parameter controls how often this data is sent to Split servers. The parameter should be in seconds.
|
|
967
|
+
*
|
|
968
|
+
* NOTE: this param is ignored in 'consumer' mode.
|
|
969
|
+
* @property {number} impressionsRefreshRate
|
|
970
|
+
* @default 60
|
|
971
|
+
*/
|
|
972
|
+
impressionsRefreshRate?: number,
|
|
973
|
+
/**
|
|
974
|
+
* The SDK posts the queued events data in bulks. This parameter controls the posting rate in seconds.
|
|
975
|
+
*
|
|
976
|
+
* NOTE: this param is ignored in 'consumer' mode.
|
|
977
|
+
* @property {number} eventsPushRate
|
|
978
|
+
* @default 60
|
|
979
|
+
*/
|
|
980
|
+
eventsPushRate?: number,
|
|
981
|
+
/**
|
|
982
|
+
* The maximum number of event items we want to queue. If we queue more values, it will trigger a flush and reset the timer.
|
|
983
|
+
* If you use a 0 here, the queue will have no maximum size.
|
|
984
|
+
*
|
|
985
|
+
* NOTE: this param is ignored in 'consumer' mode.
|
|
986
|
+
* @property {number} eventsQueueSize
|
|
987
|
+
* @default 500
|
|
988
|
+
*/
|
|
989
|
+
eventsQueueSize?: number,
|
|
990
|
+
}
|
|
859
991
|
}
|
|
860
992
|
/**
|
|
861
993
|
* This represents the interface for the SDK instance with synchronous storage and client-side API,
|
|
@@ -863,7 +995,7 @@ declare namespace SplitIO {
|
|
|
863
995
|
* @interface ISDK
|
|
864
996
|
* @extends IBasicSDK
|
|
865
997
|
*/
|
|
866
|
-
|
|
998
|
+
interface ISDK extends IBasicSDK {
|
|
867
999
|
/**
|
|
868
1000
|
* Returns the default client instance of the SDK, associated with the key and optional traffic type from settings.
|
|
869
1001
|
* @function client
|
|
@@ -884,7 +1016,26 @@ declare namespace SplitIO {
|
|
|
884
1016
|
*/
|
|
885
1017
|
manager(): IManager
|
|
886
1018
|
}
|
|
887
|
-
|
|
1019
|
+
/**
|
|
1020
|
+
* This represents the interface for the SDK instance with asynchronous storage and client-side API,
|
|
1021
|
+
* i.e., where client instances have a bound user key.
|
|
1022
|
+
* @interface IAsyncSDK
|
|
1023
|
+
* @extends IBasicSDK
|
|
1024
|
+
*/
|
|
1025
|
+
interface IAsyncSDK extends IBasicSDK {
|
|
1026
|
+
/**
|
|
1027
|
+
* Returns the default client instance of the SDK.
|
|
1028
|
+
* @function client
|
|
1029
|
+
* @returns {IAsyncClient} The asynchronous client instance.
|
|
1030
|
+
*/
|
|
1031
|
+
client(): IAsyncClient,
|
|
1032
|
+
/**
|
|
1033
|
+
* Returns a manager instance of the SDK to explore available information.
|
|
1034
|
+
* @function manager
|
|
1035
|
+
* @returns {IManager} The manager instance.
|
|
1036
|
+
*/
|
|
1037
|
+
manager(): IAsyncManager
|
|
1038
|
+
}
|
|
888
1039
|
/**
|
|
889
1040
|
* This represents the interface for the Client instance with synchronous storage for server-side SDK, where we don't have only one key.
|
|
890
1041
|
* @interface IClient
|
|
@@ -892,35 +1043,35 @@ declare namespace SplitIO {
|
|
|
892
1043
|
*/
|
|
893
1044
|
interface IClientSS extends IBasicClient {
|
|
894
1045
|
/**
|
|
895
|
-
* Returns a Treatment value, which
|
|
1046
|
+
* Returns a Treatment value, which is the treatment string for the given feature.
|
|
896
1047
|
* @function getTreatment
|
|
897
1048
|
* @param {string} key - The string key representing the consumer.
|
|
898
1049
|
* @param {string} splitName - The string that represents the split we wan't to get the treatment.
|
|
899
1050
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
900
|
-
* @returns {Treatment} The treatment
|
|
1051
|
+
* @returns {Treatment} The treatment string.
|
|
901
1052
|
*/
|
|
902
1053
|
getTreatment(key: SplitKey, splitName: string, attributes?: Attributes): Treatment,
|
|
903
1054
|
/**
|
|
904
|
-
* Returns a TreatmentWithConfig value
|
|
1055
|
+
* Returns a TreatmentWithConfig value, which is an object with both treatment and config string for the given feature.
|
|
905
1056
|
* @function getTreatmentWithConfig
|
|
906
1057
|
* @param {string} key - The string key representing the consumer.
|
|
907
1058
|
* @param {string} splitName - The string that represents the split we wan't to get the treatment.
|
|
908
1059
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
909
|
-
* @returns {TreatmentWithConfig} The TreatmentWithConfig
|
|
910
|
-
*
|
|
1060
|
+
* @returns {TreatmentWithConfig} The TreatmentWithConfig, the object containing the treatment string and the
|
|
1061
|
+
* configuration stringified JSON (or null if there was no config for that treatment).
|
|
911
1062
|
*/
|
|
912
1063
|
getTreatmentWithConfig(key: SplitKey, splitName: string, attributes?: Attributes): TreatmentWithConfig,
|
|
913
1064
|
/**
|
|
914
|
-
* Returns a Treatments value,
|
|
1065
|
+
* Returns a Treatments value, which is an object map with the treatments for the given features.
|
|
915
1066
|
* @function getTreatments
|
|
916
1067
|
* @param {string} key - The string key representing the consumer.
|
|
917
1068
|
* @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
|
|
918
1069
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
919
|
-
* @returns {Treatments} The treatments
|
|
1070
|
+
* @returns {Treatments} The treatments object map.
|
|
920
1071
|
*/
|
|
921
1072
|
getTreatments(key: SplitKey, splitNames: string[], attributes?: Attributes): Treatments,
|
|
922
1073
|
/**
|
|
923
|
-
* Returns a TreatmentsWithConfig value,
|
|
1074
|
+
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
|
|
924
1075
|
* @function getTreatmentsWithConfig
|
|
925
1076
|
* @param {string} key - The string key representing the consumer.
|
|
926
1077
|
* @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
|
|
@@ -936,7 +1087,7 @@ declare namespace SplitIO {
|
|
|
936
1087
|
* @param {string} eventType - The event type corresponding to this event.
|
|
937
1088
|
* @param {number=} value - The value of this event.
|
|
938
1089
|
* @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
|
|
939
|
-
* @returns {boolean} Whether the event was added to the queue
|
|
1090
|
+
* @returns {boolean} Whether the event was added to the queue successfully or not.
|
|
940
1091
|
*/
|
|
941
1092
|
track(key: SplitIO.SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): boolean,
|
|
942
1093
|
}
|
|
@@ -958,7 +1109,7 @@ declare namespace SplitIO {
|
|
|
958
1109
|
*/
|
|
959
1110
|
getTreatment(key: SplitKey, splitName: string, attributes?: Attributes): AsyncTreatment,
|
|
960
1111
|
/**
|
|
961
|
-
* Returns a TreatmentWithConfig value, which will be (or eventually be)
|
|
1112
|
+
* Returns a TreatmentWithConfig value, which will be (or eventually be) an object with both treatment and config string for the given feature.
|
|
962
1113
|
* For usage on NodeJS as we don't have only one key.
|
|
963
1114
|
* NOTE: Treatment will be a promise only in async storages, like REDIS.
|
|
964
1115
|
* @function getTreatmentWithConfig
|
|
@@ -969,17 +1120,17 @@ declare namespace SplitIO {
|
|
|
969
1120
|
*/
|
|
970
1121
|
getTreatmentWithConfig(key: SplitKey, splitName: string, attributes?: Attributes): AsyncTreatmentWithConfig,
|
|
971
1122
|
/**
|
|
972
|
-
* Returns a Treatments value,
|
|
1123
|
+
* Returns a Treatments value, which will be (or eventually be) an object map with the treatments for the given features.
|
|
973
1124
|
* For usage on NodeJS as we don't have only one key.
|
|
974
1125
|
* @function getTreatments
|
|
975
1126
|
* @param {string} key - The string key representing the consumer.
|
|
976
1127
|
* @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
|
|
977
1128
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
978
|
-
* @returns {AsyncTreatments} Treatments promise which will resolve to the treatments object.
|
|
1129
|
+
* @returns {AsyncTreatments} Treatments promise which will resolve to the treatments object map.
|
|
979
1130
|
*/
|
|
980
1131
|
getTreatments(key: SplitKey, splitNames: string[], attributes?: Attributes): AsyncTreatments,
|
|
981
1132
|
/**
|
|
982
|
-
* Returns a
|
|
1133
|
+
* Returns a TreatmentsWithConfig value, which will be (or eventually be) an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
|
|
983
1134
|
* For usage on NodeJS as we don't have only one key.
|
|
984
1135
|
* @function getTreatmentsWithConfig
|
|
985
1136
|
* @param {string} key - The string key representing the consumer.
|
|
@@ -996,7 +1147,7 @@ declare namespace SplitIO {
|
|
|
996
1147
|
* @param {string} eventType - The event type corresponding to this event.
|
|
997
1148
|
* @param {number=} value - The value of this event.
|
|
998
1149
|
* @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
|
|
999
|
-
* @returns {Promise<boolean>} A promise that resolves to a boolean indicating if the event was added to the queue
|
|
1150
|
+
* @returns {Promise<boolean>} A promise that resolves to a boolean indicating if the event was added to the queue successfully or not.
|
|
1000
1151
|
*/
|
|
1001
1152
|
track(key: SplitIO.SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): Promise<boolean>
|
|
1002
1153
|
}
|
|
@@ -1007,31 +1158,31 @@ declare namespace SplitIO {
|
|
|
1007
1158
|
*/
|
|
1008
1159
|
interface IClient extends IBasicClient {
|
|
1009
1160
|
/**
|
|
1010
|
-
* Returns a Treatment value, which
|
|
1161
|
+
* Returns a Treatment value, which is the treatment string for the given feature.
|
|
1011
1162
|
* @function getTreatment
|
|
1012
1163
|
* @param {string} splitName - The string that represents the split we wan't to get the treatment.
|
|
1013
1164
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1014
|
-
* @returns {Treatment} The treatment
|
|
1165
|
+
* @returns {Treatment} The treatment string.
|
|
1015
1166
|
*/
|
|
1016
1167
|
getTreatment(splitName: string, attributes?: Attributes): Treatment,
|
|
1017
1168
|
/**
|
|
1018
|
-
* Returns a TreatmentWithConfig value, which
|
|
1019
|
-
* @function
|
|
1169
|
+
* Returns a TreatmentWithConfig value, which is an object with both treatment and config string for the given feature.
|
|
1170
|
+
* @function getTreatmentWithConfig
|
|
1020
1171
|
* @param {string} splitName - The string that represents the split we wan't to get the treatment.
|
|
1021
1172
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1022
|
-
* @returns {TreatmentWithConfig} The treatment or
|
|
1173
|
+
* @returns {TreatmentWithConfig} The map containing the treatment and the configuration stringified JSON (or null if there was no config for that treatment).
|
|
1023
1174
|
*/
|
|
1024
1175
|
getTreatmentWithConfig(splitName: string, attributes?: Attributes): TreatmentWithConfig,
|
|
1025
1176
|
/**
|
|
1026
|
-
* Returns a Treatments value,
|
|
1177
|
+
* Returns a Treatments value, which is an object map with the treatments for the given features.
|
|
1027
1178
|
* @function getTreatments
|
|
1028
1179
|
* @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
|
|
1029
1180
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1030
|
-
* @returns {Treatments} The treatments
|
|
1181
|
+
* @returns {Treatments} The treatments object map.
|
|
1031
1182
|
*/
|
|
1032
1183
|
getTreatments(splitNames: string[], attributes?: Attributes): Treatments,
|
|
1033
1184
|
/**
|
|
1034
|
-
* Returns a TreatmentsWithConfig value,
|
|
1185
|
+
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
|
|
1035
1186
|
* @function getTreatmentsWithConfig
|
|
1036
1187
|
* @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
|
|
1037
1188
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
@@ -1045,10 +1196,59 @@ declare namespace SplitIO {
|
|
|
1045
1196
|
* @param {string} eventType - The event type corresponding to this event.
|
|
1046
1197
|
* @param {number=} value - The value of this event.
|
|
1047
1198
|
* @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
|
|
1048
|
-
* @returns {boolean} Whether the event was added to the queue
|
|
1199
|
+
* @returns {boolean} Whether the event was added to the queue successfully or not.
|
|
1049
1200
|
*/
|
|
1050
1201
|
track(trafficType: string, eventType: string, value?: number, properties?: Properties): boolean,
|
|
1051
1202
|
}
|
|
1203
|
+
/**
|
|
1204
|
+
* This represents the interface for the Client instance with asynchronous storage for client-side SDK, where each client has associated a key.
|
|
1205
|
+
* @interface IAsyncClient
|
|
1206
|
+
* @extends IBasicClient
|
|
1207
|
+
*/
|
|
1208
|
+
interface IAsyncClient extends IBasicClient {
|
|
1209
|
+
/**
|
|
1210
|
+
* Returns a Treatment value, which will be (or eventually be) the treatment string for the given feature.
|
|
1211
|
+
* @function getTreatment
|
|
1212
|
+
* @param {string} splitName - The string that represents the split we wan't to get the treatment.
|
|
1213
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1214
|
+
* @returns {AsyncTreatment} Treatment promise which will resolve to the treatment string.
|
|
1215
|
+
*/
|
|
1216
|
+
getTreatment(splitName: string, attributes?: Attributes): AsyncTreatment,
|
|
1217
|
+
/**
|
|
1218
|
+
* Returns a TreatmentWithConfig value, which will be (or eventually be) an object with both treatment and config string for the given feature.
|
|
1219
|
+
* @function getTreatmentWithConfig
|
|
1220
|
+
* @param {string} splitName - The string that represents the split we wan't to get the treatment.
|
|
1221
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1222
|
+
* @returns {AsyncTreatmentWithConfig} TreatmentWithConfig promise which will resolve to the TreatmentWithConfig object.
|
|
1223
|
+
*/
|
|
1224
|
+
getTreatmentWithConfig(splitName: string, attributes?: Attributes): AsyncTreatmentWithConfig,
|
|
1225
|
+
/**
|
|
1226
|
+
* Returns a Treatments value, which will be (or eventually be) an object map with the treatments for the given features.
|
|
1227
|
+
* @function getTreatments
|
|
1228
|
+
* @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
|
|
1229
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1230
|
+
* @returns {AsyncTreatments} Treatments promise which will resolve to the treatments object map.
|
|
1231
|
+
*/
|
|
1232
|
+
getTreatments(splitNames: string[], attributes?: Attributes): AsyncTreatments,
|
|
1233
|
+
/**
|
|
1234
|
+
* Returns a TreatmentsWithConfig value, which will be (or eventually be) an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
|
|
1235
|
+
* @function getTreatmentsWithConfig
|
|
1236
|
+
* @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
|
|
1237
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1238
|
+
* @returns {TreatmentsWithConfig} TreatmentsWithConfig promise which will resolve to the map of TreatmentsWithConfig objects.
|
|
1239
|
+
*/
|
|
1240
|
+
getTreatmentsWithConfig(splitNames: string[], attributes?: Attributes): AsyncTreatmentsWithConfig,
|
|
1241
|
+
/**
|
|
1242
|
+
* Tracks an event to be fed to the results product on Split Webconsole and returns a promise to signal when the event was successfully queued (or not).
|
|
1243
|
+
* @function track
|
|
1244
|
+
* @param {string} trafficType - The traffic type of the entity related to this event.
|
|
1245
|
+
* @param {string} eventType - The event type corresponding to this event.
|
|
1246
|
+
* @param {number=} value - The value of this event.
|
|
1247
|
+
* @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
|
|
1248
|
+
* @returns {boolean} A promise that resolves to a boolean indicating if the event was added to the queue successfully or not.
|
|
1249
|
+
*/
|
|
1250
|
+
track(trafficType: string, eventType: string, value?: number, properties?: Properties): Promise<boolean>,
|
|
1251
|
+
}
|
|
1052
1252
|
/**
|
|
1053
1253
|
* Representation of a manager instance with synchronous storage of the SDK.
|
|
1054
1254
|
* @interface IManager
|
|
@@ -1060,20 +1260,20 @@ declare namespace SplitIO {
|
|
|
1060
1260
|
* @function names
|
|
1061
1261
|
* @returns {SplitNames} The lists of Split names.
|
|
1062
1262
|
*/
|
|
1063
|
-
names(): SplitNames
|
|
1263
|
+
names(): SplitNames,
|
|
1064
1264
|
/**
|
|
1065
1265
|
* Get the array of splits data in SplitView format.
|
|
1066
1266
|
* @function splits
|
|
1067
1267
|
* @returns {SplitViews} The list of SplitIO.SplitView.
|
|
1068
1268
|
*/
|
|
1069
|
-
splits(): SplitViews
|
|
1269
|
+
splits(): SplitViews,
|
|
1070
1270
|
/**
|
|
1071
1271
|
* Get the data of a split in SplitView format.
|
|
1072
1272
|
* @function split
|
|
1073
1273
|
* @param {string} splitName The name of the split we wan't to get info of.
|
|
1074
1274
|
* @returns {SplitView} The SplitIO.SplitView of the given split.
|
|
1075
1275
|
*/
|
|
1076
|
-
split(splitName: string): SplitView
|
|
1276
|
+
split(splitName: string): SplitView,
|
|
1077
1277
|
}
|
|
1078
1278
|
/**
|
|
1079
1279
|
* Representation of a manager instance with asynchronous storage of the SDK.
|
|
@@ -1086,19 +1286,19 @@ declare namespace SplitIO {
|
|
|
1086
1286
|
* @function names
|
|
1087
1287
|
* @returns {SplitNamesAsync} A promise that will resolve to the array of Splitio.SplitNames.
|
|
1088
1288
|
*/
|
|
1089
|
-
names(): SplitNamesAsync
|
|
1289
|
+
names(): SplitNamesAsync,
|
|
1090
1290
|
/**
|
|
1091
1291
|
* Get the array of splits data in SplitView format.
|
|
1092
1292
|
* @function splits
|
|
1093
1293
|
* @returns {SplitViewsAsync} A promise that will resolve to the SplitIO.SplitView list.
|
|
1094
1294
|
*/
|
|
1095
|
-
splits(): SplitViewsAsync
|
|
1295
|
+
splits(): SplitViewsAsync,
|
|
1096
1296
|
/**
|
|
1097
1297
|
* Get the data of a split in SplitView format.
|
|
1098
1298
|
* @function split
|
|
1099
1299
|
* @param {string} splitName The name of the split we wan't to get info of.
|
|
1100
1300
|
* @returns {SplitViewAsync} A promise that will resolve to the SplitIO.SplitView value.
|
|
1101
1301
|
*/
|
|
1102
|
-
split(splitName: string): SplitViewAsync
|
|
1302
|
+
split(splitName: string): SplitViewAsync,
|
|
1103
1303
|
}
|
|
1104
1304
|
}
|