@purpleschool/gptbot 0.12.53 → 0.12.55

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 (29) hide show
  1. package/api/controllers/http/canvas.ts +9 -0
  2. package/api/controllers/http/index.ts +1 -0
  3. package/api/routes.ts +10 -0
  4. package/build/api/controllers/http/canvas.js +11 -0
  5. package/build/api/controllers/http/index.js +1 -0
  6. package/build/api/routes.js +7 -0
  7. package/build/commands/canvas/create-canvas.command.js +14 -0
  8. package/build/commands/canvas/delete-canvas.command.js +16 -0
  9. package/build/commands/canvas/find-canvas-by-uuid.query.js +14 -0
  10. package/build/commands/canvas/find-canvases-by-user.query.js +17 -0
  11. package/build/commands/canvas/index.js +21 -0
  12. package/build/commands/canvas/update-canvas.command.js +17 -0
  13. package/build/commands/index.js +1 -0
  14. package/build/constants/tool/enums/tool-content-type.enum.js +1 -0
  15. package/build/models/canvas.schema.js +11 -0
  16. package/build/models/index.js +1 -0
  17. package/build/models/tools/html-page-builder/html-page-builder-session.schema.js +2 -0
  18. package/commands/canvas/create-canvas.command.ts +16 -0
  19. package/commands/canvas/delete-canvas.command.ts +18 -0
  20. package/commands/canvas/find-canvas-by-uuid.query.ts +16 -0
  21. package/commands/canvas/find-canvases-by-user.query.ts +19 -0
  22. package/commands/canvas/index.ts +5 -0
  23. package/commands/canvas/update-canvas.command.ts +22 -0
  24. package/commands/index.ts +1 -0
  25. package/constants/tool/enums/tool-content-type.enum.ts +1 -0
  26. package/models/canvas.schema.ts +9 -0
  27. package/models/index.ts +1 -0
  28. package/models/tools/html-page-builder/html-page-builder-session.schema.ts +2 -0
  29. package/package.json +1 -1
@@ -0,0 +1,9 @@
1
+ export const CANVAS_PRIVATE_CONTROLLER = 'private/canvas' as const;
2
+
3
+ export const CANVAS_ROUTES = {
4
+ CREATE: '',
5
+ GET_ALL: '',
6
+ FIND_BY_UUID: (uuid: string) => `${uuid}`,
7
+ UPDATE: (uuid: string) => `${uuid}`,
8
+ DELETE: (uuid: string) => `${uuid}`,
9
+ } as const;
@@ -4,6 +4,7 @@ export * from './ai-model';
4
4
  export * from './ai-vendor';
5
5
  export * from './auth';
6
6
  export * from './blog';
7
+ export * from './canvas';
7
8
  export * from './category';
8
9
  export * from './chat-private';
9
10
  export * from './chat-public';
package/api/routes.ts CHANGED
@@ -366,6 +366,16 @@ export const REST_API = {
366
366
  DELETE: (uuid: string) =>
367
367
  `${ROOT}/${CONTROLLERS.FOLDER_PRIVATE_CONTROLLER}/${CONTROLLERS.FOLDER_ROUTES.DELETE(uuid)}`,
368
368
  },
369
+ CANVAS_PRIVATE: {
370
+ FIND_BY_UUID: (uuid: string) =>
371
+ `${ROOT}/${CONTROLLERS.CANVAS_PRIVATE_CONTROLLER}/${CONTROLLERS.CANVAS_ROUTES.FIND_BY_UUID(uuid)}`,
372
+ GET_ALL: `${ROOT}/${CONTROLLERS.CANVAS_PRIVATE_CONTROLLER}/${CONTROLLERS.CANVAS_ROUTES.GET_ALL}`,
373
+ CREATE: `${ROOT}/${CONTROLLERS.CANVAS_PRIVATE_CONTROLLER}/${CONTROLLERS.CANVAS_ROUTES.CREATE}`,
374
+ UPDATE: (uuid: string) =>
375
+ `${ROOT}/${CONTROLLERS.CANVAS_PRIVATE_CONTROLLER}/${CONTROLLERS.CANVAS_ROUTES.UPDATE(uuid)}`,
376
+ DELETE: (uuid: string) =>
377
+ `${ROOT}/${CONTROLLERS.CANVAS_PRIVATE_CONTROLLER}/${CONTROLLERS.CANVAS_ROUTES.DELETE(uuid)}`,
378
+ },
369
379
  USER_TO_PRODUCT: {
370
380
  FIND_BY_UUID: (uuid: string) =>
371
381
  `${ROOT}/${CONTROLLERS.USER_TO_PRODUCT_CONTROLLER}/${CONTROLLERS.USER_TO_PRODUCT_ROUTES.FIND_BY_UUID(uuid)}`,
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CANVAS_ROUTES = exports.CANVAS_PRIVATE_CONTROLLER = void 0;
4
+ exports.CANVAS_PRIVATE_CONTROLLER = 'private/canvas';
5
+ exports.CANVAS_ROUTES = {
6
+ CREATE: '',
7
+ GET_ALL: '',
8
+ FIND_BY_UUID: (uuid) => `${uuid}`,
9
+ UPDATE: (uuid) => `${uuid}`,
10
+ DELETE: (uuid) => `${uuid}`,
11
+ };
@@ -20,6 +20,7 @@ __exportStar(require("./ai-model"), exports);
20
20
  __exportStar(require("./ai-vendor"), exports);
21
21
  __exportStar(require("./auth"), exports);
22
22
  __exportStar(require("./blog"), exports);
23
+ __exportStar(require("./canvas"), exports);
23
24
  __exportStar(require("./category"), exports);
24
25
  __exportStar(require("./chat-private"), exports);
25
26
  __exportStar(require("./chat-public"), exports);
@@ -321,6 +321,13 @@ exports.REST_API = {
321
321
  UPDATE: (uuid) => `${exports.ROOT}/${CONTROLLERS.FOLDER_PRIVATE_CONTROLLER}/${CONTROLLERS.FOLDER_ROUTES.UPDATE(uuid)}`,
322
322
  DELETE: (uuid) => `${exports.ROOT}/${CONTROLLERS.FOLDER_PRIVATE_CONTROLLER}/${CONTROLLERS.FOLDER_ROUTES.DELETE(uuid)}`,
323
323
  },
324
+ CANVAS_PRIVATE: {
325
+ FIND_BY_UUID: (uuid) => `${exports.ROOT}/${CONTROLLERS.CANVAS_PRIVATE_CONTROLLER}/${CONTROLLERS.CANVAS_ROUTES.FIND_BY_UUID(uuid)}`,
326
+ GET_ALL: `${exports.ROOT}/${CONTROLLERS.CANVAS_PRIVATE_CONTROLLER}/${CONTROLLERS.CANVAS_ROUTES.GET_ALL}`,
327
+ CREATE: `${exports.ROOT}/${CONTROLLERS.CANVAS_PRIVATE_CONTROLLER}/${CONTROLLERS.CANVAS_ROUTES.CREATE}`,
328
+ UPDATE: (uuid) => `${exports.ROOT}/${CONTROLLERS.CANVAS_PRIVATE_CONTROLLER}/${CONTROLLERS.CANVAS_ROUTES.UPDATE(uuid)}`,
329
+ DELETE: (uuid) => `${exports.ROOT}/${CONTROLLERS.CANVAS_PRIVATE_CONTROLLER}/${CONTROLLERS.CANVAS_ROUTES.DELETE(uuid)}`,
330
+ },
324
331
  USER_TO_PRODUCT: {
325
332
  FIND_BY_UUID: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_TO_PRODUCT_CONTROLLER}/${CONTROLLERS.USER_TO_PRODUCT_ROUTES.FIND_BY_UUID(uuid)}`,
326
333
  UPDATE: (uuid) => `${exports.ROOT}/${CONTROLLERS.USER_TO_PRODUCT_CONTROLLER}/${CONTROLLERS.USER_TO_PRODUCT_ROUTES.UPDATE(uuid)}`,
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateCanvasCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ var CreateCanvasCommand;
7
+ (function (CreateCanvasCommand) {
8
+ CreateCanvasCommand.RequestSchema = zod_1.z.object({
9
+ name: zod_1.z.string().trim().min(1).optional()
10
+ });
11
+ CreateCanvasCommand.ResponseSchema = zod_1.z.object({
12
+ data: models_1.CanvasSchema,
13
+ });
14
+ })(CreateCanvasCommand || (exports.CreateCanvasCommand = CreateCanvasCommand = {}));
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeleteCanvasCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ var DeleteCanvasCommand;
7
+ (function (DeleteCanvasCommand) {
8
+ DeleteCanvasCommand.RequestSchema = models_1.CanvasSchema.pick({
9
+ uuid: true,
10
+ });
11
+ DeleteCanvasCommand.ResponseSchema = zod_1.z.object({
12
+ data: zod_1.z.object({
13
+ isDeleted: zod_1.z.boolean(),
14
+ }),
15
+ });
16
+ })(DeleteCanvasCommand || (exports.DeleteCanvasCommand = DeleteCanvasCommand = {}));
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindCanvasByUuidQuery = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ var FindCanvasByUuidQuery;
7
+ (function (FindCanvasByUuidQuery) {
8
+ FindCanvasByUuidQuery.RequestSchema = models_1.CanvasSchema.pick({
9
+ uuid: true,
10
+ });
11
+ FindCanvasByUuidQuery.ResponseSchema = zod_1.z.object({
12
+ data: models_1.CanvasSchema,
13
+ });
14
+ })(FindCanvasByUuidQuery || (exports.FindCanvasByUuidQuery = FindCanvasByUuidQuery = {}));
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindCanvasesByUserQuery = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ var FindCanvasesByUserQuery;
7
+ (function (FindCanvasesByUserQuery) {
8
+ FindCanvasesByUserQuery.RequestSchema = zod_1.z.object({
9
+ limit: zod_1.z.coerce.number().min(1).default(10),
10
+ offset: zod_1.z.coerce.number().min(0).default(0),
11
+ });
12
+ FindCanvasesByUserQuery.ResponseSchema = zod_1.z.object({
13
+ data: zod_1.z.array(models_1.CanvasSchema),
14
+ page: zod_1.z.number(),
15
+ totalPages: zod_1.z.number(),
16
+ });
17
+ })(FindCanvasesByUserQuery || (exports.FindCanvasesByUserQuery = FindCanvasesByUserQuery = {}));
@@ -0,0 +1,21 @@
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("./create-canvas.command"), exports);
18
+ __exportStar(require("./delete-canvas.command"), exports);
19
+ __exportStar(require("./find-canvas-by-uuid.query"), exports);
20
+ __exportStar(require("./find-canvases-by-user.query"), exports);
21
+ __exportStar(require("./update-canvas.command"), exports);
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateCanvasCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ var UpdateCanvasCommand;
7
+ (function (UpdateCanvasCommand) {
8
+ UpdateCanvasCommand.RequestParamSchema = models_1.CanvasSchema.pick({
9
+ uuid: true,
10
+ });
11
+ UpdateCanvasCommand.RequestSchema = zod_1.z.object({
12
+ name: zod_1.z.string().trim().min(1),
13
+ });
14
+ UpdateCanvasCommand.ResponseSchema = zod_1.z.object({
15
+ data: models_1.CanvasSchema,
16
+ });
17
+ })(UpdateCanvasCommand || (exports.UpdateCanvasCommand = UpdateCanvasCommand = {}));
@@ -19,6 +19,7 @@ __exportStar(require("./ai-model"), exports);
19
19
  __exportStar(require("./ai-vendor"), exports);
20
20
  __exportStar(require("./auth"), exports);
21
21
  __exportStar(require("./blog"), exports);
22
+ __exportStar(require("./canvas"), exports);
22
23
  __exportStar(require("./category"), exports);
23
24
  __exportStar(require("./chat"), exports);
24
25
  __exportStar(require("./course"), exports);
@@ -19,4 +19,5 @@ var TOOL_CONTENT_TYPE;
19
19
  TOOL_CONTENT_TYPE["SOLVING_EDU_TASK"] = "SOLVING_EDU_TASK";
20
20
  TOOL_CONTENT_TYPE["SPELL_CORRECTOR"] = "SPELL_CORRECTOR";
21
21
  TOOL_CONTENT_TYPE["DIAGRAMS"] = "DIAGRAMS";
22
+ TOOL_CONTENT_TYPE["HTML_PAGE_BUILDER"] = "HTML_PAGE_BUILDER";
22
23
  })(TOOL_CONTENT_TYPE || (exports.TOOL_CONTENT_TYPE = TOOL_CONTENT_TYPE = {}));
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CanvasSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.CanvasSchema = zod_1.z.object({
6
+ uuid: zod_1.z.string().uuid(),
7
+ name: zod_1.z.string(),
8
+ userId: zod_1.z.string().uuid(),
9
+ createdAt: zod_1.z.date(),
10
+ updatedAt: zod_1.z.date(),
11
+ });
@@ -19,6 +19,7 @@ __exportStar(require("./ai-model-config.schema"), exports);
19
19
  __exportStar(require("./ai-model-formatted.schema"), exports);
20
20
  __exportStar(require("./ai-model.schema"), exports);
21
21
  __exportStar(require("./ai-vendor.schema"), exports);
22
+ __exportStar(require("./canvas.schema"), exports);
22
23
  __exportStar(require("./category.schema"), exports);
23
24
  __exportStar(require("./chat-with-messages.schema"), exports);
24
25
  __exportStar(require("./chat.schema"), exports);
@@ -3,11 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HtmlPageBuilderSessionSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const constants_1 = require("../../../constants");
6
+ const html_page_builder_job_schema_1 = require("./html-page-builder-job.schema");
6
7
  exports.HtmlPageBuilderSessionSchema = zod_1.z.object({
7
8
  uuid: zod_1.z.string().uuid(),
8
9
  title: zod_1.z.string(),
9
10
  status: zod_1.z.nativeEnum(constants_1.TOOL_JOB_STATUS),
10
11
  currentHtml: zod_1.z.string().nullable().optional(),
12
+ jobs: zod_1.z.array(html_page_builder_job_schema_1.HtmlPageBuilderJobSchema),
11
13
  userId: zod_1.z.string().nullable().optional(),
12
14
  unregisteredUserId: zod_1.z.string().nullable().optional(),
13
15
  isDeleted: zod_1.z.boolean(),
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { CanvasSchema } from '../../models';
3
+
4
+ export namespace CreateCanvasCommand {
5
+ export const RequestSchema = z.object({
6
+ name: z.string().trim().min(1).optional()
7
+ });
8
+
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ data: CanvasSchema,
13
+ });
14
+
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { CanvasSchema } from '../../models';
3
+
4
+ export namespace DeleteCanvasCommand {
5
+ export const RequestSchema = CanvasSchema.pick({
6
+ uuid: true,
7
+ });
8
+
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ data: z.object({
13
+ isDeleted: z.boolean(),
14
+ }),
15
+ });
16
+
17
+ export type Response = z.infer<typeof ResponseSchema>;
18
+ }
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { CanvasSchema } from '../../models';
3
+
4
+ export namespace FindCanvasByUuidQuery {
5
+ export const RequestSchema = CanvasSchema.pick({
6
+ uuid: true,
7
+ });
8
+
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ data: CanvasSchema,
13
+ });
14
+
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import { CanvasSchema } from '../../models';
3
+
4
+ export namespace FindCanvasesByUserQuery {
5
+ export const RequestSchema = z.object({
6
+ limit: z.coerce.number().min(1).default(10),
7
+ offset: z.coerce.number().min(0).default(0),
8
+ });
9
+
10
+ export type Request = z.infer<typeof RequestSchema>;
11
+
12
+ export const ResponseSchema = z.object({
13
+ data: z.array(CanvasSchema),
14
+ page: z.number(),
15
+ totalPages: z.number(),
16
+ });
17
+
18
+ export type Response = z.infer<typeof ResponseSchema>;
19
+ }
@@ -0,0 +1,5 @@
1
+ export * from './create-canvas.command';
2
+ export * from './delete-canvas.command';
3
+ export * from './find-canvas-by-uuid.query';
4
+ export * from './find-canvases-by-user.query';
5
+ export * from './update-canvas.command';
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+ import { CanvasSchema } from '../../models';
3
+
4
+ export namespace UpdateCanvasCommand {
5
+ export const RequestParamSchema = CanvasSchema.pick({
6
+ uuid: true,
7
+ });
8
+
9
+ export type RequestParam = z.infer<typeof RequestParamSchema>;
10
+
11
+ export const RequestSchema = z.object({
12
+ name: z.string().trim().min(1),
13
+ });
14
+
15
+ export type Request = z.infer<typeof RequestSchema>;
16
+
17
+ export const ResponseSchema = z.object({
18
+ data: CanvasSchema,
19
+ });
20
+
21
+ export type Response = z.infer<typeof ResponseSchema>;
22
+ }
package/commands/index.ts CHANGED
@@ -3,6 +3,7 @@ export * from './ai-model';
3
3
  export * from './ai-vendor';
4
4
  export * from './auth';
5
5
  export * from './blog';
6
+ export * from './canvas';
6
7
  export * from './category';
7
8
  export * from './chat';
8
9
  export * from './course';
@@ -15,4 +15,5 @@ export enum TOOL_CONTENT_TYPE {
15
15
  SOLVING_EDU_TASK = 'SOLVING_EDU_TASK',
16
16
  SPELL_CORRECTOR = 'SPELL_CORRECTOR',
17
17
  DIAGRAMS = 'DIAGRAMS',
18
+ HTML_PAGE_BUILDER = 'HTML_PAGE_BUILDER',
18
19
  }
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+
3
+ export const CanvasSchema = z.object({
4
+ uuid: z.string().uuid(),
5
+ name: z.string(),
6
+ userId: z.string().uuid(),
7
+ createdAt: z.date(),
8
+ updatedAt: z.date(),
9
+ });
package/models/index.ts CHANGED
@@ -3,6 +3,7 @@ export * from './ai-model-config.schema';
3
3
  export * from './ai-model-formatted.schema';
4
4
  export * from './ai-model.schema';
5
5
  export * from './ai-vendor.schema';
6
+ export * from './canvas.schema';
6
7
  export * from './category.schema';
7
8
  export * from './chat-with-messages.schema';
8
9
  export * from './chat.schema';
@@ -1,11 +1,13 @@
1
1
  import { z } from 'zod';
2
2
  import { TOOL_JOB_STATUS } from '../../../constants';
3
+ import { HtmlPageBuilderJobSchema } from './html-page-builder-job.schema';
3
4
 
4
5
  export const HtmlPageBuilderSessionSchema = z.object({
5
6
  uuid: z.string().uuid(),
6
7
  title: z.string(),
7
8
  status: z.nativeEnum(TOOL_JOB_STATUS),
8
9
  currentHtml: z.string().nullable().optional(),
10
+ jobs: z.array(HtmlPageBuilderJobSchema),
9
11
  userId: z.string().nullable().optional(),
10
12
  unregisteredUserId: z.string().nullable().optional(),
11
13
  isDeleted: z.boolean(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.12.53",
3
+ "version": "0.12.55",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",