@purpleschool/gptbot 0.10.5 → 0.10.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.
@@ -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',
@@ -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);
@@ -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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.10.5",
3
+ "version": "0.10.6",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",