@anvil-js/client 0.0.1 → 0.0.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.
- package/README.md +15 -2
- package/dist/factory-6sY9ZEqy.d.cts +1932 -0
- package/dist/factory-6sY9ZEqy.d.ts +1932 -0
- package/dist/index.cjs +892 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +12 -0
- package/dist/index.d.ts +1 -4
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +55 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/{provider-2AIXk8yy.d.ts → react/index.d.cts} +18 -1929
- package/dist/react/index.d.ts +13673 -8
- package/dist/react/index.js +37 -3
- package/dist/react/index.js.map +1 -1
- package/dist/schemas/index.cjs +850 -0
- package/dist/schemas/index.cjs.map +1 -0
- package/dist/schemas/index.d.cts +2584 -0
- package/dist/schemas/index.d.ts +185 -185
- package/dist/server.cjs +1038 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.cts +3869 -0
- package/dist/server.d.ts +247 -247
- package/dist/ws/index.cjs +613 -0
- package/dist/ws/index.cjs.map +1 -0
- package/dist/ws/index.d.cts +298 -0
- package/package.json +54 -15
- package/dist/chunk-DV6XOONA.js +0 -41
- package/dist/chunk-DV6XOONA.js.map +0 -1
package/dist/server.cjs
ADDED
|
@@ -0,0 +1,1038 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var server = require('@trpc/server');
|
|
4
|
+
var zod = require('zod');
|
|
5
|
+
|
|
6
|
+
// src/router.ts
|
|
7
|
+
var UUIDSchema = zod.z.string().uuid();
|
|
8
|
+
var ISODateSchema = zod.z.string().datetime({ offset: true });
|
|
9
|
+
var ArchSchema = zod.z.enum(["x64", "arm64", "x86"]);
|
|
10
|
+
zod.z.enum(["windows", "macos", "linux"]);
|
|
11
|
+
var LoaderTypeSchema = zod.z.enum(["vanilla", "fabric", "forge", "neoforge", "quilt"]);
|
|
12
|
+
var LocalizedStringSchema = zod.z.record(zod.z.string(), zod.z.string());
|
|
13
|
+
zod.z.object({
|
|
14
|
+
code: zod.z.enum([
|
|
15
|
+
"BAD_REQUEST",
|
|
16
|
+
"UNAUTHORIZED",
|
|
17
|
+
"FORBIDDEN",
|
|
18
|
+
"NOT_FOUND",
|
|
19
|
+
"CONFLICT",
|
|
20
|
+
"TOO_MANY_REQUESTS",
|
|
21
|
+
"INTERNAL_SERVER_ERROR"
|
|
22
|
+
]),
|
|
23
|
+
message: zod.z.string()
|
|
24
|
+
});
|
|
25
|
+
zod.z.object({
|
|
26
|
+
page: zod.z.number().int().min(1).default(1),
|
|
27
|
+
pageSize: zod.z.number().int().min(1).max(200).default(50)
|
|
28
|
+
});
|
|
29
|
+
var UserSummarySchema = zod.z.object({
|
|
30
|
+
uuid: UUIDSchema,
|
|
31
|
+
email: zod.z.string().email(),
|
|
32
|
+
username: zod.z.string().min(1).max(64),
|
|
33
|
+
displayName: zod.z.string().min(1).max(128),
|
|
34
|
+
avatarUrl: zod.z.string().url().nullable(),
|
|
35
|
+
role: zod.z.enum(["USER", "MODERATOR", "ADMIN"]).default("USER")
|
|
36
|
+
});
|
|
37
|
+
var SessionSchema = zod.z.object({
|
|
38
|
+
anvil: zod.z.object({
|
|
39
|
+
user: UserSummarySchema,
|
|
40
|
+
accessToken: zod.z.string(),
|
|
41
|
+
refreshToken: zod.z.string(),
|
|
42
|
+
expiresAt: ISODateSchema
|
|
43
|
+
}),
|
|
44
|
+
mojang: zod.z.object({
|
|
45
|
+
uuid: UUIDSchema,
|
|
46
|
+
username: zod.z.string(),
|
|
47
|
+
accessToken: zod.z.string(),
|
|
48
|
+
expiresAt: ISODateSchema
|
|
49
|
+
}).nullable()
|
|
50
|
+
});
|
|
51
|
+
var LoginInputSchema = zod.z.object({
|
|
52
|
+
email: zod.z.string().email(),
|
|
53
|
+
password: zod.z.string().min(8).max(128)
|
|
54
|
+
});
|
|
55
|
+
var RegisterInputSchema = zod.z.object({
|
|
56
|
+
email: zod.z.string().email(),
|
|
57
|
+
username: zod.z.string().min(3).max(64).regex(/^[a-zA-Z0-9_]+$/),
|
|
58
|
+
password: zod.z.string().min(8).max(128)
|
|
59
|
+
});
|
|
60
|
+
var RefreshInputSchema = zod.z.object({
|
|
61
|
+
refreshToken: zod.z.string().min(1)
|
|
62
|
+
});
|
|
63
|
+
var ForgotPasswordInputSchema = zod.z.object({
|
|
64
|
+
email: zod.z.string().email()
|
|
65
|
+
});
|
|
66
|
+
var ResetPasswordInputSchema = zod.z.object({
|
|
67
|
+
token: zod.z.string().min(1),
|
|
68
|
+
newPassword: zod.z.string().min(8).max(128)
|
|
69
|
+
});
|
|
70
|
+
var ValidateInputSchema = zod.z.object({
|
|
71
|
+
token: zod.z.string().min(1)
|
|
72
|
+
});
|
|
73
|
+
var BuildSummarySchema = zod.z.object({
|
|
74
|
+
id: UUIDSchema,
|
|
75
|
+
slug: zod.z.string(),
|
|
76
|
+
name: zod.z.string(),
|
|
77
|
+
shortDescription: zod.z.string(),
|
|
78
|
+
iconUrl: zod.z.string().url().nullable(),
|
|
79
|
+
mcVersions: zod.z.array(zod.z.string()),
|
|
80
|
+
loaders: zod.z.array(LoaderTypeSchema),
|
|
81
|
+
visibility: zod.z.enum(["public", "private", "unlisted"]),
|
|
82
|
+
pricing: zod.z.discriminatedUnion("model", [
|
|
83
|
+
zod.z.object({ model: zod.z.literal("free") }),
|
|
84
|
+
zod.z.object({
|
|
85
|
+
model: zod.z.literal("paid"),
|
|
86
|
+
priceCents: zod.z.number().int().nonnegative(),
|
|
87
|
+
currency: zod.z.string()
|
|
88
|
+
}),
|
|
89
|
+
zod.z.object({
|
|
90
|
+
model: zod.z.literal("subscription"),
|
|
91
|
+
tiers: zod.z.array(
|
|
92
|
+
zod.z.object({
|
|
93
|
+
id: zod.z.string(),
|
|
94
|
+
name: zod.z.string(),
|
|
95
|
+
priceCents: zod.z.number().int().nonnegative(),
|
|
96
|
+
interval: zod.z.enum(["month", "year"])
|
|
97
|
+
})
|
|
98
|
+
)
|
|
99
|
+
})
|
|
100
|
+
]),
|
|
101
|
+
stats: zod.z.object({
|
|
102
|
+
downloads: zod.z.number().int().nonnegative(),
|
|
103
|
+
favorites: zod.z.number().int().nonnegative(),
|
|
104
|
+
updatedAt: ISODateSchema
|
|
105
|
+
}),
|
|
106
|
+
// Provider source -- UI uses this to badge cards (Modrinth / Anvil).
|
|
107
|
+
source: zod.z.enum(["modrinth", "anvil"]).default("anvil")
|
|
108
|
+
});
|
|
109
|
+
var BuildFileSchema = zod.z.object({
|
|
110
|
+
url: zod.z.string().url(),
|
|
111
|
+
sha256: zod.z.string().regex(/^[a-f0-9]{64}$/),
|
|
112
|
+
sizeBytes: zod.z.number().int().nonnegative(),
|
|
113
|
+
primary: zod.z.boolean()
|
|
114
|
+
});
|
|
115
|
+
var BuildVersionSchema = zod.z.object({
|
|
116
|
+
id: UUIDSchema,
|
|
117
|
+
buildId: UUIDSchema,
|
|
118
|
+
name: zod.z.string(),
|
|
119
|
+
mcVersion: zod.z.string(),
|
|
120
|
+
loader: LoaderTypeSchema,
|
|
121
|
+
loaderVersion: zod.z.string(),
|
|
122
|
+
files: zod.z.array(BuildFileSchema),
|
|
123
|
+
dependencies: zod.z.array(
|
|
124
|
+
zod.z.object({
|
|
125
|
+
kind: zod.z.enum(["required", "optional", "incompatible", "embedded"]),
|
|
126
|
+
projectId: zod.z.string(),
|
|
127
|
+
versionId: zod.z.string().optional()
|
|
128
|
+
})
|
|
129
|
+
),
|
|
130
|
+
changelog: zod.z.string().optional(),
|
|
131
|
+
publishedAt: ISODateSchema
|
|
132
|
+
});
|
|
133
|
+
var BuildSchema = BuildSummarySchema.extend({
|
|
134
|
+
versions: zod.z.array(BuildVersionSchema),
|
|
135
|
+
description: zod.z.string().optional(),
|
|
136
|
+
longDescription: LocalizedStringSchema.optional()
|
|
137
|
+
});
|
|
138
|
+
var ListBuildsInputSchema = zod.z.object({
|
|
139
|
+
search: zod.z.string().optional(),
|
|
140
|
+
tags: zod.z.array(zod.z.string()).optional(),
|
|
141
|
+
mcVersions: zod.z.array(zod.z.string()).optional(),
|
|
142
|
+
loaders: zod.z.array(LoaderTypeSchema).optional(),
|
|
143
|
+
visibility: zod.z.array(zod.z.enum(["public", "private", "unlisted"])).optional(),
|
|
144
|
+
source: zod.z.array(zod.z.enum(["modrinth", "anvil"])).optional(),
|
|
145
|
+
page: zod.z.number().int().min(1).default(1),
|
|
146
|
+
pageSize: zod.z.number().int().min(1).max(100).default(24),
|
|
147
|
+
sort: zod.z.enum(["popular", "recent", "name"]).default("popular")
|
|
148
|
+
});
|
|
149
|
+
var GetBuildInputSchema = zod.z.object({
|
|
150
|
+
idOrSlug: zod.z.string().min(1)
|
|
151
|
+
});
|
|
152
|
+
var RequestDownloadInputSchema = zod.z.object({
|
|
153
|
+
versionId: UUIDSchema,
|
|
154
|
+
clientArch: ArchSchema.optional()
|
|
155
|
+
});
|
|
156
|
+
var RequestDownloadOutputSchema = zod.z.object({
|
|
157
|
+
installId: UUIDSchema,
|
|
158
|
+
downloadUrl: zod.z.string().url(),
|
|
159
|
+
expiresAt: ISODateSchema,
|
|
160
|
+
sha256: zod.z.string(),
|
|
161
|
+
sizeBytes: zod.z.number().int().nonnegative()
|
|
162
|
+
});
|
|
163
|
+
var LicenseSchema = zod.z.object({
|
|
164
|
+
id: UUIDSchema,
|
|
165
|
+
buildId: UUIDSchema,
|
|
166
|
+
buildName: zod.z.string(),
|
|
167
|
+
status: zod.z.enum(["active", "expired", "revoked"]),
|
|
168
|
+
source: zod.z.enum(["purchase", "subscription", "gift", "promo", "dev_grant"]),
|
|
169
|
+
grantedAt: ISODateSchema,
|
|
170
|
+
expiresAt: ISODateSchema.nullable()
|
|
171
|
+
});
|
|
172
|
+
var ListLicensesInputSchema = zod.z.object({
|
|
173
|
+
buildId: UUIDSchema.optional(),
|
|
174
|
+
status: zod.z.enum(["active", "expired", "revoked"]).optional()
|
|
175
|
+
});
|
|
176
|
+
var CheckLicenseInputSchema = zod.z.object({
|
|
177
|
+
buildId: UUIDSchema
|
|
178
|
+
});
|
|
179
|
+
var CheckLicenseOutputSchema = zod.z.object({
|
|
180
|
+
hasAccess: zod.z.boolean(),
|
|
181
|
+
license: LicenseSchema.optional(),
|
|
182
|
+
reason: zod.z.enum(["no_license", "expired", "revoked", "region_locked"]).optional()
|
|
183
|
+
});
|
|
184
|
+
var RelationshipTypeSchema = zod.z.enum(["FRIENDS", "BLOCKED", "NEUTRAL"]);
|
|
185
|
+
var RelationshipStatusSchema = zod.z.enum(["PENDING", "VERIFIED"]);
|
|
186
|
+
var RelationshipDirectionSchema = zod.z.enum(["INCOMING", "OUTGOING", "MUTUAL"]);
|
|
187
|
+
var RelationshipsListKindSchema = zod.z.enum([
|
|
188
|
+
"FRIENDS",
|
|
189
|
+
"INCOMING_PENDING",
|
|
190
|
+
"OUTGOING_PENDING",
|
|
191
|
+
"BLOCKED"
|
|
192
|
+
]);
|
|
193
|
+
var PresenceStatusSchema = zod.z.enum(["ONLINE", "OFFLINE", "AWAY", "BUSY"]);
|
|
194
|
+
var RelationshipSchema = zod.z.object({
|
|
195
|
+
id: UUIDSchema,
|
|
196
|
+
type: RelationshipTypeSchema,
|
|
197
|
+
status: RelationshipStatusSchema,
|
|
198
|
+
// 'MUTUAL' for verified friends, 'INCOMING' for pending requests
|
|
199
|
+
// sent to the current user, 'OUTGOING' for pending requests the
|
|
200
|
+
// current user sent.
|
|
201
|
+
direction: RelationshipDirectionSchema,
|
|
202
|
+
// The other side of the relationship.
|
|
203
|
+
otherUser: UserSummarySchema,
|
|
204
|
+
since: ISODateSchema,
|
|
205
|
+
// uuid of the user who sent the original request (FRIENDS only;
|
|
206
|
+
// for BLOCKED this is the user who created the block, which may
|
|
207
|
+
// be either side).
|
|
208
|
+
initiatorUuid: UUIDSchema
|
|
209
|
+
});
|
|
210
|
+
var TrustedHostSchema = zod.z.object({
|
|
211
|
+
id: UUIDSchema,
|
|
212
|
+
name: zod.z.string().min(1).max(64),
|
|
213
|
+
domains: zod.z.array(zod.z.string().min(1).max(255)).min(1).max(32),
|
|
214
|
+
addedAt: ISODateSchema
|
|
215
|
+
});
|
|
216
|
+
var UserActivitySchema = zod.z.object({
|
|
217
|
+
// 'playing <buildId>' / 'building' / 'browsing' / 'afk'
|
|
218
|
+
type: zod.z.string(),
|
|
219
|
+
metadata: zod.z.record(zod.z.string(), zod.z.string())
|
|
220
|
+
});
|
|
221
|
+
var PresenceSchema = zod.z.object({
|
|
222
|
+
uuid: UUIDSchema,
|
|
223
|
+
status: PresenceStatusSchema,
|
|
224
|
+
lastOnline: ISODateSchema,
|
|
225
|
+
currentActivity: UserActivitySchema.optional()
|
|
226
|
+
});
|
|
227
|
+
var LocalizedRuleSchema = zod.z.object({
|
|
228
|
+
locale: zod.z.string(),
|
|
229
|
+
title: zod.z.string(),
|
|
230
|
+
body: zod.z.string()
|
|
231
|
+
});
|
|
232
|
+
var CommunityRulesStatusSchema = zod.z.object({
|
|
233
|
+
accepted: zod.z.boolean(),
|
|
234
|
+
version: zod.z.string(),
|
|
235
|
+
rules: zod.z.array(LocalizedRuleSchema),
|
|
236
|
+
updatedAt: ISODateSchema
|
|
237
|
+
});
|
|
238
|
+
var SuspensionStatusSchema = zod.z.object({
|
|
239
|
+
suspended: zod.z.boolean(),
|
|
240
|
+
reason: zod.z.string().optional(),
|
|
241
|
+
expiresAt: ISODateSchema.optional()
|
|
242
|
+
});
|
|
243
|
+
var CreateRelationshipInputSchema = zod.z.object({
|
|
244
|
+
targetUuid: UUIDSchema,
|
|
245
|
+
type: zod.z.enum(["FRIENDS", "BLOCKED", "NEUTRAL"])
|
|
246
|
+
});
|
|
247
|
+
var DeleteRelationshipInputSchema = zod.z.object({
|
|
248
|
+
targetUuid: UUIDSchema,
|
|
249
|
+
type: zod.z.enum(["FRIENDS", "BLOCKED", "NEUTRAL"])
|
|
250
|
+
});
|
|
251
|
+
var ListRelationshipsInputSchema = zod.z.object({
|
|
252
|
+
type: RelationshipsListKindSchema.optional()
|
|
253
|
+
});
|
|
254
|
+
var AcceptRequestInputSchema = zod.z.object({
|
|
255
|
+
fromUuid: UUIDSchema
|
|
256
|
+
});
|
|
257
|
+
var CancelRequestInputSchema = zod.z.object({
|
|
258
|
+
toUuid: UUIDSchema
|
|
259
|
+
});
|
|
260
|
+
var LookupByNameInputSchema = zod.z.object({
|
|
261
|
+
username: zod.z.string().min(3).max(64).regex(/^[a-zA-Z0-9_]+$/)
|
|
262
|
+
});
|
|
263
|
+
var ReportActivityInputSchema = zod.z.object({
|
|
264
|
+
type: zod.z.string().min(1).max(64),
|
|
265
|
+
metadata: zod.z.record(zod.z.string(), zod.z.string())
|
|
266
|
+
});
|
|
267
|
+
var InviteToServerInputSchema = zod.z.object({
|
|
268
|
+
targetUuid: UUIDSchema,
|
|
269
|
+
address: zod.z.string().min(1).max(512)
|
|
270
|
+
});
|
|
271
|
+
var CreateTrustedHostInputSchema = zod.z.object({
|
|
272
|
+
name: zod.z.string().min(1).max(64),
|
|
273
|
+
domains: zod.z.array(zod.z.string().min(1).max(255)).min(1).max(32)
|
|
274
|
+
});
|
|
275
|
+
var DeleteTrustedHostInputSchema = zod.z.object({
|
|
276
|
+
id: UUIDSchema
|
|
277
|
+
});
|
|
278
|
+
var LookupByNameOutputSchema = zod.z.object({
|
|
279
|
+
user: zod.z.object({
|
|
280
|
+
uuid: UUIDSchema,
|
|
281
|
+
username: zod.z.string(),
|
|
282
|
+
displayName: zod.z.string()
|
|
283
|
+
}).nullable(),
|
|
284
|
+
nameMap: zod.z.record(UUIDSchema, zod.z.string())
|
|
285
|
+
});
|
|
286
|
+
var CosmeticTypeSchema = zod.z.enum([
|
|
287
|
+
"hat",
|
|
288
|
+
"body",
|
|
289
|
+
"back",
|
|
290
|
+
"face",
|
|
291
|
+
"hand",
|
|
292
|
+
"feet",
|
|
293
|
+
"particle",
|
|
294
|
+
"emote"
|
|
295
|
+
]);
|
|
296
|
+
var CosmeticRaritySchema = zod.z.enum(["common", "uncommon", "rare", "epic", "legendary"]);
|
|
297
|
+
var CosmeticSchema = zod.z.object({
|
|
298
|
+
id: UUIDSchema,
|
|
299
|
+
type: CosmeticTypeSchema,
|
|
300
|
+
rarity: CosmeticRaritySchema,
|
|
301
|
+
name: LocalizedStringSchema,
|
|
302
|
+
description: LocalizedStringSchema.optional(),
|
|
303
|
+
iconUrl: zod.z.string().url().nullable(),
|
|
304
|
+
modelUrl: zod.z.string().url().nullable(),
|
|
305
|
+
owned: zod.z.boolean().default(false),
|
|
306
|
+
equipped: zod.z.boolean().default(false)
|
|
307
|
+
});
|
|
308
|
+
var OutfitSlotSchema = zod.z.object({
|
|
309
|
+
type: CosmeticTypeSchema,
|
|
310
|
+
cosmeticId: UUIDSchema.nullable()
|
|
311
|
+
});
|
|
312
|
+
var OutfitSchema = zod.z.object({
|
|
313
|
+
id: UUIDSchema,
|
|
314
|
+
name: zod.z.string().min(1).max(64),
|
|
315
|
+
slots: zod.z.array(OutfitSlotSchema).max(8),
|
|
316
|
+
createdAt: ISODateSchema,
|
|
317
|
+
updatedAt: ISODateSchema
|
|
318
|
+
});
|
|
319
|
+
var EmoteWheelSlotSchema = zod.z.object({
|
|
320
|
+
position: zod.z.number().int().min(0).max(7),
|
|
321
|
+
emoteId: UUIDSchema.nullable()
|
|
322
|
+
});
|
|
323
|
+
var EmoteWheelSchema = zod.z.object({
|
|
324
|
+
id: UUIDSchema,
|
|
325
|
+
name: zod.z.string().min(1).max(64),
|
|
326
|
+
slots: zod.z.array(EmoteWheelSlotSchema).length(8),
|
|
327
|
+
createdAt: ISODateSchema
|
|
328
|
+
});
|
|
329
|
+
var SkinVariantSchema = zod.z.enum(["classic", "slim"]);
|
|
330
|
+
var SkinSchema = zod.z.object({
|
|
331
|
+
id: UUIDSchema,
|
|
332
|
+
name: zod.z.string().min(1).max(64),
|
|
333
|
+
variant: SkinVariantSchema,
|
|
334
|
+
textureUrl: zod.z.string().url(),
|
|
335
|
+
sha256: zod.z.string().regex(/^[a-f0-9]{64}$/),
|
|
336
|
+
sizeBytes: zod.z.number().int().nonnegative(),
|
|
337
|
+
source: zod.z.enum(["uploaded", "mojang"]),
|
|
338
|
+
active: zod.z.boolean().default(false),
|
|
339
|
+
createdAt: ISODateSchema
|
|
340
|
+
});
|
|
341
|
+
var EquipCosmeticInputSchema = zod.z.object({
|
|
342
|
+
cosmeticId: UUIDSchema,
|
|
343
|
+
equipped: zod.z.boolean()
|
|
344
|
+
});
|
|
345
|
+
var CreateOutfitInputSchema = zod.z.object({
|
|
346
|
+
name: zod.z.string().min(1).max(64),
|
|
347
|
+
slots: zod.z.array(OutfitSlotSchema).max(8)
|
|
348
|
+
});
|
|
349
|
+
var UpdateOutfitInputSchema = zod.z.object({
|
|
350
|
+
id: UUIDSchema,
|
|
351
|
+
name: zod.z.string().min(1).max(64).optional(),
|
|
352
|
+
slots: zod.z.array(OutfitSlotSchema).max(8).optional()
|
|
353
|
+
});
|
|
354
|
+
var DeleteOutfitInputSchema = zod.z.object({ id: UUIDSchema });
|
|
355
|
+
var SaveEmoteWheelInputSchema = zod.z.object({
|
|
356
|
+
id: UUIDSchema.nullable(),
|
|
357
|
+
name: zod.z.string().min(1).max(64),
|
|
358
|
+
slots: zod.z.array(EmoteWheelSlotSchema).length(8)
|
|
359
|
+
});
|
|
360
|
+
var UploadSkinInputSchema = zod.z.object({
|
|
361
|
+
name: zod.z.string().min(1).max(64),
|
|
362
|
+
variant: SkinVariantSchema,
|
|
363
|
+
// base64 of the PNG bytes
|
|
364
|
+
data: zod.z.string().min(1)
|
|
365
|
+
});
|
|
366
|
+
var SetActiveSkinInputSchema = zod.z.object({ id: UUIDSchema });
|
|
367
|
+
var ChannelKindSchema = zod.z.enum(["DM", "GROUP", "ANNOUNCEMENT"]);
|
|
368
|
+
var ChatMemberSchema = zod.z.object({
|
|
369
|
+
user: UserSummarySchema,
|
|
370
|
+
role: zod.z.enum(["owner", "admin", "member"]),
|
|
371
|
+
joinedAt: ISODateSchema,
|
|
372
|
+
lastReadAt: ISODateSchema.nullable(),
|
|
373
|
+
muted: zod.z.boolean().default(false)
|
|
374
|
+
});
|
|
375
|
+
var ChannelSchema = zod.z.object({
|
|
376
|
+
id: UUIDSchema,
|
|
377
|
+
kind: ChannelKindSchema,
|
|
378
|
+
name: zod.z.string().nullable(),
|
|
379
|
+
// null for DMs
|
|
380
|
+
members: zod.z.array(ChatMemberSchema),
|
|
381
|
+
createdAt: ISODateSchema,
|
|
382
|
+
lastMessageAt: ISODateSchema.nullable(),
|
|
383
|
+
unreadCount: zod.z.number().int().nonnegative().default(0)
|
|
384
|
+
});
|
|
385
|
+
var MessageSchema = zod.z.object({
|
|
386
|
+
id: UUIDSchema,
|
|
387
|
+
channelId: UUIDSchema,
|
|
388
|
+
authorUuid: UUIDSchema,
|
|
389
|
+
authorDisplayName: zod.z.string(),
|
|
390
|
+
body: zod.z.string(),
|
|
391
|
+
// Markdown can be client-rendered; for the scaffold we ship it raw.
|
|
392
|
+
bodyMarkdown: zod.z.string().optional(),
|
|
393
|
+
createdAt: ISODateSchema,
|
|
394
|
+
editedAt: ISODateSchema.nullable(),
|
|
395
|
+
deletedAt: ISODateSchema.nullable(),
|
|
396
|
+
// Optional references
|
|
397
|
+
replyTo: UUIDSchema.nullable().optional()
|
|
398
|
+
});
|
|
399
|
+
var ListChannelsInputSchema = zod.z.object({
|
|
400
|
+
kind: ChannelKindSchema.optional()
|
|
401
|
+
});
|
|
402
|
+
var CreateDMInputSchema = zod.z.object({
|
|
403
|
+
otherUserUuid: UUIDSchema
|
|
404
|
+
});
|
|
405
|
+
var CreateGroupInputSchema = zod.z.object({
|
|
406
|
+
name: zod.z.string().min(1).max(64),
|
|
407
|
+
memberUuids: zod.z.array(UUIDSchema).min(1).max(64)
|
|
408
|
+
});
|
|
409
|
+
var ListMessagesInputSchema = zod.z.object({
|
|
410
|
+
channelId: UUIDSchema,
|
|
411
|
+
before: ISODateSchema.optional(),
|
|
412
|
+
limit: zod.z.number().int().min(1).max(200).default(50)
|
|
413
|
+
});
|
|
414
|
+
var SendMessageInputSchema = zod.z.object({
|
|
415
|
+
channelId: UUIDSchema,
|
|
416
|
+
body: zod.z.string().min(1).max(4e3),
|
|
417
|
+
replyTo: UUIDSchema.optional()
|
|
418
|
+
});
|
|
419
|
+
var EditMessageInputSchema = zod.z.object({
|
|
420
|
+
id: UUIDSchema,
|
|
421
|
+
body: zod.z.string().min(1).max(4e3)
|
|
422
|
+
});
|
|
423
|
+
var DeleteMessageInputSchema = zod.z.object({
|
|
424
|
+
id: UUIDSchema
|
|
425
|
+
});
|
|
426
|
+
var MarkReadInputSchema = zod.z.object({
|
|
427
|
+
channelId: UUIDSchema,
|
|
428
|
+
messageId: UUIDSchema
|
|
429
|
+
});
|
|
430
|
+
var ReportMessageInputSchema = zod.z.object({
|
|
431
|
+
messageId: UUIDSchema,
|
|
432
|
+
reason: zod.z.enum(["spam", "harassment", "illegal", "other"]),
|
|
433
|
+
note: zod.z.string().max(500).optional()
|
|
434
|
+
});
|
|
435
|
+
var ChannelReportsInputSchema = zod.z.object({
|
|
436
|
+
channelId: UUIDSchema,
|
|
437
|
+
start: ISODateSchema.optional(),
|
|
438
|
+
end: ISODateSchema.optional()
|
|
439
|
+
});
|
|
440
|
+
var MediaKindSchema = zod.z.enum(["screenshot", "video", "world", "skin"]);
|
|
441
|
+
var MediaItemSchema = zod.z.object({
|
|
442
|
+
id: UUIDSchema,
|
|
443
|
+
kind: MediaKindSchema,
|
|
444
|
+
url: zod.z.string().url(),
|
|
445
|
+
thumbnailUrl: zod.z.string().url().nullable(),
|
|
446
|
+
sha256: zod.z.string().regex(/^[a-f0-9]{64}$/),
|
|
447
|
+
sizeBytes: zod.z.number().int().nonnegative(),
|
|
448
|
+
width: zod.z.number().int().positive().optional(),
|
|
449
|
+
height: zod.z.number().int().positive().optional(),
|
|
450
|
+
durationSec: zod.z.number().int().nonnegative().optional(),
|
|
451
|
+
createdAt: ISODateSchema
|
|
452
|
+
});
|
|
453
|
+
var ListMediaInputSchema = zod.z.object({
|
|
454
|
+
kind: MediaKindSchema.optional(),
|
|
455
|
+
limit: zod.z.number().int().min(1).max(200).default(50),
|
|
456
|
+
offset: zod.z.number().int().min(0).default(0)
|
|
457
|
+
});
|
|
458
|
+
var UploadMediaInputSchema = zod.z.object({
|
|
459
|
+
kind: MediaKindSchema,
|
|
460
|
+
// base64 of the file bytes
|
|
461
|
+
data: zod.z.string().min(1),
|
|
462
|
+
filename: zod.z.string().min(1).max(255),
|
|
463
|
+
width: zod.z.number().int().positive().optional(),
|
|
464
|
+
height: zod.z.number().int().positive().optional()
|
|
465
|
+
});
|
|
466
|
+
var DeleteMediaInputSchema = zod.z.object({ id: UUIDSchema });
|
|
467
|
+
var SignalingKindSchema = zod.z.enum(["offer", "answer", "candidate"]);
|
|
468
|
+
var SignalingMessageSchema = zod.z.object({
|
|
469
|
+
id: UUIDSchema,
|
|
470
|
+
kind: SignalingKindSchema,
|
|
471
|
+
fromUuid: UUIDSchema,
|
|
472
|
+
toUuid: UUIDSchema,
|
|
473
|
+
payload: zod.z.string(),
|
|
474
|
+
// JSON-encoded SDP / ICE
|
|
475
|
+
createdAt: ISODateSchema
|
|
476
|
+
});
|
|
477
|
+
var SendSignalingInputSchema = zod.z.object({
|
|
478
|
+
toUuid: UUIDSchema,
|
|
479
|
+
kind: SignalingKindSchema,
|
|
480
|
+
payload: zod.z.string()
|
|
481
|
+
});
|
|
482
|
+
zod.z.object({
|
|
483
|
+
fromUuid: UUIDSchema.optional(),
|
|
484
|
+
since: ISODateSchema.optional()
|
|
485
|
+
});
|
|
486
|
+
var UpnpSessionStatusSchema = zod.z.enum(["pending", "active", "closed", "error"]);
|
|
487
|
+
var UpnpSessionSchema = zod.z.object({
|
|
488
|
+
id: UUIDSchema,
|
|
489
|
+
ownerUuid: UUIDSchema,
|
|
490
|
+
ownerDisplayName: zod.z.string(),
|
|
491
|
+
publicAddress: zod.z.string(),
|
|
492
|
+
publicPort: zod.z.number().int().min(1).max(65535),
|
|
493
|
+
localAddress: zod.z.string(),
|
|
494
|
+
localPort: zod.z.number().int().min(1).max(65535),
|
|
495
|
+
status: UpnpSessionStatusSchema,
|
|
496
|
+
createdAt: ISODateSchema,
|
|
497
|
+
closedAt: ISODateSchema.nullable(),
|
|
498
|
+
invitedUuids: zod.z.array(UUIDSchema)
|
|
499
|
+
});
|
|
500
|
+
var CreateUpnpInputSchema = zod.z.object({
|
|
501
|
+
localAddress: zod.z.string(),
|
|
502
|
+
localPort: zod.z.number().int().min(1).max(65535),
|
|
503
|
+
invitedUuids: zod.z.array(UUIDSchema).default([])
|
|
504
|
+
});
|
|
505
|
+
var CloseUpnpInputSchema = zod.z.object({ id: UUIDSchema });
|
|
506
|
+
var KnownServerSchema = zod.z.object({
|
|
507
|
+
id: UUIDSchema,
|
|
508
|
+
name: zod.z.string(),
|
|
509
|
+
address: zod.z.string(),
|
|
510
|
+
description: zod.z.string().optional(),
|
|
511
|
+
iconUrl: zod.z.string().url().nullable(),
|
|
512
|
+
playerCount: zod.z.number().int().nonnegative().nullable(),
|
|
513
|
+
maxPlayers: zod.z.number().int().positive().nullable(),
|
|
514
|
+
version: zod.z.string().nullable(),
|
|
515
|
+
pingMs: zod.z.number().int().nonnegative().nullable(),
|
|
516
|
+
source: zod.z.enum(["anvil", "community"])
|
|
517
|
+
});
|
|
518
|
+
var SystemStatusSchema = zod.z.object({
|
|
519
|
+
status: zod.z.enum(["operational", "degraded", "outage"]),
|
|
520
|
+
maintenanceUntil: ISODateSchema.nullable(),
|
|
521
|
+
message: zod.z.string().nullable()
|
|
522
|
+
});
|
|
523
|
+
var InstalledInstanceSchema = zod.z.object({
|
|
524
|
+
id: UUIDSchema,
|
|
525
|
+
name: zod.z.string(),
|
|
526
|
+
mcVersion: zod.z.string(),
|
|
527
|
+
loader: LoaderTypeSchema,
|
|
528
|
+
loaderVersion: zod.z.string(),
|
|
529
|
+
path: zod.z.string(),
|
|
530
|
+
sizeBytes: zod.z.number().int().nonnegative(),
|
|
531
|
+
lastPlayedAt: ISODateSchema.nullable(),
|
|
532
|
+
installedAt: ISODateSchema
|
|
533
|
+
});
|
|
534
|
+
var ReportTelemetryInputSchema = zod.z.object({
|
|
535
|
+
event: zod.z.enum(["launch", "playtime", "crash"]),
|
|
536
|
+
metadata: zod.z.record(zod.z.string(), zod.z.string()).default({})
|
|
537
|
+
});
|
|
538
|
+
var LauncherUpdateInfoSchema = zod.z.object({
|
|
539
|
+
currentVersion: zod.z.string(),
|
|
540
|
+
latestVersion: zod.z.string(),
|
|
541
|
+
updateAvailable: zod.z.boolean(),
|
|
542
|
+
changelog: zod.z.string().nullable(),
|
|
543
|
+
downloadUrl: zod.z.string().url().nullable()
|
|
544
|
+
});
|
|
545
|
+
|
|
546
|
+
// src/router.ts
|
|
547
|
+
var createContext = async (opts) => {
|
|
548
|
+
return {
|
|
549
|
+
userUuid: opts.userUuid,
|
|
550
|
+
token: opts.token,
|
|
551
|
+
requestId: opts.requestId ?? (typeof crypto !== "undefined" ? crypto.randomUUID() : Math.random().toString())
|
|
552
|
+
};
|
|
553
|
+
};
|
|
554
|
+
var t = server.initTRPC.context().create({
|
|
555
|
+
// No superjson transformer in the scaffold. The MSW dev layer
|
|
556
|
+
// returns plain `{ result: { data } }` envelopes; using
|
|
557
|
+
// superjson here requires the server to wrap responses in
|
|
558
|
+
// `{ result: { data, meta: { values } } }`, which the MSW
|
|
559
|
+
// handlers don't (and shouldn't) emit. All our data is
|
|
560
|
+
// JSON-serializable so the default transformer is correct.
|
|
561
|
+
// When `apps/api` is wired, either re-introduce superjson
|
|
562
|
+
// here AND update the MSW handlers to match, or leave the
|
|
563
|
+
// default transformer in place (the prod NestJS handler can
|
|
564
|
+
// also omit the transformer).
|
|
565
|
+
errorFormatter: ({ shape }) => ({
|
|
566
|
+
...shape,
|
|
567
|
+
data: {
|
|
568
|
+
code: shape.data.code,
|
|
569
|
+
httpStatus: shape.data.httpStatus
|
|
570
|
+
}
|
|
571
|
+
})
|
|
572
|
+
});
|
|
573
|
+
var router = t.router;
|
|
574
|
+
var publicProcedure = t.procedure;
|
|
575
|
+
var middleware = t.middleware;
|
|
576
|
+
var isAuthed = middleware(({ ctx, next }) => {
|
|
577
|
+
if (!ctx.userUuid) {
|
|
578
|
+
throw new server.TRPCError({
|
|
579
|
+
code: "UNAUTHORIZED",
|
|
580
|
+
message: "Authentication required"
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
const parsed = UUIDSchema.safeParse(ctx.userUuid);
|
|
584
|
+
if (!parsed.success) {
|
|
585
|
+
throw new server.TRPCError({
|
|
586
|
+
code: "UNAUTHORIZED",
|
|
587
|
+
message: "Invalid user identifier"
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
return next({ ctx: { ...ctx, userUuid: ctx.userUuid } });
|
|
591
|
+
});
|
|
592
|
+
var protectedProcedure = t.procedure.use(isAuthed);
|
|
593
|
+
var authRouter = router({
|
|
594
|
+
// --- Anvil auth (email + password) ---
|
|
595
|
+
signIn: publicProcedure.input(LoginInputSchema).output(
|
|
596
|
+
zod.z.object({
|
|
597
|
+
accessToken: zod.z.string(),
|
|
598
|
+
refreshToken: zod.z.string(),
|
|
599
|
+
expiresAt: zod.z.string().datetime(),
|
|
600
|
+
user: UserSummarySchema
|
|
601
|
+
})
|
|
602
|
+
).mutation(() => {
|
|
603
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
604
|
+
}),
|
|
605
|
+
signUp: publicProcedure.input(RegisterInputSchema).output(
|
|
606
|
+
zod.z.object({
|
|
607
|
+
accessToken: zod.z.string(),
|
|
608
|
+
refreshToken: zod.z.string(),
|
|
609
|
+
expiresAt: zod.z.string().datetime(),
|
|
610
|
+
user: UserSummarySchema
|
|
611
|
+
})
|
|
612
|
+
).mutation(() => {
|
|
613
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
614
|
+
}),
|
|
615
|
+
refresh: publicProcedure.input(RefreshInputSchema).output(
|
|
616
|
+
zod.z.object({
|
|
617
|
+
accessToken: zod.z.string(),
|
|
618
|
+
refreshToken: zod.z.string(),
|
|
619
|
+
expiresAt: zod.z.string().datetime()
|
|
620
|
+
})
|
|
621
|
+
).mutation(() => {
|
|
622
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
623
|
+
}),
|
|
624
|
+
validate: publicProcedure.input(ValidateInputSchema).output(
|
|
625
|
+
zod.z.object({
|
|
626
|
+
valid: zod.z.boolean(),
|
|
627
|
+
user: UserSummarySchema.optional(),
|
|
628
|
+
expiresAt: zod.z.string().datetime().optional()
|
|
629
|
+
})
|
|
630
|
+
).query(() => {
|
|
631
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
632
|
+
}),
|
|
633
|
+
forgotPassword: publicProcedure.input(ForgotPasswordInputSchema).output(zod.z.void()).mutation(() => {
|
|
634
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
635
|
+
}),
|
|
636
|
+
resetPassword: publicProcedure.input(ResetPasswordInputSchema).output(zod.z.void()).mutation(() => {
|
|
637
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
638
|
+
}),
|
|
639
|
+
signOut: protectedProcedure.output(zod.z.void()).mutation(() => {
|
|
640
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
641
|
+
}),
|
|
642
|
+
// --- Session (current authenticated user) ---
|
|
643
|
+
session: router({
|
|
644
|
+
current: protectedProcedure.output(SessionSchema).query(() => {
|
|
645
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
646
|
+
})
|
|
647
|
+
}),
|
|
648
|
+
// --- Mojang auth (Microsoft OAuth) -- spec §5.1 ---
|
|
649
|
+
mojang: router({
|
|
650
|
+
startDeviceCode: publicProcedure.output(
|
|
651
|
+
zod.z.object({
|
|
652
|
+
deviceCode: zod.z.string(),
|
|
653
|
+
userCode: zod.z.string(),
|
|
654
|
+
verificationUri: zod.z.string().url(),
|
|
655
|
+
expiresIn: zod.z.number().int(),
|
|
656
|
+
interval: zod.z.number().int()
|
|
657
|
+
})
|
|
658
|
+
).mutation(() => {
|
|
659
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
660
|
+
}),
|
|
661
|
+
pollDeviceCode: publicProcedure.input(zod.z.object({ deviceCode: zod.z.string() })).output(
|
|
662
|
+
zod.z.discriminatedUnion("kind", [
|
|
663
|
+
zod.z.object({
|
|
664
|
+
kind: zod.z.literal("success"),
|
|
665
|
+
mcAccessToken: zod.z.string(),
|
|
666
|
+
mcRefreshToken: zod.z.string(),
|
|
667
|
+
mcExpiresAt: zod.z.string().datetime(),
|
|
668
|
+
profile: zod.z.object({ uuid: UUIDSchema, username: zod.z.string() })
|
|
669
|
+
}),
|
|
670
|
+
zod.z.object({ kind: zod.z.literal("pending") }),
|
|
671
|
+
zod.z.object({
|
|
672
|
+
kind: zod.z.literal("error"),
|
|
673
|
+
code: zod.z.enum(["authorization_declined", "expired", "slow_down"])
|
|
674
|
+
})
|
|
675
|
+
])
|
|
676
|
+
).query(() => {
|
|
677
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
678
|
+
})
|
|
679
|
+
})
|
|
680
|
+
});
|
|
681
|
+
var buildsRouter = router({
|
|
682
|
+
list: publicProcedure.input(ListBuildsInputSchema).output(
|
|
683
|
+
zod.z.object({
|
|
684
|
+
items: zod.z.array(BuildSummarySchema),
|
|
685
|
+
total: zod.z.number().int().nonnegative(),
|
|
686
|
+
page: zod.z.number().int().min(1),
|
|
687
|
+
pageSize: zod.z.number().int().min(1)
|
|
688
|
+
})
|
|
689
|
+
).query(() => {
|
|
690
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
691
|
+
}),
|
|
692
|
+
get: publicProcedure.input(GetBuildInputSchema).output(BuildSchema).query(() => {
|
|
693
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
694
|
+
}),
|
|
695
|
+
getVersions: publicProcedure.input(zod.z.object({ buildId: UUIDSchema })).output(zod.z.array(zod.z.any())).query(() => {
|
|
696
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
697
|
+
}),
|
|
698
|
+
requestDownload: protectedProcedure.input(RequestDownloadInputSchema).output(RequestDownloadOutputSchema).mutation(() => {
|
|
699
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
700
|
+
})
|
|
701
|
+
});
|
|
702
|
+
var licensesRouter = router({
|
|
703
|
+
list: protectedProcedure.input(ListLicensesInputSchema).output(zod.z.array(LicenseSchema)).query(() => {
|
|
704
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
705
|
+
}),
|
|
706
|
+
check: protectedProcedure.input(CheckLicenseInputSchema).output(CheckLicenseOutputSchema).query(() => {
|
|
707
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
708
|
+
})
|
|
709
|
+
});
|
|
710
|
+
var healthRouter = router({
|
|
711
|
+
ping: publicProcedure.output(zod.z.object({ status: zod.z.string(), version: zod.z.string(), timestamp: zod.z.string().datetime() })).query(() => ({
|
|
712
|
+
status: "ok",
|
|
713
|
+
version: "0.0.0",
|
|
714
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
715
|
+
})),
|
|
716
|
+
version: publicProcedure.output(
|
|
717
|
+
zod.z.object({
|
|
718
|
+
api: zod.z.string(),
|
|
719
|
+
minLauncher: zod.z.string(),
|
|
720
|
+
recommendedLauncher: zod.z.string(),
|
|
721
|
+
deprecations: zod.z.array(zod.z.string())
|
|
722
|
+
})
|
|
723
|
+
).query(() => ({
|
|
724
|
+
api: "0.0.0",
|
|
725
|
+
minLauncher: "0.0.0",
|
|
726
|
+
recommendedLauncher: "0.0.0",
|
|
727
|
+
deprecations: []
|
|
728
|
+
}))
|
|
729
|
+
});
|
|
730
|
+
var socialRouter = router({
|
|
731
|
+
relationships: router({
|
|
732
|
+
create: protectedProcedure.input(CreateRelationshipInputSchema).output(zod.z.object({ relationship: RelationshipSchema, created: zod.z.boolean() })).mutation(() => {
|
|
733
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
734
|
+
}),
|
|
735
|
+
delete: protectedProcedure.input(DeleteRelationshipInputSchema).output(zod.z.object({ deleted: zod.z.boolean() })).mutation(() => {
|
|
736
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
737
|
+
}),
|
|
738
|
+
list: protectedProcedure.input(ListRelationshipsInputSchema).output(zod.z.object({ items: zod.z.array(RelationshipSchema) })).query(() => {
|
|
739
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
740
|
+
}),
|
|
741
|
+
acceptRequest: protectedProcedure.input(AcceptRequestInputSchema).output(zod.z.object({ relationship: RelationshipSchema })).mutation(() => {
|
|
742
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
743
|
+
}),
|
|
744
|
+
cancelRequest: protectedProcedure.input(CancelRequestInputSchema).output(zod.z.object({ cancelled: zod.z.boolean() })).mutation(() => {
|
|
745
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
746
|
+
})
|
|
747
|
+
}),
|
|
748
|
+
users: router({
|
|
749
|
+
lookupByName: protectedProcedure.input(LookupByNameInputSchema).output(LookupByNameOutputSchema).query(() => {
|
|
750
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
751
|
+
})
|
|
752
|
+
}),
|
|
753
|
+
presence: router({
|
|
754
|
+
/**
|
|
755
|
+
* Query (not subscription) in this scaffold. Prod presence streaming
|
|
756
|
+
* will land as a separate /v1/ws subscription multiplexed over the
|
|
757
|
+
* WebSocket gateway. For now the MSW layer returns a snapshot of the
|
|
758
|
+
* current presence map; the client polls every 5s.
|
|
759
|
+
*/
|
|
760
|
+
get: protectedProcedure.input(zod.z.object({ uuids: zod.z.array(UUIDSchema) })).output(zod.z.object({ items: zod.z.array(PresenceSchema) })).query(() => {
|
|
761
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
762
|
+
})
|
|
763
|
+
}),
|
|
764
|
+
activity: router({
|
|
765
|
+
report: protectedProcedure.input(ReportActivityInputSchema).output(zod.z.void()).mutation(() => {
|
|
766
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
767
|
+
})
|
|
768
|
+
}),
|
|
769
|
+
invites: router({
|
|
770
|
+
toServer: protectedProcedure.input(InviteToServerInputSchema).output(zod.z.object({ delivered: zod.z.boolean() })).mutation(() => {
|
|
771
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
772
|
+
})
|
|
773
|
+
}),
|
|
774
|
+
trustedHosts: router({
|
|
775
|
+
list: protectedProcedure.input(zod.z.void()).output(zod.z.object({ items: zod.z.array(TrustedHostSchema) })).query(() => {
|
|
776
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
777
|
+
}),
|
|
778
|
+
create: protectedProcedure.input(CreateTrustedHostInputSchema).output(zod.z.object({ host: TrustedHostSchema })).mutation(() => {
|
|
779
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
780
|
+
}),
|
|
781
|
+
delete: protectedProcedure.input(DeleteTrustedHostInputSchema).output(zod.z.object({ deleted: zod.z.boolean() })).mutation(() => {
|
|
782
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
783
|
+
})
|
|
784
|
+
}),
|
|
785
|
+
communityRules: router({
|
|
786
|
+
get: protectedProcedure.input(zod.z.void()).output(CommunityRulesStatusSchema).query(() => {
|
|
787
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
788
|
+
}),
|
|
789
|
+
agree: protectedProcedure.input(zod.z.void()).output(zod.z.object({ accepted: zod.z.boolean() })).mutation(() => {
|
|
790
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
791
|
+
})
|
|
792
|
+
}),
|
|
793
|
+
suspension: router({
|
|
794
|
+
get: protectedProcedure.input(zod.z.void()).output(SuspensionStatusSchema).query(() => {
|
|
795
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
796
|
+
})
|
|
797
|
+
})
|
|
798
|
+
});
|
|
799
|
+
var cosmeticsRouter = router({
|
|
800
|
+
list: protectedProcedure.input(
|
|
801
|
+
zod.z.object({
|
|
802
|
+
type: zod.z.enum(["hat", "body", "back", "face", "hand", "feet", "particle", "emote"]).optional(),
|
|
803
|
+
owned: zod.z.boolean().optional(),
|
|
804
|
+
limit: zod.z.number().int().min(1).max(200).default(60),
|
|
805
|
+
offset: zod.z.number().int().min(0).default(0)
|
|
806
|
+
})
|
|
807
|
+
).output(zod.z.object({ items: zod.z.array(CosmeticSchema), total: zod.z.number().int().nonnegative() })).query(() => {
|
|
808
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
809
|
+
}),
|
|
810
|
+
equip: protectedProcedure.input(EquipCosmeticInputSchema).output(zod.z.object({ ok: zod.z.boolean() })).mutation(() => {
|
|
811
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
812
|
+
})
|
|
813
|
+
});
|
|
814
|
+
var outfitsRouter = router({
|
|
815
|
+
list: protectedProcedure.input(zod.z.void()).output(zod.z.object({ items: zod.z.array(OutfitSchema) })).query(() => {
|
|
816
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
817
|
+
}),
|
|
818
|
+
create: protectedProcedure.input(CreateOutfitInputSchema).output(zod.z.object({ outfit: OutfitSchema })).mutation(() => {
|
|
819
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
820
|
+
}),
|
|
821
|
+
update: protectedProcedure.input(UpdateOutfitInputSchema).output(zod.z.object({ outfit: OutfitSchema })).mutation(() => {
|
|
822
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
823
|
+
}),
|
|
824
|
+
delete: protectedProcedure.input(DeleteOutfitInputSchema).output(zod.z.object({ deleted: zod.z.boolean() })).mutation(() => {
|
|
825
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
826
|
+
})
|
|
827
|
+
});
|
|
828
|
+
var emoteWheelsRouter = router({
|
|
829
|
+
list: protectedProcedure.input(zod.z.void()).output(zod.z.object({ items: zod.z.array(EmoteWheelSchema) })).query(() => {
|
|
830
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
831
|
+
}),
|
|
832
|
+
save: protectedProcedure.input(SaveEmoteWheelInputSchema).output(zod.z.object({ wheel: EmoteWheelSchema })).mutation(() => {
|
|
833
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
834
|
+
})
|
|
835
|
+
});
|
|
836
|
+
var skinsRouter = router({
|
|
837
|
+
list: protectedProcedure.input(zod.z.void()).output(zod.z.object({ items: zod.z.array(SkinSchema) })).query(() => {
|
|
838
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
839
|
+
}),
|
|
840
|
+
upload: protectedProcedure.input(UploadSkinInputSchema).output(zod.z.object({ skin: SkinSchema })).mutation(() => {
|
|
841
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
842
|
+
}),
|
|
843
|
+
setActive: protectedProcedure.input(SetActiveSkinInputSchema).output(zod.z.object({ ok: zod.z.boolean() })).mutation(() => {
|
|
844
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
845
|
+
})
|
|
846
|
+
});
|
|
847
|
+
var chatRouter = router({
|
|
848
|
+
channels: router({
|
|
849
|
+
list: protectedProcedure.input(ListChannelsInputSchema).output(zod.z.object({ items: zod.z.array(ChannelSchema) })).query(() => {
|
|
850
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
851
|
+
}),
|
|
852
|
+
createDM: protectedProcedure.input(CreateDMInputSchema).output(zod.z.object({ channel: ChannelSchema })).mutation(() => {
|
|
853
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
854
|
+
}),
|
|
855
|
+
createGroup: protectedProcedure.input(CreateGroupInputSchema).output(zod.z.object({ channel: ChannelSchema })).mutation(() => {
|
|
856
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
857
|
+
})
|
|
858
|
+
}),
|
|
859
|
+
messages: router({
|
|
860
|
+
list: protectedProcedure.input(ListMessagesInputSchema).output(zod.z.object({ items: zod.z.array(MessageSchema) })).query(() => {
|
|
861
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
862
|
+
}),
|
|
863
|
+
send: protectedProcedure.input(SendMessageInputSchema).output(zod.z.object({ message: MessageSchema })).mutation(() => {
|
|
864
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
865
|
+
}),
|
|
866
|
+
edit: protectedProcedure.input(EditMessageInputSchema).output(zod.z.object({ message: MessageSchema })).mutation(() => {
|
|
867
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
868
|
+
}),
|
|
869
|
+
delete: protectedProcedure.input(DeleteMessageInputSchema).output(zod.z.object({ deleted: zod.z.boolean() })).mutation(() => {
|
|
870
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
871
|
+
}),
|
|
872
|
+
markRead: protectedProcedure.input(MarkReadInputSchema).output(zod.z.object({ ok: zod.z.boolean() })).mutation(() => {
|
|
873
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
874
|
+
}),
|
|
875
|
+
report: protectedProcedure.input(ReportMessageInputSchema).output(zod.z.object({ reported: zod.z.boolean() })).mutation(() => {
|
|
876
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
877
|
+
}),
|
|
878
|
+
reports: protectedProcedure.input(ChannelReportsInputSchema).output(zod.z.object({ items: zod.z.array(zod.z.any()) })).query(() => {
|
|
879
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
880
|
+
})
|
|
881
|
+
})
|
|
882
|
+
});
|
|
883
|
+
var mediaRouter = router({
|
|
884
|
+
list: protectedProcedure.input(ListMediaInputSchema).output(zod.z.object({ items: zod.z.array(MediaItemSchema) })).query(() => {
|
|
885
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
886
|
+
}),
|
|
887
|
+
upload: protectedProcedure.input(UploadMediaInputSchema).output(zod.z.object({ item: MediaItemSchema })).mutation(() => {
|
|
888
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
889
|
+
}),
|
|
890
|
+
delete: protectedProcedure.input(DeleteMediaInputSchema).output(zod.z.object({ deleted: zod.z.boolean() })).mutation(() => {
|
|
891
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
892
|
+
})
|
|
893
|
+
});
|
|
894
|
+
var multiplayerRouter = router({
|
|
895
|
+
sendSignaling: protectedProcedure.input(SendSignalingInputSchema).output(zod.z.object({ message: SignalingMessageSchema })).mutation(() => {
|
|
896
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
897
|
+
}),
|
|
898
|
+
listSignaling: protectedProcedure.input(zod.z.object({ fromUuid: UUIDSchema.optional(), since: ISODateSchema.optional() })).output(zod.z.object({ items: zod.z.array(SignalingMessageSchema) })).query(() => {
|
|
899
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
900
|
+
})
|
|
901
|
+
});
|
|
902
|
+
var upnpRouter = router({
|
|
903
|
+
list: protectedProcedure.input(zod.z.void()).output(zod.z.object({ items: zod.z.array(UpnpSessionSchema) })).query(() => {
|
|
904
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
905
|
+
}),
|
|
906
|
+
create: protectedProcedure.input(CreateUpnpInputSchema).output(zod.z.object({ session: UpnpSessionSchema })).mutation(() => {
|
|
907
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
908
|
+
}),
|
|
909
|
+
close: protectedProcedure.input(CloseUpnpInputSchema).output(zod.z.object({ closed: zod.z.boolean() })).mutation(() => {
|
|
910
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
911
|
+
})
|
|
912
|
+
});
|
|
913
|
+
var discoveryRouter = router({
|
|
914
|
+
list: protectedProcedure.input(zod.z.void()).output(zod.z.object({ items: zod.z.array(KnownServerSchema) })).query(() => {
|
|
915
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
916
|
+
})
|
|
917
|
+
});
|
|
918
|
+
var systemRouter = router({
|
|
919
|
+
status: protectedProcedure.input(zod.z.void()).output(SystemStatusSchema).query(() => {
|
|
920
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
921
|
+
})
|
|
922
|
+
});
|
|
923
|
+
var instancesRouter = router({
|
|
924
|
+
list: protectedProcedure.input(zod.z.void()).output(zod.z.object({ items: zod.z.array(InstalledInstanceSchema) })).query(() => {
|
|
925
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
926
|
+
})
|
|
927
|
+
});
|
|
928
|
+
var telemetryRouter = router({
|
|
929
|
+
report: protectedProcedure.input(ReportTelemetryInputSchema).output(zod.z.object({ ok: zod.z.boolean() })).mutation(() => {
|
|
930
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
931
|
+
})
|
|
932
|
+
});
|
|
933
|
+
var launcherRouter = router({
|
|
934
|
+
updateCheck: protectedProcedure.input(zod.z.void()).output(LauncherUpdateInfoSchema).query(() => {
|
|
935
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
936
|
+
})
|
|
937
|
+
});
|
|
938
|
+
var adminRouter = router({
|
|
939
|
+
users: router({
|
|
940
|
+
list: protectedProcedure.input(zod.z.object({ limit: zod.z.number().optional(), offset: zod.z.number().optional(), search: zod.z.string().optional() }).optional()).query(() => {
|
|
941
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
942
|
+
}),
|
|
943
|
+
get: protectedProcedure.input(zod.z.object({ uuid: zod.z.string() })).query(() => {
|
|
944
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
945
|
+
}),
|
|
946
|
+
updateRole: protectedProcedure.input(zod.z.object({ uuid: zod.z.string(), role: zod.z.enum(["USER", "MODERATOR", "ADMIN"]) })).mutation(() => {
|
|
947
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
948
|
+
}),
|
|
949
|
+
ban: protectedProcedure.input(zod.z.object({ uuid: zod.z.string() })).mutation(() => {
|
|
950
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
951
|
+
})
|
|
952
|
+
}),
|
|
953
|
+
builds: router({
|
|
954
|
+
list: protectedProcedure.query(() => {
|
|
955
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
956
|
+
}),
|
|
957
|
+
create: protectedProcedure.input(zod.z.object({ slug: zod.z.string(), name: zod.z.string(), shortDescription: zod.z.string().optional(), iconUrl: zod.z.string().optional(), visibility: zod.z.enum(["PUBLIC", "PRIVATE", "UNLISTED"]).optional() })).mutation(() => {
|
|
958
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
959
|
+
}),
|
|
960
|
+
update: protectedProcedure.input(zod.z.object({ id: zod.z.string(), name: zod.z.string().optional(), shortDescription: zod.z.string().optional(), iconUrl: zod.z.string().optional().nullable(), visibility: zod.z.enum(["PUBLIC", "PRIVATE", "UNLISTED"]).optional() })).mutation(() => {
|
|
961
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
962
|
+
}),
|
|
963
|
+
delete: protectedProcedure.input(zod.z.object({ id: zod.z.string() })).mutation(() => {
|
|
964
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
965
|
+
}),
|
|
966
|
+
listVersions: protectedProcedure.input(zod.z.object({ buildId: zod.z.string() })).query(() => {
|
|
967
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
968
|
+
}),
|
|
969
|
+
createVersion: protectedProcedure.input(zod.z.object({
|
|
970
|
+
buildId: zod.z.string(),
|
|
971
|
+
name: zod.z.string(),
|
|
972
|
+
mcVersion: zod.z.string(),
|
|
973
|
+
loader: zod.z.enum(["VANILLA", "FABRIC", "FORGE", "NEOFORGE", "QUILT"]),
|
|
974
|
+
loaderVersion: zod.z.string().optional(),
|
|
975
|
+
changelog: zod.z.string().optional(),
|
|
976
|
+
downloadUrl: zod.z.string().optional(),
|
|
977
|
+
sha256: zod.z.string().optional(),
|
|
978
|
+
bytes: zod.z.number().optional()
|
|
979
|
+
})).mutation(() => {
|
|
980
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
981
|
+
}),
|
|
982
|
+
deleteVersion: protectedProcedure.input(zod.z.object({ id: zod.z.string() })).mutation(() => {
|
|
983
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
984
|
+
})
|
|
985
|
+
}),
|
|
986
|
+
telemetry: router({
|
|
987
|
+
recent: protectedProcedure.query(() => {
|
|
988
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
989
|
+
})
|
|
990
|
+
}),
|
|
991
|
+
stats: protectedProcedure.query(() => {
|
|
992
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
993
|
+
})
|
|
994
|
+
});
|
|
995
|
+
var profileRouter = router({
|
|
996
|
+
update: protectedProcedure.input(zod.z.object({ displayName: zod.z.string().optional(), bio: zod.z.string().optional().nullable(), avatarUrl: zod.z.string().url().optional().nullable() })).mutation(() => {
|
|
997
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
998
|
+
}),
|
|
999
|
+
changePassword: protectedProcedure.input(zod.z.object({ currentPassword: zod.z.string(), newPassword: zod.z.string().min(8) })).mutation(() => {
|
|
1000
|
+
throw new server.TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "not implemented" });
|
|
1001
|
+
})
|
|
1002
|
+
});
|
|
1003
|
+
var appRouter = router({
|
|
1004
|
+
v1: router({
|
|
1005
|
+
health: healthRouter,
|
|
1006
|
+
auth: authRouter,
|
|
1007
|
+
profile: profileRouter,
|
|
1008
|
+
builds: buildsRouter,
|
|
1009
|
+
licenses: licensesRouter,
|
|
1010
|
+
social: socialRouter,
|
|
1011
|
+
cosmetics: cosmeticsRouter,
|
|
1012
|
+
admin: adminRouter,
|
|
1013
|
+
outfits: outfitsRouter,
|
|
1014
|
+
emoteWheels: emoteWheelsRouter,
|
|
1015
|
+
skins: skinsRouter,
|
|
1016
|
+
chat: chatRouter,
|
|
1017
|
+
media: mediaRouter,
|
|
1018
|
+
multiplayer: multiplayerRouter,
|
|
1019
|
+
upnp: upnpRouter,
|
|
1020
|
+
discovery: discoveryRouter,
|
|
1021
|
+
system: systemRouter,
|
|
1022
|
+
instances: instancesRouter,
|
|
1023
|
+
telemetry: telemetryRouter,
|
|
1024
|
+
launcher: launcherRouter
|
|
1025
|
+
})
|
|
1026
|
+
});
|
|
1027
|
+
var createCaller = async (ctx) => {
|
|
1028
|
+
const context = await createContext(ctx);
|
|
1029
|
+
return appRouter.createCaller(context);
|
|
1030
|
+
};
|
|
1031
|
+
|
|
1032
|
+
exports.appRouter = appRouter;
|
|
1033
|
+
exports.createCaller = createCaller;
|
|
1034
|
+
exports.createContext = createContext;
|
|
1035
|
+
exports.protectedProcedure = protectedProcedure;
|
|
1036
|
+
exports.publicProcedure = publicProcedure;
|
|
1037
|
+
//# sourceMappingURL=server.cjs.map
|
|
1038
|
+
//# sourceMappingURL=server.cjs.map
|