@splitsoftware/splitio-commons 3.0.0-rc.6 → 3.0.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 +2 -2
- package/cjs/listeners/node.js +2 -2
- package/cjs/logger/messages/info.js +2 -2
- package/cjs/logger/messages/warn.js +3 -3
- package/cjs/readiness/readinessManager.js +1 -1
- package/cjs/readiness/sdkReadinessManager.js +1 -1
- package/cjs/sync/polling/updaters/segmentChangesUpdater.js +1 -1
- package/esm/listeners/node.js +2 -2
- package/esm/logger/messages/info.js +2 -2
- package/esm/logger/messages/warn.js +3 -3
- package/esm/readiness/readinessManager.js +1 -1
- package/esm/readiness/sdkReadinessManager.js +1 -1
- package/esm/sync/polling/updaters/segmentChangesUpdater.js +1 -1
- package/package.json +1 -1
- package/src/listeners/node.ts +2 -2
- package/src/logger/messages/info.ts +2 -2
- package/src/logger/messages/warn.ts +3 -3
- package/src/readiness/readinessManager.ts +1 -1
- package/src/readiness/sdkReadinessManager.ts +1 -1
- package/src/sync/polling/updaters/segmentChangesUpdater.ts +1 -1
- package/types/splitio.d.ts +56 -46
package/CHANGES.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
3.0.0 (June
|
|
1
|
+
3.0.0 (June 26, 2026)
|
|
2
2
|
- Extracted SDK lifecycle methods (`init`, `flush`, and `destroy`) into a reusable `sdkLifecycle` module.
|
|
3
3
|
- Extracted the `track` method into a standalone `trackMethod` factory for reuse across SDKs.
|
|
4
4
|
- Added a bloom filter utility and platform-specific modules (`src/platform/`) for reuse across SDKs.
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
- Removed the misleading warning log 'No listeners for SDK_READY event detected', since users can use the `whenReady` method to wait for the SDK to be ready.
|
|
13
13
|
- BREAKING CHANGES: Renamed some types and modules, and updated the signatures of others for clarity and reusability.
|
|
14
14
|
|
|
15
|
-
2.12.1 (
|
|
15
|
+
2.12.1 (June 25, 2026)
|
|
16
16
|
- Updated internal modules to handle `null` values from `/splitChanges` response.
|
|
17
17
|
- Updated some dependencies for vulnerability fixes.
|
|
18
18
|
|
package/cjs/listeners/node.js
CHANGED
|
@@ -47,13 +47,13 @@ var NodeSignalListener = /** @class */ (function () {
|
|
|
47
47
|
// eslint-disable-next-line no-undef
|
|
48
48
|
process.kill(process.pid, SIGTERM);
|
|
49
49
|
};
|
|
50
|
-
this.settings.log.debug("".concat(constants_1.LOG_PREFIX_CLEANUP, "
|
|
50
|
+
this.settings.log.debug("".concat(constants_1.LOG_PREFIX_CLEANUP, "SDK graceful shutdown after SIGTERM."));
|
|
51
51
|
var handlerResult = null;
|
|
52
52
|
try {
|
|
53
53
|
handlerResult = this.handler();
|
|
54
54
|
}
|
|
55
55
|
catch (err) {
|
|
56
|
-
this.settings.log.error("".concat(constants_1.LOG_PREFIX_CLEANUP, "Error with
|
|
56
|
+
this.settings.log.error("".concat(constants_1.LOG_PREFIX_CLEANUP, "Error with SDK graceful shutdown: ").concat(err));
|
|
57
57
|
}
|
|
58
58
|
if ((0, thenable_1.thenable)(handlerResult)) {
|
|
59
59
|
// Always exit, even with errors. The promise is returned for UT purposes.
|
|
@@ -4,7 +4,7 @@ exports.codesInfo = void 0;
|
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var c = tslib_1.__importStar(require("../constants"));
|
|
6
6
|
var warn_1 = require("./warn");
|
|
7
|
-
var READY_MSG = '
|
|
7
|
+
var READY_MSG = 'SDK client is ready';
|
|
8
8
|
exports.codesInfo = warn_1.codesWarn.concat([
|
|
9
9
|
// client status
|
|
10
10
|
[c.CLIENT_READY_FROM_CACHE, READY_MSG + ' from cache'],
|
|
@@ -12,7 +12,7 @@ exports.codesInfo = warn_1.codesWarn.concat([
|
|
|
12
12
|
// SDK
|
|
13
13
|
[c.IMPRESSION_QUEUEING, c.LOG_PREFIX_IMPRESSIONS_TRACKER + 'Queueing impression. %s: %s. Key: %s. Evaluation: %s. Label: %s'],
|
|
14
14
|
[c.NEW_SHARED_CLIENT, 'New shared client instance created.'],
|
|
15
|
-
[c.NEW_FACTORY, 'New
|
|
15
|
+
[c.NEW_FACTORY, 'New SDK instance created. %s'],
|
|
16
16
|
[c.EVENTS_TRACKER_SUCCESS, c.LOG_PREFIX_EVENTS_TRACKER + 'Successfully queued %s'],
|
|
17
17
|
[c.IMPRESSIONS_TRACKER_SUCCESS, c.LOG_PREFIX_IMPRESSIONS_TRACKER + 'Successfully stored %s impression(s).'],
|
|
18
18
|
[c.USER_CONSENT_UPDATED, 'UserConsent: consent status changed from %s to %s.'],
|
|
@@ -23,9 +23,9 @@ exports.codesWarn = error_1.codesError.concat([
|
|
|
23
23
|
[c.WARN_TRIMMING_PROPERTIES, '%s: more than 300 properties were provided. Some of them will be trimmed when processed.'],
|
|
24
24
|
[c.WARN_CONVERTING, '%s: %s "%s" is not of type string, converting.'],
|
|
25
25
|
[c.WARN_TRIMMING, '%s: %s "%s" has extra whitespace, trimming.'],
|
|
26
|
-
[c.WARN_NOT_EXISTENT_DEFINITION, '%s: "%s" does not exist in this environment. Please double check that it exists in Harness UI.'],
|
|
26
|
+
[c.WARN_NOT_EXISTENT_DEFINITION, '%s: "%s" does not exist in this environment. Please double check that it exists in Harness FME UI.'],
|
|
27
27
|
[c.WARN_LOWERCASE_TRAFFIC_TYPE, '%s: traffic_type_name should be all lowercase - converting string to lowercase.'],
|
|
28
|
-
[c.WARN_NOT_EXISTENT_TT, '%s: traffic type "%s" does not have any corresponding feature flag in this environment, make sure you\'re tracking your events to a valid traffic type defined in Harness UI.'],
|
|
28
|
+
[c.WARN_NOT_EXISTENT_TT, '%s: traffic type "%s" does not have any corresponding feature flag in this environment, make sure you\'re tracking your events to a valid traffic type defined in Harness FME UI.'],
|
|
29
29
|
[c.WARN_FLAGSET_NOT_CONFIGURED, '%s: you passed %s which is not part of the configured FlagSetsFilter, ignoring Flag Set.'],
|
|
30
30
|
// initialization / settings validation
|
|
31
31
|
[c.WARN_INTEGRATION_INVALID, c.LOG_PREFIX_SETTINGS + ': %s integration item(s) at settings is invalid. %s'],
|
|
@@ -37,5 +37,5 @@ exports.codesWarn = error_1.codesError.concat([
|
|
|
37
37
|
[c.STREAMING_PARSING_SPLIT_UPDATE, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching SplitChanges due to an error processing %s notification: %s'],
|
|
38
38
|
[c.WARN_INVALID_FLAGSET, '%s: you passed %s, flag set must adhere to the regular expressions %s. This means a flag set must start with a letter or number, be in lowercase, alphanumeric and have a max length of 50 characters. %s was discarded.'],
|
|
39
39
|
[c.WARN_LOWERCASE_FLAGSET, '%s: flag set %s should be all lowercase - converting string to lowercase.'],
|
|
40
|
-
[c.WARN_FLAGSET_WITHOUT_FLAGS, '%s: you passed %s flag set that does not contain cached feature flag names. Please double check what flag sets are in use in Harness UI.'],
|
|
40
|
+
[c.WARN_FLAGSET_WITHOUT_FLAGS, '%s: you passed %s flag set that does not contain cached feature flag names. Please double check what flag sets are in use in Harness FME UI.'],
|
|
41
41
|
]);
|
|
@@ -55,7 +55,7 @@ function readinessManagerFactory(EventEmitter, settings, definitions, isShared)
|
|
|
55
55
|
return;
|
|
56
56
|
hasTimedout = true;
|
|
57
57
|
syncLastUpdate();
|
|
58
|
-
gate.emit(constants_1.SDK_READY_TIMED_OUT, '
|
|
58
|
+
gate.emit(constants_1.SDK_READY_TIMED_OUT, 'SDK client emitted SDK_READY_TIMED_OUT event.');
|
|
59
59
|
}
|
|
60
60
|
// emit SDK_READY and SDK_UPDATE
|
|
61
61
|
var isReady = false;
|
|
@@ -79,7 +79,7 @@ function sdkReadinessManagerFactory(EventEmitter, settings, readinessManager) {
|
|
|
79
79
|
ready: function () {
|
|
80
80
|
if (readinessManager.hasTimedout()) {
|
|
81
81
|
if (!readinessManager.isReady()) {
|
|
82
|
-
return (0, wrapper_1.promiseWrapper)(Promise.reject(new Error('
|
|
82
|
+
return (0, wrapper_1.promiseWrapper)(Promise.reject(new Error('SDK client has emitted SDK_READY_TIMED_OUT event.')), defaultOnRejected);
|
|
83
83
|
}
|
|
84
84
|
else {
|
|
85
85
|
return Promise.resolve();
|
|
@@ -84,7 +84,7 @@ function segmentChangesUpdaterFactory(log, segmentChangesFetcher, segments, read
|
|
|
84
84
|
// @TODO although factory status is destroyed, synchronization is not stopped
|
|
85
85
|
if (readiness)
|
|
86
86
|
readiness.setDestroyed();
|
|
87
|
-
log.error("".concat(constants_2.LOG_PREFIX_INSTANTIATION, ": you passed a client-side type authorizationKey, please grab an SDK Key from Harness UI that is of type server-side."));
|
|
87
|
+
log.error("".concat(constants_2.LOG_PREFIX_INSTANTIATION, ": you passed a client-side type authorizationKey, please grab an SDK Key from Harness FME UI that is of type server-side."));
|
|
88
88
|
}
|
|
89
89
|
else {
|
|
90
90
|
log.warn("".concat(constants_2.LOG_PREFIX_SYNC, "Error while doing fetch of segments. ").concat(error));
|
package/esm/listeners/node.js
CHANGED
|
@@ -44,13 +44,13 @@ var NodeSignalListener = /** @class */ (function () {
|
|
|
44
44
|
// eslint-disable-next-line no-undef
|
|
45
45
|
process.kill(process.pid, SIGTERM);
|
|
46
46
|
};
|
|
47
|
-
this.settings.log.debug("".concat(LOG_PREFIX_CLEANUP, "
|
|
47
|
+
this.settings.log.debug("".concat(LOG_PREFIX_CLEANUP, "SDK graceful shutdown after SIGTERM."));
|
|
48
48
|
var handlerResult = null;
|
|
49
49
|
try {
|
|
50
50
|
handlerResult = this.handler();
|
|
51
51
|
}
|
|
52
52
|
catch (err) {
|
|
53
|
-
this.settings.log.error("".concat(LOG_PREFIX_CLEANUP, "Error with
|
|
53
|
+
this.settings.log.error("".concat(LOG_PREFIX_CLEANUP, "Error with SDK graceful shutdown: ").concat(err));
|
|
54
54
|
}
|
|
55
55
|
if (thenable(handlerResult)) {
|
|
56
56
|
// Always exit, even with errors. The promise is returned for UT purposes.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as c from '../constants';
|
|
2
2
|
import { codesWarn } from './warn';
|
|
3
|
-
var READY_MSG = '
|
|
3
|
+
var READY_MSG = 'SDK client is ready';
|
|
4
4
|
export var codesInfo = codesWarn.concat([
|
|
5
5
|
// client status
|
|
6
6
|
[c.CLIENT_READY_FROM_CACHE, READY_MSG + ' from cache'],
|
|
@@ -8,7 +8,7 @@ export var codesInfo = codesWarn.concat([
|
|
|
8
8
|
// SDK
|
|
9
9
|
[c.IMPRESSION_QUEUEING, c.LOG_PREFIX_IMPRESSIONS_TRACKER + 'Queueing impression. %s: %s. Key: %s. Evaluation: %s. Label: %s'],
|
|
10
10
|
[c.NEW_SHARED_CLIENT, 'New shared client instance created.'],
|
|
11
|
-
[c.NEW_FACTORY, 'New
|
|
11
|
+
[c.NEW_FACTORY, 'New SDK instance created. %s'],
|
|
12
12
|
[c.EVENTS_TRACKER_SUCCESS, c.LOG_PREFIX_EVENTS_TRACKER + 'Successfully queued %s'],
|
|
13
13
|
[c.IMPRESSIONS_TRACKER_SUCCESS, c.LOG_PREFIX_IMPRESSIONS_TRACKER + 'Successfully stored %s impression(s).'],
|
|
14
14
|
[c.USER_CONSENT_UPDATED, 'UserConsent: consent status changed from %s to %s.'],
|
|
@@ -19,9 +19,9 @@ export var codesWarn = codesError.concat([
|
|
|
19
19
|
[c.WARN_TRIMMING_PROPERTIES, '%s: more than 300 properties were provided. Some of them will be trimmed when processed.'],
|
|
20
20
|
[c.WARN_CONVERTING, '%s: %s "%s" is not of type string, converting.'],
|
|
21
21
|
[c.WARN_TRIMMING, '%s: %s "%s" has extra whitespace, trimming.'],
|
|
22
|
-
[c.WARN_NOT_EXISTENT_DEFINITION, '%s: "%s" does not exist in this environment. Please double check that it exists in Harness UI.'],
|
|
22
|
+
[c.WARN_NOT_EXISTENT_DEFINITION, '%s: "%s" does not exist in this environment. Please double check that it exists in Harness FME UI.'],
|
|
23
23
|
[c.WARN_LOWERCASE_TRAFFIC_TYPE, '%s: traffic_type_name should be all lowercase - converting string to lowercase.'],
|
|
24
|
-
[c.WARN_NOT_EXISTENT_TT, '%s: traffic type "%s" does not have any corresponding feature flag in this environment, make sure you\'re tracking your events to a valid traffic type defined in Harness UI.'],
|
|
24
|
+
[c.WARN_NOT_EXISTENT_TT, '%s: traffic type "%s" does not have any corresponding feature flag in this environment, make sure you\'re tracking your events to a valid traffic type defined in Harness FME UI.'],
|
|
25
25
|
[c.WARN_FLAGSET_NOT_CONFIGURED, '%s: you passed %s which is not part of the configured FlagSetsFilter, ignoring Flag Set.'],
|
|
26
26
|
// initialization / settings validation
|
|
27
27
|
[c.WARN_INTEGRATION_INVALID, c.LOG_PREFIX_SETTINGS + ': %s integration item(s) at settings is invalid. %s'],
|
|
@@ -33,5 +33,5 @@ export var codesWarn = codesError.concat([
|
|
|
33
33
|
[c.STREAMING_PARSING_SPLIT_UPDATE, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching SplitChanges due to an error processing %s notification: %s'],
|
|
34
34
|
[c.WARN_INVALID_FLAGSET, '%s: you passed %s, flag set must adhere to the regular expressions %s. This means a flag set must start with a letter or number, be in lowercase, alphanumeric and have a max length of 50 characters. %s was discarded.'],
|
|
35
35
|
[c.WARN_LOWERCASE_FLAGSET, '%s: flag set %s should be all lowercase - converting string to lowercase.'],
|
|
36
|
-
[c.WARN_FLAGSET_WITHOUT_FLAGS, '%s: you passed %s flag set that does not contain cached feature flag names. Please double check what flag sets are in use in Harness UI.'],
|
|
36
|
+
[c.WARN_FLAGSET_WITHOUT_FLAGS, '%s: you passed %s flag set that does not contain cached feature flag names. Please double check what flag sets are in use in Harness FME UI.'],
|
|
37
37
|
]);
|
|
@@ -52,7 +52,7 @@ export function readinessManagerFactory(EventEmitter, settings, definitions, isS
|
|
|
52
52
|
return;
|
|
53
53
|
hasTimedout = true;
|
|
54
54
|
syncLastUpdate();
|
|
55
|
-
gate.emit(SDK_READY_TIMED_OUT, '
|
|
55
|
+
gate.emit(SDK_READY_TIMED_OUT, 'SDK client emitted SDK_READY_TIMED_OUT event.');
|
|
56
56
|
}
|
|
57
57
|
// emit SDK_READY and SDK_UPDATE
|
|
58
58
|
var isReady = false;
|
|
@@ -76,7 +76,7 @@ export function sdkReadinessManagerFactory(EventEmitter, settings, readinessMana
|
|
|
76
76
|
ready: function () {
|
|
77
77
|
if (readinessManager.hasTimedout()) {
|
|
78
78
|
if (!readinessManager.isReady()) {
|
|
79
|
-
return promiseWrapper(Promise.reject(new Error('
|
|
79
|
+
return promiseWrapper(Promise.reject(new Error('SDK client has emitted SDK_READY_TIMED_OUT event.')), defaultOnRejected);
|
|
80
80
|
}
|
|
81
81
|
else {
|
|
82
82
|
return Promise.resolve();
|
|
@@ -81,7 +81,7 @@ export function segmentChangesUpdaterFactory(log, segmentChangesFetcher, segment
|
|
|
81
81
|
// @TODO although factory status is destroyed, synchronization is not stopped
|
|
82
82
|
if (readiness)
|
|
83
83
|
readiness.setDestroyed();
|
|
84
|
-
log.error("".concat(LOG_PREFIX_INSTANTIATION, ": you passed a client-side type authorizationKey, please grab an SDK Key from Harness UI that is of type server-side."));
|
|
84
|
+
log.error("".concat(LOG_PREFIX_INSTANTIATION, ": you passed a client-side type authorizationKey, please grab an SDK Key from Harness FME UI that is of type server-side."));
|
|
85
85
|
}
|
|
86
86
|
else {
|
|
87
87
|
log.warn("".concat(LOG_PREFIX_SYNC, "Error while doing fetch of segments. ").concat(error));
|
package/package.json
CHANGED
package/src/listeners/node.ts
CHANGED
|
@@ -58,14 +58,14 @@ export class NodeSignalListener implements ISignalListener {
|
|
|
58
58
|
process.kill(process.pid, SIGTERM);
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
this.settings.log.debug(`${LOG_PREFIX_CLEANUP}
|
|
61
|
+
this.settings.log.debug(`${LOG_PREFIX_CLEANUP}SDK graceful shutdown after SIGTERM.`);
|
|
62
62
|
|
|
63
63
|
let handlerResult = null;
|
|
64
64
|
|
|
65
65
|
try {
|
|
66
66
|
handlerResult = this.handler();
|
|
67
67
|
} catch (err) {
|
|
68
|
-
this.settings.log.error(`${LOG_PREFIX_CLEANUP}Error with
|
|
68
|
+
this.settings.log.error(`${LOG_PREFIX_CLEANUP}Error with SDK graceful shutdown: ${err}`);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
if (thenable(handlerResult)) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as c from '../constants';
|
|
2
2
|
import { codesWarn } from './warn';
|
|
3
3
|
|
|
4
|
-
const READY_MSG = '
|
|
4
|
+
const READY_MSG = 'SDK client is ready';
|
|
5
5
|
|
|
6
6
|
export const codesInfo: [number, string][] = codesWarn.concat([
|
|
7
7
|
// client status
|
|
@@ -10,7 +10,7 @@ export const codesInfo: [number, string][] = codesWarn.concat([
|
|
|
10
10
|
// SDK
|
|
11
11
|
[c.IMPRESSION_QUEUEING, c.LOG_PREFIX_IMPRESSIONS_TRACKER +'Queueing impression. %s: %s. Key: %s. Evaluation: %s. Label: %s'],
|
|
12
12
|
[c.NEW_SHARED_CLIENT, 'New shared client instance created.'],
|
|
13
|
-
[c.NEW_FACTORY, 'New
|
|
13
|
+
[c.NEW_FACTORY, 'New SDK instance created. %s'],
|
|
14
14
|
[c.EVENTS_TRACKER_SUCCESS, c.LOG_PREFIX_EVENTS_TRACKER + 'Successfully queued %s'],
|
|
15
15
|
[c.IMPRESSIONS_TRACKER_SUCCESS, c.LOG_PREFIX_IMPRESSIONS_TRACKER + 'Successfully stored %s impression(s).'],
|
|
16
16
|
[c.USER_CONSENT_UPDATED, 'UserConsent: consent status changed from %s to %s.'],
|
|
@@ -20,9 +20,9 @@ export const codesWarn: [number, string][] = codesError.concat([
|
|
|
20
20
|
[c.WARN_TRIMMING_PROPERTIES, '%s: more than 300 properties were provided. Some of them will be trimmed when processed.'],
|
|
21
21
|
[c.WARN_CONVERTING, '%s: %s "%s" is not of type string, converting.'],
|
|
22
22
|
[c.WARN_TRIMMING, '%s: %s "%s" has extra whitespace, trimming.'],
|
|
23
|
-
[c.WARN_NOT_EXISTENT_DEFINITION, '%s: "%s" does not exist in this environment. Please double check that it exists in Harness UI.'],
|
|
23
|
+
[c.WARN_NOT_EXISTENT_DEFINITION, '%s: "%s" does not exist in this environment. Please double check that it exists in Harness FME UI.'],
|
|
24
24
|
[c.WARN_LOWERCASE_TRAFFIC_TYPE, '%s: traffic_type_name should be all lowercase - converting string to lowercase.'],
|
|
25
|
-
[c.WARN_NOT_EXISTENT_TT, '%s: traffic type "%s" does not have any corresponding feature flag in this environment, make sure you\'re tracking your events to a valid traffic type defined in Harness UI.'],
|
|
25
|
+
[c.WARN_NOT_EXISTENT_TT, '%s: traffic type "%s" does not have any corresponding feature flag in this environment, make sure you\'re tracking your events to a valid traffic type defined in Harness FME UI.'],
|
|
26
26
|
[c.WARN_FLAGSET_NOT_CONFIGURED, '%s: you passed %s which is not part of the configured FlagSetsFilter, ignoring Flag Set.'],
|
|
27
27
|
// initialization / settings validation
|
|
28
28
|
[c.WARN_INTEGRATION_INVALID, c.LOG_PREFIX_SETTINGS + ': %s integration item(s) at settings is invalid. %s'],
|
|
@@ -35,5 +35,5 @@ export const codesWarn: [number, string][] = codesError.concat([
|
|
|
35
35
|
[c.STREAMING_PARSING_SPLIT_UPDATE, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching SplitChanges due to an error processing %s notification: %s'],
|
|
36
36
|
[c.WARN_INVALID_FLAGSET, '%s: you passed %s, flag set must adhere to the regular expressions %s. This means a flag set must start with a letter or number, be in lowercase, alphanumeric and have a max length of 50 characters. %s was discarded.'],
|
|
37
37
|
[c.WARN_LOWERCASE_FLAGSET, '%s: flag set %s should be all lowercase - converting string to lowercase.'],
|
|
38
|
-
[c.WARN_FLAGSET_WITHOUT_FLAGS, '%s: you passed %s flag set that does not contain cached feature flag names. Please double check what flag sets are in use in Harness UI.'],
|
|
38
|
+
[c.WARN_FLAGSET_WITHOUT_FLAGS, '%s: you passed %s flag set that does not contain cached feature flag names. Please double check what flag sets are in use in Harness FME UI.'],
|
|
39
39
|
]);
|
|
@@ -69,7 +69,7 @@ export function readinessManagerFactory(
|
|
|
69
69
|
if (hasTimedout || isReady) return;
|
|
70
70
|
hasTimedout = true;
|
|
71
71
|
syncLastUpdate();
|
|
72
|
-
gate.emit(SDK_READY_TIMED_OUT, '
|
|
72
|
+
gate.emit(SDK_READY_TIMED_OUT, 'SDK client emitted SDK_READY_TIMED_OUT event.');
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
|
|
@@ -96,7 +96,7 @@ export function sdkReadinessManagerFactory(
|
|
|
96
96
|
ready() {
|
|
97
97
|
if (readinessManager.hasTimedout()) {
|
|
98
98
|
if (!readinessManager.isReady()) {
|
|
99
|
-
return promiseWrapper(Promise.reject(new Error('
|
|
99
|
+
return promiseWrapper(Promise.reject(new Error('SDK client has emitted SDK_READY_TIMED_OUT event.')), defaultOnRejected);
|
|
100
100
|
} else {
|
|
101
101
|
return Promise.resolve();
|
|
102
102
|
}
|
|
@@ -102,7 +102,7 @@ export function segmentChangesUpdaterFactory(
|
|
|
102
102
|
// If the operation is forbidden, it may be due to permissions. Destroy the SDK instance.
|
|
103
103
|
// @TODO although factory status is destroyed, synchronization is not stopped
|
|
104
104
|
if (readiness) readiness.setDestroyed();
|
|
105
|
-
log.error(`${LOG_PREFIX_INSTANTIATION}: you passed a client-side type authorizationKey, please grab an SDK Key from Harness UI that is of type server-side.`);
|
|
105
|
+
log.error(`${LOG_PREFIX_INSTANTIATION}: you passed a client-side type authorizationKey, please grab an SDK Key from Harness FME UI that is of type server-side.`);
|
|
106
106
|
} else {
|
|
107
107
|
log.warn(`${LOG_PREFIX_SYNC}Error while doing fetch of segments. ${error}`);
|
|
108
108
|
}
|
package/types/splitio.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ interface ISharedSettings {
|
|
|
26
26
|
* List of feature flag filters. These filters are used to fetch a subset of the feature flag definitions in your environment, in order to reduce the delay of the SDK to be ready.
|
|
27
27
|
*
|
|
28
28
|
* NOTES:
|
|
29
|
-
* - This configuration is only meaningful when the SDK is working in `
|
|
29
|
+
* - This configuration is only meaningful when the SDK is working in `'standalone'` mode.
|
|
30
30
|
* - If `bySet` filter is provided, `byName` and `byPrefix` filters are ignored.
|
|
31
31
|
* - If both `byName` and `byPrefix` filters are provided, the intersection of the two groups of feature flags is fetched.
|
|
32
32
|
*
|
|
@@ -79,7 +79,7 @@ interface ISharedSettings {
|
|
|
79
79
|
* 'Authorization': context.headers['Authorization'] + ', other-value',
|
|
80
80
|
* 'custom-header': 'custom-value'
|
|
81
81
|
* };
|
|
82
|
-
* }
|
|
82
|
+
* }
|
|
83
83
|
* }
|
|
84
84
|
* }
|
|
85
85
|
* });
|
|
@@ -925,7 +925,7 @@ declare namespace SplitIO {
|
|
|
925
925
|
type AsyncTreatmentWithConfig = Promise<TreatmentWithConfig>;
|
|
926
926
|
/**
|
|
927
927
|
* An object with the treatments with configs for a bulk of feature flags, returned by getTreatmentsWithConfig.
|
|
928
|
-
* Each existing configuration is a stringified version of the JSON you defined on
|
|
928
|
+
* Each existing configuration is a stringified version of the JSON you defined on Harness FME UI. For example:
|
|
929
929
|
* ```
|
|
930
930
|
* {
|
|
931
931
|
* feature1: { treatment: 'on', config: null }
|
|
@@ -1080,7 +1080,7 @@ declare namespace SplitIO {
|
|
|
1080
1080
|
changeNumber: number;
|
|
1081
1081
|
/**
|
|
1082
1082
|
* Map of configurations per treatment.
|
|
1083
|
-
* Each existing configuration is a stringified version of the JSON you defined on
|
|
1083
|
+
* Each existing configuration is a stringified version of the JSON you defined on Harness FME UI.
|
|
1084
1084
|
*/
|
|
1085
1085
|
configs: {
|
|
1086
1086
|
[treatmentName: string]: string;
|
|
@@ -1599,7 +1599,7 @@ declare namespace SplitIO {
|
|
|
1599
1599
|
* 'Authorization': context.headers['Authorization'] + ', other-value',
|
|
1600
1600
|
* 'custom-header': 'custom-value'
|
|
1601
1601
|
* };
|
|
1602
|
-
* }
|
|
1602
|
+
* }
|
|
1603
1603
|
* }
|
|
1604
1604
|
* }
|
|
1605
1605
|
* });
|
|
@@ -2311,64 +2311,73 @@ declare namespace SplitIO {
|
|
|
2311
2311
|
*/
|
|
2312
2312
|
interface ConfigsClientSettings {
|
|
2313
2313
|
/**
|
|
2314
|
-
*
|
|
2314
|
+
* SDK key used to authenticate with Harness services.
|
|
2315
2315
|
*
|
|
2316
2316
|
* @see {@link https://developer.harness.io/docs/feature-management-experimentation/management-and-administration/account-settings/api-keys/}
|
|
2317
2317
|
*/
|
|
2318
2318
|
sdkKey: string;
|
|
2319
2319
|
/**
|
|
2320
|
-
*
|
|
2321
|
-
*
|
|
2322
|
-
*
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
*
|
|
2327
|
-
*
|
|
2328
|
-
* @defaultValue `60`
|
|
2329
|
-
*/
|
|
2330
|
-
pushRate?: number;
|
|
2331
|
-
/**
|
|
2332
|
-
* Maximum queue size for events and impressions. When the queue reaches this size, a flush is triggered. Minimum value: 1000.
|
|
2333
|
-
*
|
|
2334
|
-
* @defaultValue `10000`
|
|
2335
|
-
*/
|
|
2336
|
-
queueSize?: number;
|
|
2337
|
-
/**
|
|
2338
|
-
* Logging level.
|
|
2339
|
-
*
|
|
2340
|
-
* @defaultValue `'NONE'`
|
|
2341
|
-
*/
|
|
2342
|
-
logLevel?: LogLevel;
|
|
2343
|
-
/**
|
|
2344
|
-
* Time in seconds before emitting the `SDK_READY_TIMED_OUT` event.
|
|
2345
|
-
* A value of `-1` disables the timeout and thus the event is never emitted.
|
|
2346
|
-
*
|
|
2347
|
-
* @defaultValue `10`
|
|
2320
|
+
* Log level for SDK logging.
|
|
2321
|
+
* - `'none'`: No logging
|
|
2322
|
+
* - `'error'`: Log errors only
|
|
2323
|
+
* - `'warn'`: Log warnings and errors
|
|
2324
|
+
* - `'info'`: Log info, warnings, and errors
|
|
2325
|
+
* - `'debug'`: Log debug info and above
|
|
2326
|
+
* @defaultValue `'none'`
|
|
2348
2327
|
*/
|
|
2349
|
-
|
|
2328
|
+
logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
2350
2329
|
/**
|
|
2351
|
-
*
|
|
2330
|
+
* Synchronization configuration.
|
|
2352
2331
|
*/
|
|
2353
|
-
|
|
2332
|
+
sync?: {
|
|
2354
2333
|
/**
|
|
2355
|
-
*
|
|
2334
|
+
* Polling rate for configs and segments refresh, in seconds. Minimum value: 5.
|
|
2356
2335
|
*
|
|
2357
|
-
* @defaultValue `
|
|
2336
|
+
* @defaultValue `60`
|
|
2358
2337
|
*/
|
|
2359
|
-
|
|
2338
|
+
pollingRate?: number;
|
|
2360
2339
|
/**
|
|
2361
|
-
*
|
|
2340
|
+
* Push rate for events and impressions, in seconds. Minimum value: 60.
|
|
2362
2341
|
*
|
|
2363
|
-
* @defaultValue `
|
|
2342
|
+
* @defaultValue `60`
|
|
2364
2343
|
*/
|
|
2365
|
-
|
|
2344
|
+
pushRate?: number;
|
|
2366
2345
|
/**
|
|
2367
|
-
*
|
|
2346
|
+
* Maximum queue size for events and impressions. When the queue reaches this size, a flush is triggered. Minimum value: 1000.
|
|
2347
|
+
*
|
|
2348
|
+
* @defaultValue `10000`
|
|
2349
|
+
*/
|
|
2350
|
+
queueSize?: number;
|
|
2351
|
+
/**
|
|
2352
|
+
* Time in seconds before emitting the `SDK_READY_TIMED_OUT` event.
|
|
2353
|
+
* A value of `-1` disables the timeout and thus the event is never emitted.
|
|
2368
2354
|
*
|
|
2369
|
-
* @defaultValue `
|
|
2355
|
+
* @defaultValue `10`
|
|
2370
2356
|
*/
|
|
2371
|
-
|
|
2357
|
+
readyTimeout?: number;
|
|
2358
|
+
/**
|
|
2359
|
+
* Base URLs used by the SDK for different services.
|
|
2360
|
+
*/
|
|
2361
|
+
serviceEndpoints?: {
|
|
2362
|
+
/**
|
|
2363
|
+
* String property to override the base URL where the SDK will get JWT authentication credentials.
|
|
2364
|
+
*
|
|
2365
|
+
* @defaultValue `'https://auth.split.io'`
|
|
2366
|
+
*/
|
|
2367
|
+
auth?: string;
|
|
2368
|
+
/**
|
|
2369
|
+
* String property to override the base URL where the SDK will get rollout plan related data, like configs and segments definitions.
|
|
2370
|
+
*
|
|
2371
|
+
* @defaultValue `'https://configs.split.io'`
|
|
2372
|
+
*/
|
|
2373
|
+
configs?: string;
|
|
2374
|
+
/**
|
|
2375
|
+
* String property to override the base URL where the SDK will post event-related information like impressions.
|
|
2376
|
+
*
|
|
2377
|
+
* @defaultValue `'https://events.split.io'`
|
|
2378
|
+
*/
|
|
2379
|
+
events?: string;
|
|
2380
|
+
};
|
|
2372
2381
|
};
|
|
2373
2382
|
/**
|
|
2374
2383
|
* Fallback configuration objects returned by the `client.getConfig` method when the SDK is not ready or the provided config name is not found.
|
|
@@ -2385,6 +2394,7 @@ declare namespace SplitIO {
|
|
|
2385
2394
|
* You can use it, for example, for certificate pinning or setting a network proxy:
|
|
2386
2395
|
*
|
|
2387
2396
|
* ```
|
|
2397
|
+
* const { ConfigsClient } = require('@splitsoftware/configs');
|
|
2388
2398
|
* const { HttpsProxyAgent } = require('https-proxy-agent');
|
|
2389
2399
|
*
|
|
2390
2400
|
* const proxyAgent = new HttpsProxyAgent(process.env.HTTPS_PROXY || 'http://10.10.1.10:1080');
|