@splitsoftware/splitio 10.28.1-rc.4 → 11.0.0-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 (78) hide show
  1. package/CHANGES.txt +16 -7
  2. package/{lib → cjs}/factory/browser.js +9 -8
  3. package/{lib → cjs}/settings/browser.js +1 -3
  4. package/{lib → cjs}/settings/defaults/version.js +1 -1
  5. package/{lib → cjs}/settings/storage/browser.js +13 -2
  6. package/{lib → cjs}/sync/offline/splitsParserFromFile.js +1 -1
  7. package/client/package.json +2 -2
  8. package/{es → esm}/factory/browser.js +6 -5
  9. package/{es → esm}/settings/browser.js +1 -3
  10. package/esm/settings/defaults/version.js +1 -0
  11. package/esm/settings/storage/browser.js +29 -0
  12. package/{es → esm}/sync/offline/splitsParserFromFile.js +1 -1
  13. package/package.json +10 -15
  14. package/server/package.json +2 -2
  15. package/src/factory/browser.js +6 -6
  16. package/src/settings/browser.js +1 -3
  17. package/src/settings/defaults/version.js +1 -1
  18. package/src/settings/storage/browser.js +16 -2
  19. package/src/sync/offline/splitsParserFromFile.js +1 -1
  20. package/types/client/index.d.ts +1 -1
  21. package/types/index.d.ts +3 -3
  22. package/types/server/index.d.ts +2 -2
  23. package/types/splitio.d.ts +125 -288
  24. package/es/settings/defaults/version.js +0 -1
  25. package/es/settings/storage/browser.js +0 -18
  26. package/scripts/ga-to-split-autorequire.js +0 -1
  27. /package/{lib → cjs}/factory/node.js +0 -0
  28. /package/{es → cjs}/factory/package.json +0 -0
  29. /package/{lib → cjs}/index.js +0 -0
  30. /package/{lib → cjs}/platform/EventEmitter.js +0 -0
  31. /package/{lib → cjs}/platform/browser.js +0 -0
  32. /package/{lib → cjs}/platform/filter/bloomFilter.js +0 -0
  33. /package/{lib → cjs}/platform/getEventSource/browser.js +0 -0
  34. /package/{es → cjs}/platform/getEventSource/eventsource.js +0 -0
  35. /package/{lib → cjs}/platform/getEventSource/node.js +0 -0
  36. /package/{es → cjs}/platform/getEventSource/package.json +0 -0
  37. /package/{lib → cjs}/platform/getFetch/browser.js +0 -0
  38. /package/{lib → cjs}/platform/getFetch/node.js +0 -0
  39. /package/{es → cjs}/platform/getFetch/package.json +0 -0
  40. /package/{lib → cjs}/platform/getOptions/node.js +0 -0
  41. /package/{lib → cjs}/platform/node.js +0 -0
  42. /package/{es → cjs}/platform/package.json +0 -0
  43. /package/{lib → cjs}/settings/defaults/browser.js +0 -0
  44. /package/{lib → cjs}/settings/defaults/node.js +0 -0
  45. /package/{lib → cjs}/settings/integrations/browser.js +0 -0
  46. /package/{lib → cjs}/settings/node.js +0 -0
  47. /package/{es → cjs}/settings/package.json +0 -0
  48. /package/{lib → cjs}/settings/runtime/node.js +0 -0
  49. /package/{lib → cjs}/settings/storage/node.js +0 -0
  50. /package/{lib → cjs}/sync/offline/LocalhostFromFile.js +0 -0
  51. /package/{lib → cjs}/umd.js +0 -0
  52. /package/{lib → cjs}/utils/ip.js +0 -0
  53. /package/{es → esm}/factory/node.js +0 -0
  54. /package/{lib → esm}/factory/package.json +0 -0
  55. /package/{es → esm}/index.js +0 -0
  56. /package/{es → esm}/platform/EventEmitter.js +0 -0
  57. /package/{es → esm}/platform/browser.js +0 -0
  58. /package/{es → esm}/platform/filter/bloomFilter.js +0 -0
  59. /package/{es → esm}/platform/getEventSource/browser.js +0 -0
  60. /package/{lib → esm}/platform/getEventSource/eventsource.js +0 -0
  61. /package/{es → esm}/platform/getEventSource/node.js +0 -0
  62. /package/{lib → esm}/platform/getEventSource/package.json +0 -0
  63. /package/{es → esm}/platform/getFetch/browser.js +0 -0
  64. /package/{es → esm}/platform/getFetch/node.js +0 -0
  65. /package/{lib → esm}/platform/getFetch/package.json +0 -0
  66. /package/{es → esm}/platform/getOptions/node.js +0 -0
  67. /package/{es → esm}/platform/node.js +0 -0
  68. /package/{lib → esm}/platform/package.json +0 -0
  69. /package/{es → esm}/settings/defaults/browser.js +0 -0
  70. /package/{es → esm}/settings/defaults/node.js +0 -0
  71. /package/{es → esm}/settings/integrations/browser.js +0 -0
  72. /package/{es → esm}/settings/node.js +0 -0
  73. /package/{lib → esm}/settings/package.json +0 -0
  74. /package/{es → esm}/settings/runtime/node.js +0 -0
  75. /package/{es → esm}/settings/storage/node.js +0 -0
  76. /package/{es → esm}/sync/offline/LocalhostFromFile.js +0 -0
  77. /package/{es → esm}/umd.js +0 -0
  78. /package/{es → esm}/utils/ip.js +0 -0
@@ -2,7 +2,6 @@
2
2
  // Project: http://www.split.io/
3
3
  // Definitions by: Nico Zelaya <https://github.com/NicoZelaya/>
4
4
 
5
- /// <reference types="google.analytics" />
6
5
  import { RedisOptions } from "ioredis";
7
6
  import { RequestOptions } from "http";
8
7
 
@@ -63,7 +62,6 @@ interface ISettings {
63
62
  readonly core: {
64
63
  authorizationKey: string,
65
64
  key: SplitIO.SplitKey,
66
- trafficType: string,
67
65
  labelsEnabled: boolean,
68
66
  IPAddressesEnabled: boolean
69
67
  },
@@ -355,7 +353,7 @@ interface INodeBasicSettings extends ISharedSettings {
355
353
  eventsQueueSize?: number,
356
354
  /**
357
355
  * For mocking/testing only. The SDK will refresh the features mocked data when mode is set to "localhost" by defining the key.
358
- * For more information @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#localhost-mode}
356
+ * For more information see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#localhost-mode}
359
357
  * @property {number} offlineRefreshRate
360
358
  * @default 15
361
359
  */
@@ -374,7 +372,8 @@ interface INodeBasicSettings extends ISharedSettings {
374
372
  */
375
373
  core: {
376
374
  /**
377
- * Your SDK key. More information: @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
375
+ * Your SDK key.
376
+ * @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
378
377
  * @property {string} authorizationKey
379
378
  */
380
379
  authorizationKey: string,
@@ -422,7 +421,7 @@ interface INodeBasicSettings extends ISharedSettings {
422
421
  */
423
422
  mode?: SDKMode,
424
423
  /**
425
- * Mocked features file path. For testing purposses only. For using this you should specify "localhost" as authorizationKey on core settings.
424
+ * Mocked features file path. For testing purposes only. For using this you should specify "localhost" as authorizationKey on core settings.
426
425
  * @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#localhost-mode}
427
426
  * @property {MockedFeaturesFilePath} features
428
427
  * @default '$HOME/.split'
@@ -441,9 +440,8 @@ interface IStatusInterface extends EventEmitter {
441
440
  */
442
441
  Event: EventConsts,
443
442
  /**
444
- * Returns a promise that resolves once the SDK has finished loading (SDK_READY event emitted) or rejected if the SDK has timedout (SDK_READY_TIMED_OUT event emitted).
445
- * As it's meant to provide similar flexibility to the event approach, given that the SDK might be eventually ready after a timeout event, calling the `ready` method after the
446
- * SDK had timed out will return a new promise that should eventually resolve if the SDK gets ready.
443
+ * 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).
444
+ * As it's meant to provide similar flexibility to the event approach, given that the SDK might be eventually ready after a timeout event, the `ready` method will return a resolved promise once the SDK is ready.
447
445
  *
448
446
  * Caveats: the method was designed to avoid an unhandled Promise rejection if the rejection case is not handled, so that `onRejected` handler is optional when using promises.
449
447
  * However, when using async/await syntax, the rejection should be explicitly propagated like in the following example:
@@ -501,9 +499,8 @@ interface IBasicSDK {
501
499
  }
502
500
  /****** Exposed namespace ******/
503
501
  /**
504
- * Types and interfaces for @splitsoftware/splitio package for usage when integrating javascript sdk on typescript apps.
505
- * For the SDK package information
506
- * @see {@link https://www.npmjs.com/package/@splitsoftware/splitio}
502
+ * Types and interfaces for `@splitsoftware/splitio` package for usage when integrating JavaScript SDK with TypeScript.
503
+ * For the SDK package information see {@link https://www.npmjs.com/package/@splitsoftware/splitio}
507
504
  */
508
505
  declare namespace SplitIO {
509
506
  /**
@@ -733,154 +730,6 @@ declare namespace SplitIO {
733
730
  interface IImpressionListener {
734
731
  logImpression(data: SplitIO.ImpressionData): void
735
732
  }
736
- /**
737
- * A pair of user key and it's trafficType, required for tracking valid Split events.
738
- * @typedef {Object} Identity
739
- * @property {string} key The user key.
740
- * @property {string} trafficType The key traffic type.
741
- */
742
- type Identity = {
743
- key: string;
744
- trafficType: string;
745
- };
746
- /**
747
- * Object with information about a Split event.
748
- * @typedef {Object} EventData
749
- */
750
- type EventData = {
751
- eventTypeId: string;
752
- value?: number;
753
- properties?: Properties;
754
- trafficTypeName?: string;
755
- key?: string;
756
- timestamp?: number;
757
- };
758
- /**
759
- * Enable 'Google Analytics to Split' integration, to track Google Analytics hits as Split events.
760
- *
761
- * @see {@link https://help.split.io/hc/en-us/articles/360040838752#google-analytics-to-split}
762
- */
763
- interface IGoogleAnalyticsToSplitConfig {
764
- type: 'GOOGLE_ANALYTICS_TO_SPLIT',
765
- /**
766
- * Optional flag to filter GA hits from being tracked as Split events.
767
- * @property {boolean} hits
768
- * @default true
769
- */
770
- hits?: boolean,
771
- /**
772
- * Optional predicate used to define a custom filter for tracking GA hits as Split events.
773
- * For example, the following filter allows to track only 'event' hits:
774
- * `(model) => model.get('hitType') === 'event'`
775
- * By default, all hits are tracked as Split events.
776
- */
777
- filter?: (model: UniversalAnalytics.Model) => boolean,
778
- /**
779
- * Optional function useful when you need to modify the Split event before tracking it.
780
- * This function is invoked with two arguments:
781
- * 1. the GA model object representing the hit.
782
- * 2. the default format of the mapped Split event instance.
783
- * The return value must be a Split event, that can be the second argument or a new object.
784
- *
785
- * For example, the following mapper adds a custom property to events:
786
- * `(model, defaultMapping) => {
787
- * defaultMapping.properties.someProperty = SOME_VALUE;
788
- * return defaultMapping;
789
- * }`
790
- */
791
- mapper?: (model: UniversalAnalytics.Model, defaultMapping: SplitIO.EventData) => SplitIO.EventData,
792
- /**
793
- * Optional prefix for EventTypeId, to prevent any kind of data collision between events.
794
- * @property {string} prefix
795
- * @default 'ga'
796
- */
797
- prefix?: string,
798
- /**
799
- * List of Split identities (key & traffic type pairs) used to track events.
800
- * If not provided, events are sent using the key and traffic type provided at SDK config
801
- */
802
- identities?: Identity[],
803
- /**
804
- * Optional flag to log an error if the `auto-require` script is not detected.
805
- * The auto-require script automatically requires the `splitTracker` plugin for created trackers,
806
- * and should be placed right after your Google Analytics, Google Tag Manager or gtag.js script tag.
807
- *
808
- * @see {@link https://help.split.io/hc/en-us/articles/360040838752#set-up-with-gtm-and-gtag.js}
809
- *
810
- * @property {boolean} autoRequire
811
- * @default false
812
- */
813
- autoRequire?: boolean,
814
- }
815
- /**
816
- * Object representing the data sent by Split (events and impressions).
817
- * @typedef {Object} IntegrationData
818
- * @property {string} type The type of Split data, either 'IMPRESSION' or 'EVENT'.
819
- * @property {ImpressionData | EventData} payload The data instance itself.
820
- */
821
- type IntegrationData = { type: 'IMPRESSION', payload: SplitIO.ImpressionData } | { type: 'EVENT', payload: SplitIO.EventData };
822
- /**
823
- * Enable 'Split to Google Analytics' integration, to track Split impressions and events as Google Analytics hits.
824
- *
825
- * @see {@link https://help.split.io/hc/en-us/articles/360040838752#split-to-google-analytics}
826
- */
827
- interface ISplitToGoogleAnalyticsConfig {
828
- type: 'SPLIT_TO_GOOGLE_ANALYTICS',
829
- /**
830
- * Optional flag to filter Split impressions from being tracked as GA hits.
831
- * @property {boolean} impressions
832
- * @default true
833
- */
834
- impressions?: boolean,
835
- /**
836
- * Optional flag to filter Split events from being tracked as GA hits.
837
- * @property {boolean} events
838
- * @default true
839
- */
840
- events?: boolean,
841
- /**
842
- * Optional predicate used to define a custom filter for tracking Split data (events and impressions) as GA hits.
843
- * For example, the following filter allows to track only impressions, equivalent to setting events to false:
844
- * `(data) => data.type === 'IMPRESSION'`
845
- */
846
- filter?: (data: SplitIO.IntegrationData) => boolean,
847
- /**
848
- * Optional function useful when you need to modify the GA hit before sending it.
849
- * This function is invoked with two arguments:
850
- * 1. the input data (Split event or impression).
851
- * 2. the default format of the mapped FieldsObject instance (GA hit).
852
- * The return value must be a FieldsObject, that can be the second argument or a new object.
853
- *
854
- * For example, the following mapper adds a custom dimension to hits:
855
- * `(data, defaultMapping) => {
856
- * defaultMapping.dimension1 = SOME_VALUE;
857
- * return defaultMapping;
858
- * }`
859
- *
860
- * Default FieldsObject instance for data.type === 'IMPRESSION':
861
- * `{
862
- * hitType: 'event',
863
- * eventCategory: 'split-impression',
864
- * eventAction: 'Evaluate ' + data.payload.impression.feature,
865
- * eventLabel: 'Treatment: ' + data.payload.impression.treatment + '. Targeting rule: ' + data.payload.impression.label + '.',
866
- * nonInteraction: true,
867
- * }`
868
- * Default FieldsObject instance for data.type === 'EVENT':
869
- * `{
870
- * hitType: 'event',
871
- * eventCategory: 'split-event',
872
- * eventAction: data.payload.eventTypeId,
873
- * eventValue: data.payload.value,
874
- * nonInteraction: true,
875
- * }`
876
- */
877
- mapper?: (data: SplitIO.IntegrationData, defaultMapping: UniversalAnalytics.FieldsObject) => UniversalAnalytics.FieldsObject,
878
- /**
879
- * List of tracker names to send the hit. An empty string represents the default tracker.
880
- * If not provided, hits are only sent to default tracker.
881
- */
882
- trackerNames?: string[],
883
- }
884
733
  /**
885
734
  * Available URL settings for the SDKs.
886
735
  */
@@ -917,10 +766,6 @@ declare namespace SplitIO {
917
766
  telemetry?: string
918
767
  };
919
768
 
920
- /**
921
- * Available integration options for the browser
922
- */
923
- type BrowserIntegration = ISplitToGoogleAnalyticsConfig | IGoogleAnalyticsToSplitConfig;
924
769
  /**
925
770
  * SplitFilter type.
926
771
  *
@@ -1055,7 +900,7 @@ declare namespace SplitIO {
1055
900
  eventsQueueSize?: number,
1056
901
  /**
1057
902
  * For mocking/testing only. The SDK will refresh the features mocked data when mode is set to "localhost" by defining the key.
1058
- * For more information @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#localhost-mode}
903
+ * For more information see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#localhost-mode}
1059
904
  * @property {number} offlineRefreshRate
1060
905
  * @default 15
1061
906
  */
@@ -1074,21 +919,17 @@ declare namespace SplitIO {
1074
919
  */
1075
920
  core: {
1076
921
  /**
1077
- * Your SDK key. More information: @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
922
+ * Your SDK key.
923
+ * @see {@link https://help.split.io/hc/en-us/articles/360019916211-API-keys}
1078
924
  * @property {string} authorizationKey
1079
925
  */
1080
926
  authorizationKey: string,
1081
927
  /**
1082
- * Customer identifier. Whatever this means to you. @see {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
928
+ * Customer identifier. Whatever this means to you.
929
+ * @see {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
1083
930
  * @property {SplitKey} key
1084
931
  */
1085
932
  key: SplitKey,
1086
- /**
1087
- * Traffic type associated with the customer identifier. @see {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
1088
- * If no provided as a setting it will be required on the client.track() calls.
1089
- * @property {string} trafficType
1090
- */
1091
- trafficType?: string,
1092
933
  /**
1093
934
  * Disable labels from being sent to Split backend. Labels may contain sensitive information.
1094
935
  * @property {boolean} labelsEnabled
@@ -1097,7 +938,7 @@ declare namespace SplitIO {
1097
938
  labelsEnabled?: boolean
1098
939
  },
1099
940
  /**
1100
- * Mocked features map. For testing purposses only. For using this you should specify "localhost" as authorizationKey on core settings.
941
+ * Mocked features map. For testing purposes only. For using this you should specify "localhost" as authorizationKey on core settings.
1101
942
  * @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#localhost-mode}
1102
943
  */
1103
944
  features?: MockedFeaturesMap,
@@ -1130,11 +971,6 @@ declare namespace SplitIO {
1130
971
  * @property {Object} urls
1131
972
  */
1132
973
  urls?: UrlSettings,
1133
- /**
1134
- * SDK integration settings for the Browser.
1135
- * @property {Object} integrations
1136
- */
1137
- integrations?: BrowserIntegration[],
1138
974
  /**
1139
975
  * User consent status. Possible values are `'GRANTED'`, which is the default, `'DECLINED'` or `'UNKNOWN'`.
1140
976
  * - `'GRANTED'`: the user grants consent for tracking events and impressions. The SDK sends them to Split cloud.
@@ -1416,10 +1252,9 @@ declare namespace SplitIO {
1416
1252
  * Returns a shared client of the SDK.
1417
1253
  * @function client
1418
1254
  * @param {SplitKey} key The key for the new client instance.
1419
- * @param {string=} trafficType The traffic type of the provided key.
1420
1255
  * @returns {IBrowserClient} The client instance.
1421
1256
  */
1422
- client(key: SplitKey, trafficType?: string): IBrowserClient
1257
+ client(key: SplitKey): IBrowserClient
1423
1258
  /**
1424
1259
  * Returns a manager instance of the SDK to explore available information.
1425
1260
  * @function manager
@@ -1452,14 +1287,16 @@ declare namespace SplitIO {
1452
1287
  manager(): IAsyncManager
1453
1288
  }
1454
1289
  /**
1455
- * This represents the interface for the Client instance with synchronous storage.
1290
+ * This represents the interface for the Client instance on server-side, where the user key is not bound to the instance and must be provided on each method call.
1291
+ * This interface is available in NodeJS, or when importing the 'server' sub-package (e.g., `import { SplitFactory } from '@splitsoftware/splitio/server'`).
1292
+ *
1456
1293
  * @interface IClient
1457
1294
  * @extends IBasicClient
1458
1295
  */
1459
1296
  interface IClient extends IBasicClient {
1460
1297
  /**
1461
1298
  * Returns a Treatment value, which is the treatment string for the given feature.
1462
- * For usage on NodeJS as we don't have only one key.
1299
+ *
1463
1300
  * @function getTreatment
1464
1301
  * @param {string} key - The string key representing the consumer.
1465
1302
  * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
@@ -1467,18 +1304,9 @@ declare namespace SplitIO {
1467
1304
  * @returns {Treatment} The treatment string.
1468
1305
  */
1469
1306
  getTreatment(key: SplitKey, featureFlagName: string, attributes?: Attributes): Treatment,
1470
- /**
1471
- * Returns a Treatment value, which is the treatment string for the given feature.
1472
- * For usage on the Browser as we defined the key on the settings.
1473
- * @function getTreatment
1474
- * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
1475
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1476
- * @returns {Treatment} The treatment string.
1477
- */
1478
- getTreatment(featureFlagName: string, attributes?: Attributes): Treatment,
1479
1307
  /**
1480
1308
  * Returns a TreatmentWithConfig value, which is an object with both treatment and config string for the given feature.
1481
- * For usage on NodeJS as we don't have only one key.
1309
+ *
1482
1310
  * @function getTreatmentWithConfig
1483
1311
  * @param {string} key - The string key representing the consumer.
1484
1312
  * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
@@ -1487,20 +1315,9 @@ declare namespace SplitIO {
1487
1315
  * configuration stringified JSON (or null if there was no config for that treatment).
1488
1316
  */
1489
1317
  getTreatmentWithConfig(key: SplitKey, featureFlagName: string, attributes?: Attributes): TreatmentWithConfig,
1490
- /**
1491
- * Returns a TreatmentWithConfig value, which an object with both treatment and config string for the given feature.
1492
- * For usage on the Browser as we defined the key on the settings.
1493
- * @function getTreatmentWithConfig
1494
- * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
1495
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1496
- * @returns {TreatmentWithConfig} The TreatmentWithConfig, the object containing the treatment string and the
1497
- * configuration stringified JSON (or null if there was no config for that treatment).
1498
- */
1499
- getTreatmentWithConfig(featureFlagName: string, attributes?: Attributes): TreatmentWithConfig,
1500
1318
  /**
1501
1319
  * Returns a Treatments value, which is an object map with the treatments for the given features.
1502
- * For usage on NodeJS as we don't have only one key.
1503
- * NOTE: Treatment will be a promise only in async storages, like REDIS.
1320
+ *
1504
1321
  * @function getTreatments
1505
1322
  * @param {string} key - The string key representing the consumer.
1506
1323
  * @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
@@ -1508,19 +1325,9 @@ declare namespace SplitIO {
1508
1325
  * @returns {Treatments} The treatments object map.
1509
1326
  */
1510
1327
  getTreatments(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): Treatments,
1511
- /**
1512
- * Returns a Treatments value, which is an object map with the treatments for the given features.
1513
- * For usage on the Browser as we defined the key on the settings.
1514
- * NOTE: Treatment will be a promise only in async storages, like REDIS.
1515
- * @function getTreatments
1516
- * @param {Array<string>} featureFlagNames - An array of the feature flags names we want to get the treatments.
1517
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1518
- * @returns {Treatments} The treatments object map.
1519
- */
1520
- getTreatments(featureFlagNames: string[], attributes?: Attributes): Treatments,
1521
1328
  /**
1522
1329
  * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
1523
- * For usage on NodeJS as we don't have only one key.
1330
+ *
1524
1331
  * @function getTreatmentsWithConfig
1525
1332
  * @param {string} key - The string key representing the consumer.
1526
1333
  * @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
@@ -1528,17 +1335,9 @@ declare namespace SplitIO {
1528
1335
  * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1529
1336
  */
1530
1337
  getTreatmentsWithConfig(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig,
1531
- /**
1532
- * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
1533
- * For usage on the Browser as we defined the key on the settings.
1534
- * @function getTreatmentsWithConfig
1535
- * @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
1536
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1537
- * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1538
- */
1539
- getTreatmentsWithConfig(featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig,
1540
1338
  /**
1541
1339
  * Returns a Treatments value, which is an object map with the treatments for the feature flags related to the given flag set.
1340
+ *
1542
1341
  * @function getTreatmentsByFlagSet
1543
1342
  * @param {string} key - The string key representing the consumer.
1544
1343
  * @param {string} flagSet - The flag set name we want to get the treatments.
@@ -1546,16 +1345,9 @@ declare namespace SplitIO {
1546
1345
  * @returns {Treatments} The map with all the Treatments objects
1547
1346
  */
1548
1347
  getTreatmentsByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): Treatments,
1549
- /**
1550
- * Returns a Treatments value, which is an object map with the treatments for the feature flags related to the given flag set.
1551
- * @function getTreatmentsByFlagSet
1552
- * @param {string} flagSet - The flag set name we want to get the treatments.
1553
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1554
- * @returns {Treatments} The map with all the Treatments objects
1555
- */
1556
- getTreatmentsByFlagSet(flagSet: string, attributes?: Attributes): Treatments,
1557
1348
  /**
1558
1349
  * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag set.
1350
+ *
1559
1351
  * @function getTreatmentsWithConfigByFlagSet
1560
1352
  * @param {string} key - The string key representing the consumer.
1561
1353
  * @param {string} flagSet - The flag set name we want to get the treatments.
@@ -1563,16 +1355,9 @@ declare namespace SplitIO {
1563
1355
  * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1564
1356
  */
1565
1357
  getTreatmentsWithConfigByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): TreatmentsWithConfig,
1566
- /**
1567
- * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag set.
1568
- * @function getTreatmentsWithConfigByFlagSet
1569
- * @param {string} flagSet - The flag set name we want to get the treatments.
1570
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1571
- * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1572
- */
1573
- getTreatmentsWithConfigByFlagSet(flagSet: string, attributes?: Attributes): TreatmentsWithConfig,
1574
1358
  /**
1575
1359
  * Returns a Returns a Treatments value, which is an object with both treatment and config string for to the feature flags related to the given flag sets.
1360
+ *
1576
1361
  * @function getTreatmentsByFlagSets
1577
1362
  * @param {string} key - The string key representing the consumer.
1578
1363
  * @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
@@ -1580,16 +1365,9 @@ declare namespace SplitIO {
1580
1365
  * @returns {Treatments} The map with all the Treatments objects
1581
1366
  */
1582
1367
  getTreatmentsByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): Treatments,
1583
- /**
1584
- * Returns a Returns a Treatments value, which is an object with both treatment and config string for to the feature flags related to the given flag sets.
1585
- * @function getTreatmentsByFlagSets
1586
- * @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
1587
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1588
- * @returns {Treatments} The map with all the Treatments objects
1589
- */
1590
- getTreatmentsByFlagSets(flagSets: string[], attributes?: Attributes): Treatments,
1591
1368
  /**
1592
1369
  * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag sets.
1370
+ *
1593
1371
  * @function getTreatmentsWithConfigByFlagSets
1594
1372
  * @param {string} key - The string key representing the consumer.
1595
1373
  * @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
@@ -1597,54 +1375,111 @@ declare namespace SplitIO {
1597
1375
  * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1598
1376
  */
1599
1377
  getTreatmentsWithConfigByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): TreatmentsWithConfig,
1600
- /**
1601
- * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag sets.
1602
- * @function getTreatmentsWithConfigByFlagSets
1603
- * @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
1604
- * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1605
- * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1606
- */
1607
- getTreatmentsWithConfigByFlagSets(flagSets: string[], attributes?: Attributes): TreatmentsWithConfig,
1608
1378
  /**
1609
1379
  * Tracks an event to be fed to the results product on Split user interface.
1610
- * For usage on NodeJS as we don't have only one key.
1380
+ *
1611
1381
  * @function track
1612
1382
  * @param {SplitKey} key - The key that identifies the entity related to this event.
1613
- * @param {string} trafficType - The traffic type of the entity related to this event.
1383
+ * @param {string} trafficType - The traffic type of the entity related to this event. See {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
1614
1384
  * @param {string} eventType - The event type corresponding to this event.
1615
1385
  * @param {number=} value - The value of this event.
1616
1386
  * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
1617
1387
  * @returns {boolean} Whether the event was added to the queue successfully or not.
1618
1388
  */
1619
1389
  track(key: SplitIO.SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): boolean,
1390
+ }
1391
+ /**
1392
+ * This represents the interface for the Client instance on client-side, where the user key is bound to the instance on creation and does not need to be provided on each method call.
1393
+ * This interface is the default when importing the SDK in the Browser, or when importing the 'client' sub-package (e.g., `import { SplitFactory } from '@splitsoftware/splitio/client'`).
1394
+ *
1395
+ * @interface IBrowserClient
1396
+ * @extends IBasicClient
1397
+ */
1398
+ interface IBrowserClient extends IBasicClient {
1620
1399
  /**
1621
- * Tracks an event to be fed to the results product on Split user interface.
1622
- * For usage on the Browser as we defined the key on the settings.
1623
- * @function track
1624
- * @param {string} trafficType - The traffic type of the entity related to this event.
1625
- * @param {string} eventType - The event type corresponding to this event.
1626
- * @param {number=} value - The value of this event.
1627
- * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
1628
- * @returns {boolean} Whether the event was added to the queue successfully or not.
1400
+ * Returns a Treatment value, which is the treatment string for the given feature.
1401
+ *
1402
+ * @function getTreatment
1403
+ * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
1404
+ * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1405
+ * @returns {Treatment} The treatment string.
1629
1406
  */
1630
- track(trafficType: string, eventType: string, value?: number, properties?: Properties): boolean,
1407
+ getTreatment(featureFlagName: string, attributes?: Attributes): Treatment,
1408
+ /**
1409
+ * Returns a TreatmentWithConfig value, which an object with both treatment and config string for the given feature.
1410
+ *
1411
+ * @function getTreatmentWithConfig
1412
+ * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
1413
+ * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1414
+ * @returns {TreatmentWithConfig} The TreatmentWithConfig, the object containing the treatment string and the
1415
+ * configuration stringified JSON (or null if there was no config for that treatment).
1416
+ */
1417
+ getTreatmentWithConfig(featureFlagName: string, attributes?: Attributes): TreatmentWithConfig,
1418
+ /**
1419
+ * Returns a Treatments value, which is an object map with the treatments for the given features.
1420
+ *
1421
+ * @function getTreatments
1422
+ * @param {Array<string>} featureFlagNames - An array of the feature flags names we want to get the treatments.
1423
+ * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1424
+ * @returns {Treatments} The treatments object map.
1425
+ */
1426
+ getTreatments(featureFlagNames: string[], attributes?: Attributes): Treatments,
1427
+ /**
1428
+ * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the given features.
1429
+ *
1430
+ * @function getTreatmentsWithConfig
1431
+ * @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
1432
+ * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1433
+ * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1434
+ */
1435
+ getTreatmentsWithConfig(featureFlagNames: string[], attributes?: Attributes): TreatmentsWithConfig,
1436
+ /**
1437
+ * Returns a Treatments value, which is an object map with the treatments for the feature flags related to the given flag set.
1438
+ *
1439
+ * @function getTreatmentsByFlagSet
1440
+ * @param {string} flagSet - The flag set name we want to get the treatments.
1441
+ * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1442
+ * @returns {Treatments} The map with all the Treatments objects
1443
+ */
1444
+ getTreatmentsByFlagSet(flagSet: string, attributes?: Attributes): Treatments,
1445
+ /**
1446
+ * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag set.
1447
+ *
1448
+ * @function getTreatmentsWithConfigByFlagSet
1449
+ * @param {string} flagSet - The flag set name we want to get the treatments.
1450
+ * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1451
+ * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1452
+ */
1453
+ getTreatmentsWithConfigByFlagSet(flagSet: string, attributes?: Attributes): TreatmentsWithConfig,
1454
+ /**
1455
+ * Returns a Returns a Treatments value, which is an object with both treatment and config string for to the feature flags related to the given flag sets.
1456
+ *
1457
+ * @function getTreatmentsByFlagSets
1458
+ * @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
1459
+ * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1460
+ * @returns {Treatments} The map with all the Treatments objects
1461
+ */
1462
+ getTreatmentsByFlagSets(flagSets: string[], attributes?: Attributes): Treatments,
1463
+ /**
1464
+ * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag sets.
1465
+ *
1466
+ * @function getTreatmentsWithConfigByFlagSets
1467
+ * @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
1468
+ * @param {Attributes=} attributes - An object of type Attributes defining the attributes for the given key.
1469
+ * @returns {TreatmentsWithConfig} The map with all the TreatmentWithConfig objects
1470
+ */
1471
+ getTreatmentsWithConfigByFlagSets(flagSets: string[], attributes?: Attributes): TreatmentsWithConfig,
1631
1472
  /**
1632
1473
  * Tracks an event to be fed to the results product on Split user interface.
1633
- * For usage on the Browser if we defined the key and also the trafficType on the settings.
1474
+ *
1634
1475
  * @function track
1476
+ * @param {string} trafficType - The traffic type of the entity related to this event. See {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
1635
1477
  * @param {string} eventType - The event type corresponding to this event.
1636
1478
  * @param {number=} value - The value of this event.
1637
1479
  * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.
1638
1480
  * @returns {boolean} Whether the event was added to the queue successfully or not.
1639
1481
  */
1640
- track(eventType: string, value?: number, properties?: Properties): boolean
1641
- }
1642
- /**
1643
- * This represents the interface for the Client instance with attributes binding.
1644
- * @interface IBrowserClient
1645
- * @Extends IClient
1646
- */
1647
- interface IBrowserClient extends IClient {
1482
+ track(trafficType: string, eventType: string, value?: number, properties?: Properties): boolean,
1648
1483
  /**
1649
1484
  * Add an attribute to client's in memory attributes storage.
1650
1485
  *
@@ -1688,15 +1523,17 @@ declare namespace SplitIO {
1688
1523
  clearAttributes(): boolean
1689
1524
  }
1690
1525
  /**
1691
- * This represents the interface for the Client instance with asynchronous storage.
1526
+ * This represents the interface for the Client instance on server-side with asynchronous storage, like REDIS.
1527
+ * User key is not bound to the instance and must be provided on each method call, which returns a promise.
1528
+ * This interface is available in NodeJS, or when importing the 'server' sub-package (e.g., `import { SplitFactory } from '@splitsoftware/splitio/server'`).
1529
+ *
1692
1530
  * @interface IAsyncClient
1693
1531
  * @extends IBasicClient
1694
1532
  */
1695
1533
  interface IAsyncClient extends IBasicClient {
1696
1534
  /**
1697
1535
  * Returns a Treatment value, which will be (or eventually be) the treatment string for the given feature.
1698
- * For usage on NodeJS as we don't have only one key.
1699
- * NOTE: Treatment will be a promise only in async storages, like REDIS.
1536
+ *
1700
1537
  * @function getTreatment
1701
1538
  * @param {string} key - The string key representing the consumer.
1702
1539
  * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
@@ -1706,8 +1543,7 @@ declare namespace SplitIO {
1706
1543
  getTreatment(key: SplitKey, featureFlagName: string, attributes?: Attributes): AsyncTreatment,
1707
1544
  /**
1708
1545
  * Returns a TreatmentWithConfig value, which will be (or eventually be) an object with both treatment and config string for the given feature.
1709
- * For usage on NodeJS as we don't have only one key.
1710
- * NOTE: Treatment will be a promise only in async storages, like REDIS.
1546
+ *
1711
1547
  * @function getTreatmentWithConfig
1712
1548
  * @param {string} key - The string key representing the consumer.
1713
1549
  * @param {string} featureFlagName - The string that represents the feature flag we want to get the treatment.
@@ -1717,7 +1553,7 @@ declare namespace SplitIO {
1717
1553
  getTreatmentWithConfig(key: SplitKey, featureFlagName: string, attributes?: Attributes): AsyncTreatmentWithConfig,
1718
1554
  /**
1719
1555
  * Returns a Treatments value, which will be (or eventually be) an object map with the treatments for the given features.
1720
- * For usage on NodeJS as we don't have only one key.
1556
+ *
1721
1557
  * @function getTreatments
1722
1558
  * @param {string} key - The string key representing the consumer.
1723
1559
  * @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
@@ -1727,7 +1563,7 @@ declare namespace SplitIO {
1727
1563
  getTreatments(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): AsyncTreatments,
1728
1564
  /**
1729
1565
  * 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.
1730
- * For usage on NodeJS as we don't have only one key.
1566
+ *
1731
1567
  * @function getTreatmentsWithConfig
1732
1568
  * @param {string} key - The string key representing the consumer.
1733
1569
  * @param {Array<string>} featureFlagNames - An array of the feature flag names we want to get the treatments.
@@ -1737,7 +1573,7 @@ declare namespace SplitIO {
1737
1573
  getTreatmentsWithConfig(key: SplitKey, featureFlagNames: string[], attributes?: Attributes): AsyncTreatmentsWithConfig,
1738
1574
  /**
1739
1575
  * Returns a Treatments value, which is an object map with the treatments for the feature flags related to the given flag set.
1740
- * For usage on NodeJS as we don't have only one key.
1576
+ *
1741
1577
  * @function getTreatmentsByFlagSet
1742
1578
  * @param {string} key - The string key representing the consumer.
1743
1579
  * @param {string} flagSet - The flag set name we want to get the treatments.
@@ -1747,7 +1583,7 @@ declare namespace SplitIO {
1747
1583
  getTreatmentsByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): AsyncTreatments,
1748
1584
  /**
1749
1585
  * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag set.
1750
- * For usage on NodeJS as we don't have only one key.
1586
+ *
1751
1587
  * @function getTreatmentsWithConfigByFlagSet
1752
1588
  * @param {string} flagSet - The flag set name we want to get the treatments.
1753
1589
  * @param {string} key - The string key representing the consumer.
@@ -1757,7 +1593,7 @@ declare namespace SplitIO {
1757
1593
  getTreatmentsWithConfigByFlagSet(key: SplitKey, flagSet: string, attributes?: Attributes): AsyncTreatmentsWithConfig,
1758
1594
  /**
1759
1595
  * Returns a Returns a Treatments value, which is an object with both treatment and config string for to the feature flags related to the given flag sets.
1760
- * For usage on NodeJS as we don't have only one key.
1596
+ *
1761
1597
  * @function getTreatmentsByFlagSets
1762
1598
  * @param {string} key - The string key representing the consumer.
1763
1599
  * @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
@@ -1767,7 +1603,7 @@ declare namespace SplitIO {
1767
1603
  getTreatmentsByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): AsyncTreatments,
1768
1604
  /**
1769
1605
  * Returns a TreatmentsWithConfig value, which is an object map with the TreatmentWithConfig (an object with both treatment and config string) for the feature flags related to the given flag sets.
1770
- * For usage on NodeJS as we don't have only one key.
1606
+ *
1771
1607
  * @function getTreatmentsWithConfigByFlagSets
1772
1608
  * @param {string} key - The string key representing the consumer.
1773
1609
  * @param {Array<string>} flagSets - An array of the flag set names we want to get the treatments.
@@ -1777,9 +1613,10 @@ declare namespace SplitIO {
1777
1613
  getTreatmentsWithConfigByFlagSets(key: SplitKey, flagSets: string[], attributes?: Attributes): AsyncTreatmentsWithConfig,
1778
1614
  /**
1779
1615
  * 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).
1616
+ *
1780
1617
  * @function track
1781
1618
  * @param {SplitKey} key - The key that identifies the entity related to this event.
1782
- * @param {string} trafficType - The traffic type of the entity related to this event.
1619
+ * @param {string} trafficType - The traffic type of the entity related to this event. See {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
1783
1620
  * @param {string} eventType - The event type corresponding to this event.
1784
1621
  * @param {number=} value - The value of this event.
1785
1622
  * @param {Properties=} properties - The properties of this event. Values can be string, number, boolean or null.