Phase8
This commit is contained in:
@@ -205,3 +205,16 @@ export {
|
||||
type WalletResponse,
|
||||
type UsageListResponse,
|
||||
} from './billing';
|
||||
|
||||
export {
|
||||
edgeBackendSchema,
|
||||
edgeActionSchema,
|
||||
edgeResolveResponseSchema,
|
||||
edgeStartRequestSchema,
|
||||
edgeStartResponseSchema,
|
||||
type EdgeBackend,
|
||||
type EdgeAction,
|
||||
type EdgeResolveResponse,
|
||||
type EdgeStartRequest,
|
||||
type EdgeStartResponse,
|
||||
} from './join';
|
||||
|
||||
38
packages/contracts/src/join.ts
Normal file
38
packages/contracts/src/join.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
import { gameServerStatusSchema, serverEditionSchema } from './servers';
|
||||
|
||||
export const edgeBackendSchema = z.object({
|
||||
host: z.string(),
|
||||
port: z.number().int(),
|
||||
});
|
||||
|
||||
export const edgeActionSchema = z.enum(['proxy', 'start', 'wait', 'reject']);
|
||||
|
||||
export const edgeResolveResponseSchema = z.object({
|
||||
serverId: z.string().uuid(),
|
||||
slug: z.string(),
|
||||
status: gameServerStatusSchema,
|
||||
joinToStartEnabled: z.boolean(),
|
||||
edition: serverEditionSchema,
|
||||
backend: edgeBackendSchema.nullable(),
|
||||
action: edgeActionSchema,
|
||||
message: z.string().optional(),
|
||||
});
|
||||
|
||||
export const edgeStartRequestSchema = z.object({
|
||||
clientIp: z.string().min(1).max(64),
|
||||
});
|
||||
|
||||
export const edgeStartResponseSchema = z.object({
|
||||
resolve: edgeResolveResponseSchema,
|
||||
started: z.boolean(),
|
||||
jobId: z.string().optional(),
|
||||
queuePosition: z.number().int().optional(),
|
||||
});
|
||||
|
||||
export type EdgeBackend = z.infer<typeof edgeBackendSchema>;
|
||||
export type EdgeAction = z.infer<typeof edgeActionSchema>;
|
||||
export type EdgeResolveResponse = z.infer<typeof edgeResolveResponseSchema>;
|
||||
export type EdgeStartRequest = z.infer<typeof edgeStartRequestSchema>;
|
||||
export type EdgeStartResponse = z.infer<typeof edgeStartResponseSchema>;
|
||||
@@ -61,6 +61,9 @@ export const serverResponseSchema = z.object({
|
||||
ramMb: z.number().int(),
|
||||
idleShutdownEnabled: z.boolean(),
|
||||
idleStopAt: z.string().datetime().nullable(),
|
||||
joinSlug: z.string().nullable(),
|
||||
joinHostname: z.string().nullable(),
|
||||
joinToStartEnabled: z.boolean(),
|
||||
createdAt: z.string().datetime(),
|
||||
updatedAt: z.string().datetime(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user