@purpleschool/gptbot 0.5.20 → 0.5.21
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/ai-model.ts +1 -0
- package/build/api/controllers/ai-model.js +1 -0
- package/build/commands/ai-model/find-formatted-ai-model.command.js +18 -0
- package/build/commands/ai-model/index.js +1 -0
- package/build/commands/page/create-page.command.js +18 -0
- package/build/commands/page/find-page-by-alias.command.js +4 -2
- package/build/commands/page/find-page.command.js +2 -1
- package/build/constants/index.js +1 -0
- package/build/constants/page/enums/index.js +17 -0
- package/build/constants/page/enums/page-type.enum.js +9 -0
- package/build/constants/page/index.js +17 -0
- package/build/models/ai-model-formatted.schema.js +7 -0
- package/build/models/index.js +1 -0
- package/build/models/page.schema.js +4 -1
- package/commands/ai-model/find-formatted-ai-model.command.ts +22 -0
- package/commands/ai-model/index.ts +1 -0
- package/commands/page/create-page.command.ts +25 -1
- package/commands/page/find-page-by-alias.command.ts +5 -3
- package/commands/page/find-page.command.ts +3 -2
- package/constants/index.ts +1 -0
- package/constants/page/enums/index.ts +1 -0
- package/constants/page/enums/page-type.enum.ts +5 -0
- package/constants/page/index.ts +1 -0
- package/models/ai-model-formatted.schema.ts +8 -0
- package/models/index.ts +1 -0
- package/models/page.schema.ts +4 -1
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FindFormattedAIModelCommand = void 0;
|
|
4
|
+
const models_1 = require("../../models");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const ai_model_formatted_schema_1 = require("../../models/ai-model-formatted.schema");
|
|
7
|
+
var FindFormattedAIModelCommand;
|
|
8
|
+
(function (FindFormattedAIModelCommand) {
|
|
9
|
+
FindFormattedAIModelCommand.RequestSchema = models_1.AiModelSchema.pick({
|
|
10
|
+
uuid: true,
|
|
11
|
+
});
|
|
12
|
+
FindFormattedAIModelCommand.ResponseSchema = zod_1.z.object({
|
|
13
|
+
data: zod_1.z.array(ai_model_formatted_schema_1.AiModelFormmattedSchema),
|
|
14
|
+
});
|
|
15
|
+
FindFormattedAIModelCommand.ResponseByUUIDSchema = zod_1.z.object({
|
|
16
|
+
data: models_1.AiModelSchema,
|
|
17
|
+
});
|
|
18
|
+
})(FindFormattedAIModelCommand || (exports.FindFormattedAIModelCommand = FindFormattedAIModelCommand = {}));
|
|
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./create-ai-model.command"), exports);
|
|
18
18
|
__exportStar(require("./delete-ai-model.command"), exports);
|
|
19
19
|
__exportStar(require("./find-ai-model.command"), exports);
|
|
20
|
+
__exportStar(require("./find-formatted-ai-model.command"), exports);
|
|
20
21
|
__exportStar(require("./update-ai-model.command"), exports);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CreatePageCommand = void 0;
|
|
4
|
+
const constants_1 = require("../../constants");
|
|
4
5
|
const models_1 = require("../../models");
|
|
5
6
|
const zod_1 = require("zod");
|
|
6
7
|
var CreatePageCommand;
|
|
@@ -9,6 +10,23 @@ var CreatePageCommand;
|
|
|
9
10
|
uuid: true,
|
|
10
11
|
createdAt: true,
|
|
11
12
|
updatedAt: true,
|
|
13
|
+
})
|
|
14
|
+
.refine((data) => {
|
|
15
|
+
if (data.type === constants_1.PageType.AI_MODEL) {
|
|
16
|
+
return !!data.aIModelId;
|
|
17
|
+
}
|
|
18
|
+
return true;
|
|
19
|
+
}, {
|
|
20
|
+
message: 'aIModelId is required when type is AI_MODEL',
|
|
21
|
+
path: ['aIModelId'],
|
|
22
|
+
})
|
|
23
|
+
.refine((data) => {
|
|
24
|
+
if (data.type === constants_1.PageType.CATEGORY) {
|
|
25
|
+
return !!data.categoryId;
|
|
26
|
+
}
|
|
27
|
+
return true;
|
|
28
|
+
}, {
|
|
29
|
+
message: 'categoryId is required when type is CATEGORY',
|
|
12
30
|
});
|
|
13
31
|
CreatePageCommand.ResponseSchema = zod_1.z.object({
|
|
14
32
|
data: models_1.PageSchema,
|
|
@@ -13,13 +13,15 @@ var FindPageByAliasCommand;
|
|
|
13
13
|
});
|
|
14
14
|
FindPageByAliasCommand.ResponseByAliasSchema = zod_1.z.object({
|
|
15
15
|
data: models_1.PageSchema.extend({
|
|
16
|
-
category: models_1.CategorySchema,
|
|
16
|
+
category: zod_1.z.union([models_1.CategorySchema, zod_1.z.null()]),
|
|
17
|
+
aIModel: zod_1.z.union([models_1.AiModelSchema, zod_1.z.null()]),
|
|
17
18
|
questions: zod_1.z.array(models_1.QuestionSchema),
|
|
18
19
|
}),
|
|
19
20
|
});
|
|
20
21
|
FindPageByAliasCommand.ResponseByAllSchema = zod_1.z.object({
|
|
21
22
|
data: zod_1.z.array(models_1.PageSchema.extend({
|
|
22
|
-
category: models_1.CategorySchema,
|
|
23
|
+
category: zod_1.z.union([models_1.CategorySchema, zod_1.z.null()]),
|
|
24
|
+
aIModel: zod_1.z.union([models_1.AiModelSchema, zod_1.z.null()]),
|
|
23
25
|
questions: zod_1.z.array(models_1.QuestionSchema),
|
|
24
26
|
})),
|
|
25
27
|
});
|
|
@@ -13,7 +13,8 @@ var FindPageCommand;
|
|
|
13
13
|
});
|
|
14
14
|
FindPageCommand.ResponseByUUIDSchema = zod_1.z.object({
|
|
15
15
|
data: models_1.PageSchema.extend({
|
|
16
|
-
category: models_1.CategorySchema,
|
|
16
|
+
category: zod_1.z.union([models_1.CategorySchema, zod_1.z.null()]),
|
|
17
|
+
aIModel: zod_1.z.union([models_1.AiModelSchema, zod_1.z.null()]),
|
|
17
18
|
questions: zod_1.z.array(models_1.QuestionSchema),
|
|
18
19
|
}),
|
|
19
20
|
});
|
package/build/constants/index.js
CHANGED
|
@@ -24,6 +24,7 @@ __exportStar(require("./email"), exports);
|
|
|
24
24
|
__exportStar(require("./errors"), exports);
|
|
25
25
|
__exportStar(require("./message"), exports);
|
|
26
26
|
__exportStar(require("./order"), exports);
|
|
27
|
+
__exportStar(require("./page"), exports);
|
|
27
28
|
__exportStar(require("./payment"), exports);
|
|
28
29
|
__exportStar(require("./product"), exports);
|
|
29
30
|
__exportStar(require("./referral"), exports);
|
|
@@ -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("./page-type.enum"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PageType = void 0;
|
|
4
|
+
var PageType;
|
|
5
|
+
(function (PageType) {
|
|
6
|
+
PageType["CATEGORY"] = "category";
|
|
7
|
+
PageType["AI_MODEL"] = "ai_model";
|
|
8
|
+
PageType["OTHER"] = "other";
|
|
9
|
+
})(PageType || (exports.PageType = PageType = {}));
|
|
@@ -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("./enums"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AiModelFormmattedSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const ai_model_schema_1 = require("./ai-model.schema");
|
|
6
|
+
const page_schema_1 = require("./page.schema");
|
|
7
|
+
exports.AiModelFormmattedSchema = zod_1.z.intersection(ai_model_schema_1.AiModelSchema, zod_1.z.object({ page: page_schema_1.PageSchema.pick({ alias: true }).optional() }));
|
package/build/models/index.js
CHANGED
|
@@ -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("./ai-model-formatted.schema"), exports);
|
|
17
18
|
__exportStar(require("./ai-model.schema"), exports);
|
|
18
19
|
__exportStar(require("./category.schema"), exports);
|
|
19
20
|
__exportStar(require("./chat.schema"), exports);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PageSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
5
6
|
exports.PageSchema = zod_1.z.object({
|
|
6
7
|
uuid: zod_1.z.string().uuid(),
|
|
7
8
|
metaTitle: zod_1.z.string().min(3).max(16384),
|
|
@@ -10,7 +11,9 @@ exports.PageSchema = zod_1.z.object({
|
|
|
10
11
|
subTitle: zod_1.z.string().min(3).max(16384),
|
|
11
12
|
seoTextMd: zod_1.z.string().min(3).max(16384),
|
|
12
13
|
alias: zod_1.z.string().min(3).max(16384),
|
|
13
|
-
categoryId: zod_1.z.string().uuid(),
|
|
14
|
+
categoryId: zod_1.z.string().uuid().nullable().optional(),
|
|
15
|
+
aIModelId: zod_1.z.string().uuid().nullable().optional(),
|
|
16
|
+
type: zod_1.z.nativeEnum(constants_1.PageType),
|
|
14
17
|
createdAt: zod_1.z.date(),
|
|
15
18
|
updatedAt: zod_1.z.date(),
|
|
16
19
|
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AiModelSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { AiModelFormmattedSchema } from '../../models/ai-model-formatted.schema';
|
|
4
|
+
|
|
5
|
+
export namespace FindFormattedAIModelCommand {
|
|
6
|
+
export const RequestSchema = AiModelSchema.pick({
|
|
7
|
+
uuid: true,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
11
|
+
|
|
12
|
+
export const ResponseSchema = z.object({
|
|
13
|
+
data: z.array(AiModelFormmattedSchema),
|
|
14
|
+
});
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
|
|
17
|
+
export const ResponseByUUIDSchema = z.object({
|
|
18
|
+
data: AiModelSchema,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export type ResponseByUUID = z.infer<typeof ResponseByUUIDSchema>;
|
|
22
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PageType } from '../../constants';
|
|
1
2
|
import { PageSchema } from '../../models';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
|
|
@@ -6,7 +7,30 @@ export namespace CreatePageCommand {
|
|
|
6
7
|
uuid: true,
|
|
7
8
|
createdAt: true,
|
|
8
9
|
updatedAt: true,
|
|
9
|
-
})
|
|
10
|
+
})
|
|
11
|
+
.refine(
|
|
12
|
+
(data) => {
|
|
13
|
+
if (data.type === PageType.AI_MODEL) {
|
|
14
|
+
return !!data.aIModelId;
|
|
15
|
+
}
|
|
16
|
+
return true;
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
message: 'aIModelId is required when type is AI_MODEL',
|
|
20
|
+
path: ['aIModelId'],
|
|
21
|
+
},
|
|
22
|
+
)
|
|
23
|
+
.refine(
|
|
24
|
+
(data) => {
|
|
25
|
+
if (data.type === PageType.CATEGORY) {
|
|
26
|
+
return !!data.categoryId;
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
message: 'categoryId is required when type is CATEGORY',
|
|
32
|
+
},
|
|
33
|
+
);
|
|
10
34
|
|
|
11
35
|
export type Request = z.infer<typeof RequestSchema>;
|
|
12
36
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CategorySchema, PageSchema, QuestionSchema } from '../../models';
|
|
1
|
+
import { AiModelSchema, CategorySchema, PageSchema, QuestionSchema } from '../../models';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
export namespace FindPageByAliasCommand {
|
|
@@ -16,7 +16,8 @@ export namespace FindPageByAliasCommand {
|
|
|
16
16
|
|
|
17
17
|
export const ResponseByAliasSchema = z.object({
|
|
18
18
|
data: PageSchema.extend({
|
|
19
|
-
category: CategorySchema,
|
|
19
|
+
category: z.union([CategorySchema, z.null()]),
|
|
20
|
+
aIModel: z.union([AiModelSchema, z.null()]),
|
|
20
21
|
questions: z.array(QuestionSchema),
|
|
21
22
|
}),
|
|
22
23
|
});
|
|
@@ -24,7 +25,8 @@ export namespace FindPageByAliasCommand {
|
|
|
24
25
|
export const ResponseByAllSchema = z.object({
|
|
25
26
|
data: z.array(
|
|
26
27
|
PageSchema.extend({
|
|
27
|
-
category: CategorySchema,
|
|
28
|
+
category: z.union([CategorySchema, z.null()]),
|
|
29
|
+
aIModel: z.union([AiModelSchema, z.null()]),
|
|
28
30
|
questions: z.array(QuestionSchema),
|
|
29
31
|
}),
|
|
30
32
|
),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CategorySchema, PageSchema, QuestionSchema } from '../../models';
|
|
1
|
+
import { AiModelSchema, CategorySchema, PageSchema, QuestionSchema } from '../../models';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
export namespace FindPageCommand {
|
|
@@ -16,7 +16,8 @@ export namespace FindPageCommand {
|
|
|
16
16
|
|
|
17
17
|
export const ResponseByUUIDSchema = z.object({
|
|
18
18
|
data: PageSchema.extend({
|
|
19
|
-
category: CategorySchema,
|
|
19
|
+
category: z.union([CategorySchema, z.null()]),
|
|
20
|
+
aIModel: z.union([AiModelSchema, z.null()]),
|
|
20
21
|
questions: z.array(QuestionSchema),
|
|
21
22
|
}),
|
|
22
23
|
});
|
package/constants/index.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './page-type.enum';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './enums';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AiModelSchema } from './ai-model.schema';
|
|
3
|
+
import { PageSchema } from './page.schema';
|
|
4
|
+
|
|
5
|
+
export const AiModelFormmattedSchema = z.intersection(
|
|
6
|
+
AiModelSchema,
|
|
7
|
+
z.object({ page: PageSchema.pick({ alias: true }).optional() }),
|
|
8
|
+
);
|
package/models/index.ts
CHANGED
package/models/page.schema.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { PageType } from '../constants';
|
|
2
3
|
|
|
3
4
|
export const PageSchema = z.object({
|
|
4
5
|
uuid: z.string().uuid(),
|
|
@@ -8,7 +9,9 @@ export const PageSchema = z.object({
|
|
|
8
9
|
subTitle: z.string().min(3).max(16384),
|
|
9
10
|
seoTextMd: z.string().min(3).max(16384),
|
|
10
11
|
alias: z.string().min(3).max(16384),
|
|
11
|
-
categoryId: z.string().uuid(),
|
|
12
|
+
categoryId: z.string().uuid().nullable().optional(),
|
|
13
|
+
aIModelId: z.string().uuid().nullable().optional(),
|
|
14
|
+
type: z.nativeEnum(PageType),
|
|
12
15
|
|
|
13
16
|
createdAt: z.date(),
|
|
14
17
|
updatedAt: z.date(),
|