@purpleschool/multisite 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/controller/http/ai-proxy.ts +6 -0
- package/api/controller/http/auth.ts +14 -0
- package/api/controller/http/cloud-payments.ts +5 -0
- package/api/controller/http/file.ts +6 -0
- package/api/controller/http/health.ts +3 -0
- package/api/controller/http/image-editor.ts +15 -0
- package/api/controller/http/image-generation.ts +15 -0
- package/api/controller/http/index.ts +16 -0
- package/api/controller/http/marketplace-card.ts +15 -0
- package/api/controller/http/page-question.ts +9 -0
- package/api/controller/http/page.ts +12 -0
- package/api/controller/http/payment.ts +5 -0
- package/api/controller/http/product.ts +7 -0
- package/api/controller/http/subscription.ts +7 -0
- package/api/controller/http/transaction.ts +5 -0
- package/api/controller/http/unregistered-user.ts +1 -0
- package/api/controller/http/user.ts +5 -0
- package/api/controller/index.ts +1 -0
- package/api/index.ts +2 -0
- package/api/routes.ts +192 -0
- package/build/api/routes.d.ts +60 -1
- package/build/api/routes.d.ts.map +1 -1
- package/build/api/routes.js +60 -1
- package/commands/auth/create-user.command.ts +18 -0
- package/commands/auth/index.ts +9 -0
- package/commands/auth/login.command.ts +17 -0
- package/commands/auth/register.command.ts +20 -0
- package/commands/auth/reset-password.command.ts +19 -0
- package/commands/auth/restore-password.command.ts +16 -0
- package/commands/auth/verify-email-retry.command.ts +17 -0
- package/commands/auth/verify-email.command.ts +18 -0
- package/commands/auth/vk-login.command.ts +21 -0
- package/commands/auth/yandex-login.command.ts +19 -0
- package/commands/file/index.ts +1 -0
- package/commands/file/upload-file.command.ts +9 -0
- package/commands/image-editor/execute-image-editor.command.ts +18 -0
- package/commands/image-editor/index.ts +7 -0
- package/commands/image-editor/proxy-image-editor-callback.command.ts +15 -0
- package/commands/image-editor/retry-image-editor-job.command.ts +17 -0
- package/commands/image-editor/set-reaction-to-image-editor-job.command.ts +18 -0
- package/commands/image-editor/soft-delete-image-editor-job-by-uuid.command.ts +8 -0
- package/commands/image-editor/soft-delete-image-editor-jobs-by-criteria.command.ts +8 -0
- package/commands/image-editor/update-image-editor-job-title.command.ts +16 -0
- package/commands/image-generation/execute-image-generation.command.ts +19 -0
- package/commands/image-generation/index.ts +7 -0
- package/commands/image-generation/proxy-image-generation-callback.command.ts +21 -0
- package/commands/image-generation/retry-image-generation-job.command.ts +19 -0
- package/commands/image-generation/set-reaction-to-image-generation-job.command.ts +28 -0
- package/commands/image-generation/soft-delete-image-generation-job-by-uuid.command.ts +9 -0
- package/commands/image-generation/soft-delete-image-generation-jobs-by-criteria.command.ts +9 -0
- package/commands/image-generation/update-image-generation-job-title.command.ts +16 -0
- package/commands/index.ts +11 -0
- package/commands/marketplace-card/execute-marketplace-card.command.ts +12 -0
- package/commands/marketplace-card/index.ts +6 -0
- package/commands/marketplace-card/retry-marketplace-card-job.command.ts +27 -0
- package/commands/marketplace-card/set-reaction-to-marketplace-card-job.command.ts +21 -0
- package/commands/marketplace-card/soft-delete-marketplace-card-job-by-uuid.command.ts +13 -0
- package/commands/marketplace-card/soft-delete-marketplace-card-jobs-by-criteria.command.ts +8 -0
- package/commands/marketplace-card/update-marketplace-card-job-title.command.ts +19 -0
- package/commands/page/create-page-question.command.ts +18 -0
- package/commands/page/create-page.command.ts +18 -0
- package/commands/page/delete-page-question.command.ts +14 -0
- package/commands/page/delete-page.command.ts +12 -0
- package/commands/page/find-page-by-alias.command.ts +28 -0
- package/commands/page/find-page-by-criteria.command.ts +24 -0
- package/commands/page/find-page.command.ts +22 -0
- package/commands/page/index.ts +9 -0
- package/commands/page/update-page-question.command.ts +24 -0
- package/commands/page/update-page.command.ts +24 -0
- package/commands/payment/cloud-payments.command.ts +53 -0
- package/commands/payment/index.ts +1 -0
- package/commands/product/buy-product.command.ts +19 -0
- package/commands/product/index.ts +1 -0
- package/commands/subscription/buy-subscription.command.ts +19 -0
- package/commands/subscription/index.ts +1 -0
- package/commands/transaction/index.ts +1 -0
- package/commands/transaction/write-off.command.ts +19 -0
- package/commands/unregistered-user/index.ts +1 -0
- package/commands/unregistered-user/upsert-unregistered-user.command.ts +16 -0
- package/constants/common/enums/index.ts +1 -0
- package/constants/common/enums/user-reaction.enum.ts +4 -0
- package/constants/common/index.ts +1 -0
- package/constants/email/email-endpoint.ts +1 -0
- package/constants/email/index.ts +2 -0
- package/constants/email/subjects.ts +12 -0
- package/constants/errors/errors.ts +682 -0
- package/constants/errors/index.ts +1 -0
- package/constants/files/enums/file-type.enum.ts +3 -0
- package/constants/files/enums/index.ts +1 -0
- package/constants/files/index.ts +1 -0
- package/constants/image-editor/enums/image-editing-strategy.enum.ts +9 -0
- package/constants/image-editor/enums/image-editor-model-type.enum.ts +5 -0
- package/constants/image-editor/enums/index.ts +2 -0
- package/constants/image-editor/index.ts +1 -0
- package/constants/image-generation/enums/image-generation-model-strategy.enum.ts +15 -0
- package/constants/image-generation/enums/image-generation-resolution.enum.ts +5 -0
- package/constants/image-generation/enums/index.ts +2 -0
- package/constants/image-generation/index.ts +1 -0
- package/constants/index.ts +15 -0
- package/constants/order/enums/index.ts +2 -0
- package/constants/order/enums/order-status.enum.ts +5 -0
- package/constants/order/enums/order-type.enum.ts +3 -0
- package/constants/order/index.ts +1 -0
- package/constants/page/enums/page-type.enum.ts +5 -0
- package/constants/page/index.ts +1 -0
- package/constants/payment/enums/index.ts +1 -0
- package/constants/payment/enums/payment-status.enum.ts +3 -0
- package/constants/payment/index.ts +1 -0
- package/constants/subscription/free-subscription-id.constant.ts +1 -0
- package/constants/subscription/index.ts +1 -0
- package/constants/tools/enums/index.ts +5 -0
- package/constants/tools/enums/job-request-origin.enum.ts +3 -0
- package/constants/tools/enums/job-status.enum.ts +5 -0
- package/constants/tools/enums/marketplace-card-strategy.enum.ts +6 -0
- package/constants/tools/enums/tool-model-status.enum.ts +4 -0
- package/constants/tools/enums/tool-type.enum.ts +5 -0
- package/constants/tools/index.ts +1 -0
- package/constants/transaction/enums/index.ts +1 -0
- package/constants/transaction/enums/transaction-status.enum.ts +5 -0
- package/constants/transaction/index.ts +1 -0
- package/constants/user/enums/index.ts +3 -0
- package/constants/user/enums/signup-method.enum.ts +6 -0
- package/constants/user/enums/user-role.enum.ts +5 -0
- package/constants/user/enums/user-status.enum.ts +5 -0
- package/constants/user/index.ts +1 -0
- package/constants/user-to-product/enums/index.ts +1 -0
- package/constants/user-to-product/enums/user-to-product-status.enum.ts +3 -0
- package/constants/user-to-product/index.ts +1 -0
- package/constants/user-to-subscription/enums/index.ts +1 -0
- package/constants/user-to-subscription/enums/user-to-subscription-status.enum.ts +3 -0
- package/constants/user-to-subscription/index.ts +1 -0
- package/index.ts +5 -0
- package/models/cloud-payments-widget-data.schema.ts +18 -0
- package/models/cloud-payments-widget.schema.ts +15 -0
- package/models/common/attached-file.schema.ts +13 -0
- package/models/common/icon-variants.schema.ts +12 -0
- package/models/common/index.ts +4 -0
- package/models/common/json-value.schema.ts +10 -0
- package/models/common/receipt.schema.ts +19 -0
- package/models/file.schema.ts +13 -0
- package/models/image-editor/image-editor-config.schema.ts +10 -0
- package/models/image-editor/image-editor-job-params.schema.ts +12 -0
- package/models/image-editor/image-editor-job-request-params.schema.ts +9 -0
- package/models/image-editor/image-editor-job.schema.ts +30 -0
- package/models/image-editor/image-editor-model-params.schema.ts +18 -0
- package/models/image-editor/image-editor-model.schema.ts +28 -0
- package/models/image-editor/image-editor-pricing-rule.schema.ts +14 -0
- package/models/image-editor/image-editor-prompt-group.schema.ts +13 -0
- package/models/image-editor/image-editor-system-prompt.schema.ts +20 -0
- package/models/image-editor/index.ts +9 -0
- package/models/image-generation/image-generation-config.schema.ts +10 -0
- package/models/image-generation/image-generation-job-attempt.schema.ts +11 -0
- package/models/image-generation/image-generation-job-params.schema.ts +11 -0
- package/models/image-generation/image-generation-job-request-params.schema.ts +10 -0
- package/models/image-generation/image-generation-job.schema.ts +30 -0
- package/models/image-generation/image-generation-model-params.schema.ts +22 -0
- package/models/image-generation/image-generation-model.schema.ts +28 -0
- package/models/image-generation/image-generation-preset.schema.ts +10 -0
- package/models/image-generation/image-generation-pricing-rule.schema.ts +19 -0
- package/models/image-generation/image-generation-vendor.schema.ts +9 -0
- package/models/image-generation/index.ts +10 -0
- package/models/index.ts +13 -0
- package/models/marketplace-card/index.ts +6 -0
- package/models/marketplace-card/marketplace-card-config.schema.ts +10 -0
- package/models/marketplace-card/marketplace-card-job-request-params.schema.ts +15 -0
- package/models/marketplace-card/marketplace-card-job.schema.ts +28 -0
- package/models/marketplace-card/marketplace-card-model-params.schema.ts +11 -0
- package/models/marketplace-card/marketplace-card-model.schema.ts +16 -0
- package/models/marketplace-card/marketplace-card-style-preset.schema.ts +10 -0
- package/models/page-question.schema.ts +10 -0
- package/models/page.schema.ts +40 -0
- package/models/product.schema.ts +10 -0
- package/models/subscription.schema.ts +12 -0
- package/models/tools/index.ts +1 -0
- package/models/tools/vendor.schema.ts +11 -0
- package/models/user.schema.ts +11 -0
- package/package.json +1 -7
- package/queries/file/find-files.command.ts +20 -0
- package/queries/file/get-file.command.ts +14 -0
- package/queries/file/index.ts +2 -0
- package/queries/image-editor/find-image-editor-jobs.command.ts +20 -0
- package/queries/image-editor/get-image-editor-config.command.ts +9 -0
- package/queries/image-editor/get-image-editor-job.command.ts +14 -0
- package/queries/image-editor/get-image-editor-price.command.ts +17 -0
- package/queries/image-editor/index.ts +4 -0
- package/queries/image-generation/find-image-generation-jobs.command.ts +20 -0
- package/queries/image-generation/get-image-generation-config.command.ts +9 -0
- package/queries/image-generation/get-image-generation-job.command.ts +14 -0
- package/queries/image-generation/get-image-generation-price.command.ts +19 -0
- package/queries/image-generation/index.ts +4 -0
- package/queries/index.ts +9 -0
- package/queries/marketplace-card/find-marketplace-card-jobs.command.ts +21 -0
- package/queries/marketplace-card/get-marketplace-card-config.command.ts +9 -0
- package/queries/marketplace-card/get-marketplace-card-job.command.ts +14 -0
- package/queries/marketplace-card/get-marketplace-card-price.command.ts +15 -0
- package/queries/marketplace-card/index.ts +4 -0
- package/queries/page/find-all-page-questions.query.ts +14 -0
- package/queries/page/find-page-question-by-uuid.query.ts +16 -0
- package/queries/page/find-page-questions-by-page-id.query.ts +16 -0
- package/queries/page/index.ts +3 -0
- package/queries/payment/get-payment-history.command.ts +17 -0
- package/queries/payment/index.ts +1 -0
- package/queries/product/find-products.command.ts +9 -0
- package/queries/product/index.ts +1 -0
- package/queries/subscription/find-subscriptions.command.ts +9 -0
- package/queries/subscription/index.ts +1 -0
- package/queries/user/get-my-products.command.ts +19 -0
- package/queries/user/get-my-subscriptions.command.ts +21 -0
- package/queries/user/get-user.command.ts +14 -0
- package/queries/user/index.ts +3 -0
- package/tsconfig.json +104 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { IMAGE_GENERATION_MODEL_STRATEGY, TOOL_MODEL_STATUS } from '../../constants';
|
|
3
|
+
import { IconVariantsSchema } from '../common';
|
|
4
|
+
import { ImageGenerationModelParamsSchema } from './image-generation-model-params.schema';
|
|
5
|
+
import { ImageGenerationPricingRulesSchema } from './image-generation-pricing-rule.schema';
|
|
6
|
+
|
|
7
|
+
export const ImageGenerationModelSchema = z.object({
|
|
8
|
+
uuid: z.string().uuid(),
|
|
9
|
+
title: z.string(),
|
|
10
|
+
model: z.string(),
|
|
11
|
+
description: z.string(),
|
|
12
|
+
price: z.number().int().nonnegative(),
|
|
13
|
+
canUse: z.boolean(),
|
|
14
|
+
pricingRules: ImageGenerationPricingRulesSchema,
|
|
15
|
+
params: ImageGenerationModelParamsSchema,
|
|
16
|
+
strategy: z.nativeEnum(IMAGE_GENERATION_MODEL_STRATEGY),
|
|
17
|
+
status: z.nativeEnum(TOOL_MODEL_STATUS),
|
|
18
|
+
statusCheckEndpoint: z.string().nullable().optional(),
|
|
19
|
+
maxPromptLength: z.number().int(),
|
|
20
|
+
iconVariants: IconVariantsSchema,
|
|
21
|
+
supportsImageAttachment: z.boolean(),
|
|
22
|
+
maxAttachedImages: z.number().int(),
|
|
23
|
+
translatePrompt: z.boolean(),
|
|
24
|
+
order: z.number().int(),
|
|
25
|
+
vendorId: z.string().uuid(),
|
|
26
|
+
createdAt: z.string().datetime().or(z.date()).optional(),
|
|
27
|
+
updatedAt: z.string().datetime().or(z.date()).optional(),
|
|
28
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const ImageGenerationPresetSchema = z.object({
|
|
4
|
+
uuid: z.string().uuid(),
|
|
5
|
+
title: z.string(),
|
|
6
|
+
sample: z.string().url(),
|
|
7
|
+
order: z.number().int(),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type ImageGenerationPreset = z.infer<typeof ImageGenerationPresetSchema>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { IMAGE_GENERATION_RESOLUTION } from '../../constants';
|
|
3
|
+
|
|
4
|
+
export const ImageGenerationPricingRuleConditionSchema = z.object({
|
|
5
|
+
resolution: z.nativeEnum(IMAGE_GENERATION_RESOLUTION).optional(),
|
|
6
|
+
withoutSub: z.boolean().optional(),
|
|
7
|
+
});
|
|
8
|
+
export type ImageGenerationPricingRuleCondition = z.infer<
|
|
9
|
+
typeof ImageGenerationPricingRuleConditionSchema
|
|
10
|
+
>;
|
|
11
|
+
|
|
12
|
+
export const ImageGenerationPricingRuleSchema = z.object({
|
|
13
|
+
condition: ImageGenerationPricingRuleConditionSchema,
|
|
14
|
+
value: z.number().int(),
|
|
15
|
+
});
|
|
16
|
+
export type ImageGenerationPricingRule = z.infer<typeof ImageGenerationPricingRuleSchema>;
|
|
17
|
+
|
|
18
|
+
export const ImageGenerationPricingRulesSchema = z.array(ImageGenerationPricingRuleSchema);
|
|
19
|
+
export type ImageGenerationPricingRules = z.infer<typeof ImageGenerationPricingRulesSchema>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { VendorSchema } from '../tools/vendor.schema';
|
|
3
|
+
import { ImageGenerationModelSchema } from './image-generation-model.schema';
|
|
4
|
+
|
|
5
|
+
export const ImageGenerationVendorSchema = VendorSchema.extend({
|
|
6
|
+
models: z.array(ImageGenerationModelSchema),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type ImageGenerationVendor = z.infer<typeof ImageGenerationVendorSchema>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './image-generation-model.schema';
|
|
2
|
+
export * from './image-generation-job.schema';
|
|
3
|
+
export * from './image-generation-job-attempt.schema';
|
|
4
|
+
export * from './image-generation-job-params.schema';
|
|
5
|
+
export * from './image-generation-job-request-params.schema';
|
|
6
|
+
export * from './image-generation-model-params.schema';
|
|
7
|
+
export * from './image-generation-pricing-rule.schema';
|
|
8
|
+
export * from './image-generation-vendor.schema';
|
|
9
|
+
export * from './image-generation-preset.schema';
|
|
10
|
+
export * from './image-generation-config.schema';
|
package/models/index.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './user.schema';
|
|
2
|
+
export * from './product.schema';
|
|
3
|
+
export * from './subscription.schema';
|
|
4
|
+
export * from './cloud-payments-widget.schema';
|
|
5
|
+
export * from './cloud-payments-widget-data.schema';
|
|
6
|
+
export * from './image-generation';
|
|
7
|
+
export * from './image-editor';
|
|
8
|
+
export * from './marketplace-card';
|
|
9
|
+
export * from './file.schema';
|
|
10
|
+
export * from './common';
|
|
11
|
+
export * from './tools';
|
|
12
|
+
export * from './page.schema';
|
|
13
|
+
export * from './page-question.schema';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './marketplace-card-model-params.schema';
|
|
2
|
+
export * from './marketplace-card-model.schema';
|
|
3
|
+
export * from './marketplace-card-style-preset.schema';
|
|
4
|
+
export * from './marketplace-card-job-request-params.schema';
|
|
5
|
+
export * from './marketplace-card-job.schema';
|
|
6
|
+
export * from './marketplace-card-config.schema';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MarketplaceCardModelSchema } from './marketplace-card-model.schema';
|
|
3
|
+
import { MarketplaceCardStylePresetSchema } from './marketplace-card-style-preset.schema';
|
|
4
|
+
|
|
5
|
+
export const MarketplaceCardConfigSchema = z.object({
|
|
6
|
+
styles: z.array(MarketplaceCardStylePresetSchema),
|
|
7
|
+
models: z.array(MarketplaceCardModelSchema),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type MarketplaceCardConfig = z.infer<typeof MarketplaceCardConfigSchema>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const MarketplaceCardJobRequestParamsSchema = z.object({
|
|
4
|
+
title: z.string().min(1),
|
|
5
|
+
subtitle: z.string().nullable().optional(),
|
|
6
|
+
advantages: z.array(z.string()).default([]),
|
|
7
|
+
tags: z.array(z.string()).default([]),
|
|
8
|
+
stylePresetId: z.string().uuid().nullable().optional(),
|
|
9
|
+
isCustom: z.boolean(),
|
|
10
|
+
customStylePrompt: z.string().nullable().optional(),
|
|
11
|
+
inputImages: z.array(z.string().uuid()).default([]),
|
|
12
|
+
backgroundDescription: z.string().nullable().optional(),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type MarketplaceCardJobRequestParams = z.infer<typeof MarketplaceCardJobRequestParamsSchema>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { JOB_STATUS, USER_REACTION } from '../../constants';
|
|
3
|
+
const MarketplaceCardInputImageSchema = z.object({
|
|
4
|
+
uuid: z.string().uuid(),
|
|
5
|
+
url: z.string().url(),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export const MarketplaceCardJobSchema = z.object({
|
|
9
|
+
uuid: z.string().uuid(),
|
|
10
|
+
status: z.nativeEnum(JOB_STATUS),
|
|
11
|
+
error: z.string().nullable(),
|
|
12
|
+
title: z.string(),
|
|
13
|
+
subtitle: z.string().nullable(),
|
|
14
|
+
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
15
|
+
advantages: z.array(z.string()),
|
|
16
|
+
tags: z.array(z.string()),
|
|
17
|
+
stylePresetId: z.string().uuid().nullable(),
|
|
18
|
+
isCustom: z.boolean(),
|
|
19
|
+
customStylePrompt: z.string().nullable(),
|
|
20
|
+
inputImages: z.array(MarketplaceCardInputImageSchema),
|
|
21
|
+
resultImages: z.array(z.string()).nullable(),
|
|
22
|
+
backgroundDescription: z.string().nullable(),
|
|
23
|
+
price: z.number().int().nonnegative(),
|
|
24
|
+
createdAt: z.string().datetime().or(z.date()).optional(),
|
|
25
|
+
updatedAt: z.string().datetime().or(z.date()).optional(),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export type MarketplaceCardJob = z.infer<typeof MarketplaceCardJobSchema>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const MarketplaceCardModelParamsSchema = z.object({
|
|
4
|
+
imageAttachment: z.object({
|
|
5
|
+
supported: z.boolean(),
|
|
6
|
+
maxImages: z.number().int().nonnegative(),
|
|
7
|
+
acceptedTypes: z.array(z.string()),
|
|
8
|
+
}),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export type MarketplaceCardModelParams = z.infer<typeof MarketplaceCardModelParamsSchema>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MARKETPLACE_CARD_STRATEGY, TOOL_MODEL_STATUS } from '../../constants';
|
|
3
|
+
import { IconVariantsSchema } from '../common';
|
|
4
|
+
import { MarketplaceCardModelParamsSchema } from './marketplace-card-model-params.schema';
|
|
5
|
+
|
|
6
|
+
export const MarketplaceCardModelSchema = z.object({
|
|
7
|
+
uuid: z.string().uuid(),
|
|
8
|
+
price: z.number().int().nonnegative(),
|
|
9
|
+
params: MarketplaceCardModelParamsSchema,
|
|
10
|
+
iconVariants: IconVariantsSchema,
|
|
11
|
+
maxPromptLength: z.number().int().positive(),
|
|
12
|
+
supportsImageAttachment: z.boolean(),
|
|
13
|
+
maxAttachedImages: z.number().int().nonnegative(),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export type MarketplaceCardModel = z.infer<typeof MarketplaceCardModelSchema>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const MarketplaceCardStylePresetSchema = z.object({
|
|
4
|
+
uuid: z.string().uuid(),
|
|
5
|
+
previewImageUrl: z.string().url(),
|
|
6
|
+
order: z.number().int().nonnegative(),
|
|
7
|
+
isActive: z.boolean(),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type MarketplaceCardStylePreset = z.infer<typeof MarketplaceCardStylePresetSchema>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const PageQuestionSchema = z.object({
|
|
4
|
+
uuid: z.string().uuid(),
|
|
5
|
+
question: z.string().min(3).max(16384),
|
|
6
|
+
answer: z.string().min(3).max(16384),
|
|
7
|
+
pageId: z.string().uuid(),
|
|
8
|
+
createdAt: z.date(),
|
|
9
|
+
updatedAt: z.date(),
|
|
10
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PageType } from '../constants';
|
|
3
|
+
import { PageQuestionSchema } from './page-question.schema';
|
|
4
|
+
|
|
5
|
+
export const WriterToolPageMetadataSchema = z.object({
|
|
6
|
+
type: z.literal(PageType.WRITER_TOOL),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const EduTaskSolvingToolPageMetadataSchema = z.object({
|
|
10
|
+
type: z.literal(PageType.EDU_TASK_SOLVING_TOOL),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const WriterDocumentTypePageMetadataSchema = z.object({
|
|
14
|
+
type: z.literal(PageType.WRITER_DOCUMENT_TYPE),
|
|
15
|
+
writerDocumentTypeId: z.string().uuid(),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const PageMetadataSchema = z.discriminatedUnion('type', [
|
|
19
|
+
WriterToolPageMetadataSchema,
|
|
20
|
+
EduTaskSolvingToolPageMetadataSchema,
|
|
21
|
+
WriterDocumentTypePageMetadataSchema,
|
|
22
|
+
]);
|
|
23
|
+
|
|
24
|
+
export const PageSchema = z.object({
|
|
25
|
+
uuid: z.string().uuid(),
|
|
26
|
+
metaTitle: z.string().min(3).max(16384),
|
|
27
|
+
metaDescription: z.string().min(3).max(16384),
|
|
28
|
+
title: z.string().min(3).max(16384),
|
|
29
|
+
subTitle: z.string().min(3).max(16384),
|
|
30
|
+
seoTextMd: z.string().min(3).max(16384),
|
|
31
|
+
alias: z.string().min(3).max(16384),
|
|
32
|
+
type: z.nativeEnum(PageType),
|
|
33
|
+
metadata: PageMetadataSchema,
|
|
34
|
+
createdAt: z.date(),
|
|
35
|
+
updatedAt: z.date(),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const PageWithQuestionsSchema = PageSchema.extend({
|
|
39
|
+
questions: z.array(PageQuestionSchema),
|
|
40
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const ProductSchema = z.object({
|
|
4
|
+
uuid: z.string().uuid(),
|
|
5
|
+
siteId: z.string().uuid(),
|
|
6
|
+
name: z.string().min(1).max(200),
|
|
7
|
+
description: z.string().min(1).max(2000),
|
|
8
|
+
tokens: z.number().int().min(0),
|
|
9
|
+
price: z.number().int().min(0),
|
|
10
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const SubscriptionSchema = z.object({
|
|
4
|
+
uuid: z.string().uuid(),
|
|
5
|
+
siteId: z.string().uuid(),
|
|
6
|
+
name: z.string().min(1).max(200),
|
|
7
|
+
description: z.string().min(1).max(2000),
|
|
8
|
+
price: z.number().int().min(0),
|
|
9
|
+
period: z.number().int().min(1).max(36),
|
|
10
|
+
tokens: z.number().int().min(0),
|
|
11
|
+
carryoverPercent: z.number().int().min(0).max(100),
|
|
12
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './vendor.schema';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { IconVariantsSchema } from '../common';
|
|
3
|
+
|
|
4
|
+
export const VendorSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
title: z.string(),
|
|
7
|
+
order: z.number().int(),
|
|
8
|
+
iconVariants: IconVariantsSchema,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export type Vendor = z.infer<typeof VendorSchema>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { USER_ROLE, USER_STATUS } from '../constants';
|
|
3
|
+
|
|
4
|
+
export const UserSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid().optional(),
|
|
6
|
+
siteId: z.string().uuid().optional(),
|
|
7
|
+
email: z.string().email(),
|
|
8
|
+
password: z.string().min(6).max(128),
|
|
9
|
+
role: z.nativeEnum(USER_ROLE).optional(),
|
|
10
|
+
status: z.nativeEnum(USER_STATUS).optional(),
|
|
11
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purpleschool/multisite",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Multisite API contracts (DTO schemas, routes, constants)",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "build/index.js",
|
|
@@ -31,12 +31,6 @@
|
|
|
31
31
|
"default": "./build/api/*/index.js"
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
|
-
"files": [
|
|
35
|
-
"build/**",
|
|
36
|
-
"package.json",
|
|
37
|
-
"README.md",
|
|
38
|
-
"LICENSE"
|
|
39
|
-
],
|
|
40
34
|
"scripts": {
|
|
41
35
|
"prepublish": "rm -rf build && tsc",
|
|
42
36
|
"build": "tsc"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { FileSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace FindFilesCommand {
|
|
5
|
+
export const RequestQuerySchema = z.object({
|
|
6
|
+
limit: z.coerce.number().int().min(1).max(100).default(20),
|
|
7
|
+
offset: z.coerce.number().int().min(0).default(0),
|
|
8
|
+
});
|
|
9
|
+
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: z.array(FileSchema),
|
|
13
|
+
meta: z.object({
|
|
14
|
+
limit: z.number().int(),
|
|
15
|
+
offset: z.number().int(),
|
|
16
|
+
total: z.number().int(),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { FileSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace GetFileCommand {
|
|
5
|
+
export const RequestParamSchema = z.object({
|
|
6
|
+
uuid: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
9
|
+
|
|
10
|
+
export const ResponseSchema = z.object({
|
|
11
|
+
data: FileSchema,
|
|
12
|
+
});
|
|
13
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ImageEditorJobSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace FindImageEditorJobsCommand {
|
|
5
|
+
export const RequestQuerySchema = z.object({
|
|
6
|
+
limit: z.coerce.number().int().min(1).max(100).default(20),
|
|
7
|
+
offset: z.coerce.number().int().min(0).default(0),
|
|
8
|
+
});
|
|
9
|
+
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: z.array(ImageEditorJobSchema),
|
|
13
|
+
meta: z.object({
|
|
14
|
+
limit: z.number().int(),
|
|
15
|
+
offset: z.number().int(),
|
|
16
|
+
total: z.number().int(),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ImageEditorConfigSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace GetImageEditorConfigCommand {
|
|
5
|
+
export const ResponseSchema = z.object({
|
|
6
|
+
data: ImageEditorConfigSchema,
|
|
7
|
+
});
|
|
8
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ImageEditorJobSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace GetImageEditorJobCommand {
|
|
5
|
+
export const RequestParamSchema = z.object({
|
|
6
|
+
uuid: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
9
|
+
|
|
10
|
+
export const ResponseSchema = z.object({
|
|
11
|
+
data: ImageEditorJobSchema,
|
|
12
|
+
});
|
|
13
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ImageEditorJobRequestParamsSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace GetImageEditorPriceCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
modelId: z.string().uuid(),
|
|
7
|
+
params: ImageEditorJobRequestParamsSchema.optional().default({ imageUrls: [] }),
|
|
8
|
+
});
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: z.object({
|
|
13
|
+
price: z.number().int().nonnegative(),
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
16
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ImageGenerationJobSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace FindImageGenerationJobsCommand {
|
|
5
|
+
export const RequestQuerySchema = z.object({
|
|
6
|
+
limit: z.coerce.number().int().min(1).max(100).default(20),
|
|
7
|
+
offset: z.coerce.number().int().min(0).default(0),
|
|
8
|
+
});
|
|
9
|
+
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: z.array(ImageGenerationJobSchema),
|
|
13
|
+
meta: z.object({
|
|
14
|
+
limit: z.number().int(),
|
|
15
|
+
offset: z.number().int(),
|
|
16
|
+
total: z.number().int(),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ImageGenerationConfigSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace GetImageGenerationConfigCommand {
|
|
5
|
+
export const ResponseSchema = z.object({
|
|
6
|
+
data: ImageGenerationConfigSchema,
|
|
7
|
+
});
|
|
8
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ImageGenerationJobSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace GetImageGenerationJobCommand {
|
|
5
|
+
export const RequestParamSchema = z.object({
|
|
6
|
+
uuid: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
9
|
+
|
|
10
|
+
export const ResponseSchema = z.object({
|
|
11
|
+
data: ImageGenerationJobSchema,
|
|
12
|
+
});
|
|
13
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { IMAGE_GENERATION_RESOLUTION } from '../../constants';
|
|
3
|
+
|
|
4
|
+
export namespace GetImageGenerationPriceCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
modelId: z.string().uuid(),
|
|
7
|
+
params: z.object({
|
|
8
|
+
resolution: z.nativeEnum(IMAGE_GENERATION_RESOLUTION).optional(),
|
|
9
|
+
}),
|
|
10
|
+
});
|
|
11
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
12
|
+
|
|
13
|
+
export const ResponseSchema = z.object({
|
|
14
|
+
data: z.object({
|
|
15
|
+
price: z.number().int().nonnegative(),
|
|
16
|
+
}),
|
|
17
|
+
});
|
|
18
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
19
|
+
}
|
package/queries/index.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './product';
|
|
2
|
+
export * from './subscription';
|
|
3
|
+
export * from './payment';
|
|
4
|
+
export * from './file';
|
|
5
|
+
export * from './user';
|
|
6
|
+
export * from './image-generation';
|
|
7
|
+
export * from './image-editor';
|
|
8
|
+
export * from './page';
|
|
9
|
+
export * from './marketplace-card';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MarketplaceCardJobSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace FindMarketplaceCardJobsCommand {
|
|
5
|
+
export const RequestQuerySchema = z.object({
|
|
6
|
+
limit: z.coerce.number().int().min(1).max(100).default(20),
|
|
7
|
+
offset: z.coerce.number().int().min(0).default(0),
|
|
8
|
+
title: z.string().min(1).optional(),
|
|
9
|
+
});
|
|
10
|
+
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
|
11
|
+
|
|
12
|
+
export const ResponseSchema = z.object({
|
|
13
|
+
data: z.array(MarketplaceCardJobSchema),
|
|
14
|
+
meta: z.object({
|
|
15
|
+
limit: z.number().int(),
|
|
16
|
+
offset: z.number().int(),
|
|
17
|
+
total: z.number().int(),
|
|
18
|
+
}),
|
|
19
|
+
});
|
|
20
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MarketplaceCardConfigSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace GetMarketplaceCardConfigCommand {
|
|
5
|
+
export const ResponseSchema = z.object({
|
|
6
|
+
data: MarketplaceCardConfigSchema,
|
|
7
|
+
});
|
|
8
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MarketplaceCardJobSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace GetMarketplaceCardJobCommand {
|
|
5
|
+
export const RequestParamSchema = z.object({
|
|
6
|
+
uuid: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
9
|
+
|
|
10
|
+
export const ResponseSchema = z.object({
|
|
11
|
+
data: MarketplaceCardJobSchema,
|
|
12
|
+
});
|
|
13
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace GetMarketplaceCardPriceCommand {
|
|
4
|
+
export const RequestSchema = z.object({
|
|
5
|
+
modelId: z.string().uuid().optional(),
|
|
6
|
+
});
|
|
7
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
8
|
+
|
|
9
|
+
export const ResponseSchema = z.object({
|
|
10
|
+
data: z.object({
|
|
11
|
+
price: z.number().int().nonnegative(),
|
|
12
|
+
}),
|
|
13
|
+
});
|
|
14
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PageQuestionSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace FindAllPageQuestionsQuery {
|
|
5
|
+
export const RequestQuerySchema = z.object({});
|
|
6
|
+
|
|
7
|
+
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
|
8
|
+
|
|
9
|
+
export const ResponseSchema = z.object({
|
|
10
|
+
data: z.array(PageQuestionSchema),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PageQuestionSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace FindPageQuestionByUUIDQuery {
|
|
5
|
+
export const RequestParamsSchema = z.object({
|
|
6
|
+
uuid: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: PageQuestionSchema.nullable(),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|