@purpleschool/multisite 0.0.34 → 0.0.41
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/controller/http/auth.ts +1 -0
- package/api/controller/http/catalog.ts +6 -0
- package/api/controller/http/file.ts +1 -0
- package/api/controller/http/index.ts +2 -0
- package/api/controller/http/text-chat.ts +18 -0
- package/api/routes.ts +1 -0
- package/build/api/controller/http/auth.d.ts +1 -0
- package/build/api/controller/http/auth.d.ts.map +1 -1
- package/build/api/controller/http/auth.js +1 -0
- package/build/api/controller/http/catalog.d.ts +7 -0
- package/build/api/controller/http/catalog.d.ts.map +1 -0
- package/build/api/controller/http/catalog.js +9 -0
- package/build/api/controller/http/file.d.ts +1 -0
- package/build/api/controller/http/file.d.ts.map +1 -1
- package/build/api/controller/http/file.js +1 -0
- package/build/api/controller/http/index.d.ts +2 -0
- package/build/api/controller/http/index.d.ts.map +1 -1
- package/build/api/controller/http/index.js +2 -0
- package/build/api/controller/http/text-chat.d.ts +18 -0
- package/build/api/controller/http/text-chat.d.ts.map +1 -0
- package/build/api/controller/http/text-chat.js +20 -0
- package/build/api/routes.d.ts +1 -0
- package/build/api/routes.d.ts.map +1 -1
- package/build/api/routes.js +1 -0
- package/build/commands/auth/change-password.command.d.ts +5 -0
- package/build/commands/auth/change-password.command.d.ts.map +1 -1
- package/build/commands/auth/change-password.command.js +1 -0
- package/build/commands/auth/index.d.ts +1 -0
- package/build/commands/auth/index.d.ts.map +1 -1
- package/build/commands/auth/index.js +1 -0
- package/build/commands/auth/login.command.d.ts +5 -0
- package/build/commands/auth/login.command.d.ts.map +1 -1
- package/build/commands/auth/login.command.js +1 -0
- package/build/commands/auth/refresh.command.d.ts +30 -0
- package/build/commands/auth/refresh.command.d.ts.map +1 -0
- package/build/commands/auth/refresh.command.js +15 -0
- package/build/commands/auth/register.command.d.ts +5 -0
- package/build/commands/auth/register.command.d.ts.map +1 -1
- package/build/commands/auth/register.command.js +1 -0
- package/build/commands/auth/reset-password.command.d.ts +5 -0
- package/build/commands/auth/reset-password.command.d.ts.map +1 -1
- package/build/commands/auth/reset-password.command.js +1 -0
- package/build/commands/auth/verify-email.command.d.ts.map +1 -1
- package/build/commands/auth/verify-email.command.js +2 -1
- package/build/commands/auth/vk-login.command.d.ts +5 -0
- package/build/commands/auth/vk-login.command.d.ts.map +1 -1
- package/build/commands/auth/vk-login.command.js +1 -0
- package/build/commands/auth/yandex-login.command.d.ts +5 -0
- package/build/commands/auth/yandex-login.command.d.ts.map +1 -1
- package/build/commands/auth/yandex-login.command.js +1 -0
- package/build/commands/catalog/index.d.ts +156 -0
- package/build/commands/catalog/index.d.ts.map +1 -0
- package/build/commands/catalog/index.js +23 -0
- package/build/commands/index.d.ts +2 -0
- package/build/commands/index.d.ts.map +1 -1
- package/build/commands/index.js +2 -0
- package/build/commands/page/create-page.command.d.ts +8 -0
- package/build/commands/page/create-page.command.d.ts.map +1 -1
- package/build/commands/page/find-page-by-alias.command.d.ts +16 -0
- package/build/commands/page/find-page-by-alias.command.d.ts.map +1 -1
- package/build/commands/page/find-page-by-criteria.command.d.ts +5 -0
- package/build/commands/page/find-page-by-criteria.command.d.ts.map +1 -1
- package/build/commands/page/find-page.command.d.ts +11 -0
- package/build/commands/page/find-page.command.d.ts.map +1 -1
- package/build/commands/page/update-page.command.d.ts +8 -0
- package/build/commands/page/update-page.command.d.ts.map +1 -1
- package/build/commands/product/fast-buy-product.command.d.ts.map +1 -1
- package/build/commands/product/fast-buy-product.command.js +2 -1
- package/build/commands/subscription/fast-buy-subscription.command.d.ts.map +1 -1
- package/build/commands/subscription/fast-buy-subscription.command.js +2 -1
- package/build/commands/text-chat/category.d.ts +321 -0
- package/build/commands/text-chat/category.d.ts.map +1 -0
- package/build/commands/text-chat/category.js +29 -0
- package/build/commands/text-chat/index.d.ts +292 -0
- package/build/commands/text-chat/index.d.ts.map +1 -0
- package/build/commands/text-chat/index.js +73 -0
- package/build/constants/catalog.d.ts +5 -0
- package/build/constants/catalog.d.ts.map +1 -0
- package/build/constants/catalog.js +8 -0
- package/build/constants/errors/errors.d.ts +77 -0
- package/build/constants/errors/errors.d.ts.map +1 -1
- package/build/constants/errors/errors.js +77 -0
- package/build/constants/files/enums/file-type.enum.d.ts +3 -1
- package/build/constants/files/enums/file-type.enum.d.ts.map +1 -1
- package/build/constants/files/enums/file-type.enum.js +2 -0
- package/build/constants/index.d.ts +3 -0
- package/build/constants/index.d.ts.map +1 -1
- package/build/constants/index.js +3 -0
- package/build/constants/text-chat/attachments.d.ts +12 -0
- package/build/constants/text-chat/attachments.d.ts.map +1 -0
- package/build/constants/text-chat/attachments.js +52 -0
- package/build/constants/text-chat/index.d.ts +38 -0
- package/build/constants/text-chat/index.d.ts.map +1 -0
- package/build/constants/text-chat/index.js +59 -0
- package/build/constants/text-provider/index.d.ts +37 -0
- package/build/constants/text-provider/index.d.ts.map +1 -0
- package/build/constants/text-provider/index.js +46 -0
- package/build/constants/tools/enums/tool-type.enum.d.ts +1 -0
- package/build/constants/tools/enums/tool-type.enum.d.ts.map +1 -1
- package/build/constants/tools/enums/tool-type.enum.js +1 -0
- package/build/helpers/index.d.ts +1 -0
- package/build/helpers/index.d.ts.map +1 -1
- package/build/helpers/index.js +1 -0
- package/build/helpers/text-chat/index.d.ts +23 -0
- package/build/helpers/text-chat/index.d.ts.map +1 -0
- package/build/helpers/text-chat/index.js +91 -0
- package/build/models/catalog/index.d.ts +181 -0
- package/build/models/catalog/index.d.ts.map +1 -0
- package/build/models/catalog/index.js +36 -0
- package/build/models/index.d.ts +2 -0
- package/build/models/index.d.ts.map +1 -1
- package/build/models/index.js +2 -0
- package/build/models/page.schema.d.ts +6 -0
- package/build/models/page.schema.d.ts.map +1 -1
- package/build/models/page.schema.js +1 -0
- package/build/models/text-chat/category.schema.d.ts +79 -0
- package/build/models/text-chat/category.schema.d.ts.map +1 -0
- package/build/models/text-chat/category.schema.js +38 -0
- package/build/models/text-chat/index.d.ts +319 -0
- package/build/models/text-chat/index.d.ts.map +1 -0
- package/build/models/text-chat/index.js +79 -0
- package/build/models/text-chat/provider-config.schema.d.ts +92 -0
- package/build/models/text-chat/provider-config.schema.d.ts.map +1 -0
- package/build/models/text-chat/provider-config.schema.js +42 -0
- package/build/models/text-chat/stream.schema.d.ts +83 -0
- package/build/models/text-chat/stream.schema.d.ts.map +1 -0
- package/build/models/text-chat/stream.schema.js +24 -0
- package/build/models/user.schema.d.ts +1 -0
- package/build/models/user.schema.d.ts.map +1 -1
- package/build/models/user.schema.js +3 -2
- package/build/queries/catalog/index.d.ts +259 -0
- package/build/queries/catalog/index.d.ts.map +1 -0
- package/build/queries/catalog/index.js +31 -0
- package/build/queries/index.d.ts +2 -0
- package/build/queries/index.d.ts.map +1 -1
- package/build/queries/index.js +2 -0
- package/build/queries/subscription/get-subscriptions-summary.command.d.ts +5 -0
- package/build/queries/subscription/get-subscriptions-summary.command.d.ts.map +1 -1
- package/build/queries/subscription/get-subscriptions-summary.command.js +1 -0
- package/build/queries/text-chat/category.d.ts +297 -0
- package/build/queries/text-chat/category.d.ts.map +1 -0
- package/build/queries/text-chat/category.js +45 -0
- package/build/queries/text-chat/index.d.ts +472 -0
- package/build/queries/text-chat/index.d.ts.map +1 -0
- package/build/queries/text-chat/index.js +61 -0
- package/commands/auth/change-password.command.ts +1 -0
- package/commands/auth/index.ts +1 -0
- package/commands/auth/login.command.ts +1 -0
- package/commands/auth/refresh.command.ts +15 -0
- package/commands/auth/register.command.ts +1 -0
- package/commands/auth/reset-password.command.ts +1 -0
- package/commands/auth/verify-email.command.ts +2 -1
- package/commands/auth/vk-login.command.ts +1 -0
- package/commands/auth/yandex-login.command.ts +1 -0
- package/commands/catalog/index.ts +26 -0
- package/commands/index.ts +2 -0
- package/commands/product/fast-buy-product.command.ts +2 -1
- package/commands/subscription/fast-buy-subscription.command.ts +2 -1
- package/commands/text-chat/category.ts +42 -0
- package/commands/text-chat/index.ts +71 -0
- package/constants/catalog.ts +4 -0
- package/constants/errors/errors.ts +78 -0
- package/constants/files/enums/file-type.enum.ts +2 -0
- package/constants/index.ts +3 -0
- package/constants/text-chat/attachments.ts +55 -0
- package/constants/text-chat/index.ts +43 -0
- package/constants/text-provider/index.ts +42 -0
- package/constants/tools/enums/tool-type.enum.ts +1 -0
- package/helpers/index.ts +1 -0
- package/helpers/text-chat/index.ts +91 -0
- package/models/catalog/index.ts +35 -0
- package/models/index.ts +2 -0
- package/models/page.schema.ts +1 -0
- package/models/text-chat/category.schema.ts +40 -0
- package/models/text-chat/index.ts +82 -0
- package/models/text-chat/provider-config.schema.ts +47 -0
- package/models/text-chat/stream.schema.ts +43 -0
- package/models/user.schema.ts +3 -1
- package/package.json +1 -1
- package/queries/catalog/index.ts +29 -0
- package/queries/index.ts +2 -0
- package/queries/subscription/get-subscriptions-summary.command.ts +1 -0
- package/queries/text-chat/category.ts +51 -0
- package/queries/text-chat/index.ts +56 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TEXT_PROVIDER_SKIP_REASON = exports.TEXT_PROVIDER_FALLBACK_REASON = exports.TEXT_PROVIDER_FAILURE_KIND = exports.TEXT_PROVIDER_ATTEMPT_EVENT = exports.TEXT_PROVIDER_TRANSPORT = exports.TEXT_PROVIDER_MESSAGE_ROLE = exports.TEXT_PROVIDER_CODE = void 0;
|
|
4
|
+
var TEXT_PROVIDER_CODE;
|
|
5
|
+
(function (TEXT_PROVIDER_CODE) {
|
|
6
|
+
TEXT_PROVIDER_CODE["WELLFLOW"] = "wellflow";
|
|
7
|
+
TEXT_PROVIDER_CODE["API_ROUTE"] = "api_route";
|
|
8
|
+
TEXT_PROVIDER_CODE["DEROUTER"] = "derouter";
|
|
9
|
+
})(TEXT_PROVIDER_CODE || (exports.TEXT_PROVIDER_CODE = TEXT_PROVIDER_CODE = {}));
|
|
10
|
+
var TEXT_PROVIDER_MESSAGE_ROLE;
|
|
11
|
+
(function (TEXT_PROVIDER_MESSAGE_ROLE) {
|
|
12
|
+
TEXT_PROVIDER_MESSAGE_ROLE["SYSTEM"] = "system";
|
|
13
|
+
TEXT_PROVIDER_MESSAGE_ROLE["USER"] = "user";
|
|
14
|
+
TEXT_PROVIDER_MESSAGE_ROLE["ASSISTANT"] = "assistant";
|
|
15
|
+
})(TEXT_PROVIDER_MESSAGE_ROLE || (exports.TEXT_PROVIDER_MESSAGE_ROLE = TEXT_PROVIDER_MESSAGE_ROLE = {}));
|
|
16
|
+
var TEXT_PROVIDER_TRANSPORT;
|
|
17
|
+
(function (TEXT_PROVIDER_TRANSPORT) {
|
|
18
|
+
TEXT_PROVIDER_TRANSPORT["AI_PROXY"] = "ai_proxy";
|
|
19
|
+
})(TEXT_PROVIDER_TRANSPORT || (exports.TEXT_PROVIDER_TRANSPORT = TEXT_PROVIDER_TRANSPORT = {}));
|
|
20
|
+
var TEXT_PROVIDER_ATTEMPT_EVENT;
|
|
21
|
+
(function (TEXT_PROVIDER_ATTEMPT_EVENT) {
|
|
22
|
+
TEXT_PROVIDER_ATTEMPT_EVENT["START"] = "start";
|
|
23
|
+
TEXT_PROVIDER_ATTEMPT_EVENT["FIRST_DELTA"] = "first_delta";
|
|
24
|
+
TEXT_PROVIDER_ATTEMPT_EVENT["SUCCESS"] = "success";
|
|
25
|
+
TEXT_PROVIDER_ATTEMPT_EVENT["FAILED"] = "failed";
|
|
26
|
+
TEXT_PROVIDER_ATTEMPT_EVENT["CANCELLED"] = "cancelled";
|
|
27
|
+
})(TEXT_PROVIDER_ATTEMPT_EVENT || (exports.TEXT_PROVIDER_ATTEMPT_EVENT = TEXT_PROVIDER_ATTEMPT_EVENT = {}));
|
|
28
|
+
var TEXT_PROVIDER_FAILURE_KIND;
|
|
29
|
+
(function (TEXT_PROVIDER_FAILURE_KIND) {
|
|
30
|
+
TEXT_PROVIDER_FAILURE_KIND["TIMEOUT"] = "timeout";
|
|
31
|
+
TEXT_PROVIDER_FAILURE_KIND["REQUEST"] = "request";
|
|
32
|
+
TEXT_PROVIDER_FAILURE_KIND["PROVIDER"] = "provider";
|
|
33
|
+
})(TEXT_PROVIDER_FAILURE_KIND || (exports.TEXT_PROVIDER_FAILURE_KIND = TEXT_PROVIDER_FAILURE_KIND = {}));
|
|
34
|
+
var TEXT_PROVIDER_FALLBACK_REASON;
|
|
35
|
+
(function (TEXT_PROVIDER_FALLBACK_REASON) {
|
|
36
|
+
TEXT_PROVIDER_FALLBACK_REASON["NO_CANDIDATES"] = "no_candidates";
|
|
37
|
+
TEXT_PROVIDER_FALLBACK_REASON["QUERY_FAILED"] = "query_failed";
|
|
38
|
+
TEXT_PROVIDER_FALLBACK_REASON["EXHAUSTED"] = "exhausted";
|
|
39
|
+
TEXT_PROVIDER_FALLBACK_REASON["BUDGET"] = "budget";
|
|
40
|
+
})(TEXT_PROVIDER_FALLBACK_REASON || (exports.TEXT_PROVIDER_FALLBACK_REASON = TEXT_PROVIDER_FALLBACK_REASON = {}));
|
|
41
|
+
var TEXT_PROVIDER_SKIP_REASON;
|
|
42
|
+
(function (TEXT_PROVIDER_SKIP_REASON) {
|
|
43
|
+
TEXT_PROVIDER_SKIP_REASON["INVALID"] = "invalid";
|
|
44
|
+
TEXT_PROVIDER_SKIP_REASON["TRAFFIC"] = "traffic";
|
|
45
|
+
TEXT_PROVIDER_SKIP_REASON["COOLDOWN"] = "cooldown";
|
|
46
|
+
})(TEXT_PROVIDER_SKIP_REASON || (exports.TEXT_PROVIDER_SKIP_REASON = TEXT_PROVIDER_SKIP_REASON = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-type.enum.d.ts","sourceRoot":"","sources":["../../../../constants/tools/enums/tool-type.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS;IACjB,gBAAgB,qBAAqB;IACrC,YAAY,iBAAiB;IAC7B,gBAAgB,qBAAqB;IACrC,GAAG,QAAQ;IACX,GAAG,QAAQ;CACd"}
|
|
1
|
+
{"version":3,"file":"tool-type.enum.d.ts","sourceRoot":"","sources":["../../../../constants/tools/enums/tool-type.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS;IACjB,IAAI,SAAS;IACb,gBAAgB,qBAAqB;IACrC,YAAY,iBAAiB;IAC7B,gBAAgB,qBAAqB;IACrC,GAAG,QAAQ;IACX,GAAG,QAAQ;CACd"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TOOL_TYPE = void 0;
|
|
4
4
|
var TOOL_TYPE;
|
|
5
5
|
(function (TOOL_TYPE) {
|
|
6
|
+
TOOL_TYPE["TEXT"] = "text";
|
|
6
7
|
TOOL_TYPE["IMAGE_GENERATION"] = "image_generation";
|
|
7
8
|
TOOL_TYPE["IMAGE_EDITOR"] = "image_editor";
|
|
8
9
|
TOOL_TYPE["MARKETPLACE_CARD"] = "marketplace_card";
|
package/build/helpers/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC"}
|
package/build/helpers/index.js
CHANGED
|
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./image-generation"), exports);
|
|
18
18
|
__exportStar(require("./image-editor"), exports);
|
|
19
19
|
__exportStar(require("./openai-image-2"), exports);
|
|
20
|
+
__exportStar(require("./text-chat"), exports);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TextChatStreamFrame } from '../../models/text-chat/stream.schema';
|
|
2
|
+
/** UTF-8 NDJSON, one validated JSON frame followed by LF. Not SSE. */
|
|
3
|
+
export declare function encodeTextChatStreamFrame(frame: TextChatStreamFrame): string;
|
|
4
|
+
/** One parser per HTTP response. EOF without a terminal frame is never success. */
|
|
5
|
+
export declare class TextChatStreamParser {
|
|
6
|
+
private readonly expected;
|
|
7
|
+
private readonly maxFrameLength;
|
|
8
|
+
private readonly decoder;
|
|
9
|
+
private pending;
|
|
10
|
+
private sequence;
|
|
11
|
+
private correlation;
|
|
12
|
+
private terminal;
|
|
13
|
+
private closed;
|
|
14
|
+
private failed;
|
|
15
|
+
constructor(expected?: {
|
|
16
|
+
chatId?: string;
|
|
17
|
+
messageId?: string;
|
|
18
|
+
}, maxFrameLength?: number);
|
|
19
|
+
push(chunk: Uint8Array): TextChatStreamFrame[];
|
|
20
|
+
finish(): void;
|
|
21
|
+
private accept;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../helpers/text-chat/index.ts"],"names":[],"mappings":"AACA,OAAO,EACH,mBAAmB,EAEtB,MAAM,sCAAsC,CAAC;AAE9C,sEAAsE;AACtE,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,CAE5E;AAED,mFAAmF;AACnF,qBAAa,oBAAoB;IAUzB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAVnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6C;IACrE,OAAO,CAAC,OAAO,CAAM;IACrB,OAAO,CAAC,QAAQ,CAAM;IACtB,OAAO,CAAC,WAAW,CAAoD;IACvE,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAS;IAEvB,YACqB,QAAQ,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAO,EACtD,cAAc,SAAc,EAKhD;IAED,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,mBAAmB,EAAE,CAsB7C;IAED,MAAM,IAAI,IAAI,CAMb;IAED,OAAO,CAAC,MAAM;CA4BjB"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextChatStreamParser = void 0;
|
|
4
|
+
exports.encodeTextChatStreamFrame = encodeTextChatStreamFrame;
|
|
5
|
+
const text_chat_1 = require("../../constants/text-chat");
|
|
6
|
+
const stream_schema_1 = require("../../models/text-chat/stream.schema");
|
|
7
|
+
/** UTF-8 NDJSON, one validated JSON frame followed by LF. Not SSE. */
|
|
8
|
+
function encodeTextChatStreamFrame(frame) {
|
|
9
|
+
return `${JSON.stringify(stream_schema_1.TextChatStreamFrameSchema.parse(frame))}\n`;
|
|
10
|
+
}
|
|
11
|
+
/** One parser per HTTP response. EOF without a terminal frame is never success. */
|
|
12
|
+
class TextChatStreamParser {
|
|
13
|
+
constructor(expected = {}, maxFrameLength = 1024 * 1024) {
|
|
14
|
+
this.expected = expected;
|
|
15
|
+
this.maxFrameLength = maxFrameLength;
|
|
16
|
+
this.decoder = new TextDecoder('utf-8', { fatal: true });
|
|
17
|
+
this.pending = '';
|
|
18
|
+
this.sequence = -1;
|
|
19
|
+
this.terminal = false;
|
|
20
|
+
this.closed = false;
|
|
21
|
+
this.failed = false;
|
|
22
|
+
if (!Number.isSafeInteger(maxFrameLength) || maxFrameLength < 1) {
|
|
23
|
+
throw new Error('Invalid stream frame limit');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
push(chunk) {
|
|
27
|
+
if (this.closed || this.failed)
|
|
28
|
+
throw new Error('Stream parser is closed');
|
|
29
|
+
try {
|
|
30
|
+
this.pending += this.decoder.decode(chunk, { stream: true });
|
|
31
|
+
const frames = [];
|
|
32
|
+
let newline;
|
|
33
|
+
while ((newline = this.pending.indexOf('\n')) !== -1) {
|
|
34
|
+
if (newline > this.maxFrameLength)
|
|
35
|
+
throw new Error('Stream frame is too large');
|
|
36
|
+
const line = this.pending.slice(0, newline);
|
|
37
|
+
this.pending = this.pending.slice(newline + 1);
|
|
38
|
+
if (!line.trim())
|
|
39
|
+
continue;
|
|
40
|
+
const frame = stream_schema_1.TextChatStreamFrameSchema.parse(JSON.parse(line));
|
|
41
|
+
this.accept(frame);
|
|
42
|
+
frames.push(frame);
|
|
43
|
+
}
|
|
44
|
+
if (this.pending.length > this.maxFrameLength)
|
|
45
|
+
throw new Error('Stream frame is too large');
|
|
46
|
+
return frames;
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
this.failed = true;
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
finish() {
|
|
54
|
+
if (this.closed || this.failed)
|
|
55
|
+
throw new Error('Stream parser is closed');
|
|
56
|
+
this.closed = true;
|
|
57
|
+
this.pending += this.decoder.decode();
|
|
58
|
+
if (this.pending.length)
|
|
59
|
+
throw new Error('Incomplete stream frame');
|
|
60
|
+
if (!this.terminal)
|
|
61
|
+
throw new Error('Stream ended without a terminal frame');
|
|
62
|
+
}
|
|
63
|
+
accept(frame) {
|
|
64
|
+
if (this.terminal)
|
|
65
|
+
throw new Error('Frame received after stream completion');
|
|
66
|
+
if (frame.sequence !== this.sequence + 1)
|
|
67
|
+
throw new Error('Invalid stream sequence');
|
|
68
|
+
if (!this.correlation) {
|
|
69
|
+
if (frame.type !== text_chat_1.TEXT_CHAT_STREAM_EVENT.START)
|
|
70
|
+
throw new Error('Missing stream start');
|
|
71
|
+
if ((this.expected.chatId && frame.chatId !== this.expected.chatId) ||
|
|
72
|
+
(this.expected.messageId && frame.messageId !== this.expected.messageId)) {
|
|
73
|
+
throw new Error('Unexpected stream correlation');
|
|
74
|
+
}
|
|
75
|
+
this.correlation = { chatId: frame.chatId, messageId: frame.messageId };
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
if (frame.type === text_chat_1.TEXT_CHAT_STREAM_EVENT.START)
|
|
79
|
+
throw new Error('Duplicate stream start');
|
|
80
|
+
if (frame.chatId !== this.correlation.chatId ||
|
|
81
|
+
frame.messageId !== this.correlation.messageId) {
|
|
82
|
+
throw new Error('Stream correlation changed');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
this.sequence = frame.sequence;
|
|
86
|
+
this.terminal =
|
|
87
|
+
frame.type === text_chat_1.TEXT_CHAT_STREAM_EVENT.FINISH ||
|
|
88
|
+
frame.type === text_chat_1.TEXT_CHAT_STREAM_EVENT.ERROR;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
exports.TextChatStreamParser = TextChatStreamParser;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { TOOL_TYPE } from '../../constants';
|
|
3
|
+
export declare const CatalogOrderSchema: z.ZodNumber;
|
|
4
|
+
export declare const CatalogGroupFieldsSchema: z.ZodObject<{
|
|
5
|
+
title: z.ZodString;
|
|
6
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
title: string;
|
|
9
|
+
order?: number | undefined;
|
|
10
|
+
}, {
|
|
11
|
+
title: string;
|
|
12
|
+
order?: number | undefined;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const CatalogGroupSchema: z.ZodObject<{
|
|
15
|
+
uuid: z.ZodString;
|
|
16
|
+
title: z.ZodString;
|
|
17
|
+
order: z.ZodNumber;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
uuid: string;
|
|
20
|
+
title: string;
|
|
21
|
+
order: number;
|
|
22
|
+
}, {
|
|
23
|
+
uuid: string;
|
|
24
|
+
title: string;
|
|
25
|
+
order: number;
|
|
26
|
+
}>;
|
|
27
|
+
export declare const CatalogGroupAdminSchema: z.ZodObject<{
|
|
28
|
+
uuid: z.ZodString;
|
|
29
|
+
title: z.ZodString;
|
|
30
|
+
order: z.ZodNumber;
|
|
31
|
+
} & {
|
|
32
|
+
siteId: z.ZodString;
|
|
33
|
+
createdAt: z.ZodUnion<[z.ZodString, z.ZodDate]>;
|
|
34
|
+
updatedAt: z.ZodUnion<[z.ZodString, z.ZodDate]>;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
uuid: string;
|
|
37
|
+
title: string;
|
|
38
|
+
order: number;
|
|
39
|
+
siteId: string;
|
|
40
|
+
createdAt: string | Date;
|
|
41
|
+
updatedAt: string | Date;
|
|
42
|
+
}, {
|
|
43
|
+
uuid: string;
|
|
44
|
+
title: string;
|
|
45
|
+
order: number;
|
|
46
|
+
siteId: string;
|
|
47
|
+
createdAt: string | Date;
|
|
48
|
+
updatedAt: string | Date;
|
|
49
|
+
}>;
|
|
50
|
+
export declare const CatalogItemSchema: z.ZodObject<{
|
|
51
|
+
categoryId: z.ZodString;
|
|
52
|
+
title: z.ZodString;
|
|
53
|
+
order: z.ZodNumber;
|
|
54
|
+
page: z.ZodObject<{
|
|
55
|
+
uuid: z.ZodString;
|
|
56
|
+
alias: z.ZodString;
|
|
57
|
+
title: z.ZodString;
|
|
58
|
+
toolType: z.ZodNullable<z.ZodNativeEnum<typeof TOOL_TYPE>>;
|
|
59
|
+
toolOptionId: z.ZodNullable<z.ZodString>;
|
|
60
|
+
}, "strip", z.ZodTypeAny, {
|
|
61
|
+
uuid: string;
|
|
62
|
+
alias: string;
|
|
63
|
+
title: string;
|
|
64
|
+
toolType: TOOL_TYPE | null;
|
|
65
|
+
toolOptionId: string | null;
|
|
66
|
+
}, {
|
|
67
|
+
uuid: string;
|
|
68
|
+
alias: string;
|
|
69
|
+
title: string;
|
|
70
|
+
toolType: TOOL_TYPE | null;
|
|
71
|
+
toolOptionId: string | null;
|
|
72
|
+
}>;
|
|
73
|
+
}, "strip", z.ZodTypeAny, {
|
|
74
|
+
categoryId: string;
|
|
75
|
+
title: string;
|
|
76
|
+
order: number;
|
|
77
|
+
page: {
|
|
78
|
+
uuid: string;
|
|
79
|
+
alias: string;
|
|
80
|
+
title: string;
|
|
81
|
+
toolType: TOOL_TYPE | null;
|
|
82
|
+
toolOptionId: string | null;
|
|
83
|
+
};
|
|
84
|
+
}, {
|
|
85
|
+
categoryId: string;
|
|
86
|
+
title: string;
|
|
87
|
+
order: number;
|
|
88
|
+
page: {
|
|
89
|
+
uuid: string;
|
|
90
|
+
alias: string;
|
|
91
|
+
title: string;
|
|
92
|
+
toolType: TOOL_TYPE | null;
|
|
93
|
+
toolOptionId: string | null;
|
|
94
|
+
};
|
|
95
|
+
}>;
|
|
96
|
+
export declare const PublicCatalogGroupSchema: z.ZodObject<{
|
|
97
|
+
uuid: z.ZodString;
|
|
98
|
+
title: z.ZodString;
|
|
99
|
+
order: z.ZodNumber;
|
|
100
|
+
} & {
|
|
101
|
+
items: z.ZodArray<z.ZodObject<{
|
|
102
|
+
categoryId: z.ZodString;
|
|
103
|
+
title: z.ZodString;
|
|
104
|
+
order: z.ZodNumber;
|
|
105
|
+
page: z.ZodObject<{
|
|
106
|
+
uuid: z.ZodString;
|
|
107
|
+
alias: z.ZodString;
|
|
108
|
+
title: z.ZodString;
|
|
109
|
+
toolType: z.ZodNullable<z.ZodNativeEnum<typeof TOOL_TYPE>>;
|
|
110
|
+
toolOptionId: z.ZodNullable<z.ZodString>;
|
|
111
|
+
}, "strip", z.ZodTypeAny, {
|
|
112
|
+
uuid: string;
|
|
113
|
+
alias: string;
|
|
114
|
+
title: string;
|
|
115
|
+
toolType: TOOL_TYPE | null;
|
|
116
|
+
toolOptionId: string | null;
|
|
117
|
+
}, {
|
|
118
|
+
uuid: string;
|
|
119
|
+
alias: string;
|
|
120
|
+
title: string;
|
|
121
|
+
toolType: TOOL_TYPE | null;
|
|
122
|
+
toolOptionId: string | null;
|
|
123
|
+
}>;
|
|
124
|
+
}, "strip", z.ZodTypeAny, {
|
|
125
|
+
categoryId: string;
|
|
126
|
+
title: string;
|
|
127
|
+
order: number;
|
|
128
|
+
page: {
|
|
129
|
+
uuid: string;
|
|
130
|
+
alias: string;
|
|
131
|
+
title: string;
|
|
132
|
+
toolType: TOOL_TYPE | null;
|
|
133
|
+
toolOptionId: string | null;
|
|
134
|
+
};
|
|
135
|
+
}, {
|
|
136
|
+
categoryId: string;
|
|
137
|
+
title: string;
|
|
138
|
+
order: number;
|
|
139
|
+
page: {
|
|
140
|
+
uuid: string;
|
|
141
|
+
alias: string;
|
|
142
|
+
title: string;
|
|
143
|
+
toolType: TOOL_TYPE | null;
|
|
144
|
+
toolOptionId: string | null;
|
|
145
|
+
};
|
|
146
|
+
}>, "many">;
|
|
147
|
+
}, "strip", z.ZodTypeAny, {
|
|
148
|
+
uuid: string;
|
|
149
|
+
title: string;
|
|
150
|
+
order: number;
|
|
151
|
+
items: {
|
|
152
|
+
categoryId: string;
|
|
153
|
+
title: string;
|
|
154
|
+
order: number;
|
|
155
|
+
page: {
|
|
156
|
+
uuid: string;
|
|
157
|
+
alias: string;
|
|
158
|
+
title: string;
|
|
159
|
+
toolType: TOOL_TYPE | null;
|
|
160
|
+
toolOptionId: string | null;
|
|
161
|
+
};
|
|
162
|
+
}[];
|
|
163
|
+
}, {
|
|
164
|
+
uuid: string;
|
|
165
|
+
title: string;
|
|
166
|
+
order: number;
|
|
167
|
+
items: {
|
|
168
|
+
categoryId: string;
|
|
169
|
+
title: string;
|
|
170
|
+
order: number;
|
|
171
|
+
page: {
|
|
172
|
+
uuid: string;
|
|
173
|
+
alias: string;
|
|
174
|
+
title: string;
|
|
175
|
+
toolType: TOOL_TYPE | null;
|
|
176
|
+
toolOptionId: string | null;
|
|
177
|
+
};
|
|
178
|
+
}[];
|
|
179
|
+
}>;
|
|
180
|
+
export type PublicCatalogGroup = z.infer<typeof PublicCatalogGroupSchema>;
|
|
181
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../models/catalog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,eAAO,MAAM,kBAAkB,aAA0C,CAAC;AAC1E,eAAO,MAAM,wBAAwB;;;;;;;;;EAGnC,CAAC;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;EAI7B,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;EAIlC,CAAC;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAW5B,CAAC;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PublicCatalogGroupSchema = exports.CatalogItemSchema = exports.CatalogGroupAdminSchema = exports.CatalogGroupSchema = exports.CatalogGroupFieldsSchema = exports.CatalogOrderSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
exports.CatalogOrderSchema = zod_1.z.number().int().min(0).max(2147483647);
|
|
7
|
+
exports.CatalogGroupFieldsSchema = zod_1.z.object({
|
|
8
|
+
title: zod_1.z.string().trim().min(1).max(200),
|
|
9
|
+
order: exports.CatalogOrderSchema.optional(),
|
|
10
|
+
});
|
|
11
|
+
exports.CatalogGroupSchema = zod_1.z.object({
|
|
12
|
+
uuid: zod_1.z.string().uuid(),
|
|
13
|
+
title: zod_1.z.string(),
|
|
14
|
+
order: exports.CatalogOrderSchema,
|
|
15
|
+
});
|
|
16
|
+
const TimestampSchema = zod_1.z.string().datetime().or(zod_1.z.date());
|
|
17
|
+
exports.CatalogGroupAdminSchema = exports.CatalogGroupSchema.extend({
|
|
18
|
+
siteId: zod_1.z.string().uuid(),
|
|
19
|
+
createdAt: TimestampSchema,
|
|
20
|
+
updatedAt: TimestampSchema,
|
|
21
|
+
});
|
|
22
|
+
exports.CatalogItemSchema = zod_1.z.object({
|
|
23
|
+
categoryId: zod_1.z.string().uuid(),
|
|
24
|
+
title: zod_1.z.string(),
|
|
25
|
+
order: exports.CatalogOrderSchema,
|
|
26
|
+
page: zod_1.z.object({
|
|
27
|
+
uuid: zod_1.z.string().uuid(),
|
|
28
|
+
alias: zod_1.z.string(),
|
|
29
|
+
title: zod_1.z.string(),
|
|
30
|
+
toolType: zod_1.z.nativeEnum(constants_1.TOOL_TYPE).nullable(),
|
|
31
|
+
toolOptionId: zod_1.z.string().nullable(),
|
|
32
|
+
}),
|
|
33
|
+
});
|
|
34
|
+
exports.PublicCatalogGroupSchema = exports.CatalogGroupSchema.extend({
|
|
35
|
+
items: zod_1.z.array(exports.CatalogItemSchema),
|
|
36
|
+
});
|
package/build/models/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../models/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,mCAAmC,CAAC;AAClD,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC;AACvC,cAAc,OAAO,CAAC;AACtB,cAAc,OAAO,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../models/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,mCAAmC,CAAC;AAClD,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC;AACvC,cAAc,OAAO,CAAC;AACtB,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
|
package/build/models/index.js
CHANGED
|
@@ -32,3 +32,5 @@ __exportStar(require("./page.schema"), exports);
|
|
|
32
32
|
__exportStar(require("./page-question.schema"), exports);
|
|
33
33
|
__exportStar(require("./stt"), exports);
|
|
34
34
|
__exportStar(require("./tts"), exports);
|
|
35
|
+
__exportStar(require("./text-chat"), exports);
|
|
36
|
+
__exportStar(require("./catalog"), exports);
|
|
@@ -10,6 +10,7 @@ export declare const PageSchema: z.ZodObject<{
|
|
|
10
10
|
alias: z.ZodString;
|
|
11
11
|
toolType: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof TOOL_TYPE>>>;
|
|
12
12
|
toolOptionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
13
|
+
categoryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
13
14
|
createdAt: z.ZodDate;
|
|
14
15
|
updatedAt: z.ZodDate;
|
|
15
16
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -22,6 +23,7 @@ export declare const PageSchema: z.ZodObject<{
|
|
|
22
23
|
alias: string;
|
|
23
24
|
toolType?: TOOL_TYPE | null | undefined;
|
|
24
25
|
toolOptionId?: string | null | undefined;
|
|
26
|
+
categoryId?: string | null | undefined;
|
|
25
27
|
createdAt: Date;
|
|
26
28
|
updatedAt: Date;
|
|
27
29
|
}, {
|
|
@@ -34,6 +36,7 @@ export declare const PageSchema: z.ZodObject<{
|
|
|
34
36
|
alias: string;
|
|
35
37
|
toolType?: TOOL_TYPE | null | undefined;
|
|
36
38
|
toolOptionId?: string | null | undefined;
|
|
39
|
+
categoryId?: string | null | undefined;
|
|
37
40
|
createdAt: Date;
|
|
38
41
|
updatedAt: Date;
|
|
39
42
|
}>;
|
|
@@ -47,6 +50,7 @@ export declare const PageWithQuestionsSchema: z.ZodObject<{
|
|
|
47
50
|
alias: z.ZodString;
|
|
48
51
|
toolType: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof TOOL_TYPE>>>;
|
|
49
52
|
toolOptionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
53
|
+
categoryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
50
54
|
createdAt: z.ZodDate;
|
|
51
55
|
updatedAt: z.ZodDate;
|
|
52
56
|
} & {
|
|
@@ -82,6 +86,7 @@ export declare const PageWithQuestionsSchema: z.ZodObject<{
|
|
|
82
86
|
alias: string;
|
|
83
87
|
toolType?: TOOL_TYPE | null | undefined;
|
|
84
88
|
toolOptionId?: string | null | undefined;
|
|
89
|
+
categoryId?: string | null | undefined;
|
|
85
90
|
createdAt: Date;
|
|
86
91
|
updatedAt: Date;
|
|
87
92
|
questions: {
|
|
@@ -102,6 +107,7 @@ export declare const PageWithQuestionsSchema: z.ZodObject<{
|
|
|
102
107
|
alias: string;
|
|
103
108
|
toolType?: TOOL_TYPE | null | undefined;
|
|
104
109
|
toolOptionId?: string | null | undefined;
|
|
110
|
+
categoryId?: string | null | undefined;
|
|
105
111
|
createdAt: Date;
|
|
106
112
|
updatedAt: Date;
|
|
107
113
|
questions: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.schema.d.ts","sourceRoot":"","sources":["../../models/page.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"page.schema.d.ts","sourceRoot":"","sources":["../../models/page.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAarB,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAElC,CAAC"}
|
|
@@ -14,6 +14,7 @@ exports.PageSchema = zod_1.z.object({
|
|
|
14
14
|
alias: zod_1.z.string().min(3).max(16384),
|
|
15
15
|
toolType: zod_1.z.nativeEnum(constants_1.TOOL_TYPE).nullable().optional(),
|
|
16
16
|
toolOptionId: zod_1.z.string().uuid().nullable().optional(),
|
|
17
|
+
categoryId: zod_1.z.string().uuid().nullable().optional(),
|
|
17
18
|
createdAt: zod_1.z.date(),
|
|
18
19
|
updatedAt: zod_1.z.date(),
|
|
19
20
|
});
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { TOOL_TYPE } from '../../constants/tools';
|
|
3
|
+
export declare const TextChatCategoryFieldsSchema: z.ZodObject<{
|
|
4
|
+
title: z.ZodString;
|
|
5
|
+
toolType: z.ZodDefault<z.ZodEnum<[TOOL_TYPE.TEXT, TOOL_TYPE.IMAGE_GENERATION, TOOL_TYPE.IMAGE_EDITOR]>>;
|
|
6
|
+
placeholder: z.ZodDefault<z.ZodString>;
|
|
7
|
+
groupId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
prompt: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null | undefined, string | null | undefined>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
title: string;
|
|
12
|
+
toolType: TOOL_TYPE.TEXT | TOOL_TYPE.IMAGE_GENERATION | TOOL_TYPE.IMAGE_EDITOR;
|
|
13
|
+
placeholder: string;
|
|
14
|
+
groupId?: string | null | undefined;
|
|
15
|
+
order?: number | undefined;
|
|
16
|
+
prompt?: string | null | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
title: string;
|
|
19
|
+
toolType?: TOOL_TYPE.TEXT | TOOL_TYPE.IMAGE_GENERATION | TOOL_TYPE.IMAGE_EDITOR | undefined;
|
|
20
|
+
placeholder?: string | undefined;
|
|
21
|
+
groupId?: string | null | undefined;
|
|
22
|
+
order?: number | undefined;
|
|
23
|
+
prompt?: string | null | undefined;
|
|
24
|
+
}>;
|
|
25
|
+
/** Explicit allowlist. Never extend the administrative schema for public responses. */
|
|
26
|
+
export declare const TextChatCategoryPublicSchema: z.ZodObject<{
|
|
27
|
+
uuid: z.ZodString;
|
|
28
|
+
title: z.ZodString;
|
|
29
|
+
placeholder: z.ZodString;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
uuid: string;
|
|
32
|
+
title: string;
|
|
33
|
+
placeholder: string;
|
|
34
|
+
}, {
|
|
35
|
+
uuid: string;
|
|
36
|
+
title: string;
|
|
37
|
+
placeholder: string;
|
|
38
|
+
}>;
|
|
39
|
+
export type TextChatCategoryPublic = z.infer<typeof TextChatCategoryPublicSchema>;
|
|
40
|
+
export declare const TextChatCategoryAdminSchema: z.ZodObject<{
|
|
41
|
+
uuid: z.ZodString;
|
|
42
|
+
title: z.ZodString;
|
|
43
|
+
placeholder: z.ZodString;
|
|
44
|
+
} & {
|
|
45
|
+
siteId: z.ZodString;
|
|
46
|
+
toolType: z.ZodDefault<z.ZodEnum<[TOOL_TYPE.TEXT, TOOL_TYPE.IMAGE_GENERATION, TOOL_TYPE.IMAGE_EDITOR]>>;
|
|
47
|
+
groupId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
48
|
+
order: z.ZodDefault<z.ZodNumber>;
|
|
49
|
+
prompt: z.ZodNullable<z.ZodString>;
|
|
50
|
+
archivedAt: z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodDate]>>;
|
|
51
|
+
createdAt: z.ZodUnion<[z.ZodString, z.ZodDate]>;
|
|
52
|
+
updatedAt: z.ZodUnion<[z.ZodString, z.ZodDate]>;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
uuid: string;
|
|
55
|
+
title: string;
|
|
56
|
+
placeholder: string;
|
|
57
|
+
siteId: string;
|
|
58
|
+
toolType: TOOL_TYPE.TEXT | TOOL_TYPE.IMAGE_GENERATION | TOOL_TYPE.IMAGE_EDITOR;
|
|
59
|
+
groupId: string | null;
|
|
60
|
+
order: number;
|
|
61
|
+
prompt: string | null;
|
|
62
|
+
archivedAt: string | Date | null;
|
|
63
|
+
createdAt: string | Date;
|
|
64
|
+
updatedAt: string | Date;
|
|
65
|
+
}, {
|
|
66
|
+
uuid: string;
|
|
67
|
+
title: string;
|
|
68
|
+
placeholder: string;
|
|
69
|
+
siteId: string;
|
|
70
|
+
toolType?: TOOL_TYPE.TEXT | TOOL_TYPE.IMAGE_GENERATION | TOOL_TYPE.IMAGE_EDITOR | undefined;
|
|
71
|
+
groupId?: string | null | undefined;
|
|
72
|
+
order?: number | undefined;
|
|
73
|
+
prompt: string | null;
|
|
74
|
+
archivedAt: string | Date | null;
|
|
75
|
+
createdAt: string | Date;
|
|
76
|
+
updatedAt: string | Date;
|
|
77
|
+
}>;
|
|
78
|
+
export type TextChatCategoryAdmin = z.infer<typeof TextChatCategoryAdminSchema>;
|
|
79
|
+
//# sourceMappingURL=category.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"category.schema.d.ts","sourceRoot":"","sources":["../../../models/text-chat/category.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;EAcvC,CAAC;AAEH,uFAAuF;AACvF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;EAIvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAGlF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAStC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextChatCategoryAdminSchema = exports.TextChatCategoryPublicSchema = exports.TextChatCategoryFieldsSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const tools_1 = require("../../constants/tools");
|
|
6
|
+
const catalog_1 = require("../catalog");
|
|
7
|
+
exports.TextChatCategoryFieldsSchema = zod_1.z.object({
|
|
8
|
+
title: zod_1.z.string().trim().min(1).max(200),
|
|
9
|
+
toolType: zod_1.z
|
|
10
|
+
.enum([tools_1.TOOL_TYPE.TEXT, tools_1.TOOL_TYPE.IMAGE_GENERATION, tools_1.TOOL_TYPE.IMAGE_EDITOR])
|
|
11
|
+
.default(tools_1.TOOL_TYPE.TEXT),
|
|
12
|
+
placeholder: zod_1.z.string().trim().max(1000).default(''),
|
|
13
|
+
groupId: zod_1.z.string().uuid().nullable().optional(),
|
|
14
|
+
order: catalog_1.CatalogOrderSchema.optional(),
|
|
15
|
+
prompt: zod_1.z
|
|
16
|
+
.string()
|
|
17
|
+
.max(100000)
|
|
18
|
+
.nullable()
|
|
19
|
+
.optional()
|
|
20
|
+
.transform((value) => (typeof value === 'string' && !value.trim() ? null : value)),
|
|
21
|
+
});
|
|
22
|
+
/** Explicit allowlist. Never extend the administrative schema for public responses. */
|
|
23
|
+
exports.TextChatCategoryPublicSchema = zod_1.z.object({
|
|
24
|
+
uuid: zod_1.z.string().uuid(),
|
|
25
|
+
title: zod_1.z.string(),
|
|
26
|
+
placeholder: zod_1.z.string(),
|
|
27
|
+
});
|
|
28
|
+
const TimestampSchema = zod_1.z.string().datetime().or(zod_1.z.date());
|
|
29
|
+
exports.TextChatCategoryAdminSchema = exports.TextChatCategoryPublicSchema.extend({
|
|
30
|
+
siteId: zod_1.z.string().uuid(),
|
|
31
|
+
toolType: exports.TextChatCategoryFieldsSchema.shape.toolType,
|
|
32
|
+
groupId: zod_1.z.string().uuid().nullable().default(null),
|
|
33
|
+
order: catalog_1.CatalogOrderSchema.default(0),
|
|
34
|
+
prompt: zod_1.z.string().nullable(),
|
|
35
|
+
archivedAt: TimestampSchema.nullable(),
|
|
36
|
+
createdAt: TimestampSchema,
|
|
37
|
+
updatedAt: TimestampSchema,
|
|
38
|
+
});
|