@purpleschool/gptbot 0.19.7 → 0.19.9-stage-2

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 (57) hide show
  1. package/build/api/controllers/http/greetings.d.ts +24 -0
  2. package/build/api/controllers/http/greetings.js +28 -0
  3. package/build/api/controllers/http/index.d.ts +1 -0
  4. package/build/api/controllers/http/index.js +1 -0
  5. package/build/api/index.d.ts +1 -0
  6. package/build/api/index.js +1 -0
  7. package/build/api/partner-code-routes.d.ts +21 -0
  8. package/build/api/partner-code-routes.js +25 -0
  9. package/build/commands/content-report/create-content-report.command.d.ts +2 -0
  10. package/build/commands/content-report/find-content-reports.query.d.ts +2 -0
  11. package/build/commands/content-report/update-content-report-status.command.d.ts +1 -0
  12. package/build/commands/index.d.ts +1 -0
  13. package/build/commands/index.js +1 -0
  14. package/build/commands/message/create-text-message.command.js +1 -1
  15. package/build/commands/partner-codes/index.d.ts +489 -0
  16. package/build/commands/partner-codes/index.js +73 -0
  17. package/build/commands/tools/greetings/index.d.ts +2 -0
  18. package/build/commands/tools/greetings/index.js +18 -0
  19. package/build/commands/tools/greetings/requests.d.ts +130 -0
  20. package/build/commands/tools/greetings/requests.js +34 -0
  21. package/build/commands/tools/greetings/responses.d.ts +251 -0
  22. package/build/commands/tools/greetings/responses.js +29 -0
  23. package/build/commands/tools/index.d.ts +1 -0
  24. package/build/commands/tools/index.js +1 -0
  25. package/build/constants/cabinet/enums/statistics-request-type.enum.d.ts +1 -0
  26. package/build/constants/cabinet/enums/statistics-request-type.enum.js +1 -0
  27. package/build/constants/content-report/enums/content-report-target-type.enum.d.ts +1 -0
  28. package/build/constants/tool/enums/greetings-kind.enum.d.ts +12 -0
  29. package/build/constants/tool/enums/greetings-kind.enum.js +17 -0
  30. package/build/constants/tool/enums/index.d.ts +1 -0
  31. package/build/constants/tool/enums/index.js +1 -0
  32. package/build/constants/tool/enums/tool-content-type.enum.d.ts +1 -0
  33. package/build/constants/tool/enums/tool-content-type.enum.js +1 -0
  34. package/build/greetings/index.d.ts +4 -0
  35. package/build/greetings/index.js +20 -0
  36. package/build/index.d.ts +1 -0
  37. package/build/index.js +1 -0
  38. package/build/models/content-report.schema.d.ts +1 -0
  39. package/build/models/index.d.ts +1 -0
  40. package/build/models/index.js +1 -0
  41. package/build/models/partner-codes/index.d.ts +1 -0
  42. package/build/models/partner-codes/index.js +17 -0
  43. package/build/models/partner-codes/partner-codes.schema.d.ts +739 -0
  44. package/build/models/partner-codes/partner-codes.schema.js +347 -0
  45. package/build/models/tools/greetings/greeting-config.schema.d.ts +70 -0
  46. package/build/models/tools/greetings/greeting-config.schema.js +35 -0
  47. package/build/models/tools/greetings/greeting-input.schema.d.ts +49 -0
  48. package/build/models/tools/greetings/greeting-input.schema.js +27 -0
  49. package/build/models/tools/greetings/greeting-job.schema.d.ts +94 -0
  50. package/build/models/tools/greetings/greeting-job.schema.js +23 -0
  51. package/build/models/tools/greetings/greeting-result.schema.d.ts +43 -0
  52. package/build/models/tools/greetings/greeting-result.schema.js +32 -0
  53. package/build/models/tools/greetings/index.d.ts +4 -0
  54. package/build/models/tools/greetings/index.js +20 -0
  55. package/build/models/tools/index.d.ts +1 -0
  56. package/build/models/tools/index.js +1 -0
  57. package/package.json +2 -2
@@ -0,0 +1,347 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PartnerCloseResultSchema = exports.PartnerReportSchema = exports.PartnerClosedSnapshotSchema = exports.PartnerReportDaySchema = exports.PartnerReportGroupSchema = exports.PartnerReportRowSchema = exports.PartnerReportTotalsSchema = exports.PartnerAttemptSchema = exports.PartnerCodeActivateSchema = exports.PartnerCodeCheckSchema = exports.PartnerCodeEligibilitySchema = exports.PartnerCodeGrantSchema = exports.PartnerCodeOriginSchema = exports.PartnerCodeInputSchema = exports.PartnerLeakCreateSchema = exports.PartnerLeakRequestSchema = exports.PartnerExportChallengeVerifySchema = exports.PartnerExportChallengeRequestSchema = exports.PartnerExportChallengeSchema = exports.PartnerInviteErrorSchema = exports.PartnerInviteListSchema = exports.PartnerInviteRevokeSchema = exports.PartnerInviteAcceptSchema = exports.PartnerInviteSendSchema = exports.PartnerInviteSchema = exports.PartnerCodeListQuerySchema = exports.PartnerBatchListQuerySchema = exports.PartnerPageQuerySchema = exports.PartnerExportHistorySchema = exports.PartnerExportAuditSchema = exports.PartnerCodeSchema = exports.PartnerBatchSchema = exports.PartnerIssueRequestSchema = exports.PartnerOfferSchema = exports.PartnerMembershipSchema = exports.PartnerCompanySchema = exports.PartnerProductSchema = exports.PartnerAttemptResultSchema = exports.PartnerBatchStatusSchema = exports.PartnerCodeStatusSchema = exports.PartnerCommissionConditionsSchema = exports.PartnerCommissionTypeSchema = exports.PartnerRoleSchema = exports.PartnerMonthSchema = exports.PartnerCommissionValueSchema = exports.PartnerReportMoneySchema = exports.PartnerCommissionMoneySchema = exports.PartnerMoneySchema = void 0;
4
+ exports.validPartnerCommission = validPartnerCommission;
5
+ const zod_1 = require("zod");
6
+ exports.PartnerMoneySchema = zod_1.z.string().regex(/^(0|[1-9]\d{0,21})\.\d{2}$/);
7
+ // Financial storage widths remain independent of the percent range (0–100).
8
+ exports.PartnerCommissionMoneySchema = zod_1.z.string().regex(/^(0|[1-9]\d{0,25})\.\d{2}$/);
9
+ // Decimal(38,2) totals also cover the existing signed-int activation count range.
10
+ exports.PartnerReportMoneySchema = zod_1.z.string().regex(/^(0|[1-9]\d{0,35})\.\d{2}$/);
11
+ exports.PartnerCommissionValueSchema = zod_1.z.string().regex(/^(0|[1-9]\d{0,11})(\.\d{1,6})?$/);
12
+ exports.PartnerMonthSchema = zod_1.z.string().regex(/^\d{4}-(0[1-9]|1[0-2])$/);
13
+ exports.PartnerRoleSchema = zod_1.z.enum(['owner', 'manager']);
14
+ exports.PartnerCommissionTypeSchema = zod_1.z.enum(['fixed', 'percent']);
15
+ function validPartnerCommission(conditions) {
16
+ if (!exports.PartnerCommissionTypeSchema.safeParse(conditions.commissionType).success ||
17
+ !exports.PartnerCommissionValueSchema.safeParse(conditions.commissionValue).success)
18
+ return false;
19
+ if (conditions.commissionType === 'fixed')
20
+ return true;
21
+ const [whole, fraction = ''] = conditions.commissionValue.split('.');
22
+ // The integer part is at most 12 digits; inspect the fraction separately to
23
+ // avoid losing the six-decimal boundary through floating-point conversion.
24
+ return Number(whole) < 100 || (Number(whole) === 100 && !/[1-9]/.test(fraction));
25
+ }
26
+ exports.PartnerCommissionConditionsSchema = zod_1.z
27
+ .object({
28
+ commissionType: exports.PartnerCommissionTypeSchema,
29
+ commissionValue: exports.PartnerCommissionValueSchema,
30
+ })
31
+ .strict()
32
+ .refine(validPartnerCommission, { message: 'Invalid partner commission conditions' });
33
+ exports.PartnerCodeStatusSchema = zod_1.z.enum(['issued', 'activated', 'revoked', 'expired']);
34
+ exports.PartnerBatchStatusSchema = zod_1.z.enum(['active', 'revoked', 'expired']);
35
+ exports.PartnerAttemptResultSchema = zod_1.z.enum([
36
+ 'ok',
37
+ 'not_found',
38
+ 'used',
39
+ 'revoked',
40
+ 'expired',
41
+ 'rate_limited',
42
+ ]);
43
+ exports.PartnerProductSchema = zod_1.z.discriminatedUnion('kind', [
44
+ zod_1.z
45
+ .object({
46
+ kind: zod_1.z.literal('subscription'),
47
+ title: zod_1.z.string(),
48
+ subscriptionId: zod_1.z.uuid(),
49
+ durationMonths: zod_1.z.number().int().positive(),
50
+ })
51
+ .strict(),
52
+ zod_1.z
53
+ .object({
54
+ kind: zod_1.z.literal('stars'),
55
+ title: zod_1.z.string(),
56
+ starsAmount: exports.PartnerMoneySchema,
57
+ })
58
+ .strict(),
59
+ ]);
60
+ exports.PartnerCompanySchema = zod_1.z
61
+ .object({
62
+ uuid: zod_1.z.uuid(),
63
+ name: zod_1.z.string(),
64
+ code: zod_1.z.string(),
65
+ status: zod_1.z.enum(['active', 'disabled']),
66
+ createdAt: zod_1.z.iso.datetime(),
67
+ })
68
+ .strict();
69
+ exports.PartnerMembershipSchema = zod_1.z
70
+ .object({
71
+ uuid: zod_1.z.uuid(),
72
+ partnerId: zod_1.z.uuid(),
73
+ userId: zod_1.z.uuid(),
74
+ role: exports.PartnerRoleSchema,
75
+ createdAt: zod_1.z.iso.datetime(),
76
+ })
77
+ .strict();
78
+ exports.PartnerOfferSchema = zod_1.z
79
+ .object({
80
+ uuid: zod_1.z.uuid(),
81
+ partnerId: zod_1.z.uuid(),
82
+ product: exports.PartnerProductSchema,
83
+ retailPrice: exports.PartnerMoneySchema,
84
+ commissionType: exports.PartnerCommissionTypeSchema,
85
+ commissionValue: exports.PartnerCommissionValueSchema,
86
+ maxOutstanding: zod_1.z.number().int().nonnegative(),
87
+ codeTtlDays: zod_1.z.number().int().positive(),
88
+ active: zod_1.z.boolean(),
89
+ outstanding: zod_1.z.number().int().nonnegative(),
90
+ availableQuantity: zod_1.z.number().int().nonnegative(),
91
+ })
92
+ .strict()
93
+ .refine(validPartnerCommission, { message: 'Invalid partner commission conditions' });
94
+ exports.PartnerIssueRequestSchema = zod_1.z
95
+ .object({
96
+ offerId: zod_1.z.uuid(),
97
+ quantity: zod_1.z.number().int().min(1).max(10000),
98
+ })
99
+ .strict();
100
+ exports.PartnerBatchSchema = zod_1.z
101
+ .object({
102
+ uuid: zod_1.z.uuid(),
103
+ partnerId: zod_1.z.uuid(),
104
+ offerId: zod_1.z.uuid(),
105
+ product: exports.PartnerProductSchema,
106
+ quantity: zod_1.z.number().int().min(1).max(10000),
107
+ status: exports.PartnerBatchStatusSchema,
108
+ expiresAt: zod_1.z.iso.datetime(),
109
+ createdAt: zod_1.z.iso.datetime(),
110
+ createdByUserId: zod_1.z.uuid().nullable(),
111
+ exportCount: zod_1.z.number().int().nonnegative(),
112
+ lastExportedAt: zod_1.z.iso.datetime().nullable(),
113
+ activatedCount: zod_1.z.number().int().nonnegative(),
114
+ remainingCount: zod_1.z.number().int().nonnegative(),
115
+ })
116
+ .strict();
117
+ exports.PartnerCodeSchema = zod_1.z
118
+ .object({
119
+ uuid: zod_1.z.uuid(),
120
+ batchId: zod_1.z.uuid(),
121
+ serial: zod_1.z.string(),
122
+ status: exports.PartnerCodeStatusSchema,
123
+ activatedAt: zod_1.z.iso.datetime().nullable(),
124
+ })
125
+ .strict();
126
+ exports.PartnerExportAuditSchema = zod_1.z
127
+ .object({
128
+ uuid: zod_1.z.uuid(),
129
+ batchId: zod_1.z.uuid(),
130
+ userId: zod_1.z.uuid().nullable(),
131
+ ip: zod_1.z.string(),
132
+ createdAt: zod_1.z.iso.datetime(),
133
+ })
134
+ .strict();
135
+ exports.PartnerExportHistorySchema = zod_1.z.object({ createdAt: zod_1.z.iso.datetime() }).strict();
136
+ exports.PartnerPageQuerySchema = zod_1.z
137
+ .object({
138
+ page: zod_1.z.number().int().min(1).default(1),
139
+ pageSize: zod_1.z.number().int().min(1).max(100).default(20),
140
+ })
141
+ .strict();
142
+ exports.PartnerBatchListQuerySchema = exports.PartnerPageQuerySchema.extend({
143
+ offerId: zod_1.z.uuid().optional(),
144
+ status: exports.PartnerBatchStatusSchema.optional(),
145
+ });
146
+ exports.PartnerCodeListQuerySchema = exports.PartnerPageQuerySchema.extend({
147
+ pageSize: exports.PartnerPageQuerySchema.shape.pageSize.removeDefault().default(50),
148
+ status: exports.PartnerCodeStatusSchema.optional(),
149
+ serial: zod_1.z.string().max(128).optional(),
150
+ });
151
+ exports.PartnerInviteSchema = zod_1.z
152
+ .object({
153
+ uuid: zod_1.z.uuid(),
154
+ partnerId: zod_1.z.uuid(),
155
+ recipientUserId: zod_1.z.uuid(),
156
+ recipientEmail: zod_1.z.email(),
157
+ sentByUserId: zod_1.z.uuid().nullable(),
158
+ role: exports.PartnerRoleSchema,
159
+ status: zod_1.z.enum(['pending', 'accepted', 'revoked', 'expired']),
160
+ expiresAt: zod_1.z.iso.datetime(),
161
+ acceptedAt: zod_1.z.iso.datetime().nullable(),
162
+ revokedAt: zod_1.z.iso.datetime().nullable(),
163
+ createdAt: zod_1.z.iso.datetime(),
164
+ })
165
+ .strict();
166
+ exports.PartnerInviteSendSchema = zod_1.z
167
+ .object({ email: zod_1.z.email(), role: exports.PartnerRoleSchema })
168
+ .strict();
169
+ // Input secrets belong exclusively to sensitive endpoint DTOs, never to ordinary read models.
170
+ exports.PartnerInviteAcceptSchema = zod_1.z
171
+ .object({ purpose: zod_1.z.literal('partner_invite'), token: zod_1.z.string().min(32).max(512) })
172
+ .strict();
173
+ exports.PartnerInviteRevokeSchema = zod_1.z.object({ inviteId: zod_1.z.uuid() }).strict();
174
+ exports.PartnerInviteListSchema = zod_1.z.object({ items: zod_1.z.array(exports.PartnerInviteSchema) }).strict();
175
+ exports.PartnerInviteErrorSchema = zod_1.z.enum([
176
+ 'user_not_found',
177
+ 'already_member',
178
+ 'invalid_invite',
179
+ 'forbidden',
180
+ ]);
181
+ exports.PartnerExportChallengeSchema = zod_1.z
182
+ .object({
183
+ purpose: zod_1.z.literal('partner_code_export'),
184
+ challengeId: zod_1.z.uuid(),
185
+ batchId: zod_1.z.uuid(),
186
+ expiresAt: zod_1.z.iso.datetime(),
187
+ resendAt: zod_1.z.iso.datetime(),
188
+ })
189
+ .strict();
190
+ exports.PartnerExportChallengeRequestSchema = zod_1.z.object({ batchId: zod_1.z.uuid() }).strict();
191
+ exports.PartnerExportChallengeVerifySchema = zod_1.z
192
+ .object({
193
+ purpose: zod_1.z.literal('partner_code_export'),
194
+ challengeId: zod_1.z.uuid(),
195
+ otp: zod_1.z.string().regex(/^\d{6}$/),
196
+ })
197
+ .strict();
198
+ exports.PartnerLeakRequestSchema = zod_1.z
199
+ .object({
200
+ uuid: zod_1.z.uuid(),
201
+ partnerId: zod_1.z.uuid(),
202
+ batchId: zod_1.z.uuid(),
203
+ comment: zod_1.z.string(),
204
+ createdByUserId: zod_1.z.uuid().nullable(),
205
+ createdAt: zod_1.z.iso.datetime(),
206
+ status: zod_1.z.enum(['open', 'resolved']),
207
+ })
208
+ .strict();
209
+ exports.PartnerLeakCreateSchema = zod_1.z
210
+ .object({ batchId: zod_1.z.uuid(), comment: zod_1.z.string().min(1).max(5000) })
211
+ .strict();
212
+ exports.PartnerCodeInputSchema = zod_1.z
213
+ .object({ code: zod_1.z.string().max(128), captchaToken: zod_1.z.string().max(4096).optional() })
214
+ .strict();
215
+ exports.PartnerCodeOriginSchema = zod_1.z
216
+ .object({
217
+ type: zod_1.z.literal('activation_code'),
218
+ codeId: zod_1.z.uuid(),
219
+ serial: zod_1.z.string(),
220
+ partnerId: zod_1.z.uuid(),
221
+ })
222
+ .strict();
223
+ exports.PartnerCodeGrantSchema = zod_1.z
224
+ .object({
225
+ uuid: zod_1.z.uuid(),
226
+ origin: exports.PartnerCodeOriginSchema,
227
+ product: exports.PartnerProductSchema,
228
+ state: zod_1.z.enum(['active', 'queued']),
229
+ startsAt: zod_1.z.iso.datetime(),
230
+ endsAt: zod_1.z.iso.datetime(),
231
+ })
232
+ .strict();
233
+ exports.PartnerCodeEligibilitySchema = zod_1.z.discriminatedUnion('state', [
234
+ zod_1.z.object({ state: zod_1.z.literal('guest') }).strict(),
235
+ zod_1.z
236
+ .object({
237
+ state: zod_1.z.literal('allowed'),
238
+ preview: exports.PartnerCodeGrantSchema.omit({ uuid: true, origin: true }),
239
+ })
240
+ .strict(),
241
+ zod_1.z
242
+ .object({
243
+ state: zod_1.z.literal('blocked'),
244
+ reason: zod_1.z.literal('auto_renewal_enabled'),
245
+ // Conditional period only; redemption owns calculation and explicit cancellation.
246
+ preview: exports.PartnerCodeGrantSchema.omit({ uuid: true, origin: true }),
247
+ })
248
+ .strict(),
249
+ ]);
250
+ exports.PartnerCodeCheckSchema = zod_1.z.discriminatedUnion('validity', [
251
+ zod_1.z
252
+ .object({
253
+ validity: zod_1.z.literal('valid'),
254
+ product: exports.PartnerProductSchema,
255
+ eligibility: exports.PartnerCodeEligibilitySchema,
256
+ })
257
+ .strict(),
258
+ zod_1.z
259
+ .object({
260
+ validity: zod_1.z.enum(['not_found', 'used', 'revoked', 'expired', 'disabled']),
261
+ captchaRequired: zod_1.z.boolean(),
262
+ retryAfter: zod_1.z.number().int().nonnegative().optional(),
263
+ })
264
+ .strict(),
265
+ ]);
266
+ exports.PartnerCodeActivateSchema = zod_1.z.discriminatedUnion('result', [
267
+ zod_1.z
268
+ .object({ result: zod_1.z.literal('ok'), grant: exports.PartnerCodeGrantSchema, idempotent: zod_1.z.boolean() })
269
+ .strict(),
270
+ zod_1.z
271
+ .object({
272
+ result: zod_1.z.literal('error'),
273
+ reason: zod_1.z.enum([
274
+ 'not_found',
275
+ 'used',
276
+ 'revoked',
277
+ 'expired',
278
+ 'disabled',
279
+ 'auto_renewal_enabled',
280
+ 'rate_limited',
281
+ ]),
282
+ retryAfter: zod_1.z.number().int().nonnegative().optional(),
283
+ })
284
+ .strict(),
285
+ ]);
286
+ exports.PartnerAttemptSchema = zod_1.z
287
+ .object({
288
+ uuid: zod_1.z.uuid(),
289
+ ip: zod_1.z.string(),
290
+ userId: zod_1.z.uuid().nullable(),
291
+ result: exports.PartnerAttemptResultSchema,
292
+ createdAt: zod_1.z.iso.datetime(),
293
+ })
294
+ .strict();
295
+ exports.PartnerReportTotalsSchema = zod_1.z
296
+ .object({
297
+ activationsCount: zod_1.z.number().int().nonnegative(),
298
+ retailTotal: exports.PartnerReportMoneySchema,
299
+ commissionTotal: exports.PartnerReportMoneySchema,
300
+ })
301
+ .strict();
302
+ exports.PartnerReportRowSchema = zod_1.z
303
+ .object({
304
+ codeId: zod_1.z.uuid(),
305
+ serial: zod_1.z.string(),
306
+ product: exports.PartnerProductSchema,
307
+ activatedAt: zod_1.z.iso.datetime(),
308
+ retailPrice: exports.PartnerMoneySchema,
309
+ commission: exports.PartnerCommissionMoneySchema,
310
+ commissionType: exports.PartnerCommissionTypeSchema,
311
+ commissionValue: exports.PartnerCommissionValueSchema,
312
+ })
313
+ .strict()
314
+ .refine(validPartnerCommission, { message: 'Invalid partner commission conditions' });
315
+ exports.PartnerReportGroupSchema = exports.PartnerReportTotalsSchema.extend({
316
+ product: exports.PartnerProductSchema,
317
+ retailPrice: exports.PartnerMoneySchema,
318
+ commission: exports.PartnerCommissionMoneySchema,
319
+ commissionType: exports.PartnerCommissionTypeSchema,
320
+ commissionValue: exports.PartnerCommissionValueSchema,
321
+ }).refine(validPartnerCommission, { message: 'Invalid partner commission conditions' });
322
+ exports.PartnerReportDaySchema = exports.PartnerReportTotalsSchema.extend({
323
+ day: zod_1.z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
324
+ });
325
+ exports.PartnerClosedSnapshotSchema = zod_1.z
326
+ .object({
327
+ version: zod_1.z.literal(1),
328
+ partnerId: zod_1.z.uuid(),
329
+ month: exports.PartnerMonthSchema,
330
+ summary: exports.PartnerReportTotalsSchema,
331
+ groups: zod_1.z.array(exports.PartnerReportGroupSchema),
332
+ days: zod_1.z.array(exports.PartnerReportDaySchema),
333
+ rows: zod_1.z.array(exports.PartnerReportRowSchema),
334
+ })
335
+ .strict();
336
+ exports.PartnerReportSchema = exports.PartnerClosedSnapshotSchema.extend({
337
+ status: zod_1.z.enum(['open', 'closed']),
338
+ closedAt: zod_1.z.iso.datetime().nullable(),
339
+ dataVersion: zod_1.z.string(),
340
+ });
341
+ exports.PartnerCloseResultSchema = zod_1.z
342
+ .object({
343
+ periodId: zod_1.z.uuid(),
344
+ alreadyClosed: zod_1.z.boolean(),
345
+ report: exports.PartnerReportSchema,
346
+ })
347
+ .strict();
@@ -0,0 +1,70 @@
1
+ import { z } from 'zod';
2
+ import { GREETINGS_KIND } from '../../../constants';
3
+ export declare const GreetingOptionSchema: z.ZodObject<{
4
+ uuid: z.ZodUUID;
5
+ title: z.ZodString;
6
+ order: z.ZodInt;
7
+ }, z.core.$strip>;
8
+ export declare const GreetingModelSchema: z.ZodObject<{
9
+ uuid: z.ZodUUID;
10
+ title: z.ZodString;
11
+ description: z.ZodOptional<z.ZodString>;
12
+ kind: z.ZodEnum<typeof GREETINGS_KIND>;
13
+ order: z.ZodInt;
14
+ sourceModelId: z.ZodUUID;
15
+ sourceModelType: z.ZodEnum<typeof GREETINGS_KIND>;
16
+ durations: z.ZodArray<z.ZodInt>;
17
+ aspectRatios: z.ZodArray<z.ZodString>;
18
+ defaultDuration: z.ZodNullable<z.ZodInt>;
19
+ defaultAspectRatio: z.ZodNullable<z.ZodString>;
20
+ supportsReference: z.ZodBoolean;
21
+ maxAttachedImages: z.ZodInt;
22
+ maxPromptLength: z.ZodInt;
23
+ maxProviderPromptLength: z.ZodOptional<z.ZodInt>;
24
+ }, z.core.$strip>;
25
+ export type GreetingModel = z.infer<typeof GreetingModelSchema>;
26
+ export declare const GreetingConfigSchema: z.ZodObject<{
27
+ models: z.ZodArray<z.ZodObject<{
28
+ uuid: z.ZodUUID;
29
+ title: z.ZodString;
30
+ description: z.ZodOptional<z.ZodString>;
31
+ kind: z.ZodEnum<typeof GREETINGS_KIND>;
32
+ order: z.ZodInt;
33
+ sourceModelId: z.ZodUUID;
34
+ sourceModelType: z.ZodEnum<typeof GREETINGS_KIND>;
35
+ durations: z.ZodArray<z.ZodInt>;
36
+ aspectRatios: z.ZodArray<z.ZodString>;
37
+ defaultDuration: z.ZodNullable<z.ZodInt>;
38
+ defaultAspectRatio: z.ZodNullable<z.ZodString>;
39
+ supportsReference: z.ZodBoolean;
40
+ maxAttachedImages: z.ZodInt;
41
+ maxPromptLength: z.ZodInt;
42
+ maxProviderPromptLength: z.ZodOptional<z.ZodInt>;
43
+ }, z.core.$strip>>;
44
+ textLengths: z.ZodArray<z.ZodObject<{
45
+ uuid: z.ZodUUID;
46
+ title: z.ZodString;
47
+ order: z.ZodInt;
48
+ }, z.core.$strip>>;
49
+ textFormats: z.ZodArray<z.ZodObject<{
50
+ uuid: z.ZodUUID;
51
+ title: z.ZodString;
52
+ order: z.ZodInt;
53
+ }, z.core.$strip>>;
54
+ musicStyles: z.ZodArray<z.ZodObject<{
55
+ uuid: z.ZodUUID;
56
+ title: z.ZodString;
57
+ order: z.ZodInt;
58
+ }, z.core.$strip>>;
59
+ videoStyles: z.ZodArray<z.ZodObject<{
60
+ uuid: z.ZodUUID;
61
+ title: z.ZodString;
62
+ order: z.ZodInt;
63
+ }, z.core.$strip>>;
64
+ imageStyles: z.ZodArray<z.ZodObject<{
65
+ uuid: z.ZodUUID;
66
+ title: z.ZodString;
67
+ order: z.ZodInt;
68
+ }, z.core.$strip>>;
69
+ }, z.core.$strip>;
70
+ export type GreetingConfig = z.infer<typeof GreetingConfigSchema>;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GreetingConfigSchema = exports.GreetingModelSchema = exports.GreetingOptionSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const constants_1 = require("../../../constants");
6
+ exports.GreetingOptionSchema = zod_1.z.object({
7
+ uuid: zod_1.z.uuid(),
8
+ title: zod_1.z.string(),
9
+ order: zod_1.z.int(),
10
+ });
11
+ exports.GreetingModelSchema = zod_1.z.object({
12
+ uuid: zod_1.z.uuid(),
13
+ title: zod_1.z.string(),
14
+ description: zod_1.z.string().optional(),
15
+ kind: zod_1.z.nativeEnum(constants_1.GREETINGS_KIND),
16
+ order: zod_1.z.int(),
17
+ sourceModelId: zod_1.z.uuid(),
18
+ sourceModelType: zod_1.z.enum(constants_1.GREETINGS_KIND),
19
+ durations: zod_1.z.array(zod_1.z.int()),
20
+ aspectRatios: zod_1.z.array(zod_1.z.string()),
21
+ defaultDuration: zod_1.z.int().nullable(),
22
+ defaultAspectRatio: zod_1.z.string().nullable(),
23
+ supportsReference: zod_1.z.boolean(),
24
+ maxAttachedImages: zod_1.z.int().nonnegative(),
25
+ maxPromptLength: zod_1.z.int(),
26
+ maxProviderPromptLength: zod_1.z.int().positive().optional(),
27
+ });
28
+ exports.GreetingConfigSchema = zod_1.z.object({
29
+ models: zod_1.z.array(exports.GreetingModelSchema),
30
+ textLengths: zod_1.z.array(exports.GreetingOptionSchema),
31
+ textFormats: zod_1.z.array(exports.GreetingOptionSchema),
32
+ musicStyles: zod_1.z.array(exports.GreetingOptionSchema),
33
+ videoStyles: zod_1.z.array(exports.GreetingOptionSchema),
34
+ imageStyles: zod_1.z.array(exports.GreetingOptionSchema),
35
+ });
@@ -0,0 +1,49 @@
1
+ import { z } from 'zod';
2
+ import { LOCALE } from '@purpleschool/rugpt-lib-common';
3
+ import { GREETINGS_KIND } from '../../../constants';
4
+ export declare const GreetingInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
5
+ modelId: z.ZodUUID;
6
+ prompt: z.ZodString;
7
+ locale: z.ZodDefault<z.ZodEnum<typeof LOCALE>>;
8
+ kind: z.ZodLiteral<GREETINGS_KIND.TEXT>;
9
+ settings: z.ZodObject<{
10
+ lengthId: z.ZodUUID;
11
+ formatId: z.ZodUUID;
12
+ }, z.core.$strict>;
13
+ }, z.core.$strict>, z.ZodObject<{
14
+ modelId: z.ZodUUID;
15
+ prompt: z.ZodString;
16
+ locale: z.ZodDefault<z.ZodEnum<typeof LOCALE>>;
17
+ kind: z.ZodLiteral<GREETINGS_KIND.SONG>;
18
+ settings: z.ZodObject<{
19
+ styleId: z.ZodOptional<z.ZodUUID>;
20
+ customStyle: z.ZodOptional<z.ZodString>;
21
+ voice: z.ZodDefault<z.ZodEnum<{
22
+ f: "f";
23
+ m: "m";
24
+ }>>;
25
+ }, z.core.$strict>;
26
+ }, z.core.$strict>, z.ZodObject<{
27
+ modelId: z.ZodUUID;
28
+ prompt: z.ZodString;
29
+ locale: z.ZodDefault<z.ZodEnum<typeof LOCALE>>;
30
+ kind: z.ZodLiteral<GREETINGS_KIND.VIDEO>;
31
+ settings: z.ZodObject<{
32
+ styleId: z.ZodOptional<z.ZodUUID>;
33
+ customStyle: z.ZodOptional<z.ZodString>;
34
+ imageUrls: z.ZodOptional<z.ZodArray<z.ZodURL>>;
35
+ duration: z.ZodInt;
36
+ }, z.core.$strict>;
37
+ }, z.core.$strict>, z.ZodObject<{
38
+ modelId: z.ZodUUID;
39
+ prompt: z.ZodString;
40
+ locale: z.ZodDefault<z.ZodEnum<typeof LOCALE>>;
41
+ kind: z.ZodLiteral<GREETINGS_KIND.IMAGE>;
42
+ settings: z.ZodObject<{
43
+ styleId: z.ZodOptional<z.ZodUUID>;
44
+ customStyle: z.ZodOptional<z.ZodString>;
45
+ imageUrls: z.ZodOptional<z.ZodArray<z.ZodURL>>;
46
+ aspectRatio: z.ZodString;
47
+ }, z.core.$strict>;
48
+ }, z.core.$strict>], "kind">;
49
+ export type GreetingInput = z.infer<typeof GreetingInputSchema>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GreetingInputSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const rugpt_lib_common_1 = require("@purpleschool/rugpt-lib-common");
6
+ const constants_1 = require("../../../constants");
7
+ const styleFields = {
8
+ styleId: zod_1.z.uuid().optional(),
9
+ customStyle: zod_1.z.string().trim().max(200).optional(),
10
+ };
11
+ const referenceFields = {
12
+ imageUrls: zod_1.z
13
+ .array(zod_1.z.url())
14
+ .refine((urls) => new Set(urls).size === urls.length)
15
+ .optional(),
16
+ };
17
+ const baseFields = {
18
+ modelId: zod_1.z.uuid(),
19
+ prompt: zod_1.z.string().trim().min(1).max(10000),
20
+ locale: zod_1.z.enum(rugpt_lib_common_1.LOCALE).default(rugpt_lib_common_1.LOCALE.RU),
21
+ };
22
+ exports.GreetingInputSchema = zod_1.z.discriminatedUnion('kind', [
23
+ zod_1.z.strictObject(Object.assign(Object.assign({}, baseFields), { kind: zod_1.z.literal(constants_1.GREETINGS_KIND.TEXT), settings: zod_1.z.strictObject({ lengthId: zod_1.z.uuid(), formatId: zod_1.z.uuid() }) })),
24
+ zod_1.z.strictObject(Object.assign(Object.assign({}, baseFields), { kind: zod_1.z.literal(constants_1.GREETINGS_KIND.SONG), settings: zod_1.z.strictObject(Object.assign(Object.assign({}, styleFields), { voice: zod_1.z.enum(['m', 'f']).default('f') })) })),
25
+ zod_1.z.strictObject(Object.assign(Object.assign({}, baseFields), { kind: zod_1.z.literal(constants_1.GREETINGS_KIND.VIDEO), settings: zod_1.z.strictObject(Object.assign(Object.assign(Object.assign({}, styleFields), referenceFields), { duration: zod_1.z.int().positive() })) })),
26
+ zod_1.z.strictObject(Object.assign(Object.assign({}, baseFields), { kind: zod_1.z.literal(constants_1.GREETINGS_KIND.IMAGE), settings: zod_1.z.strictObject(Object.assign(Object.assign(Object.assign({}, styleFields), referenceFields), { aspectRatio: zod_1.z.string().min(1) })) })),
27
+ ]);
@@ -0,0 +1,94 @@
1
+ import { z } from 'zod';
2
+ import { GREETINGS_KIND, GREETINGS_STATUS, USER_REACTION } from '../../../constants';
3
+ export declare const GreetingJobSchema: z.ZodObject<{
4
+ uuid: z.ZodUUID;
5
+ isFavorite: z.ZodDefault<z.ZodBoolean>;
6
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7
+ reaction: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof USER_REACTION>>>;
8
+ kind: z.ZodEnum<typeof GREETINGS_KIND>;
9
+ modelId: z.ZodUUID;
10
+ input: z.ZodDiscriminatedUnion<[z.ZodObject<{
11
+ modelId: z.ZodUUID;
12
+ prompt: z.ZodString;
13
+ locale: z.ZodDefault<z.ZodEnum<typeof import("@purpleschool/rugpt-lib-common").LOCALE>>;
14
+ kind: z.ZodLiteral<GREETINGS_KIND.TEXT>;
15
+ settings: z.ZodObject<{
16
+ lengthId: z.ZodUUID;
17
+ formatId: z.ZodUUID;
18
+ }, z.core.$strict>;
19
+ }, z.core.$strict>, z.ZodObject<{
20
+ modelId: z.ZodUUID;
21
+ prompt: z.ZodString;
22
+ locale: z.ZodDefault<z.ZodEnum<typeof import("@purpleschool/rugpt-lib-common").LOCALE>>;
23
+ kind: z.ZodLiteral<GREETINGS_KIND.SONG>;
24
+ settings: z.ZodObject<{
25
+ styleId: z.ZodOptional<z.ZodUUID>;
26
+ customStyle: z.ZodOptional<z.ZodString>;
27
+ voice: z.ZodDefault<z.ZodEnum<{
28
+ f: "f";
29
+ m: "m";
30
+ }>>;
31
+ }, z.core.$strict>;
32
+ }, z.core.$strict>, z.ZodObject<{
33
+ modelId: z.ZodUUID;
34
+ prompt: z.ZodString;
35
+ locale: z.ZodDefault<z.ZodEnum<typeof import("@purpleschool/rugpt-lib-common").LOCALE>>;
36
+ kind: z.ZodLiteral<GREETINGS_KIND.VIDEO>;
37
+ settings: z.ZodObject<{
38
+ styleId: z.ZodOptional<z.ZodUUID>;
39
+ customStyle: z.ZodOptional<z.ZodString>;
40
+ imageUrls: z.ZodOptional<z.ZodArray<z.ZodURL>>;
41
+ duration: z.ZodInt;
42
+ }, z.core.$strict>;
43
+ }, z.core.$strict>, z.ZodObject<{
44
+ modelId: z.ZodUUID;
45
+ prompt: z.ZodString;
46
+ locale: z.ZodDefault<z.ZodEnum<typeof import("@purpleschool/rugpt-lib-common").LOCALE>>;
47
+ kind: z.ZodLiteral<GREETINGS_KIND.IMAGE>;
48
+ settings: z.ZodObject<{
49
+ styleId: z.ZodOptional<z.ZodUUID>;
50
+ customStyle: z.ZodOptional<z.ZodString>;
51
+ imageUrls: z.ZodOptional<z.ZodArray<z.ZodURL>>;
52
+ aspectRatio: z.ZodString;
53
+ }, z.core.$strict>;
54
+ }, z.core.$strict>], "kind">;
55
+ status: z.ZodEnum<typeof GREETINGS_STATUS>;
56
+ currentAttemptId: z.ZodUUID;
57
+ price: z.ZodInt;
58
+ result: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
59
+ kind: z.ZodLiteral<GREETINGS_KIND.TEXT>;
60
+ text: z.ZodString;
61
+ }, z.core.$strip>, z.ZodObject<{
62
+ kind: z.ZodLiteral<GREETINGS_KIND.SONG>;
63
+ tracks: z.ZodArray<z.ZodObject<{
64
+ id: z.ZodString;
65
+ title: z.ZodString;
66
+ audioUrl: z.ZodURL;
67
+ imageUrl: z.ZodOptional<z.ZodURL>;
68
+ duration: z.ZodOptional<z.ZodNumber>;
69
+ lyrics: z.ZodOptional<z.ZodString>;
70
+ }, z.core.$strip>>;
71
+ }, z.core.$strip>, z.ZodObject<{
72
+ kind: z.ZodLiteral<GREETINGS_KIND.VIDEO>;
73
+ video: z.ZodObject<{
74
+ url: z.ZodURL;
75
+ file: z.ZodOptional<z.ZodNullable<z.ZodObject<{
76
+ uuid: z.ZodUUID;
77
+ url: z.ZodString;
78
+ }, z.core.$strip>>>;
79
+ }, z.core.$strip>;
80
+ }, z.core.$strip>, z.ZodObject<{
81
+ kind: z.ZodLiteral<GREETINGS_KIND.IMAGE>;
82
+ image: z.ZodObject<{
83
+ url: z.ZodURL;
84
+ file: z.ZodOptional<z.ZodNullable<z.ZodObject<{
85
+ uuid: z.ZodUUID;
86
+ url: z.ZodString;
87
+ }, z.core.$strip>>>;
88
+ }, z.core.$strip>;
89
+ }, z.core.$strip>], "kind">>;
90
+ error: z.ZodNullable<z.ZodString>;
91
+ createdAt: z.ZodString;
92
+ updatedAt: z.ZodString;
93
+ }, z.core.$strip>;
94
+ export type GreetingJob = z.infer<typeof GreetingJobSchema>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GreetingJobSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const constants_1 = require("../../../constants");
6
+ const greeting_input_schema_1 = require("./greeting-input.schema");
7
+ const greeting_result_schema_1 = require("./greeting-result.schema");
8
+ exports.GreetingJobSchema = zod_1.z.object({
9
+ uuid: zod_1.z.uuid(),
10
+ isFavorite: zod_1.z.boolean().default(false),
11
+ title: zod_1.z.string().nullable().optional(),
12
+ reaction: zod_1.z.enum(constants_1.USER_REACTION).nullable().optional(),
13
+ kind: zod_1.z.nativeEnum(constants_1.GREETINGS_KIND),
14
+ modelId: zod_1.z.uuid(),
15
+ input: greeting_input_schema_1.GreetingInputSchema,
16
+ status: zod_1.z.enum(constants_1.GREETINGS_STATUS),
17
+ currentAttemptId: zod_1.z.uuid(),
18
+ price: zod_1.z.int().nonnegative(),
19
+ result: greeting_result_schema_1.GreetingResultSchema.nullable(),
20
+ error: zod_1.z.string().nullable(),
21
+ createdAt: zod_1.z.string(),
22
+ updatedAt: zod_1.z.string(),
23
+ });