Skip to content

Commit 0364d67

Browse files
Merge pull request #784 from splitio/development
Release v10.25.0
2 parents 421dc7d + 28592cf commit 0364d67

File tree

10 files changed

+91
-61
lines changed

10 files changed

+91
-61
lines changed

.github/workflows/update-license-year.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-20.04
1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@v2
16+
uses: actions/checkout@v4
1717
with:
1818
fetch-depth: 0
1919

@@ -24,7 +24,7 @@ jobs:
2424
run: "echo PREVIOUS=$(($CURRENT-1)) >> $GITHUB_ENV"
2525

2626
- name: Update LICENSE
27-
uses: jacobtomlinson/gha-find-replace@v2
27+
uses: jacobtomlinson/gha-find-replace@v3
2828
with:
2929
find: ${{ env.PREVIOUS }}
3030
replace: ${{ env.CURRENT }}
@@ -38,7 +38,7 @@ jobs:
3838
git commit -m "Updated License Year" -a
3939
4040
- name: Create Pull Request
41-
uses: peter-evans/create-pull-request@v3
41+
uses: peter-evans/create-pull-request@v5
4242
with:
4343
token: ${{ secrets.GITHUB_TOKEN }}
4444
title: Update License Year

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
10.25.0 (January 4, 2024)
2+
- Updated SDK to support URLs without TLS protocol in NodeJS, to simplify proxy usage inside private networks.
3+
14
10.24.1 (December 12, 2023)
25
- Updated SDK cache for browsers using localStorage, to clear cached feature flag definitions before initiating the synchronization process if the cache was previously synchronized with a different SDK key (i.e., a different environment) or different Split Filter criteria, to avoid using invalid cached data when the SDK is ready from cache.
36
- Updated @splitsoftware/splitio-commons package to version 1.12.1.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright © 2023 Split Software, Inc.
1+
Copyright © 2024 Split Software, Inc.
22

33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.

package-lock.json

Lines changed: 31 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@splitsoftware/splitio",
3-
"version": "10.24.1",
3+
"version": "10.25.0",
44
"description": "Split SDK",
55
"files": [
66
"README.md",
@@ -40,20 +40,20 @@
4040
"node": ">=6"
4141
},
4242
"dependencies": {
43-
"@splitsoftware/splitio-commons": "1.12.1",
43+
"@splitsoftware/splitio-commons": "1.13.0",
4444
"@types/google.analytics": "0.0.40",
4545
"@types/ioredis": "^4.28.0",
4646
"bloom-filters": "^3.0.0",
4747
"ioredis": "^4.28.0",
4848
"js-yaml": "^3.13.1",
49-
"node-fetch": "^2.6.7",
49+
"node-fetch": "^2.7.0",
5050
"unfetch": "^4.2.0"
5151
},
5252
"optionalDependencies": {
5353
"eventsource": "^1.1.2"
5454
},
5555
"devDependencies": {
56-
"@types/node-fetch": "^2.5.12",
56+
"@types/node-fetch": "^2.6.10",
5757
"@types/seedrandom": "^3.0.2",
5858
"copyfiles": "^2.4.1",
5959
"cross-env": "^7.0.3",
Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,33 @@
11
import tape from 'tape-catch';
2-
import { getFetch } from '../node';
2+
import sinon from 'sinon';
3+
import { getFetch, __setFetch } from '../node';
34

4-
tape('getFetch returns node-fetch module in Node', assert => {
5-
assert.equal(getFetch(), require('node-fetch'));
5+
tape('getFetch returns a wrapped node-fetch module in Node', assert => {
6+
assert.equal(typeof getFetch(), 'function');
7+
8+
assert.end();
9+
});
10+
11+
tape('getFetch passes an agent object to HTTPs requests', assert => {
12+
const fetchMock = sinon.stub();
13+
__setFetch(fetchMock);
14+
15+
const fetch = getFetch();
16+
17+
fetch('http://test.com');
18+
assert.true(fetchMock.calledWithExactly('http://test.com', { agent: undefined }));
19+
20+
fetch('https-https://', { option: 'value' });
21+
assert.true(fetchMock.calledWithExactly('https-https://', { option: 'value', agent: undefined }));
22+
23+
fetch('https://test.com');
24+
assert.true(fetchMock.calledWithExactly('https://test.com', { agent: sinon.match.object }));
25+
26+
fetch('https://test.com', { option: 'value' });
27+
assert.true(fetchMock.calledWithExactly('https://test.com', { option: 'value', agent: sinon.match.object }));
28+
29+
// Restore
30+
__setFetch(require('node-fetch'));
631

732
assert.end();
833
});

src/platform/getFetch/node.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
/* eslint-disable compat/compat */
2+
import https from 'https';
3+
4+
// @TODO
5+
// 1- handle multiple protocols automatically
6+
// 2- destroy it once the sdk is destroyed
7+
const agent = new https.Agent({
8+
keepAlive: true,
9+
keepAliveMsecs: 1500
10+
});
11+
112
let nodeFetch;
213

314
try {
@@ -16,6 +27,14 @@ export function __setFetch(fetch) {
1627
nodeFetch = fetch;
1728
}
1829

30+
/**
31+
* Retrieves 'node-fetch', a Fetch API polyfill for NodeJS, with fallback to global 'fetch' if available.
32+
* It passes an https agent with keepAlive enabled if URL is https.
33+
*/
1934
export function getFetch() {
20-
return nodeFetch;
35+
if (nodeFetch) {
36+
return (url, options) => {
37+
return nodeFetch(url, Object.assign({ agent: url.startsWith('https:') ? agent : undefined }, options));
38+
};
39+
}
2140
}

src/platform/node.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import EventEmitter from 'events';
22
import { getFetch } from '../platform/getFetch/node';
33
import { getEventSource } from '../platform/getEventSource/node';
4-
import { getOptions } from '../platform/request/options/node';
54
import { NodeSignalListener } from '@splitsoftware/splitio-commons/src/listeners/node';
65
import { now } from '@splitsoftware/splitio-commons/src/utils/timeTracker/now/node';
76

87
export const platform = {
9-
getOptions,
108
getFetch,
119
getEventSource,
1210
EventEmitter,

src/platform/request/options/node.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/settings/defaults/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const packageVersion = '10.24.1';
1+
export const packageVersion = '10.25.0';

0 commit comments

Comments
 (0)