Exact source used by this build. SHA-256: 542cd5169604e53b6023a864c72365a5024639f5a5369c91006aa02ec21a87b5.

1 import cropsJson from "../../../generated/crops.json";
2 import { CropSchema } from "./schema";
3 import type { ContentDomain } from "../types";
4 
5 export * from "./schema";
6 export const CROPS = CropSchema.array().parse(cropsJson);
7 export const CROP_BY_ID = Object.fromEntries(CROPS.map((crop) => [crop.id, crop]));
8 export const cropsDomain: ContentDomain = {
9   id: "crops", data: CROPS,
10   validate() {
11     CropSchema.array().parse(cropsJson);
12     if (new Set(CROPS.map((crop) => crop.id)).size !== CROPS.length) throw new Error("crop ids must be unique");
13   },
14 };
15 cropsDomain.validate();
16