@splitsoftware/splitio 10.28.1-rc.4 → 11.0.0-rc.0

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