@goscribe/server 1.2.0 → 1.3.1

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 (126) hide show
  1. package/check-difficulty.cjs +14 -0
  2. package/check-questions.cjs +14 -0
  3. package/db-summary.cjs +22 -0
  4. package/dist/context.d.ts +5 -1
  5. package/dist/lib/activity_human_description.d.ts +13 -0
  6. package/dist/lib/activity_human_description.js +221 -0
  7. package/dist/lib/activity_human_description.test.d.ts +1 -0
  8. package/dist/lib/activity_human_description.test.js +16 -0
  9. package/dist/lib/activity_log_service.d.ts +87 -0
  10. package/dist/lib/activity_log_service.js +276 -0
  11. package/dist/lib/activity_log_service.test.d.ts +1 -0
  12. package/dist/lib/activity_log_service.test.js +27 -0
  13. package/dist/lib/ai-session.d.ts +15 -2
  14. package/dist/lib/ai-session.js +147 -85
  15. package/dist/lib/constants.d.ts +13 -0
  16. package/dist/lib/constants.js +12 -0
  17. package/dist/lib/email.d.ts +11 -0
  18. package/dist/lib/email.js +193 -0
  19. package/dist/lib/env.d.ts +13 -0
  20. package/dist/lib/env.js +16 -0
  21. package/dist/lib/inference.d.ts +4 -1
  22. package/dist/lib/inference.js +3 -3
  23. package/dist/lib/logger.d.ts +4 -4
  24. package/dist/lib/logger.js +30 -8
  25. package/dist/lib/notification-service.d.ts +152 -0
  26. package/dist/lib/notification-service.js +473 -0
  27. package/dist/lib/notification-service.test.d.ts +1 -0
  28. package/dist/lib/notification-service.test.js +87 -0
  29. package/dist/lib/prisma.d.ts +2 -1
  30. package/dist/lib/prisma.js +5 -1
  31. package/dist/lib/pusher.d.ts +23 -0
  32. package/dist/lib/pusher.js +69 -5
  33. package/dist/lib/retry.d.ts +15 -0
  34. package/dist/lib/retry.js +37 -0
  35. package/dist/lib/storage.js +2 -2
  36. package/dist/lib/stripe.d.ts +9 -0
  37. package/dist/lib/stripe.js +36 -0
  38. package/dist/lib/subscription_service.d.ts +37 -0
  39. package/dist/lib/subscription_service.js +654 -0
  40. package/dist/lib/usage_service.d.ts +26 -0
  41. package/dist/lib/usage_service.js +59 -0
  42. package/dist/lib/worksheet-generation.d.ts +91 -0
  43. package/dist/lib/worksheet-generation.js +95 -0
  44. package/dist/lib/worksheet-generation.test.d.ts +1 -0
  45. package/dist/lib/worksheet-generation.test.js +20 -0
  46. package/dist/lib/workspace-access.d.ts +18 -0
  47. package/dist/lib/workspace-access.js +13 -0
  48. package/dist/routers/_app.d.ts +1349 -253
  49. package/dist/routers/_app.js +10 -0
  50. package/dist/routers/admin.d.ts +361 -0
  51. package/dist/routers/admin.js +633 -0
  52. package/dist/routers/annotations.d.ts +219 -0
  53. package/dist/routers/annotations.js +187 -0
  54. package/dist/routers/auth.d.ts +88 -7
  55. package/dist/routers/auth.js +339 -19
  56. package/dist/routers/chat.d.ts +6 -12
  57. package/dist/routers/copilot.d.ts +199 -0
  58. package/dist/routers/copilot.js +571 -0
  59. package/dist/routers/flashcards.d.ts +47 -81
  60. package/dist/routers/flashcards.js +143 -27
  61. package/dist/routers/members.d.ts +36 -7
  62. package/dist/routers/members.js +200 -19
  63. package/dist/routers/notifications.d.ts +99 -0
  64. package/dist/routers/notifications.js +127 -0
  65. package/dist/routers/payment.d.ts +89 -0
  66. package/dist/routers/payment.js +403 -0
  67. package/dist/routers/podcast.d.ts +8 -13
  68. package/dist/routers/podcast.js +54 -31
  69. package/dist/routers/studyguide.d.ts +1 -29
  70. package/dist/routers/studyguide.js +80 -71
  71. package/dist/routers/worksheets.d.ts +105 -38
  72. package/dist/routers/worksheets.js +258 -68
  73. package/dist/routers/workspace.d.ts +139 -60
  74. package/dist/routers/workspace.js +455 -315
  75. package/dist/scripts/purge-deleted-users.d.ts +1 -0
  76. package/dist/scripts/purge-deleted-users.js +149 -0
  77. package/dist/server.js +130 -10
  78. package/dist/services/flashcard-progress.service.d.ts +18 -66
  79. package/dist/services/flashcard-progress.service.js +51 -42
  80. package/dist/trpc.d.ts +20 -21
  81. package/dist/trpc.js +150 -1
  82. package/mcq-test.cjs +36 -0
  83. package/package.json +9 -2
  84. package/prisma/migrations/20260413143206_init/migration.sql +873 -0
  85. package/prisma/schema.prisma +471 -324
  86. package/src/context.ts +4 -1
  87. package/src/lib/activity_human_description.test.ts +28 -0
  88. package/src/lib/activity_human_description.ts +239 -0
  89. package/src/lib/activity_log_service.test.ts +37 -0
  90. package/src/lib/activity_log_service.ts +353 -0
  91. package/src/lib/ai-session.ts +79 -51
  92. package/src/lib/email.ts +213 -29
  93. package/src/lib/env.ts +23 -6
  94. package/src/lib/inference.ts +2 -2
  95. package/src/lib/notification-service.test.ts +106 -0
  96. package/src/lib/notification-service.ts +677 -0
  97. package/src/lib/prisma.ts +6 -1
  98. package/src/lib/pusher.ts +86 -2
  99. package/src/lib/stripe.ts +39 -0
  100. package/src/lib/subscription_service.ts +722 -0
  101. package/src/lib/usage_service.ts +74 -0
  102. package/src/lib/worksheet-generation.test.ts +31 -0
  103. package/src/lib/worksheet-generation.ts +139 -0
  104. package/src/routers/_app.ts +9 -0
  105. package/src/routers/admin.ts +710 -0
  106. package/src/routers/annotations.ts +41 -0
  107. package/src/routers/auth.ts +338 -28
  108. package/src/routers/copilot.ts +719 -0
  109. package/src/routers/flashcards.ts +201 -68
  110. package/src/routers/members.ts +280 -80
  111. package/src/routers/notifications.ts +142 -0
  112. package/src/routers/payment.ts +448 -0
  113. package/src/routers/podcast.ts +112 -83
  114. package/src/routers/studyguide.ts +12 -0
  115. package/src/routers/worksheets.ts +289 -66
  116. package/src/routers/workspace.ts +329 -122
  117. package/src/scripts/purge-deleted-users.ts +167 -0
  118. package/src/server.ts +137 -11
  119. package/src/services/flashcard-progress.service.ts +49 -37
  120. package/src/trpc.ts +184 -5
  121. package/test-generate.js +30 -0
  122. package/test-ratio.cjs +9 -0
  123. package/zod-test.cjs +22 -0
  124. package/prisma/migrations/20250826124819_add_worksheet_difficulty_and_estimated_time/migration.sql +0 -213
  125. package/prisma/migrations/20250826133236_add_worksheet_question_progress/migration.sql +0 -31
  126. package/prisma/seed.mjs +0 -135
@@ -1,12 +1,5 @@
1
- import type { PrismaClient } from '@prisma/client';
2
1
  export declare const workspace: import("@trpc/server").TRPCBuiltRouter<{
3
- ctx: {
4
- db: PrismaClient<import("@prisma/client").Prisma.PrismaClientOptions, never, import("@prisma/client/runtime/library").DefaultArgs>;
5
- session: any;
6
- req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
7
- res: import("express").Response<any, Record<string, any>>;
8
- cookies: Record<string, string | undefined>;
9
- };
2
+ ctx: import("../context.js").Context;
10
3
  meta: object;
11
4
  errorShape: {
12
5
  data: {
@@ -30,10 +23,11 @@ export declare const workspace: import("@trpc/server").TRPCBuiltRouter<{
30
23
  id: string;
31
24
  createdAt: Date;
32
25
  updatedAt: Date;
33
- ownerId: string;
34
- color: string;
35
26
  title: string;
36
27
  description: string | null;
28
+ ownerId: string;
29
+ color: string;
30
+ markerColor: string | null;
37
31
  icon: string;
38
32
  folderId: string | null;
39
33
  fileBeingAnalyzed: boolean;
@@ -48,10 +42,53 @@ export declare const workspace: import("@trpc/server").TRPCBuiltRouter<{
48
42
  ownerId: string;
49
43
  parentId: string | null;
50
44
  color: string;
45
+ markerColor: string | null;
51
46
  }[];
52
47
  };
53
48
  meta: object;
54
49
  }>;
50
+ /**
51
+ * Fetches the entire directory tree for the user.
52
+ * Includes Folders, Workspaces (files), and Uploads (sub-files).
53
+ */
54
+ getTree: import("@trpc/server").TRPCQueryProcedure<{
55
+ input: void;
56
+ output: {
57
+ folders: {
58
+ name: string;
59
+ id: string;
60
+ createdAt: Date;
61
+ updatedAt: Date;
62
+ ownerId: string;
63
+ parentId: string | null;
64
+ color: string;
65
+ markerColor: string | null;
66
+ }[];
67
+ workspaces: ({
68
+ uploads: {
69
+ name: string;
70
+ id: string;
71
+ createdAt: Date;
72
+ mimeType: string;
73
+ }[];
74
+ } & {
75
+ id: string;
76
+ createdAt: Date;
77
+ updatedAt: Date;
78
+ title: string;
79
+ description: string | null;
80
+ ownerId: string;
81
+ color: string;
82
+ markerColor: string | null;
83
+ icon: string;
84
+ folderId: string | null;
85
+ fileBeingAnalyzed: boolean;
86
+ analysisProgress: import("@prisma/client/runtime/library").JsonValue | null;
87
+ needsAnalysis: boolean;
88
+ })[];
89
+ };
90
+ meta: object;
91
+ }>;
55
92
  create: import("@trpc/server").TRPCMutationProcedure<{
56
93
  input: {
57
94
  name: string;
@@ -62,10 +99,11 @@ export declare const workspace: import("@trpc/server").TRPCBuiltRouter<{
62
99
  id: string;
63
100
  createdAt: Date;
64
101
  updatedAt: Date;
65
- ownerId: string;
66
- color: string;
67
102
  title: string;
68
103
  description: string | null;
104
+ ownerId: string;
105
+ color: string;
106
+ markerColor: string | null;
69
107
  icon: string;
70
108
  folderId: string | null;
71
109
  fileBeingAnalyzed: boolean;
@@ -88,6 +126,7 @@ export declare const workspace: import("@trpc/server").TRPCBuiltRouter<{
88
126
  ownerId: string;
89
127
  parentId: string | null;
90
128
  color: string;
129
+ markerColor: string | null;
91
130
  };
92
131
  meta: object;
93
132
  }>;
@@ -95,7 +134,7 @@ export declare const workspace: import("@trpc/server").TRPCBuiltRouter<{
95
134
  input: {
96
135
  id: string;
97
136
  name?: string | undefined;
98
- color?: string | undefined;
137
+ markerColor?: string | null | undefined;
99
138
  };
100
139
  output: {
101
140
  name: string;
@@ -105,6 +144,7 @@ export declare const workspace: import("@trpc/server").TRPCBuiltRouter<{
105
144
  ownerId: string;
106
145
  parentId: string | null;
107
146
  color: string;
147
+ markerColor: string | null;
108
148
  };
109
149
  meta: object;
110
150
  }>;
@@ -120,6 +160,7 @@ export declare const workspace: import("@trpc/server").TRPCBuiltRouter<{
120
160
  ownerId: string;
121
161
  parentId: string | null;
122
162
  color: string;
163
+ markerColor: string | null;
123
164
  };
124
165
  meta: object;
125
166
  }>;
@@ -136,14 +177,32 @@ export declare const workspace: import("@trpc/server").TRPCBuiltRouter<{
136
177
  ownerId: string;
137
178
  parentId: string | null;
138
179
  color: string;
180
+ markerColor: string | null;
139
181
  } | null;
182
+ artifacts: {
183
+ id: string;
184
+ createdAt: Date;
185
+ updatedAt: Date;
186
+ workspaceId: string;
187
+ type: import("@prisma/client").$Enums.ArtifactType;
188
+ title: string;
189
+ isArchived: boolean;
190
+ difficulty: import("@prisma/client").$Enums.Difficulty | null;
191
+ estimatedTime: string | null;
192
+ createdById: string | null;
193
+ description: string | null;
194
+ generating: boolean;
195
+ generatingMetadata: import("@prisma/client/runtime/library").JsonValue | null;
196
+ worksheetConfig: import("@prisma/client/runtime/library").JsonValue | null;
197
+ imageObjectKey: string | null;
198
+ }[];
140
199
  uploads: {
141
200
  meta: import("@prisma/client/runtime/library").JsonValue | null;
142
201
  name: string;
143
202
  id: string;
144
203
  createdAt: Date;
145
- userId: string | null;
146
204
  workspaceId: string | null;
205
+ userId: string | null;
147
206
  mimeType: string;
148
207
  size: number;
149
208
  bucket: string | null;
@@ -152,30 +211,15 @@ export declare const workspace: import("@trpc/server").TRPCBuiltRouter<{
152
211
  checksum: string | null;
153
212
  aiTranscription: import("@prisma/client/runtime/library").JsonValue | null;
154
213
  }[];
155
- artifacts: {
156
- id: string;
157
- createdAt: Date;
158
- updatedAt: Date;
159
- title: string;
160
- description: string | null;
161
- workspaceId: string;
162
- type: import("@prisma/client").$Enums.ArtifactType;
163
- isArchived: boolean;
164
- generating: boolean;
165
- generatingMetadata: import("@prisma/client/runtime/library").JsonValue | null;
166
- difficulty: import("@prisma/client").$Enums.Difficulty | null;
167
- estimatedTime: string | null;
168
- imageObjectKey: string | null;
169
- createdById: string | null;
170
- }[];
171
214
  } & {
172
215
  id: string;
173
216
  createdAt: Date;
174
217
  updatedAt: Date;
175
- ownerId: string;
176
- color: string;
177
218
  title: string;
178
219
  description: string | null;
220
+ ownerId: string;
221
+ color: string;
222
+ markerColor: string | null;
179
223
  icon: string;
180
224
  folderId: string | null;
181
225
  fileBeingAnalyzed: boolean;
@@ -195,22 +239,42 @@ export declare const workspace: import("@trpc/server").TRPCBuiltRouter<{
195
239
  };
196
240
  meta: object;
197
241
  }>;
242
+ getStudyAnalytics: import("@trpc/server").TRPCQueryProcedure<{
243
+ input: void;
244
+ output: {
245
+ streak: number;
246
+ totalStudyDays: number;
247
+ weeklyActivity: boolean[];
248
+ flashcards: {
249
+ total: number;
250
+ mastered: number;
251
+ dueForReview: number;
252
+ };
253
+ worksheets: {
254
+ completed: number;
255
+ correct: number;
256
+ accuracy: number;
257
+ };
258
+ };
259
+ meta: object;
260
+ }>;
198
261
  update: import("@trpc/server").TRPCMutationProcedure<{
199
262
  input: {
200
263
  id: string;
201
264
  name?: string | undefined;
202
265
  description?: string | undefined;
203
- color?: string | undefined;
266
+ markerColor?: string | null | undefined;
204
267
  icon?: string | undefined;
205
268
  };
206
269
  output: {
207
270
  id: string;
208
271
  createdAt: Date;
209
272
  updatedAt: Date;
210
- ownerId: string;
211
- color: string;
212
273
  title: string;
213
274
  description: string | null;
275
+ ownerId: string;
276
+ color: string;
277
+ markerColor: string | null;
214
278
  icon: string;
215
279
  folderId: string | null;
216
280
  fileBeingAnalyzed: boolean;
@@ -239,6 +303,7 @@ export declare const workspace: import("@trpc/server").TRPCBuiltRouter<{
239
303
  ownerId: string;
240
304
  parentId: string | null;
241
305
  color: string;
306
+ markerColor: string | null;
242
307
  };
243
308
  parents: {
244
309
  name: string;
@@ -248,6 +313,7 @@ export declare const workspace: import("@trpc/server").TRPCBuiltRouter<{
248
313
  ownerId: string;
249
314
  parentId: string | null;
250
315
  color: string;
316
+ markerColor: string | null;
251
317
  }[];
252
318
  };
253
319
  meta: object;
@@ -261,10 +327,11 @@ export declare const workspace: import("@trpc/server").TRPCBuiltRouter<{
261
327
  id: string;
262
328
  createdAt: Date;
263
329
  updatedAt: Date;
264
- ownerId: string;
265
- color: string;
266
330
  title: string;
267
331
  description: string | null;
332
+ ownerId: string;
333
+ color: string;
334
+ markerColor: string | null;
268
335
  icon: string;
269
336
  folderId: string | null;
270
337
  fileBeingAnalyzed: boolean;
@@ -276,10 +343,11 @@ export declare const workspace: import("@trpc/server").TRPCBuiltRouter<{
276
343
  id: string;
277
344
  createdAt: Date;
278
345
  updatedAt: Date;
279
- ownerId: string;
280
- color: string;
281
346
  title: string;
282
347
  description: string | null;
348
+ ownerId: string;
349
+ color: string;
350
+ markerColor: string | null;
283
351
  icon: string;
284
352
  folderId: string | null;
285
353
  fileBeingAnalyzed: boolean;
@@ -360,32 +428,14 @@ export declare const workspace: import("@trpc/server").TRPCBuiltRouter<{
360
428
  search: import("@trpc/server").TRPCQueryProcedure<{
361
429
  input: {
362
430
  query: string;
431
+ color?: string | undefined;
363
432
  limit?: number | undefined;
364
433
  };
365
- output: {
366
- id: string;
367
- createdAt: Date;
368
- updatedAt: Date;
369
- ownerId: string;
370
- color: string;
371
- title: string;
372
- description: string | null;
373
- icon: string;
374
- folderId: string | null;
375
- fileBeingAnalyzed: boolean;
376
- analysisProgress: import("@prisma/client/runtime/library").JsonValue | null;
377
- needsAnalysis: boolean;
378
- }[];
434
+ output: any[];
379
435
  meta: object;
380
436
  }>;
381
437
  members: import("@trpc/server").TRPCBuiltRouter<{
382
- ctx: {
383
- db: PrismaClient<import("@prisma/client").Prisma.PrismaClientOptions, never, import("@prisma/client/runtime/library").DefaultArgs>;
384
- session: any;
385
- req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
386
- res: import("express").Response<any, Record<string, any>>;
387
- cookies: Record<string, string | undefined>;
388
- };
438
+ ctx: import("../context.js").Context;
389
439
  meta: object;
390
440
  errorShape: {
391
441
  data: {
@@ -466,6 +516,7 @@ export declare const workspace: import("@trpc/server").TRPCBuiltRouter<{
466
516
  token: string;
467
517
  };
468
518
  output: {
519
+ message?: string | undefined;
469
520
  workspaceId: string;
470
521
  workspaceTitle: string;
471
522
  role: string;
@@ -523,5 +574,33 @@ export declare const workspace: import("@trpc/server").TRPCBuiltRouter<{
523
574
  };
524
575
  meta: object;
525
576
  }>;
577
+ resendInvitation: import("@trpc/server").TRPCMutationProcedure<{
578
+ input: {
579
+ invitationId: string;
580
+ };
581
+ output: {
582
+ invitationId: string;
583
+ message: string;
584
+ };
585
+ meta: object;
586
+ }>;
587
+ getAllInvitationsDebug: import("@trpc/server").TRPCQueryProcedure<{
588
+ input: {
589
+ workspaceId: string;
590
+ };
591
+ output: {
592
+ id: string;
593
+ email: string;
594
+ createdAt: Date;
595
+ updatedAt: Date;
596
+ workspaceId: string;
597
+ role: string;
598
+ token: string;
599
+ invitedById: string;
600
+ acceptedAt: Date | null;
601
+ expiresAt: Date;
602
+ }[];
603
+ meta: object;
604
+ }>;
526
605
  }>>;
527
606
  }>>;