Files
Sebastian Poxhofer 15f4bd8eff chore: migrate from zod/v3 to zod/v4 (#43691)
* 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
2026-05-30 16:01:58 +00:00

37 lines
1.0 KiB
TypeScript

import { z } from 'zod/v4';
import { DockerDatasource } from '../../../datasource/docker/index.ts';
import type { PackageDependency } from '../../types.ts';
import { ExtensionTagFragment, StringFragment } from './fragments.ts';
export const ociExtensionPrefix = 'oci';
const pullTag = 'pull';
export const ociExtensionTags = ['pull'];
export const RuleToDockerPackageDep = ExtensionTagFragment.extend({
extension: z.literal(ociExtensionPrefix),
tag: z.literal(pullTag),
children: z.object({
name: StringFragment,
image: StringFragment,
tag: StringFragment.optional(),
digest: StringFragment.optional(),
}),
}).transform(
({
rawString,
children: { name, image, tag, digest },
}): PackageDependency => ({
datasource: DockerDatasource.id,
depType: 'oci_pull',
depName: name.value,
packageName: image.value,
currentValue: tag?.value,
currentDigest: digest?.value,
// Provide a replace string so the auto replacer can replace both the tag
// and digest if applicable.
replaceString: rawString,
}),
);