Skip to content

Instantly share code, notes, and snippets.

@WtfJoke
Created May 30, 2025 21:53
Show Gist options
  • Select an option

  • Save WtfJoke/3588881da1936e455947ae122af3454b to your computer and use it in GitHub Desktop.

Select an option

Save WtfJoke/3588881da1936e455947ae122af3454b to your computer and use it in GitHub Desktop.
Sample of zod bundling options https://github.com/colinhacks/zod/issues/4433
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