@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 @@
|
|
|
1
|
+
export * from './enums';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export enum IMAGE_GENERATION_MODEL_STRATEGY {
|
|
2
|
+
DEFAULT = 'default',
|
|
3
|
+
|
|
4
|
+
KIE_Z_IMAGE_GENERATION = 'KIE_Z_IMAGE_GENERATION',
|
|
5
|
+
FLUX_IMAGE_GENERATION = 'FLUX_IMAGE_GENERATION',
|
|
6
|
+
FLUX_DEV_IMAGE_GENERATION = 'FLUX_DEV_IMAGE_GENERATION',
|
|
7
|
+
GROK_IMAGE_GENERATION = 'GROK_IMAGE_GENERATION',
|
|
8
|
+
IMAGEN_IMAGE_GENERATION = 'IMAGEN_IMAGE_GENERATION',
|
|
9
|
+
DALLE_IMAGE_GENERATION = 'DALLE_IMAGE_GENERATION',
|
|
10
|
+
MIDJOURNEY_IMAGE_GENERATION = 'MIDJOURNEY_IMAGE_GENERATION',
|
|
11
|
+
OPENAI_IMAGE_1_GENERATION = 'OPENAI_IMAGE_1_GENERATION',
|
|
12
|
+
NANO_BANANA_IMAGE_GENERATION = 'NANO_BANANA_IMAGE_GENERATION',
|
|
13
|
+
KIE_FLUX_IMAGE_GENERATION = 'KIE_FLUX_IMAGE_GENERATION',
|
|
14
|
+
KIE_SEEDREAM_IMAGE_GENERATION = 'KIE_SEEDREAM_IMAGE_GENERATION',
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './enums';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './errors';
|
|
2
|
+
export * from './common';
|
|
3
|
+
export * from './user';
|
|
4
|
+
export * from './payment';
|
|
5
|
+
export * from './transaction';
|
|
6
|
+
export * from './user-to-product';
|
|
7
|
+
export * from './user-to-subscription';
|
|
8
|
+
export * from './subscription';
|
|
9
|
+
export * from './order';
|
|
10
|
+
export * from './tools';
|
|
11
|
+
export * from './files';
|
|
12
|
+
export * from './image-generation';
|
|
13
|
+
export * from './image-editor';
|
|
14
|
+
export * from './page';
|
|
15
|
+
export * from './email';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './enums';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './enums/page-type.enum';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './payment-status.enum';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './enums';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const FREE_SUBSCRIPTION_ID = '00000000-0000-0000-0000-000000000000' as const;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './free-subscription-id.constant';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './enums';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './transaction-status.enum';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './enums';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './enums';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './user-to-product-status.enum';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './enums';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './user-to-subscription-status.enum';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './enums';
|
package/index.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ReceiptSchema } from './common';
|
|
3
|
+
|
|
4
|
+
export const CloudPaymentsRecurrentDataSchema = z.object({
|
|
5
|
+
period: z.number().int().positive(),
|
|
6
|
+
interval: z.literal('Month'),
|
|
7
|
+
customerReceipt: ReceiptSchema,
|
|
8
|
+
amount: z.number().nonnegative(),
|
|
9
|
+
});
|
|
10
|
+
export type CloudPaymentsRecurrentData = z.infer<typeof CloudPaymentsRecurrentDataSchema>;
|
|
11
|
+
|
|
12
|
+
export const CloudPaymentsWidgetDataSchema = z.object({
|
|
13
|
+
CloudPayments: z.object({
|
|
14
|
+
CustomerReceipt: ReceiptSchema,
|
|
15
|
+
recurrent: CloudPaymentsRecurrentDataSchema.optional(),
|
|
16
|
+
}),
|
|
17
|
+
});
|
|
18
|
+
export type CloudPaymentsWidgetData = z.infer<typeof CloudPaymentsWidgetDataSchema>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CloudPaymentsWidgetDataSchema } from './cloud-payments-widget-data.schema';
|
|
3
|
+
|
|
4
|
+
export const CloudPaymentsWidgetSchema = z.object({
|
|
5
|
+
publicId: z.string(),
|
|
6
|
+
amount: z.number(),
|
|
7
|
+
currency: z.string(),
|
|
8
|
+
accountId: z.string(),
|
|
9
|
+
description: z.string(),
|
|
10
|
+
invoiceId: z.string(),
|
|
11
|
+
email: z.string().email(),
|
|
12
|
+
skin: z.string(),
|
|
13
|
+
autoClose: z.number(),
|
|
14
|
+
data: CloudPaymentsWidgetDataSchema,
|
|
15
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { FILE_TYPE } from '../../constants';
|
|
3
|
+
|
|
4
|
+
export const AttachedFileSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
url: z.string().url(),
|
|
7
|
+
name: z.string(),
|
|
8
|
+
mimeType: z.string(),
|
|
9
|
+
type: z.nativeEnum(FILE_TYPE),
|
|
10
|
+
size: z.number().int().nonnegative(),
|
|
11
|
+
duration: z.number().optional().nullable(),
|
|
12
|
+
});
|
|
13
|
+
export type AttachedFile = z.infer<typeof AttachedFileSchema>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const IconVariantSchema = z.object({
|
|
4
|
+
png: z.string().url().optional(),
|
|
5
|
+
svg: z.string().url().optional(),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export const IconVariantsSchema = z.object({
|
|
9
|
+
light: IconVariantSchema,
|
|
10
|
+
dark: IconVariantSchema,
|
|
11
|
+
});
|
|
12
|
+
export type IconVariants = z.infer<typeof IconVariantsSchema>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export type JsonPrimitive = string | number | boolean | null;
|
|
4
|
+
export type JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };
|
|
5
|
+
|
|
6
|
+
export const JsonPrimitiveSchema = z.union([z.string(), z.number(), z.boolean(), z.null()]);
|
|
7
|
+
|
|
8
|
+
export const JsonValueSchema: z.ZodType<JsonValue> = z.lazy(() =>
|
|
9
|
+
z.union([JsonPrimitiveSchema, z.array(JsonValueSchema), z.record(JsonValueSchema)]),
|
|
10
|
+
);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const ReceiptItemSchema = z.object({
|
|
4
|
+
label: z.string().min(1),
|
|
5
|
+
price: z.number().nonnegative(),
|
|
6
|
+
quantity: z.number().int().positive(),
|
|
7
|
+
amount: z.number().nonnegative(),
|
|
8
|
+
vat: z.number().int().nonnegative(),
|
|
9
|
+
});
|
|
10
|
+
export type ReceiptItem = z.infer<typeof ReceiptItemSchema>;
|
|
11
|
+
|
|
12
|
+
export const ReceiptSchema = z.object({
|
|
13
|
+
items: z.array(ReceiptItemSchema),
|
|
14
|
+
taxationSystem: z.number().int().nonnegative(),
|
|
15
|
+
email: z.string().email(),
|
|
16
|
+
isBso: z.boolean(),
|
|
17
|
+
amounts: z.object({ electronic: z.number().nonnegative() }),
|
|
18
|
+
});
|
|
19
|
+
export type Receipt = z.infer<typeof ReceiptSchema>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { FILE_TYPE } from '../constants';
|
|
3
|
+
|
|
4
|
+
export const FileSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
name: z.string(),
|
|
7
|
+
key: z.string(),
|
|
8
|
+
url: z.string().url(),
|
|
9
|
+
mimeType: z.string(),
|
|
10
|
+
size: z.number().int().nonnegative(),
|
|
11
|
+
type: z.nativeEnum(FILE_TYPE),
|
|
12
|
+
createdAt: z.string().datetime().or(z.date()).optional(),
|
|
13
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ImageEditorModelSchema } from './image-editor-model.schema';
|
|
3
|
+
import { ImageEditorPromptGroupSchema } from './image-editor-prompt-group.schema';
|
|
4
|
+
|
|
5
|
+
export const ImageEditorConfigSchema = z.object({
|
|
6
|
+
models: z.array(ImageEditorModelSchema),
|
|
7
|
+
promptGroups: z.array(ImageEditorPromptGroupSchema),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type ImageEditorConfig = z.infer<typeof ImageEditorConfigSchema>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AttachedFileSchema } from '../common';
|
|
3
|
+
|
|
4
|
+
export const ImageEditorJobParamsSchema = z.object({
|
|
5
|
+
attachedFiles: z.array(AttachedFileSchema).optional(),
|
|
6
|
+
imageUrls: z.array(z.string()).optional(),
|
|
7
|
+
systemPromptId: z.string().uuid().optional(),
|
|
8
|
+
aspectRatio: z.string().optional(),
|
|
9
|
+
userHasActiveSubscriptionOrProduct: z.boolean().optional(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export type ImageEditorJobParams = z.infer<typeof ImageEditorJobParamsSchema>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const ImageEditorJobRequestParamsSchema = z.object({
|
|
4
|
+
imageUrls: z.array(z.string().uuid()).optional().default([]),
|
|
5
|
+
systemPromptId: z.string().uuid().optional(),
|
|
6
|
+
aspectRatio: z.string().optional(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type ImageEditorJobRequestParams = z.infer<typeof ImageEditorJobRequestParamsSchema>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { JOB_STATUS, USER_REACTION } from '../../constants';
|
|
3
|
+
import { ImageEditorJobParamsSchema } from './image-editor-job-params.schema';
|
|
4
|
+
|
|
5
|
+
export const ImageEditorJobSchema = z.object({
|
|
6
|
+
uuid: z.string().uuid(),
|
|
7
|
+
prompt: z.string(),
|
|
8
|
+
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
9
|
+
dislikeReason: z.string().nullable(),
|
|
10
|
+
externalId: z.string().nullable(),
|
|
11
|
+
title: z.string(),
|
|
12
|
+
status: z.nativeEnum(JOB_STATUS),
|
|
13
|
+
error: z.string().nullable(),
|
|
14
|
+
internalError: z.string().nullable().optional(),
|
|
15
|
+
modelId: z.string().uuid(),
|
|
16
|
+
price: z.number().int().nonnegative(),
|
|
17
|
+
params: ImageEditorJobParamsSchema,
|
|
18
|
+
imageUrls: z.array(z.string()).default([]),
|
|
19
|
+
attempts: z.array(z.any()),
|
|
20
|
+
userId: z.string().uuid().nullable().optional(),
|
|
21
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
22
|
+
postId: z.string().uuid().nullable(),
|
|
23
|
+
isDeleted: z.boolean(),
|
|
24
|
+
tokenReservationId: z.string().nullable().optional(),
|
|
25
|
+
createdAt: z.string().datetime().or(z.date()),
|
|
26
|
+
completedAt: z.string().datetime().or(z.date()).nullable().optional(),
|
|
27
|
+
updatedAt: z.string().datetime().or(z.date()),
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export type ImageEditorJob = z.infer<typeof ImageEditorJobSchema>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const ImageEditorModelParamsSchema = z.object({
|
|
4
|
+
imageAttachment: z.object({
|
|
5
|
+
supported: z.boolean(),
|
|
6
|
+
maxImages: z.number().int().nonnegative(),
|
|
7
|
+
acceptedTypes: z.array(z.string()),
|
|
8
|
+
}),
|
|
9
|
+
aspectRatio: z.record(
|
|
10
|
+
z.string(),
|
|
11
|
+
z.object({
|
|
12
|
+
width: z.number().int().positive(),
|
|
13
|
+
height: z.number().int().positive(),
|
|
14
|
+
}),
|
|
15
|
+
),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export type ImageEditorModelParams = z.infer<typeof ImageEditorModelParamsSchema>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { IMAGE_EDITING_STRATEGY, TOOL_MODEL_STATUS } from '../../constants';
|
|
3
|
+
import { IconVariantsSchema } from '../common';
|
|
4
|
+
import { ImageEditorModelParamsSchema } from './image-editor-model-params.schema';
|
|
5
|
+
import { ImageEditorPricingRulesSchema } from './image-editor-pricing-rule.schema';
|
|
6
|
+
|
|
7
|
+
export const ImageEditorModelSchema = z.object({
|
|
8
|
+
uuid: z.string().uuid(),
|
|
9
|
+
title: z.string(),
|
|
10
|
+
description: z.string(),
|
|
11
|
+
aiModel: z.string(),
|
|
12
|
+
isNew: z.boolean(),
|
|
13
|
+
tierLabel: z.string(),
|
|
14
|
+
pricePerImage: z.number().int().nonnegative(),
|
|
15
|
+
order: z.number().int(),
|
|
16
|
+
status: z.nativeEnum(TOOL_MODEL_STATUS),
|
|
17
|
+
icons: IconVariantsSchema,
|
|
18
|
+
strategy: z.nativeEnum(IMAGE_EDITING_STRATEGY),
|
|
19
|
+
maxInputLength: z.number().int().nonnegative(),
|
|
20
|
+
params: ImageEditorModelParamsSchema,
|
|
21
|
+
pricingRules: ImageEditorPricingRulesSchema,
|
|
22
|
+
canUse: z.boolean(),
|
|
23
|
+
statusCheckEndpoint: z.string().nullable().optional(),
|
|
24
|
+
createdAt: z.string().datetime().or(z.date()).optional(),
|
|
25
|
+
updatedAt: z.string().datetime().or(z.date()).optional(),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export type ImageEditorModel = z.infer<typeof ImageEditorModelSchema>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const ImageEditorPricingRuleConditionSchema = z.object({
|
|
4
|
+
withoutSub: z.boolean().optional(),
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
export const ImageEditorPricingRulesSchema = z.array(
|
|
8
|
+
z.object({
|
|
9
|
+
condition: ImageEditorPricingRuleConditionSchema,
|
|
10
|
+
value: z.number().int(),
|
|
11
|
+
}),
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
export type ImageEditorPricingRules = z.infer<typeof ImageEditorPricingRulesSchema>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { IconVariantsSchema } from '../common';
|
|
3
|
+
import { ImageEditorSystemPromptSchema } from './image-editor-system-prompt.schema';
|
|
4
|
+
|
|
5
|
+
export const ImageEditorPromptGroupSchema = z.object({
|
|
6
|
+
uuid: z.string().uuid(),
|
|
7
|
+
title: z.string(),
|
|
8
|
+
icons: IconVariantsSchema,
|
|
9
|
+
order: z.number().int(),
|
|
10
|
+
prompts: z.array(ImageEditorSystemPromptSchema),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type ImageEditorPromptGroup = z.infer<typeof ImageEditorPromptGroupSchema>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { IMAGE_EDITING_STRATEGY } from '../../constants';
|
|
3
|
+
|
|
4
|
+
export const ImageEditorSystemPromptSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
title: z.string(),
|
|
7
|
+
description: z.string(),
|
|
8
|
+
strategy: z.nativeEnum(IMAGE_EDITING_STRATEGY).nullable().optional(),
|
|
9
|
+
prompt: z.string(),
|
|
10
|
+
allowUserPrompt: z.boolean(),
|
|
11
|
+
order: z.number().int(),
|
|
12
|
+
params: z.record(z.any()).optional(),
|
|
13
|
+
preview: z.record(z.any()).optional(),
|
|
14
|
+
placeholder: z.string().nullable().optional(),
|
|
15
|
+
groupId: z.string().uuid(),
|
|
16
|
+
createdAt: z.string().datetime().or(z.date()).optional(),
|
|
17
|
+
updatedAt: z.string().datetime().or(z.date()).optional(),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export type ImageEditorSystemPrompt = z.infer<typeof ImageEditorSystemPromptSchema>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './image-editor-config.schema';
|
|
2
|
+
export * from './image-editor-job-params.schema';
|
|
3
|
+
export * from './image-editor-job-request-params.schema';
|
|
4
|
+
export * from './image-editor-job.schema';
|
|
5
|
+
export * from './image-editor-model-params.schema';
|
|
6
|
+
export * from './image-editor-model.schema';
|
|
7
|
+
export * from './image-editor-pricing-rule.schema';
|
|
8
|
+
export * from './image-editor-prompt-group.schema';
|
|
9
|
+
export * from './image-editor-system-prompt.schema';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ImageGenerationVendorSchema } from './image-generation-vendor.schema';
|
|
3
|
+
import { ImageGenerationPresetSchema } from './image-generation-preset.schema';
|
|
4
|
+
|
|
5
|
+
export const ImageGenerationConfigSchema = z.object({
|
|
6
|
+
vendors: z.array(ImageGenerationVendorSchema),
|
|
7
|
+
presets: z.array(ImageGenerationPresetSchema),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type ImageGenerationConfig = z.infer<typeof ImageGenerationConfigSchema>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { JOB_STATUS } from '../../constants';
|
|
3
|
+
|
|
4
|
+
export const ImageGenerationJobAttemptSchema = z.object({
|
|
5
|
+
order: z.number().int().positive(),
|
|
6
|
+
status: z.nativeEnum(JOB_STATUS),
|
|
7
|
+
error: z.string().nullable(),
|
|
8
|
+
timestamp: z.string().datetime().or(z.date()),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export type ImageGenerationJobAttempt = z.infer<typeof ImageGenerationJobAttemptSchema>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AttachedFileSchema } from '../common';
|
|
3
|
+
import { IMAGE_GENERATION_RESOLUTION } from '../../constants';
|
|
4
|
+
|
|
5
|
+
export const ImageGenerationJobParamsSchema = z.object({
|
|
6
|
+
aspectRatio: z.string().min(1),
|
|
7
|
+
attachedFiles: z.array(AttachedFileSchema).optional().default([]),
|
|
8
|
+
enhancePrompt: z.boolean().optional().default(false),
|
|
9
|
+
resolution: z.nativeEnum(IMAGE_GENERATION_RESOLUTION).optional(),
|
|
10
|
+
});
|
|
11
|
+
export type ImageGenerationJobParams = z.infer<typeof ImageGenerationJobParamsSchema>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { IMAGE_GENERATION_RESOLUTION } from '../../constants';
|
|
3
|
+
|
|
4
|
+
export const ImageGenerationJobRequestParamsSchema = z.object({
|
|
5
|
+
aspectRatio: z.string().min(1),
|
|
6
|
+
attachedFiles: z.array(z.string().uuid()).optional().default([]),
|
|
7
|
+
enhancePrompt: z.boolean().optional().default(false),
|
|
8
|
+
resolution: z.nativeEnum(IMAGE_GENERATION_RESOLUTION).optional(),
|
|
9
|
+
});
|
|
10
|
+
export type ImageGenerationJobRequestParams = z.infer<typeof ImageGenerationJobRequestParamsSchema>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { JOB_REQUEST_ORIGIN, JOB_STATUS, USER_REACTION } from '../../constants';
|
|
3
|
+
import { ImageGenerationJobParamsSchema } from './image-generation-job-params.schema';
|
|
4
|
+
import { ImageGenerationJobAttemptSchema } from './image-generation-job-attempt.schema';
|
|
5
|
+
|
|
6
|
+
export const ImageGenerationJobSchema = z.object({
|
|
7
|
+
uuid: z.string().uuid(),
|
|
8
|
+
modelId: z.string().uuid(),
|
|
9
|
+
prompt: z.string(),
|
|
10
|
+
title: z.string(),
|
|
11
|
+
params: ImageGenerationJobParamsSchema,
|
|
12
|
+
price: z.number().int().nonnegative(),
|
|
13
|
+
status: z.nativeEnum(JOB_STATUS),
|
|
14
|
+
error: z.string().nullable().optional(),
|
|
15
|
+
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
16
|
+
dislikeReason: z.string().nullable(),
|
|
17
|
+
externalId: z.string().nullable(),
|
|
18
|
+
output: z.array(z.string().url()),
|
|
19
|
+
presetId: z.string().uuid().nullable().optional(),
|
|
20
|
+
attempts: z.array(ImageGenerationJobAttemptSchema),
|
|
21
|
+
userId: z.string().uuid().nullable().optional(),
|
|
22
|
+
unregisteredUserId: z.string().nullable().optional(),
|
|
23
|
+
origin: z.nativeEnum(JOB_REQUEST_ORIGIN),
|
|
24
|
+
isDeleted: z.boolean(),
|
|
25
|
+
internalError: z.string().nullable(),
|
|
26
|
+
tokenReservationId: z.string().uuid().nullable().optional(),
|
|
27
|
+
createdAt: z.string().datetime().or(z.date()).optional(),
|
|
28
|
+
updatedAt: z.string().datetime().or(z.date()).optional(),
|
|
29
|
+
completedAt: z.string().datetime().or(z.date()).nullable().optional(),
|
|
30
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { IMAGE_GENERATION_RESOLUTION } from '../../constants';
|
|
3
|
+
|
|
4
|
+
export const ImageGenerationModelParamsSchema = z.object({
|
|
5
|
+
aspectRatio: z.record(
|
|
6
|
+
z.string(),
|
|
7
|
+
z.union([
|
|
8
|
+
z.object({
|
|
9
|
+
width: z.number().int().positive(),
|
|
10
|
+
height: z.number().int().positive(),
|
|
11
|
+
}),
|
|
12
|
+
z.literal('auto'),
|
|
13
|
+
]),
|
|
14
|
+
),
|
|
15
|
+
quality: z.union([z.string(), z.record(z.string(), z.string())]).optional(),
|
|
16
|
+
resolution: z
|
|
17
|
+
.object({
|
|
18
|
+
options: z.array(z.nativeEnum(IMAGE_GENERATION_RESOLUTION)),
|
|
19
|
+
})
|
|
20
|
+
.optional(),
|
|
21
|
+
});
|
|
22
|
+
export type ImageGenerationModelParams = z.infer<typeof ImageGenerationModelParamsSchema>;
|