@truelab/trueserver 0.0.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 +36 -0
- package/README.md +220 -0
- package/dist/application.d.ts +7 -0
- package/dist/application.d.ts.map +1 -0
- package/dist/application.js +41 -0
- package/dist/application.js.map +1 -0
- package/dist/helpers/config.helper.d.ts +5 -0
- package/dist/helpers/config.helper.d.ts.map +1 -0
- package/dist/helpers/config.helper.js +12 -0
- package/dist/helpers/config.helper.js.map +1 -0
- package/dist/helpers/env.helper.d.ts +5 -0
- package/dist/helpers/env.helper.d.ts.map +1 -0
- package/dist/helpers/env.helper.js +29 -0
- package/dist/helpers/env.helper.js.map +1 -0
- package/dist/helpers/fastify.helper.d.ts +9 -0
- package/dist/helpers/fastify.helper.d.ts.map +1 -0
- package/dist/helpers/fastify.helper.js +27 -0
- package/dist/helpers/fastify.helper.js.map +1 -0
- package/dist/helpers/handlers.helper.d.ts +39 -0
- package/dist/helpers/handlers.helper.d.ts.map +1 -0
- package/dist/helpers/handlers.helper.js +25 -0
- package/dist/helpers/handlers.helper.js.map +1 -0
- package/dist/helpers/logger.helper.d.ts +6 -0
- package/dist/helpers/logger.helper.d.ts.map +1 -0
- package/dist/helpers/logger.helper.js +21 -0
- package/dist/helpers/logger.helper.js.map +1 -0
- package/dist/helpers/pkg-version.helper.d.ts +5 -0
- package/dist/helpers/pkg-version.helper.d.ts.map +1 -0
- package/dist/helpers/pkg-version.helper.js +22 -0
- package/dist/helpers/pkg-version.helper.js.map +1 -0
- package/dist/helpers/random.helper.d.ts +7 -0
- package/dist/helpers/random.helper.d.ts.map +1 -0
- package/dist/helpers/random.helper.js +18 -0
- package/dist/helpers/random.helper.js.map +1 -0
- package/dist/helpers/tests.helper.d.ts +9 -0
- package/dist/helpers/tests.helper.d.ts.map +1 -0
- package/dist/helpers/tests.helper.js +45 -0
- package/dist/helpers/tests.helper.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/404.plugin.d.ts +3 -0
- package/dist/plugins/404.plugin.d.ts.map +1 -0
- package/dist/plugins/404.plugin.js +10 -0
- package/dist/plugins/404.plugin.js.map +1 -0
- package/dist/plugins/apikey.plugin.d.ts +3 -0
- package/dist/plugins/apikey.plugin.d.ts.map +1 -0
- package/dist/plugins/apikey.plugin.js +18 -0
- package/dist/plugins/apikey.plugin.js.map +1 -0
- package/dist/plugins/cors.plugin.d.ts +3 -0
- package/dist/plugins/cors.plugin.d.ts.map +1 -0
- package/dist/plugins/cors.plugin.js +15 -0
- package/dist/plugins/cors.plugin.js.map +1 -0
- package/dist/plugins/error.plugin.d.ts +3 -0
- package/dist/plugins/error.plugin.d.ts.map +1 -0
- package/dist/plugins/error.plugin.js +18 -0
- package/dist/plugins/error.plugin.js.map +1 -0
- package/dist/plugins/logger.plugin.d.ts +3 -0
- package/dist/plugins/logger.plugin.d.ts.map +1 -0
- package/dist/plugins/logger.plugin.js +51 -0
- package/dist/plugins/logger.plugin.js.map +1 -0
- package/dist/plugins/metrics.plugin.d.ts +9 -0
- package/dist/plugins/metrics.plugin.d.ts.map +1 -0
- package/dist/plugins/metrics.plugin.js +24 -0
- package/dist/plugins/metrics.plugin.js.map +1 -0
- package/dist/plugins/sentry.plugin.d.ts +3 -0
- package/dist/plugins/sentry.plugin.d.ts.map +1 -0
- package/dist/plugins/sentry.plugin.js +24 -0
- package/dist/plugins/sentry.plugin.js.map +1 -0
- package/dist/plugins/swagger.plugin.d.ts +3 -0
- package/dist/plugins/swagger.plugin.d.ts.map +1 -0
- package/dist/plugins/swagger.plugin.js +58 -0
- package/dist/plugins/swagger.plugin.js.map +1 -0
- package/dist/routes/client.route.d.ts +3 -0
- package/dist/routes/client.route.d.ts.map +1 -0
- package/dist/routes/client.route.js +21 -0
- package/dist/routes/client.route.js.map +1 -0
- package/dist/routes/config/config.route.d.ts +3 -0
- package/dist/routes/config/config.route.d.ts.map +1 -0
- package/dist/routes/config/config.route.js +21 -0
- package/dist/routes/config/config.route.js.map +1 -0
- package/dist/routes/config/config.route.validate.plugin.d.ts +3 -0
- package/dist/routes/config/config.route.validate.plugin.d.ts.map +1 -0
- package/dist/routes/config/config.route.validate.plugin.js +42 -0
- package/dist/routes/config/config.route.validate.plugin.js.map +1 -0
- package/dist/routes/config/index.d.ts +3 -0
- package/dist/routes/config/index.d.ts.map +1 -0
- package/dist/routes/config/index.js +14 -0
- package/dist/routes/config/index.js.map +1 -0
- package/dist/routes/healthcheck.route.d.ts +3 -0
- package/dist/routes/healthcheck.route.d.ts.map +1 -0
- package/dist/routes/healthcheck.route.js +34 -0
- package/dist/routes/healthcheck.route.js.map +1 -0
- package/dist/routes/play/index.d.ts +3 -0
- package/dist/routes/play/index.d.ts.map +1 -0
- package/dist/routes/play/index.js +14 -0
- package/dist/routes/play/index.js.map +1 -0
- package/dist/routes/play/play.route.d.ts +3 -0
- package/dist/routes/play/play.route.d.ts.map +1 -0
- package/dist/routes/play/play.route.js +22 -0
- package/dist/routes/play/play.route.js.map +1 -0
- package/dist/routes/play/play.route.validate.plugin.d.ts +13 -0
- package/dist/routes/play/play.route.validate.plugin.d.ts.map +1 -0
- package/dist/routes/play/play.route.validate.plugin.js +108 -0
- package/dist/routes/play/play.route.validate.plugin.js.map +1 -0
- package/dist/routes/validate/index.d.ts +3 -0
- package/dist/routes/validate/index.d.ts.map +1 -0
- package/dist/routes/validate/index.js +14 -0
- package/dist/routes/validate/index.js.map +1 -0
- package/dist/routes/validate/validate.route.d.ts +3 -0
- package/dist/routes/validate/validate.route.d.ts.map +1 -0
- package/dist/routes/validate/validate.route.js +22 -0
- package/dist/routes/validate/validate.route.js.map +1 -0
- package/dist/routes/validate/validate.route.validate.plugin.d.ts +3 -0
- package/dist/routes/validate/validate.route.validate.plugin.d.ts.map +1 -0
- package/dist/routes/validate/validate.route.validate.plugin.js +28 -0
- package/dist/routes/validate/validate.route.validate.plugin.js.map +1 -0
- package/dist/schemas/client.schema.d.ts +9 -0
- package/dist/schemas/client.schema.d.ts.map +1 -0
- package/dist/schemas/client.schema.js +22 -0
- package/dist/schemas/client.schema.js.map +1 -0
- package/dist/schemas/config.schema.d.ts +34 -0
- package/dist/schemas/config.schema.d.ts.map +1 -0
- package/dist/schemas/config.schema.js +78 -0
- package/dist/schemas/config.schema.js.map +1 -0
- package/dist/schemas/examples/client.schema.examples.d.ts +3 -0
- package/dist/schemas/examples/client.schema.examples.d.ts.map +1 -0
- package/dist/schemas/examples/client.schema.examples.js +32 -0
- package/dist/schemas/examples/client.schema.examples.js.map +1 -0
- package/dist/schemas/examples/config.schema.examples.d.ts +3 -0
- package/dist/schemas/examples/config.schema.examples.d.ts.map +1 -0
- package/dist/schemas/examples/config.schema.examples.js +56 -0
- package/dist/schemas/examples/config.schema.examples.js.map +1 -0
- package/dist/schemas/examples/healthcheck.schema.examples.d.ts +3 -0
- package/dist/schemas/examples/healthcheck.schema.examples.d.ts.map +1 -0
- package/dist/schemas/examples/healthcheck.schema.examples.js +28 -0
- package/dist/schemas/examples/healthcheck.schema.examples.js.map +1 -0
- package/dist/schemas/examples/play.schema.examples.d.ts +4 -0
- package/dist/schemas/examples/play.schema.examples.d.ts.map +1 -0
- package/dist/schemas/examples/play.schema.examples.js +165 -0
- package/dist/schemas/examples/play.schema.examples.js.map +1 -0
- package/dist/schemas/examples/validate.schema.examples.d.ts +4 -0
- package/dist/schemas/examples/validate.schema.examples.d.ts.map +1 -0
- package/dist/schemas/examples/validate.schema.examples.js +100 -0
- package/dist/schemas/examples/validate.schema.examples.js.map +1 -0
- package/dist/schemas/healthcheck.schema.d.ts +31 -0
- package/dist/schemas/healthcheck.schema.d.ts.map +1 -0
- package/dist/schemas/healthcheck.schema.js +63 -0
- package/dist/schemas/healthcheck.schema.js.map +1 -0
- package/dist/schemas/play.schema.d.ts +34 -0
- package/dist/schemas/play.schema.d.ts.map +1 -0
- package/dist/schemas/play.schema.js +80 -0
- package/dist/schemas/play.schema.js.map +1 -0
- package/dist/schemas/shared.d.ts +71 -0
- package/dist/schemas/shared.d.ts.map +1 -0
- package/dist/schemas/shared.js +147 -0
- package/dist/schemas/shared.js.map +1 -0
- package/dist/schemas/validate.schema.d.ts +21 -0
- package/dist/schemas/validate.schema.d.ts.map +1 -0
- package/dist/schemas/validate.schema.js +43 -0
- package/dist/schemas/validate.schema.js.map +1 -0
- package/dist/test-utils.d.ts +6 -0
- package/dist/test-utils.d.ts.map +1 -0
- package/dist/test-utils.js +13 -0
- package/dist/test-utils.js.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Static, Type } from 'typebox';
|
|
2
|
+
export declare enum ECategory {
|
|
3
|
+
slots = "slots",
|
|
4
|
+
cluster = "cluster",
|
|
5
|
+
table = "table"
|
|
6
|
+
}
|
|
7
|
+
export declare enum EStakeType {
|
|
8
|
+
default = "default",
|
|
9
|
+
buy = "buy",
|
|
10
|
+
bonusBet = "bonusBet"
|
|
11
|
+
}
|
|
12
|
+
export declare enum EVolatility {
|
|
13
|
+
variable = "Variable",
|
|
14
|
+
low = "Low",
|
|
15
|
+
medLow = "Medium - Low",
|
|
16
|
+
med = "Medium",
|
|
17
|
+
medHigh = "Medium - High",
|
|
18
|
+
high = "High",
|
|
19
|
+
veryHigh = "Very High"
|
|
20
|
+
}
|
|
21
|
+
export declare enum EEnvironment {
|
|
22
|
+
development = "development",
|
|
23
|
+
staging = "staging",
|
|
24
|
+
production = "production"
|
|
25
|
+
}
|
|
26
|
+
export type TExamples = {
|
|
27
|
+
[key: string]: {
|
|
28
|
+
value: any;
|
|
29
|
+
summary?: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export declare const StakeSchema: Type.TObject<{
|
|
34
|
+
name: Type.TString;
|
|
35
|
+
amount: Type.TNumber;
|
|
36
|
+
level: Type.TOptional<Type.TInteger>;
|
|
37
|
+
qty: Type.TOptional<Type.TInteger>;
|
|
38
|
+
params: Type.TOptional<Type.TString>;
|
|
39
|
+
}>;
|
|
40
|
+
export declare const StakeModeSchema: Type.TObject<{
|
|
41
|
+
name: Type.TString;
|
|
42
|
+
type: Type.TEnum<[EStakeType.default, EStakeType.buy, EStakeType.bonusBet]>;
|
|
43
|
+
bets: Type.TNumber;
|
|
44
|
+
multiple: Type.TOptional<Type.TBoolean>;
|
|
45
|
+
parametric: Type.TBoolean;
|
|
46
|
+
maxQty: Type.TOptional<Type.TInteger>;
|
|
47
|
+
}>;
|
|
48
|
+
export declare const HeadersSchema: Type.TObject<{
|
|
49
|
+
"x-api-key": Type.TString;
|
|
50
|
+
}>;
|
|
51
|
+
export declare const InternalErrorSchema: Type.TObject<{
|
|
52
|
+
ok: Type.TBoolean;
|
|
53
|
+
message: Type.TString;
|
|
54
|
+
custom: Type.TOptional<Type.TAny>;
|
|
55
|
+
}>;
|
|
56
|
+
export declare const RequestErrorSchema: Type.TObject<{
|
|
57
|
+
ok: Type.TBoolean;
|
|
58
|
+
message: Type.TString;
|
|
59
|
+
custom: Type.TOptional<Type.TAny>;
|
|
60
|
+
}>;
|
|
61
|
+
export declare const AccessErrorSchema: Type.TObject<{
|
|
62
|
+
ok: Type.TBoolean;
|
|
63
|
+
message: Type.TString;
|
|
64
|
+
custom: Type.TOptional<Type.TAny>;
|
|
65
|
+
}>;
|
|
66
|
+
export type TStake = Static<typeof StakeSchema>;
|
|
67
|
+
export type TStakeMode = Static<typeof StakeModeSchema>;
|
|
68
|
+
export type TInternalError = Static<typeof InternalErrorSchema>;
|
|
69
|
+
export type TRequestError = Static<typeof RequestErrorSchema>;
|
|
70
|
+
export type TAccessError = Static<typeof AccessErrorSchema>;
|
|
71
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../schemas/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AccessErrorSchema = exports.RequestErrorSchema = exports.InternalErrorSchema = exports.HeadersSchema = exports.StakeModeSchema = exports.StakeSchema = exports.EEnvironment = exports.EVolatility = exports.EStakeType = exports.ECategory = void 0;
|
|
4
|
+
const typebox_1 = require("typebox");
|
|
5
|
+
const env_helper_1 = require("../helpers/env.helper");
|
|
6
|
+
var ECategory;
|
|
7
|
+
(function (ECategory) {
|
|
8
|
+
ECategory["slots"] = "slots";
|
|
9
|
+
ECategory["cluster"] = "cluster";
|
|
10
|
+
ECategory["table"] = "table";
|
|
11
|
+
})(ECategory || (exports.ECategory = ECategory = {}));
|
|
12
|
+
var EStakeType;
|
|
13
|
+
(function (EStakeType) {
|
|
14
|
+
EStakeType["default"] = "default";
|
|
15
|
+
EStakeType["buy"] = "buy";
|
|
16
|
+
EStakeType["bonusBet"] = "bonusBet";
|
|
17
|
+
})(EStakeType || (exports.EStakeType = EStakeType = {}));
|
|
18
|
+
var EVolatility;
|
|
19
|
+
(function (EVolatility) {
|
|
20
|
+
EVolatility["variable"] = "Variable";
|
|
21
|
+
EVolatility["low"] = "Low";
|
|
22
|
+
EVolatility["medLow"] = "Medium - Low";
|
|
23
|
+
EVolatility["med"] = "Medium";
|
|
24
|
+
EVolatility["medHigh"] = "Medium - High";
|
|
25
|
+
EVolatility["high"] = "High";
|
|
26
|
+
EVolatility["veryHigh"] = "Very High";
|
|
27
|
+
})(EVolatility || (exports.EVolatility = EVolatility = {}));
|
|
28
|
+
var EEnvironment;
|
|
29
|
+
(function (EEnvironment) {
|
|
30
|
+
EEnvironment["development"] = "development";
|
|
31
|
+
EEnvironment["staging"] = "staging";
|
|
32
|
+
EEnvironment["production"] = "production";
|
|
33
|
+
})(EEnvironment || (exports.EEnvironment = EEnvironment = {}));
|
|
34
|
+
exports.StakeSchema = typebox_1.Type.Object({
|
|
35
|
+
name: typebox_1.Type.String({
|
|
36
|
+
description: 'Stake mode name ("default", "buyBonus", etc)',
|
|
37
|
+
}),
|
|
38
|
+
amount: typebox_1.Type.Number({
|
|
39
|
+
description: 'Cash bet value',
|
|
40
|
+
exclusiveMinimum: 0,
|
|
41
|
+
}),
|
|
42
|
+
level: typebox_1.Type.Optional(typebox_1.Type.Integer({
|
|
43
|
+
description: 'Line level. Available only for games with variable lines and for some specific table games',
|
|
44
|
+
minimum: 0,
|
|
45
|
+
})),
|
|
46
|
+
qty: typebox_1.Type.Optional(typebox_1.Type.Integer({
|
|
47
|
+
description: 'Count of the same stakes (only for multiple)',
|
|
48
|
+
minimum: 1,
|
|
49
|
+
})),
|
|
50
|
+
params: typebox_1.Type.Optional(typebox_1.Type.String({
|
|
51
|
+
description: 'Custom additional data for complex stakes (chip value, slider range, etc.). Stringified JSON',
|
|
52
|
+
})),
|
|
53
|
+
}, {
|
|
54
|
+
$id: 'Stake',
|
|
55
|
+
description: 'Stake data. Optional for requests with choice',
|
|
56
|
+
additionalProperties: false,
|
|
57
|
+
});
|
|
58
|
+
exports.StakeModeSchema = typebox_1.Type.Object({
|
|
59
|
+
name: typebox_1.Type.String({
|
|
60
|
+
description: 'Stake mode name ("default", "buyBonus", etc)',
|
|
61
|
+
}),
|
|
62
|
+
type: typebox_1.Type.Enum(EStakeType, {
|
|
63
|
+
description: 'Type of stake mode: default, buy, etc',
|
|
64
|
+
}),
|
|
65
|
+
bets: typebox_1.Type.Number({
|
|
66
|
+
description: 'Multiplier (price) of stake mode, by default 1',
|
|
67
|
+
exclusiveMinimum: 0,
|
|
68
|
+
}),
|
|
69
|
+
multiple: typebox_1.Type.Optional(typebox_1.Type.Boolean({
|
|
70
|
+
description: 'Shows that it is allowed to place several stakes of this type.',
|
|
71
|
+
})),
|
|
72
|
+
parametric: typebox_1.Type.Boolean({
|
|
73
|
+
description: 'Shows that stake mode may have custom additional data (chip value, slider range, etc.)',
|
|
74
|
+
}),
|
|
75
|
+
maxQty: typebox_1.Type.Optional(typebox_1.Type.Integer({
|
|
76
|
+
description: 'How many stakes of this type is allowed to make at once',
|
|
77
|
+
minimum: 1,
|
|
78
|
+
})),
|
|
79
|
+
}, {
|
|
80
|
+
$id: 'StakeMode',
|
|
81
|
+
description: 'Information about available stakes of the game',
|
|
82
|
+
additionalProperties: false,
|
|
83
|
+
});
|
|
84
|
+
exports.HeadersSchema = typebox_1.Type.Object({
|
|
85
|
+
[(0, env_helper_1.getenv)('API_HEADER', 'x-api-key')]: typebox_1.Type.String({
|
|
86
|
+
description: 'Secret key',
|
|
87
|
+
examples: ['test'],
|
|
88
|
+
}),
|
|
89
|
+
});
|
|
90
|
+
exports.InternalErrorSchema = typebox_1.Type.Object({
|
|
91
|
+
ok: typebox_1.Type.Boolean({
|
|
92
|
+
description: 'Always false',
|
|
93
|
+
}),
|
|
94
|
+
message: typebox_1.Type.String({
|
|
95
|
+
description: 'Error message',
|
|
96
|
+
}),
|
|
97
|
+
custom: typebox_1.Type.Optional(typebox_1.Type.Any({
|
|
98
|
+
description: 'Any additional data about error',
|
|
99
|
+
})),
|
|
100
|
+
}, {
|
|
101
|
+
$id: 'InternalError',
|
|
102
|
+
description: 'Any internal error: invalid reply format, native exception, etc.',
|
|
103
|
+
additionalProperties: false,
|
|
104
|
+
examples: [{
|
|
105
|
+
ok: false,
|
|
106
|
+
message: '"ok" is required!',
|
|
107
|
+
}],
|
|
108
|
+
});
|
|
109
|
+
exports.RequestErrorSchema = typebox_1.Type.Object({
|
|
110
|
+
ok: typebox_1.Type.Boolean({
|
|
111
|
+
description: 'Always false',
|
|
112
|
+
}),
|
|
113
|
+
message: typebox_1.Type.String({
|
|
114
|
+
description: 'Error message',
|
|
115
|
+
}),
|
|
116
|
+
custom: typebox_1.Type.Optional(typebox_1.Type.Any({
|
|
117
|
+
description: 'Any additional data about error',
|
|
118
|
+
})),
|
|
119
|
+
}, {
|
|
120
|
+
$id: 'RequestError',
|
|
121
|
+
description: 'Invalid request format (body, headers)',
|
|
122
|
+
additionalProperties: false,
|
|
123
|
+
examples: [{
|
|
124
|
+
ok: false,
|
|
125
|
+
message: "body must have required property 'demo'",
|
|
126
|
+
}],
|
|
127
|
+
});
|
|
128
|
+
exports.AccessErrorSchema = typebox_1.Type.Object({
|
|
129
|
+
ok: typebox_1.Type.Boolean({
|
|
130
|
+
description: 'Always false',
|
|
131
|
+
}),
|
|
132
|
+
message: typebox_1.Type.String({
|
|
133
|
+
description: 'Error message',
|
|
134
|
+
}),
|
|
135
|
+
custom: typebox_1.Type.Optional(typebox_1.Type.Any({
|
|
136
|
+
description: 'Any additional data about error',
|
|
137
|
+
})),
|
|
138
|
+
}, {
|
|
139
|
+
$id: 'AccessError',
|
|
140
|
+
description: 'Incorrect API key',
|
|
141
|
+
additionalProperties: false,
|
|
142
|
+
examples: [{
|
|
143
|
+
ok: false,
|
|
144
|
+
message: "API_KEY doesn't match",
|
|
145
|
+
}],
|
|
146
|
+
});
|
|
147
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../schemas/shared.ts"],"names":[],"mappings":";;;AAAA,qCAAsC;AAEtC,sDAA8C;AAE9C,IAAY,SAIX;AAJD,WAAY,SAAS;IACjB,4BAAe,CAAA;IACf,gCAAmB,CAAA;IACnB,4BAAe,CAAA;AACnB,CAAC,EAJW,SAAS,yBAAT,SAAS,QAIpB;AAED,IAAY,UAIX;AAJD,WAAY,UAAU;IAClB,iCAAmB,CAAA;IACnB,yBAAW,CAAA;IACX,mCAAqB,CAAA;AACzB,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB;AAED,IAAY,WAQX;AARD,WAAY,WAAW;IACnB,oCAAqB,CAAA;IACrB,0BAAW,CAAA;IACX,sCAAuB,CAAA;IACvB,6BAAc,CAAA;IACd,wCAAyB,CAAA;IACzB,4BAAa,CAAA;IACb,qCAAsB,CAAA;AAC1B,CAAC,EARW,WAAW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,cAAI,CAAC,OAAO,CAAC;QACb,WAAW,EAAE,cAAc;KAC9B,CAAC;IACF,OAAO,EAAE,cAAI,CAAC,MAAM,CAAC;QACjB,WAAW,EAAE,eAAe;KAC/B,CAAC;IACF,MAAM,EAAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,GAAG,CAAC;QAC3B,WAAW,EAAE,iCAAiC;KACjD,CAAC,CAAC;CACN,EAAE;IACC,GAAG,EAAE,cAAc;IACnB,WAAW,EAAE,wCAAwC;IACrD,oBAAoB,EAAE,KAAK;IAC3B,QAAQ,EAAE,CAAC;YACP,EAAE,EAAE,KAAK;YACT,OAAO,EAAE,yCAAyC;SACrD,CAAC;CACL,CAAC,CAAA;AAEW,QAAA,iBAAiB,GAAG,cAAI,CAAC,MAAM,CAAC;IACzC,EAAE,EAAE,cAAI,CAAC,OAAO,CAAC;QACb,WAAW,EAAE,cAAc;KAC9B,CAAC;IACF,OAAO,EAAE,cAAI,CAAC,MAAM,CAAC;QACjB,WAAW,EAAE,eAAe;KAC/B,CAAC;IACF,MAAM,EAAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,GAAG,CAAC;QAC3B,WAAW,EAAE,iCAAiC;KACjD,CAAC,CAAC;CACN,EAAE;IACC,GAAG,EAAE,aAAa;IAClB,WAAW,EAAE,mBAAmB;IAChC,oBAAoB,EAAE,KAAK;IAC3B,QAAQ,EAAE,CAAC;YACP,EAAE,EAAE,KAAK;YACT,OAAO,EAAE,uBAAuB;SACnC,CAAC;CACL,CAAC,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Static, Type } from 'typebox';
|
|
2
|
+
export declare const ValidateRequestSchema: Type.TObject<{
|
|
3
|
+
demo: Type.TBoolean;
|
|
4
|
+
currencyDecimals: Type.TOptional<Type.TInteger>;
|
|
5
|
+
stakes: Type.TOptional<Type.TArray<Type.TObject<{
|
|
6
|
+
name: Type.TString;
|
|
7
|
+
amount: Type.TNumber;
|
|
8
|
+
level: Type.TOptional<Type.TInteger>;
|
|
9
|
+
qty: Type.TOptional<Type.TInteger>;
|
|
10
|
+
params: Type.TOptional<Type.TString>;
|
|
11
|
+
}>>>;
|
|
12
|
+
maxExposure: Type.TNumber;
|
|
13
|
+
metaPrivate: Type.TOptional<Type.TString>;
|
|
14
|
+
metaPublic: Type.TOptional<Type.TString>;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const ValidateReplySchema: Type.TObject<{
|
|
17
|
+
ok: Type.TBoolean;
|
|
18
|
+
}>;
|
|
19
|
+
export type TValidateRequest = Static<typeof ValidateRequestSchema>;
|
|
20
|
+
export type TValidateReply = Static<typeof ValidateReplySchema>;
|
|
21
|
+
//# sourceMappingURL=validate.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.schema.d.ts","sourceRoot":"","sources":["../../schemas/validate.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAKtC,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;EA0BhC,CAAA;AAEF,eAAO,MAAM,mBAAmB;;EAQ9B,CAAA;AAEF,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAA;AACnE,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValidateReplySchema = exports.ValidateRequestSchema = void 0;
|
|
4
|
+
const typebox_1 = require("typebox");
|
|
5
|
+
const validate_schema_examples_1 = require("./examples/validate.schema.examples");
|
|
6
|
+
const shared_1 = require("./shared");
|
|
7
|
+
exports.ValidateRequestSchema = typebox_1.Type.Object({
|
|
8
|
+
demo: typebox_1.Type.Boolean({
|
|
9
|
+
description: 'true if it is demo game',
|
|
10
|
+
}),
|
|
11
|
+
currencyDecimals: typebox_1.Type.Optional(typebox_1.Type.Integer({
|
|
12
|
+
description: 'Floating point number for current currency profile',
|
|
13
|
+
minimum: 0,
|
|
14
|
+
})),
|
|
15
|
+
stakes: typebox_1.Type.Optional(typebox_1.Type.Array(shared_1.StakeSchema, {
|
|
16
|
+
description: 'List of stakes of the round',
|
|
17
|
+
minItems: 1,
|
|
18
|
+
})),
|
|
19
|
+
maxExposure: typebox_1.Type.Number({
|
|
20
|
+
description: 'Maximum available winning amount in currency',
|
|
21
|
+
exclusiveMinimum: 0,
|
|
22
|
+
}),
|
|
23
|
+
metaPrivate: typebox_1.Type.Optional(typebox_1.Type.String({
|
|
24
|
+
description: 'Private part of meta data (json object transformed to string). Inner data for calculating average bet, double up payouts, etc.',
|
|
25
|
+
})),
|
|
26
|
+
metaPublic: typebox_1.Type.Optional(typebox_1.Type.String({
|
|
27
|
+
description: 'Public part of meta data (json object transformed to string). Visual progress of cumulative features for client side or something like that',
|
|
28
|
+
})),
|
|
29
|
+
}, {
|
|
30
|
+
$id: 'ValidateRequest',
|
|
31
|
+
additionalProperties: false,
|
|
32
|
+
'x-examples': validate_schema_examples_1.validateRequestExamples,
|
|
33
|
+
});
|
|
34
|
+
exports.ValidateReplySchema = typebox_1.Type.Object({
|
|
35
|
+
ok: typebox_1.Type.Boolean({
|
|
36
|
+
description: 'Always true for success responses',
|
|
37
|
+
}),
|
|
38
|
+
}, {
|
|
39
|
+
$id: 'ValidateReply',
|
|
40
|
+
additionalProperties: false,
|
|
41
|
+
'x-examples': validate_schema_examples_1.validateReplyExamples,
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=validate.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.schema.js","sourceRoot":"","sources":["../../schemas/validate.schema.ts"],"names":[],"mappings":";;;AAAA,qCAAsC;AAEtC,kFAAoG;AACpG,qCAAsC;AAEzB,QAAA,qBAAqB,GAAG,cAAI,CAAC,MAAM,CAAC;IAC7C,IAAI,EAAE,cAAI,CAAC,OAAO,CAAC;QACf,WAAW,EAAE,yBAAyB;KACzC,CAAC;IACF,gBAAgB,EAAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,OAAO,CAAC;QACzC,WAAW,EAAE,oDAAoD;QACjE,OAAO,EAAE,CAAC;KACb,CAAC,CAAC;IACH,MAAM,EAAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,KAAK,CAAC,oBAAW,EAAE;QAC1C,WAAW,EAAE,6BAA6B;QAC1C,QAAQ,EAAE,CAAC;KACd,CAAC,CAAC;IACH,WAAW,EAAE,cAAI,CAAC,MAAM,CAAC;QACrB,WAAW,EAAE,8CAA8C;QAC3D,gBAAgB,EAAE,CAAC;KACtB,CAAC;IACF,WAAW,EAAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,MAAM,CAAC;QACnC,WAAW,EAAE,gIAAgI;KAChJ,CAAC,CAAC;IACH,UAAU,EAAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,MAAM,CAAC;QAClC,WAAW,EAAE,6IAA6I;KAC7J,CAAC,CAAC;CACN,EAAE;IACC,GAAG,EAAE,iBAAiB;IACtB,oBAAoB,EAAE,KAAK;IAC3B,YAAY,EAAE,kDAAuB;CACxC,CAAC,CAAA;AAEW,QAAA,mBAAmB,GAAG,cAAI,CAAC,MAAM,CAAC;IAC3C,EAAE,EAAE,cAAI,CAAC,OAAO,CAAC;QACb,WAAW,EAAE,mCAAmC;KACnD,CAAC;CACL,EAAE;IACC,GAAG,EAAE,eAAe;IACpB,oBAAoB,EAAE,KAAK;IAC3B,YAAY,EAAE,gDAAqB;CACtC,CAAC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test utilities for route/integration tests (`testBuild`, `validator`, etc.).
|
|
3
|
+
* Uses Jest globals (`expect`) — add `jest` and `@types/jest` in your game server project.
|
|
4
|
+
*/
|
|
5
|
+
export { checkSchemaPropertyDescriptions, testBuild, testHeaders, validator, } from './helpers/tests.helper';
|
|
6
|
+
//# sourceMappingURL=test-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../test-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACH,+BAA+B,EAC/B,SAAS,EACT,WAAW,EACX,SAAS,GACZ,MAAM,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validator = exports.testHeaders = exports.testBuild = exports.checkSchemaPropertyDescriptions = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Test utilities for route/integration tests (`testBuild`, `validator`, etc.).
|
|
6
|
+
* Uses Jest globals (`expect`) — add `jest` and `@types/jest` in your game server project.
|
|
7
|
+
*/
|
|
8
|
+
var tests_helper_1 = require("./helpers/tests.helper");
|
|
9
|
+
Object.defineProperty(exports, "checkSchemaPropertyDescriptions", { enumerable: true, get: function () { return tests_helper_1.checkSchemaPropertyDescriptions; } });
|
|
10
|
+
Object.defineProperty(exports, "testBuild", { enumerable: true, get: function () { return tests_helper_1.testBuild; } });
|
|
11
|
+
Object.defineProperty(exports, "testHeaders", { enumerable: true, get: function () { return tests_helper_1.testHeaders; } });
|
|
12
|
+
Object.defineProperty(exports, "validator", { enumerable: true, get: function () { return tests_helper_1.validator; } });
|
|
13
|
+
//# sourceMappingURL=test-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-utils.js","sourceRoot":"","sources":["../test-utils.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uDAK+B;AAJ3B,+HAAA,+BAA+B,OAAA;AAC/B,yGAAA,SAAS,OAAA;AACT,2GAAA,WAAW,OAAA;AACX,yGAAA,SAAS,OAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@truelab/trueserver",
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"description": "TrueLab Fastify server package: routes, schemas, and plugins for TrueLab game backends",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./test-utils": {
|
|
13
|
+
"types": "./dist/test-utils.d.ts",
|
|
14
|
+
"default": "./dist/test-utils.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"typesVersions": {
|
|
18
|
+
">=4.2": {
|
|
19
|
+
"test-utils": [
|
|
20
|
+
"./dist/test-utils.d.ts"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"README.md",
|
|
27
|
+
"CHANGELOG.md"
|
|
28
|
+
],
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=22.12"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"clean": "rm -rf dist",
|
|
34
|
+
"build": "tsc -p tsconfig.json",
|
|
35
|
+
"prepack": "npm run clean && npm run build",
|
|
36
|
+
"test": "jest",
|
|
37
|
+
"test:watch": "jest --watch"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public",
|
|
41
|
+
"registry": "https://registry.npmjs.org/"
|
|
42
|
+
},
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "git+ssh://git@bitbucket.org/trueflipgames/trueserver.git"
|
|
46
|
+
},
|
|
47
|
+
"keywords": [
|
|
48
|
+
"fastify",
|
|
49
|
+
"truelab",
|
|
50
|
+
"game-server",
|
|
51
|
+
"typebox"
|
|
52
|
+
],
|
|
53
|
+
"author": "TrueLab team",
|
|
54
|
+
"license": "ISC",
|
|
55
|
+
"homepage": "https://bitbucket.org/trueflipgames/trueserver#readme",
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@fastify/autoload": "^6.3.1",
|
|
58
|
+
"@fastify/cors": "^11.2.0",
|
|
59
|
+
"@fastify/swagger": "^9.7.0",
|
|
60
|
+
"@fastify/swagger-ui": "^5.2.6",
|
|
61
|
+
"@fastify/type-provider-typebox": "^6.1.0",
|
|
62
|
+
"@immobiliarelabs/fastify-sentry": "^9.0.1",
|
|
63
|
+
"ajv": "^8.20.0",
|
|
64
|
+
"dotenv": "^17.4.2",
|
|
65
|
+
"fastify": "^5.8.5",
|
|
66
|
+
"fastify-plugin": "^5.1.0",
|
|
67
|
+
"pino": "^10.3.1",
|
|
68
|
+
"pino-pretty": "^13.1.3",
|
|
69
|
+
"typebox": "^1.1.38"
|
|
70
|
+
},
|
|
71
|
+
"devDependencies": {
|
|
72
|
+
"@babel/core": "^7.29.0",
|
|
73
|
+
"@babel/preset-env": "^7.29.5",
|
|
74
|
+
"@types/jest": "^30.0.0",
|
|
75
|
+
"@types/node": "^25.8.0",
|
|
76
|
+
"jest": "^30.4.2",
|
|
77
|
+
"ts-jest": "^29.4.9",
|
|
78
|
+
"typescript": "^5.9.3"
|
|
79
|
+
}
|
|
80
|
+
}
|