@splitsoftware/splitio-commons 1.8.1 → 1.8.2-rc.1
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 +6 -3
- package/README.md +1 -1
- package/cjs/logger/constants.js +3 -3
- package/cjs/logger/messages/debug.js +7 -7
- package/cjs/logger/messages/error.js +2 -2
- package/cjs/logger/messages/info.js +3 -3
- package/cjs/logger/messages/warn.js +7 -7
- package/cjs/sdkClient/client.js +20 -20
- package/cjs/sdkClient/clientAttributesDecoration.js +8 -8
- package/cjs/sdkClient/clientInputValidation.js +10 -10
- package/cjs/sdkClient/sdkClient.js +1 -1
- package/cjs/sdkFactory/index.js +1 -1
- package/cjs/sdkManager/index.js +10 -8
- package/cjs/services/splitHttpClient.js +1 -1
- package/cjs/storages/inRedis/SplitsCacheInRedis.js +2 -2
- package/cjs/storages/pluggable/SplitsCachePluggable.js +1 -1
- package/cjs/sync/polling/updaters/segmentChangesUpdater.js +1 -1
- package/cjs/sync/streaming/pushManager.js +1 -1
- package/cjs/sync/submitters/telemetrySubmitter.js +2 -2
- package/cjs/utils/inputValidation/apiKey.js +26 -25
- package/cjs/utils/inputValidation/preloadedData.js +3 -3
- package/cjs/utils/inputValidation/split.js +1 -1
- package/cjs/utils/inputValidation/splits.js +2 -2
- package/cjs/utils/settingsValidation/index.js +1 -1
- package/esm/logger/constants.js +2 -2
- package/esm/logger/messages/debug.js +7 -7
- package/esm/logger/messages/error.js +2 -2
- package/esm/logger/messages/info.js +3 -3
- package/esm/logger/messages/warn.js +7 -7
- package/esm/sdkClient/client.js +20 -20
- package/esm/sdkClient/clientAttributesDecoration.js +8 -8
- package/esm/sdkClient/clientInputValidation.js +10 -10
- package/esm/sdkClient/sdkClient.js +1 -1
- package/esm/sdkFactory/index.js +1 -1
- package/esm/sdkManager/index.js +10 -8
- package/esm/services/splitHttpClient.js +1 -1
- package/esm/storages/inRedis/SplitsCacheInRedis.js +2 -2
- package/esm/storages/pluggable/SplitsCachePluggable.js +1 -1
- package/esm/sync/polling/updaters/segmentChangesUpdater.js +1 -1
- package/esm/sync/streaming/pushManager.js +1 -1
- package/esm/sync/submitters/telemetrySubmitter.js +2 -2
- package/esm/utils/inputValidation/apiKey.js +27 -26
- package/esm/utils/inputValidation/preloadedData.js +3 -3
- package/esm/utils/inputValidation/split.js +1 -1
- package/esm/utils/inputValidation/splits.js +2 -2
- package/esm/utils/settingsValidation/index.js +1 -1
- package/package.json +2 -2
- package/src/logger/constants.ts +2 -2
- package/src/logger/messages/debug.ts +7 -7
- package/src/logger/messages/error.ts +2 -2
- package/src/logger/messages/info.ts +3 -3
- package/src/logger/messages/warn.ts +7 -7
- package/src/sdkClient/client.ts +20 -20
- package/src/sdkClient/clientAttributesDecoration.ts +10 -10
- package/src/sdkClient/clientInputValidation.ts +10 -10
- package/src/sdkClient/sdkClient.ts +3 -3
- package/src/sdkFactory/index.ts +1 -1
- package/src/sdkManager/index.ts +11 -8
- package/src/services/splitHttpClient.ts +1 -1
- package/src/storages/inMemory/AttributesCacheInMemory.ts +7 -6
- package/src/storages/inRedis/SplitsCacheInRedis.ts +2 -2
- package/src/storages/pluggable/SplitsCachePluggable.ts +1 -1
- package/src/sync/polling/updaters/segmentChangesUpdater.ts +1 -1
- package/src/sync/streaming/pushManager.ts +1 -1
- package/src/sync/submitters/telemetrySubmitter.ts +2 -2
- package/src/types.ts +147 -140
- package/src/utils/inputValidation/apiKey.ts +25 -24
- package/src/utils/inputValidation/preloadedData.ts +3 -3
- package/src/utils/inputValidation/split.ts +1 -1
- package/src/utils/inputValidation/splits.ts +1 -1
- package/src/utils/settingsValidation/index.ts +1 -1
- package/types/logger/constants.d.ts +1 -1
- package/types/sdkClient/clientAttributesDecoration.d.ts +7 -7
- package/types/storages/inMemory/AttributesCacheInMemory.d.ts +4 -3
- package/types/types.d.ts +142 -135
- package/types/utils/inputValidation/apiKey.d.ts +5 -5
- package/types/utils/inputValidation/sdkKey.d.ts +7 -0
- package/types/utils/settingsValidation/index.d.ts +1 -1
- package/types/storages/metadataBuilder.d.ts +0 -3
- /package/types/storages/inMemory/{uniqueKeysCacheInMemory.d.ts → UniqueKeysCacheInMemory.d.ts} +0 -0
- /package/types/storages/inMemory/{uniqueKeysCacheInMemoryCS.d.ts → UniqueKeysCacheInMemoryCS.d.ts} +0 -0
- /package/types/storages/inRedis/{uniqueKeysCacheInRedis.d.ts → UniqueKeysCacheInRedis.d.ts} +0 -0
package/types/types.d.ts
CHANGED
|
@@ -188,23 +188,23 @@ interface ISharedSettings {
|
|
|
188
188
|
*/
|
|
189
189
|
sync?: {
|
|
190
190
|
/**
|
|
191
|
-
* List of
|
|
191
|
+
* 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.
|
|
192
192
|
* This configuration is only meaningful when the SDK is working in "standalone" mode.
|
|
193
193
|
*
|
|
194
|
-
* At the moment,
|
|
194
|
+
* At the moment, only one type of feature flag filter is supported: by name.
|
|
195
|
+
*
|
|
195
196
|
* Example:
|
|
196
197
|
* `splitFilter: [
|
|
197
|
-
* { type: 'byName', values: ['
|
|
198
|
-
* { type: 'byPrefix', values: ['testing'] } // will fetch splits whose names start with 'testing__' prefix
|
|
198
|
+
* { 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'
|
|
199
199
|
* ]`
|
|
200
200
|
* @property {SplitIO.SplitFilter[]} splitFilters
|
|
201
201
|
*/
|
|
202
202
|
splitFilters?: SplitIO.SplitFilter[];
|
|
203
203
|
/**
|
|
204
|
-
* Impressions Collection Mode. Option to determine how impressions are going to be sent to Split
|
|
204
|
+
* Impressions Collection Mode. Option to determine how impressions are going to be sent to Split servers.
|
|
205
205
|
* Possible values are 'DEBUG' and 'OPTIMIZED'.
|
|
206
206
|
* - DEBUG: will send all the impressions generated (recommended only for debugging purposes).
|
|
207
|
-
* - OPTIMIZED: will send unique impressions to Split
|
|
207
|
+
* - OPTIMIZED: will send unique impressions to Split servers avoiding a considerable amount of traffic that duplicated impressions could generate.
|
|
208
208
|
* @property {String} impressionsMode
|
|
209
209
|
* @default 'OPTIMIZED'
|
|
210
210
|
*/
|
|
@@ -331,7 +331,7 @@ interface INodeBasicSettings extends ISharedSettings {
|
|
|
331
331
|
*/
|
|
332
332
|
core: {
|
|
333
333
|
/**
|
|
334
|
-
* Your
|
|
334
|
+
* Your SDK key. More information: @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
|
|
335
335
|
* @property {string} authorizationKey
|
|
336
336
|
*/
|
|
337
337
|
authorizationKey: string;
|
|
@@ -356,14 +356,14 @@ interface INodeBasicSettings extends ISharedSettings {
|
|
|
356
356
|
/**
|
|
357
357
|
* The SDK mode. Possible values are "standalone" (which is the default) and "consumer". For "localhost" mode, use "localhost" as authorizationKey.
|
|
358
358
|
* @property {SDKMode} mode
|
|
359
|
-
* @default standalone
|
|
359
|
+
* @default 'standalone'
|
|
360
360
|
*/
|
|
361
361
|
mode?: SDKMode;
|
|
362
362
|
/**
|
|
363
363
|
* Mocked features file path. For testing purposses only. For using this you should specify "localhost" as authorizationKey on core settings.
|
|
364
364
|
* @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#localhost-mode}
|
|
365
365
|
* @property {MockedFeaturesFilePath} features
|
|
366
|
-
* @default $HOME/.split
|
|
366
|
+
* @default '$HOME/.split'
|
|
367
367
|
*/
|
|
368
368
|
features?: SplitIO.MockedFeaturesFilePath;
|
|
369
369
|
}
|
|
@@ -443,17 +443,17 @@ interface IBasicSDK {
|
|
|
443
443
|
*/
|
|
444
444
|
export declare namespace SplitIO {
|
|
445
445
|
/**
|
|
446
|
-
*
|
|
446
|
+
* Feature flag treatment value, returned by getTreatment.
|
|
447
447
|
* @typedef {string} Treatment
|
|
448
448
|
*/
|
|
449
449
|
type Treatment = string;
|
|
450
450
|
/**
|
|
451
|
-
*
|
|
451
|
+
* Feature flag treatment promise that will resolve to actual treatment value.
|
|
452
452
|
* @typedef {Promise<string>} AsyncTreatment
|
|
453
453
|
*/
|
|
454
454
|
type AsyncTreatment = Promise<string>;
|
|
455
455
|
/**
|
|
456
|
-
* An object with the treatments for a bulk of
|
|
456
|
+
* An object with the treatments for a bulk of feature flags, returned by getTreatments. For example:
|
|
457
457
|
* {
|
|
458
458
|
* feature1: 'on',
|
|
459
459
|
* feature2: 'off
|
|
@@ -464,14 +464,14 @@ export declare namespace SplitIO {
|
|
|
464
464
|
[featureName: string]: Treatment;
|
|
465
465
|
};
|
|
466
466
|
/**
|
|
467
|
-
*
|
|
467
|
+
* Feature flag treatments promise that will resolve to the actual SplitIO.Treatments object.
|
|
468
468
|
* @typedef {Promise<Treatments>} AsyncTreatments
|
|
469
469
|
*/
|
|
470
470
|
type AsyncTreatments = Promise<Treatments>;
|
|
471
471
|
/**
|
|
472
|
-
*
|
|
472
|
+
* Feature flag evaluation result with treatment and configuration, returned by getTreatmentWithConfig.
|
|
473
473
|
* @typedef {Object} TreatmentWithConfig
|
|
474
|
-
* @property {string} treatment The treatment
|
|
474
|
+
* @property {string} treatment The treatment string
|
|
475
475
|
* @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.
|
|
476
476
|
*/
|
|
477
477
|
type TreatmentWithConfig = {
|
|
@@ -479,13 +479,13 @@ export declare namespace SplitIO {
|
|
|
479
479
|
config: string | null;
|
|
480
480
|
};
|
|
481
481
|
/**
|
|
482
|
-
*
|
|
482
|
+
* Feature flag treatment promise that will resolve to actual treatment with config value.
|
|
483
483
|
* @typedef {Promise<TreatmentWithConfig>} AsyncTreatmentWithConfig
|
|
484
484
|
*/
|
|
485
485
|
type AsyncTreatmentWithConfig = Promise<TreatmentWithConfig>;
|
|
486
486
|
/**
|
|
487
|
-
* An object with the treatments with configs for a bulk of
|
|
488
|
-
* Each existing configuration is a stringified version of the JSON you defined on the Split
|
|
487
|
+
* An object with the treatments with configs for a bulk of feature flags, returned by getTreatmentsWithConfig.
|
|
488
|
+
* Each existing configuration is a stringified version of the JSON you defined on the Split user interface. For example:
|
|
489
489
|
* {
|
|
490
490
|
* feature1: { treatment: 'on', config: null }
|
|
491
491
|
* feature2: { treatment: 'off', config: '{"bannerText":"Click here."}' }
|
|
@@ -496,7 +496,7 @@ export declare namespace SplitIO {
|
|
|
496
496
|
[featureName: string]: TreatmentWithConfig;
|
|
497
497
|
};
|
|
498
498
|
/**
|
|
499
|
-
*
|
|
499
|
+
* Feature flag treatments promise that will resolve to the actual SplitIO.TreatmentsWithConfig object.
|
|
500
500
|
* @typedef {Promise<TreatmentsWithConfig>} AsyncTreatmentsWithConfig
|
|
501
501
|
*/
|
|
502
502
|
type AsyncTreatmentsWithConfig = Promise<TreatmentsWithConfig>;
|
|
@@ -506,15 +506,20 @@ export declare namespace SplitIO {
|
|
|
506
506
|
*/
|
|
507
507
|
type Event = 'init::timeout' | 'init::ready' | 'init::cache-ready' | 'state::update';
|
|
508
508
|
/**
|
|
509
|
-
*
|
|
510
|
-
* @typedef {Object.<
|
|
509
|
+
* Attributes should be on object with values of type string or number (dates should be sent as millis since epoch).
|
|
510
|
+
* @typedef {Object.<AttributeType>} Attributes
|
|
511
511
|
* @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#attribute-syntax}
|
|
512
512
|
*/
|
|
513
513
|
type Attributes = {
|
|
514
|
-
[attributeName: string]:
|
|
514
|
+
[attributeName: string]: AttributeType;
|
|
515
515
|
};
|
|
516
516
|
/**
|
|
517
|
-
*
|
|
517
|
+
* Type of an attribute value
|
|
518
|
+
* @typedef {string | number | boolean | Array<string | number>} AttributeType
|
|
519
|
+
*/
|
|
520
|
+
type AttributeType = string | number | boolean | Array<string | number>;
|
|
521
|
+
/**
|
|
522
|
+
* Properties should be an object with values of type string, number, boolean or null. Size limit of ~31kb.
|
|
518
523
|
* @typedef {Object.<number, string, boolean, null>} Attributes
|
|
519
524
|
* @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#track
|
|
520
525
|
*/
|
|
@@ -559,38 +564,38 @@ export declare namespace SplitIO {
|
|
|
559
564
|
sdkLanguageVersion: string;
|
|
560
565
|
};
|
|
561
566
|
/**
|
|
562
|
-
* Data corresponding to one
|
|
567
|
+
* Data corresponding to one feature flag view.
|
|
563
568
|
* @typedef {Object} SplitView
|
|
564
569
|
*/
|
|
565
570
|
type SplitView = {
|
|
566
571
|
/**
|
|
567
|
-
* The name of the
|
|
572
|
+
* The name of the feature flag.
|
|
568
573
|
* @property {string} name
|
|
569
574
|
*/
|
|
570
575
|
name: string;
|
|
571
576
|
/**
|
|
572
|
-
* The traffic type of the
|
|
577
|
+
* The traffic type of the feature flag.
|
|
573
578
|
* @property {string} trafficType
|
|
574
579
|
*/
|
|
575
580
|
trafficType: string;
|
|
576
581
|
/**
|
|
577
|
-
* Whether the
|
|
582
|
+
* Whether the feature flag is killed or not.
|
|
578
583
|
* @property {boolean} killed
|
|
579
584
|
*/
|
|
580
585
|
killed: boolean;
|
|
581
586
|
/**
|
|
582
|
-
* The list of treatments available for the
|
|
587
|
+
* The list of treatments available for the feature flag.
|
|
583
588
|
* @property {Array<string>} treatments
|
|
584
589
|
*/
|
|
585
590
|
treatments: Array<string>;
|
|
586
591
|
/**
|
|
587
|
-
* Current change number of the
|
|
592
|
+
* Current change number of the feature flag.
|
|
588
593
|
* @property {number} changeNumber
|
|
589
594
|
*/
|
|
590
595
|
changeNumber: number;
|
|
591
596
|
/**
|
|
592
597
|
* Map of configurations per treatment.
|
|
593
|
-
* Each existing configuration is a stringified version of the JSON you defined on the Split
|
|
598
|
+
* Each existing configuration is a stringified version of the JSON you defined on the Split user interface.
|
|
594
599
|
* @property {Object.<string>} configs
|
|
595
600
|
*/
|
|
596
601
|
configs: {
|
|
@@ -598,7 +603,7 @@ export declare namespace SplitIO {
|
|
|
598
603
|
};
|
|
599
604
|
};
|
|
600
605
|
/**
|
|
601
|
-
* A promise that
|
|
606
|
+
* A promise that resolves to a feature flag view.
|
|
602
607
|
* @typedef {Promise<SplitView>} SplitView
|
|
603
608
|
*/
|
|
604
609
|
type SplitViewAsync = Promise<SplitView>;
|
|
@@ -607,17 +612,17 @@ export declare namespace SplitIO {
|
|
|
607
612
|
*/
|
|
608
613
|
type SplitViews = Array<SplitView>;
|
|
609
614
|
/**
|
|
610
|
-
* A promise that
|
|
615
|
+
* A promise that resolves to an SplitIO.SplitViews array.
|
|
611
616
|
* @typedef {Promise<SplitViews>} SplitViewsAsync
|
|
612
617
|
*/
|
|
613
618
|
type SplitViewsAsync = Promise<SplitViews>;
|
|
614
619
|
/**
|
|
615
|
-
* An array of
|
|
620
|
+
* An array of feature flag names.
|
|
616
621
|
* @typedef {Array<string>} SplitNames
|
|
617
622
|
*/
|
|
618
623
|
type SplitNames = Array<string>;
|
|
619
624
|
/**
|
|
620
|
-
* A promise that
|
|
625
|
+
* A promise that resolves to an array of feature flag names.
|
|
621
626
|
* @typedef {Promise<SplitNames>} SplitNamesAsync
|
|
622
627
|
*/
|
|
623
628
|
type SplitNamesAsync = Promise<SplitNames>;
|
|
@@ -667,7 +672,7 @@ export declare namespace SplitIO {
|
|
|
667
672
|
*/
|
|
668
673
|
type UrlSettings = {
|
|
669
674
|
/**
|
|
670
|
-
* String property to override the base URL where the SDK will get
|
|
675
|
+
* String property to override the base URL where the SDK will get rollout plan related data, like feature flags and segments definitions.
|
|
671
676
|
* @property {string} sdk
|
|
672
677
|
* @default 'https://sdk.split.io/api'
|
|
673
678
|
*/
|
|
@@ -703,7 +708,7 @@ export declare namespace SplitIO {
|
|
|
703
708
|
*/
|
|
704
709
|
type SplitFilterType = 'byName' | 'byPrefix';
|
|
705
710
|
/**
|
|
706
|
-
* Defines a
|
|
711
|
+
* Defines a feature flag filter, described by a type and list of values.
|
|
707
712
|
*/
|
|
708
713
|
interface SplitFilter {
|
|
709
714
|
/**
|
|
@@ -712,7 +717,7 @@ export declare namespace SplitIO {
|
|
|
712
717
|
*/
|
|
713
718
|
type: SplitFilterType;
|
|
714
719
|
/**
|
|
715
|
-
* List of values:
|
|
720
|
+
* List of values: feature flag names for 'byName' filter type, and feature flag name prefixes for 'byPrefix' type.
|
|
716
721
|
* @property {string[]} values
|
|
717
722
|
*/
|
|
718
723
|
values: string[];
|
|
@@ -723,7 +728,7 @@ export declare namespace SplitIO {
|
|
|
723
728
|
*/
|
|
724
729
|
type ImpressionsMode = 'OPTIMIZED' | 'DEBUG' | 'NONE';
|
|
725
730
|
/**
|
|
726
|
-
* Defines the format of
|
|
731
|
+
* Defines the format of rollout plan data to preload on the factory storage (cache).
|
|
727
732
|
*/
|
|
728
733
|
interface PreloadedData {
|
|
729
734
|
/**
|
|
@@ -738,7 +743,7 @@ export declare namespace SplitIO {
|
|
|
738
743
|
*/
|
|
739
744
|
since: number;
|
|
740
745
|
/**
|
|
741
|
-
* Map of
|
|
746
|
+
* Map of feature flags to their stringified definitions.
|
|
742
747
|
*/
|
|
743
748
|
splitsData: {
|
|
744
749
|
[splitName: string]: string;
|
|
@@ -751,7 +756,7 @@ export declare namespace SplitIO {
|
|
|
751
756
|
[key: string]: string[];
|
|
752
757
|
};
|
|
753
758
|
/**
|
|
754
|
-
* Optional map of segments to their
|
|
759
|
+
* Optional map of segments to their stringified definitions.
|
|
755
760
|
* This property is ignored if `mySegmentsData` was provided.
|
|
756
761
|
*/
|
|
757
762
|
segmentsData?: {
|
|
@@ -803,15 +808,15 @@ export declare namespace SplitIO {
|
|
|
803
808
|
*/
|
|
804
809
|
scheduler?: {
|
|
805
810
|
/**
|
|
806
|
-
* The SDK polls Split servers for changes to feature
|
|
811
|
+
* The SDK polls Split servers for changes to feature flag definitions. This parameter controls this polling period in seconds.
|
|
807
812
|
* @property {number} featuresRefreshRate
|
|
808
|
-
* @default
|
|
813
|
+
* @default 60
|
|
809
814
|
*/
|
|
810
815
|
featuresRefreshRate?: number;
|
|
811
816
|
/**
|
|
812
817
|
* The SDK sends information on who got what treatment at what time back to Split servers to power analytics. This parameter controls how often this data is sent to Split servers. The parameter should be in seconds.
|
|
813
818
|
* @property {number} impressionsRefreshRate
|
|
814
|
-
* @default
|
|
819
|
+
* @default 300
|
|
815
820
|
*/
|
|
816
821
|
impressionsRefreshRate?: number;
|
|
817
822
|
/**
|
|
@@ -825,7 +830,7 @@ export declare namespace SplitIO {
|
|
|
825
830
|
* The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
|
|
826
831
|
* @property {number} metricsRefreshRate
|
|
827
832
|
* @default 120
|
|
828
|
-
* @deprecated This parameter is ignored now.
|
|
833
|
+
* @deprecated This parameter is ignored now. Use `telemetryRefreshRate` instead.
|
|
829
834
|
*/
|
|
830
835
|
metricsRefreshRate?: number;
|
|
831
836
|
/**
|
|
@@ -874,7 +879,7 @@ export declare namespace SplitIO {
|
|
|
874
879
|
*/
|
|
875
880
|
core: {
|
|
876
881
|
/**
|
|
877
|
-
* Your
|
|
882
|
+
* Your SDK key. More information: @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
|
|
878
883
|
* @property {string} authorizationKey
|
|
879
884
|
*/
|
|
880
885
|
authorizationKey: string;
|
|
@@ -1015,51 +1020,51 @@ export declare namespace SplitIO {
|
|
|
1015
1020
|
*/
|
|
1016
1021
|
interface IClient extends IBasicClient {
|
|
1017
1022
|
/**
|
|
1018
|
-
* Returns a Treatment value, which
|
|
1023
|
+
* Returns a Treatment value, which is the treatment string for the given feature.
|
|
1019
1024
|
* @function getTreatment
|
|
1020
1025
|
* @param {string} key - The string key representing the consumer.
|
|
1021
|
-
* @param {string}
|
|
1026
|
+
* @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
|
|
1022
1027
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1023
|
-
* @returns {Treatment} The treatment
|
|
1028
|
+
* @returns {Treatment} The treatment string.
|
|
1024
1029
|
*/
|
|
1025
|
-
getTreatment(key: SplitKey,
|
|
1030
|
+
getTreatment(key: SplitKey, featureFlagName: string, attributes?: Attributes): Treatment;
|
|
1026
1031
|
/**
|
|
1027
|
-
* Returns a TreatmentWithConfig value
|
|
1032
|
+
* Returns a TreatmentWithConfig value, which is an object with both treatment and config string for the given feature.
|
|
1028
1033
|
* @function getTreatmentWithConfig
|
|
1029
1034
|
* @param {string} key - The string key representing the consumer.
|
|
1030
|
-
* @param {string}
|
|
1035
|
+
* @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
|
|
1031
1036
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1032
|
-
* @returns {TreatmentWithConfig} The TreatmentWithConfig
|
|
1033
|
-
*
|
|
1037
|
+
* @returns {TreatmentWithConfig} The TreatmentWithConfig, the object containing the treatment string and the
|
|
1038
|
+
* configuration stringified JSON (or null if there was no config for that treatment).
|
|
1034
1039
|
*/
|
|
1035
|
-
getTreatmentWithConfig(key: SplitKey,
|
|
1040
|
+
getTreatmentWithConfig(key: SplitKey, featureFlagName: string, attributes?: Attributes): TreatmentWithConfig;
|
|
1036
1041
|
/**
|
|
1037
|
-
* Returns a Treatments value,
|
|
1042
|
+
* Returns a Treatments value, which is an object map with the treatments for the given features.
|
|
1038
1043
|
* @function getTreatments
|
|
1039
1044
|
* @param {string} key - The string key representing the consumer.
|
|
1040
|
-
* @param {Array<string>}
|
|
1045
|
+
* @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
|
|
1041
1046
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1042
|
-
* @returns {Treatments} The treatments
|
|
1047
|
+
* @returns {Treatments} The treatments object map.
|
|
1043
1048
|
*/
|
|
1044
|
-
getTreatments(key: SplitKey,
|
|
1049
|
+
getTreatments(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): Treatments;
|
|
1045
1050
|
/**
|
|
1046
|
-
* Returns a TreatmentsWithConfig value,
|
|
1051
|
+
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
|
|
1047
1052
|
* @function getTreatmentsWithConfig
|
|
1048
1053
|
* @param {string} key - The string key representing the consumer.
|
|
1049
|
-
* @param {Array<string>}
|
|
1054
|
+
* @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
|
|
1050
1055
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1051
1056
|
* @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
|
|
1052
1057
|
*/
|
|
1053
|
-
getTreatmentsWithConfig(key: SplitKey,
|
|
1058
|
+
getTreatmentsWithConfig(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig;
|
|
1054
1059
|
/**
|
|
1055
|
-
* Tracks an event to be fed to the results product on Split
|
|
1060
|
+
* Tracks an event to be fed to the results product on Split user interface.
|
|
1056
1061
|
* @function track
|
|
1057
1062
|
* @param {SplitKey} key - The key that identifies the entity related to this event.
|
|
1058
1063
|
* @param {string} trafficType - The traffic type of the entity related to this event.
|
|
1059
1064
|
* @param {string} eventType - The event type corresponding to this event.
|
|
1060
1065
|
* @param {number=} value - The value of this event.
|
|
1061
1066
|
* @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
|
|
1062
|
-
* @returns {boolean} Whether the event was added to the queue
|
|
1067
|
+
* @returns {boolean} Whether the event was added to the queue successfully or not.
|
|
1063
1068
|
*/
|
|
1064
1069
|
track(key: SplitIO.SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): boolean;
|
|
1065
1070
|
}
|
|
@@ -1075,51 +1080,51 @@ export declare namespace SplitIO {
|
|
|
1075
1080
|
* NOTE: Treatment will be a promise only in async storages, like REDIS.
|
|
1076
1081
|
* @function getTreatment
|
|
1077
1082
|
* @param {string} key - The string key representing the consumer.
|
|
1078
|
-
* @param {string}
|
|
1083
|
+
* @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
|
|
1079
1084
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1080
|
-
* @returns {AsyncTreatment} Treatment promise
|
|
1085
|
+
* @returns {AsyncTreatment} Treatment promise that resolves to the treatment string.
|
|
1081
1086
|
*/
|
|
1082
|
-
getTreatment(key: SplitKey,
|
|
1087
|
+
getTreatment(key: SplitKey, featureFlagName: string, attributes?: Attributes): AsyncTreatment;
|
|
1083
1088
|
/**
|
|
1084
|
-
* Returns a TreatmentWithConfig value, which will be (or eventually be)
|
|
1089
|
+
* Returns a TreatmentWithConfig value, which will be (or eventually be) an object with both treatment and config string for the given feature.
|
|
1085
1090
|
* For usage on NodeJS as we don't have only one key.
|
|
1086
1091
|
* NOTE: Treatment will be a promise only in async storages, like REDIS.
|
|
1087
1092
|
* @function getTreatmentWithConfig
|
|
1088
1093
|
* @param {string} key - The string key representing the consumer.
|
|
1089
|
-
* @param {string}
|
|
1094
|
+
* @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
|
|
1090
1095
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1091
|
-
* @returns {AsyncTreatmentWithConfig} TreatmentWithConfig promise
|
|
1096
|
+
* @returns {AsyncTreatmentWithConfig} TreatmentWithConfig promise that resolves to the TreatmentWithConfig object.
|
|
1092
1097
|
*/
|
|
1093
|
-
getTreatmentWithConfig(key: SplitKey,
|
|
1098
|
+
getTreatmentWithConfig(key: SplitKey, featureFlagName: string, attributes?: Attributes): AsyncTreatmentWithConfig;
|
|
1094
1099
|
/**
|
|
1095
|
-
* Returns a Treatments value,
|
|
1100
|
+
* Returns a Treatments value, which will be (or eventually be) an object map with the treatments for the given features.
|
|
1096
1101
|
* For usage on NodeJS as we don't have only one key.
|
|
1097
1102
|
* @function getTreatments
|
|
1098
1103
|
* @param {string} key - The string key representing the consumer.
|
|
1099
|
-
* @param {Array<string>}
|
|
1104
|
+
* @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
|
|
1100
1105
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1101
|
-
* @returns {AsyncTreatments} Treatments promise
|
|
1106
|
+
* @returns {AsyncTreatments} Treatments promise that resolves to the treatments object map.
|
|
1102
1107
|
*/
|
|
1103
|
-
getTreatments(key: SplitKey,
|
|
1108
|
+
getTreatments(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): AsyncTreatments;
|
|
1104
1109
|
/**
|
|
1105
|
-
* Returns a
|
|
1110
|
+
* 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.
|
|
1106
1111
|
* For usage on NodeJS as we don't have only one key.
|
|
1107
1112
|
* @function getTreatmentsWithConfig
|
|
1108
1113
|
* @param {string} key - The string key representing the consumer.
|
|
1109
|
-
* @param {Array<string>}
|
|
1114
|
+
* @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
|
|
1110
1115
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1111
|
-
* @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise
|
|
1116
|
+
* @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise that resolves to the map of TreatmentsWithConfig objects.
|
|
1112
1117
|
*/
|
|
1113
|
-
getTreatmentsWithConfig(key: SplitKey,
|
|
1118
|
+
getTreatmentsWithConfig(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): AsyncTreatmentsWithConfig;
|
|
1114
1119
|
/**
|
|
1115
|
-
* Tracks an event to be fed to the results product on Split
|
|
1120
|
+
* 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).
|
|
1116
1121
|
* @function track
|
|
1117
1122
|
* @param {SplitKey} key - The key that identifies the entity related to this event.
|
|
1118
1123
|
* @param {string} trafficType - The traffic type of the entity related to this event.
|
|
1119
1124
|
* @param {string} eventType - The event type corresponding to this event.
|
|
1120
1125
|
* @param {number=} value - The value of this event.
|
|
1121
1126
|
* @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
|
|
1122
|
-
* @returns {Promise<boolean>} A promise that resolves to a boolean indicating if the event was added to the queue
|
|
1127
|
+
* @returns {Promise<boolean>} A promise that resolves to a boolean indicating if the event was added to the queue successfully or not.
|
|
1123
1128
|
*/
|
|
1124
1129
|
track(key: SplitIO.SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): Promise<boolean>;
|
|
1125
1130
|
}
|
|
@@ -1130,84 +1135,86 @@ export declare namespace SplitIO {
|
|
|
1130
1135
|
*/
|
|
1131
1136
|
interface ICsClient extends IBasicClient {
|
|
1132
1137
|
/**
|
|
1133
|
-
* Returns a Treatment value, which
|
|
1138
|
+
* Returns a Treatment value, which is the treatment string for the given feature.
|
|
1134
1139
|
* @function getTreatment
|
|
1135
|
-
* @param {string}
|
|
1140
|
+
* @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
|
|
1136
1141
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1137
|
-
* @returns {Treatment} The treatment
|
|
1142
|
+
* @returns {Treatment} The treatment string.
|
|
1138
1143
|
*/
|
|
1139
|
-
getTreatment(
|
|
1144
|
+
getTreatment(featureFlagName: string, attributes?: Attributes): Treatment;
|
|
1140
1145
|
/**
|
|
1141
|
-
* Returns a TreatmentWithConfig value, which
|
|
1142
|
-
* @function
|
|
1143
|
-
* @param {string}
|
|
1146
|
+
* Returns a TreatmentWithConfig value, which is an object with both treatment and config string for the given feature.
|
|
1147
|
+
* @function getTreatmentWithConfig
|
|
1148
|
+
* @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
|
|
1144
1149
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1145
|
-
* @returns {TreatmentWithConfig} The treatment or
|
|
1150
|
+
* @returns {TreatmentWithConfig} The map containing the treatment and the configuration stringified JSON (or null if there was no config for that treatment).
|
|
1146
1151
|
*/
|
|
1147
|
-
getTreatmentWithConfig(
|
|
1152
|
+
getTreatmentWithConfig(featureFlagName: string, attributes?: Attributes): TreatmentWithConfig;
|
|
1148
1153
|
/**
|
|
1149
|
-
* Returns a Treatments value,
|
|
1154
|
+
* Returns a Treatments value, which is an object map with the treatments for the given features.
|
|
1150
1155
|
* @function getTreatments
|
|
1151
|
-
* @param {Array<string>}
|
|
1156
|
+
* @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
|
|
1152
1157
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1153
|
-
* @returns {Treatments} The treatments
|
|
1158
|
+
* @returns {Treatments} The treatments object map.
|
|
1154
1159
|
*/
|
|
1155
|
-
getTreatments(
|
|
1160
|
+
getTreatments(featureFlagNames: string[], attributes?: Attributes): Treatments;
|
|
1156
1161
|
/**
|
|
1157
|
-
* Returns a TreatmentsWithConfig value,
|
|
1162
|
+
* Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
|
|
1158
1163
|
* @function getTreatmentsWithConfig
|
|
1159
|
-
* @param {Array<string>}
|
|
1164
|
+
* @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
|
|
1160
1165
|
* @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
|
|
1161
1166
|
* @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
|
|
1162
1167
|
*/
|
|
1163
|
-
getTreatmentsWithConfig(
|
|
1168
|
+
getTreatmentsWithConfig(featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig;
|
|
1164
1169
|
/**
|
|
1165
|
-
* Tracks an event to be fed to the results product on Split
|
|
1170
|
+
* Tracks an event to be fed to the results product on Split user interface.
|
|
1166
1171
|
* @function track
|
|
1167
|
-
* @param {string} trafficType - The traffic type of the entity related to this event.
|
|
1172
|
+
* @param {string} trafficType - The traffic type of the entity related to this event.
|
|
1168
1173
|
* @param {string} eventType - The event type corresponding to this event.
|
|
1169
1174
|
* @param {number=} value - The value of this event.
|
|
1170
1175
|
* @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
|
|
1171
|
-
* @returns {boolean} Whether the event was added to the queue
|
|
1176
|
+
* @returns {boolean} Whether the event was added to the queue successfully or not.
|
|
1172
1177
|
*/
|
|
1173
|
-
track(
|
|
1178
|
+
track(trafficType: string, eventType: string, value?: number, properties?: Properties): boolean;
|
|
1174
1179
|
/**
|
|
1175
1180
|
* Add an attribute to client's in memory attributes storage
|
|
1176
|
-
*
|
|
1177
|
-
* @param {string} attributeName
|
|
1178
|
-
* @param {
|
|
1179
|
-
* @returns {boolean} true if the attribute was stored and false
|
|
1181
|
+
*
|
|
1182
|
+
* @param {string} attributeName Attribute name
|
|
1183
|
+
* @param {AttributeType} attributeValue Attribute value
|
|
1184
|
+
* @returns {boolean} true if the attribute was stored and false otherwise
|
|
1180
1185
|
*/
|
|
1181
|
-
setAttribute(attributeName: string, attributeValue:
|
|
1186
|
+
setAttribute(attributeName: string, attributeValue: AttributeType): boolean;
|
|
1182
1187
|
/**
|
|
1183
1188
|
* Returns the attribute with the given key
|
|
1184
|
-
*
|
|
1189
|
+
*
|
|
1185
1190
|
* @param {string} attributeName Attribute name
|
|
1186
|
-
* @returns {
|
|
1191
|
+
* @returns {AttributeType} Attribute with the given key
|
|
1187
1192
|
*/
|
|
1188
|
-
getAttribute(attributeName: string):
|
|
1193
|
+
getAttribute(attributeName: string): AttributeType;
|
|
1189
1194
|
/**
|
|
1190
|
-
*
|
|
1191
|
-
*
|
|
1192
|
-
* @param {
|
|
1193
|
-
* @returns true if
|
|
1195
|
+
* Removes from client's in memory attributes storage the attribute with the given key.
|
|
1196
|
+
*
|
|
1197
|
+
* @param {string} attributeName
|
|
1198
|
+
* @returns {boolean} true if attribute was removed and false otherwise
|
|
1194
1199
|
*/
|
|
1195
|
-
|
|
1200
|
+
removeAttribute(attributeName: string): boolean;
|
|
1196
1201
|
/**
|
|
1197
|
-
*
|
|
1198
|
-
*
|
|
1199
|
-
* @
|
|
1202
|
+
* Add to client's in memory attributes storage the attributes in 'attributes'.
|
|
1203
|
+
*
|
|
1204
|
+
* @param {Attributes} attributes Object with attributes to store
|
|
1205
|
+
* @returns true if attributes were stored an false otherwise
|
|
1200
1206
|
*/
|
|
1201
|
-
|
|
1207
|
+
setAttributes(attributes: Attributes): boolean;
|
|
1202
1208
|
/**
|
|
1203
|
-
*
|
|
1204
|
-
*
|
|
1205
|
-
* @
|
|
1206
|
-
* @returns {boolean} true if attribute was removed and false otherways
|
|
1209
|
+
* Return all the attributes stored in client's in memory attributes storage.
|
|
1210
|
+
*
|
|
1211
|
+
* @returns {Attributes} returns all the stored attributes
|
|
1207
1212
|
*/
|
|
1208
|
-
|
|
1213
|
+
getAttributes(): Attributes;
|
|
1209
1214
|
/**
|
|
1210
|
-
* Remove all the stored attributes in the client's in memory attribute storage
|
|
1215
|
+
* Remove all the stored attributes in the client's in memory attribute storage.
|
|
1216
|
+
*
|
|
1217
|
+
* @returns {boolean} true if all attribute were removed and false otherwise
|
|
1211
1218
|
*/
|
|
1212
1219
|
clearAttributes(): boolean;
|
|
1213
1220
|
}
|
|
@@ -1218,13 +1225,13 @@ export declare namespace SplitIO {
|
|
|
1218
1225
|
*/
|
|
1219
1226
|
interface IManager extends IStatusInterface {
|
|
1220
1227
|
/**
|
|
1221
|
-
* Get the array of
|
|
1228
|
+
* Get the array of feature flag names.
|
|
1222
1229
|
* @function names
|
|
1223
|
-
* @returns {SplitNames} The
|
|
1230
|
+
* @returns {SplitNames} The list of feature flag names.
|
|
1224
1231
|
*/
|
|
1225
1232
|
names(): SplitNames;
|
|
1226
1233
|
/**
|
|
1227
|
-
* Get the array of
|
|
1234
|
+
* Get the array of feature flags data in SplitView format.
|
|
1228
1235
|
* @function splits
|
|
1229
1236
|
* @returns {SplitViews} The list of SplitIO.SplitView.
|
|
1230
1237
|
*/
|
|
@@ -1232,10 +1239,10 @@ export declare namespace SplitIO {
|
|
|
1232
1239
|
/**
|
|
1233
1240
|
* Get the data of a split in SplitView format.
|
|
1234
1241
|
* @function split
|
|
1235
|
-
* @param {string}
|
|
1242
|
+
* @param {string} featureFlagName The name of the feature flag we want to get info of.
|
|
1236
1243
|
* @returns {SplitView} The SplitIO.SplitView of the given split.
|
|
1237
1244
|
*/
|
|
1238
|
-
split(
|
|
1245
|
+
split(featureFlagName: string): SplitView;
|
|
1239
1246
|
}
|
|
1240
1247
|
/**
|
|
1241
1248
|
* Representation of a manager instance with asynchronous storage of the SDK.
|
|
@@ -1244,24 +1251,24 @@ export declare namespace SplitIO {
|
|
|
1244
1251
|
*/
|
|
1245
1252
|
interface IAsyncManager extends IStatusInterface {
|
|
1246
1253
|
/**
|
|
1247
|
-
* Get the array of
|
|
1254
|
+
* Get the array of feature flag names.
|
|
1248
1255
|
* @function names
|
|
1249
|
-
* @returns {SplitNamesAsync} A promise that
|
|
1256
|
+
* @returns {SplitNamesAsync} A promise that resolves to the list of feature flag names.
|
|
1250
1257
|
*/
|
|
1251
1258
|
names(): SplitNamesAsync;
|
|
1252
1259
|
/**
|
|
1253
|
-
* Get the array of
|
|
1260
|
+
* Get the array of feature flags data in SplitView format.
|
|
1254
1261
|
* @function splits
|
|
1255
|
-
* @returns {SplitViewsAsync} A promise that
|
|
1262
|
+
* @returns {SplitViewsAsync} A promise that resolves to the SplitIO.SplitView list.
|
|
1256
1263
|
*/
|
|
1257
1264
|
splits(): SplitViewsAsync;
|
|
1258
1265
|
/**
|
|
1259
1266
|
* Get the data of a split in SplitView format.
|
|
1260
1267
|
* @function split
|
|
1261
|
-
* @param {string}
|
|
1262
|
-
* @returns {SplitViewAsync} A promise that
|
|
1268
|
+
* @param {string} featureFlagName The name of the feature flag we want to get info of.
|
|
1269
|
+
* @returns {SplitViewAsync} A promise that resolves to the SplitIO.SplitView value.
|
|
1263
1270
|
*/
|
|
1264
|
-
split(
|
|
1271
|
+
split(featureFlagName: string): SplitViewAsync;
|
|
1265
1272
|
}
|
|
1266
1273
|
}
|
|
1267
1274
|
export {};
|