{"version":3,"file":"literal-schemas.mjs","names":[],"sources":["../../../../src/_generated/style-rules/literal-schemas.ts"],"sourcesContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/*!\n *\n *  Copyright (c) \"Neo4j\"\n *  Neo4j Sweden AB [http://neo4j.com]\n *\n *  This file is part of Neo4j.\n *\n *  Neo4j is free software: you can redistribute it and/or modify\n *  it under the terms of the GNU General Public License as published by\n *  the Free Software Foundation, either version 3 of the License, or\n *  (at your option) any later version.\n *\n *  This program is distributed in the hope that it will be useful,\n *  but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { z } from 'zod';\n\nimport {\n  parseDateString,\n  parseLocalDateString,\n  parseTimeString,\n} from './date-utils';\nimport type {\n  BigintLiteral,\n  DatetimeLiteral,\n  LocalDatetimeLiteral,\n  NumericLiteral,\n  RangeLiteral,\n  TimeLiteral,\n} from './literal-types';\n\n/*\n * Internal only. These schemas are the runtime backing for the style-rule type\n * guards; the public contract is the hand-written types in `literal-types.ts`.\n * Do NOT re-export these schemas from this package or from any consumer's\n * public entry point.\n */\n\n/**\n * A JSON-safe bigint literal. Native bigint values cannot be serialized as\n * JSON, so persisted style rules can use a signed decimal string instead.\n */\nexport const BigintLiteralSchema = z.object({\n  bigint: z.string().regex(/^[+-]?\\d+$/, {\n    message: 'bigint must be a signed decimal integer string',\n  }),\n}) satisfies z.ZodType<BigintLiteral>;\n\n/** A numeric style-rule literal, including native and JSON-safe bigints. */\nexport const NumericLiteralSchema = z.union([\n  z.number(),\n  z.bigint(),\n  BigintLiteralSchema,\n]) satisfies z.ZodType<NumericLiteral>;\n\n/**\n * An ISO 8601 or RFC 9557 datetime literal that resolves to a Unix millisecond\n * timestamp at evaluation time. Supported formats:\n * - RFC 9557 with IANA timezone: `\"2024-06-15T14:00:00[Europe/Stockholm]\"` (offset\n *   inferred from the named zone, DST-aware) or `\"2024-06-15T14:00:00+02:00[Europe/Stockholm]\"`\n *   (offset explicit)\n * - UTC or offset datetime: `\"2024-01-01T00:00:00Z\"`, `\"2024-01-01T00:00:00+02:00\"`\n * - Plain datetime (treated as UTC): `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as UTC midnight): `\"2024-01-01\"`\n */\nexport const DatetimeLiteralSchema = z.object({\n  datetime: z.string().refine((input) => parseDateString(input) !== null, {\n    message:\n      'datetime must be a valid ISO 8601 / RFC 9557 date or datetime string',\n  }),\n}) satisfies z.ZodType<DatetimeLiteral>;\n\n/**\n * A plain (unzoned) ISO 8601 date or datetime literal that resolves to a Unix\n * millisecond timestamp at evaluation time, interpreting the wall-clock time\n * in the browser's local timezone.\n *\n * Only plain date/datetime strings without timezone qualifiers are accepted:\n * - Plain datetime: `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as local midnight): `\"2024-01-01\"`\n *\n * Strings with `Z`, a UTC offset (`+02:00`), or an IANA bracket\n * (`[Europe/Stockholm]`) are **rejected** — use `{ datetime }` for\n * timezone-aware instants. This matches the semantics of Neo4j `LocalDateTime`.\n */\nexport const LocalDatetimeLiteralSchema = z.object({\n  localdatetime: z\n    .string()\n    .refine((input) => parseLocalDateString(input) !== null, {\n      message:\n        'localdatetime must be a valid ISO 8601 plain date or datetime string (no Z, offset, or timezone)',\n    }),\n}) satisfies z.ZodType<LocalDatetimeLiteral>;\n\n/**\n * An ISO 8601 time literal that resolves to milliseconds since UTC midnight\n * at evaluation time. Supported formats:\n * - Local time (treated as UTC): `\"14:30:00\"`, `\"14:30:00.500\"`\n * - UTC time: `\"14:30:00Z\"` — identical to local form\n * - Offset time (UTC-normalised): `\"14:30:00+02:00\"` → 45,000,000 ms (12:30 UTC)\n *\n * IANA timezone brackets (e.g. `[Europe/Stockholm]`) are **not** accepted — a\n * time-of-day value has no calendar date so DST cannot be resolved. Use\n * `{ datetime }` literals for timezone-aware instants.\n *\n * Full datetime strings (containing `T`) are rejected.\n */\nexport const TimeLiteralSchema = z.object({\n  time: z.string().refine((input) => parseTimeString(input) !== null, {\n    message:\n      'time must be a valid ISO 8601 time string (e.g. \"14:30:00\" or \"14:30:00+02:00\")',\n  }),\n}) satisfies z.ZodType<TimeLiteral>;\n\n/**\n * A continuous, orderable literal that can be used as a range boundary.\n * Temporal literals resolve to numbers before range interpolation.\n */\nexport const RangeLiteralSchema = z.union([\n  NumericLiteralSchema,\n  DatetimeLiteralSchema,\n  LocalDatetimeLiteralSchema,\n  TimeLiteralSchema,\n]) satisfies z.ZodType<RangeLiteral>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,MAAa,sBAAsB,EAAE,OAAO,EAC1C,QAAQ,EAAE,OAAO,CAAC,CAAC,MAAM,cAAc,EACrC,SAAS,iDACX,CAAC,EACH,CAAC;;AAGD,MAAa,uBAAuB,EAAE,MAAM;CAC1C,EAAE,OAAO;CACT,EAAE,OAAO;CACT;AACF,CAAC;;;;;;;;;;;AAYD,MAAa,wBAAwB,EAAE,OAAO,EAC5C,UAAU,EAAE,OAAO,CAAC,CAAC,QAAQ,UAAU,gBAAgB,KAAK,MAAM,MAAM,EACtE,SACE,uEACJ,CAAC,EACH,CAAC;;;;;;;;;;;;;;AAeD,MAAa,6BAA6B,EAAE,OAAO,EACjD,eAAe,EACZ,OAAO,CAAC,CACR,QAAQ,UAAU,qBAAqB,KAAK,MAAM,MAAM,EACvD,SACE,mGACJ,CAAC,EACL,CAAC;;;;;;;;;;;;;;AAeD,MAAa,oBAAoB,EAAE,OAAO,EACxC,MAAM,EAAE,OAAO,CAAC,CAAC,QAAQ,UAAU,gBAAgB,KAAK,MAAM,MAAM,EAClE,SACE,sFACJ,CAAC,EACH,CAAC;;;;;AAMD,MAAa,qBAAqB,EAAE,MAAM;CACxC;CACA;CACA;CACA;AACF,CAAC"}