@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.
Files changed (82) hide show
  1. package/CHANGES.txt +6 -3
  2. package/README.md +1 -1
  3. package/cjs/logger/constants.js +3 -3
  4. package/cjs/logger/messages/debug.js +7 -7
  5. package/cjs/logger/messages/error.js +2 -2
  6. package/cjs/logger/messages/info.js +3 -3
  7. package/cjs/logger/messages/warn.js +7 -7
  8. package/cjs/sdkClient/client.js +20 -20
  9. package/cjs/sdkClient/clientAttributesDecoration.js +8 -8
  10. package/cjs/sdkClient/clientInputValidation.js +10 -10
  11. package/cjs/sdkClient/sdkClient.js +1 -1
  12. package/cjs/sdkFactory/index.js +1 -1
  13. package/cjs/sdkManager/index.js +10 -8
  14. package/cjs/services/splitHttpClient.js +1 -1
  15. package/cjs/storages/inRedis/SplitsCacheInRedis.js +2 -2
  16. package/cjs/storages/pluggable/SplitsCachePluggable.js +1 -1
  17. package/cjs/sync/polling/updaters/segmentChangesUpdater.js +1 -1
  18. package/cjs/sync/streaming/pushManager.js +1 -1
  19. package/cjs/sync/submitters/telemetrySubmitter.js +2 -2
  20. package/cjs/utils/inputValidation/apiKey.js +26 -25
  21. package/cjs/utils/inputValidation/preloadedData.js +3 -3
  22. package/cjs/utils/inputValidation/split.js +1 -1
  23. package/cjs/utils/inputValidation/splits.js +2 -2
  24. package/cjs/utils/settingsValidation/index.js +1 -1
  25. package/esm/logger/constants.js +2 -2
  26. package/esm/logger/messages/debug.js +7 -7
  27. package/esm/logger/messages/error.js +2 -2
  28. package/esm/logger/messages/info.js +3 -3
  29. package/esm/logger/messages/warn.js +7 -7
  30. package/esm/sdkClient/client.js +20 -20
  31. package/esm/sdkClient/clientAttributesDecoration.js +8 -8
  32. package/esm/sdkClient/clientInputValidation.js +10 -10
  33. package/esm/sdkClient/sdkClient.js +1 -1
  34. package/esm/sdkFactory/index.js +1 -1
  35. package/esm/sdkManager/index.js +10 -8
  36. package/esm/services/splitHttpClient.js +1 -1
  37. package/esm/storages/inRedis/SplitsCacheInRedis.js +2 -2
  38. package/esm/storages/pluggable/SplitsCachePluggable.js +1 -1
  39. package/esm/sync/polling/updaters/segmentChangesUpdater.js +1 -1
  40. package/esm/sync/streaming/pushManager.js +1 -1
  41. package/esm/sync/submitters/telemetrySubmitter.js +2 -2
  42. package/esm/utils/inputValidation/apiKey.js +27 -26
  43. package/esm/utils/inputValidation/preloadedData.js +3 -3
  44. package/esm/utils/inputValidation/split.js +1 -1
  45. package/esm/utils/inputValidation/splits.js +2 -2
  46. package/esm/utils/settingsValidation/index.js +1 -1
  47. package/package.json +2 -2
  48. package/src/logger/constants.ts +2 -2
  49. package/src/logger/messages/debug.ts +7 -7
  50. package/src/logger/messages/error.ts +2 -2
  51. package/src/logger/messages/info.ts +3 -3
  52. package/src/logger/messages/warn.ts +7 -7
  53. package/src/sdkClient/client.ts +20 -20
  54. package/src/sdkClient/clientAttributesDecoration.ts +10 -10
  55. package/src/sdkClient/clientInputValidation.ts +10 -10
  56. package/src/sdkClient/sdkClient.ts +3 -3
  57. package/src/sdkFactory/index.ts +1 -1
  58. package/src/sdkManager/index.ts +11 -8
  59. package/src/services/splitHttpClient.ts +1 -1
  60. package/src/storages/inMemory/AttributesCacheInMemory.ts +7 -6
  61. package/src/storages/inRedis/SplitsCacheInRedis.ts +2 -2
  62. package/src/storages/pluggable/SplitsCachePluggable.ts +1 -1
  63. package/src/sync/polling/updaters/segmentChangesUpdater.ts +1 -1
  64. package/src/sync/streaming/pushManager.ts +1 -1
  65. package/src/sync/submitters/telemetrySubmitter.ts +2 -2
  66. package/src/types.ts +147 -140
  67. package/src/utils/inputValidation/apiKey.ts +25 -24
  68. package/src/utils/inputValidation/preloadedData.ts +3 -3
  69. package/src/utils/inputValidation/split.ts +1 -1
  70. package/src/utils/inputValidation/splits.ts +1 -1
  71. package/src/utils/settingsValidation/index.ts +1 -1
  72. package/types/logger/constants.d.ts +1 -1
  73. package/types/sdkClient/clientAttributesDecoration.d.ts +7 -7
  74. package/types/storages/inMemory/AttributesCacheInMemory.d.ts +4 -3
  75. package/types/types.d.ts +142 -135
  76. package/types/utils/inputValidation/apiKey.d.ts +5 -5
  77. package/types/utils/inputValidation/sdkKey.d.ts +7 -0
  78. package/types/utils/settingsValidation/index.d.ts +1 -1
  79. package/types/storages/metadataBuilder.d.ts +0 -3
  80. /package/types/storages/inMemory/{uniqueKeysCacheInMemory.d.ts → UniqueKeysCacheInMemory.d.ts} +0 -0
  81. /package/types/storages/inMemory/{uniqueKeysCacheInMemoryCS.d.ts → UniqueKeysCacheInMemoryCS.d.ts} +0 -0
  82. /package/types/storages/inRedis/{uniqueKeysCacheInRedis.d.ts → UniqueKeysCacheInRedis.d.ts} +0 -0
package/src/types.ts CHANGED
@@ -194,23 +194,23 @@ interface ISharedSettings {
194
194
  */
195
195
  sync?: {
196
196
  /**
197
- * List of Split filters. These filters are used to fetch a subset of the Splits definitions in your environment, in order to reduce the delay of the SDK to be ready.
197
+ * 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.
198
198
  * This configuration is only meaningful when the SDK is working in "standalone" mode.
199
199
  *
200
- * At the moment, two types of split filters are supported: by name and by prefix.
200
+ * At the moment, only one type of feature flag filter is supported: by name.
201
+ *
201
202
  * Example:
202
203
  * `splitFilter: [
203
- * { type: 'byName', values: ['my_split_1', 'my_split_2'] }, // will fetch splits named 'my_split_1' and 'my_split_2'
204
- * { type: 'byPrefix', values: ['testing'] } // will fetch splits whose names start with 'testing__' prefix
204
+ * { 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'
205
205
  * ]`
206
206
  * @property {SplitIO.SplitFilter[]} splitFilters
207
207
  */
208
208
  splitFilters?: SplitIO.SplitFilter[]
209
209
  /**
210
- * Impressions Collection Mode. Option to determine how impressions are going to be sent to Split Servers.
210
+ * Impressions Collection Mode. Option to determine how impressions are going to be sent to Split servers.
211
211
  * Possible values are 'DEBUG' and 'OPTIMIZED'.
212
212
  * - DEBUG: will send all the impressions generated (recommended only for debugging purposes).
213
- * - OPTIMIZED: will send unique impressions to Split Servers avoiding a considerable amount of traffic that duplicated impressions could generate.
213
+ * - OPTIMIZED: will send unique impressions to Split servers avoiding a considerable amount of traffic that duplicated impressions could generate.
214
214
  * @property {String} impressionsMode
215
215
  * @default 'OPTIMIZED'
216
216
  */
@@ -337,7 +337,7 @@ interface INodeBasicSettings extends ISharedSettings {
337
337
  */
338
338
  core: {
339
339
  /**
340
- * Your API key. More information: @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
340
+ * Your SDK key. More information: @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
341
341
  * @property {string} authorizationKey
342
342
  */
343
343
  authorizationKey: string,
@@ -362,14 +362,14 @@ interface INodeBasicSettings extends ISharedSettings {
362
362
  /**
363
363
  * The SDK mode. Possible values are "standalone" (which is the default) and "consumer". For "localhost" mode, use "localhost" as authorizationKey.
364
364
  * @property {SDKMode} mode
365
- * @default standalone
365
+ * @default 'standalone'
366
366
  */
367
367
  mode?: SDKMode,
368
368
  /**
369
369
  * Mocked features file path. For testing purposses only. For using this you should specify "localhost" as authorizationKey on core settings.
370
370
  * @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#localhost-mode}
371
371
  * @property {MockedFeaturesFilePath} features
372
- * @default $HOME/.split
372
+ * @default '$HOME/.split'
373
373
  */
374
374
  features?: SplitIO.MockedFeaturesFilePath,
375
375
  }
@@ -452,17 +452,17 @@ interface IBasicSDK {
452
452
  */
453
453
  export namespace SplitIO {
454
454
  /**
455
- * Split treatment value, returned by getTreatment.
455
+ * Feature flag treatment value, returned by getTreatment.
456
456
  * @typedef {string} Treatment
457
457
  */
458
458
  export type Treatment = string;
459
459
  /**
460
- * Split treatment promise that will resolve to actual treatment value.
460
+ * Feature flag treatment promise that will resolve to actual treatment value.
461
461
  * @typedef {Promise<string>} AsyncTreatment
462
462
  */
463
463
  export type AsyncTreatment = Promise<string>;
464
464
  /**
465
- * An object with the treatments for a bulk of splits, returned by getTreatments. For example:
465
+ * An object with the treatments for a bulk of feature flags, returned by getTreatments. For example:
466
466
  * {
467
467
  * feature1: 'on',
468
468
  * feature2: 'off
@@ -473,14 +473,14 @@ export namespace SplitIO {
473
473
  [featureName: string]: Treatment
474
474
  };
475
475
  /**
476
- * Split treatments promise that will resolve to the actual SplitIO.Treatments object.
476
+ * Feature flag treatments promise that will resolve to the actual SplitIO.Treatments object.
477
477
  * @typedef {Promise<Treatments>} AsyncTreatments
478
478
  */
479
479
  export type AsyncTreatments = Promise<Treatments>;
480
480
  /**
481
- * Split evaluation result with treatment and configuration, returned by getTreatmentWithConfig.
481
+ * Feature flag evaluation result with treatment and configuration, returned by getTreatmentWithConfig.
482
482
  * @typedef {Object} TreatmentWithConfig
483
- * @property {string} treatment The treatment result
483
+ * @property {string} treatment The treatment string
484
484
  * @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.
485
485
  */
486
486
  export type TreatmentWithConfig = {
@@ -488,13 +488,13 @@ export namespace SplitIO {
488
488
  config: string | null
489
489
  };
490
490
  /**
491
- * Split treatment promise that will resolve to actual treatment with config value.
491
+ * Feature flag treatment promise that will resolve to actual treatment with config value.
492
492
  * @typedef {Promise<TreatmentWithConfig>} AsyncTreatmentWithConfig
493
493
  */
494
494
  export type AsyncTreatmentWithConfig = Promise<TreatmentWithConfig>;
495
495
  /**
496
- * An object with the treatments with configs for a bulk of splits, returned by getTreatmentsWithConfig.
497
- * Each existing configuration is a stringified version of the JSON you defined on the Split web console. For example:
496
+ * An object with the treatments with configs for a bulk of feature flags, returned by getTreatmentsWithConfig.
497
+ * Each existing configuration is a stringified version of the JSON you defined on the Split user interface. For example:
498
498
  * {
499
499
  * feature1: { treatment: 'on', config: null }
500
500
  * feature2: { treatment: 'off', config: '{"bannerText":"Click here."}' }
@@ -505,7 +505,7 @@ export namespace SplitIO {
505
505
  [featureName: string]: TreatmentWithConfig
506
506
  };
507
507
  /**
508
- * Split treatments promise that will resolve to the actual SplitIO.TreatmentsWithConfig object.
508
+ * Feature flag treatments promise that will resolve to the actual SplitIO.TreatmentsWithConfig object.
509
509
  * @typedef {Promise<TreatmentsWithConfig>} AsyncTreatmentsWithConfig
510
510
  */
511
511
  export type AsyncTreatmentsWithConfig = Promise<TreatmentsWithConfig>;
@@ -515,15 +515,20 @@ export namespace SplitIO {
515
515
  */
516
516
  export type Event = 'init::timeout' | 'init::ready' | 'init::cache-ready' | 'state::update';
517
517
  /**
518
- * Split attributes should be on object with values of type string or number (dates should be sent as millis since epoch).
519
- * @typedef {Object.<number, string, boolean, string[], number[]>} Attributes
518
+ * Attributes should be on object with values of type string or number (dates should be sent as millis since epoch).
519
+ * @typedef {Object.<AttributeType>} Attributes
520
520
  * @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#attribute-syntax}
521
521
  */
522
522
  export type Attributes = {
523
- [attributeName: string]: string | number | boolean | Array<string | number>
523
+ [attributeName: string]: AttributeType
524
524
  };
525
525
  /**
526
- * Split properties should be an object with values of type string, number, boolean or null. Size limit of ~31kb.
526
+ * Type of an attribute value
527
+ * @typedef {string | number | boolean | Array<string | number>} AttributeType
528
+ */
529
+ export type AttributeType = string | number | boolean | Array<string | number>;
530
+ /**
531
+ * Properties should be an object with values of type string, number, boolean or null. Size limit of ~31kb.
527
532
  * @typedef {Object.<number, string, boolean, null>} Attributes
528
533
  * @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#track
529
534
  */
@@ -563,43 +568,43 @@ export namespace SplitIO {
563
568
  export type ImpressionData = {
564
569
  impression: ImpressionDTO,
565
570
  attributes?: SplitIO.Attributes,
566
- ip: string| false,
571
+ ip: string | false,
567
572
  hostname: string | false,
568
573
  sdkLanguageVersion: string
569
574
  };
570
575
  /**
571
- * Data corresponding to one Split view.
576
+ * Data corresponding to one feature flag view.
572
577
  * @typedef {Object} SplitView
573
578
  */
574
579
  export type SplitView = {
575
580
  /**
576
- * The name of the split.
581
+ * The name of the feature flag.
577
582
  * @property {string} name
578
583
  */
579
584
  name: string,
580
585
  /**
581
- * The traffic type of the split.
586
+ * The traffic type of the feature flag.
582
587
  * @property {string} trafficType
583
588
  */
584
589
  trafficType: string,
585
590
  /**
586
- * Whether the split is killed or not.
591
+ * Whether the feature flag is killed or not.
587
592
  * @property {boolean} killed
588
593
  */
589
594
  killed: boolean,
590
595
  /**
591
- * The list of treatments available for the split.
596
+ * The list of treatments available for the feature flag.
592
597
  * @property {Array<string>} treatments
593
598
  */
594
599
  treatments: Array<string>,
595
600
  /**
596
- * Current change number of the split.
601
+ * Current change number of the feature flag.
597
602
  * @property {number} changeNumber
598
603
  */
599
604
  changeNumber: number,
600
605
  /**
601
606
  * Map of configurations per treatment.
602
- * Each existing configuration is a stringified version of the JSON you defined on the Split web console.
607
+ * Each existing configuration is a stringified version of the JSON you defined on the Split user interface.
603
608
  * @property {Object.<string>} configs
604
609
  */
605
610
  configs: {
@@ -607,7 +612,7 @@ export namespace SplitIO {
607
612
  }
608
613
  };
609
614
  /**
610
- * A promise that will be resolved with that SplitView.
615
+ * A promise that resolves to a feature flag view.
611
616
  * @typedef {Promise<SplitView>} SplitView
612
617
  */
613
618
  export type SplitViewAsync = Promise<SplitView>;
@@ -616,17 +621,17 @@ export namespace SplitIO {
616
621
  */
617
622
  export type SplitViews = Array<SplitView>;
618
623
  /**
619
- * A promise that will be resolved with an SplitIO.SplitViews array.
624
+ * A promise that resolves to an SplitIO.SplitViews array.
620
625
  * @typedef {Promise<SplitViews>} SplitViewsAsync
621
626
  */
622
627
  export type SplitViewsAsync = Promise<SplitViews>;
623
628
  /**
624
- * An array of split names.
629
+ * An array of feature flag names.
625
630
  * @typedef {Array<string>} SplitNames
626
631
  */
627
632
  export type SplitNames = Array<string>;
628
633
  /**
629
- * A promise that will be resolved with an array of split names.
634
+ * A promise that resolves to an array of feature flag names.
630
635
  * @typedef {Promise<SplitNames>} SplitNamesAsync
631
636
  */
632
637
  export type SplitNamesAsync = Promise<SplitNames>;
@@ -670,7 +675,7 @@ export namespace SplitIO {
670
675
  */
671
676
  export type UrlSettings = {
672
677
  /**
673
- * String property to override the base URL where the SDK will get feature flagging related data like a Split rollout plan or segments information.
678
+ * String property to override the base URL where the SDK will get rollout plan related data, like feature flags and segments definitions.
674
679
  * @property {string} sdk
675
680
  * @default 'https://sdk.split.io/api'
676
681
  */
@@ -706,7 +711,7 @@ export namespace SplitIO {
706
711
  */
707
712
  export type SplitFilterType = 'byName' | 'byPrefix';
708
713
  /**
709
- * Defines a split filter, described by a type and list of values.
714
+ * Defines a feature flag filter, described by a type and list of values.
710
715
  */
711
716
  export interface SplitFilter {
712
717
  /**
@@ -715,7 +720,7 @@ export namespace SplitIO {
715
720
  */
716
721
  type: SplitFilterType,
717
722
  /**
718
- * List of values: split names for 'byName' filter type, and split prefixes for 'byPrefix' type.
723
+ * List of values: feature flag names for 'byName' filter type, and feature flag name prefixes for 'byPrefix' type.
719
724
  * @property {string[]} values
720
725
  */
721
726
  values: string[],
@@ -726,7 +731,7 @@ export namespace SplitIO {
726
731
  */
727
732
  export type ImpressionsMode = 'OPTIMIZED' | 'DEBUG' | 'NONE'
728
733
  /**
729
- * Defines the format of Split data to preload on the factory storage (cache).
734
+ * Defines the format of rollout plan data to preload on the factory storage (cache).
730
735
  */
731
736
  export interface PreloadedData {
732
737
  /**
@@ -741,7 +746,7 @@ export namespace SplitIO {
741
746
  */
742
747
  since: number,
743
748
  /**
744
- * Map of splits to their serialized definitions.
749
+ * Map of feature flags to their stringified definitions.
745
750
  */
746
751
  splitsData: {
747
752
  [splitName: string]: string
@@ -754,7 +759,7 @@ export namespace SplitIO {
754
759
  [key: string]: string[]
755
760
  },
756
761
  /**
757
- * Optional map of segments to their serialized definitions.
762
+ * Optional map of segments to their stringified definitions.
758
763
  * This property is ignored if `mySegmentsData` was provided.
759
764
  */
760
765
  segmentsData?: {
@@ -806,15 +811,15 @@ export namespace SplitIO {
806
811
  */
807
812
  scheduler?: {
808
813
  /**
809
- * The SDK polls Split servers for changes to feature roll-out plans. This parameter controls this polling period in seconds.
814
+ * The SDK polls Split servers for changes to feature flag definitions. This parameter controls this polling period in seconds.
810
815
  * @property {number} featuresRefreshRate
811
- * @default 30
816
+ * @default 60
812
817
  */
813
818
  featuresRefreshRate?: number,
814
819
  /**
815
820
  * 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.
816
821
  * @property {number} impressionsRefreshRate
817
- * @default 60
822
+ * @default 300
818
823
  */
819
824
  impressionsRefreshRate?: number,
820
825
  /**
@@ -828,7 +833,7 @@ export namespace SplitIO {
828
833
  * The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds.
829
834
  * @property {number} metricsRefreshRate
830
835
  * @default 120
831
- * @deprecated This parameter is ignored now.
836
+ * @deprecated This parameter is ignored now. Use `telemetryRefreshRate` instead.
832
837
  */
833
838
  metricsRefreshRate?: number,
834
839
  /**
@@ -877,7 +882,7 @@ export namespace SplitIO {
877
882
  */
878
883
  core: {
879
884
  /**
880
- * Your API key. More information: @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
885
+ * Your SDK key. More information: @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
881
886
  * @property {string} authorizationKey
882
887
  */
883
888
  authorizationKey: string,
@@ -1018,51 +1023,51 @@ export namespace SplitIO {
1018
1023
  */
1019
1024
  export interface IClient extends IBasicClient {
1020
1025
  /**
1021
- * Returns a Treatment value, which will be (or eventually be) the treatment string for the given feature.
1026
+ * Returns a Treatment value, which is the treatment string for the given feature.
1022
1027
  * @function getTreatment
1023
1028
  * @param {string} key - The string key representing the consumer.
1024
- * @param {string} splitName - The string that represents the split we wan't to get the treatment.
1029
+ * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
1025
1030
  * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1026
- * @returns {Treatment} The treatment or treatment promise which will resolve to the treatment string.
1031
+ * @returns {Treatment} The treatment string.
1027
1032
  */
1028
- getTreatment(key: SplitKey, splitName: string, attributes?: Attributes): Treatment,
1033
+ getTreatment(key: SplitKey, featureFlagName: string, attributes?: Attributes): Treatment,
1029
1034
  /**
1030
- * Returns a TreatmentWithConfig value (a map of treatment and config), which will be (or eventually be) the map with treatment and config for the given feature.
1035
+ * Returns a TreatmentWithConfig value, which is an object with both treatment and config string for the given feature.
1031
1036
  * @function getTreatmentWithConfig
1032
1037
  * @param {string} key - The string key representing the consumer.
1033
- * @param {string} splitName - The string that represents the split we wan't to get the treatment.
1038
+ * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
1034
1039
  * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1035
- * @returns {TreatmentWithConfig} The TreatmentWithConfig or TreatmentWithConfig promise which will resolve to the map containing
1036
- * the treatment and the configuration stringified JSON (or null if there was no config for that treatment).
1040
+ * @returns {TreatmentWithConfig} The TreatmentWithConfig, the object containing the treatment string and the
1041
+ * configuration stringified JSON (or null if there was no config for that treatment).
1037
1042
  */
1038
- getTreatmentWithConfig(key: SplitKey, splitName: string, attributes?: Attributes): TreatmentWithConfig,
1043
+ getTreatmentWithConfig(key: SplitKey, featureFlagName: string, attributes?: Attributes): TreatmentWithConfig,
1039
1044
  /**
1040
- * Returns a Treatments value, whick will be (or eventually be) an object with the treatments for the given features.
1045
+ * Returns a Treatments value, which is an object map with the treatments for the given features.
1041
1046
  * @function getTreatments
1042
1047
  * @param {string} key - The string key representing the consumer.
1043
- * @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
1048
+ * @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
1044
1049
  * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1045
- * @returns {Treatments} The treatments or treatments promise which will resolve to the treatments object.
1050
+ * @returns {Treatments} The treatments object map.
1046
1051
  */
1047
- getTreatments(key: SplitKey, splitNames: string[], attributes?: Attributes): Treatments,
1052
+ getTreatments(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): Treatments,
1048
1053
  /**
1049
- * Returns a TreatmentsWithConfig value, whick will be an object with the TreatmentWithConfig (a map with both treatment and config string) for the given features.
1054
+ * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
1050
1055
  * @function getTreatmentsWithConfig
1051
1056
  * @param {string} key - The string key representing the consumer.
1052
- * @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
1057
+ * @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
1053
1058
  * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1054
1059
  * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1055
1060
  */
1056
- getTreatmentsWithConfig(key: SplitKey, splitNames: string[], attributes?: Attributes): TreatmentsWithConfig,
1061
+ getTreatmentsWithConfig(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig,
1057
1062
  /**
1058
- * Tracks an event to be fed to the results product on Split Webconsole.
1063
+ * Tracks an event to be fed to the results product on Split user interface.
1059
1064
  * @function track
1060
1065
  * @param {SplitKey} key - The key that identifies the entity related to this event.
1061
1066
  * @param {string} trafficType - The traffic type of the entity related to this event.
1062
1067
  * @param {string} eventType - The event type corresponding to this event.
1063
1068
  * @param {number=} value - The value of this event.
1064
1069
  * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
1065
- * @returns {boolean} Whether the event was added to the queue succesfully or not.
1070
+ * @returns {boolean} Whether the event was added to the queue successfully or not.
1066
1071
  */
1067
1072
  track(key: SplitIO.SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): boolean,
1068
1073
  }
@@ -1078,51 +1083,51 @@ export namespace SplitIO {
1078
1083
  * NOTE: Treatment will be a promise only in async storages, like REDIS.
1079
1084
  * @function getTreatment
1080
1085
  * @param {string} key - The string key representing the consumer.
1081
- * @param {string} splitName - The string that represents the split we wan't to get the treatment.
1086
+ * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
1082
1087
  * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1083
- * @returns {AsyncTreatment} Treatment promise which will resolve to the treatment string.
1088
+ * @returns {AsyncTreatment} Treatment promise that resolves to the treatment string.
1084
1089
  */
1085
- getTreatment(key: SplitKey, splitName: string, attributes?: Attributes): AsyncTreatment,
1090
+ getTreatment(key: SplitKey, featureFlagName: string, attributes?: Attributes): AsyncTreatment,
1086
1091
  /**
1087
- * Returns a TreatmentWithConfig value, which will be (or eventually be) a map with both treatment and config string for the given feature.
1092
+ * Returns a TreatmentWithConfig value, which will be (or eventually be) an object with both treatment and config string for the given feature.
1088
1093
  * For usage on NodeJS as we don't have only one key.
1089
1094
  * NOTE: Treatment will be a promise only in async storages, like REDIS.
1090
1095
  * @function getTreatmentWithConfig
1091
1096
  * @param {string} key - The string key representing the consumer.
1092
- * @param {string} splitName - The string that represents the split we wan't to get the treatment.
1097
+ * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
1093
1098
  * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1094
- * @returns {AsyncTreatmentWithConfig} TreatmentWithConfig promise which will resolve to the TreatmentWithConfig object.
1099
+ * @returns {AsyncTreatmentWithConfig} TreatmentWithConfig promise that resolves to the TreatmentWithConfig object.
1095
1100
  */
1096
- getTreatmentWithConfig(key: SplitKey, splitName: string, attributes?: Attributes): AsyncTreatmentWithConfig,
1101
+ getTreatmentWithConfig(key: SplitKey, featureFlagName: string, attributes?: Attributes): AsyncTreatmentWithConfig,
1097
1102
  /**
1098
- * Returns a Treatments value, whick will be (or eventually be) an object with the treatments for the given features.
1103
+ * Returns a Treatments value, which will be (or eventually be) an object map with the treatments for the given features.
1099
1104
  * For usage on NodeJS as we don't have only one key.
1100
1105
  * @function getTreatments
1101
1106
  * @param {string} key - The string key representing the consumer.
1102
- * @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
1107
+ * @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
1103
1108
  * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1104
- * @returns {AsyncTreatments} Treatments promise which will resolve to the treatments object.
1109
+ * @returns {AsyncTreatments} Treatments promise that resolves to the treatments object map.
1105
1110
  */
1106
- getTreatments(key: SplitKey, splitNames: string[], attributes?: Attributes): AsyncTreatments,
1111
+ getTreatments(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): AsyncTreatments,
1107
1112
  /**
1108
- * Returns a Treatments value, whick will be (or eventually be) an object with all the maps of treatment and config string for the given features.
1113
+ * 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.
1109
1114
  * For usage on NodeJS as we don't have only one key.
1110
1115
  * @function getTreatmentsWithConfig
1111
1116
  * @param {string} key - The string key representing the consumer.
1112
- * @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
1117
+ * @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
1113
1118
  * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1114
- * @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise which will resolve to the map of TreatmentsWithConfig objects.
1119
+ * @returns {AsyncTreatmentsWithConfig} TreatmentsWithConfig promise that resolves to the map of TreatmentsWithConfig objects.
1115
1120
  */
1116
- getTreatmentsWithConfig(key: SplitKey, splitNames: string[], attributes?: Attributes): AsyncTreatmentsWithConfig,
1121
+ getTreatmentsWithConfig(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): AsyncTreatmentsWithConfig,
1117
1122
  /**
1118
- * Tracks an event to be fed to the results product on Split Webconsole and returns a promise to signal when the event was successfully queued (or not).
1123
+ * 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).
1119
1124
  * @function track
1120
1125
  * @param {SplitKey} key - The key that identifies the entity related to this event.
1121
1126
  * @param {string} trafficType - The traffic type of the entity related to this event.
1122
1127
  * @param {string} eventType - The event type corresponding to this event.
1123
1128
  * @param {number=} value - The value of this event.
1124
1129
  * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
1125
- * @returns {Promise<boolean>} A promise that resolves to a boolean indicating if the event was added to the queue succesfully or not.
1130
+ * @returns {Promise<boolean>} A promise that resolves to a boolean indicating if the event was added to the queue successfully or not.
1126
1131
  */
1127
1132
  track(key: SplitIO.SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): Promise<boolean>
1128
1133
  }
@@ -1133,84 +1138,86 @@ export namespace SplitIO {
1133
1138
  */
1134
1139
  export interface ICsClient extends IBasicClient {
1135
1140
  /**
1136
- * Returns a Treatment value, which will be the treatment string for the given feature.
1141
+ * Returns a Treatment value, which is the treatment string for the given feature.
1137
1142
  * @function getTreatment
1138
- * @param {string} splitName - The string that represents the split we wan't to get the treatment.
1143
+ * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
1139
1144
  * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1140
- * @returns {Treatment} The treatment result.
1145
+ * @returns {Treatment} The treatment string.
1141
1146
  */
1142
- getTreatment(splitName: string, attributes?: Attributes): Treatment,
1147
+ getTreatment(featureFlagName: string, attributes?: Attributes): Treatment,
1143
1148
  /**
1144
- * Returns a TreatmentWithConfig value, which will be a map of treatment and the config for that treatment.
1145
- * @function getTreatment
1146
- * @param {string} splitName - The string that represents the split we wan't to get the treatment.
1149
+ * Returns a TreatmentWithConfig value, which is an object with both treatment and config string for the given feature.
1150
+ * @function getTreatmentWithConfig
1151
+ * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
1147
1152
  * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1148
- * @returns {TreatmentWithConfig} The treatment or treatment promise which will resolve to the treatment string.
1153
+ * @returns {TreatmentWithConfig} The map containing the treatment and the configuration stringified JSON (or null if there was no config for that treatment).
1149
1154
  */
1150
- getTreatmentWithConfig(splitName: string, attributes?: Attributes): TreatmentWithConfig,
1155
+ getTreatmentWithConfig(featureFlagName: string, attributes?: Attributes): TreatmentWithConfig,
1151
1156
  /**
1152
- * Returns a Treatments value, whick will be (or eventually be) an object with the treatments for the given features.
1157
+ * Returns a Treatments value, which is an object map with the treatments for the given features.
1153
1158
  * @function getTreatments
1154
- * @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
1159
+ * @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
1155
1160
  * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1156
- * @returns {Treatments} The treatments or treatments promise which will resolve to the treatments object.
1161
+ * @returns {Treatments} The treatments object map.
1157
1162
  */
1158
- getTreatments(splitNames: string[], attributes?: Attributes): Treatments,
1163
+ getTreatments(featureFlagNames: string[], attributes?: Attributes): Treatments,
1159
1164
  /**
1160
- * Returns a TreatmentsWithConfig value, whick will be an object with the TreatmentWithConfig (a map with both treatment and config string) for the given features.
1165
+ * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
1161
1166
  * @function getTreatmentsWithConfig
1162
- * @param {Array<string>} splitNames - An array of the split names we wan't to get the treatments.
1167
+ * @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
1163
1168
  * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1164
1169
  * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1165
1170
  */
1166
- getTreatmentsWithConfig(splitNames: string[], attributes?: Attributes): TreatmentsWithConfig,
1171
+ getTreatmentsWithConfig(featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig,
1167
1172
  /**
1168
- * Tracks an event to be fed to the results product on Split Webconsole.
1173
+ * Tracks an event to be fed to the results product on Split user interface.
1169
1174
  * @function track
1170
- * @param {string} trafficType - The traffic type of the entity related to this event. NOTE: only has to be provided if the client doesn't have a traffic type
1175
+ * @param {string} trafficType - The traffic type of the entity related to this event.
1171
1176
  * @param {string} eventType - The event type corresponding to this event.
1172
1177
  * @param {number=} value - The value of this event.
1173
1178
  * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
1174
- * @returns {boolean} Whether the event was added to the queue succesfully or not.
1179
+ * @returns {boolean} Whether the event was added to the queue successfully or not.
1175
1180
  */
1176
- track(...args: [trafficType: string, eventType: string, value?: number, properties?: Properties] | [eventType: string, value?: number, properties?: Properties]): boolean,
1181
+ track(trafficType: string, eventType: string, value?: number, properties?: Properties): boolean,
1177
1182
  /**
1178
1183
  * Add an attribute to client's in memory attributes storage
1179
- * @function setAttribute
1180
- * @param {string} attributeName Attrinute name
1181
- * @param {string, number, boolean, list} attributeValue Attribute value
1182
- * @returns {boolean} true if the attribute was stored and false otherways
1184
+ *
1185
+ * @param {string} attributeName Attribute name
1186
+ * @param {AttributeType} attributeValue Attribute value
1187
+ * @returns {boolean} true if the attribute was stored and false otherwise
1183
1188
  */
1184
- setAttribute(attributeName: string, attributeValue: Object): boolean,
1189
+ setAttribute(attributeName: string, attributeValue: AttributeType): boolean,
1185
1190
  /**
1186
1191
  * Returns the attribute with the given key
1187
- * @function getAttribute
1192
+ *
1188
1193
  * @param {string} attributeName Attribute name
1189
- * @returns {Object} Attribute with the given key
1194
+ * @returns {AttributeType} Attribute with the given key
1190
1195
  */
1191
- getAttribute(attributeName: string): Object,
1196
+ getAttribute(attributeName: string): AttributeType,
1192
1197
  /**
1193
- * Add to client's in memory attributes storage the attributes in 'attributes'
1194
- * @function setAttributes
1195
- * @param {Object} attributes Object with attributes to store
1196
- * @returns true if attributes were stored an false otherways
1198
+ * Removes from client's in memory attributes storage the attribute with the given key.
1199
+ *
1200
+ * @param {string} attributeName
1201
+ * @returns {boolean} true if attribute was removed and false otherwise
1197
1202
  */
1198
- setAttributes(attributes: Record<string, Object>): boolean,
1203
+ removeAttribute(attributeName: string): boolean,
1199
1204
  /**
1200
- * Return all the attributes stored in client's in memory attributes storage
1201
- * @function getAttributes
1202
- * @returns {Object} returns all the stored attributes
1205
+ * Add to client's in memory attributes storage the attributes in 'attributes'.
1206
+ *
1207
+ * @param {Attributes} attributes Object with attributes to store
1208
+ * @returns true if attributes were stored an false otherwise
1203
1209
  */
1204
- getAttributes(): Record<string, Object>,
1210
+ setAttributes(attributes: Attributes): boolean,
1205
1211
  /**
1206
- * Removes from client's in memory attributes storage the attribute with the given key
1207
- * @function removeAttribute
1208
- * @param {string} attributeName
1209
- * @returns {boolean} true if attribute was removed and false otherways
1212
+ * Return all the attributes stored in client's in memory attributes storage.
1213
+ *
1214
+ * @returns {Attributes} returns all the stored attributes
1210
1215
  */
1211
- removeAttribute(attributeName: string): boolean,
1216
+ getAttributes(): Attributes,
1212
1217
  /**
1213
- * Remove all the stored attributes in the client's in memory attribute storage
1218
+ * Remove all the stored attributes in the client's in memory attribute storage.
1219
+ *
1220
+ * @returns {boolean} true if all attribute were removed and false otherwise
1214
1221
  */
1215
1222
  clearAttributes(): boolean
1216
1223
  }
@@ -1221,24 +1228,24 @@ export namespace SplitIO {
1221
1228
  */
1222
1229
  export interface IManager extends IStatusInterface {
1223
1230
  /**
1224
- * Get the array of Split names.
1231
+ * Get the array of feature flag names.
1225
1232
  * @function names
1226
- * @returns {SplitNames} The lists of Split names.
1233
+ * @returns {SplitNames} The list of feature flag names.
1227
1234
  */
1228
- names(): SplitNames;
1235
+ names(): SplitNames,
1229
1236
  /**
1230
- * Get the array of splits data in SplitView format.
1237
+ * Get the array of feature flags data in SplitView format.
1231
1238
  * @function splits
1232
1239
  * @returns {SplitViews} The list of SplitIO.SplitView.
1233
1240
  */
1234
- splits(): SplitViews;
1241
+ splits(): SplitViews,
1235
1242
  /**
1236
1243
  * Get the data of a split in SplitView format.
1237
1244
  * @function split
1238
- * @param {string} splitName The name of the split we wan't to get info of.
1245
+ * @param {string} featureFlagName The name of the feature flag we want to get info of.
1239
1246
  * @returns {SplitView} The SplitIO.SplitView of the given split.
1240
1247
  */
1241
- split(splitName: string): SplitView;
1248
+ split(featureFlagName: string): SplitView,
1242
1249
  }
1243
1250
  /**
1244
1251
  * Representation of a manager instance with asynchronous storage of the SDK.
@@ -1247,23 +1254,23 @@ export namespace SplitIO {
1247
1254
  */
1248
1255
  export interface IAsyncManager extends IStatusInterface {
1249
1256
  /**
1250
- * Get the array of Split names.
1257
+ * Get the array of feature flag names.
1251
1258
  * @function names
1252
- * @returns {SplitNamesAsync} A promise that will resolve to the array of Splitio.SplitNames.
1259
+ * @returns {SplitNamesAsync} A promise that resolves to the list of feature flag names.
1253
1260
  */
1254
- names(): SplitNamesAsync;
1261
+ names(): SplitNamesAsync,
1255
1262
  /**
1256
- * Get the array of splits data in SplitView format.
1263
+ * Get the array of feature flags data in SplitView format.
1257
1264
  * @function splits
1258
- * @returns {SplitViewsAsync} A promise that will resolve to the SplitIO.SplitView list.
1265
+ * @returns {SplitViewsAsync} A promise that resolves to the SplitIO.SplitView list.
1259
1266
  */
1260
- splits(): SplitViewsAsync;
1267
+ splits(): SplitViewsAsync,
1261
1268
  /**
1262
1269
  * Get the data of a split in SplitView format.
1263
1270
  * @function split
1264
- * @param {string} splitName The name of the split we wan't to get info of.
1265
- * @returns {SplitViewAsync} A promise that will resolve to the SplitIO.SplitView value.
1271
+ * @param {string} featureFlagName The name of the feature flag we want to get info of.
1272
+ * @returns {SplitViewAsync} A promise that resolves to the SplitIO.SplitView value.
1266
1273
  */
1267
- split(splitName: string): SplitViewAsync;
1274
+ split(featureFlagName: string): SplitViewAsync,
1268
1275
  }
1269
1276
  }