@splitsoftware/splitio-commons 1.2.1-rc.2 → 1.2.1-rc.5

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 (111) hide show
  1. package/cjs/integrations/ga/GoogleAnalyticsToSplit.js +4 -2
  2. package/cjs/integrations/ga/SplitToGoogleAnalytics.js +4 -2
  3. package/cjs/listeners/browser.js +14 -10
  4. package/cjs/logger/constants.js +6 -4
  5. package/cjs/logger/messages/error.js +3 -2
  6. package/cjs/logger/messages/info.js +3 -2
  7. package/cjs/sdkClient/client.js +10 -4
  8. package/cjs/sdkFactory/index.js +6 -4
  9. package/cjs/sdkFactory/userConsentProps.js +34 -0
  10. package/cjs/storages/KeyBuilderCS.js +11 -1
  11. package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +23 -3
  12. package/cjs/storages/inLocalStorage/index.js +1 -1
  13. package/cjs/storages/inMemory/ImpressionsCacheInMemory.js +15 -1
  14. package/cjs/storages/inMemory/InMemoryStorage.js +1 -1
  15. package/cjs/storages/inMemory/InMemoryStorageCS.js +1 -1
  16. package/cjs/storages/pluggable/index.js +2 -2
  17. package/cjs/sync/streaming/pushManager.js +9 -2
  18. package/cjs/sync/submitters/eventsSyncTask.js +9 -4
  19. package/cjs/sync/submitters/impressionsSyncTask.js +13 -1
  20. package/cjs/sync/syncManagerOnline.js +11 -7
  21. package/cjs/utils/consent.js +10 -0
  22. package/cjs/utils/constants/index.js +5 -1
  23. package/cjs/utils/settingsValidation/consent.js +16 -0
  24. package/cjs/utils/settingsValidation/impressionsMode.js +6 -6
  25. package/cjs/utils/settingsValidation/index.js +6 -1
  26. package/cjs/utils/settingsValidation/{runtime/browser.js → runtime.js} +1 -0
  27. package/esm/integrations/ga/GoogleAnalyticsToSplit.js +4 -2
  28. package/esm/integrations/ga/SplitToGoogleAnalytics.js +4 -2
  29. package/esm/listeners/browser.js +14 -10
  30. package/esm/logger/constants.js +4 -2
  31. package/esm/logger/messages/error.js +3 -2
  32. package/esm/logger/messages/info.js +3 -2
  33. package/esm/sdkClient/client.js +11 -5
  34. package/esm/sdkFactory/index.js +6 -4
  35. package/esm/sdkFactory/userConsentProps.js +30 -0
  36. package/esm/storages/KeyBuilderCS.js +11 -1
  37. package/esm/storages/inLocalStorage/MySegmentsCacheInLocal.js +23 -3
  38. package/esm/storages/inLocalStorage/index.js +1 -1
  39. package/esm/storages/inMemory/ImpressionsCacheInMemory.js +15 -1
  40. package/esm/storages/inMemory/InMemoryStorage.js +1 -1
  41. package/esm/storages/inMemory/InMemoryStorageCS.js +1 -1
  42. package/esm/storages/pluggable/index.js +2 -2
  43. package/esm/sync/streaming/pushManager.js +9 -2
  44. package/esm/sync/submitters/eventsSyncTask.js +10 -5
  45. package/esm/sync/submitters/impressionsSyncTask.js +13 -1
  46. package/esm/sync/syncManagerOnline.js +11 -7
  47. package/esm/utils/consent.js +6 -0
  48. package/esm/utils/constants/index.js +4 -0
  49. package/esm/utils/settingsValidation/consent.js +12 -0
  50. package/esm/utils/settingsValidation/impressionsMode.js +7 -7
  51. package/esm/utils/settingsValidation/index.js +6 -1
  52. package/esm/utils/settingsValidation/{runtime/browser.js → runtime.js} +1 -0
  53. package/package.json +1 -2
  54. package/src/integrations/ga/GoogleAnalyticsToSplit.ts +7 -4
  55. package/src/integrations/ga/SplitToGoogleAnalytics.ts +7 -4
  56. package/src/integrations/types.ts +5 -0
  57. package/src/listeners/browser.ts +13 -9
  58. package/src/logger/constants.ts +4 -2
  59. package/src/logger/messages/error.ts +3 -2
  60. package/src/logger/messages/info.ts +3 -2
  61. package/src/logger/types.ts +4 -4
  62. package/src/sdkClient/client.ts +7 -5
  63. package/src/sdkFactory/index.ts +6 -4
  64. package/src/sdkFactory/types.ts +2 -0
  65. package/src/sdkFactory/userConsentProps.ts +37 -0
  66. package/src/storages/KeyBuilderCS.ts +13 -1
  67. package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +23 -3
  68. package/src/storages/inLocalStorage/index.ts +1 -1
  69. package/src/storages/inMemory/ImpressionsCacheInMemory.ts +22 -1
  70. package/src/storages/inMemory/InMemoryStorage.ts +1 -1
  71. package/src/storages/inMemory/InMemoryStorageCS.ts +1 -1
  72. package/src/storages/pluggable/index.ts +2 -2
  73. package/src/storages/types.ts +6 -2
  74. package/src/sync/streaming/pushManager.ts +11 -2
  75. package/src/sync/submitters/eventsSyncTask.ts +11 -5
  76. package/src/sync/submitters/impressionsSyncTask.ts +16 -1
  77. package/src/sync/syncManagerOnline.ts +13 -7
  78. package/src/sync/types.ts +4 -1
  79. package/src/types.ts +21 -0
  80. package/src/utils/consent.ts +8 -0
  81. package/src/utils/constants/index.ts +5 -0
  82. package/src/utils/settingsValidation/consent.ts +14 -0
  83. package/src/utils/settingsValidation/impressionsMode.ts +7 -8
  84. package/src/utils/settingsValidation/index.ts +7 -1
  85. package/src/utils/settingsValidation/runtime.ts +9 -0
  86. package/src/utils/settingsValidation/types.ts +2 -0
  87. package/types/integrations/ga/GoogleAnalyticsToSplit.d.ts +2 -2
  88. package/types/integrations/ga/SplitToGoogleAnalytics.d.ts +2 -3
  89. package/types/integrations/types.d.ts +4 -0
  90. package/types/logger/constants.d.ts +4 -2
  91. package/types/logger/types.d.ts +4 -4
  92. package/types/sdkFactory/types.d.ts +1 -0
  93. package/types/sdkFactory/userConsentProps.d.ts +6 -0
  94. package/types/storages/KeyBuilderCS.d.ts +2 -0
  95. package/types/storages/inMemory/ImpressionsCacheInMemory.d.ts +9 -0
  96. package/types/storages/types.d.ts +3 -1
  97. package/types/sync/types.d.ts +3 -0
  98. package/types/types.d.ts +21 -0
  99. package/types/utils/consent.d.ts +2 -0
  100. package/types/utils/constants/index.d.ts +3 -0
  101. package/types/utils/settingsValidation/consent.d.ts +5 -0
  102. package/types/utils/settingsValidation/impressionsMode.d.ts +1 -1
  103. package/types/utils/settingsValidation/runtime/browser.d.ts +2 -4
  104. package/types/utils/settingsValidation/runtime/node.d.ts +1 -4
  105. package/types/utils/settingsValidation/runtime.d.ts +2 -0
  106. package/types/utils/settingsValidation/types.d.ts +2 -0
  107. package/types/utils/settingsValidation/userConsent.d.ts +5 -0
  108. package/cjs/utils/settingsValidation/runtime/node.js +0 -22
  109. package/esm/utils/settingsValidation/runtime/node.js +0 -17
  110. package/src/utils/settingsValidation/runtime/browser.ts +0 -6
  111. package/src/utils/settingsValidation/runtime/node.ts +0 -22
@@ -1,5 +1,2 @@
1
1
  import { ISettings } from '../../../types';
2
- export declare function validateRuntime(settings: ISettings): {
3
- ip: string | false;
4
- hostname: string | false;
5
- };
2
+ export declare function validateRuntime(settings: ISettings): ISettings['runtime'];
@@ -0,0 +1,2 @@
1
+ import { ISettings } from '../../types';
2
+ export declare function validateRuntime(): ISettings['runtime'];
@@ -23,4 +23,6 @@ export interface ISettingsValidationParams {
23
23
  logger: (settings: ISettings) => ISettings['log'];
24
24
  /** Localhost mode validator (`settings.sync.localhostMode`) */
25
25
  localhost?: (settings: ISettings) => ISettings['sync']['localhostMode'];
26
+ /** User consent validator (`settings.userConsent`) */
27
+ consent: (settings: ISettings) => ISettings['userConsent'];
26
28
  }
@@ -0,0 +1,5 @@
1
+ import { ILogger } from '../../logger/types';
2
+ export declare function validateUserConsent({ userConsent, log }: {
3
+ userConsent: any;
4
+ log: ILogger;
5
+ }): any;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateRuntime = void 0;
4
- var tslib_1 = require("tslib");
5
- var os_1 = (0, tslib_1.__importDefault)(require("os"));
6
- var ip_1 = (0, tslib_1.__importDefault)(require("ip"));
7
- var constants_1 = require("../../constants");
8
- function validateRuntime(settings) {
9
- var isIPAddressesEnabled = settings.core.IPAddressesEnabled === true;
10
- var isConsumerMode = settings.mode === constants_1.CONSUMER_MODE;
11
- // If the values are not available, default to false (for standalone) or "unknown" (for consumer mode, to be used on Redis keys)
12
- var ip = ip_1.default.address() || (isConsumerMode ? constants_1.UNKNOWN : false);
13
- var hostname = os_1.default.hostname() || (isConsumerMode ? constants_1.UNKNOWN : false);
14
- if (!isIPAddressesEnabled) { // If IPAddresses setting is not enabled, set as false (for standalone) or "NA" (for consumer mode, to be used on Redis keys)
15
- ip = hostname = isConsumerMode ? constants_1.NA : false;
16
- }
17
- return {
18
- ip: ip,
19
- hostname: hostname
20
- };
21
- }
22
- exports.validateRuntime = validateRuntime;
@@ -1,17 +0,0 @@
1
- import osFunction from 'os';
2
- import ipFunction from 'ip';
3
- import { UNKNOWN, NA, CONSUMER_MODE } from '../../constants';
4
- export function validateRuntime(settings) {
5
- var isIPAddressesEnabled = settings.core.IPAddressesEnabled === true;
6
- var isConsumerMode = settings.mode === CONSUMER_MODE;
7
- // If the values are not available, default to false (for standalone) or "unknown" (for consumer mode, to be used on Redis keys)
8
- var ip = ipFunction.address() || (isConsumerMode ? UNKNOWN : false);
9
- var hostname = osFunction.hostname() || (isConsumerMode ? UNKNOWN : false);
10
- if (!isIPAddressesEnabled) { // If IPAddresses setting is not enabled, set as false (for standalone) or "NA" (for consumer mode, to be used on Redis keys)
11
- ip = hostname = isConsumerMode ? NA : false;
12
- }
13
- return {
14
- ip: ip,
15
- hostname: hostname
16
- };
17
- }
@@ -1,6 +0,0 @@
1
- export function validateRuntime() {
2
- return {
3
- ip: false,
4
- hostname: false
5
- };
6
- }
@@ -1,22 +0,0 @@
1
- import osFunction from 'os';
2
- import ipFunction from 'ip';
3
-
4
- import { UNKNOWN, NA, CONSUMER_MODE } from '../../constants';
5
- import { ISettings } from '../../../types';
6
-
7
- export function validateRuntime(settings: ISettings) {
8
- const isIPAddressesEnabled = settings.core.IPAddressesEnabled === true;
9
- const isConsumerMode = settings.mode === CONSUMER_MODE;
10
-
11
- // If the values are not available, default to false (for standalone) or "unknown" (for consumer mode, to be used on Redis keys)
12
- let ip = ipFunction.address() || (isConsumerMode ? UNKNOWN : false);
13
- let hostname = osFunction.hostname() || (isConsumerMode ? UNKNOWN : false);
14
-
15
- if (!isIPAddressesEnabled) { // If IPAddresses setting is not enabled, set as false (for standalone) or "NA" (for consumer mode, to be used on Redis keys)
16
- ip = hostname = isConsumerMode ? NA : false;
17
- }
18
-
19
- return {
20
- ip, hostname
21
- };
22
- }