@veruna/api-contracts 1.0.45 → 1.0.46
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/v1/index.d.ts +1 -0
- package/build/v1/index.js +1 -0
- package/build/v1/message/commands/create-message.command.d.ts +10 -0
- package/build/v1/message/schemas/index.d.ts +3 -1
- package/build/v1/message/schemas/index.js +6 -1
- package/build/v1/message/schemas/message-attachment.schema.d.ts +27 -0
- package/build/v1/message/schemas/message-attachment.schema.js +28 -0
- package/build/v1/message/schemas/stream-events.schema.d.ts +26 -0
- package/build/v1/message/schemas/stream-events.schema.js +20 -1
- package/build/v1/s3/index.d.ts +1 -0
- package/build/v1/s3/index.js +17 -0
- package/build/v1/s3/s3.errors.d.ts +13 -0
- package/build/v1/s3/s3.errors.js +29 -0
- package/package.json +1 -1
package/build/v1/index.d.ts
CHANGED
package/build/v1/index.js
CHANGED
|
@@ -51,6 +51,7 @@ export declare namespace CreateMessageCommand {
|
|
|
51
51
|
chatId: z.ZodString;
|
|
52
52
|
messageId: z.ZodString;
|
|
53
53
|
type: z.ZodLiteral<import("../schemas").StreamEventType.REASONING>;
|
|
54
|
+
content: z.ZodLiteral<"">;
|
|
54
55
|
reasoning: z.ZodString;
|
|
55
56
|
reasoningDetails: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
56
57
|
type: z.ZodString;
|
|
@@ -58,6 +59,15 @@ export declare namespace CreateMessageCommand {
|
|
|
58
59
|
format: z.ZodOptional<z.ZodString>;
|
|
59
60
|
index: z.ZodOptional<z.ZodNumber>;
|
|
60
61
|
}, z.core.$strip>>>;
|
|
62
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
63
|
+
id: z.ZodNumber;
|
|
64
|
+
chatId: z.ZodString;
|
|
65
|
+
messageId: z.ZodString;
|
|
66
|
+
type: z.ZodLiteral<import("../schemas").StreamEventType.IMAGE>;
|
|
67
|
+
content: z.ZodLiteral<"">;
|
|
68
|
+
imageBase64: z.ZodString;
|
|
69
|
+
imageMimeType: z.ZodString;
|
|
70
|
+
imageIndex: z.ZodNumber;
|
|
61
71
|
}, z.core.$strip>, z.ZodObject<{
|
|
62
72
|
id: z.ZodNumber;
|
|
63
73
|
chatId: z.ZodString;
|
|
@@ -4,7 +4,9 @@ export { UserRating } from './user-rating.enum';
|
|
|
4
4
|
export { CreateMessageRequestSchema } from './create-message-request.schema';
|
|
5
5
|
export { CreateMessageResponseSchema } from './create-message-response.schema';
|
|
6
6
|
export { MessageResponseSchema } from './message-response.schema';
|
|
7
|
-
export { StreamEventType, StreamEventSchema, StreamChunkEventSchema, StreamReasoningEventSchema, StreamDoneEventSchema, StreamErrorEventSchema, } from './stream-events.schema';
|
|
7
|
+
export { StreamEventType, StreamEventSchema, StreamChunkEventSchema, StreamReasoningEventSchema, StreamImageEventSchema, StreamDoneEventSchema, StreamErrorEventSchema, } from './stream-events.schema';
|
|
8
|
+
export { AttachmentType, AttachmentSchema, AttachmentsSchema } from './message-attachment.schema';
|
|
9
|
+
export type { Attachment, Attachments } from './message-attachment.schema';
|
|
8
10
|
export { MessageMetaSchema, ReasoningMetaSchema, ReasoningDetailSchema, } from './message-meta.schema';
|
|
9
11
|
export { RateMessageRequestSchema, RateMessageResponseSchema, RateMessageParamsSchema, } from './rate-message.schema';
|
|
10
12
|
export type { RateMessageRequestDto, RateMessageResponseDto, RateMessageParamsDto, } from './rate-message.schema';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RateMessageParamsSchema = exports.RateMessageResponseSchema = exports.RateMessageRequestSchema = exports.ReasoningDetailSchema = exports.ReasoningMetaSchema = exports.MessageMetaSchema = exports.StreamErrorEventSchema = exports.StreamDoneEventSchema = exports.StreamReasoningEventSchema = exports.StreamChunkEventSchema = exports.StreamEventSchema = exports.StreamEventType = exports.MessageResponseSchema = exports.CreateMessageResponseSchema = exports.CreateMessageRequestSchema = exports.UserRating = exports.MessageStatus = exports.MessageRole = void 0;
|
|
3
|
+
exports.RateMessageParamsSchema = exports.RateMessageResponseSchema = exports.RateMessageRequestSchema = exports.ReasoningDetailSchema = exports.ReasoningMetaSchema = exports.MessageMetaSchema = exports.AttachmentsSchema = exports.AttachmentSchema = exports.AttachmentType = exports.StreamErrorEventSchema = exports.StreamDoneEventSchema = exports.StreamImageEventSchema = exports.StreamReasoningEventSchema = exports.StreamChunkEventSchema = exports.StreamEventSchema = exports.StreamEventType = exports.MessageResponseSchema = exports.CreateMessageResponseSchema = exports.CreateMessageRequestSchema = exports.UserRating = exports.MessageStatus = exports.MessageRole = void 0;
|
|
4
4
|
var message_role_enum_1 = require("./message-role.enum");
|
|
5
5
|
Object.defineProperty(exports, "MessageRole", { enumerable: true, get: function () { return message_role_enum_1.MessageRole; } });
|
|
6
6
|
var message_status_enum_1 = require("./message-status.enum");
|
|
@@ -18,8 +18,13 @@ Object.defineProperty(exports, "StreamEventType", { enumerable: true, get: funct
|
|
|
18
18
|
Object.defineProperty(exports, "StreamEventSchema", { enumerable: true, get: function () { return stream_events_schema_1.StreamEventSchema; } });
|
|
19
19
|
Object.defineProperty(exports, "StreamChunkEventSchema", { enumerable: true, get: function () { return stream_events_schema_1.StreamChunkEventSchema; } });
|
|
20
20
|
Object.defineProperty(exports, "StreamReasoningEventSchema", { enumerable: true, get: function () { return stream_events_schema_1.StreamReasoningEventSchema; } });
|
|
21
|
+
Object.defineProperty(exports, "StreamImageEventSchema", { enumerable: true, get: function () { return stream_events_schema_1.StreamImageEventSchema; } });
|
|
21
22
|
Object.defineProperty(exports, "StreamDoneEventSchema", { enumerable: true, get: function () { return stream_events_schema_1.StreamDoneEventSchema; } });
|
|
22
23
|
Object.defineProperty(exports, "StreamErrorEventSchema", { enumerable: true, get: function () { return stream_events_schema_1.StreamErrorEventSchema; } });
|
|
24
|
+
var message_attachment_schema_1 = require("./message-attachment.schema");
|
|
25
|
+
Object.defineProperty(exports, "AttachmentType", { enumerable: true, get: function () { return message_attachment_schema_1.AttachmentType; } });
|
|
26
|
+
Object.defineProperty(exports, "AttachmentSchema", { enumerable: true, get: function () { return message_attachment_schema_1.AttachmentSchema; } });
|
|
27
|
+
Object.defineProperty(exports, "AttachmentsSchema", { enumerable: true, get: function () { return message_attachment_schema_1.AttachmentsSchema; } });
|
|
23
28
|
var message_meta_schema_1 = require("./message-meta.schema");
|
|
24
29
|
Object.defineProperty(exports, "MessageMetaSchema", { enumerable: true, get: function () { return message_meta_schema_1.MessageMetaSchema; } });
|
|
25
30
|
Object.defineProperty(exports, "ReasoningMetaSchema", { enumerable: true, get: function () { return message_meta_schema_1.ReasoningMetaSchema; } });
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Attachment types for message assets
|
|
4
|
+
*/
|
|
5
|
+
export declare enum AttachmentType {
|
|
6
|
+
IMAGE = "image"
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Attachment schema - stores S3 reference for generated assets
|
|
10
|
+
* Used internally for file management (deletion, tracking)
|
|
11
|
+
* NOT sent to frontend - frontend gets images via markdown in content
|
|
12
|
+
*/
|
|
13
|
+
export declare const AttachmentSchema: z.ZodObject<{
|
|
14
|
+
type: z.ZodEnum<typeof AttachmentType>;
|
|
15
|
+
key: z.ZodString;
|
|
16
|
+
bucket: z.ZodString;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export type Attachment = z.infer<typeof AttachmentSchema>;
|
|
19
|
+
/**
|
|
20
|
+
* Array of attachments for message
|
|
21
|
+
*/
|
|
22
|
+
export declare const AttachmentsSchema: z.ZodArray<z.ZodObject<{
|
|
23
|
+
type: z.ZodEnum<typeof AttachmentType>;
|
|
24
|
+
key: z.ZodString;
|
|
25
|
+
bucket: z.ZodString;
|
|
26
|
+
}, z.core.$strip>>;
|
|
27
|
+
export type Attachments = z.infer<typeof AttachmentsSchema>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AttachmentsSchema = exports.AttachmentSchema = exports.AttachmentType = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* Attachment types for message assets
|
|
7
|
+
*/
|
|
8
|
+
var AttachmentType;
|
|
9
|
+
(function (AttachmentType) {
|
|
10
|
+
AttachmentType["IMAGE"] = "image";
|
|
11
|
+
})(AttachmentType || (exports.AttachmentType = AttachmentType = {}));
|
|
12
|
+
/**
|
|
13
|
+
* Attachment schema - stores S3 reference for generated assets
|
|
14
|
+
* Used internally for file management (deletion, tracking)
|
|
15
|
+
* NOT sent to frontend - frontend gets images via markdown in content
|
|
16
|
+
*/
|
|
17
|
+
exports.AttachmentSchema = zod_1.z.object({
|
|
18
|
+
/** Asset type */
|
|
19
|
+
type: zod_1.z.nativeEnum(AttachmentType),
|
|
20
|
+
/** S3 object key */
|
|
21
|
+
key: zod_1.z.string().min(1),
|
|
22
|
+
/** S3 bucket name */
|
|
23
|
+
bucket: zod_1.z.string().min(1),
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Array of attachments for message
|
|
27
|
+
*/
|
|
28
|
+
exports.AttachmentsSchema = zod_1.z.array(exports.AttachmentSchema);
|
|
@@ -7,6 +7,8 @@ export declare enum StreamEventType {
|
|
|
7
7
|
CHUNK = "chunk",
|
|
8
8
|
/** Reasoning chunk from AI */
|
|
9
9
|
REASONING = "reasoning",
|
|
10
|
+
/** Image generated by AI */
|
|
11
|
+
IMAGE = "image",
|
|
10
12
|
/** Stream completed successfully */
|
|
11
13
|
DONE = "done",
|
|
12
14
|
/** Error occurred during streaming */
|
|
@@ -30,6 +32,7 @@ export declare const StreamReasoningEventSchema: z.ZodObject<{
|
|
|
30
32
|
chatId: z.ZodString;
|
|
31
33
|
messageId: z.ZodString;
|
|
32
34
|
type: z.ZodLiteral<StreamEventType.REASONING>;
|
|
35
|
+
content: z.ZodLiteral<"">;
|
|
33
36
|
reasoning: z.ZodString;
|
|
34
37
|
reasoningDetails: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
35
38
|
type: z.ZodString;
|
|
@@ -58,6 +61,19 @@ export declare const StreamErrorEventSchema: z.ZodObject<{
|
|
|
58
61
|
type: z.ZodLiteral<StreamEventType.ERROR>;
|
|
59
62
|
content: z.ZodLiteral<"">;
|
|
60
63
|
}, z.core.$strip>;
|
|
64
|
+
/**
|
|
65
|
+
* Image event - AI generated image (base64)
|
|
66
|
+
*/
|
|
67
|
+
export declare const StreamImageEventSchema: z.ZodObject<{
|
|
68
|
+
id: z.ZodNumber;
|
|
69
|
+
chatId: z.ZodString;
|
|
70
|
+
messageId: z.ZodString;
|
|
71
|
+
type: z.ZodLiteral<StreamEventType.IMAGE>;
|
|
72
|
+
content: z.ZodLiteral<"">;
|
|
73
|
+
imageBase64: z.ZodString;
|
|
74
|
+
imageMimeType: z.ZodString;
|
|
75
|
+
imageIndex: z.ZodNumber;
|
|
76
|
+
}, z.core.$strip>;
|
|
61
77
|
/**
|
|
62
78
|
* Discriminated union of all stream events
|
|
63
79
|
* Use `type` field to narrow the type
|
|
@@ -73,6 +89,7 @@ export declare const StreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
73
89
|
chatId: z.ZodString;
|
|
74
90
|
messageId: z.ZodString;
|
|
75
91
|
type: z.ZodLiteral<StreamEventType.REASONING>;
|
|
92
|
+
content: z.ZodLiteral<"">;
|
|
76
93
|
reasoning: z.ZodString;
|
|
77
94
|
reasoningDetails: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
78
95
|
type: z.ZodString;
|
|
@@ -80,6 +97,15 @@ export declare const StreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
80
97
|
format: z.ZodOptional<z.ZodString>;
|
|
81
98
|
index: z.ZodOptional<z.ZodNumber>;
|
|
82
99
|
}, z.core.$strip>>>;
|
|
100
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
101
|
+
id: z.ZodNumber;
|
|
102
|
+
chatId: z.ZodString;
|
|
103
|
+
messageId: z.ZodString;
|
|
104
|
+
type: z.ZodLiteral<StreamEventType.IMAGE>;
|
|
105
|
+
content: z.ZodLiteral<"">;
|
|
106
|
+
imageBase64: z.ZodString;
|
|
107
|
+
imageMimeType: z.ZodString;
|
|
108
|
+
imageIndex: z.ZodNumber;
|
|
83
109
|
}, z.core.$strip>, z.ZodObject<{
|
|
84
110
|
id: z.ZodNumber;
|
|
85
111
|
chatId: z.ZodString;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StreamEventSchema = exports.StreamErrorEventSchema = exports.StreamDoneEventSchema = exports.StreamReasoningEventSchema = exports.StreamChunkEventSchema = exports.StreamEventType = void 0;
|
|
3
|
+
exports.StreamEventSchema = exports.StreamImageEventSchema = exports.StreamErrorEventSchema = exports.StreamDoneEventSchema = exports.StreamReasoningEventSchema = exports.StreamChunkEventSchema = exports.StreamEventType = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
/**
|
|
6
6
|
* Stream Event Types for message streaming (NDJSON format)
|
|
@@ -11,6 +11,8 @@ var StreamEventType;
|
|
|
11
11
|
StreamEventType["CHUNK"] = "chunk";
|
|
12
12
|
/** Reasoning chunk from AI */
|
|
13
13
|
StreamEventType["REASONING"] = "reasoning";
|
|
14
|
+
/** Image generated by AI */
|
|
15
|
+
StreamEventType["IMAGE"] = "image";
|
|
14
16
|
/** Stream completed successfully */
|
|
15
17
|
StreamEventType["DONE"] = "done";
|
|
16
18
|
/** Error occurred during streaming */
|
|
@@ -43,6 +45,8 @@ exports.StreamChunkEventSchema = BaseStreamEventSchema.extend({
|
|
|
43
45
|
*/
|
|
44
46
|
exports.StreamReasoningEventSchema = BaseStreamEventSchema.extend({
|
|
45
47
|
type: zod_1.z.literal(StreamEventType.REASONING),
|
|
48
|
+
/** Always empty for reasoning event */
|
|
49
|
+
content: zod_1.z.literal(''),
|
|
46
50
|
/** Partial reasoning text */
|
|
47
51
|
reasoning: zod_1.z.string().min(1),
|
|
48
52
|
reasoningDetails: zod_1.z
|
|
@@ -70,6 +74,20 @@ exports.StreamErrorEventSchema = BaseStreamEventSchema.extend({
|
|
|
70
74
|
/** Always empty for error event */
|
|
71
75
|
content: zod_1.z.literal(''),
|
|
72
76
|
});
|
|
77
|
+
/**
|
|
78
|
+
* Image event - AI generated image (base64)
|
|
79
|
+
*/
|
|
80
|
+
exports.StreamImageEventSchema = BaseStreamEventSchema.extend({
|
|
81
|
+
type: zod_1.z.literal(StreamEventType.IMAGE),
|
|
82
|
+
/** Always empty for image event */
|
|
83
|
+
content: zod_1.z.literal(''),
|
|
84
|
+
/** Base64 encoded image data */
|
|
85
|
+
imageBase64: zod_1.z.string().min(1),
|
|
86
|
+
/** Image MIME type (image/jpeg, image/png, etc.) */
|
|
87
|
+
imageMimeType: zod_1.z.string().min(1),
|
|
88
|
+
/** Image index (for multiple images in one message) */
|
|
89
|
+
imageIndex: zod_1.z.number().int().nonnegative(),
|
|
90
|
+
});
|
|
73
91
|
// ============================================================================
|
|
74
92
|
// Union Schema
|
|
75
93
|
// ============================================================================
|
|
@@ -80,6 +98,7 @@ exports.StreamErrorEventSchema = BaseStreamEventSchema.extend({
|
|
|
80
98
|
exports.StreamEventSchema = zod_1.z.discriminatedUnion('type', [
|
|
81
99
|
exports.StreamChunkEventSchema,
|
|
82
100
|
exports.StreamReasoningEventSchema,
|
|
101
|
+
exports.StreamImageEventSchema,
|
|
83
102
|
exports.StreamDoneEventSchema,
|
|
84
103
|
exports.StreamErrorEventSchema,
|
|
85
104
|
]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './s3.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("./s3.errors"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ErrorMetadata } from '../../shared/error-metadata';
|
|
2
|
+
/**
|
|
3
|
+
* S3 Error Codes
|
|
4
|
+
*/
|
|
5
|
+
export declare enum S3ErrorCode {
|
|
6
|
+
UPLOAD_FAILED = "S3_UPLOAD_FAILED",
|
|
7
|
+
INVALID_BASE64 = "S3_INVALID_BASE64",
|
|
8
|
+
DELETE_FAILED = "S3_DELETE_FAILED"
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* S3 Error Metadata mapping
|
|
12
|
+
*/
|
|
13
|
+
export declare const S3_ERRORS: Record<S3ErrorCode, ErrorMetadata>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.S3_ERRORS = exports.S3ErrorCode = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* S3 Error Codes
|
|
6
|
+
*/
|
|
7
|
+
var S3ErrorCode;
|
|
8
|
+
(function (S3ErrorCode) {
|
|
9
|
+
S3ErrorCode["UPLOAD_FAILED"] = "S3_UPLOAD_FAILED";
|
|
10
|
+
S3ErrorCode["INVALID_BASE64"] = "S3_INVALID_BASE64";
|
|
11
|
+
S3ErrorCode["DELETE_FAILED"] = "S3_DELETE_FAILED";
|
|
12
|
+
})(S3ErrorCode || (exports.S3ErrorCode = S3ErrorCode = {}));
|
|
13
|
+
/**
|
|
14
|
+
* S3 Error Metadata mapping
|
|
15
|
+
*/
|
|
16
|
+
exports.S3_ERRORS = {
|
|
17
|
+
[S3ErrorCode.UPLOAD_FAILED]: {
|
|
18
|
+
code: S3ErrorCode.UPLOAD_FAILED,
|
|
19
|
+
statusCode: 500,
|
|
20
|
+
},
|
|
21
|
+
[S3ErrorCode.INVALID_BASE64]: {
|
|
22
|
+
code: S3ErrorCode.INVALID_BASE64,
|
|
23
|
+
statusCode: 400,
|
|
24
|
+
},
|
|
25
|
+
[S3ErrorCode.DELETE_FAILED]: {
|
|
26
|
+
code: S3ErrorCode.DELETE_FAILED,
|
|
27
|
+
statusCode: 500,
|
|
28
|
+
},
|
|
29
|
+
};
|