@goscribe/server 1.3.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.
- package/dist/context.d.ts +5 -1
- package/dist/lib/activity_human_description.d.ts +13 -0
- package/dist/lib/activity_human_description.js +221 -0
- package/dist/lib/activity_human_description.test.d.ts +1 -0
- package/dist/lib/activity_human_description.test.js +16 -0
- package/dist/lib/activity_log_service.d.ts +87 -0
- package/dist/lib/activity_log_service.js +276 -0
- package/dist/lib/activity_log_service.test.d.ts +1 -0
- package/dist/lib/activity_log_service.test.js +27 -0
- package/dist/lib/ai-session.d.ts +15 -2
- package/dist/lib/ai-session.js +147 -85
- package/dist/lib/constants.d.ts +13 -0
- package/dist/lib/constants.js +12 -0
- package/dist/lib/email.d.ts +11 -0
- package/dist/lib/email.js +193 -0
- package/dist/lib/env.d.ts +13 -0
- package/dist/lib/env.js +16 -0
- package/dist/lib/inference.d.ts +4 -1
- package/dist/lib/inference.js +3 -3
- package/dist/lib/logger.d.ts +4 -4
- package/dist/lib/logger.js +30 -8
- package/dist/lib/notification-service.d.ts +152 -0
- package/dist/lib/notification-service.js +473 -0
- package/dist/lib/notification-service.test.d.ts +1 -0
- package/dist/lib/notification-service.test.js +87 -0
- package/dist/lib/prisma.d.ts +2 -1
- package/dist/lib/prisma.js +5 -1
- package/dist/lib/pusher.d.ts +23 -0
- package/dist/lib/pusher.js +69 -5
- package/dist/lib/retry.d.ts +15 -0
- package/dist/lib/retry.js +37 -0
- package/dist/lib/storage.js +2 -2
- package/dist/lib/stripe.d.ts +9 -0
- package/dist/lib/stripe.js +36 -0
- package/dist/lib/subscription_service.d.ts +37 -0
- package/dist/lib/subscription_service.js +654 -0
- package/dist/lib/usage_service.d.ts +26 -0
- package/dist/lib/usage_service.js +59 -0
- package/dist/lib/worksheet-generation.d.ts +91 -0
- package/dist/lib/worksheet-generation.js +95 -0
- package/dist/lib/worksheet-generation.test.d.ts +1 -0
- package/dist/lib/worksheet-generation.test.js +20 -0
- package/dist/lib/workspace-access.d.ts +18 -0
- package/dist/lib/workspace-access.js +13 -0
- package/dist/routers/_app.d.ts +1349 -253
- package/dist/routers/_app.js +10 -0
- package/dist/routers/admin.d.ts +361 -0
- package/dist/routers/admin.js +633 -0
- package/dist/routers/annotations.d.ts +219 -0
- package/dist/routers/annotations.js +187 -0
- package/dist/routers/auth.d.ts +88 -7
- package/dist/routers/auth.js +339 -19
- package/dist/routers/chat.d.ts +6 -12
- package/dist/routers/copilot.d.ts +199 -0
- package/dist/routers/copilot.js +571 -0
- package/dist/routers/flashcards.d.ts +47 -81
- package/dist/routers/flashcards.js +143 -27
- package/dist/routers/members.d.ts +36 -7
- package/dist/routers/members.js +200 -19
- package/dist/routers/notifications.d.ts +99 -0
- package/dist/routers/notifications.js +127 -0
- package/dist/routers/payment.d.ts +89 -0
- package/dist/routers/payment.js +403 -0
- package/dist/routers/podcast.d.ts +8 -13
- package/dist/routers/podcast.js +54 -31
- package/dist/routers/studyguide.d.ts +1 -29
- package/dist/routers/studyguide.js +80 -71
- package/dist/routers/worksheets.d.ts +105 -38
- package/dist/routers/worksheets.js +258 -68
- package/dist/routers/workspace.d.ts +139 -60
- package/dist/routers/workspace.js +455 -315
- package/dist/scripts/purge-deleted-users.d.ts +1 -0
- package/dist/scripts/purge-deleted-users.js +149 -0
- package/dist/server.js +130 -10
- package/dist/services/flashcard-progress.service.d.ts +18 -66
- package/dist/services/flashcard-progress.service.js +51 -42
- package/dist/trpc.d.ts +20 -21
- package/dist/trpc.js +150 -1
- package/package.json +1 -1
package/dist/routers/_app.js
CHANGED
|
@@ -7,6 +7,11 @@ import { studyguide } from './studyguide.js';
|
|
|
7
7
|
import { podcast } from './podcast.js';
|
|
8
8
|
import { chat } from './chat.js';
|
|
9
9
|
import { members } from './members.js';
|
|
10
|
+
import { annotations } from './annotations.js';
|
|
11
|
+
import { admin } from './admin.js';
|
|
12
|
+
import { paymentRouter } from './payment.js';
|
|
13
|
+
import { copilot } from './copilot.js';
|
|
14
|
+
import { notifications } from './notifications.js';
|
|
10
15
|
export const appRouter = router({
|
|
11
16
|
auth,
|
|
12
17
|
workspace,
|
|
@@ -15,6 +20,11 @@ export const appRouter = router({
|
|
|
15
20
|
studyguide,
|
|
16
21
|
podcast,
|
|
17
22
|
chat,
|
|
23
|
+
annotations,
|
|
24
|
+
admin,
|
|
25
|
+
payment: paymentRouter,
|
|
26
|
+
copilot,
|
|
27
|
+
notifications,
|
|
18
28
|
// Public member endpoints (for invitation acceptance)
|
|
19
29
|
member: router({
|
|
20
30
|
acceptInvite: members.acceptInvite,
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
export declare const admin: import("@trpc/server").TRPCBuiltRouter<{
|
|
2
|
+
ctx: import("../context.js").Context;
|
|
3
|
+
meta: object;
|
|
4
|
+
errorShape: {
|
|
5
|
+
data: {
|
|
6
|
+
zodError: string | null;
|
|
7
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
|
|
8
|
+
httpStatus: number;
|
|
9
|
+
path?: string;
|
|
10
|
+
stack?: string;
|
|
11
|
+
};
|
|
12
|
+
message: string;
|
|
13
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
|
|
14
|
+
};
|
|
15
|
+
transformer: true;
|
|
16
|
+
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
17
|
+
getSystemStats: import("@trpc/server").TRPCQueryProcedure<{
|
|
18
|
+
input: void;
|
|
19
|
+
output: {
|
|
20
|
+
totalUsers: number;
|
|
21
|
+
totalWorkspaces: number;
|
|
22
|
+
totalSubscriptions: number;
|
|
23
|
+
revenue: number;
|
|
24
|
+
subscriptionRevenue: number;
|
|
25
|
+
topupRevenue: number;
|
|
26
|
+
};
|
|
27
|
+
meta: object;
|
|
28
|
+
}>;
|
|
29
|
+
listUsers: import("@trpc/server").TRPCQueryProcedure<{
|
|
30
|
+
input: {
|
|
31
|
+
page?: number | undefined;
|
|
32
|
+
pageSize?: number | undefined;
|
|
33
|
+
search?: string | undefined;
|
|
34
|
+
emailVerified?: "all" | "yes" | "no" | undefined;
|
|
35
|
+
joinedFrom?: unknown;
|
|
36
|
+
joinedTo?: unknown;
|
|
37
|
+
};
|
|
38
|
+
output: {
|
|
39
|
+
users: any[];
|
|
40
|
+
page: number;
|
|
41
|
+
pageSize: number;
|
|
42
|
+
totalCount: number;
|
|
43
|
+
totalPages: number;
|
|
44
|
+
};
|
|
45
|
+
meta: object;
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* Paginated global invoice list for admin Invoices page (search + filters).
|
|
49
|
+
*/
|
|
50
|
+
listInvoices: import("@trpc/server").TRPCQueryProcedure<{
|
|
51
|
+
input: {
|
|
52
|
+
page?: number | undefined;
|
|
53
|
+
pageSize?: number | undefined;
|
|
54
|
+
search?: string | undefined;
|
|
55
|
+
status?: string | undefined;
|
|
56
|
+
type?: "SUBSCRIPTION" | "TOPUP" | undefined;
|
|
57
|
+
userId?: string | undefined;
|
|
58
|
+
from?: unknown;
|
|
59
|
+
to?: unknown;
|
|
60
|
+
};
|
|
61
|
+
output: {
|
|
62
|
+
items: any;
|
|
63
|
+
page: number;
|
|
64
|
+
pageSize: number;
|
|
65
|
+
totalCount: any;
|
|
66
|
+
totalPages: number;
|
|
67
|
+
};
|
|
68
|
+
meta: object;
|
|
69
|
+
}>;
|
|
70
|
+
listWorkspaces: import("@trpc/server").TRPCQueryProcedure<{
|
|
71
|
+
input: {
|
|
72
|
+
limit?: number | undefined;
|
|
73
|
+
cursor?: string | null | undefined;
|
|
74
|
+
};
|
|
75
|
+
output: {
|
|
76
|
+
workspaces: ({
|
|
77
|
+
owner: {
|
|
78
|
+
name: string | null;
|
|
79
|
+
email: string | null;
|
|
80
|
+
};
|
|
81
|
+
} & {
|
|
82
|
+
id: string;
|
|
83
|
+
createdAt: Date;
|
|
84
|
+
updatedAt: Date;
|
|
85
|
+
title: string;
|
|
86
|
+
description: string | null;
|
|
87
|
+
ownerId: string;
|
|
88
|
+
color: string;
|
|
89
|
+
markerColor: string | null;
|
|
90
|
+
icon: string;
|
|
91
|
+
folderId: string | null;
|
|
92
|
+
fileBeingAnalyzed: boolean;
|
|
93
|
+
analysisProgress: import("@prisma/client/runtime/library").JsonValue | null;
|
|
94
|
+
needsAnalysis: boolean;
|
|
95
|
+
})[];
|
|
96
|
+
nextCursor: string | undefined;
|
|
97
|
+
};
|
|
98
|
+
meta: object;
|
|
99
|
+
}>;
|
|
100
|
+
updateUserRole: import("@trpc/server").TRPCMutationProcedure<{
|
|
101
|
+
input: {
|
|
102
|
+
userId: string;
|
|
103
|
+
roleName: string;
|
|
104
|
+
};
|
|
105
|
+
output: {
|
|
106
|
+
name: string | null;
|
|
107
|
+
id: string;
|
|
108
|
+
email: string | null;
|
|
109
|
+
emailVerified: Date | null;
|
|
110
|
+
passwordHash: string | null;
|
|
111
|
+
createdAt: Date;
|
|
112
|
+
updatedAt: Date;
|
|
113
|
+
fileAssetId: string | null;
|
|
114
|
+
roleId: string | null;
|
|
115
|
+
deletedAt: Date | null;
|
|
116
|
+
stripe_customer_id: string | null;
|
|
117
|
+
};
|
|
118
|
+
meta: object;
|
|
119
|
+
}>;
|
|
120
|
+
listPlans: import("@trpc/server").TRPCQueryProcedure<{
|
|
121
|
+
input: void;
|
|
122
|
+
output: ({
|
|
123
|
+
limit: {
|
|
124
|
+
id: string;
|
|
125
|
+
createdAt: Date;
|
|
126
|
+
updatedAt: Date;
|
|
127
|
+
planId: string;
|
|
128
|
+
maxStorageBytes: bigint;
|
|
129
|
+
maxWorksheets: number;
|
|
130
|
+
maxFlashcards: number;
|
|
131
|
+
maxPodcasts: number;
|
|
132
|
+
maxStudyGuides: number;
|
|
133
|
+
} | null;
|
|
134
|
+
} & {
|
|
135
|
+
name: string;
|
|
136
|
+
id: string;
|
|
137
|
+
createdAt: Date;
|
|
138
|
+
type: string;
|
|
139
|
+
description: string | null;
|
|
140
|
+
interval: string | null;
|
|
141
|
+
active: boolean;
|
|
142
|
+
price: number;
|
|
143
|
+
stripePriceId: string;
|
|
144
|
+
})[];
|
|
145
|
+
meta: object;
|
|
146
|
+
}>;
|
|
147
|
+
upsertPlan: import("@trpc/server").TRPCMutationProcedure<{
|
|
148
|
+
input: {
|
|
149
|
+
name: string;
|
|
150
|
+
type: string;
|
|
151
|
+
price: number;
|
|
152
|
+
interval: string | null;
|
|
153
|
+
limits: {
|
|
154
|
+
maxStorageBytes: number;
|
|
155
|
+
maxWorksheets: number;
|
|
156
|
+
maxFlashcards: number;
|
|
157
|
+
maxPodcasts?: number | undefined;
|
|
158
|
+
maxStudyGuides?: number | undefined;
|
|
159
|
+
};
|
|
160
|
+
id?: string | undefined;
|
|
161
|
+
description?: string | undefined;
|
|
162
|
+
stripePriceId?: string | undefined;
|
|
163
|
+
active?: boolean | undefined;
|
|
164
|
+
};
|
|
165
|
+
output: {
|
|
166
|
+
name: string;
|
|
167
|
+
id: string;
|
|
168
|
+
createdAt: Date;
|
|
169
|
+
type: string;
|
|
170
|
+
description: string | null;
|
|
171
|
+
interval: string | null;
|
|
172
|
+
active: boolean;
|
|
173
|
+
price: number;
|
|
174
|
+
stripePriceId: string;
|
|
175
|
+
};
|
|
176
|
+
meta: object;
|
|
177
|
+
}>;
|
|
178
|
+
deletePlan: import("@trpc/server").TRPCMutationProcedure<{
|
|
179
|
+
input: {
|
|
180
|
+
id: string;
|
|
181
|
+
};
|
|
182
|
+
output: {
|
|
183
|
+
success: boolean;
|
|
184
|
+
message: string;
|
|
185
|
+
};
|
|
186
|
+
meta: object;
|
|
187
|
+
}>;
|
|
188
|
+
getUserInvoices: import("@trpc/server").TRPCQueryProcedure<{
|
|
189
|
+
input: {
|
|
190
|
+
userId: string;
|
|
191
|
+
limit?: number | undefined;
|
|
192
|
+
};
|
|
193
|
+
output: any;
|
|
194
|
+
meta: object;
|
|
195
|
+
}>;
|
|
196
|
+
getUserDetailedInfo: import("@trpc/server").TRPCQueryProcedure<{
|
|
197
|
+
input: {
|
|
198
|
+
userId: string;
|
|
199
|
+
};
|
|
200
|
+
output: {
|
|
201
|
+
totalSpent: number;
|
|
202
|
+
purchasedCredits: {
|
|
203
|
+
type: import("@prisma/client").$Enums.ArtifactType;
|
|
204
|
+
amount: number;
|
|
205
|
+
}[];
|
|
206
|
+
profilePicture: string | null;
|
|
207
|
+
role: {
|
|
208
|
+
name: string;
|
|
209
|
+
id: string;
|
|
210
|
+
} | null;
|
|
211
|
+
_count: {
|
|
212
|
+
artifacts: number;
|
|
213
|
+
workspaces: number;
|
|
214
|
+
};
|
|
215
|
+
subscriptions: ({
|
|
216
|
+
plan: {
|
|
217
|
+
name: string;
|
|
218
|
+
id: string;
|
|
219
|
+
createdAt: Date;
|
|
220
|
+
type: string;
|
|
221
|
+
description: string | null;
|
|
222
|
+
interval: string | null;
|
|
223
|
+
active: boolean;
|
|
224
|
+
price: number;
|
|
225
|
+
stripePriceId: string;
|
|
226
|
+
};
|
|
227
|
+
} & {
|
|
228
|
+
id: string;
|
|
229
|
+
createdAt: Date;
|
|
230
|
+
userId: string;
|
|
231
|
+
planId: string;
|
|
232
|
+
stripeSubscriptionId: string;
|
|
233
|
+
stripeCustomerId: string | null;
|
|
234
|
+
status: string;
|
|
235
|
+
currentPeriodStart: Date;
|
|
236
|
+
currentPeriodEnd: Date;
|
|
237
|
+
cancelAt: Date | null;
|
|
238
|
+
canceledAt: Date | null;
|
|
239
|
+
})[];
|
|
240
|
+
name: string | null;
|
|
241
|
+
id: string;
|
|
242
|
+
email: string | null;
|
|
243
|
+
emailVerified: Date | null;
|
|
244
|
+
passwordHash: string | null;
|
|
245
|
+
createdAt: Date;
|
|
246
|
+
updatedAt: Date;
|
|
247
|
+
fileAssetId: string | null;
|
|
248
|
+
roleId: string | null;
|
|
249
|
+
deletedAt: Date | null;
|
|
250
|
+
stripe_customer_id: string | null;
|
|
251
|
+
};
|
|
252
|
+
meta: object;
|
|
253
|
+
}>;
|
|
254
|
+
debugInvoices: import("@trpc/server").TRPCQueryProcedure<{
|
|
255
|
+
input: void;
|
|
256
|
+
output: {
|
|
257
|
+
count: any;
|
|
258
|
+
all: any;
|
|
259
|
+
};
|
|
260
|
+
meta: object;
|
|
261
|
+
}>;
|
|
262
|
+
listResourcePrices: import("@trpc/server").TRPCQueryProcedure<{
|
|
263
|
+
input: void;
|
|
264
|
+
output: {
|
|
265
|
+
id: string;
|
|
266
|
+
updatedAt: Date;
|
|
267
|
+
resourceType: import("@prisma/client").$Enums.ArtifactType;
|
|
268
|
+
priceCents: number;
|
|
269
|
+
}[];
|
|
270
|
+
meta: object;
|
|
271
|
+
}>;
|
|
272
|
+
upsertResourcePrice: import("@trpc/server").TRPCMutationProcedure<{
|
|
273
|
+
input: {
|
|
274
|
+
resourceType: "STUDY_GUIDE" | "FLASHCARD_SET" | "WORKSHEET" | "MEETING_SUMMARY" | "PODCAST_EPISODE" | "STORAGE";
|
|
275
|
+
priceCents: number;
|
|
276
|
+
};
|
|
277
|
+
output: {
|
|
278
|
+
id: string;
|
|
279
|
+
updatedAt: Date;
|
|
280
|
+
resourceType: import("@prisma/client").$Enums.ArtifactType;
|
|
281
|
+
priceCents: number;
|
|
282
|
+
};
|
|
283
|
+
meta: object;
|
|
284
|
+
}>;
|
|
285
|
+
listRecentInvoices: import("@trpc/server").TRPCQueryProcedure<{
|
|
286
|
+
input: {
|
|
287
|
+
limit?: number | undefined;
|
|
288
|
+
};
|
|
289
|
+
output: any;
|
|
290
|
+
meta: object;
|
|
291
|
+
}>;
|
|
292
|
+
activityList: import("@trpc/server").TRPCQueryProcedure<{
|
|
293
|
+
input: {
|
|
294
|
+
from?: unknown;
|
|
295
|
+
to?: unknown;
|
|
296
|
+
actorUserId?: string | undefined;
|
|
297
|
+
workspaceId?: string | undefined;
|
|
298
|
+
category?: "AUTH" | "WORKSPACE" | "BILLING" | "ADMIN" | "CONTENT" | "SYSTEM" | undefined;
|
|
299
|
+
status?: "SUCCESS" | "FAILURE" | undefined;
|
|
300
|
+
search?: string | undefined;
|
|
301
|
+
page?: number | undefined;
|
|
302
|
+
limit?: number | undefined;
|
|
303
|
+
};
|
|
304
|
+
output: {
|
|
305
|
+
items: {
|
|
306
|
+
id: string;
|
|
307
|
+
createdAt: Date;
|
|
308
|
+
action: string;
|
|
309
|
+
description: string;
|
|
310
|
+
category: import("@prisma/client").$Enums.ActivityLogCategory;
|
|
311
|
+
trpcPath: string | null;
|
|
312
|
+
status: import("@prisma/client").$Enums.ActivityLogStatus;
|
|
313
|
+
durationMs: number;
|
|
314
|
+
errorCode: string | null;
|
|
315
|
+
ipAddress: string | null;
|
|
316
|
+
actor: {
|
|
317
|
+
name: string | null;
|
|
318
|
+
id: string;
|
|
319
|
+
email: string | null;
|
|
320
|
+
} | null;
|
|
321
|
+
workspace: {
|
|
322
|
+
id: string;
|
|
323
|
+
title: string;
|
|
324
|
+
} | null;
|
|
325
|
+
metadata: import("@prisma/client/runtime/library").JsonValue;
|
|
326
|
+
}[];
|
|
327
|
+
page: number;
|
|
328
|
+
pageSize: number;
|
|
329
|
+
totalCount: number;
|
|
330
|
+
totalPages: number;
|
|
331
|
+
};
|
|
332
|
+
meta: object;
|
|
333
|
+
}>;
|
|
334
|
+
activityExportCsv: import("@trpc/server").TRPCQueryProcedure<{
|
|
335
|
+
input: {
|
|
336
|
+
from?: unknown;
|
|
337
|
+
to?: unknown;
|
|
338
|
+
actorUserId?: string | undefined;
|
|
339
|
+
workspaceId?: string | undefined;
|
|
340
|
+
category?: "AUTH" | "WORKSPACE" | "BILLING" | "ADMIN" | "CONTENT" | "SYSTEM" | undefined;
|
|
341
|
+
status?: "SUCCESS" | "FAILURE" | undefined;
|
|
342
|
+
search?: string | undefined;
|
|
343
|
+
maxRows?: number | undefined;
|
|
344
|
+
};
|
|
345
|
+
output: {
|
|
346
|
+
csv: string;
|
|
347
|
+
count: number;
|
|
348
|
+
};
|
|
349
|
+
meta: object;
|
|
350
|
+
}>;
|
|
351
|
+
/** Deletes rows older than ACTIVITY_LOG_RETENTION_DAYS (default 365). Run manually or via cron. */
|
|
352
|
+
activityPurgeRetention: import("@trpc/server").TRPCMutationProcedure<{
|
|
353
|
+
input: void;
|
|
354
|
+
output: {
|
|
355
|
+
deleted: number;
|
|
356
|
+
retentionDays: number;
|
|
357
|
+
cutoff: Date;
|
|
358
|
+
};
|
|
359
|
+
meta: object;
|
|
360
|
+
}>;
|
|
361
|
+
}>>;
|