@splitsoftware/splitio 10.22.3 → 10.22.5-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 +32 -20
- package/CONTRIBUTORS-GUIDE.md +2 -2
- package/LICENSE +1 -1
- package/README.md +6 -6
- package/es/index.js +0 -15
- package/es/settings/defaults/version.js +1 -1
- package/es/sync/offline/splitsParserFromFile.js +27 -26
- package/lib/index.js +0 -15
- package/lib/settings/defaults/version.js +1 -1
- package/lib/sync/offline/splitsParserFromFile.js +27 -26
- package/package.json +7 -2
- package/src/index.js +0 -16
- package/src/platform/EventEmitter.js +95 -95
- package/src/settings/defaults/version.js +1 -1
- package/src/sync/offline/splitsParserFromFile.js +27 -26
- package/types/client/index.d.ts +1 -1
- package/types/index.d.ts +1 -1
- package/types/server/index.d.ts +1 -1
- package/types/splitio.d.ts +104 -98
package/types/splitio.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for
|
|
1
|
+
// Type definitions for JavaScript and NodeJS Split Software SDK
|
|
2
2
|
// Project: http://www.split.io/
|
|
3
3
|
// Definitions by: Nico Zelaya <https://github.com/NicoZelaya/>
|
|
4
4
|
|
|
@@ -214,24 +214,24 @@ interface ISharedSettings {
|
|
|
214
214
|
*/
|
|
215
215
|
sync?: {
|
|
216
216
|
/**
|
|
217
|
-
* List of
|
|
217
|
+
* 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.
|
|
218
218
|
* This configuration is only meaningful when the SDK is working in "standalone" mode.
|
|
219
219
|
*
|
|
220
|
-
* At the moment,
|
|
220
|
+
* At the moment, only one type of feature flag filter is supported: by name.
|
|
221
|
+
*
|
|
221
222
|
* Example:
|
|
222
223
|
* `splitFilter: [
|
|
223
|
-
* { type: 'byName', values: ['
|
|
224
|
-
* { type: 'byPrefix', values: ['testing'] } // will fetch splits whose names start with 'testing__' prefix
|
|
224
|
+
* { type: 'byName', values: ['my_feature_flag_1', 'my_feature_flag_2'] }, // will fetch feature flags named 'my_feature_flag_1' and 'my_feature_flag_2'
|
|
225
225
|
* ]`
|
|
226
226
|
* @property {SplitIO.SplitFilter[]} splitFilters
|
|
227
227
|
*/
|
|
228
228
|
splitFilters?: SplitIO.SplitFilter[]
|
|
229
229
|
/**
|
|
230
|
-
* Impressions Collection Mode. Option to determine how impressions are going to be sent to Split
|
|
230
|
+
* Impressions Collection Mode. Option to determine how impressions are going to be sent to Split servers.
|
|
231
231
|
* Possible values are 'DEBUG', 'OPTIMIZED', and 'NONE'.
|
|
232
232
|
* - DEBUG: will send all the impressions generated (recommended only for debugging purposes).
|
|
233
|
-
* - OPTIMIZED: will send unique impressions to Split
|
|
234
|
-
* - NONE: will send unique keys evaluated per feature to Split
|
|
233
|
+
* - OPTIMIZED: will send unique impressions to Split servers, avoiding a considerable amount of traffic that duplicated impressions could generate.
|
|
234
|
+
* - NONE: will send unique keys evaluated per feature to Split servers instead of full blown impressions, avoiding a considerable amount of traffic that impressions could generate.
|
|
235
235
|
*
|
|
236
236
|
* @property {string} impressionsMode
|
|
237
237
|
* @default 'OPTIMIZED'
|
|
@@ -293,7 +293,7 @@ interface INodeBasicSettings extends ISharedSettings {
|
|
|
293
293
|
*/
|
|
294
294
|
scheduler?: {
|
|
295
295
|
/**
|
|
296
|
-
* The SDK polls Split servers for changes to feature
|
|
296
|
+
* The SDK polls Split servers for changes to feature flag definitions. This parameter controls this polling period in seconds.
|
|
297
297
|
* @property {number} featuresRefreshRate
|
|
298
298
|
* @default 60
|
|
299
299
|
*/
|
|
@@ -364,7 +364,7 @@ interface INodeBasicSettings extends ISharedSettings {
|
|
|
364
364
|
*/
|
|
365
365
|
core: {
|
|
366
366
|
/**
|
|
367
|
-
* Your
|
|
367
|
+
* Your SDK key. More information: @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
|
|
368
368
|
* @property {string} authorizationKey
|
|
369
369
|
*/
|
|
370
370
|
authorizationKey: string,
|
|
@@ -389,7 +389,7 @@ interface INodeBasicSettings extends ISharedSettings {
|
|
|
389
389
|
/**
|
|
390
390
|
* Storage type to be instantiated by the SDK.
|
|
391
391
|
* @property {StorageType} type
|
|
392
|
-
* @default MEMORY
|
|
392
|
+
* @default 'MEMORY'
|
|
393
393
|
*/
|
|
394
394
|
type?: StorageType,
|
|
395
395
|
/**
|
|
@@ -400,7 +400,7 @@ interface INodeBasicSettings extends ISharedSettings {
|
|
|
400
400
|
/**
|
|
401
401
|
* Optional prefix to prevent any kind of data collision between SDK versions.
|
|
402
402
|
* @property {string} prefix
|
|
403
|
-
* @default SPLITIO
|
|
403
|
+
* @default 'SPLITIO'
|
|
404
404
|
*/
|
|
405
405
|
prefix?: string
|
|
406
406
|
},
|
|
@@ -408,14 +408,14 @@ interface INodeBasicSettings extends ISharedSettings {
|
|
|
408
408
|
* The SDK mode. Possible values are "standalone", which is the default when using a synchronous storage, like 'MEMORY' and 'LOCALSTORAGE',
|
|
409
409
|
* and "consumer", which must be set when using an asynchronous storage, like 'REDIS'. For "localhost" mode, use "localhost" as authorizationKey.
|
|
410
410
|
* @property {SDKMode} mode
|
|
411
|
-
* @default standalone
|
|
411
|
+
* @default 'standalone'
|
|
412
412
|
*/
|
|
413
413
|
mode?: SDKMode,
|
|
414
414
|
/**
|
|
415
415
|
* Mocked features file path. For testing purposses only. For using this you should specify "localhost" as authorizationKey on core settings.
|
|
416
416
|
* @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#localhost-mode}
|
|
417
417
|
* @property {MockedFeaturesFilePath} features
|
|
418
|
-
* @default $HOME/.split
|
|
418
|
+
* @default '$HOME/.split'
|
|
419
419
|
*/
|
|
420
420
|
features?: SplitIO.MockedFeaturesFilePath,
|
|
421
421
|
}
|
|
@@ -431,7 +431,7 @@ interface IStatusInterface extends EventEmitter {
|
|
|
431
431
|
*/
|
|
432
432
|
Event: EventConsts,
|
|
433
433
|
/**
|
|
434
|
-
* Returns a promise that
|
|
434
|
+
* 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).
|
|
435
435
|
* As it's meant to provide similar flexibility to the event approach, given that the SDK might be eventually ready after a timeout event, calling the `ready` method after the
|
|
436
436
|
* SDK had timed out will return a new promise that should eventually resolve if the SDK gets ready.
|
|
437
437
|
*
|
|
@@ -458,9 +458,12 @@ interface IStatusInterface extends EventEmitter {
|
|
|
458
458
|
*/
|
|
459
459
|
interface IBasicClient extends IStatusInterface {
|
|
460
460
|
/**
|
|
461
|
-
*
|
|
461
|
+
* Destroys the client instance.
|
|
462
|
+
* In 'standalone' mode, this method will flush any pending impressions and events, and stop the synchronization of feature flag definitions with the backend.
|
|
463
|
+
* In 'consumer' mode, this method will disconnect the SDK from the Redis or Pluggable storage.
|
|
464
|
+
*
|
|
462
465
|
* @function destroy
|
|
463
|
-
* @returns {Promise<void>}
|
|
466
|
+
* @returns {Promise<void>} A promise that resolves once the client is destroyed.
|
|
464
467
|
*/
|
|
465
468
|
destroy(): Promise<void>
|
|
466
469
|
}
|
|
@@ -488,17 +491,17 @@ interface IBasicSDK {
|
|
|
488
491
|
*/
|
|
489
492
|
declare namespace SplitIO {
|
|
490
493
|
/**
|
|
491
|
-
*
|
|
494
|
+
* Feature flag treatment value, returned by getTreatment.
|
|
492
495
|
* @typedef {string} Treatment
|
|
493
496
|
*/
|
|
494
497
|
type Treatment = string;
|
|
495
498
|
/**
|
|
496
|
-
*
|
|
499
|
+
* Feature flag treatment promise that resolves to actual treatment value.
|
|
497
500
|
* @typedef {Promise<string>} AsyncTreatment
|
|
498
501
|
*/
|
|
499
502
|
type AsyncTreatment = Promise<string>;
|
|
500
503
|
/**
|
|
501
|
-
* An object with the treatments for a bulk of
|
|
504
|
+
* An object with the treatments for a bulk of feature flags, returned by getTreatments. For example:
|
|
502
505
|
* {
|
|
503
506
|
* feature1: 'on',
|
|
504
507
|
* feature2: 'off
|
|
@@ -509,14 +512,14 @@ declare namespace SplitIO {
|
|
|
509
512
|
[featureName: string]: Treatment
|
|
510
513
|
};
|
|
511
514
|
/**
|
|
512
|
-
*
|
|
515
|
+
* Feature flag treatments promise that resolves to the actual SplitIO.Treatments object.
|
|
513
516
|
* @typedef {Promise<Treatments>} AsyncTreatments
|
|
514
517
|
*/
|
|
515
518
|
type AsyncTreatments = Promise<Treatments>;
|
|
516
519
|
/**
|
|
517
|
-
*
|
|
520
|
+
* Feature flag evaluation result with treatment and configuration, returned by getTreatmentWithConfig.
|
|
518
521
|
* @typedef {Object} TreatmentWithConfig
|
|
519
|
-
* @property {string} treatment The treatment
|
|
522
|
+
* @property {string} treatment The treatment string
|
|
520
523
|
* @property {string | null} config The stringified version of the JSON config defined for that treatment, null if there is no config for the resulting treatment.
|
|
521
524
|
*/
|
|
522
525
|
type TreatmentWithConfig = {
|
|
@@ -524,13 +527,13 @@ declare namespace SplitIO {
|
|
|
524
527
|
config: string | null
|
|
525
528
|
};
|
|
526
529
|
/**
|
|
527
|
-
*
|
|
530
|
+
* Feature flag treatment promise that resolves to actual treatment with config value.
|
|
528
531
|
* @typedef {Promise<TreatmentWithConfig>} AsyncTreatmentWithConfig
|
|
529
532
|
*/
|
|
530
533
|
type AsyncTreatmentWithConfig = Promise<TreatmentWithConfig>;
|
|
531
534
|
/**
|
|
532
|
-
* An object with the treatments with configs for a bulk of
|
|
533
|
-
* Each existing configuration is a stringified version of the JSON you defined on the Split
|
|
535
|
+
* An object with the treatments with configs for a bulk of feature flags, returned by getTreatmentsWithConfig.
|
|
536
|
+
* Each existing configuration is a stringified version of the JSON you defined on the Split user interface. For example:
|
|
534
537
|
* {
|
|
535
538
|
* feature1: { treatment: 'on', config: null }
|
|
536
539
|
* feature2: { treatment: 'off', config: '{"bannerText":"Click here."}' }
|
|
@@ -541,7 +544,7 @@ declare namespace SplitIO {
|
|
|
541
544
|
[featureName: string]: TreatmentWithConfig
|
|
542
545
|
};
|
|
543
546
|
/**
|
|
544
|
-
*
|
|
547
|
+
* Feature flag treatments promise that resolves to the actual SplitIO.TreatmentsWithConfig object.
|
|
545
548
|
* @typedef {Promise<TreatmentsWithConfig>} AsyncTreatmentsWithConfig
|
|
546
549
|
*/
|
|
547
550
|
type AsyncTreatmentsWithConfig = Promise<TreatmentsWithConfig>;
|
|
@@ -551,7 +554,7 @@ declare namespace SplitIO {
|
|
|
551
554
|
*/
|
|
552
555
|
type Event = 'init::timeout' | 'init::ready' | 'init::cache-ready' | 'state::update';
|
|
553
556
|
/**
|
|
554
|
-
*
|
|
557
|
+
* Attributes should be on object with values of type string, boolean, number (dates should be sent as millis since epoch) or array of strings or numbers.
|
|
555
558
|
* @typedef {Object.<AttributeType>} Attributes
|
|
556
559
|
* @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#attribute-syntax}
|
|
557
560
|
*/
|
|
@@ -564,7 +567,7 @@ declare namespace SplitIO {
|
|
|
564
567
|
*/
|
|
565
568
|
type AttributeType = string | number | boolean | Array<string | number>;
|
|
566
569
|
/**
|
|
567
|
-
*
|
|
570
|
+
* Properties should be an object with values of type string, number, boolean or null. Size limit of ~31kb.
|
|
568
571
|
* @typedef {Object.<number, string, boolean, null>} Properties
|
|
569
572
|
* @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#track
|
|
570
573
|
*/
|
|
@@ -618,38 +621,38 @@ declare namespace SplitIO {
|
|
|
618
621
|
sdkLanguageVersion: string
|
|
619
622
|
};
|
|
620
623
|
/**
|
|
621
|
-
* Data corresponding to one
|
|
624
|
+
* Data corresponding to one feature flag view.
|
|
622
625
|
* @typedef {Object} SplitView
|
|
623
626
|
*/
|
|
624
627
|
type SplitView = {
|
|
625
628
|
/**
|
|
626
|
-
* The name of the
|
|
629
|
+
* The name of the feature flag.
|
|
627
630
|
* @property {string} name
|
|
628
631
|
*/
|
|
629
632
|
name: string,
|
|
630
633
|
/**
|
|
631
|
-
* The traffic type of the
|
|
634
|
+
* The traffic type of the feature flag.
|
|
632
635
|
* @property {string} trafficType
|
|
633
636
|
*/
|
|
634
637
|
trafficType: string,
|
|
635
638
|
/**
|
|
636
|
-
* Whether the
|
|
639
|
+
* Whether the feature flag is killed or not.
|
|
637
640
|
* @property {boolean} killed
|
|
638
641
|
*/
|
|
639
642
|
killed: boolean,
|
|
640
643
|
/**
|
|
641
|
-
* The list of treatments available for the
|
|
644
|
+
* The list of treatments available for the feature flag.
|
|
642
645
|
* @property {Array<string>} treatments
|
|
643
646
|
*/
|
|
644
647
|
treatments: Array<string>,
|
|
645
648
|
/**
|
|
646
|
-
* Current change number of the
|
|
649
|
+
* Current change number of the feature flag.
|
|
647
650
|
* @property {number} changeNumber
|
|
648
651
|
*/
|
|
649
652
|
changeNumber: number,
|
|
650
653
|
/**
|
|
651
654
|
* Map of configurations per treatment.
|
|
652
|
-
* Each existing configuration is a stringified version of the JSON you defined on the Split
|
|
655
|
+
* Each existing configuration is a stringified version of the JSON you defined on the Split user interface.
|
|
653
656
|
* @property {Object.<string>} configs
|
|
654
657
|
*/
|
|
655
658
|
configs: {
|
|
@@ -657,7 +660,7 @@ declare namespace SplitIO {
|
|
|
657
660
|
}
|
|
658
661
|
};
|
|
659
662
|
/**
|
|
660
|
-
* A promise that
|
|
663
|
+
* A promise that resolves to a feature flag view.
|
|
661
664
|
* @typedef {Promise<SplitView>} SplitView
|
|
662
665
|
*/
|
|
663
666
|
type SplitViewAsync = Promise<SplitView>;
|
|
@@ -666,17 +669,17 @@ declare namespace SplitIO {
|
|
|
666
669
|
*/
|
|
667
670
|
type SplitViews = Array<SplitView>;
|
|
668
671
|
/**
|
|
669
|
-
* A promise that
|
|
672
|
+
* A promise that resolves to an SplitIO.SplitViews array.
|
|
670
673
|
* @typedef {Promise<SplitViews>} SplitViewsAsync
|
|
671
674
|
*/
|
|
672
675
|
type SplitViewsAsync = Promise<SplitViews>;
|
|
673
676
|
/**
|
|
674
|
-
* An array of
|
|
677
|
+
* An array of feature flag names.
|
|
675
678
|
* @typedef {Array<string>} SplitNames
|
|
676
679
|
*/
|
|
677
680
|
type SplitNames = Array<string>;
|
|
678
681
|
/**
|
|
679
|
-
* A promise that
|
|
682
|
+
* A promise that resolves to an array of feature flag names.
|
|
680
683
|
* @typedef {Promise<SplitNames>} SplitNamesAsync
|
|
681
684
|
*/
|
|
682
685
|
type SplitNamesAsync = Promise<SplitNames>;
|
|
@@ -857,7 +860,7 @@ declare namespace SplitIO {
|
|
|
857
860
|
*/
|
|
858
861
|
type UrlSettings = {
|
|
859
862
|
/**
|
|
860
|
-
* String property to override the base URL where the SDK will get
|
|
863
|
+
* String property to override the base URL where the SDK will get rollout plan related data, like feature flags and segments definitions.
|
|
861
864
|
* @property {string} sdk
|
|
862
865
|
* @default 'https://sdk.split.io/api'
|
|
863
866
|
*/
|
|
@@ -894,20 +897,23 @@ declare namespace SplitIO {
|
|
|
894
897
|
type BrowserIntegration = ISplitToGoogleAnalyticsConfig | IGoogleAnalyticsToSplitConfig;
|
|
895
898
|
/**
|
|
896
899
|
* SplitFilter type.
|
|
900
|
+
*
|
|
897
901
|
* @typedef {string} SplitFilterType
|
|
898
902
|
*/
|
|
899
903
|
type SplitFilterType = 'byName' | 'byPrefix';
|
|
900
904
|
/**
|
|
901
|
-
* Defines a
|
|
905
|
+
* Defines a feature flag filter, described by a type and list of values.
|
|
902
906
|
*/
|
|
903
907
|
interface SplitFilter {
|
|
904
908
|
/**
|
|
905
909
|
* Type of the filter.
|
|
910
|
+
*
|
|
906
911
|
* @property {SplitFilterType} type
|
|
907
912
|
*/
|
|
908
913
|
type: SplitFilterType,
|
|
909
914
|
/**
|
|
910
|
-
* List of values:
|
|
915
|
+
* List of values: feature flag names for 'byName' filter type, and feature flag name prefixes for 'byPrefix' type.
|
|
916
|
+
*
|
|
911
917
|
* @property {string[]} values
|
|
912
918
|
*/
|
|
913
919
|
values: string[],
|
|
@@ -967,7 +973,7 @@ declare namespace SplitIO {
|
|
|
967
973
|
*/
|
|
968
974
|
scheduler?: {
|
|
969
975
|
/**
|
|
970
|
-
* The SDK polls Split servers for changes to feature
|
|
976
|
+
* The SDK polls Split servers for changes to feature flag definitions. This parameter controls this polling period in seconds.
|
|
971
977
|
* @property {number} featuresRefreshRate
|
|
972
978
|
* @default 60
|
|
973
979
|
*/
|
|
@@ -1038,7 +1044,7 @@ declare namespace SplitIO {
|
|
|
1038
1044
|
*/
|
|
1039
1045
|
core: {
|
|
1040
1046
|
/**
|
|
1041
|
-
* Your
|
|
1047
|
+
* Your SDK key. More information: @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
|
|
1042
1048
|
* @property {string} authorizationKey
|
|
1043
1049
|
*/
|
|
1044
1050
|
authorizationKey: string,
|
|
@@ -1074,13 +1080,13 @@ declare namespace SplitIO {
|
|
|
1074
1080
|
/**
|
|
1075
1081
|
* Storage type to be instantiated by the SDK.
|
|
1076
1082
|
* @property {BrowserStorage} type
|
|
1077
|
-
* @default MEMORY
|
|
1083
|
+
* @default 'MEMORY'
|
|
1078
1084
|
*/
|
|
1079
1085
|
type?: BrowserStorage,
|
|
1080
1086
|
/**
|
|
1081
1087
|
* Optional prefix to prevent any kind of data collision between SDK versions.
|
|
1082
1088
|
* @property {string} prefix
|
|
1083
|
-
* @default SPLITIO
|
|
1089
|
+
* @default 'SPLITIO'
|
|
1084
1090
|
*/
|
|
1085
1091
|
prefix?: string
|
|
1086
1092
|
},
|
|
@@ -1130,13 +1136,13 @@ declare namespace SplitIO {
|
|
|
1130
1136
|
/**
|
|
1131
1137
|
* Synchronous storage type to be instantiated by the SDK.
|
|
1132
1138
|
* @property {NodeSyncStorage} type
|
|
1133
|
-
* @default MEMORY
|
|
1139
|
+
* @default 'MEMORY'
|
|
1134
1140
|
*/
|
|
1135
1141
|
type?: NodeSyncStorage,
|
|
1136
1142
|
/**
|
|
1137
1143
|
* Optional prefix to prevent any kind of data collision between SDK versions.
|
|
1138
1144
|
* @property {string} prefix
|
|
1139
|
-
* @default SPLITIO
|
|
1145
|
+
* @default 'SPLITIO'
|
|
1140
1146
|
*/
|
|
1141
1147
|
prefix?: string
|
|
1142
1148
|
},
|
|
@@ -1145,7 +1151,7 @@ declare namespace SplitIO {
|
|
|
1145
1151
|
* For "localhost" mode, use "localhost" as authorizationKey.
|
|
1146
1152
|
*
|
|
1147
1153
|
* @property {'standalone'} mode
|
|
1148
|
-
* @default standalone
|
|
1154
|
+
* @default 'standalone'
|
|
1149
1155
|
*/
|
|
1150
1156
|
mode?: 'standalone'
|
|
1151
1157
|
}
|
|
@@ -1234,7 +1240,7 @@ declare namespace SplitIO {
|
|
|
1234
1240
|
/**
|
|
1235
1241
|
* Optional prefix to prevent any kind of data collision between SDK versions.
|
|
1236
1242
|
* @property {string} prefix
|
|
1237
|
-
* @default SPLITIO
|
|
1243
|
+
* @default 'SPLITIO'
|
|
1238
1244
|
*/
|
|
1239
1245
|
prefix?: string
|
|
1240
1246
|
},
|
|
@@ -1330,83 +1336,83 @@ declare namespace SplitIO {
|
|
|
1330
1336
|
* For usage on NodeJS as we don't have only one key.
|
|
1331
1337
|
* @function getTreatment
|
|
1332
1338
|
* @param {string} key - The string key representing the consumer.
|
|
1333
|
-
* @param {string}
|
|
1339
|
+
* @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
|
|
1334
1340
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1335
1341
|
* @returns {Treatment} The treatment string.
|
|
1336
1342
|
*/
|
|
1337
|
-
getTreatment(key: SplitKey,
|
|
1343
|
+
getTreatment(key: SplitKey, featureFlagName: string, attributes?: Attributes): Treatment,
|
|
1338
1344
|
/**
|
|
1339
1345
|
* Returns a Treatment value, which is the treatment string for the given feature.
|
|
1340
1346
|
* For usage on the Browser as we defined the key on the settings.
|
|
1341
1347
|
* @function getTreatment
|
|
1342
|
-
* @param {string}
|
|
1348
|
+
* @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
|
|
1343
1349
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1344
1350
|
* @returns {Treatment} The treatment string.
|
|
1345
1351
|
*/
|
|
1346
|
-
getTreatment(
|
|
1352
|
+
getTreatment(featureFlagName: string, attributes?: Attributes): Treatment,
|
|
1347
1353
|
/**
|
|
1348
1354
|
* Returns a TreatmentWithConfig value, which is an object with both treatment and config string for the given feature.
|
|
1349
1355
|
* For usage on NodeJS as we don't have only one key.
|
|
1350
1356
|
* @function getTreatmentWithConfig
|
|
1351
1357
|
* @param {string} key - The string key representing the consumer.
|
|
1352
|
-
* @param {string}
|
|
1358
|
+
* @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
|
|
1353
1359
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1354
1360
|
* @returns {TreatmentWithConfig} The TreatmentWithConfig, the object containing the treatment string and the
|
|
1355
1361
|
* configuration stringified JSON (or null if there was no config for that treatment).
|
|
1356
1362
|
*/
|
|
1357
|
-
getTreatmentWithConfig(key: SplitKey,
|
|
1363
|
+
getTreatmentWithConfig(key: SplitKey, featureFlagName: string, attributes?: Attributes): TreatmentWithConfig,
|
|
1358
1364
|
/**
|
|
1359
1365
|
* Returns a TreatmentWithConfig value, which an object with both treatment and config string for the given feature.
|
|
1360
1366
|
* For usage on the Browser as we defined the key on the settings.
|
|
1361
1367
|
* @function getTreatment
|
|
1362
|
-
* @param {string}
|
|
1368
|
+
* @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
|
|
1363
1369
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1364
1370
|
* @returns {TreatmentWithConfig} The TreatmentWithConfig, the object containing the treatment string and the
|
|
1365
1371
|
* configuration stringified JSON (or null if there was no config for that treatment).
|
|
1366
1372
|
*/
|
|
1367
|
-
getTreatmentWithConfig(
|
|
1373
|
+
getTreatmentWithConfig(featureFlagName: string, attributes?: Attributes): TreatmentWithConfig,
|
|
1368
1374
|
/**
|
|
1369
1375
|
* Returns a Treatments value, which is an object map with the treatments for the given features.
|
|
1370
1376
|
* For usage on NodeJS as we don't have only one key.
|
|
1371
1377
|
* NOTE: Treatment will be a promise only in async storages, like REDIS.
|
|
1372
1378
|
* @function getTreatments
|
|
1373
1379
|
* @param {string} key - The string key representing the consumer.
|
|
1374
|
-
* @param {Array<string>}
|
|
1380
|
+
* @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
|
|
1375
1381
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1376
1382
|
* @returns {Treatments} The treatments object map.
|
|
1377
1383
|
*/
|
|
1378
|
-
getTreatments(key: SplitKey,
|
|
1384
|
+
getTreatments(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): Treatments,
|
|
1379
1385
|
/**
|
|
1380
1386
|
* Returns a Treatments value, which is an object map with the treatments for the given features.
|
|
1381
1387
|
* For usage on the Browser as we defined the key on the settings.
|
|
1382
1388
|
* NOTE: Treatment will be a promise only in async storages, like REDIS.
|
|
1383
1389
|
* @function getTreatments
|
|
1384
|
-
* @param {Array<string>}
|
|
1390
|
+
* @param {Array<string>} featureFlagNames - An array of the feature flags names we want to get the treatments.
|
|
1385
1391
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1386
1392
|
* @returns {Treatments} The treatments object map.
|
|
1387
1393
|
*/
|
|
1388
|
-
getTreatments(
|
|
1394
|
+
getTreatments(featureFlagNames: string[], attributes?: Attributes): Treatments,
|
|
1389
1395
|
/**
|
|
1390
1396
|
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
|
|
1391
1397
|
* For usage on NodeJS as we don't have only one key.
|
|
1392
1398
|
* @function getTreatmentsWithConfig
|
|
1393
1399
|
* @param {string} key - The string key representing the consumer.
|
|
1394
|
-
* @param {Array<string>}
|
|
1400
|
+
* @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
|
|
1395
1401
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1396
1402
|
* @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
|
|
1397
1403
|
*/
|
|
1398
|
-
getTreatmentsWithConfig(key: SplitKey,
|
|
1404
|
+
getTreatmentsWithConfig(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig,
|
|
1399
1405
|
/**
|
|
1400
1406
|
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
|
|
1401
1407
|
* For usage on the Browser as we defined the key on the settings.
|
|
1402
1408
|
* @function getTreatmentsWithConfig
|
|
1403
|
-
* @param {Array<string>}
|
|
1409
|
+
* @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
|
|
1404
1410
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1405
1411
|
* @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
|
|
1406
1412
|
*/
|
|
1407
|
-
getTreatmentsWithConfig(
|
|
1413
|
+
getTreatmentsWithConfig(featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig,
|
|
1408
1414
|
/**
|
|
1409
|
-
* Tracks an event to be fed to the results product on Split
|
|
1415
|
+
* Tracks an event to be fed to the results product on Split user interface.
|
|
1410
1416
|
* For usage on NodeJS as we don't have only one key.
|
|
1411
1417
|
* @function track
|
|
1412
1418
|
* @param {SplitKey} key - The key that identifies the entity related to this event.
|
|
@@ -1418,7 +1424,7 @@ declare namespace SplitIO {
|
|
|
1418
1424
|
*/
|
|
1419
1425
|
track(key: SplitIO.SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): boolean,
|
|
1420
1426
|
/**
|
|
1421
|
-
* Tracks an event to be fed to the results product on Split
|
|
1427
|
+
* Tracks an event to be fed to the results product on Split user interface.
|
|
1422
1428
|
* For usage on the Browser as we defined the key on the settings.
|
|
1423
1429
|
* @function track
|
|
1424
1430
|
* @param {string} trafficType - The traffic type of the entity related to this event.
|
|
@@ -1429,7 +1435,7 @@ declare namespace SplitIO {
|
|
|
1429
1435
|
*/
|
|
1430
1436
|
track(trafficType: string, eventType: string, value?: number, properties?: Properties): boolean,
|
|
1431
1437
|
/**
|
|
1432
|
-
* Tracks an event to be fed to the results product on Split
|
|
1438
|
+
* Tracks an event to be fed to the results product on Split user interface.
|
|
1433
1439
|
* For usage on the Browser if we defined the key and also the trafficType on the settings.
|
|
1434
1440
|
* @function track
|
|
1435
1441
|
* @param {string} eventType - The event type corresponding to this event.
|
|
@@ -1499,44 +1505,44 @@ declare namespace SplitIO {
|
|
|
1499
1505
|
* NOTE: Treatment will be a promise only in async storages, like REDIS.
|
|
1500
1506
|
* @function getTreatment
|
|
1501
1507
|
* @param {string} key - The string key representing the consumer.
|
|
1502
|
-
* @param {string}
|
|
1508
|
+
* @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
|
|
1503
1509
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1504
|
-
* @returns {AsyncTreatment} Treatment promise
|
|
1510
|
+
* @returns {AsyncTreatment} Treatment promise that resolves to the treatment string.
|
|
1505
1511
|
*/
|
|
1506
|
-
getTreatment(key: SplitKey,
|
|
1512
|
+
getTreatment(key: SplitKey, featureFlagName: string, attributes?: Attributes): AsyncTreatment,
|
|
1507
1513
|
/**
|
|
1508
1514
|
* Returns a TreatmentWithConfig value, which will be (or eventually be) an object with both treatment and config string for the given feature.
|
|
1509
1515
|
* For usage on NodeJS as we don't have only one key.
|
|
1510
1516
|
* NOTE: Treatment will be a promise only in async storages, like REDIS.
|
|
1511
1517
|
* @function getTreatmentWithConfig
|
|
1512
1518
|
* @param {string} key - The string key representing the consumer.
|
|
1513
|
-
* @param {string}
|
|
1519
|
+
* @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
|
|
1514
1520
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1515
|
-
* @returns {AsyncTreatmentWithConfig} TreatmentWithConfig promise
|
|
1521
|
+
* @returns {AsyncTreatmentWithConfig} TreatmentWithConfig promise that resolves to the TreatmentWithConfig object.
|
|
1516
1522
|
*/
|
|
1517
|
-
getTreatmentWithConfig(key: SplitKey,
|
|
1523
|
+
getTreatmentWithConfig(key: SplitKey, featureFlagName: string, attributes?: Attributes): AsyncTreatmentWithConfig,
|
|
1518
1524
|
/**
|
|
1519
1525
|
* Returns a Treatments value, which will be (or eventually be) an object map with the treatments for the given features.
|
|
1520
1526
|
* For usage on NodeJS as we don't have only one key.
|
|
1521
1527
|
* @function getTreatments
|
|
1522
1528
|
* @param {string} key - The string key representing the consumer.
|
|
1523
|
-
* @param {Array<string>}
|
|
1529
|
+
* @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
|
|
1524
1530
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1525
|
-
* @returns {AsyncTreatments} Treatments promise
|
|
1531
|
+
* @returns {AsyncTreatments} Treatments promise that resolves to the treatments object map.
|
|
1526
1532
|
*/
|
|
1527
|
-
getTreatments(key: SplitKey,
|
|
1533
|
+
getTreatments(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): AsyncTreatments,
|
|
1528
1534
|
/**
|
|
1529
1535
|
* 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.
|
|
1530
1536
|
* For usage on NodeJS as we don't have only one key.
|
|
1531
1537
|
* @function getTreatmentsWithConfig
|
|
1532
1538
|
* @param {string} key - The string key representing the consumer.
|
|
1533
|
-
* @param {Array<string>}
|
|
1539
|
+
* @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
|
|
1534
1540
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1535
|
-
* @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise
|
|
1541
|
+
* @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise that resolves to the map of TreatmentsWithConfig objects.
|
|
1536
1542
|
*/
|
|
1537
|
-
getTreatmentsWithConfig(key: SplitKey,
|
|
1543
|
+
getTreatmentsWithConfig(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): AsyncTreatmentsWithConfig,
|
|
1538
1544
|
/**
|
|
1539
|
-
* Tracks an event to be fed to the results product on Split
|
|
1545
|
+
* 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).
|
|
1540
1546
|
* @function track
|
|
1541
1547
|
* @param {SplitKey} key - The key that identifies the entity related to this event.
|
|
1542
1548
|
* @param {string} trafficType - The traffic type of the entity related to this event.
|
|
@@ -1554,24 +1560,24 @@ declare namespace SplitIO {
|
|
|
1554
1560
|
*/
|
|
1555
1561
|
interface IManager extends IStatusInterface {
|
|
1556
1562
|
/**
|
|
1557
|
-
* Get the array of
|
|
1563
|
+
* Get the array of feature flag names.
|
|
1558
1564
|
* @function names
|
|
1559
|
-
* @returns {SplitNames} The
|
|
1565
|
+
* @returns {SplitNames} The list of feature flag names.
|
|
1560
1566
|
*/
|
|
1561
1567
|
names(): SplitNames;
|
|
1562
1568
|
/**
|
|
1563
|
-
* Get the array of
|
|
1569
|
+
* Get the array of feature flags data in SplitView format.
|
|
1564
1570
|
* @function splits
|
|
1565
1571
|
* @returns {SplitViews} The list of SplitIO.SplitView.
|
|
1566
1572
|
*/
|
|
1567
1573
|
splits(): SplitViews;
|
|
1568
1574
|
/**
|
|
1569
|
-
* Get the data of a
|
|
1575
|
+
* Get the data of a feature flag in SplitView format.
|
|
1570
1576
|
* @function split
|
|
1571
|
-
* @param {string}
|
|
1572
|
-
* @returns {SplitView | null} The SplitIO.SplitView of the given
|
|
1577
|
+
* @param {string} featureFlagName The name of the feature flag we want to get info of.
|
|
1578
|
+
* @returns {SplitView | null} The SplitIO.SplitView of the given feature flag name or null if the feature flag is not found.
|
|
1573
1579
|
*/
|
|
1574
|
-
split(
|
|
1580
|
+
split(featureFlagName: string): SplitView | null;
|
|
1575
1581
|
}
|
|
1576
1582
|
/**
|
|
1577
1583
|
* Representation of a manager instance with asynchronous storage of the SDK.
|
|
@@ -1580,23 +1586,23 @@ declare namespace SplitIO {
|
|
|
1580
1586
|
*/
|
|
1581
1587
|
interface IAsyncManager extends IStatusInterface {
|
|
1582
1588
|
/**
|
|
1583
|
-
* Get the array of
|
|
1589
|
+
* Get the array of feature flag names.
|
|
1584
1590
|
* @function names
|
|
1585
|
-
* @returns {SplitNamesAsync} A promise that
|
|
1591
|
+
* @returns {SplitNamesAsync} A promise that resolves to the list of feature flag names.
|
|
1586
1592
|
*/
|
|
1587
1593
|
names(): SplitNamesAsync;
|
|
1588
1594
|
/**
|
|
1589
|
-
* Get the array of
|
|
1595
|
+
* Get the array of feature flags data in SplitView format.
|
|
1590
1596
|
* @function splits
|
|
1591
|
-
* @returns {SplitViewsAsync} A promise that
|
|
1597
|
+
* @returns {SplitViewsAsync} A promise that resolves to the SplitIO.SplitView list.
|
|
1592
1598
|
*/
|
|
1593
1599
|
splits(): SplitViewsAsync;
|
|
1594
1600
|
/**
|
|
1595
|
-
* Get the data of a
|
|
1601
|
+
* Get the data of a feature flag in SplitView format.
|
|
1596
1602
|
* @function split
|
|
1597
|
-
* @param {string}
|
|
1598
|
-
* @returns {SplitViewAsync} A promise that
|
|
1603
|
+
* @param {string} featureFlagName The name of the feature flag we want to get info of.
|
|
1604
|
+
* @returns {SplitViewAsync} A promise that resolves to the SplitIO.SplitView value.
|
|
1599
1605
|
*/
|
|
1600
|
-
split(
|
|
1606
|
+
split(featureFlagName: string): SplitViewAsync;
|
|
1601
1607
|
}
|
|
1602
1608
|
}
|