@splitsoftware/splitio 10.17.3-rc.2 → 10.17.3-rc.3
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/es/factory/browser.js +41 -33
- package/es/factory/node.js +41 -36
- package/es/index.js +16 -1
- package/es/platform/EventEmitter.js +300 -326
- package/es/platform/browser.js +4 -4
- package/es/platform/getEventSource/browser.js +2 -2
- package/es/platform/getEventSource/node.js +13 -12
- package/es/platform/getFetch/browser.js +2 -2
- package/es/platform/getFetch/node.js +13 -13
- package/es/platform/node.js +5 -5
- package/es/platform/request/options/node.js +6 -21
- package/es/settings/browser.js +9 -9
- package/es/settings/defaults/browser.js +13 -13
- package/es/settings/defaults/node.js +22 -22
- package/es/settings/defaults/version.js +1 -1
- package/es/settings/integrations/browser.js +3 -3
- package/es/settings/node.js +9 -12
- package/es/settings/storage/browser.js +31 -59
- package/es/settings/storage/node.js +62 -91
- package/es/umd.js +3 -3
- package/lib/factory/browser.js +61 -70
- package/lib/factory/node.js +59 -69
- package/lib/index.js +16 -4
- package/lib/platform/EventEmitter.js +303 -330
- package/lib/platform/browser.js +10 -18
- package/lib/platform/getEventSource/browser.js +5 -6
- package/lib/platform/getEventSource/node.js +18 -19
- package/lib/platform/getFetch/browser.js +7 -10
- package/lib/platform/getFetch/node.js +17 -18
- package/lib/platform/node.js +13 -23
- package/lib/platform/request/options/node.js +12 -31
- package/lib/settings/browser.js +18 -26
- package/lib/settings/defaults/browser.js +15 -19
- package/lib/settings/defaults/node.js +24 -28
- package/lib/settings/defaults/version.js +2 -4
- package/lib/settings/integrations/browser.js +7 -12
- package/lib/settings/node.js +17 -29
- package/lib/settings/storage/browser.js +36 -68
- package/lib/settings/storage/node.js +66 -97
- package/lib/umd.js +3 -8
- package/package.json +23 -28
- package/src/factory/browser.js +10 -1
- package/src/factory/node.js +10 -1
- package/src/index.js +16 -0
- package/src/platform/request/options/node.js +0 -15
- package/src/settings/.DS_Store +0 -0
- package/src/settings/browser.js +2 -0
- package/src/settings/defaults/version.js +1 -1
- package/src/settings/integrations/browser.js +2 -2
- package/src/settings/node.js +2 -3
- package/src/settings/storage/browser.js +0 -16
- package/src/settings/storage/node.js +0 -15
- package/es/settings/integrations/node.js +0 -5
- package/es/settings/runtime/node.js +0 -35
- package/lib/settings/integrations/node.js +0 -12
- package/lib/settings/runtime/node.js +0 -45
- package/src/settings/integrations/node.js +0 -5
- package/src/settings/runtime/node.js +0 -37
|
@@ -1,101 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _constants = require("@splitsoftware/splitio-commons/cjs/utils/constants");
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
Copyright 2022 Split Software
|
|
10
|
-
|
|
11
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
you may not use this file except in compliance with the License.
|
|
13
|
-
You may obtain a copy of the License at
|
|
14
|
-
|
|
15
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
|
|
17
|
-
Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
See the License for the specific language governing permissions and
|
|
21
|
-
limitations under the License.
|
|
22
|
-
**/
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateStorage = void 0;
|
|
4
|
+
var constants_1 = require("@splitsoftware/splitio-commons/cjs/utils/constants");
|
|
23
5
|
function validateStorage(settings) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
6
|
+
var log = settings.log, mode = settings.mode, _a = settings.storage, _b = _a === void 0 ? { type: constants_1.STORAGE_MEMORY } : _a, type = _b.type, _c = _b.options, options = _c === void 0 ? {} : _c, prefix = _b.prefix;
|
|
7
|
+
if (prefix) {
|
|
8
|
+
prefix += '.SPLITIO';
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
prefix = 'SPLITIO';
|
|
12
|
+
}
|
|
13
|
+
// We can have MEMORY, REDIS or an invalid storage type
|
|
14
|
+
switch (type) {
|
|
15
|
+
case constants_1.STORAGE_REDIS: {
|
|
16
|
+
// If passing REDIS storage in localhost or standalone mode, we log an error and fallback to MEMORY storage
|
|
17
|
+
if (mode === constants_1.STANDALONE_MODE || mode === constants_1.LOCALHOST_MODE) {
|
|
18
|
+
log.error('The provided REDIS storage is invalid for this mode. It requires consumer mode. Fallbacking into default MEMORY storage.');
|
|
19
|
+
return {
|
|
20
|
+
type: constants_1.STORAGE_MEMORY,
|
|
21
|
+
prefix: prefix
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
var host = options.host, port = options.port, db = options.db, pass = options.pass, url = options.url, connectionTimeout = options.connectionTimeout, operationTimeout = options.operationTimeout;
|
|
25
|
+
if (process.env.REDIS_HOST)
|
|
26
|
+
host = process.env.REDIS_HOST;
|
|
27
|
+
if (process.env.REDIS_PORT)
|
|
28
|
+
port = process.env.REDIS_PORT;
|
|
29
|
+
if (process.env.REDIS_DB)
|
|
30
|
+
db = process.env.REDIS_DB;
|
|
31
|
+
if (process.env.REDIS_PASS)
|
|
32
|
+
pass = process.env.REDIS_PASS;
|
|
33
|
+
if (process.env.REDIS_URL)
|
|
34
|
+
url = process.env.REDIS_URL;
|
|
35
|
+
var newOpts = {
|
|
36
|
+
connectionTimeout: connectionTimeout,
|
|
37
|
+
operationTimeout: operationTimeout
|
|
38
|
+
};
|
|
39
|
+
if (url) {
|
|
40
|
+
newOpts.url = url;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
newOpts.host = host;
|
|
44
|
+
newOpts.port = port;
|
|
45
|
+
newOpts.db = db;
|
|
46
|
+
newOpts.pass = pass;
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
type: type,
|
|
50
|
+
prefix: prefix,
|
|
51
|
+
options: newOpts
|
|
52
|
+
};
|
|
52
53
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
var newOpts = {
|
|
67
|
-
connectionTimeout: connectionTimeout,
|
|
68
|
-
operationTimeout: operationTimeout
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
if (url) {
|
|
72
|
-
newOpts.url = url;
|
|
73
|
-
} else {
|
|
74
|
-
newOpts.host = host;
|
|
75
|
-
newOpts.port = port;
|
|
76
|
-
newOpts.db = db;
|
|
77
|
-
newOpts.pass = pass;
|
|
54
|
+
// For now, we don't have modifiers or settings for MEMORY in NodeJS
|
|
55
|
+
case constants_1.STORAGE_MEMORY:
|
|
56
|
+
default: {
|
|
57
|
+
// If passing MEMORY storage in consumer mode, throw an error (no way to fallback to REDIS storage)
|
|
58
|
+
if (mode === constants_1.CONSUMER_MODE)
|
|
59
|
+
throw new Error('A REDIS storage is required on consumer mode');
|
|
60
|
+
// If passing an invalid storage type, log an error
|
|
61
|
+
if (type !== constants_1.STORAGE_MEMORY)
|
|
62
|
+
log.error("The provided '" + type + "' storage type is invalid. Fallbacking into default MEMORY storage.");
|
|
63
|
+
return {
|
|
64
|
+
type: constants_1.STORAGE_MEMORY,
|
|
65
|
+
prefix: prefix
|
|
66
|
+
};
|
|
78
67
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
prefix: prefix,
|
|
83
|
-
options: newOpts
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
// For now, we don't have modifiers or settings for MEMORY in NodeJS
|
|
87
|
-
|
|
88
|
-
case _constants.STORAGE_MEMORY:
|
|
89
|
-
default:
|
|
90
|
-
{
|
|
91
|
-
// If passing MEMORY storage in consumer mode, throw an error (no way to fallback to REDIS storage)
|
|
92
|
-
if (mode === _constants.CONSUMER_MODE) throw new Error('A REDIS storage is required on consumer mode'); // If passing an invalid storage type, log an error
|
|
93
|
-
|
|
94
|
-
if (type !== _constants.STORAGE_MEMORY) log.error("The provided '" + type + "' storage type is invalid. Fallbacking into default MEMORY storage.");
|
|
95
|
-
return {
|
|
96
|
-
type: _constants.STORAGE_MEMORY,
|
|
97
|
-
prefix: prefix
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.validateStorage = validateStorage;
|
package/lib/umd.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.default = void 0;
|
|
5
|
-
|
|
6
|
-
var _index = require("./index");
|
|
7
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var index_1 = require("./index");
|
|
8
4
|
// eslint-disable-next-line import/no-default-export
|
|
9
|
-
|
|
10
|
-
exports.default = _default;
|
|
5
|
+
exports.default = index_1.SplitFactory;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splitsoftware/splitio",
|
|
3
|
-
"version": "10.17.3-rc.
|
|
3
|
+
"version": "10.17.3-rc.3",
|
|
4
4
|
"description": "Split SDK",
|
|
5
5
|
"files": [
|
|
6
6
|
"README.md",
|
|
@@ -34,8 +34,7 @@
|
|
|
34
34
|
"node": ">=6"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@
|
|
38
|
-
"@splitsoftware/splitio-commons": "1.2.1-rc.0",
|
|
37
|
+
"@splitsoftware/splitio-commons": "1.2.1-rc.2",
|
|
39
38
|
"@types/google.analytics": "0.0.40",
|
|
40
39
|
"ioredis": "^4.28.0",
|
|
41
40
|
"ip": "1.1.5",
|
|
@@ -47,14 +46,9 @@
|
|
|
47
46
|
"eventsource": "^1.0.7"
|
|
48
47
|
},
|
|
49
48
|
"devDependencies": {
|
|
50
|
-
"@
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
53
|
-
"@babel/plugin-transform-runtime": "^7.13.10",
|
|
54
|
-
"@babel/preset-env": "^7.13.10",
|
|
55
|
-
"@babel/preset-typescript": "^7.16.7",
|
|
56
|
-
"@babel/register": "^7.13.8",
|
|
57
|
-
"babel-loader": "^8.2.2",
|
|
49
|
+
"@types/ioredis": "^4.28.0",
|
|
50
|
+
"@types/ip": "^1.1.0",
|
|
51
|
+
"@types/node-fetch": "^2.5.12",
|
|
58
52
|
"copyfiles": "^2.4.1",
|
|
59
53
|
"cross-env": "^7.0.3",
|
|
60
54
|
"csv-streamify": "4.0.0",
|
|
@@ -78,24 +72,25 @@
|
|
|
78
72
|
"tap-min": "^2.0.0",
|
|
79
73
|
"tape": "4.13.2",
|
|
80
74
|
"tape-catch": "1.0.6",
|
|
75
|
+
"ts-loader": "^9.2.6",
|
|
76
|
+
"ts-node": "^10.5.0",
|
|
77
|
+
"typescript": "4.4.4",
|
|
81
78
|
"webpack": "^5.53.0",
|
|
82
79
|
"webpack-cli": "^4.8.0",
|
|
83
80
|
"webpack-merge": "^5.8.0"
|
|
84
81
|
},
|
|
85
82
|
"scripts": {
|
|
86
|
-
"build-
|
|
87
|
-
"postbuild-
|
|
83
|
+
"build-esm": "rimraf es && tsc -outDir es",
|
|
84
|
+
"postbuild-esm": "cross-env NODE_ENV=es node scripts/copy.packages.json.js && ./scripts/build_esm_replace_imports.sh",
|
|
88
85
|
"build-umd:stats": "webpack --progress --env production --json > ./stats/stat_results.json",
|
|
89
|
-
"build-cjs": "rimraf lib &&
|
|
86
|
+
"build-cjs": "rimraf lib && tsc -outDir lib -m CommonJS",
|
|
90
87
|
"postbuild-cjs": "cross-env NODE_ENV=cjs node scripts/copy.packages.json.js && ./scripts/build_cjs_replace_imports.sh",
|
|
91
|
-
"build-umd": "webpack --config webpack.
|
|
92
|
-
"build
|
|
93
|
-
"build
|
|
94
|
-
"build:npm": "rimraf lib es && npm run build-cjs && npm run build-es",
|
|
95
|
-
"build": "rimraf lib umd es && npm run build-cjs && npm run build-es && npm run build-umd",
|
|
88
|
+
"build-umd": "webpack --config webpack.dev.js --env branch=$BUILD_BRANCH --env commit_hash=$BUILD_COMMIT && webpack --config webpack.prod.js --env branch=$BUILD_BRANCH --env commit_hash=$BUILD_COMMIT && ./scripts/clean_umd_build.sh",
|
|
89
|
+
"build:npm": "rimraf lib es && npm run build-cjs && npm run build-esm",
|
|
90
|
+
"build": "rimraf lib umd es && npm run build-cjs && npm run build-esm && npm run build-umd",
|
|
96
91
|
"check": "npm run check:lint && npm run check:version",
|
|
97
92
|
"check:lint": "eslint src",
|
|
98
|
-
"check:version": "cross-env NODE_ENV=test tape -r ./
|
|
93
|
+
"check:version": "cross-env NODE_ENV=test tape -r ./ts-node.register src/settings/__tests__/defaults.spec.js",
|
|
99
94
|
"test-browser-local": "cross-env NODE_ENV=test karma start karma/local.karma.conf.js",
|
|
100
95
|
"test-browser-e2e-local": "cross-env NODE_ENV=test karma start karma/e2e.local.karma.conf.js",
|
|
101
96
|
"test-browser": "npm run test-browser-unit && npm run test-browser-online && npm run test-browser-offline && npm run test-browser-destroy && npm run test-browser-errors && npm run test-browser-push && npm run test-browser-gaintegration",
|
|
@@ -107,14 +102,14 @@
|
|
|
107
102
|
"test-browser-gaintegration": "cross-env NODE_ENV=test karma start karma/gaintegration.ci.karma.conf.js",
|
|
108
103
|
"test-browser-push": "cross-env NODE_ENV=test karma start karma/push.ci.karma.conf.js",
|
|
109
104
|
"test-node": "npm run test-node-unit && npm run test-node-online && npm run test-node-redis && npm run test-node-offline && npm run test-node-destroy && npm run test-node-errors && npm run test-node-push",
|
|
110
|
-
"test-node-unit": "cross-env NODE_ENV=test tape -r ./
|
|
111
|
-
"test-node-online": "cross-env NODE_ENV=test tape -r ./
|
|
112
|
-
"test-node-destroy": "cross-env NODE_ENV=test tape -r ./
|
|
113
|
-
"test-node-errors": "cross-env NODE_ENV=test tape -r ./
|
|
114
|
-
"test-node-offline": "cross-env NODE_ENV=test tape -r ./
|
|
115
|
-
"test-node-redis": "cross-env NODE_ENV=test tape -r ./
|
|
116
|
-
"test-node-push": "cross-env NODE_ENV=test tape -r ./
|
|
117
|
-
"pretest-ts-decls": "npm run build-
|
|
105
|
+
"test-node-unit": "cross-env NODE_ENV=test tape -r ./ts-node.register \"src/*/**/__tests__/**/!(browser).spec.js\" | tap-min",
|
|
106
|
+
"test-node-online": "cross-env NODE_ENV=test tape -r ./ts-node.register src/__tests__/node.spec.js | tap-min",
|
|
107
|
+
"test-node-destroy": "cross-env NODE_ENV=test tape -r ./ts-node.register src/__tests__/destroy/node.spec.js | tap-min",
|
|
108
|
+
"test-node-errors": "cross-env NODE_ENV=test tape -r ./ts-node.register src/__tests__/errorCatching/node.spec.js | tap-min",
|
|
109
|
+
"test-node-offline": "cross-env NODE_ENV=test tape -r ./ts-node.register src/__tests__/offline/node.spec.js | tap-min",
|
|
110
|
+
"test-node-redis": "cross-env NODE_ENV=test tape -r ./ts-node.register \"src/__tests__/node_redis.spec.js\" | tap-min",
|
|
111
|
+
"test-node-push": "cross-env NODE_ENV=test tape -r ./ts-node.register src/__tests__/push/node.spec.js | tap-min",
|
|
112
|
+
"pretest-ts-decls": "npm run build-esm && npm run build-cjs && npm link",
|
|
118
113
|
"test-ts-decls": "./scripts/ts-tests.sh",
|
|
119
114
|
"posttest-ts-decls": "npm unlink && npm install",
|
|
120
115
|
"test": "npm run test-node && npm run test-browser",
|
package/src/factory/browser.js
CHANGED
|
@@ -67,8 +67,17 @@ function getModules(settings) {
|
|
|
67
67
|
return modules;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
/**
|
|
71
|
+
* SplitFactory for client-side.
|
|
72
|
+
*
|
|
73
|
+
* @param {SplitIO.IBrowserSettings} config configuration object used to instantiate the SDK
|
|
74
|
+
* @param {Function=} __updateModules optional function that lets redefine internal SDK modules. Use with
|
|
75
|
+
* caution since, unlike `config`, this param is not validated neither considered part of the public API.
|
|
76
|
+
* @throws Will throw an error if the provided config is invalid.
|
|
77
|
+
*/
|
|
78
|
+
export function SplitFactory(config, __updateModules) {
|
|
71
79
|
const settings = settingsFactory(config);
|
|
72
80
|
const modules = getModules(settings);
|
|
81
|
+
if (__updateModules) __updateModules(modules);
|
|
73
82
|
return sdkFactory(modules);
|
|
74
83
|
}
|
package/src/factory/node.js
CHANGED
|
@@ -64,8 +64,17 @@ function getModules(settings) {
|
|
|
64
64
|
return modules;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
/**
|
|
68
|
+
* SplitFactory for server-side.
|
|
69
|
+
*
|
|
70
|
+
* @param {SplitIO.INodeSettings | SplitIO.INodeAsyncSettings} config configuration object used to instantiate the SDK
|
|
71
|
+
* @param {Function=} __updateModules optional function that lets redefine internal SDK modules. Use with
|
|
72
|
+
* caution since, unlike `config`, this param is not validated neither considered part of the public API.
|
|
73
|
+
* @throws Will throw an error if the provided config is invalid.
|
|
74
|
+
*/
|
|
75
|
+
export function SplitFactory(config, __updateModules) {
|
|
68
76
|
const settings = settingsFactory(config);
|
|
69
77
|
const modules = getModules(settings);
|
|
78
|
+
if (__updateModules) __updateModules(modules);
|
|
70
79
|
return sdkFactory(modules);
|
|
71
80
|
}
|
package/src/index.js
CHANGED
|
@@ -1 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Copyright 2022 Split Software
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
**/
|
|
16
|
+
|
|
1
17
|
export { SplitFactory } from './factory';
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
Copyright 2022 Split Software
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
**/
|
|
16
1
|
// @TODO
|
|
17
2
|
// 1- handle multiple protocols automatically
|
|
18
3
|
// 2- destroy it once the sdk is destroyed
|
package/src/settings/.DS_Store
CHANGED
|
Binary file
|
package/src/settings/browser.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { settingsValidation } from '@splitsoftware/splitio-commons/src/utils/settingsValidation';
|
|
2
2
|
import { defaults } from './defaults/browser';
|
|
3
|
+
import { validateRuntime } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/runtime/browser';
|
|
3
4
|
import { validateStorage } from './storage/browser';
|
|
4
5
|
import { validateIntegrations } from './integrations/browser';
|
|
5
6
|
import { validateLogger } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/logger/builtinLogger';
|
|
@@ -7,6 +8,7 @@ import { LocalhostFromObject } from '@splitsoftware/splitio-commons/src/sync/off
|
|
|
7
8
|
|
|
8
9
|
const params = {
|
|
9
10
|
defaults,
|
|
11
|
+
runtime: validateRuntime,
|
|
10
12
|
storage: validateStorage,
|
|
11
13
|
integrations: validateIntegrations,
|
|
12
14
|
logger: validateLogger,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const packageVersion = '10.17.3-rc.
|
|
1
|
+
export const packageVersion = '10.17.3-rc.3';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GOOGLE_ANALYTICS_TO_SPLIT, SPLIT_TO_GOOGLE_ANALYTICS } from '@splitsoftware/splitio-commons/src/utils/constants/browser';
|
|
2
2
|
import { validateConfigurableIntegrations } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/integrations/configurable';
|
|
3
3
|
|
|
4
|
-
export
|
|
4
|
+
export function validateIntegrations(settings) {
|
|
5
5
|
return validateConfigurableIntegrations(settings, [GOOGLE_ANALYTICS_TO_SPLIT, SPLIT_TO_GOOGLE_ANALYTICS]);
|
|
6
|
-
}
|
|
6
|
+
}
|
package/src/settings/node.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { settingsValidation } from '@splitsoftware/splitio-commons/src/utils/settingsValidation';
|
|
2
2
|
import { defaults } from './defaults/node';
|
|
3
|
-
import { validateRuntime } from '
|
|
3
|
+
import { validateRuntime } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/runtime/node';
|
|
4
4
|
import { validateStorage } from './storage/node';
|
|
5
|
-
import { validateIntegrations } from './integrations/node';
|
|
6
5
|
import { validateLogger } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/logger/builtinLogger';
|
|
7
6
|
import { LocalhostFromFile } from '@splitsoftware/splitio-commons/src/sync/offline/LocalhostFromFile';
|
|
8
7
|
|
|
@@ -10,9 +9,9 @@ const params = {
|
|
|
10
9
|
defaults,
|
|
11
10
|
runtime: validateRuntime,
|
|
12
11
|
storage: validateStorage,
|
|
13
|
-
integrations: validateIntegrations,
|
|
14
12
|
logger: validateLogger,
|
|
15
13
|
localhost: () => LocalhostFromFile(),
|
|
14
|
+
// For now, Node SDK ignores settings.integrations, so no integration validator is passed
|
|
16
15
|
};
|
|
17
16
|
|
|
18
17
|
export function settingsFactory(config) {
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
Copyright 2022 Split Software
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
**/
|
|
16
|
-
|
|
17
1
|
import { isLocalStorageAvailable } from '@splitsoftware/splitio-commons/src/utils/env/isLocalStorageAvailable';
|
|
18
2
|
import { LOCALHOST_MODE, STORAGE_MEMORY } from '@splitsoftware/splitio-commons/src/utils/constants';
|
|
19
3
|
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
Copyright 2022 Split Software
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
**/
|
|
16
1
|
import { LOCALHOST_MODE, STORAGE_MEMORY, STORAGE_REDIS, CONSUMER_MODE, STANDALONE_MODE } from '@splitsoftware/splitio-commons/src/utils/constants';
|
|
17
2
|
|
|
18
3
|
export function validateStorage(settings) {
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
Copyright 2022 Split Software
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
**/
|
|
16
|
-
import osFunction from 'os';
|
|
17
|
-
import ipFunction from 'ip';
|
|
18
|
-
import { UNKNOWN, NA, CONSUMER_MODE } from '@splitsoftware/splitio-commons/esm/utils/constants';
|
|
19
|
-
export function validateRuntime(settings) {
|
|
20
|
-
var isIPAddressesEnabled = settings.core.IPAddressesEnabled === true;
|
|
21
|
-
var isConsumerMode = settings.mode === CONSUMER_MODE; // If the values are not available, default to false (for standalone) or "unknown" (for consumer mode, to be used on Redis keys)
|
|
22
|
-
|
|
23
|
-
var ip = ipFunction.address() || (isConsumerMode ? UNKNOWN : false);
|
|
24
|
-
var hostname = osFunction.hostname() || (isConsumerMode ? UNKNOWN : false);
|
|
25
|
-
|
|
26
|
-
if (!isIPAddressesEnabled) {
|
|
27
|
-
// If IPAddresses setting is not enabled, set as false (for standalone) or "NA" (for consumer mode, to be used on Redis keys)
|
|
28
|
-
ip = hostname = isConsumerMode ? NA : false;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return {
|
|
32
|
-
ip: ip,
|
|
33
|
-
hostname: hostname
|
|
34
|
-
};
|
|
35
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.validateIntegrations = void 0;
|
|
5
|
-
|
|
6
|
-
// For now, Node SDK does not support integrations,
|
|
7
|
-
// thus any integrations settings is parsed into undefined.
|
|
8
|
-
var validateIntegrations = function validateIntegrations() {
|
|
9
|
-
return [];
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
exports.validateIntegrations = validateIntegrations;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
exports.__esModule = true;
|
|
6
|
-
exports.validateRuntime = validateRuntime;
|
|
7
|
-
|
|
8
|
-
var _os = _interopRequireDefault(require("os"));
|
|
9
|
-
|
|
10
|
-
var _ip = _interopRequireDefault(require("ip"));
|
|
11
|
-
|
|
12
|
-
var _constants = require("@splitsoftware/splitio-commons/cjs/utils/constants");
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
Copyright 2022 Split Software
|
|
16
|
-
|
|
17
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
18
|
-
you may not use this file except in compliance with the License.
|
|
19
|
-
You may obtain a copy of the License at
|
|
20
|
-
|
|
21
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
22
|
-
|
|
23
|
-
Unless required by applicable law or agreed to in writing, software
|
|
24
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
25
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
26
|
-
See the License for the specific language governing permissions and
|
|
27
|
-
limitations under the License.
|
|
28
|
-
**/
|
|
29
|
-
function validateRuntime(settings) {
|
|
30
|
-
var isIPAddressesEnabled = settings.core.IPAddressesEnabled === true;
|
|
31
|
-
var isConsumerMode = settings.mode === _constants.CONSUMER_MODE; // If the values are not available, default to false (for standalone) or "unknown" (for consumer mode, to be used on Redis keys)
|
|
32
|
-
|
|
33
|
-
var ip = _ip.default.address() || (isConsumerMode ? _constants.UNKNOWN : false);
|
|
34
|
-
var hostname = _os.default.hostname() || (isConsumerMode ? _constants.UNKNOWN : false);
|
|
35
|
-
|
|
36
|
-
if (!isIPAddressesEnabled) {
|
|
37
|
-
// If IPAddresses setting is not enabled, set as false (for standalone) or "NA" (for consumer mode, to be used on Redis keys)
|
|
38
|
-
ip = hostname = isConsumerMode ? _constants.NA : false;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return {
|
|
42
|
-
ip: ip,
|
|
43
|
-
hostname: hostname
|
|
44
|
-
};
|
|
45
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
Copyright 2022 Split Software
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
**/
|
|
16
|
-
|
|
17
|
-
import osFunction from 'os';
|
|
18
|
-
import ipFunction from 'ip';
|
|
19
|
-
|
|
20
|
-
import { UNKNOWN, NA, CONSUMER_MODE } from '@splitsoftware/splitio-commons/src/utils/constants';
|
|
21
|
-
|
|
22
|
-
export function validateRuntime(settings) {
|
|
23
|
-
const isIPAddressesEnabled = settings.core.IPAddressesEnabled === true;
|
|
24
|
-
const isConsumerMode = settings.mode === CONSUMER_MODE;
|
|
25
|
-
|
|
26
|
-
// If the values are not available, default to false (for standalone) or "unknown" (for consumer mode, to be used on Redis keys)
|
|
27
|
-
let ip = ipFunction.address() || (isConsumerMode ? UNKNOWN : false);
|
|
28
|
-
let hostname = osFunction.hostname() || (isConsumerMode ? UNKNOWN : false);
|
|
29
|
-
|
|
30
|
-
if (!isIPAddressesEnabled) { // If IPAddresses setting is not enabled, set as false (for standalone) or "NA" (for consumer mode, to be used on Redis keys)
|
|
31
|
-
ip = hostname = isConsumerMode ? NA : false;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
ip, hostname
|
|
36
|
-
};
|
|
37
|
-
}
|