@ourofoundation/ouro-js 1.0.0

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.
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConversationSchema = exports.CreateConversationSchema = exports.UpdateConversationSchema = exports.MessageSchema = void 0;
4
+ const uuidv7_1 = require("uuidv7");
5
+ const zod_1 = require("zod");
6
+ const _1 = require(".");
7
+ const assets_1 = require("./assets");
8
+ const posts_1 = require("./posts");
9
+ const ConversationSchema = assets_1.AssetSchema.extend({
10
+ metadata: zod_1.z.object({
11
+ members: zod_1.z.array(zod_1.z.string()),
12
+ }),
13
+ asset_type: _1.AssetTypeSchema.default("conversation"),
14
+ });
15
+ exports.ConversationSchema = ConversationSchema;
16
+ const CreateConversationSchema = ConversationSchema.omit({
17
+ org_id: true,
18
+ team_id: true,
19
+ user_id: true,
20
+ created_at: true,
21
+ last_updated: true,
22
+ }).extend({
23
+ id: zod_1.z
24
+ .string()
25
+ .uuid()
26
+ .default(() => (0, uuidv7_1.uuidv7)()),
27
+ org_id: zod_1.z.string().uuid().default("00000000-0000-0000-0000-000000000000"),
28
+ team_id: zod_1.z.string().uuid().default("00000000-0000-0000-0000-000000000000"),
29
+ monetization: _1.MonetizationSchema.default("none"),
30
+ visibility: _1.VisibilitySchema.default("private"),
31
+ });
32
+ exports.CreateConversationSchema = CreateConversationSchema;
33
+ // Partial because we can make updates to conversations without providing all fields
34
+ const UpdateConversationSchema = CreateConversationSchema.omit({
35
+ id: true,
36
+ org_id: true,
37
+ team_id: true,
38
+ team: true,
39
+ user: true,
40
+ }).partial();
41
+ exports.UpdateConversationSchema = UpdateConversationSchema;
42
+ const MessageSchema = zod_1.z.object({
43
+ id: zod_1.z.string().uuid(),
44
+ conversation_id: zod_1.z.string().uuid(),
45
+ user_id: zod_1.z.string().uuid(),
46
+ created_at: zod_1.z.string().datetime(),
47
+ last_updated: zod_1.z.string().datetime(),
48
+ viewers: zod_1.z.array(zod_1.z.string().uuid()),
49
+ json: posts_1.TipTapSchema,
50
+ text: zod_1.z.string(),
51
+ metadata: zod_1.z.object({}).passthrough().nullable().optional(),
52
+ });
53
+ exports.MessageSchema = MessageSchema;