@ai-grator/api 0.1.37 → 0.1.39

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 (182) hide show
  1. package/admin/endpoints/admin.ts +18 -0
  2. package/admin/endpoints/commands/create-admin-model-family.command.ts +28 -0
  3. package/admin/endpoints/commands/create-admin-page.command.ts +56 -0
  4. package/admin/endpoints/commands/delete-admin-model-family.command.ts +29 -0
  5. package/admin/endpoints/commands/delete-admin-page.command.ts +28 -0
  6. package/admin/endpoints/commands/index.ts +8 -0
  7. package/admin/endpoints/commands/update-admin-model-family.command.ts +38 -0
  8. package/admin/endpoints/commands/update-admin-organization.command.ts +28 -0
  9. package/admin/endpoints/commands/update-admin-page-status.command.ts +37 -0
  10. package/admin/endpoints/commands/update-admin-page.command.ts +55 -0
  11. package/admin/endpoints/queries/get-admin-model-families.query.ts +22 -0
  12. package/admin/endpoints/queries/get-admin-organization.query.ts +21 -0
  13. package/admin/endpoints/queries/get-admin-page.query.ts +29 -0
  14. package/admin/endpoints/queries/get-admin-pages.query.ts +38 -0
  15. package/admin/endpoints/queries/index.ts +4 -0
  16. package/admin/models/admin-page-list-item.schema.ts +19 -0
  17. package/admin/models/admin-page-response.schema.ts +33 -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 +15 -0
  22. package/build/admin/endpoints/commands/create-admin-model-family.command.d.ts +41 -0
  23. package/build/admin/endpoints/commands/create-admin-model-family.command.d.ts.map +1 -0
  24. package/build/admin/endpoints/commands/create-admin-model-family.command.js +24 -0
  25. package/build/admin/endpoints/commands/create-admin-page.command.d.ts +801 -0
  26. package/build/admin/endpoints/commands/create-admin-page.command.d.ts.map +1 -0
  27. package/build/admin/endpoints/commands/create-admin-page.command.js +44 -0
  28. package/build/admin/endpoints/commands/delete-admin-model-family.command.d.ts +27 -0
  29. package/build/admin/endpoints/commands/delete-admin-model-family.command.d.ts.map +1 -0
  30. package/build/admin/endpoints/commands/delete-admin-model-family.command.js +26 -0
  31. package/build/admin/endpoints/commands/delete-admin-page.command.d.ts +26 -0
  32. package/build/admin/endpoints/commands/delete-admin-page.command.d.ts.map +1 -0
  33. package/build/admin/endpoints/commands/delete-admin-page.command.js +25 -0
  34. package/build/admin/endpoints/commands/index.d.ts +8 -0
  35. package/build/admin/endpoints/commands/index.d.ts.map +1 -1
  36. package/build/admin/endpoints/commands/index.js +8 -0
  37. package/build/admin/endpoints/commands/update-admin-model-family.command.d.ts +49 -0
  38. package/build/admin/endpoints/commands/update-admin-model-family.command.d.ts.map +1 -0
  39. package/build/admin/endpoints/commands/update-admin-model-family.command.js +30 -0
  40. package/build/admin/endpoints/commands/update-admin-organization.command.d.ts +71 -0
  41. package/build/admin/endpoints/commands/update-admin-organization.command.d.ts.map +1 -0
  42. package/build/admin/endpoints/commands/update-admin-organization.command.js +24 -0
  43. package/build/admin/endpoints/commands/update-admin-page-status.command.d.ts +433 -0
  44. package/build/admin/endpoints/commands/update-admin-page-status.command.d.ts.map +1 -0
  45. package/build/admin/endpoints/commands/update-admin-page-status.command.js +32 -0
  46. package/build/admin/endpoints/commands/update-admin-page.command.d.ts +801 -0
  47. package/build/admin/endpoints/commands/update-admin-page.command.d.ts.map +1 -0
  48. package/build/admin/endpoints/commands/update-admin-page.command.js +50 -0
  49. package/build/admin/endpoints/queries/get-admin-model-families.query.d.ts +30 -0
  50. package/build/admin/endpoints/queries/get-admin-model-families.query.d.ts.map +1 -0
  51. package/build/admin/endpoints/queries/get-admin-model-families.query.js +21 -0
  52. package/build/admin/endpoints/queries/get-admin-organization.query.d.ts +41 -0
  53. package/build/admin/endpoints/queries/get-admin-organization.query.d.ts.map +1 -0
  54. package/build/admin/endpoints/queries/get-admin-organization.query.js +19 -0
  55. package/build/admin/endpoints/queries/get-admin-page.query.d.ts +424 -0
  56. package/build/admin/endpoints/queries/get-admin-page.query.d.ts.map +1 -0
  57. package/build/admin/endpoints/queries/get-admin-page.query.js +26 -0
  58. package/build/admin/endpoints/queries/get-admin-pages.query.d.ts +74 -0
  59. package/build/admin/endpoints/queries/get-admin-pages.query.d.ts.map +1 -0
  60. package/build/admin/endpoints/queries/get-admin-pages.query.js +35 -0
  61. package/build/admin/endpoints/queries/index.d.ts +4 -0
  62. package/build/admin/endpoints/queries/index.d.ts.map +1 -1
  63. package/build/admin/endpoints/queries/index.js +4 -0
  64. package/build/admin/models/admin-page-list-item.schema.d.ts +18 -0
  65. package/build/admin/models/admin-page-list-item.schema.d.ts.map +1 -0
  66. package/build/admin/models/admin-page-list-item.schema.js +19 -0
  67. package/build/admin/models/admin-page-response.schema.d.ts +204 -0
  68. package/build/admin/models/admin-page-response.schema.d.ts.map +1 -0
  69. package/build/admin/models/admin-page-response.schema.js +24 -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 +94 -0
  74. package/build/errors/errors.d.ts.map +1 -1
  75. package/build/errors/errors.js +94 -0
  76. package/build/index.d.ts +1 -0
  77. package/build/index.d.ts.map +1 -1
  78. package/build/index.js +1 -0
  79. package/build/model-page/endpoints/model-page.d.ts +4 -0
  80. package/build/model-page/endpoints/model-page.d.ts.map +1 -1
  81. package/build/model-page/endpoints/model-page.js +5 -1
  82. package/build/model-page/endpoints/queries/get-public-model-by-slug.query.d.ts +84 -6
  83. package/build/model-page/endpoints/queries/get-public-model-by-slug.query.d.ts.map +1 -1
  84. package/build/model-page/endpoints/queries/get-public-page-by-slug.query.d.ts +387 -0
  85. package/build/model-page/endpoints/queries/get-public-page-by-slug.query.d.ts.map +1 -0
  86. package/build/model-page/endpoints/queries/get-public-page-by-slug.query.js +25 -0
  87. package/build/model-page/endpoints/queries/index.d.ts +1 -0
  88. package/build/model-page/endpoints/queries/index.d.ts.map +1 -1
  89. package/build/model-page/endpoints/queries/index.js +1 -0
  90. package/build/model-page/enums/index.d.ts +6 -0
  91. package/build/model-page/enums/index.d.ts.map +1 -0
  92. package/build/model-page/enums/index.js +21 -0
  93. package/build/model-page/enums/page-locale.enum.d.ts +4 -0
  94. package/build/model-page/enums/page-locale.enum.d.ts.map +1 -0
  95. package/build/model-page/enums/page-locale.enum.js +7 -0
  96. package/build/model-page/enums/page-status.enum.d.ts +7 -0
  97. package/build/model-page/enums/page-status.enum.d.ts.map +1 -0
  98. package/build/model-page/enums/page-status.enum.js +10 -0
  99. package/build/model-page/enums/page-type.enum.d.ts +8 -0
  100. package/build/model-page/enums/page-type.enum.d.ts.map +1 -0
  101. package/build/model-page/enums/page-type.enum.js +11 -0
  102. package/build/model-page/enums/robots.enum.d.ts +9 -0
  103. package/build/model-page/enums/robots.enum.d.ts.map +1 -0
  104. package/build/model-page/enums/robots.enum.js +13 -0
  105. package/build/model-page/enums/twitter-card.enum.d.ts +5 -0
  106. package/build/model-page/enums/twitter-card.enum.d.ts.map +1 -0
  107. package/build/model-page/enums/twitter-card.enum.js +8 -0
  108. package/build/model-page/index.d.ts +1 -0
  109. package/build/model-page/index.d.ts.map +1 -1
  110. package/build/model-page/index.js +1 -0
  111. package/build/model-page/models/index.d.ts +4 -0
  112. package/build/model-page/models/index.d.ts.map +1 -1
  113. package/build/model-page/models/index.js +4 -0
  114. package/build/model-page/models/model-family.schema.d.ts +16 -0
  115. package/build/model-page/models/model-family.schema.d.ts.map +1 -0
  116. package/build/model-page/models/model-family.schema.js +16 -0
  117. package/build/model-page/models/page-content.schema.d.ts +37 -0
  118. package/build/model-page/models/page-content.schema.d.ts.map +1 -1
  119. package/build/model-page/models/page-content.schema.js +13 -1
  120. package/build/model-page/models/public-model-detail.schema.d.ts +42 -3
  121. package/build/model-page/models/public-model-detail.schema.d.ts.map +1 -1
  122. package/build/model-page/models/public-model-detail.schema.js +7 -3
  123. package/build/model-page/models/public-page.schema.d.ts +187 -0
  124. package/build/model-page/models/public-page.schema.d.ts.map +1 -0
  125. package/build/model-page/models/public-page.schema.js +16 -0
  126. package/build/model-page/models/schema-toggles.schema.d.ts +22 -0
  127. package/build/model-page/models/schema-toggles.schema.d.ts.map +1 -0
  128. package/build/model-page/models/schema-toggles.schema.js +22 -0
  129. package/build/model-page/models/seo-meta.schema.d.ts +84 -0
  130. package/build/model-page/models/seo-meta.schema.d.ts.map +1 -0
  131. package/build/model-page/models/seo-meta.schema.js +53 -0
  132. package/build/organization/endpoints/index.d.ts +3 -0
  133. package/build/organization/endpoints/index.d.ts.map +1 -0
  134. package/build/organization/endpoints/index.js +18 -0
  135. package/build/organization/endpoints/organization.d.ts +5 -0
  136. package/build/organization/endpoints/organization.d.ts.map +1 -0
  137. package/build/organization/endpoints/organization.js +7 -0
  138. package/build/organization/endpoints/queries/get-organization.query.d.ts +37 -0
  139. package/build/organization/endpoints/queries/get-organization.query.d.ts.map +1 -0
  140. package/build/organization/endpoints/queries/get-organization.query.js +17 -0
  141. package/build/organization/endpoints/queries/index.d.ts +2 -0
  142. package/build/organization/endpoints/queries/index.d.ts.map +1 -0
  143. package/build/organization/endpoints/queries/index.js +17 -0
  144. package/build/organization/index.d.ts +3 -0
  145. package/build/organization/index.d.ts.map +1 -0
  146. package/build/organization/index.js +18 -0
  147. package/build/organization/models/index.d.ts +2 -0
  148. package/build/organization/models/index.d.ts.map +1 -0
  149. package/build/organization/models/index.js +17 -0
  150. package/build/organization/models/organization.schema.d.ts +30 -0
  151. package/build/organization/models/organization.schema.d.ts.map +1 -0
  152. package/build/organization/models/organization.schema.js +20 -0
  153. package/build/scripts/generate-openapi.js +115 -462
  154. package/build/tsconfig.tsbuildinfo +1 -1
  155. package/errors/errors.ts +94 -0
  156. package/index.ts +1 -0
  157. package/model-page/endpoints/model-page.ts +6 -0
  158. package/model-page/endpoints/queries/get-public-page-by-slug.query.ts +28 -0
  159. package/model-page/endpoints/queries/index.ts +1 -0
  160. package/model-page/enums/index.ts +5 -0
  161. package/model-page/enums/page-locale.enum.ts +3 -0
  162. package/model-page/enums/page-status.enum.ts +6 -0
  163. package/model-page/enums/page-type.enum.ts +7 -0
  164. package/model-page/enums/robots.enum.ts +9 -0
  165. package/model-page/enums/twitter-card.enum.ts +4 -0
  166. package/model-page/index.ts +1 -0
  167. package/model-page/models/index.ts +4 -0
  168. package/model-page/models/model-family.schema.ts +18 -0
  169. package/model-page/models/page-content.schema.ts +15 -0
  170. package/model-page/models/public-model-detail.schema.ts +7 -3
  171. package/model-page/models/public-page.schema.ts +17 -0
  172. package/model-page/models/schema-toggles.schema.ts +25 -0
  173. package/model-page/models/seo-meta.schema.ts +64 -0
  174. package/organization/endpoints/index.ts +2 -0
  175. package/organization/endpoints/organization.ts +5 -0
  176. package/organization/endpoints/queries/get-organization.query.ts +16 -0
  177. package/organization/endpoints/queries/index.ts +1 -0
  178. package/organization/index.ts +2 -0
  179. package/organization/models/index.ts +1 -0
  180. package/organization/models/organization.schema.ts +22 -0
  181. package/package.json +1 -1
  182. package/scripts/generate-openapi.ts +195 -496
package/errors/errors.ts CHANGED
@@ -873,6 +873,100 @@ export const ERRORS = {
873
873
  code: 'MODEL_PAGE.PRICE_UNAVAILABLE',
874
874
  message: 'Не удалось рассчитать цены для страницы модели',
875
875
  },
876
+ NOT_FOUND: {
877
+ httpCode: 404,
878
+ code: 'MODEL_PAGE.NOT_FOUND',
879
+ message: 'Страница не найдена',
880
+ },
881
+ FIND_ERROR: {
882
+ httpCode: 500,
883
+ code: 'MODEL_PAGE.FIND_ERROR',
884
+ message: 'Не удалось получить страницы',
885
+ },
886
+ SLUG_ALREADY_EXISTS: {
887
+ httpCode: 409,
888
+ code: 'MODEL_PAGE.SLUG_ALREADY_EXISTS',
889
+ message: 'Страница с таким slug уже существует',
890
+ },
891
+ MODEL_ALREADY_LINKED: {
892
+ httpCode: 409,
893
+ code: 'MODEL_PAGE.MODEL_ALREADY_LINKED',
894
+ message: 'К этой модели уже привязана другая страница',
895
+ },
896
+ CREATE_ERROR: {
897
+ httpCode: 500,
898
+ code: 'MODEL_PAGE.CREATE_ERROR',
899
+ message: 'Не удалось создать страницу',
900
+ },
901
+ UPDATE_ERROR: {
902
+ httpCode: 500,
903
+ code: 'MODEL_PAGE.UPDATE_ERROR',
904
+ message: 'Не удалось обновить страницу',
905
+ },
906
+ DELETE_ERROR: {
907
+ httpCode: 500,
908
+ code: 'MODEL_PAGE.DELETE_ERROR',
909
+ message: 'Не удалось удалить страницу',
910
+ },
911
+ },
912
+ MODEL_FAMILY: {
913
+ NOT_FOUND: {
914
+ httpCode: 404,
915
+ code: 'MODEL_FAMILY.NOT_FOUND',
916
+ message: 'Семейство моделей не найдено',
917
+ },
918
+ FIND_ERROR: {
919
+ httpCode: 500,
920
+ code: 'MODEL_FAMILY.FIND_ERROR',
921
+ message: 'Не удалось получить семейства моделей',
922
+ },
923
+ NAME_ALREADY_EXISTS: {
924
+ httpCode: 409,
925
+ code: 'MODEL_FAMILY.NAME_ALREADY_EXISTS',
926
+ message: 'Семейство моделей с таким названием уже существует',
927
+ },
928
+ HAS_LINKED_PAGES: {
929
+ httpCode: 409,
930
+ code: 'MODEL_FAMILY.HAS_LINKED_PAGES',
931
+ message: 'Нельзя удалить семейство, к которому привязаны страницы',
932
+ },
933
+ CREATE_ERROR: {
934
+ httpCode: 500,
935
+ code: 'MODEL_FAMILY.CREATE_ERROR',
936
+ message: 'Не удалось создать семейство моделей',
937
+ },
938
+ UPDATE_ERROR: {
939
+ httpCode: 500,
940
+ code: 'MODEL_FAMILY.UPDATE_ERROR',
941
+ message: 'Не удалось обновить семейство моделей',
942
+ },
943
+ DELETE_ERROR: {
944
+ httpCode: 500,
945
+ code: 'MODEL_FAMILY.DELETE_ERROR',
946
+ message: 'Не удалось удалить семейство моделей',
947
+ },
948
+ },
949
+ ORGANIZATION: {
950
+ NOT_FOUND: {
951
+ httpCode: 404,
952
+ code: 'ORGANIZATION.NOT_FOUND',
953
+ message: 'Реквизиты организации не заполнены',
954
+ },
955
+ INCOMPLETE_DETAILS: {
956
+ httpCode: 400,
957
+ code: 'ORGANIZATION.INCOMPLETE_DETAILS',
958
+ message: 'Реквизиты организации ещё не заведены: заполните все поля целиком',
959
+ },
960
+ FIND_ERROR: {
961
+ httpCode: 500,
962
+ code: 'ORGANIZATION.FIND_ERROR',
963
+ message: 'Не удалось получить реквизиты организации',
964
+ },
965
+ UPDATE_ERROR: {
966
+ httpCode: 500,
967
+ code: 'ORGANIZATION.UPDATE_ERROR',
968
+ message: 'Не удалось обновить реквизиты организации',
969
+ },
876
970
  },
877
971
  USER_CONTEXT: {
878
972
  FIND_ERROR: {
package/index.ts CHANGED
@@ -20,3 +20,4 @@ export * from './generation-job-chat';
20
20
  export * from './marketplace-card';
21
21
  export * from './support';
22
22
  export * from './user-context';
23
+ export * from './organization';
@@ -4,3 +4,9 @@ export const PUBLIC_MODEL_ROUTES = {
4
4
  LIST: '',
5
5
  GET_BY_SLUG: (slug: string) => `${slug}`,
6
6
  } as const;
7
+
8
+ export const PUBLIC_PAGE_CONTROLLER = 'pages' as const;
9
+
10
+ export const PUBLIC_PAGE_ROUTES = {
11
+ GET_BY_SLUG: (slug: string) => `${slug}`,
12
+ } as const;
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
3
+ import { PublicPageSchema } from '../../models';
4
+ import { PUBLIC_PAGE_ROUTES } from '../model-page';
5
+
6
+ export const GetPublicPageBySlugQueryParams = z.object({
7
+ slug: z.string().min(1),
8
+ });
9
+
10
+ export const GetPublicPageBySlugQueryResponse = PublicPageSchema;
11
+
12
+ export const GetPublicPageBySlugQuery = defineContract({
13
+ method: HTTP_METHODS.GET,
14
+ path: PUBLIC_PAGE_ROUTES.GET_BY_SLUG(':slug'),
15
+ summary: 'Get published static or hub page by slug',
16
+ request: {
17
+ params: GetPublicPageBySlugQueryParams,
18
+ },
19
+ responses: {
20
+ 200: GetPublicPageBySlugQueryResponse,
21
+ 404: HttpErrorResponseSchema,
22
+ 500: HttpErrorResponseSchema,
23
+ 503: HttpErrorResponseSchema,
24
+ },
25
+ });
26
+
27
+ export type GetPublicPageBySlugQueryParamsType = z.infer<typeof GetPublicPageBySlugQueryParams>;
28
+ export type GetPublicPageBySlugQueryResponseType = z.infer<typeof GetPublicPageBySlugQueryResponse>;
@@ -1,2 +1,3 @@
1
1
  export * from './get-public-model-by-slug.query';
2
2
  export * from './list-public-models.query';
3
+ export * from './get-public-page-by-slug.query';
@@ -0,0 +1,5 @@
1
+ export * from './page-status.enum';
2
+ export * from './page-type.enum';
3
+ export * from './page-locale.enum';
4
+ export * from './robots.enum';
5
+ export * from './twitter-card.enum';
@@ -0,0 +1,3 @@
1
+ export enum PAGE_LOCALE {
2
+ RU = 'ru',
3
+ }
@@ -0,0 +1,6 @@
1
+ export enum PAGE_STATUS {
2
+ DRAFT = 'draft',
3
+ REVIEW = 'review',
4
+ PUBLISHED = 'published',
5
+ ARCHIVED = 'archived',
6
+ }
@@ -0,0 +1,7 @@
1
+ export enum PAGE_TYPE {
2
+ MODEL = 'model',
3
+ TOOL = 'tool',
4
+ STATIC = 'static',
5
+ HUB = 'hub',
6
+ ARTICLE = 'article',
7
+ }
@@ -0,0 +1,9 @@
1
+ export enum ROBOTS_INDEX {
2
+ INDEX = 'index',
3
+ NOINDEX = 'noindex',
4
+ }
5
+
6
+ export enum ROBOTS_FOLLOW {
7
+ FOLLOW = 'follow',
8
+ NOFOLLOW = 'nofollow',
9
+ }
@@ -0,0 +1,4 @@
1
+ export enum TWITTER_CARD {
2
+ SUMMARY = 'summary',
3
+ SUMMARY_LARGE_IMAGE = 'summary_large_image',
4
+ }
@@ -1,2 +1,3 @@
1
+ export * from './enums';
1
2
  export * from './models';
2
3
  export * from './endpoints';
@@ -1,4 +1,8 @@
1
1
  export * from './page-card.schema';
2
2
  export * from './page-content.schema';
3
+ export * from './seo-meta.schema';
4
+ export * from './schema-toggles.schema';
5
+ export * from './model-family.schema';
3
6
  export * from './public-model-card.schema';
4
7
  export * from './public-model-detail.schema';
8
+ export * from './public-page.schema';
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { MODEL_CATEGORY } from '../../model-catalog';
3
+
4
+ export const ModelFamilySchema = z.object({
5
+ uuid: z.uuid(),
6
+ name: z.string().min(1),
7
+ developer: z.string().min(1),
8
+ category: z.enum(MODEL_CATEGORY),
9
+ });
10
+
11
+ export const ModelFamilyInputSchema = z.object({
12
+ name: z.string().min(1).max(255),
13
+ developer: z.string().min(1).max(255),
14
+ category: z.enum(MODEL_CATEGORY),
15
+ });
16
+
17
+ export type ModelFamilySchemaType = z.infer<typeof ModelFamilySchema>;
18
+ export type ModelFamilyInputSchemaType = z.infer<typeof ModelFamilyInputSchema>;
@@ -166,6 +166,20 @@ export const PricingWidgetBlockSchema = BlockBaseSchema.extend({
166
166
  ctaSlug: z.string().min(1),
167
167
  });
168
168
 
169
+ export const PricingTableBlockSchema = BlockBaseSchema.extend({
170
+ type: z.literal('pricingTable'),
171
+ rows: z
172
+ .array(
173
+ z.object({
174
+ label: z.string().min(1),
175
+ price: z.string().min(1),
176
+ unit: z.string().min(1),
177
+ note: z.string().min(1).nullable(),
178
+ }),
179
+ )
180
+ .min(1),
181
+ });
182
+
169
183
  export const PageContentBlockSchema = z.discriminatedUnion('type', [
170
184
  RichTextBlockSchema,
171
185
  FeatureListBlockSchema,
@@ -178,6 +192,7 @@ export const PageContentBlockSchema = z.discriminatedUnion('type', [
178
192
  RelatedLinksBlockSchema,
179
193
  DemoBlockSchema,
180
194
  PricingWidgetBlockSchema,
195
+ PricingTableBlockSchema,
181
196
  ]);
182
197
 
183
198
  export const PageContentSchema = z.object({
@@ -1,8 +1,11 @@
1
1
  import { z } from 'zod';
2
2
  import { FILE_TYPE } from '../../file';
3
+ import { ModelFamilySchema } from './model-family.schema';
3
4
  import { PageCardSchema } from './page-card.schema';
4
5
  import { PageContentSchema } from './page-content.schema';
5
6
  import { PublicModelCardSchema } from './public-model-card.schema';
7
+ import { SchemaTogglesSchema } from './schema-toggles.schema';
8
+ import { PublicSeoMetaSchema } from './seo-meta.schema';
6
9
 
7
10
  export const PublicChatModelCapabilitiesSchema = z.object({
8
11
  reasoning: z.boolean(),
@@ -23,10 +26,11 @@ export const PublicGenerationModelDetailsSchema = z.object({
23
26
  });
24
27
 
25
28
  export const PublicModelDetailSchema = PublicModelCardSchema.extend({
26
- h1: z.string().min(1),
27
29
  card: PageCardSchema.nullable(),
28
- seoTitle: z.string().min(1),
29
- seoDescription: z.string().nullable(),
30
+ seo: PublicSeoMetaSchema,
31
+ schemaToggles: SchemaTogglesSchema,
32
+ family: ModelFamilySchema.nullable(),
33
+ versionName: z.string().min(1).nullable(),
30
34
  content: PageContentSchema.nullable(),
31
35
  chat: PublicChatModelDetailsSchema.nullable(),
32
36
  generation: PublicGenerationModelDetailsSchema.nullable(),
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ import { PAGE_TYPE } from '../enums';
3
+ import { PageContentSchema } from './page-content.schema';
4
+ import { SchemaTogglesSchema } from './schema-toggles.schema';
5
+ import { PublicSeoMetaSchema } from './seo-meta.schema';
6
+
7
+ export const PUBLIC_PAGE_TYPES = [PAGE_TYPE.STATIC, PAGE_TYPE.HUB] as const;
8
+
9
+ export const PublicPageSchema = z.object({
10
+ slug: z.string().min(1),
11
+ type: z.enum(PUBLIC_PAGE_TYPES),
12
+ seo: PublicSeoMetaSchema,
13
+ schemaToggles: SchemaTogglesSchema,
14
+ content: PageContentSchema.nullable(),
15
+ });
16
+
17
+ export type PublicPageSchemaType = z.infer<typeof PublicPageSchema>;
@@ -0,0 +1,25 @@
1
+ import { z } from 'zod';
2
+
3
+ export const SchemaTogglesSchema = z.object({
4
+ enableProductSchema: z.boolean(),
5
+ enableFAQSchema: z.boolean(),
6
+ enableBreadcrumbSchema: z.boolean(),
7
+ enableOrganizationSchema: z.boolean(),
8
+ });
9
+
10
+ export const DEFAULT_SCHEMA_TOGGLES = {
11
+ enableProductSchema: false,
12
+ enableFAQSchema: false,
13
+ enableBreadcrumbSchema: false,
14
+ enableOrganizationSchema: false,
15
+ } as const;
16
+
17
+ export const SchemaTogglesInputSchema = z.object({
18
+ enableProductSchema: z.boolean().default(DEFAULT_SCHEMA_TOGGLES.enableProductSchema),
19
+ enableFAQSchema: z.boolean().default(DEFAULT_SCHEMA_TOGGLES.enableFAQSchema),
20
+ enableBreadcrumbSchema: z.boolean().default(DEFAULT_SCHEMA_TOGGLES.enableBreadcrumbSchema),
21
+ enableOrganizationSchema: z.boolean().default(DEFAULT_SCHEMA_TOGGLES.enableOrganizationSchema),
22
+ });
23
+
24
+ export type SchemaTogglesSchemaType = z.infer<typeof SchemaTogglesSchema>;
25
+ export type SchemaTogglesInputSchemaType = z.infer<typeof SchemaTogglesInputSchema>;
@@ -0,0 +1,64 @@
1
+ import { z } from 'zod';
2
+ import { ROBOTS_FOLLOW, ROBOTS_INDEX, TWITTER_CARD } from '../enums';
3
+
4
+ export const CANONICAL_URL_AUTO = 'auto' as const;
5
+
6
+ export const SEO_TITLE_MAX_LENGTH = 70;
7
+ export const SEO_META_DESCRIPTION_MAX_LENGTH = 160;
8
+
9
+ export const HreflangAlternateSchema = z.object({
10
+ locale: z.string().min(1),
11
+ url: z.url(),
12
+ });
13
+
14
+ export const CanonicalUrlSchema = z.union([z.literal(CANONICAL_URL_AUTO), z.url()]);
15
+
16
+ export const SeoMetaSchema = z.object({
17
+ title: z.string().min(1),
18
+ metaDescription: z.string().min(1),
19
+ h1: z.string().min(1),
20
+ focusKeyword: z.string().min(1).nullable(),
21
+ canonicalUrl: CanonicalUrlSchema,
22
+ robotsIndex: z.enum(ROBOTS_INDEX),
23
+ robotsFollow: z.enum(ROBOTS_FOLLOW),
24
+ ogTitle: z.string().min(1).nullable(),
25
+ ogDescription: z.string().min(1).nullable(),
26
+ ogImage: z.string().min(1),
27
+ twitterCard: z.enum(TWITTER_CARD),
28
+ hreflangAlternates: z.array(HreflangAlternateSchema),
29
+ });
30
+
31
+ export const PublicSeoMetaSchema = SeoMetaSchema.extend({
32
+ metaDescription: z.string().min(1).nullable(),
33
+ ogTitle: z.string().min(1),
34
+ ogDescription: z.string().min(1).nullable(),
35
+ ogImage: z.string().min(1).nullable(),
36
+ });
37
+
38
+ export const DraftSeoMetaSchema = SeoMetaSchema.extend({
39
+ title: z.string().min(1).nullable(),
40
+ metaDescription: z.string().min(1).nullable(),
41
+ h1: z.string().min(1).nullable(),
42
+ ogImage: z.string().min(1).nullable(),
43
+ });
44
+
45
+ export const SeoMetaInputSchema = z.object({
46
+ title: z.string().min(1),
47
+ metaDescription: z.string().min(1),
48
+ h1: z.string().min(1),
49
+ focusKeyword: z.string().min(1).nullable().default(null),
50
+ canonicalUrl: CanonicalUrlSchema.default(CANONICAL_URL_AUTO),
51
+ robotsIndex: z.enum(ROBOTS_INDEX).default(ROBOTS_INDEX.INDEX),
52
+ robotsFollow: z.enum(ROBOTS_FOLLOW).default(ROBOTS_FOLLOW.FOLLOW),
53
+ ogTitle: z.string().min(1).nullable().default(null),
54
+ ogDescription: z.string().min(1).nullable().default(null),
55
+ ogImage: z.string().min(1),
56
+ twitterCard: z.enum(TWITTER_CARD).default(TWITTER_CARD.SUMMARY_LARGE_IMAGE),
57
+ hreflangAlternates: z.array(HreflangAlternateSchema).default([]),
58
+ });
59
+
60
+ export type HreflangAlternateSchemaType = z.infer<typeof HreflangAlternateSchema>;
61
+ export type SeoMetaSchemaType = z.infer<typeof SeoMetaSchema>;
62
+ export type PublicSeoMetaSchemaType = z.infer<typeof PublicSeoMetaSchema>;
63
+ export type DraftSeoMetaSchemaType = z.infer<typeof DraftSeoMetaSchema>;
64
+ export type SeoMetaInputSchemaType = z.infer<typeof SeoMetaInputSchema>;
@@ -0,0 +1,2 @@
1
+ export * from './organization';
2
+ export * from './queries';
@@ -0,0 +1,5 @@
1
+ export const ORGANIZATION_CONTROLLER = 'organization' as const;
2
+
3
+ export const ORGANIZATION_ROUTES = {
4
+ GET: '',
5
+ } as const;
@@ -0,0 +1,16 @@
1
+ import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
2
+ import { OrganizationSchema } from '../../models';
3
+ import { ORGANIZATION_ROUTES } from '../organization';
4
+
5
+ export const GetOrganizationQueryResponse = OrganizationSchema;
6
+
7
+ export const GetOrganizationQuery = defineContract({
8
+ method: HTTP_METHODS.GET,
9
+ path: ORGANIZATION_ROUTES.GET,
10
+ summary: 'Get organization details',
11
+ responses: {
12
+ 200: GetOrganizationQueryResponse,
13
+ 404: HttpErrorResponseSchema,
14
+ 500: HttpErrorResponseSchema,
15
+ },
16
+ });
@@ -0,0 +1 @@
1
+ export * from './get-organization.query';
@@ -0,0 +1,2 @@
1
+ export * from './models';
2
+ export * from './endpoints';
@@ -0,0 +1 @@
1
+ export * from './organization.schema';
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+
3
+ export const OrganizationSchema = z.object({
4
+ legalName: z.string().min(1),
5
+ inn: z.string().min(1),
6
+ ogrn: z.string().min(1),
7
+ legalAddress: z.string().min(1),
8
+ phone: z.string().min(1),
9
+ email: z.email(),
10
+ paymentBadges: z.array(z.string().min(1)),
11
+ supportChatUrl: z.url(),
12
+ offerUrl: z.url(),
13
+ privacyUrl: z.url(),
14
+ consentUrl: z.url(),
15
+ });
16
+
17
+ export const OrganizationInputSchema = OrganizationSchema.partial().refine((value) => Object.keys(value).length > 0, {
18
+ message: 'At least one field is required',
19
+ });
20
+
21
+ export type OrganizationSchemaType = z.infer<typeof OrganizationSchema>;
22
+ export type OrganizationInputSchemaType = z.infer<typeof OrganizationInputSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-grator/api",
3
- "version": "0.1.37",
3
+ "version": "0.1.39",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "scripts": {