@ai-grator/api 0.2.50 → 0.2.53
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/_common/error.contract.ts +2 -0
- package/admin/endpoints/admin.ts +4 -0
- package/admin/endpoints/queries/get-admin-partner-links-stats.query.ts +33 -0
- package/admin/endpoints/queries/get-admin-partner-referral-deposits.query.ts +36 -0
- package/admin/endpoints/queries/get-admin-partner-referrals-deposits-stats.query.ts +42 -0
- package/admin/endpoints/queries/index.ts +3 -0
- package/build/_common/error.contract.d.ts +1 -0
- package/build/_common/error.contract.d.ts.map +1 -1
- package/build/_common/error.contract.js +1 -0
- package/build/admin/endpoints/admin.d.ts +3 -0
- package/build/admin/endpoints/admin.d.ts.map +1 -1
- package/build/admin/endpoints/admin.js +3 -0
- package/build/admin/endpoints/queries/get-admin-partner-links-stats.query.d.ts +77 -0
- package/build/admin/endpoints/queries/get-admin-partner-links-stats.query.d.ts.map +1 -0
- package/build/admin/endpoints/queries/get-admin-partner-links-stats.query.js +28 -0
- package/build/admin/endpoints/queries/get-admin-partner-referral-deposits.query.d.ts +57 -0
- package/build/admin/endpoints/queries/get-admin-partner-referral-deposits.query.d.ts.map +1 -0
- package/build/admin/endpoints/queries/get-admin-partner-referral-deposits.query.js +29 -0
- package/build/admin/endpoints/queries/get-admin-partner-referrals-deposits-stats.query.d.ts +59 -0
- package/build/admin/endpoints/queries/get-admin-partner-referrals-deposits-stats.query.d.ts.map +1 -0
- package/build/admin/endpoints/queries/get-admin-partner-referrals-deposits-stats.query.js +28 -0
- package/build/admin/endpoints/queries/index.d.ts +3 -0
- package/build/admin/endpoints/queries/index.d.ts.map +1 -1
- package/build/admin/endpoints/queries/index.js +3 -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/generation-model/endpoints/queries/get-generation-models-by-type.query.d.ts +4 -0
- package/build/generation-model/endpoints/queries/get-generation-models-by-type.query.d.ts.map +1 -1
- package/build/generation-model/endpoints/queries/get-generation-models.query.d.ts +4 -0
- package/build/generation-model/endpoints/queries/get-generation-models.query.d.ts.map +1 -1
- package/build/generation-model/endpoints/queries/get-generation-price.query.d.ts +2 -0
- package/build/generation-model/endpoints/queries/get-generation-price.query.d.ts.map +1 -1
- package/build/generation-model/endpoints/queries/get-generation-price.query.js +1 -0
- package/build/generation-model/models/generation-model-response.schema.d.ts +4 -0
- package/build/generation-model/models/generation-model-response.schema.d.ts.map +1 -1
- package/build/generation-model/models/generation-model-response.schema.js +5 -1
- package/build/referral/endpoints/referral.d.ts +4 -0
- package/build/referral/endpoints/referral.d.ts.map +1 -1
- package/build/referral/endpoints/referral.js +4 -0
- package/build/referral/models/index.d.ts +3 -0
- package/build/referral/models/index.d.ts.map +1 -1
- package/build/referral/models/index.js +3 -0
- package/build/referral/models/referral-deposits-stats-response.schema.d.ts +63 -0
- package/build/referral/models/referral-deposits-stats-response.schema.d.ts.map +1 -0
- package/build/referral/models/referral-deposits-stats-response.schema.js +34 -0
- package/build/referral/models/referral-link-stats-response.schema.d.ts +88 -0
- package/build/referral/models/referral-link-stats-response.schema.d.ts.map +1 -0
- package/build/referral/models/referral-link-stats-response.schema.js +25 -0
- package/build/referral/models/referral-stats-period.schema.d.ts +7 -0
- package/build/referral/models/referral-stats-period.schema.d.ts.map +1 -0
- package/build/referral/models/referral-stats-period.schema.js +9 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/errors/errors.ts +25 -0
- package/generation-model/endpoints/queries/get-generation-price.query.ts +1 -0
- package/generation-model/models/generation-model-response.schema.ts +6 -0
- package/package.json +1 -1
- package/referral/endpoints/referral.ts +4 -0
- package/referral/models/index.ts +3 -0
- package/referral/models/referral-deposits-stats-response.schema.ts +57 -0
- package/referral/models/referral-link-stats-response.schema.ts +42 -0
- package/referral/models/referral-stats-period.schema.ts +10 -0
package/errors/errors.ts
CHANGED
|
@@ -338,6 +338,16 @@ export const ERRORS = {
|
|
|
338
338
|
code: 'GENERATION_JOB.ATTACHMENT_SLOT_NOT_MULTIPLE',
|
|
339
339
|
message: 'Превышено максимальное количество файлов для этого слота вложения',
|
|
340
340
|
},
|
|
341
|
+
CONFLICTING_ATTACHMENT_SLOTS: {
|
|
342
|
+
httpCode: 400,
|
|
343
|
+
code: 'GENERATION_JOB.CONFLICTING_ATTACHMENT_SLOTS',
|
|
344
|
+
message: 'Эти вложения нельзя использовать вместе в одной генерации',
|
|
345
|
+
},
|
|
346
|
+
ATTACHMENT_SLOT_REQUIRES_COMPANION: {
|
|
347
|
+
httpCode: 400,
|
|
348
|
+
code: 'GENERATION_JOB.ATTACHMENT_SLOT_REQUIRES_COMPANION',
|
|
349
|
+
message: 'Это вложение нельзя использовать без другого обязательного вложения',
|
|
350
|
+
},
|
|
341
351
|
CHAT_MODEL_MISMATCH: {
|
|
342
352
|
httpCode: 400,
|
|
343
353
|
code: 'GENERATION_JOB.CHAT_MODEL_MISMATCH',
|
|
@@ -628,6 +638,11 @@ export const ERRORS = {
|
|
|
628
638
|
code: 'AUTH.EMAIL_ALREADY_EXISTS',
|
|
629
639
|
message: 'Пользователь с этим адресом электронной почты уже существует',
|
|
630
640
|
},
|
|
641
|
+
EMAIL_DOMAIN_NOT_ALLOWED: {
|
|
642
|
+
httpCode: 400,
|
|
643
|
+
code: 'AUTH.EMAIL_DOMAIN_NOT_ALLOWED',
|
|
644
|
+
message: 'Не удалось принять этот адрес. Попробуйте личную почту, например Яндекс или Mail.ru.',
|
|
645
|
+
},
|
|
631
646
|
INVALID_VERIFY_TOKEN: {
|
|
632
647
|
httpCode: 400,
|
|
633
648
|
code: 'AUTH.INVALID_VERIFY_TOKEN',
|
|
@@ -742,6 +757,16 @@ export const ERRORS = {
|
|
|
742
757
|
code: 'REFERRAL.MODEL_NOT_AVAILABLE_IN_TOOL',
|
|
743
758
|
message: 'Выбранная модель недоступна в этом инструменте',
|
|
744
759
|
},
|
|
760
|
+
VISIT_RECORD_ERROR: {
|
|
761
|
+
httpCode: 500,
|
|
762
|
+
code: 'REFERRAL.VISIT_RECORD_ERROR',
|
|
763
|
+
message: 'Не удалось записать переход по реферальной ссылке',
|
|
764
|
+
},
|
|
765
|
+
REFEREE_NOT_FOUND: {
|
|
766
|
+
httpCode: 404,
|
|
767
|
+
code: 'REFERRAL.REFEREE_NOT_FOUND',
|
|
768
|
+
message: 'Реферал не найден',
|
|
769
|
+
},
|
|
745
770
|
},
|
|
746
771
|
EMAIL: {
|
|
747
772
|
SEND_ERROR: {
|
|
@@ -8,6 +8,7 @@ export const GetGenerationPriceBodyParams = z.object({
|
|
|
8
8
|
|
|
9
9
|
export const GetGenerationPriceBody = z.object({
|
|
10
10
|
params: z.record(z.string(), z.unknown()),
|
|
11
|
+
attachments: z.record(z.string(), z.array(z.uuid())).optional(),
|
|
11
12
|
});
|
|
12
13
|
|
|
13
14
|
export const GetGenerationPriceResponse = z.object({
|
|
@@ -17,6 +17,10 @@ export const AttachmentSlotSchema = z.object({
|
|
|
17
17
|
|
|
18
18
|
export const AttachmentPolicySchema = z.record(z.string(), AttachmentSlotSchema);
|
|
19
19
|
|
|
20
|
+
export const AttachmentSlotConflictSchema = z.tuple([z.array(z.string()), z.array(z.string())]);
|
|
21
|
+
|
|
22
|
+
export const DependentAttachmentSlotsSchema = z.record(z.string(), z.array(z.string()));
|
|
23
|
+
|
|
20
24
|
export const GenerationModelResponseSchema = z.object({
|
|
21
25
|
uuid: z.uuid(),
|
|
22
26
|
titleModel: z.string().min(1),
|
|
@@ -29,6 +33,8 @@ export const GenerationModelResponseSchema = z.object({
|
|
|
29
33
|
isActive: z.boolean(),
|
|
30
34
|
isNew: z.boolean(),
|
|
31
35
|
attachmentPolicy: AttachmentPolicySchema,
|
|
36
|
+
conflictingSlots: z.array(AttachmentSlotConflictSchema),
|
|
37
|
+
dependentSlots: DependentAttachmentSlotsSchema,
|
|
32
38
|
paramsSchema: JsonObjectSchema,
|
|
33
39
|
pricingPolicy: PricingPolicySchema,
|
|
34
40
|
});
|
package/package.json
CHANGED
|
@@ -12,4 +12,8 @@ export const REFERRAL_ROUTES = {
|
|
|
12
12
|
GET_LINKS: 'links',
|
|
13
13
|
DELETE_LINK: 'link/:code',
|
|
14
14
|
RESOLVE_LINK: 'resolve/:code',
|
|
15
|
+
VISIT_LINK: 'links/:code/visit',
|
|
16
|
+
GET_LINKS_STATS: 'links/stats',
|
|
17
|
+
GET_REFERRALS_DEPOSITS_STATS: 'referrals',
|
|
18
|
+
GET_REFERRAL_DEPOSITS: 'referrals/:refereeId/deposits',
|
|
15
19
|
} as const;
|
package/referral/models/index.ts
CHANGED
|
@@ -3,3 +3,6 @@ export * from './partner-referral-rate-config.schema';
|
|
|
3
3
|
export * from './referral-stats-response.schema';
|
|
4
4
|
export * from './bonus-history-response.schema';
|
|
5
5
|
export * from './referral-link-response.schema';
|
|
6
|
+
export * from './referral-stats-period.schema';
|
|
7
|
+
export * from './referral-link-stats-response.schema';
|
|
8
|
+
export * from './referral-deposits-stats-response.schema';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineCursorPaginationQuery } from '../../_common';
|
|
3
|
+
import { ReferralStatsPeriodQuerySchema } from './referral-stats-period.schema';
|
|
4
|
+
|
|
5
|
+
export const ReferralStatsPageQuerySchema = defineCursorPaginationQuery(z.uuid()).extend(
|
|
6
|
+
ReferralStatsPeriodQuerySchema.shape,
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
export type ReferralStatsPageQuerySchemaType = z.infer<typeof ReferralStatsPageQuerySchema>;
|
|
10
|
+
|
|
11
|
+
export const GetReferralsDepositsStatsQuerySchema = ReferralStatsPageQuerySchema;
|
|
12
|
+
|
|
13
|
+
export type GetReferralsDepositsStatsQuerySchemaType = z.infer<typeof GetReferralsDepositsStatsQuerySchema>;
|
|
14
|
+
|
|
15
|
+
export const ReferralDepositsStatsItemSchema = z.object({
|
|
16
|
+
refereeId: z.uuid(),
|
|
17
|
+
depositsCount: z.number().int().nonnegative(),
|
|
18
|
+
earnedAmount: z.number().nonnegative(),
|
|
19
|
+
emailConfirmedAt: z.iso.datetime().nullable(),
|
|
20
|
+
firstDepositAt: z.iso.datetime().nullable(),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export type ReferralDepositsStatsItemSchemaType = z.infer<typeof ReferralDepositsStatsItemSchema>;
|
|
24
|
+
|
|
25
|
+
export const GetReferralsDepositsStatsResponseSchema = z.object({
|
|
26
|
+
referrals: z.array(ReferralDepositsStatsItemSchema),
|
|
27
|
+
nextCursor: z.uuid().nullable(),
|
|
28
|
+
hasMore: z.boolean(),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export type GetReferralsDepositsStatsResponseSchemaType = z.infer<typeof GetReferralsDepositsStatsResponseSchema>;
|
|
32
|
+
|
|
33
|
+
export const GetReferralDepositsParamsSchema = z.object({
|
|
34
|
+
refereeId: z.uuid(),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export type GetReferralDepositsParamsSchemaType = z.infer<typeof GetReferralDepositsParamsSchema>;
|
|
38
|
+
|
|
39
|
+
export const GetReferralDepositsQuerySchema = ReferralStatsPageQuerySchema;
|
|
40
|
+
|
|
41
|
+
export type GetReferralDepositsQuerySchemaType = z.infer<typeof GetReferralDepositsQuerySchema>;
|
|
42
|
+
|
|
43
|
+
export const ReferralDepositItemSchema = z.object({
|
|
44
|
+
depositedAt: z.iso.datetime(),
|
|
45
|
+
amount: z.number().nonnegative(),
|
|
46
|
+
earnedAmount: z.number().nonnegative(),
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export type ReferralDepositItemSchemaType = z.infer<typeof ReferralDepositItemSchema>;
|
|
50
|
+
|
|
51
|
+
export const GetReferralDepositsResponseSchema = z.object({
|
|
52
|
+
deposits: z.array(ReferralDepositItemSchema),
|
|
53
|
+
nextCursor: z.uuid().nullable(),
|
|
54
|
+
hasMore: z.boolean(),
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export type GetReferralDepositsResponseSchemaType = z.infer<typeof GetReferralDepositsResponseSchema>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import {
|
|
3
|
+
ReferralLinkListItemSchema,
|
|
4
|
+
ResolveReferralLinkParamsSchema,
|
|
5
|
+
ResolveReferralLinkResponseSchema,
|
|
6
|
+
} from './referral-link-response.schema';
|
|
7
|
+
|
|
8
|
+
export const VisitReferralLinkRouteParamsSchema = ResolveReferralLinkParamsSchema;
|
|
9
|
+
|
|
10
|
+
export type VisitReferralLinkRouteParamsSchemaType = z.infer<typeof VisitReferralLinkRouteParamsSchema>;
|
|
11
|
+
|
|
12
|
+
export const VisitReferralLinkResponseSchema = ResolveReferralLinkResponseSchema;
|
|
13
|
+
|
|
14
|
+
export type VisitReferralLinkResponseSchemaType = z.infer<typeof VisitReferralLinkResponseSchema>;
|
|
15
|
+
|
|
16
|
+
const RateSchema = z.number().nonnegative();
|
|
17
|
+
|
|
18
|
+
export const ReferralLinkMetricsSchema = z.object({
|
|
19
|
+
visitsTotal: z.number().int().nonnegative(),
|
|
20
|
+
visitsUnique: z.number().int().nonnegative(),
|
|
21
|
+
registrations: z.number().int().nonnegative(),
|
|
22
|
+
emailConfirmations: z.number().int().nonnegative(),
|
|
23
|
+
depositors: z.number().int().nonnegative(),
|
|
24
|
+
depositsAmount: z.number().nonnegative(),
|
|
25
|
+
visitToRegistrationRate: RateSchema,
|
|
26
|
+
registrationToConfirmationRate: RateSchema,
|
|
27
|
+
confirmationToDepositRate: RateSchema,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export type ReferralLinkMetricsSchemaType = z.infer<typeof ReferralLinkMetricsSchema>;
|
|
31
|
+
|
|
32
|
+
export const ReferralLinkStatsItemSchema = ReferralLinkListItemSchema.omit({ referralsCount: true }).extend({
|
|
33
|
+
metrics: ReferralLinkMetricsSchema,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export type ReferralLinkStatsItemSchemaType = z.infer<typeof ReferralLinkStatsItemSchema>;
|
|
37
|
+
|
|
38
|
+
export const GetReferralLinksStatsResponseSchema = z.object({
|
|
39
|
+
links: z.array(ReferralLinkStatsItemSchema),
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export type GetReferralLinksStatsResponseSchemaType = z.infer<typeof GetReferralLinksStatsResponseSchema>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const PeriodBoundarySchema = z.iso.datetime({ offset: true }).transform((value) => new Date(value));
|
|
4
|
+
|
|
5
|
+
export const ReferralStatsPeriodQuerySchema = z.object({
|
|
6
|
+
from: PeriodBoundarySchema.optional(),
|
|
7
|
+
to: PeriodBoundarySchema.optional(),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type ReferralStatsPeriodQuerySchemaType = z.infer<typeof ReferralStatsPeriodQuerySchema>;
|