@purpleschool/gptbot 0.7.28 → 0.7.30

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.
@@ -27,6 +27,14 @@ var CreatePageCommand;
27
27
  return true;
28
28
  }, {
29
29
  message: 'categoryId is required when type is CATEGORY',
30
+ })
31
+ .refine((data) => {
32
+ if (data.type === constants_1.PageType.TOOL) {
33
+ return !!data.toolId;
34
+ }
35
+ return true;
36
+ }, {
37
+ message: 'toolId is required when type is TOOL',
30
38
  });
31
39
  CreatePageCommand.ResponseSchema = zod_1.z.object({
32
40
  data: models_1.PageSchema,
@@ -15,6 +15,7 @@ var FindPageByAliasCommand;
15
15
  data: models_1.PageSchema.extend({
16
16
  category: zod_1.z.union([models_1.CategorySchema, zod_1.z.null()]),
17
17
  aIModel: zod_1.z.union([models_1.AiModelSchema, zod_1.z.null()]),
18
+ tool: models_1.ToolSchema.nullable(),
18
19
  questions: zod_1.z.array(models_1.QuestionSchema),
19
20
  }),
20
21
  });
@@ -22,6 +23,7 @@ var FindPageByAliasCommand;
22
23
  data: zod_1.z.array(models_1.PageSchema.extend({
23
24
  category: zod_1.z.union([models_1.CategorySchema, zod_1.z.null()]),
24
25
  aIModel: zod_1.z.union([models_1.AiModelSchema, zod_1.z.null()]),
26
+ tool: models_1.ToolSchema.nullable(),
25
27
  questions: zod_1.z.array(models_1.QuestionSchema),
26
28
  })),
27
29
  });
@@ -15,6 +15,7 @@ var FindPageCommand;
15
15
  data: models_1.PageSchema.extend({
16
16
  category: zod_1.z.union([models_1.CategorySchema, zod_1.z.null()]),
17
17
  aIModel: zod_1.z.union([models_1.AiModelSchema, zod_1.z.null()]),
18
+ tool: models_1.ToolSchema.nullable(),
18
19
  questions: zod_1.z.array(models_1.QuestionSchema),
19
20
  }),
20
21
  });
@@ -7,4 +7,5 @@ var PageType;
7
7
  PageType["AI_MODEL"] = "ai_model";
8
8
  PageType["OTHER"] = "other";
9
9
  PageType["BOT"] = "bot";
10
+ PageType["TOOL"] = "tool";
10
11
  })(PageType || (exports.PageType = PageType = {}));
@@ -13,6 +13,7 @@ exports.PageSchema = zod_1.z.object({
13
13
  alias: zod_1.z.string().min(3).max(16384),
14
14
  categoryId: zod_1.z.string().uuid().nullable().optional(),
15
15
  aIModelId: zod_1.z.string().uuid().nullable().optional(),
16
+ toolId: zod_1.z.string().uuid().nullable().optional(),
16
17
  type: zod_1.z.nativeEnum(constants_1.PageType),
17
18
  createdAt: zod_1.z.date(),
18
19
  updatedAt: zod_1.z.date(),
@@ -30,6 +30,17 @@ export namespace CreatePageCommand {
30
30
  {
31
31
  message: 'categoryId is required when type is CATEGORY',
32
32
  },
33
+ )
34
+ .refine(
35
+ (data) => {
36
+ if (data.type === PageType.TOOL) {
37
+ return !!data.toolId;
38
+ }
39
+ return true;
40
+ },
41
+ {
42
+ message: 'toolId is required when type is TOOL',
43
+ },
33
44
  );
34
45
 
35
46
  export type Request = z.infer<typeof RequestSchema>;
@@ -1,4 +1,10 @@
1
- import { AiModelSchema, CategorySchema, PageSchema, QuestionSchema } from '../../models';
1
+ import {
2
+ AiModelSchema,
3
+ CategorySchema,
4
+ PageSchema,
5
+ QuestionSchema,
6
+ ToolSchema,
7
+ } from '../../models';
2
8
  import { z } from 'zod';
3
9
 
4
10
  export namespace FindPageByAliasCommand {
@@ -18,6 +24,7 @@ export namespace FindPageByAliasCommand {
18
24
  data: PageSchema.extend({
19
25
  category: z.union([CategorySchema, z.null()]),
20
26
  aIModel: z.union([AiModelSchema, z.null()]),
27
+ tool: ToolSchema.nullable(),
21
28
  questions: z.array(QuestionSchema),
22
29
  }),
23
30
  });
@@ -27,6 +34,7 @@ export namespace FindPageByAliasCommand {
27
34
  PageSchema.extend({
28
35
  category: z.union([CategorySchema, z.null()]),
29
36
  aIModel: z.union([AiModelSchema, z.null()]),
37
+ tool: ToolSchema.nullable(),
30
38
  questions: z.array(QuestionSchema),
31
39
  }),
32
40
  ),
@@ -1,4 +1,10 @@
1
- import { AiModelSchema, CategorySchema, PageSchema, QuestionSchema } from '../../models';
1
+ import {
2
+ AiModelSchema,
3
+ CategorySchema,
4
+ PageSchema,
5
+ QuestionSchema,
6
+ ToolSchema,
7
+ } from '../../models';
2
8
  import { z } from 'zod';
3
9
 
4
10
  export namespace FindPageCommand {
@@ -18,6 +24,7 @@ export namespace FindPageCommand {
18
24
  data: PageSchema.extend({
19
25
  category: z.union([CategorySchema, z.null()]),
20
26
  aIModel: z.union([AiModelSchema, z.null()]),
27
+ tool: ToolSchema.nullable(),
21
28
  questions: z.array(QuestionSchema),
22
29
  }),
23
30
  });
@@ -3,4 +3,5 @@ export enum PageType {
3
3
  AI_MODEL = 'ai_model',
4
4
  OTHER = 'other',
5
5
  BOT = 'bot',
6
+ TOOL = 'tool',
6
7
  }
@@ -11,6 +11,7 @@ export const PageSchema = z.object({
11
11
  alias: z.string().min(3).max(16384),
12
12
  categoryId: z.string().uuid().nullable().optional(),
13
13
  aIModelId: z.string().uuid().nullable().optional(),
14
+ toolId: z.string().uuid().nullable().optional(),
14
15
  type: z.nativeEnum(PageType),
15
16
 
16
17
  createdAt: z.date(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.7.28",
3
+ "version": "0.7.30",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",