@hackler/sdk-core
Advanced tools
Comparing version 1.1.2 to 1.2.0-rc.0
@@ -9,3 +9,3 @@ import AutoCloseable from "./external/js/lang/AutoCloseable"; | ||
* @param experimentKey the unique key for the experiment. | ||
* @param user the identifier of your customer. id (e.g. user_email, account_id, etc.) MUST NOT be null. | ||
* @param user the identifier of your customer. id (e.g. user_email, account_id, etc.) MUST NOT be null. (e.g. { id: "userId"} ) | ||
* @param defaultVariation the default variation of the experiment. (Optional) | ||
@@ -15,3 +15,3 @@ * | ||
*/ | ||
variation(experimentKey: number, user?: User, defaultVariation?: string): string; | ||
variation(experimentKey: number, user: User, defaultVariation?: string): string; | ||
/** | ||
@@ -22,3 +22,3 @@ * Decide the variation to expose to the user for experiment, and returns an object that | ||
* @param experimentKey the unique key for the experiment. | ||
* @param user the user to participate in the experiment. MUST NOT be null. | ||
* @param user the user to participate in the experiment. MUST NOT be null. (e.g. { id: "userId"} ) | ||
* @param defaultVariation the default variation of the experiment. MUST NOT be null. | ||
@@ -28,3 +28,3 @@ * | ||
*/ | ||
variationDetail(experimentKey: number, user?: User, defaultVariation?: string): Decision; | ||
variationDetail(experimentKey: number, user: User, defaultVariation?: string): Decision; | ||
/** | ||
@@ -34,7 +34,7 @@ * Records the event performed by the user. | ||
* @param event the unique key of the event. MUST NOT be null. | ||
* @param user the identifier of user that performed the event. id MUST NOT be null. | ||
* @param user the identifier of user that performed the event. id MUST NOT be null. (e.g. { id: "userId"} ) | ||
*/ | ||
track(event: string | UserEvent, user?: User): void; | ||
onReady(block: () => void, timeout?: number): Promise<void>; | ||
track(event: string | UserEvent, user: User): void; | ||
onReady(block: () => void, timeout?: number): void; | ||
} | ||
//# sourceMappingURL=HackleClient.d.ts.map |
@@ -1,16 +0,4 @@ | ||
/// <reference types="node" /> | ||
import Hackle from "./Hackle"; | ||
import HackleClient from "./HackleClient"; | ||
import { Event, User } from "./internal/model/model"; | ||
import PollingWorkspaceFetcher from "./internal/workspace/PollingWorkspaceFetcher"; | ||
import EventDispatcher from "./internal/event/EventDispatcher"; | ||
import { EventEmitter } from "events"; | ||
declare function createInstance(sdkKey: string, eventDispatcher: EventDispatcher, workspaceFetcher: PollingWorkspaceFetcher, eventEmitter: EventEmitter, eventConfig: { | ||
flushInterval: number; | ||
}): HackleClient; | ||
export { User }; | ||
export { Event }; | ||
export { HackleClient }; | ||
export { createInstance }; | ||
export default Hackle; | ||
import { Duration } from "@js-joda/core"; | ||
export { Event, User, Duration }; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createInstance = void 0; | ||
var Hackle_1 = require("./Hackle"); | ||
var EventProcessor_1 = require("./internal/event/EventProcessor"); | ||
exports.Duration = void 0; | ||
// import PollingWorkspaceFetcher from "./internal/workspace/PollingWorkspaceFetcher" | ||
// import EventDispatcher from "./internal/event/EventDispatcher" | ||
// import EventProcessor from "./internal/event/EventProcessor" | ||
// import { EventEmitter } from "events" | ||
var core_1 = require("@js-joda/core"); | ||
function createInstance(sdkKey, eventDispatcher, workspaceFetcher, eventEmitter, eventConfig) { | ||
var eventProcessor = new EventProcessor_1.default(eventDispatcher, core_1.Duration.ofMillis(eventConfig.flushInterval)); | ||
return Hackle_1.default.createInstance(sdkKey, workspaceFetcher, eventDispatcher, eventProcessor, eventEmitter); | ||
} | ||
exports.createInstance = createInstance; | ||
exports.default = Hackle_1.default; | ||
Object.defineProperty(exports, "Duration", { enumerable: true, get: function () { return core_1.Duration; } }); | ||
// export { Event } | ||
// export { Duration } | ||
// export { HackleClient } | ||
// export { createInstance } | ||
// export default Hackle | ||
//# sourceMappingURL=index.js.map |
@@ -0,1 +1,8 @@ | ||
export declare const logLevels: { | ||
DISABLE: number; | ||
ERROR: number; | ||
WARN: number; | ||
INFO: number; | ||
DEBUG: number; | ||
}; | ||
export default class Logger { | ||
@@ -8,2 +15,3 @@ private static logLevel; | ||
info: (message: string) => void; | ||
debug: (message: string) => void; | ||
}; | ||
@@ -10,0 +18,0 @@ private static _log; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var logLevels = { | ||
exports.logLevels = void 0; | ||
exports.logLevels = { | ||
DISABLE: 0, | ||
@@ -8,2 +9,3 @@ ERROR: 1, | ||
INFO: 3, | ||
DEBUG: 4, | ||
}; | ||
@@ -14,15 +16,26 @@ var Logger = /** @class */ (function () { | ||
Logger.setLogLevel = function (logLevel) { | ||
if (logLevel === void 0) { logLevel = logLevels.INFO; } | ||
if (logLevel === void 0) { logLevel = exports.logLevels.INFO; } | ||
this.logLevel = logLevel; | ||
}; | ||
Logger._log = function (level, message) { | ||
var color; | ||
switch (level) { | ||
case "WARN": | ||
color = "orange"; | ||
break; | ||
case "ERROR": | ||
color = "red"; | ||
break; | ||
default: | ||
color = "#AAAAAA"; | ||
} | ||
try { | ||
console.log("[" + level + "] Hackle: " + message); | ||
console.log("%c[" + level + "] Hackle: " + message, "color: " + color); | ||
} | ||
catch (e) { } | ||
}; | ||
Logger.logLevel = logLevels.INFO; | ||
Logger.logLevel = exports.logLevels.INFO; | ||
Logger.log = { | ||
error: function (message) { | ||
if (Logger.logLevel >= logLevels.ERROR) { | ||
if (Logger.logLevel >= exports.logLevels.ERROR) { | ||
Logger._log("ERROR", message); | ||
@@ -32,3 +45,3 @@ } | ||
warn: function (message) { | ||
if (Logger.logLevel >= logLevels.WARN) { | ||
if (Logger.logLevel >= exports.logLevels.WARN) { | ||
Logger._log("WARN", message); | ||
@@ -38,5 +51,10 @@ } | ||
info: function (message) { | ||
if (Logger.logLevel >= logLevels.INFO) { | ||
if (Logger.logLevel >= exports.logLevels.INFO) { | ||
Logger._log("INFO", message); | ||
} | ||
}, | ||
debug: function (message) { | ||
if (Logger.logLevel >= exports.logLevels.DEBUG) { | ||
Logger._log("DEBUG", message); | ||
} | ||
} | ||
@@ -43,0 +61,0 @@ }; |
{ | ||
"name": "@hackler/sdk-core", | ||
"version": "1.1.2", | ||
"version": "1.2.0-rc.0", | ||
"description": "JavaScript SDK-core", | ||
@@ -30,3 +30,4 @@ "author": { | ||
"compile": "tsc", | ||
"watch": "tsc --watch" | ||
"watch": "tsc --watch", | ||
"publish:rc": "npm publish --tag rc" | ||
}, | ||
@@ -33,0 +34,0 @@ "bugs": { |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
197304
94
2735
1