@ai-grator/api 0.0.7 → 0.0.8
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/admin/endpoints/admin.ts +3 -0
- package/billing/endpoints/index.ts +1 -0
- package/billing/endpoints/queries/get-admin-stats.query.ts +29 -0
- package/billing/endpoints/queries/index.ts +1 -0
- package/billing/enums/index.ts +1 -0
- package/billing/enums/model-type.enum.ts +5 -0
- package/billing/index.ts +3 -0
- package/billing/models/admin-stats-response.schema.ts +29 -0
- package/billing/models/index.ts +1 -0
- package/build/admin/endpoints/admin.d.ts +1 -0
- package/build/admin/endpoints/admin.d.ts.map +1 -1
- package/build/admin/endpoints/admin.js +2 -0
- package/build/billing/endpoints/index.d.ts +2 -0
- package/build/billing/endpoints/index.d.ts.map +1 -0
- package/build/billing/endpoints/index.js +17 -0
- package/build/billing/endpoints/queries/get-admin-stats.query.d.ts +61 -0
- package/build/billing/endpoints/queries/get-admin-stats.query.d.ts.map +1 -0
- package/build/billing/endpoints/queries/get-admin-stats.query.js +26 -0
- package/build/billing/endpoints/queries/index.d.ts +2 -0
- package/build/billing/endpoints/queries/index.d.ts.map +1 -0
- package/build/billing/endpoints/queries/index.js +17 -0
- package/build/billing/enums/index.d.ts +2 -0
- package/build/billing/enums/index.d.ts.map +1 -0
- package/build/billing/enums/index.js +17 -0
- package/build/billing/enums/model-type.enum.d.ts +6 -0
- package/build/billing/enums/model-type.enum.d.ts.map +1 -0
- package/build/billing/enums/model-type.enum.js +9 -0
- package/build/billing/index.d.ts +4 -0
- package/build/billing/index.d.ts.map +1 -0
- package/build/billing/index.js +19 -0
- package/build/billing/models/admin-stats-response.schema.d.ts +37 -0
- package/build/billing/models/admin-stats-response.schema.d.ts.map +1 -0
- package/build/billing/models/admin-stats-response.schema.js +25 -0
- package/build/billing/models/index.d.ts +2 -0
- package/build/billing/models/index.d.ts.map +1 -0
- package/build/billing/models/index.js +17 -0
- package/build/errors/errors.d.ts +5 -0
- package/build/errors/errors.d.ts.map +1 -1
- package/build/errors/errors.js +5 -0
- package/build/scripts/generate-openapi.js +4 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/errors/errors.ts +5 -0
- package/package.json +1 -1
- package/scripts/generate-openapi.ts +8 -0
package/admin/endpoints/admin.ts
CHANGED
|
@@ -12,6 +12,9 @@ export const ADMIN_ROUTES = {
|
|
|
12
12
|
CREATE_PARTNER_BONUS_OPERATION: (partnerId: string) => `partners/${partnerId}/bonus-operations`,
|
|
13
13
|
REFERRAL_CONFIG: 'referral-config',
|
|
14
14
|
|
|
15
|
+
// STATS
|
|
16
|
+
STATS: 'stats',
|
|
17
|
+
|
|
15
18
|
// USERS
|
|
16
19
|
GET_USERS: 'users',
|
|
17
20
|
GET_USER: (userId: string) => `users/${userId}`,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './queries';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
3
|
+
import { ADMIN_ROUTES } from '../../../admin/endpoints/admin';
|
|
4
|
+
import { AdminStatsResponseSchema } from '../../models';
|
|
5
|
+
|
|
6
|
+
export const GetAdminStatsQueryQuery = z.object({
|
|
7
|
+
from: z.coerce.date().optional(),
|
|
8
|
+
to: z.coerce.date().optional(),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const GetAdminStatsQueryResponse = AdminStatsResponseSchema;
|
|
12
|
+
|
|
13
|
+
export const GetAdminStatsQuery = defineContract({
|
|
14
|
+
method: HTTP_METHODS.GET,
|
|
15
|
+
path: ADMIN_ROUTES.STATS,
|
|
16
|
+
summary: 'Get transaction statistics (deposits and charges) for a date range',
|
|
17
|
+
request: {
|
|
18
|
+
query: GetAdminStatsQueryQuery,
|
|
19
|
+
},
|
|
20
|
+
responses: {
|
|
21
|
+
200: GetAdminStatsQueryResponse,
|
|
22
|
+
401: HttpErrorResponseSchema,
|
|
23
|
+
403: HttpErrorResponseSchema,
|
|
24
|
+
500: HttpErrorResponseSchema,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export type GetAdminStatsQueryQueryType = z.infer<typeof GetAdminStatsQueryQuery>;
|
|
29
|
+
export type GetAdminStatsQueryResponseType = z.infer<typeof GetAdminStatsQueryResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './get-admin-stats.query';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './model-type.enum';
|
package/billing/index.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MODEL_TYPE } from '../enums';
|
|
3
|
+
|
|
4
|
+
const ModelRevenueItemSchema = z.object({
|
|
5
|
+
modelName: z.string(),
|
|
6
|
+
modelType: z.enum(MODEL_TYPE),
|
|
7
|
+
requestCount: z.number().int().nonnegative(),
|
|
8
|
+
revenue: z.number(),
|
|
9
|
+
revenueShare: z.number(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const DailyDataPointSchema = z.object({
|
|
13
|
+
date: z.string(),
|
|
14
|
+
deposits: z.number(),
|
|
15
|
+
charges: z.number(),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const AdminStatsResponseSchema = z.object({
|
|
19
|
+
totalDeposits: z.number(),
|
|
20
|
+
totalCharges: z.number(),
|
|
21
|
+
depositCount: z.number().int().nonnegative(),
|
|
22
|
+
chargeCount: z.number().int().nonnegative(),
|
|
23
|
+
modelRevenue: z.array(ModelRevenueItemSchema),
|
|
24
|
+
dailyBreakdown: z.array(DailyDataPointSchema),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export type AdminStatsResponseSchemaType = z.infer<typeof AdminStatsResponseSchema>;
|
|
28
|
+
export type ModelRevenueItem = z.infer<typeof ModelRevenueItemSchema>;
|
|
29
|
+
export type DailyDataPoint = z.infer<typeof DailyDataPointSchema>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './admin-stats-response.schema';
|
|
@@ -9,6 +9,7 @@ export declare const ADMIN_ROUTES: {
|
|
|
9
9
|
readonly GET_PARTNER_BONUS_OPERATIONS: (partnerId: string) => string;
|
|
10
10
|
readonly CREATE_PARTNER_BONUS_OPERATION: (partnerId: string) => string;
|
|
11
11
|
readonly REFERRAL_CONFIG: "referral-config";
|
|
12
|
+
readonly STATS: "stats";
|
|
12
13
|
readonly GET_USERS: "users";
|
|
13
14
|
readonly GET_USER: (userId: string) => string;
|
|
14
15
|
readonly GET_USER_TRANSACTIONS: (userId: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../../admin/endpoints/admin.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,EAAG,OAAgB,CAAC;AAEjD,eAAO,MAAM,YAAY;;sCAGI,MAAM;gDACI,MAAM;iDACL,MAAM;sDACD,MAAM;yDACH,MAAM;uDACR,MAAM;yDACJ,MAAM
|
|
1
|
+
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../../admin/endpoints/admin.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,EAAG,OAAgB,CAAC;AAEjD,eAAO,MAAM,YAAY;;sCAGI,MAAM;gDACI,MAAM;iDACL,MAAM;sDACD,MAAM;yDACH,MAAM;uDACR,MAAM;yDACJ,MAAM;;;;gCAQ/B,MAAM;6CACO,MAAM;gCACnB,MAAM;CACnB,CAAC"}
|
|
@@ -13,6 +13,8 @@ exports.ADMIN_ROUTES = {
|
|
|
13
13
|
GET_PARTNER_BONUS_OPERATIONS: (partnerId) => `partners/${partnerId}/bonus-operations`,
|
|
14
14
|
CREATE_PARTNER_BONUS_OPERATION: (partnerId) => `partners/${partnerId}/bonus-operations`,
|
|
15
15
|
REFERRAL_CONFIG: 'referral-config',
|
|
16
|
+
// STATS
|
|
17
|
+
STATS: 'stats',
|
|
16
18
|
// USERS
|
|
17
19
|
GET_USERS: 'users',
|
|
18
20
|
GET_USER: (userId) => `users/${userId}`,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../billing/endpoints/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./queries"), exports);
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { HTTP_METHODS } from '../../../_common';
|
|
3
|
+
export declare const GetAdminStatsQueryQuery: z.ZodObject<{
|
|
4
|
+
from: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
5
|
+
to: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export declare const GetAdminStatsQueryResponse: z.ZodObject<{
|
|
8
|
+
totalDeposits: z.ZodNumber;
|
|
9
|
+
totalCharges: z.ZodNumber;
|
|
10
|
+
depositCount: z.ZodNumber;
|
|
11
|
+
chargeCount: z.ZodNumber;
|
|
12
|
+
modelRevenue: z.ZodArray<z.ZodObject<{
|
|
13
|
+
modelName: z.ZodString;
|
|
14
|
+
modelType: z.ZodEnum<typeof import("../..").MODEL_TYPE>;
|
|
15
|
+
requestCount: z.ZodNumber;
|
|
16
|
+
revenue: z.ZodNumber;
|
|
17
|
+
revenueShare: z.ZodNumber;
|
|
18
|
+
}, z.core.$strip>>;
|
|
19
|
+
dailyBreakdown: z.ZodArray<z.ZodObject<{
|
|
20
|
+
date: z.ZodString;
|
|
21
|
+
deposits: z.ZodNumber;
|
|
22
|
+
charges: z.ZodNumber;
|
|
23
|
+
}, z.core.$strip>>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export declare const GetAdminStatsQuery: {
|
|
26
|
+
method: HTTP_METHODS.GET;
|
|
27
|
+
path: "stats";
|
|
28
|
+
summary: string;
|
|
29
|
+
request: {
|
|
30
|
+
query: z.ZodObject<{
|
|
31
|
+
from: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
32
|
+
to: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
};
|
|
35
|
+
responses: {
|
|
36
|
+
200: z.ZodObject<{
|
|
37
|
+
totalDeposits: z.ZodNumber;
|
|
38
|
+
totalCharges: z.ZodNumber;
|
|
39
|
+
depositCount: z.ZodNumber;
|
|
40
|
+
chargeCount: z.ZodNumber;
|
|
41
|
+
modelRevenue: z.ZodArray<z.ZodObject<{
|
|
42
|
+
modelName: z.ZodString;
|
|
43
|
+
modelType: z.ZodEnum<typeof import("../..").MODEL_TYPE>;
|
|
44
|
+
requestCount: z.ZodNumber;
|
|
45
|
+
revenue: z.ZodNumber;
|
|
46
|
+
revenueShare: z.ZodNumber;
|
|
47
|
+
}, z.core.$strip>>;
|
|
48
|
+
dailyBreakdown: z.ZodArray<z.ZodObject<{
|
|
49
|
+
date: z.ZodString;
|
|
50
|
+
deposits: z.ZodNumber;
|
|
51
|
+
charges: z.ZodNumber;
|
|
52
|
+
}, z.core.$strip>>;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
401: z.ZodType<import("../../../_common").HttpErrorResponse, unknown, z.core.$ZodTypeInternals<import("../../../_common").HttpErrorResponse, unknown>>;
|
|
55
|
+
403: z.ZodType<import("../../../_common").HttpErrorResponse, unknown, z.core.$ZodTypeInternals<import("../../../_common").HttpErrorResponse, unknown>>;
|
|
56
|
+
500: z.ZodType<import("../../../_common").HttpErrorResponse, unknown, z.core.$ZodTypeInternals<import("../../../_common").HttpErrorResponse, unknown>>;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export type GetAdminStatsQueryQueryType = z.infer<typeof GetAdminStatsQueryQuery>;
|
|
60
|
+
export type GetAdminStatsQueryResponseType = z.infer<typeof GetAdminStatsQueryResponse>;
|
|
61
|
+
//# sourceMappingURL=get-admin-stats.query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-admin-stats.query.d.ts","sourceRoot":"","sources":["../../../../billing/endpoints/queries/get-admin-stats.query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,YAAY,EAA2B,MAAM,kBAAkB,CAAC;AAIzF,eAAO,MAAM,uBAAuB;;;iBAGlC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;iBAA2B,CAAC;AAEnE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAa7B,CAAC;AAEH,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAClF,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetAdminStatsQuery = exports.GetAdminStatsQueryResponse = exports.GetAdminStatsQueryQuery = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const _common_1 = require("../../../_common");
|
|
6
|
+
const admin_1 = require("../../../admin/endpoints/admin");
|
|
7
|
+
const models_1 = require("../../models");
|
|
8
|
+
exports.GetAdminStatsQueryQuery = zod_1.z.object({
|
|
9
|
+
from: zod_1.z.coerce.date().optional(),
|
|
10
|
+
to: zod_1.z.coerce.date().optional(),
|
|
11
|
+
});
|
|
12
|
+
exports.GetAdminStatsQueryResponse = models_1.AdminStatsResponseSchema;
|
|
13
|
+
exports.GetAdminStatsQuery = (0, _common_1.defineContract)({
|
|
14
|
+
method: _common_1.HTTP_METHODS.GET,
|
|
15
|
+
path: admin_1.ADMIN_ROUTES.STATS,
|
|
16
|
+
summary: 'Get transaction statistics (deposits and charges) for a date range',
|
|
17
|
+
request: {
|
|
18
|
+
query: exports.GetAdminStatsQueryQuery,
|
|
19
|
+
},
|
|
20
|
+
responses: {
|
|
21
|
+
200: exports.GetAdminStatsQueryResponse,
|
|
22
|
+
401: _common_1.HttpErrorResponseSchema,
|
|
23
|
+
403: _common_1.HttpErrorResponseSchema,
|
|
24
|
+
500: _common_1.HttpErrorResponseSchema,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../billing/endpoints/queries/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./get-admin-stats.query"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../billing/enums/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./model-type.enum"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-type.enum.d.ts","sourceRoot":"","sources":["../../../billing/enums/model-type.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IAClB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,KAAK,UAAU;CAClB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MODEL_TYPE = void 0;
|
|
4
|
+
var MODEL_TYPE;
|
|
5
|
+
(function (MODEL_TYPE) {
|
|
6
|
+
MODEL_TYPE["TEXT"] = "text";
|
|
7
|
+
MODEL_TYPE["IMAGE"] = "image";
|
|
8
|
+
MODEL_TYPE["VIDEO"] = "video";
|
|
9
|
+
})(MODEL_TYPE || (exports.MODEL_TYPE = MODEL_TYPE = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../billing/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./enums"), exports);
|
|
18
|
+
__exportStar(require("./models"), exports);
|
|
19
|
+
__exportStar(require("./endpoints"), exports);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MODEL_TYPE } from '../enums';
|
|
3
|
+
declare const ModelRevenueItemSchema: z.ZodObject<{
|
|
4
|
+
modelName: z.ZodString;
|
|
5
|
+
modelType: z.ZodEnum<typeof MODEL_TYPE>;
|
|
6
|
+
requestCount: z.ZodNumber;
|
|
7
|
+
revenue: z.ZodNumber;
|
|
8
|
+
revenueShare: z.ZodNumber;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
declare const DailyDataPointSchema: z.ZodObject<{
|
|
11
|
+
date: z.ZodString;
|
|
12
|
+
deposits: z.ZodNumber;
|
|
13
|
+
charges: z.ZodNumber;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export declare const AdminStatsResponseSchema: z.ZodObject<{
|
|
16
|
+
totalDeposits: z.ZodNumber;
|
|
17
|
+
totalCharges: z.ZodNumber;
|
|
18
|
+
depositCount: z.ZodNumber;
|
|
19
|
+
chargeCount: z.ZodNumber;
|
|
20
|
+
modelRevenue: z.ZodArray<z.ZodObject<{
|
|
21
|
+
modelName: z.ZodString;
|
|
22
|
+
modelType: z.ZodEnum<typeof MODEL_TYPE>;
|
|
23
|
+
requestCount: z.ZodNumber;
|
|
24
|
+
revenue: z.ZodNumber;
|
|
25
|
+
revenueShare: z.ZodNumber;
|
|
26
|
+
}, z.core.$strip>>;
|
|
27
|
+
dailyBreakdown: z.ZodArray<z.ZodObject<{
|
|
28
|
+
date: z.ZodString;
|
|
29
|
+
deposits: z.ZodNumber;
|
|
30
|
+
charges: z.ZodNumber;
|
|
31
|
+
}, z.core.$strip>>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
export type AdminStatsResponseSchemaType = z.infer<typeof AdminStatsResponseSchema>;
|
|
34
|
+
export type ModelRevenueItem = z.infer<typeof ModelRevenueItemSchema>;
|
|
35
|
+
export type DailyDataPoint = z.infer<typeof DailyDataPointSchema>;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=admin-stats-response.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-stats-response.schema.d.ts","sourceRoot":"","sources":["../../../billing/models/admin-stats-response.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,QAAA,MAAM,sBAAsB;;;;;;iBAM1B,CAAC;AAEH,QAAA,MAAM,oBAAoB;;;;iBAIxB,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;iBAOnC,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AACpF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AdminStatsResponseSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const enums_1 = require("../enums");
|
|
6
|
+
const ModelRevenueItemSchema = zod_1.z.object({
|
|
7
|
+
modelName: zod_1.z.string(),
|
|
8
|
+
modelType: zod_1.z.enum(enums_1.MODEL_TYPE),
|
|
9
|
+
requestCount: zod_1.z.number().int().nonnegative(),
|
|
10
|
+
revenue: zod_1.z.number(),
|
|
11
|
+
revenueShare: zod_1.z.number(),
|
|
12
|
+
});
|
|
13
|
+
const DailyDataPointSchema = zod_1.z.object({
|
|
14
|
+
date: zod_1.z.string(),
|
|
15
|
+
deposits: zod_1.z.number(),
|
|
16
|
+
charges: zod_1.z.number(),
|
|
17
|
+
});
|
|
18
|
+
exports.AdminStatsResponseSchema = zod_1.z.object({
|
|
19
|
+
totalDeposits: zod_1.z.number(),
|
|
20
|
+
totalCharges: zod_1.z.number(),
|
|
21
|
+
depositCount: zod_1.z.number().int().nonnegative(),
|
|
22
|
+
chargeCount: zod_1.z.number().int().nonnegative(),
|
|
23
|
+
modelRevenue: zod_1.z.array(ModelRevenueItemSchema),
|
|
24
|
+
dailyBreakdown: zod_1.z.array(DailyDataPointSchema),
|
|
25
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../billing/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./admin-stats-response.schema"), exports);
|
package/build/errors/errors.d.ts
CHANGED
|
@@ -560,6 +560,11 @@ export declare const ERRORS: {
|
|
|
560
560
|
readonly code: "ADMIN.CANNOT_BAN_ADMIN";
|
|
561
561
|
readonly message: "Невозможно заблокировать администратора";
|
|
562
562
|
};
|
|
563
|
+
readonly STATS_ERROR: {
|
|
564
|
+
readonly httpCode: 500;
|
|
565
|
+
readonly code: "ADMIN.STATS_ERROR";
|
|
566
|
+
readonly message: "Не удалось получить статистику";
|
|
567
|
+
};
|
|
563
568
|
};
|
|
564
569
|
readonly REFERRAL: {
|
|
565
570
|
readonly SELF_REFERRAL: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../errors/errors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../errors/errors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsrBT,CAAC"}
|
package/build/errors/errors.js
CHANGED
|
@@ -563,6 +563,11 @@ exports.ERRORS = {
|
|
|
563
563
|
code: 'ADMIN.CANNOT_BAN_ADMIN',
|
|
564
564
|
message: 'Невозможно заблокировать администратора',
|
|
565
565
|
},
|
|
566
|
+
STATS_ERROR: {
|
|
567
|
+
httpCode: 500,
|
|
568
|
+
code: 'ADMIN.STATS_ERROR',
|
|
569
|
+
message: 'Не удалось получить статистику',
|
|
570
|
+
},
|
|
566
571
|
},
|
|
567
572
|
REFERRAL: {
|
|
568
573
|
SELF_REFERRAL: {
|
|
@@ -20,6 +20,7 @@ const get_admin_referral_config_query_1 = require("../admin/endpoints/queries/ge
|
|
|
20
20
|
const get_admin_users_query_1 = require("../admin/endpoints/queries/get-admin-users.query");
|
|
21
21
|
const get_admin_user_query_1 = require("../admin/endpoints/queries/get-admin-user.query");
|
|
22
22
|
const get_admin_user_transactions_query_1 = require("../admin/endpoints/queries/get-admin-user-transactions.query");
|
|
23
|
+
const get_admin_stats_query_1 = require("../billing/endpoints/queries/get-admin-stats.query");
|
|
23
24
|
const auth_1 = require("../auth/endpoints/auth");
|
|
24
25
|
const change_password_command_1 = require("../auth/endpoints/commands/change-password.command");
|
|
25
26
|
const delete_account_command_1 = require("../auth/endpoints/commands/delete-account.command");
|
|
@@ -225,6 +226,8 @@ async function main() {
|
|
|
225
226
|
registerSchema('AdminGetUserResponse', get_admin_user_query_1.GetAdminUserQueryResponse);
|
|
226
227
|
registerSchema('AdminGetUserTransactionsQuery', get_admin_user_transactions_query_1.GetAdminUserTransactionsQueryQuery);
|
|
227
228
|
registerSchema('AdminGetUserTransactionsResponse', get_admin_user_transactions_query_1.GetAdminUserTransactionsQueryResponse);
|
|
229
|
+
registerSchema('AdminGetStatsQuery', get_admin_stats_query_1.GetAdminStatsQueryQuery);
|
|
230
|
+
registerSchema('AdminGetStatsResponse', get_admin_stats_query_1.GetAdminStatsQueryResponse);
|
|
228
231
|
const authContracts = [
|
|
229
232
|
register_command_1.RegisterCommand,
|
|
230
233
|
login_command_1.LoginCommand,
|
|
@@ -288,6 +291,7 @@ async function main() {
|
|
|
288
291
|
get_admin_users_query_1.GetAdminUsersQuery,
|
|
289
292
|
get_admin_user_query_1.GetAdminUserQuery,
|
|
290
293
|
get_admin_user_transactions_query_1.GetAdminUserTransactionsQuery,
|
|
294
|
+
get_admin_stats_query_1.GetAdminStatsQuery,
|
|
291
295
|
];
|
|
292
296
|
for (const contract of authContracts) {
|
|
293
297
|
const method = contract.method.toLowerCase();
|