UNPKG

ws-dottie

Version:

Your friendly TypeScript companion for Washington State transportation APIs - WSDOT and WSF data with smart caching and React Query integration

1 lines 4.22 kB
{"version":3,"sources":["../src/apis/shared/roadwayLocationSchema.ts","../src/apis/shared/zIsoDateStringSchema.ts"],"names":["roadwayLocationSchema","z","zIsoDateString","value","isISODateString","val","date"],"mappings":"qCAKO,IAAMA,CAAAA,CAAwBC,CAAAA,CAClC,MAAA,CAAO,CACN,WAAA,CAAaA,CAAAA,CACV,MAAA,EAAO,CACP,QAAA,EAAS,CACT,QAAA,CACC,iGACF,CAAA,CACF,SAAA,CAAWA,CAAAA,CACR,MAAA,EAAO,CACP,QAAA,EAAS,CACT,QAAA,CACC,sGACF,CAAA,CACF,QAAA,CAAUA,CAAAA,CACP,MAAA,EAAO,CACP,QAAA,CAAS,sDAAsD,CAAA,CAClE,SAAA,CAAWA,CAAAA,CACR,MAAA,EAAO,CACP,QAAA,CAAS,uDAAuD,CAAA,CACnE,QAAA,CAAUA,CAAAA,CACP,MAAA,EAAO,CACP,QAAA,CACC,+EACF,CAAA,CACF,QAAA,CAAUA,CAAAA,CACP,MAAA,EAAO,CACP,QAAA,EAAS,CACT,QAAA,CACC,6EACF,CACJ,CAAC,CAAA,CACA,QAAA,CACC,qFACF,ECvBK,IAAMC,CAAAA,CAAiB,IAC5BD,EACG,MAAA,EAAO,CACP,MAAA,CAAQE,CAAAA,EAAUC,CAAAA,CAAgBD,CAAK,CAAA,CAAG,CACzC,OAAA,CAAS,sDACX,CAAC,CAAA,CACA,SAAA,CAAWE,CAAAA,EAAQ,CAClB,IAAMC,CAAAA,CAAO,IAAI,IAAA,CAAKD,CAAG,CAAA,CACzB,GAAI,MAAA,CAAO,KAAA,CAAMC,CAAAA,CAAK,OAAA,EAAS,CAAA,CAC7B,MAAM,IAAI,KAAA,CAAM,CAAA,0BAAA,EAA6BD,CAAG,CAAA,CAAE,CAAA,CACpD,OAAOC,CACT,CAAC,CAAA,CAWCF,CAAAA,CAAmBD,CAAAA,EAA2B,CAGlD,GAAI,CADF,0EAAA,CACY,IAAA,CAAKA,CAAK,CAAA,CAAG,CAEzB,IAAMG,CAAAA,CAAO,IAAI,IAAA,CAAKH,CAAK,CAAA,CAC3B,OAAO,CAAC,MAAA,CAAO,KAAA,CAAMG,CAAAA,CAAK,OAAA,EAAS,CACrC,CACA,OAAO,KACT","file":"chunk-ADNUROX2.mjs","sourcesContent":["import { z } from \"@/shared/zod\";\n\n/**\n * Roadway location information including route, milepost, coordinates, and direction.\n */\nexport const roadwayLocationSchema = z\n .object({\n Description: z\n .string()\n .nullable()\n .describe(\n \"Human-readable description of the roadway location, such as interchange names or cross streets.\"\n ),\n Direction: z\n .string()\n .nullable()\n .describe(\n \"Traffic direction designation: N, S, B, NB, or SB, indicating which side of the highway is affected.\"\n ),\n Latitude: z\n .number()\n .describe(\"Latitude of the roadway location in decimal degrees.\"),\n Longitude: z\n .number()\n .describe(\"Longitude of the roadway location in decimal degrees.\"),\n MilePost: z\n .number()\n .describe(\n \"Milepost marker along the highway corridor, with 0 indicating route terminus.\"\n ),\n RoadName: z\n .string()\n .nullable()\n .describe(\n \"Highway or route designation code, such as '005' for I-5 or '090' for I-90.\"\n ),\n })\n .describe(\n \"Roadway location information including route, milepost, coordinates, and direction.\"\n );\n\nexport type RoadwayLocation = z.infer<typeof roadwayLocationSchema>;\n","/**\n * @fileoverview ISO Date String Validation for TanStack Query\n *\n * This module provides Zod schema validation for ISO date format strings,\n * including standard ISO-8601 date formats. It handles validation and\n * transformation to JavaScript Date objects.\n */\n\nimport { z } from \"@/shared/zod\";\n\n/**\n * ISO date string validation and transformation schema\n *\n * This Zod schema handles ISO date formats (e.g., \"2024-01-01T12:00:00.000Z\").\n * It validates the input format and transforms it to a JavaScript Date object.\n */\nexport const zIsoDateString = () =>\n z\n .string()\n .refine((value) => isISODateString(value), {\n message: \"Invalid date format. Expected ISO date string format\",\n })\n .transform((val) => {\n const date = new Date(val);\n if (Number.isNaN(date.getTime()))\n throw new Error(`Failed to parse ISO date: ${val}`);\n return date;\n });\n\n/**\n * Type guard for ISO date format\n *\n * This function checks if a string matches the ISO-8601 date format\n * with optional time and timezone information.\n *\n * @param value - The string to check\n * @returns True if the string matches ISO-8601 date format\n */\nconst isISODateString = (value: string): boolean => {\n const isoRegex =\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}(\\.\\d{1,3})?)?(Z|[+-]\\d{2}:\\d{2})?$/;\n if (!isoRegex.test(value)) {\n // Try basic date parsing as fallback\n const date = new Date(value);\n return !Number.isNaN(date.getTime());\n }\n return true;\n};\n"]}