@purpleschool/gptbot 0.8.95 → 0.8.98
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/controllers/http/index.ts +1 -0
- package/api/controllers/http/interior-design.ts +14 -0
- package/api/controllers/http/product.ts +1 -0
- package/api/controllers/http/subscription.ts +1 -0
- package/api/routes.ts +36 -0
- package/build/api/controllers/http/index.js +1 -0
- package/build/api/controllers/http/interior-design.js +16 -0
- package/build/api/controllers/http/product.js +1 -0
- package/build/api/controllers/http/subscription.js +1 -0
- package/build/api/routes.js +24 -0
- package/build/commands/product/index.js +1 -0
- package/build/commands/product/refund-product.command.js +15 -0
- package/build/commands/subscription/index.js +1 -0
- package/build/commands/subscription/refund-subscription.command.js +15 -0
- package/build/commands/tools/index.js +1 -0
- package/build/commands/tools/interior-design/delete-all-interior-design-jobs.command.js +8 -0
- package/build/commands/tools/interior-design/delete-interior-design-job-by-uuid.command.js +11 -0
- package/build/commands/tools/interior-design/find-interior-design-job-by-uuid.command.js +14 -0
- package/build/commands/tools/interior-design/find-interior-design-jobs.command.js +18 -0
- package/build/commands/tools/interior-design/get-interior-design-tool-config.command.js +11 -0
- package/build/commands/tools/interior-design/index.js +25 -0
- package/build/commands/tools/interior-design/interior-design.command.js +20 -0
- package/build/commands/tools/interior-design/retry-interior-design-job.command.js +25 -0
- package/build/commands/tools/interior-design/set-reaction-to-interior-design-job.command.js +28 -0
- package/build/commands/tools/interior-design/update-interior-design-job-title.command.js +17 -0
- package/build/constants/errors/errors.js +4411 -2760
- package/build/constants/errors/index.js +1 -1
- package/build/constants/product/enums/product-status.enum.js +1 -0
- package/build/constants/subscription/enums/subscription-feature-type.enum.js +3 -0
- package/build/constants/subscription/enums/subscription-status.enum.js +1 -0
- package/build/constants/tool/enums/tool-type.enum.js +1 -0
- package/build/helpers/index.js +1 -0
- package/build/helpers/interior-design/calculate-interior-design-price.helper.js +13 -0
- package/build/helpers/interior-design/index.js +17 -0
- package/build/models/subscription-feature.schema.js +14 -1
- package/build/models/tools/index.js +1 -0
- package/build/models/tools/interior-design/index.js +19 -0
- package/build/models/tools/interior-design/interior-design-config.schema.js +23 -0
- package/build/models/tools/interior-design/interior-design-job.schema.js +27 -0
- package/build/models/tools/interior-design/interior-design-model.schema.js +33 -0
- package/build/models/tools/video/video-job.schema.js +2 -1
- package/commands/product/index.ts +1 -0
- package/commands/product/refund-product.command.ts +17 -0
- package/commands/subscription/index.ts +1 -0
- package/commands/subscription/refund-subscription.command.ts +17 -0
- package/commands/tools/index.ts +1 -0
- package/commands/tools/interior-design/delete-all-interior-design-jobs.command.ts +6 -0
- package/commands/tools/interior-design/delete-interior-design-job-by-uuid.command.ts +11 -0
- package/commands/tools/interior-design/find-interior-design-job-by-uuid.command.ts +16 -0
- package/commands/tools/interior-design/find-interior-design-jobs.command.ts +18 -0
- package/commands/tools/interior-design/get-interior-design-tool-config.command.ts +10 -0
- package/commands/tools/interior-design/index.ts +9 -0
- package/commands/tools/interior-design/interior-design.command.ts +21 -0
- package/commands/tools/interior-design/retry-interior-design-job.command.ts +27 -0
- package/commands/tools/interior-design/set-reaction-to-interior-design-job.command.ts +33 -0
- package/commands/tools/interior-design/update-interior-design-job-title.command.ts +19 -0
- package/constants/errors/errors.ts +4451 -2766
- package/constants/errors/index.ts +1 -1
- package/constants/product/enums/product-status.enum.ts +1 -0
- package/constants/subscription/enums/subscription-feature-type.enum.ts +3 -0
- package/constants/subscription/enums/subscription-status.enum.ts +1 -0
- package/constants/tool/enums/tool-type.enum.ts +1 -0
- package/helpers/index.ts +1 -0
- package/helpers/interior-design/calculate-interior-design-price.helper.ts +23 -0
- package/helpers/interior-design/index.ts +1 -0
- package/models/subscription-feature.schema.ts +19 -0
- package/models/tools/index.ts +1 -0
- package/models/tools/interior-design/index.ts +3 -0
- package/models/tools/interior-design/interior-design-config.schema.ts +29 -0
- package/models/tools/interior-design/interior-design-job.schema.ts +32 -0
- package/models/tools/interior-design/interior-design-model.schema.ts +44 -0
- package/models/tools/video/video-job.schema.ts +2 -1
- package/package.json +1 -1
|
@@ -22,6 +22,8 @@ export enum SUBSCRIPTION_FEATURE_TYPE {
|
|
|
22
22
|
WRITER_MODEL_ACCESS = 'writer_model_access',
|
|
23
23
|
IMAGE_EDITOR_QUOTA = 'image_editor_quota',
|
|
24
24
|
IMAGE_EDITOR_MODEL_ACCESS = 'image_editor_model_access',
|
|
25
|
+
INTERIOR_DESIGN_QUOTA = 'interior_design_quota',
|
|
26
|
+
INTERIOR_DESIGN_MODEL_ACCESS = 'interior_design_model_access',
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
export enum SUBSCRIPTION_FEATURE_KIND {
|
|
@@ -37,4 +39,5 @@ export enum SUBSCRIPTION_FEATURE_KIND {
|
|
|
37
39
|
MUSIC = 'music',
|
|
38
40
|
WRITER = 'writer',
|
|
39
41
|
IMAGE_EDITOR = 'image_editor',
|
|
42
|
+
INTERIOR_DESIGN = 'interior_design',
|
|
40
43
|
}
|
package/helpers/index.ts
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { InteriorDesignModelPricingRules } from '../../models';
|
|
2
|
+
|
|
3
|
+
export function calculateInteriorDesignPrice({
|
|
4
|
+
basePrice,
|
|
5
|
+
userHasActiveSubscriptionOrProduct,
|
|
6
|
+
rules,
|
|
7
|
+
}: {
|
|
8
|
+
basePrice: number;
|
|
9
|
+
userHasActiveSubscriptionOrProduct: boolean;
|
|
10
|
+
rules: InteriorDesignModelPricingRules;
|
|
11
|
+
}): number {
|
|
12
|
+
let price = basePrice;
|
|
13
|
+
|
|
14
|
+
for (const rule of rules ?? []) {
|
|
15
|
+
const condition = rule.condition;
|
|
16
|
+
|
|
17
|
+
if (condition.withoutSub && userHasActiveSubscriptionOrProduct === false) {
|
|
18
|
+
price += rule.value;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return price;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './calculate-interior-design-price.helper';
|
|
@@ -192,6 +192,23 @@ export const ImageEditorModelAccessFeatureSchema = SubscriptionFeatureBaseSchema
|
|
|
192
192
|
});
|
|
193
193
|
export type ImageEditorModelAccessFeature = z.infer<typeof ImageEditorModelAccessFeatureSchema>;
|
|
194
194
|
|
|
195
|
+
export const InteriorDesignQuotaFeatureSchema = SubscriptionFeatureBaseSchema.extend({
|
|
196
|
+
kind: z.literal(SUBSCRIPTION_FEATURE_KIND.INTERIOR_DESIGN),
|
|
197
|
+
type: z.literal(SUBSCRIPTION_FEATURE_TYPE.INTERIOR_DESIGN_QUOTA),
|
|
198
|
+
value: z.number(),
|
|
199
|
+
});
|
|
200
|
+
export type InteriorDesignQuotaFeature = z.infer<typeof InteriorDesignQuotaFeatureSchema>;
|
|
201
|
+
|
|
202
|
+
export const InteriorDesignModelAccessFeatureSchema = SubscriptionFeatureBaseSchema.extend({
|
|
203
|
+
kind: z.literal(SUBSCRIPTION_FEATURE_KIND.INTERIOR_DESIGN),
|
|
204
|
+
type: z.literal(SUBSCRIPTION_FEATURE_TYPE.INTERIOR_DESIGN_MODEL_ACCESS),
|
|
205
|
+
isAvailable: z.boolean(),
|
|
206
|
+
modelId: z.string(),
|
|
207
|
+
});
|
|
208
|
+
export type InteriorDesignModelAccessFeature = z.infer<
|
|
209
|
+
typeof InteriorDesignModelAccessFeatureSchema
|
|
210
|
+
>;
|
|
211
|
+
|
|
195
212
|
export const SubscriptionFeatureSchema = z.union([
|
|
196
213
|
AiModelAccessFeatureSchema,
|
|
197
214
|
RequestsQuotaFeatureSchema,
|
|
@@ -215,6 +232,8 @@ export const SubscriptionFeatureSchema = z.union([
|
|
|
215
232
|
WriterModelAccessFeatureSchema,
|
|
216
233
|
ImageEditorQuotaFeatureSchema,
|
|
217
234
|
ImageEditorModelAccessFeatureSchema,
|
|
235
|
+
InteriorDesignQuotaFeatureSchema,
|
|
236
|
+
InteriorDesignModelAccessFeatureSchema,
|
|
218
237
|
]);
|
|
219
238
|
|
|
220
239
|
export type SubscriptionFeature = z.infer<typeof SubscriptionFeatureSchema>;
|
package/models/tools/index.ts
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { InteriorDesignModelSchema } from './interior-design-model.schema';
|
|
3
|
+
|
|
4
|
+
export const InteriorDesignStylesSchema = z.object({
|
|
5
|
+
uuid: z.string(),
|
|
6
|
+
title: z.string(),
|
|
7
|
+
prompt: z.string(),
|
|
8
|
+
sample: z.string(),
|
|
9
|
+
order: z.number(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export type InteriorDesignStyles = z.infer<typeof InteriorDesignStylesSchema>;
|
|
13
|
+
|
|
14
|
+
export const InteriorDesignRoomTypesSchema = z.object({
|
|
15
|
+
uuid: z.string(),
|
|
16
|
+
title: z.string(),
|
|
17
|
+
prompt: z.string(),
|
|
18
|
+
order: z.number(),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export type InteriorDesignRoomTypes = z.infer<typeof InteriorDesignRoomTypesSchema>;
|
|
22
|
+
|
|
23
|
+
export const InteriorDesignConfigSchema = z.object({
|
|
24
|
+
models: z.array(InteriorDesignModelSchema),
|
|
25
|
+
styles: z.array(InteriorDesignStylesSchema),
|
|
26
|
+
roomTypes: z.array(InteriorDesignRoomTypesSchema),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export type InteriorDesignConfig = z.infer<typeof InteriorDesignConfigSchema>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { USER_REACTION } from '../../../constants';
|
|
3
|
+
import { ToolJobSchema } from '../../tool-job.schema';
|
|
4
|
+
import { FileSchema } from '../../file.schema';
|
|
5
|
+
import { AttachedToolFileSchema } from '../common';
|
|
6
|
+
|
|
7
|
+
export const InteriorDesignJobParamsSchema = z.object({
|
|
8
|
+
attachedFiles: z.array(AttachedToolFileSchema),
|
|
9
|
+
styleId: z.string().optional(),
|
|
10
|
+
roomTypeId: z.string().optional(),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type InteriorDesignJobParams = z.infer<typeof InteriorDesignJobParamsSchema>;
|
|
14
|
+
|
|
15
|
+
export const InteriorDesignJobSchema = ToolJobSchema.extend({
|
|
16
|
+
title: z.string(),
|
|
17
|
+
prompt: z.string(),
|
|
18
|
+
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
19
|
+
imageUrls: z.string().array(),
|
|
20
|
+
images: z
|
|
21
|
+
.array(
|
|
22
|
+
FileSchema.pick({
|
|
23
|
+
uuid: true,
|
|
24
|
+
url: true,
|
|
25
|
+
}),
|
|
26
|
+
)
|
|
27
|
+
.nullable(),
|
|
28
|
+
params: InteriorDesignJobParamsSchema,
|
|
29
|
+
modelId: z.string(),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export type InteriorDesignJob = z.infer<typeof InteriorDesignJobSchema>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { IconVariantsSchema } from '../../icon-variants.schema';
|
|
3
|
+
import { UnlockedBySchema } from '../../unlocked-by-subscription.schema';
|
|
4
|
+
|
|
5
|
+
export const InteriorDesignModelParamsSchema = z.object({
|
|
6
|
+
imageAttachment: z.object({
|
|
7
|
+
supported: z.boolean(),
|
|
8
|
+
maxImages: z.number(),
|
|
9
|
+
acceptedTypes: z.array(z.string()),
|
|
10
|
+
}),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type InteriorDesignModelParams = z.infer<typeof InteriorDesignModelParamsSchema>;
|
|
14
|
+
|
|
15
|
+
export const InteriorDesignModelPricingRuleConditionSchema = z.object({
|
|
16
|
+
withoutSub: z.boolean().optional(),
|
|
17
|
+
});
|
|
18
|
+
export type InteriorDesignModelPricingRuleCondition = z.infer<
|
|
19
|
+
typeof InteriorDesignModelPricingRuleConditionSchema
|
|
20
|
+
>;
|
|
21
|
+
|
|
22
|
+
export const InteriorDesignModelPricingRulesSchema = z.array(
|
|
23
|
+
z.object({
|
|
24
|
+
condition: InteriorDesignModelPricingRuleConditionSchema,
|
|
25
|
+
value: z.number(),
|
|
26
|
+
}),
|
|
27
|
+
);
|
|
28
|
+
export type InteriorDesignModelPricingRules = z.infer<typeof InteriorDesignModelPricingRulesSchema>;
|
|
29
|
+
|
|
30
|
+
export const InteriorDesignModelSchema = z.object({
|
|
31
|
+
uuid: z.string(),
|
|
32
|
+
title: z.string(),
|
|
33
|
+
description: z.string(),
|
|
34
|
+
price: z.number(),
|
|
35
|
+
order: z.number(),
|
|
36
|
+
icons: IconVariantsSchema,
|
|
37
|
+
maxPromptLength: z.number(),
|
|
38
|
+
params: InteriorDesignModelParamsSchema,
|
|
39
|
+
pricingRules: InteriorDesignModelPricingRulesSchema,
|
|
40
|
+
unlockedBy: UnlockedBySchema.nullable(),
|
|
41
|
+
canUse: z.boolean(),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export type InteriorDesignModel = z.infer<typeof InteriorDesignModelSchema>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ToolJobSchema } from '../../tool-job.schema';
|
|
3
2
|
import { USER_REACTION } from '../../../constants';
|
|
3
|
+
import { ToolJobSchema } from '../../tool-job.schema';
|
|
4
4
|
|
|
5
5
|
export const VideoJobParamsSchema = z.object({
|
|
6
6
|
imageUrls: z.string().array().optional(),
|
|
@@ -31,6 +31,7 @@ export const VideoJobSchema = ToolJobSchema.extend({
|
|
|
31
31
|
.nullable(),
|
|
32
32
|
params: VideoJobParamsSchema,
|
|
33
33
|
modelId: z.string(),
|
|
34
|
+
thumbnail: z.string().nullable(),
|
|
34
35
|
isPublished: z.boolean(),
|
|
35
36
|
postId: z.string().nullable(),
|
|
36
37
|
});
|