@veruna/api-contracts 1.0.25 → 1.0.26
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/rest-api.d.ts +2 -1
- package/build/rest-api.js +2 -1
- package/build/routes/chat.routes.d.ts +2 -1
- package/build/routes/chat.routes.js +2 -1
- package/build/v1/ai/ai.errors.d.ts +16 -0
- package/build/v1/ai/ai.errors.js +72 -0
- package/build/v1/ai/index.d.ts +1 -0
- package/build/v1/ai/index.js +17 -0
- package/build/v1/chat/commands/{get-or-create-unreg-chat.command.d.ts → create-unreg-chat.command.d.ts} +4 -4
- package/build/v1/chat/commands/create-unreg-chat.command.js +18 -0
- package/build/v1/chat/commands/index.d.ts +1 -1
- package/build/v1/chat/commands/index.js +3 -3
- package/build/v1/chat/index.d.ts +1 -0
- package/build/v1/chat/index.js +1 -0
- package/build/v1/chat/queries/get-unreg-chat.query.d.ts +32 -0
- package/build/v1/chat/queries/get-unreg-chat.query.js +18 -0
- package/build/v1/chat/queries/index.d.ts +1 -0
- package/build/v1/chat/queries/index.js +5 -0
- package/build/v1/chat/schemas/chat-status.enum.d.ts +1 -0
- package/build/v1/chat/schemas/chat-status.enum.js +1 -0
- package/build/v1/index.d.ts +1 -0
- package/build/v1/index.js +1 -0
- package/package.json +1 -1
- package/build/v1/chat/commands/get-or-create-unreg-chat.command.js +0 -18
package/build/rest-api.d.ts
CHANGED
|
@@ -106,7 +106,8 @@ export declare const REST_API: {
|
|
|
106
106
|
};
|
|
107
107
|
readonly CHAT: {
|
|
108
108
|
readonly UNREG: {
|
|
109
|
-
readonly
|
|
109
|
+
readonly GET: (pageId: string) => string;
|
|
110
|
+
readonly CREATE: (pageId: string) => string;
|
|
110
111
|
};
|
|
111
112
|
};
|
|
112
113
|
readonly MESSAGE: {
|
package/build/rest-api.js
CHANGED
|
@@ -123,7 +123,8 @@ exports.REST_API = {
|
|
|
123
123
|
},
|
|
124
124
|
CHAT: {
|
|
125
125
|
UNREG: {
|
|
126
|
-
|
|
126
|
+
GET: (pageId) => `${exports.ROOT}/${controllers_1.CHAT_UNREG_CONTROLLER.replace(':pageId', pageId)}`,
|
|
127
|
+
CREATE: (pageId) => `${exports.ROOT}/${controllers_1.CHAT_UNREG_CONTROLLER.replace(':pageId', pageId)}`,
|
|
127
128
|
},
|
|
128
129
|
},
|
|
129
130
|
MESSAGE: {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ErrorMetadata } from '../../shared';
|
|
2
|
+
export declare enum AIErrorCode {
|
|
3
|
+
GENERATION_FAILED = "GENERATION_FAILED",
|
|
4
|
+
GENERATION_TIMEOUT = "GENERATION_TIMEOUT",
|
|
5
|
+
CONTENT_FILTERED = "CONTENT_FILTERED",
|
|
6
|
+
CONTEXT_TOO_LONG = "CONTEXT_TOO_LONG",
|
|
7
|
+
MODEL_NOT_FOUND = "MODEL_NOT_FOUND",
|
|
8
|
+
MODEL_UNAVAILABLE = "MODEL_UNAVAILABLE",
|
|
9
|
+
NO_SUITABLE_MODEL = "NO_SUITABLE_MODEL",
|
|
10
|
+
INSUFFICIENT_BALANCE = "INSUFFICIENT_BALANCE",
|
|
11
|
+
COST_LIMIT_EXCEEDED = "COST_LIMIT_EXCEEDED",
|
|
12
|
+
PROVIDER_ERROR = "PROVIDER_ERROR",
|
|
13
|
+
PROVIDER_RATE_LIMIT = "PROVIDER_RATE_LIMIT",
|
|
14
|
+
PROVIDER_TIMEOUT = "PROVIDER_TIMEOUT"
|
|
15
|
+
}
|
|
16
|
+
export declare const AI_ERRORS: Record<AIErrorCode, ErrorMetadata>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AI_ERRORS = exports.AIErrorCode = void 0;
|
|
4
|
+
var AIErrorCode;
|
|
5
|
+
(function (AIErrorCode) {
|
|
6
|
+
// Generation
|
|
7
|
+
AIErrorCode["GENERATION_FAILED"] = "GENERATION_FAILED";
|
|
8
|
+
AIErrorCode["GENERATION_TIMEOUT"] = "GENERATION_TIMEOUT";
|
|
9
|
+
AIErrorCode["CONTENT_FILTERED"] = "CONTENT_FILTERED";
|
|
10
|
+
AIErrorCode["CONTEXT_TOO_LONG"] = "CONTEXT_TOO_LONG";
|
|
11
|
+
// Model
|
|
12
|
+
AIErrorCode["MODEL_NOT_FOUND"] = "MODEL_NOT_FOUND";
|
|
13
|
+
AIErrorCode["MODEL_UNAVAILABLE"] = "MODEL_UNAVAILABLE";
|
|
14
|
+
AIErrorCode["NO_SUITABLE_MODEL"] = "NO_SUITABLE_MODEL";
|
|
15
|
+
// Billing
|
|
16
|
+
AIErrorCode["INSUFFICIENT_BALANCE"] = "INSUFFICIENT_BALANCE";
|
|
17
|
+
AIErrorCode["COST_LIMIT_EXCEEDED"] = "COST_LIMIT_EXCEEDED";
|
|
18
|
+
// Provider
|
|
19
|
+
AIErrorCode["PROVIDER_ERROR"] = "PROVIDER_ERROR";
|
|
20
|
+
AIErrorCode["PROVIDER_RATE_LIMIT"] = "PROVIDER_RATE_LIMIT";
|
|
21
|
+
AIErrorCode["PROVIDER_TIMEOUT"] = "PROVIDER_TIMEOUT";
|
|
22
|
+
})(AIErrorCode || (exports.AIErrorCode = AIErrorCode = {}));
|
|
23
|
+
exports.AI_ERRORS = {
|
|
24
|
+
[AIErrorCode.GENERATION_FAILED]: {
|
|
25
|
+
code: AIErrorCode.GENERATION_FAILED,
|
|
26
|
+
statusCode: 500,
|
|
27
|
+
},
|
|
28
|
+
[AIErrorCode.GENERATION_TIMEOUT]: {
|
|
29
|
+
code: AIErrorCode.GENERATION_TIMEOUT,
|
|
30
|
+
statusCode: 504,
|
|
31
|
+
},
|
|
32
|
+
[AIErrorCode.CONTENT_FILTERED]: {
|
|
33
|
+
code: AIErrorCode.CONTENT_FILTERED,
|
|
34
|
+
statusCode: 400,
|
|
35
|
+
},
|
|
36
|
+
[AIErrorCode.CONTEXT_TOO_LONG]: {
|
|
37
|
+
code: AIErrorCode.CONTEXT_TOO_LONG,
|
|
38
|
+
statusCode: 400,
|
|
39
|
+
},
|
|
40
|
+
[AIErrorCode.MODEL_NOT_FOUND]: {
|
|
41
|
+
code: AIErrorCode.MODEL_NOT_FOUND,
|
|
42
|
+
statusCode: 404,
|
|
43
|
+
},
|
|
44
|
+
[AIErrorCode.MODEL_UNAVAILABLE]: {
|
|
45
|
+
code: AIErrorCode.MODEL_UNAVAILABLE,
|
|
46
|
+
statusCode: 503,
|
|
47
|
+
},
|
|
48
|
+
[AIErrorCode.NO_SUITABLE_MODEL]: {
|
|
49
|
+
code: AIErrorCode.NO_SUITABLE_MODEL,
|
|
50
|
+
statusCode: 400,
|
|
51
|
+
},
|
|
52
|
+
[AIErrorCode.INSUFFICIENT_BALANCE]: {
|
|
53
|
+
code: AIErrorCode.INSUFFICIENT_BALANCE,
|
|
54
|
+
statusCode: 402,
|
|
55
|
+
},
|
|
56
|
+
[AIErrorCode.COST_LIMIT_EXCEEDED]: {
|
|
57
|
+
code: AIErrorCode.COST_LIMIT_EXCEEDED,
|
|
58
|
+
statusCode: 402,
|
|
59
|
+
},
|
|
60
|
+
[AIErrorCode.PROVIDER_ERROR]: {
|
|
61
|
+
code: AIErrorCode.PROVIDER_ERROR,
|
|
62
|
+
statusCode: 502,
|
|
63
|
+
},
|
|
64
|
+
[AIErrorCode.PROVIDER_RATE_LIMIT]: {
|
|
65
|
+
code: AIErrorCode.PROVIDER_RATE_LIMIT,
|
|
66
|
+
statusCode: 429,
|
|
67
|
+
},
|
|
68
|
+
[AIErrorCode.PROVIDER_TIMEOUT]: {
|
|
69
|
+
code: AIErrorCode.PROVIDER_TIMEOUT,
|
|
70
|
+
statusCode: 504,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ai.errors';
|
|
@@ -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("./ai.errors"), exports);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { HttpMethod } from '../../../shared/http-method';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Create Unreg Chat Command
|
|
5
|
+
* POST /api/v1/unreg/page/:pageId/chat
|
|
6
6
|
*/
|
|
7
|
-
export declare namespace
|
|
7
|
+
export declare namespace CreateUnregChatCommand {
|
|
8
8
|
const Request: z.ZodObject<{}, z.core.$strip>;
|
|
9
9
|
const Response: z.ZodObject<{
|
|
10
10
|
uuid: z.ZodString;
|
|
@@ -26,7 +26,7 @@ export declare namespace GetOrCreateUnregChatCommand {
|
|
|
26
26
|
}, z.core.$strip>>;
|
|
27
27
|
}, z.core.$strip>;
|
|
28
28
|
const URL: (pageId: string) => string;
|
|
29
|
-
const METHOD = HttpMethod.
|
|
29
|
+
const METHOD = HttpMethod.POST;
|
|
30
30
|
type RequestType = z.infer<typeof Request>;
|
|
31
31
|
type ResponseType = z.infer<typeof Response>;
|
|
32
32
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateUnregChatCommand = 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
|
+
* Create Unreg Chat Command
|
|
10
|
+
* POST /api/v1/unreg/page/:pageId/chat
|
|
11
|
+
*/
|
|
12
|
+
var CreateUnregChatCommand;
|
|
13
|
+
(function (CreateUnregChatCommand) {
|
|
14
|
+
CreateUnregChatCommand.Request = zod_1.z.object({});
|
|
15
|
+
CreateUnregChatCommand.Response = schemas_1.ChatWithMessagesResponseSchema;
|
|
16
|
+
CreateUnregChatCommand.URL = (pageId) => rest_api_1.REST_API.V1.CHAT.UNREG.CREATE(pageId);
|
|
17
|
+
CreateUnregChatCommand.METHOD = http_method_1.HttpMethod.POST;
|
|
18
|
+
})(CreateUnregChatCommand || (exports.CreateUnregChatCommand = CreateUnregChatCommand = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { CreateUnregChatCommand } from './create-unreg-chat.command';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "
|
|
3
|
+
exports.CreateUnregChatCommand = void 0;
|
|
4
|
+
var create_unreg_chat_command_1 = require("./create-unreg-chat.command");
|
|
5
|
+
Object.defineProperty(exports, "CreateUnregChatCommand", { enumerable: true, get: function () { return create_unreg_chat_command_1.CreateUnregChatCommand; } });
|
package/build/v1/chat/index.d.ts
CHANGED
package/build/v1/chat/index.js
CHANGED
|
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./schemas"), exports);
|
|
18
18
|
__exportStar(require("./commands"), exports);
|
|
19
|
+
__exportStar(require("./queries"), exports);
|
|
19
20
|
__exportStar(require("./chat.errors"), exports);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { HttpMethod } from '../../../shared/http-method';
|
|
3
|
+
/**
|
|
4
|
+
* Get Unreg Chat Query
|
|
5
|
+
* GET /api/v1/unreg/page/:pageId/chat
|
|
6
|
+
*/
|
|
7
|
+
export declare namespace GetUnregChatQuery {
|
|
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.GET;
|
|
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.GetUnregChatQuery = 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 Unreg Chat Query
|
|
10
|
+
* GET /api/v1/unreg/page/:pageId/chat
|
|
11
|
+
*/
|
|
12
|
+
var GetUnregChatQuery;
|
|
13
|
+
(function (GetUnregChatQuery) {
|
|
14
|
+
GetUnregChatQuery.Request = zod_1.z.object({});
|
|
15
|
+
GetUnregChatQuery.Response = schemas_1.ChatWithMessagesResponseSchema;
|
|
16
|
+
GetUnregChatQuery.URL = (pageId) => rest_api_1.REST_API.V1.CHAT.UNREG.GET(pageId);
|
|
17
|
+
GetUnregChatQuery.METHOD = http_method_1.HttpMethod.GET;
|
|
18
|
+
})(GetUnregChatQuery || (exports.GetUnregChatQuery = GetUnregChatQuery = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { GetUnregChatQuery } from './get-unreg-chat.query';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetUnregChatQuery = void 0;
|
|
4
|
+
var get_unreg_chat_query_1 = require("./get-unreg-chat.query");
|
|
5
|
+
Object.defineProperty(exports, "GetUnregChatQuery", { enumerable: true, get: function () { return get_unreg_chat_query_1.GetUnregChatQuery; } });
|
package/build/v1/index.d.ts
CHANGED
package/build/v1/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,18 +0,0 @@
|
|
|
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 = {}));
|