@ai-grator/api 0.3.66 → 0.3.67
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/endpoints/admin.ts +16 -0
- package/admin/endpoints/commands/create-admin-trend-category.command.ts +29 -0
- package/admin/endpoints/commands/create-admin-trend.command.ts +30 -0
- package/admin/endpoints/commands/delete-admin-trend-category.command.ts +28 -0
- package/admin/endpoints/commands/delete-admin-trend.command.ts +28 -0
- package/admin/endpoints/commands/index.ts +9 -0
- package/admin/endpoints/commands/probe-admin-trend-reference-video.command.ts +37 -0
- package/admin/endpoints/commands/reorder-admin-trends.command.ts +31 -0
- package/admin/endpoints/commands/update-admin-trend-category.command.ts +36 -0
- package/admin/endpoints/commands/update-admin-trend-status.command.ts +37 -0
- package/admin/endpoints/commands/update-admin-trend.command.ts +36 -0
- package/admin/endpoints/queries/get-admin-trend-categories.query.ts +22 -0
- package/admin/endpoints/queries/get-admin-trend.query.ts +29 -0
- package/admin/endpoints/queries/get-admin-trends.query.ts +36 -0
- package/admin/endpoints/queries/index.ts +3 -0
- package/admin/models/admin-trend-category-response.schema.ts +11 -0
- package/admin/models/admin-trend-response.schema.ts +61 -0
- package/admin/models/index.ts +2 -0
- package/build/admin/endpoints/admin.d.ts +12 -0
- package/build/admin/endpoints/admin.d.ts.map +1 -1
- package/build/admin/endpoints/admin.js +14 -0
- package/build/admin/endpoints/commands/create-admin-trend-category.command.d.ts +41 -0
- package/build/admin/endpoints/commands/create-admin-trend-category.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/create-admin-trend-category.command.js +25 -0
- package/build/admin/endpoints/commands/create-admin-trend.command.d.ts +144 -0
- package/build/admin/endpoints/commands/create-admin-trend.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/create-admin-trend.command.js +26 -0
- package/build/admin/endpoints/commands/delete-admin-trend-category.command.d.ts +26 -0
- package/build/admin/endpoints/commands/delete-admin-trend-category.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/delete-admin-trend-category.command.js +25 -0
- package/build/admin/endpoints/commands/delete-admin-trend.command.d.ts +26 -0
- package/build/admin/endpoints/commands/delete-admin-trend.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/delete-admin-trend.command.js +25 -0
- package/build/admin/endpoints/commands/index.d.ts +9 -0
- package/build/admin/endpoints/commands/index.d.ts.map +1 -1
- package/build/admin/endpoints/commands/index.js +9 -0
- package/build/admin/endpoints/commands/probe-admin-trend-reference-video.command.d.ts +37 -0
- package/build/admin/endpoints/commands/probe-admin-trend-reference-video.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/probe-admin-trend-reference-video.command.js +32 -0
- package/build/admin/endpoints/commands/reorder-admin-trends.command.d.ts +26 -0
- package/build/admin/endpoints/commands/reorder-admin-trends.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/reorder-admin-trends.command.js +28 -0
- package/build/admin/endpoints/commands/update-admin-trend-category.command.d.ts +49 -0
- package/build/admin/endpoints/commands/update-admin-trend-category.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/update-admin-trend-category.command.js +31 -0
- package/build/admin/endpoints/commands/update-admin-trend-status.command.d.ts +118 -0
- package/build/admin/endpoints/commands/update-admin-trend-status.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/update-admin-trend-status.command.js +32 -0
- package/build/admin/endpoints/commands/update-admin-trend.command.d.ts +151 -0
- package/build/admin/endpoints/commands/update-admin-trend.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/update-admin-trend.command.js +31 -0
- package/build/admin/endpoints/queries/get-admin-trend-categories.query.d.ts +32 -0
- package/build/admin/endpoints/queries/get-admin-trend-categories.query.d.ts.map +1 -0
- package/build/admin/endpoints/queries/get-admin-trend-categories.query.js +21 -0
- package/build/admin/endpoints/queries/get-admin-trend.query.d.ts +110 -0
- package/build/admin/endpoints/queries/get-admin-trend.query.d.ts.map +1 -0
- package/build/admin/endpoints/queries/get-admin-trend.query.js +26 -0
- package/build/admin/endpoints/queries/get-admin-trends.query.d.ts +63 -0
- package/build/admin/endpoints/queries/get-admin-trends.query.d.ts.map +1 -0
- package/build/admin/endpoints/queries/get-admin-trends.query.js +33 -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/admin/models/admin-trend-category-response.schema.d.ts +10 -0
- package/build/admin/models/admin-trend-category-response.schema.d.ts.map +1 -0
- package/build/admin/models/admin-trend-category-response.schema.js +11 -0
- package/build/admin/models/admin-trend-response.schema.d.ts +79 -0
- package/build/admin/models/admin-trend-response.schema.d.ts.map +1 -0
- package/build/admin/models/admin-trend-response.schema.js +53 -0
- package/build/admin/models/index.d.ts +2 -0
- package/build/admin/models/index.d.ts.map +1 -1
- package/build/admin/models/index.js +2 -0
- package/build/errors/errors.d.ts +142 -0
- package/build/errors/errors.d.ts.map +1 -1
- package/build/errors/errors.js +142 -0
- package/build/generation-job-chat/endpoints/commands/create-generation-job-chat.command.d.ts +2 -0
- package/build/generation-job-chat/endpoints/commands/create-generation-job-chat.command.d.ts.map +1 -1
- package/build/generation-job-chat/endpoints/commands/update-generation-job-chat.command.d.ts +2 -0
- package/build/generation-job-chat/endpoints/commands/update-generation-job-chat.command.d.ts.map +1 -1
- package/build/generation-job-chat/endpoints/queries/get-generation-job-chat-by-uuid.query.d.ts +2 -0
- package/build/generation-job-chat/endpoints/queries/get-generation-job-chat-by-uuid.query.d.ts.map +1 -1
- package/build/generation-job-chat/endpoints/queries/get-generation-job-chats.query.d.ts +2 -0
- package/build/generation-job-chat/endpoints/queries/get-generation-job-chats.query.d.ts.map +1 -1
- package/build/generation-job-chat/models/generation-job-chat-response.schema.d.ts +1 -0
- package/build/generation-job-chat/models/generation-job-chat-response.schema.d.ts.map +1 -1
- package/build/generation-job-chat/models/generation-job-chat-response.schema.js +1 -0
- package/build/generation-model/endpoints/queries/get-generation-models-by-type.query.d.ts +2 -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 +2 -0
- package/build/generation-model/endpoints/queries/get-generation-models.query.d.ts.map +1 -1
- package/build/generation-model/models/generation-model-response.schema.d.ts +3 -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 +1 -0
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/trend/endpoints/commands/generate-trend.command.d.ts +142 -0
- package/build/trend/endpoints/commands/generate-trend.command.d.ts.map +1 -0
- package/build/trend/endpoints/commands/generate-trend.command.js +54 -0
- package/build/trend/endpoints/commands/index.d.ts +2 -0
- package/build/trend/endpoints/commands/index.d.ts.map +1 -0
- package/build/trend/endpoints/commands/index.js +17 -0
- package/build/trend/endpoints/index.d.ts +4 -0
- package/build/trend/endpoints/index.d.ts.map +1 -0
- package/build/trend/endpoints/index.js +19 -0
- package/build/trend/endpoints/queries/get-public-trend-by-slug.query.d.ts +92 -0
- package/build/trend/endpoints/queries/get-public-trend-by-slug.query.d.ts.map +1 -0
- package/build/trend/endpoints/queries/get-public-trend-by-slug.query.js +24 -0
- package/build/trend/endpoints/queries/index.d.ts +4 -0
- package/build/trend/endpoints/queries/index.d.ts.map +1 -0
- package/build/trend/endpoints/queries/index.js +19 -0
- package/build/trend/endpoints/queries/list-public-trend-categories.query.d.ts +26 -0
- package/build/trend/endpoints/queries/list-public-trend-categories.query.d.ts.map +1 -0
- package/build/trend/endpoints/queries/list-public-trend-categories.query.js +19 -0
- package/build/trend/endpoints/queries/list-public-trends.query.d.ts +69 -0
- package/build/trend/endpoints/queries/list-public-trends.query.d.ts.map +1 -0
- package/build/trend/endpoints/queries/list-public-trends.query.js +28 -0
- package/build/trend/endpoints/trend.d.ts +11 -0
- package/build/trend/endpoints/trend.d.ts.map +1 -0
- package/build/trend/endpoints/trend.js +13 -0
- package/build/trend/enums/index.d.ts +6 -0
- package/build/trend/enums/index.d.ts.map +1 -0
- package/build/trend/enums/index.js +21 -0
- package/build/trend/enums/trend-aspect-ratio.enum.d.ts +9 -0
- package/build/trend/enums/trend-aspect-ratio.enum.d.ts.map +1 -0
- package/build/trend/enums/trend-aspect-ratio.enum.js +12 -0
- package/build/trend/enums/trend-field-type.enum.d.ts +5 -0
- package/build/trend/enums/trend-field-type.enum.d.ts.map +1 -0
- package/build/trend/enums/trend-field-type.enum.js +8 -0
- package/build/trend/enums/trend-limits.d.ts +11 -0
- package/build/trend/enums/trend-limits.d.ts.map +1 -0
- package/build/trend/enums/trend-limits.js +13 -0
- package/build/trend/enums/trend-quality.enum.d.ts +7 -0
- package/build/trend/enums/trend-quality.enum.d.ts.map +1 -0
- package/build/trend/enums/trend-quality.enum.js +10 -0
- package/build/trend/enums/trend-status.enum.d.ts +5 -0
- package/build/trend/enums/trend-status.enum.d.ts.map +1 -0
- package/build/trend/enums/trend-status.enum.js +8 -0
- package/build/trend/helpers/index.d.ts +2 -0
- package/build/trend/helpers/index.d.ts.map +1 -0
- package/build/trend/helpers/index.js +17 -0
- package/build/trend/helpers/trend-field-reference.helper.d.ts +4 -0
- package/build/trend/helpers/trend-field-reference.helper.d.ts.map +1 -0
- package/build/trend/helpers/trend-field-reference.helper.js +12 -0
- package/build/trend/index.d.ts +5 -0
- package/build/trend/index.d.ts.map +1 -0
- package/build/trend/index.js +20 -0
- package/build/trend/models/index.d.ts +5 -0
- package/build/trend/models/index.d.ts.map +1 -0
- package/build/trend/models/index.js +20 -0
- package/build/trend/models/public-trend.schema.d.ts +88 -0
- package/build/trend/models/public-trend.schema.d.ts.map +1 -0
- package/build/trend/models/public-trend.schema.js +44 -0
- package/build/trend/models/trend-category-input.schema.d.ts +7 -0
- package/build/trend/models/trend-category-input.schema.d.ts.map +1 -0
- package/build/trend/models/trend-category-input.schema.js +10 -0
- package/build/trend/models/trend-common.schema.d.ts +10 -0
- package/build/trend/models/trend-common.schema.d.ts.map +1 -0
- package/build/trend/models/trend-common.schema.js +17 -0
- package/build/trend/models/trend-input.schema.d.ts +33 -0
- package/build/trend/models/trend-input.schema.d.ts.map +1 -0
- package/build/trend/models/trend-input.schema.js +54 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/video-generation-chain/endpoints/queries/get-video-generation-chain-config.query.d.ts +2 -0
- package/build/video-generation-chain/endpoints/queries/get-video-generation-chain-config.query.d.ts.map +1 -1
- package/errors/errors.ts +142 -0
- package/generation-job-chat/models/generation-job-chat-response.schema.ts +1 -0
- package/generation-model/models/generation-model-response.schema.ts +1 -0
- package/index.ts +1 -0
- package/package.json +1 -1
- package/trend/endpoints/commands/generate-trend.command.ts +63 -0
- package/trend/endpoints/commands/index.ts +1 -0
- package/trend/endpoints/index.ts +3 -0
- package/trend/endpoints/queries/get-public-trend-by-slug.query.ts +27 -0
- package/trend/endpoints/queries/index.ts +3 -0
- package/trend/endpoints/queries/list-public-trend-categories.query.ts +20 -0
- package/trend/endpoints/queries/list-public-trends.query.ts +31 -0
- package/trend/endpoints/trend.ts +13 -0
- package/trend/enums/index.ts +5 -0
- package/trend/enums/trend-aspect-ratio.enum.ts +8 -0
- package/trend/enums/trend-field-type.enum.ts +4 -0
- package/trend/enums/trend-limits.ts +10 -0
- package/trend/enums/trend-quality.enum.ts +7 -0
- package/trend/enums/trend-status.enum.ts +4 -0
- package/trend/helpers/index.ts +1 -0
- package/trend/helpers/trend-field-reference.helper.ts +9 -0
- package/trend/index.ts +4 -0
- package/trend/models/index.ts +4 -0
- package/trend/models/public-trend.schema.ts +58 -0
- package/trend/models/trend-category-input.schema.ts +10 -0
- package/trend/models/trend-common.schema.ts +26 -0
- package/trend/models/trend-input.schema.ts +69 -0
package/build/video-generation-chain/endpoints/queries/get-video-generation-chain-config.query.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export declare const GetVideoGenerationChainConfigResponse: z.ZodObject<{
|
|
|
24
24
|
extensions: z.ZodArray<z.ZodString>;
|
|
25
25
|
maxSize: z.ZodInt;
|
|
26
26
|
}, z.core.$strip>;
|
|
27
|
+
maxSizeBytes: z.ZodOptional<z.ZodInt>;
|
|
27
28
|
}, z.core.$strip>>;
|
|
28
29
|
conflictingSlots: z.ZodArray<z.ZodTuple<[z.ZodArray<z.ZodString>, z.ZodArray<z.ZodString>], null>>;
|
|
29
30
|
dependentSlots: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
|
|
@@ -77,6 +78,7 @@ export declare const GetVideoGenerationChainConfigQuery: {
|
|
|
77
78
|
extensions: z.ZodArray<z.ZodString>;
|
|
78
79
|
maxSize: z.ZodInt;
|
|
79
80
|
}, z.core.$strip>;
|
|
81
|
+
maxSizeBytes: z.ZodOptional<z.ZodInt>;
|
|
80
82
|
}, z.core.$strip>>;
|
|
81
83
|
conflictingSlots: z.ZodArray<z.ZodTuple<[z.ZodArray<z.ZodString>, z.ZodArray<z.ZodString>], null>>;
|
|
82
84
|
dependentSlots: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-video-generation-chain-config.query.d.ts","sourceRoot":"","sources":["../../../../video-generation-chain/endpoints/queries/get-video-generation-chain-config.query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,YAAY,EAA2B,MAAM,kBAAkB,CAAC;AAIzF,eAAO,MAAM,qCAAqC
|
|
1
|
+
{"version":3,"file":"get-video-generation-chain-config.query.d.ts","sourceRoot":"","sources":["../../../../video-generation-chain/endpoints/queries/get-video-generation-chain-config.query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,YAAY,EAA2B,MAAM,kBAAkB,CAAC;AAIzF,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAIhD,CAAC;AAEH,MAAM,MAAM,yCAAyC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAC;AAE9G,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAS7C,CAAC"}
|
package/errors/errors.ts
CHANGED
|
@@ -333,6 +333,11 @@ export const ERRORS = {
|
|
|
333
333
|
code: 'GENERATION_JOB.INVALID_ATTACHMENT_FILE_FORMAT',
|
|
334
334
|
message: 'Один или несколько прикреплённых файлов имеют формат, не поддерживаемый этой моделью',
|
|
335
335
|
},
|
|
336
|
+
ATTACHMENT_FILE_TOO_LARGE: {
|
|
337
|
+
httpCode: 400,
|
|
338
|
+
code: 'GENERATION_JOB.ATTACHMENT_FILE_TOO_LARGE',
|
|
339
|
+
message: 'Один или несколько прикреплённых файлов превышают допустимый для этой модели размер',
|
|
340
|
+
},
|
|
336
341
|
ATTACHMENT_SLOT_NOT_MULTIPLE: {
|
|
337
342
|
httpCode: 400,
|
|
338
343
|
code: 'GENERATION_JOB.ATTACHMENT_SLOT_NOT_MULTIPLE',
|
|
@@ -1185,4 +1190,141 @@ export const ERRORS = {
|
|
|
1185
1190
|
message: 'Не удалось сохранить контекст пользователя',
|
|
1186
1191
|
},
|
|
1187
1192
|
},
|
|
1193
|
+
TREND: {
|
|
1194
|
+
NOT_FOUND: {
|
|
1195
|
+
httpCode: 404,
|
|
1196
|
+
code: 'TREND.NOT_FOUND',
|
|
1197
|
+
message: 'Тренд не найден',
|
|
1198
|
+
},
|
|
1199
|
+
SLUG_CONFLICT: {
|
|
1200
|
+
httpCode: 409,
|
|
1201
|
+
code: 'TREND.SLUG_CONFLICT',
|
|
1202
|
+
message: 'Тренд с таким slug уже существует',
|
|
1203
|
+
},
|
|
1204
|
+
CATEGORY_NOT_FOUND: {
|
|
1205
|
+
httpCode: 404,
|
|
1206
|
+
code: 'TREND.CATEGORY_NOT_FOUND',
|
|
1207
|
+
message: 'Категория трендов не найдена',
|
|
1208
|
+
},
|
|
1209
|
+
CATEGORY_SLUG_CONFLICT: {
|
|
1210
|
+
httpCode: 409,
|
|
1211
|
+
code: 'TREND.CATEGORY_SLUG_CONFLICT',
|
|
1212
|
+
message: 'Категория трендов с таким slug уже существует',
|
|
1213
|
+
},
|
|
1214
|
+
FIELD_NOT_FOUND: {
|
|
1215
|
+
httpCode: 400,
|
|
1216
|
+
code: 'TREND.FIELD_NOT_FOUND',
|
|
1217
|
+
message: 'Поле не принадлежит тренду',
|
|
1218
|
+
},
|
|
1219
|
+
PROMPT_UNKNOWN_FIELD: {
|
|
1220
|
+
httpCode: 400,
|
|
1221
|
+
code: 'TREND.PROMPT_UNKNOWN_FIELD',
|
|
1222
|
+
message: 'Промпт ссылается на несуществующее поле',
|
|
1223
|
+
},
|
|
1224
|
+
PROMPT_FIELD_NOT_REFERENCED: {
|
|
1225
|
+
httpCode: 400,
|
|
1226
|
+
code: 'TREND.PROMPT_FIELD_NOT_REFERENCED',
|
|
1227
|
+
message: 'Поле не используется в промпте',
|
|
1228
|
+
},
|
|
1229
|
+
REFERENCE_VIDEO_INVALID: {
|
|
1230
|
+
httpCode: 400,
|
|
1231
|
+
code: 'TREND.REFERENCE_VIDEO_INVALID',
|
|
1232
|
+
message: 'Референс тренда должен быть видеофайлом',
|
|
1233
|
+
},
|
|
1234
|
+
REFERENCE_VIDEO_PROBE_ERROR: {
|
|
1235
|
+
httpCode: 400,
|
|
1236
|
+
code: 'TREND.REFERENCE_VIDEO_PROBE_ERROR',
|
|
1237
|
+
message: 'Не удалось определить длительность и формат референсного видео',
|
|
1238
|
+
},
|
|
1239
|
+
REFERENCE_VIDEO_DURATION_MISMATCH: {
|
|
1240
|
+
httpCode: 400,
|
|
1241
|
+
code: 'TREND.REFERENCE_VIDEO_DURATION_MISMATCH',
|
|
1242
|
+
message: 'Длительность тренда должна совпадать с длительностью референсного видео',
|
|
1243
|
+
},
|
|
1244
|
+
PREVIEW_INVALID: {
|
|
1245
|
+
httpCode: 400,
|
|
1246
|
+
code: 'TREND.PREVIEW_INVALID',
|
|
1247
|
+
message: 'Превью тренда должно быть изображением',
|
|
1248
|
+
},
|
|
1249
|
+
MODEL_NOT_FOUND: {
|
|
1250
|
+
httpCode: 404,
|
|
1251
|
+
code: 'TREND.MODEL_NOT_FOUND',
|
|
1252
|
+
message: 'Модель для тренда не найдена',
|
|
1253
|
+
},
|
|
1254
|
+
MODEL_INCOMPATIBLE: {
|
|
1255
|
+
httpCode: 400,
|
|
1256
|
+
code: 'TREND.MODEL_INCOMPATIBLE',
|
|
1257
|
+
message: 'Модель не поддерживает референсное видео, длительность, формат или количество полей тренда',
|
|
1258
|
+
},
|
|
1259
|
+
REORDER_INVALID: {
|
|
1260
|
+
httpCode: 400,
|
|
1261
|
+
code: 'TREND.REORDER_INVALID',
|
|
1262
|
+
message: 'Список для сортировки должен содержать все тренды ровно один раз',
|
|
1263
|
+
},
|
|
1264
|
+
MODEL_NOT_IN_TREND: {
|
|
1265
|
+
httpCode: 400,
|
|
1266
|
+
code: 'TREND.MODEL_NOT_IN_TREND',
|
|
1267
|
+
message: 'Модель недоступна в этом тренде',
|
|
1268
|
+
},
|
|
1269
|
+
QUALITY_NOT_SUPPORTED: {
|
|
1270
|
+
httpCode: 400,
|
|
1271
|
+
code: 'TREND.QUALITY_NOT_SUPPORTED',
|
|
1272
|
+
message: 'Выбранное качество не поддерживается моделью',
|
|
1273
|
+
},
|
|
1274
|
+
FIELD_VALUE_MISSING: {
|
|
1275
|
+
httpCode: 400,
|
|
1276
|
+
code: 'TREND.FIELD_VALUE_MISSING',
|
|
1277
|
+
message: 'Заполните все поля тренда',
|
|
1278
|
+
},
|
|
1279
|
+
FIELD_VALUE_TYPE_MISMATCH: {
|
|
1280
|
+
httpCode: 400,
|
|
1281
|
+
code: 'TREND.FIELD_VALUE_TYPE_MISMATCH',
|
|
1282
|
+
message: 'Тип значения не совпадает с типом поля',
|
|
1283
|
+
},
|
|
1284
|
+
FIELD_FILE_NOT_IMAGE: {
|
|
1285
|
+
httpCode: 400,
|
|
1286
|
+
code: 'TREND.FIELD_FILE_NOT_IMAGE',
|
|
1287
|
+
message: 'В поле можно загрузить только изображение',
|
|
1288
|
+
},
|
|
1289
|
+
PROMPT_TOO_LONG: {
|
|
1290
|
+
httpCode: 400,
|
|
1291
|
+
code: 'TREND.PROMPT_TOO_LONG',
|
|
1292
|
+
message: 'Промпт с подставленными значениями превышает лимит модели',
|
|
1293
|
+
},
|
|
1294
|
+
CATEGORY_SAVE_ERROR: {
|
|
1295
|
+
httpCode: 500,
|
|
1296
|
+
code: 'TREND.CATEGORY_SAVE_ERROR',
|
|
1297
|
+
message: 'Не удалось сохранить категорию трендов',
|
|
1298
|
+
},
|
|
1299
|
+
CATEGORY_DELETE_ERROR: {
|
|
1300
|
+
httpCode: 500,
|
|
1301
|
+
code: 'TREND.CATEGORY_DELETE_ERROR',
|
|
1302
|
+
message: 'Не удалось удалить категорию трендов',
|
|
1303
|
+
},
|
|
1304
|
+
FIND_ERROR: {
|
|
1305
|
+
httpCode: 500,
|
|
1306
|
+
code: 'TREND.FIND_ERROR',
|
|
1307
|
+
message: 'Не удалось получить тренды',
|
|
1308
|
+
},
|
|
1309
|
+
CREATE_ERROR: {
|
|
1310
|
+
httpCode: 500,
|
|
1311
|
+
code: 'TREND.CREATE_ERROR',
|
|
1312
|
+
message: 'Не удалось создать тренд',
|
|
1313
|
+
},
|
|
1314
|
+
UPDATE_ERROR: {
|
|
1315
|
+
httpCode: 500,
|
|
1316
|
+
code: 'TREND.UPDATE_ERROR',
|
|
1317
|
+
message: 'Не удалось обновить тренд',
|
|
1318
|
+
},
|
|
1319
|
+
DELETE_ERROR: {
|
|
1320
|
+
httpCode: 500,
|
|
1321
|
+
code: 'TREND.DELETE_ERROR',
|
|
1322
|
+
message: 'Не удалось удалить тренд',
|
|
1323
|
+
},
|
|
1324
|
+
GENERATE_ERROR: {
|
|
1325
|
+
httpCode: 500,
|
|
1326
|
+
code: 'TREND.GENERATE_ERROR',
|
|
1327
|
+
message: 'Не удалось запустить генерацию по тренду',
|
|
1328
|
+
},
|
|
1329
|
+
},
|
|
1188
1330
|
} as const;
|
|
@@ -6,6 +6,7 @@ export const GenerationJobChatResponseSchema = z.object({
|
|
|
6
6
|
title: z.string().min(1),
|
|
7
7
|
type: GenerationTypeSchema,
|
|
8
8
|
modelId: z.uuid().nullable(),
|
|
9
|
+
trendId: z.uuid().nullable(),
|
|
9
10
|
icon: z.url().nullable(),
|
|
10
11
|
createdAt: z.iso.datetime(),
|
|
11
12
|
updatedAt: z.iso.datetime(),
|
|
@@ -13,6 +13,7 @@ export const AttachmentSlotSchema = z.object({
|
|
|
13
13
|
required: z.boolean(),
|
|
14
14
|
maxCount: z.int().positive(),
|
|
15
15
|
allowedFormats: FileFormatListSchema,
|
|
16
|
+
maxSizeBytes: z.int().positive().optional(),
|
|
16
17
|
});
|
|
17
18
|
|
|
18
19
|
export const AttachmentPolicySchema = z.record(z.string(), AttachmentSlotSchema);
|
package/index.ts
CHANGED
|
@@ -21,6 +21,7 @@ export * from './file';
|
|
|
21
21
|
export * from './generation-job-chat';
|
|
22
22
|
export * from './marketplace-card';
|
|
23
23
|
export * from './video-generation-chain';
|
|
24
|
+
export * from './trend';
|
|
24
25
|
export * from './support';
|
|
25
26
|
export * from './user-context';
|
|
26
27
|
export * from './organization';
|
package/package.json
CHANGED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
3
|
+
import { GenerationJobResponseSchema } from '../../../generation-job';
|
|
4
|
+
import { TREND_FIELD_TYPE, TREND_MAX_FIELDS, TREND_TEXT_VALUE_MAX_LENGTH } from '../../enums';
|
|
5
|
+
import { TrendQualitySchema, TrendSlugSchema } from '../../models';
|
|
6
|
+
import { TREND_ROUTES } from '../trend';
|
|
7
|
+
|
|
8
|
+
export const GenerateTrendCommandParams = z.object({
|
|
9
|
+
slug: TrendSlugSchema,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const TrendFileFieldValueSchema = z.object({
|
|
13
|
+
type: z.literal(TREND_FIELD_TYPE.FILE),
|
|
14
|
+
fieldId: z.uuid(),
|
|
15
|
+
fileId: z.uuid(),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const TrendTextFieldValueSchema = z.object({
|
|
19
|
+
type: z.literal(TREND_FIELD_TYPE.TEXT),
|
|
20
|
+
fieldId: z.uuid(),
|
|
21
|
+
text: z.string().trim().min(1).max(TREND_TEXT_VALUE_MAX_LENGTH),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const TrendFieldValueSchema = z.discriminatedUnion('type', [
|
|
25
|
+
TrendFileFieldValueSchema,
|
|
26
|
+
TrendTextFieldValueSchema,
|
|
27
|
+
]);
|
|
28
|
+
|
|
29
|
+
export const GenerateTrendCommandBody = z.object({
|
|
30
|
+
modelId: z.uuid(),
|
|
31
|
+
quality: TrendQualitySchema,
|
|
32
|
+
values: z
|
|
33
|
+
.array(TrendFieldValueSchema)
|
|
34
|
+
.min(1)
|
|
35
|
+
.max(TREND_MAX_FIELDS)
|
|
36
|
+
.refine((values) => new Set(values.map(({ fieldId }) => fieldId)).size === values.length, {
|
|
37
|
+
message: 'Each field can have only one value',
|
|
38
|
+
}),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export const GenerateTrendCommandResponse = GenerationJobResponseSchema;
|
|
42
|
+
|
|
43
|
+
export const GenerateTrendCommand = defineContract({
|
|
44
|
+
method: HTTP_METHODS.POST,
|
|
45
|
+
path: TREND_ROUTES.GENERATE(':slug'),
|
|
46
|
+
summary: 'Create a video generation chat from a trend and start generation',
|
|
47
|
+
request: {
|
|
48
|
+
params: GenerateTrendCommandParams,
|
|
49
|
+
body: GenerateTrendCommandBody,
|
|
50
|
+
},
|
|
51
|
+
responses: {
|
|
52
|
+
201: GenerateTrendCommandResponse,
|
|
53
|
+
400: HttpErrorResponseSchema,
|
|
54
|
+
401: HttpErrorResponseSchema,
|
|
55
|
+
404: HttpErrorResponseSchema,
|
|
56
|
+
500: HttpErrorResponseSchema,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export type TrendFieldValueSchemaType = z.infer<typeof TrendFieldValueSchema>;
|
|
61
|
+
export type GenerateTrendCommandParamsType = z.infer<typeof GenerateTrendCommandParams>;
|
|
62
|
+
export type GenerateTrendCommandBodyType = z.infer<typeof GenerateTrendCommandBody>;
|
|
63
|
+
export type GenerateTrendCommandResponseType = z.infer<typeof GenerateTrendCommandResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './generate-trend.command';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
3
|
+
import { PublicTrendSchema, TrendSlugSchema } from '../../models';
|
|
4
|
+
import { TREND_ROUTES } from '../trend';
|
|
5
|
+
|
|
6
|
+
export const GetPublicTrendBySlugQueryParams = z.object({
|
|
7
|
+
slug: TrendSlugSchema,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const GetPublicTrendBySlugQueryResponse = PublicTrendSchema;
|
|
11
|
+
|
|
12
|
+
export const GetPublicTrendBySlugQuery = defineContract({
|
|
13
|
+
method: HTTP_METHODS.GET,
|
|
14
|
+
path: TREND_ROUTES.GET_BY_SLUG(':slug'),
|
|
15
|
+
summary: 'Get published trend with models, qualities and prices',
|
|
16
|
+
request: {
|
|
17
|
+
params: GetPublicTrendBySlugQueryParams,
|
|
18
|
+
},
|
|
19
|
+
responses: {
|
|
20
|
+
200: GetPublicTrendBySlugQueryResponse,
|
|
21
|
+
404: HttpErrorResponseSchema,
|
|
22
|
+
500: HttpErrorResponseSchema,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export type GetPublicTrendBySlugQueryParamsType = z.infer<typeof GetPublicTrendBySlugQueryParams>;
|
|
27
|
+
export type GetPublicTrendBySlugQueryResponseType = z.infer<typeof GetPublicTrendBySlugQueryResponse>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
3
|
+
import { PublicTrendCategorySchema } from '../../models';
|
|
4
|
+
import { TREND_CATEGORY_ROUTES } from '../trend';
|
|
5
|
+
|
|
6
|
+
export const ListPublicTrendCategoriesQueryResponse = z.object({
|
|
7
|
+
categories: z.array(PublicTrendCategorySchema),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const ListPublicTrendCategoriesQuery = defineContract({
|
|
11
|
+
method: HTTP_METHODS.GET,
|
|
12
|
+
path: TREND_CATEGORY_ROUTES.LIST,
|
|
13
|
+
summary: 'List trend categories that contain published trends',
|
|
14
|
+
responses: {
|
|
15
|
+
200: ListPublicTrendCategoriesQueryResponse,
|
|
16
|
+
500: HttpErrorResponseSchema,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export type ListPublicTrendCategoriesQueryResponseType = z.infer<typeof ListPublicTrendCategoriesQueryResponse>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineContract, defineOffsetPaginationQuery, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
3
|
+
import { PublicTrendCardSchema } from '../../models';
|
|
4
|
+
import { TREND_ROUTES } from '../trend';
|
|
5
|
+
|
|
6
|
+
export const ListPublicTrendsQueryQuery = defineOffsetPaginationQuery().extend({
|
|
7
|
+
categorySlug: z.string().min(1).optional(),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const ListPublicTrendsQueryResponse = z.object({
|
|
11
|
+
trends: z.array(PublicTrendCardSchema),
|
|
12
|
+
total: z.number().int().nonnegative(),
|
|
13
|
+
page: z.number().int().positive(),
|
|
14
|
+
limit: z.number().int().positive(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const ListPublicTrendsQuery = defineContract({
|
|
18
|
+
method: HTTP_METHODS.GET,
|
|
19
|
+
path: TREND_ROUTES.LIST,
|
|
20
|
+
summary: 'List published trends with available models, ordered by admin order',
|
|
21
|
+
request: {
|
|
22
|
+
query: ListPublicTrendsQueryQuery,
|
|
23
|
+
},
|
|
24
|
+
responses: {
|
|
25
|
+
200: ListPublicTrendsQueryResponse,
|
|
26
|
+
500: HttpErrorResponseSchema,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export type ListPublicTrendsQueryQueryType = z.infer<typeof ListPublicTrendsQueryQuery>;
|
|
31
|
+
export type ListPublicTrendsQueryResponseType = z.infer<typeof ListPublicTrendsQueryResponse>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const TREND_CONTROLLER = 'trends' as const;
|
|
2
|
+
|
|
3
|
+
export const TREND_ROUTES = {
|
|
4
|
+
LIST: '',
|
|
5
|
+
GET_BY_SLUG: (slug: string) => `${slug}`,
|
|
6
|
+
GENERATE: (slug: string) => `${slug}/generate`,
|
|
7
|
+
} as const;
|
|
8
|
+
|
|
9
|
+
export const TREND_CATEGORY_CONTROLLER = 'trend-categories' as const;
|
|
10
|
+
|
|
11
|
+
export const TREND_CATEGORY_ROUTES = {
|
|
12
|
+
LIST: '',
|
|
13
|
+
} as const;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const TREND_TITLE_MAX_LENGTH = 255;
|
|
2
|
+
export const TREND_PROMPT_MAX_LENGTH = 5000;
|
|
3
|
+
export const TREND_FIELD_NAME_MAX_LENGTH = 50;
|
|
4
|
+
export const TREND_TEXT_VALUE_MAX_LENGTH = 500;
|
|
5
|
+
export const TREND_MIN_FIELDS = 1;
|
|
6
|
+
export const TREND_MAX_FIELDS = 10;
|
|
7
|
+
export const TREND_DURATION_TOLERANCE_SEC = 1;
|
|
8
|
+
export const TREND_CATEGORY_NAME_MAX_LENGTH = 100;
|
|
9
|
+
export const TREND_SLUG_MAX_LENGTH = 255;
|
|
10
|
+
export const TREND_SLUG_PATTERN = /^[a-z0-9]+(?:-[a-z0-9.]+)*$/;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './trend-field-reference.helper';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const TREND_FIELD_REFERENCE_PATTERN = /\{([^{}]+)\}/g;
|
|
2
|
+
|
|
3
|
+
export function toTrendFieldReference(fieldName: string): string {
|
|
4
|
+
return `{${fieldName}}`;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function extractTrendFieldReferences(prompt: string): string[] {
|
|
8
|
+
return [...new Set(Array.from(prompt.matchAll(TREND_FIELD_REFERENCE_PATTERN), (match) => match[1]))];
|
|
9
|
+
}
|
package/trend/index.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { IconSchema } from '../../_common';
|
|
3
|
+
import {
|
|
4
|
+
TrendAspectRatioSchema,
|
|
5
|
+
TrendDurationSecSchema,
|
|
6
|
+
TrendFieldTypeSchema,
|
|
7
|
+
TrendQualitySchema,
|
|
8
|
+
} from './trend-common.schema';
|
|
9
|
+
|
|
10
|
+
export const PublicTrendCategorySchema = z.object({
|
|
11
|
+
uuid: z.uuid(),
|
|
12
|
+
slug: z.string(),
|
|
13
|
+
name: z.string(),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const PublicTrendFieldSchema = z.object({
|
|
17
|
+
uuid: z.uuid(),
|
|
18
|
+
type: TrendFieldTypeSchema,
|
|
19
|
+
name: z.string(),
|
|
20
|
+
order: z.int().nonnegative(),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const PublicTrendCardSchema = z.object({
|
|
24
|
+
uuid: z.uuid(),
|
|
25
|
+
slug: z.string(),
|
|
26
|
+
title: z.string(),
|
|
27
|
+
previewUrl: z.url(),
|
|
28
|
+
fields: z.array(PublicTrendFieldSchema),
|
|
29
|
+
categories: z.array(PublicTrendCategorySchema),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const PublicTrendModelQualitySchema = z.object({
|
|
33
|
+
quality: TrendQualitySchema,
|
|
34
|
+
price: z.number().nonnegative(),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const PublicTrendModelSchema = z.object({
|
|
38
|
+
uuid: z.uuid(),
|
|
39
|
+
titleModel: z.string(),
|
|
40
|
+
icons: IconSchema,
|
|
41
|
+
isDefault: z.boolean(),
|
|
42
|
+
defaultQuality: TrendQualitySchema,
|
|
43
|
+
qualities: z.array(PublicTrendModelQualitySchema).min(1),
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export const PublicTrendSchema = PublicTrendCardSchema.extend({
|
|
47
|
+
prompt: z.string(),
|
|
48
|
+
referenceVideoUrl: z.url(),
|
|
49
|
+
aspectRatio: TrendAspectRatioSchema,
|
|
50
|
+
durationSec: TrendDurationSecSchema,
|
|
51
|
+
models: z.array(PublicTrendModelSchema).min(1),
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export type PublicTrendCategorySchemaType = z.infer<typeof PublicTrendCategorySchema>;
|
|
55
|
+
export type PublicTrendFieldSchemaType = z.infer<typeof PublicTrendFieldSchema>;
|
|
56
|
+
export type PublicTrendCardSchemaType = z.infer<typeof PublicTrendCardSchema>;
|
|
57
|
+
export type PublicTrendModelSchemaType = z.infer<typeof PublicTrendModelSchema>;
|
|
58
|
+
export type PublicTrendSchemaType = z.infer<typeof PublicTrendSchema>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { TREND_CATEGORY_NAME_MAX_LENGTH } from '../enums';
|
|
3
|
+
import { TrendSlugSchema } from './trend-common.schema';
|
|
4
|
+
|
|
5
|
+
export const TrendCategoryInputSchema = z.object({
|
|
6
|
+
slug: TrendSlugSchema,
|
|
7
|
+
name: z.string().trim().min(1).max(TREND_CATEGORY_NAME_MAX_LENGTH),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type TrendCategoryInputSchemaType = z.infer<typeof TrendCategoryInputSchema>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import {
|
|
3
|
+
TREND_ASPECT_RATIO,
|
|
4
|
+
TREND_FIELD_NAME_MAX_LENGTH,
|
|
5
|
+
TREND_FIELD_TYPE,
|
|
6
|
+
TREND_QUALITY,
|
|
7
|
+
TREND_SLUG_MAX_LENGTH,
|
|
8
|
+
TREND_SLUG_PATTERN,
|
|
9
|
+
TREND_STATUS,
|
|
10
|
+
} from '../enums';
|
|
11
|
+
|
|
12
|
+
export const TrendStatusSchema = z.enum(TREND_STATUS);
|
|
13
|
+
export const TrendFieldTypeSchema = z.enum(TREND_FIELD_TYPE);
|
|
14
|
+
export const TrendAspectRatioSchema = z.enum(TREND_ASPECT_RATIO);
|
|
15
|
+
export const TrendQualitySchema = z.enum(TREND_QUALITY);
|
|
16
|
+
|
|
17
|
+
export const TrendSlugSchema = z.string().min(1).max(TREND_SLUG_MAX_LENGTH).regex(TREND_SLUG_PATTERN);
|
|
18
|
+
|
|
19
|
+
export const TrendFieldNameSchema = z
|
|
20
|
+
.string()
|
|
21
|
+
.trim()
|
|
22
|
+
.min(1)
|
|
23
|
+
.max(TREND_FIELD_NAME_MAX_LENGTH)
|
|
24
|
+
.regex(/^[^{}]+$/, 'Field name must not contain { or }');
|
|
25
|
+
|
|
26
|
+
export const TrendDurationSecSchema = z.int().positive();
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { TREND_MAX_FIELDS, TREND_MIN_FIELDS, TREND_PROMPT_MAX_LENGTH, TREND_TITLE_MAX_LENGTH } from '../enums';
|
|
3
|
+
import {
|
|
4
|
+
TrendAspectRatioSchema,
|
|
5
|
+
TrendDurationSecSchema,
|
|
6
|
+
TrendFieldNameSchema,
|
|
7
|
+
TrendFieldTypeSchema,
|
|
8
|
+
TrendSlugSchema,
|
|
9
|
+
} from './trend-common.schema';
|
|
10
|
+
|
|
11
|
+
export const TrendFieldInputSchema = z.object({
|
|
12
|
+
uuid: z.uuid().optional(),
|
|
13
|
+
type: TrendFieldTypeSchema,
|
|
14
|
+
name: TrendFieldNameSchema,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const TrendModelInputSchema = z.object({
|
|
18
|
+
modelId: z.uuid(),
|
|
19
|
+
isDefault: z.boolean().default(false),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
function findDuplicates(values: readonly string[]): string[] {
|
|
23
|
+
return [...new Set(values.filter((value, index) => values.indexOf(value) !== index))];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const TrendInputSchema = z
|
|
27
|
+
.object({
|
|
28
|
+
slug: TrendSlugSchema,
|
|
29
|
+
title: z.string().trim().min(1).max(TREND_TITLE_MAX_LENGTH),
|
|
30
|
+
prompt: z.string().trim().min(1).max(TREND_PROMPT_MAX_LENGTH),
|
|
31
|
+
referenceVideoFileId: z.uuid(),
|
|
32
|
+
previewFileId: z.uuid(),
|
|
33
|
+
aspectRatio: TrendAspectRatioSchema,
|
|
34
|
+
durationSec: TrendDurationSecSchema,
|
|
35
|
+
categoryIds: z.array(z.uuid()).default([]),
|
|
36
|
+
fields: z.array(TrendFieldInputSchema).min(TREND_MIN_FIELDS).max(TREND_MAX_FIELDS),
|
|
37
|
+
models: z.array(TrendModelInputSchema).min(1),
|
|
38
|
+
})
|
|
39
|
+
.superRefine((trend, ctx) => {
|
|
40
|
+
const duplicateNames = findDuplicates(trend.fields.map((field) => field.name));
|
|
41
|
+
if (duplicateNames.length > 0) {
|
|
42
|
+
ctx.addIssue({
|
|
43
|
+
code: 'custom',
|
|
44
|
+
path: ['fields'],
|
|
45
|
+
message: `Field names must be unique: ${duplicateNames.join(', ')}`,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const fieldUuids = trend.fields.flatMap((field) => (field.uuid ? [field.uuid] : []));
|
|
50
|
+
if (findDuplicates(fieldUuids).length > 0) {
|
|
51
|
+
ctx.addIssue({ code: 'custom', path: ['fields'], message: 'Field uuids must be unique' });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (findDuplicates(trend.models.map((model) => model.modelId)).length > 0) {
|
|
55
|
+
ctx.addIssue({ code: 'custom', path: ['models'], message: 'Models must be unique' });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (trend.models.filter((model) => model.isDefault).length > 1) {
|
|
59
|
+
ctx.addIssue({ code: 'custom', path: ['models'], message: 'Only one model can be default' });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (findDuplicates(trend.categoryIds).length > 0) {
|
|
63
|
+
ctx.addIssue({ code: 'custom', path: ['categoryIds'], message: 'Categories must be unique' });
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
export type TrendFieldInputSchemaType = z.infer<typeof TrendFieldInputSchema>;
|
|
68
|
+
export type TrendModelInputSchemaType = z.infer<typeof TrendModelInputSchema>;
|
|
69
|
+
export type TrendInputSchemaType = z.infer<typeof TrendInputSchema>;
|