diff --git a/package-lock.json b/package-lock.json
index fedca55d0..fbd922199 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@splitsoftware/splitio",
- "version": "10.17.4-rc.0",
+ "version": "10.17.4-rc.4",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -437,9 +437,9 @@
"dev": true
},
"@splitsoftware/splitio-commons": {
- "version": "1.2.1-rc.8",
- "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.2.1-rc.8.tgz",
- "integrity": "sha512-K/qQZqBaJa4fssNJgTWtBMkWFlwJBKemSHhhlF+8hQnOv8Tra4tAz7ObPQwnZ9Esjdmd2jEd2SJ1LeSi9haIqQ==",
+ "version": "1.2.1-rc.11",
+ "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.2.1-rc.11.tgz",
+ "integrity": "sha512-kiba0u5Fnn9O+MBKhM140KnVm7zsY77sIyBrTodOo2EKNHTw8p88eBPnLiR5rRyurQ8AJpMosdrlRphGuQLMYQ==",
"requires": {
"tslib": "^2.3.1"
}
@@ -521,7 +521,6 @@
"version": "4.28.8",
"resolved": "https://registry.npmjs.org/@types/ioredis/-/ioredis-4.28.8.tgz",
"integrity": "sha512-mULOyO2smtvkE1zmzRRA4P0+1UjEqusi014kXOL1q3CY0RgqkR5/wKvv+vAJbPw2Q66wPyylKeevUy+m/FaRMg==",
- "dev": true,
"requires": {
"@types/node": "*"
}
@@ -539,10 +538,9 @@
"dev": true
},
"@types/node": {
- "version": "14.14.35",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.35.tgz",
- "integrity": "sha512-Lt+wj8NVPx0zUmUwumiVXapmaLUcAk3yPuHCFVXras9k5VT9TdhJqKqGVUQCD60OTMCl0qxJ57OiTL0Mic3Iag==",
- "dev": true
+ "version": "17.0.21",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.21.tgz",
+ "integrity": "sha512-DBZCJbhII3r90XbQxI8Y9IjjiiOGlZ0Hr32omXIZvwwZ7p4DMMXGrKXVyPfuoBOri9XNtL0UK69jYIBIsRX3QQ=="
},
"@types/node-fetch": {
"version": "2.5.12",
@@ -4265,9 +4263,9 @@
}
},
"minimist": {
- "version": "1.2.5",
- "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
- "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
+ "version": "1.2.6",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
+ "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
"dev": true
},
"minipass": {
@@ -5852,9 +5850,9 @@
}
},
"minimist": {
- "version": "1.2.5",
- "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
- "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
+ "version": "1.2.6",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
+ "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
"dev": true
},
"resolve": {
diff --git a/package.json b/package.json
index 82ecf76a5..a4f980bcf 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@splitsoftware/splitio",
- "version": "10.17.4-rc.0",
+ "version": "10.17.4-rc.4",
"description": "Split SDK",
"files": [
"README.md",
@@ -32,8 +32,9 @@
"node": ">=6"
},
"dependencies": {
- "@splitsoftware/splitio-commons": "1.2.1-rc.8",
+ "@splitsoftware/splitio-commons": "1.2.1-rc.11",
"@types/google.analytics": "0.0.40",
+ "@types/ioredis": "^4.28.0",
"ioredis": "^4.28.0",
"ip": "1.1.5",
"js-yaml": "3.13.1",
@@ -44,7 +45,6 @@
"eventsource": "^1.0.7"
},
"devDependencies": {
- "@types/ioredis": "^4.28.0",
"@types/node-fetch": "^2.5.12",
"copyfiles": "^2.4.1",
"cross-env": "^7.0.3",
diff --git a/src/settings/__tests__/node.spec.js b/src/settings/__tests__/node.spec.js
index c6fb3a90b..fd66e4fb6 100644
--- a/src/settings/__tests__/node.spec.js
+++ b/src/settings/__tests__/node.spec.js
@@ -21,7 +21,8 @@ tape('SETTINGS / Redis options should be properly parsed', assert => {
host: 'h', port: 'p', db: 'bla', pass: 'nope',
randomProp: 'I will not be present',
connectionTimeout: 11,
- operationTimeout: 22
+ operationTimeout: 22,
+ tls: { ca: 'ca' }
},
prefix: 'test_prefix'
}
@@ -37,18 +38,19 @@ tape('SETTINGS / Redis options should be properly parsed', assert => {
host: 'host', port: 'port', pass: 'pass', db: 'db',
randomProp: 'I will not be present',
connectionTimeout: 33,
- operationTimeout: 44
+ operationTimeout: 44,
+ tls: { ca: 'ca' }
},
prefix: 'test_prefix'
}
});
assert.deepEqual(settingsWithUrl.storage, {
- type: 'REDIS', prefix: 'test_prefix', options: { url: 'test_url', connectionTimeout: 11, operationTimeout: 22 }
+ type: 'REDIS', prefix: 'test_prefix', options: { url: 'test_url', connectionTimeout: 11, operationTimeout: 22, tls: { ca: 'ca' } }
}, 'Redis storage settings and options should be passed correctly, url settings takes precedence when we are pointing to Redis.');
assert.deepEqual(settingsWithoutUrl.storage, {
- type: 'REDIS', prefix: 'test_prefix', options: { host: 'host', port: 'port', pass: 'pass', db: 'db', connectionTimeout: 33, operationTimeout: 44 }
+ type: 'REDIS', prefix: 'test_prefix', options: { host: 'host', port: 'port', pass: 'pass', db: 'db', connectionTimeout: 33, operationTimeout: 44, tls: { ca: 'ca' } }
}, 'Redis storage settings and options should be passed correctly, url settings takes precedence when we are pointing to Redis.');
assert.end();
diff --git a/src/settings/browser.js b/src/settings/browser.js
index 146e914f0..ae2302eff 100644
--- a/src/settings/browser.js
+++ b/src/settings/browser.js
@@ -9,6 +9,7 @@ import { validateConsent } from '@splitsoftware/splitio-commons/src/utils/settin
const params = {
defaults,
+ acceptKey: true, acceptTT: true, // Client with bound key and optional TT
runtime: validateRuntime,
storage: validateStorage,
integrations: validateIntegrations,
diff --git a/src/settings/defaults/version.js b/src/settings/defaults/version.js
index bac3b57cd..e408d3c6a 100644
--- a/src/settings/defaults/version.js
+++ b/src/settings/defaults/version.js
@@ -1 +1 @@
-export const packageVersion = '10.17.4-rc.0';
+export const packageVersion = '10.17.4-rc.4';
diff --git a/src/settings/storage/node.js b/src/settings/storage/node.js
index 2e7772f3e..b6cf4dcbb 100644
--- a/src/settings/storage/node.js
+++ b/src/settings/storage/node.js
@@ -28,6 +28,7 @@ export function validateStorage(settings) {
db,
pass,
url,
+ tls,
connectionTimeout,
operationTimeout
} = options;
@@ -56,6 +57,10 @@ export function validateStorage(settings) {
newOpts.pass = pass;
}
+ if (tls) {
+ newOpts.tls = tls;
+ }
+
return {
type,
prefix,
diff --git a/ts-tests/index.ts b/ts-tests/index.ts
index 3e5fc8a5b..3a2f3a5ee 100644
--- a/ts-tests/index.ts
+++ b/ts-tests/index.ts
@@ -583,7 +583,14 @@ let fullAsyncSettings: SplitIO.INodeAsyncSettings = {
storage: {
type: 'REDIS',
options: {
- opt1: 'whatever'
+ url: 'url',
+ host: 'host',
+ port: 1234,
+ db: 0,
+ pass: 'pass',
+ connectionTimeout: 100,
+ operationTimeout: 100,
+ tls: { ca: ['ca'] }
},
prefix: 'PREFIX'
},
diff --git a/types/splitio.d.ts b/types/splitio.d.ts
index 0f5b19198..202456f84 100644
--- a/types/splitio.d.ts
+++ b/types/splitio.d.ts
@@ -1,8 +1,9 @@
-// Type definitions for Javascript and Node Split Software SDK
+// Type definitions for Javascript and NodeJS Split Software SDK
// Project: http://www.split.io/
// Definitions by: Nico Zelaya
///
+import { RedisOptions } from "ioredis";
export as namespace SplitIO;
export = SplitIO;
@@ -97,7 +98,7 @@ interface ISettings {
readonly debug: boolean | LogLevel,
readonly version: string,
/**
- * Mocked features map if using in browser, or mocked features file path string if using in Node.
+ * Mocked features map if using in browser, or mocked features file path string if using in NodeJS.
*/
features: SplitIO.MockedFeaturesMap | SplitIO.MockedFeaturesFilePath,
readonly streamingEnabled: boolean,
@@ -106,7 +107,7 @@ interface ISettings {
impressionsMode: SplitIO.ImpressionsMode,
}
/**
- * User consent status if using in browser. Undefined if using in Node.
+ * User consent status if using in browser. Undefined if using in NodeJS.
*/
readonly userConsent?: SplitIO.ConsentStatus
}
@@ -325,7 +326,7 @@ interface INodeBasicSettings extends ISharedSettings {
IPAddressesEnabled?: boolean
},
/**
- * Defines which kind of storage we should instanciate.
+ * Defines which kind of storage we should instantiate.
* @property {Object} storage
*/
storage?: {
@@ -336,7 +337,7 @@ interface INodeBasicSettings extends ISharedSettings {
*/
type?: StorageType,
/**
- * Options to be passed to the selected storage. Use it with type: 'REDIS'
+ * Options to be passed to the selected storage.
* @property {Object} options
*/
options?: Object,
@@ -985,7 +986,8 @@ declare namespace SplitIO {
*/
features?: MockedFeaturesMap,
/**
- * Defines which kind of storage we should instanciate.
+ * Defines which kind of storage we can instantiate on the browser.
+ * Possible storage types are 'MEMORY', which is the default, and 'LOCALSTORAGE'.
* @property {Object} storage
*/
storage?: {
@@ -1040,7 +1042,8 @@ declare namespace SplitIO {
*/
urls?: UrlSettings,
/**
- * Defines which kind of storage we should instanciate.
+ * Defines which kind of storage we can instantiate on NodeJS for 'standalone' mode.
+ * The only possible storage type is 'MEMORY', which is the default.
* @property {Object} storage
*/
storage?: {
@@ -1074,6 +1077,11 @@ declare namespace SplitIO {
* @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#configuration}
*/
interface INodeAsyncSettings extends INodeBasicSettings {
+ /**
+ * Defines which kind of async storage we can instantiate on NodeJS for 'consumer' mode.
+ * The only possible storage type is 'REDIS'.
+ * @property {Object} storage
+ */
storage: {
/**
* 'REDIS' storage type to be instantiated by the SDK.
@@ -1081,10 +1089,68 @@ declare namespace SplitIO {
*/
type: NodeAsyncStorage,
/**
- * Options to be passed to the selected storage. Use it with type: 'REDIS'
+ * Options to be passed to the Redis storage. Use it with storage type: 'REDIS'.
* @property {Object} options
*/
- options?: Object,
+ options?: {
+ /**
+ * Redis URL. If set, `host`, `port`, `db` and `pass` params will be ignored.
+ *
+ * Examples:
+ * ```
+ * url: 'localhost'
+ * url: '127.0.0.1:6379'
+ * url: 'redis://:authpassword@127.0.0.1:6379/0'
+ * ```
+ * @property {string=} url
+ */
+ url?: string,
+ /**
+ * Redis host.
+ * @property {string=} host
+ * @default 'localhost'
+ */
+ host?: string,
+ /**
+ * Redis port.
+ * @property {number=} port
+ * @default 6379
+ */
+ port?: number,
+ /**
+ * Redis database to be used.
+ * @property {number=} db
+ * @default 0
+ */
+ db?: number,
+ /**
+ * Redis password. Don't define if no password is used.
+ * @property {string=} pass
+ * @default undefined
+ */
+ pass?: string,
+ /**
+ * The milliseconds before a timeout occurs during the initial connection to the Redis server.
+ * @property {number=} connectionTimeout
+ * @default 10000
+ */
+ connectionTimeout?: number,
+ /**
+ * The milliseconds before Redis commands are timeout by the SDK.
+ * Method calls that involve Redis commands, like `client.getTreatment` or `client.track` calls, are resolved when the commands success or timeout.
+ * @property {number=} operationTimeout
+ * @default 5000
+ */
+ operationTimeout?: number,
+ /**
+ * TLS configuration for Redis connection.
+ * @see {@link https://www.npmjs.com/package/ioredis#tls-options }
+ *
+ * @property {Object=} tls
+ * @default undefined
+ */
+ tls?: RedisOptions['tls'],
+ },
/**
* Optional prefix to prevent any kind of data collision between SDK versions.
* @property {string} prefix