@purpleschool/multisite 0.0.1
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 +7 -0
- package/api/controller/http/cloud-payments.ts +6 -0
- package/api/controller/http/file.ts +7 -0
- package/api/controller/http/health.ts +4 -0
- package/api/controller/http/image-generation.ts +15 -0
- package/api/controller/http/index.ts +12 -0
- package/api/controller/http/payment.ts +6 -0
- package/api/controller/http/product.ts +7 -0
- package/api/controller/http/subscription.ts +8 -0
- package/api/controller/http/transaction.ts +6 -0
- package/api/controller/http/unregistered-user.ts +1 -0
- package/api/controller/http/user.ts +5 -0
- package/api/controller/index.ts +2 -0
- package/api/index.ts +2 -0
- package/api/routes.ts +76 -0
- package/build/api/controller/http/ai-proxy.js +7 -0
- package/build/api/controller/http/auth.js +8 -0
- package/build/api/controller/http/cloud-payments.js +7 -0
- package/build/api/controller/http/file.js +8 -0
- package/build/api/controller/http/health.js +6 -0
- package/build/api/controller/http/image-generation.js +17 -0
- package/build/api/controller/http/index.js +28 -0
- package/build/api/controller/http/payment.js +7 -0
- package/build/api/controller/http/product.js +9 -0
- package/build/api/controller/http/subscription.js +9 -0
- package/build/api/controller/http/transaction.js +7 -0
- package/build/api/controller/http/unregistered-user.js +4 -0
- package/build/api/controller/http/user.js +7 -0
- package/build/api/controller/index.js +17 -0
- package/build/api/index.js +18 -0
- package/build/api/routes.js +103 -0
- package/build/commands/auth/index.js +18 -0
- package/build/commands/auth/login.command.js +17 -0
- package/build/commands/auth/register.command.js +17 -0
- package/build/commands/file/index.js +17 -0
- package/build/commands/file/upload-file.command.js +11 -0
- package/build/commands/image-generation/execute-image-generation.command.js +17 -0
- package/build/commands/image-generation/index.js +23 -0
- package/build/commands/image-generation/proxy-image-generation-callback.command.js +21 -0
- package/build/commands/image-generation/retry-image-generation-job.command.js +17 -0
- package/build/commands/image-generation/set-reaction-to-image-generation-job.command.js +26 -0
- package/build/commands/image-generation/soft-delete-image-generation-job-by-uuid.command.js +10 -0
- package/build/commands/image-generation/soft-delete-image-generation-jobs-by-criteria.command.js +10 -0
- package/build/commands/image-generation/update-image-generation-job-title.command.js +14 -0
- package/build/commands/index.js +24 -0
- package/build/commands/payment/cloud-payments.command.js +47 -0
- package/build/commands/payment/index.js +17 -0
- package/build/commands/product/buy-product.command.js +17 -0
- package/build/commands/product/index.js +17 -0
- package/build/commands/subscription/buy-subscription.command.js +17 -0
- package/build/commands/subscription/index.js +17 -0
- package/build/commands/transaction/index.js +17 -0
- package/build/commands/transaction/write-off.command.js +19 -0
- package/build/commands/unregistered-user/index.js +17 -0
- package/build/commands/unregistered-user/upsert-unregistered-user.command.js +16 -0
- package/build/constants/common/enums/index.js +17 -0
- package/build/constants/common/enums/user-reaction.enum.js +8 -0
- package/build/constants/common/index.js +17 -0
- package/build/constants/errors/errors.js +298 -0
- package/build/constants/errors/index.js +17 -0
- package/build/constants/files/enums/file-type.enum.js +7 -0
- package/build/constants/files/enums/index.js +17 -0
- package/build/constants/files/index.js +17 -0
- package/build/constants/image-generation/enums/image-generation-model-strategy.enum.js +18 -0
- package/build/constants/image-generation/enums/image-generation-resolution.enum.js +9 -0
- package/build/constants/image-generation/enums/index.js +18 -0
- package/build/constants/image-generation/index.js +17 -0
- package/build/constants/index.js +28 -0
- package/build/constants/order/enums/index.js +18 -0
- package/build/constants/order/enums/order-status.enum.js +9 -0
- package/build/constants/order/enums/order-type.enum.js +7 -0
- package/build/constants/order/index.js +17 -0
- package/build/constants/payment/enums/index.js +17 -0
- package/build/constants/payment/enums/payment-status.enum.js +7 -0
- package/build/constants/payment/index.js +17 -0
- package/build/constants/subscription/free-subscription-id.constant.js +4 -0
- package/build/constants/subscription/index.js +17 -0
- package/build/constants/tools/enums/index.js +20 -0
- package/build/constants/tools/enums/job-request-origin.enum.js +7 -0
- package/build/constants/tools/enums/job-status.enum.js +9 -0
- package/build/constants/tools/enums/tool-model-status.enum.js +8 -0
- package/build/constants/tools/enums/tool-type.enum.js +7 -0
- package/build/constants/tools/index.js +17 -0
- package/build/constants/transaction/enums/index.js +17 -0
- package/build/constants/transaction/enums/transaction-status.enum.js +9 -0
- package/build/constants/transaction/index.js +17 -0
- package/build/constants/user/enums/index.js +18 -0
- package/build/constants/user/enums/user-role.enum.js +9 -0
- package/build/constants/user/enums/user-status.enum.js +9 -0
- package/build/constants/user/index.js +17 -0
- package/build/constants/user-to-product/enums/index.js +17 -0
- package/build/constants/user-to-product/enums/user-to-product-status.enum.js +7 -0
- package/build/constants/user-to-product/index.js +17 -0
- package/build/constants/user-to-subscription/enums/index.js +17 -0
- package/build/constants/user-to-subscription/enums/user-to-subscription-status.enum.js +7 -0
- package/build/constants/user-to-subscription/index.js +17 -0
- package/build/index.js +21 -0
- package/build/models/cloud-payments-widget-data.schema.js +17 -0
- package/build/models/cloud-payments-widget.schema.js +17 -0
- package/build/models/common/attached-file.schema.js +14 -0
- package/build/models/common/icon-variants.schema.js +12 -0
- package/build/models/common/index.js +20 -0
- package/build/models/common/json-value.schema.js +6 -0
- package/build/models/common/receipt.schema.js +18 -0
- package/build/models/file.schema.js +15 -0
- package/build/models/image-generation/image-generation-config.schema.js +10 -0
- package/build/models/image-generation/image-generation-job-attempt.schema.js +11 -0
- package/build/models/image-generation/image-generation-job-params.schema.js +12 -0
- package/build/models/image-generation/image-generation-job-request-params.schema.js +11 -0
- package/build/models/image-generation/image-generation-job.schema.js +32 -0
- package/build/models/image-generation/image-generation-model-params.schema.js +20 -0
- package/build/models/image-generation/image-generation-model.schema.js +30 -0
- package/build/models/image-generation/image-generation-preset.schema.js +10 -0
- package/build/models/image-generation/image-generation-pricing-rule.schema.js +14 -0
- package/build/models/image-generation/image-generation-vendor.schema.js +9 -0
- package/build/models/image-generation/index.js +26 -0
- package/build/models/index.js +25 -0
- package/build/models/product.schema.js +12 -0
- package/build/models/subscription.schema.js +14 -0
- package/build/models/tools/index.js +17 -0
- package/build/models/tools/vendor.schema.js +11 -0
- package/build/models/user.schema.js +13 -0
- package/build/queries/file/find-files.command.js +20 -0
- package/build/queries/file/get-file.command.js +14 -0
- package/build/queries/file/index.js +18 -0
- package/build/queries/image-generation/find-image-generation-jobs.command.js +20 -0
- package/build/queries/image-generation/get-image-generation-config.command.js +11 -0
- package/build/queries/image-generation/get-image-generation-job.command.js +14 -0
- package/build/queries/image-generation/get-image-generation-price.command.js +19 -0
- package/build/queries/image-generation/index.js +20 -0
- package/build/queries/index.js +22 -0
- package/build/queries/payment/get-payment-history.command.js +18 -0
- package/build/queries/payment/index.js +17 -0
- package/build/queries/product/find-products.command.js +11 -0
- package/build/queries/product/index.js +17 -0
- package/build/queries/subscription/find-subscriptions.command.js +11 -0
- package/build/queries/subscription/index.js +17 -0
- package/build/queries/user/get-my-products.command.js +19 -0
- package/build/queries/user/get-my-subscriptions.command.js +21 -0
- package/build/queries/user/get-user.command.js +16 -0
- package/build/queries/user/index.js +19 -0
- package/commands/auth/index.ts +2 -0
- package/commands/auth/login.command.ts +18 -0
- package/commands/auth/register.command.ts +18 -0
- package/commands/file/index.ts +1 -0
- package/commands/file/upload-file.command.ts +10 -0
- package/commands/image-generation/execute-image-generation.command.ts +20 -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 +20 -0
- package/commands/image-generation/set-reaction-to-image-generation-job.command.ts +29 -0
- package/commands/image-generation/soft-delete-image-generation-job-by-uuid.command.ts +10 -0
- package/commands/image-generation/soft-delete-image-generation-jobs-by-criteria.command.ts +10 -0
- package/commands/image-generation/update-image-generation-job-title.command.ts +17 -0
- package/commands/index.ts +8 -0
- package/commands/payment/cloud-payments.command.ts +53 -0
- package/commands/payment/index.ts +1 -0
- package/commands/product/buy-product.command.ts +20 -0
- package/commands/product/index.ts +1 -0
- package/commands/subscription/buy-subscription.command.ts +20 -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 +2 -0
- package/commands/unregistered-user/upsert-unregistered-user.command.ts +17 -0
- package/constants/common/enums/index.ts +2 -0
- package/constants/common/enums/user-reaction.enum.ts +5 -0
- package/constants/common/index.ts +2 -0
- package/constants/errors/errors.ts +308 -0
- package/constants/errors/index.ts +2 -0
- package/constants/files/enums/file-type.enum.ts +4 -0
- package/constants/files/enums/index.ts +2 -0
- package/constants/files/index.ts +2 -0
- package/constants/image-generation/enums/image-generation-model-strategy.enum.ts +15 -0
- package/constants/image-generation/enums/image-generation-resolution.enum.ts +6 -0
- package/constants/image-generation/enums/index.ts +2 -0
- package/constants/image-generation/index.ts +2 -0
- package/constants/index.ts +12 -0
- package/constants/order/enums/index.ts +3 -0
- package/constants/order/enums/order-status.enum.ts +6 -0
- package/constants/order/enums/order-type.enum.ts +4 -0
- package/constants/order/index.ts +2 -0
- package/constants/payment/enums/index.ts +2 -0
- package/constants/payment/enums/payment-status.enum.ts +4 -0
- package/constants/payment/index.ts +2 -0
- package/constants/subscription/free-subscription-id.constant.ts +2 -0
- package/constants/subscription/index.ts +2 -0
- package/constants/tools/enums/index.ts +4 -0
- package/constants/tools/enums/job-request-origin.enum.ts +4 -0
- package/constants/tools/enums/job-status.enum.ts +6 -0
- package/constants/tools/enums/tool-model-status.enum.ts +5 -0
- package/constants/tools/enums/tool-type.enum.ts +4 -0
- package/constants/tools/index.ts +2 -0
- package/constants/transaction/enums/index.ts +2 -0
- package/constants/transaction/enums/transaction-status.enum.ts +6 -0
- package/constants/transaction/index.ts +2 -0
- package/constants/user/enums/index.ts +3 -0
- package/constants/user/enums/user-role.enum.ts +6 -0
- package/constants/user/enums/user-status.enum.ts +6 -0
- package/constants/user/index.ts +2 -0
- package/constants/user-to-product/enums/index.ts +2 -0
- package/constants/user-to-product/enums/user-to-product-status.enum.ts +4 -0
- package/constants/user-to-product/index.ts +2 -0
- package/constants/user-to-subscription/enums/index.ts +2 -0
- package/constants/user-to-subscription/enums/user-to-subscription-status.enum.ts +4 -0
- package/constants/user-to-subscription/index.ts +2 -0
- package/index.ts +5 -0
- package/models/cloud-payments-widget-data.schema.ts +19 -0
- package/models/cloud-payments-widget.schema.ts +15 -0
- package/models/common/attached-file.schema.ts +14 -0
- package/models/common/icon-variants.schema.ts +13 -0
- package/models/common/index.ts +4 -0
- package/models/common/json-value.schema.ts +11 -0
- package/models/common/receipt.schema.ts +20 -0
- package/models/file.schema.ts +14 -0
- package/models/image-generation/image-generation-config.schema.ts +11 -0
- package/models/image-generation/image-generation-job-attempt.schema.ts +12 -0
- package/models/image-generation/image-generation-job-params.schema.ts +11 -0
- package/models/image-generation/image-generation-job-request-params.schema.ts +11 -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 +11 -0
- package/models/image-generation/image-generation-pricing-rule.schema.ts +20 -0
- package/models/image-generation/image-generation-vendor.schema.ts +9 -0
- package/models/image-generation/index.ts +10 -0
- package/models/index.ts +9 -0
- package/models/product.schema.ts +10 -0
- package/models/subscription.schema.ts +12 -0
- package/models/tools/index.ts +2 -0
- package/models/tools/vendor.schema.ts +12 -0
- package/models/user.schema.ts +11 -0
- package/package.json +18 -0
- package/queries/file/find-files.command.ts +21 -0
- package/queries/file/get-file.command.ts +15 -0
- package/queries/file/index.ts +3 -0
- package/queries/image-generation/find-image-generation-jobs.command.ts +21 -0
- package/queries/image-generation/get-image-generation-config.command.ts +9 -0
- package/queries/image-generation/get-image-generation-job.command.ts +15 -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 +7 -0
- package/queries/payment/get-payment-history.command.ts +17 -0
- package/queries/payment/index.ts +2 -0
- package/queries/product/find-products.command.ts +10 -0
- package/queries/product/index.ts +2 -0
- package/queries/subscription/find-subscriptions.command.ts +10 -0
- package/queries/subscription/index.ts +2 -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,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FindSubscriptionsCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
var FindSubscriptionsCommand;
|
|
7
|
+
(function (FindSubscriptionsCommand) {
|
|
8
|
+
FindSubscriptionsCommand.ResponseSchema = zod_1.z.object({
|
|
9
|
+
data: zod_1.z.array(models_1.SubscriptionSchema),
|
|
10
|
+
});
|
|
11
|
+
})(FindSubscriptionsCommand || (exports.FindSubscriptionsCommand = FindSubscriptionsCommand = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./find-subscriptions.command"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetMyProductsCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
const constants_1 = require("../../constants");
|
|
7
|
+
var GetMyProductsCommand;
|
|
8
|
+
(function (GetMyProductsCommand) {
|
|
9
|
+
GetMyProductsCommand.ResponseSchema = zod_1.z.object({
|
|
10
|
+
data: zod_1.z.array(zod_1.z.object({
|
|
11
|
+
uuid: zod_1.z.string().uuid(),
|
|
12
|
+
initTokenBalance: zod_1.z.number().int(),
|
|
13
|
+
tokenBalance: zod_1.z.number().int(),
|
|
14
|
+
status: zod_1.z.nativeEnum(constants_1.USER_TO_PRODUCT_STATUS),
|
|
15
|
+
createdAt: zod_1.z.date().or(zod_1.z.string().datetime()),
|
|
16
|
+
product: models_1.ProductSchema,
|
|
17
|
+
})),
|
|
18
|
+
});
|
|
19
|
+
})(GetMyProductsCommand || (exports.GetMyProductsCommand = GetMyProductsCommand = {}));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetMySubscriptionsCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
const constants_1 = require("../../constants");
|
|
7
|
+
var GetMySubscriptionsCommand;
|
|
8
|
+
(function (GetMySubscriptionsCommand) {
|
|
9
|
+
GetMySubscriptionsCommand.ResponseSchema = zod_1.z.object({
|
|
10
|
+
data: zod_1.z.array(zod_1.z.object({
|
|
11
|
+
uuid: zod_1.z.string().uuid(),
|
|
12
|
+
initTokenBalance: zod_1.z.number().int(),
|
|
13
|
+
tokenBalance: zod_1.z.number().int(),
|
|
14
|
+
carriedOverTokenBalance: zod_1.z.number().int(),
|
|
15
|
+
status: zod_1.z.nativeEnum(constants_1.USER_TO_SUBSCRIPTION_STATUS),
|
|
16
|
+
active: zod_1.z.boolean(),
|
|
17
|
+
createdAt: zod_1.z.date().or(zod_1.z.string().datetime()),
|
|
18
|
+
subscription: models_1.SubscriptionSchema,
|
|
19
|
+
})),
|
|
20
|
+
});
|
|
21
|
+
})(GetMySubscriptionsCommand || (exports.GetMySubscriptionsCommand = GetMySubscriptionsCommand = {}));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetUserCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
var GetUserCommand;
|
|
7
|
+
(function (GetUserCommand) {
|
|
8
|
+
GetUserCommand.ResponseSchema = zod_1.z.object({
|
|
9
|
+
data: zod_1.z.object({
|
|
10
|
+
uuid: zod_1.z.string().uuid(),
|
|
11
|
+
email: zod_1.z.string().email(),
|
|
12
|
+
role: zod_1.z.nativeEnum(constants_1.USER_ROLE),
|
|
13
|
+
siteId: zod_1.z.string().uuid(),
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
16
|
+
})(GetUserCommand || (exports.GetUserCommand = GetUserCommand = {}));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./get-user.command"), exports);
|
|
18
|
+
__exportStar(require("./get-my-products.command"), exports);
|
|
19
|
+
__exportStar(require("./get-my-subscriptions.command"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UserSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace LoginCommand {
|
|
5
|
+
export const RequestSchema = UserSchema.pick({
|
|
6
|
+
email: true,
|
|
7
|
+
password: true,
|
|
8
|
+
});
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: z.object({
|
|
13
|
+
accessToken: z.string(),
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
16
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
17
|
+
}
|
|
18
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UserSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace RegisterCommand {
|
|
5
|
+
export const RequestSchema = UserSchema.pick({
|
|
6
|
+
email: true,
|
|
7
|
+
password: true,
|
|
8
|
+
});
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: z.object({
|
|
13
|
+
accessToken: z.string(),
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
16
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
17
|
+
}
|
|
18
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './upload-file.command';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ImageGenerationJobRequestParamsSchema, ImageGenerationJobSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace ExecuteImageGenerationCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
modelId: z.string().uuid(),
|
|
7
|
+
prompt: z.string().min(1).max(4000),
|
|
8
|
+
presetId: z.string().uuid().nullable().optional(),
|
|
9
|
+
params: ImageGenerationJobRequestParamsSchema,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
13
|
+
|
|
14
|
+
export const ResponseSchema = z.object({
|
|
15
|
+
data: ImageGenerationJobSchema,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
19
|
+
}
|
|
20
|
+
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './execute-image-generation.command';
|
|
2
|
+
export * from './retry-image-generation-job.command';
|
|
3
|
+
export * from './set-reaction-to-image-generation-job.command';
|
|
4
|
+
export * from './update-image-generation-job-title.command';
|
|
5
|
+
export * from './soft-delete-image-generation-job-by-uuid.command';
|
|
6
|
+
export * from './soft-delete-image-generation-jobs-by-criteria.command';
|
|
7
|
+
export * from './proxy-image-generation-callback.command';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace ProxyImageGenerationCallbackCommand {
|
|
4
|
+
export const RequestSchema = z.object({
|
|
5
|
+
model: z.string(),
|
|
6
|
+
response: z
|
|
7
|
+
.object({
|
|
8
|
+
data: z.array(z.string()),
|
|
9
|
+
externalId: z.string(),
|
|
10
|
+
type: z.string(),
|
|
11
|
+
errorMsg: z.string().optional(),
|
|
12
|
+
})
|
|
13
|
+
.optional(),
|
|
14
|
+
});
|
|
15
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
16
|
+
|
|
17
|
+
export const ResponseSchema = z.object({
|
|
18
|
+
ok: z.boolean(),
|
|
19
|
+
});
|
|
20
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ImageGenerationJobRequestParamsSchema, ImageGenerationJobSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace RetryImageGenerationJobCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
prompt: z.string().min(1).max(4000).optional(),
|
|
7
|
+
modelId: z.string().uuid().optional(),
|
|
8
|
+
presetId: z.string().uuid().nullable().optional(),
|
|
9
|
+
params: ImageGenerationJobRequestParamsSchema.optional(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
13
|
+
|
|
14
|
+
export const ResponseSchema = z.object({
|
|
15
|
+
data: ImageGenerationJobSchema,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
19
|
+
}
|
|
20
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { USER_REACTION } from '../../constants';
|
|
3
|
+
import { ImageGenerationJobSchema } from '../../models';
|
|
4
|
+
|
|
5
|
+
export namespace SetReactionToImageGenerationJobCommand {
|
|
6
|
+
export const RequestSchema = z
|
|
7
|
+
.object({
|
|
8
|
+
reaction: z.nativeEnum(USER_REACTION).nullable(),
|
|
9
|
+
dislikeReason: z.string().nullable().default(null),
|
|
10
|
+
})
|
|
11
|
+
.superRefine((data, ctx) => {
|
|
12
|
+
if (data.reaction !== USER_REACTION.DISLIKE && data.dislikeReason) {
|
|
13
|
+
ctx.addIssue({
|
|
14
|
+
code: z.ZodIssueCode.custom,
|
|
15
|
+
message: 'Dislike reason is not allowed when reaction is not dislike',
|
|
16
|
+
path: ['dislikeReason'],
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
22
|
+
|
|
23
|
+
export const ResponseSchema = z.object({
|
|
24
|
+
data: ImageGenerationJobSchema,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
28
|
+
}
|
|
29
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ImageGenerationJobSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace UpdateImageGenerationJobTitleCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
title: z.string().min(1).max(200),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: ImageGenerationJobSchema,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
|
17
|
+
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { JsonValueSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace CloudPaymentsCheckCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
transactionId: z.union([z.string(), z.number()]).optional(),
|
|
7
|
+
amount: z.union([z.string(), z.number()]),
|
|
8
|
+
paymentAmount: z.union([z.string(), z.number()]),
|
|
9
|
+
currency: z.string(),
|
|
10
|
+
paymentCurrency: z.string(),
|
|
11
|
+
invoiceId: z.string().optional(),
|
|
12
|
+
accountId: z.string().optional(),
|
|
13
|
+
data: z.string().optional(),
|
|
14
|
+
});
|
|
15
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
16
|
+
|
|
17
|
+
export const ResponseSchema = z.object({
|
|
18
|
+
code: z.number(),
|
|
19
|
+
});
|
|
20
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export namespace CloudPaymentsPayCommand {
|
|
24
|
+
export const RequestSchema = z.object({
|
|
25
|
+
transactionId: z.number().optional(),
|
|
26
|
+
amount: z.number(),
|
|
27
|
+
currency: z.string().optional().default('RUB'),
|
|
28
|
+
paymentAmount: z.union([z.string(), z.number()]).optional(),
|
|
29
|
+
paymentCurrency: z.string().optional(),
|
|
30
|
+
invoiceId: z.string().optional(),
|
|
31
|
+
accountId: z.string(),
|
|
32
|
+
subscriptionId: z.string().optional(),
|
|
33
|
+
data: JsonValueSchema.optional(),
|
|
34
|
+
});
|
|
35
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
36
|
+
|
|
37
|
+
export const ResponseSchema = z.object({ code: z.number() });
|
|
38
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export namespace CloudPaymentsRecurrentCommand {
|
|
42
|
+
export const RequestSchema = z.object({
|
|
43
|
+
id: z.string(),
|
|
44
|
+
accountId: z.string(),
|
|
45
|
+
status: z.string(),
|
|
46
|
+
failedTransactionsNumber: z.number().optional(),
|
|
47
|
+
lastTransactionDate: z.string().optional(),
|
|
48
|
+
});
|
|
49
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
50
|
+
|
|
51
|
+
export const ResponseSchema = z.object({ code: z.number() });
|
|
52
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './cloud-payments.command';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CloudPaymentsWidgetSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace BuyProductCommand {
|
|
5
|
+
export const RequestParamSchema = z.object({
|
|
6
|
+
uuid: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
9
|
+
|
|
10
|
+
export const RequestSchema = z.object({
|
|
11
|
+
promocode: z.string().min(1).max(64).optional(),
|
|
12
|
+
});
|
|
13
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
14
|
+
|
|
15
|
+
export const ResponseSchema = z.object({
|
|
16
|
+
data: CloudPaymentsWidgetSchema,
|
|
17
|
+
});
|
|
18
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
19
|
+
}
|
|
20
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './buy-product.command';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CloudPaymentsWidgetSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace BuySubscriptionCommand {
|
|
5
|
+
export const RequestParamSchema = z.object({
|
|
6
|
+
uuid: z.string().uuid(),
|
|
7
|
+
});
|
|
8
|
+
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
9
|
+
|
|
10
|
+
export const RequestSchema = z.object({
|
|
11
|
+
promocode: z.string().min(1).max(64).optional(),
|
|
12
|
+
});
|
|
13
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
14
|
+
|
|
15
|
+
export const ResponseSchema = z.object({
|
|
16
|
+
data: CloudPaymentsWidgetSchema,
|
|
17
|
+
});
|
|
18
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
19
|
+
}
|
|
20
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './buy-subscription.command';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './write-off.command';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { TRANSACTION_STATUS } from '../../constants';
|
|
3
|
+
|
|
4
|
+
export namespace WriteOffCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
sum: z.number().int().positive(),
|
|
7
|
+
description: z.string().min(1).max(500).default('Использование токенов'),
|
|
8
|
+
});
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: z.object({
|
|
13
|
+
transactionId: z.string().uuid(),
|
|
14
|
+
status: z.nativeEnum(TRANSACTION_STATUS),
|
|
15
|
+
remainingSum: z.number().int(),
|
|
16
|
+
}),
|
|
17
|
+
});
|
|
18
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace UpsertUnregisteredUserCommand {
|
|
4
|
+
export const RequestSchema = z.object({});
|
|
5
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
6
|
+
|
|
7
|
+
export const ResponseSchema = z.object({
|
|
8
|
+
data: z.object({
|
|
9
|
+
unregisteredUserId: z.string().uuid(),
|
|
10
|
+
accessToken: z.string(),
|
|
11
|
+
tokenBalance: z.number().int(),
|
|
12
|
+
expiresAt: z.coerce.date(),
|
|
13
|
+
}),
|
|
14
|
+
});
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
|
17
|
+
|