@purpleschool/gptbot 0.7.78 → 0.7.80

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 (77) hide show
  1. package/api/controllers/http/presentation.ts +0 -10
  2. package/build/api/controllers/http/presentation.js +0 -7
  3. package/build/commands/auth/register-user.command.js +18 -1
  4. package/build/commands/auth/vk-login.command.js +18 -1
  5. package/build/commands/auth/yandex-login.command.js +18 -1
  6. package/build/commands/product/buy-product.command.js +25 -1
  7. package/build/commands/subscription/buy-subscription.command.js +25 -1
  8. package/build/commands/telegram-auth/create-telegram-auth-link.command.js +19 -1
  9. package/build/commands/telegram-profile/auth-with-telegram-web-app.command.js +7 -0
  10. package/build/commands/tools/presentation/index.js +0 -7
  11. package/build/commands/tools/presentation/update-presentation.command.js +3 -4
  12. package/build/commands/user/get-aggregated-user-data.command.js +1 -0
  13. package/build/commands/user/index.js +1 -0
  14. package/build/constants/errors/errors.js +6 -9
  15. package/build/constants/presentation/enums/index.js +0 -4
  16. package/build/constants/webmaster/enums/organization-type.enum.js +0 -1
  17. package/build/helpers/index.js +0 -1
  18. package/build/models/tools/index.js +0 -1
  19. package/build/models/tools/presentation/index.js +0 -1
  20. package/build/models/tools/presentation/presentation-config.schema.js +0 -3
  21. package/build/models/tools/presentation/presentation.schema.js +0 -2
  22. package/build/models/tools/presentation/slide-content.schema.js +20 -22
  23. package/build/models/tools/presentation/slide.schema.js +1 -39
  24. package/build/models/user-referrals.schema.js +6 -0
  25. package/commands/auth/register-user.command.ts +23 -1
  26. package/commands/auth/vk-login.command.ts +23 -1
  27. package/commands/auth/yandex-login.command.ts +23 -1
  28. package/commands/product/buy-product.command.ts +38 -9
  29. package/commands/subscription/buy-subscription.command.ts +38 -9
  30. package/commands/telegram-auth/create-telegram-auth-link.command.ts +24 -1
  31. package/commands/telegram-profile/auth-with-telegram-web-app.command.ts +7 -0
  32. package/commands/tools/presentation/index.ts +0 -7
  33. package/commands/tools/presentation/update-presentation.command.ts +4 -5
  34. package/commands/user/get-aggregated-user-data.command.ts +1 -0
  35. package/commands/user/index.ts +1 -0
  36. package/constants/errors/errors.ts +6 -9
  37. package/constants/presentation/enums/index.ts +0 -4
  38. package/constants/webmaster/enums/organization-type.enum.ts +0 -1
  39. package/helpers/index.ts +0 -1
  40. package/models/tools/index.ts +0 -1
  41. package/models/tools/presentation/index.ts +0 -1
  42. package/models/tools/presentation/presentation-config.schema.ts +0 -3
  43. package/models/tools/presentation/presentation.schema.ts +0 -2
  44. package/models/tools/presentation/slide-content.schema.ts +32 -119
  45. package/models/tools/presentation/slide.schema.ts +0 -47
  46. package/models/user-referrals.schema.ts +6 -0
  47. package/package.json +1 -1
  48. package/build/commands/tools/presentation/build-blank-slide.command.js +0 -21
  49. package/build/commands/tools/presentation/generate-and-insert-slide.command.js +0 -22
  50. package/build/commands/tools/presentation/presentation-generate-report.command.js +0 -17
  51. package/build/commands/tools/presentation/presentation-paraphrase.command.js +0 -20
  52. package/build/commands/tools/presentation/update-presentation-slides.command.js +0 -25
  53. package/build/commands/tools/presentation/update-slide-image-slot.command.js +0 -34
  54. package/build/commands/tools/presentation/update-slide.command.js +0 -19
  55. package/build/constants/presentation/enums/presentation-ai-action-call-status.enum.js +0 -9
  56. package/build/constants/presentation/enums/presentation-ai-action-pricing-type.enum.js +0 -8
  57. package/build/constants/presentation/enums/presentation-ai-action-type.enum.js +0 -8
  58. package/build/constants/presentation/enums/slide-image-slot-action.enum.js +0 -8
  59. package/build/helpers/presentation/calculate-presentation-ai-action-price.util.js +0 -16
  60. package/build/helpers/presentation/index.js +0 -17
  61. package/build/models/tools/presentation/presentation-ai-action.schema.js +0 -27
  62. package/build/models/tools/presentation/slide-content-edit.schema.js +0 -129
  63. package/commands/tools/presentation/build-blank-slide.command.ts +0 -23
  64. package/commands/tools/presentation/generate-and-insert-slide.command.ts +0 -27
  65. package/commands/tools/presentation/presentation-generate-report.command.ts +0 -21
  66. package/commands/tools/presentation/presentation-paraphrase.command.ts +0 -26
  67. package/commands/tools/presentation/update-presentation-slides.command.ts +0 -32
  68. package/commands/tools/presentation/update-slide-image-slot.command.ts +0 -40
  69. package/commands/tools/presentation/update-slide.command.ts +0 -25
  70. package/constants/presentation/enums/presentation-ai-action-call-status.enum.ts +0 -5
  71. package/constants/presentation/enums/presentation-ai-action-pricing-type.enum.ts +0 -4
  72. package/constants/presentation/enums/presentation-ai-action-type.enum.ts +0 -4
  73. package/constants/presentation/enums/slide-image-slot-action.enum.ts +0 -4
  74. package/helpers/presentation/calculate-presentation-ai-action-price.util.ts +0 -20
  75. package/helpers/presentation/index.ts +0 -1
  76. package/models/tools/presentation/presentation-ai-action.schema.ts +0 -33
  77. package/models/tools/presentation/slide-content-edit.schema.ts +0 -154
@@ -6,8 +6,30 @@ export namespace YandexLoginCommand {
6
6
  .object({
7
7
  code: z.string(),
8
8
  code_verifier: z.string(),
9
+ marketingConsent: z.boolean().default(false),
9
10
  })
10
- .merge(UserReferralsSchema);
11
+ .merge(UserReferralsSchema)
12
+ .refine(
13
+ (data) => {
14
+ const hasAdmitadUid = !!data.admitadUid;
15
+ const hasAdmitadClickDate = !!data.admitadClickDate;
16
+ return hasAdmitadUid === hasAdmitadClickDate;
17
+ },
18
+ {
19
+ message: 'admitadUid and admitadClickDate must be provided together',
20
+ path: ['admitadUid'],
21
+ },
22
+ )
23
+ .refine(
24
+ (data) => {
25
+ if (!data.admitadClickDate) return true;
26
+ return new Date(data.admitadClickDate).getTime() <= Date.now();
27
+ },
28
+ {
29
+ message: 'admitadClickDate cannot be in the future',
30
+ path: ['admitadClickDate'],
31
+ },
32
+ );
11
33
 
12
34
  export type Request = z.infer<typeof RequestSchema>;
13
35
 
@@ -32,15 +32,44 @@ export namespace BuyProductCommand {
32
32
  }),
33
33
  });
34
34
 
35
- export const RequestFastSchema = z.object({
36
- email: z.string().email(),
37
- partnerId: z.string().uuid().optional(),
38
- promocode: z.string().optional(),
39
- webmasterAlias: z.string().optional(),
40
- webmasterReferralProvidedAt: z
41
- .preprocess((val) => (typeof val === 'string' ? new Date(val) : val), z.date())
42
- .optional(),
43
- });
35
+ export const RequestFastSchema = z
36
+ .object({
37
+ email: z.string().email(),
38
+ partnerId: z.string().uuid().optional(),
39
+ promocode: z.string().optional(),
40
+ webmasterAlias: z.string().optional(),
41
+ webmasterReferralProvidedAt: z
42
+ .preprocess((val) => (typeof val === 'string' ? new Date(val) : val), z.date())
43
+ .optional(),
44
+ admitadUid: z.string().optional(),
45
+ admitadClickDate: z
46
+ .string()
47
+ .datetime()
48
+ .transform((date) => new Date(date))
49
+ .optional(),
50
+ marketingConsent: z.boolean().default(false),
51
+ })
52
+ .refine(
53
+ (data) => {
54
+ const hasAdmitadUid = !!data.admitadUid;
55
+ const hasAdmitadClickDate = !!data.admitadClickDate;
56
+ return hasAdmitadUid === hasAdmitadClickDate;
57
+ },
58
+ {
59
+ message: 'admitadUid and admitadClickDate must be provided together',
60
+ path: ['admitadUid'],
61
+ },
62
+ )
63
+ .refine(
64
+ (data) => {
65
+ if (!data.admitadClickDate) return true;
66
+ return new Date(data.admitadClickDate).getTime() <= Date.now();
67
+ },
68
+ {
69
+ message: 'admitadClickDate cannot be in the future',
70
+ path: ['admitadClickDate'],
71
+ },
72
+ );
44
73
 
45
74
  export type RequestFast = z.infer<typeof RequestFastSchema>;
46
75
  export const ResponseSchema = z.object({
@@ -12,15 +12,44 @@ export namespace BuySubscriptionCommand {
12
12
  });
13
13
 
14
14
  export type Request = z.infer<typeof RequestSchema>;
15
- export const RequestFastSchema = z.object({
16
- email: z.string().email(),
17
- partnerId: z.string().uuid().optional(),
18
- promocode: z.string().optional(),
19
- webmasterAlias: z.string().optional(),
20
- webmasterReferralProvidedAt: z
21
- .preprocess((val) => (typeof val === 'string' ? new Date(val) : val), z.date())
22
- .optional(),
23
- });
15
+ export const RequestFastSchema = z
16
+ .object({
17
+ email: z.string().email(),
18
+ partnerId: z.string().uuid().optional(),
19
+ promocode: z.string().optional(),
20
+ webmasterAlias: z.string().optional(),
21
+ webmasterReferralProvidedAt: z
22
+ .preprocess((val) => (typeof val === 'string' ? new Date(val) : val), z.date())
23
+ .optional(),
24
+ admitadUid: z.string().optional(),
25
+ admitadClickDate: z
26
+ .string()
27
+ .datetime()
28
+ .transform((date) => new Date(date))
29
+ .optional(),
30
+ marketingConsent: z.boolean().default(false),
31
+ })
32
+ .refine(
33
+ (data) => {
34
+ const hasAdmitadUid = !!data.admitadUid;
35
+ const hasAdmitadClickDate = !!data.admitadClickDate;
36
+ return hasAdmitadUid === hasAdmitadClickDate;
37
+ },
38
+ {
39
+ message: 'admitadUid and admitadClickDate must be provided together',
40
+ path: ['admitadUid'],
41
+ },
42
+ )
43
+ .refine(
44
+ (data) => {
45
+ if (!data.admitadClickDate) return true;
46
+ return new Date(data.admitadClickDate).getTime() <= Date.now();
47
+ },
48
+ {
49
+ message: 'admitadClickDate cannot be in the future',
50
+ path: ['admitadClickDate'],
51
+ },
52
+ );
24
53
 
25
54
  export type RequestFast = z.infer<typeof RequestFastSchema>;
26
55
 
@@ -2,7 +2,30 @@ import { z } from 'zod';
2
2
  import { UserReferralsSchema } from '../../models';
3
3
 
4
4
  export namespace CreateTelegramAuthLinkCommand {
5
- export const RequestSchema = UserReferralsSchema;
5
+ export const RequestSchema = UserReferralsSchema.extend({
6
+ marketingConsent: z.boolean().default(false),
7
+ })
8
+ .refine(
9
+ (data) => {
10
+ const hasAdmitadUid = !!data.admitadUid;
11
+ const hasAdmitadClickDate = !!data.admitadClickDate;
12
+ return hasAdmitadUid === hasAdmitadClickDate;
13
+ },
14
+ {
15
+ message: 'admitadUid and admitadClickDate must be provided together',
16
+ path: ['admitadUid'],
17
+ },
18
+ )
19
+ .refine(
20
+ (data) => {
21
+ if (!data.admitadClickDate) return true;
22
+ return new Date(data.admitadClickDate).getTime() <= Date.now();
23
+ },
24
+ {
25
+ message: 'admitadClickDate cannot be in the future',
26
+ path: ['admitadClickDate'],
27
+ },
28
+ );
6
29
 
7
30
  export type Request = z.infer<typeof RequestSchema>;
8
31
 
@@ -11,6 +11,13 @@ export namespace AuthWithTelegramWebAppCommand {
11
11
  .preprocess((val) => (typeof val === 'string' ? new Date(val) : val), z.date())
12
12
  .optional(),
13
13
  utm: UtmSchema.optional(),
14
+ admitadUid: z.string().optional(),
15
+ admitadClickDate: z
16
+ .string()
17
+ .datetime()
18
+ .transform((date) => new Date(date))
19
+ .optional(),
20
+ marketingConsent: z.boolean().default(false),
14
21
  });
15
22
 
16
23
  export type Request = z.infer<typeof RequestBodySchema>;
@@ -1,4 +1,3 @@
1
- export * from './build-blank-slide.command';
2
1
  export * from './create-presentation.command';
3
2
  export * from './delete-all-user-presentations.command';
4
3
  export * from './delete-slide-outline.command';
@@ -8,15 +7,9 @@ export * from './find-presentation-by-uuid.command';
8
7
  export * from './find-presentation-outline.command';
9
8
  export * from './find-presentations.command';
10
9
  export * from './generate-presentation-slides.command';
11
- export * from './generate-and-insert-slide.command';
12
10
  export * from './get-presentation-config.command';
13
11
  export * from './reposition-slide-outline.command';
14
12
  export * from './update-slide-outline.command';
15
13
  export * from './update-presentation-outline.command';
16
14
  export * from './update-presentation.command';
17
- export * from './update-presentation-slides.command';
18
- export * from './update-slide-image-slot.command';
19
15
  export * from './update-slide-outline.command';
20
- export * from './presentation-paraphrase.command';
21
- export * from './presentation-generate-report.command';
22
- export * from './update-slide.command';
@@ -5,12 +5,11 @@ export namespace UpdatePresentationCommand {
5
5
  export const RequestParamsSchema = z.object({
6
6
  uuid: z.string().uuid(),
7
7
  });
8
- export type RequestParams = z.infer<typeof RequestParamsSchema>;
9
8
 
10
- export const RequestBodySchema = PresentationSchema.pick({
11
- title: true,
12
- templateId: true,
13
- }).partial();
9
+ export const RequestBodySchema = z.object({
10
+ title: z.string(),
11
+ });
12
+
14
13
  export type Request = z.infer<typeof RequestBodySchema>;
15
14
 
16
15
  export const ResponseSchema = z.object({
@@ -17,6 +17,7 @@ export namespace GetAggregatedUserData {
17
17
  hasActiveSubscription: z.boolean(),
18
18
  hasActiveProduct: z.boolean(),
19
19
  isCustomer: z.boolean(),
20
+ marketingConsent: z.boolean(),
20
21
  });
21
22
 
22
23
  export type AggregatedUser = z.infer<typeof AggregatedUserSchema>;
@@ -8,3 +8,4 @@ export * from './get-user-orders.command';
8
8
  export * from './get-user-subscriptions.command';
9
9
  export * from './get-user-products.command';
10
10
  export * from './delete-account.command';
11
+ export * from './get-aggregated-user-data.command';
@@ -2247,10 +2247,12 @@ export const ERRORS = {
2247
2247
  MUSIC_MAX_SYMBOLS_EXCEEDED: {
2248
2248
  code: 'A458',
2249
2249
  message: 'Превышена максимальная количество символов',
2250
+ httpCode: 400,
2250
2251
  },
2251
2252
  MUSIC_INVALID_VOCAL: {
2252
2253
  code: 'A459',
2253
2254
  message: 'Выбран неверный голос для вокала',
2255
+ httpCode: 400,
2254
2256
  },
2255
2257
  MUSIC_JOB_DELETE_ERROR: {
2256
2258
  code: 'A460',
@@ -2288,18 +2290,13 @@ export const ERRORS = {
2288
2290
  httpCode: 403,
2289
2291
  },
2290
2292
  WEBMASTER_BONUS_APPLY_ERROR: {
2291
- code: 'A449',
2293
+ code: 'A467',
2292
2294
  message: 'Не удалось применить бонусы вебмастеру',
2293
2295
  httpCode: 500,
2294
2296
  },
2295
- SLIDE_IMAGE_SLOT_UPDATE_ERROR: {
2296
- code: 'A450',
2297
- message: 'Произошла ошибка при обновлении изображения на слайде',
2298
- httpCode: 500,
2299
- },
2300
- FILE_TYPE_NOT_SUPPORTED: {
2301
- code: 'A451',
2302
- message: 'Неподдерживаемый тип файла',
2297
+ WEBMASTER_BALANCE_LESS_THAN_MINIMUM_ERROR: {
2298
+ code: 'A468',
2299
+ message: 'Минимальная сумма для вывода 5000 рублей',
2303
2300
  httpCode: 400,
2304
2301
  },
2305
2302
  };
@@ -3,7 +3,3 @@ export * from './slide-content-type.enum';
3
3
  export * from './slide-icon-slot-status.enum';
4
4
  export * from './slide-image-slot.status.enum';
5
5
  export * from './slide-layout.enum';
6
- export * from './slide-image-slot-action.enum';
7
- export * from './presentation-ai-action-type.enum';
8
- export * from './presentation-ai-action-pricing-type.enum';
9
- export * from './presentation-ai-action-call-status.enum';
@@ -1,5 +1,4 @@
1
1
  export enum ORGANIZATION_TYPE {
2
2
  INDIVIDUAL_ENTREPRENEUR = 'ИП',
3
3
  LEGAL_ENTITY = 'Юридическое лицо',
4
- SELF_EMPLOYED = 'Самозанятый',
5
4
  }
package/helpers/index.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export * from './ai-model';
2
- export * from './presentation';
3
2
  export * from './stt';
4
3
  export * from './subscription';
5
4
  export * from './tts';
@@ -1,6 +1,5 @@
1
1
  export * from './language';
2
2
  export * from './paraphrase';
3
- export * from './presentation';
4
3
  export * from './stt';
5
4
  export * from './tts';
6
5
  export * from './video';
@@ -5,4 +5,3 @@ export * from './slide-outline.schema';
5
5
  export * from './slide.schema';
6
6
  export * from './slide-content.schema';
7
7
  export * from './presentation-config.schema';
8
- export * from './presentation-ai-action.schema';
@@ -2,19 +2,16 @@ import { z } from 'zod';
2
2
  import { SlideContentTypeSchema } from './slide-content-type.schema';
3
3
  import { LanguageSchema } from '../language';
4
4
  import { PresentationTemplateSchema } from './presentation-template.schema';
5
- import { PresentationAiActionSchema } from './presentation-ai-action.schema';
6
5
 
7
6
  export const PresentationConfigSchema = z.object({
8
7
  slideContentTypes: z.array(SlideContentTypeSchema),
9
8
  languages: z.array(LanguageSchema),
10
9
  templates: z.array(PresentationTemplateSchema),
11
- aiActions: z.array(PresentationAiActionSchema),
12
10
  slideGenerationPrice: z.number(),
13
11
  maxSlides: z.number(),
14
12
  minSlides: z.number(),
15
13
  maxSlideTitleLength: z.number(),
16
14
  maxSlideOutlineLength: z.number(),
17
15
  maxPromptLength: z.number(),
18
- imageGenerationPrice: z.number(),
19
16
  });
20
17
  export type PresentationConfig = z.infer<typeof PresentationConfigSchema>;
@@ -13,8 +13,6 @@ export const PresentationSchema = z.object({
13
13
  templateId: z.string(),
14
14
  downloadUrl: z.string().nullable(),
15
15
  slideCount: z.number(),
16
- lastContentUpdateAt: z.date().nullable(),
17
- lastPptxExportedAt: z.date().nullable(),
18
16
  createdAt: z.date(),
19
17
  updatedAt: z.date(),
20
18
  });
@@ -19,95 +19,14 @@ export const IconSlotSchema = z.object({
19
19
  .string()
20
20
  .uuid()
21
21
  .describe('Generate a valid uuid for icon slot, that will be used for future lookups'),
22
- prompt: z.string().describe('Provide a search query for an fitting icon. MUST BE IN ENGLISH'),
22
+ prompt: z
23
+ .string()
24
+ .describe(
25
+ 'Icons are stored locally. Provide a search query for a fitting icon. MUST BE IN ENGLISH',
26
+ ),
23
27
  });
24
28
  export type IconSlot = z.infer<typeof IconSlotSchema>;
25
29
 
26
- export interface ICoverSlideDataStructure {
27
- contentType: SLIDE_CONTENT_TYPE.COVER;
28
- title: string;
29
- author: { label: string; value: string };
30
- date: { label: string; value: string };
31
- email: { label: string; value: string };
32
- version: 1;
33
- }
34
-
35
- export interface IThankYouSlideDataStructure {
36
- contentType: SLIDE_CONTENT_TYPE.THANK_YOU;
37
- title: string;
38
- author: { label: string; value: string };
39
- date: { label: string; value: string };
40
- email: { label: string; value: string };
41
- version: 1;
42
- }
43
-
44
- export interface ITextSlideDataStructure {
45
- contentType: SLIDE_CONTENT_TYPE.TEXT;
46
- title: string;
47
- description: string;
48
- version: 1;
49
- }
50
-
51
- export interface IStructuredListSlideDataStructure {
52
- contentType: SLIDE_CONTENT_TYPE.STRUCTURED_LIST;
53
- title: string;
54
- description: string;
55
- list: Array<{ title: string; description: string }>;
56
- version: 1;
57
- }
58
-
59
- export interface IContentsSlideDataStructure {
60
- contentType: SLIDE_CONTENT_TYPE.CONTENTS;
61
- title: string;
62
- items: Array<{ pageNumber: number; title: string }>;
63
- version: 1;
64
- }
65
-
66
- export interface IImageSlideDataStructure {
67
- contentType: SLIDE_CONTENT_TYPE.TEXT_WITH_IMAGE;
68
- title: string;
69
- description: string;
70
- imageSlot?: ImageSlot;
71
- version: 1;
72
- }
73
-
74
- export interface ISectionBreakSlideDataStructure {
75
- contentType: SLIDE_CONTENT_TYPE.SECTION_BREAK;
76
- title: string;
77
- description: string;
78
- version: 1;
79
- }
80
-
81
- export interface ITableSlideDataStructure {
82
- contentType: SLIDE_CONTENT_TYPE.TABLE;
83
- title: string;
84
- description: string;
85
- table: {
86
- columnHeaders: string[];
87
- rows: string[][];
88
- hasRowHeaders: boolean;
89
- hasSummaryRow: boolean;
90
- };
91
- version: 1;
92
- }
93
-
94
- export interface IBarChartSlideDataStructure {
95
- type: SLIDE_CHART_TYPE.BAR;
96
- categories: string[];
97
- series: Array<{ name: string; data: number[]; type: number }>;
98
- yAxisLabel?: string;
99
- unit?: string;
100
- version: 1;
101
- }
102
-
103
- export interface IChartSlideDataStructure {
104
- contentType: SLIDE_CONTENT_TYPE.CHART;
105
- title: string;
106
- description: string;
107
- chart: IBarChartSlideDataStructure;
108
- version: 1;
109
- }
110
-
111
30
  export const CoverSlideDataSchema = z.object({
112
31
  contentType: z.literal(SLIDE_CONTENT_TYPE.COVER),
113
32
  title: z.string().describe('Slide title in about 6 words').min(10).max(150),
@@ -130,22 +49,20 @@ export const CoverSlideDataSchema = z.object({
130
49
  value: z.string().describe('Just default "email@example.com"'),
131
50
  }),
132
51
  version: z.literal(1),
133
- }) satisfies z.ZodType<ICoverSlideDataStructure>;
52
+ });
134
53
  export type CoverSlideData = z.infer<typeof CoverSlideDataSchema>;
135
54
 
136
55
  export const ThankYouSlideDataSchema = z.object({
137
56
  contentType: z.literal(SLIDE_CONTENT_TYPE.THANK_YOU),
138
- title: z
139
- .string()
140
- .describe('"Thank you for your attention" in presentation\'s language')
141
- .min(10)
142
- .max(150),
57
+ title: z.string().describe('Slide title in about 6 words').min(10).max(150),
143
58
  author: z.object({
144
- label: z.string().describe('"Author" in presentation\'s language'),
145
- value: z.string().describe('"Author of the presentation" in presentation\'s language'),
59
+ label: z.string().describe('Literal "Author" in presentation\'s language'),
60
+ value: z
61
+ .string()
62
+ .describe('Literal "Author of the presentation" in presentation\'s language'),
146
63
  }),
147
64
  date: z.object({
148
- label: z.string().describe('"Date" in presentation\'s language'),
65
+ label: z.string().describe('Literal "Date" in presentation\'s language'),
149
66
  value: z
150
67
  .string()
151
68
  .describe(
@@ -157,7 +74,7 @@ export const ThankYouSlideDataSchema = z.object({
157
74
  value: z.string().describe('Just default "email@example.com"'),
158
75
  }),
159
76
  version: z.literal(1),
160
- }) satisfies z.ZodType<IThankYouSlideDataStructure>;
77
+ });
161
78
  export type ThankYouSlideData = z.infer<typeof ThankYouSlideDataSchema>;
162
79
 
163
80
  export const StructuredListSlideDataSchema = z.object({
@@ -173,7 +90,7 @@ export const StructuredListSlideDataSchema = z.object({
173
90
  )
174
91
  .length(4),
175
92
  version: z.literal(1),
176
- }) satisfies z.ZodType<IStructuredListSlideDataStructure>;
93
+ });
177
94
  export type StructuredListSlideData = z.infer<typeof StructuredListSlideDataSchema>;
178
95
 
179
96
  export const TextSlideDataSchema = z.object({
@@ -182,12 +99,12 @@ export const TextSlideDataSchema = z.object({
182
99
  description: z
183
100
  .string()
184
101
  .describe(
185
- "Fairly long textual description of the point presented in the title. A couple of paragraphs. Consider maximum amount of text to be 600 characters. Don't cut the text short.",
102
+ 'Fairly long textual description of the point presented in the title. A couple of paragraphs.',
186
103
  )
187
104
  .min(300)
188
- .max(600),
105
+ .max(500),
189
106
  version: z.literal(1),
190
- }) satisfies z.ZodType<ITextSlideDataStructure>;
107
+ });
191
108
  export type TextSlideData = z.infer<typeof TextSlideDataSchema>;
192
109
 
193
110
  export const ContentsSlideDataSchema = z.object({
@@ -211,7 +128,7 @@ export const ContentsSlideDataSchema = z.object({
211
128
  'List of slide titles. Must be relevant and generated after all the slides are generated',
212
129
  ),
213
130
  version: z.literal(1),
214
- }) satisfies z.ZodType<IContentsSlideDataStructure>;
131
+ });
215
132
  export type ContentsSlideData = z.infer<typeof ContentsSlideDataSchema>;
216
133
 
217
134
  export const ImageSlideDataSchema = z
@@ -226,9 +143,7 @@ export const ImageSlideDataSchema = z
226
143
  imageSlot: ImageSlotSchema,
227
144
  version: z.literal(1),
228
145
  })
229
- .describe(
230
- 'Slide that contains a title, description of the title',
231
- ) satisfies z.ZodType<IImageSlideDataStructure>;
146
+ .describe('Slide that contains a title, description of the title');
232
147
  export type ImageSlideData = z.infer<typeof ImageSlideDataSchema>;
233
148
 
234
149
  export const SectionBreakSlideDataSchema = z.object({
@@ -236,7 +151,7 @@ export const SectionBreakSlideDataSchema = z.object({
236
151
  title: z.string().describe('Slide title in about 6 words').min(10).max(200),
237
152
  description: z.string().describe('Description of the slide in about 6 words').min(10).max(200),
238
153
  version: z.literal(1),
239
- }) satisfies z.ZodType<ISectionBreakSlideDataStructure>;
154
+ });
240
155
  export type SectionBreakSlideData = z.infer<typeof SectionBreakSlideDataSchema>;
241
156
 
242
157
  export const TableSlideDataSchema = z.object({
@@ -254,9 +169,9 @@ export const TableSlideDataSchema = z.object({
254
169
  .max(10)
255
170
  .describe('Array of column header labels'),
256
171
  rows: z
257
- .array(z.array(z.string().min(1).max(75)))
258
- .min(3)
259
- .max(4)
172
+ .array(z.array(z.string().min(1).max(150)))
173
+ .min(2)
174
+ .max(10)
260
175
  .describe(
261
176
  'Table rows; each row must have exactly the same number of cells as columnHeaders',
262
177
  ),
@@ -264,23 +179,21 @@ export const TableSlideDataSchema = z.object({
264
179
  hasSummaryRow: z.boolean().describe('If table needs a summary row, set this to true'),
265
180
  }),
266
181
  version: z.literal(1),
267
- }) satisfies z.ZodType<ITableSlideDataStructure>;
182
+ });
268
183
  export type TableSlideData = z.infer<typeof TableSlideDataSchema>;
269
184
 
270
185
  // Charts
271
186
  export const BarChartSlideDataSchema = z.object({
272
187
  type: z.literal(SLIDE_CHART_TYPE.BAR),
273
188
  categories: z
274
- .array(z.string())
189
+ .array(z.string().min(1).max(12))
275
190
  .min(1)
276
191
  .max(12)
277
192
  .describe('Category labels (e.g., months, products, regions)'),
278
193
  series: z
279
194
  .array(
280
195
  z.object({
281
- name: z
282
- .string()
283
- .describe('Series name for legend. Try to include measurements if needed'),
196
+ name: z.string().min(1).max(12).describe('Series name for legend'),
284
197
  data: z.array(z.number()).describe('Values corresponding to categories'),
285
198
  type: z
286
199
  .number()
@@ -290,21 +203,21 @@ export const BarChartSlideDataSchema = z.object({
290
203
  }),
291
204
  )
292
205
  .min(1)
293
- .max(1)
294
- .describe('Data series for the chart. Only one series is supported'),
206
+ .max(12)
207
+ .describe('Data series for the chart'),
295
208
  yAxisLabel: z.string().max(40).optional().describe('Y-axis label'),
296
209
  unit: z.string().max(10).optional().describe('Unit symbol (%, $, etc.)'),
297
210
  version: z.literal(1),
298
- }) satisfies z.ZodType<IBarChartSlideDataStructure>;
211
+ });
299
212
  export type BarChartSlideData = z.infer<typeof BarChartSlideDataSchema>;
300
213
 
301
214
  export const ChartSlideDataSchema = z.object({
302
215
  contentType: z.literal(SLIDE_CONTENT_TYPE.CHART),
303
- title: z.string().describe('Slide title in about 2-6 words').max(100),
304
- description: z.string().describe("Information on slide's topic").max(600),
216
+ title: z.string().describe('Slide title in about 6 words').min(10).max(200),
217
+ description: z.string().describe("Information on slide's topic").min(10).max(400),
305
218
  chart: z.discriminatedUnion('type', [BarChartSlideDataSchema]),
306
219
  version: z.literal(1),
307
- }) satisfies z.ZodType<IChartSlideDataStructure>;
220
+ });
308
221
  export type ChartSlideData = z.infer<typeof ChartSlideDataSchema>;
309
222
 
310
223
  export const SlideContentSchema = z.discriminatedUnion('contentType', [
@@ -3,7 +3,6 @@ import { SlideContentSchema } from './slide-content.schema';
3
3
  import { SLIDE_CONTENT_TYPE, SLIDE_LAYOUT } from '../../../constants';
4
4
  import { SlideIconSlotSchema } from './slide-icon-slot.schema';
5
5
  import { SlideImageSlotSchema } from './slide-image-slot.schema';
6
- import { SlideContentUserEditSchema } from './slide-content-edit.schema';
7
6
 
8
7
  export const SlideSchema = z.object({
9
8
  uuid: z.string().uuid(),
@@ -18,49 +17,3 @@ export const SlideSchema = z.object({
18
17
  updatedAt: z.date(),
19
18
  });
20
19
  export type Slide = z.infer<typeof SlideSchema>;
21
-
22
- export const SlideUpdateSchema = SlideSchema.pick({
23
- layoutId: true,
24
- })
25
- .extend({
26
- content: SlideContentUserEditSchema,
27
- })
28
- .partial();
29
- export type SlideUpdate = z.infer<typeof SlideUpdateSchema>;
30
-
31
- export const SlideBulkUpdateSchema = SlideSchema.pick({
32
- order: true,
33
- contentTypeId: true,
34
- layoutId: true,
35
- presentationId: true,
36
- })
37
- .extend({
38
- uuid: z.string().uuid().optional(),
39
- content: SlideContentUserEditSchema,
40
- })
41
- .array()
42
- .min(1, 'Must include at least one slide')
43
- .refine(
44
- (arr) => {
45
- const orders = arr.map((s) => s.order);
46
- const unique = new Set(orders);
47
- if (unique.size !== orders.length) return false;
48
- const sorted = [...orders].sort((a, b) => a - b);
49
- return sorted.every((val, idx) => val === idx);
50
- },
51
- {
52
- message: 'Slide orders must be unique and sequential starting at 0',
53
- path: ['order'],
54
- },
55
- )
56
- .refine(
57
- (arr) => {
58
- const [firstId, ...rest] = arr.map((s) => s.presentationId);
59
- return rest.every((id) => id === firstId);
60
- },
61
- {
62
- message: 'All slides must belong to the same presentation',
63
- path: ['presentationId'],
64
- },
65
- );
66
- export type SlideBulkUpdate = z.infer<typeof SlideBulkUpdateSchema>;