@ai-grator/api 0.2.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.
Files changed (298) hide show
  1. package/admin/endpoints/admin.ts +16 -0
  2. package/admin/endpoints/commands/create-admin-trend-category.command.ts +29 -0
  3. package/admin/endpoints/commands/create-admin-trend.command.ts +30 -0
  4. package/admin/endpoints/commands/delete-admin-trend-category.command.ts +28 -0
  5. package/admin/endpoints/commands/delete-admin-trend.command.ts +28 -0
  6. package/admin/endpoints/commands/index.ts +9 -0
  7. package/admin/endpoints/commands/probe-admin-trend-reference-video.command.ts +37 -0
  8. package/admin/endpoints/commands/reorder-admin-trends.command.ts +31 -0
  9. package/admin/endpoints/commands/update-admin-trend-category.command.ts +36 -0
  10. package/admin/endpoints/commands/update-admin-trend-status.command.ts +37 -0
  11. package/admin/endpoints/commands/update-admin-trend.command.ts +36 -0
  12. package/admin/endpoints/queries/get-admin-trend-categories.query.ts +22 -0
  13. package/admin/endpoints/queries/get-admin-trend.query.ts +29 -0
  14. package/admin/endpoints/queries/get-admin-trends.query.ts +36 -0
  15. package/admin/endpoints/queries/index.ts +3 -0
  16. package/admin/models/admin-trend-category-response.schema.ts +11 -0
  17. package/admin/models/admin-trend-response.schema.ts +61 -0
  18. package/admin/models/index.ts +2 -0
  19. package/build/admin/endpoints/admin.d.ts +12 -0
  20. package/build/admin/endpoints/admin.d.ts.map +1 -1
  21. package/build/admin/endpoints/admin.js +14 -0
  22. package/build/admin/endpoints/commands/create-admin-trend-category.command.d.ts +41 -0
  23. package/build/admin/endpoints/commands/create-admin-trend-category.command.d.ts.map +1 -0
  24. package/build/admin/endpoints/commands/create-admin-trend-category.command.js +25 -0
  25. package/build/admin/endpoints/commands/create-admin-trend.command.d.ts +144 -0
  26. package/build/admin/endpoints/commands/create-admin-trend.command.d.ts.map +1 -0
  27. package/build/admin/endpoints/commands/create-admin-trend.command.js +26 -0
  28. package/build/admin/endpoints/commands/delete-admin-trend-category.command.d.ts +26 -0
  29. package/build/admin/endpoints/commands/delete-admin-trend-category.command.d.ts.map +1 -0
  30. package/build/admin/endpoints/commands/delete-admin-trend-category.command.js +25 -0
  31. package/build/admin/endpoints/commands/delete-admin-trend.command.d.ts +26 -0
  32. package/build/admin/endpoints/commands/delete-admin-trend.command.d.ts.map +1 -0
  33. package/build/admin/endpoints/commands/delete-admin-trend.command.js +25 -0
  34. package/build/admin/endpoints/commands/index.d.ts +9 -0
  35. package/build/admin/endpoints/commands/index.d.ts.map +1 -1
  36. package/build/admin/endpoints/commands/index.js +9 -0
  37. package/build/admin/endpoints/commands/probe-admin-trend-reference-video.command.d.ts +37 -0
  38. package/build/admin/endpoints/commands/probe-admin-trend-reference-video.command.d.ts.map +1 -0
  39. package/build/admin/endpoints/commands/probe-admin-trend-reference-video.command.js +32 -0
  40. package/build/admin/endpoints/commands/reorder-admin-trends.command.d.ts +26 -0
  41. package/build/admin/endpoints/commands/reorder-admin-trends.command.d.ts.map +1 -0
  42. package/build/admin/endpoints/commands/reorder-admin-trends.command.js +28 -0
  43. package/build/admin/endpoints/commands/update-admin-trend-category.command.d.ts +49 -0
  44. package/build/admin/endpoints/commands/update-admin-trend-category.command.d.ts.map +1 -0
  45. package/build/admin/endpoints/commands/update-admin-trend-category.command.js +31 -0
  46. package/build/admin/endpoints/commands/update-admin-trend-status.command.d.ts +118 -0
  47. package/build/admin/endpoints/commands/update-admin-trend-status.command.d.ts.map +1 -0
  48. package/build/admin/endpoints/commands/update-admin-trend-status.command.js +32 -0
  49. package/build/admin/endpoints/commands/update-admin-trend.command.d.ts +151 -0
  50. package/build/admin/endpoints/commands/update-admin-trend.command.d.ts.map +1 -0
  51. package/build/admin/endpoints/commands/update-admin-trend.command.js +31 -0
  52. package/build/admin/endpoints/queries/get-admin-trend-categories.query.d.ts +32 -0
  53. package/build/admin/endpoints/queries/get-admin-trend-categories.query.d.ts.map +1 -0
  54. package/build/admin/endpoints/queries/get-admin-trend-categories.query.js +21 -0
  55. package/build/admin/endpoints/queries/get-admin-trend.query.d.ts +110 -0
  56. package/build/admin/endpoints/queries/get-admin-trend.query.d.ts.map +1 -0
  57. package/build/admin/endpoints/queries/get-admin-trend.query.js +26 -0
  58. package/build/admin/endpoints/queries/get-admin-trends.query.d.ts +63 -0
  59. package/build/admin/endpoints/queries/get-admin-trends.query.d.ts.map +1 -0
  60. package/build/admin/endpoints/queries/get-admin-trends.query.js +33 -0
  61. package/build/admin/endpoints/queries/index.d.ts +3 -0
  62. package/build/admin/endpoints/queries/index.d.ts.map +1 -1
  63. package/build/admin/endpoints/queries/index.js +3 -0
  64. package/build/admin/models/admin-trend-category-response.schema.d.ts +10 -0
  65. package/build/admin/models/admin-trend-category-response.schema.d.ts.map +1 -0
  66. package/build/admin/models/admin-trend-category-response.schema.js +11 -0
  67. package/build/admin/models/admin-trend-response.schema.d.ts +79 -0
  68. package/build/admin/models/admin-trend-response.schema.d.ts.map +1 -0
  69. package/build/admin/models/admin-trend-response.schema.js +53 -0
  70. package/build/admin/models/index.d.ts +2 -0
  71. package/build/admin/models/index.d.ts.map +1 -1
  72. package/build/admin/models/index.js +2 -0
  73. package/build/errors/errors.d.ts +216 -0
  74. package/build/errors/errors.d.ts.map +1 -1
  75. package/build/errors/errors.js +216 -0
  76. package/build/generation-job/endpoints/commands/create-generation-job.command.d.ts +2 -2
  77. package/build/generation-job/endpoints/commands/update-generation-job.command.d.ts +2 -2
  78. package/build/generation-job/endpoints/queries/get-generation-job-by-uuid.query.d.ts +2 -2
  79. package/build/generation-job/endpoints/queries/get-generation-job-history.query.d.ts +3 -3
  80. package/build/generation-job/endpoints/queries/get-generation-jobs.query.d.ts +2 -2
  81. package/build/generation-job/models/generation-job-response.schema.d.ts +1 -1
  82. package/build/generation-job/models/generation-job-response.schema.js +1 -1
  83. package/build/generation-job-chat/endpoints/commands/create-generation-job-chat.command.d.ts +2 -0
  84. package/build/generation-job-chat/endpoints/commands/create-generation-job-chat.command.d.ts.map +1 -1
  85. package/build/generation-job-chat/endpoints/commands/update-generation-job-chat.command.d.ts +2 -0
  86. package/build/generation-job-chat/endpoints/commands/update-generation-job-chat.command.d.ts.map +1 -1
  87. package/build/generation-job-chat/endpoints/queries/get-generation-job-chat-by-uuid.query.d.ts +2 -0
  88. package/build/generation-job-chat/endpoints/queries/get-generation-job-chat-by-uuid.query.d.ts.map +1 -1
  89. package/build/generation-job-chat/endpoints/queries/get-generation-job-chats.query.d.ts +2 -0
  90. package/build/generation-job-chat/endpoints/queries/get-generation-job-chats.query.d.ts.map +1 -1
  91. package/build/generation-job-chat/models/generation-job-chat-response.schema.d.ts +1 -0
  92. package/build/generation-job-chat/models/generation-job-chat-response.schema.d.ts.map +1 -1
  93. package/build/generation-job-chat/models/generation-job-chat-response.schema.js +1 -0
  94. package/build/generation-model/endpoints/queries/get-generation-models-by-type.query.d.ts +2 -0
  95. package/build/generation-model/endpoints/queries/get-generation-models-by-type.query.d.ts.map +1 -1
  96. package/build/generation-model/endpoints/queries/get-generation-models.query.d.ts +2 -0
  97. package/build/generation-model/endpoints/queries/get-generation-models.query.d.ts.map +1 -1
  98. package/build/generation-model/models/generation-model-response.schema.d.ts +3 -0
  99. package/build/generation-model/models/generation-model-response.schema.d.ts.map +1 -1
  100. package/build/generation-model/models/generation-model-response.schema.js +1 -0
  101. package/build/index.d.ts +2 -0
  102. package/build/index.d.ts.map +1 -1
  103. package/build/index.js +2 -0
  104. package/build/referral/endpoints/referral.d.ts +3 -0
  105. package/build/referral/endpoints/referral.d.ts.map +1 -1
  106. package/build/referral/endpoints/referral.js +3 -0
  107. package/build/referral/models/index.d.ts +1 -0
  108. package/build/referral/models/index.d.ts.map +1 -1
  109. package/build/referral/models/index.js +1 -0
  110. package/build/referral/models/referral-advertising-stats.schema.d.ts +101 -0
  111. package/build/referral/models/referral-advertising-stats.schema.d.ts.map +1 -0
  112. package/build/referral/models/referral-advertising-stats.schema.js +62 -0
  113. package/build/trend/endpoints/commands/generate-trend.command.d.ts +142 -0
  114. package/build/trend/endpoints/commands/generate-trend.command.d.ts.map +1 -0
  115. package/build/trend/endpoints/commands/generate-trend.command.js +54 -0
  116. package/build/trend/endpoints/commands/index.d.ts +2 -0
  117. package/build/trend/endpoints/commands/index.d.ts.map +1 -0
  118. package/build/trend/endpoints/commands/index.js +17 -0
  119. package/build/trend/endpoints/index.d.ts +4 -0
  120. package/build/trend/endpoints/index.d.ts.map +1 -0
  121. package/build/trend/endpoints/index.js +19 -0
  122. package/build/trend/endpoints/queries/get-public-trend-by-slug.query.d.ts +92 -0
  123. package/build/trend/endpoints/queries/get-public-trend-by-slug.query.d.ts.map +1 -0
  124. package/build/trend/endpoints/queries/get-public-trend-by-slug.query.js +24 -0
  125. package/build/trend/endpoints/queries/index.d.ts +4 -0
  126. package/build/trend/endpoints/queries/index.d.ts.map +1 -0
  127. package/build/trend/endpoints/queries/index.js +19 -0
  128. package/build/trend/endpoints/queries/list-public-trend-categories.query.d.ts +26 -0
  129. package/build/trend/endpoints/queries/list-public-trend-categories.query.d.ts.map +1 -0
  130. package/build/trend/endpoints/queries/list-public-trend-categories.query.js +19 -0
  131. package/build/trend/endpoints/queries/list-public-trends.query.d.ts +69 -0
  132. package/build/trend/endpoints/queries/list-public-trends.query.d.ts.map +1 -0
  133. package/build/trend/endpoints/queries/list-public-trends.query.js +28 -0
  134. package/build/trend/endpoints/trend.d.ts +11 -0
  135. package/build/trend/endpoints/trend.d.ts.map +1 -0
  136. package/build/trend/endpoints/trend.js +13 -0
  137. package/build/trend/enums/index.d.ts +6 -0
  138. package/build/trend/enums/index.d.ts.map +1 -0
  139. package/build/trend/enums/index.js +21 -0
  140. package/build/trend/enums/trend-aspect-ratio.enum.d.ts +9 -0
  141. package/build/trend/enums/trend-aspect-ratio.enum.d.ts.map +1 -0
  142. package/build/trend/enums/trend-aspect-ratio.enum.js +12 -0
  143. package/build/trend/enums/trend-field-type.enum.d.ts +5 -0
  144. package/build/trend/enums/trend-field-type.enum.d.ts.map +1 -0
  145. package/build/trend/enums/trend-field-type.enum.js +8 -0
  146. package/build/trend/enums/trend-limits.d.ts +11 -0
  147. package/build/trend/enums/trend-limits.d.ts.map +1 -0
  148. package/build/trend/enums/trend-limits.js +13 -0
  149. package/build/trend/enums/trend-quality.enum.d.ts +7 -0
  150. package/build/trend/enums/trend-quality.enum.d.ts.map +1 -0
  151. package/build/trend/enums/trend-quality.enum.js +10 -0
  152. package/build/trend/enums/trend-status.enum.d.ts +5 -0
  153. package/build/trend/enums/trend-status.enum.d.ts.map +1 -0
  154. package/build/trend/enums/trend-status.enum.js +8 -0
  155. package/build/trend/helpers/index.d.ts +2 -0
  156. package/build/trend/helpers/index.d.ts.map +1 -0
  157. package/build/trend/helpers/index.js +17 -0
  158. package/build/trend/helpers/trend-field-reference.helper.d.ts +4 -0
  159. package/build/trend/helpers/trend-field-reference.helper.d.ts.map +1 -0
  160. package/build/trend/helpers/trend-field-reference.helper.js +12 -0
  161. package/build/trend/index.d.ts +5 -0
  162. package/build/trend/index.d.ts.map +1 -0
  163. package/build/trend/index.js +20 -0
  164. package/build/trend/models/index.d.ts +5 -0
  165. package/build/trend/models/index.d.ts.map +1 -0
  166. package/build/trend/models/index.js +20 -0
  167. package/build/trend/models/public-trend.schema.d.ts +88 -0
  168. package/build/trend/models/public-trend.schema.d.ts.map +1 -0
  169. package/build/trend/models/public-trend.schema.js +44 -0
  170. package/build/trend/models/trend-category-input.schema.d.ts +7 -0
  171. package/build/trend/models/trend-category-input.schema.d.ts.map +1 -0
  172. package/build/trend/models/trend-category-input.schema.js +10 -0
  173. package/build/trend/models/trend-common.schema.d.ts +10 -0
  174. package/build/trend/models/trend-common.schema.d.ts.map +1 -0
  175. package/build/trend/models/trend-common.schema.js +17 -0
  176. package/build/trend/models/trend-input.schema.d.ts +33 -0
  177. package/build/trend/models/trend-input.schema.d.ts.map +1 -0
  178. package/build/trend/models/trend-input.schema.js +54 -0
  179. package/build/tsconfig.tsbuildinfo +1 -1
  180. package/build/video-generation-chain/endpoints/commands/cancel-video-generation-chain.command.d.ts +112 -0
  181. package/build/video-generation-chain/endpoints/commands/cancel-video-generation-chain.command.d.ts.map +1 -0
  182. package/build/video-generation-chain/endpoints/commands/cancel-video-generation-chain.command.js +26 -0
  183. package/build/video-generation-chain/endpoints/commands/create-video-generation-chain.command.d.ts +120 -0
  184. package/build/video-generation-chain/endpoints/commands/create-video-generation-chain.command.d.ts.map +1 -0
  185. package/build/video-generation-chain/endpoints/commands/create-video-generation-chain.command.js +52 -0
  186. package/build/video-generation-chain/endpoints/commands/index.d.ts +6 -0
  187. package/build/video-generation-chain/endpoints/commands/index.d.ts.map +1 -0
  188. package/build/video-generation-chain/endpoints/commands/index.js +21 -0
  189. package/build/video-generation-chain/endpoints/commands/regenerate-video-generation-chain-scene.command.d.ts +114 -0
  190. package/build/video-generation-chain/endpoints/commands/regenerate-video-generation-chain-scene.command.d.ts.map +1 -0
  191. package/build/video-generation-chain/endpoints/commands/regenerate-video-generation-chain-scene.command.js +25 -0
  192. package/build/video-generation-chain/endpoints/commands/resume-video-generation-chain.command.d.ts +113 -0
  193. package/build/video-generation-chain/endpoints/commands/resume-video-generation-chain.command.d.ts.map +1 -0
  194. package/build/video-generation-chain/endpoints/commands/resume-video-generation-chain.command.js +27 -0
  195. package/build/video-generation-chain/endpoints/commands/update-video-generation-chain-scene.command.d.ts +127 -0
  196. package/build/video-generation-chain/endpoints/commands/update-video-generation-chain-scene.command.d.ts.map +1 -0
  197. package/build/video-generation-chain/endpoints/commands/update-video-generation-chain-scene.command.js +43 -0
  198. package/build/video-generation-chain/endpoints/index.d.ts +4 -0
  199. package/build/video-generation-chain/endpoints/index.d.ts.map +1 -0
  200. package/build/video-generation-chain/endpoints/index.js +19 -0
  201. package/build/video-generation-chain/endpoints/queries/get-video-generation-chain-by-uuid.query.d.ts +111 -0
  202. package/build/video-generation-chain/endpoints/queries/get-video-generation-chain-by-uuid.query.d.ts.map +1 -0
  203. package/build/video-generation-chain/endpoints/queries/get-video-generation-chain-by-uuid.query.js +25 -0
  204. package/build/video-generation-chain/endpoints/queries/get-video-generation-chain-config.query.d.ts +109 -0
  205. package/build/video-generation-chain/endpoints/queries/get-video-generation-chain-config.query.d.ts.map +1 -0
  206. package/build/video-generation-chain/endpoints/queries/get-video-generation-chain-config.query.js +22 -0
  207. package/build/video-generation-chain/endpoints/queries/get-video-generation-chains.query.d.ts +54 -0
  208. package/build/video-generation-chain/endpoints/queries/get-video-generation-chains.query.d.ts.map +1 -0
  209. package/build/video-generation-chain/endpoints/queries/get-video-generation-chains.query.js +26 -0
  210. package/build/video-generation-chain/endpoints/queries/index.d.ts +4 -0
  211. package/build/video-generation-chain/endpoints/queries/index.d.ts.map +1 -0
  212. package/build/video-generation-chain/endpoints/queries/index.js +19 -0
  213. package/build/video-generation-chain/endpoints/video-generation-chain.d.ts +12 -0
  214. package/build/video-generation-chain/endpoints/video-generation-chain.d.ts.map +1 -0
  215. package/build/video-generation-chain/endpoints/video-generation-chain.js +14 -0
  216. package/build/video-generation-chain/enums/index.d.ts +5 -0
  217. package/build/video-generation-chain/enums/index.d.ts.map +1 -0
  218. package/build/video-generation-chain/enums/index.js +20 -0
  219. package/build/video-generation-chain/enums/video-generation-chain-frame-slot.enum.d.ts +6 -0
  220. package/build/video-generation-chain/enums/video-generation-chain-frame-slot.enum.d.ts.map +1 -0
  221. package/build/video-generation-chain/enums/video-generation-chain-frame-slot.enum.js +13 -0
  222. package/build/video-generation-chain/enums/video-generation-chain-limits.d.ts +3 -0
  223. package/build/video-generation-chain/enums/video-generation-chain-limits.d.ts.map +1 -0
  224. package/build/video-generation-chain/enums/video-generation-chain-limits.js +5 -0
  225. package/build/video-generation-chain/enums/video-generation-chain-scene-status.enum.d.ts +7 -0
  226. package/build/video-generation-chain/enums/video-generation-chain-scene-status.enum.d.ts.map +1 -0
  227. package/build/video-generation-chain/enums/video-generation-chain-scene-status.enum.js +10 -0
  228. package/build/video-generation-chain/enums/video-generation-chain-status.enum.d.ts +9 -0
  229. package/build/video-generation-chain/enums/video-generation-chain-status.enum.d.ts.map +1 -0
  230. package/build/video-generation-chain/enums/video-generation-chain-status.enum.js +12 -0
  231. package/build/video-generation-chain/index.d.ts +4 -0
  232. package/build/video-generation-chain/index.d.ts.map +1 -0
  233. package/build/video-generation-chain/index.js +19 -0
  234. package/build/video-generation-chain/models/index.d.ts +4 -0
  235. package/build/video-generation-chain/models/index.d.ts.map +1 -0
  236. package/build/video-generation-chain/models/index.js +19 -0
  237. package/build/video-generation-chain/models/video-generation-chain-response.schema.d.ts +73 -0
  238. package/build/video-generation-chain/models/video-generation-chain-response.schema.d.ts.map +1 -0
  239. package/build/video-generation-chain/models/video-generation-chain-response.schema.js +24 -0
  240. package/build/video-generation-chain/models/video-generation-chain-scene-input.schema.d.ts +9 -0
  241. package/build/video-generation-chain/models/video-generation-chain-scene-input.schema.d.ts.map +1 -0
  242. package/build/video-generation-chain/models/video-generation-chain-scene-input.schema.js +15 -0
  243. package/build/video-generation-chain/models/video-generation-chain-scene-response.schema.d.ts +44 -0
  244. package/build/video-generation-chain/models/video-generation-chain-scene-response.schema.d.ts.map +1 -0
  245. package/build/video-generation-chain/models/video-generation-chain-scene-response.schema.js +24 -0
  246. package/errors/errors.ts +216 -0
  247. package/generation-job/models/generation-job-response.schema.ts +1 -1
  248. package/generation-job-chat/models/generation-job-chat-response.schema.ts +1 -0
  249. package/generation-model/models/generation-model-response.schema.ts +1 -0
  250. package/index.ts +2 -0
  251. package/package.json +1 -1
  252. package/referral/endpoints/referral.ts +3 -0
  253. package/referral/models/index.ts +1 -0
  254. package/referral/models/referral-advertising-stats.schema.ts +79 -0
  255. package/trend/endpoints/commands/generate-trend.command.ts +63 -0
  256. package/trend/endpoints/commands/index.ts +1 -0
  257. package/trend/endpoints/index.ts +3 -0
  258. package/trend/endpoints/queries/get-public-trend-by-slug.query.ts +27 -0
  259. package/trend/endpoints/queries/index.ts +3 -0
  260. package/trend/endpoints/queries/list-public-trend-categories.query.ts +20 -0
  261. package/trend/endpoints/queries/list-public-trends.query.ts +31 -0
  262. package/trend/endpoints/trend.ts +13 -0
  263. package/trend/enums/index.ts +5 -0
  264. package/trend/enums/trend-aspect-ratio.enum.ts +8 -0
  265. package/trend/enums/trend-field-type.enum.ts +4 -0
  266. package/trend/enums/trend-limits.ts +10 -0
  267. package/trend/enums/trend-quality.enum.ts +7 -0
  268. package/trend/enums/trend-status.enum.ts +4 -0
  269. package/trend/helpers/index.ts +1 -0
  270. package/trend/helpers/trend-field-reference.helper.ts +9 -0
  271. package/trend/index.ts +4 -0
  272. package/trend/models/index.ts +4 -0
  273. package/trend/models/public-trend.schema.ts +58 -0
  274. package/trend/models/trend-category-input.schema.ts +10 -0
  275. package/trend/models/trend-common.schema.ts +26 -0
  276. package/trend/models/trend-input.schema.ts +69 -0
  277. package/video-generation-chain/endpoints/commands/cancel-video-generation-chain.command.ts +26 -0
  278. package/video-generation-chain/endpoints/commands/create-video-generation-chain.command.ts +59 -0
  279. package/video-generation-chain/endpoints/commands/index.ts +5 -0
  280. package/video-generation-chain/endpoints/commands/regenerate-video-generation-chain-scene.command.ts +25 -0
  281. package/video-generation-chain/endpoints/commands/resume-video-generation-chain.command.ts +27 -0
  282. package/video-generation-chain/endpoints/commands/update-video-generation-chain-scene.command.ts +49 -0
  283. package/video-generation-chain/endpoints/index.ts +3 -0
  284. package/video-generation-chain/endpoints/queries/get-video-generation-chain-by-uuid.query.ts +25 -0
  285. package/video-generation-chain/endpoints/queries/get-video-generation-chain-config.query.ts +23 -0
  286. package/video-generation-chain/endpoints/queries/get-video-generation-chains.query.ts +26 -0
  287. package/video-generation-chain/endpoints/queries/index.ts +3 -0
  288. package/video-generation-chain/endpoints/video-generation-chain.ts +12 -0
  289. package/video-generation-chain/enums/index.ts +4 -0
  290. package/video-generation-chain/enums/video-generation-chain-frame-slot.enum.ts +10 -0
  291. package/video-generation-chain/enums/video-generation-chain-limits.ts +2 -0
  292. package/video-generation-chain/enums/video-generation-chain-scene-status.enum.ts +6 -0
  293. package/video-generation-chain/enums/video-generation-chain-status.enum.ts +8 -0
  294. package/video-generation-chain/index.ts +3 -0
  295. package/video-generation-chain/models/index.ts +3 -0
  296. package/video-generation-chain/models/video-generation-chain-response.schema.ts +28 -0
  297. package/video-generation-chain/models/video-generation-chain-scene-input.schema.ts +17 -0
  298. package/video-generation-chain/models/video-generation-chain-scene-response.schema.ts +26 -0
@@ -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
@@ -20,6 +20,8 @@ export * from './admin';
20
20
  export * from './file';
21
21
  export * from './generation-job-chat';
22
22
  export * from './marketplace-card';
23
+ export * from './video-generation-chain';
24
+ export * from './trend';
23
25
  export * from './support';
24
26
  export * from './user-context';
25
27
  export * from './organization';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-grator/api",
3
- "version": "0.2.66",
3
+ "version": "0.3.67",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "scripts": {
@@ -5,6 +5,9 @@ export const REFERRAL_LINK_PATH = 'r' as const;
5
5
  export const REFERRAL_UTM_MEDIUM = 'referral' as const;
6
6
 
7
7
  export const REFERRAL_ROUTES = {
8
+ GET_ADVERTISING_LINKS: 'advertising/links',
9
+ GET_ADVERTISING_LINK_STATS: 'advertising/links/:code/stats',
10
+ GET_ADVERTISING_STATS: 'advertising/stats',
8
11
  GET_CONFIG: 'config',
9
12
  GET_STATS: 'stats',
10
13
  GET_BONUS_HISTORY: 'bonus-history',
@@ -6,3 +6,4 @@ export * from './referral-link-response.schema';
6
6
  export * from './referral-stats-period.schema';
7
7
  export * from './referral-link-stats-response.schema';
8
8
  export * from './referral-deposits-stats-response.schema';
9
+ export * from './referral-advertising-stats.schema';
@@ -0,0 +1,79 @@
1
+ import { z } from 'zod';
2
+ import { ReferralLinkListItemSchema, ResolveReferralLinkParamsSchema } from './referral-link-response.schema';
3
+ import { ReferralStatsPeriodQuerySchema } from './referral-stats-period.schema';
4
+
5
+ export const REFERRAL_STATS_UTC_OFFSET_HOURS = 3;
6
+
7
+ const DAY_MS = 24 * 60 * 60 * 1000;
8
+ const MOSCOW_UTC_OFFSET_MS = REFERRAL_STATS_UTC_OFFSET_HOURS * 60 * 60 * 1000;
9
+ const MAX_CALENDAR_PERIODS = { day: 31, month: 100 } as const;
10
+
11
+ /** Both boundaries are required; to is exclusive. */
12
+ export const GetReferralAdvertisingStatsQuerySchema = ReferralStatsPeriodQuerySchema.required()
13
+ .extend({
14
+ groupBy: z.enum(['month', 'day']).default('month'),
15
+ })
16
+ .superRefine(({ from, to, groupBy }, ctx) => {
17
+ // Format checks may fail before the date transforms run.
18
+ if (!(from instanceof Date) || !(to instanceof Date)) {
19
+ return;
20
+ }
21
+
22
+ if (from >= to) {
23
+ ctx.addIssue({ code: 'custom', path: ['to'], message: 'to must be later than from' });
24
+ return;
25
+ }
26
+
27
+ // Count Moscow calendar buckets, excluding the upper boundary as in the SQL query.
28
+ const start = new Date(from.getTime() + MOSCOW_UTC_OFFSET_MS);
29
+ const end = new Date(to.getTime() - 1 + MOSCOW_UTC_OFFSET_MS);
30
+ const periodCount =
31
+ groupBy === 'day'
32
+ ? Math.floor(end.getTime() / DAY_MS) - Math.floor(start.getTime() / DAY_MS) + 1
33
+ : (end.getUTCFullYear() - start.getUTCFullYear()) * 12 + end.getUTCMonth() - start.getUTCMonth() + 1;
34
+
35
+ if (periodCount > MAX_CALENDAR_PERIODS[groupBy]) {
36
+ ctx.addIssue({
37
+ code: 'custom',
38
+ path: ['to'],
39
+ message: `Period must not exceed ${MAX_CALENDAR_PERIODS[groupBy]} calendar ${groupBy}s per request`,
40
+ });
41
+ }
42
+ });
43
+
44
+ export type GetReferralAdvertisingStatsQuerySchemaType = z.infer<typeof GetReferralAdvertisingStatsQuerySchema>;
45
+
46
+ export const ReferralAdvertisingMetricsSchema = z.object({
47
+ clicks: z.number().int().nonnegative(),
48
+ registrations: z.number().int().nonnegative(),
49
+ purchases: z.number().int().nonnegative(),
50
+ conversionRate: z.number().nonnegative(),
51
+ });
52
+ export type ReferralAdvertisingMetricsSchemaType = z.infer<typeof ReferralAdvertisingMetricsSchema>;
53
+
54
+ export const ReferralAdvertisingPeriodStatsSchema = z.object({
55
+ periodStart: z.iso.datetime(),
56
+ /** Exclusive upper boundary. */
57
+ periodEnd: z.iso.datetime(),
58
+ metrics: ReferralAdvertisingMetricsSchema,
59
+ });
60
+ export type ReferralAdvertisingPeriodStatsSchemaType = z.infer<typeof ReferralAdvertisingPeriodStatsSchema>;
61
+
62
+ export const GetReferralAdvertisingStatsResponseSchema = z.object({
63
+ periods: z.array(ReferralAdvertisingPeriodStatsSchema),
64
+ });
65
+ export type GetReferralAdvertisingStatsResponseSchemaType = z.infer<typeof GetReferralAdvertisingStatsResponseSchema>;
66
+
67
+ export const ReferralAdvertisingLinkStatsSchema = ReferralLinkListItemSchema.omit({ referralsCount: true }).extend({
68
+ metrics: ReferralAdvertisingMetricsSchema,
69
+ });
70
+ export type ReferralAdvertisingLinkStatsSchemaType = z.infer<typeof ReferralAdvertisingLinkStatsSchema>;
71
+
72
+ export const GetReferralAdvertisingLinksResponseSchema = z.object({
73
+ links: z.array(ReferralAdvertisingLinkStatsSchema),
74
+ });
75
+ export type GetReferralAdvertisingLinksResponseSchemaType = z.infer<typeof GetReferralAdvertisingLinksResponseSchema>;
76
+
77
+ export const GetReferralAdvertisingLinkStatsParamsSchema = ResolveReferralLinkParamsSchema;
78
+ export const GetReferralAdvertisingLinkStatsQuerySchema = GetReferralAdvertisingStatsQuerySchema;
79
+ export const GetReferralAdvertisingLinkStatsResponseSchema = GetReferralAdvertisingStatsResponseSchema;
@@ -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,3 @@
1
+ export * from './trend';
2
+ export * from './commands';
3
+ export * from './queries';
@@ -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,3 @@
1
+ export * from './list-public-trends.query';
2
+ export * from './get-public-trend-by-slug.query';
3
+ export * from './list-public-trend-categories.query';
@@ -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,5 @@
1
+ export * from './trend-status.enum';
2
+ export * from './trend-field-type.enum';
3
+ export * from './trend-aspect-ratio.enum';
4
+ export * from './trend-quality.enum';
5
+ export * from './trend-limits';
@@ -0,0 +1,8 @@
1
+ export enum TREND_ASPECT_RATIO {
2
+ SQUARE = '1:1',
3
+ LANDSCAPE = '16:9',
4
+ ULTRAWIDE = '21:9',
5
+ PORTRAIT_3_4 = '3:4',
6
+ LANDSCAPE_4_3 = '4:3',
7
+ PORTRAIT = '9:16',
8
+ }
@@ -0,0 +1,4 @@
1
+ export enum TREND_FIELD_TYPE {
2
+ FILE = 'file',
3
+ TEXT = 'text',
4
+ }
@@ -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,7 @@
1
+ export enum TREND_QUALITY {
2
+ P480 = '480p',
3
+ P720 = '720p',
4
+ P1080 = '1080p',
5
+ }
6
+
7
+ export const TREND_DEFAULT_QUALITY = TREND_QUALITY.P720;
@@ -0,0 +1,4 @@
1
+ export enum TREND_STATUS {
2
+ DRAFT = 'draft',
3
+ PUBLISHED = 'published',
4
+ }
@@ -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,4 @@
1
+ export * from './enums';
2
+ export * from './helpers';
3
+ export * from './models';
4
+ export * from './endpoints';
@@ -0,0 +1,4 @@
1
+ export * from './trend-common.schema';
2
+ export * from './trend-input.schema';
3
+ export * from './trend-category-input.schema';
4
+ export * from './public-trend.schema';
@@ -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>;
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
3
+ import { VideoGenerationChainResponseSchema } from '../../models';
4
+ import { VIDEO_GENERATION_CHAIN_ROUTES } from '../video-generation-chain';
5
+
6
+ export const CancelVideoGenerationChainCommandParams = z.object({
7
+ uuid: z.uuid(),
8
+ });
9
+
10
+ export const CancelVideoGenerationChainCommandResponse = VideoGenerationChainResponseSchema;
11
+
12
+ export const CancelVideoGenerationChainCommand = defineContract({
13
+ method: HTTP_METHODS.POST,
14
+ path: VIDEO_GENERATION_CHAIN_ROUTES.CANCEL(':uuid'),
15
+ summary: 'Cancel a generation chain; already generated scenes are kept',
16
+ request: {
17
+ params: CancelVideoGenerationChainCommandParams,
18
+ },
19
+ responses: {
20
+ 200: CancelVideoGenerationChainCommandResponse,
21
+ 401: HttpErrorResponseSchema,
22
+ 404: HttpErrorResponseSchema,
23
+ 409: HttpErrorResponseSchema,
24
+ 500: HttpErrorResponseSchema,
25
+ },
26
+ });
@@ -0,0 +1,59 @@
1
+ import { z } from 'zod';
2
+ import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
3
+ import {
4
+ VIDEO_GENERATION_CHAIN_FRAME_SLOT,
5
+ VIDEO_GENERATION_CHAIN_MAX_SCENES,
6
+ VIDEO_GENERATION_CHAIN_MIN_SCENES,
7
+ } from '../../enums';
8
+ import { VideoGenerationChainResponseSchema, VideoGenerationChainSceneInputSchema } from '../../models';
9
+ import { VIDEO_GENERATION_CHAIN_ROUTES } from '../video-generation-chain';
10
+
11
+ export const CreateVideoGenerationChainCommandBody = z
12
+ .object({
13
+ modelId: z.uuid(),
14
+ scenes: z
15
+ .array(VideoGenerationChainSceneInputSchema)
16
+ .min(VIDEO_GENERATION_CHAIN_MIN_SCENES)
17
+ .max(VIDEO_GENERATION_CHAIN_MAX_SCENES),
18
+ })
19
+ .superRefine(({ scenes }, ctx) => {
20
+ const lastIndex = scenes.length - 1;
21
+
22
+ scenes.forEach((scene, index) => {
23
+ const slots = Object.keys(scene.attachments ?? {});
24
+
25
+ if (index !== 0 && slots.includes(VIDEO_GENERATION_CHAIN_FRAME_SLOT.FIRST_FRAME)) {
26
+ ctx.addIssue({
27
+ code: 'custom',
28
+ path: ['scenes', index, 'attachments', VIDEO_GENERATION_CHAIN_FRAME_SLOT.FIRST_FRAME],
29
+ message: 'First frame is allowed only for the first scene',
30
+ });
31
+ }
32
+
33
+ if (index !== lastIndex && slots.includes(VIDEO_GENERATION_CHAIN_FRAME_SLOT.LAST_FRAME)) {
34
+ ctx.addIssue({
35
+ code: 'custom',
36
+ path: ['scenes', index, 'attachments', VIDEO_GENERATION_CHAIN_FRAME_SLOT.LAST_FRAME],
37
+ message: 'Last frame is allowed only for the last scene',
38
+ });
39
+ }
40
+ });
41
+ });
42
+
43
+ export const CreateVideoGenerationChainCommandResponse = VideoGenerationChainResponseSchema;
44
+
45
+ export const CreateVideoGenerationChainCommand = defineContract({
46
+ method: HTTP_METHODS.POST,
47
+ path: VIDEO_GENERATION_CHAIN_ROUTES.CREATE,
48
+ summary: 'Create and start a chain of linked video generations',
49
+ request: {
50
+ body: CreateVideoGenerationChainCommandBody,
51
+ },
52
+ responses: {
53
+ 201: CreateVideoGenerationChainCommandResponse,
54
+ 400: HttpErrorResponseSchema,
55
+ 401: HttpErrorResponseSchema,
56
+ 404: HttpErrorResponseSchema,
57
+ 500: HttpErrorResponseSchema,
58
+ },
59
+ });
@@ -0,0 +1,5 @@
1
+ export * from './create-video-generation-chain.command';
2
+ export * from './update-video-generation-chain-scene.command';
3
+ export * from './resume-video-generation-chain.command';
4
+ export * from './cancel-video-generation-chain.command';
5
+ export * from './regenerate-video-generation-chain-scene.command';
@@ -0,0 +1,25 @@
1
+ import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
2
+ import { VideoGenerationChainResponseSchema } from '../../models';
3
+ import { VIDEO_GENERATION_CHAIN_ROUTES } from '../video-generation-chain';
4
+ import { VideoGenerationChainSceneParams } from './update-video-generation-chain-scene.command';
5
+
6
+ export const RegenerateVideoGenerationChainSceneCommandParams = VideoGenerationChainSceneParams;
7
+
8
+ export const RegenerateVideoGenerationChainSceneCommandResponse = VideoGenerationChainResponseSchema;
9
+
10
+ export const RegenerateVideoGenerationChainSceneCommand = defineContract({
11
+ method: HTTP_METHODS.POST,
12
+ path: VIDEO_GENERATION_CHAIN_ROUTES.REGENERATE_SCENE(':uuid', ':index'),
13
+ summary: 'Regenerate a generated scene that no generated scene depends on',
14
+ request: {
15
+ params: RegenerateVideoGenerationChainSceneCommandParams,
16
+ },
17
+ responses: {
18
+ 200: RegenerateVideoGenerationChainSceneCommandResponse,
19
+ 400: HttpErrorResponseSchema,
20
+ 401: HttpErrorResponseSchema,
21
+ 404: HttpErrorResponseSchema,
22
+ 409: HttpErrorResponseSchema,
23
+ 500: HttpErrorResponseSchema,
24
+ },
25
+ });