@purpleschool/gptbot 0.7.53 → 0.7.54-presentations
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/presentation.ts +5 -0
- package/build/api/controllers/http/presentation.js +4 -0
- package/build/commands/chat/create-chat.command.js +1 -3
- package/build/commands/chat/find-chat-by-uuid.command.js +1 -1
- package/build/commands/chat/find-chats.command.js +1 -3
- package/build/commands/chat/get-last-active-chat-command.js +1 -1
- package/build/commands/folder/find-folder-by-uuid-with-chats.command.js +1 -3
- package/build/commands/tools/presentation/build-blank-slide.command.js +21 -0
- package/build/commands/tools/presentation/generate-and-insert-slide.command.js +22 -0
- package/build/commands/tools/presentation/index.js +4 -0
- package/build/commands/tools/presentation/update-presentation-slides.command.js +25 -0
- package/build/commands/tools/presentation/update-presentation.command.js +4 -3
- package/build/commands/tools/presentation/update-slide-image-slot.command.js +36 -0
- package/build/constants/presentation/enums/index.js +1 -0
- package/build/constants/presentation/enums/slide-image-slot-action.enum.js +8 -0
- package/build/models/chat-with-messages.schema.js +9 -0
- package/build/models/chat.schema.js +0 -2
- package/build/models/index.js +1 -0
- package/build/models/tools/presentation/presentation.schema.js +2 -0
- package/build/models/tools/presentation/slide-content-edit.schema.js +135 -0
- package/build/models/tools/presentation/slide-content.schema.js +22 -20
- package/build/models/tools/presentation/slide.schema.js +32 -1
- package/commands/chat/create-chat.command.ts +2 -4
- package/commands/chat/find-chat-by-uuid.command.ts +2 -2
- package/commands/chat/find-chats.command.ts +2 -6
- package/commands/chat/get-last-active-chat-command.ts +2 -2
- package/commands/folder/find-folder-by-uuid-with-chats.command.ts +2 -6
- package/commands/tools/presentation/build-blank-slide.command.ts +23 -0
- package/commands/tools/presentation/generate-and-insert-slide.command.ts +27 -0
- package/commands/tools/presentation/index.ts +4 -0
- package/commands/tools/presentation/update-presentation-slides.command.ts +32 -0
- package/commands/tools/presentation/update-presentation.command.ts +5 -4
- package/commands/tools/presentation/update-slide-image-slot.command.ts +41 -0
- package/constants/presentation/enums/index.ts +1 -0
- package/constants/presentation/enums/slide-image-slot-action.enum.ts +4 -0
- package/models/chat-with-messages.schema.ts +7 -0
- package/models/chat.schema.ts +0 -2
- package/models/index.ts +1 -0
- package/models/tools/presentation/presentation.schema.ts +2 -0
- package/models/tools/presentation/slide-content-edit.schema.ts +160 -0
- package/models/tools/presentation/slide-content.schema.ts +119 -32
- package/models/tools/presentation/slide.schema.ts +38 -0
- package/package.json +1 -1
|
@@ -16,6 +16,11 @@ export const PRESENTATION_ROUTES = {
|
|
|
16
16
|
UPDATE_PRESENTATION_OUTLINE: (uuid: string) => `${uuid}/outline`,
|
|
17
17
|
UPDATE_SLIDE_OUTLINE: (presentationId: string, slideOutlineId: string) =>
|
|
18
18
|
`${presentationId}/outline/${slideOutlineId}`,
|
|
19
|
+
UPDATE_PRESENTATION_SLIDES: (uuid: string) => `${uuid}/slides`,
|
|
20
|
+
GENERATE_AND_INSERT_SLIDE: (uuid: string) => `${uuid}/slides/generate-and-insert`,
|
|
21
|
+
BUILD_BLANK_SLIDE: 'slides/blank',
|
|
22
|
+
UPDATE_SLIDE_IMAGE_SLOT: (presentationId: string, slideId: string, slotId: string) =>
|
|
23
|
+
`${presentationId}/slides/${slideId}/image-slots/${slotId}`,
|
|
19
24
|
REPOSITION_SLIDE_OUTLINE: (presentationId: string, slideOutlineId: string) =>
|
|
20
25
|
`${presentationId}/outline/${slideOutlineId}/move`,
|
|
21
26
|
DELETE_SLIDE_OUTLINE: (presentationId: string, slideOutlineId: string) =>
|
|
@@ -17,6 +17,10 @@ exports.PRESENTATION_ROUTES = {
|
|
|
17
17
|
GENERATE_SLIDES: (uuid) => `${uuid}/slides/generate`,
|
|
18
18
|
UPDATE_PRESENTATION_OUTLINE: (uuid) => `${uuid}/outline`,
|
|
19
19
|
UPDATE_SLIDE_OUTLINE: (presentationId, slideOutlineId) => `${presentationId}/outline/${slideOutlineId}`,
|
|
20
|
+
UPDATE_PRESENTATION_SLIDES: (uuid) => `${uuid}/slides`,
|
|
21
|
+
GENERATE_AND_INSERT_SLIDE: (uuid) => `${uuid}/slides/generate-and-insert`,
|
|
22
|
+
BUILD_BLANK_SLIDE: 'slides/blank',
|
|
23
|
+
UPDATE_SLIDE_IMAGE_SLOT: (presentationId, slideId, slotId) => `${presentationId}/slides/${slideId}/image-slots/${slotId}`,
|
|
20
24
|
REPOSITION_SLIDE_OUTLINE: (presentationId, slideOutlineId) => `${presentationId}/outline/${slideOutlineId}/move`,
|
|
21
25
|
DELETE_SLIDE_OUTLINE: (presentationId, slideOutlineId) => `${presentationId}/outline/${slideOutlineId}`,
|
|
22
26
|
CREATE_SLIDE_OUTLINE: (presentationId) => `${presentationId}/outline`,
|
|
@@ -12,8 +12,6 @@ var CreateChatCommand;
|
|
|
12
12
|
folderId: zod_1.z.string().uuid().optional(),
|
|
13
13
|
});
|
|
14
14
|
CreateChatCommand.ResponseSchema = zod_1.z.object({
|
|
15
|
-
data: models_1.
|
|
16
|
-
messages: zod_1.z.array(models_1.MessageSchema),
|
|
17
|
-
}),
|
|
15
|
+
data: models_1.ChatWithMessagesSchema,
|
|
18
16
|
});
|
|
19
17
|
})(CreateChatCommand || (exports.CreateChatCommand = CreateChatCommand = {}));
|
|
@@ -9,6 +9,6 @@ var FindChatByUUIDCommand;
|
|
|
9
9
|
uuid: true,
|
|
10
10
|
});
|
|
11
11
|
FindChatByUUIDCommand.ResponseSchema = zod_1.z.object({
|
|
12
|
-
data: models_1.
|
|
12
|
+
data: models_1.ChatWithMessagesSchema,
|
|
13
13
|
});
|
|
14
14
|
})(FindChatByUUIDCommand || (exports.FindChatByUUIDCommand = FindChatByUUIDCommand = {}));
|
|
@@ -13,9 +13,7 @@ var FindChatsCommand;
|
|
|
13
13
|
const QuerySchema = zod_1.z.intersection(models_1.ChatSchema.pick({ categoryId: true, aIModelId: true }).partial(), models_1.AiModelSchema.pick({ contentType: true }).partial());
|
|
14
14
|
FindChatsCommand.RequestQuerySchema = zod_1.z.intersection(QuerySchema, PaginationQuerySchema);
|
|
15
15
|
FindChatsCommand.ResponseSchema = zod_1.z.object({
|
|
16
|
-
data: zod_1.z.array(models_1.ChatSchema
|
|
17
|
-
messages: zod_1.z.array(models_1.MessageSchema),
|
|
18
|
-
})),
|
|
16
|
+
data: zod_1.z.array(models_1.ChatSchema),
|
|
19
17
|
page: zod_1.z.number(),
|
|
20
18
|
totalPages: zod_1.z.number(),
|
|
21
19
|
});
|
|
@@ -10,6 +10,6 @@ var GetLastActiveChatCommand;
|
|
|
10
10
|
aIModelId: true,
|
|
11
11
|
});
|
|
12
12
|
GetLastActiveChatCommand.Response = zod_1.z.object({
|
|
13
|
-
data: models_1.
|
|
13
|
+
data: models_1.ChatWithMessagesSchema,
|
|
14
14
|
});
|
|
15
15
|
})(GetLastActiveChatCommand || (exports.GetLastActiveChatCommand = GetLastActiveChatCommand = {}));
|
|
@@ -17,9 +17,7 @@ var FindFolderByUuidWithChatsCommand;
|
|
|
17
17
|
});
|
|
18
18
|
FindFolderByUuidWithChatsCommand.ResponseSchema = zod_1.default.object({
|
|
19
19
|
data: models_1.FolderSchema.extend({
|
|
20
|
-
chats: zod_1.default.array(models_1.ChatSchema
|
|
21
|
-
messages: zod_1.default.array(models_1.MessageSchema),
|
|
22
|
-
})),
|
|
20
|
+
chats: zod_1.default.array(models_1.ChatSchema),
|
|
23
21
|
}),
|
|
24
22
|
page: zod_1.default.number(),
|
|
25
23
|
totalPages: zod_1.default.number(),
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BuildBlankSlideCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
var BuildBlankSlideCommand;
|
|
6
|
+
(function (BuildBlankSlideCommand) {
|
|
7
|
+
BuildBlankSlideCommand.RequestSchema = zod_1.z.object({
|
|
8
|
+
slideContentType: zod_1.z.string(),
|
|
9
|
+
});
|
|
10
|
+
BuildBlankSlideCommand.ResponseSchema = zod_1.z.object({
|
|
11
|
+
data: zod_1.z.object({
|
|
12
|
+
uuid: zod_1.z.string().uuid(),
|
|
13
|
+
order: zod_1.z.number(),
|
|
14
|
+
contentTypeId: zod_1.z.string(),
|
|
15
|
+
layoutId: zod_1.z.string(),
|
|
16
|
+
content: zod_1.z.record(zod_1.z.any()),
|
|
17
|
+
createdAt: zod_1.z.date(),
|
|
18
|
+
updatedAt: zod_1.z.date(),
|
|
19
|
+
}),
|
|
20
|
+
});
|
|
21
|
+
})(BuildBlankSlideCommand || (exports.BuildBlankSlideCommand = BuildBlankSlideCommand = {}));
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GenerateAndInsertSlideCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const presentation_1 = require("../../../models/tools/presentation");
|
|
6
|
+
const constants_1 = require("../../../constants");
|
|
7
|
+
var GenerateAndInsertSlideCommand;
|
|
8
|
+
(function (GenerateAndInsertSlideCommand) {
|
|
9
|
+
GenerateAndInsertSlideCommand.RequestSchema = zod_1.z.object({
|
|
10
|
+
contentTypeId: zod_1.z.nativeEnum(constants_1.SLIDE_CONTENT_TYPE),
|
|
11
|
+
prompt: zod_1.z.string().min(1).max(10000),
|
|
12
|
+
title: zod_1.z.string().min(1).max(80),
|
|
13
|
+
position: zod_1.z.number().min(0),
|
|
14
|
+
layoutId: zod_1.z.nativeEnum(constants_1.SLIDE_LAYOUT).optional(),
|
|
15
|
+
});
|
|
16
|
+
GenerateAndInsertSlideCommand.RequestParamsSchema = zod_1.z.object({
|
|
17
|
+
uuid: zod_1.z.string().uuid(),
|
|
18
|
+
});
|
|
19
|
+
GenerateAndInsertSlideCommand.ResponseSchema = zod_1.z.object({
|
|
20
|
+
data: zod_1.z.array(presentation_1.SlideSchema),
|
|
21
|
+
});
|
|
22
|
+
})(GenerateAndInsertSlideCommand || (exports.GenerateAndInsertSlideCommand = GenerateAndInsertSlideCommand = {}));
|
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./build-blank-slide.command"), exports);
|
|
17
18
|
__exportStar(require("./create-presentation.command"), exports);
|
|
18
19
|
__exportStar(require("./delete-all-user-presentations.command"), exports);
|
|
19
20
|
__exportStar(require("./delete-slide-outline.command"), exports);
|
|
@@ -23,9 +24,12 @@ __exportStar(require("./find-presentation-by-uuid.command"), exports);
|
|
|
23
24
|
__exportStar(require("./find-presentation-outline.command"), exports);
|
|
24
25
|
__exportStar(require("./find-presentations.command"), exports);
|
|
25
26
|
__exportStar(require("./generate-presentation-slides.command"), exports);
|
|
27
|
+
__exportStar(require("./generate-and-insert-slide.command"), exports);
|
|
26
28
|
__exportStar(require("./get-presentation-config.command"), exports);
|
|
27
29
|
__exportStar(require("./reposition-slide-outline.command"), exports);
|
|
28
30
|
__exportStar(require("./update-slide-outline.command"), exports);
|
|
29
31
|
__exportStar(require("./update-presentation-outline.command"), exports);
|
|
30
32
|
__exportStar(require("./update-presentation.command"), exports);
|
|
33
|
+
__exportStar(require("./update-presentation-slides.command"), exports);
|
|
34
|
+
__exportStar(require("./update-slide-image-slot.command"), exports);
|
|
31
35
|
__exportStar(require("./update-slide-outline.command"), exports);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdatePresentationSlidesCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const presentation_1 = require("../../../models/tools/presentation");
|
|
6
|
+
var UpdatePresentationSlidesCommand;
|
|
7
|
+
(function (UpdatePresentationSlidesCommand) {
|
|
8
|
+
UpdatePresentationSlidesCommand.RequestSchema = zod_1.z.object({
|
|
9
|
+
data: presentation_1.SlideBulkUpdateSchema,
|
|
10
|
+
});
|
|
11
|
+
UpdatePresentationSlidesCommand.RequestParamsSchema = zod_1.z.object({
|
|
12
|
+
uuid: zod_1.z.string().uuid(),
|
|
13
|
+
});
|
|
14
|
+
UpdatePresentationSlidesCommand.ResponseSchema = zod_1.z.object({
|
|
15
|
+
data: zod_1.z.array(zod_1.z.object({
|
|
16
|
+
uuid: zod_1.z.string().uuid(),
|
|
17
|
+
order: zod_1.z.number(),
|
|
18
|
+
contentTypeId: zod_1.z.string(),
|
|
19
|
+
layoutId: zod_1.z.string(),
|
|
20
|
+
content: zod_1.z.record(zod_1.z.any()),
|
|
21
|
+
createdAt: zod_1.z.date(),
|
|
22
|
+
updatedAt: zod_1.z.date(),
|
|
23
|
+
})),
|
|
24
|
+
});
|
|
25
|
+
})(UpdatePresentationSlidesCommand || (exports.UpdatePresentationSlidesCommand = UpdatePresentationSlidesCommand = {}));
|
|
@@ -8,9 +8,10 @@ var UpdatePresentationCommand;
|
|
|
8
8
|
UpdatePresentationCommand.RequestParamsSchema = zod_1.z.object({
|
|
9
9
|
uuid: zod_1.z.string().uuid(),
|
|
10
10
|
});
|
|
11
|
-
UpdatePresentationCommand.RequestBodySchema =
|
|
12
|
-
title:
|
|
13
|
-
|
|
11
|
+
UpdatePresentationCommand.RequestBodySchema = presentation_1.PresentationSchema.pick({
|
|
12
|
+
title: true,
|
|
13
|
+
templateId: true,
|
|
14
|
+
}).partial();
|
|
14
15
|
UpdatePresentationCommand.ResponseSchema = zod_1.z.object({
|
|
15
16
|
data: presentation_1.PresentationSchema,
|
|
16
17
|
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateSlideImageSlotCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("../../../constants");
|
|
6
|
+
const slide_image_slot_schema_1 = require("../../../models/tools/presentation/slide-image-slot.schema");
|
|
7
|
+
var UpdateSlideImageSlotCommand;
|
|
8
|
+
(function (UpdateSlideImageSlotCommand) {
|
|
9
|
+
const ReplacePayload = zod_1.z.object({
|
|
10
|
+
action: zod_1.z.literal(constants_1.SLIDE_IMAGE_SLOT_ACTION.REPLACE),
|
|
11
|
+
url: zod_1.z.string().url(),
|
|
12
|
+
});
|
|
13
|
+
const GeneratePayload = zod_1.z.object({
|
|
14
|
+
action: zod_1.z.literal(constants_1.SLIDE_IMAGE_SLOT_ACTION.GENERATE),
|
|
15
|
+
prompt: zod_1.z.string().min(1).max(1000).optional(),
|
|
16
|
+
});
|
|
17
|
+
const UpdateImageSlotPayload = zod_1.z.discriminatedUnion('action', [
|
|
18
|
+
ReplacePayload,
|
|
19
|
+
GeneratePayload,
|
|
20
|
+
]);
|
|
21
|
+
UpdateSlideImageSlotCommand.RequestSchema = zod_1.z.object({
|
|
22
|
+
payload: UpdateImageSlotPayload,
|
|
23
|
+
});
|
|
24
|
+
UpdateSlideImageSlotCommand.RequestParamsSchema = zod_1.z.object({
|
|
25
|
+
presentationId: zod_1.z.string().uuid(),
|
|
26
|
+
slideId: zod_1.z.string().uuid(),
|
|
27
|
+
slotId: zod_1.z.string().uuid().optional(),
|
|
28
|
+
});
|
|
29
|
+
UpdateSlideImageSlotCommand.ResponseSchema = zod_1.z.object({
|
|
30
|
+
data: zod_1.z.object({
|
|
31
|
+
oldImage: zod_1.z.string().url().optional(),
|
|
32
|
+
newImage: zod_1.z.string().url(),
|
|
33
|
+
imageSlot: slide_image_slot_schema_1.SlideImageSlotSchema,
|
|
34
|
+
}),
|
|
35
|
+
});
|
|
36
|
+
})(UpdateSlideImageSlotCommand || (exports.UpdateSlideImageSlotCommand = UpdateSlideImageSlotCommand = {}));
|
|
@@ -19,3 +19,4 @@ __exportStar(require("./slide-content-type.enum"), exports);
|
|
|
19
19
|
__exportStar(require("./slide-icon-slot-status.enum"), exports);
|
|
20
20
|
__exportStar(require("./slide-image-slot.status.enum"), exports);
|
|
21
21
|
__exportStar(require("./slide-layout.enum"), exports);
|
|
22
|
+
__exportStar(require("./slide-image-slot-action.enum"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SLIDE_IMAGE_SLOT_ACTION = void 0;
|
|
4
|
+
var SLIDE_IMAGE_SLOT_ACTION;
|
|
5
|
+
(function (SLIDE_IMAGE_SLOT_ACTION) {
|
|
6
|
+
SLIDE_IMAGE_SLOT_ACTION["REPLACE"] = "REPLACE";
|
|
7
|
+
SLIDE_IMAGE_SLOT_ACTION["GENERATE"] = "GENERATE";
|
|
8
|
+
})(SLIDE_IMAGE_SLOT_ACTION || (exports.SLIDE_IMAGE_SLOT_ACTION = SLIDE_IMAGE_SLOT_ACTION = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChatWithMessagesSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const chat_schema_1 = require("./chat.schema");
|
|
6
|
+
const message_schema_1 = require("./message.schema");
|
|
7
|
+
exports.ChatWithMessagesSchema = chat_schema_1.ChatSchema.extend({
|
|
8
|
+
messages: zod_1.z.array(message_schema_1.MessageSchema),
|
|
9
|
+
});
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ChatSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
|
-
const message_schema_1 = require("./message.schema");
|
|
7
6
|
exports.ChatSchema = zod_1.z.object({
|
|
8
7
|
uuid: zod_1.z.string().uuid(),
|
|
9
8
|
userId: zod_1.z.nullable(zod_1.z.string().uuid()),
|
|
@@ -12,7 +11,6 @@ exports.ChatSchema = zod_1.z.object({
|
|
|
12
11
|
aIModelId: zod_1.z.string().uuid(),
|
|
13
12
|
title: zod_1.z.string(),
|
|
14
13
|
chatStatus: zod_1.z.enum(Object.values(constants_1.CHAT_STATUS_ENUM)),
|
|
15
|
-
messages: zod_1.z.array(message_schema_1.MessageSchema),
|
|
16
14
|
folderId: zod_1.z.string().nullable(),
|
|
17
15
|
createdAt: zod_1.z.date(),
|
|
18
16
|
updatedAt: zod_1.z.date(),
|
package/build/models/index.js
CHANGED
|
@@ -20,6 +20,7 @@ __exportStar(require("./ai-model-formatted.schema"), exports);
|
|
|
20
20
|
__exportStar(require("./ai-model.schema"), exports);
|
|
21
21
|
__exportStar(require("./ai-vendor.schema"), exports);
|
|
22
22
|
__exportStar(require("./category.schema"), exports);
|
|
23
|
+
__exportStar(require("./chat-with-messages.schema"), exports);
|
|
23
24
|
__exportStar(require("./chat.schema"), exports);
|
|
24
25
|
__exportStar(require("./cloud-payments-receipt.schema"), exports);
|
|
25
26
|
__exportStar(require("./course-author.schema"), exports);
|
|
@@ -15,6 +15,8 @@ exports.PresentationSchema = zod_1.z.object({
|
|
|
15
15
|
templateId: zod_1.z.string(),
|
|
16
16
|
downloadUrl: zod_1.z.string().nullable(),
|
|
17
17
|
slideCount: zod_1.z.number(),
|
|
18
|
+
lastContentUpdateAt: zod_1.z.date().nullable(),
|
|
19
|
+
lastPptxExportedAt: zod_1.z.date().nullable(),
|
|
18
20
|
createdAt: zod_1.z.date(),
|
|
19
21
|
updatedAt: zod_1.z.date(),
|
|
20
22
|
});
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SlideContentUserEditSchema = exports.ChartSlideDataUserEditSchema = exports.BarChartSlideDataUserEditSchema = exports.TableSlideDataUserEditSchema = exports.SectionBreakSlideDataUserEditSchema = exports.ImageSlideDataUserEditSchema = exports.ContentsSlideDataUserEditSchema = exports.StructuredListSlideDataUserEditSchema = exports.TextSlideDataUserEditSchema = exports.ThankYouSlideDataUserEditSchema = exports.CoverSlideDataUserEditSchema = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const slide_content_schema_1 = require("./slide-content.schema");
|
|
9
|
+
const constants_1 = require("../../../constants");
|
|
10
|
+
exports.CoverSlideDataUserEditSchema = zod_1.default.object({
|
|
11
|
+
contentType: zod_1.default.literal(constants_1.SLIDE_CONTENT_TYPE.COVER),
|
|
12
|
+
title: zod_1.default.string().min(1).max(500),
|
|
13
|
+
author: zod_1.default.object({
|
|
14
|
+
label: zod_1.default.string().min(1).max(100),
|
|
15
|
+
value: zod_1.default.string().min(1).max(200),
|
|
16
|
+
}),
|
|
17
|
+
date: zod_1.default.object({
|
|
18
|
+
label: zod_1.default.string().min(1).max(100),
|
|
19
|
+
value: zod_1.default.string().min(1).max(200),
|
|
20
|
+
}),
|
|
21
|
+
email: zod_1.default.object({
|
|
22
|
+
label: zod_1.default.string().min(1).max(100),
|
|
23
|
+
value: zod_1.default.string().min(1).max(200),
|
|
24
|
+
}),
|
|
25
|
+
version: zod_1.default.literal(1),
|
|
26
|
+
});
|
|
27
|
+
exports.ThankYouSlideDataUserEditSchema = zod_1.default.object({
|
|
28
|
+
contentType: zod_1.default.literal(constants_1.SLIDE_CONTENT_TYPE.THANK_YOU),
|
|
29
|
+
title: zod_1.default.string().min(1).max(500),
|
|
30
|
+
author: zod_1.default.object({
|
|
31
|
+
label: zod_1.default.string().min(1).max(100),
|
|
32
|
+
value: zod_1.default.string().min(1).max(200),
|
|
33
|
+
}),
|
|
34
|
+
date: zod_1.default.object({
|
|
35
|
+
label: zod_1.default.string().min(1).max(100),
|
|
36
|
+
value: zod_1.default.string().min(1).max(200),
|
|
37
|
+
}),
|
|
38
|
+
email: zod_1.default.object({
|
|
39
|
+
label: zod_1.default.string().min(1).max(100),
|
|
40
|
+
value: zod_1.default.string().min(1).max(200),
|
|
41
|
+
}),
|
|
42
|
+
version: zod_1.default.literal(1),
|
|
43
|
+
});
|
|
44
|
+
exports.TextSlideDataUserEditSchema = zod_1.default.object({
|
|
45
|
+
contentType: zod_1.default.literal(constants_1.SLIDE_CONTENT_TYPE.TEXT),
|
|
46
|
+
title: zod_1.default.string().min(1).max(500),
|
|
47
|
+
description: zod_1.default.string().min(1).max(3000),
|
|
48
|
+
version: zod_1.default.literal(1),
|
|
49
|
+
});
|
|
50
|
+
exports.StructuredListSlideDataUserEditSchema = zod_1.default.object({
|
|
51
|
+
contentType: zod_1.default.literal(constants_1.SLIDE_CONTENT_TYPE.STRUCTURED_LIST),
|
|
52
|
+
title: zod_1.default.string().min(1).max(500),
|
|
53
|
+
description: zod_1.default.string().min(1).max(1000),
|
|
54
|
+
list: zod_1.default
|
|
55
|
+
.array(zod_1.default.object({
|
|
56
|
+
title: zod_1.default.string().min(1).max(200),
|
|
57
|
+
description: zod_1.default.string().min(1).max(500),
|
|
58
|
+
}))
|
|
59
|
+
.min(1)
|
|
60
|
+
.max(10),
|
|
61
|
+
version: zod_1.default.literal(1),
|
|
62
|
+
});
|
|
63
|
+
exports.ContentsSlideDataUserEditSchema = zod_1.default.object({
|
|
64
|
+
contentType: zod_1.default.literal(constants_1.SLIDE_CONTENT_TYPE.CONTENTS),
|
|
65
|
+
title: zod_1.default.string().min(1).max(500),
|
|
66
|
+
items: zod_1.default
|
|
67
|
+
.array(zod_1.default.object({
|
|
68
|
+
pageNumber: zod_1.default.number(),
|
|
69
|
+
title: zod_1.default.string().min(1).max(500),
|
|
70
|
+
}))
|
|
71
|
+
.min(1)
|
|
72
|
+
.max(50),
|
|
73
|
+
version: zod_1.default.literal(1),
|
|
74
|
+
});
|
|
75
|
+
exports.ImageSlideDataUserEditSchema = zod_1.default.object({
|
|
76
|
+
contentType: zod_1.default.literal(constants_1.SLIDE_CONTENT_TYPE.TEXT_WITH_IMAGE),
|
|
77
|
+
title: zod_1.default.string().min(1).max(500),
|
|
78
|
+
description: zod_1.default.string().min(1).max(2000),
|
|
79
|
+
imageSlot: slide_content_schema_1.ImageSlotSchema,
|
|
80
|
+
version: zod_1.default.literal(1),
|
|
81
|
+
});
|
|
82
|
+
exports.SectionBreakSlideDataUserEditSchema = zod_1.default.object({
|
|
83
|
+
contentType: zod_1.default.literal(constants_1.SLIDE_CONTENT_TYPE.SECTION_BREAK),
|
|
84
|
+
title: zod_1.default.string().min(1).max(500),
|
|
85
|
+
description: zod_1.default.string().min(1).max(500),
|
|
86
|
+
version: zod_1.default.literal(1),
|
|
87
|
+
});
|
|
88
|
+
exports.TableSlideDataUserEditSchema = zod_1.default.object({
|
|
89
|
+
contentType: zod_1.default.literal(constants_1.SLIDE_CONTENT_TYPE.TABLE),
|
|
90
|
+
title: zod_1.default.string().min(1).max(500),
|
|
91
|
+
description: zod_1.default.string().min(1).max(1000),
|
|
92
|
+
table: zod_1.default.object({
|
|
93
|
+
columnHeaders: zod_1.default.array(zod_1.default.string().min(1).max(200)).min(1).max(20),
|
|
94
|
+
rows: zod_1.default
|
|
95
|
+
.array(zod_1.default.array(zod_1.default.string().min(1).max(500)))
|
|
96
|
+
.min(1)
|
|
97
|
+
.max(20),
|
|
98
|
+
hasRowHeaders: zod_1.default.boolean(),
|
|
99
|
+
hasSummaryRow: zod_1.default.boolean(),
|
|
100
|
+
}),
|
|
101
|
+
version: zod_1.default.literal(1),
|
|
102
|
+
});
|
|
103
|
+
exports.BarChartSlideDataUserEditSchema = zod_1.default.object({
|
|
104
|
+
type: zod_1.default.literal(slide_content_schema_1.SLIDE_CHART_TYPE.BAR),
|
|
105
|
+
categories: zod_1.default.array(zod_1.default.string().min(1).max(200)).min(1).max(50),
|
|
106
|
+
series: zod_1.default
|
|
107
|
+
.array(zod_1.default.object({
|
|
108
|
+
name: zod_1.default.string().min(1).max(200),
|
|
109
|
+
data: zod_1.default.array(zod_1.default.number()),
|
|
110
|
+
type: zod_1.default.number().min(0).max(11),
|
|
111
|
+
}))
|
|
112
|
+
.min(1)
|
|
113
|
+
.max(5),
|
|
114
|
+
yAxisLabel: zod_1.default.string().max(200).optional(),
|
|
115
|
+
unit: zod_1.default.string().max(50).optional(),
|
|
116
|
+
version: zod_1.default.literal(1),
|
|
117
|
+
});
|
|
118
|
+
exports.ChartSlideDataUserEditSchema = zod_1.default.object({
|
|
119
|
+
contentType: zod_1.default.literal(constants_1.SLIDE_CONTENT_TYPE.CHART),
|
|
120
|
+
title: zod_1.default.string().min(1).max(500),
|
|
121
|
+
description: zod_1.default.string().min(1).max(2000),
|
|
122
|
+
chart: zod_1.default.discriminatedUnion('type', [exports.BarChartSlideDataUserEditSchema]),
|
|
123
|
+
version: zod_1.default.literal(1),
|
|
124
|
+
});
|
|
125
|
+
exports.SlideContentUserEditSchema = zod_1.default.discriminatedUnion('contentType', [
|
|
126
|
+
exports.CoverSlideDataUserEditSchema,
|
|
127
|
+
exports.StructuredListSlideDataUserEditSchema,
|
|
128
|
+
exports.TextSlideDataUserEditSchema,
|
|
129
|
+
exports.ContentsSlideDataUserEditSchema,
|
|
130
|
+
exports.SectionBreakSlideDataUserEditSchema,
|
|
131
|
+
exports.ImageSlideDataUserEditSchema,
|
|
132
|
+
exports.ThankYouSlideDataUserEditSchema,
|
|
133
|
+
exports.TableSlideDataUserEditSchema,
|
|
134
|
+
exports.ChartSlideDataUserEditSchema,
|
|
135
|
+
]);
|
|
@@ -19,9 +19,7 @@ exports.IconSlotSchema = zod_1.z.object({
|
|
|
19
19
|
.string()
|
|
20
20
|
.uuid()
|
|
21
21
|
.describe('Generate a valid uuid for icon slot, that will be used for future lookups'),
|
|
22
|
-
prompt: zod_1.z
|
|
23
|
-
.string()
|
|
24
|
-
.describe('Icons are stored locally. Provide a search query for a fitting icon. MUST BE IN ENGLISH'),
|
|
22
|
+
prompt: zod_1.z.string().describe('Provide a search query for an fitting icon. MUST BE IN ENGLISH'),
|
|
25
23
|
});
|
|
26
24
|
exports.CoverSlideDataSchema = zod_1.z.object({
|
|
27
25
|
contentType: zod_1.z.literal(constants_1.SLIDE_CONTENT_TYPE.COVER),
|
|
@@ -46,15 +44,17 @@ exports.CoverSlideDataSchema = zod_1.z.object({
|
|
|
46
44
|
});
|
|
47
45
|
exports.ThankYouSlideDataSchema = zod_1.z.object({
|
|
48
46
|
contentType: zod_1.z.literal(constants_1.SLIDE_CONTENT_TYPE.THANK_YOU),
|
|
49
|
-
title: zod_1.z
|
|
47
|
+
title: zod_1.z
|
|
48
|
+
.string()
|
|
49
|
+
.describe('"Thank you for your attention" in presentation\'s language')
|
|
50
|
+
.min(10)
|
|
51
|
+
.max(150),
|
|
50
52
|
author: zod_1.z.object({
|
|
51
|
-
label: zod_1.z.string().describe('
|
|
52
|
-
value: zod_1.z
|
|
53
|
-
.string()
|
|
54
|
-
.describe('Literal "Author of the presentation" in presentation\'s language'),
|
|
53
|
+
label: zod_1.z.string().describe('"Author" in presentation\'s language'),
|
|
54
|
+
value: zod_1.z.string().describe('"Author of the presentation" in presentation\'s language'),
|
|
55
55
|
}),
|
|
56
56
|
date: zod_1.z.object({
|
|
57
|
-
label: zod_1.z.string().describe('
|
|
57
|
+
label: zod_1.z.string().describe('"Date" in presentation\'s language'),
|
|
58
58
|
value: zod_1.z
|
|
59
59
|
.string()
|
|
60
60
|
.describe('Date of the presentation in the "dd month yyyy" format in presentation\'s locale'),
|
|
@@ -82,9 +82,9 @@ exports.TextSlideDataSchema = zod_1.z.object({
|
|
|
82
82
|
title: zod_1.z.string().describe('Slide title in about 6 words').min(10).max(150),
|
|
83
83
|
description: zod_1.z
|
|
84
84
|
.string()
|
|
85
|
-
.describe(
|
|
85
|
+
.describe("Fairly long textual description of the point presented in the title. A couple of paragraphs. Consider maximum amount of text to be 600 characters. Don't cut the text short.")
|
|
86
86
|
.min(300)
|
|
87
|
-
.max(
|
|
87
|
+
.max(600),
|
|
88
88
|
version: zod_1.z.literal(1),
|
|
89
89
|
});
|
|
90
90
|
exports.ContentsSlideDataSchema = zod_1.z.object({
|
|
@@ -137,9 +137,9 @@ exports.TableSlideDataSchema = zod_1.z.object({
|
|
|
137
137
|
.max(10)
|
|
138
138
|
.describe('Array of column header labels'),
|
|
139
139
|
rows: zod_1.z
|
|
140
|
-
.array(zod_1.z.array(zod_1.z.string().min(1).max(
|
|
141
|
-
.min(
|
|
142
|
-
.max(
|
|
140
|
+
.array(zod_1.z.array(zod_1.z.string().min(1).max(75)))
|
|
141
|
+
.min(3)
|
|
142
|
+
.max(4)
|
|
143
143
|
.describe('Table rows; each row must have exactly the same number of cells as columnHeaders'),
|
|
144
144
|
hasRowHeaders: zod_1.z.boolean().describe('If table needs special row headers, set this to true'),
|
|
145
145
|
hasSummaryRow: zod_1.z.boolean().describe('If table needs a summary row, set this to true'),
|
|
@@ -150,13 +150,15 @@ exports.TableSlideDataSchema = zod_1.z.object({
|
|
|
150
150
|
exports.BarChartSlideDataSchema = zod_1.z.object({
|
|
151
151
|
type: zod_1.z.literal(SLIDE_CHART_TYPE.BAR),
|
|
152
152
|
categories: zod_1.z
|
|
153
|
-
.array(zod_1.z.string()
|
|
153
|
+
.array(zod_1.z.string())
|
|
154
154
|
.min(1)
|
|
155
155
|
.max(12)
|
|
156
156
|
.describe('Category labels (e.g., months, products, regions)'),
|
|
157
157
|
series: zod_1.z
|
|
158
158
|
.array(zod_1.z.object({
|
|
159
|
-
name: zod_1.z
|
|
159
|
+
name: zod_1.z
|
|
160
|
+
.string()
|
|
161
|
+
.describe('Series name for legend. Try to include measurements if needed'),
|
|
160
162
|
data: zod_1.z.array(zod_1.z.number()).describe('Values corresponding to categories'),
|
|
161
163
|
type: zod_1.z
|
|
162
164
|
.number()
|
|
@@ -165,16 +167,16 @@ exports.BarChartSlideDataSchema = zod_1.z.object({
|
|
|
165
167
|
.describe('Series type. Used to discriminate colors when applying theme'),
|
|
166
168
|
}))
|
|
167
169
|
.min(1)
|
|
168
|
-
.max(
|
|
169
|
-
.describe('Data series for the chart'),
|
|
170
|
+
.max(1)
|
|
171
|
+
.describe('Data series for the chart. Only one series is supported'),
|
|
170
172
|
yAxisLabel: zod_1.z.string().max(40).optional().describe('Y-axis label'),
|
|
171
173
|
unit: zod_1.z.string().max(10).optional().describe('Unit symbol (%, $, etc.)'),
|
|
172
174
|
version: zod_1.z.literal(1),
|
|
173
175
|
});
|
|
174
176
|
exports.ChartSlideDataSchema = zod_1.z.object({
|
|
175
177
|
contentType: zod_1.z.literal(constants_1.SLIDE_CONTENT_TYPE.CHART),
|
|
176
|
-
title: zod_1.z.string().describe('Slide title in about 6 words').
|
|
177
|
-
description: zod_1.z.string().describe("Information on slide's topic").
|
|
178
|
+
title: zod_1.z.string().describe('Slide title in about 2-6 words').max(100),
|
|
179
|
+
description: zod_1.z.string().describe("Information on slide's topic").max(600),
|
|
178
180
|
chart: zod_1.z.discriminatedUnion('type', [exports.BarChartSlideDataSchema]),
|
|
179
181
|
version: zod_1.z.literal(1),
|
|
180
182
|
});
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SlideSchema = void 0;
|
|
3
|
+
exports.SlideBulkUpdateSchema = exports.SlideSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const slide_content_schema_1 = require("./slide-content.schema");
|
|
6
6
|
const constants_1 = require("../../../constants");
|
|
7
7
|
const slide_icon_slot_schema_1 = require("./slide-icon-slot.schema");
|
|
8
8
|
const slide_image_slot_schema_1 = require("./slide-image-slot.schema");
|
|
9
|
+
const slide_content_edit_schema_1 = require("./slide-content-edit.schema");
|
|
9
10
|
exports.SlideSchema = zod_1.z.object({
|
|
10
11
|
uuid: zod_1.z.string().uuid(),
|
|
11
12
|
order: zod_1.z.number(),
|
|
@@ -18,3 +19,33 @@ exports.SlideSchema = zod_1.z.object({
|
|
|
18
19
|
createdAt: zod_1.z.date(),
|
|
19
20
|
updatedAt: zod_1.z.date(),
|
|
20
21
|
});
|
|
22
|
+
exports.SlideBulkUpdateSchema = exports.SlideSchema.pick({
|
|
23
|
+
order: true,
|
|
24
|
+
contentTypeId: true,
|
|
25
|
+
layoutId: true,
|
|
26
|
+
presentationId: true,
|
|
27
|
+
})
|
|
28
|
+
.extend({
|
|
29
|
+
uuid: zod_1.z.string().uuid().optional(),
|
|
30
|
+
content: slide_content_edit_schema_1.SlideContentUserEditSchema,
|
|
31
|
+
})
|
|
32
|
+
.array()
|
|
33
|
+
.min(1, 'Must include at least one slide')
|
|
34
|
+
.refine((arr) => {
|
|
35
|
+
const orders = arr.map((s) => s.order);
|
|
36
|
+
const unique = new Set(orders);
|
|
37
|
+
if (unique.size !== orders.length)
|
|
38
|
+
return false;
|
|
39
|
+
const sorted = [...orders].sort((a, b) => a - b);
|
|
40
|
+
return sorted.every((val, idx) => val === idx);
|
|
41
|
+
}, {
|
|
42
|
+
message: 'Slide orders must be unique and sequential starting at 0',
|
|
43
|
+
path: ['order'],
|
|
44
|
+
})
|
|
45
|
+
.refine((arr) => {
|
|
46
|
+
const [firstId, ...rest] = arr.map((s) => s.presentationId);
|
|
47
|
+
return rest.every((id) => id === firstId);
|
|
48
|
+
}, {
|
|
49
|
+
message: 'All slides must belong to the same presentation',
|
|
50
|
+
path: ['presentationId'],
|
|
51
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChatSchema,
|
|
1
|
+
import { ChatSchema, ChatWithMessagesSchema } from '../../models';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
export namespace CreateChatCommand {
|
|
@@ -12,9 +12,7 @@ export namespace CreateChatCommand {
|
|
|
12
12
|
export type RequestSchema = z.infer<typeof RequestSchema>;
|
|
13
13
|
|
|
14
14
|
export const ResponseSchema = z.object({
|
|
15
|
-
data:
|
|
16
|
-
messages: z.array(MessageSchema),
|
|
17
|
-
}),
|
|
15
|
+
data: ChatWithMessagesSchema,
|
|
18
16
|
});
|
|
19
17
|
|
|
20
18
|
export type Response = z.infer<typeof ResponseSchema>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChatSchema } from '../../models';
|
|
1
|
+
import { ChatSchema, ChatWithMessagesSchema } from '../../models';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
export namespace FindChatByUUIDCommand {
|
|
@@ -9,7 +9,7 @@ export namespace FindChatByUUIDCommand {
|
|
|
9
9
|
export type Request = z.infer<typeof RequestParamsSchema>;
|
|
10
10
|
|
|
11
11
|
export const ResponseSchema = z.object({
|
|
12
|
-
data:
|
|
12
|
+
data: ChatWithMessagesSchema,
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
export type Response = z.infer<typeof ResponseSchema>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AiModelSchema, ChatSchema
|
|
1
|
+
import { AiModelSchema, ChatSchema } from '../../models';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
export namespace FindChatsCommand {
|
|
@@ -18,11 +18,7 @@ export namespace FindChatsCommand {
|
|
|
18
18
|
export type RequestQuery = z.infer<typeof RequestQuerySchema>;
|
|
19
19
|
|
|
20
20
|
export const ResponseSchema = z.object({
|
|
21
|
-
data: z.array(
|
|
22
|
-
ChatSchema.extend({
|
|
23
|
-
messages: z.array(MessageSchema),
|
|
24
|
-
}),
|
|
25
|
-
),
|
|
21
|
+
data: z.array(ChatSchema),
|
|
26
22
|
page: z.number(),
|
|
27
23
|
totalPages: z.number(),
|
|
28
24
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChatSchema } from '../../models';
|
|
1
|
+
import { ChatSchema, ChatWithMessagesSchema } from '../../models';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
export namespace GetLastActiveChatCommand {
|
|
@@ -8,7 +8,7 @@ export namespace GetLastActiveChatCommand {
|
|
|
8
8
|
});
|
|
9
9
|
|
|
10
10
|
export const Response = z.object({
|
|
11
|
-
data:
|
|
11
|
+
data: ChatWithMessagesSchema,
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
export type Response = z.infer<typeof Response>;
|