@splitsoftware/splitio 10.26.1 → 10.26.2-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/CHANGES.txt +4 -0
- package/es/platform/getOptions/node.js +3 -0
- package/es/settings/defaults/version.js +1 -1
- package/es/settings/node.js +5 -1
- package/lib/platform/getOptions/node.js +3 -0
- package/lib/settings/defaults/version.js +1 -1
- package/lib/settings/node.js +5 -1
- package/package.json +1 -1
- package/src/platform/getOptions/node.js +3 -0
- package/src/settings/defaults/version.js +1 -1
- package/src/settings/node.js +5 -1
- package/types/splitio.d.ts +36 -0
package/CHANGES.txt
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
10.27.0 (June 25, 2024)
|
|
2
|
+
- Added `sync.requestOptions.agent` property to SDK configuration, to pass a custom HTTP(S) Agent to the SDK requests in NodeJS. This allows the SDK to use a custom agent with specific configurations, like a network proxy or custom TLS settings (See https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#proxy).
|
|
3
|
+
- Updated some transitive dependencies for vulnerability fixes.
|
|
4
|
+
|
|
1
5
|
10.26.1 (June 14, 2024)
|
|
2
6
|
- Updated the internal imports of 'os' and 'ioredis' modules for NodeJS, to use EcmaScript 'import' rather than CommonJS 'require' for the ES modules build. This avoids runtime errors on some scenarios when bundling the SDK into a .mjs file or importing it from a .mjs file.
|
|
3
7
|
- Updated eventsource dependency for NodeJS. The eventsource v1.1.2 dependency was removed, and the SDK now uses an embedded adaptation that can accept an HTTP(S) agent option, like other HTTP(S) requests.
|
|
@@ -8,6 +8,9 @@ var agent = new https.Agent({
|
|
|
8
8
|
keepAliveMsecs: 1500
|
|
9
9
|
});
|
|
10
10
|
export function getOptions(settings) {
|
|
11
|
+
// User provided options take precedence
|
|
12
|
+
if (settings.sync.requestOptions)
|
|
13
|
+
return settings.sync.requestOptions;
|
|
11
14
|
// If some URL is not HTTPS, we don't use the agent, to let the SDK connect to HTTP endpoints
|
|
12
15
|
if (find(settings.urls, function (url) { return !url.startsWith('https:'); }))
|
|
13
16
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export var packageVersion = '10.26.
|
|
1
|
+
export var packageVersion = '10.26.2-rc.0';
|
package/es/settings/node.js
CHANGED
|
@@ -14,5 +14,9 @@ var params = {
|
|
|
14
14
|
// In Node.js the SDK ignores `config.integrations`, so a validator for integrations is not required
|
|
15
15
|
};
|
|
16
16
|
export function settingsFactory(config) {
|
|
17
|
-
|
|
17
|
+
var settings = settingsValidation(config, params);
|
|
18
|
+
// if provided, keeps reference to the `requestOptions` object
|
|
19
|
+
if (settings.sync.requestOptions)
|
|
20
|
+
settings.sync.requestOptions = config.sync.requestOptions;
|
|
21
|
+
return settings;
|
|
18
22
|
}
|
|
@@ -12,6 +12,9 @@ var agent = new https_1.default.Agent({
|
|
|
12
12
|
keepAliveMsecs: 1500
|
|
13
13
|
});
|
|
14
14
|
function getOptions(settings) {
|
|
15
|
+
// User provided options take precedence
|
|
16
|
+
if (settings.sync.requestOptions)
|
|
17
|
+
return settings.sync.requestOptions;
|
|
15
18
|
// If some URL is not HTTPS, we don't use the agent, to let the SDK connect to HTTP endpoints
|
|
16
19
|
if ((0, lang_1.find)(settings.urls, function (url) { return !url.startsWith('https:'); }))
|
|
17
20
|
return;
|
package/lib/settings/node.js
CHANGED
|
@@ -17,6 +17,10 @@ var params = {
|
|
|
17
17
|
// In Node.js the SDK ignores `config.integrations`, so a validator for integrations is not required
|
|
18
18
|
};
|
|
19
19
|
function settingsFactory(config) {
|
|
20
|
-
|
|
20
|
+
var settings = (0, settingsValidation_1.settingsValidation)(config, params);
|
|
21
|
+
// if provided, keeps reference to the `requestOptions` object
|
|
22
|
+
if (settings.sync.requestOptions)
|
|
23
|
+
settings.sync.requestOptions = config.sync.requestOptions;
|
|
24
|
+
return settings;
|
|
21
25
|
}
|
|
22
26
|
exports.settingsFactory = settingsFactory;
|
package/package.json
CHANGED
|
@@ -11,6 +11,9 @@ const agent = new https.Agent({
|
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
export function getOptions(settings) {
|
|
14
|
+
// User provided options take precedence
|
|
15
|
+
if (settings.sync.requestOptions) return settings.sync.requestOptions;
|
|
16
|
+
|
|
14
17
|
// If some URL is not HTTPS, we don't use the agent, to let the SDK connect to HTTP endpoints
|
|
15
18
|
if (find(settings.urls, url => !url.startsWith('https:'))) return;
|
|
16
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const packageVersion = '10.26.
|
|
1
|
+
export const packageVersion = '10.26.2-rc.0';
|
package/src/settings/node.js
CHANGED
|
@@ -17,5 +17,9 @@ const params = {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
export function settingsFactory(config) {
|
|
20
|
-
|
|
20
|
+
const settings = settingsValidation(config, params);
|
|
21
|
+
|
|
22
|
+
// if provided, keeps reference to the `requestOptions` object
|
|
23
|
+
if (settings.sync.requestOptions) settings.sync.requestOptions = config.sync.requestOptions;
|
|
24
|
+
return settings;
|
|
21
25
|
}
|
package/types/splitio.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/// <reference types="google.analytics" />
|
|
6
6
|
import { RedisOptions } from "ioredis";
|
|
7
|
+
import { RequestOptions } from "http";
|
|
7
8
|
|
|
8
9
|
export as namespace SplitIO;
|
|
9
10
|
export = SplitIO;
|
|
@@ -1168,6 +1169,41 @@ declare namespace SplitIO {
|
|
|
1168
1169
|
* @default 'standalone'
|
|
1169
1170
|
*/
|
|
1170
1171
|
mode?: 'standalone'
|
|
1172
|
+
sync?: INodeBasicSettings['sync'] & {
|
|
1173
|
+
/**
|
|
1174
|
+
* Custom options object for HTTP(S) requests in NodeJS.
|
|
1175
|
+
* If provided, this object is merged with the options object passed by the SDK for EventSource and Node-Fetch calls.
|
|
1176
|
+
* @see {@link https://www.npmjs.com/package/node-fetch#options}
|
|
1177
|
+
*/
|
|
1178
|
+
requestOptions?: {
|
|
1179
|
+
/**
|
|
1180
|
+
* Custom NodeJS HTTP(S) Agent used by the SDK for HTTP(S) requests.
|
|
1181
|
+
*
|
|
1182
|
+
* You can use it, for example, for certificate pinning or setting a network proxy:
|
|
1183
|
+
*
|
|
1184
|
+
* ```javascript
|
|
1185
|
+
* const { HttpsProxyAgent } = require('https-proxy-agent');
|
|
1186
|
+
*
|
|
1187
|
+
* const proxyAgent = new HttpsProxyAgent(process.env.HTTPS_PROXY || 'http://10.10.1.10:1080');
|
|
1188
|
+
*
|
|
1189
|
+
* const factory = SplitFactory({
|
|
1190
|
+
* ...
|
|
1191
|
+
* sync: {
|
|
1192
|
+
* requestOptions: {
|
|
1193
|
+
* agent: proxyAgent
|
|
1194
|
+
* }
|
|
1195
|
+
* }
|
|
1196
|
+
* })
|
|
1197
|
+
* ```
|
|
1198
|
+
*
|
|
1199
|
+
* @see {@link https://nodejs.org/api/https.html#class-httpsagent}
|
|
1200
|
+
*
|
|
1201
|
+
* @property {http.Agent | https.Agent} agent
|
|
1202
|
+
* @default undefined
|
|
1203
|
+
*/
|
|
1204
|
+
agent?: RequestOptions["agent"]
|
|
1205
|
+
},
|
|
1206
|
+
}
|
|
1171
1207
|
}
|
|
1172
1208
|
/**
|
|
1173
1209
|
* Settings interface with async storage for SDK instances created on NodeJS.
|