@hackler/sdk-core
Advanced tools
Comparing version 2.2.1 to 2.2.2
@@ -8,4 +8,3 @@ export declare const WORKSPACE_FETCH_URL = "https://sdk.hackle.io/api/v2/workspaces"; | ||
export declare const REQUEST_TIME_OUT = 10000; | ||
export declare const DEFAULT_MAX_QUEUE_SIZE = 10000; | ||
export declare const BATCH_SIZE = 1000; | ||
export declare const DEFAULT_BATCH_SIZE = 1000; | ||
export declare const DEFAULT_FLUSH_INTERVAL = 10000; | ||
@@ -12,0 +11,0 @@ export declare const DEFAULT_ON_READY_TIMEOUT = 3000; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ERROR_RETRY_BASE_WAIT_SECONDS_BY_ERROR_COUNT = exports.DEFAULT_ON_READY_TIMEOUT = exports.DEFAULT_FLUSH_INTERVAL = exports.BATCH_SIZE = exports.DEFAULT_MAX_QUEUE_SIZE = exports.REQUEST_TIME_OUT = exports.DEFAULT_POOL_INTERVAL = exports.SDK_VERSION_HEADER = exports.SDK_NAME_HEADER = exports.SDK_KEY_HEADER = exports.EVENT_DISPATCH_URL = exports.WORKSPACE_FETCH_URL = void 0; | ||
exports.ERROR_RETRY_BASE_WAIT_SECONDS_BY_ERROR_COUNT = exports.DEFAULT_ON_READY_TIMEOUT = exports.DEFAULT_FLUSH_INTERVAL = exports.DEFAULT_BATCH_SIZE = exports.REQUEST_TIME_OUT = exports.DEFAULT_POOL_INTERVAL = exports.SDK_VERSION_HEADER = exports.SDK_NAME_HEADER = exports.SDK_KEY_HEADER = exports.EVENT_DISPATCH_URL = exports.WORKSPACE_FETCH_URL = void 0; | ||
exports.WORKSPACE_FETCH_URL = "https://sdk.hackle.io/api/v2/workspaces"; | ||
@@ -11,4 +11,3 @@ exports.EVENT_DISPATCH_URL = "https://event.hackle.io/api/v2/events"; | ||
exports.REQUEST_TIME_OUT = 10000; | ||
exports.DEFAULT_MAX_QUEUE_SIZE = 10000; | ||
exports.BATCH_SIZE = 1000; | ||
exports.DEFAULT_BATCH_SIZE = 1000; | ||
exports.DEFAULT_FLUSH_INTERVAL = 10000; | ||
@@ -15,0 +14,0 @@ exports.DEFAULT_ON_READY_TIMEOUT = 3000; |
@@ -50,3 +50,3 @@ "use strict"; | ||
decisionReason: this.decisionReason.toString(), | ||
hackleProperties: this.hackleProperties | ||
hackleProperties: PropertyUtil_1.default.filteredProperties(this.hackleProperties || {}), | ||
}; | ||
@@ -74,3 +74,3 @@ }; | ||
properties: PropertyUtil_1.default.filteredProperties(this.event.properties || {}), | ||
hackleProperties: this.hackleProperties | ||
hackleProperties: PropertyUtil_1.default.filteredProperties(this.hackleProperties || {}), | ||
}; | ||
@@ -77,0 +77,0 @@ }; |
@@ -10,3 +10,3 @@ import AutoCloseable from "../../external/js/lang/AutoCloseable"; | ||
static DEFAULT_FLUSH_INTERVAL: Duration; | ||
constructor(eventDispatcher: EventDispatcher, flushInterval?: Duration); | ||
constructor(eventDispatcher: EventDispatcher, batchSize?: number, flushInterval?: Duration); | ||
drainQueue(buffer: Event[], useBeacon?: boolean): Promise<void>; | ||
@@ -13,0 +13,0 @@ process(event: Event): void; |
@@ -7,4 +7,6 @@ "use strict"; | ||
var EventQueue_1 = require("./EventQueue"); | ||
var config_1 = require("../config"); | ||
var EventProcessor = /** @class */ (function () { | ||
function EventProcessor(eventDispatcher, flushInterval) { | ||
function EventProcessor(eventDispatcher, batchSize, flushInterval) { | ||
if (batchSize === void 0) { batchSize = config_1.DEFAULT_BATCH_SIZE; } | ||
if (flushInterval === void 0) { flushInterval = EventProcessor.DEFAULT_FLUSH_INTERVAL; } | ||
@@ -14,3 +16,3 @@ this.flushInterval = EventProcessor.DEFAULT_FLUSH_INTERVAL; | ||
this.flushInterval = flushInterval; | ||
this.queue = new EventQueue_1.DefaultEventQueue(this.drainQueue.bind(this), areEventContextsEqual, flushInterval.toMillis()); | ||
this.queue = new EventQueue_1.DefaultEventQueue(this.drainQueue.bind(this), areEventContextsEqual, batchSize, flushInterval.toMillis()); | ||
} | ||
@@ -17,0 +19,0 @@ EventProcessor.prototype.drainQueue = function (buffer, useBeacon) { |
@@ -26,3 +26,3 @@ import AutoCloseable from "../../external/js/lang/AutoCloseable"; | ||
private started; | ||
constructor(sink: EventQueueSink<Event>, batchComparator: (eventA: Event, eventB: Event) => boolean, flushInterval?: number); | ||
constructor(sink: EventQueueSink<Event>, batchComparator: (eventA: Event, eventB: Event) => boolean, batchSize?: number, flushInterval?: number); | ||
start(): void; | ||
@@ -29,0 +29,0 @@ stop(): Promise<any>; |
@@ -26,7 +26,8 @@ "use strict"; | ||
var DefaultEventQueue = /** @class */ (function () { | ||
function DefaultEventQueue(sink, batchComparator, flushInterval) { | ||
function DefaultEventQueue(sink, batchComparator, batchSize, flushInterval) { | ||
if (batchSize === void 0) { batchSize = config_1.DEFAULT_BATCH_SIZE; } | ||
if (flushInterval === void 0) { flushInterval = config_1.DEFAULT_FLUSH_INTERVAL; } | ||
this.buffer = []; | ||
this.sink = sink; | ||
this.maxQueueSize = config_1.DEFAULT_MAX_QUEUE_SIZE; | ||
this.maxQueueSize = batchSize; | ||
this.batchComparator = batchComparator; | ||
@@ -53,6 +54,2 @@ this.timer = new Timer({ | ||
} | ||
var bufferedEvent = this.buffer[0]; | ||
// if (bufferedEvent && !this.batchComparator(bufferedEvent, event)) { | ||
// this.flush(); | ||
// } | ||
if (this.buffer.length === 0) { | ||
@@ -59,0 +56,0 @@ this.timer.refresh(); |
@@ -5,4 +5,5 @@ import { Properties } from "../model/model"; | ||
static filteredProperties(properties: Properties): Properties; | ||
static filteredPropertiesValue(value: any): any; | ||
private static validProperty; | ||
} | ||
//# sourceMappingURL=PropertyUtil.d.ts.map |
@@ -26,5 +26,13 @@ "use strict"; | ||
var _a; | ||
return ((0, tslib_1.__assign)((0, tslib_1.__assign)({}, obj), (_a = {}, _a[key] = properties[key], _a))); | ||
return ((0, tslib_1.__assign)((0, tslib_1.__assign)({}, obj), (_a = {}, _a[key] = _this.filteredPropertiesValue(properties[key]), _a))); | ||
}, {}); | ||
}; | ||
PropertyUtil.filteredPropertiesValue = function (value) { | ||
if (typeof value === "string") { | ||
if (value.length > 1024) { | ||
return value.slice(0, 1024); | ||
} | ||
} | ||
return value; | ||
}; | ||
PropertyUtil.validProperty = function (key, value) { | ||
@@ -31,0 +39,0 @@ if (!key) { |
{ | ||
"name": "@hackler/sdk-core", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"description": "JavaScript SDK-core", | ||
@@ -5,0 +5,0 @@ "author": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
236399
3196