@arken/seer-protocol 0.1.1 → 0.1.3

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.
Files changed (118) hide show
  1. package/.rush/temp/shrinkwrap-deps.json +778 -53
  2. package/area/area.models.ts +15 -0
  3. package/area/area.router.ts +74 -0
  4. package/area/area.schema.ts +22 -0
  5. package/area/area.types.ts +25 -0
  6. package/area/index.ts +4 -0
  7. package/asset/asset.models.ts +59 -0
  8. package/asset/asset.router.ts +55 -0
  9. package/asset/asset.schema.ts +30 -0
  10. package/asset/asset.types.ts +21 -0
  11. package/asset/index.ts +4 -0
  12. package/chain/chain.models.ts +50 -0
  13. package/chain/chain.router.ts +104 -0
  14. package/chain/chain.schema.ts +67 -0
  15. package/chain/chain.types.ts +23 -0
  16. package/chain/index.ts +4 -0
  17. package/character/character.models.ts +174 -0
  18. package/character/character.router.ts +314 -0
  19. package/character/character.schema.ts +150 -0
  20. package/character/character.types.ts +63 -0
  21. package/character/index.ts +4 -0
  22. package/chat/chat.models.ts +43 -0
  23. package/chat/chat.router.ts +67 -0
  24. package/chat/chat.schema.ts +39 -0
  25. package/chat/chat.types.ts +19 -0
  26. package/chat/index.ts +4 -0
  27. package/collection/collection.models.ts +76 -0
  28. package/collection/collection.router.ts +91 -0
  29. package/collection/collection.schema.ts +90 -0
  30. package/collection/collection.types.ts +35 -0
  31. package/collection/index.ts +4 -0
  32. package/core/core.models.ts +1380 -0
  33. package/core/core.router.ts +1781 -0
  34. package/core/core.schema.ts +940 -0
  35. package/core/core.types.ts +339 -0
  36. package/core/index.ts +4 -0
  37. package/evolution/evolution.models.ts +1 -1
  38. package/evolution/evolution.router.ts +19 -19
  39. package/evolution/evolution.schema.ts +1 -1
  40. package/evolution/evolution.types.ts +2 -3
  41. package/evolution/index.ts +0 -1
  42. package/game/game.models.ts +53 -0
  43. package/game/game.router.ts +110 -0
  44. package/game/game.schema.ts +23 -0
  45. package/game/game.types.ts +27 -0
  46. package/game/index.ts +4 -0
  47. package/index.ts +43 -6
  48. package/infinite/index.ts +0 -1
  49. package/infinite/infinite.models.ts +1 -1
  50. package/infinite/infinite.router.ts +9 -9
  51. package/infinite/infinite.schema.ts +1 -1
  52. package/infinite/infinite.types.ts +2 -3
  53. package/interface/index.ts +4 -0
  54. package/interface/interface.canonicalize.ts +279 -0
  55. package/interface/interface.models.ts +40 -0
  56. package/interface/interface.router.ts +175 -0
  57. package/interface/interface.schema.ts +59 -0
  58. package/interface/interface.types.ts +24 -0
  59. package/isles/index.ts +0 -1
  60. package/isles/isles.models.ts +1 -1
  61. package/isles/isles.router.ts +9 -9
  62. package/isles/isles.schema.ts +1 -1
  63. package/isles/isles.types.ts +2 -3
  64. package/item/index.ts +4 -0
  65. package/item/item.models.ts +124 -0
  66. package/item/item.router.ts +103 -0
  67. package/item/item.schema.ts +150 -0
  68. package/item/item.types.ts +73 -0
  69. package/job/index.ts +4 -0
  70. package/job/job.models.ts +14 -0
  71. package/job/job.router.ts +44 -0
  72. package/job/job.schema.ts +9 -0
  73. package/job/job.types.ts +22 -0
  74. package/market/index.ts +4 -0
  75. package/market/market.models.ts +113 -0
  76. package/market/market.router.ts +73 -0
  77. package/market/market.schema.ts +149 -0
  78. package/market/market.types.ts +55 -0
  79. package/oasis/index.ts +0 -1
  80. package/oasis/oasis.models.ts +1 -1
  81. package/oasis/oasis.router.ts +5 -6
  82. package/oasis/oasis.schema.ts +1 -1
  83. package/oasis/oasis.types.ts +2 -3
  84. package/package.json +17 -4
  85. package/product/index.ts +4 -0
  86. package/product/product.models.ts +166 -0
  87. package/product/product.router.ts +93 -0
  88. package/product/product.schema.ts +186 -0
  89. package/product/product.types.ts +32 -0
  90. package/profile/index.ts +4 -0
  91. package/profile/profile.models.ts +214 -0
  92. package/profile/profile.router.ts +72 -0
  93. package/profile/profile.schema.ts +219 -0
  94. package/profile/profile.types.ts +21 -0
  95. package/raffle/index.ts +4 -0
  96. package/raffle/raffle.models.ts +44 -0
  97. package/raffle/raffle.router.ts +90 -0
  98. package/raffle/raffle.schema.ts +32 -0
  99. package/raffle/raffle.types.ts +29 -0
  100. package/router.ts +23 -29
  101. package/schema.ts +321 -0
  102. package/skill/index.ts +4 -0
  103. package/skill/skill.models.ts +16 -0
  104. package/skill/skill.router.ts +201 -0
  105. package/skill/skill.schema.ts +52 -0
  106. package/skill/skill.types.ts +32 -0
  107. package/trek/index.ts +0 -1
  108. package/trek/trek.models.ts +1 -1
  109. package/trek/trek.router.ts +2 -2
  110. package/trek/trek.schema.ts +1 -1
  111. package/trek/trek.types.ts +1 -1
  112. package/tsconfig.json +25 -17
  113. package/types.ts +174 -26
  114. package/video/index.ts +4 -0
  115. package/video/video.models.ts +25 -0
  116. package/video/video.router.ts +143 -0
  117. package/video/video.schema.ts +46 -0
  118. package/video/video.types.ts +32 -0
@@ -0,0 +1,940 @@
1
+ // node/modules/core/core.schema.ts
2
+
3
+ import { z, ObjectId, Entity } from '../schema';
4
+ import { Profile } from '../profile/profile.schema';
5
+ import { ProfileDocument } from '../profile/profile.types';
6
+
7
+ export const MerkleTree = Entity.merge(
8
+ z.object({
9
+ name: z
10
+ .string()
11
+ .min(1)
12
+ .max(200)
13
+ .trim()
14
+ .default('global'),
15
+ root: z.string(),
16
+ depth: z.number().default(16), // log2(#leaves)
17
+ })
18
+ );
19
+
20
+ export const MerkleNode = Entity.merge(
21
+ z.object({
22
+ treeId: ObjectId,
23
+ level: z.number(), // 0 = leaves, up to max depth
24
+ index: z.number(), // position within that level
25
+ hash: z.string(), // Poseidon hash
26
+ })
27
+ );
28
+
29
+ // Account Schema
30
+ export const Account = Entity.merge(
31
+ z.object({
32
+ username: z.string().min(1),
33
+ email: z.string().optional(),
34
+ address: z.string().optional(),
35
+ addressIndex: z.number().optional(),
36
+ telegramUserId: z.number().optional(),
37
+ activeProfileId: ObjectId.optional(),
38
+ sessionUserId: z.string().optional(),
39
+ })
40
+ );
41
+
42
+ // Achievement Schema
43
+ export const Achievement = Entity.merge(z.object({}));
44
+
45
+ // Act Schema
46
+ export const Act = Entity.merge(z.object({}));
47
+
48
+ // Agent Schema
49
+ export const Agent = Entity.merge(z.object({}));
50
+
51
+ // Application Schema
52
+ export const Application = Entity.merge(
53
+ z.object({
54
+ ownerId: ObjectId.optional(),
55
+ metaverseId: ObjectId.optional(),
56
+ name: z.string().min(1),
57
+ description: z.string().optional(),
58
+ })
59
+ );
60
+
61
+ // Badge Schema
62
+ export const Badge = Entity.merge(z.object({}));
63
+
64
+ // BattlePass Schema
65
+ export const BattlePass = Entity.merge(z.object({}));
66
+
67
+ // Biome Schema
68
+ export const Biome = Entity.merge(z.object({}));
69
+
70
+ // BiomeFeature Schema
71
+ export const BiomeFeature = Entity.merge(z.object({}));
72
+
73
+ // Bounty Schema
74
+ export const Bounty = Entity.merge(z.object({}));
75
+
76
+ // Counter Schema
77
+ export const Counter = Entity.merge(z.object({ seq: z.number().default(0) }));
78
+
79
+ // Collection Schema
80
+ export const Collection = Entity.merge(z.object({}));
81
+
82
+ // Comment Schema
83
+ export const Comment = Entity.merge(
84
+ z.object({
85
+ body: z.string().min(1),
86
+ entity: ObjectId,
87
+ entityModel: z.string(), // Changed from enum to string
88
+ text: z.string(),
89
+ ratingId: ObjectId.optional(),
90
+ })
91
+ );
92
+
93
+ // Community Schema
94
+ export const Community = Entity.merge(
95
+ z.object({
96
+ ideas: z.array(ObjectId).optional(),
97
+ products: z.array(ObjectId).optional(),
98
+ projects: z.array(ObjectId).optional(),
99
+ })
100
+ );
101
+
102
+ // Company Schema
103
+ export const Company = Entity.merge(
104
+ z.object({
105
+ content: z.string().optional(),
106
+ people: z.array(ObjectId).optional(),
107
+ })
108
+ );
109
+
110
+ // Conversation Schema
111
+ export const Conversation = Entity.merge(
112
+ z.object({
113
+ // back-compat
114
+ profileId: ObjectId.optional(),
115
+ messages: z.array(ObjectId).optional(),
116
+
117
+ kind: z.enum(['mail', 'dm', 'group', 'support', 'system']).default('mail'),
118
+
119
+ participants: z
120
+ .array(
121
+ z.object({
122
+ profileId: ObjectId,
123
+ role: z.enum(['user', 'system', 'gm', 'npc']).default('user'),
124
+ lastReadAt: z.coerce.date().default(new Date(0)),
125
+ unreadCount: z
126
+ .number()
127
+ .int()
128
+ .min(0)
129
+ .default(0),
130
+ isMuted: z.boolean().default(false),
131
+ isPinned: z.boolean().default(false),
132
+ isArchived: z.boolean().default(false),
133
+ isDeleted: z.boolean().default(false),
134
+ })
135
+ )
136
+ .default([]),
137
+
138
+ isLocked: z.boolean().default(true),
139
+ allowUserSend: z.boolean().default(false),
140
+
141
+ title: z.string().optional(),
142
+ category: z.string().default('system'),
143
+ importance: z
144
+ .number()
145
+ .int()
146
+ .min(0)
147
+ .max(2)
148
+ .default(0),
149
+
150
+ // ✅ use lastMessageDate consistently everywhere
151
+ lastMessageDate: z.coerce
152
+ .date()
153
+ .nullable()
154
+ .optional(),
155
+ lastMessagePreview: z.string().default(''),
156
+ messageCount: z
157
+ .number()
158
+ .int()
159
+ .min(0)
160
+ .default(0),
161
+ })
162
+ );
163
+
164
+ // ConversationMessage Schema
165
+ export const ConversationMessage = Entity.merge(
166
+ z.object({
167
+ conversationId: ObjectId,
168
+
169
+ role: z.enum(['user', 'assistant', 'system']),
170
+
171
+ type: z.enum(['text', 'notice', 'reward', 'action', 'system']).default('text'),
172
+
173
+ content: z.string().default(''),
174
+
175
+ payload: z.any().optional(),
176
+
177
+ replyToId: ObjectId.optional(),
178
+
179
+ isStarred: z.boolean().default(false),
180
+
181
+ claim: z
182
+ .object({
183
+ isClaimable: z.boolean().default(false),
184
+
185
+ // ✅ align with Mongo: claimedDate (not claimedAt)
186
+ claimedDate: z.coerce
187
+ .date()
188
+ .nullable()
189
+ .optional(),
190
+ claimedByProfileId: ObjectId.nullable().optional(),
191
+
192
+ dedupeKey: z
193
+ .string()
194
+ .nullable()
195
+ .optional(),
196
+ attachments: z.array(z.any()).default([]),
197
+
198
+ revokedDate: z.coerce
199
+ .date()
200
+ .nullable()
201
+ .optional(),
202
+ revokeReason: z
203
+ .string()
204
+ .nullable()
205
+ .optional(),
206
+ })
207
+ .default({ isClaimable: false, attachments: [] }),
208
+ })
209
+ );
210
+
211
+ // Data Schema
212
+ export const Data = Entity.merge(
213
+ z.object({
214
+ mod: z.string(),
215
+ })
216
+ );
217
+
218
+ // Meta Schema
219
+ export const Meta = Entity.merge(z.object({}));
220
+
221
+ // Discussion Schema
222
+ export const Discussion = Entity.merge(
223
+ z.object({
224
+ content: z.string().optional(),
225
+ parentId: ObjectId.optional(),
226
+ rootMessageId: ObjectId.optional(),
227
+ type: z.string().default('Discussion'),
228
+ })
229
+ );
230
+
231
+ // Energy Schema
232
+ export const Energy = Entity.merge(z.object({}));
233
+
234
+ // Event Schema
235
+ export const Event = Entity.merge(z.object({}));
236
+
237
+ // File Schema
238
+ export const File = Entity.merge(
239
+ z.object({
240
+ content: z.string().optional(),
241
+ storageType: z
242
+ .string()
243
+ .max(100)
244
+ .optional(),
245
+ accessType: z
246
+ .string()
247
+ .max(100)
248
+ .optional(),
249
+ })
250
+ );
251
+
252
+ // Galaxy Schema
253
+ export const Galaxy = Entity.merge(
254
+ z.object({
255
+ universeId: ObjectId.optional(),
256
+ })
257
+ );
258
+
259
+ // Guide Schema
260
+ export const Guide = Entity.merge(
261
+ z.object({
262
+ content: z.string().optional(),
263
+ gameId: ObjectId.optional(),
264
+ attachments: z.array(z.unknown()).optional(),
265
+ })
266
+ );
267
+
268
+ // Idea Schema
269
+ export const Idea = Entity.merge(
270
+ z.object({
271
+ type: z
272
+ .string()
273
+ .max(100)
274
+ .optional(),
275
+ communityId: ObjectId.optional(),
276
+ })
277
+ );
278
+
279
+ // Leaderboard Schema
280
+ export const Leaderboard = Entity.merge(
281
+ z.object({
282
+ productId: ObjectId.optional(),
283
+ })
284
+ );
285
+
286
+ // Log Schema
287
+ export const Log = Entity.merge(
288
+ z.object({
289
+ mod: z.string(),
290
+ messages: z.array(z.unknown()).optional(),
291
+ tags: z.array(z.unknown()).optional(),
292
+ })
293
+ );
294
+
295
+ // Lore Schema
296
+ export const Lore = Entity.merge(
297
+ z.object({
298
+ gameId: ObjectId.optional(),
299
+ })
300
+ );
301
+
302
+ // Market Schema
303
+ export const Market = Entity.merge(z.object({}));
304
+
305
+ // Memory Schema
306
+ export const Memory = Entity.merge(z.object({}));
307
+
308
+ // Message Schema
309
+ export const Message = Entity.merge(
310
+ z.object({
311
+ conversationId: ObjectId.optional(),
312
+ content: z.string().optional(),
313
+ type: z
314
+ .string()
315
+ .max(100)
316
+ .optional(),
317
+ replyToId: ObjectId.optional(),
318
+ parentId: ObjectId.optional(),
319
+ parent: ObjectId.optional(),
320
+ messageIds: z.array(ObjectId).optional(),
321
+ // messages: z.array(ObjectId).optional(),
322
+ })
323
+ );
324
+
325
+ // Metaverse Schema
326
+ export const Metaverse = Entity.merge(
327
+ z.object({
328
+ omniverseId: ObjectId,
329
+ ratingId: ObjectId.optional(),
330
+ })
331
+ );
332
+
333
+ // NewsArticle Schema
334
+ export const NewsArticle = Entity.merge(
335
+ z.object({
336
+ href: z.string(),
337
+ source: z.string(),
338
+ })
339
+ );
340
+
341
+ // Npc Schema
342
+ export const Npc = Entity.merge(
343
+ z.object({
344
+ characterRaceId: ObjectId.optional(),
345
+ characterId: ObjectId.optional(),
346
+ })
347
+ );
348
+
349
+ // Offer Schema
350
+ export const Offer = Entity.merge(z.object({}));
351
+
352
+ // Omniverse Schema
353
+ export const Omniverse = Entity.merge(
354
+ z.object({
355
+ ratingId: ObjectId.optional(),
356
+ })
357
+ );
358
+
359
+ // Order Schema
360
+ export const Order = Entity.merge(z.object({}));
361
+
362
+ // Payment Schema
363
+ export const Payment = Entity.merge(
364
+ z.object({
365
+ owner: Profile.optional(),
366
+ status: z
367
+ .enum([
368
+ 'Archived',
369
+ 'Processing',
370
+ 'Failed',
371
+ 'Submitted',
372
+ 'Denied',
373
+ 'Processed',
374
+ 'Voided',
375
+ 'Completed',
376
+ 'Refunding',
377
+ 'Refunded',
378
+ 'Expired',
379
+ ])
380
+ .default('Submitted'),
381
+ })
382
+ );
383
+
384
+ // Permission Schema
385
+ export const Permission = Entity.merge(
386
+ z.object({
387
+ roles: z.array(ObjectId).optional(),
388
+ })
389
+ );
390
+
391
+ // Person Schema
392
+ export const Person = Entity.merge(
393
+ z.object({
394
+ content: z.string().optional(),
395
+ companyId: ObjectId.optional(),
396
+ })
397
+ );
398
+
399
+ // Planet Schema
400
+ export const Planet = Entity.merge(
401
+ z.object({
402
+ solarSystemId: ObjectId.optional(),
403
+ })
404
+ );
405
+
406
+ // Poll Schema
407
+ export const Poll = Entity.merge(z.object({}));
408
+
409
+ // Project Schema
410
+ export const Project = Entity.merge(
411
+ z.object({
412
+ content: z.string().optional(),
413
+ contractStatus: z
414
+ .string()
415
+ .default('Pending')
416
+ .optional(),
417
+ parentId: ObjectId.optional(),
418
+ realmId: ObjectId.optional(),
419
+ communityId: ObjectId.optional(),
420
+ productId: ObjectId.optional(),
421
+ ratingId: ObjectId.optional(),
422
+ })
423
+ );
424
+
425
+ // Proposal Schema
426
+ export const Proposal = Entity.merge(
427
+ z.object({
428
+ content: z.string().optional(),
429
+ })
430
+ );
431
+
432
+ // Quest Schema
433
+ export const Quest = Entity.merge(
434
+ z.object({
435
+ type: z.string().default('zone'),
436
+ })
437
+ );
438
+
439
+ // Question Schema
440
+ export const Question = Entity.merge(
441
+ z.object({
442
+ topics: z.array(z.unknown()).optional(),
443
+ text: z.string(),
444
+ answer: z.string(),
445
+ popularity: z.number().optional(),
446
+ })
447
+ );
448
+
449
+ // Rating Schema
450
+ export const Rating = Entity.merge(
451
+ z.object({
452
+ votes: z.array(ObjectId).optional(),
453
+ projects: z.array(ObjectId).optional(),
454
+ comments: z.array(ObjectId).optional(),
455
+ })
456
+ );
457
+
458
+ // Referral Schema
459
+ export const Referral = Entity.merge(
460
+ z.object({
461
+ recipientId: ObjectId.optional(),
462
+ senderId: ObjectId.optional(),
463
+ })
464
+ );
465
+
466
+ // Revision Schema
467
+ export const Revision = Entity.merge(
468
+ z.object({
469
+ objectType: z.string().max(100),
470
+ objectId: z.string().min(1),
471
+ actionType: z.string().max(100),
472
+ reason: z.string().max(100),
473
+ interfaces: z.array(ObjectId).optional(),
474
+ profiles: z.array(ObjectId).optional(),
475
+ })
476
+ );
477
+
478
+ // Review Schema
479
+ export const Review = Entity.merge(
480
+ z.object({
481
+ value: z.string().optional(),
482
+ })
483
+ );
484
+
485
+ // Role Schema
486
+ export const Role = Entity.merge(
487
+ z.object({
488
+ value: z.string().optional(),
489
+ profiles: z.array(ObjectId).optional(),
490
+ permissions: z.array(ObjectId).optional(),
491
+ })
492
+ );
493
+
494
+ // Season Schema
495
+ export const Season = Entity.merge(z.object({}));
496
+
497
+ // RealmShard Schema
498
+ export const RealmShard = Entity.merge(
499
+ z.object({
500
+ endpoint: z.string().max(100),
501
+ realmId: ObjectId.optional(),
502
+ status: z
503
+ .string()
504
+ .default('Offline')
505
+ .optional(),
506
+ clientCount: z.number(),
507
+ })
508
+ );
509
+
510
+ // RealmTrait Schema
511
+ export const RealmTrait = Entity.merge(
512
+ z.object({
513
+ description: z.string().optional(),
514
+ })
515
+ );
516
+
517
+ // RealmEvent Schema
518
+ export const RealmEvent = Entity.merge(
519
+ z.object({
520
+ description: z.string().optional(),
521
+ startDate: z.date().optional(),
522
+ endDate: z.date().optional(),
523
+ })
524
+ );
525
+
526
+ // Realm Schema
527
+ export const Realm = Entity.merge(
528
+ z.object({
529
+ endpoint: z
530
+ .string()
531
+ .max(100)
532
+ .optional(),
533
+ realmShards: z.array(RealmShard).optional(),
534
+ realmEvents: z.array(RealmEvent).optional(),
535
+ realmTraits: z.array(RealmTrait).optional(),
536
+ gameId: ObjectId,
537
+ status: z
538
+ .string()
539
+ .default('Offline')
540
+ .optional(),
541
+ clientCount: z.number(),
542
+ regionCode: z.string(),
543
+ })
544
+ );
545
+
546
+ // Session Schema
547
+ export const Session = Entity.merge(
548
+ z.object({
549
+ expired: z.date(),
550
+ })
551
+ );
552
+
553
+ // SolarSystem Schema
554
+ export const SolarSystem = Entity.merge(
555
+ z.object({
556
+ galaxyId: ObjectId.optional(),
557
+ })
558
+ );
559
+
560
+ // Star Schema
561
+ export const Star = Entity.merge(z.object({}));
562
+
563
+ // Stash Schema
564
+ export const Stash = Entity.merge(z.object({}));
565
+
566
+ // Stock Schema
567
+ export const Stock = Entity.merge(
568
+ z.object({
569
+ rank: z
570
+ .number()
571
+ .min(0)
572
+ .optional(),
573
+ price: z
574
+ .number()
575
+ .min(0)
576
+ .optional(),
577
+ hourChange: z.number().optional(),
578
+ dayChange: z.number().optional(),
579
+ weekChange: z.number().optional(),
580
+ marketCap: z
581
+ .number()
582
+ .min(0)
583
+ .optional(),
584
+ volume: z
585
+ .number()
586
+ .min(0)
587
+ .optional(),
588
+ ticker: z.string(),
589
+ unusualActivity: z
590
+ .number()
591
+ .min(0)
592
+ .optional(),
593
+ })
594
+ );
595
+
596
+ // Suggestion Schema
597
+ export const Suggestion = Entity.merge(
598
+ z.object({
599
+ content: z.string().optional(),
600
+ })
601
+ );
602
+
603
+ // Tag Schema
604
+ export const Tag = Entity.merge(
605
+ z.object({
606
+ value: z.string().optional(),
607
+ })
608
+ );
609
+
610
+ // Team Schema
611
+ export const Team = Entity.merge(
612
+ z.object({
613
+ ratingId: ObjectId.optional(),
614
+ profiles: z.array(Profile).optional(), // TODO: convert to 'members'
615
+ limit: z
616
+ .number()
617
+ .optional()
618
+ .default(50),
619
+ points: z
620
+ .number()
621
+ .optional()
622
+ .default(0),
623
+ memberCount: z
624
+ .number()
625
+ .optional()
626
+ .default(0),
627
+ })
628
+ );
629
+
630
+ // Party Schema
631
+ export const Party = Entity.merge(
632
+ z.object({
633
+ targetAreaId: ObjectId.optional(),
634
+ limit: z.number().default(6),
635
+ isPublic: z.boolean().default(true),
636
+ isVisibleToEnemies: z.boolean().default(true),
637
+ isAlliesOnly: z.boolean().default(false),
638
+ isApprovalRequired: z.boolean().default(false),
639
+ isNonLeaderInviteAllowed: z.boolean().default(false),
640
+ isCombatEnabled: z.boolean().default(true),
641
+ isDisbandEnabled: z.boolean().default(false),
642
+ isFriendlyFireEnabled: z.boolean().default(true),
643
+ isLocalQuestShared: z.boolean().default(true),
644
+ isGlobalQuestShared: z.boolean().default(true),
645
+ isMergeEnabled: z.boolean().default(false),
646
+ isRejoinEnabled: z.boolean().default(false),
647
+ itemDistribution: z.enum(['Random', 'Personal']),
648
+ leaderId: ObjectId.optional(),
649
+ powerRequired: z.number().default(1),
650
+ levelRequired: z.number().default(1),
651
+ approvalMethod: z.enum(['Auto Accept', 'Approval Required']),
652
+ memberIds: z.array(ObjectId).optional(),
653
+ assistantIds: z.array(ObjectId).optional(), // have control over party even if not in party
654
+ pendingMemberIds: z.array(ObjectId).optional(),
655
+ blockedMemberIds: z.array(ObjectId).optional(),
656
+ members: z
657
+ .array(Profile)
658
+ .optional()
659
+ .default([]),
660
+ })
661
+ );
662
+
663
+ // Tournament Schema
664
+ export const Tournament = Entity.merge(z.object({}));
665
+
666
+ // Trade Schema
667
+ export const Trade = Entity.merge(
668
+ z.object({
669
+ status: z.enum(['Paused', 'Pending', 'Active', 'Delisted', 'Sold']).default('Active'), // Default set in StatusEnum matches Mongoose
670
+ chainId: ObjectId.optional(),
671
+ buyerId: ObjectId.optional(),
672
+ parentId: ObjectId.optional(),
673
+ productId: ObjectId.optional(),
674
+ sellerId: ObjectId.optional(),
675
+ itemId: ObjectId.optional(),
676
+ tokenId: ObjectId.optional(),
677
+ })
678
+ );
679
+
680
+ // Universe Schema
681
+ export const Universe = Entity.merge(z.object({}));
682
+
683
+ // Validator Schema
684
+ export const Validator = Entity.merge(z.object({}));
685
+
686
+ // Vote Schema
687
+ export const Vote = Entity.merge(
688
+ z.object({
689
+ ratingId: ObjectId.optional(),
690
+ })
691
+ );
692
+
693
+ // WorldEvent Schema
694
+ export const WorldEvent = Entity.merge(
695
+ z.object({
696
+ text: z.string().min(1),
697
+ importance: z.number().optional(),
698
+ tags: z.array(z.unknown()).optional(),
699
+ })
700
+ );
701
+
702
+ // WorldRecord Schema
703
+ export const WorldRecord = Entity.merge(
704
+ z.object({
705
+ gameId: ObjectId.optional(),
706
+ holderId: ObjectId,
707
+ score: z.number().default(0),
708
+ })
709
+ );
710
+
711
+ // Stat Schema
712
+ export const Stat = Entity.merge(
713
+ z.object({
714
+ number: z.number().default(0),
715
+ })
716
+ );
717
+
718
+ // Define the enum of model names
719
+ export const ModelNames = z.enum([
720
+ 'Account',
721
+ 'Achievement',
722
+ 'Act',
723
+ 'Agent',
724
+ 'Application',
725
+ 'Badge',
726
+ 'BattlePass',
727
+ 'Biome',
728
+ 'BiomeFeature',
729
+ 'Bounty',
730
+ 'Collection',
731
+ 'Comment',
732
+ 'Community',
733
+ 'Company',
734
+ 'Conversation',
735
+ 'ConversationMessage',
736
+ 'Data',
737
+ 'Discussion',
738
+ 'Energy',
739
+ 'Event',
740
+ 'File',
741
+ 'Galaxy',
742
+ 'Guide',
743
+ 'Idea',
744
+ 'Leaderboard',
745
+ 'Log',
746
+ 'Lore',
747
+ 'Market',
748
+ 'Memory',
749
+ 'Message',
750
+ 'Metaverse',
751
+ 'NewsArticle',
752
+ 'Npc',
753
+ 'Offer',
754
+ 'Omniverse',
755
+ 'Order',
756
+ 'ObjectInteraction',
757
+ 'Payment',
758
+ 'Party',
759
+ 'Permission',
760
+ 'Person',
761
+ 'Planet',
762
+ 'Poll',
763
+ 'Project',
764
+ 'Proposal',
765
+ 'Quest',
766
+ 'Question',
767
+ 'Rating',
768
+ 'Realm',
769
+ 'Referral',
770
+ 'Revision',
771
+ 'Review',
772
+ 'Role',
773
+ 'Season',
774
+ 'RealmShard',
775
+ 'Session',
776
+ 'SeerEvent',
777
+ 'SeerPayload',
778
+ 'Procedure',
779
+ 'SolarSystem',
780
+ 'Star',
781
+ 'Stash',
782
+ 'Stock',
783
+ 'Suggestion',
784
+ 'Tag',
785
+ 'Team',
786
+ 'Tournament',
787
+ 'Trade',
788
+ 'Universe',
789
+ 'Validator',
790
+ 'Vote',
791
+ 'WorldEvent',
792
+ 'WorldRecord',
793
+ 'Stat',
794
+ ]);
795
+
796
+ // Node Schema for polymorphic relationships
797
+ export const Node = z.object({
798
+ relationKey: z.string(),
799
+ fromModel: ModelNames,
800
+ from: ObjectId,
801
+ toModel: ModelNames,
802
+ to: ObjectId,
803
+ });
804
+
805
+ export const Prefab = Entity.merge(
806
+ z.object({
807
+ name: z.string().min(1),
808
+ fbxPath: z.string().min(1),
809
+ customizationOptions: z.record(z.any()).optional(), // Allows flexibility for customizable properties
810
+ childPrefabs: z
811
+ .array(
812
+ z.object({
813
+ prefabId: ObjectId,
814
+ position: z.object({
815
+ x: z.number(),
816
+ y: z.number(),
817
+ z: z.number(),
818
+ }),
819
+ rotation: z
820
+ .object({
821
+ x: z.number(),
822
+ y: z.number(),
823
+ z: z.number(),
824
+ })
825
+ .optional(),
826
+ scale: z
827
+ .number()
828
+ .positive()
829
+ .default(1),
830
+ })
831
+ )
832
+ .optional(),
833
+ })
834
+ );
835
+
836
+ export const Object = Entity.merge(
837
+ z.object({
838
+ prefabId: ObjectId,
839
+ playerId: ObjectId,
840
+ coordinates: z.object({
841
+ x: z.number(),
842
+ y: z.number(),
843
+ z: z.number(),
844
+ }),
845
+ rotation: z
846
+ .object({
847
+ x: z.number(),
848
+ y: z.number(),
849
+ z: z.number(),
850
+ })
851
+ .optional(),
852
+ scale: z
853
+ .number()
854
+ .positive()
855
+ .default(1),
856
+ customizations: z.record(z.any()).optional(),
857
+ childInstances: z
858
+ .array(
859
+ z.object({
860
+ prefabId: ObjectId,
861
+ coordinates: z.object({
862
+ x: z.number(),
863
+ y: z.number(),
864
+ z: z.number(),
865
+ }),
866
+ rotation: z
867
+ .object({
868
+ x: z.number(),
869
+ y: z.number(),
870
+ z: z.number(),
871
+ })
872
+ .optional(),
873
+ scale: z
874
+ .number()
875
+ .positive()
876
+ .default(1),
877
+ })
878
+ )
879
+ .optional(),
880
+ })
881
+ );
882
+
883
+ export const ObjectInteraction = Entity.merge(
884
+ z.object({
885
+ profileId: ObjectId,
886
+ objectId: ObjectId,
887
+ interactionType: z.enum(['Use', 'Fight', 'Open', 'Talk', 'Touch']),
888
+ outcome: z.record(z.any()).optional(),
889
+ })
890
+ );
891
+
892
+ export const SeerEvent = Entity.merge(
893
+ z.object({
894
+ // Which model this event is about, e.g. "Character", "Item", "Zone", etc.
895
+ kind: z.string().min(1),
896
+
897
+ // Logical operation over that model
898
+ operation: z.enum(['create', 'update', 'delete']),
899
+
900
+ // ID of the affected record (Mongo _id as string)
901
+ recordId: z.string().min(1),
902
+
903
+ // Application scoping (optional)
904
+ // applicationId: ObjectId.optional(),
905
+
906
+ // Full payload for this version (we keep it generic / untyped here)
907
+ payload: z.unknown(),
908
+
909
+ // Monotonically increasing sequence number for ordering
910
+ seq: z.number().int(),
911
+
912
+ // When the event occurred
913
+ timestamp: z.date(),
914
+ })
915
+ );
916
+
917
+ export const SeerPayload = Entity.merge(
918
+ z.object({
919
+ // Which seer node / wallet this payload came from
920
+ fromSeer: z.string().min(1),
921
+
922
+ // Optional app scope (if you ever shard per app)
923
+ // applicationId: ObjectId.optional(),
924
+
925
+ // Batch of SeerEvent-like objects (kept generic to avoid cross-module coupling)
926
+ events: z.array(z.unknown()).default([]),
927
+
928
+ // Hash of events as used in your zk circuit
929
+ eventsHash: z.string().min(1),
930
+
931
+ // Merkle root representing this batch / state
932
+ merkleRoot: z.string().min(1),
933
+
934
+ // Groth16 proof object
935
+ proof: z.unknown(),
936
+
937
+ // Groth16 public signals
938
+ publicSignals: z.unknown(),
939
+ })
940
+ );