@splitsoftware/splitio 10.17.1 → 10.17.3-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.txt +4 -0
- package/client/package.json +5 -0
- package/es/factory/browser.js +58 -0
- package/es/factory/node.js +59 -0
- package/es/{client → factory}/package.json +0 -0
- package/es/index.js +1 -132
- package/es/platform/EventEmitter.js +412 -0
- package/es/platform/browser.js +10 -0
- package/es/{services → platform}/getEventSource/browser.js +1 -1
- package/es/{services → platform}/getEventSource/node.js +1 -1
- package/es/{impressions/observer → platform/getEventSource}/package.json +0 -0
- package/es/{services → platform}/getFetch/browser.js +1 -1
- package/es/{services → platform}/getFetch/node.js +1 -1
- package/es/{integrations → platform/getFetch}/package.json +0 -0
- package/es/platform/node.js +12 -0
- package/es/{listeners → platform}/package.json +0 -0
- package/es/{services → platform}/request/options/node.js +2 -2
- package/es/settings/browser.js +18 -0
- package/{lib/utils → es}/settings/defaults/browser.js +6 -8
- package/{src/utils → es}/settings/defaults/node.js +6 -3
- package/es/settings/defaults/version.js +1 -0
- package/es/settings/integrations/browser.js +5 -0
- package/es/settings/integrations/node.js +5 -0
- package/es/settings/node.js +20 -0
- package/es/{producer/offline → settings}/package.json +0 -0
- package/es/{utils/settings → settings}/runtime/node.js +6 -4
- package/es/{utils/settings → settings}/storage/browser.js +16 -17
- package/es/{utils/settings → settings}/storage/node.js +25 -16
- package/es/umd.js +2 -1
- package/lib/factory/browser.js +79 -0
- package/lib/factory/node.js +78 -0
- package/{es/producer → lib/factory}/package.json +0 -0
- package/lib/index.js +3 -151
- package/lib/platform/EventEmitter.js +417 -0
- package/lib/platform/browser.js +21 -0
- package/lib/{services → platform}/getEventSource/browser.js +1 -1
- package/lib/{services → platform}/getEventSource/node.js +1 -1
- package/{es/services → lib/platform}/getEventSource/package.json +0 -0
- package/lib/{services → platform}/getFetch/browser.js +1 -1
- package/lib/{services → platform}/getFetch/node.js +1 -1
- package/{es/services → lib/platform}/getFetch/package.json +0 -0
- package/lib/platform/node.js +26 -0
- package/{es/services/request/options → lib/platform}/package.json +0 -0
- package/lib/{services → platform}/request/options/node.js +2 -2
- package/lib/settings/browser.js +30 -0
- package/{src/utils → lib}/settings/defaults/browser.js +13 -3
- package/{es/utils → lib}/settings/defaults/node.js +13 -3
- package/lib/settings/defaults/version.js +6 -0
- package/lib/settings/integrations/browser.js +14 -0
- package/lib/settings/integrations/node.js +12 -0
- package/lib/settings/node.js +33 -0
- package/{es/services/splitChanges/offline → lib/settings}/package.json +0 -0
- package/lib/{utils/settings → settings}/runtime/node.js +7 -5
- package/lib/{utils/settings → settings}/storage/browser.js +20 -24
- package/lib/{utils/settings → settings}/storage/node.js +26 -17
- package/lib/umd.js +1 -0
- package/package.json +20 -16
- package/server/package.json +5 -0
- package/src/.DS_Store +0 -0
- package/src/factory/browser.js +74 -0
- package/src/factory/node.js +71 -0
- package/{es/storage/SegmentCache/InMemory → src/factory}/package.json +0 -0
- package/src/index.js +1 -140
- package/src/{sync/SSEHandler → platform}/.DS_Store +0 -0
- package/src/platform/EventEmitter.js +443 -0
- package/src/platform/browser.js +12 -0
- package/src/{services → platform}/getEventSource/browser.js +2 -2
- package/src/{services → platform}/getEventSource/node.js +2 -2
- package/{es/storage → src/platform/getEventSource}/package.json +0 -0
- package/src/{services → platform}/getFetch/browser.js +2 -2
- package/src/{services → platform}/getFetch/node.js +1 -1
- package/{es/sync/PushManager/pushRequirements → src/platform/getFetch}/package.json +0 -0
- package/src/platform/node.js +14 -0
- package/{es/sync/SegmentUpdateWorker → src/platform}/package.json +0 -0
- package/src/{services → platform}/request/options/node.js +2 -2
- package/src/{listeners → settings}/.DS_Store +0 -0
- package/src/settings/browser.js +18 -0
- package/{es/utils → src}/settings/defaults/browser.js +8 -3
- package/{lib/utils → src}/settings/defaults/node.js +6 -6
- package/src/settings/defaults/version.js +1 -0
- package/src/settings/integrations/browser.js +6 -0
- package/src/{utils/settings → settings}/integrations/node.js +1 -3
- package/src/settings/node.js +20 -0
- package/{es/sync → src/settings}/package.json +0 -0
- package/src/{utils/settings → settings}/runtime/node.js +9 -6
- package/src/{utils/settings → settings}/storage/browser.js +13 -18
- package/src/{utils/settings → settings}/storage/node.js +19 -14
- package/src/umd.js +1 -0
- package/types/client/index.d.ts +14 -0
- package/types/server/index.d.ts +20 -0
- package/types/splitio.d.ts +22 -5
- package/es/client/attributesDecoration.js +0 -116
- package/es/client/browser.js +0 -39
- package/es/client/client.js +0 -155
- package/es/client/inputValidation.js +0 -117
- package/es/client/node.js +0 -6
- package/es/engine/combiners/and.js +0 -54
- package/es/engine/combiners/ifelseif.js +0 -73
- package/es/engine/condition/index.js +0 -62
- package/es/engine/convertions/index.js +0 -29
- package/es/engine/engine/index.js +0 -60
- package/es/engine/engine/legacy.js +0 -77
- package/es/engine/engine/murmur3/common.js +0 -40
- package/es/engine/engine/murmur3/murmur3.js +0 -83
- package/es/engine/engine/murmur3/murmur3_128.js +0 -250
- package/es/engine/engine/murmur3/murmur3_128_x86.js +0 -183
- package/es/engine/engine/murmur3/murmur3_64.js +0 -52
- package/es/engine/engine/murmur3/utfx.js +0 -112
- package/es/engine/evaluator/index.js +0 -111
- package/es/engine/index.js +0 -112
- package/es/engine/matchers/all.js +0 -32
- package/es/engine/matchers/between.js +0 -35
- package/es/engine/matchers/boolean.js +0 -35
- package/es/engine/matchers/cont_all.js +0 -51
- package/es/engine/matchers/cont_any.js +0 -47
- package/es/engine/matchers/cont_str.js +0 -38
- package/es/engine/matchers/dependency.js +0 -50
- package/es/engine/matchers/eq.js +0 -35
- package/es/engine/matchers/eq_set.js +0 -49
- package/es/engine/matchers/ew.js +0 -38
- package/es/engine/matchers/gte.js +0 -35
- package/es/engine/matchers/index.js +0 -65
- package/es/engine/matchers/lte.js +0 -35
- package/es/engine/matchers/part_of.js +0 -49
- package/es/engine/matchers/segment.js +0 -39
- package/es/engine/matchers/string.js +0 -44
- package/es/engine/matchers/sw.js +0 -38
- package/es/engine/matchers/types.js +0 -48
- package/es/engine/matchers/whitelist.js +0 -36
- package/es/engine/parser/index.js +0 -69
- package/es/engine/parser/segments.js +0 -22
- package/es/engine/transforms/matcherGroup.js +0 -43
- package/es/engine/transforms/matchers.js +0 -109
- package/es/engine/transforms/segment.js +0 -28
- package/es/engine/transforms/set.js +0 -20
- package/es/engine/transforms/unaryNumeric.js +0 -20
- package/es/engine/transforms/whitelist.js +0 -22
- package/es/engine/treatments/index.js +0 -67
- package/es/engine/value/index.js +0 -54
- package/es/engine/value/sanitize.js +0 -125
- package/es/events/index.js +0 -65
- package/es/factory/offline.js +0 -50
- package/es/factory/online.js +0 -113
- package/es/impressions/counter.js +0 -52
- package/es/impressions/hasher/buildKey.js +0 -3
- package/es/impressions/hasher/hashImpression128.js +0 -5
- package/es/impressions/hasher/hashImpression32.js +0 -5
- package/es/impressions/observer/browser.js +0 -9
- package/es/impressions/observer/node.js +0 -9
- package/es/impressions/observer/observer.js +0 -21
- package/es/integrations/browser.js +0 -62
- package/es/integrations/ga/GaToSplit.js +0 -246
- package/es/integrations/ga/SplitToGa.js +0 -127
- package/es/integrations/node.js +0 -3
- package/es/listeners/browser.js +0 -157
- package/es/listeners/node.js +0 -65
- package/es/manager/index.js +0 -104
- package/es/metrics/Collectors.js +0 -100
- package/es/metrics/index.js +0 -157
- package/es/producer/browser/Partial.js +0 -103
- package/es/producer/browser.js +0 -70
- package/es/producer/fetcher/MySegments.js +0 -47
- package/es/producer/fetcher/SegmentChanges.js +0 -52
- package/es/producer/fetcher/SplitChanges.js +0 -46
- package/es/producer/node.js +0 -130
- package/es/producer/offline/browser.js +0 -26
- package/es/producer/offline/node.js +0 -26
- package/es/producer/task.js +0 -50
- package/es/producer/updater/MySegments.js +0 -108
- package/es/producer/updater/SegmentChanges.js +0 -135
- package/es/producer/updater/SplitChanges.js +0 -131
- package/es/producer/updater/SplitChangesFromFeatures.js +0 -21
- package/es/producer/updater/SplitChangesFromFileSystem.js +0 -21
- package/es/producer/updater/SplitChangesFromObject.js +0 -73
- package/es/readiness/index.js +0 -123
- package/es/readiness/statusManager.js +0 -114
- package/es/services/auth/auth.js +0 -25
- package/es/services/auth/index.js +0 -2
- package/es/services/events/bulk.js +0 -22
- package/es/services/events/index.js +0 -17
- package/es/services/impressions/bulk.js +0 -26
- package/es/services/impressions/count.js +0 -7
- package/es/services/impressions/dto.js +0 -73
- package/es/services/impressions/index.js +0 -17
- package/es/services/impressions/post.js +0 -22
- package/es/services/metrics/counters.js +0 -24
- package/es/services/metrics/dto.js +0 -38
- package/es/services/metrics/index.js +0 -17
- package/es/services/metrics/times.js +0 -24
- package/es/services/mySegments/get.js +0 -26
- package/es/services/mySegments/index.js +0 -17
- package/es/services/request/index.js +0 -43
- package/es/services/request/options/browser.js +0 -18
- package/es/services/segmentChanges/get.js +0 -21
- package/es/services/segmentChanges/index.js +0 -17
- package/es/services/splitChanges/get.js +0 -19
- package/es/services/splitChanges/index.js +0 -17
- package/es/services/splitChanges/offline/browser.js +0 -63
- package/es/services/splitChanges/offline/node.js +0 -176
- package/es/services/splitChanges/offline/parseCondition.js +0 -43
- package/es/services/transport/index.js +0 -51
- package/es/storage/AttributesCache/InMemory.js +0 -85
- package/es/storage/BaseMetricsAsyncCache.js +0 -23
- package/es/storage/CountCache/InMemory.js +0 -48
- package/es/storage/CountCache/InRedis.js +0 -42
- package/es/storage/EventsCache/InMemory.js +0 -109
- package/es/storage/EventsCache/InRedis.js +0 -65
- package/es/storage/ImpressionsCache/InMemory.js +0 -71
- package/es/storage/ImpressionsCache/InRedis.js +0 -73
- package/es/storage/Keys.js +0 -125
- package/es/storage/KeysLocalStorage.js +0 -47
- package/es/storage/LatencyCache/InMemory.js +0 -56
- package/es/storage/LatencyCache/InRedis.js +0 -44
- package/es/storage/LatencyCache/findIndex.js +0 -2
- package/es/storage/Meta.js +0 -7
- package/es/storage/RedisAdapter.js +0 -198
- package/es/storage/SegmentCache/InLocalStorage/index.js +0 -138
- package/es/storage/SegmentCache/InMemory/browser.js +0 -107
- package/es/storage/SegmentCache/InMemory/node.js +0 -82
- package/es/storage/SegmentCache/InRedis/index.js +0 -81
- package/es/storage/SplitCache/InLocalStorage.js +0 -332
- package/es/storage/SplitCache/InMemory.js +0 -162
- package/es/storage/SplitCache/InRedis.js +0 -214
- package/es/storage/SplitCache/killLocally.js +0 -35
- package/es/storage/browser.js +0 -101
- package/es/storage/node.js +0 -81
- package/es/sync/AuthClient/index.js +0 -34
- package/es/sync/PushManager/index.js +0 -315
- package/es/sync/PushManager/mySegmentsV2utils.js +0 -76
- package/es/sync/PushManager/pushRequirements/browser.js +0 -23
- package/es/sync/PushManager/pushRequirements/node.js +0 -18
- package/es/sync/SSEClient/index.js +0 -93
- package/es/sync/SSEHandler/NotificationKeeper.js +0 -97
- package/es/sync/SSEHandler/NotificationParser.js +0 -31
- package/es/sync/SSEHandler/index.js +0 -110
- package/es/sync/SegmentUpdateWorker/browser.js +0 -74
- package/es/sync/SegmentUpdateWorker/node.js +0 -79
- package/es/sync/SplitUpdateWorker/index.js +0 -86
- package/es/sync/browser.js +0 -125
- package/es/sync/constants.js +0 -42
- package/es/sync/node.js +0 -60
- package/es/trackers/event.js +0 -53
- package/es/trackers/impressions.js +0 -132
- package/es/utils/backoff/index.js +0 -51
- package/es/utils/base64/browser.js +0 -19
- package/es/utils/base64/node.js +0 -19
- package/es/utils/base64/package.json +0 -4
- package/es/utils/binarySearch/index.js +0 -50
- package/es/utils/constants/index.js +0 -38
- package/es/utils/context/constants.js +0 -30
- package/es/utils/context/index.js +0 -101
- package/es/utils/decompress/index.js +0 -476
- package/es/utils/fn/repeat.js +0 -58
- package/es/utils/inputValidation/apiKey.js +0 -39
- package/es/utils/inputValidation/attribute.js +0 -22
- package/es/utils/inputValidation/attributes.js +0 -19
- package/es/utils/inputValidation/event.js +0 -23
- package/es/utils/inputValidation/eventProperties.js +0 -69
- package/es/utils/inputValidation/eventValue.js +0 -9
- package/es/utils/inputValidation/index.js +0 -11
- package/es/utils/inputValidation/isOperational.js +0 -14
- package/es/utils/inputValidation/key.js +0 -50
- package/es/utils/inputValidation/split.js +0 -47
- package/es/utils/inputValidation/splitFilters.js +0 -121
- package/es/utils/inputValidation/splits.js +0 -27
- package/es/utils/inputValidation/trafficType.js +0 -55
- package/es/utils/jwt/hashUserKey.js +0 -11
- package/es/utils/jwt/index.js +0 -14
- package/es/utils/key/factory.js +0 -38
- package/es/utils/key/parser.js +0 -34
- package/es/utils/labels/index.js +0 -7
- package/es/utils/lang/Errors.js +0 -41
- package/es/utils/lang/Sets.js +0 -114
- package/es/utils/lang/index.js +0 -305
- package/es/utils/localstorage/isAvailable.js +0 -26
- package/es/utils/logger/LoggerFactory.js +0 -86
- package/es/utils/logger/index.js +0 -97
- package/es/utils/lrucache/linkedlist.js +0 -122
- package/es/utils/lrucache/lru.spec.js +0 -24
- package/es/utils/lrucache/lrucache.js +0 -80
- package/es/utils/now/browser.js +0 -27
- package/es/utils/now/node.js +0 -19
- package/es/utils/now/package.json +0 -4
- package/es/utils/promise/thenable.js +0 -3
- package/es/utils/promise/timeout.js +0 -34
- package/es/utils/promise/wrapper.js +0 -58
- package/es/utils/settings/defaults/package.json +0 -4
- package/es/utils/settings/impressionsMode.js +0 -16
- package/es/utils/settings/index.js +0 -194
- package/es/utils/settings/integrations/browser.js +0 -8
- package/es/utils/settings/integrations/common.js +0 -30
- package/es/utils/settings/integrations/node.js +0 -7
- package/es/utils/settings/integrations/package.json +0 -4
- package/es/utils/settings/language/browser.js +0 -16
- package/es/utils/settings/language/node.js +0 -16
- package/es/utils/settings/language/package.json +0 -4
- package/es/utils/settings/mode.js +0 -10
- package/es/utils/settings/runtime/browser.js +0 -21
- package/es/utils/settings/runtime/package.json +0 -4
- package/es/utils/settings/storage/package.json +0 -4
- package/es/utils/splits/usesSegments.js +0 -21
- package/es/utils/time/index.js +0 -8
- package/es/utils/timeTracker/index.js +0 -216
- package/es/utils/timeTracker/timer.js +0 -25
- package/lib/client/attributesDecoration.js +0 -128
- package/lib/client/browser.js +0 -50
- package/lib/client/client.js +0 -174
- package/lib/client/inputValidation.js +0 -129
- package/lib/client/node.js +0 -14
- package/lib/client/package.json +0 -4
- package/lib/engine/combiners/and.js +0 -65
- package/lib/engine/combiners/ifelseif.js +0 -88
- package/lib/engine/condition/index.js +0 -76
- package/lib/engine/convertions/index.js +0 -36
- package/lib/engine/engine/index.js +0 -71
- package/lib/engine/engine/legacy.js +0 -83
- package/lib/engine/engine/murmur3/common.js +0 -52
- package/lib/engine/engine/murmur3/murmur3.js +0 -90
- package/lib/engine/engine/murmur3/murmur3_128.js +0 -256
- package/lib/engine/engine/murmur3/murmur3_128_x86.js +0 -189
- package/lib/engine/engine/murmur3/murmur3_64.js +0 -57
- package/lib/engine/engine/murmur3/utfx.js +0 -121
- package/lib/engine/evaluator/index.js +0 -129
- package/lib/engine/index.js +0 -128
- package/lib/engine/matchers/all.js +0 -41
- package/lib/engine/matchers/between.js +0 -44
- package/lib/engine/matchers/boolean.js +0 -44
- package/lib/engine/matchers/cont_all.js +0 -61
- package/lib/engine/matchers/cont_any.js +0 -57
- package/lib/engine/matchers/cont_str.js +0 -48
- package/lib/engine/matchers/dependency.js +0 -60
- package/lib/engine/matchers/eq.js +0 -44
- package/lib/engine/matchers/eq_set.js +0 -59
- package/lib/engine/matchers/ew.js +0 -48
- package/lib/engine/matchers/gte.js +0 -44
- package/lib/engine/matchers/index.js +0 -90
- package/lib/engine/matchers/lte.js +0 -44
- package/lib/engine/matchers/part_of.js +0 -59
- package/lib/engine/matchers/segment.js +0 -49
- package/lib/engine/matchers/string.js +0 -53
- package/lib/engine/matchers/sw.js +0 -48
- package/lib/engine/matchers/types.js +0 -57
- package/lib/engine/matchers/whitelist.js +0 -46
- package/lib/engine/parser/index.js +0 -84
- package/lib/engine/parser/segments.js +0 -28
- package/lib/engine/transforms/matcherGroup.js +0 -54
- package/lib/engine/transforms/matchers.js +0 -124
- package/lib/engine/transforms/segment.js +0 -34
- package/lib/engine/transforms/set.js +0 -26
- package/lib/engine/transforms/unaryNumeric.js +0 -26
- package/lib/engine/transforms/whitelist.js +0 -28
- package/lib/engine/treatments/index.js +0 -73
- package/lib/engine/value/index.js +0 -64
- package/lib/engine/value/sanitize.js +0 -137
- package/lib/events/index.js +0 -80
- package/lib/factory/offline.js +0 -62
- package/lib/factory/online.js +0 -129
- package/lib/impressions/counter.js +0 -61
- package/lib/impressions/hasher/buildKey.js +0 -8
- package/lib/impressions/hasher/hashImpression128.js +0 -12
- package/lib/impressions/hasher/hashImpression32.js +0 -14
- package/lib/impressions/observer/browser.js +0 -19
- package/lib/impressions/observer/node.js +0 -19
- package/lib/impressions/observer/observer.js +0 -29
- package/lib/impressions/observer/package.json +0 -4
- package/lib/integrations/browser.js +0 -72
- package/lib/integrations/ga/GaToSplit.js +0 -267
- package/lib/integrations/ga/SplitToGa.js +0 -138
- package/lib/integrations/node.js +0 -9
- package/lib/integrations/package.json +0 -4
- package/lib/listeners/browser.js +0 -173
- package/lib/listeners/node.js +0 -74
- package/lib/listeners/package.json +0 -4
- package/lib/manager/index.js +0 -115
- package/lib/metrics/Collectors.js +0 -118
- package/lib/metrics/index.js +0 -182
- package/lib/producer/browser/Partial.js +0 -114
- package/lib/producer/browser.js +0 -82
- package/lib/producer/fetcher/MySegments.js +0 -59
- package/lib/producer/fetcher/SegmentChanges.js +0 -62
- package/lib/producer/fetcher/SplitChanges.js +0 -58
- package/lib/producer/node.js +0 -142
- package/lib/producer/offline/browser.js +0 -35
- package/lib/producer/offline/node.js +0 -35
- package/lib/producer/offline/package.json +0 -4
- package/lib/producer/package.json +0 -4
- package/lib/producer/task.js +0 -61
- package/lib/producer/updater/MySegments.js +0 -119
- package/lib/producer/updater/SegmentChanges.js +0 -148
- package/lib/producer/updater/SplitChanges.js +0 -145
- package/lib/producer/updater/SplitChangesFromFeatures.js +0 -30
- package/lib/producer/updater/SplitChangesFromFileSystem.js +0 -30
- package/lib/producer/updater/SplitChangesFromObject.js +0 -84
- package/lib/readiness/index.js +0 -132
- package/lib/readiness/statusManager.js +0 -124
- package/lib/services/auth/auth.js +0 -32
- package/lib/services/auth/index.js +0 -11
- package/lib/services/events/bulk.js +0 -31
- package/lib/services/events/index.js +0 -26
- package/lib/services/getEventSource/package.json +0 -4
- package/lib/services/getFetch/package.json +0 -4
- package/lib/services/impressions/bulk.js +0 -36
- package/lib/services/impressions/count.js +0 -16
- package/lib/services/impressions/dto.js +0 -81
- package/lib/services/impressions/index.js +0 -26
- package/lib/services/impressions/post.js +0 -31
- package/lib/services/metrics/counters.js +0 -33
- package/lib/services/metrics/dto.js +0 -46
- package/lib/services/metrics/index.js +0 -26
- package/lib/services/metrics/times.js +0 -33
- package/lib/services/mySegments/get.js +0 -35
- package/lib/services/mySegments/index.js +0 -26
- package/lib/services/request/index.js +0 -53
- package/lib/services/request/options/browser.js +0 -23
- package/lib/services/request/options/package.json +0 -4
- package/lib/services/segmentChanges/get.js +0 -29
- package/lib/services/segmentChanges/index.js +0 -26
- package/lib/services/splitChanges/get.js +0 -27
- package/lib/services/splitChanges/index.js +0 -26
- package/lib/services/splitChanges/offline/browser.js +0 -71
- package/lib/services/splitChanges/offline/node.js +0 -189
- package/lib/services/splitChanges/offline/package.json +0 -4
- package/lib/services/splitChanges/offline/parseCondition.js +0 -49
- package/lib/services/transport/index.js +0 -62
- package/lib/storage/AttributesCache/InMemory.js +0 -93
- package/lib/storage/BaseMetricsAsyncCache.js +0 -28
- package/lib/storage/CountCache/InMemory.js +0 -54
- package/lib/storage/CountCache/InRedis.js +0 -50
- package/lib/storage/EventsCache/InMemory.js +0 -118
- package/lib/storage/EventsCache/InRedis.js +0 -74
- package/lib/storage/ImpressionsCache/InMemory.js +0 -77
- package/lib/storage/ImpressionsCache/InRedis.js +0 -79
- package/lib/storage/Keys.js +0 -132
- package/lib/storage/KeysLocalStorage.js +0 -58
- package/lib/storage/LatencyCache/InMemory.js +0 -64
- package/lib/storage/LatencyCache/InRedis.js +0 -53
- package/lib/storage/LatencyCache/findIndex.js +0 -12
- package/lib/storage/Meta.js +0 -12
- package/lib/storage/RedisAdapter.js +0 -212
- package/lib/storage/SegmentCache/InLocalStorage/index.js +0 -147
- package/lib/storage/SegmentCache/InMemory/browser.js +0 -113
- package/lib/storage/SegmentCache/InMemory/node.js +0 -89
- package/lib/storage/SegmentCache/InMemory/package.json +0 -4
- package/lib/storage/SegmentCache/InRedis/index.js +0 -87
- package/lib/storage/SplitCache/InLocalStorage.js +0 -344
- package/lib/storage/SplitCache/InMemory.js +0 -172
- package/lib/storage/SplitCache/InRedis.js +0 -224
- package/lib/storage/SplitCache/killLocally.js +0 -42
- package/lib/storage/browser.js +0 -122
- package/lib/storage/node.js +0 -104
- package/lib/storage/package.json +0 -4
- package/lib/sync/AuthClient/index.js +0 -44
- package/lib/sync/PushManager/index.js +0 -340
- package/lib/sync/PushManager/mySegmentsV2utils.js +0 -87
- package/lib/sync/PushManager/pushRequirements/browser.js +0 -30
- package/lib/sync/PushManager/pushRequirements/node.js +0 -25
- package/lib/sync/PushManager/pushRequirements/package.json +0 -4
- package/lib/sync/SSEClient/index.js +0 -101
- package/lib/sync/SSEHandler/NotificationKeeper.js +0 -104
- package/lib/sync/SSEHandler/NotificationParser.js +0 -39
- package/lib/sync/SSEHandler/index.js +0 -121
- package/lib/sync/SegmentUpdateWorker/browser.js +0 -81
- package/lib/sync/SegmentUpdateWorker/node.js +0 -86
- package/lib/sync/SegmentUpdateWorker/package.json +0 -4
- package/lib/sync/SplitUpdateWorker/index.js +0 -93
- package/lib/sync/browser.js +0 -139
- package/lib/sync/constants.js +0 -59
- package/lib/sync/node.js +0 -71
- package/lib/sync/package.json +0 -4
- package/lib/trackers/event.js +0 -64
- package/lib/trackers/impressions.js +0 -146
- package/lib/utils/backoff/index.js +0 -57
- package/lib/utils/base64/browser.js +0 -26
- package/lib/utils/base64/node.js +0 -26
- package/lib/utils/base64/package.json +0 -4
- package/lib/utils/binarySearch/index.js +0 -56
- package/lib/utils/constants/index.js +0 -60
- package/lib/utils/context/constants.js +0 -49
- package/lib/utils/context/index.js +0 -111
- package/lib/utils/decompress/index.js +0 -483
- package/lib/utils/fn/repeat.js +0 -64
- package/lib/utils/inputValidation/apiKey.js +0 -51
- package/lib/utils/inputValidation/attribute.js +0 -32
- package/lib/utils/inputValidation/attributes.js +0 -32
- package/lib/utils/inputValidation/event.js +0 -33
- package/lib/utils/inputValidation/eventProperties.js +0 -78
- package/lib/utils/inputValidation/eventValue.js +0 -19
- package/lib/utils/inputValidation/index.js +0 -48
- package/lib/utils/inputValidation/isOperational.js +0 -25
- package/lib/utils/inputValidation/key.js +0 -59
- package/lib/utils/inputValidation/split.js +0 -60
- package/lib/utils/inputValidation/splitFilters.js +0 -134
- package/lib/utils/inputValidation/splits.js +0 -38
- package/lib/utils/inputValidation/trafficType.js +0 -68
- package/lib/utils/jwt/hashUserKey.js +0 -19
- package/lib/utils/jwt/index.js +0 -19
- package/lib/utils/key/factory.js +0 -46
- package/lib/utils/key/parser.js +0 -42
- package/lib/utils/labels/index.js +0 -18
- package/lib/utils/lang/Errors.js +0 -58
- package/lib/utils/lang/Sets.js +0 -127
- package/lib/utils/lang/index.js +0 -350
- package/lib/utils/localstorage/isAvailable.js +0 -31
- package/lib/utils/logger/LoggerFactory.js +0 -98
- package/lib/utils/logger/index.js +0 -109
- package/lib/utils/lrucache/linkedlist.js +0 -132
- package/lib/utils/lrucache/lru.spec.js +0 -30
- package/lib/utils/lrucache/lrucache.js +0 -88
- package/lib/utils/now/browser.js +0 -33
- package/lib/utils/now/node.js +0 -24
- package/lib/utils/now/package.json +0 -4
- package/lib/utils/promise/thenable.js +0 -10
- package/lib/utils/promise/timeout.js +0 -40
- package/lib/utils/promise/wrapper.js +0 -63
- package/lib/utils/settings/defaults/package.json +0 -4
- package/lib/utils/settings/impressionsMode.js +0 -26
- package/lib/utils/settings/index.js +0 -214
- package/lib/utils/settings/integrations/browser.js +0 -17
- package/lib/utils/settings/integrations/common.js +0 -40
- package/lib/utils/settings/integrations/node.js +0 -13
- package/lib/utils/settings/integrations/package.json +0 -4
- package/lib/utils/settings/language/browser.js +0 -22
- package/lib/utils/settings/language/node.js +0 -22
- package/lib/utils/settings/language/package.json +0 -4
- package/lib/utils/settings/mode.js +0 -16
- package/lib/utils/settings/runtime/browser.js +0 -26
- package/lib/utils/settings/runtime/package.json +0 -4
- package/lib/utils/settings/storage/package.json +0 -4
- package/lib/utils/splits/usesSegments.js +0 -27
- package/lib/utils/time/index.js +0 -12
- package/lib/utils/timeTracker/index.js +0 -213
- package/lib/utils/timeTracker/timer.js +0 -33
- package/src/client/attributesDecoration.js +0 -112
- package/src/client/browser.js +0 -41
- package/src/client/client.js +0 -131
- package/src/client/inputValidation.js +0 -130
- package/src/client/node.js +0 -8
- package/src/client/package.json +0 -4
- package/src/engine/combiners/and.js +0 -55
- package/src/engine/combiners/ifelseif.js +0 -74
- package/src/engine/condition/index.js +0 -65
- package/src/engine/convertions/index.js +0 -22
- package/src/engine/engine/index.js +0 -63
- package/src/engine/engine/legacy.js +0 -66
- package/src/engine/engine/murmur3/common.js +0 -54
- package/src/engine/engine/murmur3/murmur3.js +0 -79
- package/src/engine/engine/murmur3/murmur3_128.js +0 -273
- package/src/engine/engine/murmur3/murmur3_128_x86.js +0 -188
- package/src/engine/engine/murmur3/murmur3_64.js +0 -34
- package/src/engine/engine/murmur3/utfx.js +0 -111
- package/src/engine/evaluator/index.js +0 -148
- package/src/engine/index.js +0 -123
- package/src/engine/matchers/all.js +0 -29
- package/src/engine/matchers/between.js +0 -30
- package/src/engine/matchers/boolean.js +0 -29
- package/src/engine/matchers/cont_all.js +0 -40
- package/src/engine/matchers/cont_any.js +0 -35
- package/src/engine/matchers/cont_str.js +0 -31
- package/src/engine/matchers/dependency.js +0 -52
- package/src/engine/matchers/eq.js +0 -30
- package/src/engine/matchers/eq_set.js +0 -37
- package/src/engine/matchers/ew.js +0 -31
- package/src/engine/matchers/gte.js +0 -30
- package/src/engine/matchers/index.js +0 -71
- package/src/engine/matchers/lte.js +0 -30
- package/src/engine/matchers/part_of.js +0 -37
- package/src/engine/matchers/segment.js +0 -41
- package/src/engine/matchers/string.js +0 -39
- package/src/engine/matchers/sw.js +0 -31
- package/src/engine/matchers/types.js +0 -52
- package/src/engine/matchers/whitelist.js +0 -30
- package/src/engine/parser/index.js +0 -79
- package/src/engine/parser/segments.js +0 -31
- package/src/engine/transforms/matcherGroup.js +0 -45
- package/src/engine/transforms/matchers.js +0 -118
- package/src/engine/transforms/segment.js +0 -23
- package/src/engine/transforms/set.js +0 -20
- package/src/engine/transforms/unaryNumeric.js +0 -20
- package/src/engine/transforms/whitelist.js +0 -22
- package/src/engine/treatments/index.js +0 -67
- package/src/engine/value/index.js +0 -53
- package/src/engine/value/sanitize.js +0 -117
- package/src/events/index.js +0 -62
- package/src/factory/offline.js +0 -60
- package/src/factory/online.js +0 -127
- package/src/impressions/counter.js +0 -43
- package/src/impressions/hasher/buildKey.js +0 -3
- package/src/impressions/hasher/hashImpression128.js +0 -6
- package/src/impressions/hasher/hashImpression32.js +0 -6
- package/src/impressions/observer/browser.js +0 -8
- package/src/impressions/observer/node.js +0 -8
- package/src/impressions/observer/observer.js +0 -17
- package/src/impressions/observer/package.json +0 -4
- package/src/integrations/browser.js +0 -57
- package/src/integrations/ga/GaToSplit.js +0 -278
- package/src/integrations/ga/SplitToGa.js +0 -125
- package/src/integrations/node.js +0 -4
- package/src/integrations/package.json +0 -4
- package/src/listeners/browser.js +0 -137
- package/src/listeners/node.js +0 -59
- package/src/listeners/package.json +0 -4
- package/src/manager/index.js +0 -103
- package/src/metrics/Collectors.js +0 -77
- package/src/metrics/index.js +0 -174
- package/src/producer/browser/Partial.js +0 -104
- package/src/producer/browser.js +0 -82
- package/src/producer/fetcher/MySegments.js +0 -40
- package/src/producer/fetcher/SegmentChanges.js +0 -52
- package/src/producer/fetcher/SplitChanges.js +0 -39
- package/src/producer/node.js +0 -142
- package/src/producer/offline/browser.js +0 -28
- package/src/producer/offline/node.js +0 -28
- package/src/producer/offline/package.json +0 -4
- package/src/producer/package.json +0 -4
- package/src/producer/task.js +0 -57
- package/src/producer/updater/MySegments.js +0 -104
- package/src/producer/updater/SegmentChanges.js +0 -126
- package/src/producer/updater/SplitChanges.js +0 -138
- package/src/producer/updater/SplitChangesFromFeatures.js +0 -23
- package/src/producer/updater/SplitChangesFromFileSystem.js +0 -23
- package/src/producer/updater/SplitChangesFromObject.js +0 -81
- package/src/readiness/index.js +0 -125
- package/src/readiness/statusManager.js +0 -121
- package/src/services/.DS_Store +0 -0
- package/src/services/auth/auth.js +0 -21
- package/src/services/auth/index.js +0 -3
- package/src/services/events/bulk.js +0 -23
- package/src/services/events/index.js +0 -18
- package/src/services/getEventSource/package.json +0 -4
- package/src/services/getFetch/package.json +0 -4
- package/src/services/impressions/bulk.js +0 -26
- package/src/services/impressions/count.js +0 -8
- package/src/services/impressions/dto.js +0 -71
- package/src/services/impressions/index.js +0 -18
- package/src/services/impressions/post.js +0 -23
- package/src/services/metrics/counters.js +0 -25
- package/src/services/metrics/dto.js +0 -44
- package/src/services/metrics/index.js +0 -18
- package/src/services/metrics/times.js +0 -25
- package/src/services/mySegments/get.js +0 -27
- package/src/services/mySegments/index.js +0 -18
- package/src/services/request/index.js +0 -43
- package/src/services/request/options/browser.js +0 -18
- package/src/services/request/options/package.json +0 -4
- package/src/services/segmentChanges/get.js +0 -20
- package/src/services/segmentChanges/index.js +0 -18
- package/src/services/splitChanges/get.js +0 -20
- package/src/services/splitChanges/index.js +0 -18
- package/src/services/splitChanges/offline/browser.js +0 -66
- package/src/services/splitChanges/offline/node.js +0 -190
- package/src/services/splitChanges/offline/package.json +0 -4
- package/src/services/splitChanges/offline/parseCondition.js +0 -52
- package/src/services/transport/index.js +0 -44
- package/src/storage/AttributesCache/InMemory.js +0 -76
- package/src/storage/BaseMetricsAsyncCache.js +0 -14
- package/src/storage/CountCache/InMemory.js +0 -48
- package/src/storage/CountCache/InRedis.js +0 -32
- package/src/storage/EventsCache/InMemory.js +0 -99
- package/src/storage/EventsCache/InRedis.js +0 -62
- package/src/storage/ImpressionsCache/InMemory.js +0 -62
- package/src/storage/ImpressionsCache/InRedis.js +0 -65
- package/src/storage/Keys.js +0 -122
- package/src/storage/KeysLocalStorage.js +0 -40
- package/src/storage/LatencyCache/InMemory.js +0 -56
- package/src/storage/LatencyCache/InRedis.js +0 -35
- package/src/storage/LatencyCache/findIndex.js +0 -7
- package/src/storage/Meta.js +0 -7
- package/src/storage/RedisAdapter.js +0 -170
- package/src/storage/SegmentCache/InLocalStorage/index.js +0 -120
- package/src/storage/SegmentCache/InMemory/browser.js +0 -99
- package/src/storage/SegmentCache/InMemory/node.js +0 -84
- package/src/storage/SegmentCache/InMemory/package.json +0 -4
- package/src/storage/SegmentCache/InRedis/index.js +0 -71
- package/src/storage/SplitCache/InLocalStorage.js +0 -324
- package/src/storage/SplitCache/InMemory.js +0 -145
- package/src/storage/SplitCache/InRedis.js +0 -187
- package/src/storage/SplitCache/killLocally.js +0 -33
- package/src/storage/browser.js +0 -110
- package/src/storage/node.js +0 -83
- package/src/storage/package.json +0 -4
- package/src/sync/.DS_Store +0 -0
- package/src/sync/AuthClient/index.js +0 -31
- package/src/sync/PushManager/index.js +0 -328
- package/src/sync/PushManager/mySegmentsV2utils.js +0 -76
- package/src/sync/PushManager/pushRequirements/browser.js +0 -20
- package/src/sync/PushManager/pushRequirements/node.js +0 -16
- package/src/sync/PushManager/pushRequirements/package.json +0 -4
- package/src/sync/SSEClient/index.js +0 -92
- package/src/sync/SSEHandler/NotificationKeeper.js +0 -90
- package/src/sync/SSEHandler/NotificationParser.js +0 -35
- package/src/sync/SSEHandler/index.js +0 -110
- package/src/sync/SegmentUpdateWorker/browser.js +0 -67
- package/src/sync/SegmentUpdateWorker/node.js +0 -73
- package/src/sync/SegmentUpdateWorker/package.json +0 -4
- package/src/sync/SplitUpdateWorker/index.js +0 -79
- package/src/sync/browser.js +0 -130
- package/src/sync/constants.js +0 -43
- package/src/sync/node.js +0 -66
- package/src/sync/package.json +0 -4
- package/src/trackers/event.js +0 -47
- package/src/trackers/impressions.js +0 -123
- package/src/utils/backoff/index.js +0 -46
- package/src/utils/base64/browser.js +0 -19
- package/src/utils/base64/node.js +0 -19
- package/src/utils/base64/package.json +0 -4
- package/src/utils/binarySearch/index.js +0 -50
- package/src/utils/constants/index.js +0 -41
- package/src/utils/context/constants.js +0 -18
- package/src/utils/context/index.js +0 -84
- package/src/utils/decompress/index.js +0 -428
- package/src/utils/fn/repeat.js +0 -48
- package/src/utils/inputValidation/apiKey.js +0 -42
- package/src/utils/inputValidation/attribute.js +0 -22
- package/src/utils/inputValidation/attributes.js +0 -26
- package/src/utils/inputValidation/event.js +0 -23
- package/src/utils/inputValidation/eventProperties.js +0 -65
- package/src/utils/inputValidation/eventValue.js +0 -11
- package/src/utils/inputValidation/index.js +0 -11
- package/src/utils/inputValidation/isOperational.js +0 -16
- package/src/utils/inputValidation/key.js +0 -53
- package/src/utils/inputValidation/split.js +0 -42
- package/src/utils/inputValidation/splitFilters.js +0 -108
- package/src/utils/inputValidation/splits.js +0 -21
- package/src/utils/inputValidation/trafficType.js +0 -58
- package/src/utils/jwt/hashUserKey.js +0 -11
- package/src/utils/jwt/index.js +0 -15
- package/src/utils/key/factory.js +0 -34
- package/src/utils/key/parser.js +0 -34
- package/src/utils/labels/index.js +0 -7
- package/src/utils/lang/Errors.js +0 -19
- package/src/utils/lang/Sets.js +0 -94
- package/src/utils/lang/index.js +0 -291
- package/src/utils/localstorage/isAvailable.js +0 -26
- package/src/utils/logger/LoggerFactory.js +0 -90
- package/src/utils/logger/index.js +0 -93
- package/src/utils/lrucache/linkedlist.js +0 -116
- package/src/utils/lrucache/lru.spec.js +0 -26
- package/src/utils/lrucache/lrucache.js +0 -49
- package/src/utils/now/browser.js +0 -29
- package/src/utils/now/node.js +0 -21
- package/src/utils/now/package.json +0 -4
- package/src/utils/promise/thenable.js +0 -1
- package/src/utils/promise/timeout.js +0 -38
- package/src/utils/promise/wrapper.js +0 -60
- package/src/utils/settings/defaults/package.json +0 -4
- package/src/utils/settings/impressionsMode.js +0 -15
- package/src/utils/settings/index.js +0 -217
- package/src/utils/settings/integrations/browser.js +0 -8
- package/src/utils/settings/integrations/common.js +0 -32
- package/src/utils/settings/integrations/package.json +0 -4
- package/src/utils/settings/language/browser.js +0 -17
- package/src/utils/settings/language/node.js +0 -17
- package/src/utils/settings/language/package.json +0 -4
- package/src/utils/settings/mode.js +0 -12
- package/src/utils/settings/runtime/browser.js +0 -22
- package/src/utils/settings/runtime/package.json +0 -4
- package/src/utils/settings/storage/package.json +0 -4
- package/src/utils/splits/usesSegments.js +0 -17
- package/src/utils/time/index.js +0 -8
- package/src/utils/timeTracker/index.js +0 -223
- package/src/utils/timeTracker/timer.js +0 -27
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
2
|
+
//
|
|
3
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
4
|
+
// copy of this software and associated documentation files (the
|
|
5
|
+
// "Software"), to deal in the Software without restriction, including
|
|
6
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
8
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
9
|
+
// following conditions:
|
|
10
|
+
//
|
|
11
|
+
// The above copyright notice and this permission notice shall be included
|
|
12
|
+
// in all copies or substantial portions of the Software.
|
|
13
|
+
//
|
|
14
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
15
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
17
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
18
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
19
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
20
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
21
|
+
|
|
22
|
+
// Adaptation of "events" library (https://www.npmjs.com/package/events)
|
|
23
|
+
// exported as an ES module instead of CommonJS, to avoid extra configuration steps when using
|
|
24
|
+
// the ESM build of the SDK with tools that doesn't support CommonJS by default (e.g. Rollup).
|
|
25
|
+
|
|
26
|
+
var R = typeof Reflect === 'object' ? Reflect : null;
|
|
27
|
+
var ReflectApply = R && typeof R.apply === 'function'
|
|
28
|
+
? R.apply
|
|
29
|
+
: function ReflectApply(target, receiver, args) {
|
|
30
|
+
return Function.prototype.apply.call(target, receiver, args);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
var ReflectOwnKeys;
|
|
34
|
+
if (R && typeof R.ownKeys === 'function') {
|
|
35
|
+
ReflectOwnKeys = R.ownKeys;
|
|
36
|
+
} else if (Object.getOwnPropertySymbols) {
|
|
37
|
+
ReflectOwnKeys = function ReflectOwnKeys(target) {
|
|
38
|
+
return Object.getOwnPropertyNames(target)
|
|
39
|
+
.concat(Object.getOwnPropertySymbols(target));
|
|
40
|
+
};
|
|
41
|
+
} else {
|
|
42
|
+
ReflectOwnKeys = function ReflectOwnKeys(target) {
|
|
43
|
+
return Object.getOwnPropertyNames(target);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function ProcessEmitWarning(warning) {
|
|
48
|
+
if (console && console.warn) console.warn(warning);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
|
|
52
|
+
return value !== value;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export function EventEmitter() {
|
|
56
|
+
EventEmitter.init.call(this);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
EventEmitter.prototype._events = undefined;
|
|
60
|
+
EventEmitter.prototype._eventsCount = 0;
|
|
61
|
+
EventEmitter.prototype._maxListeners = undefined;
|
|
62
|
+
|
|
63
|
+
// By default EventEmitters will print a warning if more than 10 listeners are
|
|
64
|
+
// added to it. This is a useful default which helps finding memory leaks.
|
|
65
|
+
var defaultMaxListeners = 10;
|
|
66
|
+
|
|
67
|
+
function checkListener(listener) {
|
|
68
|
+
if (typeof listener !== 'function') {
|
|
69
|
+
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function() {
|
|
76
|
+
return defaultMaxListeners;
|
|
77
|
+
},
|
|
78
|
+
set: function(arg) {
|
|
79
|
+
if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {
|
|
80
|
+
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.');
|
|
81
|
+
}
|
|
82
|
+
defaultMaxListeners = arg;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
EventEmitter.init = function() {
|
|
87
|
+
|
|
88
|
+
if (this._events === undefined ||
|
|
89
|
+
this._events === Object.getPrototypeOf(this)._events) {
|
|
90
|
+
this._events = Object.create(null);
|
|
91
|
+
this._eventsCount = 0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
this._maxListeners = this._maxListeners || undefined;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// Obviously not all Emitters should be limited to 10. This function allows
|
|
98
|
+
// that to be increased. Set to zero for unlimited.
|
|
99
|
+
EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
|
|
100
|
+
if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
|
|
101
|
+
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.');
|
|
102
|
+
}
|
|
103
|
+
this._maxListeners = n;
|
|
104
|
+
return this;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
function _getMaxListeners(that) {
|
|
108
|
+
if (that._maxListeners === undefined)
|
|
109
|
+
return EventEmitter.defaultMaxListeners;
|
|
110
|
+
return that._maxListeners;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
|
|
114
|
+
return _getMaxListeners(this);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
EventEmitter.prototype.emit = function emit(type) {
|
|
118
|
+
var args = [];
|
|
119
|
+
for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
|
|
120
|
+
var doError = (type === 'error');
|
|
121
|
+
|
|
122
|
+
var events = this._events;
|
|
123
|
+
if (events !== undefined)
|
|
124
|
+
doError = (doError && events.error === undefined);
|
|
125
|
+
else if (!doError)
|
|
126
|
+
return false;
|
|
127
|
+
|
|
128
|
+
// If there is no 'error' event listener then throw.
|
|
129
|
+
if (doError) {
|
|
130
|
+
var er;
|
|
131
|
+
if (args.length > 0)
|
|
132
|
+
er = args[0];
|
|
133
|
+
if (er instanceof Error) {
|
|
134
|
+
// Note: The comments on the `throw` lines are intentional, they show
|
|
135
|
+
// up in Node's output if this results in an unhandled exception.
|
|
136
|
+
throw er; // Unhandled 'error' event
|
|
137
|
+
}
|
|
138
|
+
// At least give some kind of context to the user
|
|
139
|
+
var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
|
|
140
|
+
err.context = er;
|
|
141
|
+
throw err; // Unhandled 'error' event
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
var handler = events[type];
|
|
145
|
+
|
|
146
|
+
if (handler === undefined)
|
|
147
|
+
return false;
|
|
148
|
+
|
|
149
|
+
if (typeof handler === 'function') {
|
|
150
|
+
ReflectApply(handler, this, args);
|
|
151
|
+
} else {
|
|
152
|
+
var len = handler.length;
|
|
153
|
+
var listeners = arrayClone(handler, len); // eslint-disable-next-line no-redeclare
|
|
154
|
+
for (var i = 0; i < len; ++i)
|
|
155
|
+
ReflectApply(listeners[i], this, args);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return true;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
function _addListener(target, type, listener, prepend) {
|
|
162
|
+
var m;
|
|
163
|
+
var events;
|
|
164
|
+
var existing;
|
|
165
|
+
|
|
166
|
+
checkListener(listener);
|
|
167
|
+
|
|
168
|
+
events = target._events;
|
|
169
|
+
if (events === undefined) {
|
|
170
|
+
events = target._events = Object.create(null);
|
|
171
|
+
target._eventsCount = 0;
|
|
172
|
+
} else {
|
|
173
|
+
// To avoid recursion in the case that type === "newListener"! Before
|
|
174
|
+
// adding it to the listeners, first emit "newListener".
|
|
175
|
+
if (events.newListener !== undefined) {
|
|
176
|
+
target.emit('newListener', type, listener.listener ? listener.listener : listener);
|
|
177
|
+
|
|
178
|
+
// Re-assign `events` because a newListener handler could have caused the
|
|
179
|
+
// this._events to be assigned to a new object
|
|
180
|
+
events = target._events;
|
|
181
|
+
}
|
|
182
|
+
existing = events[type];
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (existing === undefined) {
|
|
186
|
+
// Optimize the case of one listener. Don't need the extra array object.
|
|
187
|
+
existing = events[type] = listener;
|
|
188
|
+
++target._eventsCount;
|
|
189
|
+
} else {
|
|
190
|
+
if (typeof existing === 'function') {
|
|
191
|
+
// Adding the second element, need to change to array.
|
|
192
|
+
existing = events[type] =
|
|
193
|
+
prepend ? [listener, existing] : [existing, listener];
|
|
194
|
+
// If we've already got an array, just append.
|
|
195
|
+
} else if (prepend) {
|
|
196
|
+
existing.unshift(listener);
|
|
197
|
+
} else {
|
|
198
|
+
existing.push(listener);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Check for listener leak
|
|
202
|
+
m = _getMaxListeners(target);
|
|
203
|
+
if (m > 0 && existing.length > m && !existing.warned) {
|
|
204
|
+
existing.warned = true;
|
|
205
|
+
// No error code for this since it is a Warning
|
|
206
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
207
|
+
var w = new Error('Possible EventEmitter memory leak detected. ' +
|
|
208
|
+
existing.length + ' ' + String(type) + ' listeners ' +
|
|
209
|
+
'added. Use emitter.setMaxListeners() to ' +
|
|
210
|
+
'increase limit');
|
|
211
|
+
w.name = 'MaxListenersExceededWarning';
|
|
212
|
+
w.emitter = target;
|
|
213
|
+
w.type = type;
|
|
214
|
+
w.count = existing.length;
|
|
215
|
+
ProcessEmitWarning(w);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return target;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
EventEmitter.prototype.addListener = function addListener(type, listener) {
|
|
223
|
+
return _addListener(this, type, listener, false);
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
|
|
227
|
+
|
|
228
|
+
EventEmitter.prototype.prependListener =
|
|
229
|
+
function prependListener(type, listener) {
|
|
230
|
+
return _addListener(this, type, listener, true);
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
function onceWrapper() {
|
|
234
|
+
if (!this.fired) {
|
|
235
|
+
this.target.removeListener(this.type, this.wrapFn);
|
|
236
|
+
this.fired = true;
|
|
237
|
+
if (arguments.length === 0)
|
|
238
|
+
return this.listener.call(this.target);
|
|
239
|
+
return this.listener.apply(this.target, arguments);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function _onceWrap(target, type, listener) {
|
|
244
|
+
var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
|
|
245
|
+
var wrapped = onceWrapper.bind(state);
|
|
246
|
+
wrapped.listener = listener;
|
|
247
|
+
state.wrapFn = wrapped;
|
|
248
|
+
return wrapped;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
EventEmitter.prototype.once = function once(type, listener) {
|
|
252
|
+
checkListener(listener);
|
|
253
|
+
this.on(type, _onceWrap(this, type, listener));
|
|
254
|
+
return this;
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
EventEmitter.prototype.prependOnceListener =
|
|
258
|
+
function prependOnceListener(type, listener) {
|
|
259
|
+
checkListener(listener);
|
|
260
|
+
this.prependListener(type, _onceWrap(this, type, listener));
|
|
261
|
+
return this;
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
// Emits a 'removeListener' event if and only if the listener was removed.
|
|
265
|
+
EventEmitter.prototype.removeListener =
|
|
266
|
+
function removeListener(type, listener) {
|
|
267
|
+
var list, events, position, i, originalListener;
|
|
268
|
+
|
|
269
|
+
checkListener(listener);
|
|
270
|
+
|
|
271
|
+
events = this._events;
|
|
272
|
+
if (events === undefined)
|
|
273
|
+
return this;
|
|
274
|
+
|
|
275
|
+
list = events[type];
|
|
276
|
+
if (list === undefined)
|
|
277
|
+
return this;
|
|
278
|
+
|
|
279
|
+
if (list === listener || list.listener === listener) {
|
|
280
|
+
if (--this._eventsCount === 0)
|
|
281
|
+
this._events = Object.create(null);
|
|
282
|
+
else {
|
|
283
|
+
delete events[type];
|
|
284
|
+
if (events.removeListener)
|
|
285
|
+
this.emit('removeListener', type, list.listener || listener);
|
|
286
|
+
}
|
|
287
|
+
} else if (typeof list !== 'function') {
|
|
288
|
+
position = -1;
|
|
289
|
+
|
|
290
|
+
for (i = list.length - 1; i >= 0; i--) {
|
|
291
|
+
if (list[i] === listener || list[i].listener === listener) {
|
|
292
|
+
originalListener = list[i].listener;
|
|
293
|
+
position = i;
|
|
294
|
+
break;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (position < 0)
|
|
299
|
+
return this;
|
|
300
|
+
|
|
301
|
+
if (position === 0)
|
|
302
|
+
list.shift();
|
|
303
|
+
else {
|
|
304
|
+
spliceOne(list, position);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
if (list.length === 1)
|
|
308
|
+
events[type] = list[0];
|
|
309
|
+
|
|
310
|
+
if (events.removeListener !== undefined)
|
|
311
|
+
this.emit('removeListener', type, originalListener || listener);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
return this;
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
|
|
318
|
+
|
|
319
|
+
EventEmitter.prototype.removeAllListeners =
|
|
320
|
+
function removeAllListeners(type) {
|
|
321
|
+
var listeners, events, i;
|
|
322
|
+
|
|
323
|
+
events = this._events;
|
|
324
|
+
if (events === undefined)
|
|
325
|
+
return this;
|
|
326
|
+
|
|
327
|
+
// not listening for removeListener, no need to emit
|
|
328
|
+
if (events.removeListener === undefined) {
|
|
329
|
+
if (arguments.length === 0) {
|
|
330
|
+
this._events = Object.create(null);
|
|
331
|
+
this._eventsCount = 0;
|
|
332
|
+
} else if (events[type] !== undefined) {
|
|
333
|
+
if (--this._eventsCount === 0)
|
|
334
|
+
this._events = Object.create(null);
|
|
335
|
+
else
|
|
336
|
+
delete events[type];
|
|
337
|
+
}
|
|
338
|
+
return this;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// emit removeListener for all listeners on all events
|
|
342
|
+
if (arguments.length === 0) {
|
|
343
|
+
var keys = Object.keys(events);
|
|
344
|
+
var key;
|
|
345
|
+
for (i = 0; i < keys.length; ++i) {
|
|
346
|
+
key = keys[i];
|
|
347
|
+
if (key === 'removeListener') continue;
|
|
348
|
+
this.removeAllListeners(key);
|
|
349
|
+
}
|
|
350
|
+
this.removeAllListeners('removeListener');
|
|
351
|
+
this._events = Object.create(null);
|
|
352
|
+
this._eventsCount = 0;
|
|
353
|
+
return this;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
listeners = events[type];
|
|
357
|
+
|
|
358
|
+
if (typeof listeners === 'function') {
|
|
359
|
+
this.removeListener(type, listeners);
|
|
360
|
+
} else if (listeners !== undefined) {
|
|
361
|
+
// LIFO order
|
|
362
|
+
for (i = listeners.length - 1; i >= 0; i--) {
|
|
363
|
+
this.removeListener(type, listeners[i]);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
return this;
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
function _listeners(target, type, unwrap) {
|
|
371
|
+
var events = target._events;
|
|
372
|
+
|
|
373
|
+
if (events === undefined)
|
|
374
|
+
return [];
|
|
375
|
+
|
|
376
|
+
var evlistener = events[type];
|
|
377
|
+
if (evlistener === undefined)
|
|
378
|
+
return [];
|
|
379
|
+
|
|
380
|
+
if (typeof evlistener === 'function')
|
|
381
|
+
return unwrap ? [evlistener.listener || evlistener] : [evlistener];
|
|
382
|
+
|
|
383
|
+
return unwrap ?
|
|
384
|
+
unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
EventEmitter.prototype.listeners = function listeners(type) {
|
|
388
|
+
return _listeners(this, type, true);
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
EventEmitter.prototype.rawListeners = function rawListeners(type) {
|
|
392
|
+
return _listeners(this, type, false);
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
EventEmitter.listenerCount = function(emitter, type) {
|
|
396
|
+
if (typeof emitter.listenerCount === 'function') {
|
|
397
|
+
return emitter.listenerCount(type);
|
|
398
|
+
} else {
|
|
399
|
+
return listenerCount.call(emitter, type);
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
EventEmitter.prototype.listenerCount = listenerCount;
|
|
404
|
+
function listenerCount(type) {
|
|
405
|
+
var events = this._events;
|
|
406
|
+
|
|
407
|
+
if (events !== undefined) {
|
|
408
|
+
var evlistener = events[type];
|
|
409
|
+
|
|
410
|
+
if (typeof evlistener === 'function') {
|
|
411
|
+
return 1;
|
|
412
|
+
} else if (evlistener !== undefined) {
|
|
413
|
+
return evlistener.length;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
return 0;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
EventEmitter.prototype.eventNames = function eventNames() {
|
|
421
|
+
return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
function arrayClone(arr, n) {
|
|
425
|
+
var copy = new Array(n);
|
|
426
|
+
for (var i = 0; i < n; ++i)
|
|
427
|
+
copy[i] = arr[i];
|
|
428
|
+
return copy;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
function spliceOne(list, index) {
|
|
432
|
+
for (; index + 1 < list.length; index++)
|
|
433
|
+
list[index] = list[index + 1];
|
|
434
|
+
list.pop();
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
function unwrapListeners(arr) {
|
|
438
|
+
var ret = new Array(arr.length);
|
|
439
|
+
for (var i = 0; i < ret.length; ++i) {
|
|
440
|
+
ret[i] = arr[i].listener || arr[i];
|
|
441
|
+
}
|
|
442
|
+
return ret;
|
|
443
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EventEmitter } from './EventEmitter';
|
|
2
|
+
import { getFetch } from '../platform/getFetch/browser';
|
|
3
|
+
import { getEventSource } from '../platform/getEventSource/browser';
|
|
4
|
+
import { BrowserSignalListener } from '@splitsoftware/splitio-commons/src/listeners/browser';
|
|
5
|
+
|
|
6
|
+
export const platform = {
|
|
7
|
+
getFetch,
|
|
8
|
+
getEventSource,
|
|
9
|
+
EventEmitter
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const SignalListener = BrowserSignalListener;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
1
|
+
export function getEventSource() {
|
|
2
2
|
return typeof EventSource === 'function' ? EventSource : undefined;
|
|
3
|
-
}
|
|
3
|
+
}
|
|
@@ -10,11 +10,11 @@ export function __restore() {
|
|
|
10
10
|
__isCustom = false;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export function getEventSource() {
|
|
14
14
|
// returns EventSource at `eventsource` package. If not available, return global EventSource or undefined
|
|
15
15
|
try {
|
|
16
16
|
return __isCustom ? __eventSource : require('eventsource');
|
|
17
17
|
} catch (error) {
|
|
18
18
|
return typeof EventSource === 'function' ? EventSource : undefined;
|
|
19
19
|
}
|
|
20
|
-
}
|
|
20
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import EventEmitter from 'events';
|
|
2
|
+
import { getFetch } from '../platform/getFetch/node';
|
|
3
|
+
import { getEventSource } from '../platform/getEventSource/node';
|
|
4
|
+
import { getOptions } from '../platform/request/options/node';
|
|
5
|
+
import { NodeSignalListener } from '@splitsoftware/splitio-commons/src/listeners/node';
|
|
6
|
+
|
|
7
|
+
export const platform = {
|
|
8
|
+
getOptions,
|
|
9
|
+
getFetch,
|
|
10
|
+
getEventSource,
|
|
11
|
+
EventEmitter
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const SignalListener = NodeSignalListener;
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
Copyright
|
|
2
|
+
Copyright 2022 Split Software
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -23,7 +23,7 @@ const agent = new https.Agent({
|
|
|
23
23
|
keepAliveMsecs: 1500
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
export
|
|
26
|
+
export function getOptions() {
|
|
27
27
|
return {
|
|
28
28
|
agent
|
|
29
29
|
};
|
|
Binary file
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { settingsValidation } from '@splitsoftware/splitio-commons/src/utils/settingsValidation';
|
|
2
|
+
import { defaults } from './defaults/browser';
|
|
3
|
+
import { validateStorage } from './storage/browser';
|
|
4
|
+
import { validateIntegrations } from './integrations/browser';
|
|
5
|
+
import { validateLogger } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/logger/builtinLogger';
|
|
6
|
+
import { LocalhostFromObject } from '@splitsoftware/splitio-commons/src/sync/offline/LocalhostFromObject';
|
|
7
|
+
|
|
8
|
+
const params = {
|
|
9
|
+
defaults,
|
|
10
|
+
storage: validateStorage,
|
|
11
|
+
integrations: validateIntegrations,
|
|
12
|
+
logger: validateLogger,
|
|
13
|
+
localhost: () => LocalhostFromObject(),
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function settingsFactory(config) {
|
|
17
|
+
return settingsValidation(config, params);
|
|
18
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { packageVersion } from './version';
|
|
2
|
+
|
|
3
|
+
export const defaults = {
|
|
2
4
|
startup: {
|
|
3
5
|
// Stress the request time used while starting up the SDK.
|
|
4
6
|
requestTimeoutBeforeReady: 5,
|
|
@@ -8,5 +10,8 @@ export default {
|
|
|
8
10
|
readyTimeout: 10,
|
|
9
11
|
// Amount of time we will wait before the first push of events.
|
|
10
12
|
eventsFirstPushWindow: 10
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
// Instance version.
|
|
16
|
+
version: `javascript-${packageVersion}`,
|
|
17
|
+
};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { packageVersion } from './version';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
exports.default = void 0;
|
|
5
|
-
var _default = {
|
|
3
|
+
export const defaults = {
|
|
6
4
|
core: {
|
|
7
5
|
// Default is true.
|
|
8
6
|
IPAddressesEnabled: true
|
|
@@ -21,6 +19,8 @@ var _default = {
|
|
|
21
19
|
featuresRefreshRate: 5,
|
|
22
20
|
impressionsRefreshRate: 300
|
|
23
21
|
},
|
|
24
|
-
features: '.split'
|
|
22
|
+
features: '.split',
|
|
23
|
+
|
|
24
|
+
// Instance version.
|
|
25
|
+
version: `nodejs-${packageVersion}`,
|
|
25
26
|
};
|
|
26
|
-
exports.default = _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const packageVersion = '10.17.3-rc.1';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { GOOGLE_ANALYTICS_TO_SPLIT, SPLIT_TO_GOOGLE_ANALYTICS } from '@splitsoftware/splitio-commons/src/utils/constants/browser';
|
|
2
|
+
import { validateConfigurableIntegrations } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/integrations/configurable';
|
|
3
|
+
|
|
4
|
+
export const validateIntegrations = settings => {
|
|
5
|
+
return validateConfigurableIntegrations(settings, [GOOGLE_ANALYTICS_TO_SPLIT, SPLIT_TO_GOOGLE_ANALYTICS]);
|
|
6
|
+
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// For now, Node SDK does not support integrations,
|
|
2
2
|
// thus any integrations settings is parsed into undefined.
|
|
3
|
-
const
|
|
3
|
+
export const validateIntegrations = () => {
|
|
4
4
|
return [];
|
|
5
5
|
};
|
|
6
|
-
|
|
7
|
-
export default validateNodeIntegrationsSettings;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { settingsValidation } from '@splitsoftware/splitio-commons/src/utils/settingsValidation';
|
|
2
|
+
import { defaults } from './defaults/node';
|
|
3
|
+
import { validateRuntime } from './runtime/node';
|
|
4
|
+
import { validateStorage } from './storage/node';
|
|
5
|
+
import { validateIntegrations } from './integrations/node';
|
|
6
|
+
import { validateLogger } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/logger/builtinLogger';
|
|
7
|
+
import { LocalhostFromFile } from '@splitsoftware/splitio-commons/src/sync/offline/LocalhostFromFile';
|
|
8
|
+
|
|
9
|
+
const params = {
|
|
10
|
+
defaults,
|
|
11
|
+
runtime: validateRuntime,
|
|
12
|
+
storage: validateStorage,
|
|
13
|
+
integrations: validateIntegrations,
|
|
14
|
+
logger: validateLogger,
|
|
15
|
+
localhost: () => LocalhostFromFile(),
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export function settingsFactory(config) {
|
|
19
|
+
return settingsValidation(config, params);
|
|
20
|
+
}
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
Copyright
|
|
2
|
+
Copyright 2022 Split Software
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -17,18 +17,21 @@ limitations under the License.
|
|
|
17
17
|
import osFunction from 'os';
|
|
18
18
|
import ipFunction from 'ip';
|
|
19
19
|
|
|
20
|
-
import { UNKNOWN, NA } from '
|
|
20
|
+
import { UNKNOWN, NA, CONSUMER_MODE } from '@splitsoftware/splitio-commons/src/utils/constants';
|
|
21
|
+
|
|
22
|
+
export function validateRuntime(settings) {
|
|
23
|
+
const isIPAddressesEnabled = settings.core.IPAddressesEnabled === true;
|
|
24
|
+
const isConsumerMode = settings.mode === CONSUMER_MODE;
|
|
21
25
|
|
|
22
|
-
export default function generateRuntimeSettings(isIPAddressesEnabled, isConsumerMode) {
|
|
23
26
|
// If the values are not available, default to false (for standalone) or "unknown" (for consumer mode, to be used on Redis keys)
|
|
24
27
|
let ip = ipFunction.address() || (isConsumerMode ? UNKNOWN : false);
|
|
25
28
|
let hostname = osFunction.hostname() || (isConsumerMode ? UNKNOWN : false);
|
|
26
|
-
|
|
29
|
+
|
|
27
30
|
if (!isIPAddressesEnabled) { // If IPAddresses setting is not enabled, set as false (for standalone) or "NA" (for consumer mode, to be used on Redis keys)
|
|
28
31
|
ip = hostname = isConsumerMode ? NA : false;
|
|
29
32
|
}
|
|
30
|
-
|
|
33
|
+
|
|
31
34
|
return {
|
|
32
35
|
ip, hostname
|
|
33
36
|
};
|
|
34
|
-
}
|
|
37
|
+
}
|