@purpleschool/gptbot 0.10.5 → 0.10.7
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/api/controllers/http/team-account.ts +2 -0
- package/build/api/controllers/http/team-account.js +2 -0
- package/build/commands/product/find-product.command.js +4 -0
- package/build/commands/subscription/find-subscription.command.js +4 -0
- package/build/commands/team-account/get-team-account-statistics-by-month.command.js +34 -0
- package/build/commands/team-account/get-team-account-statistics-overview.command.js +28 -0
- package/build/commands/team-account/index.js +2 -0
- package/commands/product/find-product.command.ts +7 -0
- package/commands/subscription/find-subscription.command.ts +7 -0
- package/commands/team-account/get-team-account-statistics-by-month.command.ts +37 -0
- package/commands/team-account/get-team-account-statistics-overview.command.ts +31 -0
- package/commands/team-account/index.ts +2 -0
- package/package.json +1 -1
|
@@ -16,6 +16,8 @@ export const TEAM_ACCOUNT_ROUTES = {
|
|
|
16
16
|
GET_CURRENT_PRODUCTS: 'products/current',
|
|
17
17
|
GET_CURRENT_SUBSCRIPTIONS: 'subscriptions/current',
|
|
18
18
|
GET_BALANCE: 'balance',
|
|
19
|
+
GET_STATISTICS_OVERVIEW: 'statistics/overview',
|
|
20
|
+
GET_STATISTICS_BY_MONTH: 'statistics/by-month',
|
|
19
21
|
CREATE_MANUAL_SUBSCRIPTION: 'manual/subscription',
|
|
20
22
|
CREATE_MANUAL_PRODUCT: 'manual/product',
|
|
21
23
|
ADMIN_FIND_BY_NAME: 'admin/find',
|
|
@@ -18,6 +18,8 @@ exports.TEAM_ACCOUNT_ROUTES = {
|
|
|
18
18
|
GET_CURRENT_PRODUCTS: 'products/current',
|
|
19
19
|
GET_CURRENT_SUBSCRIPTIONS: 'subscriptions/current',
|
|
20
20
|
GET_BALANCE: 'balance',
|
|
21
|
+
GET_STATISTICS_OVERVIEW: 'statistics/overview',
|
|
22
|
+
GET_STATISTICS_BY_MONTH: 'statistics/by-month',
|
|
21
23
|
CREATE_MANUAL_SUBSCRIPTION: 'manual/subscription',
|
|
22
24
|
CREATE_MANUAL_PRODUCT: 'manual/product',
|
|
23
25
|
ADMIN_FIND_BY_NAME: 'admin/find',
|
|
@@ -3,11 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FindProductCommand = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const models_1 = require("../../models");
|
|
6
|
+
const constants_1 = require("../../constants");
|
|
6
7
|
var FindProductCommand;
|
|
7
8
|
(function (FindProductCommand) {
|
|
8
9
|
FindProductCommand.RequestSchema = models_1.ProductSchema.pick({
|
|
9
10
|
uuid: true,
|
|
10
11
|
});
|
|
12
|
+
FindProductCommand.RequestQuerySchema = zod_1.z.object({
|
|
13
|
+
billingScope: zod_1.z.nativeEnum(constants_1.BILLING_SCOPE).default(constants_1.BILLING_SCOPE.USER),
|
|
14
|
+
});
|
|
11
15
|
FindProductCommand.ResponseSchema = zod_1.z.object({
|
|
12
16
|
data: zod_1.z.array(models_1.ProductSchema),
|
|
13
17
|
});
|
|
@@ -3,11 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FindSubscriptionCommand = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const models_1 = require("../../models");
|
|
6
|
+
const constants_1 = require("../../constants");
|
|
6
7
|
var FindSubscriptionCommand;
|
|
7
8
|
(function (FindSubscriptionCommand) {
|
|
8
9
|
FindSubscriptionCommand.RequestSchema = models_1.SubscriptionSchema.pick({
|
|
9
10
|
uuid: true,
|
|
10
11
|
});
|
|
12
|
+
FindSubscriptionCommand.RequestQuerySchema = zod_1.z.object({
|
|
13
|
+
billingScope: zod_1.z.nativeEnum(constants_1.BILLING_SCOPE).default(constants_1.BILLING_SCOPE.USER),
|
|
14
|
+
});
|
|
11
15
|
FindSubscriptionCommand.ResponseSchema = zod_1.z.object({
|
|
12
16
|
data: zod_1.z.array(models_1.SubscriptionWithSubTypesSchema),
|
|
13
17
|
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetTeamAccountStatisticsByMonthCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
var GetTeamAccountStatisticsByMonthCommand;
|
|
7
|
+
(function (GetTeamAccountStatisticsByMonthCommand) {
|
|
8
|
+
GetTeamAccountStatisticsByMonthCommand.RequestSchema = zod_1.z.object({
|
|
9
|
+
origin: zod_1.z.nativeEnum(constants_1.JOB_REQUEST_ORIGIN).default(constants_1.JOB_REQUEST_ORIGIN.API).optional(),
|
|
10
|
+
metric: zod_1.z
|
|
11
|
+
.nativeEnum(constants_1.STATISTICS_METRIC_TYPE)
|
|
12
|
+
.default(constants_1.STATISTICS_METRIC_TYPE.REQUESTS)
|
|
13
|
+
.optional(),
|
|
14
|
+
memberUserId: zod_1.z.string().uuid().optional(),
|
|
15
|
+
});
|
|
16
|
+
GetTeamAccountStatisticsByMonthCommand.TeamAccountStatisticsByMonthItemSchema = zod_1.z.object({
|
|
17
|
+
month: zod_1.z.string(),
|
|
18
|
+
total_texts: zod_1.z.number(),
|
|
19
|
+
total_audios: zod_1.z.number(),
|
|
20
|
+
total_images: zod_1.z.number(),
|
|
21
|
+
total_videos: zod_1.z.number(),
|
|
22
|
+
total_presentations: zod_1.z.number(),
|
|
23
|
+
total_paraphrases: zod_1.z.number(),
|
|
24
|
+
writers: zod_1.z.object({
|
|
25
|
+
total_writers: zod_1.z.number(),
|
|
26
|
+
total_writer_actions: zod_1.z.number(),
|
|
27
|
+
}),
|
|
28
|
+
total_video_edits: zod_1.z.number(),
|
|
29
|
+
total_musics: zod_1.z.number(),
|
|
30
|
+
});
|
|
31
|
+
GetTeamAccountStatisticsByMonthCommand.ResponseSchema = zod_1.z.object({
|
|
32
|
+
data: zod_1.z.array(GetTeamAccountStatisticsByMonthCommand.TeamAccountStatisticsByMonthItemSchema),
|
|
33
|
+
});
|
|
34
|
+
})(GetTeamAccountStatisticsByMonthCommand || (exports.GetTeamAccountStatisticsByMonthCommand = GetTeamAccountStatisticsByMonthCommand = {}));
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetTeamAccountStatisticsOverviewCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
var GetTeamAccountStatisticsOverviewCommand;
|
|
7
|
+
(function (GetTeamAccountStatisticsOverviewCommand) {
|
|
8
|
+
GetTeamAccountStatisticsOverviewCommand.RequestSchema = zod_1.z.object({
|
|
9
|
+
startDate: zod_1.z.string().refine((v) => !isNaN(Date.parse(v)), {
|
|
10
|
+
message: 'from must be a valid date string',
|
|
11
|
+
}),
|
|
12
|
+
endDate: zod_1.z.string().refine((v) => !isNaN(Date.parse(v)), {
|
|
13
|
+
message: 'to must be a valid date string',
|
|
14
|
+
}),
|
|
15
|
+
groupBy: zod_1.z.nativeEnum(constants_1.GROUP_BY).default(constants_1.GROUP_BY.DAY),
|
|
16
|
+
origin: zod_1.z.nativeEnum(constants_1.JOB_REQUEST_ORIGIN).default(constants_1.JOB_REQUEST_ORIGIN.API).optional(),
|
|
17
|
+
memberUserId: zod_1.z.string().uuid().optional(),
|
|
18
|
+
});
|
|
19
|
+
GetTeamAccountStatisticsOverviewCommand.TeamAccountStatisticsOverviewItemSchema = zod_1.z.object({
|
|
20
|
+
startDate: zod_1.z.string(),
|
|
21
|
+
endDate: zod_1.z.string(),
|
|
22
|
+
total_tokens: zod_1.z.number(),
|
|
23
|
+
total_messages: zod_1.z.number(),
|
|
24
|
+
});
|
|
25
|
+
GetTeamAccountStatisticsOverviewCommand.ResponseSchema = zod_1.z.object({
|
|
26
|
+
data: zod_1.z.array(GetTeamAccountStatisticsOverviewCommand.TeamAccountStatisticsOverviewItemSchema),
|
|
27
|
+
});
|
|
28
|
+
})(GetTeamAccountStatisticsOverviewCommand || (exports.GetTeamAccountStatisticsOverviewCommand = GetTeamAccountStatisticsOverviewCommand = {}));
|
|
@@ -28,6 +28,8 @@ __exportStar(require("./find-team-account-products.command"), exports);
|
|
|
28
28
|
__exportStar(require("./find-team-account-subscriptions.command"), exports);
|
|
29
29
|
__exportStar(require("./find-current-team-account-products.command"), exports);
|
|
30
30
|
__exportStar(require("./find-current-team-account-subscriptions.command"), exports);
|
|
31
|
+
__exportStar(require("./get-team-account-statistics-overview.command"), exports);
|
|
32
|
+
__exportStar(require("./get-team-account-statistics-by-month.command"), exports);
|
|
31
33
|
__exportStar(require("./get-team-account-balance.command"), exports);
|
|
32
34
|
__exportStar(require("./create-manual-team-subscription.command"), exports);
|
|
33
35
|
__exportStar(require("./create-manual-team-product.command"), exports);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ProductSchema } from '../../models';
|
|
3
|
+
import { BILLING_SCOPE } from '../../constants';
|
|
3
4
|
|
|
4
5
|
export namespace FindProductCommand {
|
|
5
6
|
export const RequestSchema = ProductSchema.pick({
|
|
@@ -8,6 +9,12 @@ export namespace FindProductCommand {
|
|
|
8
9
|
|
|
9
10
|
export type Request = z.infer<typeof RequestSchema>;
|
|
10
11
|
|
|
12
|
+
export const RequestQuerySchema = z.object({
|
|
13
|
+
billingScope: z.nativeEnum(BILLING_SCOPE).default(BILLING_SCOPE.USER),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
|
17
|
+
|
|
11
18
|
export const ResponseSchema = z.object({
|
|
12
19
|
data: z.array(ProductSchema),
|
|
13
20
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { SubscriptionSchema, SubscriptionWithSubTypesSchema } from '../../models';
|
|
3
|
+
import { BILLING_SCOPE } from '../../constants';
|
|
3
4
|
|
|
4
5
|
export namespace FindSubscriptionCommand {
|
|
5
6
|
export const RequestSchema = SubscriptionSchema.pick({
|
|
@@ -8,6 +9,12 @@ export namespace FindSubscriptionCommand {
|
|
|
8
9
|
|
|
9
10
|
export type Request = z.infer<typeof RequestSchema>;
|
|
10
11
|
|
|
12
|
+
export const RequestQuerySchema = z.object({
|
|
13
|
+
billingScope: z.nativeEnum(BILLING_SCOPE).default(BILLING_SCOPE.USER),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
|
17
|
+
|
|
11
18
|
export const ResponseSchema = z.object({
|
|
12
19
|
data: z.array(SubscriptionWithSubTypesSchema),
|
|
13
20
|
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { JOB_REQUEST_ORIGIN, STATISTICS_METRIC_TYPE } from '../../constants';
|
|
3
|
+
|
|
4
|
+
export namespace GetTeamAccountStatisticsByMonthCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
origin: z.nativeEnum(JOB_REQUEST_ORIGIN).default(JOB_REQUEST_ORIGIN.API).optional(),
|
|
7
|
+
metric: z
|
|
8
|
+
.nativeEnum(STATISTICS_METRIC_TYPE)
|
|
9
|
+
.default(STATISTICS_METRIC_TYPE.REQUESTS)
|
|
10
|
+
.optional(),
|
|
11
|
+
memberUserId: z.string().uuid().optional(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
15
|
+
|
|
16
|
+
export const TeamAccountStatisticsByMonthItemSchema = z.object({
|
|
17
|
+
month: z.string(),
|
|
18
|
+
total_texts: z.number(),
|
|
19
|
+
total_audios: z.number(),
|
|
20
|
+
total_images: z.number(),
|
|
21
|
+
total_videos: z.number(),
|
|
22
|
+
total_presentations: z.number(),
|
|
23
|
+
total_paraphrases: z.number(),
|
|
24
|
+
writers: z.object({
|
|
25
|
+
total_writers: z.number(),
|
|
26
|
+
total_writer_actions: z.number(),
|
|
27
|
+
}),
|
|
28
|
+
total_video_edits: z.number(),
|
|
29
|
+
total_musics: z.number(),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const ResponseSchema = z.object({
|
|
33
|
+
data: z.array(TeamAccountStatisticsByMonthItemSchema),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { GROUP_BY, JOB_REQUEST_ORIGIN } from '../../constants';
|
|
3
|
+
|
|
4
|
+
export namespace GetTeamAccountStatisticsOverviewCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
startDate: z.string().refine((v) => !isNaN(Date.parse(v)), {
|
|
7
|
+
message: 'from must be a valid date string',
|
|
8
|
+
}),
|
|
9
|
+
endDate: z.string().refine((v) => !isNaN(Date.parse(v)), {
|
|
10
|
+
message: 'to must be a valid date string',
|
|
11
|
+
}),
|
|
12
|
+
groupBy: z.nativeEnum(GROUP_BY).default(GROUP_BY.DAY),
|
|
13
|
+
origin: z.nativeEnum(JOB_REQUEST_ORIGIN).default(JOB_REQUEST_ORIGIN.API).optional(),
|
|
14
|
+
memberUserId: z.string().uuid().optional(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
18
|
+
|
|
19
|
+
export const TeamAccountStatisticsOverviewItemSchema = z.object({
|
|
20
|
+
startDate: z.string(),
|
|
21
|
+
endDate: z.string(),
|
|
22
|
+
total_tokens: z.number(),
|
|
23
|
+
total_messages: z.number(),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const ResponseSchema = z.object({
|
|
27
|
+
data: z.array(TeamAccountStatisticsOverviewItemSchema),
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
31
|
+
}
|
|
@@ -12,6 +12,8 @@ export * from './find-team-account-products.command';
|
|
|
12
12
|
export * from './find-team-account-subscriptions.command';
|
|
13
13
|
export * from './find-current-team-account-products.command';
|
|
14
14
|
export * from './find-current-team-account-subscriptions.command';
|
|
15
|
+
export * from './get-team-account-statistics-overview.command';
|
|
16
|
+
export * from './get-team-account-statistics-by-month.command';
|
|
15
17
|
export * from './get-team-account-balance.command';
|
|
16
18
|
export * from './create-manual-team-subscription.command';
|
|
17
19
|
export * from './create-manual-team-product.command';
|