Created
May 30, 2025 21:53
-
-
Save WtfJoke/3588881da1936e455947ae122af3454b to your computer and use it in GitHub Desktop.
Sample of zod bundling options https://github.com/colinhacks/zod/issues/4433
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as z from "zod/v4-mini"; | |
| const DAY_IN_MINUTES = 24 * 60; | |
| export const CarbonAwareTimeWindowPayloadScheme = z.object({ | |
| location: z.enum(["de", "fr", "at"]), | |
| earliestDateTime: z.optional(z.iso.datetime()), | |
| latestStartInMinutes: z._default(z.optional(z.number()), DAY_IN_MINUTES), | |
| }); | |
| export type CarbonAwareTimeWindowPayload = z.infer< | |
| typeof CarbonAwareTimeWindowPayloadScheme | |
| >; | |
| export const CarbonAwareTimeWindowResponseScheme = z.object({ | |
| waitTimeInSecondsForOptimalExecution: z.number(), | |
| optimalExecutionDateTime: z.optional(z.string()), | |
| }); | |
| export type CarbonAwareTimeWindowResponse = z.infer< | |
| typeof CarbonAwareTimeWindowResponseScheme | |
| >; | |
| export const handler = async () => { | |
| return { | |
| statusCode: 200, | |
| body: JSON.stringify({ | |
| message: "This is a placeholder for the Carbon Aware Computing handler.", | |
| }), | |
| }; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment