@purpleschool/multisite 0.0.6 → 0.0.8

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 (125) hide show
  1. package/api/controller/http/image-editor.ts +0 -1
  2. package/api/controller/http/image-generation.ts +0 -1
  3. package/api/controller/http/product.ts +1 -0
  4. package/api/controller/http/subscription.ts +3 -0
  5. package/api/controller/http/unregistered-user.ts +4 -0
  6. package/api/controller/http/user.ts +1 -0
  7. package/api/routes.ts +7 -2
  8. package/build/api/controller/http/image-editor.d.ts +0 -1
  9. package/build/api/controller/http/image-editor.d.ts.map +1 -1
  10. package/build/api/controller/http/image-editor.js +0 -1
  11. package/build/api/controller/http/image-generation.d.ts +0 -1
  12. package/build/api/controller/http/image-generation.d.ts.map +1 -1
  13. package/build/api/controller/http/image-generation.js +0 -1
  14. package/build/api/controller/http/product.d.ts +1 -0
  15. package/build/api/controller/http/product.d.ts.map +1 -1
  16. package/build/api/controller/http/product.js +1 -0
  17. package/build/api/controller/http/subscription.d.ts +3 -0
  18. package/build/api/controller/http/subscription.d.ts.map +1 -1
  19. package/build/api/controller/http/subscription.js +3 -0
  20. package/build/api/controller/http/unregistered-user.d.ts +3 -0
  21. package/build/api/controller/http/unregistered-user.d.ts.map +1 -1
  22. package/build/api/controller/http/unregistered-user.js +4 -1
  23. package/build/api/controller/http/user.d.ts +1 -0
  24. package/build/api/controller/http/user.d.ts.map +1 -1
  25. package/build/api/controller/http/user.js +1 -0
  26. package/build/api/routes.d.ts +6 -2
  27. package/build/api/routes.d.ts.map +1 -1
  28. package/build/api/routes.js +6 -2
  29. package/build/commands/subscription/cancel-subscription.command.d.ts +22 -0
  30. package/build/commands/subscription/cancel-subscription.command.d.ts.map +1 -0
  31. package/build/commands/subscription/cancel-subscription.command.js +14 -0
  32. package/build/commands/subscription/index.d.ts +1 -0
  33. package/build/commands/subscription/index.d.ts.map +1 -1
  34. package/build/commands/subscription/index.js +1 -0
  35. package/build/constants/cloud-payments/index.d.ts +2 -0
  36. package/build/constants/cloud-payments/index.d.ts.map +1 -0
  37. package/build/constants/cloud-payments/index.js +4 -0
  38. package/build/constants/errors/errors.d.ts +5 -0
  39. package/build/constants/errors/errors.d.ts.map +1 -1
  40. package/build/constants/errors/errors.js +5 -0
  41. package/build/constants/index.d.ts +1 -0
  42. package/build/constants/index.d.ts.map +1 -1
  43. package/build/constants/index.js +1 -0
  44. package/build/helpers/image-editor/calculate-image-editor-price.helper.d.ts +7 -0
  45. package/build/helpers/image-editor/calculate-image-editor-price.helper.d.ts.map +1 -0
  46. package/build/helpers/image-editor/calculate-image-editor-price.helper.js +13 -0
  47. package/build/helpers/image-editor/index.d.ts +2 -0
  48. package/build/helpers/image-editor/index.d.ts.map +1 -0
  49. package/build/helpers/image-editor/index.js +17 -0
  50. package/build/helpers/image-generation/calculate-image-generation-price.helper.d.ts +8 -0
  51. package/build/helpers/image-generation/calculate-image-generation-price.helper.d.ts.map +1 -0
  52. package/build/helpers/image-generation/calculate-image-generation-price.helper.js +16 -0
  53. package/build/helpers/image-generation/index.d.ts +2 -0
  54. package/build/helpers/image-generation/index.d.ts.map +1 -0
  55. package/build/helpers/image-generation/index.js +17 -0
  56. package/build/helpers/index.d.ts +3 -0
  57. package/build/helpers/index.d.ts.map +1 -0
  58. package/build/helpers/index.js +18 -0
  59. package/build/index.d.ts +1 -0
  60. package/build/index.d.ts.map +1 -1
  61. package/build/index.js +1 -0
  62. package/build/queries/image-editor/find-image-editor-jobs.command.d.ts +3 -0
  63. package/build/queries/image-editor/find-image-editor-jobs.command.d.ts.map +1 -1
  64. package/build/queries/image-editor/find-image-editor-jobs.command.js +1 -0
  65. package/build/queries/image-editor/index.d.ts +0 -1
  66. package/build/queries/image-editor/index.d.ts.map +1 -1
  67. package/build/queries/image-editor/index.js +0 -1
  68. package/build/queries/image-generation/find-image-generation-jobs.command.d.ts +3 -0
  69. package/build/queries/image-generation/find-image-generation-jobs.command.d.ts.map +1 -1
  70. package/build/queries/image-generation/find-image-generation-jobs.command.js +1 -0
  71. package/build/queries/image-generation/index.d.ts +0 -1
  72. package/build/queries/image-generation/index.d.ts.map +1 -1
  73. package/build/queries/image-generation/index.js +0 -1
  74. package/build/queries/index.d.ts +1 -0
  75. package/build/queries/index.d.ts.map +1 -1
  76. package/build/queries/index.js +1 -0
  77. package/build/queries/subscription/get-subscriptions-summary.command.d.ts +308 -0
  78. package/build/queries/subscription/get-subscriptions-summary.command.d.ts.map +1 -0
  79. package/build/queries/subscription/get-subscriptions-summary.command.js +36 -0
  80. package/build/queries/subscription/index.d.ts +1 -0
  81. package/build/queries/subscription/index.d.ts.map +1 -1
  82. package/build/queries/subscription/index.js +1 -0
  83. package/build/queries/unregistered-user/get-unregistered-user-balance.command.d.ts +37 -0
  84. package/build/queries/unregistered-user/get-unregistered-user-balance.command.d.ts.map +1 -0
  85. package/build/queries/unregistered-user/get-unregistered-user-balance.command.js +15 -0
  86. package/build/queries/unregistered-user/index.d.ts +2 -0
  87. package/build/queries/unregistered-user/index.d.ts.map +1 -0
  88. package/build/queries/unregistered-user/index.js +17 -0
  89. package/build/queries/user/get-user-balance.command.d.ts +37 -0
  90. package/build/queries/user/get-user-balance.command.d.ts.map +1 -0
  91. package/build/queries/user/get-user-balance.command.js +15 -0
  92. package/build/queries/user/index.d.ts +1 -0
  93. package/build/queries/user/index.d.ts.map +1 -1
  94. package/build/queries/user/index.js +1 -0
  95. package/commands/subscription/cancel-subscription.command.ts +16 -0
  96. package/commands/subscription/index.ts +1 -0
  97. package/constants/cloud-payments/index.ts +1 -0
  98. package/constants/errors/errors.ts +5 -0
  99. package/constants/index.ts +1 -0
  100. package/helpers/image-editor/calculate-image-editor-price.helper.ts +23 -0
  101. package/helpers/image-editor/index.ts +1 -0
  102. package/helpers/image-generation/calculate-image-generation-price.helper.ts +29 -0
  103. package/helpers/image-generation/index.ts +1 -0
  104. package/helpers/index.ts +2 -0
  105. package/index.ts +1 -0
  106. package/package.json +1 -1
  107. package/queries/image-editor/find-image-editor-jobs.command.ts +1 -0
  108. package/queries/image-editor/index.ts +0 -1
  109. package/queries/image-generation/find-image-generation-jobs.command.ts +1 -0
  110. package/queries/image-generation/index.ts +0 -1
  111. package/queries/index.ts +1 -0
  112. package/queries/subscription/get-subscriptions-summary.command.ts +38 -0
  113. package/queries/subscription/index.ts +1 -0
  114. package/queries/unregistered-user/get-unregistered-user-balance.command.ts +14 -0
  115. package/queries/unregistered-user/index.ts +1 -0
  116. package/queries/user/get-user-balance.command.ts +14 -0
  117. package/queries/user/index.ts +1 -0
  118. package/build/queries/image-editor/get-image-editor-price.command.d.ts +0 -53
  119. package/build/queries/image-editor/get-image-editor-price.command.d.ts.map +0 -1
  120. package/build/queries/image-editor/get-image-editor-price.command.js +0 -17
  121. package/build/queries/image-generation/get-image-generation-price.command.d.ts +0 -44
  122. package/build/queries/image-generation/get-image-generation-price.command.d.ts.map +0 -1
  123. package/build/queries/image-generation/get-image-generation-price.command.js +0 -19
  124. package/queries/image-editor/get-image-editor-price.command.ts +0 -17
  125. package/queries/image-generation/get-image-generation-price.command.ts +0 -19
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace CancelSubscriptionCommand {
4
+ export const RequestParamSchema = z.object({
5
+ uuidSiteUserToSubscription: z.string().uuid(),
6
+ });
7
+ export type RequestParam = z.infer<typeof RequestParamSchema>;
8
+
9
+ export const RequestSchema = z.object({
10
+ text: z.string().min(1).max(500),
11
+ });
12
+ export type Request = z.infer<typeof RequestSchema>;
13
+
14
+ export const ResponseSchema = z.void();
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -1 +1,2 @@
1
1
  export * from './buy-subscription.command';
2
+ export * from './cancel-subscription.command';
@@ -0,0 +1 @@
1
+ export const CLOUD_PAYMENTS_CANCEL = 'https://api.cloudpayments.ru/subscriptions/cancel';
@@ -201,6 +201,11 @@ export const ERRORS = {
201
201
  code: 'SUBSCRIPTION_005',
202
202
  httpCode: 409,
203
203
  },
204
+ SUBSCRIPTION_CANCEL_ERROR: {
205
+ message: 'Ошибка при отмене подписки',
206
+ code: 'SUBSCRIPTION_006',
207
+ httpCode: 500,
208
+ },
204
209
 
205
210
  // ORDER
206
211
  ORDER_NOT_FOUND: {
@@ -1,5 +1,6 @@
1
1
  export * from './errors';
2
2
  export * from './common';
3
+ export * from './cloud-payments';
3
4
  export * from './user';
4
5
  export * from './payment';
5
6
  export * from './transaction';
@@ -0,0 +1,23 @@
1
+ import { ImageEditorPricingRules } from '../../models';
2
+
3
+ export function calculateImageEditorPrice({
4
+ basePrice,
5
+ userHasActiveSubscriptionOrProduct,
6
+ rules,
7
+ }: {
8
+ basePrice: number;
9
+ userHasActiveSubscriptionOrProduct: boolean;
10
+ rules: ImageEditorPricingRules;
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-image-editor-price.helper';
@@ -0,0 +1,29 @@
1
+ import { ImageGenerationJobParams, ImageGenerationPricingRules } from '../../models';
2
+
3
+ export function calculateImageGenerationPrice({
4
+ basePrice,
5
+ params,
6
+ userHasActiveSubscriptionOrProduct,
7
+ rules,
8
+ }: {
9
+ basePrice: number;
10
+ params: Pick<ImageGenerationJobParams, 'resolution'>;
11
+ userHasActiveSubscriptionOrProduct: boolean;
12
+ rules: ImageGenerationPricingRules;
13
+ }): number {
14
+ let price = basePrice;
15
+
16
+ for (const rule of rules ?? []) {
17
+ const condition = rule.condition;
18
+
19
+ if (condition.resolution && condition.resolution === params.resolution) {
20
+ price += rule.value;
21
+ }
22
+
23
+ if (condition.withoutSub && userHasActiveSubscriptionOrProduct === false) {
24
+ price += rule.value;
25
+ }
26
+ }
27
+
28
+ return price;
29
+ }
@@ -0,0 +1 @@
1
+ export * from './calculate-image-generation-price.helper';
@@ -0,0 +1,2 @@
1
+ export * from './image-generation';
2
+ export * from './image-editor';
package/index.ts CHANGED
@@ -3,3 +3,4 @@ export * from './commands';
3
3
  export * from './queries';
4
4
  export * from './models';
5
5
  export * from './constants';
6
+ export * from './helpers';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/multisite",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "Multisite API contracts (DTO schemas, routes, constants)",
5
5
  "type": "commonjs",
6
6
  "main": "build/index.js",
@@ -5,6 +5,7 @@ export namespace FindImageEditorJobsCommand {
5
5
  export const RequestQuerySchema = z.object({
6
6
  limit: z.coerce.number().int().min(1).max(100).default(20),
7
7
  offset: z.coerce.number().int().min(0).default(0),
8
+ title: z.string().trim().min(1).max(200).optional(),
8
9
  });
9
10
  export type RequestQuery = z.infer<typeof RequestQuerySchema>;
10
11
 
@@ -1,4 +1,3 @@
1
1
  export * from './get-image-editor-config.command';
2
2
  export * from './get-image-editor-job.command';
3
3
  export * from './find-image-editor-jobs.command';
4
- export * from './get-image-editor-price.command';
@@ -5,6 +5,7 @@ export namespace FindImageGenerationJobsCommand {
5
5
  export const RequestQuerySchema = z.object({
6
6
  limit: z.coerce.number().int().min(1).max(100).default(20),
7
7
  offset: z.coerce.number().int().min(0).default(0),
8
+ title: z.string().trim().min(1).max(200).optional(),
8
9
  });
9
10
  export type RequestQuery = z.infer<typeof RequestQuerySchema>;
10
11
 
@@ -1,4 +1,3 @@
1
1
  export * from './get-image-generation-config.command';
2
2
  export * from './get-image-generation-job.command';
3
3
  export * from './find-image-generation-jobs.command';
4
- export * from './get-image-generation-price.command';
package/queries/index.ts CHANGED
@@ -3,6 +3,7 @@ export * from './subscription';
3
3
  export * from './payment';
4
4
  export * from './file';
5
5
  export * from './user';
6
+ export * from './unregistered-user';
6
7
  export * from './image-generation';
7
8
  export * from './image-editor';
8
9
  export * from './page';
@@ -0,0 +1,38 @@
1
+ import { z } from 'zod';
2
+ import { SubscriptionSchema, ProductSchema } from '../../models';
3
+ import { USER_TO_SUBSCRIPTION_STATUS, USER_TO_PRODUCT_STATUS } from '../../constants';
4
+
5
+ const FeatureSchema = z.object({
6
+ type: z.string(),
7
+ name: z.string(),
8
+ });
9
+
10
+ const UserToSubscriptionSummarySchema = z.object({
11
+ uuid: z.string().uuid(),
12
+ initTokenBalance: z.number().int(),
13
+ tokenBalance: z.number().int(),
14
+ carriedOverTokenBalance: z.number().int(),
15
+ status: z.nativeEnum(USER_TO_SUBSCRIPTION_STATUS),
16
+ active: z.boolean(),
17
+ createdAt: z.date().or(z.string().datetime()),
18
+ subscription: SubscriptionSchema,
19
+ });
20
+
21
+ const UserToProductSummarySchema = z.object({
22
+ uuid: z.string().uuid(),
23
+ initTokenBalance: z.number().int(),
24
+ tokenBalance: z.number().int(),
25
+ status: z.nativeEnum(USER_TO_PRODUCT_STATUS),
26
+ createdAt: z.date().or(z.string().datetime()),
27
+ product: ProductSchema,
28
+ });
29
+
30
+ export namespace GetSubscriptionsSummaryCommand {
31
+ export const ResponseSchema = z.object({
32
+ subscriptions: z.array(UserToSubscriptionSummarySchema),
33
+ products: z.array(UserToProductSummarySchema),
34
+ features: z.array(FeatureSchema),
35
+ });
36
+
37
+ export type Response = z.infer<typeof ResponseSchema>;
38
+ }
@@ -1 +1,2 @@
1
1
  export * from './find-subscriptions.command';
2
+ export * from './get-subscriptions-summary.command';
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace GetUnregisteredUserBalanceCommand {
4
+ export const ResponseSchema = z.object({
5
+ data: z.object({
6
+ subscriptionTokens: z.number().int().min(0),
7
+ productTokens: z.number().int().min(0),
8
+ bonusTokens: z.number().int().min(0),
9
+ totalTokens: z.number().int().min(0),
10
+ }),
11
+ });
12
+
13
+ export type Response = z.infer<typeof ResponseSchema>;
14
+ }
@@ -0,0 +1 @@
1
+ export * from './get-unregistered-user-balance.command';
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace GetUserBalanceCommand {
4
+ export const ResponseSchema = z.object({
5
+ data: z.object({
6
+ subscriptionTokens: z.number().int().min(0),
7
+ productTokens: z.number().int().min(0),
8
+ bonusTokens: z.number().int().min(0),
9
+ totalTokens: z.number().int().min(0),
10
+ }),
11
+ });
12
+
13
+ export type Response = z.infer<typeof ResponseSchema>;
14
+ }
@@ -1,3 +1,4 @@
1
1
  export * from './get-user.command';
2
+ export * from './get-user-balance.command';
2
3
  export * from './get-my-products.command';
3
4
  export * from './get-my-subscriptions.command';
@@ -1,53 +0,0 @@
1
- import { z } from 'zod';
2
- export declare namespace GetImageEditorPriceCommand {
3
- const RequestSchema: z.ZodObject<{
4
- modelId: z.ZodString;
5
- params: z.ZodDefault<z.ZodOptional<z.ZodObject<{
6
- imageUrls: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
7
- systemPromptId: z.ZodOptional<z.ZodString>;
8
- aspectRatio: z.ZodOptional<z.ZodString>;
9
- }, "strip", z.ZodTypeAny, {
10
- imageUrls: string[];
11
- aspectRatio?: string | undefined;
12
- systemPromptId?: string | undefined;
13
- }, {
14
- aspectRatio?: string | undefined;
15
- imageUrls?: string[] | undefined;
16
- systemPromptId?: string | undefined;
17
- }>>>;
18
- }, "strip", z.ZodTypeAny, {
19
- params: {
20
- imageUrls: string[];
21
- aspectRatio?: string | undefined;
22
- systemPromptId?: string | undefined;
23
- };
24
- modelId: string;
25
- }, {
26
- modelId: string;
27
- params?: {
28
- aspectRatio?: string | undefined;
29
- imageUrls?: string[] | undefined;
30
- systemPromptId?: string | undefined;
31
- } | undefined;
32
- }>;
33
- type Request = z.infer<typeof RequestSchema>;
34
- const ResponseSchema: z.ZodObject<{
35
- data: z.ZodObject<{
36
- price: z.ZodNumber;
37
- }, "strip", z.ZodTypeAny, {
38
- price: number;
39
- }, {
40
- price: number;
41
- }>;
42
- }, "strip", z.ZodTypeAny, {
43
- data: {
44
- price: number;
45
- };
46
- }, {
47
- data: {
48
- price: number;
49
- };
50
- }>;
51
- type Response = z.infer<typeof ResponseSchema>;
52
- }
53
- //# sourceMappingURL=get-image-editor-price.command.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-image-editor-price.command.d.ts","sourceRoot":"","sources":["../../../queries/image-editor/get-image-editor-price.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,yBAAiB,0BAA0B,CAAC;IACjC,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAGxB,CAAC;IACH,KAAY,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;IAE7C,MAAM,cAAc;;;;;;;;;;;;;;;;MAIzB,CAAC;IACH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GetImageEditorPriceCommand = void 0;
4
- const zod_1 = require("zod");
5
- const models_1 = require("../../models");
6
- var GetImageEditorPriceCommand;
7
- (function (GetImageEditorPriceCommand) {
8
- GetImageEditorPriceCommand.RequestSchema = zod_1.z.object({
9
- modelId: zod_1.z.string().uuid(),
10
- params: models_1.ImageEditorJobRequestParamsSchema.optional().default({ imageUrls: [] }),
11
- });
12
- GetImageEditorPriceCommand.ResponseSchema = zod_1.z.object({
13
- data: zod_1.z.object({
14
- price: zod_1.z.number().int().nonnegative(),
15
- }),
16
- });
17
- })(GetImageEditorPriceCommand || (exports.GetImageEditorPriceCommand = GetImageEditorPriceCommand = {}));
@@ -1,44 +0,0 @@
1
- import { z } from 'zod';
2
- import { IMAGE_GENERATION_RESOLUTION } from '../../constants';
3
- export declare namespace GetImageGenerationPriceCommand {
4
- const RequestSchema: z.ZodObject<{
5
- modelId: z.ZodString;
6
- params: z.ZodObject<{
7
- resolution: z.ZodOptional<z.ZodNativeEnum<typeof IMAGE_GENERATION_RESOLUTION>>;
8
- }, "strip", z.ZodTypeAny, {
9
- resolution?: IMAGE_GENERATION_RESOLUTION | undefined;
10
- }, {
11
- resolution?: IMAGE_GENERATION_RESOLUTION | undefined;
12
- }>;
13
- }, "strip", z.ZodTypeAny, {
14
- params: {
15
- resolution?: IMAGE_GENERATION_RESOLUTION | undefined;
16
- };
17
- modelId: string;
18
- }, {
19
- params: {
20
- resolution?: IMAGE_GENERATION_RESOLUTION | undefined;
21
- };
22
- modelId: string;
23
- }>;
24
- type Request = z.infer<typeof RequestSchema>;
25
- const ResponseSchema: z.ZodObject<{
26
- data: z.ZodObject<{
27
- price: z.ZodNumber;
28
- }, "strip", z.ZodTypeAny, {
29
- price: number;
30
- }, {
31
- price: number;
32
- }>;
33
- }, "strip", z.ZodTypeAny, {
34
- data: {
35
- price: number;
36
- };
37
- }, {
38
- data: {
39
- price: number;
40
- };
41
- }>;
42
- type Response = z.infer<typeof ResponseSchema>;
43
- }
44
- //# sourceMappingURL=get-image-generation-price.command.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-image-generation-price.command.d.ts","sourceRoot":"","sources":["../../../queries/image-generation/get-image-generation-price.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAE9D,yBAAiB,8BAA8B,CAAC;IACrC,MAAM,aAAa;;;;;;;;;;;;;;;;;;;MAKxB,CAAC;IACH,KAAY,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;IAE7C,MAAM,cAAc;;;;;;;;;;;;;;;;MAIzB,CAAC;IACH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GetImageGenerationPriceCommand = void 0;
4
- const zod_1 = require("zod");
5
- const constants_1 = require("../../constants");
6
- var GetImageGenerationPriceCommand;
7
- (function (GetImageGenerationPriceCommand) {
8
- GetImageGenerationPriceCommand.RequestSchema = zod_1.z.object({
9
- modelId: zod_1.z.string().uuid(),
10
- params: zod_1.z.object({
11
- resolution: zod_1.z.nativeEnum(constants_1.IMAGE_GENERATION_RESOLUTION).optional(),
12
- }),
13
- });
14
- GetImageGenerationPriceCommand.ResponseSchema = zod_1.z.object({
15
- data: zod_1.z.object({
16
- price: zod_1.z.number().int().nonnegative(),
17
- }),
18
- });
19
- })(GetImageGenerationPriceCommand || (exports.GetImageGenerationPriceCommand = GetImageGenerationPriceCommand = {}));
@@ -1,17 +0,0 @@
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
- }
@@ -1,19 +0,0 @@
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
- }