@truelab/trueserver 0.0.3 → 0.0.6
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 +33 -0
- package/MIGRATION.md +303 -0
- package/README.md +96 -98
- 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 +7 -0
- package/dist/examples.d.ts.map +1 -0
- package/dist/examples.js +18 -0
- package/dist/examples.js.map +1 -0
- package/dist/helpers/config.helper.d.ts +4 -1
- package/dist/helpers/config.helper.d.ts.map +1 -1
- package/dist/helpers/config.helper.js +26 -0
- package/dist/helpers/config.helper.js.map +1 -1
- package/dist/helpers/errors.helper.d.ts +18 -0
- package/dist/helpers/errors.helper.d.ts.map +1 -0
- package/dist/helpers/errors.helper.js +20 -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/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -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.js +2 -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 +43 -17
- package/dist/routes/config/config.route.validate.plugin.js.map +1 -1
- package/dist/routes/play/play.route.validate.plugin.d.ts +9 -9
- package/dist/routes/play/play.route.validate.plugin.d.ts.map +1 -1
- package/dist/routes/play/play.route.validate.plugin.js +84 -40
- 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 +9 -3
- 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 +41 -42
- 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 +30 -34
- 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 +66 -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 +1 -3
- 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 +21 -16
- package/dist/schemas/play.schema.d.ts.map +1 -1
- package/dist/schemas/play.schema.js +36 -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 +2 -3
- package/dist/schemas/validate.schema.d.ts.map +1 -1
- package/dist/schemas/validate.schema.js +2 -5
- package/dist/schemas/validate.schema.js.map +1 -1
- package/package.json +10 -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
package/dist/application.js
CHANGED
|
@@ -22,16 +22,20 @@ class Application {
|
|
|
22
22
|
}).withTypeProvider();
|
|
23
23
|
}
|
|
24
24
|
async build() {
|
|
25
|
-
// Load plugins
|
|
26
25
|
await this.server.register(autoload_1.default, {
|
|
27
26
|
dir: path_1.default.join(__dirname, 'plugins'),
|
|
28
27
|
});
|
|
29
|
-
|
|
28
|
+
const prefix = (0, fastify_helper_1.getRoutePrefix)();
|
|
29
|
+
// Version-agnostic routes (healthcheck)
|
|
30
|
+
await this.server.register(autoload_1.default, {
|
|
31
|
+
dir: path_1.default.join(__dirname, 'routes-public'),
|
|
32
|
+
options: { prefix },
|
|
33
|
+
dirNameRoutePrefix: false,
|
|
34
|
+
});
|
|
35
|
+
// Version-scoped routes (config, client, play, validate, checksum)
|
|
30
36
|
await this.server.register(autoload_1.default, {
|
|
31
37
|
dir: path_1.default.join(__dirname, 'routes'),
|
|
32
|
-
options: {
|
|
33
|
-
prefix: (0, fastify_helper_1.getRoutePrefix)(),
|
|
34
|
-
},
|
|
38
|
+
options: { prefix: `${prefix}/:rtpVersion` },
|
|
35
39
|
dirNameRoutePrefix: false,
|
|
36
40
|
});
|
|
37
41
|
return this.server;
|
package/dist/application.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.js","sourceRoot":"","sources":["../application.ts"],"names":[],"mappings":";;;;;AAAA,iEAA+C;AAE/C,sDAA6B;AAC7B,gDAAuB;AAEvB,6DAAyE;AACzE,2DAAuD;AAEvD,MAAqB,WAAW;IAC5B,MAAM,CAAgB;IAEtB;QACI,IAAI,CAAC,MAAM,GAAG,IAAA,iBAAO,EAAC;YAClB,GAAG,EAAE;gBACD,aAAa,EAAE;oBACX,QAAQ,EAAE,CAAC,YAAY,CAAC;iBAC3B;aACJ;YACD,MAAM,EAAE,6BAAa;YACrB,qBAAqB,EAAE,IAAI;SAC9B,CAAC,CAAC,gBAAgB,EAAuB,CAAA;IAC9C,CAAC;IAED,KAAK,CAAC,KAAK;
|
|
1
|
+
{"version":3,"file":"application.js","sourceRoot":"","sources":["../application.ts"],"names":[],"mappings":";;;;;AAAA,iEAA+C;AAE/C,sDAA6B;AAC7B,gDAAuB;AAEvB,6DAAyE;AACzE,2DAAuD;AAEvD,MAAqB,WAAW;IAC5B,MAAM,CAAgB;IAEtB;QACI,IAAI,CAAC,MAAM,GAAG,IAAA,iBAAO,EAAC;YAClB,GAAG,EAAE;gBACD,aAAa,EAAE;oBACX,QAAQ,EAAE,CAAC,YAAY,CAAC;iBAC3B;aACJ;YACD,MAAM,EAAE,6BAAa;YACrB,qBAAqB,EAAE,IAAI;SAC9B,CAAC,CAAC,gBAAgB,EAAuB,CAAA;IAC9C,CAAC;IAED,KAAK,CAAC,KAAK;QACP,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAe,EAAE;YACxC,GAAG,EAAE,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC;SACvC,CAAC,CAAA;QAEF,MAAM,MAAM,GAAG,IAAA,+BAAc,GAAE,CAAA;QAE/B,wCAAwC;QACxC,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAe,EAAE;YACxC,GAAG,EAAE,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC;YAC1C,OAAO,EAAE,EAAE,MAAM,EAAE;YACnB,kBAAkB,EAAE,KAAK;SAC5B,CAAC,CAAA;QAEF,mEAAmE;QACnE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAe,EAAE;YACxC,GAAG,EAAE,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC;YACnC,OAAO,EAAE,EAAE,MAAM,EAAE,GAAG,MAAM,cAAc,EAAE;YAC5C,kBAAkB,EAAE,KAAK;SAC5B,CAAC,CAAA;QAEF,OAAO,IAAI,CAAC,MAAM,CAAA;IACtB,CAAC;CACJ;AAtCD,8BAsCC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { checksumReplyExamples } from './schemas/examples/checksum.schema.examples';
|
|
2
|
+
export { clientReplyExamples } from './schemas/examples/client.schema.examples';
|
|
3
|
+
export { configReplyExamples } from './schemas/examples/config.schema.examples';
|
|
4
|
+
export { healthcheckReplyExamples } from './schemas/examples/healthcheck.schema.examples';
|
|
5
|
+
export { playReplyExamples, playRequestExamples, } from './schemas/examples/play.schema.examples';
|
|
6
|
+
export { validateReplyExamples, validateRequestExamples, } from './schemas/examples/validate.schema.examples';
|
|
7
|
+
//# sourceMappingURL=examples.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"examples.d.ts","sourceRoot":"","sources":["../examples.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAA;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAA;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAA;AACzF,OAAO,EACH,iBAAiB,EACjB,mBAAmB,GACtB,MAAM,yCAAyC,CAAA;AAChD,OAAO,EACH,qBAAqB,EACrB,uBAAuB,GAC1B,MAAM,6CAA6C,CAAA"}
|
package/dist/examples.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateRequestExamples = exports.validateReplyExamples = exports.playRequestExamples = exports.playReplyExamples = exports.healthcheckReplyExamples = exports.configReplyExamples = exports.clientReplyExamples = exports.checksumReplyExamples = void 0;
|
|
4
|
+
var checksum_schema_examples_1 = require("./schemas/examples/checksum.schema.examples");
|
|
5
|
+
Object.defineProperty(exports, "checksumReplyExamples", { enumerable: true, get: function () { return checksum_schema_examples_1.checksumReplyExamples; } });
|
|
6
|
+
var client_schema_examples_1 = require("./schemas/examples/client.schema.examples");
|
|
7
|
+
Object.defineProperty(exports, "clientReplyExamples", { enumerable: true, get: function () { return client_schema_examples_1.clientReplyExamples; } });
|
|
8
|
+
var config_schema_examples_1 = require("./schemas/examples/config.schema.examples");
|
|
9
|
+
Object.defineProperty(exports, "configReplyExamples", { enumerable: true, get: function () { return config_schema_examples_1.configReplyExamples; } });
|
|
10
|
+
var healthcheck_schema_examples_1 = require("./schemas/examples/healthcheck.schema.examples");
|
|
11
|
+
Object.defineProperty(exports, "healthcheckReplyExamples", { enumerable: true, get: function () { return healthcheck_schema_examples_1.healthcheckReplyExamples; } });
|
|
12
|
+
var play_schema_examples_1 = require("./schemas/examples/play.schema.examples");
|
|
13
|
+
Object.defineProperty(exports, "playReplyExamples", { enumerable: true, get: function () { return play_schema_examples_1.playReplyExamples; } });
|
|
14
|
+
Object.defineProperty(exports, "playRequestExamples", { enumerable: true, get: function () { return play_schema_examples_1.playRequestExamples; } });
|
|
15
|
+
var validate_schema_examples_1 = require("./schemas/examples/validate.schema.examples");
|
|
16
|
+
Object.defineProperty(exports, "validateReplyExamples", { enumerable: true, get: function () { return validate_schema_examples_1.validateReplyExamples; } });
|
|
17
|
+
Object.defineProperty(exports, "validateRequestExamples", { enumerable: true, get: function () { return validate_schema_examples_1.validateRequestExamples; } });
|
|
18
|
+
//# sourceMappingURL=examples.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"examples.js","sourceRoot":"","sources":["../examples.ts"],"names":[],"mappings":";;;AAAA,wFAAmF;AAA1E,iIAAA,qBAAqB,OAAA;AAC9B,oFAA+E;AAAtE,6HAAA,mBAAmB,OAAA;AAC5B,oFAA+E;AAAtE,6HAAA,mBAAmB,OAAA;AAC5B,8FAAyF;AAAhF,uIAAA,wBAAwB,OAAA;AACjC,gFAGgD;AAF5C,yHAAA,iBAAiB,OAAA;AACjB,2HAAA,mBAAmB,OAAA;AAEvB,wFAGoD;AAFhD,iIAAA,qBAAqB,OAAA;AACrB,mIAAA,uBAAuB,OAAA"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { TConfigReply } from '../schemas/config.schema';
|
|
2
|
-
export type TGameConfig = Pick<TConfigReply, '
|
|
2
|
+
export type TGameConfig = Pick<TConfigReply, 'gameId' | 'gameTitle' | 'rtpVersion' | 'stakeModes' | 'hasMeta' | 'hasChoice' | 'hasRestore' | 'hasMultiStake' | 'hasVariableLines' | 'variableLevels' | 'defaultLevel' | 'coinRatio'> & {
|
|
3
|
+
/** Kept for /validate endpoint (not part of GS Documentation spec) */
|
|
4
|
+
hasValidation?: boolean;
|
|
5
|
+
};
|
|
3
6
|
export declare function registerGameConfig(config: TGameConfig): void;
|
|
4
7
|
export declare function getGameConfig(): TGameConfig;
|
|
5
8
|
//# sourceMappingURL=config.helper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.helper.d.ts","sourceRoot":"","sources":["../../helpers/config.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"config.helper.d.ts","sourceRoot":"","sources":["../../helpers/config.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAGvD,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,EAC3C,QAAQ,GACR,WAAW,GACX,YAAY,GACZ,YAAY,GACZ,SAAS,GACT,WAAW,GACX,YAAY,GACZ,eAAe,GACf,kBAAkB,GAClB,gBAAgB,GAChB,cAAc,GACd,WAAW,CACV,GAAG;IACA,sEAAsE;IACtE,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAA;AAID,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,QA6BrD;AAED,wBAAgB,aAAa,IAAI,WAAW,CAE3C"}
|
|
@@ -2,8 +2,34 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.registerGameConfig = registerGameConfig;
|
|
4
4
|
exports.getGameConfig = getGameConfig;
|
|
5
|
+
const fastify_helper_1 = require("./fastify.helper");
|
|
5
6
|
let gameConfig;
|
|
6
7
|
function registerGameConfig(config) {
|
|
8
|
+
if (typeof config.rtpVersion !== 'string' || config.rtpVersion.length === 0) {
|
|
9
|
+
throw (0, fastify_helper_1.httpError)('Game config: rtpVersion must be a non-empty string', 500);
|
|
10
|
+
}
|
|
11
|
+
if (config.hasChoice && !config.hasMeta) {
|
|
12
|
+
throw (0, fastify_helper_1.httpError)('Game config: hasChoice=true requires hasMeta=true', 500);
|
|
13
|
+
}
|
|
14
|
+
if (config.hasVariableLines) {
|
|
15
|
+
if (!Array.isArray(config.variableLevels) || config.variableLevels.length === 0) {
|
|
16
|
+
throw (0, fastify_helper_1.httpError)('Game config: variableLevels must be a non-empty array when hasVariableLines=true', 500);
|
|
17
|
+
}
|
|
18
|
+
if (config.defaultLevel === undefined || !config.variableLevels.includes(config.defaultLevel)) {
|
|
19
|
+
throw (0, fastify_helper_1.httpError)('Game config: defaultLevel must be one of variableLevels when hasVariableLines=true', 500);
|
|
20
|
+
}
|
|
21
|
+
if (config.coinRatio !== undefined) {
|
|
22
|
+
throw (0, fastify_helper_1.httpError)('Game config: coinRatio must not be set when hasVariableLines=true', 500);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
if (config.coinRatio === undefined) {
|
|
27
|
+
throw (0, fastify_helper_1.httpError)('Game config: coinRatio is required when hasVariableLines=false', 500);
|
|
28
|
+
}
|
|
29
|
+
if (config.variableLevels !== undefined || config.defaultLevel !== undefined) {
|
|
30
|
+
throw (0, fastify_helper_1.httpError)('Game config: variableLevels/defaultLevel must not be set when hasVariableLines=false', 500);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
7
33
|
gameConfig = config;
|
|
8
34
|
}
|
|
9
35
|
function getGameConfig() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.helper.js","sourceRoot":"","sources":["../../helpers/config.helper.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"config.helper.js","sourceRoot":"","sources":["../../helpers/config.helper.ts"],"names":[],"mappings":";;AAuBA,gDA6BC;AAED,sCAEC;AAvDD,qDAA4C;AAoB5C,IAAI,UAAuB,CAAA;AAE3B,SAAgB,kBAAkB,CAAC,MAAmB;IAClD,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,QAAQ,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1E,MAAM,IAAA,0BAAS,EAAC,oDAAoD,EAAE,GAAG,CAAC,CAAA;IAC9E,CAAC;IAED,IAAI,MAAM,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACtC,MAAM,IAAA,0BAAS,EAAC,mDAAmD,EAAE,GAAG,CAAC,CAAA;IAC7E,CAAC;IAED,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC1B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC9E,MAAM,IAAA,0BAAS,EAAC,kFAAkF,EAAE,GAAG,CAAC,CAAA;QAC5G,CAAC;QACD,IAAI,MAAM,CAAC,YAAY,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;YAC5F,MAAM,IAAA,0BAAS,EAAC,oFAAoF,EAAE,GAAG,CAAC,CAAA;QAC9G,CAAC;QACD,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YACjC,MAAM,IAAA,0BAAS,EAAC,mEAAmE,EAAE,GAAG,CAAC,CAAA;QAC7F,CAAC;IACL,CAAC;SAAM,CAAC;QACJ,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YACjC,MAAM,IAAA,0BAAS,EAAC,gEAAgE,EAAE,GAAG,CAAC,CAAA;QAC1F,CAAC;QACD,IAAI,MAAM,CAAC,cAAc,KAAK,SAAS,IAAI,MAAM,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YAC3E,MAAM,IAAA,0BAAS,EAAC,sFAAsF,EAAE,GAAG,CAAC,CAAA;QAChH,CAAC;IACL,CAAC;IAED,UAAU,GAAG,MAAM,CAAA;AACvB,CAAC;AAED,SAAgB,aAAa;IACzB,OAAO,UAAU,CAAA;AACrB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const EErrorCode: {
|
|
2
|
+
readonly ValidationBody: 1001;
|
|
3
|
+
readonly ValidationStakes: 1002;
|
|
4
|
+
readonly ValidationMeta: 1003;
|
|
5
|
+
readonly ValidationChoice: 1004;
|
|
6
|
+
readonly ValidationStepIndex: 1005;
|
|
7
|
+
readonly ValidationConfig: 1006;
|
|
8
|
+
readonly ValidationTest: 1007;
|
|
9
|
+
readonly ApiKey: 2001;
|
|
10
|
+
readonly BusinessChoiceUnknown: 4001;
|
|
11
|
+
readonly BusinessMetaShape: 4002;
|
|
12
|
+
readonly BusinessFinishedMismatch: 4003;
|
|
13
|
+
readonly BusinessChoicesMismatch: 4004;
|
|
14
|
+
readonly Unhandled: 9001;
|
|
15
|
+
readonly NotFound: 9404;
|
|
16
|
+
};
|
|
17
|
+
export type TErrorCode = (typeof EErrorCode)[keyof typeof EErrorCode];
|
|
18
|
+
//# sourceMappingURL=errors.helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.helper.d.ts","sourceRoot":"","sources":["../../helpers/errors.helper.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;CAeb,CAAA;AAEV,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EErrorCode = void 0;
|
|
4
|
+
exports.EErrorCode = {
|
|
5
|
+
ValidationBody: 1001,
|
|
6
|
+
ValidationStakes: 1002,
|
|
7
|
+
ValidationMeta: 1003,
|
|
8
|
+
ValidationChoice: 1004,
|
|
9
|
+
ValidationStepIndex: 1005,
|
|
10
|
+
ValidationConfig: 1006,
|
|
11
|
+
ValidationTest: 1007,
|
|
12
|
+
ApiKey: 2001,
|
|
13
|
+
BusinessChoiceUnknown: 4001,
|
|
14
|
+
BusinessMetaShape: 4002,
|
|
15
|
+
BusinessFinishedMismatch: 4003,
|
|
16
|
+
BusinessChoicesMismatch: 4004,
|
|
17
|
+
Unhandled: 9001,
|
|
18
|
+
NotFound: 9404,
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=errors.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.helper.js","sourceRoot":"","sources":["../../helpers/errors.helper.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;IACtB,cAAc,EAAE,IAAI;IACpB,gBAAgB,EAAE,IAAI;IACtB,cAAc,EAAE,IAAI;IACpB,gBAAgB,EAAE,IAAI;IACtB,mBAAmB,EAAE,IAAI;IACzB,gBAAgB,EAAE,IAAI;IACtB,cAAc,EAAE,IAAI;IACpB,MAAM,EAAE,IAAI;IACZ,qBAAqB,EAAE,IAAI;IAC3B,iBAAiB,EAAE,IAAI;IACvB,wBAAwB,EAAE,IAAI;IAC9B,uBAAuB,EAAE,IAAI;IAC7B,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,IAAI;CACR,CAAA"}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { TypeBoxTypeProvider } from '@fastify/type-provider-typebox';
|
|
2
2
|
import { FastifyBaseLogger, FastifyError, FastifyInstance, RawReplyDefaultExpression, RawRequestDefaultExpression, RawServerDefault } from 'fastify';
|
|
3
|
+
import { TErrorCode } from './errors.helper';
|
|
3
4
|
export type FastifyTypebox = FastifyInstance<RawServerDefault, RawRequestDefaultExpression<RawServerDefault>, RawReplyDefaultExpression<RawServerDefault>, FastifyBaseLogger, TypeBoxTypeProvider>;
|
|
5
|
+
export type FastifyError$Coded = FastifyError & {
|
|
6
|
+
errorCode?: TErrorCode;
|
|
7
|
+
};
|
|
4
8
|
export declare function registerRoute(callback: (fastify: FastifyTypebox) => Promise<void>): (fastify: FastifyTypebox) => Promise<void>;
|
|
5
9
|
export declare function registerPlugin(callback: (fastify: FastifyTypebox) => Promise<void>): (fastify: FastifyTypebox) => Promise<void>;
|
|
6
10
|
export declare function getRoutePrefix(): string;
|
|
7
11
|
/** This is handled in error.plugin.ts */
|
|
8
|
-
export declare function httpError(message: string, statusCode?: number): FastifyError;
|
|
12
|
+
export declare function httpError(message: string, statusCode?: number, code?: TErrorCode): FastifyError$Coded;
|
|
9
13
|
//# sourceMappingURL=fastify.helper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fastify.helper.d.ts","sourceRoot":"","sources":["../../helpers/fastify.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,EACH,iBAAiB,EAAE,YAAY,EAAE,eAAe,EAChD,yBAAyB,EAAE,2BAA2B,EAAE,gBAAgB,EAC3E,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"fastify.helper.d.ts","sourceRoot":"","sources":["../../helpers/fastify.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,EACH,iBAAiB,EAAE,YAAY,EAAE,eAAe,EAChD,yBAAyB,EAAE,2BAA2B,EAAE,gBAAgB,EAC3E,MAAM,SAAS,CAAA;AAIhB,OAAO,EAAc,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAExD,MAAM,MAAM,cAAc,GAAG,eAAe,CAC5C,gBAAgB,EAChB,2BAA2B,CAAC,gBAAgB,CAAC,EAC7C,yBAAyB,CAAC,gBAAgB,CAAC,EAC3C,iBAAiB,EACjB,mBAAmB,CAClB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG;IAAE,SAAS,CAAC,EAAE,UAAU,CAAA;CAAE,CAAA;AAE1E,wBAAgB,aAAa,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAE,IAAI,CAAC,aAAjC,cAAc,KAAK,OAAO,CAAE,IAAI,CAAC,CAElF;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAE,IAAI,CAAC,aAAjC,cAAc,KAAK,OAAO,CAAE,IAAI,CAAC,CAEnF;AAED,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,yCAAyC;AACzC,wBAAgB,SAAS,CACrB,OAAO,EAAE,MAAM,EACf,UAAU,GAAE,MAAY,EACxB,IAAI,GAAE,UAAiC,GACxC,kBAAkB,CAMpB"}
|
|
@@ -9,6 +9,7 @@ exports.getRoutePrefix = getRoutePrefix;
|
|
|
9
9
|
exports.httpError = httpError;
|
|
10
10
|
const fastify_plugin_1 = __importDefault(require("fastify-plugin"));
|
|
11
11
|
const env_helper_1 = require("./env.helper");
|
|
12
|
+
const errors_helper_1 = require("./errors.helper");
|
|
12
13
|
function registerRoute(callback) {
|
|
13
14
|
return callback;
|
|
14
15
|
}
|
|
@@ -19,9 +20,10 @@ function getRoutePrefix() {
|
|
|
19
20
|
return (0, env_helper_1.getenv)('ROUTE_PREFIX', '');
|
|
20
21
|
}
|
|
21
22
|
/** This is handled in error.plugin.ts */
|
|
22
|
-
function httpError(message, statusCode = 500) {
|
|
23
|
+
function httpError(message, statusCode = 500, code = errors_helper_1.EErrorCode.Unhandled) {
|
|
23
24
|
const error = new Error(message);
|
|
24
25
|
error.statusCode = statusCode;
|
|
26
|
+
error.errorCode = code;
|
|
25
27
|
return error;
|
|
26
28
|
}
|
|
27
29
|
//# sourceMappingURL=fastify.helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fastify.helper.js","sourceRoot":"","sources":["../../helpers/fastify.helper.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"fastify.helper.js","sourceRoot":"","sources":["../../helpers/fastify.helper.ts"],"names":[],"mappings":";;;;;AAoBA,sCAEC;AAED,wCAEC;AAED,wCAEC;AAGD,8BAUC;AAtCD,oEAA0C;AAE1C,6CAAqC;AACrC,mDAAwD;AAYxD,SAAgB,aAAa,CAAC,QAAqD;IAC/E,OAAO,QAAQ,CAAA;AACnB,CAAC;AAED,SAAgB,cAAc,CAAC,QAAqD;IAChF,OAAO,IAAA,wBAAa,EAAC,QAAQ,CAAC,CAAA;AAClC,CAAC;AAED,SAAgB,cAAc;IAC1B,OAAO,IAAA,mBAAM,EAAC,cAAc,EAAE,EAAE,CAAC,CAAA;AACrC,CAAC;AAED,yCAAyC;AACzC,SAAgB,SAAS,CACrB,OAAe,EACf,aAAqB,GAAG,EACxB,OAAmB,0BAAU,CAAC,SAAS;IAEvC,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAuB,CAAA;IACtD,KAAK,CAAC,UAAU,GAAG,UAAU,CAAA;IAC7B,KAAK,CAAC,SAAS,GAAG,IAAI,CAAA;IAEtB,OAAO,KAAK,CAAA;AAChB,CAAC"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { RawReplyDefaultExpression, RawRequestDefaultExpression, RawServerDefault, RouteHandlerMethod } from 'fastify';
|
|
2
|
+
import { TChecksumReply, TChecksumRequest } from '../schemas/checksum.schema';
|
|
2
3
|
import { TClientReply, TClientRequest } from '../schemas/client.schema';
|
|
3
4
|
import { TConfigReply, TConfigRequest } from '../schemas/config.schema';
|
|
4
5
|
import { TPlayReply, TPlayRequest } from '../schemas/play.schema';
|
|
5
6
|
import { TValidateReply, TValidateRequest } from '../schemas/validate.schema';
|
|
6
|
-
export type
|
|
7
|
+
export type TRtpParams = {
|
|
8
|
+
rtpVersion: string;
|
|
9
|
+
};
|
|
10
|
+
export type RouteHandler<TRequest, TReply, TParams = TRtpParams> = RouteHandlerMethod<RawServerDefault, RawRequestDefaultExpression, RawReplyDefaultExpression, {
|
|
7
11
|
Body: TRequest;
|
|
8
12
|
Reply: TReply;
|
|
13
|
+
Params: TParams;
|
|
9
14
|
}>;
|
|
10
15
|
export declare class HandlersHelper<IHandlers extends {
|
|
11
16
|
[key: string]: {
|
|
@@ -35,5 +40,9 @@ export declare const handlers: HandlersHelper<{
|
|
|
35
40
|
request: TClientRequest;
|
|
36
41
|
reply: TClientReply;
|
|
37
42
|
};
|
|
43
|
+
checksum: {
|
|
44
|
+
request: TChecksumRequest;
|
|
45
|
+
reply: TChecksumReply;
|
|
46
|
+
};
|
|
38
47
|
}>;
|
|
39
48
|
//# sourceMappingURL=handlers.helper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.helper.d.ts","sourceRoot":"","sources":["../../helpers/handlers.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,yBAAyB,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,kBAAkB,EAC/F,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACvE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACvE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"handlers.helper.d.ts","sourceRoot":"","sources":["../../helpers/handlers.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,yBAAyB,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,kBAAkB,EAC/F,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7E,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACvE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACvE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAI7E,MAAM,MAAM,UAAU,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAAA;AAE/C,MAAM,MAAM,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAG,UAAU,IAAI,kBAAkB,CACrF,gBAAgB,EAChB,2BAA2B,EAC3B,yBAAyB,EACzB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;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perty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.handlers = exports.HandlersHelper = void 0;
|
|
4
|
+
const errors_helper_1 = require("./errors.helper");
|
|
4
5
|
const fastify_helper_1 = require("./fastify.helper");
|
|
5
6
|
class HandlersHelper {
|
|
6
7
|
handlers = new Map();
|
|
@@ -13,7 +14,7 @@ class HandlersHelper {
|
|
|
13
14
|
const handlerName = name;
|
|
14
15
|
return this.handlers.get(handlerName);
|
|
15
16
|
}
|
|
16
|
-
throw (0, fastify_helper_1.httpError)(`Handler "${String(name)}" is not registered
|
|
17
|
+
throw (0, fastify_helper_1.httpError)(`Handler "${String(name)}" is not registered`, 500, errors_helper_1.EErrorCode.Unhandled);
|
|
17
18
|
}
|
|
18
19
|
has(name) {
|
|
19
20
|
const handlerName = name;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.helper.js","sourceRoot":"","sources":["../../helpers/handlers.helper.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"handlers.helper.js","sourceRoot":"","sources":["../../helpers/handlers.helper.ts"],"names":[],"mappings":";;;AASA,mDAA4C;AAC5C,qDAA4C;AAW5C,MAAa,cAAc;IACb,QAAQ,GAAyC,IAAI,GAAG,EAAE,CAAA;IAEpE,QAAQ,CACJ,IAAW,EACX,OAA6E;QAE7E,MAAM,WAAW,GAAG,IAAc,CAAA;QAClC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;IAC3C,CAAC;IAED,GAAG,CAAgC,IAAW;QAC1C,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACjB,MAAM,WAAW,GAAG,IAAc,CAAA;YAClC,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;QACzC,CAAC;QAED,MAAM,IAAA,0BAAS,EAAC,YAAY,MAAM,CAAC,IAAI,CAAC,qBAAqB,EAAE,GAAG,EAAE,0BAAU,CAAC,SAAS,CAAC,CAAA;IAC7F,CAAC;IAED,GAAG,CAAgC,IAAW;QAC1C,MAAM,WAAW,GAAG,IAAc,CAAA;QAClC,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;IACzC,CAAC;CACJ;AAxBD,wCAwBC;AAEY,QAAA,QAAQ,GAAG,IAAI,cAAc,EAMtC,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
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';
|
|
7
8
|
export { getByChance, random, randomOf } from './helpers/random.helper';
|
|
9
|
+
export { ChecksumReplySchema, ChecksumRequestSchema, type TChecksumReply, type TChecksumRequest, } from './schemas/checksum.schema';
|
|
8
10
|
export { ClientReplySchema, ClientRequestSchema, type TClientReply, type TClientRequest, } from './schemas/client.schema';
|
|
9
11
|
export { ConfigReplySchema, ConfigRequestSchema, type TConfigReply, type TConfigRequest, } from './schemas/config.schema';
|
|
10
|
-
export { HealthcheckReplySchema, HealthcheckRequestSchema,
|
|
12
|
+
export { HealthcheckReplySchema, HealthcheckRequestSchema, type THealthcheckReply, type THealthcheckRequest, } from './schemas/healthcheck.schema';
|
|
11
13
|
export { PlayReplySchema, PlayRequestSchema, type TPlayReply, type TPlayRequest, } from './schemas/play.schema';
|
|
12
|
-
export { AccessErrorSchema,
|
|
14
|
+
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
15
|
export { ValidateReplySchema, ValidateRequestSchema, type TValidateReply, type TValidateRequest, } from './schemas/validate.schema';
|
|
14
16
|
//# 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,GACnB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EACH,KAAK,cAAc,EACnB,cAAc,EACd,SAAS,EACT,cAAc,EACd,aAAa,GAChB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACH,KAAK,YAAY,EACjB,cAAc,EACd,QAAQ,GACX,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAEvE,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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OA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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.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; } });
|
|
@@ -27,6 +29,9 @@ var random_helper_1 = require("./helpers/random.helper");
|
|
|
27
29
|
Object.defineProperty(exports, "getByChance", { enumerable: true, get: function () { return random_helper_1.getByChance; } });
|
|
28
30
|
Object.defineProperty(exports, "random", { enumerable: true, get: function () { return random_helper_1.random; } });
|
|
29
31
|
Object.defineProperty(exports, "randomOf", { enumerable: true, get: function () { return random_helper_1.randomOf; } });
|
|
32
|
+
var checksum_schema_1 = require("./schemas/checksum.schema");
|
|
33
|
+
Object.defineProperty(exports, "ChecksumReplySchema", { enumerable: true, get: function () { return checksum_schema_1.ChecksumReplySchema; } });
|
|
34
|
+
Object.defineProperty(exports, "ChecksumRequestSchema", { enumerable: true, get: function () { return checksum_schema_1.ChecksumRequestSchema; } });
|
|
30
35
|
var client_schema_1 = require("./schemas/client.schema");
|
|
31
36
|
Object.defineProperty(exports, "ClientReplySchema", { enumerable: true, get: function () { return client_schema_1.ClientReplySchema; } });
|
|
32
37
|
Object.defineProperty(exports, "ClientRequestSchema", { enumerable: true, get: function () { return client_schema_1.ClientRequestSchema; } });
|
|
@@ -36,18 +41,16 @@ Object.defineProperty(exports, "ConfigRequestSchema", { enumerable: true, get: f
|
|
|
36
41
|
var healthcheck_schema_1 = require("./schemas/healthcheck.schema");
|
|
37
42
|
Object.defineProperty(exports, "HealthcheckReplySchema", { enumerable: true, get: function () { return healthcheck_schema_1.HealthcheckReplySchema; } });
|
|
38
43
|
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
44
|
var play_schema_1 = require("./schemas/play.schema");
|
|
41
45
|
Object.defineProperty(exports, "PlayReplySchema", { enumerable: true, get: function () { return play_schema_1.PlayReplySchema; } });
|
|
42
46
|
Object.defineProperty(exports, "PlayRequestSchema", { enumerable: true, get: function () { return play_schema_1.PlayRequestSchema; } });
|
|
43
47
|
var shared_1 = require("./schemas/shared");
|
|
44
48
|
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
49
|
Object.defineProperty(exports, "EEnvironment", { enumerable: true, get: function () { return shared_1.EEnvironment; } });
|
|
47
50
|
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
51
|
Object.defineProperty(exports, "HeadersSchema", { enumerable: true, get: function () { return shared_1.HeadersSchema; } });
|
|
50
52
|
Object.defineProperty(exports, "InternalErrorSchema", { enumerable: true, get: function () { return shared_1.InternalErrorSchema; } });
|
|
53
|
+
Object.defineProperty(exports, "MetaSchema", { enumerable: true, get: function () { return shared_1.MetaSchema; } });
|
|
51
54
|
Object.defineProperty(exports, "RequestErrorSchema", { enumerable: true, get: function () { return shared_1.RequestErrorSchema; } });
|
|
52
55
|
Object.defineProperty(exports, "StakeModeSchema", { enumerable: true, get: function () { return shared_1.StakeModeSchema; } });
|
|
53
56
|
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,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"}
|
|
@@ -16,8 +16,8 @@ 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',
|
|
19
|
+
fastify.Sentry.setTag('game.title', gameConfig.gameTitle);
|
|
20
|
+
fastify.Sentry.setTag('game.id', gameConfig.gameId);
|
|
21
21
|
});
|
|
22
22
|
});
|
|
23
23
|
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,YAAY,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;QACzD,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.gameTitle}`,
|
|
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,+DAA6C;AAC7C,qEAAkD;AAElD,4DAAwD;AACxD,sDAAiD;AACjD,8DAA0D;AAC1D,sEAAiE;AACjE,4DAAiF;AACjF,4DAAiF;AACjF,wDAA2E;AAC3E,8CAE0B;AAC1B,gEAAuF;AAEvF,MAAM,aAAa,GAAG,IAAA,+BAAc,EAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IACnD,IAAI,IAAA,sBAAS,EAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC;QAAE,OAAM;IAExC,MAAM,UAAU,GAAG,IAAA,6BAAa,GAAE,CAAA;IAClC,MAAM,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
|
@@ -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"}
|