mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-25 15:01:49 +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
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { z } from 'zod/v4';
|
|
import { MaybeTimestamp } from '../../../util/timestamp.ts';
|
|
import type { Release } from '../types.ts';
|
|
|
|
export const PythonRelease = z
|
|
.object({
|
|
/** e.g: "Python 3.9.0b1" */
|
|
name: z.string(),
|
|
/** e.g: "python-390b1" */
|
|
slug: z.string(),
|
|
/** Major version e.g: 3 */
|
|
version: z.number(),
|
|
/** is latest major version, true for Python 2.7.18 and latest Python 3 */
|
|
is_latest: z.boolean(),
|
|
is_published: z.boolean(),
|
|
release_date: MaybeTimestamp,
|
|
pre_release: z.boolean(),
|
|
release_page: z.string().nullable(),
|
|
show_on_download_page: z.boolean(),
|
|
/** Changelog e.g: "https://docs.python.org/…html#python-3-9-0-beta-1" */
|
|
release_notes_url: z.string(),
|
|
/** Download URL e.g: "https://www.python.org/api/v2/downloads/release/436/" */
|
|
resource_uri: z.string(),
|
|
})
|
|
.transform(
|
|
({ name, release_date: releaseTimestamp, pre_release }): Release => {
|
|
const version = name?.replace('Python', '').trim();
|
|
const isStable = pre_release === false;
|
|
return { version, releaseTimestamp, isStable };
|
|
},
|
|
)
|
|
.array();
|