@wildo-ai/zod-decorators 1.1.5 → 1.1.7
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.
- package/dist/esm/.native.tsbuildinfo +1 -0
- package/dist/esm/__mocks__/mime.d.ts.map +1 -1
- package/dist/esm/__mocks__/mime.js.map +1 -1
- package/dist/esm/commons.d.ts.map +1 -1
- package/dist/esm/commons.js.map +1 -1
- package/dist/esm/currencies.shared.schemas.d.ts.map +1 -1
- package/dist/esm/currencies.shared.schemas.js.map +1 -1
- package/dist/esm/files/agent-file-formats.d.ts.map +1 -1
- package/dist/esm/files/agent-file-formats.js.map +1 -1
- package/dist/esm/files/extension-nature-map.d.ts.map +1 -1
- package/dist/esm/files/extension-nature-map.js.map +1 -1
- package/dist/esm/files/file-extensions.enum.d.ts.map +1 -1
- package/dist/esm/files/file-extensions.enum.js.map +1 -1
- package/dist/esm/files/mime-registry.d.ts.map +1 -1
- package/dist/esm/files/mime-registry.js.map +1 -1
- package/dist/esm/files/unified-registry.d.ts.map +1 -1
- package/dist/esm/files/unified-registry.js.map +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/install-bigint-json-encoding.d.ts.map +1 -1
- package/dist/esm/install-bigint-json-encoding.js.map +1 -1
- package/dist/esm/testing/decorated-test-schemas.d.ts.map +1 -1
- package/dist/esm/testing/decorated-test-schemas.js.map +1 -1
- package/dist/esm/testing.d.ts.map +1 -1
- package/dist/esm/testing.js.map +1 -1
- package/dist/esm/zod-address.d.ts.map +1 -1
- package/dist/esm/zod-address.js +9 -9
- package/dist/esm/zod-address.js.map +1 -1
- package/dist/esm/zod-bigdecimal.d.ts.map +1 -1
- package/dist/esm/zod-bigdecimal.js.map +1 -1
- package/dist/esm/zod-code.d.ts.map +1 -1
- package/dist/esm/zod-code.js +4 -4
- package/dist/esm/zod-code.js.map +1 -1
- package/dist/esm/zod-color.d.ts.map +1 -1
- package/dist/esm/zod-color.js.map +1 -1
- package/dist/esm/zod-decorators.types.d.ts +46 -10
- package/dist/esm/zod-decorators.types.d.ts.map +1 -1
- package/dist/esm/zod-decorators.types.js +35 -8
- package/dist/esm/zod-decorators.types.js.map +1 -1
- package/dist/esm/zod-duration.d.ts.map +1 -1
- package/dist/esm/zod-duration.js +4 -4
- package/dist/esm/zod-duration.js.map +1 -1
- package/dist/esm/zod-file.d.ts.map +1 -1
- package/dist/esm/zod-file.js +20 -18
- package/dist/esm/zod-file.js.map +1 -1
- package/dist/esm/zod-money.d.ts.map +1 -1
- package/dist/esm/zod-money.js +6 -6
- package/dist/esm/zod-money.js.map +1 -1
- package/dist/esm/zod-phone.d.ts.map +1 -1
- package/dist/esm/zod-phone.js.map +1 -1
- package/dist/esm/zod-range.d.ts.map +1 -1
- package/dist/esm/zod-range.js.map +1 -1
- package/dist/esm/zod-utils.shared.d.ts +32 -3
- package/dist/esm/zod-utils.shared.d.ts.map +1 -1
- package/dist/esm/zod-utils.shared.js +106 -4
- package/dist/esm/zod-utils.shared.js.map +1 -1
- package/dist/esm/zod-versioned.d.ts.map +1 -1
- package/dist/esm/zod-versioned.js.map +1 -1
- package/dist/esm/zod.module-override.d.ts +2 -0
- package/dist/esm/zod.module-override.d.ts.map +1 -1
- package/dist/esm/zod.module-override.js +17 -3
- package/dist/esm/zod.module-override.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod-money.js","sourceRoot":"","sources":["../../../src/zod-money.ts"],"names":[],"mappings":"AACA,+EAA+E;AAC/E,sBAAsB;AACtB,+EAA+E;AAE/E,OAAO,EAAkB,eAAe,EAAoF,YAAY,EAA2B,MAAM,wBAAwB,CAAC;AAClM,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,cAAc,EA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,WAAW,EAAE;QACxD,CAAC,CAAC,gBAAgB,CAAC;IAErB,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,eAAe,CAAC;IACzB,CAAC;IAED,gFAAgF;IAChF,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC;IAE9B,OAAO,cAAc,KAAK,QAAQ;QAChC,CAAC,CAAC,GAAG,MAAM,IAAI,eAAe,EAAE;QAChC,CAAC,CAAC,GAAG,eAAe,IAAI,MAAM,EAAE,CAAC;AACrC,CAAC","sourcesContent":["\n// ============================================================================\n// MONEY SCHEMA HELPER\n// ============================================================================\n\nimport { DecoratorInput, SCHEMA_METADATA, CustomFieldMetadata, MoneySchemaMetadata, MoneySchemaOptions, SummaryFieldParams, ZodDecorator, ZodDecorator_ParamsType } from \"./zod-decorators.types\";\nimport { z } from \"zod\";\nimport { addChainableMethods } from \"./zod.module-override\";\nimport { CurrencySchema, currencyMinorUnitDecimals } from \"./currencies.shared.schemas\";\n\n/**\n * Money value type - represents a monetary amount with bigint storage.\n *\n * The amount is stored as a bigint in the smallest unit (e.g., cents for USD).\n * Using bigint ensures no precision loss for arbitrarily large amounts.\n * The decimals field indicates how to convert to the display value:\n * - displayValue = Number(amount) / (10 ** decimals)\n *\n * Example: { amount: 1999n, currency: 'USD', decimals: 2 } = $19.99\n */\nexport interface MoneyValue {\n /**\n * Amount in smallest unit (e.g., cents). BigInt to avoid precision issues with\n * large amounts.\n *\n * WIRE CONTRACT: a `bigint` has no JSON form, so on the wire (and at rest in\n * Mongo) this amount is a decimal STRING (e.g. `\"1999\"`). Outbound it is encoded\n * by `BigInt.prototype.toJSON` (`installBigIntJsonEncoding`, same package);\n * inbound it is coerced back to `bigint` by `applyNetworkBoundaryCoercion`\n * (`@wildo-ai/saas-models`) on the shared request/response DTO — so both the\n * frontend and backend hold a real `bigint` at runtime. Full mechanism map:\n * `install-bigint-json-encoding.ts`.\n */\n amount: bigint;\n /** ISO 4217 currency code (e.g., 'USD', 'EUR', 'BTC') */\n currency: string;\n /** Number of decimal places for display (e.g., 2 for USD, 8 for BTC) */\n decimals: number;\n}\n\n/**\n * Zod schema for MoneyValue.\n */\nexport const MoneyValueSchema: z.ZodObject<{ amount: z.ZodBigInt; currency: typeof CurrencySchema; decimals: z.ZodNumber }> = z.object({\n amount: z.bigint(),\n currency: CurrencySchema,\n decimals: z.number().int().min(0).max(18),\n});\n\n/**\n * @wildo_source:part:start zod.factories.money facet:layer:shared facet:family:schema-factory\n *\n * z_money() - Creates money schemas for financial amounts.\n *\n * Money values are stored as integers to avoid floating-point precision issues.\n * The schema creates an object with: { amount, currency, decimals }\n *\n * @example\n * ```typescript\n * import { z_money } from '@wildo-ai/zod-decorators';\n *\n * const price = z_money();\n * const fiatPrice = z_money({ currenciesAllowed: [CurrencyAllowed.FIAT] });\n * const usdPrice = z_money({ allowCurrencyChange: false }).moneyUI({ edit: { defaultCurrency: 'USD' } });\n *\n * // With decorators (chainable)\n * z_money().moneyUI({ edit: { defaultCurrency: 'EUR' } })\n * z_money({ currenciesAllowed: [CurrencyAllowed.FIAT_MAJOR] }).isHidden({ edit: true })\n * ```\n */\n\n/**\n * Creates a money schema with metadata for detection and form component rendering.\n *\n * @param options - Configuration options for money field\n * @returns A Zod object schema with metadata for money detection\n *\n * @example\n * ```typescript\n * // Simple money (all currencies)\n * const price = z_money();\n * // Infers: { amount: bigint, currency: string, decimals: number }\n *\n * // Fiat only (no crypto)\n * const fiatPrice = z_money({ currenciesAllowed: [CurrencyAllowed.FIAT] });\n *\n * // Fixed currency with amount constraints\n * const usdPrice = z_money({\n * allowCurrencyChange: false,\n * minAmount: 0n,\n * maxAmount: 100000000n // $1,000,000.00 in cents\n * }).moneyUI({ edit: { defaultCurrency: 'USD' } });\n * ```\n */\nexport function createMoneySchema(\n options: MoneySchemaOptions = {}\n): DecoratedMoneySchema {\n const {\n currenciesAllowed,\n appEnabledOnly = true,\n allowCurrencyChange = true,\n minAmount,\n maxAmount,\n } = options;\n\n // Create the amount schema with optional min/max constraints\n // Using bigint for amount to avoid precision issues with large financial amounts\n let amountSchema = z.bigint();\n if (minAmount !== undefined) {\n amountSchema = amountSchema.min(minAmount);\n }\n if (maxAmount !== undefined) {\n amountSchema = amountSchema.max(maxAmount);\n }\n\n // Create the money object schema\n const moneySchema = z.object({\n amount: amountSchema,\n currency: CurrencySchema,\n decimals: z.number().int().min(0).max(18),\n });\n\n const moneyMetadata: MoneySchemaMetadata = {\n isMoney: true,\n ...(currenciesAllowed && currenciesAllowed.length > 0 && { currenciesAllowed }),\n appEnabledOnly,\n allowCurrencyChange,\n ...(minAmount !== undefined && { minAmount }),\n ...(maxAmount !== undefined && { maxAmount }),\n };\n\n // Initialize or extend SCHEMA_METADATA with money config\n const existingMetadata: CustomFieldMetadata = (moneySchema as any)[SCHEMA_METADATA] || {};\n (moneySchema as any)[SCHEMA_METADATA] = {\n ...existingMetadata,\n moneyConfig: moneyMetadata,\n };\n\n // Add chainable decorator methods to the money schema instance\n // This allows: z_money().moneyUI({ edit: { defaultCurrency: 'EUR' } }).isHidden()\n addChainableMethods(moneySchema);\n\n return moneySchema as DecoratedMoneySchema;\n}\n\n/**\n * Return type for money schemas - includes decorator methods.\n * Note: IS_FOREIGN_KEY is not applicable to money objects.\n * IS_DB_INDEXED will index internal fields (amount, currency) for query optimization.\n *\n * This type must list all decorators applicable to ZodObject (per ApplyableTypeAllTypes).\n * Missing entries here cause TS errors when chaining decorators on z_money() fields.\n */\nexport type DecoratedMoneySchema = z.ZodObject<{\n amount: z.ZodBigInt;\n currency: typeof CurrencySchema;\n decimals: z.ZodNumber;\n}> & {\n [ZodDecorator.IS_DB_INDEXED](): DecoratedMoneySchema;\n /** Installed at runtime with the other chainable methods; declared here so an authored `.moneyUI(…)` typechecks. */\n [ZodDecorator.MONEY_UI](params?: ZodDecorator_ParamsType[ZodDecorator.MONEY_UI]): DecoratedMoneySchema;\n [ZodDecorator.IS_HIDDEN](params?: ZodDecorator_ParamsType[ZodDecorator.IS_HIDDEN]): DecoratedMoneySchema;\n [ZodDecorator.IS_NOT_EDITABLE](params?: ZodDecorator_ParamsType[ZodDecorator.IS_NOT_EDITABLE]): DecoratedMoneySchema;\n // Resource-level decorators (applicable to all types including ZodObject)\n [ZodDecorator.IS_SUMMARY_FIELD](params?: SummaryFieldParams): DecoratedMoneySchema;\n [ZodDecorator.IS_BACKEND_ONLY](params?: ZodDecorator_ParamsType[ZodDecorator.IS_BACKEND_ONLY]): DecoratedMoneySchema;\n [ZodDecorator.IS_WRITE_ONLY_SECRET](params?: ZodDecorator_ParamsType[ZodDecorator.IS_WRITE_ONLY_SECRET]): DecoratedMoneySchema;\n [ZodDecorator.EXCLUDE_FROM_CREATE](): DecoratedMoneySchema;\n [ZodDecorator.EXCLUDE_FROM_UPDATE](): DecoratedMoneySchema;\n addDecorators(decorators: DecoratorInput[]): DecoratedMoneySchema;\n};\n\n/**\n * Creates a money schema for financial amounts with integer storage.\n * Named z_money to indicate it's a Zod helper function exported standalone.\n *\n * Money values are stored as: { amount: int, currency: string, decimals: int }\n * - amount: Value in smallest unit (e.g., cents for USD, satoshis for BTC)\n * - currency: ISO 4217 code (e.g., 'USD', 'EUR', 'BTC')\n * - decimals: Decimal places for display conversion (e.g., 2 for USD, 8 for BTC)\n *\n * @example\n * ```typescript\n * import { z_money } from '@wildo-ai/zod-decorators';\n *\n * // Simple usage\n * z_money() // All currencies\n *\n * // With options\n * z_money({ currenciesAllowed: [CurrencyAllowed.FIAT] })\n * z_money({ allowCurrencyChange: false }).moneyUI({ edit: { defaultCurrency: 'USD' } })\n * z_money({ currenciesAllowed: [CurrencyAllowed.FIAT_MAJOR], minAmount: 0n })\n *\n * // With decorators (chainable)\n * z_money().moneyUI({ edit: { defaultCurrency: 'USD' } })\n * z_money({ currenciesAllowed: [CurrencyAllowed.FIAT] }).isHidden({ edit: true })\n *\n * // Usage example\n * const price: MoneyValue = { amount: 1999n, currency: 'USD', decimals: 2 };\n * // Represents $19.99\n * ```\n */\nexport function z_money(\n options?: MoneySchemaOptions\n): DecoratedMoneySchema {\n return createMoneySchema(options) as DecoratedMoneySchema;\n}\n/** @wildo_source:part:end zod.factories.money */\n\n// ============================================================================\n// MONEY UTILITY FUNCTIONS\n// ============================================================================\n\n/**\n * Why an amount could not be expressed in its currency's smallest unit.\n *\n * A named vocabulary rather than three bare strings, because each member has a DIFFERENT remedy and\n * an operator reading a sync log needs to know which one they are looking at: an unknown minor unit\n * is a catalogue problem, a precision loss is an authoring problem, and an unsafe magnitude is a\n * limit of the provider's own number type.\n */\nexport enum MoneyMinorUnitConversionFailure {\n /** The currency has no minor unit (`XDR`, `XXX`) or is not one this vocabulary knows. */\n UNKNOWN_MINOR_UNIT = 'unknown_minor_unit',\n /** Converting down would discard a fraction of the provider's smallest unit. */\n PRECISION_LOSS = 'precision_loss',\n /** The converted amount cannot be represented exactly as a JavaScript number. */\n UNSAFE_MAGNITUDE = 'unsafe_magnitude',\n}\n\n/** Thrown by {@link toCurrencyMinorUnitAmountOrThrow}; carries the reason so a caller can branch. */\nexport class MoneyMinorUnitConversionError extends Error {\n constructor(\n public readonly reason: MoneyMinorUnitConversionFailure,\n message: string,\n ) {\n super(message);\n this.name = 'MoneyMinorUnitConversionError';\n }\n}\n\n/**\n * Convert a {@link MoneyValue} to the amount a payment provider expects: an integer in the CURRENCY's\n * smallest unit.\n *\n * Wildo stores money at an AUTHORED scale (`decimals` on the value); a provider reads it at the\n * currency's own scale. Those are two different numbers whenever they disagree, and until 2026-09-08\n * the billing boundary sent the stored amount straight through — so a price authored at any scale\n * other than the currency's was charged at the wrong magnitude, by a factor of 10 per decimal place\n * of disagreement.\n *\n * **All arithmetic is `bigint`.** The stored amount already is one, and the whole reason it is a\n * bigint rather than a number is that money must not round; converting through a float to save a cast\n * would give that back at exactly the boundary where it costs money.\n *\n * **Scaling UP is always exact. Scaling DOWN refuses on a remainder rather than rounding** — a price\n * of 1.005 in a currency whose smallest unit is a cent is not 1.00 and not 1.01, it is a price the\n * provider cannot express, and silently picking one is how a catalogue and an invoice come to\n * disagree by a cent per unit forever.\n *\n * **Throws rather than returning a result union**, and the reason is the compiler rather than taste:\n * this repository compiles with `strict: false` (`engine/tsconfig.common.json`), which disables the\n * discriminant narrowing a `{ ok: true } | { ok: false }` result depends on — so every caller would\n * need a cast to read the failure, at every boundary. A typed error narrows by `instanceof`, which\n * works regardless. Callers that must not throw resolve the scale directly with\n * `currencyMinorUnitDecimals` and decide for themselves.\n *\n * @param subject what the message names (\"price p_1 tier 2 flat amount\"), so an operator reading a\n * sync log knows which amount could not be expressed without opening the catalogue.\n */\nexport function toCurrencyMinorUnitAmountOrThrow(value: MoneyValue, subject: string): number {\n const target = currencyMinorUnitDecimals(value.currency);\n if (target === undefined) {\n throw new MoneyMinorUnitConversionError(\n MoneyMinorUnitConversionFailure.UNKNOWN_MINOR_UNIT,\n `Cannot express ${subject} for a payment provider: currency '${value.currency}' has no minor unit this framework can resolve. Cryptocurrencies are in this position deliberately — their decimals are protocol conventions, not a fiat provider's minor unit.`,\n );\n }\n\n let converted: bigint;\n if (value.decimals === target) {\n converted = value.amount;\n } else if (value.decimals < target) {\n converted = value.amount * 10n ** BigInt(target - value.decimals);\n } else {\n const divisor = 10n ** BigInt(value.decimals - target);\n if (value.amount % divisor !== 0n) {\n throw new MoneyMinorUnitConversionError(\n MoneyMinorUnitConversionFailure.PRECISION_LOSS,\n `Cannot express ${subject} for a payment provider: amount ${value.amount} at scale ${value.decimals} cannot be written in ${value.currency}'s smallest unit (scale ${target}) without discarding a fraction of it. Author the amount at scale ${target}, or at a scale whose extra digits are zero.`,\n );\n }\n converted = value.amount / divisor;\n }\n\n const asNumber = Number(converted);\n if (!Number.isSafeInteger(asNumber)) {\n throw new MoneyMinorUnitConversionError(\n MoneyMinorUnitConversionFailure.UNSAFE_MAGNITUDE,\n `Cannot express ${subject} for a payment provider: amount ${converted} in ${value.currency}'s smallest unit exceeds the range a JavaScript number represents exactly, so handing it over would silently change its value.`,\n );\n }\n\n return asNumber;\n}\n\n/**\n * Convert a decimal amount to bigint representation.\n *\n * **Precision caveat:** This uses floating-point arithmetic internally\n * (`Math.round(decimalAmount * 10^decimals)`), which can produce rounding\n * errors for certain values. Prefer `parseDecimalStringToAmount` when working\n * with user input strings to avoid float precision issues entirely.\n *\n * @param decimalAmount - The decimal amount (e.g., 19.99)\n * @param decimals - Number of decimal places (e.g., 2)\n * @returns BigInt amount (e.g., 1999n)\n */\nexport function toMoneyAmount(decimalAmount: number, decimals: number): bigint {\n return BigInt(Math.round(decimalAmount * Math.pow(10, decimals)));\n}\n\n/**\n * Convert a bigint amount to decimal representation.\n * @param amount - The bigint amount (e.g., 1999n)\n * @param decimals - Number of decimal places (e.g., 2)\n * @returns Decimal amount (e.g., 19.99)\n */\nexport function fromMoneyAmount(amount: bigint, decimals: number): number {\n return Number(amount) / Math.pow(10, decimals);\n}\n\n/**\n * Convert a string or number to bigint safely.\n * Useful for parsing user input or JSON values.\n * @param value - String, number, or bigint to convert\n * @returns BigInt amount\n */\nexport function toBigIntAmount(value: string | number | bigint): bigint {\n if (typeof value === 'bigint') return value;\n if (typeof value === 'number') return BigInt(Math.round(value));\n return BigInt(value);\n}\n\n/**\n * Parse a decimal string directly to a bigint amount, avoiding floating-point\n * precision issues entirely.\n *\n * This is the preferred way to convert user input (e.g., from an HTML input\n * element) to a money amount. It works by splitting the string at the decimal\n * point and manipulating integer/fractional parts as strings, so no float\n * arithmetic is ever involved.\n *\n * - Extra fractional digits beyond `decimals` are **truncated** (not rounded).\n * - Missing fractional digits are **zero-padded**.\n *\n * @param input - A decimal string (e.g., \"19.99\", \"5\", \".50\", \"-12.345\")\n * @param decimals - Number of decimal places for the target currency\n * @returns BigInt amount, or `null` if the input is not a valid decimal string\n *\n * **Note:** Scientific notation strings (e.g., `\"1e+10\"`) are rejected (returns\n * `null`) since they are not valid monetary input. This is correct behavior when\n * reading from `<input type=\"number\">`, which may produce such strings for very\n * large values — those inputs should be constrained via `min`/`max` attributes.\n *\n * @example\n * ```typescript\n * parseDecimalStringToAmount(\"19.99\", 2) // → 1999n\n * parseDecimalStringToAmount(\"19.999\", 2) // → 1999n (truncates, not rounds)\n * parseDecimalStringToAmount(\"19.9\", 2) // → 1990n (pads missing decimals)\n * parseDecimalStringToAmount(\"5\", 2) // → 500n\n * parseDecimalStringToAmount(\".50\", 2) // → 50n\n * parseDecimalStringToAmount(\"-12.34\", 2) // → -1234n\n * parseDecimalStringToAmount(\"abc\", 2) // → null\n * parseDecimalStringToAmount(\"1e+10\", 2) // → null (scientific notation rejected)\n * ```\n */\nexport function parseDecimalStringToAmount(input: string, decimals: number): bigint | null {\n const trimmed = input.trim();\n if (trimmed === '' || trimmed === '.' || trimmed === '-' || trimmed === '-.') return null;\n\n // Handle sign\n const isNegative = trimmed.startsWith('-');\n const unsigned = isNegative ? trimmed.slice(1) : trimmed;\n\n // Validate: only digits and at most one decimal point\n if (!/^\\d*\\.?\\d*$/.test(unsigned)) return null;\n\n const dotIndex = unsigned.indexOf('.');\n const integerPart = dotIndex === -1 ? unsigned : (unsigned.slice(0, dotIndex) || '0');\n const fractionalRaw = dotIndex === -1 ? '' : unsigned.slice(dotIndex + 1);\n\n // Pad or truncate fractional part to exactly `decimals` digits\n const fractionalPart = decimals === 0\n ? ''\n : fractionalRaw.padEnd(decimals, '0').slice(0, decimals);\n\n // Build the combined string and convert to bigint\n const combined = integerPart + fractionalPart;\n // Guard against empty combined (shouldn't happen after validation, but be safe)\n if (combined === '') return 0n;\n\n try {\n const result = BigInt(combined);\n return isNegative ? -result : result;\n } catch {\n return null;\n }\n}\n\n/**\n * Convert a money amount from one decimal precision to another using pure\n * bigint arithmetic (no floating-point involved).\n *\n * Use this when changing a currency (which may have different decimal places)\n * instead of the float roundtrip `fromMoneyAmount` → `toMoneyAmount`.\n *\n * - When increasing decimals (e.g., 2 → 8): multiplies by 10^(diff)\n * - When decreasing decimals (e.g., 8 → 2): divides with half-away-from-zero rounding\n *\n * @param amount - The bigint amount in the source precision\n * @param fromDecimals - Source decimal places\n * @param toDecimals - Target decimal places\n * @returns BigInt amount in the target precision\n *\n * @example\n * ```typescript\n * convertMoneyDecimals(1999n, 2, 2) // → 1999n (same decimals, no-op)\n * convertMoneyDecimals(1999n, 2, 4) // → 199900n (scale up)\n * convertMoneyDecimals(199900n, 4, 2) // → 1999n (scale down)\n * convertMoneyDecimals(12345678n, 8, 2) // → 12n (BTC satoshis to 2-decimal)\n * ```\n */\nexport function convertMoneyDecimals(amount: bigint, fromDecimals: number, toDecimals: number): bigint {\n if (fromDecimals === toDecimals) return amount;\n\n const diff = toDecimals - fromDecimals;\n\n if (diff > 0) {\n // Scale up: multiply\n return amount * (10n ** BigInt(diff));\n }\n\n // Scale down: divide with rounding (half-away-from-zero)\n const divisor = 10n ** BigInt(-diff);\n const isNegative = amount < 0n;\n const absAmount = isNegative ? -amount : amount;\n const rounded = (absAmount + divisor / 2n) / divisor;\n return isNegative ? -rounded : rounded;\n}\n\n/**\n * Format a money value for display.\n * @param money - The money value\n * @param options - Formatting options\n * @returns Formatted string (e.g., \"$19.99\" or \"19.99 USD\")\n */\nexport function formatMoney(\n money: MoneyValue,\n options: {\n showSymbol?: boolean;\n symbolPosition?: 'before' | 'after';\n thousandsSeparator?: string;\n decimalSeparator?: string;\n } = {}\n): string {\n const {\n showSymbol = true,\n symbolPosition = 'before',\n thousandsSeparator = ',',\n decimalSeparator = '.',\n } = options;\n\n const decimalValue = fromMoneyAmount(money.amount, money.decimals);\n\n // Format with proper decimal places\n const [integerPart, decimalPart] = decimalValue.toFixed(money.decimals).split('.');\n\n // Add thousands separator\n const formattedInteger = integerPart.replace(/\\B(?=(\\d{3})+(?!\\d))/g, thousandsSeparator);\n\n const formattedNumber = decimalPart\n ? `${formattedInteger}${decimalSeparator}${decimalPart}`\n : formattedInteger;\n\n if (!showSymbol) {\n return formattedNumber;\n }\n\n // For now, use currency code as symbol (can be enhanced with CURRENCY_INFO_MAP)\n const symbol = money.currency;\n\n return symbolPosition === 'before'\n ? `${symbol} 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;IAEN,MAAM,EACJ,UAAU,GAAG,IAAI,EACjB,cAAc,GAAG,QAAQ,EACzB,kBAAkB,GAAG,GAAG,EACxB,gBAAgB,GAAG,GAAG,GACvB,GAAG,OAAO,CAAC;IAEZ,MAAM,YAAY,GAAG,eAAe,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IAEnE,oCAAoC;IACpC,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEnF,0BAA0B;IAC1B,MAAM,gBAAgB,GAAG,WAAW,CAAC,OAAO,CAAC,uBAAuB,EAAE,kBAAkB,CAAC,CAAC;IAE1F,MAAM,eAAe,GAAG,WAAW;QACjC,CAAC,CAAC,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,WAAW,EAAE;QACxD,CAAC,CAAC,gBAAgB,CAAC;IAErB,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,eAAe,CAAC;IACzB,CAAC;IAED,gFAAgF;IAChF,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC;IAE9B,OAAO,cAAc,KAAK,QAAQ;QAChC,CAAC,CAAC,GAAG,MAAM,IAAI,eAAe,EAAE;QAChC,CAAC,CAAC,GAAG,eAAe,IAAI,MAAM,EAAE,CAAC;AACrC,CAAC","sourcesContent":["\n// ============================================================================\n// MONEY SCHEMA HELPER\n// ============================================================================\n\nimport { DecoratorInput, SCHEMA_METADATA, CustomFieldMetadata, MoneySchemaMetadata, MoneySchemaOptions, SummaryFieldParams, ZodDecorator, ZodDecorator_ParamsType } from \"./zod-decorators.types\";\nimport { z } from \"zod\";\nimport { addChainableMethods } from \"./zod.module-override\";\nimport { CurrencySchema, currencyMinorUnitDecimals } from \"./currencies.shared.schemas\";\n\n/**\n * Money value type - represents a monetary amount with bigint storage.\n *\n * The amount is stored as a bigint in the smallest unit (e.g., cents for USD).\n * Using bigint ensures no precision loss for arbitrarily large amounts.\n * The decimals field indicates how to convert to the display value:\n * - displayValue = Number(amount) / (10 ** decimals)\n *\n * Example: { amount: 1999n, currency: 'USD', decimals: 2 } = $19.99\n */\nexport interface MoneyValue {\n /**\n * Amount in smallest unit (e.g., cents). BigInt to avoid precision issues with\n * large amounts.\n *\n * WIRE CONTRACT: a `bigint` has no JSON form, so on the wire (and at rest in\n * Mongo) this amount is a decimal STRING (e.g. `\"1999\"`). Outbound it is encoded\n * by `BigInt.prototype.toJSON` (`installBigIntJsonEncoding`, same package);\n * inbound it is coerced back to `bigint` by `applyNetworkBoundaryCoercion`\n * (`@wildo-ai/saas-models`) on the shared request/response DTO — so both the\n * frontend and backend hold a real `bigint` at runtime. Full mechanism map:\n * `install-bigint-json-encoding.ts`.\n */\n amount: bigint;\n /** ISO 4217 currency code (e.g., 'USD', 'EUR', 'BTC') */\n currency: string;\n /** Number of decimal places for display (e.g., 2 for USD, 8 for BTC) */\n decimals: number;\n}\n\n/**\n * Zod schema for MoneyValue.\n */\nexport const MoneyValueSchema: z.ZodObject<{ amount: z.ZodBigInt; currency: typeof CurrencySchema; decimals: z.ZodNumber }> = z.object({\n amount: z.bigint().describe(\"The amount in the currency's smallest unit, such as cents, as an integer. Sent as a decimal string (`\\\"1999\\\"`), because it can exceed what a JSON number holds exactly.\"),\n currency: CurrencySchema.describe(\"The ISO 4217 currency code, such as `USD` or `EUR`.\"),\n decimals: z.number().int().min(0).max(18).describe(\"How many decimal places the currency uses, to turn `amount` into a displayed value: `1999` with 2 decimals is 19.99.\"),\n});\n\n/**\n * @wildo_source:part:start zod.factories.money facet:layer:shared facet:family:schema-factory\n *\n * z_money() - Creates money schemas for financial amounts.\n *\n * Money values are stored as integers to avoid floating-point precision issues.\n * The schema creates an object with: { amount, currency, decimals }\n *\n * @example\n * ```typescript\n * import { z_money } from '@wildo-ai/zod-decorators';\n *\n * const price = z_money();\n * const fiatPrice = z_money({ currenciesAllowed: [CurrencyAllowed.FIAT] });\n * const usdPrice = z_money({ allowCurrencyChange: false }).moneyUI({ edit: { defaultCurrency: 'USD' } });\n *\n * // With decorators (chainable)\n * z_money().moneyUI({ edit: { defaultCurrency: 'EUR' } })\n * z_money({ currenciesAllowed: [CurrencyAllowed.FIAT_MAJOR] }).isHidden({ edit: true })\n * ```\n */\n\n/**\n * Creates a money schema with metadata for detection and form component rendering.\n *\n * @param options - Configuration options for money field\n * @returns A Zod object schema with metadata for money detection\n *\n * @example\n * ```typescript\n * // Simple money (all currencies)\n * const price = z_money();\n * // Infers: { amount: bigint, currency: string, decimals: number }\n *\n * // Fiat only (no crypto)\n * const fiatPrice = z_money({ currenciesAllowed: [CurrencyAllowed.FIAT] });\n *\n * // Fixed currency with amount constraints\n * const usdPrice = z_money({\n * allowCurrencyChange: false,\n * minAmount: 0n,\n * maxAmount: 100000000n // $1,000,000.00 in cents\n * }).moneyUI({ edit: { defaultCurrency: 'USD' } });\n * ```\n */\nexport function createMoneySchema(\n options: MoneySchemaOptions = {}\n): DecoratedMoneySchema {\n const {\n currenciesAllowed,\n appEnabledOnly = true,\n allowCurrencyChange = true,\n minAmount,\n maxAmount,\n } = options;\n\n // Create the amount schema with optional min/max constraints\n // Using bigint for amount to avoid precision issues with large financial amounts\n let amountSchema = z.bigint();\n if (minAmount !== undefined) {\n amountSchema = amountSchema.min(minAmount);\n }\n if (maxAmount !== undefined) {\n amountSchema = amountSchema.max(maxAmount);\n }\n\n // Create the money object schema\n const moneySchema = z.object({\n amount: amountSchema.describe(\"The amount in the currency's smallest unit, such as cents, as an integer. Sent as a decimal string (`\\\"1999\\\"`), because it can exceed what a JSON number holds exactly.\"),\n currency: CurrencySchema.describe(\"The ISO 4217 currency code, such as `USD` or `EUR`.\"),\n decimals: z.number().int().min(0).max(18).describe(\"How many decimal places the currency uses, to turn `amount` into a displayed value: `1999` with 2 decimals is 19.99.\"),\n });\n\n const moneyMetadata: MoneySchemaMetadata = {\n isMoney: true,\n ...(currenciesAllowed && currenciesAllowed.length > 0 && { currenciesAllowed }),\n appEnabledOnly,\n allowCurrencyChange,\n ...(minAmount !== undefined && { minAmount }),\n ...(maxAmount !== undefined && { maxAmount }),\n };\n\n // Initialize or extend SCHEMA_METADATA with money config\n const existingMetadata: CustomFieldMetadata = (moneySchema as any)[SCHEMA_METADATA] || {};\n (moneySchema as any)[SCHEMA_METADATA] = {\n ...existingMetadata,\n moneyConfig: moneyMetadata,\n };\n\n // Add chainable decorator methods to the money schema instance\n // This allows: z_money().moneyUI({ edit: { defaultCurrency: 'EUR' } }).isHidden()\n addChainableMethods(moneySchema);\n\n return moneySchema as DecoratedMoneySchema;\n}\n\n/**\n * Return type for money schemas - includes decorator methods.\n * Note: IS_FOREIGN_KEY is not applicable to money objects.\n * IS_DB_INDEXED will index internal fields (amount, currency) for query optimization.\n *\n * This type must list all decorators applicable to ZodObject (per ApplyableTypeAllTypes).\n * Missing entries here cause TS errors when chaining decorators on z_money() fields.\n */\nexport type DecoratedMoneySchema = z.ZodObject<{\n amount: z.ZodBigInt;\n currency: typeof CurrencySchema;\n decimals: z.ZodNumber;\n}> & {\n [ZodDecorator.IS_DB_INDEXED](): DecoratedMoneySchema;\n /** Installed at runtime with the other chainable methods; declared here so an authored `.moneyUI(…)` typechecks. */\n [ZodDecorator.MONEY_UI](params?: ZodDecorator_ParamsType[ZodDecorator.MONEY_UI]): DecoratedMoneySchema;\n [ZodDecorator.IS_HIDDEN](params?: ZodDecorator_ParamsType[ZodDecorator.IS_HIDDEN]): DecoratedMoneySchema;\n [ZodDecorator.IS_NOT_EDITABLE](params?: ZodDecorator_ParamsType[ZodDecorator.IS_NOT_EDITABLE]): DecoratedMoneySchema;\n // Resource-level decorators (applicable to all types including ZodObject)\n [ZodDecorator.IS_SUMMARY_FIELD](params?: SummaryFieldParams): DecoratedMoneySchema;\n [ZodDecorator.IS_BACKEND_ONLY](params?: ZodDecorator_ParamsType[ZodDecorator.IS_BACKEND_ONLY]): DecoratedMoneySchema;\n [ZodDecorator.IS_WRITE_ONLY_SECRET](params?: ZodDecorator_ParamsType[ZodDecorator.IS_WRITE_ONLY_SECRET]): DecoratedMoneySchema;\n [ZodDecorator.EXCLUDE_FROM_CREATE](): DecoratedMoneySchema;\n [ZodDecorator.EXCLUDE_FROM_UPDATE](): DecoratedMoneySchema;\n addDecorators(decorators: DecoratorInput[]): DecoratedMoneySchema;\n};\n\n/**\n * Creates a money schema for financial amounts with integer storage.\n * Named z_money to indicate it's a Zod helper function exported standalone.\n *\n * Money values are stored as: { amount: int, currency: string, decimals: int }\n * - amount: Value in smallest unit (e.g., cents for USD, satoshis for BTC)\n * - currency: ISO 4217 code (e.g., 'USD', 'EUR', 'BTC')\n * - decimals: Decimal places for display conversion (e.g., 2 for USD, 8 for BTC)\n *\n * @example\n * ```typescript\n * import { z_money } from '@wildo-ai/zod-decorators';\n *\n * // Simple usage\n * z_money() // All currencies\n *\n * // With options\n * z_money({ currenciesAllowed: [CurrencyAllowed.FIAT] })\n * z_money({ allowCurrencyChange: false }).moneyUI({ edit: { defaultCurrency: 'USD' } })\n * z_money({ currenciesAllowed: [CurrencyAllowed.FIAT_MAJOR], minAmount: 0n })\n *\n * // With decorators (chainable)\n * z_money().moneyUI({ edit: { defaultCurrency: 'USD' } })\n * z_money({ currenciesAllowed: [CurrencyAllowed.FIAT] }).isHidden({ edit: true })\n *\n * // Usage example\n * const price: MoneyValue = { amount: 1999n, currency: 'USD', decimals: 2 };\n * // Represents $19.99\n * ```\n */\nexport function z_money(\n options?: MoneySchemaOptions\n): DecoratedMoneySchema {\n return createMoneySchema(options) as DecoratedMoneySchema;\n}\n/** @wildo_source:part:end zod.factories.money */\n\n// ============================================================================\n// MONEY UTILITY FUNCTIONS\n// ============================================================================\n\n/**\n * Why an amount could not be expressed in its currency's smallest unit.\n *\n * A named vocabulary rather than three bare strings, because each member has a DIFFERENT remedy and\n * an operator reading a sync log needs to know which one they are looking at: an unknown minor unit\n * is a catalogue problem, a precision loss is an authoring problem, and an unsafe magnitude is a\n * limit of the provider's own number type.\n */\nexport enum MoneyMinorUnitConversionFailure {\n /** The currency has no minor unit (`XDR`, `XXX`) or is not one this vocabulary knows. */\n UNKNOWN_MINOR_UNIT = 'unknown_minor_unit',\n /** Converting down would discard a fraction of the provider's smallest unit. */\n PRECISION_LOSS = 'precision_loss',\n /** The converted amount cannot be represented exactly as a JavaScript number. */\n UNSAFE_MAGNITUDE = 'unsafe_magnitude',\n}\n\n/** Thrown by {@link toCurrencyMinorUnitAmountOrThrow}; carries the reason so a caller can branch. */\nexport class MoneyMinorUnitConversionError extends Error {\n constructor(\n public readonly reason: MoneyMinorUnitConversionFailure,\n message: string,\n ) {\n super(message);\n this.name = 'MoneyMinorUnitConversionError';\n }\n}\n\n/**\n * Convert a {@link MoneyValue} to the amount a payment provider expects: an integer in the CURRENCY's\n * smallest unit.\n *\n * Wildo stores money at an AUTHORED scale (`decimals` on the value); a provider reads it at the\n * currency's own scale. Those are two different numbers whenever they disagree, and until 2026-09-08\n * the billing boundary sent the stored amount straight through — so a price authored at any scale\n * other than the currency's was charged at the wrong magnitude, by a factor of 10 per decimal place\n * of disagreement.\n *\n * **All arithmetic is `bigint`.** The stored amount already is one, and the whole reason it is a\n * bigint rather than a number is that money must not round; converting through a float to save a cast\n * would give that back at exactly the boundary where it costs money.\n *\n * **Scaling UP is always exact. Scaling DOWN refuses on a remainder rather than rounding** — a price\n * of 1.005 in a currency whose smallest unit is a cent is not 1.00 and not 1.01, it is a price the\n * provider cannot express, and silently picking one is how a catalogue and an invoice come to\n * disagree by a cent per unit forever.\n *\n * **Throws rather than returning a result union**, and the reason is the compiler rather than taste:\n * this repository compiles with `strict: false` (`engine/tsconfig.common.json`), which disables the\n * discriminant narrowing a `{ ok: true } | { ok: false }` result depends on — so every caller would\n * need a cast to read the failure, at every boundary. A typed error narrows by `instanceof`, which\n * works regardless. Callers that must not throw resolve the scale directly with\n * `currencyMinorUnitDecimals` and decide for themselves.\n *\n * @param subject what the message names (\"price p_1 tier 2 flat amount\"), so an operator reading a\n * sync log knows which amount could not be expressed without opening the catalogue.\n */\nexport function toCurrencyMinorUnitAmountOrThrow(value: MoneyValue, subject: string): number {\n const target = currencyMinorUnitDecimals(value.currency);\n if (target === undefined) {\n throw new MoneyMinorUnitConversionError(\n MoneyMinorUnitConversionFailure.UNKNOWN_MINOR_UNIT,\n `Cannot express ${subject} for a payment provider: currency '${value.currency}' has no minor unit this framework can resolve. Cryptocurrencies are in this position deliberately — their decimals are protocol conventions, not a fiat provider's minor unit.`,\n );\n }\n\n let converted: bigint;\n if (value.decimals === target) {\n converted = value.amount;\n } else if (value.decimals < target) {\n converted = value.amount * 10n ** BigInt(target - value.decimals);\n } else {\n const divisor = 10n ** BigInt(value.decimals - target);\n if (value.amount % divisor !== 0n) {\n throw new MoneyMinorUnitConversionError(\n MoneyMinorUnitConversionFailure.PRECISION_LOSS,\n `Cannot express ${subject} for a payment provider: amount ${value.amount} at scale ${value.decimals} cannot be written in ${value.currency}'s smallest unit (scale ${target}) without discarding a fraction of it. Author the amount at scale ${target}, or at a scale whose extra digits are zero.`,\n );\n }\n converted = value.amount / divisor;\n }\n\n const asNumber = Number(converted);\n if (!Number.isSafeInteger(asNumber)) {\n throw new MoneyMinorUnitConversionError(\n MoneyMinorUnitConversionFailure.UNSAFE_MAGNITUDE,\n `Cannot express ${subject} for a payment provider: amount ${converted} in ${value.currency}'s smallest unit exceeds the range a JavaScript number represents exactly, so handing it over would silently change its value.`,\n );\n }\n\n return asNumber;\n}\n\n/**\n * Convert a decimal amount to bigint representation.\n *\n * **Precision caveat:** This uses floating-point arithmetic internally\n * (`Math.round(decimalAmount * 10^decimals)`), which can produce rounding\n * errors for certain values. Prefer `parseDecimalStringToAmount` when working\n * with user input strings to avoid float precision issues entirely.\n *\n * @param decimalAmount - The decimal amount (e.g., 19.99)\n * @param decimals - Number of decimal places (e.g., 2)\n * @returns BigInt amount (e.g., 1999n)\n */\nexport function toMoneyAmount(decimalAmount: number, decimals: number): bigint {\n return BigInt(Math.round(decimalAmount * Math.pow(10, decimals)));\n}\n\n/**\n * Convert a bigint amount to decimal representation.\n * @param amount - The bigint amount (e.g., 1999n)\n * @param decimals - Number of decimal places (e.g., 2)\n * @returns Decimal amount (e.g., 19.99)\n */\nexport function fromMoneyAmount(amount: bigint, decimals: number): number {\n return Number(amount) / Math.pow(10, decimals);\n}\n\n/**\n * Convert a string or number to bigint safely.\n * Useful for parsing user input or JSON values.\n * @param value - String, number, or bigint to convert\n * @returns BigInt amount\n */\nexport function toBigIntAmount(value: string | number | bigint): bigint {\n if (typeof value === 'bigint') return value;\n if (typeof value === 'number') return BigInt(Math.round(value));\n return BigInt(value);\n}\n\n/**\n * Parse a decimal string directly to a bigint amount, avoiding floating-point\n * precision issues entirely.\n *\n * This is the preferred way to convert user input (e.g., from an HTML input\n * element) to a money amount. It works by splitting the string at the decimal\n * point and manipulating integer/fractional parts as strings, so no float\n * arithmetic is ever involved.\n *\n * - Extra fractional digits beyond `decimals` are **truncated** (not rounded).\n * - Missing fractional digits are **zero-padded**.\n *\n * @param input - A decimal string (e.g., \"19.99\", \"5\", \".50\", \"-12.345\")\n * @param decimals - Number of decimal places for the target currency\n * @returns BigInt amount, or `null` if the input is not a valid decimal string\n *\n * **Note:** Scientific notation strings (e.g., `\"1e+10\"`) are rejected (returns\n * `null`) since they are not valid monetary input. This is correct behavior when\n * reading from `<input type=\"number\">`, which may produce such strings for very\n * large values — those inputs should be constrained via `min`/`max` attributes.\n *\n * @example\n * ```typescript\n * parseDecimalStringToAmount(\"19.99\", 2) // → 1999n\n * parseDecimalStringToAmount(\"19.999\", 2) // → 1999n (truncates, not rounds)\n * parseDecimalStringToAmount(\"19.9\", 2) // → 1990n (pads missing decimals)\n * parseDecimalStringToAmount(\"5\", 2) // → 500n\n * parseDecimalStringToAmount(\".50\", 2) // → 50n\n * parseDecimalStringToAmount(\"-12.34\", 2) // → -1234n\n * parseDecimalStringToAmount(\"abc\", 2) // → null\n * parseDecimalStringToAmount(\"1e+10\", 2) // → null (scientific notation rejected)\n * ```\n */\nexport function parseDecimalStringToAmount(input: string, decimals: number): bigint | null {\n const trimmed = input.trim();\n if (trimmed === '' || trimmed === '.' || trimmed === '-' || trimmed === '-.') return null;\n\n // Handle sign\n const isNegative = trimmed.startsWith('-');\n const unsigned = isNegative ? trimmed.slice(1) : trimmed;\n\n // Validate: only digits and at most one decimal point\n if (!/^\\d*\\.?\\d*$/.test(unsigned)) return null;\n\n const dotIndex = unsigned.indexOf('.');\n const integerPart = dotIndex === -1 ? unsigned : (unsigned.slice(0, dotIndex) || '0');\n const fractionalRaw = dotIndex === -1 ? '' : unsigned.slice(dotIndex + 1);\n\n // Pad or truncate fractional part to exactly `decimals` digits\n const fractionalPart = decimals === 0\n ? ''\n : fractionalRaw.padEnd(decimals, '0').slice(0, decimals);\n\n // Build the combined string and convert to bigint\n const combined = integerPart + fractionalPart;\n // Guard against empty combined (shouldn't happen after validation, but be safe)\n if (combined === '') return 0n;\n\n try {\n const result = BigInt(combined);\n return isNegative ? -result : result;\n } catch {\n return null;\n }\n}\n\n/**\n * Convert a money amount from one decimal precision to another using pure\n * bigint arithmetic (no floating-point involved).\n *\n * Use this when changing a currency (which may have different decimal places)\n * instead of the float roundtrip `fromMoneyAmount` → `toMoneyAmount`.\n *\n * - When increasing decimals (e.g., 2 → 8): multiplies by 10^(diff)\n * - When decreasing decimals (e.g., 8 → 2): divides with half-away-from-zero rounding\n *\n * @param amount - The bigint amount in the source precision\n * @param fromDecimals - Source decimal places\n * @param toDecimals - Target decimal places\n * @returns BigInt amount in the target precision\n *\n * @example\n * ```typescript\n * convertMoneyDecimals(1999n, 2, 2) // → 1999n (same decimals, no-op)\n * convertMoneyDecimals(1999n, 2, 4) // → 199900n (scale up)\n * convertMoneyDecimals(199900n, 4, 2) // → 1999n (scale down)\n * convertMoneyDecimals(12345678n, 8, 2) // → 12n (BTC satoshis to 2-decimal)\n * ```\n */\nexport function convertMoneyDecimals(amount: bigint, fromDecimals: number, toDecimals: number): bigint {\n if (fromDecimals === toDecimals) return amount;\n\n const diff = toDecimals - fromDecimals;\n\n if (diff > 0) {\n // Scale up: multiply\n return amount * (10n ** BigInt(diff));\n }\n\n // Scale down: divide with rounding (half-away-from-zero)\n const divisor = 10n ** BigInt(-diff);\n const isNegative = amount < 0n;\n const absAmount = isNegative ? -amount : amount;\n const rounded = (absAmount + divisor / 2n) / divisor;\n return isNegative ? -rounded : rounded;\n}\n\n/**\n * Format a money value for display.\n * @param money - The money value\n * @param options - Formatting options\n * @returns Formatted string (e.g., \"$19.99\" or \"19.99 USD\")\n */\nexport function formatMoney(\n money: MoneyValue,\n options: {\n showSymbol?: boolean;\n symbolPosition?: 'before' | 'after';\n thousandsSeparator?: string;\n decimalSeparator?: string;\n } = {}\n): string {\n const {\n showSymbol = true,\n symbolPosition = 'before',\n thousandsSeparator = ',',\n decimalSeparator = '.',\n } = options;\n\n const decimalValue = fromMoneyAmount(money.amount, money.decimals);\n\n // Format with proper decimal places\n const [integerPart, decimalPart] = decimalValue.toFixed(money.decimals).split('.');\n\n // Add thousands separator\n const formattedInteger = integerPart.replace(/\\B(?=(\\d{3})+(?!\\d))/g, thousandsSeparator);\n\n const formattedNumber = decimalPart\n ? `${formattedInteger}${decimalSeparator}${decimalPart}`\n : formattedInteger;\n\n if (!showSymbol) {\n return formattedNumber;\n }\n\n // For now, use currency code as symbol (can be enhanced with CURRENCY_INFO_MAP)\n const symbol = money.currency;\n\n return symbolPosition === 'before'\n ? `${symbol} ${formattedNumber}`\n : `${formattedNumber} ${symbol}`;\n}\n\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod-phone.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"zod-phone.d.ts","sourceRoot":"","sources":["../../src/zod-phone.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,cAAc,EAGd,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,EACZ,uBAAu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BAAmB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAE9C,OAAO,WAA8C,CAAC;AACxD,CAAC;AAyBD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,OAAO,CAAC,OAA4B;IAClD,OAAO,iBAAiB,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC;AACD,iDAAiD","sourcesContent":["// ============================================================================\n// PHONE SCHEMA HELPER\n// ============================================================================\n\nimport type {\n DecoratorInput,\n CustomFieldMetadata,\n PhoneSchemaMetadata,\n PhoneSchemaOptions,\n SummaryFieldParams,\n ZodDecorator,\n ZodDecorator_ParamsType,\n} from './zod-decorators.types';\nimport { SCHEMA_METADATA } from './zod-decorators.types';\nimport { z } from 'zod';\nimport { addChainableMethods } from './zod.module-override';\nimport {\n parsePhoneNumberFromString,\n isValidPhoneNumber,\n getCountries as getCountriesFromLib,\n type CountryCode,\n getCountryCallingCode,\n formatIncompletePhoneNumber,\n getExampleNumber,\n AsYouType,\n} from 'libphonenumber-js';\n// JS-module subpath (NOT the .json subpath): importable under native ESM\n// without JSON import attributes, so the same source compiles for Node and\n// browser consumers alike. Example numbers back per-country placeholders.\nimport phoneExamples from 'libphonenumber-js/mobile/examples';\n\n/** Returns country codes (e.g. \"US\", \"FR\") for form components. */\nexport function getCountries(): string[] {\n return getCountriesFromLib() as string[];\n}\n\n/**\n * Phone value type — E.164 string (e.g., \"+33123456789\").\n * Use formatPhoneNumber() for display, parsePhoneNumber() for parsing.\n */\nexport type PhoneValue = string;\n\n/** Default country when parsing numbers without country code */\nconst DEFAULT_COUNTRY: CountryCode = 'US';\n\n/**\n * Parse a phone string to PhoneNumber or undefined.\n *\n * @param value - Raw input (E.164, national, or partial)\n * @param defaultCountry - Country code (e.g. \"US\", \"FR\") for numbers without +prefix\n * @returns PhoneNumber or undefined if invalid\n */\nexport function parsePhone(value: string, defaultCountry?: string): ReturnType<typeof parsePhoneNumberFromString> {\n if (!value || typeof value !== 'string') return undefined;\n const trimmed = value.trim();\n if (!trimmed) return undefined;\n const country = defaultCountry ?? DEFAULT_COUNTRY;\n return parsePhoneNumberFromString(trimmed, { defaultCountry: country as CountryCode });\n}\n\n/**\n * Validate a phone number string.\n *\n * @param value - Phone string to validate\n * @param defaultCountry - Country code (e.g. \"US\", \"FR\") for numbers without +prefix\n * @returns true if valid\n */\nexport function isValidPhone(value: string, defaultCountry?: string): boolean {\n if (!value || typeof value !== 'string') return false;\n const trimmed = value.trim();\n if (!trimmed) return false;\n const country = defaultCountry ?? DEFAULT_COUNTRY;\n return isValidPhoneNumber(trimmed, { defaultCountry: country as CountryCode });\n}\n\n/**\n * Format a phone number for display.\n *\n * @param value - E.164 or parseable phone string\n * @param defaultCountry - Country code (e.g. \"US\", \"FR\") for numbers without +prefix\n * @param format - 'international' | 'national' (default: international)\n * @returns Formatted string or original if unparseable\n */\nexport function formatPhoneNumber(\n value: string,\n defaultCountry?: string,\n format: 'international' | 'national' = 'international'\n): string {\n const parsed = parsePhone(value, defaultCountry);\n if (!parsed) return value;\n return format === 'national' ? parsed.formatNational() : parsed.formatInternational();\n}\n\n/**\n * Get country calling code (e.g., \"1\" for US).\n *\n * @param country - Country code (e.g. \"US\", \"FR\")\n */\nexport function getPhoneCountryCode(country: string): string {\n return getCountryCallingCode(country as CountryCode);\n}\n\n/**\n * Format a PARTIAL (as-you-type) national phone input for a country.\n *\n * Wraps libphonenumber's incomplete-number formatter so form controls can\n * format while the user is still typing (\"0612\" → \"06 12\" for FR) without\n * importing libphonenumber-js directly — the phone surface stays owned here.\n *\n * @param value - Partial national input (digits, may carry punctuation)\n * @param country - Country code (e.g. \"US\", \"FR\") providing the format plan\n * @returns The formatted partial, or the input unchanged when no plan applies\n */\nexport function formatPartialPhoneNumber(value: string, country?: string): string {\n if (!value) return value;\n const cc = (country ?? DEFAULT_COUNTRY) as CountryCode;\n return formatIncompletePhoneNumber(value, cc);\n}\n\n/**\n * Example national number for a country, for use as an input placeholder\n * (e.g. FR → \"06 12 34 56 78\"). Backed by libphonenumber's curated mobile\n * example set; returns undefined for countries without an example.\n *\n * @param country - Country code (e.g. \"US\", \"FR\")\n */\nexport function getExamplePhoneNumber(country: string): string | undefined {\n const example = getExampleNumber(country as CountryCode, phoneExamples);\n return example?.formatNational();\n}\n\n/**\n * Detect the country of a phone input that starts with an international\n * prefix (\"+...\"), even while the number is still incomplete.\n *\n * Powers the best-practice behavior where pasting/typing \"+49 30 ...\" into\n * the national input automatically switches the country selector to DE.\n * Returns undefined when the input is not international or the country is\n * not yet determinable (e.g. \"+1\" is ambiguous across NANP countries).\n *\n * @param value - Raw input, expected to start with \"+\"\n */\nexport function detectPhoneCountry(value: string): string | undefined {\n if (!value?.trim().startsWith('+')) return undefined;\n const formatter = new AsYouType();\n formatter.input(value.trim());\n return formatter.getCountry();\n}\n\n/**\n * @wildo_source:part:start zod.factories.phone facet:layer:shared facet:family:schema-factory\n *\n * Creates a phone schema with metadata for detection and form component rendering.\n * Values are stored as E.164 strings. Empty string passes validation.\n *\n * @param options - Configuration options for phone field\n * @returns A Zod string schema with metadata for phone detection\n */\nexport function createPhoneSchema(options: PhoneSchemaOptions = {}): DecoratedPhoneSchema {\n const { defaultCountry = DEFAULT_COUNTRY } = options;\n\n const phoneMetadata: PhoneSchemaMetadata = {\n isPhone: true,\n defaultCountry,\n };\n\n // PhoneCountryCode is libphonenumber's CountryCode union, so no cast needed.\n const country: CountryCode = defaultCountry;\n const phoneSchema = z\n .string()\n .trim()\n .refine((val) => val === '' || isValidPhone(val, country), {\n message: 'Invalid phone number',\n })\n // E.164 normalization is string -> string, so model it as a Zod 4\n // overwrite rather than a transform. The runtime result is identical, but\n // the schema remains truthfully introspectable as a string by JSON Schema /\n // OpenAPI generators instead of degrading to an unrepresentable transform.\n .overwrite((val) => {\n if (val === '') return '';\n const parsed = parsePhone(val, country);\n return parsed?.format('E.164') ?? val;\n })\n // Preserve the established ZodPipe surface used by decorator metadata and\n // boundary walkers; the terminal string adds no value conversion.\n .pipe(z.string()) as unknown as z.ZodString;\n\n const existingMetadata: CustomFieldMetadata = (phoneSchema as any)[SCHEMA_METADATA] || {};\n (phoneSchema as any)[SCHEMA_METADATA] = {\n ...existingMetadata,\n phoneConfig: phoneMetadata,\n };\n\n // 'ZodString' rather than the instance's own constructor, which is `ZodPipe` because of the\n // `.pipe(z.string())` above. A phone IS a string for every decorator purpose — the pipe exists to\n // normalize to E.164, not to change what the field is — and without this the applyable-type\n // lookup matches nothing and the schema carries NO decorators at all, including the eight\n // `DecoratedPhoneSchema` declares.\n addChainableMethods(phoneSchema, 'ZodString');\n\n return phoneSchema as unknown as DecoratedPhoneSchema;\n}\n\n/**\n * Return type for phone schemas - includes decorator methods.\n */\nexport type DecoratedPhoneSchema = z.ZodString & {\n [ZodDecorator.IS_DB_INDEXED](): DecoratedPhoneSchema;\n [ZodDecorator.IS_HIDDEN](params?: ZodDecorator_ParamsType[ZodDecorator.IS_HIDDEN]): DecoratedPhoneSchema;\n [ZodDecorator.IS_NOT_EDITABLE](params?: ZodDecorator_ParamsType[ZodDecorator.IS_NOT_EDITABLE]): DecoratedPhoneSchema;\n [ZodDecorator.IS_SUMMARY_FIELD](params?: SummaryFieldParams): DecoratedPhoneSchema;\n [ZodDecorator.IS_BACKEND_ONLY](params?: ZodDecorator_ParamsType[ZodDecorator.IS_BACKEND_ONLY]): DecoratedPhoneSchema;\n [ZodDecorator.IS_WRITE_ONLY_SECRET](params?: ZodDecorator_ParamsType[ZodDecorator.IS_WRITE_ONLY_SECRET]): DecoratedPhoneSchema;\n [ZodDecorator.EXCLUDE_FROM_CREATE](): DecoratedPhoneSchema;\n [ZodDecorator.EXCLUDE_FROM_UPDATE](): DecoratedPhoneSchema;\n /**\n * Declared here, as the sibling factories declare theirs (`DecoratedMoneySchema.moneyUI`,\n * `DecoratedCodeSchema.codeUI`, …), because a phone's display and edit policy is authored on the\n * factory's output and nowhere else. The applyable-type map admits `phoneUI` on `ZodString`, but\n * a bare `z.string()` is not a phone, so the base prototype deliberately does not carry it.\n */\n [ZodDecorator.PHONE_UI](params?: ZodDecorator_ParamsType[ZodDecorator.PHONE_UI]): DecoratedPhoneSchema;\n [ZodDecorator.PHONE_SPEC](params?: ZodDecorator_ParamsType[ZodDecorator.PHONE_SPEC]): DecoratedPhoneSchema;\n addDecorators(decorators: DecoratorInput[]): DecoratedPhoneSchema;\n};\n\n/**\n * Creates a phone schema for E.164 phone numbers.\n *\n * @example\n * ```typescript\n * import { z_phone } from '@wildo-ai/zod-decorators';\n *\n * z_phone()\n * z_phone({ defaultCountry: 'FR' })\n * ```\n */\nexport function z_phone(options?: PhoneSchemaOptions): DecoratedPhoneSchema {\n return createPhoneSchema(options);\n}\n/** @wildo_source:part:end zod.factories.phone */\n"]}
|
|
1
|
+
{"version":3,"file":"zod-phone.js","sourceRoot":"","sources":["../../src/zod-phone.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,sBAAsB;AACtB,+EAA+E;AAW/E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,YAAY,IAAI,mBAAmB,EAEnC,qBAAqB,EACrB,2BAA2B,EAC3B,gBAAgB,EAChB,SAAS,GACV,MAAM,mBAAmB,CAAC;AAC3B,yEAAyE;AACzE,2EAA2E;AAC3E,0EAA0E;AAC1E,OAAO,aAAa,MAAM,mCAAmC,CAAC;AAE9D,mEAAmE;AACnE,MAAM,UAAU,YAAY;IAC1B,OAAO,mBAAmB,EAAc,CAAC;AAC3C,CAAC;AAQD,gEAAgE;AAChE,MAAM,eAAe,GAAgB,IAAI,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,cAAuB;IAC/D,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,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CAAC;QAC1B,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QACxC,OAAO,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC;IACxC,CAAC,CAAC;QACF,0EAA0E;QAC1E,kEAAkE;SACjE,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAA2B,CAAC;IAE9C,MAAM,gBAAgB,GAAyB,WAAmB,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;IACzF,WAAmB,CAAC,eAAe,CAAC,GAAG;QACtC,GAAG,gBAAgB;QACnB,WAAW,EAAE,aAAa;KAC3B,CAAC;IAEF,4FAA4F;IAC5F,kGAAkG;IAClG,4FAA4F;IAC5F,0FAA0F;IAC1F,mCAAmC;IACnC,mBAAmB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAE9C,OAAO,WAA8C,CAAC;AACxD,CAAC;AAyBD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,OAAO,CAAC,OAA4B;IAClD,OAAO,iBAAiB,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC;AACD,iDAAiD","sourcesContent":["// ============================================================================\n// PHONE SCHEMA HELPER\n// ============================================================================\n\nimport type {\n DecoratorInput,\n CustomFieldMetadata,\n PhoneSchemaMetadata,\n PhoneSchemaOptions,\n SummaryFieldParams,\n ZodDecorator,\n ZodDecorator_ParamsType,\n} from './zod-decorators.types';\nimport { SCHEMA_METADATA } from './zod-decorators.types';\nimport { z } from 'zod';\nimport { addChainableMethods } from './zod.module-override';\nimport {\n parsePhoneNumberFromString,\n isValidPhoneNumber,\n getCountries as getCountriesFromLib,\n type CountryCode,\n getCountryCallingCode,\n formatIncompletePhoneNumber,\n getExampleNumber,\n AsYouType,\n} from 'libphonenumber-js';\n// JS-module subpath (NOT the .json subpath): importable under native ESM\n// without JSON import attributes, so the same source compiles for Node and\n// browser consumers alike. Example numbers back per-country placeholders.\nimport phoneExamples from 'libphonenumber-js/mobile/examples';\n\n/** Returns country codes (e.g. \"US\", \"FR\") for form components. */\nexport function getCountries(): string[] {\n return getCountriesFromLib() as string[];\n}\n\n/**\n * Phone value type — E.164 string (e.g., \"+33123456789\").\n * Use formatPhoneNumber() for display, parsePhoneNumber() for parsing.\n */\nexport type PhoneValue = string;\n\n/** Default country when parsing numbers without country code */\nconst DEFAULT_COUNTRY: CountryCode = 'US';\n\n/**\n * Parse a phone string to PhoneNumber or undefined.\n *\n * @param value - Raw input (E.164, national, or partial)\n * @param defaultCountry - Country code (e.g. \"US\", \"FR\") for numbers without +prefix\n * @returns PhoneNumber or undefined if invalid\n */\nexport function parsePhone(value: string, defaultCountry?: string): ReturnType<typeof parsePhoneNumberFromString> {\n if (!value || typeof value !== 'string') return undefined;\n const trimmed = value.trim();\n if (!trimmed) return undefined;\n const country = defaultCountry ?? DEFAULT_COUNTRY;\n return parsePhoneNumberFromString(trimmed, { defaultCountry: country as CountryCode });\n}\n\n/**\n * Validate a phone number string.\n *\n * @param value - Phone string to validate\n * @param defaultCountry - Country code (e.g. \"US\", \"FR\") for numbers without +prefix\n * @returns true if valid\n */\nexport function isValidPhone(value: string, defaultCountry?: string): boolean {\n if (!value || typeof value !== 'string') return false;\n const trimmed = value.trim();\n if (!trimmed) return false;\n const country = defaultCountry ?? DEFAULT_COUNTRY;\n return isValidPhoneNumber(trimmed, { defaultCountry: country as CountryCode });\n}\n\n/**\n * Format a phone number for display.\n *\n * @param value - E.164 or parseable phone string\n * @param defaultCountry - Country code (e.g. \"US\", \"FR\") for numbers without +prefix\n * @param format - 'international' | 'national' (default: international)\n * @returns Formatted string or original if unparseable\n */\nexport function formatPhoneNumber(\n value: string,\n defaultCountry?: string,\n format: 'international' | 'national' = 'international'\n): string {\n const parsed = parsePhone(value, defaultCountry);\n if (!parsed) return value;\n return format === 'national' ? parsed.formatNational() : parsed.formatInternational();\n}\n\n/**\n * Get country calling code (e.g., \"1\" for US).\n *\n * @param country - Country code (e.g. \"US\", \"FR\")\n */\nexport function getPhoneCountryCode(country: string): string {\n return getCountryCallingCode(country as CountryCode);\n}\n\n/**\n * Format a PARTIAL (as-you-type) national phone input for a country.\n *\n * Wraps libphonenumber's incomplete-number formatter so form controls can\n * format while the user is still typing (\"0612\" → \"06 12\" for FR) without\n * importing libphonenumber-js directly — the phone surface stays owned here.\n *\n * @param value - Partial national input (digits, may carry punctuation)\n * @param country - Country code (e.g. \"US\", \"FR\") providing the format plan\n * @returns The formatted partial, or the input unchanged when no plan applies\n */\nexport function formatPartialPhoneNumber(value: string, country?: string): string {\n if (!value) return value;\n const cc = (country ?? DEFAULT_COUNTRY) as CountryCode;\n return formatIncompletePhoneNumber(value, cc);\n}\n\n/**\n * Example national number for a country, for use as an input placeholder\n * (e.g. FR → \"06 12 34 56 78\"). Backed by libphonenumber's curated mobile\n * example set; returns undefined for countries without an example.\n *\n * @param country - Country code (e.g. \"US\", \"FR\")\n */\nexport function getExamplePhoneNumber(country: string): string | undefined {\n const example = getExampleNumber(country as CountryCode, phoneExamples);\n return example?.formatNational();\n}\n\n/**\n * Detect the country of a phone input that starts with an international\n * prefix (\"+...\"), even while the number is still incomplete.\n *\n * Powers the best-practice behavior where pasting/typing \"+49 30 ...\" into\n * the national input automatically switches the country selector to DE.\n * Returns undefined when the input is not international or the country is\n * not yet determinable (e.g. \"+1\" is ambiguous across NANP countries).\n *\n * @param value - Raw input, expected to start with \"+\"\n */\nexport function detectPhoneCountry(value: string): string | undefined {\n if (!value?.trim().startsWith('+')) return undefined;\n const formatter = new AsYouType();\n formatter.input(value.trim());\n return formatter.getCountry();\n}\n\n/**\n * @wildo_source:part:start zod.factories.phone facet:layer:shared facet:family:schema-factory\n *\n * Creates a phone schema with metadata for detection and form component rendering.\n * Values are stored as E.164 strings. Empty string passes validation.\n *\n * @param options - Configuration options for phone field\n * @returns A Zod string schema with metadata for phone detection\n */\nexport function createPhoneSchema(options: PhoneSchemaOptions = {}): DecoratedPhoneSchema {\n const { defaultCountry = DEFAULT_COUNTRY } = options;\n\n const phoneMetadata: PhoneSchemaMetadata = {\n isPhone: true,\n defaultCountry,\n };\n\n // PhoneCountryCode is libphonenumber's CountryCode union, so no cast needed.\n const country: CountryCode = defaultCountry;\n const phoneSchema = z\n .string()\n .trim()\n .refine((val) => val === '' || isValidPhone(val, country), {\n message: 'Invalid phone number',\n })\n // E.164 normalization is string -> string, so model it as a Zod 4\n // overwrite rather than a transform. The runtime result is identical, but\n // the schema remains truthfully introspectable as a string by JSON Schema /\n // OpenAPI generators instead of degrading to an unrepresentable transform.\n .overwrite((val) => {\n if (val === '') return '';\n const parsed = parsePhone(val, country);\n return parsed?.format('E.164') ?? val;\n })\n // Preserve the established ZodPipe surface used by decorator metadata and\n // boundary walkers; the terminal string adds no value conversion.\n .pipe(z.string()) as unknown as z.ZodString;\n\n const existingMetadata: CustomFieldMetadata = (phoneSchema as any)[SCHEMA_METADATA] || {};\n (phoneSchema as any)[SCHEMA_METADATA] = {\n ...existingMetadata,\n phoneConfig: phoneMetadata,\n };\n\n // 'ZodString' rather than the instance's own constructor, which is `ZodPipe` because of the\n // `.pipe(z.string())` above. A phone IS a string for every decorator purpose — the pipe exists to\n // normalize to E.164, not to change what the field is — and without this the applyable-type\n // lookup matches nothing and the schema carries NO decorators at all, including the eight\n // `DecoratedPhoneSchema` declares.\n addChainableMethods(phoneSchema, 'ZodString');\n\n return phoneSchema as unknown as DecoratedPhoneSchema;\n}\n\n/**\n * Return type for phone schemas - includes decorator methods.\n */\nexport type DecoratedPhoneSchema = z.ZodString & {\n [ZodDecorator.IS_DB_INDEXED](): DecoratedPhoneSchema;\n [ZodDecorator.IS_HIDDEN](params?: ZodDecorator_ParamsType[ZodDecorator.IS_HIDDEN]): DecoratedPhoneSchema;\n [ZodDecorator.IS_NOT_EDITABLE](params?: ZodDecorator_ParamsType[ZodDecorator.IS_NOT_EDITABLE]): DecoratedPhoneSchema;\n [ZodDecorator.IS_SUMMARY_FIELD](params?: SummaryFieldParams): DecoratedPhoneSchema;\n [ZodDecorator.IS_BACKEND_ONLY](params?: ZodDecorator_ParamsType[ZodDecorator.IS_BACKEND_ONLY]): DecoratedPhoneSchema;\n [ZodDecorator.IS_WRITE_ONLY_SECRET](params?: ZodDecorator_ParamsType[ZodDecorator.IS_WRITE_ONLY_SECRET]): DecoratedPhoneSchema;\n [ZodDecorator.EXCLUDE_FROM_CREATE](): DecoratedPhoneSchema;\n [ZodDecorator.EXCLUDE_FROM_UPDATE](): DecoratedPhoneSchema;\n /**\n * Declared here, as the sibling factories declare theirs (`DecoratedMoneySchema.moneyUI`,\n * `DecoratedCodeSchema.codeUI`, …), because a phone's display and edit policy is authored on the\n * factory's output and nowhere else. The applyable-type map admits `phoneUI` on `ZodString`, but\n * a bare `z.string()` is not a phone, so the base prototype deliberately does not carry it.\n */\n [ZodDecorator.PHONE_UI](params?: ZodDecorator_ParamsType[ZodDecorator.PHONE_UI]): DecoratedPhoneSchema;\n [ZodDecorator.PHONE_SPEC](params?: ZodDecorator_ParamsType[ZodDecorator.PHONE_SPEC]): DecoratedPhoneSchema;\n addDecorators(decorators: DecoratorInput[]): DecoratedPhoneSchema;\n};\n\n/**\n * Creates a phone schema for E.164 phone numbers.\n *\n * @example\n * ```typescript\n * import { z_phone } from '@wildo-ai/zod-decorators';\n *\n * z_phone()\n * z_phone({ defaultCountry: 'FR' })\n * ```\n */\nexport function z_phone(options?: PhoneSchemaOptions): DecoratedPhoneSchema {\n return createPhoneSchema(options);\n}\n/** @wildo_source:part:end zod.factories.phone */\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod-range.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"zod-range.d.ts","sourceRoot":"","sources":["../../src/zod-range.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAA6D,kBAAkB,EAAE,SAAS,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACzL,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,SAAS,EACnD,IAAI,EAAE,CAAC,EACP,OAAO,GAAE,kBAAuB,GAC/B,oBAAoB,CAmEtB;AAED;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG;IACpD,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,oBAAoB,CAAC;IACrD,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,EAAE,uBAAuB,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,oBAAoB,CAAC;IACzG,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,EAAE,uBAAuB,CAAC,YAAY,CAAC,eAAe,CAAC,GAAG,oBAAoB,CAAC;IACrH,aAAa,CAAC,UAAU,EAAE,cAAc,EAAE,GAAG,oBAAoB,CAAC;CACnE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,SAAS,GAAG,GAAG,SAAS,EAAE,EAC1D,IAAI,EAAE,CAAC,EACP,OAAO,CAAC,EAAE,kBAAkB,GAC3B,oBAAoB,CAEtB;AACD,iDAAiD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod-range.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"zod-range.js","sourceRoot":"","sources":["../../src/zod-range.ts"],"names":[],"mappings":"AACA,+EAA+E;AAC/E,sBAAsB;AACtB,+EAA+E;AAE/E,OAAO,EAAkB,eAAe,EAAgE,SAAS,EAAE,YAAY,EAA2B,MAAM,wBAAwB,CAAC;AACzL,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,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,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;IAEjE,2BAA2B;IAC3B,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;QAC3B,IAAI,EAAE,UAAU;QAChB,EAAE,EAAE,QAAQ;KACb,CAAC,CAAC;IAEH,sDAAsD;IACtD,MAAM,aAAa,GAAwB;QACzC,OAAO,EAAE,IAAI;QACb,IAAI;QACJ,YAAY;QACZ,UAAU;QACV,GAAG,CAAC,GAAG,KAAK,SAAS,IAAI,EAAE,GAAG,EAAE,CAAC;QACjC,GAAG,CAAC,GAAG,KAAK,SAAS,IAAI,EAAE,GAAG,EAAE,CAAC;KAClC,CAAC;IAEF,yDAAyD;IACzD,MAAM,gBAAgB,GAAyB,WAAmB,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;IACzF,WAAmB,CAAC,eAAe,CAAC,GAAG;QACtC,GAAG,gBAAgB;QACnB,SAAS,EAAE,IAAI;QACf,WAAW,EAAE,aAAa;KAC3B,CAAC;IAEF,+DAA+D;IAC/D,uFAAuF;IACvF,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAEjC,OAAO,WAAmC,CAAC;AAC7C,CAAC;AAcD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,OAAO,CACrB,IAAO,EACP,OAA4B;IAE5B,OAAO,iBAAiB,CAAC,IAAiB,EAAE,OAAO,CAAyB,CAAC;AAC/E,CAAC;AACD,iDAAiD","sourcesContent":["\n// ============================================================================\n// RANGE SCHEMA HELPER\n// ============================================================================\n\nimport { DecoratorInput, SCHEMA_METADATA, CustomFieldMetadata, RangeSchemaMetadata, RangeSchemaOptions, RangeType, ZodDecorator, ZodDecorator_ParamsType } from \"./zod-decorators.types\";\nimport { z } from \"zod\";\nimport { addChainableMethods } from \"./zod.module-override\";\nimport { BigDecimalValueSchema } from \"./zod-bigdecimal\";\nimport { MoneyValueSchema } from \"./zod-money\";\n\n\n/**\n * @wildo_source:part:start zod.factories.range facet:layer:shared facet:family:schema-factory\n *\n * z_range() - Creates range schemas for number, date, datetime, or time ranges.\n *\n * This is a standalone Zod helper function (cannot be added to frozen Zod module at runtime).\n *\n * @example\n * ```typescript\n * import { z_range } from '@wildo-ai/saas-models';\n *\n * const priceRange = z_range('number', { min: 0, max: 1000 });\n * const dateRange = z_range('date');\n * const timeRange = z_range('time');\n *\n * // With decorators (chainable)\n * z_range('number').numberUI({ edit: { editMode: 'SLIDER' } })\n * z_range('date', { min: new Date() }).isHidden({ edit: true })\n * ```\n */\n\n/**\n * Creates a range object schema with `from` and `to` fields.\n * Stores metadata for easy detection and form component rendering.\n *\n * @param type - The type of values in the range\n * @param options - Configuration options for optionality and constraints\n * @returns A Zod object schema with metadata for range detection\n *\n * @example\n * ```typescript\n * // Simple number range (both optional)\n * const priceRange = z.range('number');\n * // Infers: { from?: number; to?: number }\n *\n * // Date range with required 'from'\n * const eventRange = z.range('date', { fromOptional: false });\n * // Infers: { from: Date; to?: Date }\n *\n * // Number range with min/max constraints\n * const ageRange = z.range('number', { min: 0, max: 120 });\n * // Infers: { from?: number; to?: number }\n * // Metadata includes min: 0, max: 120 for UI hints\n *\n * // Both required with constraints\n * const salaryRange = z.range('number', {\n * fromOptional: false,\n * toOptional: false,\n * min: 0,\n * });\n * // Infers: { from: number; to: number }\n * ```\n */\nexport function createRangeSchema<T extends RangeType>(\n type: T,\n options: RangeSchemaOptions = {}\n): DecoratedRangeSchema {\n const {\n fromOptional = true,\n toOptional = true,\n min,\n max,\n } = options;\n\n // Create the base schema for the value type\n let baseSchema: z.ZodTypeAny;\n\n switch (type) {\n case RangeType.NUMBER:\n baseSchema = z.number();\n break;\n case RangeType.DATE:\n baseSchema = z.date();\n break;\n case RangeType.DATETIME:\n baseSchema = z.iso.datetime();\n break;\n case RangeType.TIME:\n baseSchema = z.iso.time();\n break;\n case RangeType.BIGDECIMAL:\n baseSchema = BigDecimalValueSchema;\n break;\n case RangeType.MONEY:\n baseSchema = MoneyValueSchema;\n break;\n default:\n throw new Error(`Unknown range type: ${type}`);\n }\n\n // Create from/to schemas based on optionality\n const fromSchema = fromOptional ? baseSchema.optional() : baseSchema;\n const toSchema = toOptional ? baseSchema.optional() : baseSchema;\n\n // Create the object schema\n const rangeSchema = z.object({\n from: fromSchema,\n to: toSchema,\n });\n\n // Store range metadata in SCHEMA_METADATA.rangeConfig\n const rangeMetadata: RangeSchemaMetadata = {\n isRange: true,\n type,\n fromOptional,\n toOptional,\n ...(min !== undefined && { min }),\n ...(max !== undefined && { max }),\n };\n\n // Initialize or extend SCHEMA_METADATA with range config\n const existingMetadata: CustomFieldMetadata = (rangeSchema as any)[SCHEMA_METADATA] || {};\n (rangeSchema as any)[SCHEMA_METADATA] = {\n ...existingMetadata,\n rangeType: type,\n rangeConfig: rangeMetadata,\n };\n\n // Add chainable decorator methods to the range schema instance\n // This allows: z_range('number').numberUI({ edit: { editMode: 'SLIDER' } }).isHidden()\n addChainableMethods(rangeSchema);\n\n return rangeSchema as DecoratedRangeSchema;\n}\n\n/**\n * Return type for range schemas - includes decorator methods.\n * Note: IS_FOREIGN_KEY is not applicable to range objects.\n * IS_DB_INDEXED will index internal fields (from, to) for range query optimization.\n */\nexport type DecoratedRangeSchema = z.ZodObject<any> & {\n [ZodDecorator.IS_DB_INDEXED](): DecoratedRangeSchema;\n [ZodDecorator.IS_HIDDEN](params?: ZodDecorator_ParamsType[ZodDecorator.IS_HIDDEN]): DecoratedRangeSchema;\n [ZodDecorator.IS_NOT_EDITABLE](params?: ZodDecorator_ParamsType[ZodDecorator.IS_NOT_EDITABLE]): DecoratedRangeSchema;\n addDecorators(decorators: DecoratorInput[]): DecoratedRangeSchema;\n};\n\n/**\n * Creates a range object schema with `from` and `to` fields.\n * Named z_range to indicate it's a Zod helper function exported standalone.\n *\n * @example\n * ```typescript\n * import { z_range } from '@wildo-ai/saas-models';\n *\n * // Simple usage\n * z_range('number') // { from?: number; to?: number }\n * z_range('date') // { from?: Date; to?: Date }\n *\n * // With options\n * z_range('number', { fromOptional: false, min: 0 })\n * z_range('datetime', { toOptional: false })\n *\n * // With decorators (chainable)\n * z_range('number').numberUI({ edit: { editMode: 'SLIDER' } })\n * z_range('date', { min: new Date() }).isHidden({ edit: true })\n * ```\n */\nexport function z_range<T extends RangeType | `${RangeType}`>(\n type: T,\n options?: RangeSchemaOptions\n): DecoratedRangeSchema {\n return createRangeSchema(type as RangeType, options) as DecoratedRangeSchema;\n}\n/** @wildo_source:part:end zod.factories.range */\n"]}
|
|
@@ -236,9 +236,14 @@ export declare function isZodArray(schema: z.ZodTypeAny): boolean;
|
|
|
236
236
|
* validate against. `reset_to_defaults` depended on exactly such a constraint to reject a request
|
|
237
237
|
* naming no preference block, and without it the route answered HTTP 200 having written nothing.
|
|
238
238
|
*
|
|
239
|
-
* Native `.clone()` re-instantiates from the schema's own definition, so checks
|
|
240
|
-
*
|
|
241
|
-
*
|
|
239
|
+
* Native `.clone()` re-instantiates from the schema's own definition, so checks and error maps
|
|
240
|
+
* survive by construction rather than by a copy loop that the next Zod version could outgrow.
|
|
241
|
+
*
|
|
242
|
+
* `z.globalRegistry` metadata (`.describe()`, `.meta()`) does NOT come with it: Zod links a clone to
|
|
243
|
+
* its source, which is how a clone inherits that metadata, only when no new definition is passed,
|
|
244
|
+
* and this always passes one. Measured, 2026-09-26: a billing-state `invoices` array lost its
|
|
245
|
+
* description to date coercion, so the API reference published it undescribed (#1625). It is copied
|
|
246
|
+
* explicitly below, without `id`, which names one schema and which Zod refuses to register twice.
|
|
242
247
|
*
|
|
243
248
|
* @param arraySchema - the array being rewritten. Returned untouched when it is not an array or
|
|
244
249
|
* carries no element, so callers do not need to pre-check.
|
|
@@ -282,6 +287,20 @@ export declare function hasRefine(schema: z.ZodTypeAny): boolean;
|
|
|
282
287
|
* to be rendered with appropriate range components instead of as composite objects.
|
|
283
288
|
*/
|
|
284
289
|
export declare function getSchemaType(schema: z.ZodTypeAny): FieldSchemaType;
|
|
290
|
+
/**
|
|
291
|
+
* Does this schema HOLD FIELDS of the resource — so a walk that labels by field path descends into it — rather
|
|
292
|
+
* than being a scalar or a structured value whose parts are its own (money, address, duration, code, file, every
|
|
293
|
+
* range)? See {@link FIELD_SCHEMA_TYPE_HOLDS_FIELDS} for why the two are different and why the answer is read off
|
|
294
|
+
* {@link getSchemaType} rather than off a list of value types.
|
|
295
|
+
*
|
|
296
|
+
* Takes the schema as declared, wrappers included: `getSchemaType` recognises every structured value through its
|
|
297
|
+
* wrappers, so `z_money().optional()` answers `false` like `z_money()` does.
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* isFieldContainerSchema(z.object({ city: z.string() })); // true — `address.city` is a field
|
|
301
|
+
* isFieldContainerSchema(z_address()); // false — `line1` is the address's, not the resource's
|
|
302
|
+
*/
|
|
303
|
+
export declare function isFieldContainerSchema(schema: z.ZodTypeAny): boolean;
|
|
285
304
|
export declare function inferFieldSchemaTypeFromValue(value: unknown): FieldSchemaType | undefined;
|
|
286
305
|
/**
|
|
287
306
|
* Get the shape of a Zod object schema.
|
|
@@ -594,6 +613,16 @@ export declare function getArrayConstraints(schema: z.ZodTypeAny): {
|
|
|
594
613
|
* Unwraps first, so an `.optional()` / `.default()` / `.nullable()` record answers like a bare one.
|
|
595
614
|
*/
|
|
596
615
|
export declare function getRecordValueSchema(schema: z.ZodTypeAny): z.ZodTypeAny | null;
|
|
616
|
+
/**
|
|
617
|
+
* The KEY schema of a RECORD, or `null` when the schema is not a record — {@link getRecordValueSchema}'s twin.
|
|
618
|
+
*
|
|
619
|
+
* A record's keys are data, but they can still belong to a named vocabulary: an organization's `limits` is keyed by
|
|
620
|
+
* limit identifiers, declared `z.record(z.string().systemEnum('Limit'), …)`, and a display reads each key's word
|
|
621
|
+
* through the vocabulary the key schema names (#1851) instead of printing the identifier.
|
|
622
|
+
*
|
|
623
|
+
* Unwraps first, like {@link getRecordValueSchema}.
|
|
624
|
+
*/
|
|
625
|
+
export declare function getRecordKeySchema(schema: z.ZodTypeAny): z.ZodTypeAny | null;
|
|
597
626
|
/**
|
|
598
627
|
* The element schema of a SET, or `null` when the schema is not a set.
|
|
599
628
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod-utils.shared.d.ts","sourceRoot":"","sources":["../../../src/zod-utils.shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EACV,aAAa,EAAE,kBAAkB,EAAE,eAAe,EAAE,YAAY,EAChE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,YAAY,EAC9D,YAAY,EAAE,kBAAkB,EAAE,aAAa,EAAE,cAAc,EAC/D,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EACpC,yBAAyB,EAAE,4BAA4B,EAC/E,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,YAAY,EAAE,oBAAoB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACjJ,OAAO,EAAuB,sBAAsB,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,wBAAwB,EAC9H,sBAAsB,EAAE,kBAAkB,EAAoC,wBAAwB,EAAwB,kBAAkB,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,mBAAmB,EAAkB,eAAe,EAAE,kBAAkB,EAAE,iBAAiB,EAA4B,sBAAsB,EAAE,cAAc,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,SAAS,EAAmB,qBAAqB,EAAE,kBAAkB,EAAkB,iCAAiC,EAAE,uBAAuB,EAAE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,cAAc,EAAE,cAAc,EAA4B,MAAM,wBAAwB,CAAC;AASryB,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI;IAAE,GAAG,EAAE;QAAE,IAAI,EAAE,M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,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,GAAG,kBAAkB,GAAG,SAAS,CAEpF;AACD,wBAAgB,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,GAAG,OAAO,CAE7D;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,GAAG,aAAa,GAAG,SAAS,CAE1E;AACD,wBAAgB,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,GAAG,OAAO,CAExD;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,GAAG,cAAc,GAAG,SAAS,CAE5E;AACD,wBAAgB,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,GAAG,OAAO,CAEzD"}
|
|
@@ -523,9 +523,14 @@ export function isZodArray(schema) {
|
|
|
523
523
|
* validate against. `reset_to_defaults` depended on exactly such a constraint to reject a request
|
|
524
524
|
* naming no preference block, and without it the route answered HTTP 200 having written nothing.
|
|
525
525
|
*
|
|
526
|
-
* Native `.clone()` re-instantiates from the schema's own definition, so checks
|
|
527
|
-
*
|
|
528
|
-
*
|
|
526
|
+
* Native `.clone()` re-instantiates from the schema's own definition, so checks and error maps
|
|
527
|
+
* survive by construction rather than by a copy loop that the next Zod version could outgrow.
|
|
528
|
+
*
|
|
529
|
+
* `z.globalRegistry` metadata (`.describe()`, `.meta()`) does NOT come with it: Zod links a clone to
|
|
530
|
+
* its source, which is how a clone inherits that metadata, only when no new definition is passed,
|
|
531
|
+
* and this always passes one. Measured, 2026-09-26: a billing-state `invoices` array lost its
|
|
532
|
+
* description to date coercion, so the API reference published it undescribed (#1625). It is copied
|
|
533
|
+
* explicitly below, without `id`, which names one schema and which Zod refuses to register twice.
|
|
529
534
|
*
|
|
530
535
|
* @param arraySchema - the array being rewritten. Returned untouched when it is not an array or
|
|
531
536
|
* carries no element, so callers do not need to pre-check.
|
|
@@ -539,7 +544,14 @@ export function withArrayElement(arraySchema, element) {
|
|
|
539
544
|
if (!def) {
|
|
540
545
|
return arraySchema;
|
|
541
546
|
}
|
|
542
|
-
|
|
547
|
+
const rebuilt = arraySchema.clone({ ...def, element });
|
|
548
|
+
const registered = z.globalRegistry.get(arraySchema);
|
|
549
|
+
if (registered !== undefined && !z.globalRegistry.has(rebuilt)) {
|
|
550
|
+
const { id: _id, ...carried } = registered;
|
|
551
|
+
if (Object.keys(carried).length > 0)
|
|
552
|
+
z.globalRegistry.add(rebuilt, carried);
|
|
553
|
+
}
|
|
554
|
+
return rebuilt;
|
|
543
555
|
}
|
|
544
556
|
export function isZodOptional(schema) {
|
|
545
557
|
return hasZodType(schema, 'optional');
|
|
@@ -819,6 +831,79 @@ export function getSchemaType(schema) {
|
|
|
819
831
|
default: return FieldSchemaType.UNKNOWN;
|
|
820
832
|
}
|
|
821
833
|
}
|
|
834
|
+
/**
|
|
835
|
+
* Which classified schema types HOLD FIELDS — parts that are fields of the resource in their own right, each
|
|
836
|
+
* labelled, displayed and validated under its own dotted path (`privacy.consentedPurposes`) — as opposed to
|
|
837
|
+
* being ONE value whose parts belong to the value.
|
|
838
|
+
*
|
|
839
|
+
* A structured value is a Zod object too: `z_money()` is `{ amount, currency, decimals }`, `z_address()` is
|
|
840
|
+
* `{ line1, …, coordinates }`, every `z_range()` is `{ from, to }`. But its parts are not fields. The value's
|
|
841
|
+
* own component draws and names them (`LOW_LEVEL_FORM_FIELD_ADDRESS` carries `line1`, the money field reads the
|
|
842
|
+
* currency through `system_enums`), so the resource has exactly ONE word for the whole value — its field label —
|
|
843
|
+
* and no word for any part. Walking into a structured value as if it were a nested object is how the application
|
|
844
|
+
* labelling planner came to generate, translate and ship `fields.amount.amount`, `fields.amount.currency` and
|
|
845
|
+
* `fields.amount.decimals` for a money field no screen ever looked up (#1959).
|
|
846
|
+
*
|
|
847
|
+
* A `Record` over the whole enum rather than a list of either half, so a classification added tomorrow is a
|
|
848
|
+
* compile error here until someone decides which it is — the label walk, the labelling planner, the frontend
|
|
849
|
+
* label introspection and the validation summary all read this one answer through {@link isFieldContainerSchema}.
|
|
850
|
+
*
|
|
851
|
+
* `VERSIONED_OBJECT` holds fields: `versioned()` returns the application's own object with two hidden bookkeeping
|
|
852
|
+
* fields added, and the display renders it through the plain object branch, child field by child field.
|
|
853
|
+
*/
|
|
854
|
+
const FIELD_SCHEMA_TYPE_HOLDS_FIELDS = {
|
|
855
|
+
[FieldSchemaType.OBJECT]: true,
|
|
856
|
+
[FieldSchemaType.VERSIONED_OBJECT]: true,
|
|
857
|
+
[FieldSchemaType.STRING]: false,
|
|
858
|
+
[FieldSchemaType.NUMBER]: false,
|
|
859
|
+
[FieldSchemaType.BIGINT]: false,
|
|
860
|
+
[FieldSchemaType.BOOLEAN]: false,
|
|
861
|
+
[FieldSchemaType.ENUM]: false,
|
|
862
|
+
[FieldSchemaType.DATE]: false,
|
|
863
|
+
/*
|
|
864
|
+
* An ARRAY is not a container of FIELDS: its items are rows of one schema, and a walk that labels by field
|
|
865
|
+
* steps through it to the item (index-free) and asks this question of the ITEM. SET, TUPLE, RECORD and MAP
|
|
866
|
+
* are never walked for field labels at all.
|
|
867
|
+
*/
|
|
868
|
+
[FieldSchemaType.ARRAY]: false,
|
|
869
|
+
[FieldSchemaType.SET]: false,
|
|
870
|
+
[FieldSchemaType.TUPLE]: false,
|
|
871
|
+
[FieldSchemaType.RECORD]: false,
|
|
872
|
+
[FieldSchemaType.MAP]: false,
|
|
873
|
+
[FieldSchemaType.TIME]: false,
|
|
874
|
+
[FieldSchemaType.DATETIME]: false,
|
|
875
|
+
[FieldSchemaType.RANGE_NUMBER]: false,
|
|
876
|
+
[FieldSchemaType.RANGE_DATE]: false,
|
|
877
|
+
[FieldSchemaType.RANGE_DATETIME]: false,
|
|
878
|
+
[FieldSchemaType.RANGE_TIME]: false,
|
|
879
|
+
[FieldSchemaType.RANGE_BIGDECIMAL]: false,
|
|
880
|
+
[FieldSchemaType.RANGE_MONEY]: false,
|
|
881
|
+
[FieldSchemaType.MONEY]: false,
|
|
882
|
+
[FieldSchemaType.BIGDECIMAL]: false,
|
|
883
|
+
[FieldSchemaType.CODE]: false,
|
|
884
|
+
[FieldSchemaType.FILE]: false,
|
|
885
|
+
[FieldSchemaType.DURATION]: false,
|
|
886
|
+
[FieldSchemaType.PHONE]: false,
|
|
887
|
+
[FieldSchemaType.ADDRESS]: false,
|
|
888
|
+
[FieldSchemaType.VERSIONED_FOREIGN_KEY]: false,
|
|
889
|
+
[FieldSchemaType.UNKNOWN]: false,
|
|
890
|
+
};
|
|
891
|
+
/**
|
|
892
|
+
* Does this schema HOLD FIELDS of the resource — so a walk that labels by field path descends into it — rather
|
|
893
|
+
* than being a scalar or a structured value whose parts are its own (money, address, duration, code, file, every
|
|
894
|
+
* range)? See {@link FIELD_SCHEMA_TYPE_HOLDS_FIELDS} for why the two are different and why the answer is read off
|
|
895
|
+
* {@link getSchemaType} rather than off a list of value types.
|
|
896
|
+
*
|
|
897
|
+
* Takes the schema as declared, wrappers included: `getSchemaType` recognises every structured value through its
|
|
898
|
+
* wrappers, so `z_money().optional()` answers `false` like `z_money()` does.
|
|
899
|
+
*
|
|
900
|
+
* @example
|
|
901
|
+
* isFieldContainerSchema(z.object({ city: z.string() })); // true — `address.city` is a field
|
|
902
|
+
* isFieldContainerSchema(z_address()); // false — `line1` is the address's, not the resource's
|
|
903
|
+
*/
|
|
904
|
+
export function isFieldContainerSchema(schema) {
|
|
905
|
+
return FIELD_SCHEMA_TYPE_HOLDS_FIELDS[getSchemaType(schema)];
|
|
906
|
+
}
|
|
822
907
|
// =============================================================================
|
|
823
908
|
// VALUE TYPE INFERENCE — the runtime twin of getSchemaType
|
|
824
909
|
// =============================================================================
|
|
@@ -1973,6 +2058,23 @@ export function getRecordValueSchema(schema) {
|
|
|
1973
2058
|
const valueSchema = getZodDefSchemaProperty(unwrapped, 'valueType');
|
|
1974
2059
|
return valueSchema ?? null;
|
|
1975
2060
|
}
|
|
2061
|
+
/**
|
|
2062
|
+
* The KEY schema of a RECORD, or `null` when the schema is not a record — {@link getRecordValueSchema}'s twin.
|
|
2063
|
+
*
|
|
2064
|
+
* A record's keys are data, but they can still belong to a named vocabulary: an organization's `limits` is keyed by
|
|
2065
|
+
* limit identifiers, declared `z.record(z.string().systemEnum('Limit'), …)`, and a display reads each key's word
|
|
2066
|
+
* through the vocabulary the key schema names (#1851) instead of printing the identifier.
|
|
2067
|
+
*
|
|
2068
|
+
* Unwraps first, like {@link getRecordValueSchema}.
|
|
2069
|
+
*/
|
|
2070
|
+
export function getRecordKeySchema(schema) {
|
|
2071
|
+
const unwrapped = unwrapSchema(schema);
|
|
2072
|
+
if (getZodType(unwrapped) !== 'record') {
|
|
2073
|
+
return null;
|
|
2074
|
+
}
|
|
2075
|
+
const keySchema = getZodDefSchemaProperty(unwrapped, 'keyType');
|
|
2076
|
+
return keySchema ?? null;
|
|
2077
|
+
}
|
|
1976
2078
|
/**
|
|
1977
2079
|
* The element schema of a SET, or `null` when the schema is not a set.
|
|
1978
2080
|
*
|