@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
@@ -29,4 +29,22 @@ export const ADMIN_ROUTES = {
29
29
  GET_SUPPORT_CHAT_MESSAGES: (userId: string) => `support/chats/${userId}/messages`,
30
30
  SEND_SUPPORT_REPLY: (userId: string) => `support/chats/${userId}/messages`,
31
31
  MARK_SUPPORT_CHAT_READ: (userId: string) => `support/chats/${userId}/read`,
32
+
33
+ // CONTENT PAGES
34
+ GET_PAGES: 'pages',
35
+ CREATE_PAGE: 'pages',
36
+ GET_PAGE: (pageId: string) => `pages/${pageId}`,
37
+ UPDATE_PAGE: (pageId: string) => `pages/${pageId}`,
38
+ DELETE_PAGE: (pageId: string) => `pages/${pageId}`,
39
+ UPDATE_PAGE_STATUS: (pageId: string) => `pages/${pageId}/status`,
40
+
41
+ // MODEL FAMILIES
42
+ GET_MODEL_FAMILIES: 'model-families',
43
+ CREATE_MODEL_FAMILY: 'model-families',
44
+ UPDATE_MODEL_FAMILY: (familyId: string) => `model-families/${familyId}`,
45
+ DELETE_MODEL_FAMILY: (familyId: string) => `model-families/${familyId}`,
46
+
47
+ // ORGANIZATION
48
+ GET_ORGANIZATION: 'organization',
49
+ UPDATE_ORGANIZATION: 'organization',
32
50
  } as const;
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
3
+ import { ModelFamilyInputSchema, ModelFamilySchema } from '../../../model-page';
4
+ import { ADMIN_ROUTES } from '../admin';
5
+
6
+ export const CreateAdminModelFamilyCommandBody = ModelFamilyInputSchema;
7
+
8
+ export const CreateAdminModelFamilyCommandResponse = ModelFamilySchema;
9
+
10
+ export const CreateAdminModelFamilyCommand = defineContract({
11
+ method: HTTP_METHODS.POST,
12
+ path: ADMIN_ROUTES.CREATE_MODEL_FAMILY,
13
+ summary: 'Create model family',
14
+ request: {
15
+ body: CreateAdminModelFamilyCommandBody,
16
+ },
17
+ responses: {
18
+ 201: CreateAdminModelFamilyCommandResponse,
19
+ 400: HttpErrorResponseSchema,
20
+ 401: HttpErrorResponseSchema,
21
+ 403: HttpErrorResponseSchema,
22
+ 409: HttpErrorResponseSchema,
23
+ 500: HttpErrorResponseSchema,
24
+ },
25
+ });
26
+
27
+ export type CreateAdminModelFamilyCommandBodyType = z.infer<typeof CreateAdminModelFamilyCommandBody>;
28
+ export type CreateAdminModelFamilyCommandResponseType = z.infer<typeof CreateAdminModelFamilyCommandResponse>;
@@ -0,0 +1,56 @@
1
+ import { z } from 'zod';
2
+ import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
3
+ import {
4
+ PageCardSchema,
5
+ PageContentSchema,
6
+ PAGE_LOCALE,
7
+ PAGE_STATUS,
8
+ PAGE_TYPE,
9
+ DEFAULT_SCHEMA_TOGGLES,
10
+ SchemaTogglesInputSchema,
11
+ SeoMetaInputSchema,
12
+ } from '../../../model-page';
13
+ import { AdminPageResponseSchema } from '../../models';
14
+ import { ADMIN_ROUTES } from '../admin';
15
+
16
+ export const CreateAdminPageCommandBody = z.object({
17
+ type: z.enum(PAGE_TYPE),
18
+ slug: z
19
+ .string()
20
+ .min(1)
21
+ .max(255)
22
+ .regex(/^[a-z0-9]+(?:-[a-z0-9.]+)*$/),
23
+ locale: z.enum(PAGE_LOCALE).default(PAGE_LOCALE.RU),
24
+ status: z.enum(PAGE_STATUS).default(PAGE_STATUS.DRAFT),
25
+ seo: SeoMetaInputSchema,
26
+ schemaToggles: SchemaTogglesInputSchema.default(DEFAULT_SCHEMA_TOGGLES),
27
+ card: PageCardSchema.nullable().default(null),
28
+ content: PageContentSchema.nullable().default(null),
29
+ familyId: z.uuid().nullable().default(null),
30
+ versionName: z.string().min(1).max(255).nullable().default(null),
31
+ aiModelId: z.uuid().nullable().default(null),
32
+ generationModelId: z.uuid().nullable().default(null),
33
+ });
34
+
35
+ export const CreateAdminPageCommandResponse = AdminPageResponseSchema;
36
+
37
+ export const CreateAdminPageCommand = defineContract({
38
+ method: HTTP_METHODS.POST,
39
+ path: ADMIN_ROUTES.CREATE_PAGE,
40
+ summary: 'Create content page',
41
+ request: {
42
+ body: CreateAdminPageCommandBody,
43
+ },
44
+ responses: {
45
+ 201: CreateAdminPageCommandResponse,
46
+ 400: HttpErrorResponseSchema,
47
+ 401: HttpErrorResponseSchema,
48
+ 403: HttpErrorResponseSchema,
49
+ 404: HttpErrorResponseSchema,
50
+ 409: HttpErrorResponseSchema,
51
+ 500: HttpErrorResponseSchema,
52
+ },
53
+ });
54
+
55
+ export type CreateAdminPageCommandBodyType = z.infer<typeof CreateAdminPageCommandBody>;
56
+ export type CreateAdminPageCommandResponseType = z.infer<typeof CreateAdminPageCommandResponse>;
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ import { defineContract, HTTP_METHODS, HttpErrorResponseSchema, HttpSuccessResponseSchema } from '../../../_common';
3
+ import { ADMIN_ROUTES } from '../admin';
4
+
5
+ export const DeleteAdminModelFamilyCommandParams = z.object({
6
+ familyId: z.uuid(),
7
+ });
8
+
9
+ export const DeleteAdminModelFamilyCommandResponse = HttpSuccessResponseSchema;
10
+
11
+ export const DeleteAdminModelFamilyCommand = defineContract({
12
+ method: HTTP_METHODS.DELETE,
13
+ path: ADMIN_ROUTES.DELETE_MODEL_FAMILY(':familyId'),
14
+ summary: 'Delete model family',
15
+ request: {
16
+ params: DeleteAdminModelFamilyCommandParams,
17
+ },
18
+ responses: {
19
+ 200: DeleteAdminModelFamilyCommandResponse,
20
+ 401: HttpErrorResponseSchema,
21
+ 403: HttpErrorResponseSchema,
22
+ 404: HttpErrorResponseSchema,
23
+ 409: HttpErrorResponseSchema,
24
+ 500: HttpErrorResponseSchema,
25
+ },
26
+ });
27
+
28
+ export type DeleteAdminModelFamilyCommandParamsType = z.infer<typeof DeleteAdminModelFamilyCommandParams>;
29
+ export type DeleteAdminModelFamilyCommandResponseType = z.infer<typeof DeleteAdminModelFamilyCommandResponse>;
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ import { defineContract, HTTP_METHODS, HttpErrorResponseSchema, HttpSuccessResponseSchema } from '../../../_common';
3
+ import { ADMIN_ROUTES } from '../admin';
4
+
5
+ export const DeleteAdminPageCommandParams = z.object({
6
+ pageId: z.uuid(),
7
+ });
8
+
9
+ export const DeleteAdminPageCommandResponse = HttpSuccessResponseSchema;
10
+
11
+ export const DeleteAdminPageCommand = defineContract({
12
+ method: HTTP_METHODS.DELETE,
13
+ path: ADMIN_ROUTES.DELETE_PAGE(':pageId'),
14
+ summary: 'Delete content page',
15
+ request: {
16
+ params: DeleteAdminPageCommandParams,
17
+ },
18
+ responses: {
19
+ 200: DeleteAdminPageCommandResponse,
20
+ 401: HttpErrorResponseSchema,
21
+ 403: HttpErrorResponseSchema,
22
+ 404: HttpErrorResponseSchema,
23
+ 500: HttpErrorResponseSchema,
24
+ },
25
+ });
26
+
27
+ export type DeleteAdminPageCommandParamsType = z.infer<typeof DeleteAdminPageCommandParams>;
28
+ export type DeleteAdminPageCommandResponseType = z.infer<typeof DeleteAdminPageCommandResponse>;
@@ -4,3 +4,11 @@ export * from './update-admin-partner-referral-config.command';
4
4
  export * from './update-admin-referral-config.command';
5
5
  export * from './send-admin-support-reply.command';
6
6
  export * from './mark-admin-support-chat-read.command';
7
+ export * from './create-admin-page.command';
8
+ export * from './update-admin-page.command';
9
+ export * from './update-admin-page-status.command';
10
+ export * from './delete-admin-page.command';
11
+ export * from './create-admin-model-family.command';
12
+ export * from './update-admin-model-family.command';
13
+ export * from './delete-admin-model-family.command';
14
+ export * from './update-admin-organization.command';
@@ -0,0 +1,38 @@
1
+ import { z } from 'zod';
2
+ import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
3
+ import { ModelFamilyInputSchema, ModelFamilySchema } from '../../../model-page';
4
+ import { ADMIN_ROUTES } from '../admin';
5
+
6
+ export const UpdateAdminModelFamilyCommandParams = z.object({
7
+ familyId: z.uuid(),
8
+ });
9
+
10
+ export const UpdateAdminModelFamilyCommandBody = ModelFamilyInputSchema.partial().refine(
11
+ (value) => Object.keys(value).length > 0,
12
+ { message: 'At least one field is required' },
13
+ );
14
+
15
+ export const UpdateAdminModelFamilyCommandResponse = ModelFamilySchema;
16
+
17
+ export const UpdateAdminModelFamilyCommand = defineContract({
18
+ method: HTTP_METHODS.PATCH,
19
+ path: ADMIN_ROUTES.UPDATE_MODEL_FAMILY(':familyId'),
20
+ summary: 'Update model family',
21
+ request: {
22
+ params: UpdateAdminModelFamilyCommandParams,
23
+ body: UpdateAdminModelFamilyCommandBody,
24
+ },
25
+ responses: {
26
+ 200: UpdateAdminModelFamilyCommandResponse,
27
+ 400: HttpErrorResponseSchema,
28
+ 401: HttpErrorResponseSchema,
29
+ 403: HttpErrorResponseSchema,
30
+ 404: HttpErrorResponseSchema,
31
+ 409: HttpErrorResponseSchema,
32
+ 500: HttpErrorResponseSchema,
33
+ },
34
+ });
35
+
36
+ export type UpdateAdminModelFamilyCommandParamsType = z.infer<typeof UpdateAdminModelFamilyCommandParams>;
37
+ export type UpdateAdminModelFamilyCommandBodyType = z.infer<typeof UpdateAdminModelFamilyCommandBody>;
38
+ export type UpdateAdminModelFamilyCommandResponseType = z.infer<typeof UpdateAdminModelFamilyCommandResponse>;
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
3
+ import { OrganizationInputSchema, OrganizationSchema } from '../../../organization';
4
+ import { ADMIN_ROUTES } from '../admin';
5
+
6
+ export const UpdateAdminOrganizationCommandBody = OrganizationInputSchema;
7
+
8
+ export const UpdateAdminOrganizationCommandResponse = OrganizationSchema;
9
+
10
+ export const UpdateAdminOrganizationCommand = defineContract({
11
+ method: HTTP_METHODS.PATCH,
12
+ path: ADMIN_ROUTES.UPDATE_ORGANIZATION,
13
+ summary: 'Update organization details',
14
+ request: {
15
+ body: UpdateAdminOrganizationCommandBody,
16
+ },
17
+ responses: {
18
+ 200: UpdateAdminOrganizationCommandResponse,
19
+ 400: HttpErrorResponseSchema,
20
+ 404: HttpErrorResponseSchema,
21
+ 401: HttpErrorResponseSchema,
22
+ 403: HttpErrorResponseSchema,
23
+ 500: HttpErrorResponseSchema,
24
+ },
25
+ });
26
+
27
+ export type UpdateAdminOrganizationCommandBodyType = z.infer<typeof UpdateAdminOrganizationCommandBody>;
28
+ export type UpdateAdminOrganizationCommandResponseType = z.infer<typeof UpdateAdminOrganizationCommandResponse>;
@@ -0,0 +1,37 @@
1
+ import { z } from 'zod';
2
+ import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
3
+ import { PAGE_STATUS } from '../../../model-page';
4
+ import { AdminPageResponseSchema } from '../../models';
5
+ import { ADMIN_ROUTES } from '../admin';
6
+
7
+ export const UpdateAdminPageStatusCommandParams = z.object({
8
+ pageId: z.uuid(),
9
+ });
10
+
11
+ export const UpdateAdminPageStatusCommandBody = z.object({
12
+ status: z.enum(PAGE_STATUS),
13
+ });
14
+
15
+ export const UpdateAdminPageStatusCommandResponse = AdminPageResponseSchema;
16
+
17
+ export const UpdateAdminPageStatusCommand = defineContract({
18
+ method: HTTP_METHODS.PATCH,
19
+ path: ADMIN_ROUTES.UPDATE_PAGE_STATUS(':pageId'),
20
+ summary: 'Change content page status',
21
+ request: {
22
+ params: UpdateAdminPageStatusCommandParams,
23
+ body: UpdateAdminPageStatusCommandBody,
24
+ },
25
+ responses: {
26
+ 200: UpdateAdminPageStatusCommandResponse,
27
+ 400: HttpErrorResponseSchema,
28
+ 401: HttpErrorResponseSchema,
29
+ 403: HttpErrorResponseSchema,
30
+ 404: HttpErrorResponseSchema,
31
+ 500: HttpErrorResponseSchema,
32
+ },
33
+ });
34
+
35
+ export type UpdateAdminPageStatusCommandParamsType = z.infer<typeof UpdateAdminPageStatusCommandParams>;
36
+ export type UpdateAdminPageStatusCommandBodyType = z.infer<typeof UpdateAdminPageStatusCommandBody>;
37
+ export type UpdateAdminPageStatusCommandResponseType = z.infer<typeof UpdateAdminPageStatusCommandResponse>;
@@ -0,0 +1,55 @@
1
+ import { z } from 'zod';
2
+ import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
3
+ import { PageCardSchema, PageContentSchema, SchemaTogglesSchema, SeoMetaSchema } from '../../../model-page';
4
+ import { AdminPageResponseSchema } from '../../models';
5
+ import { ADMIN_ROUTES } from '../admin';
6
+
7
+ export const UpdateAdminPageCommandParams = z.object({
8
+ pageId: z.uuid(),
9
+ });
10
+
11
+ export const UpdateAdminPageCommandBody = z
12
+ .object({
13
+ slug: z
14
+ .string()
15
+ .min(1)
16
+ .max(255)
17
+ .regex(/^[a-z0-9]+(?:-[a-z0-9.]+)*$/)
18
+ .optional(),
19
+ seo: SeoMetaSchema.optional(),
20
+ schemaToggles: SchemaTogglesSchema.optional(),
21
+ card: PageCardSchema.nullable().optional(),
22
+ content: PageContentSchema.nullable().optional(),
23
+ familyId: z.uuid().nullable().optional(),
24
+ versionName: z.string().min(1).max(255).nullable().optional(),
25
+ aiModelId: z.uuid().nullable().optional(),
26
+ generationModelId: z.uuid().nullable().optional(),
27
+ })
28
+ .refine((value) => Object.keys(value).length > 0, {
29
+ message: 'At least one field is required',
30
+ });
31
+
32
+ export const UpdateAdminPageCommandResponse = AdminPageResponseSchema;
33
+
34
+ export const UpdateAdminPageCommand = defineContract({
35
+ method: HTTP_METHODS.PATCH,
36
+ path: ADMIN_ROUTES.UPDATE_PAGE(':pageId'),
37
+ summary: 'Update content page',
38
+ request: {
39
+ params: UpdateAdminPageCommandParams,
40
+ body: UpdateAdminPageCommandBody,
41
+ },
42
+ responses: {
43
+ 200: UpdateAdminPageCommandResponse,
44
+ 400: HttpErrorResponseSchema,
45
+ 401: HttpErrorResponseSchema,
46
+ 403: HttpErrorResponseSchema,
47
+ 404: HttpErrorResponseSchema,
48
+ 409: HttpErrorResponseSchema,
49
+ 500: HttpErrorResponseSchema,
50
+ },
51
+ });
52
+
53
+ export type UpdateAdminPageCommandParamsType = z.infer<typeof UpdateAdminPageCommandParams>;
54
+ export type UpdateAdminPageCommandBodyType = z.infer<typeof UpdateAdminPageCommandBody>;
55
+ export type UpdateAdminPageCommandResponseType = z.infer<typeof UpdateAdminPageCommandResponse>;
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+ import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
3
+ import { ModelFamilySchema } from '../../../model-page';
4
+ import { ADMIN_ROUTES } from '../admin';
5
+
6
+ export const GetAdminModelFamiliesQueryResponse = z.object({
7
+ families: z.array(ModelFamilySchema),
8
+ });
9
+
10
+ export const GetAdminModelFamiliesQuery = defineContract({
11
+ method: HTTP_METHODS.GET,
12
+ path: ADMIN_ROUTES.GET_MODEL_FAMILIES,
13
+ summary: 'Get model families list',
14
+ responses: {
15
+ 200: GetAdminModelFamiliesQueryResponse,
16
+ 401: HttpErrorResponseSchema,
17
+ 403: HttpErrorResponseSchema,
18
+ 500: HttpErrorResponseSchema,
19
+ },
20
+ });
21
+
22
+ export type GetAdminModelFamiliesQueryResponseType = z.infer<typeof GetAdminModelFamiliesQueryResponse>;
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
3
+ import { OrganizationSchema } from '../../../organization';
4
+ import { ADMIN_ROUTES } from '../admin';
5
+
6
+ export const GetAdminOrganizationQueryResponse = OrganizationSchema;
7
+
8
+ export const GetAdminOrganizationQuery = defineContract({
9
+ method: HTTP_METHODS.GET,
10
+ path: ADMIN_ROUTES.GET_ORGANIZATION,
11
+ summary: 'Get organization details',
12
+ responses: {
13
+ 200: GetAdminOrganizationQueryResponse,
14
+ 401: HttpErrorResponseSchema,
15
+ 403: HttpErrorResponseSchema,
16
+ 404: HttpErrorResponseSchema,
17
+ 500: HttpErrorResponseSchema,
18
+ },
19
+ });
20
+
21
+ export type GetAdminOrganizationQueryResponseType = z.infer<typeof GetAdminOrganizationQueryResponse>;
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
3
+ import { AdminPageResponseSchema } from '../../models';
4
+ import { ADMIN_ROUTES } from '../admin';
5
+
6
+ export const GetAdminPageQueryParams = z.object({
7
+ pageId: z.uuid(),
8
+ });
9
+
10
+ export const GetAdminPageQueryResponse = AdminPageResponseSchema;
11
+
12
+ export const GetAdminPageQuery = defineContract({
13
+ method: HTTP_METHODS.GET,
14
+ path: ADMIN_ROUTES.GET_PAGE(':pageId'),
15
+ summary: 'Get content page by id',
16
+ request: {
17
+ params: GetAdminPageQueryParams,
18
+ },
19
+ responses: {
20
+ 200: GetAdminPageQueryResponse,
21
+ 401: HttpErrorResponseSchema,
22
+ 403: HttpErrorResponseSchema,
23
+ 404: HttpErrorResponseSchema,
24
+ 500: HttpErrorResponseSchema,
25
+ },
26
+ });
27
+
28
+ export type GetAdminPageQueryParamsType = z.infer<typeof GetAdminPageQueryParams>;
29
+ export type GetAdminPageQueryResponseType = z.infer<typeof GetAdminPageQueryResponse>;
@@ -0,0 +1,38 @@
1
+ import { z } from 'zod';
2
+ import { defineContract, defineOffsetPaginationQuery, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
3
+ import { PAGE_LOCALE, PAGE_STATUS, PAGE_TYPE } from '../../../model-page';
4
+ import { AdminPageListItemSchema } from '../../models';
5
+ import { ADMIN_ROUTES } from '../admin';
6
+
7
+ export const GetAdminPagesQueryQuery = defineOffsetPaginationQuery().extend({
8
+ search: z.string().trim().max(255).optional(),
9
+ type: z.enum(PAGE_TYPE).optional(),
10
+ status: z.enum(PAGE_STATUS).optional(),
11
+ locale: z.enum(PAGE_LOCALE).optional(),
12
+ familyId: z.uuid().optional(),
13
+ });
14
+
15
+ export const GetAdminPagesQueryResponse = z.object({
16
+ pages: z.array(AdminPageListItemSchema),
17
+ total: z.number().int().nonnegative(),
18
+ page: z.number().int().positive(),
19
+ limit: z.number().int().positive(),
20
+ });
21
+
22
+ export const GetAdminPagesQuery = defineContract({
23
+ method: HTTP_METHODS.GET,
24
+ path: ADMIN_ROUTES.GET_PAGES,
25
+ summary: 'Get content pages list with pagination and filters',
26
+ request: {
27
+ query: GetAdminPagesQueryQuery,
28
+ },
29
+ responses: {
30
+ 200: GetAdminPagesQueryResponse,
31
+ 401: HttpErrorResponseSchema,
32
+ 403: HttpErrorResponseSchema,
33
+ 500: HttpErrorResponseSchema,
34
+ },
35
+ });
36
+
37
+ export type GetAdminPagesQueryQueryType = z.infer<typeof GetAdminPagesQueryQuery>;
38
+ export type GetAdminPagesQueryResponseType = z.infer<typeof GetAdminPagesQueryResponse>;
@@ -11,3 +11,7 @@ export * from './get-admin-referral-config.query';
11
11
  export * from './get-admin-users.query';
12
12
  export * from './get-admin-support-chats.query';
13
13
  export * from './get-admin-support-chat-messages.query';
14
+ export * from './get-admin-pages.query';
15
+ export * from './get-admin-page.query';
16
+ export * from './get-admin-model-families.query';
17
+ export * from './get-admin-organization.query';
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import { PAGE_LOCALE, PAGE_STATUS, PAGE_TYPE } from '../../model-page';
3
+
4
+ export const AdminPageListItemSchema = z.object({
5
+ uuid: z.uuid(),
6
+ type: z.enum(PAGE_TYPE),
7
+ slug: z.string().min(1),
8
+ locale: z.enum(PAGE_LOCALE),
9
+ status: z.enum(PAGE_STATUS),
10
+ title: z.string().min(1).nullable(),
11
+ versionName: z.string().min(1).nullable(),
12
+ familyId: z.uuid().nullable(),
13
+ familyName: z.string().min(1).nullable(),
14
+ publishedAt: z.iso.datetime().nullable(),
15
+ updatedAt: z.iso.datetime(),
16
+ authorId: z.uuid().nullable(),
17
+ });
18
+
19
+ export type AdminPageListItemSchemaType = z.infer<typeof AdminPageListItemSchema>;
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ import {
3
+ DraftSeoMetaSchema,
4
+ ModelFamilySchema,
5
+ PageCardSchema,
6
+ PageContentSchema,
7
+ PAGE_LOCALE,
8
+ PAGE_STATUS,
9
+ PAGE_TYPE,
10
+ SchemaTogglesSchema,
11
+ } from '../../model-page';
12
+
13
+ export const AdminPageResponseSchema = z.object({
14
+ uuid: z.uuid(),
15
+ type: z.enum(PAGE_TYPE),
16
+ slug: z.string().min(1),
17
+ locale: z.enum(PAGE_LOCALE),
18
+ status: z.enum(PAGE_STATUS),
19
+ seo: DraftSeoMetaSchema,
20
+ schemaToggles: SchemaTogglesSchema,
21
+ card: PageCardSchema.nullable(),
22
+ content: PageContentSchema.nullable(),
23
+ family: ModelFamilySchema.nullable(),
24
+ versionName: z.string().min(1).nullable(),
25
+ aiModelId: z.uuid().nullable(),
26
+ generationModelId: z.uuid().nullable(),
27
+ publishedAt: z.iso.datetime().nullable(),
28
+ createdAt: z.iso.datetime(),
29
+ updatedAt: z.iso.datetime(),
30
+ authorId: z.uuid().nullable(),
31
+ });
32
+
33
+ export type AdminPageResponseSchemaType = z.infer<typeof AdminPageResponseSchema>;
@@ -11,3 +11,5 @@ export * from './admin-user-list-item.schema';
11
11
  export * from './admin-user-details-response.schema';
12
12
  export * from './admin-kie-balance-response.schema';
13
13
  export * from './admin-support-chat-list-item.schema';
14
+ export * from './admin-page-list-item.schema';
15
+ export * from './admin-page-response.schema';
@@ -19,5 +19,17 @@ export declare const ADMIN_ROUTES: {
19
19
  readonly GET_SUPPORT_CHAT_MESSAGES: (userId: string) => string;
20
20
  readonly SEND_SUPPORT_REPLY: (userId: string) => string;
21
21
  readonly MARK_SUPPORT_CHAT_READ: (userId: string) => string;
22
+ readonly GET_PAGES: "pages";
23
+ readonly CREATE_PAGE: "pages";
24
+ readonly GET_PAGE: (pageId: string) => string;
25
+ readonly UPDATE_PAGE: (pageId: string) => string;
26
+ readonly DELETE_PAGE: (pageId: string) => string;
27
+ readonly UPDATE_PAGE_STATUS: (pageId: string) => string;
28
+ readonly GET_MODEL_FAMILIES: "model-families";
29
+ readonly CREATE_MODEL_FAMILY: "model-families";
30
+ readonly UPDATE_MODEL_FAMILY: (familyId: string) => string;
31
+ readonly DELETE_MODEL_FAMILY: (familyId: string) => string;
32
+ readonly GET_ORGANIZATION: "organization";
33
+ readonly UPDATE_ORGANIZATION: "organization";
22
34
  };
23
35
  //# sourceMappingURL=admin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../../admin/endpoints/admin.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,EAAG,OAAgB,CAAC;AAEjD,eAAO,MAAM,YAAY;;sCAGI,MAAM;gDACI,MAAM;iDACL,MAAM;sDACD,MAAM;yDACH,MAAM;uDACR,MAAM;yDACJ,MAAM;;;;;gCAW/B,MAAM;6CACO,MAAM;gCACnB,MAAM;;iDAIW,MAAM;0CACb,MAAM;8CACF,MAAM;CACjC,CAAC"}
1
+ {"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../../admin/endpoints/admin.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,EAAG,OAAgB,CAAC;AAEjD,eAAO,MAAM,YAAY;;sCAGI,MAAM;gDACI,MAAM;iDACL,MAAM;sDACD,MAAM;yDACH,MAAM;uDACR,MAAM;yDACJ,MAAM;;;;;gCAW/B,MAAM;6CACO,MAAM;gCACnB,MAAM;;iDAIW,MAAM;0CACb,MAAM;8CACF,MAAM;;;gCAKpB,MAAM;mCACH,MAAM;mCACN,MAAM;0CACC,MAAM;;;6CAKH,MAAM;6CACN,MAAM;;;CAKhC,CAAC"}
@@ -27,4 +27,19 @@ exports.ADMIN_ROUTES = {
27
27
  GET_SUPPORT_CHAT_MESSAGES: (userId) => `support/chats/${userId}/messages`,
28
28
  SEND_SUPPORT_REPLY: (userId) => `support/chats/${userId}/messages`,
29
29
  MARK_SUPPORT_CHAT_READ: (userId) => `support/chats/${userId}/read`,
30
+ // CONTENT PAGES
31
+ GET_PAGES: 'pages',
32
+ CREATE_PAGE: 'pages',
33
+ GET_PAGE: (pageId) => `pages/${pageId}`,
34
+ UPDATE_PAGE: (pageId) => `pages/${pageId}`,
35
+ DELETE_PAGE: (pageId) => `pages/${pageId}`,
36
+ UPDATE_PAGE_STATUS: (pageId) => `pages/${pageId}/status`,
37
+ // MODEL FAMILIES
38
+ GET_MODEL_FAMILIES: 'model-families',
39
+ CREATE_MODEL_FAMILY: 'model-families',
40
+ UPDATE_MODEL_FAMILY: (familyId) => `model-families/${familyId}`,
41
+ DELETE_MODEL_FAMILY: (familyId) => `model-families/${familyId}`,
42
+ // ORGANIZATION
43
+ GET_ORGANIZATION: 'organization',
44
+ UPDATE_ORGANIZATION: 'organization',
30
45
  };
@@ -0,0 +1,41 @@
1
+ import { z } from 'zod';
2
+ import { HTTP_METHODS } from '../../../_common';
3
+ export declare const CreateAdminModelFamilyCommandBody: z.ZodObject<{
4
+ name: z.ZodString;
5
+ developer: z.ZodString;
6
+ category: z.ZodEnum<typeof import("../../..").MODEL_CATEGORY>;
7
+ }, z.core.$strip>;
8
+ export declare const CreateAdminModelFamilyCommandResponse: z.ZodObject<{
9
+ uuid: z.ZodUUID;
10
+ name: z.ZodString;
11
+ developer: z.ZodString;
12
+ category: z.ZodEnum<typeof import("../../..").MODEL_CATEGORY>;
13
+ }, z.core.$strip>;
14
+ export declare const CreateAdminModelFamilyCommand: {
15
+ method: HTTP_METHODS.POST;
16
+ path: "model-families";
17
+ summary: string;
18
+ request: {
19
+ body: z.ZodObject<{
20
+ name: z.ZodString;
21
+ developer: z.ZodString;
22
+ category: z.ZodEnum<typeof import("../../..").MODEL_CATEGORY>;
23
+ }, z.core.$strip>;
24
+ };
25
+ responses: {
26
+ 201: z.ZodObject<{
27
+ uuid: z.ZodUUID;
28
+ name: z.ZodString;
29
+ developer: z.ZodString;
30
+ category: z.ZodEnum<typeof import("../../..").MODEL_CATEGORY>;
31
+ }, z.core.$strip>;
32
+ 400: z.ZodType<import("../../../_common").HttpErrorResponse, unknown, z.core.$ZodTypeInternals<import("../../../_common").HttpErrorResponse, unknown>>;
33
+ 401: z.ZodType<import("../../../_common").HttpErrorResponse, unknown, z.core.$ZodTypeInternals<import("../../../_common").HttpErrorResponse, unknown>>;
34
+ 403: z.ZodType<import("../../../_common").HttpErrorResponse, unknown, z.core.$ZodTypeInternals<import("../../../_common").HttpErrorResponse, unknown>>;
35
+ 409: z.ZodType<import("../../../_common").HttpErrorResponse, unknown, z.core.$ZodTypeInternals<import("../../../_common").HttpErrorResponse, unknown>>;
36
+ 500: z.ZodType<import("../../../_common").HttpErrorResponse, unknown, z.core.$ZodTypeInternals<import("../../../_common").HttpErrorResponse, unknown>>;
37
+ };
38
+ };
39
+ export type CreateAdminModelFamilyCommandBodyType = z.infer<typeof CreateAdminModelFamilyCommandBody>;
40
+ export type CreateAdminModelFamilyCommandResponseType = z.infer<typeof CreateAdminModelFamilyCommandResponse>;
41
+ //# sourceMappingURL=create-admin-model-family.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-admin-model-family.command.d.ts","sourceRoot":"","sources":["../../../../admin/endpoints/commands/create-admin-model-family.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,YAAY,EAA2B,MAAM,kBAAkB,CAAC;AAIzF,eAAO,MAAM,iCAAiC;;;;iBAAyB,CAAC;AAExE,eAAO,MAAM,qCAAqC;;;;;iBAAoB,CAAC;AAEvE,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;CAexC,CAAC;AAEH,MAAM,MAAM,qCAAqC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AACtG,MAAM,MAAM,yCAAyC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateAdminModelFamilyCommand = exports.CreateAdminModelFamilyCommandResponse = exports.CreateAdminModelFamilyCommandBody = void 0;
4
+ const _common_1 = require("../../../_common");
5
+ const model_page_1 = require("../../../model-page");
6
+ const admin_1 = require("../admin");
7
+ exports.CreateAdminModelFamilyCommandBody = model_page_1.ModelFamilyInputSchema;
8
+ exports.CreateAdminModelFamilyCommandResponse = model_page_1.ModelFamilySchema;
9
+ exports.CreateAdminModelFamilyCommand = (0, _common_1.defineContract)({
10
+ method: _common_1.HTTP_METHODS.POST,
11
+ path: admin_1.ADMIN_ROUTES.CREATE_MODEL_FAMILY,
12
+ summary: 'Create model family',
13
+ request: {
14
+ body: exports.CreateAdminModelFamilyCommandBody,
15
+ },
16
+ responses: {
17
+ 201: exports.CreateAdminModelFamilyCommandResponse,
18
+ 400: _common_1.HttpErrorResponseSchema,
19
+ 401: _common_1.HttpErrorResponseSchema,
20
+ 403: _common_1.HttpErrorResponseSchema,
21
+ 409: _common_1.HttpErrorResponseSchema,
22
+ 500: _common_1.HttpErrorResponseSchema,
23
+ },
24
+ });