@truelab/trueserver 0.1.1 → 0.1.3
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 +16 -0
- package/README.md +2 -2
- package/dist/application.d.ts +5 -1
- package/dist/application.d.ts.map +1 -1
- package/dist/application.js +3 -1
- package/dist/application.js.map +1 -1
- package/dist/helpers/env.helper.d.ts +2 -1
- package/dist/helpers/env.helper.d.ts.map +1 -1
- package/dist/helpers/env.helper.js +14 -1
- package/dist/helpers/env.helper.js.map +1 -1
- package/dist/helpers/fastify.helper.d.ts +2 -0
- package/dist/helpers/fastify.helper.d.ts.map +1 -1
- package/dist/helpers/fastify.helper.js +3 -0
- package/dist/helpers/fastify.helper.js.map +1 -1
- package/dist/plugins/apikey.plugin.d.ts.map +1 -1
- package/dist/plugins/apikey.plugin.js +7 -0
- package/dist/plugins/apikey.plugin.js.map +1 -1
- package/dist/plugins/swagger.plugin.js +2 -2
- package/dist/plugins/swagger.plugin.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.1.3] - 2026-07-03
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Swagger UI (`/docs`) теперь доступен и на staging (`APP_ENV=release`), а не только на `dev`. На production (`APP_ENV=master`) остаётся отключённым.
|
|
14
|
+
|
|
15
|
+
## [0.1.2] - 2026-07-03
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- `new Application({ envPath })` — опциональный путь к дополнительному env-файлу, который загружается поверх `./.env` при старте (через новый хелпер `loadEnv()`). Позволяет игре подключать per-версионный env на деплое.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- Swagger UI (`/docs`) и корневой редирект `/` теперь доступны без API-ключа (браузер не может передать ключ). Проверка ключа в `apikey`-плагине пропускает эти публичные роуты по шаблону сматченного роута, а сам префикс вынесен в общую константу `DOCS_ROUTE_PREFIX`.
|
|
24
|
+
|
|
9
25
|
## [0.1.0] - Unreleased
|
|
10
26
|
|
|
11
27
|
### Breaking
|
package/README.md
CHANGED
|
@@ -185,12 +185,12 @@ The environment helper imports `dotenv/config`, so `.env` is loaded automaticall
|
|
|
185
185
|
|
|
186
186
|
## Swagger
|
|
187
187
|
|
|
188
|
-
Swagger UI is enabled
|
|
188
|
+
Swagger UI is enabled for `APP_ENV=dev` and `APP_ENV=release` (staging).
|
|
189
189
|
|
|
190
190
|
- `GET /` redirects to `/docs`
|
|
191
191
|
- `GET /docs` serves Swagger UI
|
|
192
192
|
|
|
193
|
-
`
|
|
193
|
+
`master` (production) disables Swagger UI.
|
|
194
194
|
|
|
195
195
|
## Advanced Validation
|
|
196
196
|
|
package/dist/application.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { FastifyTypebox } from './helpers/fastify.helper';
|
|
2
|
+
export type TApplicationOptions = {
|
|
3
|
+
/** Optional env file to load (overriding the default ./.env), e.g. a per-version file at deploy time */
|
|
4
|
+
envPath?: string;
|
|
5
|
+
};
|
|
2
6
|
export default class Application {
|
|
3
7
|
server: FastifyTypebox;
|
|
4
|
-
constructor();
|
|
8
|
+
constructor(options?: TApplicationOptions);
|
|
5
9
|
build(): Promise<FastifyTypebox>;
|
|
6
10
|
}
|
|
7
11
|
//# sourceMappingURL=application.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../application.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../application.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAkB,MAAM,0BAA0B,CAAA;AAGzE,MAAM,MAAM,mBAAmB,GAAG;IAC9B,wGAAwG;IACxG,OAAO,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,WAAW;IAC5B,MAAM,EAAE,cAAc,CAAA;gBAEV,OAAO,GAAE,mBAAwB;IAcvC,KAAK,IAAI,OAAO,CAAC,cAAc,CAAC;CAuBzC"}
|
package/dist/application.js
CHANGED
|
@@ -6,11 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const autoload_1 = __importDefault(require("@fastify/autoload"));
|
|
7
7
|
const fastify_1 = __importDefault(require("fastify"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const env_helper_1 = require("./helpers/env.helper");
|
|
9
10
|
const fastify_helper_1 = require("./helpers/fastify.helper");
|
|
10
11
|
const logger_helper_1 = require("./helpers/logger.helper");
|
|
11
12
|
class Application {
|
|
12
13
|
server;
|
|
13
|
-
constructor() {
|
|
14
|
+
constructor(options = {}) {
|
|
15
|
+
(0, env_helper_1.loadEnv)(options.envPath);
|
|
14
16
|
this.server = (0, fastify_1.default)({
|
|
15
17
|
ajv: {
|
|
16
18
|
customOptions: {
|
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;
|
|
1
|
+
{"version":3,"file":"application.js","sourceRoot":"","sources":["../application.ts"],"names":[],"mappings":";;;;;AAAA,iEAA+C;AAE/C,sDAA6B;AAC7B,gDAAuB;AAEvB,qDAA8C;AAC9C,6DAAyE;AACzE,2DAAuD;AAOvD,MAAqB,WAAW;IAC5B,MAAM,CAAgB;IAEtB,YAAY,UAA+B,EAAE;QACzC,IAAA,oBAAO,EAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAExB,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;AAxCD,8BAwCC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/** Load an additional env file, overriding already-defined vars. */
|
|
2
|
+
export declare function loadEnv(path?: string): void;
|
|
2
3
|
export declare function getenv<T = string>(name: string, def: T): T;
|
|
3
4
|
/** Вариации значений в зависимости от окружения */
|
|
4
5
|
export declare function variation<T>(devBranch: T, releaseBranch: T, masterBranch: T): T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.helper.d.ts","sourceRoot":"","sources":["../../helpers/env.helper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"env.helper.d.ts","sourceRoot":"","sources":["../../helpers/env.helper.ts"],"names":[],"mappings":"AAMA,oEAAoE;AACpE,wBAAgB,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAI3C;AAED,wBAAgB,MAAM,CAAC,CAAC,GAAG,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAY1D;AAED,mDAAmD;AACnD,wBAAgB,SAAS,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,GAAG,CAAC,CAY/E"}
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.loadEnv = loadEnv;
|
|
3
7
|
exports.getenv = getenv;
|
|
4
8
|
exports.variation = variation;
|
|
5
|
-
require("dotenv
|
|
9
|
+
const dotenv_1 = __importDefault(require("dotenv"));
|
|
10
|
+
// Load the default ./.env (relative to the process cwd). A game that needs a specific env file
|
|
11
|
+
// can pass it at startup via `new Application({ envPath })`, which calls loadEnv() below.
|
|
12
|
+
dotenv_1.default.config();
|
|
13
|
+
/** Load an additional env file, overriding already-defined vars. */
|
|
14
|
+
function loadEnv(path) {
|
|
15
|
+
if (path) {
|
|
16
|
+
dotenv_1.default.config({ path, override: true });
|
|
17
|
+
}
|
|
18
|
+
}
|
|
6
19
|
function getenv(name, def) {
|
|
7
20
|
if (name in process.env) {
|
|
8
21
|
const value = process.env[name];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.helper.js","sourceRoot":"","sources":["../../helpers/env.helper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"env.helper.js","sourceRoot":"","sources":["../../helpers/env.helper.ts"],"names":[],"mappings":";;;;;AAOA,0BAIC;AAED,wBAYC;AAGD,8BAYC;AAxCD,oDAA2B;AAE3B,+FAA+F;AAC/F,0FAA0F;AAC1F,gBAAM,CAAC,MAAM,EAAE,CAAA;AAEf,oEAAoE;AACpE,SAAgB,OAAO,CAAC,IAAa;IACjC,IAAI,IAAI,EAAE,CAAC;QACP,gBAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;IAC3C,CAAC;AACL,CAAC;AAED,SAAgB,MAAM,CAAa,IAAY,EAAE,GAAM;IACnD,IAAI,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QACtB,MAAM,KAAK,GAAY,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAExC,QAAQ,KAAK,EAAE,CAAC;YACZ,KAAK,MAAM,CAAC,CAAC,OAAO,IAAoB,CAAA;YACxC,KAAK,OAAO,CAAC,CAAC,OAAO,KAAqB,CAAA;YAC1C,OAAO,CAAC,CAAC,OAAO,KAAU,CAAA;QAC9B,CAAC;IACL,CAAC;IAED,OAAO,GAAG,CAAA;AACd,CAAC;AAED,mDAAmD;AACnD,SAAgB,SAAS,CAAI,SAAY,EAAE,aAAgB,EAAE,YAAe;IACxE,MAAM,UAAU,GAAyB;QACrC,GAAG,EAAE,SAAS;QACd,OAAO,EAAE,aAAa;QACtB,MAAM,EAAE,YAAY;KACvB,CAAA;IAED,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,UAAU,EAAE,CAAC;QAC3D,OAAO,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IAC1C,CAAC;IAED,OAAO,YAAY,CAAA;AACvB,CAAC"}
|
|
@@ -8,6 +8,8 @@ export type FastifyError$Coded = FastifyError & {
|
|
|
8
8
|
export declare function registerRoute(callback: (fastify: FastifyTypebox) => Promise<void>): (fastify: FastifyTypebox) => Promise<void>;
|
|
9
9
|
export declare function registerPlugin(callback: (fastify: FastifyTypebox) => Promise<void>): (fastify: FastifyTypebox) => Promise<void>;
|
|
10
10
|
export declare function getRoutePrefix(): string;
|
|
11
|
+
/** Public Swagger UI mount point — shared by the swagger plugin and the apikey allowlist */
|
|
12
|
+
export declare const DOCS_ROUTE_PREFIX = "/docs";
|
|
11
13
|
/** This is handled in error.plugin.ts */
|
|
12
14
|
export declare function httpError(message: string, statusCode?: number, code?: TErrorCode): FastifyError$Coded;
|
|
13
15
|
//# 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;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,CA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AA;AAExC,yCAAyC;AACzC,wBAAgB,SAAS,CACrB,OAAO,EAAE,MAAM,EACf,UAAU,GAAE,MAAY,EACxB,IAAI,GAAE,UAAiC,GACxC,kBAAkB,CAMpB"}
|
|
@@ -3,6 +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.DOCS_ROUTE_PREFIX = void 0;
|
|
6
7
|
exports.registerRoute = registerRoute;
|
|
7
8
|
exports.registerPlugin = registerPlugin;
|
|
8
9
|
exports.getRoutePrefix = getRoutePrefix;
|
|
@@ -19,6 +20,8 @@ function registerPlugin(callback) {
|
|
|
19
20
|
function getRoutePrefix() {
|
|
20
21
|
return (0, env_helper_1.getenv)('ROUTE_PREFIX', '');
|
|
21
22
|
}
|
|
23
|
+
/** Public Swagger UI mount point — shared by the swagger plugin and the apikey allowlist */
|
|
24
|
+
exports.DOCS_ROUTE_PREFIX = '/docs';
|
|
22
25
|
/** This is handled in error.plugin.ts */
|
|
23
26
|
function httpError(message, statusCode = 500, code = errors_helper_1.EErrorCode.Unhandled) {
|
|
24
27
|
const error = new Error(message);
|
|
@@ -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;AAMD,8BAUC;AAzCD,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,4FAA4F;AAC/E,QAAA,iBAAiB,GAAG,OAAO,CAAA;AAExC,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apikey.plugin.d.ts","sourceRoot":"","sources":["../../plugins/apikey.plugin.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"apikey.plugin.d.ts","sourceRoot":"","sources":["../../plugins/apikey.plugin.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,YAAY,gFAmBhB,CAAA;AAEF,eAAe,YAAY,CAAA"}
|
|
@@ -5,6 +5,13 @@ const errors_helper_1 = require("../helpers/errors.helper");
|
|
|
5
5
|
const fastify_helper_1 = require("../helpers/fastify.helper");
|
|
6
6
|
const apikeyPlugin = (0, fastify_helper_1.registerPlugin)(async (fastify) => {
|
|
7
7
|
fastify.addHook('preHandler', (request, _reply, done) => {
|
|
8
|
+
// Swagger UI (dev-only) and the root redirect are public — a browser can't send the API key.
|
|
9
|
+
// Match the matched route pattern (query-free) rather than the raw url.
|
|
10
|
+
const routeUrl = request.routeOptions.url ?? request.url;
|
|
11
|
+
if (routeUrl === '/' || routeUrl === fastify_helper_1.DOCS_ROUTE_PREFIX || routeUrl.startsWith(`${fastify_helper_1.DOCS_ROUTE_PREFIX}/`)) {
|
|
12
|
+
done();
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
8
15
|
const currentKey = request.headers[(0, env_helper_1.getenv)('API_HEADER', 'x-api-key')];
|
|
9
16
|
const expectedKey = (0, env_helper_1.getenv)('API_KEY', 'test');
|
|
10
17
|
if (currentKey !== expectedKey) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apikey.plugin.js","sourceRoot":"","sources":["../../plugins/apikey.plugin.ts"],"names":[],"mappings":";;AAAA,sDAA8C;AAC9C,4DAAqD;AACrD,
|
|
1
|
+
{"version":3,"file":"apikey.plugin.js","sourceRoot":"","sources":["../../plugins/apikey.plugin.ts"],"names":[],"mappings":";;AAAA,sDAA8C;AAC9C,4DAAqD;AACrD,8DAAwF;AAExF,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,6FAA6F;QAC7F,wEAAwE;QACxE,MAAM,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAA;QACxD,IAAI,QAAQ,KAAK,GAAG,IAAI,QAAQ,KAAK,kCAAiB,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,kCAAiB,GAAG,CAAC,EAAE,CAAC;YACrG,IAAI,EAAE,CAAA;YACN,OAAM;QACV,CAAC;QAED,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"}
|
|
@@ -16,10 +16,10 @@ const play_schema_1 = require("../schemas/play.schema");
|
|
|
16
16
|
const shared_1 = require("../schemas/shared");
|
|
17
17
|
const validate_schema_1 = require("../schemas/validate.schema");
|
|
18
18
|
const swaggerPlugin = (0, fastify_helper_1.registerPlugin)(async (fastify) => {
|
|
19
|
-
if ((0, env_helper_1.variation)(false,
|
|
19
|
+
if ((0, env_helper_1.variation)(false, false, true))
|
|
20
20
|
return;
|
|
21
21
|
const gameConfig = (0, config_helper_1.getGameConfig)();
|
|
22
|
-
const routePrefix =
|
|
22
|
+
const routePrefix = fastify_helper_1.DOCS_ROUTE_PREFIX;
|
|
23
23
|
fastify.get('/', (_request, reply) => {
|
|
24
24
|
reply.redirect(routePrefix);
|
|
25
25
|
});
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"swagger.plugin.js","sourceRoot":"","sources":["../../plugins/swagger.plugin.ts"],"names":[],"mappings":";;;;;AAAA,+DAA6C;AAC7C,qEAAkD;AAElD,4DAAwD;AACxD,sDAAiD;AACjD,8DAA6E;AAC7E,sEAAiE;AACjE,gEAAuF;AACvF,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,KAAK,EAAE,IAAI,CAAC;QAAE,OAAM;IAEzC,MAAM,UAAU,GAAG,IAAA,6BAAa,GAAE,CAAA;IAClC,MAAM,WAAW,GAAG,kCAAiB,CAAA;IA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