@omnitronix/bonnys-fortune-game-engine 1.0.0-beta.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/README.md +680 -0
- package/dist/__tests__/bonnys-fortune-v1.game-engine.test.js +71 -0
- package/dist/__tests__/bonnys-fortune-v1.game-engine.test.js.map +1 -0
- package/dist/__tests__/comprehensive.test.js +741 -0
- package/dist/__tests__/comprehensive.test.js.map +1 -0
- package/dist/bonnys-fortune-v1.game-engine.js +184 -0
- package/dist/bonnys-fortune-v1.game-engine.js.map +1 -0
- package/dist/config/game-logic-config/file-system.game-logic-config-loader.js +57 -0
- package/dist/config/game-logic-config/file-system.game-logic-config-loader.js.map +1 -0
- package/dist/config/game-logic-config/game-logic-config-loader.js +3 -0
- package/dist/config/game-logic-config/game-logic-config-loader.js.map +1 -0
- package/dist/config/game-logic-config/game-logic-config.js +382 -0
- package/dist/config/game-logic-config/game-logic-config.js.map +1 -0
- package/dist/config/reel-strips-config/file-system.reel-strips-config-loader.js +34 -0
- package/dist/config/reel-strips-config/file-system.reel-strips-config-loader.js.map +1 -0
- package/dist/config/reel-strips-config/reel-strip-option.dto.js +27 -0
- package/dist/config/reel-strips-config/reel-strip-option.dto.js.map +1 -0
- package/dist/config/reel-strips-config/reel-strips-config-loader.js +3 -0
- package/dist/config/reel-strips-config/reel-strips-config-loader.js.map +1 -0
- package/dist/config/reel-strips-config/reel-strips-config.dto.js +29 -0
- package/dist/config/reel-strips-config/reel-strips-config.dto.js.map +1 -0
- package/dist/config/reel-strips-config/reel.dto.js +29 -0
- package/dist/config/reel-strips-config/reel.dto.js.map +1 -0
- package/dist/config/reel-strips-config/reels-BASE.csv +52 -0
- package/dist/config/reel-strips-config/reels-BONUS.csv +52 -0
- package/dist/domain/game-round.types.js +9 -0
- package/dist/domain/game-round.types.js.map +1 -0
- package/dist/domain/mappers/reel-strips-config.mapper.js +17 -0
- package/dist/domain/mappers/reel-strips-config.mapper.js.map +1 -0
- package/dist/domain/reel-strip-option.js +19 -0
- package/dist/domain/reel-strip-option.js.map +1 -0
- package/dist/domain/reel-strips-config.js +22 -0
- package/dist/domain/reel-strips-config.js.map +1 -0
- package/dist/domain/reel.js +19 -0
- package/dist/domain/reel.js.map +1 -0
- package/dist/domain/types/debug-trigger-bonus-command.js +3 -0
- package/dist/domain/types/debug-trigger-bonus-command.js.map +1 -0
- package/dist/domain/types/debug-trigger-bonus-request.dto.js +3 -0
- package/dist/domain/types/debug-trigger-bonus-request.dto.js.map +1 -0
- package/dist/domain/types/debug-update-bonus-meter-progress-command.js +3 -0
- package/dist/domain/types/debug-update-bonus-meter-progress-command.js.map +1 -0
- package/dist/domain/types/debug-update-bonus-meter-progress-request.dto.js +3 -0
- package/dist/domain/types/debug-update-bonus-meter-progress-request.dto.js.map +1 -0
- package/dist/domain/types/game-spin-command.js +3 -0
- package/dist/domain/types/game-spin-command.js.map +1 -0
- package/dist/domain/types/game-spin-input.dto.js +3 -0
- package/dist/domain/types/game-spin-input.dto.js.map +1 -0
- package/dist/domain/types/game-spin-output.dto.js +17 -0
- package/dist/domain/types/game-spin-output.dto.js.map +1 -0
- package/dist/domain/types/game-symbols.response.dto.js +7 -0
- package/dist/domain/types/game-symbols.response.dto.js.map +1 -0
- package/dist/domain/types/reel-strip-option.dto.js +27 -0
- package/dist/domain/types/reel-strip-option.dto.js.map +1 -0
- package/dist/domain/types/reel-strips-config.dto.js +28 -0
- package/dist/domain/types/reel-strips-config.dto.js.map +1 -0
- package/dist/domain/types/reel.dto.js +28 -0
- package/dist/domain/types/reel.dto.js.map +1 -0
- package/dist/domain/types/start-bonus-round-command.js +3 -0
- package/dist/domain/types/start-bonus-round-command.js.map +1 -0
- package/dist/domain/types/start-bonus-round-input.dto.js +3 -0
- package/dist/domain/types/start-bonus-round-input.dto.js.map +1 -0
- package/dist/game-engine.interface.js +3 -0
- package/dist/game-engine.interface.js.map +1 -0
- package/dist/helpers/generate-hash.js +9 -0
- package/dist/helpers/generate-hash.js.map +1 -0
- package/dist/helpers/number-helper.js +43 -0
- package/dist/helpers/number-helper.js.map +1 -0
- package/dist/helpers/optional-boolean-mapper.js +9 -0
- package/dist/helpers/optional-boolean-mapper.js.map +1 -0
- package/dist/helpers/uuid-helper.js +11 -0
- package/dist/helpers/uuid-helper.js.map +1 -0
- package/dist/helpers/validation-helper.js +25 -0
- package/dist/helpers/validation-helper.js.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/logger/logger.js +140 -0
- package/dist/logger/logger.js.map +1 -0
- package/dist/logic/bonnys-fortune.game-logic.js +252 -0
- package/dist/logic/bonnys-fortune.game-logic.js.map +1 -0
- package/dist/logic/bonnys-fortune.spin-generator.js +101 -0
- package/dist/logic/bonnys-fortune.spin-generator.js.map +1 -0
- package/dist/logic/bonnys-fortune.types.js +17 -0
- package/dist/logic/bonnys-fortune.types.js.map +1 -0
- package/dist/logic/bonnys-fortune.win-calculator.js +130 -0
- package/dist/logic/bonnys-fortune.win-calculator.js.map +1 -0
- package/dist/logic/game-logic-config.interface.js +3 -0
- package/dist/logic/game-logic-config.interface.js.map +1 -0
- package/dist/logic/handlers/base-game.handler.js +113 -0
- package/dist/logic/handlers/base-game.handler.js.map +1 -0
- package/dist/logic/handlers/collect-feature-bonus.handler.js +152 -0
- package/dist/logic/handlers/collect-feature-bonus.handler.js.map +1 -0
- package/dist/logic/handlers/free-spins-bonus.handler.js +69 -0
- package/dist/logic/handlers/free-spins-bonus.handler.js.map +1 -0
- package/dist/logic/handlers/steering-to-the-fortune-bonus.handler.js +75 -0
- package/dist/logic/handlers/steering-to-the-fortune-bonus.handler.js.map +1 -0
- package/dist/logic/handlers/treasure-hunt-bonus.handler.js +131 -0
- package/dist/logic/handlers/treasure-hunt-bonus.handler.js.map +1 -0
- package/dist/rng/DummyRngClient.js +86 -0
- package/dist/rng/DummyRngClient.js.map +1 -0
- package/dist/rng/rng-client.factory.js +23 -0
- package/dist/rng/rng-client.factory.js.map +1 -0
- package/dist/rng/rng-client.interface.js +3 -0
- package/dist/rng/rng-client.interface.js.map +1 -0
- package/dist/rng/rng-service.js +78 -0
- package/dist/rng/rng-service.js.map +1 -0
- package/dist/validation/abstract-game-logic-config.validator.js +18 -0
- package/dist/validation/abstract-game-logic-config.validator.js.map +1 -0
- package/dist/validation/bonnys-fortune/bonnys-fortune-config.dto.js +454 -0
- package/dist/validation/bonnys-fortune/bonnys-fortune-config.dto.js.map +1 -0
- package/dist/validation/bonnys-fortune/bonnys-fortune-config.validator.js +12 -0
- package/dist/validation/bonnys-fortune/bonnys-fortune-config.validator.js.map +1 -0
- package/dist/validation/custom-decorators/IsNestedIntArray.js +26 -0
- package/dist/validation/custom-decorators/IsNestedIntArray.js.map +1 -0
- package/dist/validation/game-logic-config-validation.service.js +20 -0
- package/dist/validation/game-logic-config-validation.service.js.map +1 -0
- package/dist/validation/reel-strips-config-validation.service.js +26 -0
- package/dist/validation/reel-strips-config-validation.service.js.map +1 -0
- package/package.json +51 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReelStripsConfigMapper = void 0;
|
|
4
|
+
const reel_1 = require("../reel");
|
|
5
|
+
const reel_strip_option_1 = require("../reel-strip-option");
|
|
6
|
+
const reel_strips_config_1 = require("../reel-strips-config");
|
|
7
|
+
class ReelStripsConfigMapper {
|
|
8
|
+
mapRawToDomain(rawReels) {
|
|
9
|
+
const reels = rawReels.map((reelOptions) => {
|
|
10
|
+
const options = reelOptions.map((symbols) => new reel_strip_option_1.ReelStripOption(symbols));
|
|
11
|
+
return new reel_1.Reel(options);
|
|
12
|
+
});
|
|
13
|
+
return new reel_strips_config_1.ReelStripsConfig(reels);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.ReelStripsConfigMapper = ReelStripsConfigMapper;
|
|
17
|
+
//# sourceMappingURL=reel-strips-config.mapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reel-strips-config.mapper.js","sourceRoot":"","sources":["../../../src/domain/mappers/reel-strips-config.mapper.ts"],"names":[],"mappings":";;;AAAA,kCAA+B;AAC/B,4DAAuD;AACvD,8DAAyD;AAEzD,MAAa,sBAAsB;IAC1B,cAAc,CAAC,QAAsB;QAC1C,MAAM,KAAK,GAAW,QAAQ,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE;YACjD,MAAM,OAAO,GAAsB,WAAW,CAAC,GAAG,CAChD,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,mCAAe,CAAC,OAAO,CAAC,CAC1C,CAAC;YACF,OAAO,IAAI,WAAI,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,qCAAgB,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;CACF;AAXD,wDAWC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReelStripOption = void 0;
|
|
4
|
+
class ReelStripOption {
|
|
5
|
+
constructor(symbols) {
|
|
6
|
+
this.symbols = symbols;
|
|
7
|
+
}
|
|
8
|
+
getSymbols() {
|
|
9
|
+
return this.symbols;
|
|
10
|
+
}
|
|
11
|
+
get length() {
|
|
12
|
+
return this.symbols.length;
|
|
13
|
+
}
|
|
14
|
+
getSymbolAt(position) {
|
|
15
|
+
return this.symbols[position % this.length];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.ReelStripOption = ReelStripOption;
|
|
19
|
+
//# sourceMappingURL=reel-strip-option.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reel-strip-option.js","sourceRoot":"","sources":["../../src/domain/reel-strip-option.ts"],"names":[],"mappings":";;;AAAA,MAAa,eAAe;IAC1B,YAA4B,OAAiB;QAAjB,YAAO,GAAP,OAAO,CAAU;IAAG,CAAC;IAE1C,UAAU;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IAC7B,CAAC;IAEM,WAAW,CAAC,QAAgB;QACjC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;CACF;AAdD,0CAcC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReelStripsConfig = void 0;
|
|
4
|
+
class ReelStripsConfig {
|
|
5
|
+
constructor(reels) {
|
|
6
|
+
this.reels = reels;
|
|
7
|
+
}
|
|
8
|
+
getReels() {
|
|
9
|
+
return this.reels;
|
|
10
|
+
}
|
|
11
|
+
getReel(index) {
|
|
12
|
+
return this.reels[index];
|
|
13
|
+
}
|
|
14
|
+
get reelsCount() {
|
|
15
|
+
return this.reels.length;
|
|
16
|
+
}
|
|
17
|
+
get optionsCount() {
|
|
18
|
+
return this.reels[0]?.numberOfOptions ?? 0;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.ReelStripsConfig = ReelStripsConfig;
|
|
22
|
+
//# sourceMappingURL=reel-strips-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reel-strips-config.js","sourceRoot":"","sources":["../../src/domain/reel-strips-config.ts"],"names":[],"mappings":";;;AAEA,MAAa,gBAAgB;IAC3B,YAA4B,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;IAAG,CAAC;IAEtC,QAAQ;QACb,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAEM,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC3B,CAAC;IAED,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,eAAe,IAAI,CAAC,CAAC;IAC7C,CAAC;CACF;AAlBD,4CAkBC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Reel = void 0;
|
|
4
|
+
class Reel {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
this.options = options;
|
|
7
|
+
}
|
|
8
|
+
getOptions() {
|
|
9
|
+
return this.options;
|
|
10
|
+
}
|
|
11
|
+
getOption(index) {
|
|
12
|
+
return this.options[index];
|
|
13
|
+
}
|
|
14
|
+
get numberOfOptions() {
|
|
15
|
+
return this.options.length;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.Reel = Reel;
|
|
19
|
+
//# sourceMappingURL=reel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reel.js","sourceRoot":"","sources":["../../src/domain/reel.ts"],"names":[],"mappings":";;;AAEA,MAAa,IAAI;IACf,YAA4B,OAA0B;QAA1B,YAAO,GAAP,OAAO,CAAmB;IAAG,CAAC;IAEnD,UAAU;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAEM,SAAS,CAAC,KAAa;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED,IAAW,eAAe;QACxB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IAC7B,CAAC;CACF;AAdD,oBAcC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-trigger-bonus-command.js","sourceRoot":"","sources":["../../../src/domain/types/debug-trigger-bonus-command.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-trigger-bonus-request.dto.js","sourceRoot":"","sources":["../../../src/domain/types/debug-trigger-bonus-request.dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-update-bonus-meter-progress-command.js","sourceRoot":"","sources":["../../../src/domain/types/debug-update-bonus-meter-progress-command.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-update-bonus-meter-progress-request.dto.js","sourceRoot":"","sources":["../../../src/domain/types/debug-update-bonus-meter-progress-request.dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"game-spin-command.js","sourceRoot":"","sources":["../../../src/domain/types/game-spin-command.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"game-spin-input.dto.js","sourceRoot":"","sources":["../../../src/domain/types/game-spin-input.dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PrizeType = exports.SpinType = void 0;
|
|
4
|
+
var SpinType;
|
|
5
|
+
(function (SpinType) {
|
|
6
|
+
SpinType["BASE_GAME_SPIN"] = "BASE_GAME_SPIN";
|
|
7
|
+
SpinType["BONUS_GAME_1_SPIN"] = "BONUS_GAME_1_SPIN";
|
|
8
|
+
SpinType["BONUS_GAME_2_SPIN"] = "BONUS_GAME_2_SPIN";
|
|
9
|
+
SpinType["BONUS_GAME_3_SPIN"] = "BONUS_GAME_3_SPIN";
|
|
10
|
+
SpinType["COLLECT_FEATURE_SPIN"] = "COLLECT_FEATURE_SPIN";
|
|
11
|
+
})(SpinType || (exports.SpinType = SpinType = {}));
|
|
12
|
+
var PrizeType;
|
|
13
|
+
(function (PrizeType) {
|
|
14
|
+
PrizeType["MULTIPLIER"] = "MULTIPLIER";
|
|
15
|
+
PrizeType["BONUS"] = "BONUS";
|
|
16
|
+
})(PrizeType || (exports.PrizeType = PrizeType = {}));
|
|
17
|
+
//# sourceMappingURL=game-spin-output.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"game-spin-output.dto.js","sourceRoot":"","sources":["../../../src/domain/types/game-spin-output.dto.ts"],"names":[],"mappings":";;;AAAA,IAAY,QAMX;AAND,WAAY,QAAQ;IAClB,6CAAiC,CAAA;IACjC,mDAAuC,CAAA;IACvC,mDAAuC,CAAA;IACvC,mDAAuC,CAAA;IACvC,yDAA6C,CAAA;AAC/C,CAAC,EANW,QAAQ,wBAAR,QAAQ,QAMnB;AAED,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,sCAAyB,CAAA;IACzB,4BAAe,CAAA;AACjB,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GameSymbolsResponseDto = void 0;
|
|
4
|
+
class GameSymbolsResponseDto {
|
|
5
|
+
}
|
|
6
|
+
exports.GameSymbolsResponseDto = GameSymbolsResponseDto;
|
|
7
|
+
//# sourceMappingURL=game-symbols.response.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"game-symbols.response.dto.js","sourceRoot":"","sources":["../../../src/domain/types/game-symbols.response.dto.ts"],"names":[],"mappings":";;;AAQA,MAAa,sBAAsB;CAElC;AAFD,wDAEC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ReelStripOptionDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
class ReelStripOptionDto {
|
|
15
|
+
constructor(symbols) {
|
|
16
|
+
this.symbols = symbols;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.ReelStripOptionDto = ReelStripOptionDto;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, class_validator_1.IsArray)(),
|
|
22
|
+
(0, class_validator_1.ArrayNotEmpty)(),
|
|
23
|
+
(0, class_validator_1.IsInt)({ each: true }),
|
|
24
|
+
(0, class_validator_1.Min)(0, { each: true }),
|
|
25
|
+
__metadata("design:type", Array)
|
|
26
|
+
], ReelStripOptionDto.prototype, "symbols", void 0);
|
|
27
|
+
//# sourceMappingURL=reel-strip-option.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reel-strip-option.dto.js","sourceRoot":"","sources":["../../../src/domain/types/reel-strip-option.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAqE;AAErE,MAAa,kBAAkB;IAO7B,YAAY,OAAiB;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAVD,gDAUC;AALQ;IAJN,IAAA,yBAAO,GAAE;IACT,IAAA,+BAAa,GAAE;IACf,IAAA,uBAAK,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACrB,IAAA,qBAAG,EAAC,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;mDACE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ReelStripsConfigDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const reel_dto_1 = require("./reel.dto");
|
|
15
|
+
const class_transformer_1 = require("class-transformer");
|
|
16
|
+
class ReelStripsConfigDto {
|
|
17
|
+
constructor(reels) {
|
|
18
|
+
this.reels = reels;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.ReelStripsConfigDto = ReelStripsConfigDto;
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, class_validator_1.IsArray)(),
|
|
24
|
+
(0, class_validator_1.ArrayNotEmpty)(),
|
|
25
|
+
(0, class_transformer_1.Type)(() => reel_dto_1.ReelDto),
|
|
26
|
+
__metadata("design:type", Array)
|
|
27
|
+
], ReelStripsConfigDto.prototype, "reels", void 0);
|
|
28
|
+
//# sourceMappingURL=reel-strips-config.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reel-strips-config.dto.js","sourceRoot":"","sources":["../../../src/domain/types/reel-strips-config.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAyD;AAEzD,yCAAqC;AACrC,yDAAyC;AAEzC,MAAa,mBAAmB;IAM9B,YAAY,KAAgB;QAC1B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AATD,kDASC;AALQ;IAHN,IAAA,yBAAO,GAAE;IACT,IAAA,+BAAa,GAAE;IACf,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,kBAAO,CAAC;;kDACI"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ReelDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const reel_strip_option_dto_1 = require("./reel-strip-option.dto");
|
|
15
|
+
const class_transformer_1 = require("class-transformer");
|
|
16
|
+
class ReelDto {
|
|
17
|
+
constructor(options) {
|
|
18
|
+
this.options = options;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.ReelDto = ReelDto;
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, class_validator_1.IsArray)(),
|
|
24
|
+
(0, class_validator_1.ArrayNotEmpty)(),
|
|
25
|
+
(0, class_transformer_1.Type)(() => reel_strip_option_dto_1.ReelStripOptionDto),
|
|
26
|
+
__metadata("design:type", Array)
|
|
27
|
+
], ReelDto.prototype, "options", void 0);
|
|
28
|
+
//# sourceMappingURL=reel.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reel.dto.js","sourceRoot":"","sources":["../../../src/domain/types/reel.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAyD;AAEzD,mEAA6D;AAC7D,yDAAyC;AAEzC,MAAa,OAAO;IAMlB,YAAY,OAA6B;QACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AATD,0BASC;AALQ;IAHN,IAAA,yBAAO,GAAE;IACT,IAAA,+BAAa,GAAE;IACf,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,0CAAkB,CAAC;;wCACM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-bonus-round-command.js","sourceRoot":"","sources":["../../../src/domain/types/start-bonus-round-command.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-bonus-round-input.dto.js","sourceRoot":"","sources":["../../../src/domain/types/start-bonus-round-input.dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"game-engine.interface.js","sourceRoot":"","sources":["../src/game-engine.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateHash = void 0;
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
5
|
+
const generateHash = (input) => {
|
|
6
|
+
return (0, crypto_1.createHash)('sha256').update(input).digest('hex');
|
|
7
|
+
};
|
|
8
|
+
exports.generateHash = generateHash;
|
|
9
|
+
//# sourceMappingURL=generate-hash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-hash.js","sourceRoot":"","sources":["../../src/helpers/generate-hash.ts"],"names":[],"mappings":";;;AAAA,mCAAoC;AAE7B,MAAM,YAAY,GAAG,CAAC,KAAa,EAAU,EAAE;IACpD,OAAO,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC1D,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NumberHelper = void 0;
|
|
4
|
+
class NumberHelper {
|
|
5
|
+
/**
|
|
6
|
+
* Safely formats a number to the specified decimal places,
|
|
7
|
+
* minimizing floating-point issues.
|
|
8
|
+
*/
|
|
9
|
+
static toFixedNumber(value, decimals) {
|
|
10
|
+
const factor = Math.pow(10, decimals);
|
|
11
|
+
return Math.round((value + Number.EPSILON) * factor) / factor;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Safely adds two numbers and formats result.
|
|
15
|
+
*/
|
|
16
|
+
static safeSum(a, b, decimals) {
|
|
17
|
+
const result = a * Math.pow(10, decimals) + b * Math.pow(10, decimals);
|
|
18
|
+
return result / Math.pow(10, decimals);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Safely multiplies two numbers and formats result.
|
|
22
|
+
*/
|
|
23
|
+
static safeMultiply(a, b, decimals) {
|
|
24
|
+
const result = a * Math.pow(10, decimals) * (b * Math.pow(10, decimals));
|
|
25
|
+
return result / Math.pow(10, decimals * 2);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Clamps a number between min and max.
|
|
29
|
+
*/
|
|
30
|
+
static clamp(value, min, max) {
|
|
31
|
+
return Math.min(Math.max(value, min), max);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Safely divides two numbers.
|
|
35
|
+
*/
|
|
36
|
+
static safeDivide(a, b, decimals) {
|
|
37
|
+
if (b === 0)
|
|
38
|
+
throw new Error('Division by zero');
|
|
39
|
+
return this.toFixedNumber(a / b, decimals);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.NumberHelper = NumberHelper;
|
|
43
|
+
//# sourceMappingURL=number-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-helper.js","sourceRoot":"","sources":["../../src/helpers/number-helper.ts"],"names":[],"mappings":";;;AAAA,MAAa,YAAY;IACvB;;;OAGG;IACI,MAAM,CAAC,aAAa,CAAC,KAAa,EAAE,QAAgB;QACzD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC;IAChE,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,OAAO,CAAC,CAAS,EAAE,CAAS,EAAE,QAAgB;QAC1D,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;QACvE,OAAO,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,YAAY,CAAC,CAAS,EAAE,CAAS,EAAE,QAAgB;QAC/D,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;QACzE,OAAO,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,QAAQ,GAAG,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,KAAK,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW;QACzD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,UAAU,CAAC,CAAS,EAAE,CAAS,EAAE,QAAgB;QAC7D,IAAI,CAAC,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACjD,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,CAAC;IAC7C,CAAC;CACF;AAxCD,oCAwCC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.optionalBooleanMapper = void 0;
|
|
4
|
+
exports.optionalBooleanMapper = new Map([
|
|
5
|
+
['undefined', undefined],
|
|
6
|
+
['true', true],
|
|
7
|
+
['false', false],
|
|
8
|
+
]);
|
|
9
|
+
//# sourceMappingURL=optional-boolean-mapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optional-boolean-mapper.js","sourceRoot":"","sources":["../../src/helpers/optional-boolean-mapper.ts"],"names":[],"mappings":";;;AAAa,QAAA,qBAAqB,GAAG,IAAI,GAAG,CAAC;IAC3C,CAAC,WAAW,EAAE,SAAS,CAAC;IACxB,CAAC,MAAM,EAAE,IAAI,CAAC;IACd,CAAC,OAAO,EAAE,KAAK,CAAC;CACjB,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UuidHelper = void 0;
|
|
4
|
+
const uuid_1 = require("uuid");
|
|
5
|
+
class UuidHelper {
|
|
6
|
+
static generateUuid() {
|
|
7
|
+
return (0, uuid_1.v4)();
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.UuidHelper = UuidHelper;
|
|
11
|
+
//# sourceMappingURL=uuid-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uuid-helper.js","sourceRoot":"","sources":["../../src/helpers/uuid-helper.ts"],"names":[],"mappings":";;;AAAA,+BAA0B;AAE1B,MAAa,UAAU;IACd,MAAM,CAAC,YAAY;QACxB,OAAO,IAAA,SAAE,GAAE,CAAC;IACd,CAAC;CACF;AAJD,gCAIC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValidationHelper = void 0;
|
|
4
|
+
const class_validator_1 = require("class-validator");
|
|
5
|
+
class ValidationHelper {
|
|
6
|
+
static validate(dto) {
|
|
7
|
+
return (0, class_validator_1.validate)(dto, ValidationHelper.validationOptions);
|
|
8
|
+
}
|
|
9
|
+
static validateWithoutForbidden(dto) {
|
|
10
|
+
return (0, class_validator_1.validate)(dto, ValidationHelper.validationOptionsWithoutForbidden);
|
|
11
|
+
}
|
|
12
|
+
static isPlainObject(value) {
|
|
13
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.ValidationHelper = ValidationHelper;
|
|
17
|
+
ValidationHelper.validationOptions = {
|
|
18
|
+
whitelist: true,
|
|
19
|
+
forbidNonWhitelisted: true,
|
|
20
|
+
};
|
|
21
|
+
ValidationHelper.validationOptionsWithoutForbidden = {
|
|
22
|
+
whitelist: true,
|
|
23
|
+
forbidNonWhitelisted: false,
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=validation-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-helper.js","sourceRoot":"","sources":["../../src/helpers/validation-helper.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAE5D,MAAa,gBAAgB;IAWpB,MAAM,CAAC,QAAQ,CAAmB,GAAM;QAC7C,OAAO,IAAA,0BAAQ,EAAC,GAAG,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;IAC3D,CAAC;IAEM,MAAM,CAAC,wBAAwB,CACpC,GAAM;QAEN,OAAO,IAAA,0BAAQ,EAAC,GAAG,EAAE,gBAAgB,CAAC,iCAAiC,CAAC,CAAC;IAC3E,CAAC;IAEM,MAAM,CAAC,aAAa,CAAC,KAAc;QACxC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9E,CAAC;;AAvBH,4CAwBC;AAvBwB,kCAAiB,GAAG;IACzC,SAAS,EAAE,IAAI;IACf,oBAAoB,EAAE,IAAI;CAC3B,CAAC;AAEqB,kDAAiC,GAAG;IACzD,SAAS,EAAE,IAAI;IACf,oBAAoB,EAAE,KAAK;CAC5B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BonnysFortuneV1GameEngine = void 0;
|
|
4
|
+
require("reflect-metadata");
|
|
5
|
+
var bonnys_fortune_v1_game_engine_1 = require("./bonnys-fortune-v1.game-engine");
|
|
6
|
+
Object.defineProperty(exports, "BonnysFortuneV1GameEngine", { enumerable: true, get: function () { return bonnys_fortune_v1_game_engine_1.BonnysFortuneV1GameEngine; } });
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAE1B,iFAA4E;AAAnE,0IAAA,yBAAyB,OAAA"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Logger = void 0;
|
|
4
|
+
const winston_1 = require("winston");
|
|
5
|
+
class Logger {
|
|
6
|
+
constructor(context, logFormat) {
|
|
7
|
+
this.context = context;
|
|
8
|
+
const format = logFormat ?? this.detectLogFormat();
|
|
9
|
+
this.logger = this.createWinstonLogger(format);
|
|
10
|
+
}
|
|
11
|
+
detectLogFormat() {
|
|
12
|
+
const envFormat = process.env.LOG_FORMAT?.toLowerCase();
|
|
13
|
+
switch (envFormat) {
|
|
14
|
+
case 'pretty':
|
|
15
|
+
return 'pretty';
|
|
16
|
+
case 'json':
|
|
17
|
+
return 'json';
|
|
18
|
+
default:
|
|
19
|
+
return 'json';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
createWinstonLogger(logFormat) {
|
|
23
|
+
const winstonFormat = this.getLogFormat(logFormat);
|
|
24
|
+
return (0, winston_1.createLogger)({
|
|
25
|
+
level: 'info',
|
|
26
|
+
format: winstonFormat,
|
|
27
|
+
transports: this.getTransports(),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
getLogFormat(logFormat) {
|
|
31
|
+
return winston_1.format.combine(winston_1.format.timestamp(), this.selectFormat(logFormat));
|
|
32
|
+
}
|
|
33
|
+
selectFormat(logFormat) {
|
|
34
|
+
switch (logFormat) {
|
|
35
|
+
case 'pretty':
|
|
36
|
+
return this.getPrettyFormat();
|
|
37
|
+
case 'json':
|
|
38
|
+
return this.getJsonFormat();
|
|
39
|
+
default:
|
|
40
|
+
return this.getJsonFormat();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
getJsonFormat() {
|
|
44
|
+
return winston_1.format.combine((0, winston_1.format)((info) => {
|
|
45
|
+
if (this.context) {
|
|
46
|
+
info.message = `[${this.context}] ${info.message}`;
|
|
47
|
+
}
|
|
48
|
+
return info;
|
|
49
|
+
})(), winston_1.format.json());
|
|
50
|
+
}
|
|
51
|
+
getPrettyFormat() {
|
|
52
|
+
return winston_1.format.combine(winston_1.format.colorize(), winston_1.format.printf(({ timestamp, level, message, error, ...meta }) => {
|
|
53
|
+
const contextStr = this.context ? `[${this.context}] ` : '';
|
|
54
|
+
let output = `${timestamp} ${level}: ${contextStr}${message}`;
|
|
55
|
+
if (error &&
|
|
56
|
+
typeof error === 'object' &&
|
|
57
|
+
'name' in error &&
|
|
58
|
+
'message' in error) {
|
|
59
|
+
output += `\n Error: ${error.name}: ${error.message}`;
|
|
60
|
+
if (error.name === 'DomainException' && 'errorCode' in error) {
|
|
61
|
+
output += `\n Internal Code: ${error.errorCode}`;
|
|
62
|
+
}
|
|
63
|
+
if ('stack' in error && error.stack) {
|
|
64
|
+
output += `\n Stack: ${error.stack}`;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const metaKeys = Object.keys(meta).filter((key) => key !== 'timestamp' && key !== 'level' && key !== 'message');
|
|
68
|
+
if (metaKeys.length > 0) {
|
|
69
|
+
output += `\n Meta: ${JSON.stringify(meta, null, 2)}`;
|
|
70
|
+
}
|
|
71
|
+
return output;
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
safeStringify(obj) {
|
|
75
|
+
try {
|
|
76
|
+
return JSON.stringify(obj, (key, value) => {
|
|
77
|
+
if (typeof value === 'bigint') {
|
|
78
|
+
return value.toString();
|
|
79
|
+
}
|
|
80
|
+
return value;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
return '[Object cannot be serialized]';
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
getTransports() {
|
|
88
|
+
return [
|
|
89
|
+
new winston_1.transports.Console(),
|
|
90
|
+
new winston_1.transports.File({ filename: 'logs/app.log' }),
|
|
91
|
+
];
|
|
92
|
+
}
|
|
93
|
+
log(message, { level = 'info', ...rest } = {}) {
|
|
94
|
+
switch (level) {
|
|
95
|
+
case 'error':
|
|
96
|
+
this.logger.error(message, rest);
|
|
97
|
+
break;
|
|
98
|
+
case 'warn':
|
|
99
|
+
this.logger.warn(message, rest);
|
|
100
|
+
break;
|
|
101
|
+
case 'debug':
|
|
102
|
+
this.logger.debug(message, rest);
|
|
103
|
+
break;
|
|
104
|
+
case 'verbose':
|
|
105
|
+
this.logger.verbose(message, rest);
|
|
106
|
+
break;
|
|
107
|
+
default:
|
|
108
|
+
this.logger.info(message, rest);
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
error(message, ...optionalParams) {
|
|
113
|
+
if (optionalParams.length > 0 && optionalParams[0] instanceof Error) {
|
|
114
|
+
const error = optionalParams[0];
|
|
115
|
+
const errorData = {
|
|
116
|
+
name: error.name,
|
|
117
|
+
message: error.message,
|
|
118
|
+
stack: error.stack,
|
|
119
|
+
};
|
|
120
|
+
this.logger.error(message, {
|
|
121
|
+
error: errorData,
|
|
122
|
+
...optionalParams.slice(1),
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
this.logger.error(message, ...optionalParams);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
warn(message, ...optionalParams) {
|
|
130
|
+
this.logger.warn(message, ...optionalParams);
|
|
131
|
+
}
|
|
132
|
+
debug(message, ...optionalParams) {
|
|
133
|
+
this.logger.debug(message, ...optionalParams);
|
|
134
|
+
}
|
|
135
|
+
verbose(message, ...optionalParams) {
|
|
136
|
+
this.logger.verbose(message, ...optionalParams);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
exports.Logger = Logger;
|
|
140
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger/logger.ts"],"names":[],"mappings":";;;AAAA,qCAKiB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