@veruna/api-contracts 1.0.23 → 1.0.25
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/controllers/chat.controllers.d.ts +4 -0
- package/build/controllers/chat.controllers.js +7 -0
- package/build/controllers/index.d.ts +2 -0
- package/build/controllers/index.js +5 -1
- package/build/controllers/message.controllers.d.ts +1 -0
- package/build/controllers/message.controllers.js +4 -0
- package/build/rest-api.d.ts +10 -0
- package/build/rest-api.js +10 -0
- package/build/routes/chat.routes.d.ts +6 -0
- package/build/routes/chat.routes.js +9 -0
- package/build/routes/index.d.ts +2 -0
- package/build/routes/index.js +5 -1
- package/build/routes/message.routes.d.ts +3 -0
- package/build/routes/message.routes.js +6 -0
- package/build/shared/constants.d.ts +1 -0
- package/build/shared/constants.js +4 -0
- package/build/shared/index.d.ts +1 -0
- package/build/shared/index.js +1 -0
- package/build/v1/chat/chat.errors.d.ts +7 -0
- package/build/v1/chat/chat.errors.js +23 -0
- package/build/v1/chat/commands/get-or-create-unreg-chat.command.d.ts +32 -0
- package/build/v1/chat/commands/get-or-create-unreg-chat.command.js +18 -0
- package/build/v1/chat/commands/index.d.ts +1 -0
- package/build/v1/chat/commands/index.js +5 -0
- package/build/v1/chat/index.d.ts +3 -0
- package/build/v1/chat/index.js +19 -0
- package/build/v1/chat/schemas/chat-response.schema.d.ts +11 -0
- package/build/v1/chat/schemas/chat-response.schema.js +14 -0
- package/build/v1/chat/schemas/chat-status.enum.d.ts +8 -0
- package/build/v1/chat/schemas/chat-status.enum.js +12 -0
- package/build/v1/chat/schemas/chat-with-messages-response.schema.d.ts +21 -0
- package/build/v1/chat/schemas/chat-with-messages-response.schema.js +16 -0
- package/build/v1/chat/schemas/index.d.ts +5 -0
- package/build/v1/chat/schemas/index.js +11 -0
- package/build/v1/chat/schemas/page-id-param.schema.d.ts +5 -0
- package/build/v1/chat/schemas/page-id-param.schema.js +7 -0
- package/build/v1/index.d.ts +2 -0
- package/build/v1/index.js +2 -0
- package/build/v1/message/commands/create-message.command.d.ts +15 -0
- package/build/v1/message/commands/create-message.command.js +13 -0
- package/build/v1/message/commands/index.d.ts +1 -0
- package/build/v1/message/commands/index.js +5 -0
- package/build/v1/message/index.d.ts +3 -0
- package/build/v1/message/index.js +19 -0
- package/build/v1/message/message.errors.d.ts +12 -0
- package/build/v1/message/message.errors.js +48 -0
- package/build/v1/message/schemas/create-message-request.schema.d.ts +5 -0
- package/build/v1/message/schemas/create-message-request.schema.js +9 -0
- package/build/v1/message/schemas/create-message-response.schema.d.ts +4 -0
- package/build/v1/message/schemas/create-message-response.schema.js +7 -0
- package/build/v1/message/schemas/index.d.ts +6 -0
- package/build/v1/message/schemas/index.js +15 -0
- package/build/v1/message/schemas/message-response.schema.d.ts +14 -0
- package/build/v1/message/schemas/message-response.schema.js +17 -0
- package/build/v1/message/schemas/message-role.enum.d.ts +6 -0
- package/build/v1/message/schemas/message-role.enum.js +10 -0
- package/build/v1/message/schemas/message-status.enum.d.ts +6 -0
- package/build/v1/message/schemas/message-status.enum.js +10 -0
- package/build/v1/message/schemas/user-rating.enum.d.ts +4 -0
- package/build/v1/message/schemas/user-rating.enum.js +8 -0
- package/package.json +1 -1
|
@@ -10,3 +10,5 @@ export { AI_PROVIDER_ADMIN_CONTROLLER, AI_PROVIDER_PUBLIC_CONTROLLER, } from './
|
|
|
10
10
|
export { AI_MODEL_ADMIN_CONTROLLER, AI_MODEL_PUBLIC_CONTROLLER, } from './ai-model.controllers';
|
|
11
11
|
export { FILE_CONTROLLER } from './file.controllers';
|
|
12
12
|
export { CHAT_PROJECT_CONTROLLER } from './chat-project.controllers';
|
|
13
|
+
export { CHAT_UNREG_CONTROLLER } from './chat.controllers';
|
|
14
|
+
export { MESSAGE_UNREG_CONTROLLER } from './message.controllers';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CHAT_PROJECT_CONTROLLER = exports.FILE_CONTROLLER = exports.AI_MODEL_PUBLIC_CONTROLLER = exports.AI_MODEL_ADMIN_CONTROLLER = exports.AI_PROVIDER_PUBLIC_CONTROLLER = exports.AI_PROVIDER_ADMIN_CONTROLLER = exports.SEO_PAGES_PUBLIC_CONTROLLER = exports.SEO_PAGES_ADMIN_CONTROLLER = exports.BLOG_PUBLIC_POSTS_CONTROLLER = exports.BLOG_PUBLIC_CATEGORIES_CONTROLLER = exports.BLOG_ADMIN_POSTS_CONTROLLER = exports.BLOG_ADMIN_CATEGORIES_CONTROLLER = exports.UNREG_USERS_CONTROLLER = exports.USERS_CONTROLLER = exports.AUTH_CONTROLLER = void 0;
|
|
3
|
+
exports.MESSAGE_UNREG_CONTROLLER = exports.CHAT_UNREG_CONTROLLER = exports.CHAT_PROJECT_CONTROLLER = exports.FILE_CONTROLLER = exports.AI_MODEL_PUBLIC_CONTROLLER = exports.AI_MODEL_ADMIN_CONTROLLER = exports.AI_PROVIDER_PUBLIC_CONTROLLER = exports.AI_PROVIDER_ADMIN_CONTROLLER = exports.SEO_PAGES_PUBLIC_CONTROLLER = exports.SEO_PAGES_ADMIN_CONTROLLER = exports.BLOG_PUBLIC_POSTS_CONTROLLER = exports.BLOG_PUBLIC_CATEGORIES_CONTROLLER = exports.BLOG_ADMIN_POSTS_CONTROLLER = exports.BLOG_ADMIN_CATEGORIES_CONTROLLER = exports.UNREG_USERS_CONTROLLER = exports.USERS_CONTROLLER = exports.AUTH_CONTROLLER = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Centralized exports for all controllers
|
|
6
6
|
*/
|
|
@@ -28,3 +28,7 @@ var file_controllers_1 = require("./file.controllers");
|
|
|
28
28
|
Object.defineProperty(exports, "FILE_CONTROLLER", { enumerable: true, get: function () { return file_controllers_1.FILE_CONTROLLER; } });
|
|
29
29
|
var chat_project_controllers_1 = require("./chat-project.controllers");
|
|
30
30
|
Object.defineProperty(exports, "CHAT_PROJECT_CONTROLLER", { enumerable: true, get: function () { return chat_project_controllers_1.CHAT_PROJECT_CONTROLLER; } });
|
|
31
|
+
var chat_controllers_1 = require("./chat.controllers");
|
|
32
|
+
Object.defineProperty(exports, "CHAT_UNREG_CONTROLLER", { enumerable: true, get: function () { return chat_controllers_1.CHAT_UNREG_CONTROLLER; } });
|
|
33
|
+
var message_controllers_1 = require("./message.controllers");
|
|
34
|
+
Object.defineProperty(exports, "MESSAGE_UNREG_CONTROLLER", { enumerable: true, get: function () { return message_controllers_1.MESSAGE_UNREG_CONTROLLER; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MESSAGE_UNREG_CONTROLLER: "v1/unreg/page/:pageId/chat/:chatId/message";
|
package/build/rest-api.d.ts
CHANGED
|
@@ -104,5 +104,15 @@ export declare const REST_API: {
|
|
|
104
104
|
readonly UPDATE: (uuid: string) => string;
|
|
105
105
|
readonly DELETE: (uuid: string) => string;
|
|
106
106
|
};
|
|
107
|
+
readonly CHAT: {
|
|
108
|
+
readonly UNREG: {
|
|
109
|
+
readonly GET_OR_CREATE: (pageId: string) => string;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
readonly MESSAGE: {
|
|
113
|
+
readonly UNREG: {
|
|
114
|
+
readonly CREATE: (pageId: string, chatId: string) => string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
107
117
|
};
|
|
108
118
|
};
|
package/build/rest-api.js
CHANGED
|
@@ -121,5 +121,15 @@ exports.REST_API = {
|
|
|
121
121
|
UPDATE: (uuid) => `${exports.ROOT}/${controllers_1.CHAT_PROJECT_CONTROLLER}/${uuid}`,
|
|
122
122
|
DELETE: (uuid) => `${exports.ROOT}/${controllers_1.CHAT_PROJECT_CONTROLLER}/${uuid}`,
|
|
123
123
|
},
|
|
124
|
+
CHAT: {
|
|
125
|
+
UNREG: {
|
|
126
|
+
GET_OR_CREATE: (pageId) => `${exports.ROOT}/${controllers_1.CHAT_UNREG_CONTROLLER.replace(':pageId', pageId)}`,
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
MESSAGE: {
|
|
130
|
+
UNREG: {
|
|
131
|
+
CREATE: (pageId, chatId) => `${exports.ROOT}/${controllers_1.MESSAGE_UNREG_CONTROLLER.replace(':pageId', pageId).replace(':chatId', chatId)}`,
|
|
132
|
+
},
|
|
133
|
+
},
|
|
124
134
|
},
|
|
125
135
|
};
|
package/build/routes/index.d.ts
CHANGED
|
@@ -15,3 +15,5 @@ export { AI_MODEL_ADMIN_ROUTES } from './ai-model-admin.routes';
|
|
|
15
15
|
export { AI_MODEL_PUBLIC_ROUTES } from './ai-model-public.routes';
|
|
16
16
|
export { FILE_ROUTES } from './file.routes';
|
|
17
17
|
export { CHAT_PROJECT_ROUTES } from './chat-project.routes';
|
|
18
|
+
export { CHAT_UNREG_ROUTES } from './chat.routes';
|
|
19
|
+
export { MESSAGE_UNREG_ROUTES } from './message.routes';
|
package/build/routes/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CHAT_PROJECT_ROUTES = exports.FILE_ROUTES = exports.AI_MODEL_PUBLIC_ROUTES = exports.AI_MODEL_ADMIN_ROUTES = exports.AI_PROVIDER_PUBLIC_ROUTES = exports.AI_PROVIDER_ADMIN_ROUTES = exports.SEO_PAGES_PUBLIC_ROUTES = exports.SEO_PAGES_ADMIN_ROUTES = exports.BLOG_PUBLIC_POSTS_ROUTES = exports.BLOG_PUBLIC_CATEGORIES_ROUTES = exports.BLOG_ADMIN_POSTS_ROUTES = exports.BLOG_ADMIN_CATEGORIES_ROUTES = exports.UNREG_USERS_ROUTES = exports.USERS_ROUTES = exports.AUTH_ROUTES = void 0;
|
|
3
|
+
exports.MESSAGE_UNREG_ROUTES = exports.CHAT_UNREG_ROUTES = exports.CHAT_PROJECT_ROUTES = exports.FILE_ROUTES = exports.AI_MODEL_PUBLIC_ROUTES = exports.AI_MODEL_ADMIN_ROUTES = exports.AI_PROVIDER_PUBLIC_ROUTES = exports.AI_PROVIDER_ADMIN_ROUTES = exports.SEO_PAGES_PUBLIC_ROUTES = exports.SEO_PAGES_ADMIN_ROUTES = exports.BLOG_PUBLIC_POSTS_ROUTES = exports.BLOG_PUBLIC_CATEGORIES_ROUTES = exports.BLOG_ADMIN_POSTS_ROUTES = exports.BLOG_ADMIN_CATEGORIES_ROUTES = exports.UNREG_USERS_ROUTES = exports.USERS_ROUTES = exports.AUTH_ROUTES = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Centralized exports for all routes
|
|
6
6
|
*/
|
|
@@ -33,3 +33,7 @@ var file_routes_1 = require("./file.routes");
|
|
|
33
33
|
Object.defineProperty(exports, "FILE_ROUTES", { enumerable: true, get: function () { return file_routes_1.FILE_ROUTES; } });
|
|
34
34
|
var chat_project_routes_1 = require("./chat-project.routes");
|
|
35
35
|
Object.defineProperty(exports, "CHAT_PROJECT_ROUTES", { enumerable: true, get: function () { return chat_project_routes_1.CHAT_PROJECT_ROUTES; } });
|
|
36
|
+
var chat_routes_1 = require("./chat.routes");
|
|
37
|
+
Object.defineProperty(exports, "CHAT_UNREG_ROUTES", { enumerable: true, get: function () { return chat_routes_1.CHAT_UNREG_ROUTES; } });
|
|
38
|
+
var message_routes_1 = require("./message.routes");
|
|
39
|
+
Object.defineProperty(exports, "MESSAGE_UNREG_ROUTES", { enumerable: true, get: function () { return message_routes_1.MESSAGE_UNREG_ROUTES; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MESSAGE_TEXT_MAX_LENGTH = 500000;
|
package/build/shared/index.d.ts
CHANGED
package/build/shared/index.js
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ErrorMetadata } from '../../shared';
|
|
2
|
+
export declare enum ChatErrorCode {
|
|
3
|
+
PAGE_NOT_FOUND = "PAGE_NOT_FOUND",
|
|
4
|
+
PAGE_ID_REQUIRED = "PAGE_ID_REQUIRED",
|
|
5
|
+
CHAT_NOT_FOUND = "CHAT_NOT_FOUND"
|
|
6
|
+
}
|
|
7
|
+
export declare const CHAT_ERRORS: Record<ChatErrorCode, ErrorMetadata>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CHAT_ERRORS = exports.ChatErrorCode = void 0;
|
|
4
|
+
var ChatErrorCode;
|
|
5
|
+
(function (ChatErrorCode) {
|
|
6
|
+
ChatErrorCode["PAGE_NOT_FOUND"] = "PAGE_NOT_FOUND";
|
|
7
|
+
ChatErrorCode["PAGE_ID_REQUIRED"] = "PAGE_ID_REQUIRED";
|
|
8
|
+
ChatErrorCode["CHAT_NOT_FOUND"] = "CHAT_NOT_FOUND";
|
|
9
|
+
})(ChatErrorCode || (exports.ChatErrorCode = ChatErrorCode = {}));
|
|
10
|
+
exports.CHAT_ERRORS = {
|
|
11
|
+
[ChatErrorCode.PAGE_NOT_FOUND]: {
|
|
12
|
+
code: ChatErrorCode.PAGE_NOT_FOUND,
|
|
13
|
+
statusCode: 404,
|
|
14
|
+
},
|
|
15
|
+
[ChatErrorCode.PAGE_ID_REQUIRED]: {
|
|
16
|
+
code: ChatErrorCode.PAGE_ID_REQUIRED,
|
|
17
|
+
statusCode: 400,
|
|
18
|
+
},
|
|
19
|
+
[ChatErrorCode.CHAT_NOT_FOUND]: {
|
|
20
|
+
code: ChatErrorCode.CHAT_NOT_FOUND,
|
|
21
|
+
statusCode: 404,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { HttpMethod } from '../../../shared/http-method';
|
|
3
|
+
/**
|
|
4
|
+
* Get or Create Unreg Chat Command
|
|
5
|
+
* PUT /api/v1/unreg/page/:pageId/chat
|
|
6
|
+
*/
|
|
7
|
+
export declare namespace GetOrCreateUnregChatCommand {
|
|
8
|
+
const Request: z.ZodObject<{}, z.core.$strip>;
|
|
9
|
+
const Response: z.ZodObject<{
|
|
10
|
+
uuid: z.ZodString;
|
|
11
|
+
title: z.ZodString;
|
|
12
|
+
status: z.ZodEnum<typeof import("../schemas").ChatStatus>;
|
|
13
|
+
pageId: z.ZodNullable<z.ZodString>;
|
|
14
|
+
folderId: z.ZodNullable<z.ZodString>;
|
|
15
|
+
createdAt: z.ZodString;
|
|
16
|
+
updatedAt: z.ZodString;
|
|
17
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
18
|
+
uuid: z.ZodString;
|
|
19
|
+
role: z.ZodEnum<typeof import("../..").MessageRole>;
|
|
20
|
+
status: z.ZodEnum<typeof import("../..").MessageStatus>;
|
|
21
|
+
content: z.ZodString;
|
|
22
|
+
aiModelId: z.ZodNullable<z.ZodString>;
|
|
23
|
+
userRating: z.ZodNullable<z.ZodEnum<typeof import("../..").UserRating>>;
|
|
24
|
+
createdAt: z.ZodString;
|
|
25
|
+
updatedAt: z.ZodString;
|
|
26
|
+
}, z.core.$strip>>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
const URL: (pageId: string) => string;
|
|
29
|
+
const METHOD = HttpMethod.PUT;
|
|
30
|
+
type RequestType = z.infer<typeof Request>;
|
|
31
|
+
type ResponseType = z.infer<typeof Response>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetOrCreateUnregChatCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const schemas_1 = require("../schemas");
|
|
6
|
+
const rest_api_1 = require("../../../rest-api");
|
|
7
|
+
const http_method_1 = require("../../../shared/http-method");
|
|
8
|
+
/**
|
|
9
|
+
* Get or Create Unreg Chat Command
|
|
10
|
+
* PUT /api/v1/unreg/page/:pageId/chat
|
|
11
|
+
*/
|
|
12
|
+
var GetOrCreateUnregChatCommand;
|
|
13
|
+
(function (GetOrCreateUnregChatCommand) {
|
|
14
|
+
GetOrCreateUnregChatCommand.Request = zod_1.z.object({});
|
|
15
|
+
GetOrCreateUnregChatCommand.Response = schemas_1.ChatWithMessagesResponseSchema;
|
|
16
|
+
GetOrCreateUnregChatCommand.URL = (pageId) => rest_api_1.REST_API.V1.CHAT.UNREG.GET_OR_CREATE(pageId);
|
|
17
|
+
GetOrCreateUnregChatCommand.METHOD = http_method_1.HttpMethod.PUT;
|
|
18
|
+
})(GetOrCreateUnregChatCommand || (exports.GetOrCreateUnregChatCommand = GetOrCreateUnregChatCommand = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { GetOrCreateUnregChatCommand } from './get-or-create-unreg-chat.command';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetOrCreateUnregChatCommand = void 0;
|
|
4
|
+
var get_or_create_unreg_chat_command_1 = require("./get-or-create-unreg-chat.command");
|
|
5
|
+
Object.defineProperty(exports, "GetOrCreateUnregChatCommand", { enumerable: true, get: function () { return get_or_create_unreg_chat_command_1.GetOrCreateUnregChatCommand; } });
|
|
@@ -0,0 +1,19 @@
|
|
|
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("./schemas"), exports);
|
|
18
|
+
__exportStar(require("./commands"), exports);
|
|
19
|
+
__exportStar(require("./chat.errors"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ChatStatus } from './chat-status.enum';
|
|
3
|
+
export declare const ChatResponseSchema: z.ZodObject<{
|
|
4
|
+
uuid: z.ZodString;
|
|
5
|
+
title: z.ZodString;
|
|
6
|
+
status: z.ZodEnum<typeof ChatStatus>;
|
|
7
|
+
pageId: z.ZodNullable<z.ZodString>;
|
|
8
|
+
folderId: z.ZodNullable<z.ZodString>;
|
|
9
|
+
createdAt: z.ZodString;
|
|
10
|
+
updatedAt: z.ZodString;
|
|
11
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChatResponseSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const chat_status_enum_1 = require("./chat-status.enum");
|
|
6
|
+
exports.ChatResponseSchema = zod_1.z.object({
|
|
7
|
+
uuid: zod_1.z.string().uuid(),
|
|
8
|
+
title: zod_1.z.string(),
|
|
9
|
+
status: zod_1.z.nativeEnum(chat_status_enum_1.ChatStatus),
|
|
10
|
+
pageId: zod_1.z.string().uuid().nullable(),
|
|
11
|
+
folderId: zod_1.z.string().uuid().nullable(),
|
|
12
|
+
createdAt: zod_1.z.string(),
|
|
13
|
+
updatedAt: zod_1.z.string(),
|
|
14
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChatStatus = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Chat status enum
|
|
6
|
+
*/
|
|
7
|
+
var ChatStatus;
|
|
8
|
+
(function (ChatStatus) {
|
|
9
|
+
ChatStatus["NEW"] = "new";
|
|
10
|
+
ChatStatus["ACTIVE"] = "active";
|
|
11
|
+
ChatStatus["DELETED"] = "deleted";
|
|
12
|
+
})(ChatStatus || (exports.ChatStatus = ChatStatus = {}));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ChatStatus } from './chat-status.enum';
|
|
3
|
+
export declare const ChatWithMessagesResponseSchema: z.ZodObject<{
|
|
4
|
+
uuid: z.ZodString;
|
|
5
|
+
title: z.ZodString;
|
|
6
|
+
status: z.ZodEnum<typeof ChatStatus>;
|
|
7
|
+
pageId: z.ZodNullable<z.ZodString>;
|
|
8
|
+
folderId: z.ZodNullable<z.ZodString>;
|
|
9
|
+
createdAt: z.ZodString;
|
|
10
|
+
updatedAt: z.ZodString;
|
|
11
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
12
|
+
uuid: z.ZodString;
|
|
13
|
+
role: z.ZodEnum<typeof import("../..").MessageRole>;
|
|
14
|
+
status: z.ZodEnum<typeof import("../..").MessageStatus>;
|
|
15
|
+
content: z.ZodString;
|
|
16
|
+
aiModelId: z.ZodNullable<z.ZodString>;
|
|
17
|
+
userRating: z.ZodNullable<z.ZodEnum<typeof import("../..").UserRating>>;
|
|
18
|
+
createdAt: z.ZodString;
|
|
19
|
+
updatedAt: z.ZodString;
|
|
20
|
+
}, z.core.$strip>>;
|
|
21
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChatWithMessagesResponseSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const chat_status_enum_1 = require("./chat-status.enum");
|
|
6
|
+
const message_response_schema_1 = require("../../message/schemas/message-response.schema");
|
|
7
|
+
exports.ChatWithMessagesResponseSchema = zod_1.z.object({
|
|
8
|
+
uuid: zod_1.z.string().uuid(),
|
|
9
|
+
title: zod_1.z.string(),
|
|
10
|
+
status: zod_1.z.nativeEnum(chat_status_enum_1.ChatStatus),
|
|
11
|
+
pageId: zod_1.z.string().uuid().nullable(),
|
|
12
|
+
folderId: zod_1.z.string().uuid().nullable(),
|
|
13
|
+
createdAt: zod_1.z.string(),
|
|
14
|
+
updatedAt: zod_1.z.string(),
|
|
15
|
+
messages: zod_1.z.array(message_response_schema_1.MessageResponseSchema),
|
|
16
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ChatStatus } from './chat-status.enum';
|
|
2
|
+
export { ChatResponseSchema } from './chat-response.schema';
|
|
3
|
+
export { ChatWithMessagesResponseSchema } from './chat-with-messages-response.schema';
|
|
4
|
+
export { PageIdParamSchema } from './page-id-param.schema';
|
|
5
|
+
export type { PageIdParamDto } from './page-id-param.schema';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PageIdParamSchema = exports.ChatWithMessagesResponseSchema = exports.ChatResponseSchema = exports.ChatStatus = void 0;
|
|
4
|
+
var chat_status_enum_1 = require("./chat-status.enum");
|
|
5
|
+
Object.defineProperty(exports, "ChatStatus", { enumerable: true, get: function () { return chat_status_enum_1.ChatStatus; } });
|
|
6
|
+
var chat_response_schema_1 = require("./chat-response.schema");
|
|
7
|
+
Object.defineProperty(exports, "ChatResponseSchema", { enumerable: true, get: function () { return chat_response_schema_1.ChatResponseSchema; } });
|
|
8
|
+
var chat_with_messages_response_schema_1 = require("./chat-with-messages-response.schema");
|
|
9
|
+
Object.defineProperty(exports, "ChatWithMessagesResponseSchema", { enumerable: true, get: function () { return chat_with_messages_response_schema_1.ChatWithMessagesResponseSchema; } });
|
|
10
|
+
var page_id_param_schema_1 = require("./page-id-param.schema");
|
|
11
|
+
Object.defineProperty(exports, "PageIdParamSchema", { enumerable: true, get: function () { return page_id_param_schema_1.PageIdParamSchema; } });
|
package/build/v1/index.d.ts
CHANGED
package/build/v1/index.js
CHANGED
|
@@ -24,3 +24,5 @@ __exportStar(require("./seo-pages"), exports);
|
|
|
24
24
|
__exportStar(require("./ai-provider"), exports);
|
|
25
25
|
__exportStar(require("./ai-model"), exports);
|
|
26
26
|
__exportStar(require("./chat-project"), exports);
|
|
27
|
+
__exportStar(require("./chat"), exports);
|
|
28
|
+
__exportStar(require("./message"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { HttpMethod } from '../../../shared/http-method';
|
|
3
|
+
export declare namespace CreateMessageCommand {
|
|
4
|
+
const Request: z.ZodObject<{
|
|
5
|
+
aiModelId: z.ZodString;
|
|
6
|
+
text: z.ZodString;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
const Response: z.ZodObject<{
|
|
9
|
+
messageId: z.ZodString;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
const URL: (pageId: string, chatId: string) => string;
|
|
12
|
+
const METHOD = HttpMethod.POST;
|
|
13
|
+
type RequestType = z.infer<typeof Request>;
|
|
14
|
+
type ResponseType = z.infer<typeof Response>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateMessageCommand = void 0;
|
|
4
|
+
const schemas_1 = require("../schemas");
|
|
5
|
+
const rest_api_1 = require("../../../rest-api");
|
|
6
|
+
const http_method_1 = require("../../../shared/http-method");
|
|
7
|
+
var CreateMessageCommand;
|
|
8
|
+
(function (CreateMessageCommand) {
|
|
9
|
+
CreateMessageCommand.Request = schemas_1.CreateMessageRequestSchema;
|
|
10
|
+
CreateMessageCommand.Response = schemas_1.CreateMessageResponseSchema;
|
|
11
|
+
CreateMessageCommand.URL = (pageId, chatId) => rest_api_1.REST_API.V1.MESSAGE.UNREG.CREATE(pageId, chatId);
|
|
12
|
+
CreateMessageCommand.METHOD = http_method_1.HttpMethod.POST;
|
|
13
|
+
})(CreateMessageCommand || (exports.CreateMessageCommand = CreateMessageCommand = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CreateMessageCommand } from './create-message.command';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateMessageCommand = void 0;
|
|
4
|
+
var create_message_command_1 = require("./create-message.command");
|
|
5
|
+
Object.defineProperty(exports, "CreateMessageCommand", { enumerable: true, get: function () { return create_message_command_1.CreateMessageCommand; } });
|
|
@@ -0,0 +1,19 @@
|
|
|
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("./schemas"), exports);
|
|
18
|
+
__exportStar(require("./commands"), exports);
|
|
19
|
+
__exportStar(require("./message.errors"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ErrorMetadata } from '../../shared';
|
|
2
|
+
export declare enum MessageErrorCode {
|
|
3
|
+
CHAT_NOT_FOUND = "CHAT_NOT_FOUND",
|
|
4
|
+
CHAT_NOT_OWNED = "CHAT_NOT_OWNED",
|
|
5
|
+
CHAT_DELETED = "CHAT_DELETED",
|
|
6
|
+
INVALID_PAGE_ID = "INVALID_PAGE_ID",
|
|
7
|
+
MESSAGE_TEXT_EMPTY = "MESSAGE_TEXT_EMPTY",
|
|
8
|
+
MESSAGE_TEXT_TOO_LONG = "MESSAGE_TEXT_TOO_LONG",
|
|
9
|
+
AI_MODEL_NOT_FOUND = "AI_MODEL_NOT_FOUND",
|
|
10
|
+
AI_MODEL_INACTIVE = "AI_MODEL_INACTIVE"
|
|
11
|
+
}
|
|
12
|
+
export declare const MESSAGE_ERRORS: Record<MessageErrorCode, ErrorMetadata>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MESSAGE_ERRORS = exports.MessageErrorCode = void 0;
|
|
4
|
+
var MessageErrorCode;
|
|
5
|
+
(function (MessageErrorCode) {
|
|
6
|
+
MessageErrorCode["CHAT_NOT_FOUND"] = "CHAT_NOT_FOUND";
|
|
7
|
+
MessageErrorCode["CHAT_NOT_OWNED"] = "CHAT_NOT_OWNED";
|
|
8
|
+
MessageErrorCode["CHAT_DELETED"] = "CHAT_DELETED";
|
|
9
|
+
MessageErrorCode["INVALID_PAGE_ID"] = "INVALID_PAGE_ID";
|
|
10
|
+
MessageErrorCode["MESSAGE_TEXT_EMPTY"] = "MESSAGE_TEXT_EMPTY";
|
|
11
|
+
MessageErrorCode["MESSAGE_TEXT_TOO_LONG"] = "MESSAGE_TEXT_TOO_LONG";
|
|
12
|
+
MessageErrorCode["AI_MODEL_NOT_FOUND"] = "AI_MODEL_NOT_FOUND";
|
|
13
|
+
MessageErrorCode["AI_MODEL_INACTIVE"] = "AI_MODEL_INACTIVE";
|
|
14
|
+
})(MessageErrorCode || (exports.MessageErrorCode = MessageErrorCode = {}));
|
|
15
|
+
exports.MESSAGE_ERRORS = {
|
|
16
|
+
[MessageErrorCode.CHAT_NOT_FOUND]: {
|
|
17
|
+
code: MessageErrorCode.CHAT_NOT_FOUND,
|
|
18
|
+
statusCode: 404,
|
|
19
|
+
},
|
|
20
|
+
[MessageErrorCode.CHAT_NOT_OWNED]: {
|
|
21
|
+
code: MessageErrorCode.CHAT_NOT_OWNED,
|
|
22
|
+
statusCode: 403,
|
|
23
|
+
},
|
|
24
|
+
[MessageErrorCode.CHAT_DELETED]: {
|
|
25
|
+
code: MessageErrorCode.CHAT_DELETED,
|
|
26
|
+
statusCode: 410,
|
|
27
|
+
},
|
|
28
|
+
[MessageErrorCode.INVALID_PAGE_ID]: {
|
|
29
|
+
code: MessageErrorCode.INVALID_PAGE_ID,
|
|
30
|
+
statusCode: 400,
|
|
31
|
+
},
|
|
32
|
+
[MessageErrorCode.MESSAGE_TEXT_EMPTY]: {
|
|
33
|
+
code: MessageErrorCode.MESSAGE_TEXT_EMPTY,
|
|
34
|
+
statusCode: 400,
|
|
35
|
+
},
|
|
36
|
+
[MessageErrorCode.MESSAGE_TEXT_TOO_LONG]: {
|
|
37
|
+
code: MessageErrorCode.MESSAGE_TEXT_TOO_LONG,
|
|
38
|
+
statusCode: 400,
|
|
39
|
+
},
|
|
40
|
+
[MessageErrorCode.AI_MODEL_NOT_FOUND]: {
|
|
41
|
+
code: MessageErrorCode.AI_MODEL_NOT_FOUND,
|
|
42
|
+
statusCode: 404,
|
|
43
|
+
},
|
|
44
|
+
[MessageErrorCode.AI_MODEL_INACTIVE]: {
|
|
45
|
+
code: MessageErrorCode.AI_MODEL_INACTIVE,
|
|
46
|
+
statusCode: 400,
|
|
47
|
+
},
|
|
48
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateMessageRequestSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const shared_1 = require("../../../shared");
|
|
6
|
+
exports.CreateMessageRequestSchema = zod_1.z.object({
|
|
7
|
+
aiModelId: zod_1.z.string().uuid(),
|
|
8
|
+
text: zod_1.z.string().min(1).max(shared_1.MESSAGE_TEXT_MAX_LENGTH),
|
|
9
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { MessageRole } from './message-role.enum';
|
|
2
|
+
export { MessageStatus } from './message-status.enum';
|
|
3
|
+
export { UserRating } from './user-rating.enum';
|
|
4
|
+
export { CreateMessageRequestSchema } from './create-message-request.schema';
|
|
5
|
+
export { CreateMessageResponseSchema } from './create-message-response.schema';
|
|
6
|
+
export { MessageResponseSchema } from './message-response.schema';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageResponseSchema = exports.CreateMessageResponseSchema = exports.CreateMessageRequestSchema = exports.UserRating = exports.MessageStatus = exports.MessageRole = void 0;
|
|
4
|
+
var message_role_enum_1 = require("./message-role.enum");
|
|
5
|
+
Object.defineProperty(exports, "MessageRole", { enumerable: true, get: function () { return message_role_enum_1.MessageRole; } });
|
|
6
|
+
var message_status_enum_1 = require("./message-status.enum");
|
|
7
|
+
Object.defineProperty(exports, "MessageStatus", { enumerable: true, get: function () { return message_status_enum_1.MessageStatus; } });
|
|
8
|
+
var user_rating_enum_1 = require("./user-rating.enum");
|
|
9
|
+
Object.defineProperty(exports, "UserRating", { enumerable: true, get: function () { return user_rating_enum_1.UserRating; } });
|
|
10
|
+
var create_message_request_schema_1 = require("./create-message-request.schema");
|
|
11
|
+
Object.defineProperty(exports, "CreateMessageRequestSchema", { enumerable: true, get: function () { return create_message_request_schema_1.CreateMessageRequestSchema; } });
|
|
12
|
+
var create_message_response_schema_1 = require("./create-message-response.schema");
|
|
13
|
+
Object.defineProperty(exports, "CreateMessageResponseSchema", { enumerable: true, get: function () { return create_message_response_schema_1.CreateMessageResponseSchema; } });
|
|
14
|
+
var message_response_schema_1 = require("./message-response.schema");
|
|
15
|
+
Object.defineProperty(exports, "MessageResponseSchema", { enumerable: true, get: function () { return message_response_schema_1.MessageResponseSchema; } });
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MessageRole } from './message-role.enum';
|
|
3
|
+
import { MessageStatus } from './message-status.enum';
|
|
4
|
+
import { UserRating } from './user-rating.enum';
|
|
5
|
+
export declare const MessageResponseSchema: z.ZodObject<{
|
|
6
|
+
uuid: z.ZodString;
|
|
7
|
+
role: z.ZodEnum<typeof MessageRole>;
|
|
8
|
+
status: z.ZodEnum<typeof MessageStatus>;
|
|
9
|
+
content: z.ZodString;
|
|
10
|
+
aiModelId: z.ZodNullable<z.ZodString>;
|
|
11
|
+
userRating: z.ZodNullable<z.ZodEnum<typeof UserRating>>;
|
|
12
|
+
createdAt: z.ZodString;
|
|
13
|
+
updatedAt: z.ZodString;
|
|
14
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageResponseSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const message_role_enum_1 = require("./message-role.enum");
|
|
6
|
+
const message_status_enum_1 = require("./message-status.enum");
|
|
7
|
+
const user_rating_enum_1 = require("./user-rating.enum");
|
|
8
|
+
exports.MessageResponseSchema = zod_1.z.object({
|
|
9
|
+
uuid: zod_1.z.string().uuid(),
|
|
10
|
+
role: zod_1.z.nativeEnum(message_role_enum_1.MessageRole),
|
|
11
|
+
status: zod_1.z.nativeEnum(message_status_enum_1.MessageStatus),
|
|
12
|
+
content: zod_1.z.string(),
|
|
13
|
+
aiModelId: zod_1.z.string().uuid().nullable(),
|
|
14
|
+
userRating: zod_1.z.nativeEnum(user_rating_enum_1.UserRating).nullable(),
|
|
15
|
+
createdAt: zod_1.z.string(),
|
|
16
|
+
updatedAt: zod_1.z.string(),
|
|
17
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageRole = void 0;
|
|
4
|
+
var MessageRole;
|
|
5
|
+
(function (MessageRole) {
|
|
6
|
+
MessageRole["SYSTEM"] = "system";
|
|
7
|
+
MessageRole["AI"] = "ai";
|
|
8
|
+
MessageRole["PROMO"] = "promo";
|
|
9
|
+
MessageRole["USER"] = "user";
|
|
10
|
+
})(MessageRole || (exports.MessageRole = MessageRole = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageStatus = void 0;
|
|
4
|
+
var MessageStatus;
|
|
5
|
+
(function (MessageStatus) {
|
|
6
|
+
MessageStatus["NEW"] = "new";
|
|
7
|
+
MessageStatus["GENERATING"] = "generating";
|
|
8
|
+
MessageStatus["GENERATED"] = "generated";
|
|
9
|
+
MessageStatus["ERROR"] = "error";
|
|
10
|
+
})(MessageStatus || (exports.MessageStatus = MessageStatus = {}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserRating = void 0;
|
|
4
|
+
var UserRating;
|
|
5
|
+
(function (UserRating) {
|
|
6
|
+
UserRating["LIKE"] = "like";
|
|
7
|
+
UserRating["DISLIKE"] = "dislike";
|
|
8
|
+
})(UserRating || (exports.UserRating = UserRating = {}));
|