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 5.02 kB
{"version":3,"sources":["../src/apis/shared/roadwayLocationSchema.ts","../src/apis/shared/zIsoDateStringSchema.ts","../src/apis/shared/index.ts"],"names":["roadwayLocationSchema","init_roadwayLocationSchema","__esmMin","init_zod","z","zIsoDateString","isISODateString","init_zIsoDateStringSchema","value","val","date","init_shared","init_cacheFlushDate"],"mappings":"+HAAA,IAKaA,CAAAA,CALbC,CAAAA,CAAAC,CAAAA,CAAA,IAAA,CAAAC,IAKaH,CAAAA,CAAwBI,GAAAA,CAClC,MAAA,CAAO,CACN,WAAA,CAAaA,GAAAA,CACV,MAAA,EAAO,CACP,UAAS,CACT,QAAA,CACC,iGACF,CAAA,CACF,SAAA,CAAWA,GAAAA,CACR,MAAA,EAAO,CACP,UAAS,CACT,QAAA,CACC,sGACF,CAAA,CACF,SAAUA,GAAAA,CACP,MAAA,EAAO,CACP,QAAA,CAAS,sDAAsD,CAAA,CAClE,SAAA,CAAWA,GAAAA,CACR,MAAA,EAAO,CACP,QAAA,CAAS,uDAAuD,CAAA,CACnE,SAAUA,GAAAA,CACP,MAAA,EAAO,CACP,QAAA,CACC,+EACF,CAAA,CACF,QAAA,CAAUA,GAAAA,CACP,QAAO,CACP,QAAA,EAAS,CACT,QAAA,CACC,6EACF,CACJ,CAAC,CAAA,CACA,SACC,qFACF,EAAA,CAAA,ECvCF,IAgBaC,CAAAA,CAsBPC,EAtCNC,CAAAA,CAAAL,CAAAA,CAAA,IAAA,CAQAC,CAAAA,EAAAA,CAQaE,EAAiB,IAC5BD,GAAAA,CACG,MAAA,EAAO,CACP,MAAA,CAAQI,CAAAA,EAAUF,CAAAA,CAAgBE,CAAK,EAAG,CACzC,OAAA,CAAS,sDACX,CAAC,CAAA,CACA,SAAA,CAAWC,CAAAA,EAAQ,CAClB,IAAMC,CAAAA,CAAO,IAAI,IAAA,CAAKD,CAAG,CAAA,CACzB,GAAI,MAAA,CAAO,KAAA,CAAMC,EAAK,OAAA,EAAS,CAAA,CAC7B,MAAM,IAAI,KAAA,CAAM,CAAA,0BAAA,EAA6BD,CAAG,CAAA,CAAE,EACpD,OAAOC,CACT,CAAC,CAAA,CAWCJ,CAAAA,CAAmBE,CAAAA,EAA2B,CAGlD,GAAI,CADF,0EAAA,CACY,IAAA,CAAKA,CAAK,CAAA,CAAG,CAEzB,IAAME,CAAAA,CAAO,IAAI,KAAKF,CAAK,CAAA,CAC3B,OAAO,CAAC,MAAA,CAAO,KAAA,CAAME,CAAAA,CAAK,OAAA,EAAS,CACrC,CACA,OAAO,KACT,KC/CA,IAAAC,CAAAA,CAAAT,CAAAA,CAAA,IAAA,CAOAU,MAMAX,CAAAA,EAAAA,CAIAM,CAAAA,GAAAA,CAAAA","file":"chunk-PJWJKPX4.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","/**\n * @fileoverview Shared API schemas and utilities\n *\n * This module exports shared schemas and utilities used across multiple\n * WSDOT API endpoints.\n */\n\nexport {\n type CacheFlushDateInput,\n type CacheFlushDateOutput,\n cacheFlushDateInputSchema,\n cacheFlushDateOutputSchema,\n} from \"./cacheFlushDate\";\nexport {\n type RoadwayLocation,\n roadwayLocationSchema,\n} from \"./roadwayLocationSchema\";\nexport { zIsoDateString } from \"./zIsoDateStringSchema\";\n"]}