@purpleschool/gptbot-tools 0.0.114 → 0.0.116
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/build/common/errors/errors.js +5 -0
- package/build/image-generation/commands/index.js +1 -0
- package/build/image-generation/commands/retry-image-generation-job.command.js +21 -0
- package/build/image-generation/routes/image-generation.amqp.routes.js +1 -0
- package/build/video/queries/find-video-job-by-id.query.js +1 -10
- package/common/errors/errors.ts +5 -0
- package/image-generation/commands/index.ts +1 -0
- package/image-generation/commands/retry-image-generation-job.command.ts +21 -0
- package/image-generation/routes/image-generation.amqp.routes.ts +1 -0
- package/package.json +1 -1
- package/video/queries/find-video-job-by-id.query.ts +1 -9
|
@@ -1322,6 +1322,11 @@ exports.ERRORS = {
|
|
|
1322
1322
|
message: 'Произошла ошибка при обновлении задания на генерацию изображения',
|
|
1323
1323
|
httpCode: 500,
|
|
1324
1324
|
},
|
|
1325
|
+
NOT_IN_FAILED_STATE_TO_RETRY: {
|
|
1326
|
+
code: 'IMAGE_GENERATION_JOB.NOT_IN_FAILED_STATE_TO_RETRY',
|
|
1327
|
+
message: 'Задание на генерацию картинки не в состоянии "failed". Невозможно повторить',
|
|
1328
|
+
httpCode: 400,
|
|
1329
|
+
},
|
|
1325
1330
|
},
|
|
1326
1331
|
IMAGE_GENERATION_PRESET: {
|
|
1327
1332
|
FIND_ERROR: {
|
|
@@ -22,3 +22,4 @@ __exportStar(require("./soft-delete-image-generation-jobs-by-criteria.command"),
|
|
|
22
22
|
__exportStar(require("./set-reaction-to-image-generation-job.command"), exports);
|
|
23
23
|
__exportStar(require("./update-image-generation-job-title.command"), exports);
|
|
24
24
|
__exportStar(require("./image-generation-model"), exports);
|
|
25
|
+
__exportStar(require("./retry-image-generation-job.command"), exports);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RetryImageGenerationJobCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const command_response_schema_1 = require("../../common/models/command-response.schema");
|
|
6
|
+
const models_1 = require("../models");
|
|
7
|
+
var RetryImageGenerationJobCommand;
|
|
8
|
+
(function (RetryImageGenerationJobCommand) {
|
|
9
|
+
RetryImageGenerationJobCommand.RequestSchema = zod_1.z.object({
|
|
10
|
+
uuid: zod_1.z.string().uuid(),
|
|
11
|
+
userId: zod_1.z.string().uuid().nullable().optional(),
|
|
12
|
+
unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
|
|
13
|
+
prompt: zod_1.z.string().optional(),
|
|
14
|
+
userBalance: zod_1.z.number(),
|
|
15
|
+
modelId: zod_1.z.string().uuid().optional(),
|
|
16
|
+
params: models_1.ImageGenerationRequestParamsSchema.optional(),
|
|
17
|
+
presetId: zod_1.z.string().uuid().nullable().optional(),
|
|
18
|
+
userHasActiveSubscriptionOrProduct: zod_1.z.boolean(),
|
|
19
|
+
});
|
|
20
|
+
RetryImageGenerationJobCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.ImageGenerationJobSchema);
|
|
21
|
+
})(RetryImageGenerationJobCommand || (exports.RetryImageGenerationJobCommand = RetryImageGenerationJobCommand = {}));
|
|
@@ -12,4 +12,5 @@ exports.IMAGE_GENERATION_AMQP_ROUTES = {
|
|
|
12
12
|
SOFT_DELETE: 'tools.image-generation.jobs.soft-delete.rpc',
|
|
13
13
|
SOFT_DELETE_ALL: 'tools.image-generation.jobs.soft-delete-all.rpc',
|
|
14
14
|
GET_MODEL_BY_UUID: 'tools.image-generation.model.get-by-uuid.rpc',
|
|
15
|
+
RETRY: 'tools.image-generation.jobs.retry.rpc',
|
|
15
16
|
};
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FindVideoJobByIdQuery = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
4
|
const command_response_schema_1 = require("../../common/models/command-response.schema");
|
|
6
5
|
const video_job_schema_1 = require("../models/video-job.schema");
|
|
7
6
|
var FindVideoJobByIdQuery;
|
|
8
7
|
(function (FindVideoJobByIdQuery) {
|
|
9
|
-
FindVideoJobByIdQuery.RequestSchema =
|
|
10
|
-
.object({
|
|
11
|
-
uuid: zod_1.z.string(),
|
|
12
|
-
userId: zod_1.z.string().uuid().nullable().optional(),
|
|
13
|
-
unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
|
|
14
|
-
})
|
|
15
|
-
.refine((data) => data.userId || data.unregisteredUserId, {
|
|
16
|
-
message: 'Either userId or unregisteredUserId must be provided',
|
|
17
|
-
});
|
|
8
|
+
FindVideoJobByIdQuery.RequestSchema = video_job_schema_1.VideoJobSchema.pick({ uuid: true });
|
|
18
9
|
FindVideoJobByIdQuery.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(video_job_schema_1.VideoJobSchema);
|
|
19
10
|
})(FindVideoJobByIdQuery || (exports.FindVideoJobByIdQuery = FindVideoJobByIdQuery = {}));
|
package/common/errors/errors.ts
CHANGED
|
@@ -1332,6 +1332,11 @@ export const ERRORS = {
|
|
|
1332
1332
|
message: 'Произошла ошибка при обновлении задания на генерацию изображения',
|
|
1333
1333
|
httpCode: 500,
|
|
1334
1334
|
},
|
|
1335
|
+
NOT_IN_FAILED_STATE_TO_RETRY: {
|
|
1336
|
+
code: 'IMAGE_GENERATION_JOB.NOT_IN_FAILED_STATE_TO_RETRY',
|
|
1337
|
+
message: 'Задание на генерацию картинки не в состоянии "failed". Невозможно повторить',
|
|
1338
|
+
httpCode: 400,
|
|
1339
|
+
},
|
|
1335
1340
|
},
|
|
1336
1341
|
IMAGE_GENERATION_PRESET: {
|
|
1337
1342
|
FIND_ERROR: {
|
|
@@ -6,3 +6,4 @@ export * from './soft-delete-image-generation-jobs-by-criteria.command';
|
|
|
6
6
|
export * from './set-reaction-to-image-generation-job.command';
|
|
7
7
|
export * from './update-image-generation-job-title.command';
|
|
8
8
|
export * from './image-generation-model';
|
|
9
|
+
export * from './retry-image-generation-job.command';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common/models/command-response.schema';
|
|
3
|
+
import { ImageGenerationJobSchema, ImageGenerationRequestParamsSchema } from '../models';
|
|
4
|
+
|
|
5
|
+
export namespace RetryImageGenerationJobCommand {
|
|
6
|
+
export const RequestSchema = z.object({
|
|
7
|
+
uuid: z.string().uuid(),
|
|
8
|
+
userId: z.string().uuid().nullable().optional(),
|
|
9
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
10
|
+
prompt: z.string().optional(),
|
|
11
|
+
userBalance: z.number(),
|
|
12
|
+
modelId: z.string().uuid().optional(),
|
|
13
|
+
params: ImageGenerationRequestParamsSchema.optional(),
|
|
14
|
+
presetId: z.string().uuid().nullable().optional(),
|
|
15
|
+
userHasActiveSubscriptionOrProduct: z.boolean(),
|
|
16
|
+
});
|
|
17
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
18
|
+
|
|
19
|
+
export const ResponseSchema = ICommandResponseSchema(ImageGenerationJobSchema);
|
|
20
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
21
|
+
}
|
|
@@ -9,4 +9,5 @@ export const IMAGE_GENERATION_AMQP_ROUTES = {
|
|
|
9
9
|
SOFT_DELETE: 'tools.image-generation.jobs.soft-delete.rpc',
|
|
10
10
|
SOFT_DELETE_ALL: 'tools.image-generation.jobs.soft-delete-all.rpc',
|
|
11
11
|
GET_MODEL_BY_UUID: 'tools.image-generation.model.get-by-uuid.rpc',
|
|
12
|
+
RETRY: 'tools.image-generation.jobs.retry.rpc',
|
|
12
13
|
} as const;
|
package/package.json
CHANGED
|
@@ -3,15 +3,7 @@ import { ICommandResponseSchema } from '../../common/models/command-response.sch
|
|
|
3
3
|
import { VideoJobSchema } from '../models/video-job.schema';
|
|
4
4
|
|
|
5
5
|
export namespace FindVideoJobByIdQuery {
|
|
6
|
-
export const RequestSchema =
|
|
7
|
-
.object({
|
|
8
|
-
uuid: z.string(),
|
|
9
|
-
userId: z.string().uuid().nullable().optional(),
|
|
10
|
-
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
11
|
-
})
|
|
12
|
-
.refine((data) => data.userId || data.unregisteredUserId, {
|
|
13
|
-
message: 'Either userId or unregisteredUserId must be provided',
|
|
14
|
-
});
|
|
6
|
+
export const RequestSchema = VideoJobSchema.pick({ uuid: true });
|
|
15
7
|
export type Request = z.infer<typeof RequestSchema>;
|
|
16
8
|
|
|
17
9
|
export const ResponseSchema = ICommandResponseSchema(VideoJobSchema);
|