0
0
mirror of https://github.com/renovatebot/renovate.git synced 2024-12-22 13:38:32 +00:00
renovatebot_renovate/lib/modules/datasource/cdnjs/schema.ts
RahulGautamSingh 8fb2a6b9d2
fix(datasource/cdnjs): update logic to accomodate api changes (#27212)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2024-02-11 10:57:56 +00:00

31 lines
635 B
TypeScript

import { z } from 'zod';
import type { Release } from '../types';
export const Homepage = z.string().optional().catch(undefined);
export const Repository = z
.object({
type: z.literal('git'),
url: z.string(),
})
.transform(({ url }) => url)
.optional()
.catch(undefined);
export const Versions = z
.string()
.transform((version): Release => ({ version }))
.array();
export const Sri = z.record(z.string());
export const CdnjsAPIVersionResponseSchema = z.object({
homepage: Homepage,
repository: Repository,
versions: Versions,
});
export const CdnjsAPISriResponseSchema = z.object({
sri: Sri,
});