@splitsoftware/splitio-commons 1.1.1-rc.0 → 1.2.1-rc.2
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 +1 -1
- package/cjs/evaluator/Engine.js +6 -6
- package/cjs/evaluator/combiners/and.js +1 -1
- package/cjs/evaluator/combiners/ifelseif.js +2 -2
- package/cjs/evaluator/condition/engineUtils.js +2 -2
- package/cjs/evaluator/condition/index.js +4 -4
- package/cjs/evaluator/index.js +5 -5
- package/cjs/evaluator/matchers/cont_all.js +1 -1
- package/cjs/evaluator/matchers/cont_any.js +1 -1
- package/cjs/evaluator/matchers/cont_str.js +1 -1
- package/cjs/evaluator/matchers/dependency.js +1 -1
- package/cjs/evaluator/matchers/eq_set.js +1 -1
- package/cjs/evaluator/matchers/ew.js +3 -3
- package/cjs/evaluator/matchers/part_of.js +1 -1
- package/cjs/evaluator/matchers/segment.js +1 -1
- package/cjs/evaluator/matchers/sw.js +1 -1
- package/cjs/evaluator/matchers/whitelist.js +1 -1
- package/cjs/evaluator/matchersTransform/index.js +12 -12
- package/cjs/evaluator/parser/index.js +6 -6
- package/cjs/evaluator/treatments/index.js +1 -1
- package/cjs/evaluator/value/index.js +1 -1
- package/cjs/evaluator/value/sanitize.js +4 -4
- package/cjs/integrations/browser.js +3 -3
- package/cjs/integrations/ga/GaToSplit.js +14 -14
- package/cjs/integrations/ga/GoogleAnalyticsToSplit.js +1 -1
- package/cjs/integrations/ga/SplitToGa.js +1 -1
- package/cjs/listeners/browser.js +1 -1
- package/cjs/listeners/node.js +1 -1
- package/cjs/logger/constants.js +3 -1
- package/cjs/logger/index.js +2 -2
- package/cjs/logger/messages/debug.js +1 -1
- package/cjs/logger/messages/error.js +1 -1
- package/cjs/logger/messages/info.js +4 -4
- package/cjs/logger/messages/warn.js +1 -1
- package/cjs/logger/sdkLogger.js +1 -1
- package/cjs/readiness/readinessManager.js +2 -2
- package/cjs/readiness/sdkReadinessManager.js +4 -4
- package/cjs/sdkClient/client.js +11 -10
- package/cjs/sdkClient/clientAttributesDecoration.js +4 -4
- package/cjs/sdkClient/clientCS.js +4 -3
- package/cjs/sdkClient/clientInputValidation.js +14 -14
- package/cjs/sdkClient/sdkClient.js +3 -3
- package/cjs/sdkClient/sdkClientMethod.js +1 -1
- package/cjs/sdkClient/sdkClientMethodCS.js +6 -6
- package/cjs/sdkClient/sdkClientMethodCSWithTT.js +8 -8
- package/cjs/sdkFactory/index.js +8 -8
- package/cjs/sdkManager/index.js +11 -11
- package/cjs/services/splitApi.js +3 -2
- package/cjs/services/splitHttpClient.js +3 -3
- package/cjs/storages/KeyBuilder.js +2 -2
- package/cjs/storages/KeyBuilderCS.js +2 -2
- package/cjs/storages/KeyBuilderSS.js +1 -1
- package/cjs/storages/findLatencyIndex.js +1 -1
- package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +1 -1
- package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +12 -12
- package/cjs/storages/inLocalStorage/index.js +3 -3
- package/cjs/storages/inMemory/AttributesCacheInMemory.js +1 -1
- package/cjs/storages/inMemory/ImpressionCountsCacheInMemory.js +1 -1
- package/cjs/storages/inMemory/LatenciesCacheInMemory.js +1 -1
- package/cjs/storages/inMemory/MySegmentsCacheInMemory.js +1 -1
- package/cjs/storages/inMemory/SegmentsCacheInMemory.js +2 -2
- package/cjs/storages/inMemory/SplitsCacheInMemory.js +5 -5
- package/cjs/storages/inRedis/LatenciesCacheInRedis.js +1 -1
- package/cjs/storages/inRedis/RedisAdapter.js +16 -10
- package/cjs/storages/inRedis/SegmentsCacheInRedis.js +1 -1
- package/cjs/storages/inRedis/SplitsCacheInRedis.js +3 -3
- package/cjs/storages/inRedis/index.js +1 -1
- package/cjs/storages/pluggable/SegmentsCachePluggable.js +1 -1
- package/cjs/storages/pluggable/SplitsCachePluggable.js +3 -3
- package/cjs/storages/pluggable/inMemoryWrapper.js +4 -4
- package/cjs/storages/pluggable/index.js +4 -4
- package/cjs/sync/offline/LocalhostFromFile.js +1 -1
- package/cjs/sync/offline/LocalhostFromObject.js +1 -1
- package/cjs/sync/offline/splitsParser/parseCondition.js +1 -1
- package/cjs/sync/offline/splitsParser/splitsParserFromFile.js +13 -13
- package/cjs/sync/offline/splitsParser/splitsParserFromSettings.js +3 -3
- package/cjs/sync/offline/syncManagerOffline.js +1 -1
- package/cjs/sync/offline/syncTasks/fromObjectSyncTask.js +2 -2
- package/cjs/sync/polling/fetchers/mySegmentsFetcher.js +2 -2
- package/cjs/sync/polling/fetchers/segmentChangesFetcher.js +1 -1
- package/cjs/sync/polling/pollingManagerCS.js +8 -7
- package/cjs/sync/polling/pollingManagerSS.js +5 -4
- package/cjs/sync/polling/syncTasks/mySegmentsSyncTask.js +1 -1
- package/cjs/sync/polling/syncTasks/segmentsSyncTask.js +1 -1
- package/cjs/sync/polling/syncTasks/splitsSyncTask.js +1 -1
- package/cjs/sync/polling/updaters/mySegmentsUpdater.js +3 -3
- package/cjs/sync/polling/updaters/segmentChangesUpdater.js +2 -2
- package/cjs/sync/polling/updaters/splitChangesUpdater.js +2 -2
- package/cjs/sync/streaming/AuthClient/index.js +4 -5
- package/cjs/sync/streaming/SSEHandler/NotificationParser.js +1 -1
- package/cjs/sync/streaming/SSEHandler/index.js +3 -3
- package/cjs/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +1 -1
- package/cjs/sync/streaming/mySegmentsV2utils.js +1 -1
- package/cjs/sync/streaming/pushManager.js +39 -35
- package/cjs/sync/submitters/eventsSyncTask.js +1 -1
- package/cjs/sync/submitters/impressionCountsSyncTask.js +1 -1
- package/cjs/sync/submitters/impressionsSyncTask.js +3 -3
- package/cjs/sync/submitters/metricsSyncTask.js +3 -3
- package/cjs/sync/submitters/submitterManager.js +6 -5
- package/cjs/sync/submitters/submitterSyncTask.js +1 -1
- package/cjs/sync/syncManagerOnline.js +12 -12
- package/cjs/trackers/eventTracker.js +3 -3
- package/cjs/trackers/impressionObserver/impressionObserverCS.js +1 -1
- package/cjs/trackers/impressionObserver/impressionObserverSS.js +1 -1
- package/cjs/trackers/impressionsTracker.js +3 -3
- package/cjs/utils/MinEvents.js +2 -1
- package/cjs/utils/inputValidation/apiKey.js +1 -1
- package/cjs/utils/inputValidation/attribute.js +4 -4
- package/cjs/utils/inputValidation/attributes.js +2 -2
- package/cjs/utils/inputValidation/event.js +1 -1
- package/cjs/utils/inputValidation/eventProperties.js +7 -5
- package/cjs/utils/inputValidation/eventValue.js +1 -1
- package/cjs/utils/inputValidation/key.js +6 -5
- package/cjs/utils/inputValidation/preloadedData.js +8 -8
- package/cjs/utils/inputValidation/split.js +1 -1
- package/cjs/utils/inputValidation/splits.js +2 -2
- package/cjs/utils/inputValidation/trafficType.js +1 -1
- package/cjs/utils/inputValidation/trafficTypeExistance.js +1 -1
- package/cjs/utils/jwt/index.js +1 -1
- package/cjs/utils/key/index.js +3 -3
- package/cjs/utils/lang/index.js +2 -14
- package/cjs/utils/murmur3/common.js +1 -1
- package/cjs/utils/murmur3/legacy.js +44 -0
- package/cjs/utils/murmur3/murmur3.js +10 -10
- package/cjs/utils/murmur3/murmur3_128.js +1 -1
- package/cjs/utils/murmur3/murmur3_128_x86.js +37 -37
- package/cjs/utils/murmur3/murmur3_64.js +1 -1
- package/cjs/utils/promise/timeout.js +1 -1
- package/cjs/utils/settingsValidation/index.js +5 -10
- package/cjs/utils/settingsValidation/integrations/configurable.js +1 -1
- package/cjs/utils/settingsValidation/integrations/pluggable.js +1 -1
- package/cjs/utils/settingsValidation/localhost/builtin.js +2 -2
- package/cjs/utils/settingsValidation/logger/builtinLogger.js +3 -3
- package/cjs/utils/settingsValidation/logger/commons.js +1 -1
- package/cjs/utils/settingsValidation/logger/pluggableLogger.js +1 -1
- package/cjs/utils/settingsValidation/runtime/browser.js +10 -0
- package/cjs/utils/settingsValidation/runtime/node.js +22 -0
- package/cjs/utils/settingsValidation/splitFilters.js +1 -1
- package/cjs/utils/settingsValidation/storage/storageCS.js +1 -1
- package/cjs/utils/timeTracker/index.js +3 -3
- package/esm/evaluator/matchers/ew.js +4 -4
- package/esm/logger/messages/info.js +3 -3
- package/esm/sdkClient/client.js +2 -1
- package/esm/sdkClient/clientCS.js +2 -1
- package/esm/services/splitApi.js +2 -1
- package/esm/services/splitHttpClient.js +1 -1
- package/esm/storages/inRedis/RedisAdapter.js +7 -1
- package/esm/sync/offline/splitsParser/splitsParserFromFile.js +1 -1
- package/esm/sync/polling/fetchers/mySegmentsFetcher.js +2 -2
- package/esm/sync/polling/fetchers/segmentChangesFetcher.js +2 -2
- package/esm/sync/polling/pollingManagerCS.js +2 -1
- package/esm/sync/polling/pollingManagerSS.js +2 -1
- package/esm/sync/polling/syncTasks/mySegmentsSyncTask.js +1 -1
- package/esm/sync/polling/updaters/mySegmentsUpdater.js +2 -2
- package/esm/sync/streaming/AuthClient/index.js +1 -2
- package/esm/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +1 -1
- package/esm/sync/streaming/pushManager.js +27 -23
- package/esm/sync/submitters/submitterManager.js +2 -1
- package/esm/sync/syncManagerOnline.js +12 -12
- package/esm/utils/inputValidation/eventProperties.js +4 -2
- package/esm/utils/inputValidation/key.js +2 -1
- package/esm/utils/lang/index.js +2 -13
- package/esm/utils/murmur3/legacy.js +39 -0
- package/esm/utils/promise/timeout.js +1 -1
- package/esm/utils/settingsValidation/index.js +1 -6
- package/esm/utils/settingsValidation/runtime/browser.js +6 -0
- package/esm/utils/settingsValidation/runtime/node.js +17 -0
- package/package.json +8 -7
- package/src/evaluator/matchers/ew.ts +4 -4
- package/src/logger/.DS_Store +0 -0
- package/src/logger/messages/info.ts +3 -3
- package/src/logger/types.ts +4 -0
- package/src/sdkClient/client.ts +2 -1
- package/src/sdkClient/clientCS.ts +3 -1
- package/src/services/splitHttpClient.ts +1 -1
- package/src/sync/offline/splitsParser/splitsParserFromFile.ts +1 -1
- package/src/sync/polling/fetchers/mySegmentsFetcher.ts +2 -1
- package/src/sync/polling/fetchers/types.ts +1 -0
- package/src/sync/polling/pollingManagerCS.ts +3 -6
- package/src/sync/polling/pollingManagerSS.ts +3 -8
- package/src/sync/polling/syncTasks/mySegmentsSyncTask.ts +2 -1
- package/src/sync/polling/types.ts +0 -12
- package/src/sync/polling/updaters/mySegmentsUpdater.ts +2 -1
- package/src/sync/streaming/AuthClient/index.ts +1 -2
- package/src/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.ts +1 -1
- package/src/sync/streaming/pushManager.ts +31 -38
- package/src/sync/streaming/types.ts +5 -25
- package/src/sync/submitters/submitterManager.ts +4 -8
- package/src/sync/syncManagerOnline.ts +16 -22
- package/src/types.ts +5 -1
- package/src/utils/inputValidation/eventProperties.ts +4 -2
- package/src/utils/lang/index.ts +0 -14
- package/src/utils/murmur3/legacy.ts +48 -0
- package/src/utils/promise/timeout.ts +1 -1
- package/src/utils/settingsValidation/index.ts +1 -6
- package/src/utils/settingsValidation/runtime/browser.ts +6 -0
- package/src/utils/settingsValidation/runtime/node.ts +22 -0
- package/src/utils/settingsValidation/types.ts +6 -6
- package/types/integrations/ga/GaToSplitPlugin.d.ts +3 -0
- package/types/integrations/ga/SplitToGaPlugin.d.ts +4 -0
- package/types/logger/browser/{DebugLogger.d.ts → debugLogger.d.ts} +0 -0
- package/types/logger/browser/{ErrorLogger.d.ts → errorLogger.d.ts} +0 -0
- package/types/logger/browser/{InfoLogger.d.ts → infoLogger.d.ts} +0 -0
- package/types/logger/browser/{WarnLogger.d.ts → warnLogger.d.ts} +0 -0
- package/types/logger/codes.d.ts +2 -0
- package/types/logger/codesConstants.d.ts +117 -0
- package/types/logger/codesConstantsBrowser.d.ts +2 -0
- package/types/logger/codesConstantsNode.d.ts +14 -0
- package/types/logger/codesDebug.d.ts +1 -0
- package/types/logger/codesDebugBrowser.d.ts +1 -0
- package/types/logger/codesDebugNode.d.ts +1 -0
- package/types/logger/codesError.d.ts +1 -0
- package/types/logger/codesErrorNode.d.ts +1 -0
- package/types/logger/codesInfo.d.ts +1 -0
- package/types/logger/codesWarn.d.ts +1 -0
- package/types/logger/codesWarnNode.d.ts +1 -0
- package/types/logger/debugLogger.d.ts +2 -0
- package/types/logger/errorLogger.d.ts +2 -0
- package/types/logger/infoLogger.d.ts +2 -0
- package/types/logger/messages/debugBrowser.d.ts +1 -0
- package/types/logger/messages/debugNode.d.ts +1 -0
- package/types/logger/messages/errorNode.d.ts +1 -0
- package/types/logger/messages/warnNode.d.ts +1 -0
- package/types/logger/noopLogger.d.ts +2 -0
- package/types/logger/types.d.ts +4 -0
- package/types/logger/warnLogger.d.ts +2 -0
- package/types/sdkClient/clientAttributesDecoration.d.ts +1 -1
- package/types/sdkManager/sdkManagerMethod.d.ts +6 -0
- package/types/storages/getRegisteredSegments.d.ts +10 -0
- package/types/storages/inMemory/TelemetryCacheInMemory.d.ts +51 -0
- package/types/storages/inMemory/index.d.ts +10 -0
- package/types/storages/inRedis/TelemetryCacheInRedis.d.ts +0 -0
- package/types/storages/parseSegments.d.ts +6 -0
- package/types/storages/pluggable/TelemetryCachePluggable.d.ts +2 -0
- package/types/sync/polling/fetchers/mySegmentsFetcher.d.ts +1 -1
- package/types/sync/polling/fetchers/types.d.ts +1 -1
- package/types/sync/polling/pollingManagerCS.d.ts +2 -5
- package/types/sync/polling/pollingManagerSS.d.ts +2 -5
- package/types/sync/polling/syncTasks/splitsSyncTask.copy.d.ts +35 -0
- package/types/sync/polling/syncTasks/splitsSyncTask.morelikeoriginal.d.ts +35 -0
- package/types/sync/polling/types.d.ts +0 -11
- package/types/sync/polling/updaters/mySegmentsUpdater.d.ts +1 -1
- package/types/sync/streaming/AuthClient/indexV1.d.ts +12 -0
- package/types/sync/streaming/AuthClient/indexV2.d.ts +8 -0
- package/types/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.d.ts +1 -1
- package/types/sync/streaming/pushManager.d.ts +3 -7
- package/types/sync/streaming/pushManagerCS.d.ts +1 -0
- package/types/sync/streaming/pushManagerNoUsers.d.ts +13 -0
- package/types/sync/streaming/pushManagerSS.d.ts +1 -0
- package/types/sync/streaming/types.d.ts +3 -23
- package/types/sync/submitters/submitterManager.d.ts +2 -4
- package/types/sync/submitters/telemetrySyncTask.d.ts +17 -0
- package/types/sync/syncManagerFromFile.d.ts +2 -0
- package/types/sync/syncManagerFromObject.d.ts +2 -0
- package/types/sync/syncManagerOffline.d.ts +9 -0
- package/types/sync/syncManagerOnline.d.ts +3 -3
- package/types/trackers/telemetryRecorder.d.ts +0 -0
- package/types/types.d.ts +1 -0
- package/types/utils/EventEmitter.d.ts +4 -0
- package/types/utils/lang/errors.d.ts +10 -0
- package/types/utils/lang/index.d.ts +0 -4
- package/types/utils/murmur3/commons.d.ts +12 -0
- package/types/utils/murmur3/legacy.d.ts +2 -0
- package/types/utils/settingsValidation/buildMetadata.d.ts +3 -0
- package/types/utils/settingsValidation/localhost/index.d.ts +9 -0
- package/types/utils/settingsValidation/logger.d.ts +11 -0
- package/types/utils/settingsValidation/runtime/browser.d.ts +4 -0
- package/types/utils/settingsValidation/runtime/node.d.ts +5 -0
- package/types/utils/settingsValidation/types.d.ts +6 -6
|
@@ -21,9 +21,9 @@ function eventTrackerFactory(log, eventsCache, integrationsManager) {
|
|
|
21
21
|
// Wrap in a timeout because we don't want it to be blocking.
|
|
22
22
|
setTimeout(function () {
|
|
23
23
|
// copy of event, to avoid unexpected behaviour if modified by integrations
|
|
24
|
-
var eventDataCopy = objectAssign_1.objectAssign({}, eventData);
|
|
24
|
+
var eventDataCopy = (0, objectAssign_1.objectAssign)({}, eventData);
|
|
25
25
|
if (eventData.properties)
|
|
26
|
-
eventDataCopy.properties = objectAssign_1.objectAssign({}, eventData.properties);
|
|
26
|
+
eventDataCopy.properties = (0, objectAssign_1.objectAssign)({}, eventData.properties);
|
|
27
27
|
// integrationsManager does not throw errors (they are internally handled by each integration module)
|
|
28
28
|
integrationsManager.handleEvent(eventDataCopy);
|
|
29
29
|
}, 0);
|
|
@@ -37,7 +37,7 @@ function eventTrackerFactory(log, eventsCache, integrationsManager) {
|
|
|
37
37
|
return {
|
|
38
38
|
track: function (eventData, size) {
|
|
39
39
|
var tracked = eventsCache.track(eventData, size);
|
|
40
|
-
if (thenable_1.thenable(tracked)) {
|
|
40
|
+
if ((0, thenable_1.thenable)(tracked)) {
|
|
41
41
|
return tracked.then(queueEventsCallback.bind(null, eventData));
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
@@ -5,7 +5,7 @@ var ImpressionObserver_1 = require("./ImpressionObserver");
|
|
|
5
5
|
var murmur3_1 = require("../../utils/murmur3/murmur3");
|
|
6
6
|
var buildKey_1 = require("./buildKey");
|
|
7
7
|
function hashImpression32(impression) {
|
|
8
|
-
return murmur3_1.hash(buildKey_1.buildKey(impression));
|
|
8
|
+
return (0, murmur3_1.hash)((0, buildKey_1.buildKey)(impression));
|
|
9
9
|
}
|
|
10
10
|
exports.hashImpression32 = hashImpression32;
|
|
11
11
|
var LAST_SEEN_CACHE_SIZE = 500; // cache up to 500 impression hashes
|
|
@@ -5,7 +5,7 @@ var ImpressionObserver_1 = require("./ImpressionObserver");
|
|
|
5
5
|
var murmur3_128_x86_1 = require("../../utils/murmur3/murmur3_128_x86");
|
|
6
6
|
var buildKey_1 = require("./buildKey");
|
|
7
7
|
function hashImpression128(impression) {
|
|
8
|
-
return murmur3_128_x86_1.hash128(buildKey_1.buildKey(impression));
|
|
8
|
+
return (0, murmur3_128_x86_1.hash128)((0, buildKey_1.buildKey)(impression));
|
|
9
9
|
}
|
|
10
10
|
exports.hashImpression128 = hashImpression128;
|
|
11
11
|
var LAST_SEEN_CACHE_SIZE = 500000; // cache up to 500k impression hashes
|
|
@@ -39,13 +39,13 @@ countsCache) {
|
|
|
39
39
|
countsCache.track(impression.feature, now, 1);
|
|
40
40
|
}
|
|
41
41
|
// Checks if the impression should be added in queue to be sent
|
|
42
|
-
if (!countsCache || !impression.pt || impression.pt < time_1.truncateTimeFrame(now)) {
|
|
42
|
+
if (!countsCache || !impression.pt || impression.pt < (0, time_1.truncateTimeFrame)(now)) {
|
|
43
43
|
impressionsToStore.push(impression);
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
var res = impressionsCache.track(impressionsToStore);
|
|
47
47
|
// If we're on an async storage, handle error and log it.
|
|
48
|
-
if (thenable_1.thenable(res)) {
|
|
48
|
+
if ((0, thenable_1.thenable)(res)) {
|
|
49
49
|
res.then(function () {
|
|
50
50
|
log.info(constants_1.IMPRESSIONS_TRACKER_SUCCESS, [impressionsCount]);
|
|
51
51
|
}).catch(function (err) {
|
|
@@ -57,7 +57,7 @@ countsCache) {
|
|
|
57
57
|
var _loop_1 = function (i) {
|
|
58
58
|
var impressionData = {
|
|
59
59
|
// copy of impression, to avoid unexpected behaviour if modified by integrations or impressionListener
|
|
60
|
-
impression: objectAssign_1.objectAssign({}, impressions[i]),
|
|
60
|
+
impression: (0, objectAssign_1.objectAssign)({}, impressions[i]),
|
|
61
61
|
attributes: attributes,
|
|
62
62
|
ip: ip,
|
|
63
63
|
hostname: hostname,
|
package/cjs/utils/MinEvents.js
CHANGED
|
@@ -38,9 +38,10 @@ var ReflectApply = R && typeof R.apply === 'function'
|
|
|
38
38
|
: function ReflectApply(target, receiver, args) {
|
|
39
39
|
return Function.prototype.apply.call(target, receiver, args);
|
|
40
40
|
};
|
|
41
|
-
|
|
41
|
+
var EventEmitter = function EventEmitter() {
|
|
42
42
|
EventEmitter.init.call(this);
|
|
43
43
|
};
|
|
44
|
+
exports.EventEmitter = EventEmitter;
|
|
44
45
|
exports.EventEmitter.prototype._events = undefined;
|
|
45
46
|
exports.EventEmitter.prototype._eventsCount = 0;
|
|
46
47
|
function checkListener(listener) {
|
|
@@ -10,7 +10,7 @@ function validateApiKey(log, maybeApiKey) {
|
|
|
10
10
|
if (maybeApiKey == undefined) { // eslint-disable-line eqeqeq
|
|
11
11
|
log.error(constants_1.ERROR_NULL, [constants_1.LOG_PREFIX_INSTANTIATION, item]);
|
|
12
12
|
}
|
|
13
|
-
else if (lang_1.isString(maybeApiKey)) {
|
|
13
|
+
else if ((0, lang_1.isString)(maybeApiKey)) {
|
|
14
14
|
if (maybeApiKey.length > 0)
|
|
15
15
|
apiKey = maybeApiKey;
|
|
16
16
|
else
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.validateAttribute = void 0;
|
|
4
4
|
var lang_1 = require("../../utils/lang");
|
|
5
5
|
function validateAttribute(log, attributeKey, attributeValue, method) {
|
|
6
|
-
if (!lang_1.isString(attributeKey) || attributeKey.length === 0) {
|
|
6
|
+
if (!(0, lang_1.isString)(attributeKey) || attributeKey.length === 0) {
|
|
7
7
|
log.warn(method + ": you passed an invalid attribute name, attribute name must be a non-empty string.");
|
|
8
8
|
return false;
|
|
9
9
|
}
|
|
10
|
-
var isStringVal = lang_1.isString(attributeValue);
|
|
11
|
-
var isFiniteVal = lang_1.isFiniteNumber(attributeValue);
|
|
12
|
-
var isBoolVal = lang_1.isBoolean(attributeValue);
|
|
10
|
+
var isStringVal = (0, lang_1.isString)(attributeValue);
|
|
11
|
+
var isFiniteVal = (0, lang_1.isFiniteNumber)(attributeValue);
|
|
12
|
+
var isBoolVal = (0, lang_1.isBoolean)(attributeValue);
|
|
13
13
|
var isArrayVal = Array.isArray(attributeValue);
|
|
14
14
|
if (!(isStringVal || isFiniteVal || isBoolVal || isArrayVal)) { // If it's not of valid type.
|
|
15
15
|
log.warn(method + ": you passed an invalid attribute value for " + attributeKey + ". Acceptable types are: string, number, boolean and array of strings.");
|
|
@@ -6,7 +6,7 @@ var attribute_1 = require("./attribute");
|
|
|
6
6
|
var constants_1 = require("../../logger/constants");
|
|
7
7
|
function validateAttributes(log, maybeAttrs, method) {
|
|
8
8
|
// Attributes are optional
|
|
9
|
-
if (lang_1.isObject(maybeAttrs) || maybeAttrs == undefined) // eslint-disable-line eqeqeq
|
|
9
|
+
if ((0, lang_1.isObject)(maybeAttrs) || maybeAttrs == undefined) // eslint-disable-line eqeqeq
|
|
10
10
|
return maybeAttrs;
|
|
11
11
|
log.error(constants_1.ERROR_NOT_PLAIN_OBJECT, [method, 'attributes']);
|
|
12
12
|
return false;
|
|
@@ -17,7 +17,7 @@ function validateAttributesDeep(log, maybeAttributes, method) {
|
|
|
17
17
|
return false;
|
|
18
18
|
var result = true;
|
|
19
19
|
Object.keys(maybeAttributes).forEach(function (attributeKey) {
|
|
20
|
-
if (!attribute_1.validateAttribute(log, attributeKey, maybeAttributes[attributeKey], method))
|
|
20
|
+
if (!(0, attribute_1.validateAttribute)(log, attributeKey, maybeAttributes[attributeKey], method))
|
|
21
21
|
result = false;
|
|
22
22
|
});
|
|
23
23
|
return result;
|
|
@@ -9,7 +9,7 @@ function validateEvent(log, maybeEvent, method) {
|
|
|
9
9
|
if (maybeEvent == undefined) { // eslint-disable-line eqeqeq
|
|
10
10
|
log.error(constants_1.ERROR_NULL, [method, item]);
|
|
11
11
|
}
|
|
12
|
-
else if (!lang_1.isString(maybeEvent)) {
|
|
12
|
+
else if (!(0, lang_1.isString)(maybeEvent)) {
|
|
13
13
|
log.error(constants_1.ERROR_INVALID, [method, item]);
|
|
14
14
|
}
|
|
15
15
|
else { // It is a string.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateEventProperties = void 0;
|
|
4
4
|
var lang_1 = require("../lang");
|
|
5
|
+
var objectAssign_1 = require("../lang/objectAssign");
|
|
5
6
|
var constants_1 = require("../../logger/constants");
|
|
6
7
|
var ECMA_SIZES = {
|
|
7
8
|
NULL: 0,
|
|
@@ -15,12 +16,13 @@ var BASE_EVENT_SIZE = 1024; // We assume 1kb events without properties (avg meas
|
|
|
15
16
|
function validateEventProperties(log, maybeProperties, method) {
|
|
16
17
|
if (maybeProperties == undefined)
|
|
17
18
|
return { properties: null, size: BASE_EVENT_SIZE }; // eslint-disable-line eqeqeq
|
|
18
|
-
if (!lang_1.isObject(maybeProperties)) {
|
|
19
|
+
if (!(0, lang_1.isObject)(maybeProperties)) {
|
|
19
20
|
log.error(constants_1.ERROR_NOT_PLAIN_OBJECT, [method, 'properties']);
|
|
20
21
|
return { properties: false, size: BASE_EVENT_SIZE };
|
|
21
22
|
}
|
|
22
23
|
var keys = Object.keys(maybeProperties);
|
|
23
|
-
|
|
24
|
+
// Shallow clone
|
|
25
|
+
var clone = (0, objectAssign_1.objectAssign)({}, maybeProperties);
|
|
24
26
|
// To avoid calculating the size twice we'll return it from here.
|
|
25
27
|
var output = {
|
|
26
28
|
properties: clone,
|
|
@@ -32,9 +34,9 @@ function validateEventProperties(log, maybeProperties, method) {
|
|
|
32
34
|
for (var i = 0; i < keys.length; i++) {
|
|
33
35
|
output.size += keys[i].length * ECMA_SIZES.STRING; // Count the size of the key which is always a string.
|
|
34
36
|
var val = clone[keys[i]];
|
|
35
|
-
var isStringVal = lang_1.isString(val);
|
|
36
|
-
var isFiniteVal = lang_1.isFiniteNumber(val);
|
|
37
|
-
var isBoolVal = lang_1.isBoolean(val);
|
|
37
|
+
var isStringVal = (0, lang_1.isString)(val);
|
|
38
|
+
var isFiniteVal = (0, lang_1.isFiniteNumber)(val);
|
|
39
|
+
var isBoolVal = (0, lang_1.isBoolean)(val);
|
|
38
40
|
var isNullVal = val === null;
|
|
39
41
|
if (!(isStringVal || isFiniteVal || isBoolVal || isNullVal)) { // If it's not of valid type.
|
|
40
42
|
clone[keys[i]] = null;
|
|
@@ -4,7 +4,7 @@ exports.validateEventValue = void 0;
|
|
|
4
4
|
var constants_1 = require("../../logger/constants");
|
|
5
5
|
var lang_1 = require("../lang");
|
|
6
6
|
function validateEventValue(log, maybeValue, method) {
|
|
7
|
-
if (lang_1.isFiniteNumber(maybeValue) || maybeValue == undefined) // eslint-disable-line eqeqeq
|
|
7
|
+
if ((0, lang_1.isFiniteNumber)(maybeValue) || maybeValue == undefined) // eslint-disable-line eqeqeq
|
|
8
8
|
return maybeValue;
|
|
9
9
|
log.error(constants_1.ERROR_NOT_FINITE, [method]);
|
|
10
10
|
return false;
|
|
@@ -9,11 +9,11 @@ function validateKeyValue(log, maybeKey, method, type) {
|
|
|
9
9
|
log.error(constants_1.ERROR_NULL, [method, type]);
|
|
10
10
|
return false;
|
|
11
11
|
}
|
|
12
|
-
if (lang_1.isFiniteNumber(maybeKey)) {
|
|
12
|
+
if ((0, lang_1.isFiniteNumber)(maybeKey)) {
|
|
13
13
|
log.warn(constants_1.WARN_CONVERTING, [method, type, maybeKey]);
|
|
14
|
-
return lang_1.toString(maybeKey);
|
|
14
|
+
return (0, lang_1.toString)(maybeKey);
|
|
15
15
|
}
|
|
16
|
-
if (lang_1.isString(maybeKey)) {
|
|
16
|
+
if ((0, lang_1.isString)(maybeKey)) {
|
|
17
17
|
// It's a string, start by trimming the value.
|
|
18
18
|
maybeKey = maybeKey.trim();
|
|
19
19
|
// It's aaaaaall good.
|
|
@@ -32,13 +32,14 @@ function validateKeyValue(log, maybeKey, method, type) {
|
|
|
32
32
|
return false;
|
|
33
33
|
}
|
|
34
34
|
function validateKey(log, maybeKey, method) {
|
|
35
|
-
if (lang_1.isObject(maybeKey)) {
|
|
35
|
+
if ((0, lang_1.isObject)(maybeKey)) {
|
|
36
36
|
// Validate key object
|
|
37
37
|
var matchingKey = validateKeyValue(log, maybeKey.matchingKey, method, 'matchingKey');
|
|
38
38
|
var bucketingKey = validateKeyValue(log, maybeKey.bucketingKey, method, 'bucketingKey');
|
|
39
39
|
if (matchingKey && bucketingKey)
|
|
40
40
|
return {
|
|
41
|
-
matchingKey: matchingKey,
|
|
41
|
+
matchingKey: matchingKey,
|
|
42
|
+
bucketingKey: bucketingKey
|
|
42
43
|
};
|
|
43
44
|
log.error(constants_1.ERROR_INVALID_KEY_OBJECT, [method]);
|
|
44
45
|
return false;
|
|
@@ -4,30 +4,30 @@ exports.validatePreloadedData = void 0;
|
|
|
4
4
|
var lang_1 = require("../lang");
|
|
5
5
|
var split_1 = require("./split");
|
|
6
6
|
function validateTimestampData(log, maybeTimestamp, method, item) {
|
|
7
|
-
if (lang_1.isFiniteNumber(maybeTimestamp) && maybeTimestamp > -1)
|
|
7
|
+
if ((0, lang_1.isFiniteNumber)(maybeTimestamp) && maybeTimestamp > -1)
|
|
8
8
|
return true;
|
|
9
9
|
log.error(method + ": preloadedData." + item + " must be a positive number.");
|
|
10
10
|
return false;
|
|
11
11
|
}
|
|
12
12
|
function validateSplitsData(log, maybeSplitsData, method) {
|
|
13
|
-
if (lang_1.isObject(maybeSplitsData)) {
|
|
13
|
+
if ((0, lang_1.isObject)(maybeSplitsData)) {
|
|
14
14
|
var splitNames = Object.keys(maybeSplitsData);
|
|
15
15
|
if (splitNames.length === 0)
|
|
16
16
|
log.warn(method + ": preloadedData.splitsData doesn't contain split definitions.");
|
|
17
17
|
// @TODO in the future, consider handling the possibility of having parsed definitions of splits
|
|
18
|
-
if (splitNames.every(function (splitName) { return split_1.validateSplit(log, splitName, method) && lang_1.isString(maybeSplitsData[splitName]); }))
|
|
18
|
+
if (splitNames.every(function (splitName) { return (0, split_1.validateSplit)(log, splitName, method) && (0, lang_1.isString)(maybeSplitsData[splitName]); }))
|
|
19
19
|
return true;
|
|
20
20
|
}
|
|
21
21
|
log.error(method + ": preloadedData.splitsData must be a map of split names to their serialized definitions.");
|
|
22
22
|
return false;
|
|
23
23
|
}
|
|
24
24
|
function validateMySegmentsData(log, maybeMySegmentsData, method) {
|
|
25
|
-
if (lang_1.isObject(maybeMySegmentsData)) {
|
|
25
|
+
if ((0, lang_1.isObject)(maybeMySegmentsData)) {
|
|
26
26
|
var userKeys = Object.keys(maybeMySegmentsData);
|
|
27
27
|
if (userKeys.every(function (userKey) {
|
|
28
28
|
var segmentNames = maybeMySegmentsData[userKey];
|
|
29
29
|
// an empty list is valid
|
|
30
|
-
return Array.isArray(segmentNames) && segmentNames.every(function (segmentName) { return lang_1.isString(segmentName); });
|
|
30
|
+
return Array.isArray(segmentNames) && segmentNames.every(function (segmentName) { return (0, lang_1.isString)(segmentName); });
|
|
31
31
|
}))
|
|
32
32
|
return true;
|
|
33
33
|
}
|
|
@@ -35,16 +35,16 @@ function validateMySegmentsData(log, maybeMySegmentsData, method) {
|
|
|
35
35
|
return false;
|
|
36
36
|
}
|
|
37
37
|
function validateSegmentsData(log, maybeSegmentsData, method) {
|
|
38
|
-
if (lang_1.isObject(maybeSegmentsData)) {
|
|
38
|
+
if ((0, lang_1.isObject)(maybeSegmentsData)) {
|
|
39
39
|
var segmentNames = Object.keys(maybeSegmentsData);
|
|
40
|
-
if (segmentNames.every(function (segmentName) { return lang_1.isString(maybeSegmentsData[segmentName]); }))
|
|
40
|
+
if (segmentNames.every(function (segmentName) { return (0, lang_1.isString)(maybeSegmentsData[segmentName]); }))
|
|
41
41
|
return true;
|
|
42
42
|
}
|
|
43
43
|
log.error(method + ": preloadedData.segmentsData must be a map of segment names to their serialized definitions.");
|
|
44
44
|
return false;
|
|
45
45
|
}
|
|
46
46
|
function validatePreloadedData(log, maybePreloadedData, method) {
|
|
47
|
-
if (!lang_1.isObject(maybePreloadedData)) {
|
|
47
|
+
if (!(0, lang_1.isObject)(maybePreloadedData)) {
|
|
48
48
|
log.error(method + ": preloadedData must be an object.");
|
|
49
49
|
}
|
|
50
50
|
else if (validateTimestampData(log, maybePreloadedData.lastUpdated, method, 'lastUpdated') &&
|
|
@@ -10,7 +10,7 @@ function validateSplit(log, maybeSplit, method, item) {
|
|
|
10
10
|
if (maybeSplit == undefined) { // eslint-disable-line eqeqeq
|
|
11
11
|
log.error(constants_1.ERROR_NULL, [method, item]);
|
|
12
12
|
}
|
|
13
|
-
else if (!lang_1.isString(maybeSplit)) {
|
|
13
|
+
else if (!(0, lang_1.isString)(maybeSplit)) {
|
|
14
14
|
log.error(constants_1.ERROR_INVALID, [method, item]);
|
|
15
15
|
}
|
|
16
16
|
else {
|
|
@@ -11,13 +11,13 @@ function validateSplits(log, maybeSplits, method, listName, item) {
|
|
|
11
11
|
var validatedArray_1 = [];
|
|
12
12
|
// Remove invalid values
|
|
13
13
|
maybeSplits.forEach(function (maybeSplit) {
|
|
14
|
-
var splitName = split_1.validateSplit(log, maybeSplit, method, item);
|
|
14
|
+
var splitName = (0, split_1.validateSplit)(log, maybeSplit, method, item);
|
|
15
15
|
if (splitName)
|
|
16
16
|
validatedArray_1.push(splitName);
|
|
17
17
|
});
|
|
18
18
|
// Strip off duplicated values if we have valid split names then return
|
|
19
19
|
if (validatedArray_1.length)
|
|
20
|
-
return lang_1.uniq(validatedArray_1);
|
|
20
|
+
return (0, lang_1.uniq)(validatedArray_1);
|
|
21
21
|
}
|
|
22
22
|
log.error(constants_1.ERROR_EMPTY_ARRAY, [method, listName]);
|
|
23
23
|
return false;
|
|
@@ -9,7 +9,7 @@ function validateTrafficType(log, maybeTT, method) {
|
|
|
9
9
|
if (maybeTT == undefined) { // eslint-disable-line eqeqeq
|
|
10
10
|
log.error(constants_1.ERROR_NULL, [method, item]);
|
|
11
11
|
}
|
|
12
|
-
else if (!lang_1.isString(maybeTT)) {
|
|
12
|
+
else if (!(0, lang_1.isString)(maybeTT)) {
|
|
13
13
|
log.error(constants_1.ERROR_INVALID, [method, item]);
|
|
14
14
|
}
|
|
15
15
|
else {
|
|
@@ -15,7 +15,7 @@ function validateTrafficTypeExistance(log, readinessManager, splitsCache, mode,
|
|
|
15
15
|
if (!readinessManager.isReady() || mode === constants_1.LOCALHOST_MODE)
|
|
16
16
|
return true;
|
|
17
17
|
var res = splitsCache.trafficTypeExists(maybeTT); // never rejects or throws error
|
|
18
|
-
if (thenable_1.thenable(res)) {
|
|
18
|
+
if ((0, thenable_1.thenable)(res)) {
|
|
19
19
|
return res.then(function (isValid) {
|
|
20
20
|
if (!isValid)
|
|
21
21
|
logTTExistanceWarning(log, maybeTT, method);
|
package/cjs/utils/jwt/index.js
CHANGED
|
@@ -9,7 +9,7 @@ function decodeJWTtoken(token) {
|
|
|
9
9
|
var base64Url = token.split('.')[1];
|
|
10
10
|
var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
|
|
11
11
|
// no need to check availability of `encodeURIComponent`, since it is a function highly supported in browsers, node and other platforms.
|
|
12
|
-
var jsonPayload = decodeURIComponent(base64_1.decodeFromBase64(base64).split('').map(function (c) {
|
|
12
|
+
var jsonPayload = decodeURIComponent((0, base64_1.decodeFromBase64)(base64).split('').map(function (c) {
|
|
13
13
|
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
|
|
14
14
|
}).join(''));
|
|
15
15
|
return JSON.parse(jsonPayload);
|
package/cjs/utils/key/index.js
CHANGED
|
@@ -7,12 +7,12 @@ var lang_1 = require("../lang");
|
|
|
7
7
|
// }
|
|
8
8
|
// returns the matchingKey if the Key is defined as an object or the key itself if it is a string
|
|
9
9
|
function getMatching(key) {
|
|
10
|
-
return lang_1.isObject(key) ? key.matchingKey : key;
|
|
10
|
+
return (0, lang_1.isObject)(key) ? key.matchingKey : key;
|
|
11
11
|
}
|
|
12
12
|
exports.getMatching = getMatching;
|
|
13
13
|
// if the key is a string, there's no bucketingKey (undefined)
|
|
14
14
|
function getBucketing(key) {
|
|
15
|
-
return lang_1.isObject(key) ? key.bucketingKey : undefined;
|
|
15
|
+
return (0, lang_1.isObject)(key) ? key.bucketingKey : undefined;
|
|
16
16
|
}
|
|
17
17
|
exports.getBucketing = getBucketing;
|
|
18
18
|
/**
|
|
@@ -20,7 +20,7 @@ exports.getBucketing = getBucketing;
|
|
|
20
20
|
* specific split.
|
|
21
21
|
*/
|
|
22
22
|
function keyParser(key) {
|
|
23
|
-
if (lang_1.isObject(key)) {
|
|
23
|
+
if ((0, lang_1.isObject)(key)) {
|
|
24
24
|
return {
|
|
25
25
|
matchingKey: key.matchingKey,
|
|
26
26
|
bucketingKey: key.bucketingKey
|
package/cjs/utils/lang/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uniqueId = exports.uniqAsStrings = exports.uniq = exports.toString = exports.toNumber = exports.startsWith = exports.
|
|
3
|
+
exports.uniqueId = exports.uniqAsStrings = exports.uniq = exports.toString = exports.toNumber = exports.startsWith = exports.merge = exports.isString = exports.isObject = exports.isNaNNumber = exports.isIntegerNumber = exports.isFiniteNumber = exports.isBoolean = exports.groupBy = exports.get = exports.forOwn = exports.findIndex = exports.find = exports.endsWith = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
/**
|
|
6
6
|
* Checks if the target string ends with the sub string.
|
|
@@ -194,23 +194,11 @@ function merge(target, source) {
|
|
|
194
194
|
});
|
|
195
195
|
if (rest && rest.length) {
|
|
196
196
|
var nextSource = rest.splice(0, 1)[0];
|
|
197
|
-
res = merge.apply(void 0, tslib_1.
|
|
197
|
+
res = merge.apply(void 0, (0, tslib_1.__spreadArray)([res, nextSource], rest, false));
|
|
198
198
|
}
|
|
199
199
|
return res;
|
|
200
200
|
}
|
|
201
201
|
exports.merge = merge;
|
|
202
|
-
/**
|
|
203
|
-
* Shallow clone an object
|
|
204
|
-
*/
|
|
205
|
-
function shallowClone(obj) {
|
|
206
|
-
var keys = Object.keys(obj);
|
|
207
|
-
var output = {};
|
|
208
|
-
for (var i = 0; i < keys.length; i++) {
|
|
209
|
-
output[keys[i]] = obj[keys[i]];
|
|
210
|
-
}
|
|
211
|
-
return output;
|
|
212
|
-
}
|
|
213
|
-
exports.shallowClone = shallowClone;
|
|
214
202
|
/**
|
|
215
203
|
* Checks if the target string starts with the sub string.
|
|
216
204
|
*/
|
|
@@ -4,7 +4,7 @@ exports.x86Fmix = exports.x86Rotl = exports.x86Multiply = exports.UTF16ToUTF8 =
|
|
|
4
4
|
var utfx_1 = require("./utfx");
|
|
5
5
|
function UTF16ToUTF8(key) {
|
|
6
6
|
var sd;
|
|
7
|
-
utfx_1.encodeUTF16toUTF8(utfx_1.stringSource(key), sd = utfx_1.stringDestination());
|
|
7
|
+
(0, utfx_1.encodeUTF16toUTF8)((0, utfx_1.stringSource)(key), sd = (0, utfx_1.stringDestination)());
|
|
8
8
|
return sd();
|
|
9
9
|
}
|
|
10
10
|
exports.UTF16ToUTF8 = UTF16ToUTF8;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Deprecated hashing function, used for split bucketing. Replaced by murmur3
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.bucket = exports.hash = void 0;
|
|
5
|
+
//
|
|
6
|
+
// JAVA reference implementation for the hashing function.
|
|
7
|
+
//
|
|
8
|
+
// int h = 0;
|
|
9
|
+
// for (int i = 0; i < key.length(); i++) {
|
|
10
|
+
// h = 31 * h + key.charAt(i);
|
|
11
|
+
// }
|
|
12
|
+
// return h ^ seed; // XOR the hash and seed
|
|
13
|
+
//
|
|
14
|
+
function ToInteger(x) {
|
|
15
|
+
x = Number(x);
|
|
16
|
+
return x < 0 ? Math.ceil(x) : Math.floor(x);
|
|
17
|
+
}
|
|
18
|
+
function modulo(a, b) {
|
|
19
|
+
return a - Math.floor(a / b) * b;
|
|
20
|
+
}
|
|
21
|
+
function ToUint32(x) {
|
|
22
|
+
return modulo(ToInteger(x), Math.pow(2, 32));
|
|
23
|
+
}
|
|
24
|
+
function ToInt32(x) {
|
|
25
|
+
var uint32 = ToUint32(x);
|
|
26
|
+
if (uint32 >= Math.pow(2, 31)) {
|
|
27
|
+
return uint32 - Math.pow(2, 32);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return uint32;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function hash(str, seed) {
|
|
34
|
+
var h = 0;
|
|
35
|
+
for (var i = 0; i < str.length; i++) {
|
|
36
|
+
h = ToInt32(ToInt32(31 * h) + str.charCodeAt(i));
|
|
37
|
+
}
|
|
38
|
+
return ToInt32(h ^ seed);
|
|
39
|
+
}
|
|
40
|
+
exports.hash = hash;
|
|
41
|
+
function bucket(str, seed) {
|
|
42
|
+
return Math.abs(hash(str, seed) % 100) + 1;
|
|
43
|
+
}
|
|
44
|
+
exports.bucket = bucket;
|
|
@@ -28,12 +28,12 @@ function hash32(key, seed) {
|
|
|
28
28
|
var c2 = 0x1b873593;
|
|
29
29
|
for (var i = 0; i < bytes; i = i + 4) {
|
|
30
30
|
k1 = ((key.charCodeAt(i) & 0xff)) | ((key.charCodeAt(i + 1) & 0xff) << 8) | ((key.charCodeAt(i + 2) & 0xff) << 16) | ((key.charCodeAt(i + 3) & 0xff) << 24);
|
|
31
|
-
k1 = common_1.x86Multiply(k1, c1);
|
|
32
|
-
k1 = common_1.x86Rotl(k1, 15);
|
|
33
|
-
k1 = common_1.x86Multiply(k1, c2);
|
|
31
|
+
k1 = (0, common_1.x86Multiply)(k1, c1);
|
|
32
|
+
k1 = (0, common_1.x86Rotl)(k1, 15);
|
|
33
|
+
k1 = (0, common_1.x86Multiply)(k1, c2);
|
|
34
34
|
h1 ^= k1;
|
|
35
|
-
h1 = common_1.x86Rotl(h1, 13);
|
|
36
|
-
h1 = common_1.x86Multiply(h1, 5) + 0xe6546b64;
|
|
35
|
+
h1 = (0, common_1.x86Rotl)(h1, 13);
|
|
36
|
+
h1 = (0, common_1.x86Multiply)(h1, 5) + 0xe6546b64;
|
|
37
37
|
}
|
|
38
38
|
k1 = 0;
|
|
39
39
|
switch (remainder) {
|
|
@@ -43,17 +43,17 @@ function hash32(key, seed) {
|
|
|
43
43
|
k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;
|
|
44
44
|
case 1:
|
|
45
45
|
k1 ^= (key.charCodeAt(i) & 0xff);
|
|
46
|
-
k1 = common_1.x86Multiply(k1, c1);
|
|
47
|
-
k1 = common_1.x86Rotl(k1, 15);
|
|
48
|
-
k1 = common_1.x86Multiply(k1, c2);
|
|
46
|
+
k1 = (0, common_1.x86Multiply)(k1, c1);
|
|
47
|
+
k1 = (0, common_1.x86Rotl)(k1, 15);
|
|
48
|
+
k1 = (0, common_1.x86Multiply)(k1, c2);
|
|
49
49
|
h1 ^= k1;
|
|
50
50
|
}
|
|
51
51
|
h1 ^= key.length;
|
|
52
|
-
h1 = common_1.x86Fmix(h1);
|
|
52
|
+
h1 = (0, common_1.x86Fmix)(h1);
|
|
53
53
|
return h1 >>> 0;
|
|
54
54
|
}
|
|
55
55
|
function hash(str, seed) {
|
|
56
|
-
return hash32(common_1.UTF16ToUTF8(str), seed >>> 0);
|
|
56
|
+
return hash32((0, common_1.UTF16ToUTF8)(str), seed >>> 0);
|
|
57
57
|
}
|
|
58
58
|
exports.hash = hash;
|
|
59
59
|
function bucket(str, seed) {
|
|
@@ -214,6 +214,6 @@ function hash128x64(key, seed) {
|
|
|
214
214
|
* @param {string} str
|
|
215
215
|
*/
|
|
216
216
|
function hash128(str, seed) {
|
|
217
|
-
return hash128x64(common_1.UTF16ToUTF8(str), seed >>> 0);
|
|
217
|
+
return hash128x64((0, common_1.UTF16ToUTF8)(str), seed >>> 0);
|
|
218
218
|
}
|
|
219
219
|
exports.hash128 = hash128;
|
|
@@ -39,34 +39,34 @@ function hash128x86(key, seed) {
|
|
|
39
39
|
k2 = ((key.charCodeAt(i + 4) & 0xff)) | ((key.charCodeAt(i + 5) & 0xff) << 8) | ((key.charCodeAt(i + 6) & 0xff) << 16) | ((key.charCodeAt(i + 7) & 0xff) << 24);
|
|
40
40
|
k3 = ((key.charCodeAt(i + 8) & 0xff)) | ((key.charCodeAt(i + 9) & 0xff) << 8) | ((key.charCodeAt(i + 10) & 0xff) << 16) | ((key.charCodeAt(i + 11) & 0xff) << 24);
|
|
41
41
|
k4 = ((key.charCodeAt(i + 12) & 0xff)) | ((key.charCodeAt(i + 13) & 0xff) << 8) | ((key.charCodeAt(i + 14) & 0xff) << 16) | ((key.charCodeAt(i + 15) & 0xff) << 24);
|
|
42
|
-
k1 = common_1.x86Multiply(k1, c1);
|
|
43
|
-
k1 = common_1.x86Rotl(k1, 15);
|
|
44
|
-
k1 = common_1.x86Multiply(k1, c2);
|
|
42
|
+
k1 = (0, common_1.x86Multiply)(k1, c1);
|
|
43
|
+
k1 = (0, common_1.x86Rotl)(k1, 15);
|
|
44
|
+
k1 = (0, common_1.x86Multiply)(k1, c2);
|
|
45
45
|
h1 ^= k1;
|
|
46
|
-
h1 = common_1.x86Rotl(h1, 19);
|
|
46
|
+
h1 = (0, common_1.x86Rotl)(h1, 19);
|
|
47
47
|
h1 += h2;
|
|
48
|
-
h1 = common_1.x86Multiply(h1, 5) + 0x561ccd1b;
|
|
49
|
-
k2 = common_1.x86Multiply(k2, c2);
|
|
50
|
-
k2 = common_1.x86Rotl(k2, 16);
|
|
51
|
-
k2 = common_1.x86Multiply(k2, c3);
|
|
48
|
+
h1 = (0, common_1.x86Multiply)(h1, 5) + 0x561ccd1b;
|
|
49
|
+
k2 = (0, common_1.x86Multiply)(k2, c2);
|
|
50
|
+
k2 = (0, common_1.x86Rotl)(k2, 16);
|
|
51
|
+
k2 = (0, common_1.x86Multiply)(k2, c3);
|
|
52
52
|
h2 ^= k2;
|
|
53
|
-
h2 = common_1.x86Rotl(h2, 17);
|
|
53
|
+
h2 = (0, common_1.x86Rotl)(h2, 17);
|
|
54
54
|
h2 += h3;
|
|
55
|
-
h2 = common_1.x86Multiply(h2, 5) + 0x0bcaa747;
|
|
56
|
-
k3 = common_1.x86Multiply(k3, c3);
|
|
57
|
-
k3 = common_1.x86Rotl(k3, 17);
|
|
58
|
-
k3 = common_1.x86Multiply(k3, c4);
|
|
55
|
+
h2 = (0, common_1.x86Multiply)(h2, 5) + 0x0bcaa747;
|
|
56
|
+
k3 = (0, common_1.x86Multiply)(k3, c3);
|
|
57
|
+
k3 = (0, common_1.x86Rotl)(k3, 17);
|
|
58
|
+
k3 = (0, common_1.x86Multiply)(k3, c4);
|
|
59
59
|
h3 ^= k3;
|
|
60
|
-
h3 = common_1.x86Rotl(h3, 15);
|
|
60
|
+
h3 = (0, common_1.x86Rotl)(h3, 15);
|
|
61
61
|
h3 += h4;
|
|
62
|
-
h3 = common_1.x86Multiply(h3, 5) + 0x96cd1c35;
|
|
63
|
-
k4 = common_1.x86Multiply(k4, c4);
|
|
64
|
-
k4 = common_1.x86Rotl(k4, 18);
|
|
65
|
-
k4 = common_1.x86Multiply(k4, c1);
|
|
62
|
+
h3 = (0, common_1.x86Multiply)(h3, 5) + 0x96cd1c35;
|
|
63
|
+
k4 = (0, common_1.x86Multiply)(k4, c4);
|
|
64
|
+
k4 = (0, common_1.x86Rotl)(k4, 18);
|
|
65
|
+
k4 = (0, common_1.x86Multiply)(k4, c1);
|
|
66
66
|
h4 ^= k4;
|
|
67
|
-
h4 = common_1.x86Rotl(h4, 13);
|
|
67
|
+
h4 = (0, common_1.x86Rotl)(h4, 13);
|
|
68
68
|
h4 += h1;
|
|
69
|
-
h4 = common_1.x86Multiply(h4, 5) + 0x32ac3b17;
|
|
69
|
+
h4 = (0, common_1.x86Multiply)(h4, 5) + 0x32ac3b17;
|
|
70
70
|
}
|
|
71
71
|
k1 = 0;
|
|
72
72
|
k2 = 0;
|
|
@@ -79,9 +79,9 @@ function hash128x86(key, seed) {
|
|
|
79
79
|
k4 ^= key.charCodeAt(i + 13) << 8;
|
|
80
80
|
case 13:
|
|
81
81
|
k4 ^= key.charCodeAt(i + 12);
|
|
82
|
-
k4 = common_1.x86Multiply(k4, c4);
|
|
83
|
-
k4 = common_1.x86Rotl(k4, 18);
|
|
84
|
-
k4 = common_1.x86Multiply(k4, c1);
|
|
82
|
+
k4 = (0, common_1.x86Multiply)(k4, c4);
|
|
83
|
+
k4 = (0, common_1.x86Rotl)(k4, 18);
|
|
84
|
+
k4 = (0, common_1.x86Multiply)(k4, c1);
|
|
85
85
|
h4 ^= k4;
|
|
86
86
|
case 12:
|
|
87
87
|
k3 ^= key.charCodeAt(i + 11) << 24;
|
|
@@ -91,9 +91,9 @@ function hash128x86(key, seed) {
|
|
|
91
91
|
k3 ^= key.charCodeAt(i + 9) << 8;
|
|
92
92
|
case 9:
|
|
93
93
|
k3 ^= key.charCodeAt(i + 8);
|
|
94
|
-
k3 = common_1.x86Multiply(k3, c3);
|
|
95
|
-
k3 = common_1.x86Rotl(k3, 17);
|
|
96
|
-
k3 = common_1.x86Multiply(k3, c4);
|
|
94
|
+
k3 = (0, common_1.x86Multiply)(k3, c3);
|
|
95
|
+
k3 = (0, common_1.x86Rotl)(k3, 17);
|
|
96
|
+
k3 = (0, common_1.x86Multiply)(k3, c4);
|
|
97
97
|
h3 ^= k3;
|
|
98
98
|
case 8:
|
|
99
99
|
k2 ^= key.charCodeAt(i + 7) << 24;
|
|
@@ -103,9 +103,9 @@ function hash128x86(key, seed) {
|
|
|
103
103
|
k2 ^= key.charCodeAt(i + 5) << 8;
|
|
104
104
|
case 5:
|
|
105
105
|
k2 ^= key.charCodeAt(i + 4);
|
|
106
|
-
k2 = common_1.x86Multiply(k2, c2);
|
|
107
|
-
k2 = common_1.x86Rotl(k2, 16);
|
|
108
|
-
k2 = common_1.x86Multiply(k2, c3);
|
|
106
|
+
k2 = (0, common_1.x86Multiply)(k2, c2);
|
|
107
|
+
k2 = (0, common_1.x86Rotl)(k2, 16);
|
|
108
|
+
k2 = (0, common_1.x86Multiply)(k2, c3);
|
|
109
109
|
h2 ^= k2;
|
|
110
110
|
case 4:
|
|
111
111
|
k1 ^= key.charCodeAt(i + 3) << 24;
|
|
@@ -115,9 +115,9 @@ function hash128x86(key, seed) {
|
|
|
115
115
|
k1 ^= key.charCodeAt(i + 1) << 8;
|
|
116
116
|
case 1:
|
|
117
117
|
k1 ^= key.charCodeAt(i);
|
|
118
|
-
k1 = common_1.x86Multiply(k1, c1);
|
|
119
|
-
k1 = common_1.x86Rotl(k1, 15);
|
|
120
|
-
k1 = common_1.x86Multiply(k1, c2);
|
|
118
|
+
k1 = (0, common_1.x86Multiply)(k1, c1);
|
|
119
|
+
k1 = (0, common_1.x86Rotl)(k1, 15);
|
|
120
|
+
k1 = (0, common_1.x86Multiply)(k1, c2);
|
|
121
121
|
h1 ^= k1;
|
|
122
122
|
}
|
|
123
123
|
h1 ^= key.length;
|
|
@@ -130,10 +130,10 @@ function hash128x86(key, seed) {
|
|
|
130
130
|
h2 += h1;
|
|
131
131
|
h3 += h1;
|
|
132
132
|
h4 += h1;
|
|
133
|
-
h1 = common_1.x86Fmix(h1);
|
|
134
|
-
h2 = common_1.x86Fmix(h2);
|
|
135
|
-
h3 = common_1.x86Fmix(h3);
|
|
136
|
-
h4 = common_1.x86Fmix(h4);
|
|
133
|
+
h1 = (0, common_1.x86Fmix)(h1);
|
|
134
|
+
h2 = (0, common_1.x86Fmix)(h2);
|
|
135
|
+
h3 = (0, common_1.x86Fmix)(h3);
|
|
136
|
+
h4 = (0, common_1.x86Fmix)(h4);
|
|
137
137
|
h1 += h2;
|
|
138
138
|
h1 += h3;
|
|
139
139
|
h1 += h4;
|
|
@@ -149,6 +149,6 @@ function hash128x86(key, seed) {
|
|
|
149
149
|
* @param {string} str
|
|
150
150
|
*/
|
|
151
151
|
function hash128(str, seed) {
|
|
152
|
-
return hash128x86(common_1.UTF16ToUTF8(str), seed >>> 0);
|
|
152
|
+
return hash128x86((0, common_1.UTF16ToUTF8)(str), seed >>> 0);
|
|
153
153
|
}
|
|
154
154
|
exports.hash128 = hash128;
|
|
@@ -27,7 +27,7 @@ function hex2dec(s) {
|
|
|
27
27
|
* @param {string} str
|
|
28
28
|
*/
|
|
29
29
|
function hash64(str) {
|
|
30
|
-
var hex = murmur3_128_1.hash128(str).slice(0, 16);
|
|
30
|
+
var hex = (0, murmur3_128_1.hash128)(str).slice(0, 16);
|
|
31
31
|
return {
|
|
32
32
|
hex: hex,
|
|
33
33
|
dec: hex2dec(hex) // KeyList notification
|