mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-27 07:50:47 +00:00
15f4bd8eff
* chore: migrate from zod/v3 to zod/v4 This commit contains the logic changes * chore: migrate imports from zod/v3 to zod/v4 This contains import updates and adds explicit record keys as zod/v4 requires these now * ci: enforce usage of zod/v4
46 lines
975 B
TypeScript
46 lines
975 B
TypeScript
import { z } from 'zod/v4';
|
|
import { Json } from '../../../util/schema-utils/index.ts';
|
|
|
|
const InputType = z.enum([
|
|
'file',
|
|
'git',
|
|
'github',
|
|
'gitlab',
|
|
'indirect',
|
|
'path',
|
|
'sourcehut',
|
|
'tarball',
|
|
]);
|
|
|
|
const LockedInput = z.object({
|
|
ref: z.string().optional(),
|
|
rev: z.string().optional(),
|
|
type: InputType,
|
|
url: z.string().optional(),
|
|
});
|
|
|
|
const OriginalInput = z.object({
|
|
host: z.string().optional(),
|
|
owner: z.string().optional(),
|
|
repo: z.string().optional(),
|
|
ref: z.string().optional(),
|
|
rev: z.string().optional(),
|
|
type: InputType,
|
|
url: z.string().optional(),
|
|
});
|
|
|
|
const NixInput = z.object({
|
|
inputs: z.record(z.string(), z.string().or(z.array(z.string()))).optional(),
|
|
locked: LockedInput.optional(),
|
|
original: OriginalInput.optional(),
|
|
});
|
|
|
|
export const NixFlakeLock = Json.pipe(
|
|
z.object({
|
|
nodes: z.record(z.string(), NixInput),
|
|
version: z.literal(7),
|
|
}),
|
|
);
|
|
|
|
export type NixFlakeLock = z.infer<typeof NixFlakeLock>;
|