Skip to content

Commit 61580e5

Browse files
Add IReactNativeSettings to specialize the type. Fixed some defaults
1 parent d383fc5 commit 61580e5

File tree

2 files changed

+29
-15
lines changed

2 files changed

+29
-15
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
2.0.0 (October XX, 2024)
22
- Added support for targeting rules based on large segments.
33
- Added `factory.destroy()` method, which invokes the `destroy` method on all SDK clients created by the factory.
4+
- Added `SplitIO` namespace with the public TypeScript definitions to be reused by the SDKs, rather than having each SDK define its own types.
45
- Updated the handling of timers and async operations inside an `init` factory method to enable lazy initialization of the SDK in standalone mode. This update is intended for the React SDK.
56
- Bugfixing - Fixed an issue with the server-side polling manager that caused dangling timers when the SDK was destroyed before it was ready.
67
- BREAKING CHANGES:

types/splitio.d.ts

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ declare namespace SplitIO {
835835
userConsent?: ConsentStatus;
836836
}
837837
/**
838-
* Settings interface for SDK instances created for client-side with synchronous storage (e.g., Browser or React Native).
838+
* Settings interface for SDK instances created with client-side API and synchronous storage (e.g., Browser or React Native).
839839
*
840840
* @interface IClientSideSettings
841841
* @extends IClientSideBasicSettings
@@ -878,13 +878,13 @@ declare namespace SplitIO {
878878
/**
879879
* Maximum amount of time used before notify a timeout.
880880
* @property {number} readyTimeout
881-
* @default 1.5
881+
* @default 10
882882
*/
883883
readyTimeout?: number;
884884
/**
885885
* Time to wait for a request before the SDK is ready. If this time expires, JS Sdk will retry 'retriesOnFailureBeforeReady' times before notifying its failure to be 'ready'.
886886
* @property {number} requestTimeoutBeforeReady
887-
* @default 1.5
887+
* @default 5
888888
*/
889889
requestTimeoutBeforeReady?: number;
890890
/**
@@ -968,10 +968,20 @@ declare namespace SplitIO {
968968
}
969969
}
970970
/**
971-
* Settings interface with async storage for SDK instances created for client-side (e.g., Serverless environments).
972-
* If your storage is synchronous (by defaut we use memory, which is sync) use SplitIO.IClientSideSettings instead.
971+
* Settings interface for SDK instances created in React Native, with client-side API and synchronous storage.
972+
*
973+
* @interface IReactNativeSettings
974+
* @extends IClientSideSettings
975+
* @see {@link https://help.split.io/hc/en-us/articles/4406066357901-React-Native-SDK#configuration}
976+
*/
977+
interface IReactNativeSettings extends IClientSideSettings { }
978+
/**
979+
* Settings interface for SDK instances created with client-side API and asynchronous storage (e.g., serverless environments with a persistent storage).
980+
* If your storage is synchronous (by default we use memory, which is sync) use SplitIO.IClientSideSettings instead.
981+
*
973982
* @interface IClientSideAsyncSettings
974983
* @extends IClientSideBasicSettings
984+
* @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#sharing-state-with-a-pluggable-storage}
975985
*/
976986
interface IClientSideAsyncSettings extends IClientSideBasicSettings {
977987
/**
@@ -1003,7 +1013,7 @@ declare namespace SplitIO {
10031013
/**
10041014
* Maximum amount of time used before notify a timeout.
10051015
* @property {number} readyTimeout
1006-
* @default 1.5
1016+
* @default 5
10071017
*/
10081018
readyTimeout?: number;
10091019
/**
@@ -1303,7 +1313,8 @@ declare namespace SplitIO {
13031313
features?: SplitIO.MockedFeaturesFilePath;
13041314
}
13051315
/**
1306-
* Settings interface for SDK instances created on the browser
1316+
* Settings interface for JavaScript SDK instances created on the browser, with client-side API and synchronous storage.
1317+
*
13071318
* @interface IBrowserSettings
13081319
* @extends ISharedSettings
13091320
* @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#configuration}
@@ -1317,13 +1328,13 @@ declare namespace SplitIO {
13171328
/**
13181329
* Maximum amount of time used before notify a timeout.
13191330
* @property {number} readyTimeout
1320-
* @default 1.5
1331+
* @default 10
13211332
*/
13221333
readyTimeout?: number;
13231334
/**
13241335
* Time to wait for a request before the SDK is ready. If this time expires, JS Sdk will retry 'retriesOnFailureBeforeReady' times before notifying its failure to be 'ready'.
13251336
* @property {number} requestTimeoutBeforeReady
1326-
* @default 1.5
1337+
* @default 5
13271338
*/
13281339
requestTimeoutBeforeReady?: number;
13291340
/**
@@ -1512,8 +1523,9 @@ declare namespace SplitIO {
15121523
};
15131524
}
15141525
/**
1515-
* Settings interface for SDK instances created on NodeJS.
1526+
* Settings interface for JavaScript SDK instances created on NodeJS, with server-side API and synchronous storage.
15161527
* If your storage is asynchronous (Redis for example) use SplitIO.INodeAsyncSettings instead.
1528+
*
15171529
* @interface INodeSettings
15181530
* @extends INodeBasicSettings
15191531
* @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#configuration}
@@ -1542,7 +1554,7 @@ declare namespace SplitIO {
15421554
* @property {string} prefix
15431555
* @default 'SPLITIO'
15441556
*/
1545-
prefix?: string
1557+
prefix?: string;
15461558
};
15471559
/**
15481560
* The SDK mode. When using the default 'MEMORY' storage, the only possible value is "standalone", which is the default.
@@ -1551,7 +1563,7 @@ declare namespace SplitIO {
15511563
* @property {'standalone'} mode
15521564
* @default 'standalone'
15531565
*/
1554-
mode?: 'standalone'
1566+
mode?: 'standalone';
15551567
sync?: INodeBasicSettings['sync'] & {
15561568
/**
15571569
* Custom options object for HTTP(S) requests in NodeJS.
@@ -1580,7 +1592,7 @@ declare namespace SplitIO {
15801592
* };
15811593
* };
15821594
*/
1583-
getHeaderOverrides?: (context: { headers: Record<string, string> }) => Record<string, string>
1595+
getHeaderOverrides?: (context: { headers: Record<string, string> }) => Record<string, string>;
15841596
/**
15851597
* Custom NodeJS HTTP(S) Agent used by the SDK for HTTP(S) requests.
15861598
*
@@ -1611,8 +1623,9 @@ declare namespace SplitIO {
16111623
};
16121624
}
16131625
/**
1614-
* Settings interface with async storage for SDK instances created on NodeJS.
1615-
* If your storage is synchronous (by defaut we use memory, which is sync) use SplitIO.INodeSettings instead.
1626+
* Settings interface for JavaScript SDK instances created on NodeJS, with asynchronous storage like Redis.
1627+
* If your storage is synchronous (by default we use memory, which is sync) use SplitIO.INodeSettings instead.
1628+
*
16161629
* @interface INodeAsyncSettings
16171630
* @extends INodeBasicSettings
16181631
* @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#configuration}

0 commit comments

Comments
 (0)