@ai-grator/api 0.1.29 → 0.1.31
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/auth/endpoints/commands/register.command.ts +1 -0
- package/build/auth/endpoints/commands/register.command.d.ts +2 -0
- package/build/auth/endpoints/commands/register.command.d.ts.map +1 -1
- package/build/auth/endpoints/commands/register.command.js +1 -0
- package/build/errors/errors.d.ts +25 -0
- package/build/errors/errors.d.ts.map +1 -1
- package/build/errors/errors.js +25 -0
- package/build/message/endpoints/queries/get-message-price-estimate.query.d.ts +2 -2
- package/build/message/endpoints/queries/get-message-price-estimate.query.js +1 -1
- package/build/referral/endpoints/referral.d.ts +6 -0
- package/build/referral/endpoints/referral.d.ts.map +1 -1
- package/build/referral/endpoints/referral.js +7 -1
- package/build/referral/enums/index.d.ts +1 -0
- package/build/referral/enums/index.d.ts.map +1 -1
- package/build/referral/enums/index.js +1 -0
- package/build/referral/enums/tool.enum.d.ts +6 -0
- package/build/referral/enums/tool.enum.d.ts.map +1 -0
- package/build/referral/enums/tool.enum.js +9 -0
- package/build/referral/models/index.d.ts +1 -0
- package/build/referral/models/index.d.ts.map +1 -1
- package/build/referral/models/index.js +1 -0
- package/build/referral/models/referral-link-response.schema.d.ts +95 -0
- package/build/referral/models/referral-link-response.schema.d.ts.map +1 -0
- package/build/referral/models/referral-link-response.schema.js +65 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/errors/errors.ts +25 -0
- package/message/endpoints/queries/get-message-price-estimate.query.ts +1 -1
- package/package.json +1 -1
- package/referral/endpoints/referral.ts +8 -0
- package/referral/enums/index.ts +1 -0
- package/referral/enums/tool.enum.ts +5 -0
- package/referral/models/index.ts +1 -0
- package/referral/models/referral-link-response.schema.ts +92 -0
package/errors/errors.ts
CHANGED
|
@@ -702,6 +702,31 @@ export const ERRORS = {
|
|
|
702
702
|
code: 'REFERRAL.UPDATE_ERROR',
|
|
703
703
|
message: 'Не удалось обновить конфигурацию реферальной программы',
|
|
704
704
|
},
|
|
705
|
+
TOOL_REQUIRED_FOR_MODEL: {
|
|
706
|
+
httpCode: 400,
|
|
707
|
+
code: 'REFERRAL.TOOL_REQUIRED_FOR_MODEL',
|
|
708
|
+
message: 'Для выбора модели необходимо указать инструмент',
|
|
709
|
+
},
|
|
710
|
+
LINK_LIMIT_REACHED: {
|
|
711
|
+
httpCode: 400,
|
|
712
|
+
code: 'REFERRAL.LINK_LIMIT_REACHED',
|
|
713
|
+
message: 'Достигнут лимит реферальных ссылок',
|
|
714
|
+
},
|
|
715
|
+
LINK_HAS_REFERRALS: {
|
|
716
|
+
httpCode: 409,
|
|
717
|
+
code: 'REFERRAL.LINK_HAS_REFERRALS',
|
|
718
|
+
message: 'Нельзя удалить ссылку, по которой уже пришли рефералы',
|
|
719
|
+
},
|
|
720
|
+
LINK_NOT_FOUND: {
|
|
721
|
+
httpCode: 404,
|
|
722
|
+
code: 'REFERRAL.LINK_NOT_FOUND',
|
|
723
|
+
message: 'Реферальная ссылка не найдена',
|
|
724
|
+
},
|
|
725
|
+
MODEL_NOT_AVAILABLE_IN_TOOL: {
|
|
726
|
+
httpCode: 400,
|
|
727
|
+
code: 'REFERRAL.MODEL_NOT_AVAILABLE_IN_TOOL',
|
|
728
|
+
message: 'Выбранная модель недоступна в этом инструменте',
|
|
729
|
+
},
|
|
705
730
|
},
|
|
706
731
|
EMAIL: {
|
|
707
732
|
SEND_ERROR: {
|
|
@@ -3,7 +3,7 @@ import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../
|
|
|
3
3
|
import { MESSAGE_ROUTES } from '../message';
|
|
4
4
|
|
|
5
5
|
export const GetMessagePriceEstimateBody = z.object({
|
|
6
|
-
|
|
6
|
+
message: z.string(),
|
|
7
7
|
aiModelId: z.uuid(),
|
|
8
8
|
chatId: z.uuid().optional(),
|
|
9
9
|
fileIds: z.array(uuid()).optional(),
|
package/package.json
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
export const REFERRAL_CONTROLLER = 'referral' as const;
|
|
2
2
|
|
|
3
|
+
export const REFERRAL_LINK_PATH = 'r' as const;
|
|
4
|
+
|
|
5
|
+
export const REFERRAL_UTM_MEDIUM = 'referral' as const;
|
|
6
|
+
|
|
3
7
|
export const REFERRAL_ROUTES = {
|
|
4
8
|
GET_CONFIG: 'config',
|
|
5
9
|
GET_STATS: 'stats',
|
|
6
10
|
GET_BONUS_HISTORY: 'bonus-history',
|
|
11
|
+
CREATE_LINK: 'link',
|
|
12
|
+
GET_LINKS: 'links',
|
|
13
|
+
DELETE_LINK: 'link/:code',
|
|
14
|
+
RESOLVE_LINK: 'resolve/:code',
|
|
7
15
|
} as const;
|
package/referral/enums/index.ts
CHANGED
package/referral/models/index.ts
CHANGED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { TOOL } from '../enums';
|
|
3
|
+
|
|
4
|
+
export const CreateReferralLinkBodySchema = z.object({
|
|
5
|
+
tool: z.enum(TOOL).optional(),
|
|
6
|
+
modelUuid: z.uuid().optional(),
|
|
7
|
+
source: z.string().trim().min(1).max(100).optional(),
|
|
8
|
+
description: z.string().trim().min(1).max(200).optional(),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export type CreateReferralLinkBodySchemaType = z.infer<typeof CreateReferralLinkBodySchema>;
|
|
12
|
+
|
|
13
|
+
export const CreateReferralLinkResponseSchema = z.object({
|
|
14
|
+
link: z.url(),
|
|
15
|
+
code: z.string(),
|
|
16
|
+
description: z.string().nullable(),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export type CreateReferralLinkResponseSchemaType = z.infer<typeof CreateReferralLinkResponseSchema>;
|
|
20
|
+
|
|
21
|
+
export const ReferralLinkListItemSchema = z.object({
|
|
22
|
+
code: z.string(),
|
|
23
|
+
link: z.url(),
|
|
24
|
+
tool: z.enum(TOOL).nullable(),
|
|
25
|
+
modelUuid: z.uuid().nullable(),
|
|
26
|
+
source: z.string().nullable(),
|
|
27
|
+
description: z.string().nullable(),
|
|
28
|
+
referralsCount: z.number().int().nonnegative(),
|
|
29
|
+
createdAt: z.iso.datetime(),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export type ReferralLinkListItemSchemaType = z.infer<typeof ReferralLinkListItemSchema>;
|
|
33
|
+
|
|
34
|
+
export const GetReferralLinksResponseSchema = z.object({
|
|
35
|
+
links: z.array(ReferralLinkListItemSchema),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export type GetReferralLinksResponseSchemaType = z.infer<typeof GetReferralLinksResponseSchema>;
|
|
39
|
+
|
|
40
|
+
export const DeleteReferralLinkParamsSchema = z.object({
|
|
41
|
+
code: z.string().min(1).max(32),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export type DeleteReferralLinkParamsSchemaType = z.infer<typeof DeleteReferralLinkParamsSchema>;
|
|
45
|
+
|
|
46
|
+
export const DeleteReferralLinkResponseSchema = z.object({
|
|
47
|
+
isDeleted: z.literal(true),
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export type DeleteReferralLinkResponseSchemaType = z.infer<typeof DeleteReferralLinkResponseSchema>;
|
|
51
|
+
|
|
52
|
+
export const ResolveReferralLinkParamsSchema = z.object({
|
|
53
|
+
code: z.string().min(1).max(32),
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export type ResolveReferralLinkParamsSchemaType = z.infer<typeof ResolveReferralLinkParamsSchema>;
|
|
57
|
+
|
|
58
|
+
export const ReferralLinkVisitParamsSchema = z.object({
|
|
59
|
+
referral: z.object({
|
|
60
|
+
code: z.string(),
|
|
61
|
+
refId: z.uuid(),
|
|
62
|
+
tool: z.enum(TOOL).nullable(),
|
|
63
|
+
model: z.string().nullable(),
|
|
64
|
+
source: z.string().nullable(),
|
|
65
|
+
}),
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export type ReferralLinkVisitParamsSchemaType = z.infer<typeof ReferralLinkVisitParamsSchema>;
|
|
69
|
+
|
|
70
|
+
export const ReferralLinkUtmSchema = z.object({
|
|
71
|
+
utm_source: z.string(),
|
|
72
|
+
utm_medium: z.string(),
|
|
73
|
+
utm_campaign: z.string(),
|
|
74
|
+
utm_content: z.string().nullable(),
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
export type ReferralLinkUtmSchemaType = z.infer<typeof ReferralLinkUtmSchema>;
|
|
78
|
+
|
|
79
|
+
export const ResolveReferralLinkResponseSchema = z.object({
|
|
80
|
+
referrerId: z.uuid(),
|
|
81
|
+
tool: z.enum(TOOL).nullable(),
|
|
82
|
+
modelUuid: z.uuid().nullable(),
|
|
83
|
+
modelName: z.string().nullable(),
|
|
84
|
+
source: z.string().nullable(),
|
|
85
|
+
metrica: z.object({
|
|
86
|
+
params: ReferralLinkVisitParamsSchema,
|
|
87
|
+
utm: ReferralLinkUtmSchema,
|
|
88
|
+
utmQuery: z.string(),
|
|
89
|
+
}),
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
export type ResolveReferralLinkResponseSchemaType = z.infer<typeof ResolveReferralLinkResponseSchema>;
|