@quickscores/chat 0.3.0 → 0.3.1
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/dist/types/api.d.ts +23 -4
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +3 -1
- package/dist/types/message.d.ts +37 -1
- package/dist/types/message.d.ts.map +1 -1
- package/dist/types/message.js +20 -2
- package/package.json +1 -1
package/dist/types/api.d.ts
CHANGED
|
@@ -35,6 +35,8 @@ export interface SendMessageBody {
|
|
|
35
35
|
body?: string | null;
|
|
36
36
|
payload?: Record<string, unknown>;
|
|
37
37
|
client_nonce?: string | null;
|
|
38
|
+
/** When set, this message is a reply to the given message (must be in the same thread). */
|
|
39
|
+
reply_to_message_id?: string | null;
|
|
38
40
|
}
|
|
39
41
|
/**
|
|
40
42
|
* POST /chat-mark-read
|
|
@@ -50,10 +52,22 @@ export interface ThreadResponse {
|
|
|
50
52
|
thread: Thread;
|
|
51
53
|
}
|
|
52
54
|
/**
|
|
53
|
-
*
|
|
55
|
+
* Message enrichment (sender_name, sender_user_role, reply_to) – included in GET /chat-messages and POST /chat-send-message responses and Realtime new_message payload.
|
|
56
|
+
*/
|
|
57
|
+
export interface ReplyToPayload {
|
|
58
|
+
message_id: string;
|
|
59
|
+
body: string | null;
|
|
60
|
+
sender_name: string | null;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Response: send message (chat-send-message). Message includes sender_name, sender_user_role, reply_to.
|
|
54
64
|
*/
|
|
55
65
|
export interface MessageResponse {
|
|
56
|
-
message: Message
|
|
66
|
+
message: Message & {
|
|
67
|
+
sender_name?: string | null;
|
|
68
|
+
sender_user_role?: "player" | "parent" | "coach" | null;
|
|
69
|
+
reply_to?: ReplyToPayload | null;
|
|
70
|
+
};
|
|
57
71
|
}
|
|
58
72
|
/**
|
|
59
73
|
* Query params for GET /chat-messages
|
|
@@ -64,10 +78,15 @@ export interface GetMessagesParams {
|
|
|
64
78
|
before?: string | null;
|
|
65
79
|
}
|
|
66
80
|
/**
|
|
67
|
-
* Response: GET /chat-messages (paginated list, newest first)
|
|
81
|
+
* Response: GET /chat-messages (paginated list, newest first).
|
|
82
|
+
* Each message includes sender_name, sender_user_role, reply_to.
|
|
68
83
|
*/
|
|
69
84
|
export interface MessagesResponse {
|
|
70
|
-
messages: Message
|
|
85
|
+
messages: Array<Message & {
|
|
86
|
+
sender_name?: string | null;
|
|
87
|
+
sender_user_role?: "player" | "parent" | "coach" | null;
|
|
88
|
+
reply_to?: ReplyToPayload | null;
|
|
89
|
+
}>;
|
|
71
90
|
}
|
|
72
91
|
/**
|
|
73
92
|
* Response: mark read (chat-mark-read)
|
package/dist/types/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/types/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,C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,IAAI,CAAC;IACpB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,GAAG;QACjB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC5B,gBAAgB,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,CAAC;QACxD,QAAQ,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;KAClC,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,KAAK,CACb,OAAO,GAAG;QACR,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC5B,gBAAgB,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,CAAC;QACxD,QAAQ,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;KAClC,CACF,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,IAAI,CAAC;CACV"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
* Kept in sync with Supabase migrations and docs/api-chat.md.
|
|
4
4
|
*/
|
|
5
5
|
export { threadKindSchema, threadSchema, threadListRowSchema, type Thread, type ThreadKind, type ThreadListRow, } from "./thread";
|
|
6
|
-
export { messageSchema, type Message } from "./message";
|
|
7
|
-
export type { ErrorResponse, CreateThreadBody, LeagueRoomBody, TeamRoomBody, SendMessageBody, MarkReadBody, GetMessagesParams, ThreadResponse, MessageResponse, MessagesResponse, MarkReadResponse, } from "./api";
|
|
6
|
+
export { messageSchema, replyToSchema, messageWithEnrichmentSchema, type Message, type ReplyTo, type MessageWithEnrichment, } from "./message";
|
|
7
|
+
export type { ErrorResponse, CreateThreadBody, LeagueRoomBody, TeamRoomBody, SendMessageBody, MarkReadBody, GetMessagesParams, ReplyToPayload, ThreadResponse, MessageResponse, MessagesResponse, MarkReadResponse, } from "./api";
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,aAAa,GACnB,MAAM,UAAU,CAAC;AAClB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,aAAa,GACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,aAAa,EACb,aAAa,EACb,2BAA2B,EAC3B,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,qBAAqB,GAC3B,MAAM,WAAW,CAAC;AACnB,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,OAAO,CAAC"}
|
package/dist/types/index.js
CHANGED
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
* Kept in sync with Supabase migrations and docs/api-chat.md.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.messageSchema = exports.threadListRowSchema = exports.threadSchema = exports.threadKindSchema = void 0;
|
|
7
|
+
exports.messageWithEnrichmentSchema = exports.replyToSchema = exports.messageSchema = exports.threadListRowSchema = exports.threadSchema = exports.threadKindSchema = void 0;
|
|
8
8
|
var thread_1 = require("./thread");
|
|
9
9
|
Object.defineProperty(exports, "threadKindSchema", { enumerable: true, get: function () { return thread_1.threadKindSchema; } });
|
|
10
10
|
Object.defineProperty(exports, "threadSchema", { enumerable: true, get: function () { return thread_1.threadSchema; } });
|
|
11
11
|
Object.defineProperty(exports, "threadListRowSchema", { enumerable: true, get: function () { return thread_1.threadListRowSchema; } });
|
|
12
12
|
var message_1 = require("./message");
|
|
13
13
|
Object.defineProperty(exports, "messageSchema", { enumerable: true, get: function () { return message_1.messageSchema; } });
|
|
14
|
+
Object.defineProperty(exports, "replyToSchema", { enumerable: true, get: function () { return message_1.replyToSchema; } });
|
|
15
|
+
Object.defineProperty(exports, "messageWithEnrichmentSchema", { enumerable: true, get: function () { return message_1.messageWithEnrichmentSchema; } });
|
package/dist/types/message.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Reply-to payload – included when the message is a reply to another message.
|
|
4
|
+
*/
|
|
5
|
+
export declare const replyToSchema: z.ZodObject<{
|
|
6
|
+
message_id: z.ZodString;
|
|
7
|
+
body: z.ZodNullable<z.ZodString>;
|
|
8
|
+
sender_name: z.ZodNullable<z.ZodString>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export type ReplyTo = z.infer<typeof replyToSchema>;
|
|
11
|
+
/**
|
|
12
|
+
* Message – base shape (chat_messages table).
|
|
4
13
|
*/
|
|
5
14
|
export declare const messageSchema: z.ZodObject<{
|
|
6
15
|
id: z.ZodString;
|
|
@@ -13,4 +22,31 @@ export declare const messageSchema: z.ZodObject<{
|
|
|
13
22
|
created_at: z.ZodString;
|
|
14
23
|
}, z.core.$strip>;
|
|
15
24
|
export type Message = z.infer<typeof messageSchema>;
|
|
25
|
+
/**
|
|
26
|
+
* Message as returned by API (GET /chat-messages, POST /chat-send-message, Realtime).
|
|
27
|
+
* Includes sender_name, sender_user_role, and optional reply_to.
|
|
28
|
+
*/
|
|
29
|
+
export declare const messageWithEnrichmentSchema: z.ZodObject<{
|
|
30
|
+
id: z.ZodString;
|
|
31
|
+
thread_id: z.ZodString;
|
|
32
|
+
sender_id: z.ZodNumber;
|
|
33
|
+
type: z.ZodString;
|
|
34
|
+
body: z.ZodNullable<z.ZodString>;
|
|
35
|
+
payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
36
|
+
client_nonce: z.ZodNullable<z.ZodString>;
|
|
37
|
+
created_at: z.ZodString;
|
|
38
|
+
reply_to_message_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
39
|
+
sender_name: z.ZodNullable<z.ZodString>;
|
|
40
|
+
sender_user_role: z.ZodNullable<z.ZodEnum<{
|
|
41
|
+
player: "player";
|
|
42
|
+
parent: "parent";
|
|
43
|
+
coach: "coach";
|
|
44
|
+
}>>;
|
|
45
|
+
reply_to: z.ZodNullable<z.ZodObject<{
|
|
46
|
+
message_id: z.ZodString;
|
|
47
|
+
body: z.ZodNullable<z.ZodString>;
|
|
48
|
+
sender_name: z.ZodNullable<z.ZodString>;
|
|
49
|
+
}, z.core.$strip>>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
export type MessageWithEnrichment = z.infer<typeof messageWithEnrichmentSchema>;
|
|
16
52
|
//# sourceMappingURL=message.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/types/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;iBASxB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/types/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,aAAa;;;;iBAIxB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;iBASxB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD;;;GAGG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;iBAKtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
|
package/dist/types/message.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.messageSchema = void 0;
|
|
3
|
+
exports.messageWithEnrichmentSchema = exports.messageSchema = exports.replyToSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Reply-to payload – included when the message is a reply to another message.
|
|
7
|
+
*/
|
|
8
|
+
exports.replyToSchema = zod_1.z.object({
|
|
9
|
+
message_id: zod_1.z.string().uuid(),
|
|
10
|
+
body: zod_1.z.string().nullable(),
|
|
11
|
+
sender_name: zod_1.z.string().nullable(),
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* Message – base shape (chat_messages table).
|
|
7
15
|
*/
|
|
8
16
|
exports.messageSchema = zod_1.z.object({
|
|
9
17
|
id: zod_1.z.string().uuid(),
|
|
@@ -15,3 +23,13 @@ exports.messageSchema = zod_1.z.object({
|
|
|
15
23
|
client_nonce: zod_1.z.string().nullable(),
|
|
16
24
|
created_at: zod_1.z.string(),
|
|
17
25
|
});
|
|
26
|
+
/**
|
|
27
|
+
* Message as returned by API (GET /chat-messages, POST /chat-send-message, Realtime).
|
|
28
|
+
* Includes sender_name, sender_user_role, and optional reply_to.
|
|
29
|
+
*/
|
|
30
|
+
exports.messageWithEnrichmentSchema = exports.messageSchema.extend({
|
|
31
|
+
reply_to_message_id: zod_1.z.string().uuid().nullable().optional(),
|
|
32
|
+
sender_name: zod_1.z.string().nullable(),
|
|
33
|
+
sender_user_role: zod_1.z.enum(["player", "parent", "coach"]).nullable(),
|
|
34
|
+
reply_to: exports.replyToSchema.nullable(),
|
|
35
|
+
});
|