@orakl/protocol 0.1.0
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/LICENSE +662 -0
- package/dist/badges.d.ts +19 -0
- package/dist/badges.js +1 -0
- package/dist/emotes.d.ts +5 -0
- package/dist/emotes.js +62 -0
- package/dist/error-codes.d.ts +1 -0
- package/dist/error-codes.js +1 -0
- package/dist/game-answer-record.d.ts +31 -0
- package/dist/game-answer-record.js +1 -0
- package/dist/game.d.ts +83 -0
- package/dist/game.js +1 -0
- package/dist/game.settings.d.ts +91 -0
- package/dist/game.settings.js +61 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +13 -0
- package/dist/pages/app.schema.d.ts +544 -0
- package/dist/pages/app.schema.js +336 -0
- package/dist/pages/auth.schema.d.ts +25 -0
- package/dist/pages/auth.schema.js +23 -0
- package/dist/pages/common.schema.d.ts +27 -0
- package/dist/pages/common.schema.js +28 -0
- package/dist/pages/history.schema.d.ts +273 -0
- package/dist/pages/history.schema.js +210 -0
- package/dist/pages/quiz.schema.d.ts +150 -0
- package/dist/pages/quiz.schema.js +132 -0
- package/dist/player-safe-question.d.ts +13 -0
- package/dist/player-safe-question.js +1 -0
- package/dist/question.d.ts +6 -0
- package/dist/question.js +12 -0
- package/dist/question.schema.d.ts +494 -0
- package/dist/question.schema.js +132 -0
- package/dist/scoring.schema.d.ts +7 -0
- package/dist/scoring.schema.js +8 -0
- package/dist/solo-ws.d.ts +202 -0
- package/dist/solo-ws.js +4 -0
- package/dist/streak-flourish.d.ts +6 -0
- package/dist/streak-flourish.js +1 -0
- package/dist/wire/leaderboard.d.ts +6 -0
- package/dist/wire/leaderboard.js +1 -0
- package/dist/wire/question-bank.d.ts +23 -0
- package/dist/wire/question-bank.js +1 -0
- package/dist/wire/question-flags.d.ts +40 -0
- package/dist/wire/question-flags.js +1 -0
- package/dist/ws-game.schema.d.ts +75 -0
- package/dist/ws-game.schema.js +131 -0
- package/dist/ws-solo.schema.d.ts +31 -0
- package/dist/ws-solo.schema.js +57 -0
- package/dist/ws.d.ts +281 -0
- package/dist/ws.js +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { MediaTypeSchema, QuestionSourceSchema } from "../question.schema.js";
|
|
3
|
+
import { ThemeModeSchema, UserPowerSchema, UserRoleSchema, } from "./common.schema.js";
|
|
4
|
+
/** Page-load response bodies for `src/api/routes/pages.ts`. */
|
|
5
|
+
/** A JSON array, decoded mutable — Effect's `Schema.Array` types its `.Type`
|
|
6
|
+
* as a `ReadonlyArray`, which every consumer here expects as a plain array. */
|
|
7
|
+
function Arr(item) {
|
|
8
|
+
return Schema.mutable(Schema.Array(item));
|
|
9
|
+
}
|
|
10
|
+
/** Body of `GET /api/pages/home`. */
|
|
11
|
+
export const HomePageSchema = Schema.Struct({
|
|
12
|
+
isLoggedIn: Schema.Boolean,
|
|
13
|
+
isCurator: Schema.Boolean,
|
|
14
|
+
host: Schema.NullOr(Schema.Struct({
|
|
15
|
+
badge: Schema.NullOr(Schema.String),
|
|
16
|
+
open: Schema.Boolean,
|
|
17
|
+
})),
|
|
18
|
+
});
|
|
19
|
+
/** Body of `POST /api/pages/billing/return`: the route to land the member on. */
|
|
20
|
+
export const BillingReturnPageSchema = Schema.Struct({
|
|
21
|
+
route: Schema.String,
|
|
22
|
+
});
|
|
23
|
+
const CurationRequestSchema = Schema.Struct({
|
|
24
|
+
id: Schema.String,
|
|
25
|
+
user_id: Schema.String,
|
|
26
|
+
status: Schema.String,
|
|
27
|
+
created_at: Schema.String,
|
|
28
|
+
});
|
|
29
|
+
const SubscriptionRowSchema = Schema.Struct({
|
|
30
|
+
user_id: Schema.String,
|
|
31
|
+
provider: Schema.String,
|
|
32
|
+
provider_customer_id: Schema.String,
|
|
33
|
+
provider_subscription_id: Schema.NullOr(Schema.String),
|
|
34
|
+
status: Schema.String,
|
|
35
|
+
past_due_at: Schema.NullOr(Schema.String),
|
|
36
|
+
current_period_end: Schema.NullOr(Schema.String),
|
|
37
|
+
updated_at: Schema.String,
|
|
38
|
+
});
|
|
39
|
+
const HostingAllowanceSchema = Schema.Struct({
|
|
40
|
+
used: Schema.Number,
|
|
41
|
+
limit: Schema.Number,
|
|
42
|
+
left: Schema.Number,
|
|
43
|
+
entitled: Schema.Boolean,
|
|
44
|
+
unverified: Schema.Boolean,
|
|
45
|
+
});
|
|
46
|
+
const OrderBreakdownSchema = Schema.Struct({
|
|
47
|
+
vat: Schema.Number,
|
|
48
|
+
fee: Schema.Number,
|
|
49
|
+
net: Schema.Number,
|
|
50
|
+
});
|
|
51
|
+
/** Body of `GET /api/pages/profile`. */
|
|
52
|
+
export const ProfilePageSchema = Schema.Struct({
|
|
53
|
+
user: Schema.Struct({
|
|
54
|
+
nickname: Schema.NullOr(Schema.String),
|
|
55
|
+
role: UserRoleSchema,
|
|
56
|
+
powers: Arr(UserPowerSchema),
|
|
57
|
+
avatar: Schema.String,
|
|
58
|
+
emailVerified: Schema.Boolean,
|
|
59
|
+
}),
|
|
60
|
+
theme: Schema.Struct({ mode: ThemeModeSchema }),
|
|
61
|
+
font: Schema.Literal("default", "dyslexic"),
|
|
62
|
+
pendingRequest: Schema.NullOr(CurationRequestSchema),
|
|
63
|
+
subscription: Schema.NullOr(SubscriptionRowSchema),
|
|
64
|
+
graceOver: Schema.Boolean,
|
|
65
|
+
allowance: Schema.NullOr(HostingAllowanceSchema),
|
|
66
|
+
breakdown: Schema.Struct({
|
|
67
|
+
exact: Schema.NullOr(Schema.Struct({
|
|
68
|
+
vat: Schema.Number,
|
|
69
|
+
fee: Schema.Number,
|
|
70
|
+
net: Schema.Number,
|
|
71
|
+
total: Schema.Number,
|
|
72
|
+
})),
|
|
73
|
+
estimate: Schema.Struct({
|
|
74
|
+
monthly: OrderBreakdownSchema,
|
|
75
|
+
lifetime: OrderBreakdownSchema,
|
|
76
|
+
}),
|
|
77
|
+
}),
|
|
78
|
+
welcome: Schema.NullOr(Schema.Literal("monthly", "lifetime")),
|
|
79
|
+
claimed: Schema.Boolean,
|
|
80
|
+
verified: Schema.Boolean,
|
|
81
|
+
tab: Schema.Literal("account", "appearance", "privacy", "tools"),
|
|
82
|
+
tools: Schema.Boolean,
|
|
83
|
+
});
|
|
84
|
+
const SessionDtoSchema = Schema.Struct({
|
|
85
|
+
sid: Schema.String,
|
|
86
|
+
fingerprint: Schema.String,
|
|
87
|
+
label: Schema.String,
|
|
88
|
+
createdAt: Schema.Number,
|
|
89
|
+
lastSeen: Schema.Number,
|
|
90
|
+
current: Schema.Boolean,
|
|
91
|
+
location: Schema.NullOr(Schema.String),
|
|
92
|
+
});
|
|
93
|
+
const LocationOptInSchema = Schema.Struct({
|
|
94
|
+
enabled: Schema.Boolean,
|
|
95
|
+
since: Schema.NullOr(Schema.Number),
|
|
96
|
+
});
|
|
97
|
+
/** Body of `GET /api/pages/profile/sessions`. */
|
|
98
|
+
export const ProfileSessionsPageSchema = Schema.Struct({
|
|
99
|
+
sessions: Arr(SessionDtoSchema),
|
|
100
|
+
locationOptIn: LocationOptInSchema,
|
|
101
|
+
});
|
|
102
|
+
const AvatarRowSchema = Schema.Struct({
|
|
103
|
+
id: Schema.String,
|
|
104
|
+
title: Schema.String,
|
|
105
|
+
description: Schema.optional(Schema.String),
|
|
106
|
+
category: Schema.optional(Schema.String),
|
|
107
|
+
src: Schema.String,
|
|
108
|
+
});
|
|
109
|
+
/** Body of `GET /api/pages/manage/avatars`. */
|
|
110
|
+
export const ManageAvatarsPageSchema = Schema.Struct({
|
|
111
|
+
sortedGroups: Arr(Schema.mutable(Schema.Tuple(Schema.String, Arr(AvatarRowSchema)))),
|
|
112
|
+
categories: Arr(Schema.String),
|
|
113
|
+
});
|
|
114
|
+
const CategorySchema = Schema.Struct({
|
|
115
|
+
id: Schema.String,
|
|
116
|
+
name: Schema.String,
|
|
117
|
+
description: Schema.NullOr(Schema.String),
|
|
118
|
+
icon: Schema.NullOr(Schema.String),
|
|
119
|
+
color: Schema.NullOr(Schema.String),
|
|
120
|
+
question_count: Schema.Number,
|
|
121
|
+
});
|
|
122
|
+
/** Body of `GET /api/pages/manage/categories`. */
|
|
123
|
+
export const ManageCategoriesPageSchema = Schema.Struct({
|
|
124
|
+
initial: Arr(CategorySchema),
|
|
125
|
+
});
|
|
126
|
+
const AdminFlagRowSchema = Schema.Struct({
|
|
127
|
+
questionId: Schema.String,
|
|
128
|
+
excerpt: Schema.String,
|
|
129
|
+
categoryId: Schema.String,
|
|
130
|
+
flagCount: Schema.Number,
|
|
131
|
+
status: Schema.Literal("open", "resolved"),
|
|
132
|
+
});
|
|
133
|
+
/** Body of `GET /api/pages/manage/flagged-questions`. */
|
|
134
|
+
export const ManageFlaggedQuestionsPageSchema = Schema.Struct({
|
|
135
|
+
initial: Arr(AdminFlagRowSchema),
|
|
136
|
+
initialHasMore: Schema.Boolean,
|
|
137
|
+
statusFilter: Schema.Literal("open", "resolved", "all"),
|
|
138
|
+
page: Schema.Number,
|
|
139
|
+
});
|
|
140
|
+
const AuthoredQuestionRowSchema = Schema.Struct({
|
|
141
|
+
id: Schema.String,
|
|
142
|
+
category: Schema.String,
|
|
143
|
+
label: Schema.String,
|
|
144
|
+
created_at: Schema.String,
|
|
145
|
+
updated_at: Schema.NullOr(Schema.String),
|
|
146
|
+
created_by: Schema.NullOr(Schema.String),
|
|
147
|
+
author_nickname: Schema.NullOr(Schema.String),
|
|
148
|
+
author_email: Schema.NullOr(Schema.String),
|
|
149
|
+
published_at: Schema.NullOr(Schema.String),
|
|
150
|
+
published_by: Schema.NullOr(Schema.String),
|
|
151
|
+
unpublished_at: Schema.NullOr(Schema.String),
|
|
152
|
+
unpublished_by: Schema.NullOr(Schema.String),
|
|
153
|
+
unpublish_reason: Schema.NullOr(Schema.String),
|
|
154
|
+
changed_since_publish: Schema.Number,
|
|
155
|
+
});
|
|
156
|
+
/** Body of `GET /api/pages/manage/questions`. */
|
|
157
|
+
export const ManageQuestionsPageSchema = Schema.Struct({
|
|
158
|
+
initial: Schema.Struct({
|
|
159
|
+
rows: Arr(AuthoredQuestionRowSchema),
|
|
160
|
+
total: Schema.Number,
|
|
161
|
+
}),
|
|
162
|
+
page: Schema.Number,
|
|
163
|
+
filters: Schema.Struct({
|
|
164
|
+
authorId: Schema.optional(Schema.String),
|
|
165
|
+
category: Schema.optional(Schema.String),
|
|
166
|
+
published: Schema.optional(Schema.Literal("all", "shared", "private")),
|
|
167
|
+
q: Schema.optional(Schema.String),
|
|
168
|
+
changed: Schema.optional(Schema.Boolean),
|
|
169
|
+
}),
|
|
170
|
+
authors: Arr(Schema.Struct({
|
|
171
|
+
id: Schema.String,
|
|
172
|
+
nickname: Schema.NullOr(Schema.String),
|
|
173
|
+
email: Schema.NullOr(Schema.String),
|
|
174
|
+
count: Schema.Number,
|
|
175
|
+
})),
|
|
176
|
+
categories: Arr(Schema.Struct({ id: Schema.String, name: Schema.String })),
|
|
177
|
+
});
|
|
178
|
+
/** Body of `GET /api/pages/manage/import`. */
|
|
179
|
+
export const ManageImportPageSchema = Schema.Struct({
|
|
180
|
+
ok: Schema.Literal(true),
|
|
181
|
+
});
|
|
182
|
+
const CategoryOptionSchema = Schema.Struct({
|
|
183
|
+
id: Schema.String,
|
|
184
|
+
name: Schema.String,
|
|
185
|
+
icon: Schema.String,
|
|
186
|
+
count: Schema.Number,
|
|
187
|
+
color: Schema.String,
|
|
188
|
+
});
|
|
189
|
+
const QuizPresetSchema = Schema.Struct({
|
|
190
|
+
id: Schema.String,
|
|
191
|
+
curator_id: Schema.String,
|
|
192
|
+
name: Schema.String,
|
|
193
|
+
description: Schema.NullOr(Schema.String),
|
|
194
|
+
category_ids: Schema.String,
|
|
195
|
+
timer_duration: Schema.Number,
|
|
196
|
+
questions_per_round: Schema.Number,
|
|
197
|
+
difficulty: Schema.String,
|
|
198
|
+
advance_mode: Schema.String,
|
|
199
|
+
scoring_mode: Schema.NullOr(Schema.String),
|
|
200
|
+
access_mode: Schema.String,
|
|
201
|
+
max_players: Schema.NullOr(Schema.Number),
|
|
202
|
+
created_at: Schema.String,
|
|
203
|
+
});
|
|
204
|
+
/** Body of `GET /api/pages/curator/create`. */
|
|
205
|
+
export const CuratorCreatePageSchema = Schema.Struct({
|
|
206
|
+
categories: Arr(CategoryOptionSchema),
|
|
207
|
+
categoryColors: Schema.Record({ key: Schema.String, value: Schema.String }),
|
|
208
|
+
presets: Arr(QuizPresetSchema),
|
|
209
|
+
presetLimit: Schema.Number,
|
|
210
|
+
subscription: Schema.NullOr(SubscriptionRowSchema),
|
|
211
|
+
allowance: HostingAllowanceSchema,
|
|
212
|
+
});
|
|
213
|
+
const GameHistoryListItemSchema = Schema.Struct({
|
|
214
|
+
id: Schema.String,
|
|
215
|
+
quiz_name: Schema.String,
|
|
216
|
+
started_at: Schema.String,
|
|
217
|
+
player_count: Schema.Number,
|
|
218
|
+
total_questions: Schema.Number,
|
|
219
|
+
winners: Arr(Schema.String),
|
|
220
|
+
top_score: Schema.NullOr(Schema.Number),
|
|
221
|
+
});
|
|
222
|
+
/** Body of `GET /api/pages/curator/history`. */
|
|
223
|
+
export const CuratorHistoryPageSchema = Schema.Struct({
|
|
224
|
+
entries: Arr(GameHistoryListItemSchema),
|
|
225
|
+
nextCursor: Schema.NullOr(Schema.String),
|
|
226
|
+
});
|
|
227
|
+
const GameHistoryEntrySchema = Schema.Struct({
|
|
228
|
+
id: Schema.String,
|
|
229
|
+
quiz_name: Schema.String,
|
|
230
|
+
started_at: Schema.String,
|
|
231
|
+
ended_at: Schema.NullOr(Schema.String),
|
|
232
|
+
categoryIds: Arr(Schema.String),
|
|
233
|
+
timer_duration: Schema.Number,
|
|
234
|
+
total_questions: Schema.Number,
|
|
235
|
+
player_count: Schema.Number,
|
|
236
|
+
curator_id: Schema.NullOr(Schema.String),
|
|
237
|
+
difficulty: Schema.NullOr(Schema.String),
|
|
238
|
+
advance_mode: Schema.NullOr(Schema.String),
|
|
239
|
+
access_mode: Schema.NullOr(Schema.String),
|
|
240
|
+
max_players: Schema.NullOr(Schema.Number),
|
|
241
|
+
questions_per_round: Schema.NullOr(Schema.Number),
|
|
242
|
+
preset_id: Schema.NullOr(Schema.String),
|
|
243
|
+
stopped_at: Schema.NullOr(Schema.String),
|
|
244
|
+
planned_questions: Schema.NullOr(Schema.Number),
|
|
245
|
+
});
|
|
246
|
+
const GameHistoryResultSchema = Schema.Struct({
|
|
247
|
+
id: Schema.String,
|
|
248
|
+
player_nickname: Schema.String,
|
|
249
|
+
final_score: Schema.Number,
|
|
250
|
+
rank: Schema.Number,
|
|
251
|
+
player_id: Schema.NullOr(Schema.String),
|
|
252
|
+
user_id: Schema.NullOr(Schema.String),
|
|
253
|
+
avatar_id: Schema.NullOr(Schema.String),
|
|
254
|
+
role: Schema.NullOr(Schema.Literal("player", "observer")),
|
|
255
|
+
avatarSrc: Schema.String,
|
|
256
|
+
});
|
|
257
|
+
const AnswerSpreadEntrySchema = Schema.Struct({
|
|
258
|
+
answerId: Schema.String,
|
|
259
|
+
text: Schema.String,
|
|
260
|
+
count: Schema.Number,
|
|
261
|
+
correct: Schema.Boolean,
|
|
262
|
+
});
|
|
263
|
+
const QuestionRecapEntrySchema = Schema.Struct({
|
|
264
|
+
questionIndex: Schema.Number,
|
|
265
|
+
questionText: Schema.optional(Schema.String),
|
|
266
|
+
mediaUrl: Schema.optional(Schema.String),
|
|
267
|
+
mediaType: Schema.optional(MediaTypeSchema),
|
|
268
|
+
source: Schema.optional(QuestionSourceSchema),
|
|
269
|
+
postAnswerNote: Schema.optional(Schema.String),
|
|
270
|
+
answered: Schema.Number,
|
|
271
|
+
correct: Schema.Number,
|
|
272
|
+
spread: Schema.NullOr(Arr(AnswerSpreadEntrySchema)),
|
|
273
|
+
noAnswer: Schema.Number,
|
|
274
|
+
});
|
|
275
|
+
/** Body of `GET /api/pages/curator/history/:id`. */
|
|
276
|
+
export const CuratorHistoryEntryPageSchema = Schema.Struct({
|
|
277
|
+
entry: Schema.Struct({
|
|
278
|
+
session: GameHistoryEntrySchema,
|
|
279
|
+
results: Arr(GameHistoryResultSchema),
|
|
280
|
+
questions: Schema.NullOr(Arr(QuestionRecapEntrySchema)),
|
|
281
|
+
}),
|
|
282
|
+
presetLimit: Schema.Number,
|
|
283
|
+
presetCount: Schema.Number,
|
|
284
|
+
});
|
|
285
|
+
const CuratorQuestionsCategoryOptionSchema = Schema.Struct({
|
|
286
|
+
id: Schema.String,
|
|
287
|
+
name: Schema.String,
|
|
288
|
+
icon: Schema.optional(Schema.String),
|
|
289
|
+
count: Schema.Number,
|
|
290
|
+
});
|
|
291
|
+
const OwnQuestionSchema = Schema.Struct({
|
|
292
|
+
id: Schema.String,
|
|
293
|
+
category: Schema.String,
|
|
294
|
+
label: Schema.String,
|
|
295
|
+
created_at: Schema.String,
|
|
296
|
+
});
|
|
297
|
+
/** Body of `GET /api/pages/curator/questions`. */
|
|
298
|
+
export const CuratorQuestionsPageSchema = Schema.Struct({
|
|
299
|
+
categories: Arr(CuratorQuestionsCategoryOptionSchema),
|
|
300
|
+
ownQuestions: Arr(OwnQuestionSchema),
|
|
301
|
+
questionsCursor: Schema.NullOr(Schema.String),
|
|
302
|
+
});
|
|
303
|
+
/** Body of `GET /api/pages/solo/layout`. */
|
|
304
|
+
export const SoloLayoutPageSchema = Schema.Struct({
|
|
305
|
+
isLoggedIn: Schema.Boolean,
|
|
306
|
+
isGuest: Schema.Boolean,
|
|
307
|
+
userId: Schema.String,
|
|
308
|
+
nickname: Schema.String,
|
|
309
|
+
profileAvatarSrc: Schema.String,
|
|
310
|
+
categoryDataJson: Schema.String,
|
|
311
|
+
});
|
|
312
|
+
const LeaderboardEntrySchema = Schema.Struct({
|
|
313
|
+
rank: Schema.Number,
|
|
314
|
+
user_id: Schema.String,
|
|
315
|
+
nickname: Schema.String,
|
|
316
|
+
total_score: Schema.Number,
|
|
317
|
+
correct_count: Schema.Number,
|
|
318
|
+
total_answered: Schema.Number,
|
|
319
|
+
time_to_answer_avg_ms: Schema.Number,
|
|
320
|
+
max_streak: Schema.Number,
|
|
321
|
+
completed_at: Schema.Number,
|
|
322
|
+
});
|
|
323
|
+
/** Body of `GET /api/pages/solo/leaderboard`. */
|
|
324
|
+
export const SoloLeaderboardPageSchema = Schema.Struct({
|
|
325
|
+
entries: Arr(LeaderboardEntrySchema),
|
|
326
|
+
board: Schema.Literal("score", "streak", "accuracy", "speed", "survival"),
|
|
327
|
+
scope: Schema.Literal("all-time", "daily", "weekly", "monthly"),
|
|
328
|
+
categoryId: Schema.NullOr(Schema.String),
|
|
329
|
+
difficulty: Schema.NullOr(Schema.Literal("easy", "medium", "hard")),
|
|
330
|
+
categories: Arr(Schema.Struct({ id: Schema.String, name: Schema.String })),
|
|
331
|
+
userRank: Schema.NullOr(Schema.Number),
|
|
332
|
+
eligibleCount: Schema.Number,
|
|
333
|
+
percentile: Schema.NullOr(Schema.Number),
|
|
334
|
+
around: Schema.Boolean,
|
|
335
|
+
viewerId: Schema.NullOr(Schema.String),
|
|
336
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
/** Page-load response bodies for `src/api/routes/auth.ts`. */
|
|
3
|
+
/** Body of `GET /api/pages/auth/verify-email`: the address awaiting its code. */
|
|
4
|
+
export declare const VerifyEmailPageSchema: Schema.Struct<{
|
|
5
|
+
email: typeof Schema.String;
|
|
6
|
+
}>;
|
|
7
|
+
/** Body of `GET /api/pages/auth/login`: whether a reset just landed here. */
|
|
8
|
+
export declare const LoginPageSchema: Schema.Struct<{
|
|
9
|
+
resetSuccess: typeof Schema.Boolean;
|
|
10
|
+
}>;
|
|
11
|
+
/** Body of `GET /api/pages/auth/signup`: the claim-the-night prefill. */
|
|
12
|
+
export declare const SignupPageSchema: Schema.Struct<{
|
|
13
|
+
claim: typeof Schema.Boolean;
|
|
14
|
+
prefillNickname: typeof Schema.String;
|
|
15
|
+
}>;
|
|
16
|
+
/** Body of `GET /api/pages/auth/forgot-password`: the form's prefill. */
|
|
17
|
+
export declare const ForgotPasswordPageSchema: Schema.Struct<{
|
|
18
|
+
prefillEmail: typeof Schema.String;
|
|
19
|
+
sent: typeof Schema.Boolean;
|
|
20
|
+
}>;
|
|
21
|
+
/** Body of `GET /api/pages/auth/reset-password`: the token's validity. */
|
|
22
|
+
export declare const ResetPasswordPageSchema: Schema.Struct<{
|
|
23
|
+
valid: typeof Schema.Boolean;
|
|
24
|
+
token: typeof Schema.String;
|
|
25
|
+
}>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
/** Page-load response bodies for `src/api/routes/auth.ts`. */
|
|
3
|
+
/** Body of `GET /api/pages/auth/verify-email`: the address awaiting its code. */
|
|
4
|
+
export const VerifyEmailPageSchema = Schema.Struct({ email: Schema.String });
|
|
5
|
+
/** Body of `GET /api/pages/auth/login`: whether a reset just landed here. */
|
|
6
|
+
export const LoginPageSchema = Schema.Struct({
|
|
7
|
+
resetSuccess: Schema.Boolean,
|
|
8
|
+
});
|
|
9
|
+
/** Body of `GET /api/pages/auth/signup`: the claim-the-night prefill. */
|
|
10
|
+
export const SignupPageSchema = Schema.Struct({
|
|
11
|
+
claim: Schema.Boolean,
|
|
12
|
+
prefillNickname: Schema.String,
|
|
13
|
+
});
|
|
14
|
+
/** Body of `GET /api/pages/auth/forgot-password`: the form's prefill. */
|
|
15
|
+
export const ForgotPasswordPageSchema = Schema.Struct({
|
|
16
|
+
prefillEmail: Schema.String,
|
|
17
|
+
sent: Schema.Boolean,
|
|
18
|
+
});
|
|
19
|
+
/** Body of `GET /api/pages/auth/reset-password`: the token's validity. */
|
|
20
|
+
export const ResetPasswordPageSchema = Schema.Struct({
|
|
21
|
+
valid: Schema.Boolean,
|
|
22
|
+
token: Schema.String,
|
|
23
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
/** Schemas shared by more than one page-load body. */
|
|
3
|
+
export declare const UserRoleSchema: Schema.Literal<["anonymous", "display", "member", "curator", "admin"]>;
|
|
4
|
+
export declare const UserPowerSchema: Schema.Literal<["can-access-mimic", "can-send-feedback", "can-import-quizzes", "can-manage-features", "can-add-questions", "can-manage-categories", "can-moderate-questions", "can-publish-questions", "is-power-user", "can-manage-avatars", "can-apply-for-curation", "can-1v1"]>;
|
|
5
|
+
export declare const SkyPhaseSchema: Schema.Literal<["night", "dawn", "morning", "noon", "evening", "sunset", "dusk"]>;
|
|
6
|
+
export declare const ThemeModeSchema: Schema.Union<[Schema.Literal<["dark", "light", "system", "dynamic"]>, Schema.Literal<["night", "dawn", "morning", "noon", "evening", "sunset", "dusk"]>]>;
|
|
7
|
+
export declare const PlayerRoleSchema: Schema.Literal<["player", "observer"]>;
|
|
8
|
+
export declare const GameAnswerRecordSchema: Schema.Struct<{
|
|
9
|
+
questionIndex: typeof Schema.Number;
|
|
10
|
+
categoryId: typeof Schema.String;
|
|
11
|
+
difficulty: Schema.optional<Schema.Literal<["easy", "medium", "hard"]>>;
|
|
12
|
+
isCorrect: typeof Schema.Boolean;
|
|
13
|
+
timeToAnswerMs: typeof Schema.Number;
|
|
14
|
+
questionId: Schema.optional<typeof Schema.String>;
|
|
15
|
+
questionText: Schema.optional<typeof Schema.String>;
|
|
16
|
+
selectedAnswerId: Schema.optional<typeof Schema.String>;
|
|
17
|
+
selectedAnswerText: Schema.optional<typeof Schema.String>;
|
|
18
|
+
correctAnswerId: Schema.optional<typeof Schema.String>;
|
|
19
|
+
correctAnswerText: Schema.optional<typeof Schema.String>;
|
|
20
|
+
mediaUrl: Schema.optional<typeof Schema.String>;
|
|
21
|
+
mediaType: Schema.optional<Schema.Literal<["image", "audio", "video"]>>;
|
|
22
|
+
source: Schema.optional<Schema.Struct<{
|
|
23
|
+
url: Schema.filter<Schema.filter<typeof Schema.String>>;
|
|
24
|
+
label: Schema.optional<Schema.filter<typeof Schema.String>>;
|
|
25
|
+
}>>;
|
|
26
|
+
postAnswerNote: Schema.optional<typeof Schema.String>;
|
|
27
|
+
}>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { MediaTypeSchema, QuestionSourceSchema } from "../question.schema.js";
|
|
3
|
+
/** Schemas shared by more than one page-load body. */
|
|
4
|
+
export const UserRoleSchema = Schema.Literal("anonymous", "display", "member", "curator", "admin");
|
|
5
|
+
export const UserPowerSchema = Schema.Literal("can-access-mimic", "can-send-feedback", "can-import-quizzes", "can-manage-features", "can-add-questions", "can-manage-categories", "can-moderate-questions", "can-publish-questions", "is-power-user", "can-manage-avatars", "can-apply-for-curation", "can-1v1");
|
|
6
|
+
export const SkyPhaseSchema = Schema.Literal("night", "dawn", "morning", "noon", "evening", "sunset", "dusk");
|
|
7
|
+
export const ThemeModeSchema = Schema.Union(Schema.Literal("dark", "light", "system", "dynamic"), SkyPhaseSchema);
|
|
8
|
+
export const PlayerRoleSchema = Schema.Literal("player", "observer");
|
|
9
|
+
export const GameAnswerRecordSchema = Schema.Struct({
|
|
10
|
+
questionIndex: Schema.Number,
|
|
11
|
+
categoryId: Schema.String,
|
|
12
|
+
difficulty: Schema.optional(Schema.Literal("easy", "medium", "hard")),
|
|
13
|
+
isCorrect: Schema.Boolean,
|
|
14
|
+
timeToAnswerMs: Schema.Number,
|
|
15
|
+
questionId: Schema.optional(Schema.String),
|
|
16
|
+
questionText: Schema.optional(Schema.String),
|
|
17
|
+
selectedAnswerId: Schema.optional(Schema.String),
|
|
18
|
+
selectedAnswerText: Schema.optional(Schema.String),
|
|
19
|
+
correctAnswerId: Schema.optional(Schema.String),
|
|
20
|
+
correctAnswerText: Schema.optional(Schema.String),
|
|
21
|
+
mediaUrl: Schema.optional(Schema.String),
|
|
22
|
+
mediaType: Schema.optional(MediaTypeSchema),
|
|
23
|
+
source: Schema.optional(QuestionSourceSchema),
|
|
24
|
+
postAnswerNote: Schema.optional(Schema.String),
|
|
25
|
+
});
|
|
26
|
+
// Assignability check: a schema drift that drops or mistypes a field the
|
|
27
|
+
// hand-written GameAnswerRecord declares fails here at compile time.
|
|
28
|
+
const _gameAnswerRecordCheck = null;
|