@pedi/chika-types 1.0.2 → 1.0.4
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/index.d.mts +41 -1
- package/dist/index.d.ts +41 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -1
package/dist/index.d.mts
CHANGED
|
@@ -254,4 +254,44 @@ interface PediChat extends ChatDomain {
|
|
|
254
254
|
attributes: PediMessageAttributes;
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
-
|
|
257
|
+
interface UnreadCountResponse {
|
|
258
|
+
channel_id: string;
|
|
259
|
+
unread_count: number;
|
|
260
|
+
last_message_at: string | null;
|
|
261
|
+
}
|
|
262
|
+
interface MarkReadRequest {
|
|
263
|
+
participant_id: string;
|
|
264
|
+
message_id: string;
|
|
265
|
+
}
|
|
266
|
+
interface SSEUnreadSnapshotEvent {
|
|
267
|
+
event: 'unread_snapshot';
|
|
268
|
+
data: UnreadCountResponse;
|
|
269
|
+
}
|
|
270
|
+
interface SSEUnreadUpdateEvent {
|
|
271
|
+
event: 'unread_update';
|
|
272
|
+
data: {
|
|
273
|
+
channel_id: string;
|
|
274
|
+
message_id: string;
|
|
275
|
+
created_at: string;
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
interface SSEUnreadClearEvent {
|
|
279
|
+
event: 'unread_clear';
|
|
280
|
+
data: {
|
|
281
|
+
channel_id: string;
|
|
282
|
+
unread_count: number;
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
type SSEUnreadEvent = SSEUnreadSnapshotEvent | SSEUnreadUpdateEvent | SSEUnreadClearEvent;
|
|
286
|
+
declare const markReadRequestSchema: z.ZodObject<{
|
|
287
|
+
participant_id: z.ZodString;
|
|
288
|
+
message_id: z.ZodString;
|
|
289
|
+
}, "strip", z.ZodTypeAny, {
|
|
290
|
+
participant_id: string;
|
|
291
|
+
message_id: string;
|
|
292
|
+
}, {
|
|
293
|
+
participant_id: string;
|
|
294
|
+
message_id: string;
|
|
295
|
+
}>;
|
|
296
|
+
|
|
297
|
+
export { type AuthConfig, type AuthValidator, type AuthValidatorContext, type AuthValidatorResult, type ChatBucket, type ChatDomain, type ChatManifest, type DefaultDomain, type JoinRequest, type JoinResponse, type MarkReadRequest, type Message, type MessageAttributes, type MessageHistoryQuery, type MessageHistoryResponse, type Participant, type PediChat, type PediLocation, type PediMessageAttributes, type PediMessageType, type PediParticipantMeta, type PediRole, type PediVehicle, type SSEEvent, type SSEMessageEvent, type SSEResyncEvent, type SSEUnreadClearEvent, type SSEUnreadEvent, type SSEUnreadSnapshotEvent, type SSEUnreadUpdateEvent, type SendMessageRequest, type SendMessageResponse, type SystemMessageRequest, type UnreadCountResponse, joinRequestSchema, markReadRequestSchema, messageAttributesSchema, messageHistoryQuerySchema, participantSchema, sendMessageRequestSchema, systemMessageRequestSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -254,4 +254,44 @@ interface PediChat extends ChatDomain {
|
|
|
254
254
|
attributes: PediMessageAttributes;
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
-
|
|
257
|
+
interface UnreadCountResponse {
|
|
258
|
+
channel_id: string;
|
|
259
|
+
unread_count: number;
|
|
260
|
+
last_message_at: string | null;
|
|
261
|
+
}
|
|
262
|
+
interface MarkReadRequest {
|
|
263
|
+
participant_id: string;
|
|
264
|
+
message_id: string;
|
|
265
|
+
}
|
|
266
|
+
interface SSEUnreadSnapshotEvent {
|
|
267
|
+
event: 'unread_snapshot';
|
|
268
|
+
data: UnreadCountResponse;
|
|
269
|
+
}
|
|
270
|
+
interface SSEUnreadUpdateEvent {
|
|
271
|
+
event: 'unread_update';
|
|
272
|
+
data: {
|
|
273
|
+
channel_id: string;
|
|
274
|
+
message_id: string;
|
|
275
|
+
created_at: string;
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
interface SSEUnreadClearEvent {
|
|
279
|
+
event: 'unread_clear';
|
|
280
|
+
data: {
|
|
281
|
+
channel_id: string;
|
|
282
|
+
unread_count: number;
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
type SSEUnreadEvent = SSEUnreadSnapshotEvent | SSEUnreadUpdateEvent | SSEUnreadClearEvent;
|
|
286
|
+
declare const markReadRequestSchema: z.ZodObject<{
|
|
287
|
+
participant_id: z.ZodString;
|
|
288
|
+
message_id: z.ZodString;
|
|
289
|
+
}, "strip", z.ZodTypeAny, {
|
|
290
|
+
participant_id: string;
|
|
291
|
+
message_id: string;
|
|
292
|
+
}, {
|
|
293
|
+
participant_id: string;
|
|
294
|
+
message_id: string;
|
|
295
|
+
}>;
|
|
296
|
+
|
|
297
|
+
export { type AuthConfig, type AuthValidator, type AuthValidatorContext, type AuthValidatorResult, type ChatBucket, type ChatDomain, type ChatManifest, type DefaultDomain, type JoinRequest, type JoinResponse, type MarkReadRequest, type Message, type MessageAttributes, type MessageHistoryQuery, type MessageHistoryResponse, type Participant, type PediChat, type PediLocation, type PediMessageAttributes, type PediMessageType, type PediParticipantMeta, type PediRole, type PediVehicle, type SSEEvent, type SSEMessageEvent, type SSEResyncEvent, type SSEUnreadClearEvent, type SSEUnreadEvent, type SSEUnreadSnapshotEvent, type SSEUnreadUpdateEvent, type SendMessageRequest, type SendMessageResponse, type SystemMessageRequest, type UnreadCountResponse, joinRequestSchema, markReadRequestSchema, messageAttributesSchema, messageHistoryQuerySchema, participantSchema, sendMessageRequestSchema, systemMessageRequestSchema };
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
joinRequestSchema: () => joinRequestSchema,
|
|
24
|
+
markReadRequestSchema: () => markReadRequestSchema,
|
|
24
25
|
messageAttributesSchema: () => messageAttributesSchema,
|
|
25
26
|
messageHistoryQuerySchema: () => messageHistoryQuerySchema,
|
|
26
27
|
participantSchema: () => participantSchema,
|
|
@@ -61,9 +62,17 @@ var messageHistoryQuerySchema = import_zod2.z.object({
|
|
|
61
62
|
before: import_zod2.z.string().datetime().optional(),
|
|
62
63
|
after: import_zod2.z.string().datetime().optional()
|
|
63
64
|
});
|
|
65
|
+
|
|
66
|
+
// src/unread.ts
|
|
67
|
+
var import_zod3 = require("zod");
|
|
68
|
+
var markReadRequestSchema = import_zod3.z.object({
|
|
69
|
+
participant_id: import_zod3.z.string().min(1),
|
|
70
|
+
message_id: import_zod3.z.string().min(1)
|
|
71
|
+
});
|
|
64
72
|
// Annotate the CommonJS export names for ESM import in node:
|
|
65
73
|
0 && (module.exports = {
|
|
66
74
|
joinRequestSchema,
|
|
75
|
+
markReadRequestSchema,
|
|
67
76
|
messageAttributesSchema,
|
|
68
77
|
messageHistoryQuerySchema,
|
|
69
78
|
participantSchema,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/participant.ts","../src/channel.ts","../src/message.ts"],"sourcesContent":["export type { ChatDomain, DefaultDomain } from './domain';\nexport type { Participant } from './participant';\nexport type {\n MessageAttributes,\n Message,\n SendMessageRequest,\n SendMessageResponse,\n SystemMessageRequest,\n MessageHistoryQuery,\n MessageHistoryResponse,\n} from './message';\nexport type { JoinRequest, JoinResponse } from './channel';\nexport type { SSEMessageEvent, SSEResyncEvent, SSEEvent } from './sse';\nexport type { ChatBucket, ChatManifest } from './manifest';\nexport type {\n AuthValidatorContext,\n AuthValidatorResult,\n AuthValidator,\n AuthConfig,\n} from './auth';\n\nexport type {\n PediChat,\n PediRole,\n PediVehicle,\n PediLocation,\n PediParticipantMeta,\n PediMessageType,\n PediMessageAttributes,\n} from './domains';\n\nexport { participantSchema } from './participant';\nexport { joinRequestSchema } from './channel';\nexport {\n messageAttributesSchema,\n sendMessageRequestSchema,\n systemMessageRequestSchema,\n messageHistoryQuerySchema,\n} from './message';\n","import { z } from 'zod';\nimport type { ChatDomain, DefaultDomain } from './domain';\n\nexport const participantSchema = z.object({\n id: z.string().min(1),\n role: z.string().min(1),\n name: z.string().min(1),\n profile_image: z.string().url().optional(),\n metadata: z.record(z.unknown()).optional(),\n});\n\nexport interface Participant<D extends ChatDomain = DefaultDomain> {\n id: string;\n role: D['role'];\n name: string;\n profile_image?: string;\n metadata?: D['metadata'];\n}\n","import { z } from 'zod';\nimport { participantSchema, type Participant } from './participant';\nimport type { Message } from './message';\nimport type { ChatDomain, DefaultDomain } from './domain';\n\nexport const joinRequestSchema = participantSchema;\n\nexport type JoinRequest = z.infer<typeof joinRequestSchema>;\n\nexport interface JoinResponse<D extends ChatDomain = DefaultDomain> {\n channel_id: string;\n status: 'active' | 'closed';\n participants: Participant<D>[];\n messages: Message<D>[];\n joined_at: string;\n}\n","import { z } from 'zod';\nimport type { ChatDomain, DefaultDomain } from './domain';\nimport type { Participant } from './participant';\n\nexport const messageAttributesSchema = z\n .object({})\n .catchall(z.unknown());\n\nexport type MessageAttributes<D extends ChatDomain = DefaultDomain> = D['attributes'];\n\nexport interface Message<D extends ChatDomain = DefaultDomain> {\n id: string;\n channel_id: string;\n sender_id: string | null;\n sender_role: D['role'] | 'system';\n type: D['messageType'];\n body: string;\n attributes: MessageAttributes<D>;\n created_at: string;\n}\n\nexport const sendMessageRequestSchema = z.object({\n sender_id: z.string().min(1),\n type: z.string().min(1),\n body: z.string().min(1).max(10_000),\n attributes: messageAttributesSchema.optional(),\n});\n\nexport interface SendMessageRequest<D extends ChatDomain = DefaultDomain> {\n sender_id: string;\n type: D['messageType'];\n body: string;\n attributes?: MessageAttributes<D>;\n}\n\nexport interface SendMessageResponse {\n id: string;\n created_at: string;\n}\n\nexport const systemMessageRequestSchema = z.object({\n type: z.string().min(1),\n body: z.string().min(1).max(10_000),\n attributes: messageAttributesSchema.optional(),\n});\n\nexport interface SystemMessageRequest<D extends ChatDomain = DefaultDomain> {\n type: D['messageType'];\n body: string;\n attributes?: MessageAttributes<D>;\n}\n\nexport const messageHistoryQuerySchema = z.object({\n limit: z.coerce.number().int().positive().max(200).default(50),\n before: z.string().datetime().optional(),\n after: z.string().datetime().optional(),\n});\n\nexport interface MessageHistoryQuery {\n limit?: number;\n before?: string;\n after?: string;\n}\n\nexport interface MessageHistoryResponse<D extends ChatDomain = DefaultDomain> {\n channel_id: string;\n participants: Participant<D>[];\n messages: Message<D>[];\n has_more: boolean;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAkB;AAGX,IAAM,oBAAoB,aAAE,OAAO;AAAA,EACxC,IAAI,aAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACpB,MAAM,aAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,MAAM,aAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,eAAe,aAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,EACzC,UAAU,aAAE,OAAO,aAAE,QAAQ,CAAC,EAAE,SAAS;AAC3C,CAAC;;;ACJM,IAAM,oBAAoB;;;ACLjC,IAAAA,cAAkB;AAIX,IAAM,0BAA0B,cACpC,OAAO,CAAC,CAAC,EACT,SAAS,cAAE,QAAQ,CAAC;AAehB,IAAM,2BAA2B,cAAE,OAAO;AAAA,EAC/C,WAAW,cAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EAC3B,MAAM,cAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,MAAM,cAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAM;AAAA,EAClC,YAAY,wBAAwB,SAAS;AAC/C,CAAC;AAcM,IAAM,6BAA6B,cAAE,OAAO;AAAA,EACjD,MAAM,cAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,MAAM,cAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAM;AAAA,EAClC,YAAY,wBAAwB,SAAS;AAC/C,CAAC;AAQM,IAAM,4BAA4B,cAAE,OAAO;AAAA,EAChD,OAAO,cAAE,OAAO,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,GAAG,EAAE,QAAQ,EAAE;AAAA,EAC7D,QAAQ,cAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EACvC,OAAO,cAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AACxC,CAAC;","names":["import_zod"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/participant.ts","../src/channel.ts","../src/message.ts","../src/unread.ts"],"sourcesContent":["export type { ChatDomain, DefaultDomain } from './domain';\nexport type { Participant } from './participant';\nexport type {\n MessageAttributes,\n Message,\n SendMessageRequest,\n SendMessageResponse,\n SystemMessageRequest,\n MessageHistoryQuery,\n MessageHistoryResponse,\n} from './message';\nexport type { JoinRequest, JoinResponse } from './channel';\nexport type { SSEMessageEvent, SSEResyncEvent, SSEEvent } from './sse';\nexport type { ChatBucket, ChatManifest } from './manifest';\nexport type {\n AuthValidatorContext,\n AuthValidatorResult,\n AuthValidator,\n AuthConfig,\n} from './auth';\n\nexport type {\n PediChat,\n PediRole,\n PediVehicle,\n PediLocation,\n PediParticipantMeta,\n PediMessageType,\n PediMessageAttributes,\n} from './domains';\n\nexport type {\n UnreadCountResponse,\n MarkReadRequest,\n SSEUnreadSnapshotEvent,\n SSEUnreadUpdateEvent,\n SSEUnreadClearEvent,\n SSEUnreadEvent,\n} from './unread';\n\nexport { participantSchema } from './participant';\nexport { joinRequestSchema } from './channel';\nexport {\n messageAttributesSchema,\n sendMessageRequestSchema,\n systemMessageRequestSchema,\n messageHistoryQuerySchema,\n} from './message';\nexport { markReadRequestSchema } from './unread';\n","import { z } from 'zod';\nimport type { ChatDomain, DefaultDomain } from './domain';\n\nexport const participantSchema = z.object({\n id: z.string().min(1),\n role: z.string().min(1),\n name: z.string().min(1),\n profile_image: z.string().url().optional(),\n metadata: z.record(z.unknown()).optional(),\n});\n\nexport interface Participant<D extends ChatDomain = DefaultDomain> {\n id: string;\n role: D['role'];\n name: string;\n profile_image?: string;\n metadata?: D['metadata'];\n}\n","import { z } from 'zod';\nimport { participantSchema, type Participant } from './participant';\nimport type { Message } from './message';\nimport type { ChatDomain, DefaultDomain } from './domain';\n\nexport const joinRequestSchema = participantSchema;\n\nexport type JoinRequest = z.infer<typeof joinRequestSchema>;\n\nexport interface JoinResponse<D extends ChatDomain = DefaultDomain> {\n channel_id: string;\n status: 'active' | 'closed';\n participants: Participant<D>[];\n messages: Message<D>[];\n joined_at: string;\n}\n","import { z } from 'zod';\nimport type { ChatDomain, DefaultDomain } from './domain';\nimport type { Participant } from './participant';\n\nexport const messageAttributesSchema = z\n .object({})\n .catchall(z.unknown());\n\nexport type MessageAttributes<D extends ChatDomain = DefaultDomain> = D['attributes'];\n\nexport interface Message<D extends ChatDomain = DefaultDomain> {\n id: string;\n channel_id: string;\n sender_id: string | null;\n sender_role: D['role'] | 'system';\n type: D['messageType'];\n body: string;\n attributes: MessageAttributes<D>;\n created_at: string;\n}\n\nexport const sendMessageRequestSchema = z.object({\n sender_id: z.string().min(1),\n type: z.string().min(1),\n body: z.string().min(1).max(10_000),\n attributes: messageAttributesSchema.optional(),\n});\n\nexport interface SendMessageRequest<D extends ChatDomain = DefaultDomain> {\n sender_id: string;\n type: D['messageType'];\n body: string;\n attributes?: MessageAttributes<D>;\n}\n\nexport interface SendMessageResponse {\n id: string;\n created_at: string;\n}\n\nexport const systemMessageRequestSchema = z.object({\n type: z.string().min(1),\n body: z.string().min(1).max(10_000),\n attributes: messageAttributesSchema.optional(),\n});\n\nexport interface SystemMessageRequest<D extends ChatDomain = DefaultDomain> {\n type: D['messageType'];\n body: string;\n attributes?: MessageAttributes<D>;\n}\n\nexport const messageHistoryQuerySchema = z.object({\n limit: z.coerce.number().int().positive().max(200).default(50),\n before: z.string().datetime().optional(),\n after: z.string().datetime().optional(),\n});\n\nexport interface MessageHistoryQuery {\n limit?: number;\n before?: string;\n after?: string;\n}\n\nexport interface MessageHistoryResponse<D extends ChatDomain = DefaultDomain> {\n channel_id: string;\n participants: Participant<D>[];\n messages: Message<D>[];\n has_more: boolean;\n}\n","import { z } from 'zod';\n\nexport interface UnreadCountResponse {\n channel_id: string;\n unread_count: number;\n last_message_at: string | null;\n}\n\nexport interface MarkReadRequest {\n participant_id: string;\n message_id: string;\n}\n\nexport interface SSEUnreadSnapshotEvent {\n event: 'unread_snapshot';\n data: UnreadCountResponse;\n}\n\nexport interface SSEUnreadUpdateEvent {\n event: 'unread_update';\n data: {\n channel_id: string;\n message_id: string;\n created_at: string;\n };\n}\n\nexport interface SSEUnreadClearEvent {\n event: 'unread_clear';\n data: { channel_id: string; unread_count: number };\n}\n\nexport type SSEUnreadEvent =\n | SSEUnreadSnapshotEvent\n | SSEUnreadUpdateEvent\n | SSEUnreadClearEvent;\n\nexport const markReadRequestSchema = z.object({\n participant_id: z.string().min(1),\n message_id: z.string().min(1),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAkB;AAGX,IAAM,oBAAoB,aAAE,OAAO;AAAA,EACxC,IAAI,aAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACpB,MAAM,aAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,MAAM,aAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,eAAe,aAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,EACzC,UAAU,aAAE,OAAO,aAAE,QAAQ,CAAC,EAAE,SAAS;AAC3C,CAAC;;;ACJM,IAAM,oBAAoB;;;ACLjC,IAAAA,cAAkB;AAIX,IAAM,0BAA0B,cACpC,OAAO,CAAC,CAAC,EACT,SAAS,cAAE,QAAQ,CAAC;AAehB,IAAM,2BAA2B,cAAE,OAAO;AAAA,EAC/C,WAAW,cAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EAC3B,MAAM,cAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,MAAM,cAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAM;AAAA,EAClC,YAAY,wBAAwB,SAAS;AAC/C,CAAC;AAcM,IAAM,6BAA6B,cAAE,OAAO;AAAA,EACjD,MAAM,cAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,MAAM,cAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAM;AAAA,EAClC,YAAY,wBAAwB,SAAS;AAC/C,CAAC;AAQM,IAAM,4BAA4B,cAAE,OAAO;AAAA,EAChD,OAAO,cAAE,OAAO,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,GAAG,EAAE,QAAQ,EAAE;AAAA,EAC7D,QAAQ,cAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EACvC,OAAO,cAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AACxC,CAAC;;;ACxDD,IAAAC,cAAkB;AAqCX,IAAM,wBAAwB,cAAE,OAAO;AAAA,EAC5C,gBAAgB,cAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EAChC,YAAY,cAAE,OAAO,EAAE,IAAI,CAAC;AAC9B,CAAC;","names":["import_zod","import_zod"]}
|
package/dist/index.mjs
CHANGED
|
@@ -30,8 +30,16 @@ var messageHistoryQuerySchema = z2.object({
|
|
|
30
30
|
before: z2.string().datetime().optional(),
|
|
31
31
|
after: z2.string().datetime().optional()
|
|
32
32
|
});
|
|
33
|
+
|
|
34
|
+
// src/unread.ts
|
|
35
|
+
import { z as z3 } from "zod";
|
|
36
|
+
var markReadRequestSchema = z3.object({
|
|
37
|
+
participant_id: z3.string().min(1),
|
|
38
|
+
message_id: z3.string().min(1)
|
|
39
|
+
});
|
|
33
40
|
export {
|
|
34
41
|
joinRequestSchema,
|
|
42
|
+
markReadRequestSchema,
|
|
35
43
|
messageAttributesSchema,
|
|
36
44
|
messageHistoryQuerySchema,
|
|
37
45
|
participantSchema,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/participant.ts","../src/channel.ts","../src/message.ts"],"sourcesContent":["import { z } from 'zod';\nimport type { ChatDomain, DefaultDomain } from './domain';\n\nexport const participantSchema = z.object({\n id: z.string().min(1),\n role: z.string().min(1),\n name: z.string().min(1),\n profile_image: z.string().url().optional(),\n metadata: z.record(z.unknown()).optional(),\n});\n\nexport interface Participant<D extends ChatDomain = DefaultDomain> {\n id: string;\n role: D['role'];\n name: string;\n profile_image?: string;\n metadata?: D['metadata'];\n}\n","import { z } from 'zod';\nimport { participantSchema, type Participant } from './participant';\nimport type { Message } from './message';\nimport type { ChatDomain, DefaultDomain } from './domain';\n\nexport const joinRequestSchema = participantSchema;\n\nexport type JoinRequest = z.infer<typeof joinRequestSchema>;\n\nexport interface JoinResponse<D extends ChatDomain = DefaultDomain> {\n channel_id: string;\n status: 'active' | 'closed';\n participants: Participant<D>[];\n messages: Message<D>[];\n joined_at: string;\n}\n","import { z } from 'zod';\nimport type { ChatDomain, DefaultDomain } from './domain';\nimport type { Participant } from './participant';\n\nexport const messageAttributesSchema = z\n .object({})\n .catchall(z.unknown());\n\nexport type MessageAttributes<D extends ChatDomain = DefaultDomain> = D['attributes'];\n\nexport interface Message<D extends ChatDomain = DefaultDomain> {\n id: string;\n channel_id: string;\n sender_id: string | null;\n sender_role: D['role'] | 'system';\n type: D['messageType'];\n body: string;\n attributes: MessageAttributes<D>;\n created_at: string;\n}\n\nexport const sendMessageRequestSchema = z.object({\n sender_id: z.string().min(1),\n type: z.string().min(1),\n body: z.string().min(1).max(10_000),\n attributes: messageAttributesSchema.optional(),\n});\n\nexport interface SendMessageRequest<D extends ChatDomain = DefaultDomain> {\n sender_id: string;\n type: D['messageType'];\n body: string;\n attributes?: MessageAttributes<D>;\n}\n\nexport interface SendMessageResponse {\n id: string;\n created_at: string;\n}\n\nexport const systemMessageRequestSchema = z.object({\n type: z.string().min(1),\n body: z.string().min(1).max(10_000),\n attributes: messageAttributesSchema.optional(),\n});\n\nexport interface SystemMessageRequest<D extends ChatDomain = DefaultDomain> {\n type: D['messageType'];\n body: string;\n attributes?: MessageAttributes<D>;\n}\n\nexport const messageHistoryQuerySchema = z.object({\n limit: z.coerce.number().int().positive().max(200).default(50),\n before: z.string().datetime().optional(),\n after: z.string().datetime().optional(),\n});\n\nexport interface MessageHistoryQuery {\n limit?: number;\n before?: string;\n after?: string;\n}\n\nexport interface MessageHistoryResponse<D extends ChatDomain = DefaultDomain> {\n channel_id: string;\n participants: Participant<D>[];\n messages: Message<D>[];\n has_more: boolean;\n}\n"],"mappings":";AAAA,SAAS,SAAS;AAGX,IAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACpB,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,EACzC,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,SAAS;AAC3C,CAAC;;;ACJM,IAAM,oBAAoB;;;ACLjC,SAAS,KAAAA,UAAS;AAIX,IAAM,0BAA0BA,GACpC,OAAO,CAAC,CAAC,EACT,SAASA,GAAE,QAAQ,CAAC;AAehB,IAAM,2BAA2BA,GAAE,OAAO;AAAA,EAC/C,WAAWA,GAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EAC3B,MAAMA,GAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,MAAMA,GAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAM;AAAA,EAClC,YAAY,wBAAwB,SAAS;AAC/C,CAAC;AAcM,IAAM,6BAA6BA,GAAE,OAAO;AAAA,EACjD,MAAMA,GAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,MAAMA,GAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAM;AAAA,EAClC,YAAY,wBAAwB,SAAS;AAC/C,CAAC;AAQM,IAAM,4BAA4BA,GAAE,OAAO;AAAA,EAChD,OAAOA,GAAE,OAAO,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,GAAG,EAAE,QAAQ,EAAE;AAAA,EAC7D,QAAQA,GAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EACvC,OAAOA,GAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AACxC,CAAC;","names":["z"]}
|
|
1
|
+
{"version":3,"sources":["../src/participant.ts","../src/channel.ts","../src/message.ts","../src/unread.ts"],"sourcesContent":["import { z } from 'zod';\nimport type { ChatDomain, DefaultDomain } from './domain';\n\nexport const participantSchema = z.object({\n id: z.string().min(1),\n role: z.string().min(1),\n name: z.string().min(1),\n profile_image: z.string().url().optional(),\n metadata: z.record(z.unknown()).optional(),\n});\n\nexport interface Participant<D extends ChatDomain = DefaultDomain> {\n id: string;\n role: D['role'];\n name: string;\n profile_image?: string;\n metadata?: D['metadata'];\n}\n","import { z } from 'zod';\nimport { participantSchema, type Participant } from './participant';\nimport type { Message } from './message';\nimport type { ChatDomain, DefaultDomain } from './domain';\n\nexport const joinRequestSchema = participantSchema;\n\nexport type JoinRequest = z.infer<typeof joinRequestSchema>;\n\nexport interface JoinResponse<D extends ChatDomain = DefaultDomain> {\n channel_id: string;\n status: 'active' | 'closed';\n participants: Participant<D>[];\n messages: Message<D>[];\n joined_at: string;\n}\n","import { z } from 'zod';\nimport type { ChatDomain, DefaultDomain } from './domain';\nimport type { Participant } from './participant';\n\nexport const messageAttributesSchema = z\n .object({})\n .catchall(z.unknown());\n\nexport type MessageAttributes<D extends ChatDomain = DefaultDomain> = D['attributes'];\n\nexport interface Message<D extends ChatDomain = DefaultDomain> {\n id: string;\n channel_id: string;\n sender_id: string | null;\n sender_role: D['role'] | 'system';\n type: D['messageType'];\n body: string;\n attributes: MessageAttributes<D>;\n created_at: string;\n}\n\nexport const sendMessageRequestSchema = z.object({\n sender_id: z.string().min(1),\n type: z.string().min(1),\n body: z.string().min(1).max(10_000),\n attributes: messageAttributesSchema.optional(),\n});\n\nexport interface SendMessageRequest<D extends ChatDomain = DefaultDomain> {\n sender_id: string;\n type: D['messageType'];\n body: string;\n attributes?: MessageAttributes<D>;\n}\n\nexport interface SendMessageResponse {\n id: string;\n created_at: string;\n}\n\nexport const systemMessageRequestSchema = z.object({\n type: z.string().min(1),\n body: z.string().min(1).max(10_000),\n attributes: messageAttributesSchema.optional(),\n});\n\nexport interface SystemMessageRequest<D extends ChatDomain = DefaultDomain> {\n type: D['messageType'];\n body: string;\n attributes?: MessageAttributes<D>;\n}\n\nexport const messageHistoryQuerySchema = z.object({\n limit: z.coerce.number().int().positive().max(200).default(50),\n before: z.string().datetime().optional(),\n after: z.string().datetime().optional(),\n});\n\nexport interface MessageHistoryQuery {\n limit?: number;\n before?: string;\n after?: string;\n}\n\nexport interface MessageHistoryResponse<D extends ChatDomain = DefaultDomain> {\n channel_id: string;\n participants: Participant<D>[];\n messages: Message<D>[];\n has_more: boolean;\n}\n","import { z } from 'zod';\n\nexport interface UnreadCountResponse {\n channel_id: string;\n unread_count: number;\n last_message_at: string | null;\n}\n\nexport interface MarkReadRequest {\n participant_id: string;\n message_id: string;\n}\n\nexport interface SSEUnreadSnapshotEvent {\n event: 'unread_snapshot';\n data: UnreadCountResponse;\n}\n\nexport interface SSEUnreadUpdateEvent {\n event: 'unread_update';\n data: {\n channel_id: string;\n message_id: string;\n created_at: string;\n };\n}\n\nexport interface SSEUnreadClearEvent {\n event: 'unread_clear';\n data: { channel_id: string; unread_count: number };\n}\n\nexport type SSEUnreadEvent =\n | SSEUnreadSnapshotEvent\n | SSEUnreadUpdateEvent\n | SSEUnreadClearEvent;\n\nexport const markReadRequestSchema = z.object({\n participant_id: z.string().min(1),\n message_id: z.string().min(1),\n});\n"],"mappings":";AAAA,SAAS,SAAS;AAGX,IAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACpB,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,EACzC,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,SAAS;AAC3C,CAAC;;;ACJM,IAAM,oBAAoB;;;ACLjC,SAAS,KAAAA,UAAS;AAIX,IAAM,0BAA0BA,GACpC,OAAO,CAAC,CAAC,EACT,SAASA,GAAE,QAAQ,CAAC;AAehB,IAAM,2BAA2BA,GAAE,OAAO;AAAA,EAC/C,WAAWA,GAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EAC3B,MAAMA,GAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,MAAMA,GAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAM;AAAA,EAClC,YAAY,wBAAwB,SAAS;AAC/C,CAAC;AAcM,IAAM,6BAA6BA,GAAE,OAAO;AAAA,EACjD,MAAMA,GAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,MAAMA,GAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAM;AAAA,EAClC,YAAY,wBAAwB,SAAS;AAC/C,CAAC;AAQM,IAAM,4BAA4BA,GAAE,OAAO;AAAA,EAChD,OAAOA,GAAE,OAAO,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,GAAG,EAAE,QAAQ,EAAE;AAAA,EAC7D,QAAQA,GAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EACvC,OAAOA,GAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AACxC,CAAC;;;ACxDD,SAAS,KAAAC,UAAS;AAqCX,IAAM,wBAAwBA,GAAE,OAAO;AAAA,EAC5C,gBAAgBA,GAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EAChC,YAAYA,GAAE,OAAO,EAAE,IAAI,CAAC;AAC9B,CAAC;","names":["z","z"]}
|
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pedi/chika-types",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Shared TypeScript types and Zod schemas for Pedi Chika chat service",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/Pedi-Solutions-Inc/chika",
|
|
9
|
+
"directory": "packages/types"
|
|
10
|
+
},
|
|
6
11
|
"main": "./dist/index.js",
|
|
7
12
|
"module": "./dist/index.mjs",
|
|
8
13
|
"types": "./dist/index.d.ts",
|