Phase D
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
import { authUserSchema } from './auth';
|
||||
import { serverResponseSchema } from './servers';
|
||||
|
||||
export const whmcsHealthResponseSchema = z.object({
|
||||
@@ -61,6 +62,40 @@ export const whmcsSuspendRequestSchema = z.object({
|
||||
reason: z.string().max(256).optional(),
|
||||
});
|
||||
|
||||
export const whmcsSsoRoleSchema = z.enum(['owner', 'admin']);
|
||||
|
||||
export const whmcsSsoKindSchema = z.enum(['service', 'admin']);
|
||||
|
||||
export const whmcsCreateSsoRequestSchema = z.object({
|
||||
externalClientId: z.string().min(1).max(64),
|
||||
externalUserId: z.string().min(1).max(64),
|
||||
role: whmcsSsoRoleSchema.default('owner'),
|
||||
kind: whmcsSsoKindSchema.default('service'),
|
||||
targetPath: z.string().max(256).optional(),
|
||||
});
|
||||
|
||||
export const whmcsCreateSsoResponseSchema = z.object({
|
||||
ticketId: z.string().uuid(),
|
||||
redirectUrl: z.string().url(),
|
||||
expiresAt: z.string().datetime(),
|
||||
targetPath: z.string(),
|
||||
});
|
||||
|
||||
export const ssoConsumeRequestSchema = z.object({
|
||||
ticket: z.string().min(32).max(256),
|
||||
});
|
||||
|
||||
export const ssoImpersonationSchema = z.object({
|
||||
isImpersonation: z.boolean(),
|
||||
label: z.string().optional(),
|
||||
});
|
||||
|
||||
export const ssoConsumeResponseSchema = z.object({
|
||||
redirectPath: z.string(),
|
||||
user: authUserSchema,
|
||||
impersonation: ssoImpersonationSchema.optional(),
|
||||
});
|
||||
|
||||
export type WhmcsHealthResponse = z.infer<typeof whmcsHealthResponseSchema>;
|
||||
export type WhmcsPlanCatalogResponse = z.infer<typeof whmcsPlanCatalogResponseSchema>;
|
||||
export type WhmcsUpsertClientRequest = z.infer<typeof whmcsUpsertClientRequestSchema>;
|
||||
@@ -69,3 +104,7 @@ export type WhmcsProvisionServiceRequest = z.infer<typeof whmcsProvisionServiceR
|
||||
export type WhmcsServiceResponse = z.infer<typeof whmcsServiceResponseSchema>;
|
||||
export type WhmcsChangePackageRequest = z.infer<typeof whmcsChangePackageRequestSchema>;
|
||||
export type WhmcsSuspendRequest = z.infer<typeof whmcsSuspendRequestSchema>;
|
||||
export type WhmcsCreateSsoRequest = z.infer<typeof whmcsCreateSsoRequestSchema>;
|
||||
export type WhmcsCreateSsoResponse = z.infer<typeof whmcsCreateSsoResponseSchema>;
|
||||
export type SsoConsumeRequest = z.infer<typeof ssoConsumeRequestSchema>;
|
||||
export type SsoConsumeResponse = z.infer<typeof ssoConsumeResponseSchema>;
|
||||
|
||||
Reference in New Issue
Block a user