@splitsoftware/splitio 10.24.1 → 10.24.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 CHANGED
@@ -1,3 +1,6 @@
1
+ 10.25.0 (January 4, 2024)
2
+ - Updated SDK to support URLs using 'http://' scheme in NodeJS, for connecting to the Split Synchronizer in proxy mode using HTTP.
3
+
1
4
  10.24.1 (December 12, 2023)
2
5
  - 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.
3
6
  - Updated @splitsoftware/splitio-commons package to version 1.12.1.
@@ -1,3 +1,12 @@
1
+ /* eslint-disable compat/compat */
2
+ import https from 'https';
3
+ // @TODO
4
+ // 1- handle multiple protocols automatically
5
+ // 2- destroy it once the sdk is destroyed
6
+ var agent = new https.Agent({
7
+ keepAlive: true,
8
+ keepAliveMsecs: 1500
9
+ });
1
10
  var nodeFetch;
2
11
  try {
3
12
  nodeFetch = require('node-fetch');
@@ -13,6 +22,14 @@ catch (error) {
13
22
  export function __setFetch(fetch) {
14
23
  nodeFetch = fetch;
15
24
  }
25
+ /**
26
+ * Retrieves 'node-fetch', a Fetch API polyfill for NodeJS, with fallback to global 'fetch' if available.
27
+ * It passes an https agent with keepAlive enabled if URL is https.
28
+ */
16
29
  export function getFetch() {
17
- return nodeFetch;
30
+ if (nodeFetch) {
31
+ return function (url, options) {
32
+ return nodeFetch(url, Object.assign({ agent: url.startsWith('https://') ? agent : undefined }, options));
33
+ };
34
+ }
18
35
  }
@@ -1,11 +1,9 @@
1
1
  import EventEmitter from 'events';
2
2
  import { getFetch } from '../platform/getFetch/node';
3
3
  import { getEventSource } from '../platform/getEventSource/node';
4
- import { getOptions } from '../platform/request/options/node';
5
4
  import { NodeSignalListener } from '@splitsoftware/splitio-commons/esm/listeners/node';
6
5
  import { now } from '@splitsoftware/splitio-commons/esm/utils/timeTracker/now/node';
7
6
  export var platform = {
8
- getOptions: getOptions,
9
7
  getFetch: getFetch,
10
8
  getEventSource: getEventSource,
11
9
  EventEmitter: EventEmitter,
@@ -1 +1 @@
1
- export var packageVersion = '10.24.1';
1
+ export var packageVersion = '10.24.2-rc.0';
@@ -1,6 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getFetch = exports.__setFetch = void 0;
4
+ var tslib_1 = require("tslib");
5
+ /* eslint-disable compat/compat */
6
+ var https_1 = (0, tslib_1.__importDefault)(require("https"));
7
+ // @TODO
8
+ // 1- handle multiple protocols automatically
9
+ // 2- destroy it once the sdk is destroyed
10
+ var agent = new https_1.default.Agent({
11
+ keepAlive: true,
12
+ keepAliveMsecs: 1500
13
+ });
4
14
  var nodeFetch;
5
15
  try {
6
16
  nodeFetch = require('node-fetch');
@@ -17,7 +27,15 @@ function __setFetch(fetch) {
17
27
  nodeFetch = fetch;
18
28
  }
19
29
  exports.__setFetch = __setFetch;
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
+ */
20
34
  function getFetch() {
21
- return nodeFetch;
35
+ if (nodeFetch) {
36
+ return function (url, options) {
37
+ return nodeFetch(url, Object.assign({ agent: url.startsWith('https://') ? agent : undefined }, options));
38
+ };
39
+ }
22
40
  }
23
41
  exports.getFetch = getFetch;
@@ -5,14 +5,12 @@ var tslib_1 = require("tslib");
5
5
  var events_1 = (0, tslib_1.__importDefault)(require("events"));
6
6
  var node_1 = require("../platform/getFetch/node");
7
7
  var node_2 = require("../platform/getEventSource/node");
8
- var node_3 = require("../platform/request/options/node");
9
- var node_4 = require("@splitsoftware/splitio-commons/cjs/listeners/node");
10
- var node_5 = require("@splitsoftware/splitio-commons/cjs/utils/timeTracker/now/node");
8
+ var node_3 = require("@splitsoftware/splitio-commons/cjs/listeners/node");
9
+ var node_4 = require("@splitsoftware/splitio-commons/cjs/utils/timeTracker/now/node");
11
10
  exports.platform = {
12
- getOptions: node_3.getOptions,
13
11
  getFetch: node_1.getFetch,
14
12
  getEventSource: node_2.getEventSource,
15
13
  EventEmitter: events_1.default,
16
- now: node_5.now
14
+ now: node_4.now
17
15
  };
18
- exports.SignalListener = node_4.NodeSignalListener;
16
+ exports.SignalListener = node_3.NodeSignalListener;
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.packageVersion = void 0;
4
- exports.packageVersion = '10.24.1';
4
+ exports.packageVersion = '10.24.2-rc.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splitsoftware/splitio",
3
- "version": "10.24.1",
3
+ "version": "10.24.2-rc.0",
4
4
  "description": "Split SDK",
5
5
  "files": [
6
6
  "README.md",
@@ -40,20 +40,20 @@
40
40
  "node": ">=6"
41
41
  },
42
42
  "dependencies": {
43
- "@splitsoftware/splitio-commons": "1.12.1",
43
+ "@splitsoftware/splitio-commons": "1.12.2-rc.0",
44
44
  "@types/google.analytics": "0.0.40",
45
45
  "@types/ioredis": "^4.28.0",
46
46
  "bloom-filters": "^3.0.0",
47
47
  "ioredis": "^4.28.0",
48
48
  "js-yaml": "^3.13.1",
49
- "node-fetch": "^2.6.7",
49
+ "node-fetch": "^2.7.0",
50
50
  "unfetch": "^4.2.0"
51
51
  },
52
52
  "optionalDependencies": {
53
53
  "eventsource": "^1.1.2"
54
54
  },
55
55
  "devDependencies": {
56
- "@types/node-fetch": "^2.5.12",
56
+ "@types/node-fetch": "^2.6.10",
57
57
  "@types/seedrandom": "^3.0.2",
58
58
  "copyfiles": "^2.4.1",
59
59
  "cross-env": "^7.0.3",
@@ -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
+
1
12
  let nodeFetch;
2
13
 
3
14
  try {
@@ -16,6 +27,14 @@ export function __setFetch(fetch) {
16
27
  nodeFetch = fetch;
17
28
  }
18
29
 
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
+ */
19
34
  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
+ }
21
40
  }
@@ -1,12 +1,10 @@
1
1
  import EventEmitter from 'events';
2
2
  import { getFetch } from '../platform/getFetch/node';
3
3
  import { getEventSource } from '../platform/getEventSource/node';
4
- import { getOptions } from '../platform/request/options/node';
5
4
  import { NodeSignalListener } from '@splitsoftware/splitio-commons/src/listeners/node';
6
5
  import { now } from '@splitsoftware/splitio-commons/src/utils/timeTracker/now/node';
7
6
 
8
7
  export const platform = {
9
- getOptions,
10
8
  getFetch,
11
9
  getEventSource,
12
10
  EventEmitter,
@@ -1 +1 @@
1
- export const packageVersion = '10.24.1';
1
+ export const packageVersion = '10.24.2-rc.0';
@@ -1,13 +0,0 @@
1
- // @TODO
2
- // 1- handle multiple protocols automatically
3
- // 2- destroy it once the sdk is destroyed
4
- import https from 'https';
5
- var agent = new https.Agent({
6
- keepAlive: true,
7
- keepAliveMsecs: 1500
8
- });
9
- export function getOptions() {
10
- return {
11
- agent: agent
12
- };
13
- }
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getOptions = void 0;
4
- var tslib_1 = require("tslib");
5
- // @TODO
6
- // 1- handle multiple protocols automatically
7
- // 2- destroy it once the sdk is destroyed
8
- var https_1 = (0, tslib_1.__importDefault)(require("https"));
9
- var agent = new https_1.default.Agent({
10
- keepAlive: true,
11
- keepAliveMsecs: 1500
12
- });
13
- function getOptions() {
14
- return {
15
- agent: agent
16
- };
17
- }
18
- exports.getOptions = getOptions;
@@ -1,15 +0,0 @@
1
- // @TODO
2
- // 1- handle multiple protocols automatically
3
- // 2- destroy it once the sdk is destroyed
4
- import https from 'https';
5
-
6
- const agent = new https.Agent({
7
- keepAlive: true,
8
- keepAliveMsecs: 1500
9
- });
10
-
11
- export function getOptions() {
12
- return {
13
- agent
14
- };
15
- }