@ai-grator/api 0.1.40 → 0.1.42

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 (46) hide show
  1. package/build/contact-form/endpoints/commands/index.d.ts +2 -0
  2. package/build/contact-form/endpoints/commands/index.d.ts.map +1 -0
  3. package/build/contact-form/endpoints/commands/index.js +17 -0
  4. package/build/contact-form/endpoints/commands/submit-contact-form.command.d.ts +25 -0
  5. package/build/contact-form/endpoints/commands/submit-contact-form.command.d.ts.map +1 -0
  6. package/build/contact-form/endpoints/commands/submit-contact-form.command.js +25 -0
  7. package/build/contact-form/endpoints/contact-form.d.ts +5 -0
  8. package/build/contact-form/endpoints/contact-form.d.ts.map +1 -0
  9. package/build/contact-form/endpoints/contact-form.js +7 -0
  10. package/build/contact-form/endpoints/index.d.ts +3 -0
  11. package/build/contact-form/endpoints/index.d.ts.map +1 -0
  12. package/build/contact-form/endpoints/index.js +18 -0
  13. package/build/contact-form/index.d.ts +2 -0
  14. package/build/contact-form/index.d.ts.map +1 -0
  15. package/build/contact-form/index.js +17 -0
  16. package/build/errors/errors.d.ts +7 -0
  17. package/build/errors/errors.d.ts.map +1 -1
  18. package/build/errors/errors.js +7 -0
  19. package/build/index.d.ts +1 -0
  20. package/build/index.d.ts.map +1 -1
  21. package/build/index.js +1 -0
  22. package/build/pricing-page/endpoints/queries/get-pricing-page.query.d.ts +12 -0
  23. package/build/pricing-page/endpoints/queries/get-pricing-page.query.d.ts.map +1 -1
  24. package/build/pricing-page/models/index.d.ts +1 -0
  25. package/build/pricing-page/models/index.d.ts.map +1 -1
  26. package/build/pricing-page/models/index.js +1 -0
  27. package/build/pricing-page/models/pricing-condition-item.schema.d.ts +7 -0
  28. package/build/pricing-page/models/pricing-condition-item.schema.d.ts.map +1 -0
  29. package/build/pricing-page/models/pricing-condition-item.schema.js +8 -0
  30. package/build/pricing-page/models/pricing-page.schema.d.ts +6 -0
  31. package/build/pricing-page/models/pricing-page.schema.d.ts.map +1 -1
  32. package/build/pricing-page/models/pricing-page.schema.js +4 -0
  33. package/build/scripts/generate-openapi.js +6 -0
  34. package/build/tsconfig.tsbuildinfo +1 -1
  35. package/contact-form/endpoints/commands/index.ts +1 -0
  36. package/contact-form/endpoints/commands/submit-contact-form.command.ts +25 -0
  37. package/contact-form/endpoints/contact-form.ts +5 -0
  38. package/contact-form/endpoints/index.ts +2 -0
  39. package/contact-form/index.ts +1 -0
  40. package/errors/errors.ts +7 -0
  41. package/index.ts +1 -0
  42. package/package.json +1 -1
  43. package/pricing-page/models/index.ts +1 -0
  44. package/pricing-page/models/pricing-condition-item.schema.ts +8 -0
  45. package/pricing-page/models/pricing-page.schema.ts +4 -0
  46. package/scripts/generate-openapi.ts +10 -0
@@ -0,0 +1 @@
1
+ export * from './submit-contact-form.command';
@@ -0,0 +1,25 @@
1
+ import { z } from 'zod';
2
+ import { defineContract, HTTP_METHODS, HttpErrorResponseSchema, HttpSuccessResponseSchema } from '../../../_common';
3
+ import { CONTACT_FORM_ROUTES } from '../contact-form';
4
+
5
+ export const SubmitContactFormCommandBody = z.object({
6
+ email: z.email(),
7
+ message: z.string().trim().min(1).max(2000),
8
+ });
9
+
10
+ export const SubmitContactFormCommandResponse = HttpSuccessResponseSchema;
11
+
12
+ export const SubmitContactFormCommand = defineContract({
13
+ method: HTTP_METHODS.POST,
14
+ path: CONTACT_FORM_ROUTES.SUBMIT,
15
+ summary: 'Submit the public contact form; forwards the message to support by email',
16
+ request: {
17
+ body: SubmitContactFormCommandBody,
18
+ },
19
+ responses: {
20
+ 200: SubmitContactFormCommandResponse,
21
+ 400: HttpErrorResponseSchema,
22
+ 429: HttpErrorResponseSchema,
23
+ 500: HttpErrorResponseSchema,
24
+ },
25
+ });
@@ -0,0 +1,5 @@
1
+ export const CONTACT_FORM_CONTROLLER = 'contact-form' as const;
2
+
3
+ export const CONTACT_FORM_ROUTES = {
4
+ SUBMIT: '',
5
+ } as const;
@@ -0,0 +1,2 @@
1
+ export * from './contact-form';
2
+ export * from './commands';
@@ -0,0 +1 @@
1
+ export * from './endpoints';
package/errors/errors.ts CHANGED
@@ -916,6 +916,13 @@ export const ERRORS = {
916
916
  message: 'Не удалось получить данные страницы цен',
917
917
  },
918
918
  },
919
+ CONTACT_FORM: {
920
+ SUBMIT_ERROR: {
921
+ httpCode: 500,
922
+ code: 'CONTACT_FORM.SUBMIT_ERROR',
923
+ message: 'Не удалось отправить сообщение в поддержку',
924
+ },
925
+ },
919
926
  MODEL_FAMILY: {
920
927
  NOT_FOUND: {
921
928
  httpCode: 404,
package/index.ts CHANGED
@@ -4,6 +4,7 @@ export * from './generation-model';
4
4
  export * from './model-catalog';
5
5
  export * from './model-page';
6
6
  export * from './pricing-page';
7
+ export * from './contact-form';
7
8
  export * from './generation-job';
8
9
  export * from './article';
9
10
  export * from './auth';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-grator/api",
3
- "version": "0.1.40",
3
+ "version": "0.1.42",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "scripts": {
@@ -1,5 +1,6 @@
1
1
  export * from './pricing-breadcrumb-item.schema';
2
2
  export * from './pricing-calculator-task.schema';
3
+ export * from './pricing-condition-item.schema';
3
4
  export * from './pricing-faq-item.schema';
4
5
  export * from './pricing-image-model.schema';
5
6
  export * from './pricing-models.schema';
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+
3
+ export const PricingConditionItemSchema = z.object({
4
+ title: z.string().min(1),
5
+ body: z.string().min(1),
6
+ });
7
+
8
+ export type PricingConditionItemSchemaType = z.infer<typeof PricingConditionItemSchema>;
@@ -1,13 +1,17 @@
1
1
  import { z } from 'zod';
2
2
  import { PricingBreadcrumbItemSchema } from './pricing-breadcrumb-item.schema';
3
3
  import { PricingCalculatorTaskSchema } from './pricing-calculator-task.schema';
4
+ import { PricingConditionItemSchema } from './pricing-condition-item.schema';
4
5
  import { PricingFaqItemSchema } from './pricing-faq-item.schema';
5
6
  import { PricingModelsSchema } from './pricing-models.schema';
6
7
 
7
8
  export const PricingPageSchema = z.object({
9
+ h1: z.string().min(1),
10
+ lead: z.string().min(1).nullable(),
8
11
  updatedAt: z.iso.datetime(),
9
12
  models: PricingModelsSchema,
10
13
  calculatorTasks: z.array(PricingCalculatorTaskSchema),
14
+ conditions: z.array(PricingConditionItemSchema),
11
15
  faq: z.array(PricingFaqItemSchema),
12
16
  breadcrumb: z.array(PricingBreadcrumbItemSchema),
13
17
  });
@@ -319,6 +319,12 @@ import {
319
319
  GetPricingPageQuery,
320
320
  GetPricingPageQueryResponse,
321
321
  } from '../pricing-page/endpoints/queries/get-pricing-page.query';
322
+ import { CONTACT_FORM_CONTROLLER } from '../contact-form/endpoints/contact-form';
323
+ import {
324
+ SubmitContactFormCommand,
325
+ SubmitContactFormCommandBody,
326
+ SubmitContactFormCommandResponse,
327
+ } from '../contact-form/endpoints/commands/submit-contact-form.command';
322
328
  import { GENERATION_MODEL_CONTROLLER } from '../generation-model/endpoints/generation-model';
323
329
  import {
324
330
  GetGenerationModelsQuery,
@@ -569,6 +575,8 @@ async function main() {
569
575
  registerSchema('PublicModelsGetBySlugResponse', GetPublicModelBySlugQueryResponse);
570
576
  registerSchema('ModelCatalogGetAllResponse', GetModelCatalogQueryResponse);
571
577
  registerSchema('PricingPageGetResponse', GetPricingPageQueryResponse);
578
+ registerSchema('ContactFormSubmitRequest', SubmitContactFormCommandBody);
579
+ registerSchema('ContactFormSubmitResponse', SubmitContactFormCommandResponse);
572
580
  registerSchema('GenerationModelGetAllResponse', GetGenerationModelsQueryResponse);
573
581
  registerSchema('GenerationModelGetByTypeParams', GetGenerationModelsByTypeQueryParams);
574
582
  registerSchema('GenerationModelGetByTypeResponse', GetGenerationModelsByTypeQueryResponse);
@@ -746,6 +754,7 @@ async function main() {
746
754
  const publicPageContracts: HttpContract[] = [GetPublicPageBySlugQuery];
747
755
  const modelCatalogContracts: HttpContract[] = [GetModelCatalogQuery];
748
756
  const pricingPageContracts: HttpContract[] = [GetPricingPageQuery];
757
+ const contactFormContracts: HttpContract[] = [SubmitContactFormCommand];
749
758
  const generationModelContracts: HttpContract[] = [
750
759
  GetGenerationModelsQuery,
751
760
  GetGenerationModelsByTypeQuery,
@@ -860,6 +869,7 @@ async function main() {
860
869
  { controller: PUBLIC_PAGE_CONTROLLER, tag: 'Pages (public)', contracts: publicPageContracts },
861
870
  { controller: MODEL_CATALOG_CONTROLLER, tag: 'Model Catalog', contracts: modelCatalogContracts },
862
871
  { controller: PRICING_PAGE_CONTROLLER, tag: 'Pricing Page (public)', contracts: pricingPageContracts },
872
+ { controller: CONTACT_FORM_CONTROLLER, tag: 'Contact Form (public)', contracts: contactFormContracts },
863
873
  { controller: GENERATION_MODEL_CONTROLLER, tag: 'Generation Models', contracts: generationModelContracts },
864
874
  { controller: GENERATION_JOB_CONTROLLER, tag: 'Generation Jobs', contracts: generationJobContracts },
865
875
  {