@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.
- package/admin/endpoints/admin.ts +18 -0
- package/admin/endpoints/commands/create-admin-model-family.command.ts +28 -0
- package/admin/endpoints/commands/create-admin-page.command.ts +56 -0
- package/admin/endpoints/commands/delete-admin-model-family.command.ts +29 -0
- package/admin/endpoints/commands/delete-admin-page.command.ts +28 -0
- package/admin/endpoints/commands/index.ts +8 -0
- package/admin/endpoints/commands/update-admin-model-family.command.ts +38 -0
- package/admin/endpoints/commands/update-admin-organization.command.ts +28 -0
- package/admin/endpoints/commands/update-admin-page-status.command.ts +37 -0
- package/admin/endpoints/commands/update-admin-page.command.ts +55 -0
- package/admin/endpoints/queries/get-admin-model-families.query.ts +22 -0
- package/admin/endpoints/queries/get-admin-organization.query.ts +21 -0
- package/admin/endpoints/queries/get-admin-page.query.ts +29 -0
- package/admin/endpoints/queries/get-admin-pages.query.ts +38 -0
- package/admin/endpoints/queries/index.ts +4 -0
- package/admin/models/admin-page-list-item.schema.ts +19 -0
- package/admin/models/admin-page-response.schema.ts +33 -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 +15 -0
- package/build/admin/endpoints/commands/create-admin-model-family.command.d.ts +41 -0
- package/build/admin/endpoints/commands/create-admin-model-family.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/create-admin-model-family.command.js +24 -0
- package/build/admin/endpoints/commands/create-admin-page.command.d.ts +801 -0
- package/build/admin/endpoints/commands/create-admin-page.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/create-admin-page.command.js +44 -0
- package/build/admin/endpoints/commands/delete-admin-model-family.command.d.ts +27 -0
- package/build/admin/endpoints/commands/delete-admin-model-family.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/delete-admin-model-family.command.js +26 -0
- package/build/admin/endpoints/commands/delete-admin-page.command.d.ts +26 -0
- package/build/admin/endpoints/commands/delete-admin-page.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/delete-admin-page.command.js +25 -0
- package/build/admin/endpoints/commands/index.d.ts +8 -0
- package/build/admin/endpoints/commands/index.d.ts.map +1 -1
- package/build/admin/endpoints/commands/index.js +8 -0
- package/build/admin/endpoints/commands/update-admin-model-family.command.d.ts +49 -0
- package/build/admin/endpoints/commands/update-admin-model-family.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/update-admin-model-family.command.js +30 -0
- package/build/admin/endpoints/commands/update-admin-organization.command.d.ts +71 -0
- package/build/admin/endpoints/commands/update-admin-organization.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/update-admin-organization.command.js +24 -0
- package/build/admin/endpoints/commands/update-admin-page-status.command.d.ts +433 -0
- package/build/admin/endpoints/commands/update-admin-page-status.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/update-admin-page-status.command.js +32 -0
- package/build/admin/endpoints/commands/update-admin-page.command.d.ts +801 -0
- package/build/admin/endpoints/commands/update-admin-page.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/update-admin-page.command.js +50 -0
- package/build/admin/endpoints/queries/get-admin-model-families.query.d.ts +30 -0
- package/build/admin/endpoints/queries/get-admin-model-families.query.d.ts.map +1 -0
- package/build/admin/endpoints/queries/get-admin-model-families.query.js +21 -0
- package/build/admin/endpoints/queries/get-admin-organization.query.d.ts +41 -0
- package/build/admin/endpoints/queries/get-admin-organization.query.d.ts.map +1 -0
- package/build/admin/endpoints/queries/get-admin-organization.query.js +19 -0
- package/build/admin/endpoints/queries/get-admin-page.query.d.ts +424 -0
- package/build/admin/endpoints/queries/get-admin-page.query.d.ts.map +1 -0
- package/build/admin/endpoints/queries/get-admin-page.query.js +26 -0
- package/build/admin/endpoints/queries/get-admin-pages.query.d.ts +74 -0
- package/build/admin/endpoints/queries/get-admin-pages.query.d.ts.map +1 -0
- package/build/admin/endpoints/queries/get-admin-pages.query.js +35 -0
- package/build/admin/endpoints/queries/index.d.ts +4 -0
- package/build/admin/endpoints/queries/index.d.ts.map +1 -1
- package/build/admin/endpoints/queries/index.js +4 -0
- package/build/admin/models/admin-page-list-item.schema.d.ts +18 -0
- package/build/admin/models/admin-page-list-item.schema.d.ts.map +1 -0
- package/build/admin/models/admin-page-list-item.schema.js +19 -0
- package/build/admin/models/admin-page-response.schema.d.ts +204 -0
- package/build/admin/models/admin-page-response.schema.d.ts.map +1 -0
- package/build/admin/models/admin-page-response.schema.js +24 -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 +94 -0
- package/build/errors/errors.d.ts.map +1 -1
- package/build/errors/errors.js +94 -0
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/model-page/endpoints/model-page.d.ts +4 -0
- package/build/model-page/endpoints/model-page.d.ts.map +1 -1
- package/build/model-page/endpoints/model-page.js +5 -1
- package/build/model-page/endpoints/queries/get-public-model-by-slug.query.d.ts +84 -6
- package/build/model-page/endpoints/queries/get-public-model-by-slug.query.d.ts.map +1 -1
- package/build/model-page/endpoints/queries/get-public-page-by-slug.query.d.ts +387 -0
- package/build/model-page/endpoints/queries/get-public-page-by-slug.query.d.ts.map +1 -0
- package/build/model-page/endpoints/queries/get-public-page-by-slug.query.js +25 -0
- package/build/model-page/endpoints/queries/index.d.ts +1 -0
- package/build/model-page/endpoints/queries/index.d.ts.map +1 -1
- package/build/model-page/endpoints/queries/index.js +1 -0
- package/build/model-page/enums/index.d.ts +6 -0
- package/build/model-page/enums/index.d.ts.map +1 -0
- package/build/model-page/enums/index.js +21 -0
- package/build/model-page/enums/page-locale.enum.d.ts +4 -0
- package/build/model-page/enums/page-locale.enum.d.ts.map +1 -0
- package/build/model-page/enums/page-locale.enum.js +7 -0
- package/build/model-page/enums/page-status.enum.d.ts +7 -0
- package/build/model-page/enums/page-status.enum.d.ts.map +1 -0
- package/build/model-page/enums/page-status.enum.js +10 -0
- package/build/model-page/enums/page-type.enum.d.ts +8 -0
- package/build/model-page/enums/page-type.enum.d.ts.map +1 -0
- package/build/model-page/enums/page-type.enum.js +11 -0
- package/build/model-page/enums/robots.enum.d.ts +9 -0
- package/build/model-page/enums/robots.enum.d.ts.map +1 -0
- package/build/model-page/enums/robots.enum.js +13 -0
- package/build/model-page/enums/twitter-card.enum.d.ts +5 -0
- package/build/model-page/enums/twitter-card.enum.d.ts.map +1 -0
- package/build/model-page/enums/twitter-card.enum.js +8 -0
- package/build/model-page/index.d.ts +1 -0
- package/build/model-page/index.d.ts.map +1 -1
- package/build/model-page/index.js +1 -0
- package/build/model-page/models/index.d.ts +4 -0
- package/build/model-page/models/index.d.ts.map +1 -1
- package/build/model-page/models/index.js +4 -0
- package/build/model-page/models/model-family.schema.d.ts +16 -0
- package/build/model-page/models/model-family.schema.d.ts.map +1 -0
- package/build/model-page/models/model-family.schema.js +16 -0
- package/build/model-page/models/page-content.schema.d.ts +37 -0
- package/build/model-page/models/page-content.schema.d.ts.map +1 -1
- package/build/model-page/models/page-content.schema.js +13 -1
- package/build/model-page/models/public-model-detail.schema.d.ts +42 -3
- package/build/model-page/models/public-model-detail.schema.d.ts.map +1 -1
- package/build/model-page/models/public-model-detail.schema.js +7 -3
- package/build/model-page/models/public-page.schema.d.ts +187 -0
- package/build/model-page/models/public-page.schema.d.ts.map +1 -0
- package/build/model-page/models/public-page.schema.js +16 -0
- package/build/model-page/models/schema-toggles.schema.d.ts +22 -0
- package/build/model-page/models/schema-toggles.schema.d.ts.map +1 -0
- package/build/model-page/models/schema-toggles.schema.js +22 -0
- package/build/model-page/models/seo-meta.schema.d.ts +84 -0
- package/build/model-page/models/seo-meta.schema.d.ts.map +1 -0
- package/build/model-page/models/seo-meta.schema.js +53 -0
- package/build/organization/endpoints/index.d.ts +3 -0
- package/build/organization/endpoints/index.d.ts.map +1 -0
- package/build/organization/endpoints/index.js +18 -0
- package/build/organization/endpoints/organization.d.ts +5 -0
- package/build/organization/endpoints/organization.d.ts.map +1 -0
- package/build/organization/endpoints/organization.js +7 -0
- package/build/organization/endpoints/queries/get-organization.query.d.ts +37 -0
- package/build/organization/endpoints/queries/get-organization.query.d.ts.map +1 -0
- package/build/organization/endpoints/queries/get-organization.query.js +17 -0
- package/build/organization/endpoints/queries/index.d.ts +2 -0
- package/build/organization/endpoints/queries/index.d.ts.map +1 -0
- package/build/organization/endpoints/queries/index.js +17 -0
- package/build/organization/index.d.ts +3 -0
- package/build/organization/index.d.ts.map +1 -0
- package/build/organization/index.js +18 -0
- package/build/organization/models/index.d.ts +2 -0
- package/build/organization/models/index.d.ts.map +1 -0
- package/build/organization/models/index.js +17 -0
- package/build/organization/models/organization.schema.d.ts +30 -0
- package/build/organization/models/organization.schema.d.ts.map +1 -0
- package/build/organization/models/organization.schema.js +20 -0
- package/build/scripts/generate-openapi.js +115 -462
- package/build/tsconfig.tsbuildinfo +1 -1
- package/errors/errors.ts +94 -0
- package/index.ts +1 -0
- package/model-page/endpoints/model-page.ts +6 -0
- package/model-page/endpoints/queries/get-public-page-by-slug.query.ts +28 -0
- package/model-page/endpoints/queries/index.ts +1 -0
- package/model-page/enums/index.ts +5 -0
- package/model-page/enums/page-locale.enum.ts +3 -0
- package/model-page/enums/page-status.enum.ts +6 -0
- package/model-page/enums/page-type.enum.ts +7 -0
- package/model-page/enums/robots.enum.ts +9 -0
- package/model-page/enums/twitter-card.enum.ts +4 -0
- package/model-page/index.ts +1 -0
- package/model-page/models/index.ts +4 -0
- package/model-page/models/model-family.schema.ts +18 -0
- package/model-page/models/page-content.schema.ts +15 -0
- package/model-page/models/public-model-detail.schema.ts +7 -3
- package/model-page/models/public-page.schema.ts +17 -0
- package/model-page/models/schema-toggles.schema.ts +25 -0
- package/model-page/models/seo-meta.schema.ts +64 -0
- package/organization/endpoints/index.ts +2 -0
- package/organization/endpoints/organization.ts +5 -0
- package/organization/endpoints/queries/get-organization.query.ts +16 -0
- package/organization/endpoints/queries/index.ts +1 -0
- package/organization/index.ts +2 -0
- package/organization/models/index.ts +1 -0
- package/organization/models/organization.schema.ts +22 -0
- package/package.json +1 -1
- 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
|
@@ -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>;
|
package/model-page/index.ts
CHANGED
|
@@ -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
|
-
|
|
29
|
-
|
|
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,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 @@
|
|
|
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>;
|