@wildo-ai/zod-decorators 1.1.11 → 1.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/esm/commons.d.ts.map +1 -1
  2. package/dist/esm/commons.js.map +1 -1
  3. package/dist/esm/currencies.shared.schemas.d.ts.map +1 -1
  4. package/dist/esm/currencies.shared.schemas.js.map +1 -1
  5. package/dist/esm/files/agent-file-formats.d.ts.map +1 -1
  6. package/dist/esm/files/agent-file-formats.js.map +1 -1
  7. package/dist/esm/files/extension-nature-map.d.ts.map +1 -1
  8. package/dist/esm/files/extension-nature-map.js.map +1 -1
  9. package/dist/esm/files/file-extensions.enum.d.ts.map +1 -1
  10. package/dist/esm/files/file-extensions.enum.js.map +1 -1
  11. package/dist/esm/files/mime-registry.d.ts.map +1 -1
  12. package/dist/esm/files/mime-registry.js.map +1 -1
  13. package/dist/esm/files/unified-registry.d.ts.map +1 -1
  14. package/dist/esm/files/unified-registry.js.map +1 -1
  15. package/dist/esm/index.d.ts +2 -0
  16. package/dist/esm/index.d.ts.map +1 -1
  17. package/dist/esm/index.js +2 -0
  18. package/dist/esm/index.js.map +1 -1
  19. package/dist/esm/install-bigint-json-encoding.d.ts +1 -1
  20. package/dist/esm/install-bigint-json-encoding.d.ts.map +1 -1
  21. package/dist/esm/install-bigint-json-encoding.js +1 -1
  22. package/dist/esm/install-bigint-json-encoding.js.map +1 -1
  23. package/dist/esm/testing/decorated-test-schemas.d.ts +7 -7
  24. package/dist/esm/testing/decorated-test-schemas.d.ts.map +1 -1
  25. package/dist/esm/testing/decorated-test-schemas.js.map +1 -1
  26. package/dist/esm/testing.d.ts.map +1 -1
  27. package/dist/esm/testing.js.map +1 -1
  28. package/dist/esm/zod-address.d.ts.map +1 -1
  29. package/dist/esm/zod-address.js.map +1 -1
  30. package/dist/esm/zod-bigdecimal.d.ts +4 -4
  31. package/dist/esm/zod-bigdecimal.d.ts.map +1 -1
  32. package/dist/esm/zod-bigdecimal.js.map +1 -1
  33. package/dist/esm/zod-code.d.ts +4 -4
  34. package/dist/esm/zod-code.d.ts.map +1 -1
  35. package/dist/esm/zod-code.js.map +1 -1
  36. package/dist/esm/zod-color.d.ts.map +1 -1
  37. package/dist/esm/zod-color.js.map +1 -1
  38. package/dist/esm/zod-decorators.types.d.ts +116 -9
  39. package/dist/esm/zod-decorators.types.d.ts.map +1 -1
  40. package/dist/esm/zod-decorators.types.js +40 -1
  41. package/dist/esm/zod-decorators.types.js.map +1 -1
  42. package/dist/esm/zod-document-sequence.d.ts.map +1 -1
  43. package/dist/esm/zod-document-sequence.js.map +1 -1
  44. package/dist/esm/zod-duration.d.ts +6 -6
  45. package/dist/esm/zod-duration.d.ts.map +1 -1
  46. package/dist/esm/zod-duration.js.map +1 -1
  47. package/dist/esm/zod-file.d.ts +5 -4
  48. package/dist/esm/zod-file.d.ts.map +1 -1
  49. package/dist/esm/zod-file.js +1 -1
  50. package/dist/esm/zod-file.js.map +1 -1
  51. package/dist/esm/zod-money.d.ts +4 -4
  52. package/dist/esm/zod-money.d.ts.map +1 -1
  53. package/dist/esm/zod-money.js.map +1 -1
  54. package/dist/esm/zod-phone.d.ts +4 -4
  55. package/dist/esm/zod-phone.d.ts.map +1 -1
  56. package/dist/esm/zod-phone.js.map +1 -1
  57. package/dist/esm/zod-range.d.ts.map +1 -1
  58. package/dist/esm/zod-range.js.map +1 -1
  59. package/dist/esm/zod-utils.shared.d.ts +47 -12
  60. package/dist/esm/zod-utils.shared.d.ts.map +1 -1
  61. package/dist/esm/zod-utils.shared.js +143 -40
  62. package/dist/esm/zod-utils.shared.js.map +1 -1
  63. package/dist/esm/zod-versioned.d.ts.map +1 -1
  64. package/dist/esm/zod-versioned.js.map +1 -1
  65. package/dist/esm/zod-wire-date.d.ts +107 -0
  66. package/dist/esm/zod-wire-date.d.ts.map +1 -0
  67. package/dist/esm/zod-wire-date.js +162 -0
  68. package/dist/esm/zod-wire-date.js.map +1 -0
  69. package/dist/esm/zod-year-month.d.ts +76 -0
  70. package/dist/esm/zod-year-month.d.ts.map +1 -0
  71. package/dist/esm/zod-year-month.js +115 -0
  72. package/dist/esm/zod-year-month.js.map +1 -0
  73. package/dist/esm/zod.module-override.d.ts +139 -156
  74. package/dist/esm/zod.module-override.d.ts.map +1 -1
  75. package/dist/esm/zod.module-override.js +176 -6
  76. package/dist/esm/zod.module-override.js.map +1 -1
  77. package/dist/tsconfig.build.tsbuildinfo +1 -1
  78. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"zod-address.d.ts","sourceRoot":"","sources":["../../../src/zod-address.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,oBAAoB,EAEpB,cAAc,EAEd,kBAAkB,EAClB,YAAY,EACZ,uBAAuB,EACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,gDAAgD;AAChD,MAAM,WAAW,kBAAkB;IACjC,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,4FAA4F;IAC5F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,iGAAiG;IACjG,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAClC;AAED;;;GAGG;AACH,oBAAY,WAAW;IACrB,mCAAmC;IACnC,KAAK,UAAU;IACf,4CAA4C;IAC5C,KAAK,UAAU;IACf,8BAA8B;IAC9B,IAAI,SAAS;IACb,mFAAmF;IACnF,KAAK,UAAU;IACf,qDAAqD;IACrD,WAAW,eAAe;IAC1B,oCAAoC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IAAI;QACjD,GAAG,CAAC,gBAAgB,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,gBAAgB,EAAE,CAAC;QAC5E,GAAG,CAAC,cAAc,KAAK,SAAS,IAAI,EAAE,cAAc,EAAE,CAAC;KACxD,CAAC;IAEF,MAAM,gBAAgB,GAAyB,aAAqB,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;IAC3F,aAAqB,CAAC,eAAe,CAAC,GAAG;QACxC,GAAG,gBAAgB;QACnB,aAAa,EAAE,eAAe;KAC/B,CAAC;IAEF,mBAAmB,CAAC,aAAa,CAAC,CAAC;IAEnC,OAAO,aAAuC,CAAC;AACjD,CAAC;AAoBD;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,OAA8B;IACtD,OAAO,mBAAmB,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC;AACD,mDAAmD","sourcesContent":["// ============================================================================\n// ADDRESS SCHEMA HELPER (#561)\n// ============================================================================\n\nimport {\n AddressSchemaMetadata,\n AddressSchemaOptions,\n CustomFieldMetadata,\n DecoratorInput,\n SCHEMA_METADATA,\n SummaryFieldParams,\n ZodDecorator,\n ZodDecorator_ParamsType,\n} from './zod-decorators.types';\nimport { z } from 'zod';\nimport { addChainableMethods } from './zod.module-override';\n\n/** A point on the globe, in decimal degrees. */\nexport interface AddressCoordinates {\n /** -90 (south pole) to 90 (north pole). */\n latitude: number;\n /** -180 to 180. */\n longitude: number;\n}\n\n/**\n * A structured postal address.\n *\n * The part names are the ones the framework's existing `AddressSchema` already uses (organisation\n * profiles), so an application meets ONE address vocabulary rather than two. `postalCode` is optional\n * because not every country issues one.\n */\nexport interface AddressValue {\n line1: string;\n line2?: string;\n city: string;\n /** Region, state, province or county — whatever the country calls its first subdivision. */\n state?: string;\n postalCode?: string;\n /** ISO 3166-1 alpha-2, stored uppercase. */\n country: string;\n /** An optional geocode. It does NOT take part in identity — see {@link addressComparisonKey}. */\n coordinates?: AddressCoordinates;\n}\n\n/**\n * The parts of an address value, named once so the factory, the form control and the error routing\n * agree. Each member's value is the key it has in {@link AddressValue}.\n */\nexport enum AddressPart {\n /** Street and number. Required. */\n LINE1 = 'line1',\n /** Building, floor, apartment. Optional. */\n LINE2 = 'line2',\n /** Town or city. Required. */\n CITY = 'city',\n /** The country's first subdivision (state, province, region, county). Optional. */\n STATE = 'state',\n /** Optional because not every country issues one. */\n POSTAL_CODE = 'postalCode',\n /** ISO 3166-1 alpha-2. Required. */\n COUNTRY = 'country',\n}\n\n/** The two halves of the optional geocode. Each member's value is its key in {@link AddressCoordinates}. */\nexport enum AddressCoordinatePart {\n LATITUDE = 'latitude',\n LONGITUDE = 'longitude',\n}\n\n/**\n * The dotted path of every editable part inside an address value — the paths a validation issue is\n * reported at (`city`, `coordinates.longitude`). A form routes each part's error to its own control\n * by these, instead of summarising a nested error as one message for the whole field.\n */\nexport function listAddressPartPaths(): string[] {\n return [...Object.values(AddressPart), ...Object.values(AddressCoordinatePart).map((part) => `coordinates.${part}`)];\n}\n\nconst ISO_COUNTRY_CODE_PATTERN = /^[A-Z]{2}$/;\n\n/**\n * The canonical spelling of one free-text address part: trimmed, with inner whitespace collapsed to a\n * single space. Applied on parse, so a stored value never carries the typist's accidental spacing.\n */\nexport function normalizeAddressText(value: string): string {\n return value.trim().replace(/\\s+/g, ' ');\n}\n\n/** The canonical spelling of a country code: trimmed and uppercased. */\nexport function normalizeAddressCountry(value: string): string {\n return value.trim().toUpperCase();\n}\n\nexport const AddressCoordinatesSchema: z.ZodObject<{ latitude: z.ZodNumber; longitude: z.ZodNumber }> = z.object({\n latitude: z.number().min(-90).max(90).describe('Latitude in decimal degrees, from -90 to 90.'),\n longitude: z.number().min(-180).max(180).describe('Longitude in decimal degrees, from -180 to 180.'),\n});\n\n/**\n * A key under which two SPELLINGS of one address compare equal.\n *\n * Country and postal code are compared exactly after uppercasing (and, for the postal code, removing\n * spaces: `75 002` and `75002` are one code). Every free-text part is compared after case-folding,\n * stripping diacritics and treating any run of punctuation or whitespace as one separator — so\n * `12 Rue de La Paix` and `12 rue de la paix` agree, and `Saint-Étienne` matches `saint etienne`.\n *\n * Coordinates are deliberately NOT part of the key: a geocode describes where a place is, and two\n * geocoders returning slightly different points for one address must not make it two addresses.\n *\n * What it does NOT do, and cannot without a provider (#394): recognise an ABBREVIATION (`rue` vs `r.`),\n * a differently SPLIT value (postal code and city typed into `line1`), or two formats of one street\n * number (`12bis` vs `12 bis`). It recognises spelling, not meaning.\n */\nexport function addressComparisonKey(\n value: Pick<AddressValue, 'line1' | 'line2' | 'city' | 'state' | 'postalCode' | 'country'>,\n): string {\n const fold = (part: string | undefined): string => (part ?? '')\n .normalize('NFKD')\n .replace(/[\\u0300-\\u036f]/g, '')\n .toLowerCase()\n .replace(/[^\\p{L}\\p{N}]+/gu, ' ')\n .trim();\n const postalCode = (value.postalCode ?? '').replace(/\\s+/g, '').toUpperCase();\n return [\n normalizeAddressCountry(value.country),\n postalCode,\n fold(value.city),\n fold(value.state),\n fold(value.line1),\n fold(value.line2),\n ].join('|');\n}\n\n/** Whether two addresses are the same place spelled differently (see {@link addressComparisonKey}). */\nexport function isSameAddress(\n left: Pick<AddressValue, 'line1' | 'line2' | 'city' | 'state' | 'postalCode' | 'country'>,\n right: Pick<AddressValue, 'line1' | 'line2' | 'city' | 'state' | 'postalCode' | 'country'>,\n): boolean {\n return addressComparisonKey(left) === addressComparisonKey(right);\n}\n\nexport type AddressSchemaShape = {\n line1: z.ZodString;\n line2: z.ZodOptional<z.ZodString>;\n city: z.ZodString;\n state: z.ZodOptional<z.ZodString>;\n postalCode: z.ZodOptional<z.ZodString>;\n country: z.ZodString;\n coordinates: z.ZodOptional<typeof AddressCoordinatesSchema>;\n};\n\n/**\n * @wildo_source:part:start zod.factories.address facet:layer:shared facet:family:schema-factory\n *\n * z_address() - Creates a structured postal address field.\n *\n * The value is `{ line1, line2?, city, state?, postalCode?, country, coordinates? }`: a parsed,\n * country-aware value the framework renders with its own form and display fields, instead of an\n * opaque `z.string()` nothing can validate, normalise or compare.\n *\n * - Free-text parts are normalised on parse (trimmed, inner whitespace collapsed).\n * - `country` is an ISO 3166-1 alpha-2 code, uppercased on parse; `countriesAllowed` restricts it.\n * - `coordinates` is an optional `{ latitude, longitude }` pair; `withCoordinates` offers it in the form.\n * - `addressComparisonKey` / `isSameAddress` (same package) tell whether two values are one place\n * spelled differently.\n *\n * An address is personal data. Declare its data category and erasure treatment on the field like any\n * other personal field: this factory does not decide either for you.\n *\n * @example\n * ```typescript\n * import { z_address } from '@wildo-ai/zod-decorators';\n *\n * const shippingAddress = z_address();\n * const siteAddress = z_address({ withCoordinates: true, countriesAllowed: ['FR', 'BE'], defaultCountry: 'FR' });\n * ```\n */\nexport function createAddressSchema(options: AddressSchemaOptions = {}): DecoratedAddressSchema {\n const countriesAllowed = options.countriesAllowed?.map(normalizeAddressCountry);\n for (const code of countriesAllowed ?? []) {\n if (!ISO_COUNTRY_CODE_PATTERN.test(code)) {\n throw new Error(`[z_address] countriesAllowed contains \"${code}\", which is not an ISO 3166-1 alpha-2 code.`);\n }\n }\n const defaultCountry = options.defaultCountry === undefined ? undefined : normalizeAddressCountry(options.defaultCountry);\n if (defaultCountry !== undefined) {\n // Refused at DECLARATION, not at first render: a form pre-selecting a country the value may not\n // name would be an error the author could only discover by filling the form.\n if (!ISO_COUNTRY_CODE_PATTERN.test(defaultCountry)) {\n throw new Error(`[z_address] defaultCountry \"${options.defaultCountry}\" is not an ISO 3166-1 alpha-2 code.`);\n }\n if (countriesAllowed && countriesAllowed.length > 0 && !countriesAllowed.includes(defaultCountry)) {\n throw new Error(`[z_address] defaultCountry \"${defaultCountry}\" is not among countriesAllowed (${countriesAllowed.join(', ')}).`);\n }\n }\n\n const text = (): z.ZodString => z.string().overwrite(normalizeAddressText);\n let country: z.ZodString = z.string()\n .overwrite(normalizeAddressCountry)\n .regex(ISO_COUNTRY_CODE_PATTERN, { error: 'Country must be an ISO 3166-1 alpha-2 code' });\n if (countriesAllowed && countriesAllowed.length > 0) {\n country = country.refine((code) => countriesAllowed.includes(code), {\n error: `Country must be one of: ${countriesAllowed.join(', ')}`,\n });\n }\n\n const addressSchema = z.object({\n line1: text().min(1, { error: 'Address line 1 is required' }).max(100).describe(\"The first line of the street address.\"),\n line2: text().max(100).optional().describe(\"The second line of the street address, when there is one.\"),\n city: text().min(1, { error: 'City is required' }).max(50).describe(\"The city or locality.\"),\n state: text().max(50).optional().describe(\"The region, state, province or county: whatever the country calls its first subdivision.\"),\n postalCode: text().max(20).optional().describe(\"The postal code, when the country issues one.\"),\n country: country.describe(\"The country, as an ISO 3166-1 alpha-2 code in upper case.\"),\n coordinates: AddressCoordinatesSchema.optional().describe(\"An optional geocode. It does not take part in comparing two addresses.\"),\n });\n\n const addressMetadata: AddressSchemaMetadata = {\n isAddress: true,\n withCoordinates: options.withCoordinates === true,\n ...(countriesAllowed && countriesAllowed.length > 0 && { countriesAllowed }),\n ...(defaultCountry !== undefined && { defaultCountry }),\n };\n\n const existingMetadata: CustomFieldMetadata = (addressSchema as any)[SCHEMA_METADATA] || {};\n (addressSchema as any)[SCHEMA_METADATA] = {\n ...existingMetadata,\n addressConfig: addressMetadata,\n };\n\n addChainableMethods(addressSchema);\n\n return addressSchema as DecoratedAddressSchema;\n}\n\n/**\n * Return type for address schemas — includes the decorators applicable to a `ZodObject`.\n *\n * No address-specific UI or SPEC decorator exists yet: the form and display fields render from the\n * metadata alone. Adding one later is additive.\n */\nexport type DecoratedAddressSchema = z.ZodObject<AddressSchemaShape> & {\n [ZodDecorator.IS_DB_INDEXED](): DecoratedAddressSchema;\n [ZodDecorator.IS_HIDDEN](params?: ZodDecorator_ParamsType[ZodDecorator.IS_HIDDEN]): DecoratedAddressSchema;\n [ZodDecorator.IS_NOT_EDITABLE](params?: ZodDecorator_ParamsType[ZodDecorator.IS_NOT_EDITABLE]): DecoratedAddressSchema;\n [ZodDecorator.IS_SUMMARY_FIELD](params?: SummaryFieldParams): DecoratedAddressSchema;\n [ZodDecorator.IS_BACKEND_ONLY](params?: ZodDecorator_ParamsType[ZodDecorator.IS_BACKEND_ONLY]): DecoratedAddressSchema;\n [ZodDecorator.IS_WRITE_ONLY_SECRET](params?: ZodDecorator_ParamsType[ZodDecorator.IS_WRITE_ONLY_SECRET]): DecoratedAddressSchema;\n [ZodDecorator.EXCLUDE_FROM_CREATE](): DecoratedAddressSchema;\n [ZodDecorator.EXCLUDE_FROM_UPDATE](): DecoratedAddressSchema;\n addDecorators(decorators: DecoratorInput[]): DecoratedAddressSchema;\n};\n\n/**\n * Creates a structured postal address schema. Named z_address to indicate it is a Zod helper exported\n * standalone, like `z_money` and `z_phone`.\n */\nexport function z_address(options?: AddressSchemaOptions): DecoratedAddressSchema {\n return createAddressSchema(options);\n}\n/** @wildo_source:part:end zod.factories.address */\n"]}
1
+ {"version":3,"file":"zod-address.js","sourceRoot":"","sources":["../../src/zod-address.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,+BAA+B;AAC/B,+EAA+E;AAE/E,OAAO,EAKL,eAAe,EAEf,YAAY,GAEb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AA8B5D;;;GAGG;AACH,MAAM,CAAN,IAAY,WAaX;AAbD,WAAY,WAAW;IACrB,mCAAmC;IACnC,8BAAe,CAAA;IACf,4CAA4C;IAC5C,8BAAe,CAAA;IACf,8BAA8B;IAC9B,4BAAa,CAAA;IACb,mFAAmF;IACnF,8BAAe,CAAA;IACf,qDAAqD;IACrD,yCAA0B,CAAA;IAC1B,oCAAoC;IACpC,kCAAmB,CAAA;AACrB,CAAC,EAbW,WAAW,KAAX,WAAW,QAatB;AAED,4GAA4G;AAC5G,MAAM,CAAN,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,8CAAqB,CAAA;IACrB,gDAAuB,CAAA;AACzB,CAAC,EAHW,qBAAqB,KAArB,qBAAq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\n// ADDRESS SCHEMA HELPER (#561)\n// ============================================================================\n\nimport {\n AddressSchemaMetadata,\n AddressSchemaOptions,\n CustomFieldMetadata,\n DecoratorInput,\n SCHEMA_METADATA,\n SummaryFieldParams,\n ZodDecorator,\n ZodDecorator_ParamsType,\n} from './zod-decorators.types';\nimport { z } from 'zod';\nimport { addChainableMethods } from './zod.module-override';\n\n/** A point on the globe, in decimal degrees. */\nexport interface AddressCoordinates {\n /** -90 (south pole) to 90 (north pole). */\n latitude: number;\n /** -180 to 180. */\n longitude: number;\n}\n\n/**\n * A structured postal address.\n *\n * The part names are the ones the framework's existing `AddressSchema` already uses (organisation\n * profiles), so an application meets ONE address vocabulary rather than two. `postalCode` is optional\n * because not every country issues one.\n */\nexport interface AddressValue {\n line1: string;\n line2?: string;\n city: string;\n /** Region, state, province or county — whatever the country calls its first subdivision. */\n state?: string;\n postalCode?: string;\n /** ISO 3166-1 alpha-2, stored uppercase. */\n country: string;\n /** An optional geocode. It does NOT take part in identity — see {@link addressComparisonKey}. */\n coordinates?: AddressCoordinates;\n}\n\n/**\n * The parts of an address value, named once so the factory, the form control and the error routing\n * agree. Each member's value is the key it has in {@link AddressValue}.\n */\nexport enum AddressPart {\n /** Street and number. Required. */\n LINE1 = 'line1',\n /** Building, floor, apartment. Optional. */\n LINE2 = 'line2',\n /** Town or city. Required. */\n CITY = 'city',\n /** The country's first subdivision (state, province, region, county). Optional. */\n STATE = 'state',\n /** Optional because not every country issues one. */\n POSTAL_CODE = 'postalCode',\n /** ISO 3166-1 alpha-2. Required. */\n COUNTRY = 'country',\n}\n\n/** The two halves of the optional geocode. Each member's value is its key in {@link AddressCoordinates}. */\nexport enum AddressCoordinatePart {\n LATITUDE = 'latitude',\n LONGITUDE = 'longitude',\n}\n\n/**\n * The dotted path of every editable part inside an address value — the paths a validation issue is\n * reported at (`city`, `coordinates.longitude`). A form routes each part's error to its own control\n * by these, instead of summarising a nested error as one message for the whole field.\n */\nexport function listAddressPartPaths(): string[] {\n return [...Object.values(AddressPart), ...Object.values(AddressCoordinatePart).map((part) => `coordinates.${part}`)];\n}\n\nconst ISO_COUNTRY_CODE_PATTERN = /^[A-Z]{2}$/;\n\n/**\n * The canonical spelling of one free-text address part: trimmed, with inner whitespace collapsed to a\n * single space. Applied on parse, so a stored value never carries the typist's accidental spacing.\n */\nexport function normalizeAddressText(value: string): string {\n return value.trim().replace(/\\s+/g, ' ');\n}\n\n/** The canonical spelling of a country code: trimmed and uppercased. */\nexport function normalizeAddressCountry(value: string): string {\n return value.trim().toUpperCase();\n}\n\nexport const AddressCoordinatesSchema: z.ZodObject<{ latitude: z.ZodNumber; longitude: z.ZodNumber }> = z.object({\n latitude: z.number().min(-90).max(90).describe('Latitude in decimal degrees, from -90 to 90.'),\n longitude: z.number().min(-180).max(180).describe('Longitude in decimal degrees, from -180 to 180.'),\n});\n\n/**\n * A key under which two SPELLINGS of one address compare equal.\n *\n * Country and postal code are compared exactly after uppercasing (and, for the postal code, removing\n * spaces: `75 002` and `75002` are one code). Every free-text part is compared after case-folding,\n * stripping diacritics and treating any run of punctuation or whitespace as one separator — so\n * `12 Rue de La Paix` and `12 rue de la paix` agree, and `Saint-Étienne` matches `saint etienne`.\n *\n * Coordinates are deliberately NOT part of the key: a geocode describes where a place is, and two\n * geocoders returning slightly different points for one address must not make it two addresses.\n *\n * What it does NOT do, and cannot without a provider (#394): recognise an ABBREVIATION (`rue` vs `r.`),\n * a differently SPLIT value (postal code and city typed into `line1`), or two formats of one street\n * number (`12bis` vs `12 bis`). It recognises spelling, not meaning.\n */\nexport function addressComparisonKey(\n value: Pick<AddressValue, 'line1' | 'line2' | 'city' | 'state' | 'postalCode' | 'country'>,\n): string {\n const fold = (part: string | undefined): string => (part ?? '')\n .normalize('NFKD')\n .replace(/[\\u0300-\\u036f]/g, '')\n .toLowerCase()\n .replace(/[^\\p{L}\\p{N}]+/gu, ' ')\n .trim();\n const postalCode = (value.postalCode ?? '').replace(/\\s+/g, '').toUpperCase();\n return [\n normalizeAddressCountry(value.country),\n postalCode,\n fold(value.city),\n fold(value.state),\n fold(value.line1),\n fold(value.line2),\n ].join('|');\n}\n\n/** Whether two addresses are the same place spelled differently (see {@link addressComparisonKey}). */\nexport function isSameAddress(\n left: Pick<AddressValue, 'line1' | 'line2' | 'city' | 'state' | 'postalCode' | 'country'>,\n right: Pick<AddressValue, 'line1' | 'line2' | 'city' | 'state' | 'postalCode' | 'country'>,\n): boolean {\n return addressComparisonKey(left) === addressComparisonKey(right);\n}\n\nexport type AddressSchemaShape = {\n line1: z.ZodString;\n line2: z.ZodOptional<z.ZodString>;\n city: z.ZodString;\n state: z.ZodOptional<z.ZodString>;\n postalCode: z.ZodOptional<z.ZodString>;\n country: z.ZodString;\n coordinates: z.ZodOptional<typeof AddressCoordinatesSchema>;\n};\n\n/**\n * @wildo_source:part:start zod.factories.address facet:layer:shared facet:family:schema-factory\n *\n * z_address() - Creates a structured postal address field.\n *\n * The value is `{ line1, line2?, city, state?, postalCode?, country, coordinates? }`: a parsed,\n * country-aware value the framework renders with its own form and display fields, instead of an\n * opaque `z.string()` nothing can validate, normalise or compare.\n *\n * - Free-text parts are normalised on parse (trimmed, inner whitespace collapsed).\n * - `country` is an ISO 3166-1 alpha-2 code, uppercased on parse; `countriesAllowed` restricts it.\n * - `coordinates` is an optional `{ latitude, longitude }` pair; `withCoordinates` offers it in the form.\n * - `addressComparisonKey` / `isSameAddress` (same package) tell whether two values are one place\n * spelled differently.\n *\n * An address is personal data. Declare its data category and erasure treatment on the field like any\n * other personal field: this factory does not decide either for you.\n *\n * @example\n * ```typescript\n * import { z_address } from '@wildo-ai/zod-decorators';\n *\n * const shippingAddress = z_address();\n * const siteAddress = z_address({ withCoordinates: true, countriesAllowed: ['FR', 'BE'], defaultCountry: 'FR' });\n * ```\n */\nexport function createAddressSchema(options: AddressSchemaOptions = {}): DecoratedAddressSchema {\n const countriesAllowed = options.countriesAllowed?.map(normalizeAddressCountry);\n for (const code of countriesAllowed ?? []) {\n if (!ISO_COUNTRY_CODE_PATTERN.test(code)) {\n throw new Error(`[z_address] countriesAllowed contains \"${code}\", which is not an ISO 3166-1 alpha-2 code.`);\n }\n }\n const defaultCountry = options.defaultCountry === undefined ? undefined : normalizeAddressCountry(options.defaultCountry);\n if (defaultCountry !== undefined) {\n // Refused at DECLARATION, not at first render: a form pre-selecting a country the value may not\n // name would be an error the author could only discover by filling the form.\n if (!ISO_COUNTRY_CODE_PATTERN.test(defaultCountry)) {\n throw new Error(`[z_address] defaultCountry \"${options.defaultCountry}\" is not an ISO 3166-1 alpha-2 code.`);\n }\n if (countriesAllowed && countriesAllowed.length > 0 && !countriesAllowed.includes(defaultCountry)) {\n throw new Error(`[z_address] defaultCountry \"${defaultCountry}\" is not among countriesAllowed (${countriesAllowed.join(', ')}).`);\n }\n }\n\n const text = (): z.ZodString => z.string().overwrite(normalizeAddressText);\n let country: z.ZodString = z.string()\n .overwrite(normalizeAddressCountry)\n .regex(ISO_COUNTRY_CODE_PATTERN, { error: 'Country must be an ISO 3166-1 alpha-2 code' });\n if (countriesAllowed && countriesAllowed.length > 0) {\n country = country.refine((code) => countriesAllowed.includes(code), {\n error: `Country must be one of: ${countriesAllowed.join(', ')}`,\n });\n }\n\n const addressSchema = z.object({\n line1: text().min(1, { error: 'Address line 1 is required' }).max(100).describe(\"The first line of the street address.\"),\n line2: text().max(100).optional().describe(\"The second line of the street address, when there is one.\"),\n city: text().min(1, { error: 'City is required' }).max(50).describe(\"The city or locality.\"),\n state: text().max(50).optional().describe(\"The region, state, province or county: whatever the country calls its first subdivision.\"),\n postalCode: text().max(20).optional().describe(\"The postal code, when the country issues one.\"),\n country: country.describe(\"The country, as an ISO 3166-1 alpha-2 code in upper case.\"),\n coordinates: AddressCoordinatesSchema.optional().describe(\"An optional geocode. It does not take part in comparing two addresses.\"),\n });\n\n const addressMetadata: AddressSchemaMetadata = {\n isAddress: true,\n withCoordinates: options.withCoordinates === true,\n ...(countriesAllowed && countriesAllowed.length > 0 && { countriesAllowed }),\n ...(defaultCountry !== undefined && { defaultCountry }),\n };\n\n const existingMetadata: CustomFieldMetadata = (addressSchema as any)[SCHEMA_METADATA] || {};\n (addressSchema as any)[SCHEMA_METADATA] = {\n ...existingMetadata,\n addressConfig: addressMetadata,\n };\n\n addChainableMethods(addressSchema);\n\n return addressSchema as DecoratedAddressSchema;\n}\n\n/**\n * Return type for address schemas — includes the decorators applicable to a `ZodObject`.\n *\n * No address-specific UI or SPEC decorator exists yet: the form and display fields render from the\n * metadata alone. Adding one later is additive.\n */\nexport type DecoratedAddressSchema = z.ZodObject<AddressSchemaShape> & {\n [ZodDecorator.IS_DB_INDEXED](): DecoratedAddressSchema;\n [ZodDecorator.IS_HIDDEN](params?: ZodDecorator_ParamsType[ZodDecorator.IS_HIDDEN]): DecoratedAddressSchema;\n [ZodDecorator.IS_NOT_EDITABLE](params?: ZodDecorator_ParamsType[ZodDecorator.IS_NOT_EDITABLE]): DecoratedAddressSchema;\n [ZodDecorator.IS_SUMMARY_FIELD](params?: SummaryFieldParams): DecoratedAddressSchema;\n [ZodDecorator.IS_BACKEND_ONLY](params?: ZodDecorator_ParamsType[ZodDecorator.IS_BACKEND_ONLY]): DecoratedAddressSchema;\n [ZodDecorator.IS_WRITE_ONLY_SECRET](params?: ZodDecorator_ParamsType[ZodDecorator.IS_WRITE_ONLY_SECRET]): DecoratedAddressSchema;\n [ZodDecorator.EXCLUDE_FROM_CREATE](): DecoratedAddressSchema;\n [ZodDecorator.EXCLUDE_FROM_UPDATE](): DecoratedAddressSchema;\n addDecorators(decorators: DecoratorInput[]): DecoratedAddressSchema;\n};\n\n/**\n * Creates a structured postal address schema. Named z_address to indicate it is a Zod helper exported\n * standalone, like `z_money` and `z_phone`.\n */\nexport function z_address(options?: AddressSchemaOptions): DecoratedAddressSchema {\n return createAddressSchema(options);\n}\n/** @wildo_source:part:end zod.factories.address */\n"]}
@@ -62,10 +62,10 @@ export declare const BigDecimalValueSchema: z.ZodString;
62
62
  export declare function createBigDecimalSchema(options?: BigDecimalSchemaOptions): DecoratedBigDecimalSchema;
63
63
  /**
64
64
  * The chainable methods of `DecoratedBigDecimalSchema`, returning `this` so a chain of several decorations keeps
65
- * the type it reached: `.isSummaryField()` turns the field into a `DecoratedPrimitiveZodType<DecoratedBigDecimalSchema>`,
66
- * and a spec or UI method called after it must return that, not the bare factory type. A method
67
- * returning `DecoratedBigDecimalSchema` itself won that overload inside the intersection, so a resource
68
- * specification's field map rejected `schemaShape.x.<factory>Spec(...)` on a decorated field.
65
+ * the type it reached, whatever the receiver is (`typeof field` in a resource specification's field map).
66
+ * A method returning the bare `DecoratedBigDecimalSchema` once won the overload inside the intersection, so that
67
+ * field map rejected `schemaShape.x.<factory>Spec(...)` on a field decorated first. Every other decorator
68
+ * returns the receiver's own type too (#3031), so `.isSummaryField()` leaves the field a `DecoratedBigDecimalSchema`.
69
69
  */
70
70
  export interface DecoratedBigDecimalSchemaMethods {
71
71
  [ZodDecorator.IS_DB_INDEXED](): this;
@@ -1 +1 @@
1
- {"version":3,"file":"zod-bigdecimal.d.ts","sourceRoot":"","sources":["../../../src/zod-bigdecimal.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAkE,uBAAuB,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACxL,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,GAAG,MAAM,QAAQ,CAAC;AAEzB;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC;AAcrC;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,CAAC,CAAC,SAGtB,CAAC;AAEjB;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,GAAE,uBAA4B,GACpC,yBAAyB,CAkE3B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,gCAAgC;IAC/C,CAAC,YAAY,CAAC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ED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,KAAsB;IAClD,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC;AACnC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,KAAsB;IACnD,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC;AACnC,CAAC","sourcesContent":["\n// ============================================================================\n// BIGDECIMAL SCHEMA HELPER\n// ============================================================================\n\nimport { DecoratorInput, SCHEMA_METADATA, CustomFieldMetadata, BigDecimalSchemaMetadata, BigDecimalSchemaOptions, ZodDecorator, ZodDecorator_ParamsType } from \"./zod-decorators.types\";\nimport { z } from \"zod\";\nimport { addChainableMethods } from \"./zod.module-override\";\nimport Big from \"big.js\";\n\n/**\n * BigDecimal value type - represents a precise decimal number as a string.\n *\n * Using strings to store decimal values avoids JavaScript's floating-point\n * precision issues. The big.js library is used for precise arithmetic operations.\n *\n * Example: \"19.99\", \"0.00000001\", \"123456789.123456789\"\n */\nexport type BigDecimalValue = string;\n\n/**\n * Validates that a string represents a valid big decimal number.\n */\nfunction isValidBigDecimal(value: string): boolean {\n try {\n new Big(value);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Zod schema for BigDecimalValue.\n * Validates that the string represents a valid decimal number.\n */\nexport const BigDecimalValueSchema: z.ZodString = z.string().refine(\n isValidBigDecimal,\n { message: \"Invalid decimal number format\" }\n) as z.ZodString;\n\n/**\n * z_bigdecimal() - Creates bigdecimal schemas for precise decimal numbers.\n *\n * BigDecimal values are stored as strings to avoid floating-point precision issues.\n * The big.js library is used for arithmetic operations.\n *\n * @example\n * ```typescript\n * import { z_bigdecimal } from '@wildo-ai/zod-decorators';\n *\n * const price = z_bigdecimal();\n * const quantity = z_bigdecimal({ precision: 8 });\n * const percentage = z_bigdecimal({ min: '0', max: '100' });\n *\n * // With decorators (chainable)\n * z_bigdecimal().bigDecimalUI({ display: { decimalPlaces: 4 } })\n * z_bigdecimal({ precision: 2 }).isHidden({ edit: true })\n * ```\n */\n\n/**\n * @wildo_source:part:start zod.factories.bigdecimal facet:layer:shared facet:family:schema-factory\n *\n * Creates a bigdecimal schema with metadata for detection and form component rendering.\n *\n * @param options - Configuration options for bigdecimal field\n * @returns A Zod string schema with metadata for bigdecimal detection\n *\n * @example\n * ```typescript\n * // Simple bigdecimal\n * const price = z_bigdecimal();\n * // Infers: string\n *\n * // With precision constraint\n * const btcAmount = z_bigdecimal({ precision: 8 });\n *\n * // With min/max constraints\n * const percentage = z_bigdecimal({\n * min: '0',\n * max: '100',\n * precision: 2\n * });\n * ```\n */\nexport function createBigDecimalSchema(\n options: BigDecimalSchemaOptions = {}\n): DecoratedBigDecimalSchema {\n const {\n precision,\n min,\n max,\n } = options;\n\n // Create the base schema with validation\n let bigDecimalSchema = z.string().refine(\n (value) => {\n if (!isValidBigDecimal(value)) return false;\n\n try {\n const bigValue = new Big(value);\n\n // Check precision (decimal places)\n if (precision !== undefined) {\n const decimalPlaces = value.includes('.')\n ? value.split('.')[1]?.length ?? 0\n : 0;\n if (decimalPlaces > precision) return false;\n }\n\n // Check min\n if (min !== undefined) {\n const minValue = new Big(min);\n if (bigValue.lt(minValue)) return false;\n }\n\n // Check max\n if (max !== undefined) {\n const maxValue = new Big(max);\n if (bigValue.gt(maxValue)) return false;\n }\n\n return true;\n } catch {\n return false;\n }\n },\n {\n message: precision !== undefined\n ? `Invalid decimal number (max ${precision} decimal places${min !== undefined ? `, min: ${min}` : ''}${max !== undefined ? `, max: ${max}` : ''})`\n : `Invalid decimal number${min !== undefined ? ` (min: ${min}` : ''}${max !== undefined ? `${min !== undefined ? ', ' : ' ('}max: ${max})` : min !== undefined ? ')' : ''}`\n }\n );\n\n const bigDecimalMetadata: BigDecimalSchemaMetadata = {\n isBigDecimal: true,\n ...(precision !== undefined && { precision }),\n ...(min !== undefined && { min }),\n ...(max !== undefined && { max }),\n };\n\n // Initialize or extend SCHEMA_METADATA with bigdecimal config\n const existingMetadata: CustomFieldMetadata = (bigDecimalSchema as any)[SCHEMA_METADATA] || {};\n (bigDecimalSchema as any)[SCHEMA_METADATA] = {\n ...existingMetadata,\n bigDecimalConfig: bigDecimalMetadata,\n };\n\n // Add chainable decorator methods to the bigdecimal schema instance\n // This allows: z_bigdecimal().bigDecimalUI({ display: { decimalPlaces: 4 } }).isHidden()\n addChainableMethods(bigDecimalSchema);\n\n return bigDecimalSchema as unknown as DecoratedBigDecimalSchema;\n}\n\n/**\n * The chainable methods of `DecoratedBigDecimalSchema`, returning `this` so a chain of several decorations keeps\n * the type it reached: `.isSummaryField()` turns the field into a `DecoratedPrimitiveZodType<DecoratedBigDecimalSchema>`,\n * and a spec or UI method called after it must return that, not the bare factory type. A method\n * returning `DecoratedBigDecimalSchema` itself won that overload inside the intersection, so a resource\n * specification's field map rejected `schemaShape.x.<factory>Spec(...)` on a decorated field.\n */\nexport interface DecoratedBigDecimalSchemaMethods {\n [ZodDecorator.IS_DB_INDEXED](): this;\n [ZodDecorator.IS_HIDDEN](params?: ZodDecorator_ParamsType[ZodDecorator.IS_HIDDEN]): this;\n [ZodDecorator.IS_NOT_EDITABLE](params?: ZodDecorator_ParamsType[ZodDecorator.IS_NOT_EDITABLE]): this;\n [ZodDecorator.BIGDECIMAL_UI](params?: ZodDecorator_ParamsType[ZodDecorator.BIGDECIMAL_UI]): this;\n [ZodDecorator.BIGDECIMAL_SPEC](params?: ZodDecorator_ParamsType[ZodDecorator.BIGDECIMAL_SPEC]): this;\n addDecorators(decorators: DecoratorInput[]): this;\n}\n\n/**\n * Return type for bigdecimal schemas - includes decorator methods.\n * Note: IS_FOREIGN_KEY is not applicable to bigdecimal values.\n * IS_DB_INDEXED indexes the string value directly for query optimization.\n */\nexport type DecoratedBigDecimalSchema = z.ZodString & DecoratedBigDecimalSchemaMethods;\n\n/**\n * Creates a bigdecimal schema for precise decimal numbers stored as strings.\n * Named z_bigdecimal to indicate it's a Zod helper function exported standalone.\n *\n * BigDecimal values are stored as strings to avoid floating-point precision issues.\n * Use big.js for arithmetic operations on these values.\n *\n * @example\n * ```typescript\n * import { z_bigdecimal } from '@wildo-ai/zod-decorators';\n *\n * // Simple usage\n * z_bigdecimal() // Any valid decimal number as string\n *\n * // With options\n * z_bigdecimal({ precision: 2 }) // Max 2 decimal places\n * z_bigdecimal({ min: '0', max: '100' }) // Range constraint\n * z_bigdecimal({ precision: 8, min: '0' }) // Crypto amount\n *\n * // With decorators (chainable)\n * z_bigdecimal().bigDecimalUI({ display: { decimalPlaces: 4 } })\n * z_bigdecimal({ precision: 2 }).isHidden({ edit: true })\n *\n * // Usage example\n * const price: BigDecimalValue = \"19.99\";\n * const btcAmount: BigDecimalValue = \"0.00000001\";\n *\n * // Arithmetic with big.js\n * import Big from 'big.js';\n * const total = new Big(price).plus(\"10.01\").toString(); // \"30.00\"\n * ```\n */\nexport function z_bigdecimal(\n options?: BigDecimalSchemaOptions\n): DecoratedBigDecimalSchema {\n return createBigDecimalSchema(options) as DecoratedBigDecimalSchema;\n}\n/** @wildo_source:part:end zod.factories.bigdecimal */\n\n// ============================================================================\n// BIGDECIMAL UTILITY FUNCTIONS\n// ============================================================================\n\n/**\n * Add two bigdecimal values.\n * @param a - First value\n * @param b - Second value\n * @returns Sum as string\n */\nexport function bigDecimalAdd(a: BigDecimalValue, b: BigDecimalValue): BigDecimalValue {\n return new Big(a).plus(b).toString();\n}\n\n/**\n * Subtract two bigdecimal values.\n * @param a - Value to subtract from\n * @param b - Value to subtract\n * @returns Difference as string\n */\nexport function bigDecimalSubtract(a: BigDecimalValue, b: BigDecimalValue): BigDecimalValue {\n return new Big(a).minus(b).toString();\n}\n\n/**\n * Multiply two bigdecimal values.\n * @param a - First value\n * @param b - Second value\n * @returns Product as string\n */\nexport function bigDecimalMultiply(a: BigDecimalValue, b: BigDecimalValue): BigDecimalValue {\n return new Big(a).times(b).toString();\n}\n\n/**\n * Divide two bigdecimal values.\n * @param a - Dividend\n * @param b - Divisor\n * @param precision - Number of decimal places for result (default: 20)\n * @returns Quotient as string\n */\nexport function bigDecimalDivide(a: BigDecimalValue, b: BigDecimalValue, precision: number = 20): BigDecimalValue {\n return new Big(a).div(b).round(precision).toString();\n}\n\n/**\n * Compare two bigdecimal values.\n * @param a - First value\n * @param b - Second value\n * @returns -1 if a < b, 0 if a === b, 1 if a > b\n */\nexport function bigDecimalCompare(a: BigDecimalValue, b: BigDecimalValue): -1 | 0 | 1 {\n return new Big(a).cmp(b) as -1 | 0 | 1;\n}\n\n/**\n * Round a bigdecimal value to specified precision.\n * @param value - Value to round\n * @param precision - Number of decimal places\n * @param roundingMode - big.js rounding mode (default: ROUND_HALF_UP)\n * @returns Rounded value as string\n */\nexport function bigDecimalRound(\n value: BigDecimalValue,\n precision: number,\n roundingMode: Big.RoundingMode = Big.roundHalfUp\n): BigDecimalValue {\n return new Big(value).round(precision, roundingMode).toString();\n}\n\n/**\n * Format a bigdecimal value for display with fixed decimal places.\n * @param value - Value to format\n * @param decimalPlaces - Number of decimal places to show\n * @returns Formatted string with trailing zeros if needed\n */\nexport function bigDecimalFormat(value: BigDecimalValue, decimalPlaces: number): string {\n return new Big(value).toFixed(decimalPlaces);\n}\n\n/**\n * Check if a bigdecimal value is zero.\n * @param value - Value to check\n * @returns true if value equals zero\n */\nexport function bigDecimalIsZero(value: BigDecimalValue): boolean {\n return new Big(value).eq(0);\n}\n\n/**\n * Check if a bigdecimal value is positive (> 0).\n * @param value - Value to check\n * @returns true if value is greater than zero\n */\nexport function bigDecimalIsPositive(value: BigDecimalValue): boolean {\n return new Big(value).gt(0);\n}\n\n/**\n * Check if a bigdecimal value is negative (< 0).\n * @param value - Value to check\n * @returns true if value is less than zero\n */\nexport function bigDecimalIsNegative(value: BigDecimalValue): boolean {\n return new Big(value).lt(0);\n}\n\n/**\n * Get the absolute value of a bigdecimal.\n * @param value - Value\n * @returns Absolute value as string\n */\nexport function bigDecimalAbs(value: BigDecimalValue): BigDecimalValue {\n return new Big(value).abs().toString();\n}\n\n/**\n * Convert a number to bigdecimal string.\n * @param value - Number to convert\n * @returns String representation\n */\nexport function toBigDecimal(value: number): BigDecimalValue {\n return new Big(value).toString();\n}\n\n/**\n * Convert a bigdecimal string to number.\n * Warning: May lose precision for very large or very precise numbers.\n * @param value - BigDecimal string\n * @returns Number value\n */\nexport function fromBigDecimal(value: BigDecimalValue): number {\n return new Big(value).toNumber();\n}\n\n"]}
1
+ {"version":3,"file":"zod-bigdecimal.js","sourceRoot":"","sources":["../../src/zod-bigdecimal.ts"],"names":[],"mappings":"AACA,+EAA+E;AAC/E,2BAA2B;AAC3B,+EAA+E;AAE/E,OAAO,EAAkB,eAAe,EAA0E,YAAY,EAA2B,MAAM,wBAAwB,CAAC;AACxL,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,GAAG,MAAM,QAAQ,CAAC;AAYzB;;GAEG;AACH,SAAS,iBAAiB,CAAC,KAAa;IACtC,IAAI,CAAC;QACH,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;QACf,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAgB,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CACjE,iBAAiB,EACjB,EAAE,OAAO,EAAE,+BAA+B,EAAE,CAC9B,CAAC;AAEjB;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,sBAAsB,CACpC,UAAmC,EAAE;IAErC,MAAM,EACJ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,EAAE,aAAqB;IAC5E,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;AAC/C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAsB;IACrD,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC9B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAsB;IACzD,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC9B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAsB;IACzD,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC9B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,KAAsB;IAClD,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC;AACnC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,KAAsB;IACnD,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC;AACnC,CAAC","sourcesContent":["\n// ============================================================================\n// BIGDECIMAL SCHEMA HELPER\n// ============================================================================\n\nimport { DecoratorInput, SCHEMA_METADATA, CustomFieldMetadata, BigDecimalSchemaMetadata, BigDecimalSchemaOptions, ZodDecorator, ZodDecorator_ParamsType } from \"./zod-decorators.types\";\nimport { z } from \"zod\";\nimport { addChainableMethods } from \"./zod.module-override\";\nimport Big from \"big.js\";\n\n/**\n * BigDecimal value type - represents a precise decimal number as a string.\n *\n * Using strings to store decimal values avoids JavaScript's floating-point\n * precision issues. The big.js library is used for precise arithmetic operations.\n *\n * Example: \"19.99\", \"0.00000001\", \"123456789.123456789\"\n */\nexport type BigDecimalValue = string;\n\n/**\n * Validates that a string represents a valid big decimal number.\n */\nfunction isValidBigDecimal(value: string): boolean {\n try {\n new Big(value);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Zod schema for BigDecimalValue.\n * Validates that the string represents a valid decimal number.\n */\nexport const BigDecimalValueSchema: z.ZodString = z.string().refine(\n isValidBigDecimal,\n { message: \"Invalid decimal number format\" }\n) as z.ZodString;\n\n/**\n * z_bigdecimal() - Creates bigdecimal schemas for precise decimal numbers.\n *\n * BigDecimal values are stored as strings to avoid floating-point precision issues.\n * The big.js library is used for arithmetic operations.\n *\n * @example\n * ```typescript\n * import { z_bigdecimal } from '@wildo-ai/zod-decorators';\n *\n * const price = z_bigdecimal();\n * const quantity = z_bigdecimal({ precision: 8 });\n * const percentage = z_bigdecimal({ min: '0', max: '100' });\n *\n * // With decorators (chainable)\n * z_bigdecimal().bigDecimalUI({ display: { decimalPlaces: 4 } })\n * z_bigdecimal({ precision: 2 }).isHidden({ edit: true })\n * ```\n */\n\n/**\n * @wildo_source:part:start zod.factories.bigdecimal facet:layer:shared facet:family:schema-factory\n *\n * Creates a bigdecimal schema with metadata for detection and form component rendering.\n *\n * @param options - Configuration options for bigdecimal field\n * @returns A Zod string schema with metadata for bigdecimal detection\n *\n * @example\n * ```typescript\n * // Simple bigdecimal\n * const price = z_bigdecimal();\n * // Infers: string\n *\n * // With precision constraint\n * const btcAmount = z_bigdecimal({ precision: 8 });\n *\n * // With min/max constraints\n * const percentage = z_bigdecimal({\n * min: '0',\n * max: '100',\n * precision: 2\n * });\n * ```\n */\nexport function createBigDecimalSchema(\n options: BigDecimalSchemaOptions = {}\n): DecoratedBigDecimalSchema {\n const {\n precision,\n min,\n max,\n } = options;\n\n // Create the base schema with validation\n let bigDecimalSchema = z.string().refine(\n (value) => {\n if (!isValidBigDecimal(value)) return false;\n\n try {\n const bigValue = new Big(value);\n\n // Check precision (decimal places)\n if (precision !== undefined) {\n const decimalPlaces = value.includes('.')\n ? value.split('.')[1]?.length ?? 0\n : 0;\n if (decimalPlaces > precision) return false;\n }\n\n // Check min\n if (min !== undefined) {\n const minValue = new Big(min);\n if (bigValue.lt(minValue)) return false;\n }\n\n // Check max\n if (max !== undefined) {\n const maxValue = new Big(max);\n if (bigValue.gt(maxValue)) return false;\n }\n\n return true;\n } catch {\n return false;\n }\n },\n {\n message: precision !== undefined\n ? `Invalid decimal number (max ${precision} decimal places${min !== undefined ? `, min: ${min}` : ''}${max !== undefined ? `, max: ${max}` : ''})`\n : `Invalid decimal number${min !== undefined ? ` (min: ${min}` : ''}${max !== undefined ? `${min !== undefined ? ', ' : ' ('}max: ${max})` : min !== undefined ? ')' : ''}`\n }\n );\n\n const bigDecimalMetadata: BigDecimalSchemaMetadata = {\n isBigDecimal: true,\n ...(precision !== undefined && { precision }),\n ...(min !== undefined && { min }),\n ...(max !== undefined && { max }),\n };\n\n // Initialize or extend SCHEMA_METADATA with bigdecimal config\n const existingMetadata: CustomFieldMetadata = (bigDecimalSchema as any)[SCHEMA_METADATA] || {};\n (bigDecimalSchema as any)[SCHEMA_METADATA] = {\n ...existingMetadata,\n bigDecimalConfig: bigDecimalMetadata,\n };\n\n // Add chainable decorator methods to the bigdecimal schema instance\n // This allows: z_bigdecimal().bigDecimalUI({ display: { decimalPlaces: 4 } }).isHidden()\n addChainableMethods(bigDecimalSchema);\n\n return bigDecimalSchema as unknown as DecoratedBigDecimalSchema;\n}\n\n/**\n * The chainable methods of `DecoratedBigDecimalSchema`, returning `this` so a chain of several decorations keeps\n * the type it reached, whatever the receiver is (`typeof field` in a resource specification's field map).\n * A method returning the bare `DecoratedBigDecimalSchema` once won the overload inside the intersection, so that\n * field map rejected `schemaShape.x.<factory>Spec(...)` on a field decorated first. Every other decorator\n * returns the receiver's own type too (#3031), so `.isSummaryField()` leaves the field a `DecoratedBigDecimalSchema`.\n */\nexport interface DecoratedBigDecimalSchemaMethods {\n [ZodDecorator.IS_DB_INDEXED](): this;\n [ZodDecorator.IS_HIDDEN](params?: ZodDecorator_ParamsType[ZodDecorator.IS_HIDDEN]): this;\n [ZodDecorator.IS_NOT_EDITABLE](params?: ZodDecorator_ParamsType[ZodDecorator.IS_NOT_EDITABLE]): this;\n [ZodDecorator.BIGDECIMAL_UI](params?: ZodDecorator_ParamsType[ZodDecorator.BIGDECIMAL_UI]): this;\n [ZodDecorator.BIGDECIMAL_SPEC](params?: ZodDecorator_ParamsType[ZodDecorator.BIGDECIMAL_SPEC]): this;\n addDecorators(decorators: DecoratorInput[]): this;\n}\n\n/**\n * Return type for bigdecimal schemas - includes decorator methods.\n * Note: IS_FOREIGN_KEY is not applicable to bigdecimal values.\n * IS_DB_INDEXED indexes the string value directly for query optimization.\n */\nexport type DecoratedBigDecimalSchema = z.ZodString & DecoratedBigDecimalSchemaMethods;\n\n/**\n * Creates a bigdecimal schema for precise decimal numbers stored as strings.\n * Named z_bigdecimal to indicate it's a Zod helper function exported standalone.\n *\n * BigDecimal values are stored as strings to avoid floating-point precision issues.\n * Use big.js for arithmetic operations on these values.\n *\n * @example\n * ```typescript\n * import { z_bigdecimal } from '@wildo-ai/zod-decorators';\n *\n * // Simple usage\n * z_bigdecimal() // Any valid decimal number as string\n *\n * // With options\n * z_bigdecimal({ precision: 2 }) // Max 2 decimal places\n * z_bigdecimal({ min: '0', max: '100' }) // Range constraint\n * z_bigdecimal({ precision: 8, min: '0' }) // Crypto amount\n *\n * // With decorators (chainable)\n * z_bigdecimal().bigDecimalUI({ display: { decimalPlaces: 4 } })\n * z_bigdecimal({ precision: 2 }).isHidden({ edit: true })\n *\n * // Usage example\n * const price: BigDecimalValue = \"19.99\";\n * const btcAmount: BigDecimalValue = \"0.00000001\";\n *\n * // Arithmetic with big.js\n * import Big from 'big.js';\n * const total = new Big(price).plus(\"10.01\").toString(); // \"30.00\"\n * ```\n */\nexport function z_bigdecimal(\n options?: BigDecimalSchemaOptions\n): DecoratedBigDecimalSchema {\n return createBigDecimalSchema(options) as DecoratedBigDecimalSchema;\n}\n/** @wildo_source:part:end zod.factories.bigdecimal */\n\n// ============================================================================\n// BIGDECIMAL UTILITY FUNCTIONS\n// ============================================================================\n\n/**\n * Add two bigdecimal values.\n * @param a - First value\n * @param b - Second value\n * @returns Sum as string\n */\nexport function bigDecimalAdd(a: BigDecimalValue, b: BigDecimalValue): BigDecimalValue {\n return new Big(a).plus(b).toString();\n}\n\n/**\n * Subtract two bigdecimal values.\n * @param a - Value to subtract from\n * @param b - Value to subtract\n * @returns Difference as string\n */\nexport function bigDecimalSubtract(a: BigDecimalValue, b: BigDecimalValue): BigDecimalValue {\n return new Big(a).minus(b).toString();\n}\n\n/**\n * Multiply two bigdecimal values.\n * @param a - First value\n * @param b - Second value\n * @returns Product as string\n */\nexport function bigDecimalMultiply(a: BigDecimalValue, b: BigDecimalValue): BigDecimalValue {\n return new Big(a).times(b).toString();\n}\n\n/**\n * Divide two bigdecimal values.\n * @param a - Dividend\n * @param b - Divisor\n * @param precision - Number of decimal places for result (default: 20)\n * @returns Quotient as string\n */\nexport function bigDecimalDivide(a: BigDecimalValue, b: BigDecimalValue, precision: number = 20): BigDecimalValue {\n return new Big(a).div(b).round(precision).toString();\n}\n\n/**\n * Compare two bigdecimal values.\n * @param a - First value\n * @param b - Second value\n * @returns -1 if a < b, 0 if a === b, 1 if a > b\n */\nexport function bigDecimalCompare(a: BigDecimalValue, b: BigDecimalValue): -1 | 0 | 1 {\n return new Big(a).cmp(b) as -1 | 0 | 1;\n}\n\n/**\n * Round a bigdecimal value to specified precision.\n * @param value - Value to round\n * @param precision - Number of decimal places\n * @param roundingMode - big.js rounding mode (default: ROUND_HALF_UP)\n * @returns Rounded value as string\n */\nexport function bigDecimalRound(\n value: BigDecimalValue,\n precision: number,\n roundingMode: Big.RoundingMode = Big.roundHalfUp\n): BigDecimalValue {\n return new Big(value).round(precision, roundingMode).toString();\n}\n\n/**\n * Format a bigdecimal value for display with fixed decimal places.\n * @param value - Value to format\n * @param decimalPlaces - Number of decimal places to show\n * @returns Formatted string with trailing zeros if needed\n */\nexport function bigDecimalFormat(value: BigDecimalValue, decimalPlaces: number): string {\n return new Big(value).toFixed(decimalPlaces);\n}\n\n/**\n * Check if a bigdecimal value is zero.\n * @param value - Value to check\n * @returns true if value equals zero\n */\nexport function bigDecimalIsZero(value: BigDecimalValue): boolean {\n return new Big(value).eq(0);\n}\n\n/**\n * Check if a bigdecimal value is positive (> 0).\n * @param value - Value to check\n * @returns true if value is greater than zero\n */\nexport function bigDecimalIsPositive(value: BigDecimalValue): boolean {\n return new Big(value).gt(0);\n}\n\n/**\n * Check if a bigdecimal value is negative (< 0).\n * @param value - Value to check\n * @returns true if value is less than zero\n */\nexport function bigDecimalIsNegative(value: BigDecimalValue): boolean {\n return new Big(value).lt(0);\n}\n\n/**\n * Get the absolute value of a bigdecimal.\n * @param value - Value\n * @returns Absolute value as string\n */\nexport function bigDecimalAbs(value: BigDecimalValue): BigDecimalValue {\n return new Big(value).abs().toString();\n}\n\n/**\n * Convert a number to bigdecimal string.\n * @param value - Number to convert\n * @returns String representation\n */\nexport function toBigDecimal(value: number): BigDecimalValue {\n return new Big(value).toString();\n}\n\n/**\n * Convert a bigdecimal string to number.\n * Warning: May lose precision for very large or very precise numbers.\n * @param value - BigDecimal string\n * @returns Number value\n */\nexport function fromBigDecimal(value: BigDecimalValue): number {\n return new Big(value).toNumber();\n}\n\n"]}
@@ -50,10 +50,10 @@ export declare const CodeValueSchema: z.ZodObject<{
50
50
  export declare function createCodeSchema(options?: CodeSchemaOptions): DecoratedCodeSchema;
51
51
  /**
52
52
  * The chainable methods of `DecoratedCodeSchema`, returning `this` so a chain of several decorations keeps
53
- * the type it reached: `.isSummaryField()` turns the field into a `DecoratedPrimitiveZodType<DecoratedCodeSchema>`,
54
- * and a spec or UI method called after it must return that, not the bare factory type. A method
55
- * returning `DecoratedCodeSchema` itself won that overload inside the intersection, so a resource
56
- * specification's field map rejected `schemaShape.x.<factory>Spec(...)` on a decorated field.
53
+ * the type it reached, whatever the receiver is (`typeof field` in a resource specification's field map).
54
+ * A method returning the bare `DecoratedCodeSchema` once won the overload inside the intersection, so that
55
+ * field map rejected `schemaShape.x.<factory>Spec(...)` on a field decorated first. Every other decorator
56
+ * returns the receiver's own type too (#3031), so `.isSummaryField()` leaves the field a `DecoratedCodeSchema`.
57
57
  */
58
58
  export interface DecoratedCodeSchemaMethods {
59
59
  [ZodDecorator.IS_DB_INDEXED](): this;
@@ -1 +1 @@
1
- {"version":3,"file":"zod-code.d.ts","sourceRoot":"","sources":["../../../src/zod-code.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAA4D,iBAAiB,EAAE,YAAY,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAC1L,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,kEAAkE;IAClE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,ySAOtB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,SAAS,CAAC;IAAE,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC;IAAC,QAAQ,EAAE,CAAC,CAAC,SAAS,CAAA;CAAE,CAGvF,CAAC;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,GAAE,iBAAsB,GAC9B,mBAAmB,CA6CrB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,0BAA0B;IACzC,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC;IACrC,mHAAmH;IACnH,CAAC,YAAY,CAAC,OAA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AAM,EAAE,QAAQ;QAChB,SAAS,EAAE,YAAY;KACxB,CAAC;IAEF,OAAO,YAAY,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC;AAC5C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC/C,OAAO,mBAAmB,CAAC,QAAQ,CAAC,QAAe,CAAC,CAAC;AACvD,CAAC","sourcesContent":["\n// ============================================================================\n// CODE SCHEMA HELPER\n// ============================================================================\n\nimport { DecoratorInput, SCHEMA_METADATA, CustomFieldMetadata, CodeSchemaMetadata, CodeSchemaOptions, CodeLanguage, ZodDecorator, ZodDecorator_ParamsType } from \"./zod-decorators.types\";\nimport { z } from \"zod\";\nimport { addChainableMethods } from \"./zod.module-override\";\n\n/**\n * Code value type - represents a code snippet with language information.\n */\nexport interface CodeValue {\n /** The code content */\n content: string;\n /** Programming language for syntax highlighting and validation */\n language: string;\n}\n\n/**\n * Common programming languages for code schema language field.\n * Can be extended with any string value.\n */\nexport const CommonCodeLanguages = [\n 'javascript', 'typescript', 'python', 'java', 'csharp', 'cpp', 'c',\n 'go', 'rust', 'ruby', 'php', 'swift', 'kotlin', 'scala',\n 'html', 'css', 'scss', 'less', 'json', 'yaml', 'xml', 'markdown',\n 'sql', 'graphql', 'bash', 'shell', 'powershell',\n 'dockerfile', 'nginx', 'apache',\n 'plaintext'\n] as const;\n\n/**\n * Zod schema for CodeValue.\n */\nexport const CodeValueSchema: z.ZodObject<{ content: z.ZodString; language: z.ZodString }> = z.object({\n content: z.string().describe(\"The code itself.\"),\n language: z.string().describe(\"The language the code is written in, for highlighting and validation.\"),\n});\n\n/**\n * @wildo_source:part:start zod.factories.code facet:layer:shared facet:family:schema-factory\n *\n * z_code() - Creates code schemas for code snippets with language.\n *\n * @example\n * ```typescript\n * import { z_code } from '@wildo-ai/zod-decorators';\n *\n * const snippet = z_code();\n * const restrictedCode = z_code({\n * allowedLanguages: ['javascript', 'typescript', 'python'],\n * maxLength: 10000\n * });\n *\n * // UI props are now set via .codeUI():\n * z_code().codeUI({ defaultLanguage: 'javascript', syntaxHighlighting: true })\n * z_code().codeUI({ display: { showLineNumbers: true }, edit: { showLineNumbers: false } })\n * ```\n */\n\n/**\n * Creates a code schema with metadata for detection and form component rendering.\n *\n * @param options - Configuration options for code field\n * @returns A Zod object schema with metadata for code detection\n */\nexport function createCodeSchema(\n options: CodeSchemaOptions = {}\n): DecoratedCodeSchema {\n const {\n allowedLanguages,\n maxLength,\n minLength,\n } = options;\n\n // Create the content schema with optional length constraints\n let contentSchema = z.string();\n if (minLength !== undefined) {\n contentSchema = contentSchema.min(minLength);\n }\n if (maxLength !== undefined) {\n contentSchema = contentSchema.max(maxLength);\n }\n\n // Language is stored as a string. Allowed languages restriction is enforced\n // through codeConfig.allowedLanguages metadata - UI components read this\n // to filter available options, same pattern as money currencies.\n const languageSchema = z.string();\n\n // Create the code object schema\n const codeSchema = z.object({\n content: contentSchema.describe(\"The code itself.\"),\n language: languageSchema.describe(\"The language the code is written in, for highlighting and validation.\"),\n });\n\n const codeMetadata: CodeSchemaMetadata = {\n isCode: true,\n ...(allowedLanguages !== undefined && { allowedLanguages }),\n ...(maxLength !== undefined && { maxLength }),\n ...(minLength !== undefined && { minLength }),\n };\n\n // Initialize or extend SCHEMA_METADATA with code config\n const existingMetadata: CustomFieldMetadata = (codeSchema as any)[SCHEMA_METADATA] || {};\n (codeSchema as any)[SCHEMA_METADATA] = {\n ...existingMetadata,\n codeConfig: codeMetadata,\n };\n\n // Add chainable decorator methods to the code schema instance\n addChainableMethods(codeSchema);\n\n return codeSchema as unknown as DecoratedCodeSchema;\n}\n\n/**\n * The chainable methods of `DecoratedCodeSchema`, returning `this` so a chain of several decorations keeps\n * the type it reached: `.isSummaryField()` turns the field into a `DecoratedPrimitiveZodType<DecoratedCodeSchema>`,\n * and a spec or UI method called after it must return that, not the bare factory type. A method\n * returning `DecoratedCodeSchema` itself won that overload inside the intersection, so a resource\n * specification's field map rejected `schemaShape.x.<factory>Spec(...)` on a decorated field.\n */\nexport interface DecoratedCodeSchemaMethods {\n [ZodDecorator.IS_DB_INDEXED](): this;\n /** Installed at runtime with the other chainable methods; declared here so an authored `.codeUI(…)` typechecks. */\n [ZodDecorator.CODE_UI](params?: ZodDecorator_ParamsType[ZodDecorator.CODE_UI]): this;\n [ZodDecorator.CODE_SPEC](params?: ZodDecorator_ParamsType[ZodDecorator.CODE_SPEC]): this;\n [ZodDecorator.IS_HIDDEN](params?: ZodDecorator_ParamsType[ZodDecorator.IS_HIDDEN]): this;\n [ZodDecorator.IS_NOT_EDITABLE](params?: ZodDecorator_ParamsType[ZodDecorator.IS_NOT_EDITABLE]): this;\n addDecorators(decorators: DecoratorInput[]): this;\n}\n\n/**\n * Return type for code schemas - includes decorator methods.\n * IS_DB_INDEXED will index internal fields (content, language) for query optimization.\n */\nexport type DecoratedCodeSchema = z.ZodObject<{\n content: z.ZodString;\n language: z.ZodString;\n}> & DecoratedCodeSchemaMethods;\n\n/**\n * Creates a code schema for code snippets with language information.\n * Named z_code to indicate it's a Zod helper function exported standalone.\n *\n * Code values are stored as: { content: string, language: string }\n * - content: The actual code text\n * - language: Programming language identifier for syntax highlighting\n *\n * @example\n * ```typescript\n * import { z_code } from '@wildo-ai/zod-decorators';\n *\n * // Simple usage\n * z_code() // All languages, default 'plaintext'\n *\n * // With options (structural only)\n * z_code({ allowedLanguages: ['javascript', 'typescript'] })\n * z_code({ maxLength: 5000 })\n *\n * // UI props via .codeUI()\n * z_code().codeUI({ defaultLanguage: 'typescript' })\n * z_code().codeUI({ display: { showLineNumbers: false } })\n * ```\n */\nexport function z_code(options?: CodeSchemaOptions): DecoratedCodeSchema {\n return createCodeSchema(options);\n}\n/** @wildo_source:part:end zod.factories.code */\n\n// ============================================================================\n// UTILITY FUNCTIONS\n// ============================================================================\n\n/**\n * Get the display name for a code language.\n */\nexport function getLanguageDisplayName(language: CodeLanguage): string {\n const displayNames: Record<string, string> = {\n javascript: 'JavaScript',\n typescript: 'TypeScript',\n python: 'Python',\n java: 'Java',\n csharp: 'C#',\n cpp: 'C++',\n c: 'C',\n go: 'Go',\n rust: 'Rust',\n ruby: 'Ruby',\n php: 'PHP',\n swift: 'Swift',\n kotlin: 'Kotlin',\n scala: 'Scala',\n html: 'HTML',\n css: 'CSS',\n scss: 'SCSS',\n less: 'Less',\n json: 'JSON',\n yaml: 'YAML',\n xml: 'XML',\n markdown: 'Markdown',\n sql: 'SQL',\n graphql: 'GraphQL',\n bash: 'Bash',\n shell: 'Shell',\n powershell: 'PowerShell',\n dockerfile: 'Dockerfile',\n nginx: 'Nginx',\n apache: 'Apache',\n plaintext: 'Plain Text',\n };\n\n return displayNames[language] || language;\n}\n\n/**\n * Check if a language is in the common languages list.\n */\nexport function isCommonLanguage(language: string): language is typeof CommonCodeLanguages[number] {\n return CommonCodeLanguages.includes(language as any);\n}\n\n"]}
1
+ {"version":3,"file":"zod-code.js","sourceRoot":"","sources":["../../src/zod-code.ts"],"names":[],"mappings":"AACA,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;AAE/E,OAAO,EAAkB,eAAe,EAA4E,YAAY,EAA2B,MAAM,wBAAwB,CAAC;AAC1L,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAY5D;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG;IAClE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO;IACvD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU;IAChE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY;IAC/C,YAAY,EAAE,OAAO,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Z,KAAK,EAAE,OAAO;QACd,UAAU,EAAE,YAAY;QACxB,UAAU,EAAE,YAAY;QACxB,KAAK,EAAE,OAAO;QACd,MAAM,EAAE,QAAQ;QAChB,SAAS,EAAE,YAAY;KACxB,CAAC;IAEF,OAAO,YAAY,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC;AAC5C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC/C,OAAO,mBAAmB,CAAC,QAAQ,CAAC,QAAe,CAAC,CAAC;AACvD,CAAC","sourcesContent":["\n// ============================================================================\n// CODE SCHEMA HELPER\n// ============================================================================\n\nimport { DecoratorInput, SCHEMA_METADATA, CustomFieldMetadata, CodeSchemaMetadata, CodeSchemaOptions, CodeLanguage, ZodDecorator, ZodDecorator_ParamsType } from \"./zod-decorators.types\";\nimport { z } from \"zod\";\nimport { addChainableMethods } from \"./zod.module-override\";\n\n/**\n * Code value type - represents a code snippet with language information.\n */\nexport interface CodeValue {\n /** The code content */\n content: string;\n /** Programming language for syntax highlighting and validation */\n language: string;\n}\n\n/**\n * Common programming languages for code schema language field.\n * Can be extended with any string value.\n */\nexport const CommonCodeLanguages = [\n 'javascript', 'typescript', 'python', 'java', 'csharp', 'cpp', 'c',\n 'go', 'rust', 'ruby', 'php', 'swift', 'kotlin', 'scala',\n 'html', 'css', 'scss', 'less', 'json', 'yaml', 'xml', 'markdown',\n 'sql', 'graphql', 'bash', 'shell', 'powershell',\n 'dockerfile', 'nginx', 'apache',\n 'plaintext'\n] as const;\n\n/**\n * Zod schema for CodeValue.\n */\nexport const CodeValueSchema: z.ZodObject<{ content: z.ZodString; language: z.ZodString }> = z.object({\n content: z.string().describe(\"The code itself.\"),\n language: z.string().describe(\"The language the code is written in, for highlighting and validation.\"),\n});\n\n/**\n * @wildo_source:part:start zod.factories.code facet:layer:shared facet:family:schema-factory\n *\n * z_code() - Creates code schemas for code snippets with language.\n *\n * @example\n * ```typescript\n * import { z_code } from '@wildo-ai/zod-decorators';\n *\n * const snippet = z_code();\n * const restrictedCode = z_code({\n * allowedLanguages: ['javascript', 'typescript', 'python'],\n * maxLength: 10000\n * });\n *\n * // UI props are now set via .codeUI():\n * z_code().codeUI({ defaultLanguage: 'javascript', syntaxHighlighting: true })\n * z_code().codeUI({ display: { showLineNumbers: true }, edit: { showLineNumbers: false } })\n * ```\n */\n\n/**\n * Creates a code schema with metadata for detection and form component rendering.\n *\n * @param options - Configuration options for code field\n * @returns A Zod object schema with metadata for code detection\n */\nexport function createCodeSchema(\n options: CodeSchemaOptions = {}\n): DecoratedCodeSchema {\n const {\n allowedLanguages,\n maxLength,\n minLength,\n } = options;\n\n // Create the content schema with optional length constraints\n let contentSchema = z.string();\n if (minLength !== undefined) {\n contentSchema = contentSchema.min(minLength);\n }\n if (maxLength !== undefined) {\n contentSchema = contentSchema.max(maxLength);\n }\n\n // Language is stored as a string. Allowed languages restriction is enforced\n // through codeConfig.allowedLanguages metadata - UI components read this\n // to filter available options, same pattern as money currencies.\n const languageSchema = z.string();\n\n // Create the code object schema\n const codeSchema = z.object({\n content: contentSchema.describe(\"The code itself.\"),\n language: languageSchema.describe(\"The language the code is written in, for highlighting and validation.\"),\n });\n\n const codeMetadata: CodeSchemaMetadata = {\n isCode: true,\n ...(allowedLanguages !== undefined && { allowedLanguages }),\n ...(maxLength !== undefined && { maxLength }),\n ...(minLength !== undefined && { minLength }),\n };\n\n // Initialize or extend SCHEMA_METADATA with code config\n const existingMetadata: CustomFieldMetadata = (codeSchema as any)[SCHEMA_METADATA] || {};\n (codeSchema as any)[SCHEMA_METADATA] = {\n ...existingMetadata,\n codeConfig: codeMetadata,\n };\n\n // Add chainable decorator methods to the code schema instance\n addChainableMethods(codeSchema);\n\n return codeSchema as unknown as DecoratedCodeSchema;\n}\n\n/**\n * The chainable methods of `DecoratedCodeSchema`, returning `this` so a chain of several decorations keeps\n * the type it reached, whatever the receiver is (`typeof field` in a resource specification's field map).\n * A method returning the bare `DecoratedCodeSchema` once won the overload inside the intersection, so that\n * field map rejected `schemaShape.x.<factory>Spec(...)` on a field decorated first. Every other decorator\n * returns the receiver's own type too (#3031), so `.isSummaryField()` leaves the field a `DecoratedCodeSchema`.\n */\nexport interface DecoratedCodeSchemaMethods {\n [ZodDecorator.IS_DB_INDEXED](): this;\n /** Installed at runtime with the other chainable methods; declared here so an authored `.codeUI(…)` typechecks. */\n [ZodDecorator.CODE_UI](params?: ZodDecorator_ParamsType[ZodDecorator.CODE_UI]): this;\n [ZodDecorator.CODE_SPEC](params?: ZodDecorator_ParamsType[ZodDecorator.CODE_SPEC]): this;\n [ZodDecorator.IS_HIDDEN](params?: ZodDecorator_ParamsType[ZodDecorator.IS_HIDDEN]): this;\n [ZodDecorator.IS_NOT_EDITABLE](params?: ZodDecorator_ParamsType[ZodDecorator.IS_NOT_EDITABLE]): this;\n addDecorators(decorators: DecoratorInput[]): this;\n}\n\n/**\n * Return type for code schemas - includes decorator methods.\n * IS_DB_INDEXED will index internal fields (content, language) for query optimization.\n */\nexport type DecoratedCodeSchema = z.ZodObject<{\n content: z.ZodString;\n language: z.ZodString;\n}> & DecoratedCodeSchemaMethods;\n\n/**\n * Creates a code schema for code snippets with language information.\n * Named z_code to indicate it's a Zod helper function exported standalone.\n *\n * Code values are stored as: { content: string, language: string }\n * - content: The actual code text\n * - language: Programming language identifier for syntax highlighting\n *\n * @example\n * ```typescript\n * import { z_code } from '@wildo-ai/zod-decorators';\n *\n * // Simple usage\n * z_code() // All languages, default 'plaintext'\n *\n * // With options (structural only)\n * z_code({ allowedLanguages: ['javascript', 'typescript'] })\n * z_code({ maxLength: 5000 })\n *\n * // UI props via .codeUI()\n * z_code().codeUI({ defaultLanguage: 'typescript' })\n * z_code().codeUI({ display: { showLineNumbers: false } })\n * ```\n */\nexport function z_code(options?: CodeSchemaOptions): DecoratedCodeSchema {\n return createCodeSchema(options);\n}\n/** @wildo_source:part:end zod.factories.code */\n\n// ============================================================================\n// UTILITY FUNCTIONS\n// ============================================================================\n\n/**\n * Get the display name for a code language.\n */\nexport function getLanguageDisplayName(language: CodeLanguage): string {\n const displayNames: Record<string, string> = {\n javascript: 'JavaScript',\n typescript: 'TypeScript',\n python: 'Python',\n java: 'Java',\n csharp: 'C#',\n cpp: 'C++',\n c: 'C',\n go: 'Go',\n rust: 'Rust',\n ruby: 'Ruby',\n php: 'PHP',\n swift: 'Swift',\n kotlin: 'Kotlin',\n scala: 'Scala',\n html: 'HTML',\n css: 'CSS',\n scss: 'SCSS',\n less: 'Less',\n json: 'JSON',\n yaml: 'YAML',\n xml: 'XML',\n markdown: 'Markdown',\n sql: 'SQL',\n graphql: 'GraphQL',\n bash: 'Bash',\n shell: 'Shell',\n powershell: 'PowerShell',\n dockerfile: 'Dockerfile',\n nginx: 'Nginx',\n apache: 'Apache',\n plaintext: 'Plain Text',\n };\n\n return displayNames[language] || language;\n}\n\n/**\n * Check if a language is in the common languages list.\n */\nexport function isCommonLanguage(language: string): language is typeof CommonCodeLanguages[number] {\n return CommonCodeLanguages.includes(language as any);\n}\n\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"zod-color.d.ts","sourceRoot":"","sources":["../../../src/zod-color.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,CAAC,CAAC,SAyFiB,CAAC;AAEnD,MAAM,MAAM,uBAAuB,GAAG,OAAO,gBAAgB,CAAC"}
1
+ {"version":3,"file":"zod-color.d.ts","sourceRoot":"","sources":["../../src/zod-color.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,CAAC,CAAC,SAyFiB,CAAC;AAEnD,MAAM,MAAM,uBAAuB,GAAG,OAAO,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"zod-color.js","sourceRoot":"","sources":["../../../src/zod-color.ts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YAAY,EAAE,WAAW,EAAE,aAAa;QAC1F,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM;QAC1F,WAAW,EAAE,OAAO;QACpB,SAAS,EAAE,QAAQ,EAAE,kBAAkB,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc;QACrF,gBAAgB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,iBAAiB;QAC9F,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU;QACpD,aAAa,EAAE,MAAM;QACrB,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ;QAChE,eAAe,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,WAAW;QACzF,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ;QAC9C,KAAK,EAAE,WAAW,EAAE,WAAW;QAC/B,aAAa,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS;QAC5F,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW;QAC5D,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW;QAC/C,QAAQ;QACR,OAAO,EAAE,OAAO,EAAE,YAAY;QAC9B,QAAQ,EAAE,aAAa;KACxB,CAAC;IAEF,OAAO,WAAW,CAAC,QAAQ,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC;AAC1D,CAAC,EAAE;IACD,OAAO,EAAE,oJAAoJ;CAC9J,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,OAAO,CAAgB,CAAC","sourcesContent":["import { z } from \"zod\";\n\n/**\n * Color validation schema for various color formats\n * Supports: hex (3/6 digits), rgb, rgba, hsl, hsla, and named colors\n */\nexport const ZodTypeForColors: z.ZodString = z.string().refine((color) => {\n // Remove whitespace\n const trimmedColor = color.trim();\n \n // Hex colors: #fff, #ffffff, #FFF, #FFFFFF\n const hexRegex = /^#([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6})$/;\n if (hexRegex.test(trimmedColor)) {\n return true;\n }\n \n // RGB colors: rgb(255, 255, 255)\n const rgbRegex = /^rgb\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*\\)$/;\n const rgbMatch = trimmedColor.match(rgbRegex);\n if (rgbMatch) {\n const [, r, g, b] = rgbMatch;\n return [r, g, b].every(val => parseInt(val) >= 0 && parseInt(val) <= 255);\n }\n \n \n // RGBA colors: rgba(255, 255, 255, 0.5)\n const rgbaRegex = /^rgba\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(0|1|0?\\.\\d+)\\s*\\)$/;\n const rgbaMatch = trimmedColor.match(rgbaRegex);\n if (rgbaMatch) {\n const [, r, g, b, a] = rgbaMatch;\n const rgbValid = [r, g, b].every(val => parseInt(val) >= 0 && parseInt(val) <= 255);\n const alphaValid = parseFloat(a) >= 0 && parseFloat(a) <= 1;\n return rgbValid && alphaValid;\n }\n \n // HSL colors: hsl(360, 100%, 50%)\n const hslRegex = /^hsl\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})%\\s*,\\s*(\\d{1,3})%\\s*\\)$/;\n const hslMatch = trimmedColor.match(hslRegex);\n if (hslMatch) {\n const [, h, s, l] = hslMatch;\n const hValid = parseInt(h) >= 0 && parseInt(h) <= 360;\n const sValid = parseInt(s) >= 0 && parseInt(s) <= 100;\n const lValid = parseInt(l) >= 0 && parseInt(l) <= 100;\n return hValid && sValid && lValid;\n }\n \n // HSLA colors: hsla(360, 100%, 50%, 0.5)\n const hslaRegex = /^hsla\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})%\\s*,\\s*(\\d{1,3})%\\s*,\\s*(0|1|0?\\.\\d+)\\s*\\)$/;\n const hslaMatch = trimmedColor.match(hslaRegex);\n if (hslaMatch) {\n const [, h, s, l, a] = hslaMatch;\n const hValid = parseInt(h) >= 0 && parseInt(h) <= 360;\n const sValid = parseInt(s) >= 0 && parseInt(s) <= 100;\n const lValid = parseInt(l) >= 0 && parseInt(l) <= 100;\n const alphaValid = parseFloat(a) >= 0 && parseFloat(a) <= 1;\n return hValid && sValid && lValid && alphaValid;\n }\n \n // Named colors (basic set)\n const namedColors = [\n 'aliceblue', 'antiquewhite', 'aqua', 'aquamarine', 'azure',\n 'beige', 'bisque', 'black', 'blanchedalmond', 'blue', 'blueviolet', 'brown', 'burlywood',\n 'cadetblue', 'chartreuse', 'chocolate', 'coral', 'cornflowerblue', 'cornsilk', 'crimson', 'cyan',\n 'darkblue', 'darkcyan', 'darkgoldenrod', 'darkgray', 'darkgreen', 'darkkhaki', 'darkmagenta',\n 'darkolivegreen', 'darkorange', 'darkorchid', 'darkred', 'darksalmon', 'darkseagreen',\n 'darkslateblue', 'darkslategray', 'darkturquoise', 'darkviolet', 'deeppink', 'deepskyblue',\n 'dimgray', 'dodgerblue',\n 'firebrick', 'floralwhite', 'forestgreen', 'fuchsia',\n 'gainsboro', 'ghostwhite', 'gold', 'goldenrod', 'gray', 'green', 'greenyellow',\n 'honeydew', 'hotpink',\n 'indianred', 'indigo', 'ivory',\n 'khaki',\n 'lavender', 'lavenderblush', 'lawngreen', 'lemonchiffon', 'lightblue', 'lightcoral',\n 'lightcyan', 'lightgoldenrodyellow', 'lightgray', 'lightgreen', 'lightpink', 'lightsalmon',\n 'lightseagreen', 'lightskyblue', 'lightslategray', 'lightsteelblue', 'lightyellow', 'lime',\n 'limegreen', 'linen',\n 'magenta', 'maroon', 'mediumaquamarine', 'mediumblue', 'mediumorchid', 'mediumpurple',\n 'mediumseagreen', 'mediumslateblue', 'mediumspringgreen', 'mediumturquoise', 'mediumvioletred',\n 'midnightblue', 'mintcream', 'mistyrose', 'moccasin',\n 'navajowhite', 'navy',\n 'oldlace', 'olive', 'olivedrab', 'orange', 'orangered', 'orchid',\n 'palegoldenrod', 'palegreen', 'paleturquoise', 'palevioletred', 'papayawhip', 'peachpuff',\n 'peru', 'pink', 'plum', 'powderblue', 'purple',\n 'red', 'rosybrown', 'royalblue',\n 'saddlebrown', 'salmon', 'sandybrown', 'seagreen', 'seashell', 'sienna', 'silver', 'skyblue',\n 'slateblue', 'slategray', 'snow', 'springgreen', 'steelblue',\n 'tan', 'teal', 'thistle', 'tomato', 'turquoise',\n 'violet',\n 'wheat', 'white', 'whitesmoke',\n 'yellow', 'yellowgreen'\n ];\n \n return namedColors.includes(trimmedColor.toLowerCase());\n}, {\n message: 'Invalid color format. Use hex (#fff, #ffffff), rgb(255,255,255), rgba(255,255,255,0.5), hsl(360,100%,50%), hsla(360,100%,50%,0.5), or named colors'\n}).describe('color').brand('color') as z.ZodString;\n\nexport type ZodBrandedColorInstance = typeof ZodTypeForColors;\n"]}
1
+ {"version":3,"file":"zod-color.js","sourceRoot":"","sources":["../../src/zod-color.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAgB,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;IACvE,oBAAoB;IACpB,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAElC,2CAA2C;IAC3C,MAAM,QAAQ,GAAG,oCAAoC,CAAC;IACtD,IAAI,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,iCAAiC;IACjC,MAAM,QAAQ,GAAG,0DAA0D,CAAC;IAC5E,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC9C,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,CAAC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K,EAAE,WAAW,EAAE,WAAW;QAC/B,aAAa,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS;QAC5F,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW;QAC5D,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW;QAC/C,QAAQ;QACR,OAAO,EAAE,OAAO,EAAE,YAAY;QAC9B,QAAQ,EAAE,aAAa;KACxB,CAAC;IAEF,OAAO,WAAW,CAAC,QAAQ,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC;AAC1D,CAAC,EAAE;IACD,OAAO,EAAE,oJAAoJ;CAC9J,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,OAAO,CAAgB,CAAC","sourcesContent":["import { z } from \"zod\";\n\n/**\n * Color validation schema for various color formats\n * Supports: hex (3/6 digits), rgb, rgba, hsl, hsla, and named colors\n */\nexport const ZodTypeForColors: z.ZodString = z.string().refine((color) => {\n // Remove whitespace\n const trimmedColor = color.trim();\n \n // Hex colors: #fff, #ffffff, #FFF, #FFFFFF\n const hexRegex = /^#([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6})$/;\n if (hexRegex.test(trimmedColor)) {\n return true;\n }\n \n // RGB colors: rgb(255, 255, 255)\n const rgbRegex = /^rgb\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*\\)$/;\n const rgbMatch = trimmedColor.match(rgbRegex);\n if (rgbMatch) {\n const [, r, g, b] = rgbMatch;\n return [r, g, b].every(val => parseInt(val) >= 0 && parseInt(val) <= 255);\n }\n \n \n // RGBA colors: rgba(255, 255, 255, 0.5)\n const rgbaRegex = /^rgba\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(0|1|0?\\.\\d+)\\s*\\)$/;\n const rgbaMatch = trimmedColor.match(rgbaRegex);\n if (rgbaMatch) {\n const [, r, g, b, a] = rgbaMatch;\n const rgbValid = [r, g, b].every(val => parseInt(val) >= 0 && parseInt(val) <= 255);\n const alphaValid = parseFloat(a) >= 0 && parseFloat(a) <= 1;\n return rgbValid && alphaValid;\n }\n \n // HSL colors: hsl(360, 100%, 50%)\n const hslRegex = /^hsl\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})%\\s*,\\s*(\\d{1,3})%\\s*\\)$/;\n const hslMatch = trimmedColor.match(hslRegex);\n if (hslMatch) {\n const [, h, s, l] = hslMatch;\n const hValid = parseInt(h) >= 0 && parseInt(h) <= 360;\n const sValid = parseInt(s) >= 0 && parseInt(s) <= 100;\n const lValid = parseInt(l) >= 0 && parseInt(l) <= 100;\n return hValid && sValid && lValid;\n }\n \n // HSLA colors: hsla(360, 100%, 50%, 0.5)\n const hslaRegex = /^hsla\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})%\\s*,\\s*(\\d{1,3})%\\s*,\\s*(0|1|0?\\.\\d+)\\s*\\)$/;\n const hslaMatch = trimmedColor.match(hslaRegex);\n if (hslaMatch) {\n const [, h, s, l, a] = hslaMatch;\n const hValid = parseInt(h) >= 0 && parseInt(h) <= 360;\n const sValid = parseInt(s) >= 0 && parseInt(s) <= 100;\n const lValid = parseInt(l) >= 0 && parseInt(l) <= 100;\n const alphaValid = parseFloat(a) >= 0 && parseFloat(a) <= 1;\n return hValid && sValid && lValid && alphaValid;\n }\n \n // Named colors (basic set)\n const namedColors = [\n 'aliceblue', 'antiquewhite', 'aqua', 'aquamarine', 'azure',\n 'beige', 'bisque', 'black', 'blanchedalmond', 'blue', 'blueviolet', 'brown', 'burlywood',\n 'cadetblue', 'chartreuse', 'chocolate', 'coral', 'cornflowerblue', 'cornsilk', 'crimson', 'cyan',\n 'darkblue', 'darkcyan', 'darkgoldenrod', 'darkgray', 'darkgreen', 'darkkhaki', 'darkmagenta',\n 'darkolivegreen', 'darkorange', 'darkorchid', 'darkred', 'darksalmon', 'darkseagreen',\n 'darkslateblue', 'darkslategray', 'darkturquoise', 'darkviolet', 'deeppink', 'deepskyblue',\n 'dimgray', 'dodgerblue',\n 'firebrick', 'floralwhite', 'forestgreen', 'fuchsia',\n 'gainsboro', 'ghostwhite', 'gold', 'goldenrod', 'gray', 'green', 'greenyellow',\n 'honeydew', 'hotpink',\n 'indianred', 'indigo', 'ivory',\n 'khaki',\n 'lavender', 'lavenderblush', 'lawngreen', 'lemonchiffon', 'lightblue', 'lightcoral',\n 'lightcyan', 'lightgoldenrodyellow', 'lightgray', 'lightgreen', 'lightpink', 'lightsalmon',\n 'lightseagreen', 'lightskyblue', 'lightslategray', 'lightsteelblue', 'lightyellow', 'lime',\n 'limegreen', 'linen',\n 'magenta', 'maroon', 'mediumaquamarine', 'mediumblue', 'mediumorchid', 'mediumpurple',\n 'mediumseagreen', 'mediumslateblue', 'mediumspringgreen', 'mediumturquoise', 'mediumvioletred',\n 'midnightblue', 'mintcream', 'mistyrose', 'moccasin',\n 'navajowhite', 'navy',\n 'oldlace', 'olive', 'olivedrab', 'orange', 'orangered', 'orchid',\n 'palegoldenrod', 'palegreen', 'paleturquoise', 'palevioletred', 'papayawhip', 'peachpuff',\n 'peru', 'pink', 'plum', 'powderblue', 'purple',\n 'red', 'rosybrown', 'royalblue',\n 'saddlebrown', 'salmon', 'sandybrown', 'seagreen', 'seashell', 'sienna', 'silver', 'skyblue',\n 'slateblue', 'slategray', 'snow', 'springgreen', 'steelblue',\n 'tan', 'teal', 'thistle', 'tomato', 'turquoise',\n 'violet',\n 'wheat', 'white', 'whitesmoke',\n 'yellow', 'yellowgreen'\n ];\n \n return namedColors.includes(trimmedColor.toLowerCase());\n}, {\n message: 'Invalid color format. Use hex (#fff, #ffffff), rgb(255,255,255), rgba(255,255,255,0.5), hsl(360,100%,50%), hsla(360,100%,50%,0.5), or named colors'\n}).describe('color').brand('color') as z.ZodString;\n\nexport type ZodBrandedColorInstance = typeof ZodTypeForColors;\n"]}