@splitsoftware/splitio 10.28.1-rc.3 → 11.0.0-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 +13 -7
- package/{lib → cjs}/factory/browser.js +9 -8
- package/{lib → cjs}/factory/node.js +1 -11
- package/{lib → cjs}/settings/browser.js +1 -3
- package/{lib → cjs}/settings/defaults/version.js +1 -1
- package/{lib → cjs}/settings/storage/browser.js +13 -2
- package/{lib → cjs}/sync/offline/splitsParserFromFile.js +1 -1
- package/client/package.json +2 -2
- package/{es → esm}/factory/browser.js +6 -5
- package/{es → esm}/factory/node.js +1 -11
- package/{es → esm}/settings/browser.js +1 -3
- package/esm/settings/defaults/version.js +1 -0
- package/esm/settings/storage/browser.js +29 -0
- package/{es → esm}/sync/offline/splitsParserFromFile.js +1 -1
- package/package.json +10 -15
- package/server/package.json +2 -2
- package/src/factory/browser.js +6 -6
- package/src/factory/node.js +1 -12
- package/src/settings/browser.js +1 -3
- package/src/settings/defaults/version.js +1 -1
- package/src/settings/storage/browser.js +16 -2
- package/src/sync/offline/splitsParserFromFile.js +1 -1
- package/types/client/index.d.ts +1 -1
- package/types/index.d.ts +3 -3
- package/types/server/index.d.ts +2 -2
- package/types/splitio.d.ts +133 -309
- package/es/settings/defaults/version.js +0 -1
- package/es/settings/storage/browser.js +0 -18
- package/scripts/ga-to-split-autorequire.js +0 -1
- /package/{es → cjs}/factory/package.json +0 -0
- /package/{lib → cjs}/index.js +0 -0
- /package/{lib → cjs}/platform/EventEmitter.js +0 -0
- /package/{lib → cjs}/platform/browser.js +0 -0
- /package/{lib → cjs}/platform/filter/bloomFilter.js +0 -0
- /package/{lib → cjs}/platform/getEventSource/browser.js +0 -0
- /package/{es → cjs}/platform/getEventSource/eventsource.js +0 -0
- /package/{lib → cjs}/platform/getEventSource/node.js +0 -0
- /package/{es → cjs}/platform/getEventSource/package.json +0 -0
- /package/{lib → cjs}/platform/getFetch/browser.js +0 -0
- /package/{lib → cjs}/platform/getFetch/node.js +0 -0
- /package/{es → cjs}/platform/getFetch/package.json +0 -0
- /package/{lib → cjs}/platform/getOptions/node.js +0 -0
- /package/{lib → cjs}/platform/node.js +0 -0
- /package/{es → cjs}/platform/package.json +0 -0
- /package/{lib → cjs}/settings/defaults/browser.js +0 -0
- /package/{lib → cjs}/settings/defaults/node.js +0 -0
- /package/{lib → cjs}/settings/integrations/browser.js +0 -0
- /package/{lib → cjs}/settings/node.js +0 -0
- /package/{es → cjs}/settings/package.json +0 -0
- /package/{lib → cjs}/settings/runtime/node.js +0 -0
- /package/{lib → cjs}/settings/storage/node.js +0 -0
- /package/{lib → cjs}/sync/offline/LocalhostFromFile.js +0 -0
- /package/{lib → cjs}/umd.js +0 -0
- /package/{lib → cjs}/utils/ip.js +0 -0
- /package/{lib → esm}/factory/package.json +0 -0
- /package/{es → esm}/index.js +0 -0
- /package/{es → esm}/platform/EventEmitter.js +0 -0
- /package/{es → esm}/platform/browser.js +0 -0
- /package/{es → esm}/platform/filter/bloomFilter.js +0 -0
- /package/{es → esm}/platform/getEventSource/browser.js +0 -0
- /package/{lib → esm}/platform/getEventSource/eventsource.js +0 -0
- /package/{es → esm}/platform/getEventSource/node.js +0 -0
- /package/{lib → esm}/platform/getEventSource/package.json +0 -0
- /package/{es → esm}/platform/getFetch/browser.js +0 -0
- /package/{es → esm}/platform/getFetch/node.js +0 -0
- /package/{lib → esm}/platform/getFetch/package.json +0 -0
- /package/{es → esm}/platform/getOptions/node.js +0 -0
- /package/{es → esm}/platform/node.js +0 -0
- /package/{lib → esm}/platform/package.json +0 -0
- /package/{es → esm}/settings/defaults/browser.js +0 -0
- /package/{es → esm}/settings/defaults/node.js +0 -0
- /package/{es → esm}/settings/integrations/browser.js +0 -0
- /package/{es → esm}/settings/node.js +0 -0
- /package/{lib → esm}/settings/package.json +0 -0
- /package/{es → esm}/settings/runtime/node.js +0 -0
- /package/{es → esm}/settings/storage/node.js +0 -0
- /package/{es → esm}/sync/offline/LocalhostFromFile.js +0 -0
- /package/{es → esm}/umd.js +0 -0
- /package/{es → esm}/utils/ip.js +0 -0
package/types/splitio.d.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
// Project: http://www.split.io/
|
|
3
3
|
// Definitions by: Nico Zelaya <https://github.com/NicoZelaya/>
|
|
4
4
|
|
|
5
|
-
/// <reference types="google.analytics" />
|
|
6
5
|
import { RedisOptions } from "ioredis";
|
|
7
6
|
import { RequestOptions } from "http";
|
|
8
7
|
|
|
@@ -63,7 +62,6 @@ interface ISettings {
|
|
|
63
62
|
readonly core: {
|
|
64
63
|
authorizationKey: string,
|
|
65
64
|
key: SplitIO.SplitKey,
|
|
66
|
-
trafficType: string,
|
|
67
65
|
labelsEnabled: boolean,
|
|
68
66
|
IPAddressesEnabled: boolean
|
|
69
67
|
},
|
|
@@ -94,7 +92,6 @@ interface ISettings {
|
|
|
94
92
|
options: Object,
|
|
95
93
|
type: StorageType
|
|
96
94
|
},
|
|
97
|
-
readonly preloadedData?: SplitIO.PreloadedData,
|
|
98
95
|
readonly urls: {
|
|
99
96
|
events: string,
|
|
100
97
|
sdk: string,
|
|
@@ -355,7 +352,7 @@ interface INodeBasicSettings extends ISharedSettings {
|
|
|
355
352
|
eventsQueueSize?: number,
|
|
356
353
|
/**
|
|
357
354
|
* For mocking/testing only. The SDK will refresh the features mocked data when mode is set to "localhost" by defining the key.
|
|
358
|
-
* For more information
|
|
355
|
+
* For more information see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#localhost-mode}
|
|
359
356
|
* @property {number} offlineRefreshRate
|
|
360
357
|
* @default 15
|
|
361
358
|
*/
|
|
@@ -374,7 +371,8 @@ interface INodeBasicSettings extends ISharedSettings {
|
|
|
374
371
|
*/
|
|
375
372
|
core: {
|
|
376
373
|
/**
|
|
377
|
-
* Your SDK key.
|
|
374
|
+
* Your SDK key.
|
|
375
|
+
* @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
|
|
378
376
|
* @property {string} authorizationKey
|
|
379
377
|
*/
|
|
380
378
|
authorizationKey: string,
|
|
@@ -422,7 +420,7 @@ interface INodeBasicSettings extends ISharedSettings {
|
|
|
422
420
|
*/
|
|
423
421
|
mode?: SDKMode,
|
|
424
422
|
/**
|
|
425
|
-
* Mocked features file path. For testing
|
|
423
|
+
* Mocked features file path. For testing purposes only. For using this you should specify "localhost" as authorizationKey on core settings.
|
|
426
424
|
* @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#localhost-mode}
|
|
427
425
|
* @property {MockedFeaturesFilePath} features
|
|
428
426
|
* @default '$HOME/.split'
|
|
@@ -441,20 +439,9 @@ interface IStatusInterface extends EventEmitter {
|
|
|
441
439
|
*/
|
|
442
440
|
Event: EventConsts,
|
|
443
441
|
/**
|
|
444
|
-
* Returns a promise that resolves once the SDK has finished loading (SDK_READY event emitted) or rejected if the SDK has timedout (SDK_READY_TIMED_OUT event emitted).
|
|
445
|
-
* As it's meant to provide similar flexibility to the event approach, given that the SDK might be eventually ready after a timeout event,
|
|
446
|
-
*
|
|
447
|
-
*
|
|
448
|
-
* Caveats: the method was designed to avoid an unhandled Promise rejection if the rejection case is not handled, so that `onRejected` handler is optional when using promises.
|
|
449
|
-
* However, when using async/await syntax, the rejection should be explicitly propagated like in the following example:
|
|
450
|
-
* ```
|
|
451
|
-
* try {
|
|
452
|
-
* await client.ready().catch((e) => { throw e; });
|
|
453
|
-
* // SDK is ready
|
|
454
|
-
* } catch(e) {
|
|
455
|
-
* // SDK has timedout
|
|
456
|
-
* }
|
|
457
|
-
* ```
|
|
442
|
+
* Returns a promise that resolves once the SDK has finished loading (`SDK_READY` event emitted) or rejected if the SDK has timedout (`SDK_READY_TIMED_OUT` event emitted).
|
|
443
|
+
* As it's meant to provide similar flexibility to the event approach, given that the SDK might be eventually ready after a timeout event, the `ready` method will return a resolved promise once the SDK is ready.
|
|
444
|
+
* You must handle the promise rejection to avoid an unhandled promise rejection error, or you can set the `startup.readyTimeout` configuration option to 0 to avoid the timeout and thus the rejection.
|
|
458
445
|
*
|
|
459
446
|
* @function ready
|
|
460
447
|
* @returns {Promise<void>}
|
|
@@ -501,9 +488,8 @@ interface IBasicSDK {
|
|
|
501
488
|
}
|
|
502
489
|
/****** Exposed namespace ******/
|
|
503
490
|
/**
|
|
504
|
-
* Types and interfaces for
|
|
505
|
-
* For the SDK package information
|
|
506
|
-
* @see {@link https://www.npmjs.com/package/@splitsoftware/splitio}
|
|
491
|
+
* Types and interfaces for `@splitsoftware/splitio` package for usage when integrating JavaScript SDK with TypeScript.
|
|
492
|
+
* For the SDK package information see {@link https://www.npmjs.com/package/@splitsoftware/splitio}
|
|
507
493
|
*/
|
|
508
494
|
declare namespace SplitIO {
|
|
509
495
|
/**
|
|
@@ -733,154 +719,6 @@ declare namespace SplitIO {
|
|
|
733
719
|
interface IImpressionListener {
|
|
734
720
|
logImpression(data: SplitIO.ImpressionData): void
|
|
735
721
|
}
|
|
736
|
-
/**
|
|
737
|
-
* A pair of user key and it's trafficType, required for tracking valid Split events.
|
|
738
|
-
* @typedef {Object} Identity
|
|
739
|
-
* @property {string} key The user key.
|
|
740
|
-
* @property {string} trafficType The key traffic type.
|
|
741
|
-
*/
|
|
742
|
-
type Identity = {
|
|
743
|
-
key: string;
|
|
744
|
-
trafficType: string;
|
|
745
|
-
};
|
|
746
|
-
/**
|
|
747
|
-
* Object with information about a Split event.
|
|
748
|
-
* @typedef {Object} EventData
|
|
749
|
-
*/
|
|
750
|
-
type EventData = {
|
|
751
|
-
eventTypeId: string;
|
|
752
|
-
value?: number;
|
|
753
|
-
properties?: Properties;
|
|
754
|
-
trafficTypeName?: string;
|
|
755
|
-
key?: string;
|
|
756
|
-
timestamp?: number;
|
|
757
|
-
};
|
|
758
|
-
/**
|
|
759
|
-
* Enable 'Google Analytics to Split' integration, to track Google Analytics hits as Split events.
|
|
760
|
-
*
|
|
761
|
-
* @see {@link https://help.split.io/hc/en-us/articles/360040838752#google-analytics-to-split}
|
|
762
|
-
*/
|
|
763
|
-
interface IGoogleAnalyticsToSplitConfig {
|
|
764
|
-
type: 'GOOGLE_ANALYTICS_TO_SPLIT',
|
|
765
|
-
/**
|
|
766
|
-
* Optional flag to filter GA hits from being tracked as Split events.
|
|
767
|
-
* @property {boolean} hits
|
|
768
|
-
* @default true
|
|
769
|
-
*/
|
|
770
|
-
hits?: boolean,
|
|
771
|
-
/**
|
|
772
|
-
* Optional predicate used to define a custom filter for tracking GA hits as Split events.
|
|
773
|
-
* For example, the following filter allows to track only 'event' hits:
|
|
774
|
-
* `(model) => model.get('hitType') === 'event'`
|
|
775
|
-
* By default, all hits are tracked as Split events.
|
|
776
|
-
*/
|
|
777
|
-
filter?: (model: UniversalAnalytics.Model) => boolean,
|
|
778
|
-
/**
|
|
779
|
-
* Optional function useful when you need to modify the Split event before tracking it.
|
|
780
|
-
* This function is invoked with two arguments:
|
|
781
|
-
* 1. the GA model object representing the hit.
|
|
782
|
-
* 2. the default format of the mapped Split event instance.
|
|
783
|
-
* The return value must be a Split event, that can be the second argument or a new object.
|
|
784
|
-
*
|
|
785
|
-
* For example, the following mapper adds a custom property to events:
|
|
786
|
-
* `(model, defaultMapping) => {
|
|
787
|
-
* defaultMapping.properties.someProperty = SOME_VALUE;
|
|
788
|
-
* return defaultMapping;
|
|
789
|
-
* }`
|
|
790
|
-
*/
|
|
791
|
-
mapper?: (model: UniversalAnalytics.Model, defaultMapping: SplitIO.EventData) => SplitIO.EventData,
|
|
792
|
-
/**
|
|
793
|
-
* Optional prefix for EventTypeId, to prevent any kind of data collision between events.
|
|
794
|
-
* @property {string} prefix
|
|
795
|
-
* @default 'ga'
|
|
796
|
-
*/
|
|
797
|
-
prefix?: string,
|
|
798
|
-
/**
|
|
799
|
-
* List of Split identities (key & traffic type pairs) used to track events.
|
|
800
|
-
* If not provided, events are sent using the key and traffic type provided at SDK config
|
|
801
|
-
*/
|
|
802
|
-
identities?: Identity[],
|
|
803
|
-
/**
|
|
804
|
-
* Optional flag to log an error if the `auto-require` script is not detected.
|
|
805
|
-
* The auto-require script automatically requires the `splitTracker` plugin for created trackers,
|
|
806
|
-
* and should be placed right after your Google Analytics, Google Tag Manager or gtag.js script tag.
|
|
807
|
-
*
|
|
808
|
-
* @see {@link https://help.split.io/hc/en-us/articles/360040838752#set-up-with-gtm-and-gtag.js}
|
|
809
|
-
*
|
|
810
|
-
* @property {boolean} autoRequire
|
|
811
|
-
* @default false
|
|
812
|
-
*/
|
|
813
|
-
autoRequire?: boolean,
|
|
814
|
-
}
|
|
815
|
-
/**
|
|
816
|
-
* Object representing the data sent by Split (events and impressions).
|
|
817
|
-
* @typedef {Object} IntegrationData
|
|
818
|
-
* @property {string} type The type of Split data, either 'IMPRESSION' or 'EVENT'.
|
|
819
|
-
* @property {ImpressionData | EventData} payload The data instance itself.
|
|
820
|
-
*/
|
|
821
|
-
type IntegrationData = { type: 'IMPRESSION', payload: SplitIO.ImpressionData } | { type: 'EVENT', payload: SplitIO.EventData };
|
|
822
|
-
/**
|
|
823
|
-
* Enable 'Split to Google Analytics' integration, to track Split impressions and events as Google Analytics hits.
|
|
824
|
-
*
|
|
825
|
-
* @see {@link https://help.split.io/hc/en-us/articles/360040838752#split-to-google-analytics}
|
|
826
|
-
*/
|
|
827
|
-
interface ISplitToGoogleAnalyticsConfig {
|
|
828
|
-
type: 'SPLIT_TO_GOOGLE_ANALYTICS',
|
|
829
|
-
/**
|
|
830
|
-
* Optional flag to filter Split impressions from being tracked as GA hits.
|
|
831
|
-
* @property {boolean} impressions
|
|
832
|
-
* @default true
|
|
833
|
-
*/
|
|
834
|
-
impressions?: boolean,
|
|
835
|
-
/**
|
|
836
|
-
* Optional flag to filter Split events from being tracked as GA hits.
|
|
837
|
-
* @property {boolean} events
|
|
838
|
-
* @default true
|
|
839
|
-
*/
|
|
840
|
-
events?: boolean,
|
|
841
|
-
/**
|
|
842
|
-
* Optional predicate used to define a custom filter for tracking Split data (events and impressions) as GA hits.
|
|
843
|
-
* For example, the following filter allows to track only impressions, equivalent to setting events to false:
|
|
844
|
-
* `(data) => data.type === 'IMPRESSION'`
|
|
845
|
-
*/
|
|
846
|
-
filter?: (data: SplitIO.IntegrationData) => boolean,
|
|
847
|
-
/**
|
|
848
|
-
* Optional function useful when you need to modify the GA hit before sending it.
|
|
849
|
-
* This function is invoked with two arguments:
|
|
850
|
-
* 1. the input data (Split event or impression).
|
|
851
|
-
* 2. the default format of the mapped FieldsObject instance (GA hit).
|
|
852
|
-
* The return value must be a FieldsObject, that can be the second argument or a new object.
|
|
853
|
-
*
|
|
854
|
-
* For example, the following mapper adds a custom dimension to hits:
|
|
855
|
-
* `(data, defaultMapping) => {
|
|
856
|
-
* defaultMapping.dimension1 = SOME_VALUE;
|
|
857
|
-
* return defaultMapping;
|
|
858
|
-
* }`
|
|
859
|
-
*
|
|
860
|
-
* Default FieldsObject instance for data.type === 'IMPRESSION':
|
|
861
|
-
* `{
|
|
862
|
-
* hitType: 'event',
|
|
863
|
-
* eventCategory: 'split-impression',
|
|
864
|
-
* eventAction: 'Evaluate ' + data.payload.impression.feature,
|
|
865
|
-
* eventLabel: 'Treatment: ' + data.payload.impression.treatment + '. Targeting rule: ' + data.payload.impression.label + '.',
|
|
866
|
-
* nonInteraction: true,
|
|
867
|
-
* }`
|
|
868
|
-
* Default FieldsObject instance for data.type === 'EVENT':
|
|
869
|
-
* `{
|
|
870
|
-
* hitType: 'event',
|
|
871
|
-
* eventCategory: 'split-event',
|
|
872
|
-
* eventAction: data.payload.eventTypeId,
|
|
873
|
-
* eventValue: data.payload.value,
|
|
874
|
-
* nonInteraction: true,
|
|
875
|
-
* }`
|
|
876
|
-
*/
|
|
877
|
-
mapper?: (data: SplitIO.IntegrationData, defaultMapping: UniversalAnalytics.FieldsObject) => UniversalAnalytics.FieldsObject,
|
|
878
|
-
/**
|
|
879
|
-
* List of tracker names to send the hit. An empty string represents the default tracker.
|
|
880
|
-
* If not provided, hits are only sent to default tracker.
|
|
881
|
-
*/
|
|
882
|
-
trackerNames?: string[],
|
|
883
|
-
}
|
|
884
722
|
/**
|
|
885
723
|
* Available URL settings for the SDKs.
|
|
886
724
|
*/
|
|
@@ -917,10 +755,6 @@ declare namespace SplitIO {
|
|
|
917
755
|
telemetry?: string
|
|
918
756
|
};
|
|
919
757
|
|
|
920
|
-
/**
|
|
921
|
-
* Available integration options for the browser
|
|
922
|
-
*/
|
|
923
|
-
type BrowserIntegration = ISplitToGoogleAnalyticsConfig | IGoogleAnalyticsToSplitConfig;
|
|
924
758
|
/**
|
|
925
759
|
* SplitFilter type.
|
|
926
760
|
*
|
|
@@ -954,10 +788,6 @@ declare namespace SplitIO {
|
|
|
954
788
|
* @typedef {string} ConsentStatus
|
|
955
789
|
*/
|
|
956
790
|
type ConsentStatus = 'GRANTED' | 'DECLINED' | 'UNKNOWN';
|
|
957
|
-
/**
|
|
958
|
-
* Defines the format of rollout plan data to preload on the factory storage (cache).
|
|
959
|
-
*/
|
|
960
|
-
type PreloadedData = Object;
|
|
961
791
|
/**
|
|
962
792
|
* Settings interface for SDK instances created on the browser
|
|
963
793
|
* @interface IBrowserSettings
|
|
@@ -1055,7 +885,7 @@ declare namespace SplitIO {
|
|
|
1055
885
|
eventsQueueSize?: number,
|
|
1056
886
|
/**
|
|
1057
887
|
* For mocking/testing only. The SDK will refresh the features mocked data when mode is set to "localhost" by defining the key.
|
|
1058
|
-
* For more information
|
|
888
|
+
* For more information see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#localhost-mode}
|
|
1059
889
|
* @property {number} offlineRefreshRate
|
|
1060
890
|
* @default 15
|
|
1061
891
|
*/
|
|
@@ -1074,21 +904,17 @@ declare namespace SplitIO {
|
|
|
1074
904
|
*/
|
|
1075
905
|
core: {
|
|
1076
906
|
/**
|
|
1077
|
-
* Your SDK key.
|
|
907
|
+
* Your SDK key.
|
|
908
|
+
* @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
|
|
1078
909
|
* @property {string} authorizationKey
|
|
1079
910
|
*/
|
|
1080
911
|
authorizationKey: string,
|
|
1081
912
|
/**
|
|
1082
|
-
* Customer identifier. Whatever this means to you.
|
|
913
|
+
* Customer identifier. Whatever this means to you.
|
|
914
|
+
* @see {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
|
|
1083
915
|
* @property {SplitKey} key
|
|
1084
916
|
*/
|
|
1085
917
|
key: SplitKey,
|
|
1086
|
-
/**
|
|
1087
|
-
* Traffic type associated with the customer identifier. @see {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
|
|
1088
|
-
* If no provided as a setting it will be required on the client.track() calls.
|
|
1089
|
-
* @property {string} trafficType
|
|
1090
|
-
*/
|
|
1091
|
-
trafficType?: string,
|
|
1092
918
|
/**
|
|
1093
919
|
* Disable labels from being sent to Split backend. Labels may contain sensitive information.
|
|
1094
920
|
* @property {boolean} labelsEnabled
|
|
@@ -1097,7 +923,7 @@ declare namespace SplitIO {
|
|
|
1097
923
|
labelsEnabled?: boolean
|
|
1098
924
|
},
|
|
1099
925
|
/**
|
|
1100
|
-
* Mocked features map. For testing
|
|
926
|
+
* Mocked features map. For testing purposes only. For using this you should specify "localhost" as authorizationKey on core settings.
|
|
1101
927
|
* @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#localhost-mode}
|
|
1102
928
|
*/
|
|
1103
929
|
features?: MockedFeaturesMap,
|
|
@@ -1126,11 +952,6 @@ declare namespace SplitIO {
|
|
|
1126
952
|
* @property {Object} urls
|
|
1127
953
|
*/
|
|
1128
954
|
urls?: UrlSettings,
|
|
1129
|
-
/**
|
|
1130
|
-
* SDK integration settings for the Browser.
|
|
1131
|
-
* @property {Object} integrations
|
|
1132
|
-
*/
|
|
1133
|
-
integrations?: BrowserIntegration[],
|
|
1134
955
|
/**
|
|
1135
956
|
* User consent status. Possible values are `'GRANTED'`, which is the default, `'DECLINED'` or `'UNKNOWN'`.
|
|
1136
957
|
* - `'GRANTED'`: the user grants consent for tracking events and impressions. The SDK sends them to Split cloud.
|
|
@@ -1390,11 +1211,7 @@ declare namespace SplitIO {
|
|
|
1390
1211
|
* @function manager
|
|
1391
1212
|
* @returns {IManager} The manager instance.
|
|
1392
1213
|
*/
|
|
1393
|
-
manager(): IManager
|
|
1394
|
-
/**
|
|
1395
|
-
* @TODO add description
|
|
1396
|
-
*/
|
|
1397
|
-
getState(): PreloadedData,
|
|
1214
|
+
manager(): IManager
|
|
1398
1215
|
}
|
|
1399
1216
|
/**
|
|
1400
1217
|
* This represents the interface for the SDK instance with synchronous storage.
|
|
@@ -1412,10 +1229,15 @@ declare namespace SplitIO {
|
|
|
1412
1229
|
* Returns a shared client of the SDK.
|
|
1413
1230
|
* @function client
|
|
1414
1231
|
* @param {SplitKey} key The key for the new client instance.
|
|
1415
|
-
* @param {string=} trafficType The traffic type of the provided key.
|
|
1416
1232
|
* @returns {IBrowserClient} The client instance.
|
|
1417
1233
|
*/
|
|
1418
|
-
client(key: SplitKey
|
|
1234
|
+
client(key: SplitKey): IBrowserClient
|
|
1235
|
+
/**
|
|
1236
|
+
* Returns a manager instance of the SDK to explore available information.
|
|
1237
|
+
* @function manager
|
|
1238
|
+
* @returns {IManager} The manager instance.
|
|
1239
|
+
*/
|
|
1240
|
+
manager(): IManager,
|
|
1419
1241
|
/**
|
|
1420
1242
|
* User consent API.
|
|
1421
1243
|
* @property UserConsent
|
|
@@ -1442,14 +1264,16 @@ declare namespace SplitIO {
|
|
|
1442
1264
|
manager(): IAsyncManager
|
|
1443
1265
|
}
|
|
1444
1266
|
/**
|
|
1445
|
-
* This represents the interface for the Client instance
|
|
1267
|
+
* This represents the interface for the Client instance on server-side, where the user key is not bound to the instance and must be provided on each method call.
|
|
1268
|
+
* This interface is available in NodeJS, or when importing the 'server' sub-package (e.g., `import { SplitFactory } from '@splitsoftware/splitio/server'`).
|
|
1269
|
+
*
|
|
1446
1270
|
* @interface IClient
|
|
1447
1271
|
* @extends IBasicClient
|
|
1448
1272
|
*/
|
|
1449
1273
|
interface IClient extends IBasicClient {
|
|
1450
1274
|
/**
|
|
1451
1275
|
* Returns a Treatment value, which is the treatment string for the given feature.
|
|
1452
|
-
*
|
|
1276
|
+
*
|
|
1453
1277
|
* @function getTreatment
|
|
1454
1278
|
* @param {string} key - The string key representing the consumer.
|
|
1455
1279
|
* @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
|
|
@@ -1457,18 +1281,9 @@ declare namespace SplitIO {
|
|
|
1457
1281
|
* @returns {Treatment} The treatment string.
|
|
1458
1282
|
*/
|
|
1459
1283
|
getTreatment(key: SplitKey, featureFlagName: string, attributes?: Attributes): Treatment,
|
|
1460
|
-
/**
|
|
1461
|
-
* Returns a Treatment value, which is the treatment string for the given feature.
|
|
1462
|
-
* For usage on the Browser as we defined the key on the settings.
|
|
1463
|
-
* @function getTreatment
|
|
1464
|
-
* @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
|
|
1465
|
-
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1466
|
-
* @returns {Treatment} The treatment string.
|
|
1467
|
-
*/
|
|
1468
|
-
getTreatment(featureFlagName: string, attributes?: Attributes): Treatment,
|
|
1469
1284
|
/**
|
|
1470
1285
|
* Returns a TreatmentWithConfig value, which is an object with both treatment and config string for the given feature.
|
|
1471
|
-
*
|
|
1286
|
+
*
|
|
1472
1287
|
* @function getTreatmentWithConfig
|
|
1473
1288
|
* @param {string} key - The string key representing the consumer.
|
|
1474
1289
|
* @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
|
|
@@ -1477,20 +1292,9 @@ declare namespace SplitIO {
|
|
|
1477
1292
|
* configuration stringified JSON (or null if there was no config for that treatment).
|
|
1478
1293
|
*/
|
|
1479
1294
|
getTreatmentWithConfig(key: SplitKey, featureFlagName: string, attributes?: Attributes): TreatmentWithConfig,
|
|
1480
|
-
/**
|
|
1481
|
-
* Returns a TreatmentWithConfig value, which an object with both treatment and config string for the given feature.
|
|
1482
|
-
* For usage on the Browser as we defined the key on the settings.
|
|
1483
|
-
* @function getTreatmentWithConfig
|
|
1484
|
-
* @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
|
|
1485
|
-
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1486
|
-
* @returns {TreatmentWithConfig} The TreatmentWithConfig, the object containing the treatment string and the
|
|
1487
|
-
* configuration stringified JSON (or null if there was no config for that treatment).
|
|
1488
|
-
*/
|
|
1489
|
-
getTreatmentWithConfig(featureFlagName: string, attributes?: Attributes): TreatmentWithConfig,
|
|
1490
1295
|
/**
|
|
1491
1296
|
* Returns a Treatments value, which is an object map with the treatments for the given features.
|
|
1492
|
-
*
|
|
1493
|
-
* NOTE: Treatment will be a promise only in async storages, like REDIS.
|
|
1297
|
+
*
|
|
1494
1298
|
* @function getTreatments
|
|
1495
1299
|
* @param {string} key - The string key representing the consumer.
|
|
1496
1300
|
* @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
|
|
@@ -1498,19 +1302,9 @@ declare namespace SplitIO {
|
|
|
1498
1302
|
* @returns {Treatments} The treatments object map.
|
|
1499
1303
|
*/
|
|
1500
1304
|
getTreatments(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): Treatments,
|
|
1501
|
-
/**
|
|
1502
|
-
* Returns a Treatments value, which is an object map with the treatments for the given features.
|
|
1503
|
-
* For usage on the Browser as we defined the key on the settings.
|
|
1504
|
-
* NOTE: Treatment will be a promise only in async storages, like REDIS.
|
|
1505
|
-
* @function getTreatments
|
|
1506
|
-
* @param {Array<string>} featureFlagNames - An array of the feature flags names we want to get the treatments.
|
|
1507
|
-
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1508
|
-
* @returns {Treatments} The treatments object map.
|
|
1509
|
-
*/
|
|
1510
|
-
getTreatments(featureFlagNames: string[], attributes?: Attributes): Treatments,
|
|
1511
1305
|
/**
|
|
1512
1306
|
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
|
|
1513
|
-
*
|
|
1307
|
+
*
|
|
1514
1308
|
* @function getTreatmentsWithConfig
|
|
1515
1309
|
* @param {string} key - The string key representing the consumer.
|
|
1516
1310
|
* @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
|
|
@@ -1518,17 +1312,9 @@ declare namespace SplitIO {
|
|
|
1518
1312
|
* @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
|
|
1519
1313
|
*/
|
|
1520
1314
|
getTreatmentsWithConfig(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig,
|
|
1521
|
-
/**
|
|
1522
|
-
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
|
|
1523
|
-
* For usage on the Browser as we defined the key on the settings.
|
|
1524
|
-
* @function getTreatmentsWithConfig
|
|
1525
|
-
* @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
|
|
1526
|
-
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1527
|
-
* @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
|
|
1528
|
-
*/
|
|
1529
|
-
getTreatmentsWithConfig(featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig,
|
|
1530
1315
|
/**
|
|
1531
1316
|
* Returns a Treatments value, which is an object map with the treatments for the feature flags related to the given flag set.
|
|
1317
|
+
*
|
|
1532
1318
|
* @function getTreatmentsByFlagSet
|
|
1533
1319
|
* @param {string} key - The string key representing the consumer.
|
|
1534
1320
|
* @param {string} flagSet - The flag set name we want to get the treatments.
|
|
@@ -1536,16 +1322,9 @@ declare namespace SplitIO {
|
|
|
1536
1322
|
* @returns {Treatments} The map with all the Treatments objects
|
|
1537
1323
|
*/
|
|
1538
1324
|
getTreatmentsByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): Treatments,
|
|
1539
|
-
/**
|
|
1540
|
-
* Returns a Treatments value, which is an object map with the treatments for the feature flags related to the given flag set.
|
|
1541
|
-
* @function getTreatmentsByFlagSet
|
|
1542
|
-
* @param {string} flagSet - The flag set name we want to get the treatments.
|
|
1543
|
-
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1544
|
-
* @returns {Treatments} The map with all the Treatments objects
|
|
1545
|
-
*/
|
|
1546
|
-
getTreatmentsByFlagSet(flagSet: string, attributes?: Attributes): Treatments,
|
|
1547
1325
|
/**
|
|
1548
1326
|
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag set.
|
|
1327
|
+
*
|
|
1549
1328
|
* @function getTreatmentsWithConfigByFlagSet
|
|
1550
1329
|
* @param {string} key - The string key representing the consumer.
|
|
1551
1330
|
* @param {string} flagSet - The flag set name we want to get the treatments.
|
|
@@ -1553,16 +1332,9 @@ declare namespace SplitIO {
|
|
|
1553
1332
|
* @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
|
|
1554
1333
|
*/
|
|
1555
1334
|
getTreatmentsWithConfigByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): TreatmentsWithConfig,
|
|
1556
|
-
/**
|
|
1557
|
-
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag set.
|
|
1558
|
-
* @function getTreatmentsWithConfigByFlagSet
|
|
1559
|
-
* @param {string} flagSet - The flag set name we want to get the treatments.
|
|
1560
|
-
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1561
|
-
* @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
|
|
1562
|
-
*/
|
|
1563
|
-
getTreatmentsWithConfigByFlagSet(flagSet: string, attributes?: Attributes): TreatmentsWithConfig,
|
|
1564
1335
|
/**
|
|
1565
1336
|
* Returns a Returns a Treatments value, which is an object with both treatment and config string for to the feature flags related to the given flag sets.
|
|
1337
|
+
*
|
|
1566
1338
|
* @function getTreatmentsByFlagSets
|
|
1567
1339
|
* @param {string} key - The string key representing the consumer.
|
|
1568
1340
|
* @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
|
|
@@ -1570,16 +1342,9 @@ declare namespace SplitIO {
|
|
|
1570
1342
|
* @returns {Treatments} The map with all the Treatments objects
|
|
1571
1343
|
*/
|
|
1572
1344
|
getTreatmentsByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): Treatments,
|
|
1573
|
-
/**
|
|
1574
|
-
* Returns a Returns a Treatments value, which is an object with both treatment and config string for to the feature flags related to the given flag sets.
|
|
1575
|
-
* @function getTreatmentsByFlagSets
|
|
1576
|
-
* @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
|
|
1577
|
-
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1578
|
-
* @returns {Treatments} The map with all the Treatments objects
|
|
1579
|
-
*/
|
|
1580
|
-
getTreatmentsByFlagSets(flagSets: string[], attributes?: Attributes): Treatments,
|
|
1581
1345
|
/**
|
|
1582
1346
|
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag sets.
|
|
1347
|
+
*
|
|
1583
1348
|
* @function getTreatmentsWithConfigByFlagSets
|
|
1584
1349
|
* @param {string} key - The string key representing the consumer.
|
|
1585
1350
|
* @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
|
|
@@ -1587,54 +1352,111 @@ declare namespace SplitIO {
|
|
|
1587
1352
|
* @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
|
|
1588
1353
|
*/
|
|
1589
1354
|
getTreatmentsWithConfigByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): TreatmentsWithConfig,
|
|
1590
|
-
/**
|
|
1591
|
-
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag sets.
|
|
1592
|
-
* @function getTreatmentsWithConfigByFlagSets
|
|
1593
|
-
* @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
|
|
1594
|
-
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1595
|
-
* @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
|
|
1596
|
-
*/
|
|
1597
|
-
getTreatmentsWithConfigByFlagSets(flagSets: string[], attributes?: Attributes): TreatmentsWithConfig,
|
|
1598
1355
|
/**
|
|
1599
1356
|
* Tracks an event to be fed to the results product on Split user interface.
|
|
1600
|
-
*
|
|
1357
|
+
*
|
|
1601
1358
|
* @function track
|
|
1602
1359
|
* @param {SplitKey} key - The key that identifies the entity related to this event.
|
|
1603
|
-
* @param {string} trafficType - The traffic type of the entity related to this event.
|
|
1360
|
+
* @param {string} trafficType - The traffic type of the entity related to this event. See {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
|
|
1604
1361
|
* @param {string} eventType - The event type corresponding to this event.
|
|
1605
1362
|
* @param {number=} value - The value of this event.
|
|
1606
1363
|
* @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
|
|
1607
1364
|
* @returns {boolean} Whether the event was added to the queue successfully or not.
|
|
1608
1365
|
*/
|
|
1609
1366
|
track(key: SplitIO.SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): boolean,
|
|
1367
|
+
}
|
|
1368
|
+
/**
|
|
1369
|
+
* This represents the interface for the Client instance on client-side, where the user key is bound to the instance on creation and does not need to be provided on each method call.
|
|
1370
|
+
* This interface is the default when importing the SDK in the Browser, or when importing the 'client' sub-package (e.g., `import { SplitFactory } from '@splitsoftware/splitio/client'`).
|
|
1371
|
+
*
|
|
1372
|
+
* @interface IBrowserClient
|
|
1373
|
+
* @extends IBasicClient
|
|
1374
|
+
*/
|
|
1375
|
+
interface IBrowserClient extends IBasicClient {
|
|
1610
1376
|
/**
|
|
1611
|
-
*
|
|
1612
|
-
*
|
|
1613
|
-
* @function
|
|
1614
|
-
* @param {string}
|
|
1615
|
-
* @param {
|
|
1616
|
-
* @
|
|
1617
|
-
* @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
|
|
1618
|
-
* @returns {boolean} Whether the event was added to the queue successfully or not.
|
|
1377
|
+
* Returns a Treatment value, which is the treatment string for the given feature.
|
|
1378
|
+
*
|
|
1379
|
+
* @function getTreatment
|
|
1380
|
+
* @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
|
|
1381
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1382
|
+
* @returns {Treatment} The treatment string.
|
|
1619
1383
|
*/
|
|
1620
|
-
|
|
1384
|
+
getTreatment(featureFlagName: string, attributes?: Attributes): Treatment,
|
|
1385
|
+
/**
|
|
1386
|
+
* Returns a TreatmentWithConfig value, which an object with both treatment and config string for the given feature.
|
|
1387
|
+
*
|
|
1388
|
+
* @function getTreatmentWithConfig
|
|
1389
|
+
* @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
|
|
1390
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1391
|
+
* @returns {TreatmentWithConfig} The TreatmentWithConfig, the object containing the treatment string and the
|
|
1392
|
+
* configuration stringified JSON (or null if there was no config for that treatment).
|
|
1393
|
+
*/
|
|
1394
|
+
getTreatmentWithConfig(featureFlagName: string, attributes?: Attributes): TreatmentWithConfig,
|
|
1395
|
+
/**
|
|
1396
|
+
* Returns a Treatments value, which is an object map with the treatments for the given features.
|
|
1397
|
+
*
|
|
1398
|
+
* @function getTreatments
|
|
1399
|
+
* @param {Array<string>} featureFlagNames - An array of the feature flags names we want to get the treatments.
|
|
1400
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1401
|
+
* @returns {Treatments} The treatments object map.
|
|
1402
|
+
*/
|
|
1403
|
+
getTreatments(featureFlagNames: string[], attributes?: Attributes): Treatments,
|
|
1404
|
+
/**
|
|
1405
|
+
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
|
|
1406
|
+
*
|
|
1407
|
+
* @function getTreatmentsWithConfig
|
|
1408
|
+
* @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
|
|
1409
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1410
|
+
* @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
|
|
1411
|
+
*/
|
|
1412
|
+
getTreatmentsWithConfig(featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig,
|
|
1413
|
+
/**
|
|
1414
|
+
* Returns a Treatments value, which is an object map with the treatments for the feature flags related to the given flag set.
|
|
1415
|
+
*
|
|
1416
|
+
* @function getTreatmentsByFlagSet
|
|
1417
|
+
* @param {string} flagSet - The flag set name we want to get the treatments.
|
|
1418
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1419
|
+
* @returns {Treatments} The map with all the Treatments objects
|
|
1420
|
+
*/
|
|
1421
|
+
getTreatmentsByFlagSet(flagSet: string, attributes?: Attributes): Treatments,
|
|
1422
|
+
/**
|
|
1423
|
+
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag set.
|
|
1424
|
+
*
|
|
1425
|
+
* @function getTreatmentsWithConfigByFlagSet
|
|
1426
|
+
* @param {string} flagSet - The flag set name we want to get the treatments.
|
|
1427
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1428
|
+
* @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
|
|
1429
|
+
*/
|
|
1430
|
+
getTreatmentsWithConfigByFlagSet(flagSet: string, attributes?: Attributes): TreatmentsWithConfig,
|
|
1431
|
+
/**
|
|
1432
|
+
* Returns a Returns a Treatments value, which is an object with both treatment and config string for to the feature flags related to the given flag sets.
|
|
1433
|
+
*
|
|
1434
|
+
* @function getTreatmentsByFlagSets
|
|
1435
|
+
* @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
|
|
1436
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1437
|
+
* @returns {Treatments} The map with all the Treatments objects
|
|
1438
|
+
*/
|
|
1439
|
+
getTreatmentsByFlagSets(flagSets: string[], attributes?: Attributes): Treatments,
|
|
1440
|
+
/**
|
|
1441
|
+
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag sets.
|
|
1442
|
+
*
|
|
1443
|
+
* @function getTreatmentsWithConfigByFlagSets
|
|
1444
|
+
* @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
|
|
1445
|
+
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1446
|
+
* @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
|
|
1447
|
+
*/
|
|
1448
|
+
getTreatmentsWithConfigByFlagSets(flagSets: string[], attributes?: Attributes): TreatmentsWithConfig,
|
|
1621
1449
|
/**
|
|
1622
1450
|
* Tracks an event to be fed to the results product on Split user interface.
|
|
1623
|
-
*
|
|
1451
|
+
*
|
|
1624
1452
|
* @function track
|
|
1453
|
+
* @param {string} trafficType - The traffic type of the entity related to this event. See {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
|
|
1625
1454
|
* @param {string} eventType - The event type corresponding to this event.
|
|
1626
1455
|
* @param {number=} value - The value of this event.
|
|
1627
1456
|
* @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
|
|
1628
1457
|
* @returns {boolean} Whether the event was added to the queue successfully or not.
|
|
1629
1458
|
*/
|
|
1630
|
-
track(eventType: string, value?: number, properties?: Properties): boolean
|
|
1631
|
-
}
|
|
1632
|
-
/**
|
|
1633
|
-
* This represents the interface for the Client instance with attributes binding.
|
|
1634
|
-
* @interface IBrowserClient
|
|
1635
|
-
* @Extends IClient
|
|
1636
|
-
*/
|
|
1637
|
-
interface IBrowserClient extends IClient {
|
|
1459
|
+
track(trafficType: string, eventType: string, value?: number, properties?: Properties): boolean,
|
|
1638
1460
|
/**
|
|
1639
1461
|
* Add an attribute to client's in memory attributes storage.
|
|
1640
1462
|
*
|
|
@@ -1678,15 +1500,17 @@ declare namespace SplitIO {
|
|
|
1678
1500
|
clearAttributes(): boolean
|
|
1679
1501
|
}
|
|
1680
1502
|
/**
|
|
1681
|
-
* This represents the interface for the Client instance with asynchronous storage.
|
|
1503
|
+
* This represents the interface for the Client instance on server-side with asynchronous storage, like REDIS.
|
|
1504
|
+
* User key is not bound to the instance and must be provided on each method call, which returns a promise.
|
|
1505
|
+
* This interface is available in NodeJS, or when importing the 'server' sub-package (e.g., `import { SplitFactory } from '@splitsoftware/splitio/server'`).
|
|
1506
|
+
*
|
|
1682
1507
|
* @interface IAsyncClient
|
|
1683
1508
|
* @extends IBasicClient
|
|
1684
1509
|
*/
|
|
1685
1510
|
interface IAsyncClient extends IBasicClient {
|
|
1686
1511
|
/**
|
|
1687
1512
|
* Returns a Treatment value, which will be (or eventually be) the treatment string for the given feature.
|
|
1688
|
-
*
|
|
1689
|
-
* NOTE: Treatment will be a promise only in async storages, like REDIS.
|
|
1513
|
+
*
|
|
1690
1514
|
* @function getTreatment
|
|
1691
1515
|
* @param {string} key - The string key representing the consumer.
|
|
1692
1516
|
* @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
|
|
@@ -1696,8 +1520,7 @@ declare namespace SplitIO {
|
|
|
1696
1520
|
getTreatment(key: SplitKey, featureFlagName: string, attributes?: Attributes): AsyncTreatment,
|
|
1697
1521
|
/**
|
|
1698
1522
|
* Returns a TreatmentWithConfig value, which will be (or eventually be) an object with both treatment and config string for the given feature.
|
|
1699
|
-
*
|
|
1700
|
-
* NOTE: Treatment will be a promise only in async storages, like REDIS.
|
|
1523
|
+
*
|
|
1701
1524
|
* @function getTreatmentWithConfig
|
|
1702
1525
|
* @param {string} key - The string key representing the consumer.
|
|
1703
1526
|
* @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
|
|
@@ -1707,7 +1530,7 @@ declare namespace SplitIO {
|
|
|
1707
1530
|
getTreatmentWithConfig(key: SplitKey, featureFlagName: string, attributes?: Attributes): AsyncTreatmentWithConfig,
|
|
1708
1531
|
/**
|
|
1709
1532
|
* Returns a Treatments value, which will be (or eventually be) an object map with the treatments for the given features.
|
|
1710
|
-
*
|
|
1533
|
+
*
|
|
1711
1534
|
* @function getTreatments
|
|
1712
1535
|
* @param {string} key - The string key representing the consumer.
|
|
1713
1536
|
* @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
|
|
@@ -1717,7 +1540,7 @@ declare namespace SplitIO {
|
|
|
1717
1540
|
getTreatments(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): AsyncTreatments,
|
|
1718
1541
|
/**
|
|
1719
1542
|
* Returns a TreatmentsWithConfig value, which will be (or eventually be) an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
|
|
1720
|
-
*
|
|
1543
|
+
*
|
|
1721
1544
|
* @function getTreatmentsWithConfig
|
|
1722
1545
|
* @param {string} key - The string key representing the consumer.
|
|
1723
1546
|
* @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
|
|
@@ -1727,7 +1550,7 @@ declare namespace SplitIO {
|
|
|
1727
1550
|
getTreatmentsWithConfig(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): AsyncTreatmentsWithConfig,
|
|
1728
1551
|
/**
|
|
1729
1552
|
* Returns a Treatments value, which is an object map with the treatments for the feature flags related to the given flag set.
|
|
1730
|
-
*
|
|
1553
|
+
*
|
|
1731
1554
|
* @function getTreatmentsByFlagSet
|
|
1732
1555
|
* @param {string} key - The string key representing the consumer.
|
|
1733
1556
|
* @param {string} flagSet - The flag set name we want to get the treatments.
|
|
@@ -1737,7 +1560,7 @@ declare namespace SplitIO {
|
|
|
1737
1560
|
getTreatmentsByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): AsyncTreatments,
|
|
1738
1561
|
/**
|
|
1739
1562
|
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag set.
|
|
1740
|
-
*
|
|
1563
|
+
*
|
|
1741
1564
|
* @function getTreatmentsWithConfigByFlagSet
|
|
1742
1565
|
* @param {string} flagSet - The flag set name we want to get the treatments.
|
|
1743
1566
|
* @param {string} key - The string key representing the consumer.
|
|
@@ -1747,7 +1570,7 @@ declare namespace SplitIO {
|
|
|
1747
1570
|
getTreatmentsWithConfigByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): AsyncTreatmentsWithConfig,
|
|
1748
1571
|
/**
|
|
1749
1572
|
* Returns a Returns a Treatments value, which is an object with both treatment and config string for to the feature flags related to the given flag sets.
|
|
1750
|
-
*
|
|
1573
|
+
*
|
|
1751
1574
|
* @function getTreatmentsByFlagSets
|
|
1752
1575
|
* @param {string} key - The string key representing the consumer.
|
|
1753
1576
|
* @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
|
|
@@ -1757,7 +1580,7 @@ declare namespace SplitIO {
|
|
|
1757
1580
|
getTreatmentsByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): AsyncTreatments,
|
|
1758
1581
|
/**
|
|
1759
1582
|
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag sets.
|
|
1760
|
-
*
|
|
1583
|
+
*
|
|
1761
1584
|
* @function getTreatmentsWithConfigByFlagSets
|
|
1762
1585
|
* @param {string} key - The string key representing the consumer.
|
|
1763
1586
|
* @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
|
|
@@ -1767,9 +1590,10 @@ declare namespace SplitIO {
|
|
|
1767
1590
|
getTreatmentsWithConfigByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): AsyncTreatmentsWithConfig,
|
|
1768
1591
|
/**
|
|
1769
1592
|
* Tracks an event to be fed to the results product on Split user interface, and returns a promise to signal when the event was successfully queued (or not).
|
|
1593
|
+
*
|
|
1770
1594
|
* @function track
|
|
1771
1595
|
* @param {SplitKey} key - The key that identifies the entity related to this event.
|
|
1772
|
-
* @param {string} trafficType - The traffic type of the entity related to this event.
|
|
1596
|
+
* @param {string} trafficType - The traffic type of the entity related to this event. See {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
|
|
1773
1597
|
* @param {string} eventType - The event type corresponding to this event.
|
|
1774
1598
|
* @param {number=} value - The value of this event.
|
|
1775
1599
|
* @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
|