diff --git a/app/api/__generated__/msw-handlers.ts b/app/api/__generated__/msw-handlers.ts index 0c05bee04d..a1a593469e 100644 --- a/app/api/__generated__/msw-handlers.ts +++ b/app/api/__generated__/msw-handlers.ts @@ -14,7 +14,7 @@ import { type StrictResponse, } from 'msw' import type { Promisable, SnakeCasedPropertiesDeep as Snakify } from 'type-fest' -import { type ZodSchema } from 'zod' +import { type ZodType } from 'zod/v4' import type * as Api from './Api' import { snakeify } from './util' @@ -1808,7 +1808,7 @@ export interface MSWHandlers { }) => Promisable } -function validateParams( +function validateParams( schema: S, req: Request, pathParams: PathParams @@ -1841,8 +1841,9 @@ function validateParams( const handler = ( handler: MSWHandlers[keyof MSWHandlers], - paramSchema: ZodSchema | null, - bodySchema: ZodSchema | null + // eslint-disable-next-line @typescript-eslint/no-explicit-any + paramSchema: ZodType | null, + bodySchema: ZodType | null ) => async ({ request: req, diff --git a/app/api/__generated__/validate.ts b/app/api/__generated__/validate.ts index 3837132a8d..aa341271a8 100644 --- a/app/api/__generated__/validate.ts +++ b/app/api/__generated__/validate.ts @@ -8,7 +8,7 @@ /* eslint-disable */ -import { z, ZodType } from 'zod' +import { z, ZodType } from 'zod/v4' import { processResponseBody, uniqueItems } from './util' @@ -71,10 +71,7 @@ export const Name = z.preprocess( ) ) -export const NameOrId = z.preprocess( - processResponseBody, - z.union([z.string().uuid(), Name]) -) +export const NameOrId = z.preprocess(processResponseBody, z.union([z.uuid(), Name])) /** * An address tied to an address lot. @@ -108,7 +105,7 @@ export const AddressLot = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), kind: AddressLotKind, name: Name, timeCreated: z.coerce.date(), @@ -121,11 +118,7 @@ export const AddressLot = z.preprocess( */ export const AddressLotBlock = z.preprocess( processResponseBody, - z.object({ - firstAddress: z.string().ip(), - id: z.string().uuid(), - lastAddress: z.string().ip(), - }) + z.object({ firstAddress: z.ipv4(), id: z.uuid(), lastAddress: z.ipv4() }) ) /** @@ -133,7 +126,7 @@ export const AddressLotBlock = z.preprocess( */ export const AddressLotBlockCreate = z.preprocess( processResponseBody, - z.object({ firstAddress: z.string().ip(), lastAddress: z.string().ip() }) + z.object({ firstAddress: z.ipv4(), lastAddress: z.ipv4() }) ) /** @@ -193,10 +186,10 @@ export const AffinityGroup = z.preprocess( z.object({ description: z.string(), failureDomain: FailureDomain, - id: z.string().uuid(), + id: z.uuid(), name: Name, policy: AffinityPolicy, - projectId: z.string().uuid(), + projectId: z.uuid(), timeCreated: z.coerce.date(), timeModified: z.coerce.date(), }) @@ -215,7 +208,7 @@ export const AffinityGroupCreate = z.preprocess( }) ) -export const TypedUuidForInstanceKind = z.preprocess(processResponseBody, z.string().uuid()) +export const TypedUuidForInstanceKind = z.preprocess(processResponseBody, z.uuid()) /** * Running state of an Instance (primarily: booted or stopped) @@ -283,7 +276,10 @@ export const AffinityGroupUpdate = z.preprocess( }) ) -export const BgpMessageHistory = z.preprocess(processResponseBody, z.record(z.unknown())) +export const BgpMessageHistory = z.preprocess( + processResponseBody, + z.record(z.string(), z.unknown()) +) /** * Identifies switch physical location @@ -298,10 +294,7 @@ export const SwitchLocation = z.preprocess( */ export const SwitchBgpHistory = z.preprocess( processResponseBody, - z.object({ - history: z.record(z.string().min(1), BgpMessageHistory), - switch: SwitchLocation, - }) + z.object({ history: z.record(z.string(), BgpMessageHistory), switch: SwitchLocation }) ) /** @@ -328,7 +321,7 @@ export const AlertClassResultsPage = z.preprocess( z.object({ items: AlertClass.array(), nextPage: z.string().nullable().optional() }) ) -export const TypedUuidForAlertKind = z.preprocess(processResponseBody, z.string().uuid()) +export const TypedUuidForAlertKind = z.preprocess(processResponseBody, z.uuid()) /** * The response received from a webhook receiver endpoint. @@ -368,10 +361,7 @@ export const AlertDeliveryAttempts = z.preprocess( z.object({ webhook: WebhookDeliveryAttempt.array() }) ) -export const TypedUuidForAlertReceiverKind = z.preprocess( - processResponseBody, - z.string().uuid() -) +export const TypedUuidForAlertReceiverKind = z.preprocess(processResponseBody, z.uuid()) /** * The state of a webhook delivery attempt. @@ -398,7 +388,7 @@ export const AlertDelivery = z.preprocess( alertClass: z.string(), alertId: TypedUuidForAlertKind, attempts: AlertDeliveryAttempts, - id: z.string().uuid(), + id: z.uuid(), receiverId: TypedUuidForAlertReceiverKind, state: AlertDeliveryState, timeStarted: z.coerce.date(), @@ -408,7 +398,7 @@ export const AlertDelivery = z.preprocess( export const AlertDeliveryId = z.preprocess( processResponseBody, - z.object({ deliveryId: z.string().uuid() }) + z.object({ deliveryId: z.uuid() }) ) /** @@ -437,7 +427,7 @@ export const AlertProbeResult = z.preprocess( */ export const WebhookSecret = z.preprocess( processResponseBody, - z.object({ id: z.string().uuid(), timeCreated: z.coerce.date() }) + z.object({ id: z.uuid(), timeCreated: z.coerce.date() }) ) /** @@ -469,7 +459,7 @@ export const AlertReceiver = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), kind: AlertReceiverKind, name: Name, subscriptions: AlertSubscription.array(), @@ -535,10 +525,10 @@ export const AntiAffinityGroup = z.preprocess( z.object({ description: z.string(), failureDomain: FailureDomain, - id: z.string().uuid(), + id: z.uuid(), name: Name, policy: AffinityPolicy, - projectId: z.string().uuid(), + projectId: z.uuid(), timeCreated: z.coerce.date(), timeModified: z.coerce.date(), }) @@ -613,12 +603,8 @@ export const ArtifactId = z.preprocess( export const AuditLogEntryActor = z.preprocess( processResponseBody, z.union([ - z.object({ kind: z.enum(['user_builtin']), userBuiltinId: z.string().uuid() }), - z.object({ - kind: z.enum(['silo_user']), - siloId: z.string().uuid(), - siloUserId: z.string().uuid(), - }), + z.object({ kind: z.enum(['user_builtin']), userBuiltinId: z.uuid() }), + z.object({ kind: z.enum(['silo_user']), siloId: z.uuid(), siloUserId: z.uuid() }), z.object({ kind: z.enum(['unauthenticated']) }), ]) ) @@ -648,12 +634,12 @@ export const AuditLogEntry = z.preprocess( z.object({ actor: AuditLogEntryActor, authMethod: z.string().nullable().optional(), - id: z.string().uuid(), + id: z.uuid(), operationId: z.string(), requestId: z.string(), requestUri: z.string(), result: AuditLogEntryResult, - sourceIp: z.string().ip(), + sourceIp: z.ipv4(), timeCompleted: z.coerce.date(), timeStarted: z.coerce.date(), userAgent: z.string().nullable().optional(), @@ -703,7 +689,7 @@ export const BfdMode = z.preprocess( */ export const BfdSessionDisable = z.preprocess( processResponseBody, - z.object({ remote: z.string().ip(), switch: Name }) + z.object({ remote: z.ipv4(), switch: Name }) ) /** @@ -713,9 +699,9 @@ export const BfdSessionEnable = z.preprocess( processResponseBody, z.object({ detectionThreshold: z.number().min(0).max(255), - local: z.string().ip().nullable().optional(), + local: z.ipv4().nullable().optional(), mode: BfdMode, - remote: z.string().ip(), + remote: z.ipv4(), requiredRx: z.number().min(0), switch: Name, }) @@ -730,9 +716,9 @@ export const BfdStatus = z.preprocess( processResponseBody, z.object({ detectionThreshold: z.number().min(0).max(255), - local: z.string().ip().nullable().optional(), + local: z.ipv4().nullable().optional(), mode: BfdMode, - peer: z.string().ip(), + peer: z.ipv4(), requiredRx: z.number().min(0), state: BfdState, switch: Name, @@ -746,7 +732,7 @@ export const BgpAnnounceSet = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), name: Name, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -778,11 +764,7 @@ export const BgpAnnounceSetCreate = z.preprocess( */ export const BgpAnnouncement = z.preprocess( processResponseBody, - z.object({ - addressLotBlockId: z.string().uuid(), - announceSetId: z.string().uuid(), - network: IpNet, - }) + z.object({ addressLotBlockId: z.uuid(), announceSetId: z.uuid(), network: IpNet }) ) /** @@ -793,7 +775,7 @@ export const BgpConfig = z.preprocess( z.object({ asn: z.number().min(0).max(4294967295), description: z.string(), - id: z.string().uuid(), + id: z.uuid(), name: Name, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -828,7 +810,7 @@ export const BgpConfigResultsPage = z.preprocess( */ export const BgpExported = z.preprocess( processResponseBody, - z.object({ exports: z.record(z.string().min(1), Ipv4Net.array()) }) + z.object({ exports: z.record(z.string(), Ipv4Net.array()) }) ) /** @@ -838,7 +820,7 @@ export const BgpImportedRouteIpv4 = z.preprocess( processResponseBody, z.object({ id: z.number().min(0).max(4294967295), - nexthop: z.string().ip({ version: 'v4' }), + nexthop: z.ipv4(), prefix: Ipv4Net, switch: SwitchLocation, }) @@ -861,7 +843,7 @@ export const ImportExportPolicy = z.preprocess( export const BgpPeer = z.preprocess( processResponseBody, z.object({ - addr: z.string().ip(), + addr: z.ipv4(), allowedExport: ImportExportPolicy, allowedImport: ImportExportPolicy, bgpConfig: NameOrId, @@ -909,7 +891,7 @@ export const BgpPeerState = z.preprocess( export const BgpPeerStatus = z.preprocess( processResponseBody, z.object({ - addr: z.string().ip(), + addr: z.ipv4(), localAsn: z.number().min(0).max(4294967295), remoteAsn: z.number().min(0).max(4294967295), state: BgpPeerState, @@ -1197,7 +1179,7 @@ export const Certificate = z.preprocess( z.object({ cert: z.string(), description: z.string(), - id: z.string().uuid(), + id: z.uuid(), name: Name, service: ServiceUsingCertificate, timeCreated: z.coerce.date(), @@ -1232,11 +1214,7 @@ export const CertificateResultsPage = z.preprocess( */ export const ConsoleSession = z.preprocess( processResponseBody, - z.object({ - id: z.string().uuid(), - timeCreated: z.coerce.date(), - timeLastUsed: z.coerce.date(), - }) + z.object({ id: z.uuid(), timeCreated: z.coerce.date(), timeLastUsed: z.coerce.date() }) ) /** @@ -1284,12 +1262,7 @@ export const Cumulativeuint64 = z.preprocess( */ export const CurrentUser = z.preprocess( processResponseBody, - z.object({ - displayName: z.string(), - id: z.string().uuid(), - siloId: z.string().uuid(), - siloName: Name, - }) + z.object({ displayName: z.string(), id: z.uuid(), siloId: z.uuid(), siloName: Name }) ) /** @@ -1628,7 +1601,7 @@ export const DerEncodedKeyPair = z.preprocess( export const DeviceAccessToken = z.preprocess( processResponseBody, z.object({ - id: z.string().uuid(), + id: z.uuid(), timeCreated: z.coerce.date(), timeExpires: z.coerce.date().nullable().optional(), }) @@ -1636,7 +1609,7 @@ export const DeviceAccessToken = z.preprocess( export const DeviceAccessTokenRequest = z.preprocess( processResponseBody, - z.object({ clientId: z.string().uuid(), deviceCode: z.string(), grantType: z.string() }) + z.object({ clientId: z.uuid(), deviceCode: z.string(), grantType: z.string() }) ) /** @@ -1650,7 +1623,7 @@ export const DeviceAccessTokenResultsPage = z.preprocess( export const DeviceAuthRequest = z.preprocess( processResponseBody, z.object({ - clientId: z.string().uuid(), + clientId: z.uuid(), ttlSeconds: z.number().min(1).max(4294967295).nullable().optional(), }) ) @@ -1678,9 +1651,9 @@ export const DiskState = z.preprocess( z.object({ state: z.enum(['importing_from_bulk_writes']) }), z.object({ state: z.enum(['finalizing']) }), z.object({ state: z.enum(['maintenance']) }), - z.object({ instance: z.string().uuid(), state: z.enum(['attaching']) }), - z.object({ instance: z.string().uuid(), state: z.enum(['attached']) }), - z.object({ instance: z.string().uuid(), state: z.enum(['detaching']) }), + z.object({ instance: z.uuid(), state: z.enum(['attaching']) }), + z.object({ instance: z.uuid(), state: z.enum(['attached']) }), + z.object({ instance: z.uuid(), state: z.enum(['detaching']) }), z.object({ state: z.enum(['destroyed']) }), z.object({ state: z.enum(['faulted']) }), ]) @@ -1695,12 +1668,12 @@ export const Disk = z.preprocess( blockSize: ByteCount, description: z.string(), devicePath: z.string(), - id: z.string().uuid(), - imageId: z.string().uuid().nullable().optional(), + id: z.uuid(), + imageId: z.uuid().nullable().optional(), name: Name, - projectId: z.string().uuid(), + projectId: z.uuid(), size: ByteCount, - snapshotId: z.string().uuid().nullable().optional(), + snapshotId: z.uuid().nullable().optional(), state: DiskState, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -1714,8 +1687,8 @@ export const DiskSource = z.preprocess( processResponseBody, z.union([ z.object({ blockSize: BlockSize, type: z.enum(['blank']) }), - z.object({ snapshotId: z.string().uuid(), type: z.enum(['snapshot']) }), - z.object({ imageId: z.string().uuid(), type: z.enum(['image']) }), + z.object({ snapshotId: z.uuid(), type: z.enum(['snapshot']) }), + z.object({ imageId: z.uuid(), type: z.enum(['image']) }), z.object({ blockSize: BlockSize, type: z.enum(['importing_blocks']) }), ]) ) @@ -1799,25 +1772,21 @@ export const ExternalIp = z.preprocess( z.union([ z.object({ firstPort: z.number().min(0).max(65535), - ip: z.string().ip(), - ipPoolId: z.string().uuid(), + ip: z.ipv4(), + ipPoolId: z.uuid(), kind: z.enum(['snat']), lastPort: z.number().min(0).max(65535), }), - z.object({ - ip: z.string().ip(), - ipPoolId: z.string().uuid(), - kind: z.enum(['ephemeral']), - }), + z.object({ ip: z.ipv4(), ipPoolId: z.uuid(), kind: z.enum(['ephemeral']) }), z.object({ description: z.string(), - id: z.string().uuid(), - instanceId: z.string().uuid().nullable().optional(), - ip: z.string().ip(), - ipPoolId: z.string().uuid(), + id: z.uuid(), + instanceId: z.uuid().nullable().optional(), + ip: z.ipv4(), + ipPoolId: z.uuid(), kind: z.enum(['floating']), name: Name, - projectId: z.string().uuid(), + projectId: z.uuid(), timeCreated: z.coerce.date(), timeModified: z.coerce.date(), }), @@ -1897,8 +1866,8 @@ export const FieldValue = z.preprocess( z.object({ type: z.enum(['u32']), value: z.number().min(0).max(4294967295) }), z.object({ type: z.enum(['i64']), value: z.number() }), z.object({ type: z.enum(['u64']), value: z.number().min(0) }), - z.object({ type: z.enum(['ip_addr']), value: z.string().ip() }), - z.object({ type: z.enum(['uuid']), value: z.string().uuid() }), + z.object({ type: z.enum(['ip_addr']), value: z.ipv4() }), + z.object({ type: z.enum(['uuid']), value: z.uuid() }), z.object({ type: z.enum(['bool']), value: SafeBoolean }), ]) ) @@ -1931,11 +1900,7 @@ export const IdentityType = z.preprocess( */ export const FleetRoleRoleAssignment = z.preprocess( processResponseBody, - z.object({ - identityId: z.string().uuid(), - identityType: IdentityType, - roleName: FleetRole, - }) + z.object({ identityId: z.uuid(), identityType: IdentityType, roleName: FleetRole }) ) /** @@ -1955,12 +1920,12 @@ export const FloatingIp = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), - instanceId: z.string().uuid().nullable().optional(), - ip: z.string().ip(), - ipPoolId: z.string().uuid(), + id: z.uuid(), + instanceId: z.uuid().nullable().optional(), + ip: z.ipv4(), + ipPoolId: z.uuid(), name: Name, - projectId: z.string().uuid(), + projectId: z.uuid(), timeCreated: z.coerce.date(), timeModified: z.coerce.date(), }) @@ -1986,7 +1951,7 @@ export const FloatingIpCreate = z.preprocess( processResponseBody, z.object({ description: z.string(), - ip: z.string().ip().nullable().optional(), + ip: z.ipv4().nullable().optional(), name: Name, pool: NameOrId.nullable().optional(), }) @@ -2016,7 +1981,7 @@ export const FloatingIpUpdate = z.preprocess( */ export const Group = z.preprocess( processResponseBody, - z.object({ displayName: z.string(), id: z.string().uuid(), siloId: z.string().uuid() }) + z.object({ displayName: z.string(), id: z.uuid(), siloId: z.uuid() }) ) /** @@ -2064,7 +2029,7 @@ export const IdentityProvider = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), name: Name, providerType: IdentityProviderType, timeCreated: z.coerce.date(), @@ -2099,10 +2064,10 @@ export const Image = z.preprocess( blockSize: ByteCount, description: z.string(), digest: Digest.nullable().optional(), - id: z.string().uuid(), + id: z.uuid(), name: Name, os: z.string(), - projectId: z.string().uuid().nullable().optional(), + projectId: z.uuid().nullable().optional(), size: ByteCount, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -2115,7 +2080,7 @@ export const Image = z.preprocess( */ export const ImageSource = z.preprocess( processResponseBody, - z.object({ id: z.string().uuid(), type: z.enum(['snapshot']) }) + z.object({ id: z.uuid(), type: z.enum(['snapshot']) }) ) /** @@ -2173,14 +2138,14 @@ export const Instance = z.preprocess( autoRestartCooldownExpiration: z.coerce.date().nullable().optional(), autoRestartEnabled: SafeBoolean, autoRestartPolicy: InstanceAutoRestartPolicy.nullable().optional(), - bootDiskId: z.string().uuid().nullable().optional(), + bootDiskId: z.uuid().nullable().optional(), description: z.string(), hostname: z.string(), - id: z.string().uuid(), + id: z.uuid(), memory: ByteCount, name: Name, ncpus: InstanceCpuCount, - projectId: z.string().uuid(), + projectId: z.uuid(), runState: InstanceState, timeCreated: z.coerce.date(), timeLastAutoRestarted: z.coerce.date().nullable().optional(), @@ -2213,7 +2178,7 @@ export const InstanceNetworkInterfaceCreate = z.preprocess( processResponseBody, z.object({ description: z.string(), - ip: z.string().ip().nullable().optional(), + ip: z.ipv4().nullable().optional(), name: Name, subnetName: Name, vpcName: Name, @@ -2239,8 +2204,8 @@ export const InstanceCreate = z.preprocess( processResponseBody, z.object({ antiAffinityGroups: NameOrId.array().default([]).optional(), - autoRestartPolicy: InstanceAutoRestartPolicy.default(null).nullable().optional(), - bootDisk: InstanceDiskAttachment.default(null).nullable().optional(), + autoRestartPolicy: InstanceAutoRestartPolicy.nullable().default(null).optional(), + bootDisk: InstanceDiskAttachment.nullable().default(null).optional(), description: z.string(), disks: InstanceDiskAttachment.array().default([]).optional(), externalIps: ExternalIpCreate.array().default([]).optional(), @@ -2278,17 +2243,17 @@ export const InstanceNetworkInterface = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), - instanceId: z.string().uuid(), - ip: z.string().ip(), + id: z.uuid(), + instanceId: z.uuid(), + ip: z.ipv4(), mac: MacAddr, name: Name, primary: SafeBoolean, - subnetId: z.string().uuid(), + subnetId: z.uuid(), timeCreated: z.coerce.date(), timeModified: z.coerce.date(), transitIps: IpNet.array().default([]).optional(), - vpcId: z.string().uuid(), + vpcId: z.uuid(), }) ) @@ -2363,11 +2328,11 @@ export const InternetGateway = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), name: Name, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), - vpcId: z.string().uuid(), + vpcId: z.uuid(), }) ) @@ -2385,10 +2350,10 @@ export const InternetGatewayCreate = z.preprocess( export const InternetGatewayIpAddress = z.preprocess( processResponseBody, z.object({ - address: z.string().ip(), + address: z.ipv4(), description: z.string(), - id: z.string().uuid(), - internetGatewayId: z.string().uuid(), + id: z.uuid(), + internetGatewayId: z.uuid(), name: Name, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -2400,7 +2365,7 @@ export const InternetGatewayIpAddress = z.preprocess( */ export const InternetGatewayIpAddressCreate = z.preprocess( processResponseBody, - z.object({ address: z.string().ip(), description: z.string(), name: Name }) + z.object({ address: z.ipv4(), description: z.string(), name: Name }) ) /** @@ -2421,9 +2386,9 @@ export const InternetGatewayIpPool = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), - internetGatewayId: z.string().uuid(), - ipPoolId: z.string().uuid(), + id: z.uuid(), + internetGatewayId: z.uuid(), + ipPoolId: z.uuid(), name: Name, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -2464,7 +2429,7 @@ export const IpPool = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), name: Name, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -2491,10 +2456,7 @@ export const IpPoolLinkSilo = z.preprocess( */ export const Ipv4Range = z.preprocess( processResponseBody, - z.object({ - first: z.string().ip({ version: 'v4' }), - last: z.string().ip({ version: 'v4' }), - }) + z.object({ first: z.ipv4(), last: z.ipv4() }) ) /** @@ -2504,10 +2466,7 @@ export const Ipv4Range = z.preprocess( */ export const Ipv6Range = z.preprocess( processResponseBody, - z.object({ - first: z.string().ip({ version: 'v6' }), - last: z.string().ip({ version: 'v6' }), - }) + z.object({ first: z.ipv6(), last: z.ipv6() }) ) export const IpRange = z.preprocess(processResponseBody, z.union([Ipv4Range, Ipv6Range])) @@ -2515,8 +2474,8 @@ export const IpRange = z.preprocess(processResponseBody, z.union([Ipv4Range, Ipv export const IpPoolRange = z.preprocess( processResponseBody, z.object({ - id: z.string().uuid(), - ipPoolId: z.string().uuid(), + id: z.uuid(), + ipPoolId: z.uuid(), range: IpRange, timeCreated: z.coerce.date(), }) @@ -2543,11 +2502,7 @@ export const IpPoolResultsPage = z.preprocess( */ export const IpPoolSiloLink = z.preprocess( processResponseBody, - z.object({ - ipPoolId: z.string().uuid(), - isDefault: SafeBoolean, - siloId: z.string().uuid(), - }) + z.object({ ipPoolId: z.uuid(), isDefault: SafeBoolean, siloId: z.uuid() }) ) /** @@ -2621,7 +2576,7 @@ export const LldpLinkConfigCreate = z.preprocess( enabled: SafeBoolean, linkDescription: z.string().nullable().optional(), linkName: z.string().nullable().optional(), - managementIp: z.string().ip().nullable().optional(), + managementIp: z.ipv4().nullable().optional(), systemDescription: z.string().nullable().optional(), systemName: z.string().nullable().optional(), }) @@ -2683,10 +2638,10 @@ export const LldpLinkConfig = z.preprocess( z.object({ chassisId: z.string().nullable().optional(), enabled: SafeBoolean, - id: z.string().uuid(), + id: z.uuid(), linkDescription: z.string().nullable().optional(), linkName: z.string().nullable().optional(), - managementIp: z.string().ip().nullable().optional(), + managementIp: z.ipv4().nullable().optional(), systemDescription: z.string().nullable().optional(), systemName: z.string().nullable().optional(), }) @@ -2695,7 +2650,7 @@ export const LldpLinkConfig = z.preprocess( export const NetworkAddress = z.preprocess( processResponseBody, z.union([ - z.object({ ipAddr: z.string().ip() }), + z.object({ ipAddr: z.ipv4() }), z.object({ iEEE802: z.number().min(0).max(255).array() }), ]) ) @@ -2742,9 +2697,9 @@ export const LoopbackAddress = z.preprocess( processResponseBody, z.object({ address: IpNet, - addressLotBlockId: z.string().uuid(), - id: z.string().uuid(), - rackId: z.string().uuid(), + addressLotBlockId: z.uuid(), + id: z.uuid(), + rackId: z.uuid(), switchLocation: z.string(), }) ) @@ -2755,11 +2710,11 @@ export const LoopbackAddress = z.preprocess( export const LoopbackAddressCreate = z.preprocess( processResponseBody, z.object({ - address: z.string().ip(), + address: z.ipv4(), addressLot: NameOrId, anycast: SafeBoolean, mask: z.number().min(0).max(255), - rackId: z.string().uuid(), + rackId: z.uuid(), switchLocation: Name, }) ) @@ -2802,9 +2757,9 @@ export const MetricType = z.preprocess( export const NetworkInterfaceKind = z.preprocess( processResponseBody, z.union([ - z.object({ id: z.string().uuid(), type: z.enum(['instance']) }), - z.object({ id: z.string().uuid(), type: z.enum(['service']) }), - z.object({ id: z.string().uuid(), type: z.enum(['probe']) }), + z.object({ id: z.uuid(), type: z.enum(['instance']) }), + z.object({ id: z.uuid(), type: z.enum(['service']) }), + z.object({ id: z.uuid(), type: z.enum(['probe']) }), ]) ) @@ -2819,8 +2774,8 @@ export const Vni = z.preprocess(processResponseBody, z.number().min(0).max(42949 export const NetworkInterface = z.preprocess( processResponseBody, z.object({ - id: z.string().uuid(), - ip: z.string().ip(), + id: z.uuid(), + ip: z.ipv4(), kind: NetworkInterfaceKind, mac: MacAddr, name: Name, @@ -2882,7 +2837,7 @@ export const Points = z.preprocess( */ export const Timeseries = z.preprocess( processResponseBody, - z.object({ fields: z.record(z.string().min(1), FieldValue), points: Points }) + z.object({ fields: z.record(z.string(), FieldValue), points: Points }) ) /** @@ -2892,7 +2847,7 @@ export const Timeseries = z.preprocess( */ export const Table = z.preprocess( processResponseBody, - z.object({ name: z.string(), timeseries: z.record(z.string().min(1), Timeseries) }) + z.object({ name: z.string(), timeseries: z.record(z.string(), Timeseries) }) ) /** @@ -2943,11 +2898,11 @@ export const PhysicalDisk = z.preprocess( processResponseBody, z.object({ formFactor: PhysicalDiskKind, - id: z.string().uuid(), + id: z.uuid(), model: z.string(), policy: PhysicalDiskPolicy, serial: z.string(), - sledId: z.string().uuid().nullable().optional(), + sledId: z.uuid().nullable().optional(), state: PhysicalDiskState, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -2974,9 +2929,9 @@ export const Probe = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), name: Name, - sled: z.string().uuid(), + sled: z.uuid(), timeCreated: z.coerce.date(), timeModified: z.coerce.date(), }) @@ -2991,7 +2946,7 @@ export const ProbeCreate = z.preprocess( description: z.string(), ipPool: NameOrId.nullable().optional(), name: Name, - sled: z.string().uuid(), + sled: z.uuid(), }) ) @@ -3004,7 +2959,7 @@ export const ProbeExternalIp = z.preprocess( processResponseBody, z.object({ firstPort: z.number().min(0).max(65535), - ip: z.string().ip(), + ip: z.ipv4(), kind: ProbeExternalIpKind, lastPort: z.number().min(0).max(65535), }) @@ -3014,10 +2969,10 @@ export const ProbeInfo = z.preprocess( processResponseBody, z.object({ externalIps: ProbeExternalIp.array(), - id: z.string().uuid(), + id: z.uuid(), interface: NetworkInterface, name: Name, - sled: z.string().uuid(), + sled: z.uuid(), }) ) @@ -3036,7 +2991,7 @@ export const Project = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), name: Name, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -3071,11 +3026,7 @@ export const ProjectRole = z.preprocess( */ export const ProjectRoleRoleAssignment = z.preprocess( processResponseBody, - z.object({ - identityId: z.string().uuid(), - identityType: IdentityType, - roleName: ProjectRole, - }) + z.object({ identityId: z.uuid(), identityType: IdentityType, roleName: ProjectRole }) ) /** @@ -3104,11 +3055,7 @@ export const ProjectUpdate = z.preprocess( */ export const Rack = z.preprocess( processResponseBody, - z.object({ - id: z.string().uuid(), - timeCreated: z.coerce.date(), - timeModified: z.coerce.date(), - }) + z.object({ id: z.uuid(), timeCreated: z.coerce.date(), timeModified: z.coerce.date() }) ) /** @@ -3126,7 +3073,7 @@ export const Route = z.preprocess( processResponseBody, z.object({ dst: IpNet, - gw: z.string().ip(), + gw: z.ipv4(), ribPriority: z.number().min(0).max(255).nullable().optional(), vid: z.number().min(0).max(65535).nullable().optional(), }) @@ -3148,7 +3095,7 @@ export const RouteConfig = z.preprocess( export const RouteDestination = z.preprocess( processResponseBody, z.union([ - z.object({ type: z.enum(['ip']), value: z.string().ip() }), + z.object({ type: z.enum(['ip']), value: z.ipv4() }), z.object({ type: z.enum(['ip_net']), value: IpNet }), z.object({ type: z.enum(['vpc']), value: Name }), z.object({ type: z.enum(['subnet']), value: Name }), @@ -3161,7 +3108,7 @@ export const RouteDestination = z.preprocess( export const RouteTarget = z.preprocess( processResponseBody, z.union([ - z.object({ type: z.enum(['ip']), value: z.string().ip() }), + z.object({ type: z.enum(['ip']), value: z.ipv4() }), z.object({ type: z.enum(['vpc']), value: Name }), z.object({ type: z.enum(['subnet']), value: Name }), z.object({ type: z.enum(['instance']), value: Name }), @@ -3188,13 +3135,13 @@ export const RouterRoute = z.preprocess( z.object({ description: z.string(), destination: RouteDestination, - id: z.string().uuid(), + id: z.uuid(), kind: RouterRouteKind, name: Name, target: RouteTarget, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), - vpcRouterId: z.string().uuid(), + vpcRouterId: z.uuid(), }) ) @@ -3241,7 +3188,7 @@ export const SamlIdentityProvider = z.preprocess( acsUrl: z.string(), description: z.string(), groupAttributeName: z.string().nullable().optional(), - id: z.string().uuid(), + id: z.uuid(), idpEntityId: z.string(), name: Name, publicCert: z.string().nullable().optional(), @@ -3265,7 +3212,7 @@ export const SamlIdentityProviderCreate = z.preprocess( idpEntityId: z.string(), idpMetadataSource: IdpMetadataSource, name: Name, - signingKeypair: DerEncodedKeyPair.default(null).nullable().optional(), + signingKeypair: DerEncodedKeyPair.nullable().default(null).optional(), sloUrl: z.string(), spClientId: z.string(), technicalContactEmail: z.string(), @@ -3312,9 +3259,9 @@ export const Silo = z.preprocess( z.object({ description: z.string(), discoverable: SafeBoolean, - id: z.string().uuid(), + id: z.uuid(), identityMode: SiloIdentityMode, - mappedFleetRoles: z.record(z.string().min(1), FleetRole.array().refine(...uniqueItems)), + mappedFleetRoles: z.record(z.string(), FleetRole.array().refine(...uniqueItems)), name: Name, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -3328,7 +3275,7 @@ export const SiloAuthSettings = z.preprocess( processResponseBody, z.object({ deviceTokenMaxTtlSeconds: z.number().min(0).max(4294967295).nullable().optional(), - siloId: z.string().uuid(), + siloId: z.uuid(), }) ) @@ -3359,7 +3306,7 @@ export const SiloCreate = z.preprocess( discoverable: SafeBoolean, identityMode: SiloIdentityMode, mappedFleetRoles: z - .record(z.string().min(1), FleetRole.array().refine(...uniqueItems)) + .record(z.string(), FleetRole.array().refine(...uniqueItems)) .optional(), name: Name, quotas: SiloQuotasCreate, @@ -3374,7 +3321,7 @@ export const SiloIpPool = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), isDefault: SafeBoolean, name: Name, timeCreated: z.coerce.date(), @@ -3395,12 +3342,7 @@ export const SiloIpPoolResultsPage = z.preprocess( */ export const SiloQuotas = z.preprocess( processResponseBody, - z.object({ - cpus: z.number(), - memory: ByteCount, - siloId: z.string().uuid(), - storage: ByteCount, - }) + z.object({ cpus: z.number(), memory: ByteCount, siloId: z.uuid(), storage: ByteCount }) ) /** @@ -3443,11 +3385,7 @@ export const SiloRole = z.preprocess( */ export const SiloRoleRoleAssignment = z.preprocess( processResponseBody, - z.object({ - identityId: z.string().uuid(), - identityType: IdentityType, - roleName: SiloRole, - }) + z.object({ identityId: z.uuid(), identityType: IdentityType, roleName: SiloRole }) ) /** @@ -3476,7 +3414,7 @@ export const SiloUtilization = z.preprocess( z.object({ allocated: VirtualResourceCounts, provisioned: VirtualResourceCounts, - siloId: z.string().uuid(), + siloId: z.uuid(), siloName: Name, }) ) @@ -3525,9 +3463,9 @@ export const Sled = z.preprocess( processResponseBody, z.object({ baseboard: Baseboard, - id: z.string().uuid(), + id: z.uuid(), policy: SledPolicy, - rackId: z.string().uuid(), + rackId: z.uuid(), state: SledState, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -3539,7 +3477,7 @@ export const Sled = z.preprocess( /** * The unique ID of a sled. */ -export const SledId = z.preprocess(processResponseBody, z.object({ id: z.string().uuid() })) +export const SledId = z.preprocess(processResponseBody, z.object({ id: z.uuid() })) /** * An operator's view of an instance running on a given sled @@ -3547,10 +3485,10 @@ export const SledId = z.preprocess(processResponseBody, z.object({ id: z.string( export const SledInstance = z.preprocess( processResponseBody, z.object({ - activeSledId: z.string().uuid(), - id: z.string().uuid(), + activeSledId: z.uuid(), + id: z.uuid(), memory: z.number(), - migrationId: z.string().uuid().nullable().optional(), + migrationId: z.uuid().nullable().optional(), name: Name, ncpus: z.number(), projectName: Name, @@ -3605,10 +3543,10 @@ export const Snapshot = z.preprocess( processResponseBody, z.object({ description: z.string(), - diskId: z.string().uuid(), - id: z.string().uuid(), + diskId: z.uuid(), + id: z.uuid(), name: Name, - projectId: z.string().uuid(), + projectId: z.uuid(), size: ByteCount, state: SnapshotState, timeCreated: z.coerce.date(), @@ -3639,10 +3577,10 @@ export const SshKey = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), name: Name, publicKey: z.string(), - siloUserId: z.string().uuid(), + siloUserId: z.uuid(), timeCreated: z.coerce.date(), timeModified: z.coerce.date(), }) @@ -3669,10 +3607,7 @@ export const SupportBundleCreate = z.preprocess( z.object({ userComment: z.string().nullable().optional() }) ) -export const TypedUuidForSupportBundleKind = z.preprocess( - processResponseBody, - z.string().uuid() -) +export const TypedUuidForSupportBundleKind = z.preprocess(processResponseBody, z.uuid()) export const SupportBundleState = z.preprocess( processResponseBody, @@ -3711,8 +3646,8 @@ export const Switch = z.preprocess( processResponseBody, z.object({ baseboard: Baseboard, - id: z.string().uuid(), - rackId: z.string().uuid(), + id: z.uuid(), + rackId: z.uuid(), timeCreated: z.coerce.date(), timeModified: z.coerce.date(), }) @@ -3732,10 +3667,10 @@ export const SwitchInterfaceKind2 = z.preprocess( export const SwitchInterfaceConfig = z.preprocess( processResponseBody, z.object({ - id: z.string().uuid(), + id: z.uuid(), interfaceName: Name, kind: SwitchInterfaceKind2, - portSettingsId: z.string().uuid(), + portSettingsId: z.uuid(), v6Enabled: SafeBoolean, }) ) @@ -3760,7 +3695,10 @@ export const SwitchInterfaceConfigCreate = z.preprocess( z.object({ kind: SwitchInterfaceKind, linkName: Name, v6Enabled: SafeBoolean }) ) -export const SwitchLinkState = z.preprocess(processResponseBody, z.record(z.unknown())) +export const SwitchLinkState = z.preprocess( + processResponseBody, + z.record(z.string(), z.unknown()) +) /** * A switch port represents a physical external port on a rack switch. @@ -3768,10 +3706,10 @@ export const SwitchLinkState = z.preprocess(processResponseBody, z.record(z.unkn export const SwitchPort = z.preprocess( processResponseBody, z.object({ - id: z.string().uuid(), + id: z.uuid(), portName: Name, - portSettingsId: z.string().uuid().nullable().optional(), - rackId: z.string().uuid(), + portSettingsId: z.uuid().nullable().optional(), + rackId: z.uuid(), switchLocation: z.string(), }) ) @@ -3783,11 +3721,11 @@ export const SwitchPortAddressView = z.preprocess( processResponseBody, z.object({ address: IpNet, - addressLotBlockId: z.string().uuid(), - addressLotId: z.string().uuid(), + addressLotBlockId: z.uuid(), + addressLotId: z.uuid(), addressLotName: Name, interfaceName: Name, - portSettingsId: z.string().uuid(), + portSettingsId: z.uuid(), vlanId: z.number().min(0).max(65535).nullable().optional(), }) ) @@ -3813,7 +3751,7 @@ export const SwitchPortGeometry2 = z.preprocess( */ export const SwitchPortConfig = z.preprocess( processResponseBody, - z.object({ geometry: SwitchPortGeometry2, portSettingsId: z.string().uuid() }) + z.object({ geometry: SwitchPortGeometry2, portSettingsId: z.uuid() }) ) /** @@ -3857,7 +3795,7 @@ export const SwitchPortLinkConfig = z.preprocess( linkName: Name, lldpLinkConfig: LldpLinkConfig.nullable().optional(), mtu: z.number().min(0).max(65535), - portSettingsId: z.string().uuid(), + portSettingsId: z.uuid(), speed: LinkSpeed, txEqConfig: TxEqConfig2.nullable().optional(), }) @@ -3878,9 +3816,9 @@ export const SwitchPortRouteConfig = z.preprocess( processResponseBody, z.object({ dst: IpNet, - gw: z.string().ip(), + gw: z.ipv4(), interfaceName: Name, - portSettingsId: z.string().uuid(), + portSettingsId: z.uuid(), ribPriority: z.number().min(0).max(255).nullable().optional(), vlanId: z.number().min(0).max(65535).nullable().optional(), }) @@ -3891,7 +3829,7 @@ export const SwitchPortRouteConfig = z.preprocess( */ export const SwitchPortSettingsGroups = z.preprocess( processResponseBody, - z.object({ portSettingsGroupId: z.string().uuid(), portSettingsId: z.string().uuid() }) + z.object({ portSettingsGroupId: z.uuid(), portSettingsId: z.uuid() }) ) /** @@ -3899,7 +3837,7 @@ export const SwitchPortSettingsGroups = z.preprocess( */ export const SwitchVlanInterfaceConfig = z.preprocess( processResponseBody, - z.object({ interfaceConfigId: z.string().uuid(), vlanId: z.number().min(0).max(65535) }) + z.object({ interfaceConfigId: z.uuid(), vlanId: z.number().min(0).max(65535) }) ) /** @@ -3912,7 +3850,7 @@ export const SwitchPortSettings = z.preprocess( bgpPeers: BgpPeer.array(), description: z.string(), groups: SwitchPortSettingsGroups.array(), - id: z.string().uuid(), + id: z.uuid(), interfaces: SwitchInterfaceConfig.array(), links: SwitchPortLinkConfig.array(), name: Name, @@ -3949,7 +3887,7 @@ export const SwitchPortSettingsIdentity = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), name: Name, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -4155,11 +4093,7 @@ export const TufRepoInsertResponse = z.preprocess( */ export const UninitializedSled = z.preprocess( processResponseBody, - z.object({ - baseboard: Baseboard, - cubby: z.number().min(0).max(65535), - rackId: z.string().uuid(), - }) + z.object({ baseboard: Baseboard, cubby: z.number().min(0).max(65535), rackId: z.uuid() }) ) /** @@ -4184,8 +4118,8 @@ export const UninitializedSledResultsPage = z.preprocess( export const UpdatesTrustRoot = z.preprocess( processResponseBody, z.object({ - id: z.string().uuid(), - rootRole: z.record(z.unknown()), + id: z.uuid(), + rootRole: z.record(z.string(), z.unknown()), timeCreated: z.coerce.date(), }) ) @@ -4203,7 +4137,7 @@ export const UpdatesTrustRootResultsPage = z.preprocess( */ export const User = z.preprocess( processResponseBody, - z.object({ displayName: z.string(), id: z.string().uuid(), siloId: z.string().uuid() }) + z.object({ displayName: z.string(), id: z.uuid(), siloId: z.uuid() }) ) /** @@ -4215,7 +4149,7 @@ export const UserBuiltin = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), name: Name, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), @@ -4297,11 +4231,11 @@ export const Vpc = z.preprocess( z.object({ description: z.string(), dnsName: Name, - id: z.string().uuid(), + id: z.uuid(), ipv6Prefix: Ipv6Net, name: Name, - projectId: z.string().uuid(), - systemRouterId: z.string().uuid(), + projectId: z.uuid(), + systemRouterId: z.uuid(), timeCreated: z.coerce.date(), timeModified: z.coerce.date(), }) @@ -4347,7 +4281,7 @@ export const VpcFirewallRuleHostFilter = z.preprocess( z.object({ type: z.enum(['vpc']), value: Name }), z.object({ type: z.enum(['subnet']), value: Name }), z.object({ type: z.enum(['instance']), value: Name }), - z.object({ type: z.enum(['ip']), value: z.string().ip() }), + z.object({ type: z.enum(['ip']), value: z.ipv4() }), z.object({ type: z.enum(['ip_net']), value: IpNet }), ]) ) @@ -4390,7 +4324,7 @@ export const VpcFirewallRuleTarget = z.preprocess( z.object({ type: z.enum(['vpc']), value: Name }), z.object({ type: z.enum(['subnet']), value: Name }), z.object({ type: z.enum(['instance']), value: Name }), - z.object({ type: z.enum(['ip']), value: z.string().ip() }), + z.object({ type: z.enum(['ip']), value: z.ipv4() }), z.object({ type: z.enum(['ip_net']), value: IpNet }), ]) ) @@ -4405,14 +4339,14 @@ export const VpcFirewallRule = z.preprocess( description: z.string(), direction: VpcFirewallRuleDirection, filters: VpcFirewallRuleFilter, - id: z.string().uuid(), + id: z.uuid(), name: Name, priority: z.number().min(0).max(65535), status: VpcFirewallRuleStatus, targets: VpcFirewallRuleTarget.array(), timeCreated: z.coerce.date(), timeModified: z.coerce.date(), - vpcId: z.string().uuid(), + vpcId: z.uuid(), }) ) @@ -4466,12 +4400,12 @@ export const VpcRouter = z.preprocess( processResponseBody, z.object({ description: z.string(), - id: z.string().uuid(), + id: z.uuid(), kind: VpcRouterKind, name: Name, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), - vpcId: z.string().uuid(), + vpcId: z.uuid(), }) ) @@ -4508,15 +4442,15 @@ export const VpcRouterUpdate = z.preprocess( export const VpcSubnet = z.preprocess( processResponseBody, z.object({ - customRouterId: z.string().uuid().nullable().optional(), + customRouterId: z.uuid().nullable().optional(), description: z.string(), - id: z.string().uuid(), + id: z.uuid(), ipv4Block: Ipv4Net, ipv6Block: Ipv6Net, name: Name, timeCreated: z.coerce.date(), timeModified: z.coerce.date(), - vpcId: z.string().uuid(), + vpcId: z.uuid(), }) ) @@ -4588,7 +4522,7 @@ export const WebhookReceiver = z.preprocess( z.object({ description: z.string(), endpoint: z.string(), - id: z.string().uuid(), + id: z.uuid(), name: Name, secrets: WebhookSecret.array(), subscriptions: AlertSubscription.array(), @@ -4760,7 +4694,7 @@ export const SupportBundleViewParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - bundleId: z.string().uuid(), + bundleId: z.uuid(), }), query: z.object({}), }) @@ -4770,7 +4704,7 @@ export const SupportBundleUpdateParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - bundleId: z.string().uuid(), + bundleId: z.uuid(), }), query: z.object({}), }) @@ -4780,7 +4714,7 @@ export const SupportBundleDeleteParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - bundleId: z.string().uuid(), + bundleId: z.uuid(), }), query: z.object({}), }) @@ -4790,7 +4724,7 @@ export const SupportBundleDownloadParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - bundleId: z.string().uuid(), + bundleId: z.uuid(), }), query: z.object({}), }) @@ -4800,7 +4734,7 @@ export const SupportBundleHeadParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - bundleId: z.string().uuid(), + bundleId: z.uuid(), }), query: z.object({}), }) @@ -4810,7 +4744,7 @@ export const SupportBundleDownloadFileParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - bundleId: z.string().uuid(), + bundleId: z.uuid(), file: z.string(), }), query: z.object({}), @@ -4821,7 +4755,7 @@ export const SupportBundleHeadFileParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - bundleId: z.string().uuid(), + bundleId: z.uuid(), file: z.string(), }), query: z.object({}), @@ -4832,7 +4766,7 @@ export const SupportBundleIndexParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - bundleId: z.string().uuid(), + bundleId: z.uuid(), }), query: z.object({}), }) @@ -5060,7 +4994,7 @@ export const AlertDeliveryResendParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - alertId: z.string().uuid(), + alertId: z.uuid(), }), query: z.object({ receiver: NameOrId, @@ -5431,7 +5365,7 @@ export const GroupViewParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - groupId: z.string().uuid(), + groupId: z.uuid(), }), query: z.object({}), }) @@ -5951,7 +5885,7 @@ export const CurrentUserAccessTokenDeleteParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - tokenId: z.string().uuid(), + tokenId: z.uuid(), }), query: z.object({}), }) @@ -6261,7 +6195,7 @@ export const PhysicalDiskViewParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - diskId: z.string().uuid(), + diskId: z.uuid(), }), query: z.object({}), }) @@ -6272,7 +6206,7 @@ export const NetworkingSwitchPortLldpNeighborsParams = z.preprocess( z.object({ path: z.object({ port: Name, - rackId: z.string().uuid(), + rackId: z.uuid(), switchLocation: Name, }), query: z.object({ @@ -6299,7 +6233,7 @@ export const RackViewParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - rackId: z.string().uuid(), + rackId: z.uuid(), }), query: z.object({}), }) @@ -6329,7 +6263,7 @@ export const SledViewParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - sledId: z.string().uuid(), + sledId: z.uuid(), }), query: z.object({}), }) @@ -6339,7 +6273,7 @@ export const SledPhysicalDiskListParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - sledId: z.string().uuid(), + sledId: z.uuid(), }), query: z.object({ limit: z.number().min(1).max(4294967295).nullable().optional(), @@ -6353,7 +6287,7 @@ export const SledInstanceListParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - sledId: z.string().uuid(), + sledId: z.uuid(), }), query: z.object({ limit: z.number().min(1).max(4294967295).nullable().optional(), @@ -6367,7 +6301,7 @@ export const SledSetProvisionPolicyParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - sledId: z.string().uuid(), + sledId: z.uuid(), }), query: z.object({}), }) @@ -6392,7 +6326,7 @@ export const NetworkingSwitchPortListParams = z.preprocess( limit: z.number().min(1).max(4294967295).nullable().optional(), pageToken: z.string().nullable().optional(), sortBy: IdSortMode.optional(), - switchPortId: z.string().uuid().nullable().optional(), + switchPortId: z.uuid().nullable().optional(), }), }) ) @@ -6404,7 +6338,7 @@ export const NetworkingSwitchPortLldpConfigViewParams = z.preprocess( port: Name, }), query: z.object({ - rackId: z.string().uuid(), + rackId: z.uuid(), switchLocation: Name, }), }) @@ -6417,7 +6351,7 @@ export const NetworkingSwitchPortLldpConfigUpdateParams = z.preprocess( port: Name, }), query: z.object({ - rackId: z.string().uuid(), + rackId: z.uuid(), switchLocation: Name, }), }) @@ -6430,7 +6364,7 @@ export const NetworkingSwitchPortApplySettingsParams = z.preprocess( port: Name, }), query: z.object({ - rackId: z.string().uuid(), + rackId: z.uuid(), switchLocation: Name, }), }) @@ -6443,7 +6377,7 @@ export const NetworkingSwitchPortClearSettingsParams = z.preprocess( port: Name, }), query: z.object({ - rackId: z.string().uuid(), + rackId: z.uuid(), switchLocation: Name, }), }) @@ -6456,7 +6390,7 @@ export const NetworkingSwitchPortStatusParams = z.preprocess( port: Name, }), query: z.object({ - rackId: z.string().uuid(), + rackId: z.uuid(), switchLocation: Name, }), }) @@ -6478,7 +6412,7 @@ export const SwitchViewParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - switchId: z.string().uuid(), + switchId: z.uuid(), }), query: z.object({}), }) @@ -6511,7 +6445,7 @@ export const LocalIdpUserDeleteParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - userId: z.string().uuid(), + userId: z.uuid(), }), query: z.object({ silo: NameOrId, @@ -6523,7 +6457,7 @@ export const LocalIdpUserSetPasswordParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - userId: z.string().uuid(), + userId: z.uuid(), }), query: z.object({ silo: NameOrId, @@ -6974,8 +6908,8 @@ export const NetworkingLoopbackAddressDeleteParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - address: z.string().ip(), - rackId: z.string().uuid(), + address: z.ipv4(), + rackId: z.uuid(), subnetMask: z.number().min(0).max(255), switchLocation: Name, }), @@ -7229,7 +7163,7 @@ export const SystemUpdateTrustRootViewParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - trustRootId: z.string().uuid(), + trustRootId: z.uuid(), }), query: z.object({}), }) @@ -7239,7 +7173,7 @@ export const SystemUpdateTrustRootDeleteParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - trustRootId: z.string().uuid(), + trustRootId: z.uuid(), }), query: z.object({}), }) @@ -7262,7 +7196,7 @@ export const SiloUserViewParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - userId: z.string().uuid(), + userId: z.uuid(), }), query: z.object({ silo: NameOrId, @@ -7329,7 +7263,7 @@ export const UserListParams = z.preprocess( z.object({ path: z.object({}), query: z.object({ - group: z.string().uuid().nullable().optional(), + group: z.uuid().nullable().optional(), limit: z.number().min(1).max(4294967295).nullable().optional(), pageToken: z.string().nullable().optional(), sortBy: IdSortMode.optional(), @@ -7341,7 +7275,7 @@ export const UserViewParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - userId: z.string().uuid(), + userId: z.uuid(), }), query: z.object({}), }) @@ -7351,7 +7285,7 @@ export const UserTokenListParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - userId: z.string().uuid(), + userId: z.uuid(), }), query: z.object({ limit: z.number().min(1).max(4294967295).nullable().optional(), @@ -7365,7 +7299,7 @@ export const UserLogoutParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - userId: z.string().uuid(), + userId: z.uuid(), }), query: z.object({}), }) @@ -7375,7 +7309,7 @@ export const UserSessionListParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - userId: z.string().uuid(), + userId: z.uuid(), }), query: z.object({ limit: z.number().min(1).max(4294967295).nullable().optional(), @@ -7729,7 +7663,7 @@ export const WebhookSecretsDeleteParams = z.preprocess( processResponseBody, z.object({ path: z.object({ - secretId: z.string().uuid(), + secretId: z.uuid(), }), query: z.object({}), }) diff --git a/mock-api/msw/handlers.ts b/mock-api/msw/handlers.ts index 6803c75b95..af6ad59fed 100644 --- a/mock-api/msw/handlers.ts +++ b/mock-api/msw/handlers.ts @@ -808,10 +808,12 @@ export const handlers = makeHandlers({ } updateDesc(nic, body) - if (typeof body.primary === 'boolean' && body.primary !== nic.primary) { - if (nic.primary) { - throw 'Cannot remove the primary interface' - } + // We used to error here if body.primary was false and nic.primary was true + // on the grounds that you can't unset the primary interface. But this turns + // out not to match the real API, which ignores primary: false. + // https://github.com/oxidecomputer/omicron/blob/61ad056c/nexus/db-queries/src/db/datastore/network_interface.rs?plain=1#L804-L808 + + if (typeof body.primary === 'boolean' && body.primary && !nic.primary) { db.networkInterfaces .filter((n) => n.instance_id === nic.instance_id) .forEach((n) => { diff --git a/mock-api/snapshot.ts b/mock-api/snapshot.ts index 52e4758308..cc3e6bd218 100644 --- a/mock-api/snapshot.ts +++ b/mock-api/snapshot.ts @@ -77,7 +77,7 @@ export const snapshots: Json[] = [ state: 'ready', }, { - id: '7fc6ca11-452e-d3e4-9e1c-752ff615abea', + id: '75832119-7d9b-4e91-a7c6-76b996b69aaa', name: 'snapshot-heavy', description: '', project_id: project.id, diff --git a/package-lock.json b/package-lock.json index 579782627a..54fbd9c180 100644 --- a/package-lock.json +++ b/package-lock.json @@ -50,13 +50,13 @@ "tunnel-rat": "^0.1.2", "use-debounce": "^10.0.4", "uuid": "^10.0.0", - "zod": "^3.24.3", + "zod": "^4.0.17", "zustand": "^5.0.3" }, "devDependencies": { "@ianvs/prettier-plugin-sort-imports": "^4.4.1", "@mswjs/http-middleware": "^0.10.3", - "@oxide/openapi-gen-ts": "~0.8.1", + "@oxide/openapi-gen-ts": "~0.9.0", "@playwright/test": "^1.54.1", "@testing-library/dom": "^10.4.0", "@testing-library/jest-dom": "^6.6.3", @@ -1576,9 +1576,9 @@ } }, "node_modules/@oxide/openapi-gen-ts": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@oxide/openapi-gen-ts/-/openapi-gen-ts-0.8.1.tgz", - "integrity": "sha512-2U9n2qFOemfVm8mAxkgmCLvQL43OXggyvZybjSN9q54WxLgXz3Wl3pG73+mHgXVpfNsBOvrCEscZf/gy4iS1cQ==", + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/@oxide/openapi-gen-ts/-/openapi-gen-ts-0.9.0.tgz", + "integrity": "sha512-Yw6L8knvhAOonz3KS4RMHciWe7FEp6ry1pWoI0SRGRh6snAetwbI6dj9ZwCx2J8nM2lclSS3r99toF5C9Ux5Gw==", "dev": true, "license": "MPL-2.0", "dependencies": { @@ -15261,9 +15261,9 @@ } }, "node_modules/zod": { - "version": "3.24.3", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.24.3.tgz", - "integrity": "sha512-HhY1oqzWCQWuUqvBFnsyrtZRhyPeR7SUGv+C4+MsisMuVfSPx8HpwWqH8tRahSlt6M3PiFAcoeFhZAqIXTxoSg==", + "version": "4.0.17", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.0.17.tgz", + "integrity": "sha512-1PHjlYRevNxxdy2JZ8JcNAw7rX8V9P1AKkP+x/xZfxB0K5FYfuV+Ug6P/6NVSR2jHQ+FzDDoDHS04nYUsOIyLQ==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" diff --git a/package.json b/package.json index 6f6f30b306..2ec84415a9 100644 --- a/package.json +++ b/package.json @@ -73,13 +73,13 @@ "tunnel-rat": "^0.1.2", "use-debounce": "^10.0.4", "uuid": "^10.0.0", - "zod": "^3.24.3", + "zod": "^4.0.17", "zustand": "^5.0.3" }, "devDependencies": { "@ianvs/prettier-plugin-sort-imports": "^4.4.1", "@mswjs/http-middleware": "^0.10.3", - "@oxide/openapi-gen-ts": "~0.8.1", + "@oxide/openapi-gen-ts": "~0.9.0", "@playwright/test": "^1.54.1", "@testing-library/dom": "^10.4.0", "@testing-library/jest-dom": "^6.6.3", diff --git a/vite.config.ts b/vite.config.ts index e344433a93..e0645c1509 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -12,7 +12,7 @@ import react from '@vitejs/plugin-react-swc' import { defineConfig } from 'vite' import { createHtmlPlugin } from 'vite-plugin-html' import tsconfigPaths from 'vite-tsconfig-paths' -import { z } from 'zod' +import { z } from 'zod/v4' import vercelConfig from './vercel.json'