@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
package/tsconfig.json CHANGED
@@ -1,25 +1,33 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "module": "CommonJS",
4
- "preserveSymlinks": true,
5
3
  "esModuleInterop": true,
4
+ "module": "ESNext",
5
+ "lib": ["ES2020", "DOM"],
6
+ "noImplicitAny": false,
7
+ "outDir": "build",
8
+ "preserveSymlinks": false,
9
+ "preserveConstEnums": true,
6
10
  "experimentalDecorators": true,
7
11
  "emitDecoratorMetadata": true,
12
+ "removeComments": true,
13
+ "skipLibCheck": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "strict": false,
16
+ "checkJs": true,
17
+ "sourceMap": true,
18
+ "target": "ES2020",
19
+ "moduleResolution": "Node",
8
20
  "resolveJsonModule": true,
9
21
  "allowSyntheticDefaultImports": true,
10
- "noImplicitAny": false,
11
- "sourceMap": true,
12
- "strictNullChecks": false,
13
- "outDir": "./dist",
14
- "baseUrl": ".",
15
- "types": ["node", "jest"],
16
- "paths": {
17
- "~/*": ["./src/*"]
18
- },
19
- "target": "ESNext",
20
- "lib": ["ESNext"],
21
- "moduleResolution": "Node"
22
+ "types": ["jest", "node"],
23
+ "paths": {},
24
+ "allowJs": true,
25
+ "declaration": true,
26
+ "isolatedModules": true,
27
+ "noFallthroughCasesInSwitch": true,
28
+ "noEmit": false,
29
+ "composite": true
22
30
  },
23
- "include": ["./src/**/*"],
24
- "exclude": []
25
- }
31
+ "include": ["./area/**/*","./asset/**/*", "./chain/**/*","./chain/**/*","./character/**/*","./chat/**/*","./collection/**/*","./core/**/*","./evolution/**/*", "./game/**/*","./infinite/**/*","./interface/**/*","./isles/**/*","./item/**/*","./job/**/*","./market/**/*","./oasis/**/*","./product/**/*","./profile/**/*","./raffle/**/*","./skill/**/*","./trek/**/*","./video/**/*","./index.ts","./router.ts","./schema.ts","./types.ts"],
32
+ "exclude": ["node_modules", "build"]
33
+ }
package/types.ts CHANGED
@@ -1,29 +1,61 @@
1
- import * as Arken from '@arken/node';
2
- import { Router, RouterInput, RouterOutput } from './router';
3
- import * as Evolution from './modules/evolution';
4
- import * as Infinite from './modules/infinite';
5
- import * as Oasis from './modules/oasis';
6
- import * as Trek from './modules/trek';
7
- import type * as Types from './types';
8
-
9
- export type { Router, RouterInput, RouterOutput };
10
-
11
- export type ApplicationServiceType = Partial<{
12
- Trek: Trek.Service;
13
- Evolution: Evolution.Service;
14
- Infinite: Infinite.Service;
15
- Oasis: Oasis.Service;
16
- }> &
17
- Arken.ApplicationServiceType;
18
-
19
- export type ApplicationModelType = Partial<Evolution.Types.Mappings & Infinite.Types.Mappings> &
20
- Arken.ApplicationModelType;
21
-
22
- export class Application {
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
+ // Exports
32
+ export * as Area from './area';
33
+ export * as Asset from './asset';
34
+ export * as Chain from './chain';
35
+ export * as Character from './character';
36
+ export * as Chat from './chat';
37
+ export * as Collection from './collection';
38
+ export * as Core from './core';
39
+ export * as Game from './game';
40
+ export * as Interface from './interface';
41
+ export * as Item from './item';
42
+ export * as Job from './job';
43
+ export * as Market from './market';
44
+ export * as Product from './product';
45
+ export * as Profile from './profile';
46
+ export * as Raffle from './raffle';
47
+ export * as Skill from './skill';
48
+ export * as Video from './video';
49
+ export * as Evolution from './evolution';
50
+ export * as Infinite from './infinite';
51
+ export * as Oasis from './oasis';
52
+ export * as Trek from './trek';
53
+
54
+ export class Application<ServiceType> {
23
55
  router: Router;
24
- service: ApplicationServiceType = {};
56
+ service: ServiceType;
25
57
  model: ApplicationModelType = {};
26
- realms: Arken.Core.Types.Realm[] = [];
58
+ realms: Core.Types.Realm[] = [];
27
59
 
28
60
  server: any;
29
61
  http: any;
@@ -81,8 +113,10 @@ export type ApplicationType = typeof Application;
81
113
  // };
82
114
 
83
115
  export type RouterContext = {
84
- app: Application;
85
- } & Arken.RouterContext;
116
+ app: Application<any>;
117
+ client?: RouterClient;
118
+ profile?: Profile.Types.Profile;
119
+ };
86
120
 
87
121
  export interface Client {
88
122
  id: string;
@@ -104,3 +138,117 @@ export interface Client {
104
138
  export interface ServiceContext {
105
139
  client: Client;
106
140
  }
141
+
142
+
143
+ import { createRouter } from './router';
144
+
145
+ export type * as Schema from './schema';
146
+
147
+ export type Router = ReturnType<typeof createRouter>;
148
+
149
+ export type ApplicationModelType = Partial<
150
+ Area.Types.Mappings &
151
+ Asset.Types.Mappings &
152
+ Chain.Types.Mappings &
153
+ Character.Types.Mappings &
154
+ Chat.Types.Mappings &
155
+ Collection.Types.Mappings &
156
+ Core.Types.Mappings &
157
+ Game.Types.Mappings &
158
+ Interface.Types.Mappings &
159
+ Item.Types.Mappings &
160
+ Job.Types.Mappings &
161
+ Market.Types.Mappings &
162
+ Product.Types.Mappings &
163
+ Profile.Types.Mappings &
164
+ Raffle.Types.Mappings &
165
+ Skill.Types.Mappings &
166
+ Video.Types.Mappings &
167
+ Evolution.Types.Mappings &
168
+ Infinite.Types.Mappings
169
+ >;
170
+
171
+ export type RouterClient = {
172
+ socket: any;
173
+ roles: string[];
174
+ permissions: any;
175
+ profile?: Profile.Types.Profile;
176
+ emit: any;
177
+ };
178
+
179
+
180
+ export interface Signature {
181
+ hash?: string;
182
+ address?: string;
183
+ }
184
+
185
+ export type Position = {
186
+ x: number;
187
+ y: number;
188
+ z?: number;
189
+ };
190
+
191
+ export type UnwrapPromise<T> = T extends Promise<infer U> ? U : T;
192
+
193
+ export type PatchOp =
194
+ | { op: 'set'; key: string; value: any }
195
+ | { op: 'unset'; key: string }
196
+ | { op: 'inc'; key: string; value: number }
197
+ | { op: 'push'; key: string; value: any }
198
+ | { op: 'merge'; key: string; value: Record<string, any> };
199
+
200
+ export type EntityPatch = {
201
+ entityType: string; // allow any string
202
+ entityId: string;
203
+ baseVersion?: number;
204
+ ops: PatchOp[];
205
+ claimable?: boolean;
206
+ };
207
+
208
+ export type GameObjectDef = {
209
+ id: string;
210
+ type: string; // allow any string
211
+ name: string;
212
+ position: { x: number; y: number };
213
+ radius?: number; // interaction distance
214
+ tags?: string[];
215
+ meta?: Record<string, any>;
216
+ };
217
+
218
+ export type Requirement =
219
+ | { kind: 'exists'; key: string }
220
+ | { kind: 'touchedObject'; objectId: string; afterKey?: string; writeKey: string };
221
+
222
+ // Generic effects (can be positive or negative)
223
+ export type Effect =
224
+ | { kind: 'item.grant'; itemKey: string; quantity?: number }
225
+ | { kind: 'currency.grant'; key: string; amount: number } // negative amount allowed
226
+ | { kind: 'reputation.delta'; npcId: string; amount: number } // negative allowed
227
+ | { kind: 'state.patch'; patch: EntityPatch } // generic patch against any entityType
228
+ | { kind: 'ui.unlock'; uiKey: string } // optional, future
229
+ | { kind: 'emit'; eventType: string; payload?: any }; // optional, future
230
+
231
+ export type QuestDef = {
232
+ id: string;
233
+ metaverseId: string;
234
+ name: string;
235
+
236
+ // Requirements can be checked shard-side (for anti-cheat) AND client-side (for UI state)
237
+ requirements: Requirement[];
238
+
239
+ // Effects are applied on completion/claim (seer-side)
240
+ effects: Effect[];
241
+
242
+ // keys shard will write (auditing + permissions)
243
+ writes?: string[];
244
+ };
245
+
246
+ type QuestCompleteOp = {
247
+ kind: 'quest.complete';
248
+ id: string;
249
+ ts: number;
250
+ questId: string;
251
+ metaverseId: string;
252
+ evidence?: Record<string, any>;
253
+ effects?: any[]; // can include effect refs for replay/debug
254
+ };
package/video/index.ts ADDED
@@ -0,0 +1,4 @@
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';
@@ -0,0 +1,25 @@
1
+ import * as mongo from '@arken/node/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', {});
@@ -0,0 +1,143 @@
1
+ import { z as zod } from 'zod';
2
+ import { initTRPC, inferRouterInputs, inferRouterOutputs } from '@trpc/server';
3
+ import { customErrorFormatter, hasRole } from '@arken/node/rpc';
4
+ import type { RouterContext } from '../types';
5
+ import { Video, VideoParticipant, VideoDialogue, VideoTranscript, VideoScene } from './video.schema';
6
+ import { Query } from '../schema'; // Assuming the Query schema is located in '../schema'
7
+
8
+ export const z = zod;
9
+ export const t = initTRPC.context<RouterContext>().create();
10
+ export const router = t.router;
11
+ export const procedure = t.procedure;
12
+
13
+ export const createRouter = () =>
14
+ router({
15
+ // Video endpoints
16
+ getVideo: procedure
17
+ .use(hasRole('guest', t))
18
+ .use(customErrorFormatter(t))
19
+ .input(z.object({ query: Query }))
20
+ .query(({ input, ctx }) => (ctx.app.service.Video.getVideo as any)(input, ctx)),
21
+
22
+ createVideo: procedure
23
+ .use(hasRole('admin', t))
24
+ .use(customErrorFormatter(t))
25
+ .input(z.object({ data: Video.omit({ id: true }) }))
26
+ .mutation(({ input, ctx }) => (ctx.app.service.Video.createVideo as any)(input, ctx)),
27
+
28
+ updateVideo: procedure
29
+ .use(hasRole('admin', t))
30
+ .use(customErrorFormatter(t))
31
+ .input(z.object({ query: Query, data: Video.partial() }))
32
+ .mutation(({ input, ctx }) => (ctx.app.service.Video.updateVideo as any)(input, ctx)),
33
+
34
+ deleteVideo: procedure
35
+ .use(hasRole('admin', t))
36
+ .use(customErrorFormatter(t))
37
+ .input(z.object({ query: Query }))
38
+ .mutation(({ input, ctx }) => (ctx.app.service.Video.deleteVideo as any)(input, ctx)),
39
+
40
+ // Video Participant endpoints
41
+ getVideoParticipant: procedure
42
+ .use(hasRole('guest', t))
43
+ .use(customErrorFormatter(t))
44
+ .input(z.object({ query: Query }))
45
+ .query(({ input, ctx }) => (ctx.app.service.Video.getVideoParticipant as any)(input, ctx)),
46
+
47
+ createVideoParticipant: procedure
48
+ .use(hasRole('admin', t))
49
+ .use(customErrorFormatter(t))
50
+ .input(z.object({ data: VideoParticipant.omit({ id: true }) }))
51
+ .mutation(({ input, ctx }) => (ctx.app.service.Video.createVideoParticipant as any)(input, ctx)),
52
+
53
+ updateVideoParticipant: procedure
54
+ .use(hasRole('admin', t))
55
+ .use(customErrorFormatter(t))
56
+ .input(z.object({ query: Query, data: VideoParticipant.partial() }))
57
+ .mutation(({ input, ctx }) => (ctx.app.service.Video.updateVideoParticipant as any)(input, ctx)),
58
+
59
+ deleteVideoParticipant: procedure
60
+ .use(hasRole('admin', t))
61
+ .use(customErrorFormatter(t))
62
+ .input(z.object({ query: Query }))
63
+ .mutation(({ input, ctx }) => (ctx.app.service.Video.deleteVideoParticipant as any)(input, ctx)),
64
+
65
+ // Video Dialogue endpoints
66
+ getVideoDialogue: procedure
67
+ .use(hasRole('guest', t))
68
+ .use(customErrorFormatter(t))
69
+ .input(z.object({ query: Query }))
70
+ .query(({ input, ctx }) => (ctx.app.service.Video.getVideoDialogue as any)(input, ctx)),
71
+
72
+ createVideoDialogue: procedure
73
+ .use(hasRole('admin', t))
74
+ .use(customErrorFormatter(t))
75
+ .input(z.object({ data: VideoDialogue.omit({ id: true }) }))
76
+ .mutation(({ input, ctx }) => (ctx.app.service.Video.createVideoDialogue as any)(input, ctx)),
77
+
78
+ updateVideoDialogue: procedure
79
+ .use(hasRole('admin', t))
80
+ .use(customErrorFormatter(t))
81
+ .input(z.object({ query: Query, data: VideoDialogue.partial() }))
82
+ .mutation(({ input, ctx }) => (ctx.app.service.Video.updateVideoDialogue as any)(input, ctx)),
83
+
84
+ deleteVideoDialogue: procedure
85
+ .use(hasRole('admin', t))
86
+ .use(customErrorFormatter(t))
87
+ .input(z.object({ query: Query }))
88
+ .mutation(({ input, ctx }) => (ctx.app.service.Video.deleteVideoDialogue as any)(input, ctx)),
89
+
90
+ // Video Transcript endpoints
91
+ getVideoTranscript: procedure
92
+ .use(hasRole('guest', t))
93
+ .use(customErrorFormatter(t))
94
+ .input(z.object({ query: Query }))
95
+ .query(({ input, ctx }) => (ctx.app.service.Video.getVideoTranscript as any)(input, ctx)),
96
+
97
+ createVideoTranscript: procedure
98
+ .use(hasRole('admin', t))
99
+ .use(customErrorFormatter(t))
100
+ .input(z.object({ data: VideoTranscript.omit({ id: true }) }))
101
+ .mutation(({ input, ctx }) => (ctx.app.service.Video.createVideoTranscript as any)(input, ctx)),
102
+
103
+ updateVideoTranscript: procedure
104
+ .use(hasRole('admin', t))
105
+ .use(customErrorFormatter(t))
106
+ .input(z.object({ query: Query, data: VideoTranscript.partial() }))
107
+ .mutation(({ input, ctx }) => (ctx.app.service.Video.updateVideoTranscript as any)(input, ctx)),
108
+
109
+ deleteVideoTranscript: procedure
110
+ .use(hasRole('admin', t))
111
+ .use(customErrorFormatter(t))
112
+ .input(z.object({ query: Query }))
113
+ .mutation(({ input, ctx }) => (ctx.app.service.Video.deleteVideoTranscript as any)(input, ctx)),
114
+
115
+ // Video Scene endpoints
116
+ getVideoScene: procedure
117
+ .use(hasRole('guest', t))
118
+ .use(customErrorFormatter(t))
119
+ .input(z.object({ query: Query }))
120
+ .query(({ input, ctx }) => (ctx.app.service.Video.getVideoScene as any)(input, ctx)),
121
+
122
+ createVideoScene: procedure
123
+ .use(hasRole('admin', t))
124
+ .use(customErrorFormatter(t))
125
+ .input(z.object({ data: VideoScene.omit({ id: true }) }))
126
+ .mutation(({ input, ctx }) => (ctx.app.service.Video.createVideoScene as any)(input, ctx)),
127
+
128
+ updateVideoScene: procedure
129
+ .use(hasRole('admin', t))
130
+ .use(customErrorFormatter(t))
131
+ .input(z.object({ query: Query, data: VideoScene.partial() }))
132
+ .mutation(({ input, ctx }) => (ctx.app.service.Video.updateVideoScene as any)(input, ctx)),
133
+
134
+ deleteVideoScene: procedure
135
+ .use(hasRole('admin', t))
136
+ .use(customErrorFormatter(t))
137
+ .input(z.object({ query: Query }))
138
+ .mutation(({ input, ctx }) => (ctx.app.service.Video.deleteVideoScene as any)(input, ctx)),
139
+ });
140
+
141
+ export type Router = ReturnType<typeof createRouter>;
142
+ export type RouterInput = inferRouterInputs<Router>;
143
+ export type RouterOutput = inferRouterOutputs<Router>;
@@ -0,0 +1,46 @@
1
+ import { z, ObjectId, Entity } from '../schema';
2
+
3
+ export const Video = Entity.merge(
4
+ z.object({
5
+ youtubeId: z.string().min(1),
6
+ url: z.string().url(),
7
+ title: z.string().min(1),
8
+ description: z.string().optional(),
9
+ duration: z.number().min(0).optional(),
10
+ // publishedAt: z.date().optional(),
11
+ })
12
+ );
13
+
14
+ export const VideoParticipant = Entity.merge(
15
+ z.object({
16
+ videoId: ObjectId, // Reference to the associated Video
17
+ profileId: ObjectId.optional(), // Reference to a participant profile
18
+ role: z.enum(['Host', 'Contributor', 'Guest']).optional(),
19
+ })
20
+ );
21
+
22
+ export const VideoDialogue = Entity.merge(
23
+ z.object({
24
+ videoId: ObjectId, // Reference to the associated Video
25
+ participantId: ObjectId, // Reference to the VideoParticipant
26
+ text: z.string().min(1),
27
+ timestamp: z.string().regex(/^\d{2}:\d{2}:\d{2}$/), // Format HH:MM:SS
28
+ })
29
+ );
30
+
31
+ export const VideoTranscript = Entity.merge(
32
+ z.object({
33
+ videoId: ObjectId, // Reference to the associated Video
34
+ transcript: z.array(VideoDialogue), // Array of dialogues
35
+ summary: z.string().optional(),
36
+ })
37
+ );
38
+
39
+ export const VideoScene = Entity.merge(
40
+ z.object({
41
+ videoId: ObjectId, // Reference to the associated Video
42
+ startTime: z.string().regex(/^\d{2}:\d{2}:\d{2}$/), // Format HH:MM:SS
43
+ endTime: z.string().regex(/^\d{2}:\d{2}:\d{2}$/), // Format HH:MM:SS
44
+ description: z.string().optional(),
45
+ })
46
+ );
@@ -0,0 +1,32 @@
1
+ import { z } from 'zod';
2
+ import * as schema from './video.schema';
3
+ import { Document, Model } from '@arken/node/mongo';
4
+ import type { RouterContext } from '../types';
5
+ import type { inferRouterInputs, inferRouterOutputs } from '@trpc/server';
6
+ import type { Router } from './video.router';
7
+
8
+ export type * from './video.router';
9
+ export type { RouterContext };
10
+
11
+ export type Video = z.infer<typeof schema.Video>;
12
+ export type VideoParticipant = z.infer<typeof schema.VideoParticipant>;
13
+ export type VideoDialogue = z.infer<typeof schema.VideoDialogue>;
14
+ export type VideoTranscript = z.infer<typeof schema.VideoTranscript>;
15
+ export type VideoScene = z.infer<typeof schema.VideoScene>;
16
+
17
+ export type VideoDocument = Video & Document;
18
+ export type VideoParticipantDocument = VideoParticipant & Document;
19
+ export type VideoDialogueDocument = VideoDialogue & Document;
20
+ export type VideoTranscriptDocument = VideoTranscript & Document;
21
+ export type VideoSceneDocument = VideoScene & Document;
22
+
23
+ export type Mappings = {
24
+ Video: Model<VideoDocument>;
25
+ VideoParticipant: Model<VideoParticipantDocument>;
26
+ VideoDialogue: Model<VideoDialogueDocument>;
27
+ VideoTranscript: Model<VideoTranscriptDocument>;
28
+ VideoScene: Model<VideoSceneDocument>;
29
+ };
30
+
31
+ export type RouterInput = inferRouterInputs<Router>;
32
+ export type RouterOutput = inferRouterOutputs<Router>;