@arken/seer-protocol 0.1.0 → 0.1.2

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 (124) hide show
  1. package/.rush/temp/shrinkwrap-deps.json +537 -56
  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 +26 -0
  6. package/area/index.ts +5 -0
  7. package/asset/asset.models.ts +59 -0
  8. package/asset/asset.router.ts +55 -0
  9. package/asset/asset.schema.ts +27 -0
  10. package/asset/asset.types.ts +22 -0
  11. package/asset/index.ts +5 -0
  12. package/chain/chain.models.ts +50 -0
  13. package/chain/chain.router.ts +104 -0
  14. package/chain/chain.schema.ts +52 -0
  15. package/chain/chain.types.ts +24 -0
  16. package/chain/index.ts +5 -0
  17. package/character/character.models.ts +174 -0
  18. package/character/character.router.ts +314 -0
  19. package/character/character.schema.ts +147 -0
  20. package/character/character.types.ts +64 -0
  21. package/character/index.ts +5 -0
  22. package/chat/chat.models.ts +43 -0
  23. package/chat/chat.router.ts +67 -0
  24. package/chat/chat.schema.ts +36 -0
  25. package/chat/chat.types.ts +20 -0
  26. package/chat/index.ts +5 -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 +36 -0
  31. package/collection/index.ts +5 -0
  32. package/core/core.models.ts +1380 -0
  33. package/core/core.router.ts +1781 -0
  34. package/core/core.schema.ts +847 -0
  35. package/core/core.types.ts +340 -0
  36. package/core/index.ts +5 -0
  37. package/{src/modules/evolution → evolution}/evolution.models.ts +1 -1
  38. package/{src/modules/evolution → evolution}/evolution.router.ts +5 -5
  39. package/{src/modules/evolution → evolution}/evolution.types.ts +1 -1
  40. package/game/game.models.ts +53 -0
  41. package/game/game.router.ts +110 -0
  42. package/game/game.schema.ts +23 -0
  43. package/game/game.types.ts +28 -0
  44. package/game/index.ts +5 -0
  45. package/index.ts +59 -0
  46. package/{src/modules/infinite → infinite}/infinite.models.ts +1 -1
  47. package/{src/modules/infinite → infinite}/infinite.router.ts +5 -5
  48. package/{src/modules/infinite → infinite}/infinite.types.ts +1 -1
  49. package/interface/index.ts +5 -0
  50. package/interface/interface.canonicalize.ts +279 -0
  51. package/interface/interface.models.ts +40 -0
  52. package/interface/interface.router.ts +175 -0
  53. package/interface/interface.schema.ts +59 -0
  54. package/interface/interface.types.ts +25 -0
  55. package/{src/modules/isles → isles}/isles.models.ts +1 -1
  56. package/{src/modules/isles → isles}/isles.router.ts +5 -5
  57. package/{src/modules/isles → isles}/isles.types.ts +1 -1
  58. package/item/index.ts +5 -0
  59. package/item/item.models.ts +124 -0
  60. package/item/item.router.ts +103 -0
  61. package/item/item.schema.ts +120 -0
  62. package/item/item.types.ts +74 -0
  63. package/job/index.ts +5 -0
  64. package/job/job.models.ts +14 -0
  65. package/job/job.router.ts +44 -0
  66. package/job/job.schema.ts +9 -0
  67. package/job/job.types.ts +23 -0
  68. package/market/index.ts +5 -0
  69. package/market/market.models.ts +113 -0
  70. package/market/market.router.ts +73 -0
  71. package/market/market.schema.ts +140 -0
  72. package/market/market.types.ts +56 -0
  73. package/{src/modules/oasis → oasis}/oasis.models.ts +1 -1
  74. package/{src/modules/oasis → oasis}/oasis.router.ts +1 -1
  75. package/{src/modules/oasis → oasis}/oasis.types.ts +1 -1
  76. package/package.json +12 -14
  77. package/product/index.ts +5 -0
  78. package/product/product.models.ts +166 -0
  79. package/product/product.router.ts +93 -0
  80. package/product/product.schema.ts +149 -0
  81. package/product/product.types.ts +33 -0
  82. package/profile/index.ts +5 -0
  83. package/profile/profile.models.ts +214 -0
  84. package/profile/profile.router.ts +72 -0
  85. package/profile/profile.schema.ts +156 -0
  86. package/profile/profile.types.ts +22 -0
  87. package/raffle/index.ts +5 -0
  88. package/raffle/raffle.models.ts +44 -0
  89. package/raffle/raffle.router.ts +90 -0
  90. package/raffle/raffle.schema.ts +32 -0
  91. package/raffle/raffle.types.ts +30 -0
  92. package/{src/router.ts → router.ts} +22 -28
  93. package/schema.ts +321 -0
  94. package/skill/index.ts +5 -0
  95. package/skill/skill.models.ts +16 -0
  96. package/skill/skill.router.ts +201 -0
  97. package/skill/skill.schema.ts +40 -0
  98. package/skill/skill.types.ts +33 -0
  99. package/{src/modules/trek → trek}/trek.router.ts +1 -1
  100. package/types.ts +273 -0
  101. package/video/index.ts +5 -0
  102. package/video/video.models.ts +25 -0
  103. package/video/video.router.ts +143 -0
  104. package/video/video.schema.ts +46 -0
  105. package/video/video.types.ts +33 -0
  106. package/src/index.ts +0 -22
  107. package/src/modules/evolution/evolution.service.ts +0 -2000
  108. package/src/modules/infinite/infinite.service.ts +0 -40
  109. package/src/modules/isles/isles.service.ts +0 -40
  110. package/src/modules/oasis/oasis.service.ts +0 -38
  111. package/src/modules/trek/trek.service.ts +0 -1031
  112. package/src/types.ts +0 -106
  113. /package/{src/modules/evolution → evolution}/evolution.schema.ts +0 -0
  114. /package/{src/modules/evolution → evolution}/index.ts +0 -0
  115. /package/{src/modules/infinite → infinite}/index.ts +0 -0
  116. /package/{src/modules/infinite → infinite}/infinite.schema.ts +0 -0
  117. /package/{src/modules/isles → isles}/index.ts +0 -0
  118. /package/{src/modules/isles → isles}/isles.schema.ts +0 -0
  119. /package/{src/modules/oasis → oasis}/index.ts +0 -0
  120. /package/{src/modules/oasis → oasis}/oasis.schema.ts +0 -0
  121. /package/{src/modules/trek → trek}/index.ts +0 -0
  122. /package/{src/modules/trek → trek}/trek.models.ts +0 -0
  123. /package/{src/modules/trek → trek}/trek.schema.ts +0 -0
  124. /package/{src/modules/trek → trek}/trek.types.ts +0 -0
@@ -0,0 +1,201 @@
1
+ import { z as zod } from 'zod';
2
+ import { initTRPC, inferRouterInputs, inferRouterOutputs } from '@trpc/server';
3
+ import { customErrorFormatter, hasRole } from '../../util/rpc';
4
+ import type { RouterContext } from '../../types';
5
+ import {
6
+ Skill,
7
+ SkillMod,
8
+ SkillClassification,
9
+ SkillCondition,
10
+ SkillStatusEffect,
11
+ SkillTree,
12
+ SkillTreeNode,
13
+ } from './skill.schema';
14
+ import { Query } from '../../schema';
15
+
16
+ export const z = zod;
17
+ export const t = initTRPC.context<RouterContext>().create();
18
+ export const router = t.router;
19
+ export const procedure = t.procedure;
20
+
21
+ export const createRouter = () =>
22
+ router({
23
+ // Skill Procedures
24
+ getSkill: procedure
25
+ .use(hasRole('guest', t))
26
+ .use(customErrorFormatter(t))
27
+ .input(z.object({ query: Query }))
28
+ .query(({ input, ctx }) => (ctx.app.service.Skill.getSkill as any)(input, ctx)),
29
+
30
+ createSkill: procedure
31
+ .use(hasRole('admin', t))
32
+ .use(customErrorFormatter(t))
33
+ .input(z.object({ data: Skill.omit({ id: true }) }))
34
+ .mutation(({ input, ctx }) => (ctx.app.service.Skill.createSkill as any)(input, ctx)),
35
+
36
+ updateSkill: procedure
37
+ .use(hasRole('admin', t))
38
+ .use(customErrorFormatter(t))
39
+ .input(z.object({ query: Query, data: Skill.partial() }))
40
+ .mutation(({ input, ctx }) => (ctx.app.service.Skill.updateSkill as any)(input, ctx)),
41
+
42
+ deleteSkill: procedure
43
+ .use(hasRole('admin', t))
44
+ .use(customErrorFormatter(t))
45
+ .input(z.object({ query: Query }))
46
+ .mutation(({ input, ctx }) => (ctx.app.service.Skill.deleteSkill as any)(input, ctx)),
47
+
48
+ // SkillMod Procedures
49
+ getSkillMod: procedure
50
+ .use(hasRole('guest', t))
51
+ .use(customErrorFormatter(t))
52
+ .input(z.object({ query: Query }))
53
+ .query(({ input, ctx }) => (ctx.app.service.Skill.getSkillMod as any)(input, ctx)),
54
+
55
+ createSkillMod: procedure
56
+ .use(hasRole('admin', t))
57
+ .use(customErrorFormatter(t))
58
+ .input(z.object({ data: SkillMod.omit({ id: true }) }))
59
+ .mutation(({ input, ctx }) => (ctx.app.service.Skill.createSkillMod as any)(input, ctx)),
60
+
61
+ updateSkillMod: procedure
62
+ .use(hasRole('admin', t))
63
+ .use(customErrorFormatter(t))
64
+ .input(z.object({ query: Query, data: SkillMod.partial() }))
65
+ .mutation(({ input, ctx }) => (ctx.app.service.Skill.updateSkillMod as any)(input, ctx)),
66
+
67
+ deleteSkillMod: procedure
68
+ .use(hasRole('admin', t))
69
+ .use(customErrorFormatter(t))
70
+ .input(z.object({ query: Query }))
71
+ .mutation(({ input, ctx }) => (ctx.app.service.Skill.deleteSkillMod as any)(input, ctx)),
72
+
73
+ // SkillClassification Procedures
74
+ getSkillClassification: procedure
75
+ .use(hasRole('guest', t))
76
+ .use(customErrorFormatter(t))
77
+ .input(z.object({ query: Query }))
78
+ .query(({ input, ctx }) => (ctx.app.service.Skill.getSkillClassification as any)(input, ctx)),
79
+
80
+ createSkillClassification: procedure
81
+ .use(hasRole('admin', t))
82
+ .use(customErrorFormatter(t))
83
+ .input(z.object({ data: SkillClassification.omit({ id: true }) }))
84
+ .mutation(({ input, ctx }) => (ctx.app.service.Skill.createSkillClassification as any)(input, ctx)),
85
+
86
+ updateSkillClassification: procedure
87
+ .use(hasRole('admin', t))
88
+ .use(customErrorFormatter(t))
89
+ .input(z.object({ query: Query, data: SkillClassification.partial() }))
90
+ .mutation(({ input, ctx }) => (ctx.app.service.Skill.updateSkillClassification as any)(input, ctx)),
91
+
92
+ deleteSkillClassification: procedure
93
+ .use(hasRole('admin', t))
94
+ .use(customErrorFormatter(t))
95
+ .input(z.object({ query: Query }))
96
+ .mutation(({ input, ctx }) => (ctx.app.service.Skill.deleteSkillClassification as any)(input, ctx)),
97
+
98
+ // SkillCondition Procedures
99
+ getSkillCondition: procedure
100
+ .use(hasRole('guest', t))
101
+ .use(customErrorFormatter(t))
102
+ .input(z.object({ query: Query }))
103
+ .query(({ input, ctx }) => (ctx.app.service.Skill.getSkillCondition as any)(input, ctx)),
104
+
105
+ createSkillCondition: procedure
106
+ .use(hasRole('admin', t))
107
+ .use(customErrorFormatter(t))
108
+ .input(z.object({ data: SkillCondition.omit({ id: true }) }))
109
+ .mutation(({ input, ctx }) => (ctx.app.service.Skill.createSkillCondition as any)(input, ctx)),
110
+
111
+ updateSkillCondition: procedure
112
+ .use(hasRole('admin', t))
113
+ .use(customErrorFormatter(t))
114
+ .input(z.object({ query: Query, data: SkillCondition.partial() }))
115
+ .mutation(({ input, ctx }) => (ctx.app.service.Skill.updateSkillCondition as any)(input, ctx)),
116
+
117
+ deleteSkillCondition: procedure
118
+ .use(hasRole('admin', t))
119
+ .use(customErrorFormatter(t))
120
+ .input(z.object({ query: Query }))
121
+ .mutation(({ input, ctx }) => (ctx.app.service.Skill.deleteSkillCondition as any)(input, ctx)),
122
+
123
+ // SkillStatusEffect Procedures
124
+ getSkillStatusEffect: procedure
125
+ .use(hasRole('guest', t))
126
+ .use(customErrorFormatter(t))
127
+ .input(z.object({ query: Query }))
128
+ .query(({ input, ctx }) => (ctx.app.service.Skill.getSkillStatusEffect as any)(input, ctx)),
129
+
130
+ createSkillStatusEffect: procedure
131
+ .use(hasRole('admin', t))
132
+ .use(customErrorFormatter(t))
133
+ .input(z.object({ data: SkillStatusEffect.omit({ id: true }) }))
134
+ .mutation(({ input, ctx }) => (ctx.app.service.Skill.createSkillStatusEffect as any)(input, ctx)),
135
+
136
+ updateSkillStatusEffect: procedure
137
+ .use(hasRole('admin', t))
138
+ .use(customErrorFormatter(t))
139
+ .input(z.object({ query: Query, data: SkillStatusEffect.partial() }))
140
+ .mutation(({ input, ctx }) => (ctx.app.service.Skill.updateSkillStatusEffect as any)(input, ctx)),
141
+
142
+ deleteSkillStatusEffect: procedure
143
+ .use(hasRole('admin', t))
144
+ .use(customErrorFormatter(t))
145
+ .input(z.object({ query: Query }))
146
+ .mutation(({ input, ctx }) => (ctx.app.service.Skill.deleteSkillStatusEffect as any)(input, ctx)),
147
+
148
+ // SkillTree Procedures
149
+ getSkillTree: procedure
150
+ .use(hasRole('guest', t))
151
+ .use(customErrorFormatter(t))
152
+ .input(z.object({ query: Query }))
153
+ .query(({ input, ctx }) => (ctx.app.service.Skill.getSkillTree as any)(input, ctx)),
154
+
155
+ createSkillTree: procedure
156
+ .use(hasRole('admin', t))
157
+ .use(customErrorFormatter(t))
158
+ .input(z.object({ data: SkillTree.omit({ id: true }) }))
159
+ .mutation(({ input, ctx }) => (ctx.app.service.Skill.createSkillTree as any)(input, ctx)),
160
+
161
+ updateSkillTree: procedure
162
+ .use(hasRole('admin', t))
163
+ .use(customErrorFormatter(t))
164
+ .input(z.object({ query: Query, data: SkillTree.partial() }))
165
+ .mutation(({ input, ctx }) => (ctx.app.service.Skill.updateSkillTree as any)(input, ctx)),
166
+
167
+ deleteSkillTree: procedure
168
+ .use(hasRole('admin', t))
169
+ .use(customErrorFormatter(t))
170
+ .input(z.object({ query: Query }))
171
+ .mutation(({ input, ctx }) => (ctx.app.service.Skill.deleteSkillTree as any)(input, ctx)),
172
+
173
+ // SkillTreeNode Procedures
174
+ getSkillTreeNode: procedure
175
+ .use(hasRole('guest', t))
176
+ .use(customErrorFormatter(t))
177
+ .input(z.object({ query: Query }))
178
+ .query(({ input, ctx }) => (ctx.app.service.Skill.getSkillTreeNode as any)(input, ctx)),
179
+
180
+ createSkillTreeNode: procedure
181
+ .use(hasRole('admin', t))
182
+ .use(customErrorFormatter(t))
183
+ .input(z.object({ data: SkillTreeNode.omit({ id: true }) }))
184
+ .mutation(({ input, ctx }) => (ctx.app.service.Skill.createSkillTreeNode as any)(input, ctx)),
185
+
186
+ updateSkillTreeNode: procedure
187
+ .use(hasRole('admin', t))
188
+ .use(customErrorFormatter(t))
189
+ .input(z.object({ query: Query, data: SkillTreeNode.partial() }))
190
+ .mutation(({ input, ctx }) => (ctx.app.service.Skill.updateSkillTreeNode as any)(input, ctx)),
191
+
192
+ deleteSkillTreeNode: procedure
193
+ .use(hasRole('admin', t))
194
+ .use(customErrorFormatter(t))
195
+ .input(z.object({ query: Query }))
196
+ .mutation(({ input, ctx }) => (ctx.app.service.Skill.deleteSkillTreeNode as any)(input, ctx)),
197
+ });
198
+
199
+ export type Router = ReturnType<typeof createRouter>;
200
+ export type RouterInput = inferRouterInputs<Router>;
201
+ export type RouterOutput = inferRouterOutputs<Router>;
@@ -0,0 +1,40 @@
1
+ import { z, ObjectId, Entity } from '../../schema';
2
+
3
+ export const Skill = Entity.merge(
4
+ z.object({
5
+ name: z.string().min(1),
6
+ description: z.string().min(1).optional(),
7
+ type: z.enum(['attack', 'defense', 'utility']),
8
+ cooldown: z.number().min(0).optional(),
9
+ power: z.number().min(0).optional(),
10
+ })
11
+ );
12
+
13
+ export const SkillEffect = Entity.merge(
14
+ z.object({
15
+ skillId: ObjectId, // Reference to the associated Skill
16
+ effectType: z.enum(['damage', 'heal', 'buff', 'debuff']),
17
+ magnitude: z.number().min(0),
18
+ duration: z.number().min(0).optional(),
19
+ })
20
+ );
21
+
22
+ export const SkillRequirement = Entity.merge(
23
+ z.object({
24
+ skillId: ObjectId, // Reference to the associated Skill
25
+ levelRequired: z.number().min(1),
26
+ previousSkillId: ObjectId.optional(), // Reference to a prerequisite skill
27
+ })
28
+ );
29
+
30
+ export const SkillMod = Entity.merge(z.object({}));
31
+
32
+ export const SkillClassification = Entity.merge(z.object({}));
33
+
34
+ export const SkillCondition = Entity.merge(z.object({}));
35
+
36
+ export const SkillStatusEffect = Entity.merge(z.object({}));
37
+
38
+ export const SkillTree = Entity.merge(z.object({}));
39
+
40
+ export const SkillTreeNode = Entity.merge(z.object({}));
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ import * as schema from './skill.schema';
3
+ import { Document, Model } from '../../util/mongo';
4
+
5
+ export type * from './skill.router';
6
+ export type * from './skill.service';
7
+ export type { RouterContext } from '../../types';
8
+
9
+ export type Skill = z.infer<typeof schema.Skill>;
10
+ export type SkillMod = z.infer<typeof schema.SkillMod>;
11
+ export type SkillClassification = z.infer<typeof schema.SkillClassification>;
12
+ export type SkillCondition = z.infer<typeof schema.SkillCondition>;
13
+ export type SkillStatusEffect = z.infer<typeof schema.SkillStatusEffect>;
14
+ export type SkillTree = z.infer<typeof schema.SkillTree>;
15
+ export type SkillTreeNode = z.infer<typeof schema.SkillTreeNode>;
16
+
17
+ export type SkillDocument = Skill & Document;
18
+ export type SkillModDocument = SkillMod & Document;
19
+ export type SkillClassificationDocument = SkillClassification & Document;
20
+ export type SkillConditionDocument = SkillCondition & Document;
21
+ export type SkillStatusEffectDocument = SkillStatusEffect & Document;
22
+ export type SkillTreeDocument = SkillTree & Document;
23
+ export type SkillTreeNodeDocument = SkillTreeNode & Document;
24
+
25
+ export type Mappings = {
26
+ Skill: Model<SkillDocument>;
27
+ SkillMod: Model<SkillModDocument>;
28
+ SkillClassification: Model<SkillClassificationDocument>;
29
+ SkillCondition: Model<SkillConditionDocument>;
30
+ SkillStatusEffect: Model<SkillStatusEffectDocument>;
31
+ SkillTree: Model<SkillTreeDocument>;
32
+ SkillTreeNode: Model<SkillTreeNodeDocument>;
33
+ };
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { z as zod } from 'zod';
4
4
  import { initTRPC } from '@trpc/server';
5
- import { customErrorFormatter, hasRole } from '@arken/node/util/rpc';
5
+ import { customErrorFormatter, hasRole } from '@arken/node/rpc';
6
6
  import type { inferRouterOutputs, inferRouterInputs } from '@trpc/server';
7
7
  import type { RouterContext } from '../../types';
8
8
 
package/types.ts ADDED
@@ -0,0 +1,273 @@
1
+
2
+ // arken/packages/seer/protocol/types.ts
3
+ //
4
+ import * as Arken from '@arken/node';
5
+ import { Router, RouterInput, RouterOutput } from './router';
6
+
7
+
8
+ // Imports
9
+ import * as Area from './area';
10
+ import * as Asset from './asset';
11
+ import * as Chain from './chain';
12
+ import * as Character from './character';
13
+ import * as Chat from './chat';
14
+ import * as Collection from './collection';
15
+ import * as Core from './core';
16
+ import * as Game from './game';
17
+ import * as Interface from './interface';
18
+ import * as Item from './item';
19
+ import * as Job from './job';
20
+ import * as Market from './market';
21
+ import * as Product from './product';
22
+ import * as Profile from './profile';
23
+ import * as Raffle from './raffle';
24
+ import * as Skill from './skill';
25
+ import * as Video from './video';
26
+ import * as Evolution from './evolution';
27
+ import * as Infinite from './infinite';
28
+ import * as Oasis from './oasis';
29
+ import * as Trek from './trek';
30
+
31
+ export type { Router, RouterInput, RouterOutput };
32
+
33
+ export type ApplicationServiceType = Partial<{
34
+ Trek: Trek.Service;
35
+ Evolution: Evolution.Service;
36
+ Infinite: Infinite.Service;
37
+ Oasis: Oasis.Service;
38
+ }> &
39
+ Arken.ApplicationServiceType;
40
+
41
+ export type ApplicationModelType = Partial<Evolution.Types.Mappings & Infinite.Types.Mappings> &
42
+ Arken.ApplicationModelType;
43
+
44
+ export class Application {
45
+ router: Router;
46
+ service: ApplicationServiceType = {};
47
+ model: ApplicationModelType = {};
48
+ realms: Arken.Core.Types.Realm[] = [];
49
+
50
+ server: any;
51
+ http: any;
52
+ https: any;
53
+ isHttps: boolean;
54
+ cache: any;
55
+ db: any;
56
+ services: any;
57
+ applications: any;
58
+ application: any;
59
+ contracts: any;
60
+ contractInfo: any;
61
+ contractMetadata: any;
62
+ ethersProvider: any;
63
+ data: any;
64
+ signers: any;
65
+ filters: Record<string, any> = { applicationId: null };
66
+
67
+ // async getRealms(
68
+ // input: Types.RouterInput['getRealms'],
69
+ // ctx: Types.ServiceContext
70
+ // ): Promise<Types.RouterOutput['getRealms']> {
71
+ // throw new Error('Not implemented');
72
+ // }
73
+
74
+ // async updateRealm(
75
+ // input: Types.RouterInput['updateRealm'],
76
+ // ctx: Types.ServiceContext
77
+ // ): Promise<Types.RouterOutput['updateRealm']> {
78
+ // throw new Error('Not implemented');
79
+ // }
80
+ }
81
+
82
+ export type ApplicationType = typeof Application;
83
+ // export type Seer =
84
+ // export type Seer = {
85
+ // service: ApplicationServiceType;
86
+ // model: ApplicationModelType;
87
+ // realms: Arken.Core.Types.Realm[];
88
+
89
+ // server: any;
90
+ // http: any;
91
+ // https: any;
92
+ // isHttps: boolean;
93
+ // cache: any;
94
+ // db: any;
95
+ // services: any;
96
+ // applications: any;
97
+ // application: any;
98
+ // filters: Record<string, any>;
99
+ // contracts: any;
100
+ // contractInfo: any;
101
+ // contractMetadata: any;
102
+ // signers: any;
103
+ // };
104
+
105
+ export type RouterContext = {
106
+ app: Application;
107
+ } & Arken.RouterContext;
108
+
109
+ export interface Client {
110
+ id: string;
111
+ name: string;
112
+ ip: string;
113
+ socket: any;
114
+ endpoint: string;
115
+ ioCallbacks: any;
116
+ info: any;
117
+ lastReportedTime: number;
118
+ isMod: boolean;
119
+ isAdmin: boolean;
120
+ isSeer: boolean;
121
+ log: {
122
+ clientDisconnected: number;
123
+ };
124
+ }
125
+
126
+ export interface ServiceContext {
127
+ client: Client;
128
+ }
129
+
130
+
131
+ import { createRouter } from './router';
132
+
133
+ export * as util from './util';
134
+
135
+ export type * as Schema from './schema';
136
+
137
+ export type Router = ReturnType<typeof createRouter>;
138
+
139
+ export type ApplicationServiceType = Partial<{
140
+ Area: Area.Service;
141
+ Asset: Asset.Service;
142
+ Chain: Chain.Service;
143
+ Character: Character.Service;
144
+ Chat: Chat.Service;
145
+ Collection: Collection.Service;
146
+ Core: Core.Service;
147
+ Game: Game.Service;
148
+ Interface: Interface.Service;
149
+ Item: Item.Service;
150
+ Job: Job.Service;
151
+ Market: Market.Service;
152
+ Product: Product.Service;
153
+ Profile: Profile.Service;
154
+ Raffle: Raffle.Service;
155
+ Skill: Skill.Service;
156
+ Video: Video.Service;
157
+ }>;
158
+
159
+ export type ApplicationModelType = Partial<
160
+ Area.Types.Mappings &
161
+ Asset.Types.Mappings &
162
+ Chain.Types.Mappings &
163
+ Character.Types.Mappings &
164
+ Chat.Types.Mappings &
165
+ Collection.Types.Mappings &
166
+ Core.Types.Mappings &
167
+ Game.Types.Mappings &
168
+ Interface.Types.Mappings &
169
+ Item.Types.Mappings &
170
+ Job.Types.Mappings &
171
+ Market.Types.Mappings &
172
+ Product.Types.Mappings &
173
+ Profile.Types.Mappings &
174
+ Raffle.Types.Mappings &
175
+ Skill.Types.Mappings &
176
+ Video.Types.Mappings
177
+ >;
178
+
179
+ export interface Application {
180
+ model: ApplicationModelType;
181
+ service: ApplicationServiceType;
182
+ web3?: any;
183
+ }
184
+
185
+ export type RouterClient = {
186
+ socket: any;
187
+ roles: string[];
188
+ permissions: any;
189
+ profile?: Profile.Types.Profile;
190
+ emit: any;
191
+ };
192
+
193
+ export type RouterContext = {
194
+ app: Application;
195
+ client?: RouterClient;
196
+ profile?: Profile.Types.Profile;
197
+ };
198
+
199
+ export interface Signature {
200
+ hash?: string;
201
+ address?: string;
202
+ }
203
+
204
+ export type Position = {
205
+ x: number;
206
+ y: number;
207
+ z?: number;
208
+ };
209
+
210
+ export type UnwrapPromise<T> = T extends Promise<infer U> ? U : T;
211
+
212
+ export type PatchOp =
213
+ | { op: 'set'; key: string; value: any }
214
+ | { op: 'unset'; key: string }
215
+ | { op: 'inc'; key: string; value: number }
216
+ | { op: 'push'; key: string; value: any }
217
+ | { op: 'merge'; key: string; value: Record<string, any> };
218
+
219
+ export type EntityPatch = {
220
+ entityType: string; // allow any string
221
+ entityId: string;
222
+ baseVersion?: number;
223
+ ops: PatchOp[];
224
+ claimable?: boolean;
225
+ };
226
+
227
+ export type GameObjectDef = {
228
+ id: string;
229
+ type: string; // allow any string
230
+ name: string;
231
+ position: { x: number; y: number };
232
+ radius?: number; // interaction distance
233
+ tags?: string[];
234
+ meta?: Record<string, any>;
235
+ };
236
+
237
+ export type Requirement =
238
+ | { kind: 'exists'; key: string }
239
+ | { kind: 'touchedObject'; objectId: string; afterKey?: string; writeKey: string };
240
+
241
+ // Generic effects (can be positive or negative)
242
+ export type Effect =
243
+ | { kind: 'item.grant'; itemKey: string; quantity?: number }
244
+ | { kind: 'currency.grant'; key: string; amount: number } // negative amount allowed
245
+ | { kind: 'reputation.delta'; npcId: string; amount: number } // negative allowed
246
+ | { kind: 'state.patch'; patch: EntityPatch } // generic patch against any entityType
247
+ | { kind: 'ui.unlock'; uiKey: string } // optional, future
248
+ | { kind: 'emit'; eventType: string; payload?: any }; // optional, future
249
+
250
+ export type QuestDef = {
251
+ id: string;
252
+ metaverseId: string;
253
+ name: string;
254
+
255
+ // Requirements can be checked shard-side (for anti-cheat) AND client-side (for UI state)
256
+ requirements: Requirement[];
257
+
258
+ // Effects are applied on completion/claim (seer-side)
259
+ effects: Effect[];
260
+
261
+ // keys shard will write (auditing + permissions)
262
+ writes?: string[];
263
+ };
264
+
265
+ type QuestCompleteOp = {
266
+ kind: 'quest.complete';
267
+ id: string;
268
+ ts: number;
269
+ questId: string;
270
+ metaverseId: string;
271
+ evidence?: Record<string, any>;
272
+ effects?: any[]; // can include effect refs for replay/debug
273
+ };
package/video/index.ts ADDED
@@ -0,0 +1,5 @@
1
+ export * as Types from './video.types';
2
+ export * as Models from './video.models';
3
+ export * as Schemas from './video.schema';
4
+ export * from './video.router';
5
+ export * from './video.service';
@@ -0,0 +1,25 @@
1
+ import * as mongo from '../../util/mongo';
2
+ import type * as Types from './video.types';
3
+
4
+ export const Video = mongo.createModel<Types.VideoDocument>('Video', {
5
+ youtubeId: { type: String, unique: true, required: true },
6
+ url: { type: String, required: true },
7
+ });
8
+
9
+ export const VideoParticipant = mongo.createModel<Types.VideoParticipantDocument>('VideoParticipant', {
10
+ profileId: { type: mongo.Schema.Types.ObjectId, ref: 'Profile', required: true },
11
+ });
12
+
13
+ export const VideoDialogue = mongo.createModel<Types.VideoDialogueDocument>('VideoDialogue', {
14
+ participantId: { type: mongo.Schema.Types.ObjectId, ref: 'VideoParticipant', required: true },
15
+ text: { type: String, required: true },
16
+ timestamp: { type: String, required: true },
17
+ });
18
+
19
+ export const VideoTranscript = mongo.createModel<Types.VideoTranscriptDocument>('VideoTranscript', {
20
+ videoId: { type: mongo.Schema.Types.ObjectId, ref: 'Video', required: true },
21
+ // transcript: { type: [mongo.Schema.Types.Mixed], required: true },
22
+ summary: { type: String, optional: true },
23
+ });
24
+
25
+ export const VideoScene = mongo.createModel<Types.VideoSceneDocument>('VideoScene', {});