@ai-grator/api 0.3.89 → 0.3.91
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/models/admin-trend-response.schema.ts +2 -0
- package/build/admin/endpoints/commands/create-admin-trend.command.d.ts +16 -0
- package/build/admin/endpoints/commands/create-admin-trend.command.d.ts.map +1 -1
- package/build/admin/endpoints/commands/update-admin-trend-status.command.d.ts +12 -0
- package/build/admin/endpoints/commands/update-admin-trend-status.command.d.ts.map +1 -1
- package/build/admin/endpoints/commands/update-admin-trend.command.d.ts +16 -0
- package/build/admin/endpoints/commands/update-admin-trend.command.d.ts.map +1 -1
- package/build/admin/endpoints/queries/get-admin-trend.query.d.ts +12 -0
- package/build/admin/endpoints/queries/get-admin-trend.query.d.ts.map +1 -1
- package/build/admin/models/admin-trend-response.schema.d.ts +12 -0
- package/build/admin/models/admin-trend-response.schema.d.ts.map +1 -1
- package/build/admin/models/admin-trend-response.schema.js +2 -0
- package/build/errors/errors.d.ts +10 -0
- package/build/errors/errors.d.ts.map +1 -1
- package/build/errors/errors.js +10 -0
- package/build/trend/endpoints/commands/generate-trend.command.d.ts +4 -4
- package/build/trend/endpoints/commands/generate-trend.command.js +2 -2
- package/build/trend/endpoints/queries/get-public-trend-by-slug.query.d.ts +12 -0
- package/build/trend/endpoints/queries/get-public-trend-by-slug.query.d.ts.map +1 -1
- package/build/trend/endpoints/queries/list-public-trends.query.d.ts +12 -0
- package/build/trend/endpoints/queries/list-public-trends.query.d.ts.map +1 -1
- package/build/trend/models/public-trend.schema.d.ts +24 -0
- package/build/trend/models/public-trend.schema.d.ts.map +1 -1
- package/build/trend/models/public-trend.schema.js +8 -1
- package/build/trend/models/trend-input.schema.d.ts +7 -2
- package/build/trend/models/trend-input.schema.d.ts.map +1 -1
- package/build/trend/models/trend-input.schema.js +23 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/errors/errors.ts +10 -0
- package/package.json +1 -1
- package/trend/endpoints/commands/generate-trend.command.ts +2 -2
- package/trend/models/public-trend.schema.ts +9 -0
- package/trend/models/trend-input.schema.ts +32 -1
package/errors/errors.ts
CHANGED
|
@@ -1121,6 +1121,11 @@ export const ERRORS = {
|
|
|
1121
1121
|
code: 'GENERATION_PROVIDER.SEEDANCE_2_0_REFERENCE_VIDEO_DURATION',
|
|
1122
1122
|
message: 'Длительность референсного видео должна быть от 2 до 15 секунд. Обрежьте видео и попробуйте снова',
|
|
1123
1123
|
},
|
|
1124
|
+
WAN_3_0_REFERENCE_VIDEO_DURATION: {
|
|
1125
|
+
httpCode: 400,
|
|
1126
|
+
code: 'GENERATION_PROVIDER.WAN_3_0_REFERENCE_VIDEO_DURATION',
|
|
1127
|
+
message: 'Длительность референсного видео должна быть от 1 до 15 секунд. Обрежьте видео и попробуйте снова',
|
|
1128
|
+
},
|
|
1124
1129
|
VIDEO_EDITING_PARAMS: {
|
|
1125
1130
|
httpCode: 400,
|
|
1126
1131
|
code: 'GENERATION_PROVIDER.VIDEO_EDITING_PARAMS',
|
|
@@ -1460,6 +1465,11 @@ export const ERRORS = {
|
|
|
1460
1465
|
code: 'TREND.FIELD_VALUE_TYPE_MISMATCH',
|
|
1461
1466
|
message: 'Тип значения не совпадает с типом поля',
|
|
1462
1467
|
},
|
|
1468
|
+
FIELD_DEFAULT_FILE_NOT_IMAGE: {
|
|
1469
|
+
httpCode: 400,
|
|
1470
|
+
code: 'TREND.FIELD_DEFAULT_FILE_NOT_IMAGE',
|
|
1471
|
+
message: 'Файл по умолчанию для поля должен быть изображением',
|
|
1472
|
+
},
|
|
1463
1473
|
FIELD_FILE_NOT_IMAGE: {
|
|
1464
1474
|
httpCode: 400,
|
|
1465
1475
|
code: 'TREND.FIELD_FILE_NOT_IMAGE',
|
package/package.json
CHANGED
|
@@ -31,11 +31,11 @@ export const GenerateTrendCommandBody = z.object({
|
|
|
31
31
|
quality: TrendQualitySchema,
|
|
32
32
|
values: z
|
|
33
33
|
.array(TrendFieldValueSchema)
|
|
34
|
-
.min(1)
|
|
35
34
|
.max(TREND_MAX_FIELDS)
|
|
36
35
|
.refine((values) => new Set(values.map(({ fieldId }) => fieldId)).size === values.length, {
|
|
37
36
|
message: 'Each field can have only one value',
|
|
38
|
-
})
|
|
37
|
+
})
|
|
38
|
+
.default([]),
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
export const GenerateTrendCommandResponse = GenerationJobResponseSchema;
|
|
@@ -13,11 +13,19 @@ export const PublicTrendCategorySchema = z.object({
|
|
|
13
13
|
name: z.string(),
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
+
export const PublicTrendFieldFileSchema = z.object({
|
|
17
|
+
uuid: z.uuid(),
|
|
18
|
+
url: z.url(),
|
|
19
|
+
thumbnailUrl: z.url().nullable(),
|
|
20
|
+
});
|
|
21
|
+
|
|
16
22
|
export const PublicTrendFieldSchema = z.object({
|
|
17
23
|
uuid: z.uuid(),
|
|
18
24
|
type: TrendFieldTypeSchema,
|
|
19
25
|
name: z.string(),
|
|
20
26
|
order: z.int().nonnegative(),
|
|
27
|
+
defaultFile: PublicTrendFieldFileSchema.nullable(),
|
|
28
|
+
defaultText: z.string().nullable(),
|
|
21
29
|
});
|
|
22
30
|
|
|
23
31
|
export const PublicTrendCardSchema = z.object({
|
|
@@ -54,6 +62,7 @@ export const PublicTrendSchema = PublicTrendCardSchema.extend({
|
|
|
54
62
|
});
|
|
55
63
|
|
|
56
64
|
export type PublicTrendCategorySchemaType = z.infer<typeof PublicTrendCategorySchema>;
|
|
65
|
+
export type PublicTrendFieldFileSchemaType = z.infer<typeof PublicTrendFieldFileSchema>;
|
|
57
66
|
export type PublicTrendFieldSchemaType = z.infer<typeof PublicTrendFieldSchema>;
|
|
58
67
|
export type PublicTrendCardSchemaType = z.infer<typeof PublicTrendCardSchema>;
|
|
59
68
|
export type PublicTrendModelSchemaType = z.infer<typeof PublicTrendModelSchema>;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
TREND_FIELD_TYPE,
|
|
4
|
+
TREND_MAX_FIELDS,
|
|
5
|
+
TREND_MIN_FIELDS,
|
|
6
|
+
TREND_PROMPT_MAX_LENGTH,
|
|
7
|
+
TREND_TEXT_VALUE_MAX_LENGTH,
|
|
8
|
+
TREND_TITLE_MAX_LENGTH,
|
|
9
|
+
} from '../enums';
|
|
3
10
|
import {
|
|
4
11
|
TrendAspectRatioSchema,
|
|
5
12
|
TrendDurationSecSchema,
|
|
@@ -13,6 +20,13 @@ export const TrendFieldInputSchema = z.object({
|
|
|
13
20
|
uuid: z.uuid().optional(),
|
|
14
21
|
type: TrendFieldTypeSchema,
|
|
15
22
|
name: TrendFieldNameSchema,
|
|
23
|
+
defaultFileId: z.uuid().nullish(),
|
|
24
|
+
defaultText: z
|
|
25
|
+
.string()
|
|
26
|
+
.trim()
|
|
27
|
+
.max(TREND_TEXT_VALUE_MAX_LENGTH)
|
|
28
|
+
.transform((text) => text || null)
|
|
29
|
+
.nullish(),
|
|
16
30
|
});
|
|
17
31
|
|
|
18
32
|
export const TrendModelInputSchema = z.object({
|
|
@@ -49,6 +63,23 @@ export const TrendInputSchema = z
|
|
|
49
63
|
});
|
|
50
64
|
}
|
|
51
65
|
|
|
66
|
+
trend.fields.forEach((field, index) => {
|
|
67
|
+
if (field.type !== TREND_FIELD_TYPE.FILE && field.defaultFileId) {
|
|
68
|
+
ctx.addIssue({
|
|
69
|
+
code: 'custom',
|
|
70
|
+
path: ['fields', index, 'defaultFileId'],
|
|
71
|
+
message: 'Default file is allowed only for file fields',
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
if (field.type !== TREND_FIELD_TYPE.TEXT && field.defaultText) {
|
|
75
|
+
ctx.addIssue({
|
|
76
|
+
code: 'custom',
|
|
77
|
+
path: ['fields', index, 'defaultText'],
|
|
78
|
+
message: 'Default text is allowed only for text fields',
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
|
|
52
83
|
const fieldUuids = trend.fields.flatMap((field) => (field.uuid ? [field.uuid] : []));
|
|
53
84
|
if (findDuplicates(fieldUuids).length > 0) {
|
|
54
85
|
ctx.addIssue({ code: 'custom', path: ['fields'], message: 'Field uuids must be unique' });
|