@truelab/trueserver 0.0.4 → 0.1.0
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/CHANGELOG.md +67 -0
- package/MIGRATION.md +508 -0
- package/README.md +114 -94
- package/dist/application.d.ts.map +1 -1
- package/dist/application.js +9 -5
- package/dist/application.js.map +1 -1
- package/dist/examples.d.ts +1 -0
- package/dist/examples.d.ts.map +1 -1
- package/dist/examples.js +3 -1
- package/dist/examples.js.map +1 -1
- package/dist/helpers/config.helper.d.ts +9 -1
- package/dist/helpers/config.helper.d.ts.map +1 -1
- package/dist/helpers/config.helper.js +29 -0
- package/dist/helpers/config.helper.js.map +1 -1
- package/dist/helpers/errors.helper.d.ts +19 -0
- package/dist/helpers/errors.helper.d.ts.map +1 -0
- package/dist/helpers/errors.helper.js +21 -0
- package/dist/helpers/errors.helper.js.map +1 -0
- package/dist/helpers/fastify.helper.d.ts +5 -1
- package/dist/helpers/fastify.helper.d.ts.map +1 -1
- package/dist/helpers/fastify.helper.js +3 -1
- package/dist/helpers/fastify.helper.js.map +1 -1
- package/dist/helpers/handlers.helper.d.ts +10 -1
- package/dist/helpers/handlers.helper.d.ts.map +1 -1
- package/dist/helpers/handlers.helper.js +2 -1
- package/dist/helpers/handlers.helper.js.map +1 -1
- package/dist/helpers/money.helper.d.ts +13 -0
- package/dist/helpers/money.helper.d.ts.map +1 -0
- package/dist/helpers/money.helper.js +29 -0
- package/dist/helpers/money.helper.js.map +1 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/dist/plugins/404.plugin.d.ts.map +1 -1
- package/dist/plugins/404.plugin.js +2 -1
- package/dist/plugins/404.plugin.js.map +1 -1
- package/dist/plugins/apikey.plugin.d.ts.map +1 -1
- package/dist/plugins/apikey.plugin.js +6 -7
- package/dist/plugins/apikey.plugin.js.map +1 -1
- package/dist/plugins/error.plugin.d.ts.map +1 -1
- package/dist/plugins/error.plugin.js +6 -2
- package/dist/plugins/error.plugin.js.map +1 -1
- package/dist/plugins/sentry.plugin.d.ts.map +1 -1
- package/dist/plugins/sentry.plugin.js +1 -2
- package/dist/plugins/sentry.plugin.js.map +1 -1
- package/dist/plugins/swagger.plugin.d.ts.map +1 -1
- package/dist/plugins/swagger.plugin.js +5 -1
- package/dist/plugins/swagger.plugin.js.map +1 -1
- package/dist/routes/checksum/checksum.route.d.ts +3 -0
- package/dist/routes/checksum/checksum.route.d.ts.map +1 -0
- package/dist/routes/checksum/checksum.route.js +21 -0
- package/dist/routes/checksum/checksum.route.js.map +1 -0
- package/dist/routes/checksum/index.d.ts +3 -0
- package/dist/routes/checksum/index.d.ts.map +1 -0
- package/dist/routes/checksum/index.js +12 -0
- package/dist/routes/checksum/index.js.map +1 -0
- package/dist/routes/client/client.route.d.ts +3 -0
- package/dist/routes/client/client.route.d.ts.map +1 -0
- package/dist/routes/{client.route.js → client/client.route.js} +5 -5
- package/dist/routes/client/client.route.js.map +1 -0
- package/dist/routes/client/index.d.ts +3 -0
- package/dist/routes/client/index.d.ts.map +1 -0
- package/dist/routes/client/index.js +12 -0
- package/dist/routes/client/index.js.map +1 -0
- package/dist/routes/config/config.route.js +1 -1
- package/dist/routes/config/config.route.js.map +1 -1
- package/dist/routes/config/config.route.validate.plugin.d.ts.map +1 -1
- package/dist/routes/config/config.route.validate.plugin.js +48 -17
- package/dist/routes/config/config.route.validate.plugin.js.map +1 -1
- package/dist/routes/play/play.route.validate.plugin.d.ts +10 -9
- package/dist/routes/play/play.route.validate.plugin.d.ts.map +1 -1
- package/dist/routes/play/play.route.validate.plugin.js +90 -39
- package/dist/routes/play/play.route.validate.plugin.js.map +1 -1
- package/dist/routes/validate/validate.route.validate.plugin.d.ts.map +1 -1
- package/dist/routes/validate/validate.route.validate.plugin.js +5 -4
- package/dist/routes/validate/validate.route.validate.plugin.js.map +1 -1
- package/dist/routes-public/healthcheck.route.d.ts.map +1 -0
- package/dist/{routes → routes-public}/healthcheck.route.js +4 -10
- package/dist/routes-public/healthcheck.route.js.map +1 -0
- package/dist/schemas/checksum.schema.d.ts +11 -0
- package/dist/schemas/checksum.schema.d.ts.map +1 -0
- package/dist/schemas/checksum.schema.js +26 -0
- package/dist/schemas/checksum.schema.js.map +1 -0
- package/dist/schemas/client.schema.d.ts +1 -1
- package/dist/schemas/client.schema.js +4 -4
- package/dist/schemas/client.schema.js.map +1 -1
- package/dist/schemas/config.schema.d.ts +17 -20
- package/dist/schemas/config.schema.d.ts.map +1 -1
- package/dist/schemas/config.schema.js +42 -43
- package/dist/schemas/config.schema.js.map +1 -1
- package/dist/schemas/examples/checksum.schema.examples.d.ts +3 -0
- package/dist/schemas/examples/checksum.schema.examples.d.ts.map +1 -0
- package/dist/schemas/examples/checksum.schema.examples.js +26 -0
- package/dist/schemas/examples/checksum.schema.examples.js.map +1 -0
- package/dist/schemas/examples/client.schema.examples.d.ts.map +1 -1
- package/dist/schemas/examples/client.schema.examples.js +15 -18
- package/dist/schemas/examples/client.schema.examples.js.map +1 -1
- package/dist/schemas/examples/config.schema.examples.d.ts.map +1 -1
- package/dist/schemas/examples/config.schema.examples.js +65 -33
- package/dist/schemas/examples/config.schema.examples.js.map +1 -1
- package/dist/schemas/examples/healthcheck.schema.examples.d.ts.map +1 -1
- package/dist/schemas/examples/healthcheck.schema.examples.js +3 -14
- package/dist/schemas/examples/healthcheck.schema.examples.js.map +1 -1
- package/dist/schemas/examples/play.schema.examples.d.ts.map +1 -1
- package/dist/schemas/examples/play.schema.examples.js +94 -130
- package/dist/schemas/examples/play.schema.examples.js.map +1 -1
- package/dist/schemas/examples/validate.schema.examples.d.ts.map +1 -1
- package/dist/schemas/examples/validate.schema.examples.js +51 -41
- package/dist/schemas/examples/validate.schema.examples.js.map +1 -1
- package/dist/schemas/healthcheck.schema.d.ts +2 -20
- package/dist/schemas/healthcheck.schema.d.ts.map +1 -1
- package/dist/schemas/healthcheck.schema.js +10 -41
- package/dist/schemas/healthcheck.schema.js.map +1 -1
- package/dist/schemas/play.schema.d.ts +22 -17
- package/dist/schemas/play.schema.d.ts.map +1 -1
- package/dist/schemas/play.schema.js +37 -45
- package/dist/schemas/play.schema.js.map +1 -1
- package/dist/schemas/shared.d.ts +13 -21
- package/dist/schemas/shared.d.ts.map +1 -1
- package/dist/schemas/shared.js +56 -72
- package/dist/schemas/shared.js.map +1 -1
- package/dist/schemas/validate.schema.d.ts +11 -7
- package/dist/schemas/validate.schema.d.ts.map +1 -1
- package/dist/schemas/validate.schema.js +14 -16
- package/dist/schemas/validate.schema.js.map +1 -1
- package/package.json +5 -2
- package/dist/plugins/metrics.plugin.d.ts +0 -9
- package/dist/plugins/metrics.plugin.d.ts.map +0 -1
- package/dist/plugins/metrics.plugin.js +0 -24
- package/dist/plugins/metrics.plugin.js.map +0 -1
- package/dist/routes/client.route.d.ts +0 -3
- package/dist/routes/client.route.d.ts.map +0 -1
- package/dist/routes/client.route.js.map +0 -1
- package/dist/routes/healthcheck.route.d.ts.map +0 -1
- package/dist/routes/healthcheck.route.js.map +0 -1
- /package/dist/{routes → routes-public}/healthcheck.route.d.ts +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Big from 'big.js';
|
|
2
|
+
export { default as Big } from 'big.js';
|
|
3
|
+
/**
|
|
4
|
+
* Rounds a monetary value to `decimals` places using exact decimal arithmetic.
|
|
5
|
+
* Returns an exact-decimal number safe to put on the wire (default mode: round half up).
|
|
6
|
+
*/
|
|
7
|
+
export declare function roundMoney(value: number | string, decimals: number, mode?: Big.RoundingMode): number;
|
|
8
|
+
/**
|
|
9
|
+
* true if `value` is finite and has no more than `decimals` decimal places
|
|
10
|
+
* (i.e. it is an exact representation for a currency with `decimals` precision).
|
|
11
|
+
*/
|
|
12
|
+
export declare function isExactDecimal(value: number, decimals: number): boolean;
|
|
13
|
+
//# sourceMappingURL=money.helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"money.helper.d.ts","sourceRoot":"","sources":["../../helpers/money.helper.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,QAAQ,CAAA;AAExB,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,QAAQ,CAAA;AAEvC;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,GAAE,GAAG,CAAC,YAA8B,GAAG,MAAM,CAErH;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAIvE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Big = void 0;
|
|
7
|
+
exports.roundMoney = roundMoney;
|
|
8
|
+
exports.isExactDecimal = isExactDecimal;
|
|
9
|
+
const big_js_1 = __importDefault(require("big.js"));
|
|
10
|
+
var big_js_2 = require("big.js");
|
|
11
|
+
Object.defineProperty(exports, "Big", { enumerable: true, get: function () { return __importDefault(big_js_2).default; } });
|
|
12
|
+
/**
|
|
13
|
+
* Rounds a monetary value to `decimals` places using exact decimal arithmetic.
|
|
14
|
+
* Returns an exact-decimal number safe to put on the wire (default mode: round half up).
|
|
15
|
+
*/
|
|
16
|
+
function roundMoney(value, decimals, mode = big_js_1.default.roundHalfUp) {
|
|
17
|
+
return Number(new big_js_1.default(value).round(decimals, mode).toString());
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* true if `value` is finite and has no more than `decimals` decimal places
|
|
21
|
+
* (i.e. it is an exact representation for a currency with `decimals` precision).
|
|
22
|
+
*/
|
|
23
|
+
function isExactDecimal(value, decimals) {
|
|
24
|
+
if (!Number.isFinite(value))
|
|
25
|
+
return false;
|
|
26
|
+
const big = new big_js_1.default(value.toString());
|
|
27
|
+
return big.round(decimals, big_js_1.default.roundHalfUp).eq(big);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=money.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"money.helper.js","sourceRoot":"","sources":["../../helpers/money.helper.ts"],"names":[],"mappings":";;;;;;AAQA,gCAEC;AAMD,wCAIC;AApBD,oDAAwB;AAExB,iCAAuC;AAA9B,8GAAA,OAAO,OAAO;AAEvB;;;GAGG;AACH,SAAgB,UAAU,CAAC,KAAsB,EAAE,QAAgB,EAAE,OAAyB,gBAAG,CAAC,WAAW;IACzG,OAAO,MAAM,CAAC,IAAI,gBAAG,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;AAClE,CAAC;AAED;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAAa,EAAE,QAAgB;IAC1D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAA;IACzC,MAAM,GAAG,GAAG,IAAI,gBAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAA;IACrC,OAAO,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,gBAAG,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAA;AACvD,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
export { default as Application } from './application';
|
|
2
2
|
export { getGameConfig, registerGameConfig, type TGameConfig, } from './helpers/config.helper';
|
|
3
3
|
export { getenv, variation } from './helpers/env.helper';
|
|
4
|
-
export {
|
|
5
|
-
export { type
|
|
4
|
+
export { EErrorCode, type TErrorCode, } from './helpers/errors.helper';
|
|
5
|
+
export { type FastifyTypebox, type FastifyError$Coded, getRoutePrefix, httpError, registerPlugin, registerRoute, } from './helpers/fastify.helper';
|
|
6
|
+
export { type RouteHandler, type TRtpParams, HandlersHelper, handlers, } from './helpers/handlers.helper';
|
|
6
7
|
export { logger, loggerOptions } from './helpers/logger.helper';
|
|
8
|
+
export { Big, roundMoney, isExactDecimal } from './helpers/money.helper';
|
|
7
9
|
export { getByChance, random, randomOf } from './helpers/random.helper';
|
|
10
|
+
export { ChecksumReplySchema, ChecksumRequestSchema, type TChecksumReply, type TChecksumRequest, } from './schemas/checksum.schema';
|
|
8
11
|
export { ClientReplySchema, ClientRequestSchema, type TClientReply, type TClientRequest, } from './schemas/client.schema';
|
|
9
12
|
export { ConfigReplySchema, ConfigRequestSchema, type TConfigReply, type TConfigRequest, } from './schemas/config.schema';
|
|
10
|
-
export { HealthcheckReplySchema, HealthcheckRequestSchema,
|
|
13
|
+
export { HealthcheckReplySchema, HealthcheckRequestSchema, type THealthcheckReply, type THealthcheckRequest, } from './schemas/healthcheck.schema';
|
|
11
14
|
export { PlayReplySchema, PlayRequestSchema, type TPlayReply, type TPlayRequest, } from './schemas/play.schema';
|
|
12
|
-
export { AccessErrorSchema,
|
|
15
|
+
export { AccessErrorSchema, EEnvironment, EStakeType, HeadersSchema, InternalErrorSchema, MetaSchema, RequestErrorSchema, StakeModeSchema, StakeSchema, type TAccessError, type TExamples, type TInternalError, type TMeta, type TRequestError, type TStake, type TStakeMode, } from './schemas/shared';
|
|
13
16
|
export { ValidateReplySchema, ValidateRequestSchema, type TValidateReply, type TValidateRequest, } from './schemas/validate.schema';
|
|
14
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EACH,aAAa,EACb,kBAAkB,EAClB,KAAK,WAAW,GACn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M,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAEvE,OAAO,EACH,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,cAAc,EACnB,KAAK,gBAAgB,GACxB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACH,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,YAAY,EACjB,KAAK,cAAc,GACtB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACH,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,YAAY,EACjB,KAAK,cAAc,GACtB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACH,sBAAsB,EACtB,wBAAwB,EACxB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,GAC3B,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACH,eAAe,EACf,iBAAiB,EACjB,KAAK,UAAU,EACf,KAAK,YAAY,GACpB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACH,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,KAAK,EACV,KAAK,aAAa,EAClB,KAAK,MAAM,EACX,KAAK,UAAU,GAClB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACH,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,cAAc,EACnB,KAAK,gBAAgB,GACxB,MAAM,2BAA2B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ValidateRequestSchema = exports.ValidateReplySchema = exports.StakeSchema = exports.StakeModeSchema = exports.RequestErrorSchema = exports.
|
|
6
|
+
exports.ValidateRequestSchema = exports.ValidateReplySchema = exports.StakeSchema = exports.StakeModeSchema = exports.RequestErrorSchema = exports.MetaSchema = exports.InternalErrorSchema = exports.HeadersSchema = exports.EStakeType = exports.EEnvironment = exports.AccessErrorSchema = exports.PlayRequestSchema = exports.PlayReplySchema = exports.HealthcheckRequestSchema = exports.HealthcheckReplySchema = exports.ConfigRequestSchema = exports.ConfigReplySchema = exports.ClientRequestSchema = exports.ClientReplySchema = exports.ChecksumRequestSchema = exports.ChecksumReplySchema = exports.randomOf = exports.random = exports.getByChance = exports.isExactDecimal = exports.roundMoney = exports.Big = exports.loggerOptions = exports.logger = exports.handlers = exports.HandlersHelper = exports.registerRoute = exports.registerPlugin = exports.httpError = exports.getRoutePrefix = exports.EErrorCode = exports.variation = exports.getenv = exports.registerGameConfig = exports.getGameConfig = exports.Application = void 0;
|
|
7
7
|
var application_1 = require("./application");
|
|
8
8
|
Object.defineProperty(exports, "Application", { enumerable: true, get: function () { return __importDefault(application_1).default; } });
|
|
9
9
|
var config_helper_1 = require("./helpers/config.helper");
|
|
@@ -12,6 +12,8 @@ Object.defineProperty(exports, "registerGameConfig", { enumerable: true, get: fu
|
|
|
12
12
|
var env_helper_1 = require("./helpers/env.helper");
|
|
13
13
|
Object.defineProperty(exports, "getenv", { enumerable: true, get: function () { return env_helper_1.getenv; } });
|
|
14
14
|
Object.defineProperty(exports, "variation", { enumerable: true, get: function () { return env_helper_1.variation; } });
|
|
15
|
+
var errors_helper_1 = require("./helpers/errors.helper");
|
|
16
|
+
Object.defineProperty(exports, "EErrorCode", { enumerable: true, get: function () { return errors_helper_1.EErrorCode; } });
|
|
15
17
|
var fastify_helper_1 = require("./helpers/fastify.helper");
|
|
16
18
|
Object.defineProperty(exports, "getRoutePrefix", { enumerable: true, get: function () { return fastify_helper_1.getRoutePrefix; } });
|
|
17
19
|
Object.defineProperty(exports, "httpError", { enumerable: true, get: function () { return fastify_helper_1.httpError; } });
|
|
@@ -23,10 +25,17 @@ Object.defineProperty(exports, "handlers", { enumerable: true, get: function ()
|
|
|
23
25
|
var logger_helper_1 = require("./helpers/logger.helper");
|
|
24
26
|
Object.defineProperty(exports, "logger", { enumerable: true, get: function () { return logger_helper_1.logger; } });
|
|
25
27
|
Object.defineProperty(exports, "loggerOptions", { enumerable: true, get: function () { return logger_helper_1.loggerOptions; } });
|
|
28
|
+
var money_helper_1 = require("./helpers/money.helper");
|
|
29
|
+
Object.defineProperty(exports, "Big", { enumerable: true, get: function () { return money_helper_1.Big; } });
|
|
30
|
+
Object.defineProperty(exports, "roundMoney", { enumerable: true, get: function () { return money_helper_1.roundMoney; } });
|
|
31
|
+
Object.defineProperty(exports, "isExactDecimal", { enumerable: true, get: function () { return money_helper_1.isExactDecimal; } });
|
|
26
32
|
var random_helper_1 = require("./helpers/random.helper");
|
|
27
33
|
Object.defineProperty(exports, "getByChance", { enumerable: true, get: function () { return random_helper_1.getByChance; } });
|
|
28
34
|
Object.defineProperty(exports, "random", { enumerable: true, get: function () { return random_helper_1.random; } });
|
|
29
35
|
Object.defineProperty(exports, "randomOf", { enumerable: true, get: function () { return random_helper_1.randomOf; } });
|
|
36
|
+
var checksum_schema_1 = require("./schemas/checksum.schema");
|
|
37
|
+
Object.defineProperty(exports, "ChecksumReplySchema", { enumerable: true, get: function () { return checksum_schema_1.ChecksumReplySchema; } });
|
|
38
|
+
Object.defineProperty(exports, "ChecksumRequestSchema", { enumerable: true, get: function () { return checksum_schema_1.ChecksumRequestSchema; } });
|
|
30
39
|
var client_schema_1 = require("./schemas/client.schema");
|
|
31
40
|
Object.defineProperty(exports, "ClientReplySchema", { enumerable: true, get: function () { return client_schema_1.ClientReplySchema; } });
|
|
32
41
|
Object.defineProperty(exports, "ClientRequestSchema", { enumerable: true, get: function () { return client_schema_1.ClientRequestSchema; } });
|
|
@@ -36,18 +45,16 @@ Object.defineProperty(exports, "ConfigRequestSchema", { enumerable: true, get: f
|
|
|
36
45
|
var healthcheck_schema_1 = require("./schemas/healthcheck.schema");
|
|
37
46
|
Object.defineProperty(exports, "HealthcheckReplySchema", { enumerable: true, get: function () { return healthcheck_schema_1.HealthcheckReplySchema; } });
|
|
38
47
|
Object.defineProperty(exports, "HealthcheckRequestSchema", { enumerable: true, get: function () { return healthcheck_schema_1.HealthcheckRequestSchema; } });
|
|
39
|
-
Object.defineProperty(exports, "MetricsSchema", { enumerable: true, get: function () { return healthcheck_schema_1.MetricsSchema; } });
|
|
40
48
|
var play_schema_1 = require("./schemas/play.schema");
|
|
41
49
|
Object.defineProperty(exports, "PlayReplySchema", { enumerable: true, get: function () { return play_schema_1.PlayReplySchema; } });
|
|
42
50
|
Object.defineProperty(exports, "PlayRequestSchema", { enumerable: true, get: function () { return play_schema_1.PlayRequestSchema; } });
|
|
43
51
|
var shared_1 = require("./schemas/shared");
|
|
44
52
|
Object.defineProperty(exports, "AccessErrorSchema", { enumerable: true, get: function () { return shared_1.AccessErrorSchema; } });
|
|
45
|
-
Object.defineProperty(exports, "ECategory", { enumerable: true, get: function () { return shared_1.ECategory; } });
|
|
46
53
|
Object.defineProperty(exports, "EEnvironment", { enumerable: true, get: function () { return shared_1.EEnvironment; } });
|
|
47
54
|
Object.defineProperty(exports, "EStakeType", { enumerable: true, get: function () { return shared_1.EStakeType; } });
|
|
48
|
-
Object.defineProperty(exports, "EVolatility", { enumerable: true, get: function () { return shared_1.EVolatility; } });
|
|
49
55
|
Object.defineProperty(exports, "HeadersSchema", { enumerable: true, get: function () { return shared_1.HeadersSchema; } });
|
|
50
56
|
Object.defineProperty(exports, "InternalErrorSchema", { enumerable: true, get: function () { return shared_1.InternalErrorSchema; } });
|
|
57
|
+
Object.defineProperty(exports, "MetaSchema", { enumerable: true, get: function () { return shared_1.MetaSchema; } });
|
|
51
58
|
Object.defineProperty(exports, "RequestErrorSchema", { enumerable: true, get: function () { return shared_1.RequestErrorSchema; } });
|
|
52
59
|
Object.defineProperty(exports, "StakeModeSchema", { enumerable: true, get: function () { return shared_1.StakeModeSchema; } });
|
|
53
60
|
Object.defineProperty(exports, "StakeSchema", { enumerable: true, get: function () { return shared_1.StakeSchema; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAsD;AAA7C,2HAAA,OAAO,OAAe;AAC/B,yDAIgC;AAH5B,8GAAA,aAAa,OAAA;AACb,mHAAA,kBAAkB,OAAA;AAGtB,mDAAwD;AAA/C,oGAAA,MAAM,OAAA;AAAE,uGAAA,SAAS,OAAA;AAC1B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAsD;AAA7C,2HAAA,OAAO,OAAe;AAC/B,yDAIgC;AAH5B,8GAAA,aAAa,OAAA;AACb,mHAAA,kBAAkB,OAAA;AAGtB,mDAAwD;AAA/C,oGAAA,MAAM,OAAA;AAAE,uGAAA,SAAS,OAAA;AAC1B,yDAGgC;AAF5B,2GAAA,UAAU,OAAA;AAGd,2DAOiC;AAJ7B,gHAAA,cAAc,OAAA;AACd,2GAAA,SAAS,OAAA;AACT,gHAAA,cAAc,OAAA;AACd,+GAAA,aAAa,OAAA;AAEjB,6DAKkC;AAF9B,iHAAA,cAAc,OAAA;AACd,2GAAA,QAAQ,OAAA;AAEZ,yDAA+D;AAAtD,uGAAA,MAAM,OAAA;AAAE,8GAAA,aAAa,OAAA;AAC9B,uDAAwE;AAA/D,mGAAA,GAAG,OAAA;AAAE,0GAAA,UAAU,OAAA;AAAE,8GAAA,cAAc,OAAA;AACxC,yDAAuE;AAA9D,4GAAA,WAAW,OAAA;AAAE,uGAAA,MAAM,OAAA;AAAE,yGAAA,QAAQ,OAAA;AAEtC,6DAKkC;AAJ9B,sHAAA,mBAAmB,OAAA;AACnB,wHAAA,qBAAqB,OAAA;AAIzB,yDAKgC;AAJ5B,kHAAA,iBAAiB,OAAA;AACjB,oHAAA,mBAAmB,OAAA;AAIvB,yDAKgC;AAJ5B,kHAAA,iBAAiB,OAAA;AACjB,oHAAA,mBAAmB,OAAA;AAIvB,mEAKqC;AAJjC,4HAAA,sBAAsB,OAAA;AACtB,8HAAA,wBAAwB,OAAA;AAI5B,qDAK8B;AAJ1B,8GAAA,eAAe,OAAA;AACf,gHAAA,iBAAiB,OAAA;AAIrB,2CAiByB;AAhBrB,2GAAA,iBAAiB,OAAA;AACjB,sGAAA,YAAY,OAAA;AACZ,oGAAA,UAAU,OAAA;AACV,uGAAA,aAAa,OAAA;AACb,6GAAA,mBAAmB,OAAA;AACnB,oGAAA,UAAU,OAAA;AACV,4GAAA,kBAAkB,OAAA;AAClB,yGAAA,eAAe,OAAA;AACf,qGAAA,WAAW,OAAA;AASf,6DAKkC;AAJ9B,sHAAA,mBAAmB,OAAA;AACnB,wHAAA,qBAAqB,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"404.plugin.d.ts","sourceRoot":"","sources":["../../plugins/404.plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"404.plugin.d.ts","sourceRoot":"","sources":["../../plugins/404.plugin.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,cAAc,gFAIlB,CAAA;AAEF,eAAe,cAAc,CAAA"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const errors_helper_1 = require("../helpers/errors.helper");
|
|
3
4
|
const fastify_helper_1 = require("../helpers/fastify.helper");
|
|
4
5
|
const notFoundPlugin = (0, fastify_helper_1.registerPlugin)(async (fastify) => {
|
|
5
6
|
fastify.setNotFoundHandler((request) => {
|
|
6
|
-
throw (0, fastify_helper_1.httpError)(`Route "${request.url}" is not found`, 404);
|
|
7
|
+
throw (0, fastify_helper_1.httpError)(`Route "${request.url}" is not found`, 404, errors_helper_1.EErrorCode.NotFound);
|
|
7
8
|
});
|
|
8
9
|
});
|
|
9
10
|
exports.default = notFoundPlugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"404.plugin.js","sourceRoot":"","sources":["../../plugins/404.plugin.ts"],"names":[],"mappings":";;AAAA,8DAAqE;AAErE,MAAM,cAAc,GAAG,IAAA,+BAAc,EAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IACpD,OAAO,CAAC,kBAAkB,CAAC,CAAC,OAAO,EAAE,EAAE;QACnC,MAAM,IAAA,0BAAS,EAAC,UAAU,OAAO,CAAC,GAAG,gBAAgB,EAAE,GAAG,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"404.plugin.js","sourceRoot":"","sources":["../../plugins/404.plugin.ts"],"names":[],"mappings":";;AAAA,4DAAqD;AACrD,8DAAqE;AAErE,MAAM,cAAc,GAAG,IAAA,+BAAc,EAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IACpD,OAAO,CAAC,kBAAkB,CAAC,CAAC,OAAO,EAAE,EAAE;QACnC,MAAM,IAAA,0BAAS,EAAC,UAAU,OAAO,CAAC,GAAG,gBAAgB,EAAE,GAAG,EAAE,0BAAU,CAAC,QAAQ,CAAC,CAAA;IACpF,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA;AAEF,kBAAe,cAAc,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apikey.plugin.d.ts","sourceRoot":"","sources":["../../plugins/apikey.plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apikey.plugin.d.ts","sourceRoot":"","sources":["../../plugins/apikey.plugin.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,YAAY,gFAWhB,CAAA;AAEF,eAAe,YAAY,CAAA"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const env_helper_1 = require("../helpers/env.helper");
|
|
4
|
+
const errors_helper_1 = require("../helpers/errors.helper");
|
|
4
5
|
const fastify_helper_1 = require("../helpers/fastify.helper");
|
|
5
6
|
const apikeyPlugin = (0, fastify_helper_1.registerPlugin)(async (fastify) => {
|
|
6
|
-
fastify.addHook('preHandler', (request,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
throw (0, fastify_helper_1.httpError)('API_KEY doesn\'t match', 403);
|
|
12
|
-
}
|
|
7
|
+
fastify.addHook('preHandler', (request, _reply, done) => {
|
|
8
|
+
const currentKey = request.headers[(0, env_helper_1.getenv)('API_HEADER', 'x-api-key')];
|
|
9
|
+
const expectedKey = (0, env_helper_1.getenv)('API_KEY', 'test');
|
|
10
|
+
if (currentKey !== expectedKey) {
|
|
11
|
+
throw (0, fastify_helper_1.httpError)("API_KEY doesn't match", 403, errors_helper_1.EErrorCode.ApiKey);
|
|
13
12
|
}
|
|
14
13
|
done();
|
|
15
14
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apikey.plugin.js","sourceRoot":"","sources":["../../plugins/apikey.plugin.ts"],"names":[],"mappings":";;AAAA,sDAA8C;AAC9C,8DAAqE;AAErE,MAAM,YAAY,GAAG,IAAA,+BAAc,EAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IAClD,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"apikey.plugin.js","sourceRoot":"","sources":["../../plugins/apikey.plugin.ts"],"names":[],"mappings":";;AAAA,sDAA8C;AAC9C,4DAAqD;AACrD,8DAAqE;AAErE,MAAM,YAAY,GAAG,IAAA,+BAAc,EAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IAClD,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;QACpD,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,IAAA,mBAAM,EAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAA;QACrE,MAAM,WAAW,GAAG,IAAA,mBAAM,EAAC,SAAS,EAAE,MAAM,CAAC,CAAA;QAE7C,IAAI,UAAU,KAAK,WAAW,EAAE,CAAC;YAC7B,MAAM,IAAA,0BAAS,EAAC,uBAAuB,EAAE,GAAG,EAAE,0BAAU,CAAC,MAAM,CAAC,CAAA;QACpE,CAAC;QAED,IAAI,EAAE,CAAA;IACV,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA;AAEF,kBAAe,YAAY,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.plugin.d.ts","sourceRoot":"","sources":["../../plugins/error.plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"error.plugin.d.ts","sourceRoot":"","sources":["../../plugins/error.plugin.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,WAAW,gFAkBf,CAAA;AAEF,eAAe,WAAW,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const fastify_helper_1 = require("../helpers/fastify.helper");
|
|
4
|
+
const errors_helper_1 = require("../helpers/errors.helper");
|
|
4
5
|
const errorPlugin = (0, fastify_helper_1.registerPlugin)(async (fastify) => {
|
|
5
6
|
fastify.setErrorHandler((error, request, reply) => {
|
|
6
7
|
fastify.Sentry?.captureException(error);
|
|
@@ -8,8 +9,11 @@ const errorPlugin = (0, fastify_helper_1.registerPlugin)(async (fastify) => {
|
|
|
8
9
|
reqId: request.id,
|
|
9
10
|
err: error,
|
|
10
11
|
});
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
const statusCode = error.statusCode ?? 500;
|
|
13
|
+
const code = error.errorCode ?? (statusCode >= 500 ? errors_helper_1.EErrorCode.Unhandled : errors_helper_1.EErrorCode.ValidationBody);
|
|
14
|
+
reply.status(statusCode).send({
|
|
15
|
+
status: false,
|
|
16
|
+
code,
|
|
13
17
|
message: error.message,
|
|
14
18
|
});
|
|
15
19
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.plugin.js","sourceRoot":"","sources":["../../plugins/error.plugin.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"error.plugin.js","sourceRoot":"","sources":["../../plugins/error.plugin.ts"],"names":[],"mappings":";;AAAA,8DAA8E;AAC9E,4DAAqD;AAErD,MAAM,WAAW,GAAG,IAAA,+BAAc,EAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IACjD,OAAO,CAAC,eAAe,CAAqB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;QAClE,OAAO,CAAC,MAAM,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAA;QAEvC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;YACd,KAAK,EAAE,OAAO,CAAC,EAAE;YACjB,GAAG,EAAE,KAAK;SACb,CAAC,CAAA;QAEF,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,IAAI,GAAG,CAAA;QAC1C,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,IAAI,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC,0BAAU,CAAC,SAAS,CAAC,CAAC,CAAC,0BAAU,CAAC,cAAc,CAAC,CAAA;QAEtG,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;YAC1B,MAAM,EAAE,KAAK;YACb,IAAI;YACJ,OAAO,EAAE,KAAK,CAAC,OAAO;SACzB,CAAC,CAAA;IACN,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA;AAEF,kBAAe,WAAW,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentry.plugin.d.ts","sourceRoot":"","sources":["../../plugins/sentry.plugin.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"sentry.plugin.d.ts","sourceRoot":"","sources":["../../plugins/sentry.plugin.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,YAAY,gFAahB,CAAA;AAEF,eAAe,YAAY,CAAA"}
|
|
@@ -16,8 +16,7 @@ const sentryPlugin = (0, fastify_helper_1.registerPlugin)(async (fastify) => {
|
|
|
16
16
|
setErrorHandler: false,
|
|
17
17
|
});
|
|
18
18
|
fastify.addHook('onReady', () => {
|
|
19
|
-
fastify.Sentry.setTag('game.
|
|
20
|
-
fastify.Sentry.setTag('game.id', (0, env_helper_1.getenv)('GAME_ID', '0001'));
|
|
19
|
+
fastify.Sentry.setTag('game.id', gameConfig.gameId);
|
|
21
20
|
});
|
|
22
21
|
});
|
|
23
22
|
exports.default = sentryPlugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentry.plugin.js","sourceRoot":"","sources":["../../plugins/sentry.plugin.ts"],"names":[],"mappings":";;;;;AAAA,qFAA2D;AAE3D,4DAAwD;AACxD,sDAAyD;AACzD,8DAA0D;AAE1D,MAAM,YAAY,GAAG,IAAA,+BAAc,EAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IAClD,MAAM,UAAU,GAAG,IAAA,6BAAa,GAAE,CAAA;IAElC,OAAO,CAAC,QAAQ,CAAC,wBAAa,EAAE;QAC5B,GAAG,EAAE,IAAA,mBAAM,EAAC,YAAY,EAAE,SAAS,CAAC;QACpC,WAAW,EAAE,IAAA,sBAAS,EAAC,aAAa,EAAE,SAAS,EAAE,YAAY,CAAC;QAC9D,gBAAgB,EAAE,UAAU,CAAC,IAAA,mBAAM,EAAC,aAAa,EAAE,MAAM,CAAC,CAAC,EAAE,gBAAgB;QAC7E,eAAe,EAAE,KAAK;KACzB,CAAC,CAAA;IAEF,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE;QAC5B,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"sentry.plugin.js","sourceRoot":"","sources":["../../plugins/sentry.plugin.ts"],"names":[],"mappings":";;;;;AAAA,qFAA2D;AAE3D,4DAAwD;AACxD,sDAAyD;AACzD,8DAA0D;AAE1D,MAAM,YAAY,GAAG,IAAA,+BAAc,EAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IAClD,MAAM,UAAU,GAAG,IAAA,6BAAa,GAAE,CAAA;IAElC,OAAO,CAAC,QAAQ,CAAC,wBAAa,EAAE;QAC5B,GAAG,EAAE,IAAA,mBAAM,EAAC,YAAY,EAAE,SAAS,CAAC;QACpC,WAAW,EAAE,IAAA,sBAAS,EAAC,aAAa,EAAE,SAAS,EAAE,YAAY,CAAC;QAC9D,gBAAgB,EAAE,UAAU,CAAC,IAAA,mBAAM,EAAC,aAAa,EAAE,MAAM,CAAC,CAAC,EAAE,gBAAgB;QAC7E,eAAe,EAAE,KAAK;KACzB,CAAC,CAAA;IAEF,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE;QAC5B,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,CAAA;IACvD,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA;AAEF,kBAAe,YAAY,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swagger.plugin.d.ts","sourceRoot":"","sources":["../../plugins/swagger.plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"swagger.plugin.d.ts","sourceRoot":"","sources":["../../plugins/swagger.plugin.ts"],"names":[],"mappings":"AAgBA,QAAA,MAAM,aAAa,gFA8CjB,CAAA;AAEF,eAAe,aAAa,CAAA"}
|
|
@@ -9,6 +9,7 @@ const config_helper_1 = require("../helpers/config.helper");
|
|
|
9
9
|
const env_helper_1 = require("../helpers/env.helper");
|
|
10
10
|
const fastify_helper_1 = require("../helpers/fastify.helper");
|
|
11
11
|
const pkg_version_helper_1 = require("../helpers/pkg-version.helper");
|
|
12
|
+
const checksum_schema_1 = require("../schemas/checksum.schema");
|
|
12
13
|
const client_schema_1 = require("../schemas/client.schema");
|
|
13
14
|
const config_schema_1 = require("../schemas/config.schema");
|
|
14
15
|
const play_schema_1 = require("../schemas/play.schema");
|
|
@@ -37,11 +38,12 @@ const swaggerPlugin = (0, fastify_helper_1.registerPlugin)(async (fastify) => {
|
|
|
37
38
|
deepLinking: false,
|
|
38
39
|
},
|
|
39
40
|
theme: {
|
|
40
|
-
title: `Swagger - ${gameConfig.
|
|
41
|
+
title: `Swagger - ${gameConfig.gameId}`,
|
|
41
42
|
},
|
|
42
43
|
});
|
|
43
44
|
fastify.addSchema(shared_1.StakeSchema);
|
|
44
45
|
fastify.addSchema(shared_1.StakeModeSchema);
|
|
46
|
+
fastify.addSchema(shared_1.MetaSchema);
|
|
45
47
|
fastify.addSchema(shared_1.RequestErrorSchema);
|
|
46
48
|
fastify.addSchema(shared_1.AccessErrorSchema);
|
|
47
49
|
fastify.addSchema(shared_1.InternalErrorSchema);
|
|
@@ -53,6 +55,8 @@ const swaggerPlugin = (0, fastify_helper_1.registerPlugin)(async (fastify) => {
|
|
|
53
55
|
fastify.addSchema(config_schema_1.ConfigReplySchema);
|
|
54
56
|
fastify.addSchema(client_schema_1.ClientRequestSchema);
|
|
55
57
|
fastify.addSchema(client_schema_1.ClientReplySchema);
|
|
58
|
+
fastify.addSchema(checksum_schema_1.ChecksumRequestSchema);
|
|
59
|
+
fastify.addSchema(checksum_schema_1.ChecksumReplySchema);
|
|
56
60
|
});
|
|
57
61
|
exports.default = swaggerPlugin;
|
|
58
62
|
//# sourceMappingURL=swagger.plugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swagger.plugin.js","sourceRoot":"","sources":["../../plugins/swagger.plugin.ts"],"names":[],"mappings":";;;;;AAAA,+DAA6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AC,CAAA;IACtC,OAAO,CAAC,SAAS,CAAC,mCAAmB,CAAC,CAAA;IACtC,OAAO,CAAC,SAAS,CAAC,iCAAiB,CAAC,CAAA;IACpC,OAAO,CAAC,SAAS,CAAC,mCAAmB,CAAC,CAAA;IACtC,OAAO,CAAC,SAAS,CAAC,iCAAiB,CAAC,CAAA;IACpC,OAAO,CAAC,SAAS,CAAC,uCAAqB,CAAC,CAAA;IACxC,OAAO,CAAC,SAAS,CAAC,qCAAmB,CAAC,CAAA;AAC1C,CAAC,CAAC,CAAA;AAEF,kBAAe,aAAa,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checksum.route.d.ts","sourceRoot":"","sources":["../../../routes/checksum/checksum.route.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,qBAAqB,mFAYzB,CAAA;AAEF,eAAe,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const fastify_helper_1 = require("../../helpers/fastify.helper");
|
|
4
|
+
const handlers_helper_1 = require("../../helpers/handlers.helper");
|
|
5
|
+
const checksum_schema_1 = require("../../schemas/checksum.schema");
|
|
6
|
+
const shared_1 = require("../../schemas/shared");
|
|
7
|
+
const checksumRouteOriginal = (0, fastify_helper_1.registerRoute)(async (fastify) => {
|
|
8
|
+
fastify.get('/checksum', {
|
|
9
|
+
schema: {
|
|
10
|
+
response: {
|
|
11
|
+
200: checksum_schema_1.ChecksumReplySchema,
|
|
12
|
+
400: shared_1.RequestErrorSchema,
|
|
13
|
+
403: shared_1.AccessErrorSchema,
|
|
14
|
+
500: shared_1.InternalErrorSchema,
|
|
15
|
+
},
|
|
16
|
+
headers: shared_1.HeadersSchema,
|
|
17
|
+
},
|
|
18
|
+
}, async (request, reply) => handlers_helper_1.handlers.get('checksum').bind(fastify)(request, reply));
|
|
19
|
+
});
|
|
20
|
+
exports.default = checksumRouteOriginal;
|
|
21
|
+
//# sourceMappingURL=checksum.route.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checksum.route.js","sourceRoot":"","sources":["../../../routes/checksum/checksum.route.ts"],"names":[],"mappings":";;AAAA,iEAA4D;AAC5D,mEAAwD;AACxD,mEAAmE;AACnE,iDAE6B;AAE7B,MAAM,qBAAqB,GAAG,IAAA,8BAAa,EAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IAC1D,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE;QACrB,MAAM,EAAE;YACJ,QAAQ,EAAE;gBACN,GAAG,EAAE,qCAAmB;gBACxB,GAAG,EAAE,2BAAkB;gBACvB,GAAG,EAAE,0BAAiB;gBACtB,GAAG,EAAE,4BAAmB;aAC3B;YACD,OAAO,EAAE,sBAAa;SACzB;KACJ,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,0BAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;AACxF,CAAC,CAAC,CAAA;AAEF,kBAAe,qBAAqB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../routes/checksum/index.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,aAAa,mFAEjB,CAAA;AAEF,eAAe,aAAa,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const fastify_helper_1 = require("../../helpers/fastify.helper");
|
|
7
|
+
const checksum_route_1 = __importDefault(require("./checksum.route"));
|
|
8
|
+
const checksumRoute = (0, fastify_helper_1.registerRoute)(async (fastify) => {
|
|
9
|
+
fastify.register(checksum_route_1.default);
|
|
10
|
+
});
|
|
11
|
+
exports.default = checksumRoute;
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../routes/checksum/index.ts"],"names":[],"mappings":";;;;;AAAA,iEAA4D;AAC5D,sEAAoD;AAEpD,MAAM,aAAa,GAAG,IAAA,8BAAa,EAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IAClD,OAAO,CAAC,QAAQ,CAAC,wBAAqB,CAAC,CAAA;AAC3C,CAAC,CAAC,CAAA;AAEF,kBAAe,aAAa,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.route.d.ts","sourceRoot":"","sources":["../../../routes/client/client.route.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,WAAW,mFAYf,CAAA;AAEF,eAAe,WAAW,CAAA"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const fastify_helper_1 = require("
|
|
4
|
-
const handlers_helper_1 = require("
|
|
5
|
-
const client_schema_1 = require("
|
|
6
|
-
const shared_1 = require("
|
|
3
|
+
const fastify_helper_1 = require("../../helpers/fastify.helper");
|
|
4
|
+
const handlers_helper_1 = require("../../helpers/handlers.helper");
|
|
5
|
+
const client_schema_1 = require("../../schemas/client.schema");
|
|
6
|
+
const shared_1 = require("../../schemas/shared");
|
|
7
7
|
const clientRoute = (0, fastify_helper_1.registerRoute)(async (fastify) => {
|
|
8
|
-
fastify.
|
|
8
|
+
fastify.get('/client', {
|
|
9
9
|
schema: {
|
|
10
10
|
response: {
|
|
11
11
|
200: client_schema_1.ClientReplySchema,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.route.js","sourceRoot":"","sources":["../../../routes/client/client.route.ts"],"names":[],"mappings":";;AAAA,iEAA4D;AAC5D,mEAAwD;AACxD,+DAA+D;AAC/D,iDAE6B;AAE7B,MAAM,WAAW,GAAG,IAAA,8BAAa,EAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IAChD,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE;QACnB,MAAM,EAAE;YACJ,QAAQ,EAAE;gBACN,GAAG,EAAE,iCAAiB;gBACtB,GAAG,EAAE,2BAAkB;gBACvB,GAAG,EAAE,0BAAiB;gBACtB,GAAG,EAAE,4BAAmB;aAC3B;YACD,OAAO,EAAE,sBAAa;SACzB;KACJ,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,0BAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;AACtF,CAAC,CAAC,CAAA;AAEF,kBAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../routes/client/index.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,WAAW,mFAEf,CAAA;AAEF,eAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const fastify_helper_1 = require("../../helpers/fastify.helper");
|
|
7
|
+
const client_route_1 = __importDefault(require("./client.route"));
|
|
8
|
+
const clientRoute = (0, fastify_helper_1.registerRoute)(async (fastify) => {
|
|
9
|
+
fastify.register(client_route_1.default);
|
|
10
|
+
});
|
|
11
|
+
exports.default = clientRoute;
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../routes/client/index.ts"],"names":[],"mappings":";;;;;AAAA,iEAA4D;AAC5D,kEAAgD;AAEhD,MAAM,WAAW,GAAG,IAAA,8BAAa,EAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IAChD,OAAO,CAAC,QAAQ,CAAC,sBAAmB,CAAC,CAAA;AACzC,CAAC,CAAC,CAAA;AAEF,kBAAe,WAAW,CAAA"}
|
|
@@ -5,7 +5,7 @@ const handlers_helper_1 = require("../../helpers/handlers.helper");
|
|
|
5
5
|
const config_schema_1 = require("../../schemas/config.schema");
|
|
6
6
|
const shared_1 = require("../../schemas/shared");
|
|
7
7
|
const configRouteOriginal = (0, fastify_helper_1.registerRoute)(async (fastify) => {
|
|
8
|
-
fastify.
|
|
8
|
+
fastify.get('/config', {
|
|
9
9
|
schema: {
|
|
10
10
|
response: {
|
|
11
11
|
200: config_schema_1.ConfigReplySchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.route.js","sourceRoot":"","sources":["../../../routes/config/config.route.ts"],"names":[],"mappings":";;AAAA,iEAA4D;AAC5D,mEAAwD;AACxD,+DAA+D;AAC/D,iDAE6B;AAE7B,MAAM,mBAAmB,GAAG,IAAA,8BAAa,EAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IACxD,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"config.route.js","sourceRoot":"","sources":["../../../routes/config/config.route.ts"],"names":[],"mappings":";;AAAA,iEAA4D;AAC5D,mEAAwD;AACxD,+DAA+D;AAC/D,iDAE6B;AAE7B,MAAM,mBAAmB,GAAG,IAAA,8BAAa,EAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IACxD,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE;QACnB,MAAM,EAAE;YACJ,QAAQ,EAAE;gBACN,GAAG,EAAE,iCAAiB;gBACtB,GAAG,EAAE,2BAAkB;gBACvB,GAAG,EAAE,0BAAiB;gBACtB,GAAG,EAAE,4BAAmB;aAC3B;YACD,OAAO,EAAE,sBAAa;SACzB;KACJ,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,0BAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;AACtF,CAAC,CAAC,CAAA;AAEF,kBAAe,mBAAmB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.route.validate.plugin.d.ts","sourceRoot":"","sources":["../../../routes/config/config.route.validate.plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.route.validate.plugin.d.ts","sourceRoot":"","sources":["../../../routes/config/config.route.validate.plugin.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,yBAAyB,mFAuE7B,CAAA;AAEF,eAAe,yBAAyB,CAAA"}
|
|
@@ -1,38 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const config_helper_1 = require("../../helpers/config.helper");
|
|
4
|
+
const errors_helper_1 = require("../../helpers/errors.helper");
|
|
4
5
|
const fastify_helper_1 = require("../../helpers/fastify.helper");
|
|
5
|
-
const shared_1 = require("../../schemas/shared");
|
|
6
6
|
const configRouteValidatePlugin = (0, fastify_helper_1.registerPlugin)(async (fastify) => {
|
|
7
7
|
const gameConfig = (0, config_helper_1.getGameConfig)();
|
|
8
|
-
fastify.addHook('preSerialization', (
|
|
9
|
-
if (payload?.
|
|
8
|
+
fastify.addHook('preSerialization', (request, _reply, payload, done) => {
|
|
9
|
+
if (payload?.gameId) {
|
|
10
10
|
try {
|
|
11
11
|
payload.stakeModes.forEach((stakeMode) => {
|
|
12
|
-
if (!gameConfig.hasBuy
|
|
13
|
-
&& ([shared_1.EStakeType.buy, shared_1.EStakeType.bonusBet].includes(stakeMode.type))) {
|
|
14
|
-
throw new Error(`Game doesn't support buyable stake modes ("${stakeMode.name}")`);
|
|
15
|
-
}
|
|
16
12
|
if (stakeMode.multiple && stakeMode.maxQty === undefined) {
|
|
17
|
-
throw new Error(`Property "maxQty" should be defined for the stake mode
|
|
13
|
+
throw new Error(`Property "maxQty" should be defined for the multiple stake mode "${stakeMode.name}"`);
|
|
18
14
|
}
|
|
19
15
|
if (!stakeMode.multiple && stakeMode.maxQty !== undefined) {
|
|
20
|
-
throw new Error(`Stake mode
|
|
16
|
+
throw new Error(`Stake mode "${stakeMode.name}" should be multiple to define "maxQty"`);
|
|
21
17
|
}
|
|
22
18
|
});
|
|
23
|
-
if (payload.
|
|
24
|
-
throw new Error('
|
|
19
|
+
if (payload.hasChoice && !payload.hasMeta) {
|
|
20
|
+
throw new Error('hasChoice=true requires hasMeta=true');
|
|
21
|
+
}
|
|
22
|
+
if (payload.hasMultiStake && payload.freeroundsAllowed !== false) {
|
|
23
|
+
throw new Error('freeroundsAllowed must be false when hasMultiStake=true');
|
|
24
|
+
}
|
|
25
|
+
if (payload.hasMultiStake && payload.hasValidate !== true) {
|
|
26
|
+
throw new Error('hasValidate must be true when hasMultiStake=true');
|
|
27
|
+
}
|
|
28
|
+
if (payload.hasVariableLevels) {
|
|
29
|
+
if (!Array.isArray(payload.variableLevels) || payload.variableLevels.length === 0) {
|
|
30
|
+
throw new Error('variableLevels must be a non-empty array when hasVariableLevels=true');
|
|
31
|
+
}
|
|
32
|
+
if (payload.defaultLevel === undefined || !payload.variableLevels.includes(payload.defaultLevel)) {
|
|
33
|
+
throw new Error('defaultLevel must be one of variableLevels when hasVariableLevels=true');
|
|
34
|
+
}
|
|
35
|
+
if (payload.coinRatio !== undefined) {
|
|
36
|
+
throw new Error('coinRatio must not be set when hasVariableLevels=true');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
if (payload.coinRatio === undefined) {
|
|
41
|
+
throw new Error('coinRatio is required when hasVariableLevels=false');
|
|
42
|
+
}
|
|
43
|
+
if (payload.variableLevels !== undefined || payload.defaultLevel !== undefined) {
|
|
44
|
+
throw new Error('variableLevels/defaultLevel must not be set when hasVariableLevels=false');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (payload.gameId !== gameConfig.gameId) {
|
|
48
|
+
throw new Error('gameId in reply must match gameConfig.gameId');
|
|
49
|
+
}
|
|
50
|
+
// For single-RTP deployments gameConfig.rtpVersion is set and must match.
|
|
51
|
+
// Multi-RTP deployments omit it and rely on the path segment check below.
|
|
52
|
+
if (gameConfig.rtpVersion !== undefined && payload.rtpVersion !== gameConfig.rtpVersion) {
|
|
53
|
+
throw new Error(`rtpVersion in reply ("${payload.rtpVersion}") must match gameConfig.rtpVersion ("${gameConfig.rtpVersion}")`);
|
|
25
54
|
}
|
|
26
|
-
|
|
27
|
-
|
|
55
|
+
const pathParams = request.params;
|
|
56
|
+
if (pathParams?.rtpVersion !== undefined && payload.rtpVersion !== pathParams.rtpVersion) {
|
|
57
|
+
throw new Error(`rtpVersion in reply ("${payload.rtpVersion}") must match the {rtpVersion} path segment ("${pathParams.rtpVersion}")`);
|
|
28
58
|
}
|
|
29
|
-
if (
|
|
30
|
-
|| (payload.variableLevels !== gameConfig.variableLevels)
|
|
31
|
-
|
|
59
|
+
if (payload.coinRatio !== gameConfig.coinRatio
|
|
60
|
+
|| JSON.stringify(payload.variableLevels) !== JSON.stringify(gameConfig.variableLevels)
|
|
61
|
+
|| payload.defaultLevel !== gameConfig.defaultLevel) {
|
|
62
|
+
throw new Error('coinRatio / variableLevels / defaultLevel must be equal in gameConfig and in the handler');
|
|
32
63
|
}
|
|
33
64
|
}
|
|
34
65
|
catch (error) {
|
|
35
|
-
throw (0, fastify_helper_1.httpError)(`Advanced validation failed: ${error.message}`, 500);
|
|
66
|
+
throw (0, fastify_helper_1.httpError)(`Advanced validation failed: ${error.message}`, 500, errors_helper_1.EErrorCode.ValidationConfig);
|
|
36
67
|
}
|
|
37
68
|
}
|
|
38
69
|
done(null, payload);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.route.validate.plugin.js","sourceRoot":"","sources":["../../../routes/config/config.route.validate.plugin.ts"],"names":[],"mappings":";;AAAA,+DAA2D;AAC3D,iEAAwE;
|
|
1
|
+
{"version":3,"file":"config.route.validate.plugin.js","sourceRoot":"","sources":["../../../routes/config/config.route.validate.plugin.ts"],"names":[],"mappings":";;AAAA,+DAA2D;AAC3D,+DAAwD;AACxD,iEAAwE;AAIxE,MAAM,yBAAyB,GAAG,IAAA,+BAAc,EAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IAC/D,MAAM,UAAU,GAAG,IAAA,6BAAa,GAAE,CAAA;IAElC,OAAO,CAAC,OAAO,CAAe,kBAAkB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACjF,IAAI,OAAO,EAAE,MAAM,EAAE,CAAC;YAClB,IAAI,CAAC;gBACD,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;oBACrC,IAAI,SAAS,CAAC,QAAQ,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;wBACvD,MAAM,IAAI,KAAK,CAAC,oEAAoE,SAAS,CAAC,IAAI,GAAG,CAAC,CAAA;oBAC1G,CAAC;oBACD,IAAI,CAAC,SAAS,CAAC,QAAQ,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;wBACxD,MAAM,IAAI,KAAK,CAAC,eAAe,SAAS,CAAC,IAAI,yCAAyC,CAAC,CAAA;oBAC3F,CAAC;gBACL,CAAC,CAAC,CAAA;gBAEF,IAAI,OAAO,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;oBACxC,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAA;gBAC3D,CAAC;gBAED,IAAI,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,iBAAiB,KAAK,KAAK,EAAE,CAAC;oB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