diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/.github/CR_logotype-full-color.png b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/.github/CR_logotype-full-color.png new file mode 100644 index 0000000000000000000000000000000000000000..c6bd7efd3dcc31dc9a0000194c8b3a8369bb764b Binary files /dev/null and b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/.github/CR_logotype-full-color.png differ diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/.github/FUNDING.yml b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/.github/FUNDING.yml new file mode 100644 index 0000000000000000000000000000000000000000..cce355c092d231a5ca4e1ef3365a1770334fc88d --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/.github/FUNDING.yml @@ -0,0 +1 @@ +github: [StefanTerdell] diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/.prettierrc.json b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/.prettierrc.json new file mode 100644 index 0000000000000000000000000000000000000000..0967ef424bce6791893e9a57bb952f80fd536e93 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/.prettierrc.json @@ -0,0 +1 @@ +{} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/LICENSE b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..406daaf2d775f8a620662ea0dc5ed70e0f5668bf --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/LICENSE @@ -0,0 +1,15 @@ +ISC License + +Copyright (c) 2020, Stefan Terdell + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/README.md b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/README.md new file mode 100644 index 0000000000000000000000000000000000000000..57bc4ba1a98eb3f7fba2dc5790d5d0f01575c1fd --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/README.md @@ -0,0 +1,390 @@ +# Zod to Json Schema + +[![NPM Version](https://img.shields.io/npm/v/zod-to-json-schema.svg)](https://npmjs.org/package/zod-to-json-schema) +[![NPM Downloads](https://img.shields.io/npm/dw/zod-to-json-schema.svg)](https://npmjs.org/package/zod-to-json-schema) + +## Notice of deprecation + +As of November 2025, this project will no longer be actively maintained. [Zod v4 natively supports generating JSON schemas](https://zod.dev/json-schema#ztojsonschema), so I recommend you switch to the new major. + +Thank you to all the contributors and sponsors throughout the years! So long, and thanks for all the fish. + +## Summary + +Does what it says on the tin; converts [Zod schemas](https://github.com/colinhacks/zod) into [JSON schemas](https://json-schema.org/)! + +- Supports all relevant schema types, basic string, number and array length validations and string patterns. +- Resolves recursive and recurring schemas with internal `$ref`s. +- Supports targeting legacy Open API 3.0 specification (3.1 supports regular Json Schema). +- Supports Open AI strict mode schemas (Optional object properties are replaced with required but nullable ones). +- As of v3.25 you can use Zod v4 as a peer-dependency, so long as you still provide v3-schemas. + +_Looking for the exact opposite? Check out [json-schema-to-zod](https://npmjs.org/package/json-schema-to-zod)_ + +## Sponsors + +As this project will no longer be receiving updates I am no longer accepting new partnerships. Huge shout-out to CodeRabbit for keeping it real to the end <3 + + + + + +
+

+

+

+ + + + CodeRabbit logo + + +
+
+ Cut code review time & bugs in half +
+ coderabbit.ai +

+

+
+ +## Usage + +### Basic example + +```typescript +import { z } from "zod"; // Or, using v3.25 or v4, "zod/v3" +import { zodToJsonSchema } from "zod-to-json-schema"; + +const mySchema = z + .object({ + myString: z.string().min(5), + myUnion: z.union([z.number(), z.boolean()]), + }) + .describe("My neat object schema"); + +const jsonSchema = zodToJsonSchema(mySchema, "mySchema"); +``` + +#### Expected output + +```json +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$ref": "#/definitions/mySchema", + "definitions": { + "mySchema": { + "description": "My neat object schema", + "type": "object", + "properties": { + "myString": { + "type": "string", + "minLength": 5 + }, + "myUnion": { + "type": ["number", "boolean"] + } + }, + "additionalProperties": false, + "required": ["myString", "myUnion"] + } + } +} +``` + +## Options + +### Schema name + +You can pass a string as the second parameter of the main zodToJsonSchema function. If you do, your schema will end up inside a definitions object property on the root and referenced from there. Alternatively, you can pass the name as the `name` property of the options object (see below). + +### Options object + +Instead of the schema name (or nothing), you can pass an options object as the second parameter. The following options are available: + +| Option | Effect | +| ---------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **name**?: _string_ | As described above. | +| **nameStrategy**?: "ref" \| "title" | Adds name as "title" meta instead of as a ref as described above | +| **basePath**?: string[] | The base path of the root reference builder. Defaults to ["#"]. | +| **$refStrategy**?: "root" \| "relative" \| "seen" \| "none" | The reference builder strategy; Defaults to "root". | +| **effectStrategy**?: "input" \| "any" | The effects output strategy. Defaults to "input". _See known issues!_ | +| **dateStrategy**?: "format:date" \| "format:date-time" \| "string" \| "integer" | Date strategy, integer allow to specify in unix-time min and max values. "format:date" creates a string schema with format: "date". "format:date-time" creates a string schema with format: "date-time". "string" is intepreted as "format:date-time". "integer" creates an integer schema with format "unix-time" (unless target "openApi3" is used min max checks are also respected) | +| | +| **emailStrategy**?: "format:email" \| "format:idn-email" \| "pattern:zod" | Choose how to handle the email string check. Defaults to "format:email". | +| **base64Strategy**?: "format:binary" \| "contentEnconding:base64" \| "pattern:zod" | Choose how to handle the base64 string check. Defaults to "contentEncoding:base64" as described [here](https://json-schema.org/understanding-json-schema/reference/non_json_data#contentencoding). Note that "format:binary" is not represented in the output type as it's not part of the JSON Schema spec and only intended to be used when targeting OpenAPI 3.0. Later versions of OpenAPI support contentEncoding. | +| **definitionPath**?: "definitions" \| "$defs" | The name of the definitions property when name is passed. Defaults to "definitions". | +| **target**?: "jsonSchema7" \| "jsonSchema2019-09" \| "openApi3" \| "openAi" | Which spec to target. Defaults to "jsonSchema7" | +| **strictUnions**?: boolean | Scrubs unions of any-like json schemas, like `{}` or `true`. Multiple zod types may result in these out of necessity, such as z.instanceof() | +| **definitions**?: Record | See separate section below | +| **errorMessages**?: boolean | Include custom error messages created via chained function checks for supported zod types. See section below | +| **markdownDescription**?: boolean | Copies the `description` meta to `markdownDescription` | +| **patternStrategy**?: "escape" \| "preserve" | The Zod string validations `.includes()`, `.startsWith()`, and `.endsWith()` must be converted to regex to be compatible with JSON Schema's `pattern`. For safety, all non-alphanumeric characters are `escape`d by default (consider `z.string().includes(".")`), but this can occasionally cause problems with Unicode-flagged regex parsers. Use `preserve` to prevent this escaping behaviour and preserve the exact string written, even if it results in an inaccurate regex. | +| **applyRegexFlags**?: boolean | JSON Schema's `pattern` doesn't support RegExp flags, but Zod's `z.string().regex()` does. When this option is true (default false), a best-effort is made to transform regexes into a flag-independent form (e.g. `/x/i => /[xX]/` ). Supported flags: `i` (basic Latin only), `m`, `s`. | +| **pipeStrategy**?: "all" \| "input" \| "output" | Decide which types should be included when using `z.pipe`, for example `z.string().pipe(z.number())` would return both `string` and `number` by default, only `string` for "input" and only `number` for "output". | +| **removeAdditionalStrategy**?: "passthrough" \| "strict" | Decide when `additionalProperties` should be allowed. See the section on additional properties for details. | +| **allowedAdditionalProperties**?: `true` \| `undefined` | What value to give `additionalProperties` when allowed. See the section on additional properties for details. | +| **rejectedAdditionalProperties**?: `false` \| `undefined` | What value to give `additionalProperties` when rejected. See the section on additional properties for details. | +| **override**?: callback | See section | +| **postProcess**?: callback | See section | +| **openAiAnyTypeName**?: string | Decides the name of a Json schema used to allow semi-arbitrary values in Open AI structured output. If any value in the Zod-schema resolves to any "any"-type schema it will reference a definition of this name. If no such definition is provided a default Json schema will be used. Defaults to "OpenAiAnyType" | + +### Definitions + +The definitions option lets you manually add recurring schemas into definitions for cleaner outputs. It's fully compatible with named schemas, changed definitions path and base path. Here's a simple example: + +```typescript +const myRecurringSchema = z.string(); +const myObjectSchema = z.object({ a: myRecurringSchema, b: myRecurringSchema }); + +const myJsonSchema = zodToJsonSchema(myObjectSchema, { + definitions: { myRecurringSchema }, +}); +``` + +#### Result + +```json +{ + "type": "object", + "properties": { + "a": { + "$ref": "#/definitions/myRecurringSchema" + }, + "b": { + "$ref": "#/definitions/myRecurringSchema" + } + }, + "definitions": { + "myRecurringSchema": { + "type": "string" + } + } +} +``` + +### Error Messages + +This feature allows optionally including error messages created via chained function calls for supported zod types: + +```ts +// string schema with additional chained function call checks +const EmailSchema = z.string().email("Invalid email").min(5, "Too short"); + +const jsonSchema = zodToJsonSchema(EmailSchema, { errorMessages: true }); +``` + +#### Result + +```json +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "string", + "format": "email", + "minLength": 5, + "errorMessage": { + "format": "Invalid email", + "minLength": "Too short" + } +} +``` + +This allows for field specific, validation step specific error messages which can be useful for building forms and such. This format is accepted by `react-hook-form`'s ajv resolver (and therefor `ajv-errors` which it uses under the hood). Note that if using AJV with this format will require [enabling `ajv-errors`](https://ajv.js.org/packages/ajv-errors.html#usage) as vanilla AJV does not accept this format by default. + +#### Custom Error Message Support + +- ZodString + - regex + - min, max + - email, cuid, uuid, url + - endsWith, startsWith +- ZodNumber + - min, max, lt, lte, gt, gte, + - int + - multipleOf +- ZodSet + - min, max +- ZodArray + - min, max + +### Additional properties + +By default, Zod removes undeclared properties when parsing object schemas. In order to replicate the expected output of this behaviour, the default for behaviour of zodToJsonSchema is to set `"additionalProperties"` to `false` (although the correctness of this can be debated). If you wish to allow undeclared properties you can either: + +- Set `removeAdditionalStrategy` to `"strict"`. This will allow additional properties for any object schema that is not declared with `.strict()`. +- Leave `removeAdditionalStrategy` set to its default value of `"passthrough"`, and add `.passtrough()` to your object schema. + +#### Removing the `additionalProperties` keyword using the `allowedAdditionalProperties` and/or `rejectedAdditionalProperties` options. + +Some schema definitions (like Googles Gen AI API for instance) does not allow the `additionalProperties` keyword at all. Luckily the JSON Schema spec allows for this: leaving the keyword undefined _should_ have the same effect as setting it to true (as per usual YMMV). To enable this behaviour, set the option `allowedAdditionalProperties` to `undefined`. + +To exclude the keyword even when additional properties are _not_ allowed, set the `rejectedAdditionalProperties` to `undefined` as well. + +_Heads up ⚠️: Both of these options will be ignored if your schema is declared with `.catchall(...)` as the provided schema will be used instead (if valid)._ + +#### Expected outputs + +| `z.object({})` + option | `"additionalProperties"` value | +| ------------------------- | ----------------------------------------------------------- | +| `.strip()` (default) | `false` if strategy is `"passtrough"`, `true` if `"strict"` | +| `.passtrough()` | `true` | +| `.strict()` | `false` | +| `.catchall(z.string())` | `{ "type": "string" }` | +| `.catchall(z.function())` | `undefined` (function schemas are not currently parseable) | + +Substitute `true` and `false` for `undefined` according to `allowedAdditionalProperties` and/or `rejectedAdditionalProperties` respectively. + +### `override` + +This options takes a callback receiving a Zod schema definition, the current reference object (containing the current ref path and other options), an argument containing inforation about wether or not the schema has been encountered before, and a forceResolution argument. + +Important: if you don't want to override the current item you have to return the `ignoreOverride` symbol exported from the index. This is because `undefined` is a valid option to return when you want the property to be excluded from the resulting JSON schema. + +```typescript +import zodToJsonSchema, { ignoreOverride } from "zod-to-json-schema"; + +zodToJsonSchema( + z.object({ + ignoreThis: z.string(), + overrideThis: z.string(), + removeThis: z.string(), + }), + { + override: (def, refs) => { + const path = refs.currentPath.join("/"); + + if (path === "#/properties/overrideThis") { + return { + type: "integer", + }; + } + + if (path === "#/properties/removeThis") { + return undefined; + } + + // Important! Do not return `undefined` or void unless you want to remove the property from the resulting schema completely. + return ignoreOverride; + }, + }, +); +``` + +Expected output: + +```json +{ + "type": "object", + "required": ["ignoreThis", "overrideThis"], + "properties": { + "ignoreThis": { + "type": "string" + }, + "overrideThis": { + "type": "integer" + } + }, + "additionalProperties": false +} +``` + +### `postProcess` + +Besided receiving all arguments of the `override` callback, the `postProcess` callback also receives the generated schema. It should always return a JSON Schema, or `undefined` if you wish to filter it out. Unlike the `override` callback you do not have to return `ignoreOverride` if you are happy with the produced schema; simply return it unchanged. + +```typescript +import zodToJsonSchema, { PostProcessCallback } from "zod-to-json-schema"; + +// Define the callback to be used to process the output using the PostProcessCallback type: +const postProcess: PostProcessCallback = ( + // The original output produced by the package itself: + jsonSchema, + // The ZodSchema def used to produce the original schema: + def, + // The refs object containing the current path, passed options, etc. + refs, +) => { + if (!jsonSchema) { + return jsonSchema; + } + + // Try to expand description as JSON meta: + if (jsonSchema.description) { + try { + jsonSchema = { + ...jsonSchema, + ...JSON.parse(jsonSchema.description), + }; + } catch {} + } + + // Make all numbers nullable: + if ("type" in jsonSchema! && jsonSchema.type === "number") { + jsonSchema.type = ["number", "null"]; + } + + // Add the refs path, just because + (jsonSchema as any).path = refs.currentPath; + + return jsonSchema; +}; + +const jsonSchema = zodToJsonSchema(zodSchema, { postProcess }); +``` + +#### Using `postProcess` for including examples and other meta + +Adding support for examples and other JSON Schema meta keys are among the most commonly requested features for this project. Unfortunately the current Zod major (3) has pretty anemic support for this, so some userland hacking is required. Since this is such a common usecase I've included a helper function that simply tries to parse any description as JSON and expand it into the resulting schema. + +Simply stringify whatever you want added to the output schema as the description, then import and use `jsonDescription` as the postProcess option: + +```typescript +import zodToJsonSchema, { jsonDescription } from "zod-to-json-schema"; + +const zodSchema = z.string().describe( + JSON.stringify({ + title: "My string", + description: "My description", + examples: ["Foo", "Bar"], + whatever: 123, + }), +); + +const jsonSchema = zodToJsonSchema(zodSchema, { + postProcess: jsonDescription, +}); +``` + +Expected output: + +```json +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "string", + "title": "My string", + "description": "My description", + "examples": ["Foo", "Bar"], + "whatever": 123 +} +``` + +## Known issues + +- The OpenAI target should be considered experimental for now, as some combination of options may break the compatibility. +- When using `.transform`, the return type is inferred from the supplied function. In other words, there is no schema for the return type, and there is no way to convert it in runtime. Currently the JSON schema will therefore reflect the input side of the Zod schema and not necessarily the output (the latter aka. `z.infer`). If this causes problems with your schema, consider using the effectStrategy "any", which will allow any type of output. +- JSON Schemas does not support any other key type than strings for objects. When using `z.record` with any other key type, this will be ignored. An exception to this rule is `z.enum` as is supported since 3.11.3 +- Relative JSON pointers, while published alongside [JSON schema draft 2020-12](https://json-schema.org/specification.html), is not technically a part of it. Currently, most resolvers do not handle them at all. +- Since v3, the Object parser uses `.isOptional()` to check if a property should be included in `required` or not. This has the potentially dangerous behavior of calling `.safeParse` with `undefined`. To work around this, make sure your `preprocess` and other effects callbacks are pure and not liable to throw errors. An issue has been logged in the Zod repo and can be [tracked here](https://github.com/colinhacks/zod/issues/1460). +- JSON Schema version 2020-12 is not yet officially supported. However, you should be able to use this library to obtain a compatible schema for the 2020-12 format just by changing the returned schema's `$schema` field to: "https://json-schema.org/draft/2020-12/schema#" + +## Versioning + +This package _does not_ follow semantic versioning. The major and minor versions of this package instead reflects feature parity with the [Zod package](http://npmjs.com/package/zod). + +I will do my best to keep API-breaking changes to an absolute minimum, but new features may appear as "patches", such as introducing the options pattern in 3.9.1. + +While v3.25 supports Zod v4 as a peer-dependency, it does _not_ mean it supports v4 schemas. Use `import { z } from "zod/v3"` and refer to the Zod documentation. + +## Changelog + +https://github.com/StefanTerdell/zod-to-json-schema/blob/master/changelog.md diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/changelog.md b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/changelog.md new file mode 100644 index 0000000000000000000000000000000000000000..da0e94dae1b8fbfbe4492f3d87314dda72d63475 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/changelog.md @@ -0,0 +1,83 @@ +# Changelog + +| Version | Change | +| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 3.25.2 | Bumps the peer dependency of Zod 3 to 3.25.28 - Versions before patch 13 caused [OOM issues](https://github.com/StefanTerdell/zod-to-json-schema/issues/185) and versions between that and 28 removed the /v3 import alias. | +| 3.25.1 | Fixes large install size due to accidental inclusion of test files. Thanks, [Felix Mosheev](https://github.com/felixmosh)! | +| 3.25.0 | Adds support for v3.25 and v3 through v4 (`import { z } from "zod/v3"`). Big thank you to both [Andrey Gubanovs](https://github.com/finom) and especially to [Faïz Hernawan Abdillah](https://github.com/Abdillah), whose more minimal implementation was merged. This will likely be the final release of `zod-to-json-schema`, as v4 now supports JSON schema natively. | +| 3.24.6 | Removed use of instanceOf to check for optional properties as differing package versions could produce intermittent bugs. Added OpenAiAnyType to work around their schema restrictions. | +| 3.24.5 | Update .npmignore to drop 2 mb of test files. Thanks [Misha Kaletsky](https://github.com/mmkal)! | +| 3.24.4 | Added options to set the value of additionalProperties in objects and record | +| 3.24.3 | Adds postProcess callback option | +| 3.24.2 | Restructured internals to remove circular dependencies which apparently might cause some build systems to whine a bit. Big thanks to [Víctor Hernández](https://github.com/NanezX) for the fix. | +| 3.24.1 | Adds OpenAI target | +| 3.24.0 | Implements new string checks (jwt, base64url, cidr ipv4/v6), matching the new Zod version | +| 3.23.5 | Module import hotfix by [Enzo Monjardín](https://github.com/enzomonjardin). Thanks! | +| 3.23.4 | Fixes branded regex property names and a weird edgecase in arrays. Thanks to [Isaiah Marc Sanchez](https://github.com/imsanchez) and [Mitchell Merry](https://github.com/mitchell-merry)! | +| 3.23.3 | More tests (Thanks [Brett Zamir!](https://github.com/brettz9)), removed dead code | +| 3.23.2 | Lazily loads Emoji regex to avoid incompatibility with some environments. Thanks [Jacob Lee](https://github.com/jacoblee93)! | +| 3.23.1 | Best-effort RegEx flag support by [Spappz](https://github.com/Spappz)! Some minor fixes and additions, such as the title option. | +| 3.23.0 | Adds support for base64, date, time, duration and nanoid string validations. A warm welcome and a big thanks to [Colin](https://www.github.com/colinhacks), the creator of Zod, joining in as a contributor :) | +| 3.22.5 | Adds new z.date() parsing options and override callback | +| 3.22.4 | Adds fix for nullable references in OpenAPI mode | +| 3.22.3 | Adjust root path from "#/" to "#" according to RFC 6901 | +| 3.22.2 | Adds "output" pipe strategy | +| 3.22.1 | Fixes broken imports when using some bundlers | +| 3.22.0 | Support readonly. Export both CJS and ESM. Export everything from index. Alternative map parser. Improved pattern handling and updated sources. | +| 3.21.4 | Fixes missing support for exact array length | +| 3.21.3 | Fixes issue #77 (Reference path to nullable schemas in Open-API mode) | +| 3.21.2 | Adds "integer" type Date output to support min/max checks, markdownDescription option, fixes "none" refStrategy by adding "seen" and adds an option to use "pattern" with Zods' email enum instead of "format". | +| 3.21.1 | New target (2019-09) along with improved intersection schemas, improved mutual recursion references in definitions, descriptions respected in union parser and not removed in collapsed | +| 3.21.0 | Added new string validations (ip, emoji, etc) and BigInt checks to support Zod 3.21 | +| 3.20.5 | Added uniqueItems to Set and an option to disregard pipe schemas | +| 3.20.4 | Bugfixes and improved record parsing for openApi3 | +| 3.20.3 | Added Cuid2 support introduced in Zod 3.20.3 | +| 3.20.2 | Reintroduced conditional simplified return-type for when target is OpenAPI 3 | +| 3.20.1 | Fixed inconsistent casing in imports | +| 3.20.0 | Adds support for Zod 3.20 with catch and pipe parser as well as new string validations. Refactored Ref handling; adding definitions no longer considered experimental. Main API function refactored and simplified; output type less defined but a lot easier to maintain. Doubt anyone will miss it.
Narrator: Someone did in fact miss it | +| 3.19.4 | Adds custom error message support | +| 3.19.3 | Mark `definitions` as experimental in the readme | +| 3.19.2 | Added `definitions` option | +| 3.19.1 | Strict unions fix | +| 3.19.0 | No new features added in Zod, parity bump | +| 3.18.2 | Fixes support for native enums | +| 3.18.1 | Add strictUnions options | +| 3.18.0 | Added support for branded types | +| 3.17.2 | Fix for reference paths when supplying name option string. | +| 3.17.1 | Added startsWith and endsWith string checks. Merge multiple pattern checks into allOf array. | +| 3.17.0 | Added switch case handler for new trim "check". No changes to functionality. | +| 3.15.x - 3.16.x | Skipped: Did not change the Zod API in any way relevant for this package. | +| 3.14.1 | Dependabot security updates | +| 3.14.0 | Moves Zod into peerDependencies. Supports checks for sets, NaN-type (sort of), discriminated union type and standalone optional properties (as unions with undefined) | +| 3.12.x - 3.13.x | Skipped | +| 3.11.3 | Joins unions of enums into single enum and allows enums as keys of records | +| 3.11.2 | Adds option to target Open API 3 spec (paths) instead of Json Schema 7. | +| 3.11.1 | Performance boost when using $refStrategy `none` and internal improvements. | +| 3.11.0 | Added description support introduced in Zod 3.11.5 | +| 3.10.x | Skipped: Minor 10 did not change the Zod API | +| 3.9.5 | Type bug fix: used dev dependency types in package | +| 3.9.4 | Path bug fix and test case when using optional definitions path | +| 3.9.3 | Added option to change definition property name to $defs | +| 3.9.2 | Added option to handle transform results as any instead of relying on their input schema. | +| 3.9.1 | Refactored the way reference pointers are passed around and added options pattern to main function without braking backwards compatibility! You can now add a base path, change the reference strategy (or opt out), and still set the schema name inside the options object or outside as before. | +| 3.9.0 | Added support for multipleOf number validaion, .rest() schemas for tuples and key validation for records (only compatible with string keys due to JSON Schema limitation). | +| 3.7.x - 3.8.x | Skipped to reach functional parity with Zod versioning. | +| 3.6.1 | Realised intersection had another potential ref pathing bug. Fixed. | +| 3.6.0 | Added support for default & effects (refine). Broke out changelog.md | +| 3.5.0 | Added support for CUID string validation | +| 3.4.3 | Fixed $ref pathing for catchall and intersection. Additional tests and code structure fixes. | +| 3.4.2 | Fixed broken intersection parser (Thanks [Noah2610](https://github.com/Noah2610)!) | +| 3.4.1 | Fixed pathing bug for nullable items. | +| 3.4.0 | Added support for z.lazy() | +| 3.3.0 | Added support for catchall (additionalProperties schema on objects). Rebuilt object parser. | +| 3.2.0 | Added support for Map and Set as seen by their most common JSON definitions. Beware no standardized definition seem to exist and JSON.parse doesn't handle either natively. Their implementations here are based on the spread approach. Also further simplified intersection definition to just allOf. | +| 3.1.0 | String patterns finally supported! Fixed bugs include broken external type, unsafe nullable parsing, bad intersection implementation, and missing support for passthrough keys in objects. | +| 3.0.3 | Fixed array deep pathing bug (path contained `array` instead of `items`) | +| 3.0.2 | Fixed broken type usage (NonEmptyArrayDefinition was removed from Zod) | +| 3.0.1 | Fixed a typo in the readme | +| 3.0.0 | Compatible with Zod 3.2.0. Huge props to [Mr Hammad Asif](https://github.com/mrhammadasif) for his work on this. | +| 0.6.2 | Hotfix for undefined object properties. Could crash the parser when using Pick | +| 0.6.1 | Fixed bug in union pathing. `$Ref` was missing `/anyOf` | +| 0.6.0 | Moved `@types/json-schema` and `typescript` to dev dependencies. `@types/json-schema` is now only used for the test suites. Using `strict: true` in ts config. | +| 0.5.1 | First working release with all relevant Zod types present with most validations (except for string patterns due to Zod not exposing the source regexp pattern for those). | +| < 0.5.1 | Deprecated due to broken package structure. Please be patient, I eat crayons. | diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/contributing.md b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/contributing.md new file mode 100644 index 0000000000000000000000000000000000000000..c8b4717f8c2e45bfaa6ad51c178b61b3b7b6b5ae --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/contributing.md @@ -0,0 +1,9 @@ +# Contributing + +Hey, thanks for wanting to contribute. + +Before you open a PR, make sure to open an issue and discuss the problem you want to solve. I will not consider PRs without issues. + +I use [gitmoji](https://gitmoji.dev/) for my commit messages because I think it's fun. I encourage you to do the same, but won't enforce it. + +I check PRs and issues very rarely so please be patient. diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/createIndex.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/createIndex.ts new file mode 100644 index 0000000000000000000000000000000000000000..d126fcae543b9a3271c8952e81533e33417af79e --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/createIndex.ts @@ -0,0 +1,32 @@ +import { readdirSync, writeFileSync, statSync } from "fs"; + +const ignore = ["src/index.ts"]; + +function checkSrcDir(path: string): string[] { + const lines: string[] = []; + + for (const item of readdirSync(path)) { + const itemPath = path + "/" + item; + + if (ignore.includes(itemPath)) { + continue; + } + + if (statSync(itemPath).isDirectory()) { + lines.push(...checkSrcDir(itemPath)); + } else if (item.endsWith(".ts")) { + lines.push('export * from "./' + itemPath.slice(4, -2) + 'js"'); + } + } + + return lines; +} + +const lines = checkSrcDir("src"); + +lines.push( + 'import { zodToJsonSchema } from "./zodToJsonSchema.js"', + "export default zodToJsonSchema;", +); + +writeFileSync("./src/index.ts", lines.join(";\n")); diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/Options.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/Options.js new file mode 100644 index 0000000000000000000000000000000000000000..63970bee50aac273a2fe0dfd209a2fbd6e4cba83 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/Options.js @@ -0,0 +1,51 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getDefaultOptions = exports.defaultOptions = exports.jsonDescription = exports.ignoreOverride = void 0; +exports.ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use"); +const jsonDescription = (jsonSchema, def) => { + if (def.description) { + try { + return { + ...jsonSchema, + ...JSON.parse(def.description), + }; + } + catch { } + } + return jsonSchema; +}; +exports.jsonDescription = jsonDescription; +exports.defaultOptions = { + name: undefined, + $refStrategy: "root", + basePath: ["#"], + effectStrategy: "input", + pipeStrategy: "all", + dateStrategy: "format:date-time", + mapStrategy: "entries", + removeAdditionalStrategy: "passthrough", + allowedAdditionalProperties: true, + rejectedAdditionalProperties: false, + definitionPath: "definitions", + target: "jsonSchema7", + strictUnions: false, + definitions: {}, + errorMessages: false, + markdownDescription: false, + patternStrategy: "escape", + applyRegexFlags: false, + emailStrategy: "format:email", + base64Strategy: "contentEncoding:base64", + nameStrategy: "ref", + openAiAnyTypeName: "OpenAiAnyType" +}; +const getDefaultOptions = (options) => (typeof options === "string" + ? { + ...exports.defaultOptions, + name: options, + } + : { + ...exports.defaultOptions, + ...options, + }); +exports.getDefaultOptions = getDefaultOptions; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/Refs.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/Refs.js new file mode 100644 index 0000000000000000000000000000000000000000..04fd37b8b92633eadb563262a307bc0de9dbc7e5 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/Refs.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getRefs = void 0; +const Options_js_1 = require("./Options.js"); +const getRefs = (options) => { + const _options = (0, Options_js_1.getDefaultOptions)(options); + const currentPath = _options.name !== undefined + ? [..._options.basePath, _options.definitionPath, _options.name] + : _options.basePath; + return { + ..._options, + flags: { hasReferencedOpenAiAnyType: false }, + currentPath: currentPath, + propertyPath: undefined, + seen: new Map(Object.entries(_options.definitions).map(([name, def]) => [ + def._def, + { + def: def._def, + path: [..._options.basePath, _options.definitionPath, name], + // Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now. + jsonSchema: undefined, + }, + ])), + }; +}; +exports.getRefs = getRefs; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/errorMessages.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/errorMessages.js new file mode 100644 index 0000000000000000000000000000000000000000..a65eb082e64f9ef7ea91eb1191b7ff95526a2711 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/errorMessages.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.setResponseValueAndErrors = exports.addErrorMessage = void 0; +function addErrorMessage(res, key, errorMessage, refs) { + if (!refs?.errorMessages) + return; + if (errorMessage) { + res.errorMessage = { + ...res.errorMessage, + [key]: errorMessage, + }; + } +} +exports.addErrorMessage = addErrorMessage; +function setResponseValueAndErrors(res, key, value, errorMessage, refs) { + res[key] = value; + addErrorMessage(res, key, errorMessage, refs); +} +exports.setResponseValueAndErrors = setResponseValueAndErrors; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/getRelativePath.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/getRelativePath.js new file mode 100644 index 0000000000000000000000000000000000000000..03f4d787adebb769664e8472b1fa38985344fae4 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/getRelativePath.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getRelativePath = void 0; +const getRelativePath = (pathA, pathB) => { + let i = 0; + for (; i < pathA.length && i < pathB.length; i++) { + if (pathA[i] !== pathB[i]) + break; + } + return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/"); +}; +exports.getRelativePath = getRelativePath; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/index.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c438d2cad422b4dcfc9f1302234d19c9616a1319 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/index.js @@ -0,0 +1,56 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./Options.js"), exports); +__exportStar(require("./Refs.js"), exports); +__exportStar(require("./errorMessages.js"), exports); +__exportStar(require("./getRelativePath.js"), exports); +__exportStar(require("./parseDef.js"), exports); +__exportStar(require("./parseTypes.js"), exports); +__exportStar(require("./parsers/any.js"), exports); +__exportStar(require("./parsers/array.js"), exports); +__exportStar(require("./parsers/bigint.js"), exports); +__exportStar(require("./parsers/boolean.js"), exports); +__exportStar(require("./parsers/branded.js"), exports); +__exportStar(require("./parsers/catch.js"), exports); +__exportStar(require("./parsers/date.js"), exports); +__exportStar(require("./parsers/default.js"), exports); +__exportStar(require("./parsers/effects.js"), exports); +__exportStar(require("./parsers/enum.js"), exports); +__exportStar(require("./parsers/intersection.js"), exports); +__exportStar(require("./parsers/literal.js"), exports); +__exportStar(require("./parsers/map.js"), exports); +__exportStar(require("./parsers/nativeEnum.js"), exports); +__exportStar(require("./parsers/never.js"), exports); +__exportStar(require("./parsers/null.js"), exports); +__exportStar(require("./parsers/nullable.js"), exports); +__exportStar(require("./parsers/number.js"), exports); +__exportStar(require("./parsers/object.js"), exports); +__exportStar(require("./parsers/optional.js"), exports); +__exportStar(require("./parsers/pipeline.js"), exports); +__exportStar(require("./parsers/promise.js"), exports); +__exportStar(require("./parsers/readonly.js"), exports); +__exportStar(require("./parsers/record.js"), exports); +__exportStar(require("./parsers/set.js"), exports); +__exportStar(require("./parsers/string.js"), exports); +__exportStar(require("./parsers/tuple.js"), exports); +__exportStar(require("./parsers/undefined.js"), exports); +__exportStar(require("./parsers/union.js"), exports); +__exportStar(require("./parsers/unknown.js"), exports); +__exportStar(require("./selectParser.js"), exports); +__exportStar(require("./zodToJsonSchema.js"), exports); +const zodToJsonSchema_js_1 = require("./zodToJsonSchema.js"); +exports.default = zodToJsonSchema_js_1.zodToJsonSchema; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/package.json b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0292b9956f2e40d6eb3d0f3998e710d973113aaa --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/package.json @@ -0,0 +1 @@ +{"type":"commonjs"} \ No newline at end of file diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parseDef.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parseDef.js new file mode 100644 index 0000000000000000000000000000000000000000..1a4d35f6faf6d21a26cd4b0e8b5672e85d049509 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parseDef.js @@ -0,0 +1,66 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseDef = void 0; +const Options_js_1 = require("./Options.js"); +const selectParser_js_1 = require("./selectParser.js"); +const getRelativePath_js_1 = require("./getRelativePath.js"); +const any_js_1 = require("./parsers/any.js"); +function parseDef(def, refs, forceResolution = false) { + const seenItem = refs.seen.get(def); + if (refs.override) { + const overrideResult = refs.override?.(def, refs, seenItem, forceResolution); + if (overrideResult !== Options_js_1.ignoreOverride) { + return overrideResult; + } + } + if (seenItem && !forceResolution) { + const seenSchema = get$ref(seenItem, refs); + if (seenSchema !== undefined) { + return seenSchema; + } + } + const newItem = { def, path: refs.currentPath, jsonSchema: undefined }; + refs.seen.set(def, newItem); + const jsonSchemaOrGetter = (0, selectParser_js_1.selectParser)(def, def.typeName, refs); + // If the return was a function, then the inner definition needs to be extracted before a call to parseDef (recursive) + const jsonSchema = typeof jsonSchemaOrGetter === "function" + ? parseDef(jsonSchemaOrGetter(), refs) + : jsonSchemaOrGetter; + if (jsonSchema) { + addMeta(def, refs, jsonSchema); + } + if (refs.postProcess) { + const postProcessResult = refs.postProcess(jsonSchema, def, refs); + newItem.jsonSchema = jsonSchema; + return postProcessResult; + } + newItem.jsonSchema = jsonSchema; + return jsonSchema; +} +exports.parseDef = parseDef; +const get$ref = (item, refs) => { + switch (refs.$refStrategy) { + case "root": + return { $ref: item.path.join("/") }; + case "relative": + return { $ref: (0, getRelativePath_js_1.getRelativePath)(refs.currentPath, item.path) }; + case "none": + case "seen": { + if (item.path.length < refs.currentPath.length && + item.path.every((value, index) => refs.currentPath[index] === value)) { + console.warn(`Recursive reference detected at ${refs.currentPath.join("/")}! Defaulting to any`); + return (0, any_js_1.parseAnyDef)(refs); + } + return refs.$refStrategy === "seen" ? (0, any_js_1.parseAnyDef)(refs) : undefined; + } + } +}; +const addMeta = (def, refs, jsonSchema) => { + if (def.description) { + jsonSchema.description = def.description; + if (refs.markdownDescription) { + jsonSchema.markdownDescription = def.description; + } + } + return jsonSchema; +}; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parseTypes.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parseTypes.js new file mode 100644 index 0000000000000000000000000000000000000000..c8ad2e549bdc6801e0d1c80b0308d4b9bd4985ce --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parseTypes.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/any.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/any.js new file mode 100644 index 0000000000000000000000000000000000000000..d48e69dc86f7a4c25be7ff66fec2b931b2efa1d4 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/any.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseAnyDef = void 0; +const getRelativePath_js_1 = require("../getRelativePath.js"); +function parseAnyDef(refs) { + if (refs.target !== "openAi") { + return {}; + } + const anyDefinitionPath = [ + ...refs.basePath, + refs.definitionPath, + refs.openAiAnyTypeName, + ]; + refs.flags.hasReferencedOpenAiAnyType = true; + return { + $ref: refs.$refStrategy === "relative" + ? (0, getRelativePath_js_1.getRelativePath)(anyDefinitionPath, refs.currentPath) + : anyDefinitionPath.join("/"), + }; +} +exports.parseAnyDef = parseAnyDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/array.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/array.js new file mode 100644 index 0000000000000000000000000000000000000000..4f7a3db61d42a464187b7951a8243bcb284e9dc9 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/array.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseArrayDef = void 0; +const v3_1 = require("zod/v3"); +const errorMessages_js_1 = require("../errorMessages.js"); +const parseDef_js_1 = require("../parseDef.js"); +function parseArrayDef(def, refs) { + const res = { + type: "array", + }; + if (def.type?._def && + def.type?._def?.typeName !== v3_1.ZodFirstPartyTypeKind.ZodAny) { + res.items = (0, parseDef_js_1.parseDef)(def.type._def, { + ...refs, + currentPath: [...refs.currentPath, "items"], + }); + } + if (def.minLength) { + (0, errorMessages_js_1.setResponseValueAndErrors)(res, "minItems", def.minLength.value, def.minLength.message, refs); + } + if (def.maxLength) { + (0, errorMessages_js_1.setResponseValueAndErrors)(res, "maxItems", def.maxLength.value, def.maxLength.message, refs); + } + if (def.exactLength) { + (0, errorMessages_js_1.setResponseValueAndErrors)(res, "minItems", def.exactLength.value, def.exactLength.message, refs); + (0, errorMessages_js_1.setResponseValueAndErrors)(res, "maxItems", def.exactLength.value, def.exactLength.message, refs); + } + return res; +} +exports.parseArrayDef = parseArrayDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/bigint.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/bigint.js new file mode 100644 index 0000000000000000000000000000000000000000..239dd3423a78d3f24cf04f43a9c33ccdf8c26c69 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/bigint.js @@ -0,0 +1,53 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseBigintDef = void 0; +const errorMessages_js_1 = require("../errorMessages.js"); +function parseBigintDef(def, refs) { + const res = { + type: "integer", + format: "int64", + }; + if (!def.checks) + return res; + for (const check of def.checks) { + switch (check.kind) { + case "min": + if (refs.target === "jsonSchema7") { + if (check.inclusive) { + (0, errorMessages_js_1.setResponseValueAndErrors)(res, "minimum", check.value, check.message, refs); + } + else { + (0, errorMessages_js_1.setResponseValueAndErrors)(res, "exclusiveMinimum", check.value, check.message, refs); + } + } + else { + if (!check.inclusive) { + res.exclusiveMinimum = true; + } + (0, errorMessages_js_1.setResponseValueAndErrors)(res, "minimum", check.value, check.message, refs); + } + break; + case "max": + if (refs.target === "jsonSchema7") { + if (check.inclusive) { + (0, errorMessages_js_1.setResponseValueAndErrors)(res, "maximum", check.value, check.message, refs); + } + else { + (0, errorMessages_js_1.setResponseValueAndErrors)(res, "exclusiveMaximum", check.value, check.message, refs); + } + } + else { + if (!check.inclusive) { + res.exclusiveMaximum = true; + } + (0, errorMessages_js_1.setResponseValueAndErrors)(res, "maximum", check.value, check.message, refs); + } + break; + case "multipleOf": + (0, errorMessages_js_1.setResponseValueAndErrors)(res, "multipleOf", check.value, check.message, refs); + break; + } + } + return res; +} +exports.parseBigintDef = parseBigintDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/boolean.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/boolean.js new file mode 100644 index 0000000000000000000000000000000000000000..504cfa17b7e915cf34042cd4299d4da42f961804 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/boolean.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseBooleanDef = void 0; +function parseBooleanDef() { + return { + type: "boolean", + }; +} +exports.parseBooleanDef = parseBooleanDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/branded.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/branded.js new file mode 100644 index 0000000000000000000000000000000000000000..db09a921c5aba7a2e4b6cb45d21632013a75e5b3 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/branded.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseBrandedDef = void 0; +const parseDef_js_1 = require("../parseDef.js"); +function parseBrandedDef(_def, refs) { + return (0, parseDef_js_1.parseDef)(_def.type._def, refs); +} +exports.parseBrandedDef = parseBrandedDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/catch.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/catch.js new file mode 100644 index 0000000000000000000000000000000000000000..75d86c10c2374ce9c94f9c2271c9e5f89225e768 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/catch.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseCatchDef = void 0; +const parseDef_js_1 = require("../parseDef.js"); +const parseCatchDef = (def, refs) => { + return (0, parseDef_js_1.parseDef)(def.innerType._def, refs); +}; +exports.parseCatchDef = parseCatchDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/date.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/date.js new file mode 100644 index 0000000000000000000000000000000000000000..5a5229f7e25afc7208d546ac32f91d684dc4fee6 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/date.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseDateDef = void 0; +const errorMessages_js_1 = require("../errorMessages.js"); +function parseDateDef(def, refs, overrideDateStrategy) { + const strategy = overrideDateStrategy ?? refs.dateStrategy; + if (Array.isArray(strategy)) { + return { + anyOf: strategy.map((item, i) => parseDateDef(def, refs, item)), + }; + } + switch (strategy) { + case "string": + case "format:date-time": + return { + type: "string", + format: "date-time", + }; + case "format:date": + return { + type: "string", + format: "date", + }; + case "integer": + return integerDateParser(def, refs); + } +} +exports.parseDateDef = parseDateDef; +const integerDateParser = (def, refs) => { + const res = { + type: "integer", + format: "unix-time", + }; + if (refs.target === "openApi3") { + return res; + } + for (const check of def.checks) { + switch (check.kind) { + case "min": + (0, errorMessages_js_1.setResponseValueAndErrors)(res, "minimum", check.value, // This is in milliseconds + check.message, refs); + break; + case "max": + (0, errorMessages_js_1.setResponseValueAndErrors)(res, "maximum", check.value, // This is in milliseconds + check.message, refs); + break; + } + } + return res; +}; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/default.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/default.js new file mode 100644 index 0000000000000000000000000000000000000000..f558d0348dadab9b374f7349151b58571cb0ba64 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/default.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseDefaultDef = void 0; +const parseDef_js_1 = require("../parseDef.js"); +function parseDefaultDef(_def, refs) { + return { + ...(0, parseDef_js_1.parseDef)(_def.innerType._def, refs), + default: _def.defaultValue(), + }; +} +exports.parseDefaultDef = parseDefaultDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/effects.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/effects.js new file mode 100644 index 0000000000000000000000000000000000000000..e862cb4154085eaf905e725d95feefc34f48f4a7 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/effects.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseEffectsDef = void 0; +const parseDef_js_1 = require("../parseDef.js"); +const any_js_1 = require("./any.js"); +function parseEffectsDef(_def, refs) { + return refs.effectStrategy === "input" + ? (0, parseDef_js_1.parseDef)(_def.schema._def, refs) + : (0, any_js_1.parseAnyDef)(refs); +} +exports.parseEffectsDef = parseEffectsDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/enum.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/enum.js new file mode 100644 index 0000000000000000000000000000000000000000..63d599141761d320cb4dc4b98cc4c0086fd1fe5e --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/enum.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseEnumDef = void 0; +function parseEnumDef(def) { + return { + type: "string", + enum: Array.from(def.values), + }; +} +exports.parseEnumDef = parseEnumDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/intersection.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/intersection.js new file mode 100644 index 0000000000000000000000000000000000000000..d68f73ef26eb03da777954b50215f42559a62c77 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/intersection.js @@ -0,0 +1,56 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseIntersectionDef = void 0; +const parseDef_js_1 = require("../parseDef.js"); +const isJsonSchema7AllOfType = (type) => { + if ("type" in type && type.type === "string") + return false; + return "allOf" in type; +}; +function parseIntersectionDef(def, refs) { + const allOf = [ + (0, parseDef_js_1.parseDef)(def.left._def, { + ...refs, + currentPath: [...refs.currentPath, "allOf", "0"], + }), + (0, parseDef_js_1.parseDef)(def.right._def, { + ...refs, + currentPath: [...refs.currentPath, "allOf", "1"], + }), + ].filter((x) => !!x); + let unevaluatedProperties = refs.target === "jsonSchema2019-09" + ? { unevaluatedProperties: false } + : undefined; + const mergedAllOf = []; + // If either of the schemas is an allOf, merge them into a single allOf + allOf.forEach((schema) => { + if (isJsonSchema7AllOfType(schema)) { + mergedAllOf.push(...schema.allOf); + if (schema.unevaluatedProperties === undefined) { + // If one of the schemas has no unevaluatedProperties set, + // the merged schema should also have no unevaluatedProperties set + unevaluatedProperties = undefined; + } + } + else { + let nestedSchema = schema; + if ("additionalProperties" in schema && + schema.additionalProperties === false) { + const { additionalProperties, ...rest } = schema; + nestedSchema = rest; + } + else { + // As soon as one of the schemas has additionalProperties set not to false, we allow unevaluatedProperties + unevaluatedProperties = undefined; + } + mergedAllOf.push(nestedSchema); + } + }); + return mergedAllOf.length + ? { + allOf: mergedAllOf, + ...unevaluatedProperties, + } + : undefined; +} +exports.parseIntersectionDef = parseIntersectionDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/literal.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/literal.js new file mode 100644 index 0000000000000000000000000000000000000000..66c4ba063c06000d63acd109edbbcdaf32b897f7 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/literal.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseLiteralDef = void 0; +function parseLiteralDef(def, refs) { + const parsedType = typeof def.value; + if (parsedType !== "bigint" && + parsedType !== "number" && + parsedType !== "boolean" && + parsedType !== "string") { + return { + type: Array.isArray(def.value) ? "array" : "object", + }; + } + if (refs.target === "openApi3") { + return { + type: parsedType === "bigint" ? "integer" : parsedType, + enum: [def.value], + }; + } + return { + type: parsedType === "bigint" ? "integer" : parsedType, + const: def.value, + }; +} +exports.parseLiteralDef = parseLiteralDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/map.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/map.js new file mode 100644 index 0000000000000000000000000000000000000000..9974688fa52c76c90b6eab99e64da994a377051c --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/map.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseMapDef = void 0; +const parseDef_js_1 = require("../parseDef.js"); +const record_js_1 = require("./record.js"); +const any_js_1 = require("./any.js"); +function parseMapDef(def, refs) { + if (refs.mapStrategy === "record") { + return (0, record_js_1.parseRecordDef)(def, refs); + } + const keys = (0, parseDef_js_1.parseDef)(def.keyType._def, { + ...refs, + currentPath: [...refs.currentPath, "items", "items", "0"], + }) || (0, any_js_1.parseAnyDef)(refs); + const values = (0, parseDef_js_1.parseDef)(def.valueType._def, { + ...refs, + currentPath: [...refs.currentPath, "items", "items", "1"], + }) || (0, any_js_1.parseAnyDef)(refs); + return { + type: "array", + maxItems: 125, + items: { + type: "array", + items: [keys, values], + minItems: 2, + maxItems: 2, + }, + }; +} +exports.parseMapDef = parseMapDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/nativeEnum.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/nativeEnum.js new file mode 100644 index 0000000000000000000000000000000000000000..a3b35724dd9c14541fcb891bc3133564a538907d --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/nativeEnum.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseNativeEnumDef = void 0; +function parseNativeEnumDef(def) { + const object = def.values; + const actualKeys = Object.keys(def.values).filter((key) => { + return typeof object[object[key]] !== "number"; + }); + const actualValues = actualKeys.map((key) => object[key]); + const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values))); + return { + type: parsedTypes.length === 1 + ? parsedTypes[0] === "string" + ? "string" + : "number" + : ["string", "number"], + enum: actualValues, + }; +} +exports.parseNativeEnumDef = parseNativeEnumDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/never.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/never.js new file mode 100644 index 0000000000000000000000000000000000000000..01f24f9e4b525b15d52b95ef8999843270b6f2d9 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/never.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseNeverDef = void 0; +const any_js_1 = require("./any.js"); +function parseNeverDef(refs) { + return refs.target === "openAi" + ? undefined + : { + not: (0, any_js_1.parseAnyDef)({ + ...refs, + currentPath: [...refs.currentPath, "not"], + }), + }; +} +exports.parseNeverDef = parseNeverDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/null.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/null.js new file mode 100644 index 0000000000000000000000000000000000000000..1b4bfa8f8d76374a81200a271dc94a958f92406e --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/null.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseNullDef = void 0; +function parseNullDef(refs) { + return refs.target === "openApi3" + ? { + enum: ["null"], + nullable: true, + } + : { + type: "null", + }; +} +exports.parseNullDef = parseNullDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/nullable.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/nullable.js new file mode 100644 index 0000000000000000000000000000000000000000..8890795ab1325d6587cd3282b5b9c06a82166f44 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/nullable.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseNullableDef = void 0; +const parseDef_js_1 = require("../parseDef.js"); +const union_js_1 = require("./union.js"); +function parseNullableDef(def, refs) { + if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && + (!def.innerType._def.checks || !def.innerType._def.checks.length)) { + if (refs.target === "openApi3") { + return { + type: union_js_1.primitiveMappings[def.innerType._def.typeName], + nullable: true, + }; + } + return { + type: [ + union_js_1.primitiveMappings[def.innerType._def.typeName], + "null", + ], + }; + } + if (refs.target === "openApi3") { + const base = (0, parseDef_js_1.parseDef)(def.innerType._def, { + ...refs, + currentPath: [...refs.currentPath], + }); + if (base && "$ref" in base) + return { allOf: [base], nullable: true }; + return base && { ...base, nullable: true }; + } + const base = (0, parseDef_js_1.parseDef)(def.innerType._def, { + ...refs, + currentPath: [...refs.currentPath, "anyOf", "0"], + }); + return base && { anyOf: [base, { type: "null" }] }; +} +exports.parseNullableDef = parseNullableDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/number.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/number.js new file mode 100644 index 0000000000000000000000000000000000000000..274014a94a0dbeaeb23c6f23ac270f91310146b8 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/number.js @@ -0,0 +1,56 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseNumberDef = void 0; +const errorMessages_js_1 = require("../errorMessages.js"); +function parseNumberDef(def, refs) { + const res = { + type: "number", + }; + if (!def.checks) + return res; + for (const check of def.checks) { + switch (check.kind) { + case "int": + res.type = "integer"; + (0, errorMessages_js_1.addErrorMessage)(res, "type", check.message, refs); + break; + case "min": + if (refs.target === "jsonSchema7") { + if (check.inclusive) { + (0, errorMessages_js_1.setResponseValueAndErrors)(res, "minimum", check.value, check.message, refs); + } + else { + (0, errorMessages_js_1.setResponseValueAndErrors)(res, "exclusiveMinimum", check.value, check.message, refs); + } + } + else { + if (!check.inclusive) { + res.exclusiveMinimum = true; + } + (0, errorMessages_js_1.setResponseValueAndErrors)(res, "minimum", check.value, check.message, refs); + } + break; + case "max": + if (refs.target === "jsonSchema7") { + if (check.inclusive) { + (0, errorMessages_js_1.setResponseValueAndErrors)(res, "maximum", check.value, check.message, refs); + } + else { + (0, errorMessages_js_1.setResponseValueAndErrors)(res, "exclusiveMaximum", check.value, check.message, refs); + } + } + else { + if (!check.inclusive) { + res.exclusiveMaximum = true; + } + (0, errorMessages_js_1.setResponseValueAndErrors)(res, "maximum", check.value, check.message, refs); + } + break; + case "multipleOf": + (0, errorMessages_js_1.setResponseValueAndErrors)(res, "multipleOf", check.value, check.message, refs); + break; + } + } + return res; +} +exports.parseNumberDef = parseNumberDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/object.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/object.js new file mode 100644 index 0000000000000000000000000000000000000000..87c77e781cf98ad3fabdc4be53f1e4b2b4d49707 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/object.js @@ -0,0 +1,76 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseObjectDef = void 0; +const parseDef_js_1 = require("../parseDef.js"); +function parseObjectDef(def, refs) { + const forceOptionalIntoNullable = refs.target === "openAi"; + const result = { + type: "object", + properties: {}, + }; + const required = []; + const shape = def.shape(); + for (const propName in shape) { + let propDef = shape[propName]; + if (propDef === undefined || propDef._def === undefined) { + continue; + } + let propOptional = safeIsOptional(propDef); + if (propOptional && forceOptionalIntoNullable) { + if (propDef._def.typeName === "ZodOptional") { + propDef = propDef._def.innerType; + } + if (!propDef.isNullable()) { + propDef = propDef.nullable(); + } + propOptional = false; + } + const parsedDef = (0, parseDef_js_1.parseDef)(propDef._def, { + ...refs, + currentPath: [...refs.currentPath, "properties", propName], + propertyPath: [...refs.currentPath, "properties", propName], + }); + if (parsedDef === undefined) { + continue; + } + result.properties[propName] = parsedDef; + if (!propOptional) { + required.push(propName); + } + } + if (required.length) { + result.required = required; + } + const additionalProperties = decideAdditionalProperties(def, refs); + if (additionalProperties !== undefined) { + result.additionalProperties = additionalProperties; + } + return result; +} +exports.parseObjectDef = parseObjectDef; +function decideAdditionalProperties(def, refs) { + if (def.catchall._def.typeName !== "ZodNever") { + return (0, parseDef_js_1.parseDef)(def.catchall._def, { + ...refs, + currentPath: [...refs.currentPath, "additionalProperties"], + }); + } + switch (def.unknownKeys) { + case "passthrough": + return refs.allowedAdditionalProperties; + case "strict": + return refs.rejectedAdditionalProperties; + case "strip": + return refs.removeAdditionalStrategy === "strict" + ? refs.allowedAdditionalProperties + : refs.rejectedAdditionalProperties; + } +} +function safeIsOptional(schema) { + try { + return schema.isOptional(); + } + catch { + return true; + } +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/optional.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/optional.js new file mode 100644 index 0000000000000000000000000000000000000000..234d81902a31b13c5fa657b0ca834195bb6fb2ac --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/optional.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseOptionalDef = void 0; +const parseDef_js_1 = require("../parseDef.js"); +const any_js_1 = require("./any.js"); +const parseOptionalDef = (def, refs) => { + if (refs.currentPath.toString() === refs.propertyPath?.toString()) { + return (0, parseDef_js_1.parseDef)(def.innerType._def, refs); + } + const innerSchema = (0, parseDef_js_1.parseDef)(def.innerType._def, { + ...refs, + currentPath: [...refs.currentPath, "anyOf", "1"], + }); + return innerSchema + ? { + anyOf: [ + { + not: (0, any_js_1.parseAnyDef)(refs), + }, + innerSchema, + ], + } + : (0, any_js_1.parseAnyDef)(refs); +}; +exports.parseOptionalDef = parseOptionalDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/pipeline.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/pipeline.js new file mode 100644 index 0000000000000000000000000000000000000000..c05d0ef6b89a19a387a6d6eece6e87130448dcab --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/pipeline.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parsePipelineDef = void 0; +const parseDef_js_1 = require("../parseDef.js"); +const parsePipelineDef = (def, refs) => { + if (refs.pipeStrategy === "input") { + return (0, parseDef_js_1.parseDef)(def.in._def, refs); + } + else if (refs.pipeStrategy === "output") { + return (0, parseDef_js_1.parseDef)(def.out._def, refs); + } + const a = (0, parseDef_js_1.parseDef)(def.in._def, { + ...refs, + currentPath: [...refs.currentPath, "allOf", "0"], + }); + const b = (0, parseDef_js_1.parseDef)(def.out._def, { + ...refs, + currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"], + }); + return { + allOf: [a, b].filter((x) => x !== undefined), + }; +}; +exports.parsePipelineDef = parsePipelineDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/promise.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/promise.js new file mode 100644 index 0000000000000000000000000000000000000000..9f917e7aeefc6da57b0203f748faa689da5e84a2 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/promise.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parsePromiseDef = void 0; +const parseDef_js_1 = require("../parseDef.js"); +function parsePromiseDef(def, refs) { + return (0, parseDef_js_1.parseDef)(def.type._def, refs); +} +exports.parsePromiseDef = parsePromiseDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/readonly.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/readonly.js new file mode 100644 index 0000000000000000000000000000000000000000..cdccec882e9aa50f60e24ec3d0ca280877fdd7ee --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/readonly.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseReadonlyDef = void 0; +const parseDef_js_1 = require("../parseDef.js"); +const parseReadonlyDef = (def, refs) => { + return (0, parseDef_js_1.parseDef)(def.innerType._def, refs); +}; +exports.parseReadonlyDef = parseReadonlyDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/record.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/record.js new file mode 100644 index 0000000000000000000000000000000000000000..197f78f7546a1f1569df493e6f2b78d6ca8e356c --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/record.js @@ -0,0 +1,65 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseRecordDef = void 0; +const v3_1 = require("zod/v3"); +const parseDef_js_1 = require("../parseDef.js"); +const string_js_1 = require("./string.js"); +const branded_js_1 = require("./branded.js"); +const any_js_1 = require("./any.js"); +function parseRecordDef(def, refs) { + if (refs.target === "openAi") { + console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."); + } + if (refs.target === "openApi3" && + def.keyType?._def.typeName === v3_1.ZodFirstPartyTypeKind.ZodEnum) { + return { + type: "object", + required: def.keyType._def.values, + properties: def.keyType._def.values.reduce((acc, key) => ({ + ...acc, + [key]: (0, parseDef_js_1.parseDef)(def.valueType._def, { + ...refs, + currentPath: [...refs.currentPath, "properties", key], + }) ?? (0, any_js_1.parseAnyDef)(refs), + }), {}), + additionalProperties: refs.rejectedAdditionalProperties, + }; + } + const schema = { + type: "object", + additionalProperties: (0, parseDef_js_1.parseDef)(def.valueType._def, { + ...refs, + currentPath: [...refs.currentPath, "additionalProperties"], + }) ?? refs.allowedAdditionalProperties, + }; + if (refs.target === "openApi3") { + return schema; + } + if (def.keyType?._def.typeName === v3_1.ZodFirstPartyTypeKind.ZodString && + def.keyType._def.checks?.length) { + const { type, ...keyType } = (0, string_js_1.parseStringDef)(def.keyType._def, refs); + return { + ...schema, + propertyNames: keyType, + }; + } + else if (def.keyType?._def.typeName === v3_1.ZodFirstPartyTypeKind.ZodEnum) { + return { + ...schema, + propertyNames: { + enum: def.keyType._def.values, + }, + }; + } + else if (def.keyType?._def.typeName === v3_1.ZodFirstPartyTypeKind.ZodBranded && + def.keyType._def.type._def.typeName === v3_1.ZodFirstPartyTypeKind.ZodString && + def.keyType._def.type._def.checks?.length) { + const { type, ...keyType } = (0, branded_js_1.parseBrandedDef)(def.keyType._def, refs); + return { + ...schema, + propertyNames: keyType, + }; + } + return schema; +} +exports.parseRecordDef = parseRecordDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/set.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/set.js new file mode 100644 index 0000000000000000000000000000000000000000..8a2dee03cfb78d4d4569aed74e91fb84ec76e6db --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/set.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseSetDef = void 0; +const errorMessages_js_1 = require("../errorMessages.js"); +const parseDef_js_1 = require("../parseDef.js"); +function parseSetDef(def, refs) { + const items = (0, parseDef_js_1.parseDef)(def.valueType._def, { + ...refs, + currentPath: [...refs.currentPath, "items"], + }); + const schema = { + type: "array", + uniqueItems: true, + items, + }; + if (def.minSize) { + (0, errorMessages_js_1.setResponseValueAndErrors)(schema, "minItems", def.minSize.value, def.minSize.message, refs); + } + if (def.maxSize) { + (0, errorMessages_js_1.setResponseValueAndErrors)(schema, "maxItems", def.maxSize.value, def.maxSize.message, refs); + } + return schema; +} +exports.parseSetDef = parseSetDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/string.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/string.js new file mode 100644 index 0000000000000000000000000000000000000000..fd2ba9ebf345dd7ecfe18a888f9630b0a90c8b09 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/string.js @@ -0,0 +1,356 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseStringDef = exports.zodPatterns = void 0; +const errorMessages_js_1 = require("../errorMessages.js"); +let emojiRegex = undefined; +/** + * Generated from the regular expressions found here as of 2024-05-22: + * https://github.com/colinhacks/zod/blob/master/src/types.ts. + * + * Expressions with /i flag have been changed accordingly. + */ +exports.zodPatterns = { + /** + * `c` was changed to `[cC]` to replicate /i flag + */ + cuid: /^[cC][^\s-]{8,}$/, + cuid2: /^[0-9a-z]+$/, + ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/, + /** + * `a-z` was added to replicate /i flag + */ + email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/, + /** + * Constructed a valid Unicode RegExp + * + * Lazily instantiate since this type of regex isn't supported + * in all envs (e.g. React Native). + * + * See: + * https://github.com/colinhacks/zod/issues/2433 + * Fix in Zod: + * https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b + */ + emoji: () => { + if (emojiRegex === undefined) { + emojiRegex = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u"); + } + return emojiRegex; + }, + /** + * Unused + */ + uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/, + /** + * Unused + */ + ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, + ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, + /** + * Unused + */ + ipv6: /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/, + ipv6Cidr: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, + base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, + base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, + nanoid: /^[a-zA-Z0-9_-]{21}$/, + jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, +}; +function parseStringDef(def, refs) { + const res = { + type: "string", + }; + if (def.checks) { + for (const check of def.checks) { + switch (check.kind) { + case "min": + (0, errorMessages_js_1.setResponseValueAndErrors)(res, "minLength", typeof res.minLength === "number" + ? Math.max(res.minLength, check.value) + : check.value, check.message, refs); + break; + case "max": + (0, errorMessages_js_1.setResponseValueAndErrors)(res, "maxLength", typeof res.maxLength === "number" + ? Math.min(res.maxLength, check.value) + : check.value, check.message, refs); + break; + case "email": + switch (refs.emailStrategy) { + case "format:email": + addFormat(res, "email", check.message, refs); + break; + case "format:idn-email": + addFormat(res, "idn-email", check.message, refs); + break; + case "pattern:zod": + addPattern(res, exports.zodPatterns.email, check.message, refs); + break; + } + break; + case "url": + addFormat(res, "uri", check.message, refs); + break; + case "uuid": + addFormat(res, "uuid", check.message, refs); + break; + case "regex": + addPattern(res, check.regex, check.message, refs); + break; + case "cuid": + addPattern(res, exports.zodPatterns.cuid, check.message, refs); + break; + case "cuid2": + addPattern(res, exports.zodPatterns.cuid2, check.message, refs); + break; + case "startsWith": + addPattern(res, RegExp(`^${escapeLiteralCheckValue(check.value, refs)}`), check.message, refs); + break; + case "endsWith": + addPattern(res, RegExp(`${escapeLiteralCheckValue(check.value, refs)}$`), check.message, refs); + break; + case "datetime": + addFormat(res, "date-time", check.message, refs); + break; + case "date": + addFormat(res, "date", check.message, refs); + break; + case "time": + addFormat(res, "time", check.message, refs); + break; + case "duration": + addFormat(res, "duration", check.message, refs); + break; + case "length": + (0, errorMessages_js_1.setResponseValueAndErrors)(res, "minLength", typeof res.minLength === "number" + ? Math.max(res.minLength, check.value) + : check.value, check.message, refs); + (0, errorMessages_js_1.setResponseValueAndErrors)(res, "maxLength", typeof res.maxLength === "number" + ? Math.min(res.maxLength, check.value) + : check.value, check.message, refs); + break; + case "includes": { + addPattern(res, RegExp(escapeLiteralCheckValue(check.value, refs)), check.message, refs); + break; + } + case "ip": { + if (check.version !== "v6") { + addFormat(res, "ipv4", check.message, refs); + } + if (check.version !== "v4") { + addFormat(res, "ipv6", check.message, refs); + } + break; + } + case "base64url": + addPattern(res, exports.zodPatterns.base64url, check.message, refs); + break; + case "jwt": + addPattern(res, exports.zodPatterns.jwt, check.message, refs); + break; + case "cidr": { + if (check.version !== "v6") { + addPattern(res, exports.zodPatterns.ipv4Cidr, check.message, refs); + } + if (check.version !== "v4") { + addPattern(res, exports.zodPatterns.ipv6Cidr, check.message, refs); + } + break; + } + case "emoji": + addPattern(res, exports.zodPatterns.emoji(), check.message, refs); + break; + case "ulid": { + addPattern(res, exports.zodPatterns.ulid, check.message, refs); + break; + } + case "base64": { + switch (refs.base64Strategy) { + case "format:binary": { + addFormat(res, "binary", check.message, refs); + break; + } + case "contentEncoding:base64": { + (0, errorMessages_js_1.setResponseValueAndErrors)(res, "contentEncoding", "base64", check.message, refs); + break; + } + case "pattern:zod": { + addPattern(res, exports.zodPatterns.base64, check.message, refs); + break; + } + } + break; + } + case "nanoid": { + addPattern(res, exports.zodPatterns.nanoid, check.message, refs); + } + case "toLowerCase": + case "toUpperCase": + case "trim": + break; + default: + ((_) => { })(check); + } + } + } + return res; +} +exports.parseStringDef = parseStringDef; +function escapeLiteralCheckValue(literal, refs) { + return refs.patternStrategy === "escape" + ? escapeNonAlphaNumeric(literal) + : literal; +} +const ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789"); +function escapeNonAlphaNumeric(source) { + let result = ""; + for (let i = 0; i < source.length; i++) { + if (!ALPHA_NUMERIC.has(source[i])) { + result += "\\"; + } + result += source[i]; + } + return result; +} +// Adds a "format" keyword to the schema. If a format exists, both formats will be joined in an allOf-node, along with subsequent ones. +function addFormat(schema, value, message, refs) { + if (schema.format || schema.anyOf?.some((x) => x.format)) { + if (!schema.anyOf) { + schema.anyOf = []; + } + if (schema.format) { + schema.anyOf.push({ + format: schema.format, + ...(schema.errorMessage && + refs.errorMessages && { + errorMessage: { format: schema.errorMessage.format }, + }), + }); + delete schema.format; + if (schema.errorMessage) { + delete schema.errorMessage.format; + if (Object.keys(schema.errorMessage).length === 0) { + delete schema.errorMessage; + } + } + } + schema.anyOf.push({ + format: value, + ...(message && + refs.errorMessages && { errorMessage: { format: message } }), + }); + } + else { + (0, errorMessages_js_1.setResponseValueAndErrors)(schema, "format", value, message, refs); + } +} +// Adds a "pattern" keyword to the schema. If a pattern exists, both patterns will be joined in an allOf-node, along with subsequent ones. +function addPattern(schema, regex, message, refs) { + if (schema.pattern || schema.allOf?.some((x) => x.pattern)) { + if (!schema.allOf) { + schema.allOf = []; + } + if (schema.pattern) { + schema.allOf.push({ + pattern: schema.pattern, + ...(schema.errorMessage && + refs.errorMessages && { + errorMessage: { pattern: schema.errorMessage.pattern }, + }), + }); + delete schema.pattern; + if (schema.errorMessage) { + delete schema.errorMessage.pattern; + if (Object.keys(schema.errorMessage).length === 0) { + delete schema.errorMessage; + } + } + } + schema.allOf.push({ + pattern: stringifyRegExpWithFlags(regex, refs), + ...(message && + refs.errorMessages && { errorMessage: { pattern: message } }), + }); + } + else { + (0, errorMessages_js_1.setResponseValueAndErrors)(schema, "pattern", stringifyRegExpWithFlags(regex, refs), message, refs); + } +} +// Mutate z.string.regex() in a best attempt to accommodate for regex flags when applyRegexFlags is true +function stringifyRegExpWithFlags(regex, refs) { + if (!refs.applyRegexFlags || !regex.flags) { + return regex.source; + } + // Currently handled flags + const flags = { + i: regex.flags.includes("i"), + m: regex.flags.includes("m"), + s: regex.flags.includes("s"), // `.` matches newlines + }; + // The general principle here is to step through each character, one at a time, applying mutations as flags require. We keep track when the current character is escaped, and when it's inside a group /like [this]/ or (also) a range like /[a-z]/. The following is fairly brittle imperative code; edit at your peril! + const source = flags.i ? regex.source.toLowerCase() : regex.source; + let pattern = ""; + let isEscaped = false; + let inCharGroup = false; + let inCharRange = false; + for (let i = 0; i < source.length; i++) { + if (isEscaped) { + pattern += source[i]; + isEscaped = false; + continue; + } + if (flags.i) { + if (inCharGroup) { + if (source[i].match(/[a-z]/)) { + if (inCharRange) { + pattern += source[i]; + pattern += `${source[i - 2]}-${source[i]}`.toUpperCase(); + inCharRange = false; + } + else if (source[i + 1] === "-" && source[i + 2]?.match(/[a-z]/)) { + pattern += source[i]; + inCharRange = true; + } + else { + pattern += `${source[i]}${source[i].toUpperCase()}`; + } + continue; + } + } + else if (source[i].match(/[a-z]/)) { + pattern += `[${source[i]}${source[i].toUpperCase()}]`; + continue; + } + } + if (flags.m) { + if (source[i] === "^") { + pattern += `(^|(?<=[\r\n]))`; + continue; + } + else if (source[i] === "$") { + pattern += `($|(?=[\r\n]))`; + continue; + } + } + if (flags.s && source[i] === ".") { + pattern += inCharGroup ? `${source[i]}\r\n` : `[${source[i]}\r\n]`; + continue; + } + pattern += source[i]; + if (source[i] === "\\") { + isEscaped = true; + } + else if (inCharGroup && source[i] === "]") { + inCharGroup = false; + } + else if (!inCharGroup && source[i] === "[") { + inCharGroup = true; + } + } + try { + new RegExp(pattern); + } + catch { + console.warn(`Could not convert regex pattern at ${refs.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`); + return regex.source; + } + return pattern; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/tuple.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/tuple.js new file mode 100644 index 0000000000000000000000000000000000000000..e8b9fc568f7055fc38985e4378a2e263b0b81362 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/tuple.js @@ -0,0 +1,36 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseTupleDef = void 0; +const parseDef_js_1 = require("../parseDef.js"); +function parseTupleDef(def, refs) { + if (def.rest) { + return { + type: "array", + minItems: def.items.length, + items: def.items + .map((x, i) => (0, parseDef_js_1.parseDef)(x._def, { + ...refs, + currentPath: [...refs.currentPath, "items", `${i}`], + })) + .reduce((acc, x) => (x === undefined ? acc : [...acc, x]), []), + additionalItems: (0, parseDef_js_1.parseDef)(def.rest._def, { + ...refs, + currentPath: [...refs.currentPath, "additionalItems"], + }), + }; + } + else { + return { + type: "array", + minItems: def.items.length, + maxItems: def.items.length, + items: def.items + .map((x, i) => (0, parseDef_js_1.parseDef)(x._def, { + ...refs, + currentPath: [...refs.currentPath, "items", `${i}`], + })) + .reduce((acc, x) => (x === undefined ? acc : [...acc, x]), []), + }; + } +} +exports.parseTupleDef = parseTupleDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/undefined.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/undefined.js new file mode 100644 index 0000000000000000000000000000000000000000..529d7ee2039268287e8e79c96d88c2f8971f6acc --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/undefined.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseUndefinedDef = void 0; +const any_js_1 = require("./any.js"); +function parseUndefinedDef(refs) { + return { + not: (0, any_js_1.parseAnyDef)(refs), + }; +} +exports.parseUndefinedDef = parseUndefinedDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/union.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/union.js new file mode 100644 index 0000000000000000000000000000000000000000..808e572723982af59928631a08e3efef4b4745a0 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/union.js @@ -0,0 +1,84 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseUnionDef = exports.primitiveMappings = void 0; +const parseDef_js_1 = require("../parseDef.js"); +exports.primitiveMappings = { + ZodString: "string", + ZodNumber: "number", + ZodBigInt: "integer", + ZodBoolean: "boolean", + ZodNull: "null", +}; +function parseUnionDef(def, refs) { + if (refs.target === "openApi3") + return asAnyOf(def, refs); + const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options; + // This blocks tries to look ahead a bit to produce nicer looking schemas with type array instead of anyOf. + if (options.every((x) => x._def.typeName in exports.primitiveMappings && + (!x._def.checks || !x._def.checks.length))) { + // all types in union are primitive and lack checks, so might as well squash into {type: [...]} + const types = options.reduce((types, x) => { + const type = exports.primitiveMappings[x._def.typeName]; //Can be safely casted due to row 43 + return type && !types.includes(type) ? [...types, type] : types; + }, []); + return { + type: types.length > 1 ? types : types[0], + }; + } + else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) { + // all options literals + const types = options.reduce((acc, x) => { + const type = typeof x._def.value; + switch (type) { + case "string": + case "number": + case "boolean": + return [...acc, type]; + case "bigint": + return [...acc, "integer"]; + case "object": + if (x._def.value === null) + return [...acc, "null"]; + case "symbol": + case "undefined": + case "function": + default: + return acc; + } + }, []); + if (types.length === options.length) { + // all the literals are primitive, as far as null can be considered primitive + const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i); + return { + type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0], + enum: options.reduce((acc, x) => { + return acc.includes(x._def.value) ? acc : [...acc, x._def.value]; + }, []), + }; + } + } + else if (options.every((x) => x._def.typeName === "ZodEnum")) { + return { + type: "string", + enum: options.reduce((acc, x) => [ + ...acc, + ...x._def.values.filter((x) => !acc.includes(x)), + ], []), + }; + } + return asAnyOf(def, refs); +} +exports.parseUnionDef = parseUnionDef; +const asAnyOf = (def, refs) => { + const anyOf = (def.options instanceof Map + ? Array.from(def.options.values()) + : def.options) + .map((x, i) => (0, parseDef_js_1.parseDef)(x._def, { + ...refs, + currentPath: [...refs.currentPath, "anyOf", `${i}`], + })) + .filter((x) => !!x && + (!refs.strictUnions || + (typeof x === "object" && Object.keys(x).length > 0))); + return anyOf.length ? { anyOf } : undefined; +}; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/unknown.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/unknown.js new file mode 100644 index 0000000000000000000000000000000000000000..22e55649f113edf54e9693f558315a6d48ae773b --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/parsers/unknown.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseUnknownDef = void 0; +const any_js_1 = require("./any.js"); +function parseUnknownDef(refs) { + return (0, any_js_1.parseAnyDef)(refs); +} +exports.parseUnknownDef = parseUnknownDef; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/selectParser.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/selectParser.js new file mode 100644 index 0000000000000000000000000000000000000000..fbe18d9ae06c1cbf1e4e11f09fb6402bc4ece03a --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/selectParser.js @@ -0,0 +1,109 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.selectParser = void 0; +const v3_1 = require("zod/v3"); +const any_js_1 = require("./parsers/any.js"); +const array_js_1 = require("./parsers/array.js"); +const bigint_js_1 = require("./parsers/bigint.js"); +const boolean_js_1 = require("./parsers/boolean.js"); +const branded_js_1 = require("./parsers/branded.js"); +const catch_js_1 = require("./parsers/catch.js"); +const date_js_1 = require("./parsers/date.js"); +const default_js_1 = require("./parsers/default.js"); +const effects_js_1 = require("./parsers/effects.js"); +const enum_js_1 = require("./parsers/enum.js"); +const intersection_js_1 = require("./parsers/intersection.js"); +const literal_js_1 = require("./parsers/literal.js"); +const map_js_1 = require("./parsers/map.js"); +const nativeEnum_js_1 = require("./parsers/nativeEnum.js"); +const never_js_1 = require("./parsers/never.js"); +const null_js_1 = require("./parsers/null.js"); +const nullable_js_1 = require("./parsers/nullable.js"); +const number_js_1 = require("./parsers/number.js"); +const object_js_1 = require("./parsers/object.js"); +const optional_js_1 = require("./parsers/optional.js"); +const pipeline_js_1 = require("./parsers/pipeline.js"); +const promise_js_1 = require("./parsers/promise.js"); +const record_js_1 = require("./parsers/record.js"); +const set_js_1 = require("./parsers/set.js"); +const string_js_1 = require("./parsers/string.js"); +const tuple_js_1 = require("./parsers/tuple.js"); +const undefined_js_1 = require("./parsers/undefined.js"); +const union_js_1 = require("./parsers/union.js"); +const unknown_js_1 = require("./parsers/unknown.js"); +const readonly_js_1 = require("./parsers/readonly.js"); +const selectParser = (def, typeName, refs) => { + switch (typeName) { + case v3_1.ZodFirstPartyTypeKind.ZodString: + return (0, string_js_1.parseStringDef)(def, refs); + case v3_1.ZodFirstPartyTypeKind.ZodNumber: + return (0, number_js_1.parseNumberDef)(def, refs); + case v3_1.ZodFirstPartyTypeKind.ZodObject: + return (0, object_js_1.parseObjectDef)(def, refs); + case v3_1.ZodFirstPartyTypeKind.ZodBigInt: + return (0, bigint_js_1.parseBigintDef)(def, refs); + case v3_1.ZodFirstPartyTypeKind.ZodBoolean: + return (0, boolean_js_1.parseBooleanDef)(); + case v3_1.ZodFirstPartyTypeKind.ZodDate: + return (0, date_js_1.parseDateDef)(def, refs); + case v3_1.ZodFirstPartyTypeKind.ZodUndefined: + return (0, undefined_js_1.parseUndefinedDef)(refs); + case v3_1.ZodFirstPartyTypeKind.ZodNull: + return (0, null_js_1.parseNullDef)(refs); + case v3_1.ZodFirstPartyTypeKind.ZodArray: + return (0, array_js_1.parseArrayDef)(def, refs); + case v3_1.ZodFirstPartyTypeKind.ZodUnion: + case v3_1.ZodFirstPartyTypeKind.ZodDiscriminatedUnion: + return (0, union_js_1.parseUnionDef)(def, refs); + case v3_1.ZodFirstPartyTypeKind.ZodIntersection: + return (0, intersection_js_1.parseIntersectionDef)(def, refs); + case v3_1.ZodFirstPartyTypeKind.ZodTuple: + return (0, tuple_js_1.parseTupleDef)(def, refs); + case v3_1.ZodFirstPartyTypeKind.ZodRecord: + return (0, record_js_1.parseRecordDef)(def, refs); + case v3_1.ZodFirstPartyTypeKind.ZodLiteral: + return (0, literal_js_1.parseLiteralDef)(def, refs); + case v3_1.ZodFirstPartyTypeKind.ZodEnum: + return (0, enum_js_1.parseEnumDef)(def); + case v3_1.ZodFirstPartyTypeKind.ZodNativeEnum: + return (0, nativeEnum_js_1.parseNativeEnumDef)(def); + case v3_1.ZodFirstPartyTypeKind.ZodNullable: + return (0, nullable_js_1.parseNullableDef)(def, refs); + case v3_1.ZodFirstPartyTypeKind.ZodOptional: + return (0, optional_js_1.parseOptionalDef)(def, refs); + case v3_1.ZodFirstPartyTypeKind.ZodMap: + return (0, map_js_1.parseMapDef)(def, refs); + case v3_1.ZodFirstPartyTypeKind.ZodSet: + return (0, set_js_1.parseSetDef)(def, refs); + case v3_1.ZodFirstPartyTypeKind.ZodLazy: + return () => def.getter()._def; + case v3_1.ZodFirstPartyTypeKind.ZodPromise: + return (0, promise_js_1.parsePromiseDef)(def, refs); + case v3_1.ZodFirstPartyTypeKind.ZodNaN: + case v3_1.ZodFirstPartyTypeKind.ZodNever: + return (0, never_js_1.parseNeverDef)(refs); + case v3_1.ZodFirstPartyTypeKind.ZodEffects: + return (0, effects_js_1.parseEffectsDef)(def, refs); + case v3_1.ZodFirstPartyTypeKind.ZodAny: + return (0, any_js_1.parseAnyDef)(refs); + case v3_1.ZodFirstPartyTypeKind.ZodUnknown: + return (0, unknown_js_1.parseUnknownDef)(refs); + case v3_1.ZodFirstPartyTypeKind.ZodDefault: + return (0, default_js_1.parseDefaultDef)(def, refs); + case v3_1.ZodFirstPartyTypeKind.ZodBranded: + return (0, branded_js_1.parseBrandedDef)(def, refs); + case v3_1.ZodFirstPartyTypeKind.ZodReadonly: + return (0, readonly_js_1.parseReadonlyDef)(def, refs); + case v3_1.ZodFirstPartyTypeKind.ZodCatch: + return (0, catch_js_1.parseCatchDef)(def, refs); + case v3_1.ZodFirstPartyTypeKind.ZodPipeline: + return (0, pipeline_js_1.parsePipelineDef)(def, refs); + case v3_1.ZodFirstPartyTypeKind.ZodFunction: + case v3_1.ZodFirstPartyTypeKind.ZodVoid: + case v3_1.ZodFirstPartyTypeKind.ZodSymbol: + return undefined; + default: + return ((_) => undefined)(typeName); + } +}; +exports.selectParser = selectParser; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/zodToJsonSchema.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/zodToJsonSchema.js new file mode 100644 index 0000000000000000000000000000000000000000..2673e3a2e506aa6b8ab2d55a7a7d1a5386e32e1b --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/cjs/zodToJsonSchema.js @@ -0,0 +1,90 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.zodToJsonSchema = void 0; +const parseDef_js_1 = require("./parseDef.js"); +const Refs_js_1 = require("./Refs.js"); +const any_js_1 = require("./parsers/any.js"); +const zodToJsonSchema = (schema, options) => { + const refs = (0, Refs_js_1.getRefs)(options); + let definitions = typeof options === "object" && options.definitions + ? Object.entries(options.definitions).reduce((acc, [name, schema]) => ({ + ...acc, + [name]: (0, parseDef_js_1.parseDef)(schema._def, { + ...refs, + currentPath: [...refs.basePath, refs.definitionPath, name], + }, true) ?? (0, any_js_1.parseAnyDef)(refs), + }), {}) + : undefined; + const name = typeof options === "string" + ? options + : options?.nameStrategy === "title" + ? undefined + : options?.name; + const main = (0, parseDef_js_1.parseDef)(schema._def, name === undefined + ? refs + : { + ...refs, + currentPath: [...refs.basePath, refs.definitionPath, name], + }, false) ?? (0, any_js_1.parseAnyDef)(refs); + const title = typeof options === "object" && + options.name !== undefined && + options.nameStrategy === "title" + ? options.name + : undefined; + if (title !== undefined) { + main.title = title; + } + if (refs.flags.hasReferencedOpenAiAnyType) { + if (!definitions) { + definitions = {}; + } + if (!definitions[refs.openAiAnyTypeName]) { + definitions[refs.openAiAnyTypeName] = { + // Skipping "object" as no properties can be defined and additionalProperties must be "false" + type: ["string", "number", "integer", "boolean", "array", "null"], + items: { + $ref: refs.$refStrategy === "relative" + ? "1" + : [ + ...refs.basePath, + refs.definitionPath, + refs.openAiAnyTypeName, + ].join("/"), + }, + }; + } + } + const combined = name === undefined + ? definitions + ? { + ...main, + [refs.definitionPath]: definitions, + } + : main + : { + $ref: [ + ...(refs.$refStrategy === "relative" ? [] : refs.basePath), + refs.definitionPath, + name, + ].join("/"), + [refs.definitionPath]: { + ...definitions, + [name]: main, + }, + }; + if (refs.target === "jsonSchema7") { + combined.$schema = "http://json-schema.org/draft-07/schema#"; + } + else if (refs.target === "jsonSchema2019-09" || refs.target === "openAi") { + combined.$schema = "https://json-schema.org/draft/2019-09/schema#"; + } + if (refs.target === "openAi" && + ("anyOf" in combined || + "oneOf" in combined || + "allOf" in combined || + ("type" in combined && Array.isArray(combined.type)))) { + console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."); + } + return combined; +}; +exports.zodToJsonSchema = zodToJsonSchema; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/Options.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/Options.js new file mode 100644 index 0000000000000000000000000000000000000000..e26d8cec21b181b953c4154958c02710688f46d0 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/Options.js @@ -0,0 +1,46 @@ +export const ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use"); +export const jsonDescription = (jsonSchema, def) => { + if (def.description) { + try { + return { + ...jsonSchema, + ...JSON.parse(def.description), + }; + } + catch { } + } + return jsonSchema; +}; +export const defaultOptions = { + name: undefined, + $refStrategy: "root", + basePath: ["#"], + effectStrategy: "input", + pipeStrategy: "all", + dateStrategy: "format:date-time", + mapStrategy: "entries", + removeAdditionalStrategy: "passthrough", + allowedAdditionalProperties: true, + rejectedAdditionalProperties: false, + definitionPath: "definitions", + target: "jsonSchema7", + strictUnions: false, + definitions: {}, + errorMessages: false, + markdownDescription: false, + patternStrategy: "escape", + applyRegexFlags: false, + emailStrategy: "format:email", + base64Strategy: "contentEncoding:base64", + nameStrategy: "ref", + openAiAnyTypeName: "OpenAiAnyType" +}; +export const getDefaultOptions = (options) => (typeof options === "string" + ? { + ...defaultOptions, + name: options, + } + : { + ...defaultOptions, + ...options, + }); diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/Refs.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/Refs.js new file mode 100644 index 0000000000000000000000000000000000000000..99a1e0b33cbbe5f9a2be41c128e03247dc7d664a --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/Refs.js @@ -0,0 +1,22 @@ +import { getDefaultOptions } from "./Options.js"; +export const getRefs = (options) => { + const _options = getDefaultOptions(options); + const currentPath = _options.name !== undefined + ? [..._options.basePath, _options.definitionPath, _options.name] + : _options.basePath; + return { + ..._options, + flags: { hasReferencedOpenAiAnyType: false }, + currentPath: currentPath, + propertyPath: undefined, + seen: new Map(Object.entries(_options.definitions).map(([name, def]) => [ + def._def, + { + def: def._def, + path: [..._options.basePath, _options.definitionPath, name], + // Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now. + jsonSchema: undefined, + }, + ])), + }; +}; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/errorMessages.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/errorMessages.js new file mode 100644 index 0000000000000000000000000000000000000000..5a300a7f8e12ce3738fe02640c3120f1d904ed79 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/errorMessages.js @@ -0,0 +1,14 @@ +export function addErrorMessage(res, key, errorMessage, refs) { + if (!refs?.errorMessages) + return; + if (errorMessage) { + res.errorMessage = { + ...res.errorMessage, + [key]: errorMessage, + }; + } +} +export function setResponseValueAndErrors(res, key, value, errorMessage, refs) { + res[key] = value; + addErrorMessage(res, key, errorMessage, refs); +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js new file mode 100644 index 0000000000000000000000000000000000000000..63a005cb483dfdd38f3bdd111755472fa8bc61ef --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js @@ -0,0 +1,8 @@ +export const getRelativePath = (pathA, pathB) => { + let i = 0; + for (; i < pathA.length && i < pathB.length; i++) { + if (pathA[i] !== pathB[i]) + break; + } + return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/"); +}; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/index.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..cdfb5306e4cb4f7362c269baeff84c525cda93be --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/index.js @@ -0,0 +1,40 @@ +export * from "./Options.js"; +export * from "./Refs.js"; +export * from "./errorMessages.js"; +export * from "./getRelativePath.js"; +export * from "./parseDef.js"; +export * from "./parseTypes.js"; +export * from "./parsers/any.js"; +export * from "./parsers/array.js"; +export * from "./parsers/bigint.js"; +export * from "./parsers/boolean.js"; +export * from "./parsers/branded.js"; +export * from "./parsers/catch.js"; +export * from "./parsers/date.js"; +export * from "./parsers/default.js"; +export * from "./parsers/effects.js"; +export * from "./parsers/enum.js"; +export * from "./parsers/intersection.js"; +export * from "./parsers/literal.js"; +export * from "./parsers/map.js"; +export * from "./parsers/nativeEnum.js"; +export * from "./parsers/never.js"; +export * from "./parsers/null.js"; +export * from "./parsers/nullable.js"; +export * from "./parsers/number.js"; +export * from "./parsers/object.js"; +export * from "./parsers/optional.js"; +export * from "./parsers/pipeline.js"; +export * from "./parsers/promise.js"; +export * from "./parsers/readonly.js"; +export * from "./parsers/record.js"; +export * from "./parsers/set.js"; +export * from "./parsers/string.js"; +export * from "./parsers/tuple.js"; +export * from "./parsers/undefined.js"; +export * from "./parsers/union.js"; +export * from "./parsers/unknown.js"; +export * from "./selectParser.js"; +export * from "./zodToJsonSchema.js"; +import { zodToJsonSchema } from "./zodToJsonSchema.js"; +export default zodToJsonSchema; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/package.json b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/package.json new file mode 100644 index 0000000000000000000000000000000000000000..7b3eae25bb18d5a7f461baf8823d69f41e1afafa --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/package.json @@ -0,0 +1 @@ +{"type":"module","main":"index.js"} \ No newline at end of file diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parseDef.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parseDef.js new file mode 100644 index 0000000000000000000000000000000000000000..87a615e4bb6d227dd3d9d2148e6032cb206210cc --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parseDef.js @@ -0,0 +1,62 @@ +import { ignoreOverride } from "./Options.js"; +import { selectParser } from "./selectParser.js"; +import { getRelativePath } from "./getRelativePath.js"; +import { parseAnyDef } from "./parsers/any.js"; +export function parseDef(def, refs, forceResolution = false) { + const seenItem = refs.seen.get(def); + if (refs.override) { + const overrideResult = refs.override?.(def, refs, seenItem, forceResolution); + if (overrideResult !== ignoreOverride) { + return overrideResult; + } + } + if (seenItem && !forceResolution) { + const seenSchema = get$ref(seenItem, refs); + if (seenSchema !== undefined) { + return seenSchema; + } + } + const newItem = { def, path: refs.currentPath, jsonSchema: undefined }; + refs.seen.set(def, newItem); + const jsonSchemaOrGetter = selectParser(def, def.typeName, refs); + // If the return was a function, then the inner definition needs to be extracted before a call to parseDef (recursive) + const jsonSchema = typeof jsonSchemaOrGetter === "function" + ? parseDef(jsonSchemaOrGetter(), refs) + : jsonSchemaOrGetter; + if (jsonSchema) { + addMeta(def, refs, jsonSchema); + } + if (refs.postProcess) { + const postProcessResult = refs.postProcess(jsonSchema, def, refs); + newItem.jsonSchema = jsonSchema; + return postProcessResult; + } + newItem.jsonSchema = jsonSchema; + return jsonSchema; +} +const get$ref = (item, refs) => { + switch (refs.$refStrategy) { + case "root": + return { $ref: item.path.join("/") }; + case "relative": + return { $ref: getRelativePath(refs.currentPath, item.path) }; + case "none": + case "seen": { + if (item.path.length < refs.currentPath.length && + item.path.every((value, index) => refs.currentPath[index] === value)) { + console.warn(`Recursive reference detected at ${refs.currentPath.join("/")}! Defaulting to any`); + return parseAnyDef(refs); + } + return refs.$refStrategy === "seen" ? parseAnyDef(refs) : undefined; + } + } +}; +const addMeta = (def, refs, jsonSchema) => { + if (def.description) { + jsonSchema.description = def.description; + if (refs.markdownDescription) { + jsonSchema.markdownDescription = def.description; + } + } + return jsonSchema; +}; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parseTypes.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parseTypes.js new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parseTypes.js @@ -0,0 +1 @@ +export {}; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/any.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/any.js new file mode 100644 index 0000000000000000000000000000000000000000..ec9ddfdc3bac5af1bc4a33d880ac3510d8fecddb --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/any.js @@ -0,0 +1,17 @@ +import { getRelativePath } from "../getRelativePath.js"; +export function parseAnyDef(refs) { + if (refs.target !== "openAi") { + return {}; + } + const anyDefinitionPath = [ + ...refs.basePath, + refs.definitionPath, + refs.openAiAnyTypeName, + ]; + refs.flags.hasReferencedOpenAiAnyType = true; + return { + $ref: refs.$refStrategy === "relative" + ? getRelativePath(anyDefinitionPath, refs.currentPath) + : anyDefinitionPath.join("/"), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/array.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/array.js new file mode 100644 index 0000000000000000000000000000000000000000..6f275adb7f1e794b814bf7be28881e384156d070 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/array.js @@ -0,0 +1,26 @@ +import { ZodFirstPartyTypeKind } from "zod/v3"; +import { setResponseValueAndErrors } from "../errorMessages.js"; +import { parseDef } from "../parseDef.js"; +export function parseArrayDef(def, refs) { + const res = { + type: "array", + }; + if (def.type?._def && + def.type?._def?.typeName !== ZodFirstPartyTypeKind.ZodAny) { + res.items = parseDef(def.type._def, { + ...refs, + currentPath: [...refs.currentPath, "items"], + }); + } + if (def.minLength) { + setResponseValueAndErrors(res, "minItems", def.minLength.value, def.minLength.message, refs); + } + if (def.maxLength) { + setResponseValueAndErrors(res, "maxItems", def.maxLength.value, def.maxLength.message, refs); + } + if (def.exactLength) { + setResponseValueAndErrors(res, "minItems", def.exactLength.value, def.exactLength.message, refs); + setResponseValueAndErrors(res, "maxItems", def.exactLength.value, def.exactLength.message, refs); + } + return res; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js new file mode 100644 index 0000000000000000000000000000000000000000..1298a70df0ef790aff1ddcd8c523b22a87b267b8 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js @@ -0,0 +1,49 @@ +import { setResponseValueAndErrors } from "../errorMessages.js"; +export function parseBigintDef(def, refs) { + const res = { + type: "integer", + format: "int64", + }; + if (!def.checks) + return res; + for (const check of def.checks) { + switch (check.kind) { + case "min": + if (refs.target === "jsonSchema7") { + if (check.inclusive) { + setResponseValueAndErrors(res, "minimum", check.value, check.message, refs); + } + else { + setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs); + } + } + else { + if (!check.inclusive) { + res.exclusiveMinimum = true; + } + setResponseValueAndErrors(res, "minimum", check.value, check.message, refs); + } + break; + case "max": + if (refs.target === "jsonSchema7") { + if (check.inclusive) { + setResponseValueAndErrors(res, "maximum", check.value, check.message, refs); + } + else { + setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs); + } + } + else { + if (!check.inclusive) { + res.exclusiveMaximum = true; + } + setResponseValueAndErrors(res, "maximum", check.value, check.message, refs); + } + break; + case "multipleOf": + setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs); + break; + } + } + return res; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js new file mode 100644 index 0000000000000000000000000000000000000000..a7d9e5c0868a8a2f5928a444681071bd02f3c62f --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js @@ -0,0 +1,5 @@ +export function parseBooleanDef() { + return { + type: "boolean", + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js new file mode 100644 index 0000000000000000000000000000000000000000..fba4c9f024b6730978f5ab208b483306d863cbc3 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js @@ -0,0 +1,4 @@ +import { parseDef } from "../parseDef.js"; +export function parseBrandedDef(_def, refs) { + return parseDef(_def.type._def, refs); +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js new file mode 100644 index 0000000000000000000000000000000000000000..c1833f238e986347c2df275a81974ca661d2e98c --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js @@ -0,0 +1,4 @@ +import { parseDef } from "../parseDef.js"; +export const parseCatchDef = (def, refs) => { + return parseDef(def.innerType._def, refs); +}; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/date.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/date.js new file mode 100644 index 0000000000000000000000000000000000000000..28408a52a867886deddd35e2532581dbb203da00 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/date.js @@ -0,0 +1,46 @@ +import { setResponseValueAndErrors } from "../errorMessages.js"; +export function parseDateDef(def, refs, overrideDateStrategy) { + const strategy = overrideDateStrategy ?? refs.dateStrategy; + if (Array.isArray(strategy)) { + return { + anyOf: strategy.map((item, i) => parseDateDef(def, refs, item)), + }; + } + switch (strategy) { + case "string": + case "format:date-time": + return { + type: "string", + format: "date-time", + }; + case "format:date": + return { + type: "string", + format: "date", + }; + case "integer": + return integerDateParser(def, refs); + } +} +const integerDateParser = (def, refs) => { + const res = { + type: "integer", + format: "unix-time", + }; + if (refs.target === "openApi3") { + return res; + } + for (const check of def.checks) { + switch (check.kind) { + case "min": + setResponseValueAndErrors(res, "minimum", check.value, // This is in milliseconds + check.message, refs); + break; + case "max": + setResponseValueAndErrors(res, "maximum", check.value, // This is in milliseconds + check.message, refs); + break; + } + } + return res; +}; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/default.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/default.js new file mode 100644 index 0000000000000000000000000000000000000000..7f1c4dbc079153c6988d22155d166a8226d25d03 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/default.js @@ -0,0 +1,7 @@ +import { parseDef } from "../parseDef.js"; +export function parseDefaultDef(_def, refs) { + return { + ...parseDef(_def.innerType._def, refs), + default: _def.defaultValue(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js new file mode 100644 index 0000000000000000000000000000000000000000..780413e5018c193ae6d50a6e011bc9d49e994a8b --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js @@ -0,0 +1,7 @@ +import { parseDef } from "../parseDef.js"; +import { parseAnyDef } from "./any.js"; +export function parseEffectsDef(_def, refs) { + return refs.effectStrategy === "input" + ? parseDef(_def.schema._def, refs) + : parseAnyDef(refs); +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js new file mode 100644 index 0000000000000000000000000000000000000000..d6dbc068088ddcbc031b5bff847c024c74dbb4df --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js @@ -0,0 +1,6 @@ +export function parseEnumDef(def) { + return { + type: "string", + enum: Array.from(def.values), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js new file mode 100644 index 0000000000000000000000000000000000000000..945f5b3db6f2edc9056a48144c6f87a094ca09a6 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js @@ -0,0 +1,52 @@ +import { parseDef } from "../parseDef.js"; +const isJsonSchema7AllOfType = (type) => { + if ("type" in type && type.type === "string") + return false; + return "allOf" in type; +}; +export function parseIntersectionDef(def, refs) { + const allOf = [ + parseDef(def.left._def, { + ...refs, + currentPath: [...refs.currentPath, "allOf", "0"], + }), + parseDef(def.right._def, { + ...refs, + currentPath: [...refs.currentPath, "allOf", "1"], + }), + ].filter((x) => !!x); + let unevaluatedProperties = refs.target === "jsonSchema2019-09" + ? { unevaluatedProperties: false } + : undefined; + const mergedAllOf = []; + // If either of the schemas is an allOf, merge them into a single allOf + allOf.forEach((schema) => { + if (isJsonSchema7AllOfType(schema)) { + mergedAllOf.push(...schema.allOf); + if (schema.unevaluatedProperties === undefined) { + // If one of the schemas has no unevaluatedProperties set, + // the merged schema should also have no unevaluatedProperties set + unevaluatedProperties = undefined; + } + } + else { + let nestedSchema = schema; + if ("additionalProperties" in schema && + schema.additionalProperties === false) { + const { additionalProperties, ...rest } = schema; + nestedSchema = rest; + } + else { + // As soon as one of the schemas has additionalProperties set not to false, we allow unevaluatedProperties + unevaluatedProperties = undefined; + } + mergedAllOf.push(nestedSchema); + } + }); + return mergedAllOf.length + ? { + allOf: mergedAllOf, + ...unevaluatedProperties, + } + : undefined; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js new file mode 100644 index 0000000000000000000000000000000000000000..14cd677d1d0a9fb4e3abce830587fae52706ec85 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js @@ -0,0 +1,21 @@ +export function parseLiteralDef(def, refs) { + const parsedType = typeof def.value; + if (parsedType !== "bigint" && + parsedType !== "number" && + parsedType !== "boolean" && + parsedType !== "string") { + return { + type: Array.isArray(def.value) ? "array" : "object", + }; + } + if (refs.target === "openApi3") { + return { + type: parsedType === "bigint" ? "integer" : parsedType, + enum: [def.value], + }; + } + return { + type: parsedType === "bigint" ? "integer" : parsedType, + const: def.value, + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/map.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/map.js new file mode 100644 index 0000000000000000000000000000000000000000..7b35b7807229ccf12167ef97bf569f6cc765684e --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/map.js @@ -0,0 +1,26 @@ +import { parseDef } from "../parseDef.js"; +import { parseRecordDef } from "./record.js"; +import { parseAnyDef } from "./any.js"; +export function parseMapDef(def, refs) { + if (refs.mapStrategy === "record") { + return parseRecordDef(def, refs); + } + const keys = parseDef(def.keyType._def, { + ...refs, + currentPath: [...refs.currentPath, "items", "items", "0"], + }) || parseAnyDef(refs); + const values = parseDef(def.valueType._def, { + ...refs, + currentPath: [...refs.currentPath, "items", "items", "1"], + }) || parseAnyDef(refs); + return { + type: "array", + maxItems: 125, + items: { + type: "array", + items: [keys, values], + minItems: 2, + maxItems: 2, + }, + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js new file mode 100644 index 0000000000000000000000000000000000000000..fc411ba571c874b22af59ece6f5bca8703eba048 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js @@ -0,0 +1,16 @@ +export function parseNativeEnumDef(def) { + const object = def.values; + const actualKeys = Object.keys(def.values).filter((key) => { + return typeof object[object[key]] !== "number"; + }); + const actualValues = actualKeys.map((key) => object[key]); + const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values))); + return { + type: parsedTypes.length === 1 + ? parsedTypes[0] === "string" + ? "string" + : "number" + : ["string", "number"], + enum: actualValues, + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/never.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/never.js new file mode 100644 index 0000000000000000000000000000000000000000..a9940cae33c23032166a7bc024698f817cb5b6f5 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/never.js @@ -0,0 +1,11 @@ +import { parseAnyDef } from "./any.js"; +export function parseNeverDef(refs) { + return refs.target === "openAi" + ? undefined + : { + not: parseAnyDef({ + ...refs, + currentPath: [...refs.currentPath, "not"], + }), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/null.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/null.js new file mode 100644 index 0000000000000000000000000000000000000000..5b47a8a3d7172d60bed52682500960460ae2ee3e --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/null.js @@ -0,0 +1,10 @@ +export function parseNullDef(refs) { + return refs.target === "openApi3" + ? { + enum: ["null"], + nullable: true, + } + : { + type: "null", + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js new file mode 100644 index 0000000000000000000000000000000000000000..b4038d076b11c6b930bf0e27ec555217d3c516c2 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js @@ -0,0 +1,33 @@ +import { parseDef } from "../parseDef.js"; +import { primitiveMappings } from "./union.js"; +export function parseNullableDef(def, refs) { + if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && + (!def.innerType._def.checks || !def.innerType._def.checks.length)) { + if (refs.target === "openApi3") { + return { + type: primitiveMappings[def.innerType._def.typeName], + nullable: true, + }; + } + return { + type: [ + primitiveMappings[def.innerType._def.typeName], + "null", + ], + }; + } + if (refs.target === "openApi3") { + const base = parseDef(def.innerType._def, { + ...refs, + currentPath: [...refs.currentPath], + }); + if (base && "$ref" in base) + return { allOf: [base], nullable: true }; + return base && { ...base, nullable: true }; + } + const base = parseDef(def.innerType._def, { + ...refs, + currentPath: [...refs.currentPath, "anyOf", "0"], + }); + return base && { anyOf: [base, { type: "null" }] }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/number.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/number.js new file mode 100644 index 0000000000000000000000000000000000000000..2a0292c8147eab032d1420ae957529f7fb353497 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/number.js @@ -0,0 +1,52 @@ +import { addErrorMessage, setResponseValueAndErrors, } from "../errorMessages.js"; +export function parseNumberDef(def, refs) { + const res = { + type: "number", + }; + if (!def.checks) + return res; + for (const check of def.checks) { + switch (check.kind) { + case "int": + res.type = "integer"; + addErrorMessage(res, "type", check.message, refs); + break; + case "min": + if (refs.target === "jsonSchema7") { + if (check.inclusive) { + setResponseValueAndErrors(res, "minimum", check.value, check.message, refs); + } + else { + setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs); + } + } + else { + if (!check.inclusive) { + res.exclusiveMinimum = true; + } + setResponseValueAndErrors(res, "minimum", check.value, check.message, refs); + } + break; + case "max": + if (refs.target === "jsonSchema7") { + if (check.inclusive) { + setResponseValueAndErrors(res, "maximum", check.value, check.message, refs); + } + else { + setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs); + } + } + else { + if (!check.inclusive) { + res.exclusiveMaximum = true; + } + setResponseValueAndErrors(res, "maximum", check.value, check.message, refs); + } + break; + case "multipleOf": + setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs); + break; + } + } + return res; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/object.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/object.js new file mode 100644 index 0000000000000000000000000000000000000000..cff67272a167fb9fb3a4ece121c7da2a7f693237 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/object.js @@ -0,0 +1,72 @@ +import { parseDef } from "../parseDef.js"; +export function parseObjectDef(def, refs) { + const forceOptionalIntoNullable = refs.target === "openAi"; + const result = { + type: "object", + properties: {}, + }; + const required = []; + const shape = def.shape(); + for (const propName in shape) { + let propDef = shape[propName]; + if (propDef === undefined || propDef._def === undefined) { + continue; + } + let propOptional = safeIsOptional(propDef); + if (propOptional && forceOptionalIntoNullable) { + if (propDef._def.typeName === "ZodOptional") { + propDef = propDef._def.innerType; + } + if (!propDef.isNullable()) { + propDef = propDef.nullable(); + } + propOptional = false; + } + const parsedDef = parseDef(propDef._def, { + ...refs, + currentPath: [...refs.currentPath, "properties", propName], + propertyPath: [...refs.currentPath, "properties", propName], + }); + if (parsedDef === undefined) { + continue; + } + result.properties[propName] = parsedDef; + if (!propOptional) { + required.push(propName); + } + } + if (required.length) { + result.required = required; + } + const additionalProperties = decideAdditionalProperties(def, refs); + if (additionalProperties !== undefined) { + result.additionalProperties = additionalProperties; + } + return result; +} +function decideAdditionalProperties(def, refs) { + if (def.catchall._def.typeName !== "ZodNever") { + return parseDef(def.catchall._def, { + ...refs, + currentPath: [...refs.currentPath, "additionalProperties"], + }); + } + switch (def.unknownKeys) { + case "passthrough": + return refs.allowedAdditionalProperties; + case "strict": + return refs.rejectedAdditionalProperties; + case "strip": + return refs.removeAdditionalStrategy === "strict" + ? refs.allowedAdditionalProperties + : refs.rejectedAdditionalProperties; + } +} +function safeIsOptional(schema) { + try { + return schema.isOptional(); + } + catch { + return true; + } +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js new file mode 100644 index 0000000000000000000000000000000000000000..2c5e53233ab303adc03b4a07b20f38ad7b4e4351 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js @@ -0,0 +1,21 @@ +import { parseDef } from "../parseDef.js"; +import { parseAnyDef } from "./any.js"; +export const parseOptionalDef = (def, refs) => { + if (refs.currentPath.toString() === refs.propertyPath?.toString()) { + return parseDef(def.innerType._def, refs); + } + const innerSchema = parseDef(def.innerType._def, { + ...refs, + currentPath: [...refs.currentPath, "anyOf", "1"], + }); + return innerSchema + ? { + anyOf: [ + { + not: parseAnyDef(refs), + }, + innerSchema, + ], + } + : parseAnyDef(refs); +}; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js new file mode 100644 index 0000000000000000000000000000000000000000..e8edfe296aa4f06b7288f786095bb027ea7aec2c --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js @@ -0,0 +1,20 @@ +import { parseDef } from "../parseDef.js"; +export const parsePipelineDef = (def, refs) => { + if (refs.pipeStrategy === "input") { + return parseDef(def.in._def, refs); + } + else if (refs.pipeStrategy === "output") { + return parseDef(def.out._def, refs); + } + const a = parseDef(def.in._def, { + ...refs, + currentPath: [...refs.currentPath, "allOf", "0"], + }); + const b = parseDef(def.out._def, { + ...refs, + currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"], + }); + return { + allOf: [a, b].filter((x) => x !== undefined), + }; +}; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js new file mode 100644 index 0000000000000000000000000000000000000000..bfb1f5d047b5f3b51816b9f390b2af91e9cc294d --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js @@ -0,0 +1,4 @@ +import { parseDef } from "../parseDef.js"; +export function parsePromiseDef(def, refs) { + return parseDef(def.type._def, refs); +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js new file mode 100644 index 0000000000000000000000000000000000000000..b36a73c96a4781cf40efd639a15a21aea4a0191b --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js @@ -0,0 +1,4 @@ +import { parseDef } from "../parseDef.js"; +export const parseReadonlyDef = (def, refs) => { + return parseDef(def.innerType._def, refs); +}; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/record.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/record.js new file mode 100644 index 0000000000000000000000000000000000000000..dd75a92f4de5495d9fe631c11c93dc355c80b025 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/record.js @@ -0,0 +1,61 @@ +import { ZodFirstPartyTypeKind, } from "zod/v3"; +import { parseDef } from "../parseDef.js"; +import { parseStringDef } from "./string.js"; +import { parseBrandedDef } from "./branded.js"; +import { parseAnyDef } from "./any.js"; +export function parseRecordDef(def, refs) { + if (refs.target === "openAi") { + console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."); + } + if (refs.target === "openApi3" && + def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) { + return { + type: "object", + required: def.keyType._def.values, + properties: def.keyType._def.values.reduce((acc, key) => ({ + ...acc, + [key]: parseDef(def.valueType._def, { + ...refs, + currentPath: [...refs.currentPath, "properties", key], + }) ?? parseAnyDef(refs), + }), {}), + additionalProperties: refs.rejectedAdditionalProperties, + }; + } + const schema = { + type: "object", + additionalProperties: parseDef(def.valueType._def, { + ...refs, + currentPath: [...refs.currentPath, "additionalProperties"], + }) ?? refs.allowedAdditionalProperties, + }; + if (refs.target === "openApi3") { + return schema; + } + if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodString && + def.keyType._def.checks?.length) { + const { type, ...keyType } = parseStringDef(def.keyType._def, refs); + return { + ...schema, + propertyNames: keyType, + }; + } + else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) { + return { + ...schema, + propertyNames: { + enum: def.keyType._def.values, + }, + }; + } + else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodBranded && + def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind.ZodString && + def.keyType._def.type._def.checks?.length) { + const { type, ...keyType } = parseBrandedDef(def.keyType._def, refs); + return { + ...schema, + propertyNames: keyType, + }; + } + return schema; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/set.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/set.js new file mode 100644 index 0000000000000000000000000000000000000000..88f0624bd513a340891c51e8ed15df075693f69b --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/set.js @@ -0,0 +1,20 @@ +import { setResponseValueAndErrors } from "../errorMessages.js"; +import { parseDef } from "../parseDef.js"; +export function parseSetDef(def, refs) { + const items = parseDef(def.valueType._def, { + ...refs, + currentPath: [...refs.currentPath, "items"], + }); + const schema = { + type: "array", + uniqueItems: true, + items, + }; + if (def.minSize) { + setResponseValueAndErrors(schema, "minItems", def.minSize.value, def.minSize.message, refs); + } + if (def.maxSize) { + setResponseValueAndErrors(schema, "maxItems", def.maxSize.value, def.maxSize.message, refs); + } + return schema; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/string.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/string.js new file mode 100644 index 0000000000000000000000000000000000000000..bc224a306fb2d936bb3c0236fad7a238136cf256 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/string.js @@ -0,0 +1,352 @@ +import { setResponseValueAndErrors } from "../errorMessages.js"; +let emojiRegex = undefined; +/** + * Generated from the regular expressions found here as of 2024-05-22: + * https://github.com/colinhacks/zod/blob/master/src/types.ts. + * + * Expressions with /i flag have been changed accordingly. + */ +export const zodPatterns = { + /** + * `c` was changed to `[cC]` to replicate /i flag + */ + cuid: /^[cC][^\s-]{8,}$/, + cuid2: /^[0-9a-z]+$/, + ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/, + /** + * `a-z` was added to replicate /i flag + */ + email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/, + /** + * Constructed a valid Unicode RegExp + * + * Lazily instantiate since this type of regex isn't supported + * in all envs (e.g. React Native). + * + * See: + * https://github.com/colinhacks/zod/issues/2433 + * Fix in Zod: + * https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b + */ + emoji: () => { + if (emojiRegex === undefined) { + emojiRegex = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u"); + } + return emojiRegex; + }, + /** + * Unused + */ + uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/, + /** + * Unused + */ + ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, + ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, + /** + * Unused + */ + ipv6: /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/, + ipv6Cidr: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, + base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, + base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, + nanoid: /^[a-zA-Z0-9_-]{21}$/, + jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, +}; +export function parseStringDef(def, refs) { + const res = { + type: "string", + }; + if (def.checks) { + for (const check of def.checks) { + switch (check.kind) { + case "min": + setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" + ? Math.max(res.minLength, check.value) + : check.value, check.message, refs); + break; + case "max": + setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" + ? Math.min(res.maxLength, check.value) + : check.value, check.message, refs); + break; + case "email": + switch (refs.emailStrategy) { + case "format:email": + addFormat(res, "email", check.message, refs); + break; + case "format:idn-email": + addFormat(res, "idn-email", check.message, refs); + break; + case "pattern:zod": + addPattern(res, zodPatterns.email, check.message, refs); + break; + } + break; + case "url": + addFormat(res, "uri", check.message, refs); + break; + case "uuid": + addFormat(res, "uuid", check.message, refs); + break; + case "regex": + addPattern(res, check.regex, check.message, refs); + break; + case "cuid": + addPattern(res, zodPatterns.cuid, check.message, refs); + break; + case "cuid2": + addPattern(res, zodPatterns.cuid2, check.message, refs); + break; + case "startsWith": + addPattern(res, RegExp(`^${escapeLiteralCheckValue(check.value, refs)}`), check.message, refs); + break; + case "endsWith": + addPattern(res, RegExp(`${escapeLiteralCheckValue(check.value, refs)}$`), check.message, refs); + break; + case "datetime": + addFormat(res, "date-time", check.message, refs); + break; + case "date": + addFormat(res, "date", check.message, refs); + break; + case "time": + addFormat(res, "time", check.message, refs); + break; + case "duration": + addFormat(res, "duration", check.message, refs); + break; + case "length": + setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" + ? Math.max(res.minLength, check.value) + : check.value, check.message, refs); + setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" + ? Math.min(res.maxLength, check.value) + : check.value, check.message, refs); + break; + case "includes": { + addPattern(res, RegExp(escapeLiteralCheckValue(check.value, refs)), check.message, refs); + break; + } + case "ip": { + if (check.version !== "v6") { + addFormat(res, "ipv4", check.message, refs); + } + if (check.version !== "v4") { + addFormat(res, "ipv6", check.message, refs); + } + break; + } + case "base64url": + addPattern(res, zodPatterns.base64url, check.message, refs); + break; + case "jwt": + addPattern(res, zodPatterns.jwt, check.message, refs); + break; + case "cidr": { + if (check.version !== "v6") { + addPattern(res, zodPatterns.ipv4Cidr, check.message, refs); + } + if (check.version !== "v4") { + addPattern(res, zodPatterns.ipv6Cidr, check.message, refs); + } + break; + } + case "emoji": + addPattern(res, zodPatterns.emoji(), check.message, refs); + break; + case "ulid": { + addPattern(res, zodPatterns.ulid, check.message, refs); + break; + } + case "base64": { + switch (refs.base64Strategy) { + case "format:binary": { + addFormat(res, "binary", check.message, refs); + break; + } + case "contentEncoding:base64": { + setResponseValueAndErrors(res, "contentEncoding", "base64", check.message, refs); + break; + } + case "pattern:zod": { + addPattern(res, zodPatterns.base64, check.message, refs); + break; + } + } + break; + } + case "nanoid": { + addPattern(res, zodPatterns.nanoid, check.message, refs); + } + case "toLowerCase": + case "toUpperCase": + case "trim": + break; + default: + ((_) => { })(check); + } + } + } + return res; +} +function escapeLiteralCheckValue(literal, refs) { + return refs.patternStrategy === "escape" + ? escapeNonAlphaNumeric(literal) + : literal; +} +const ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789"); +function escapeNonAlphaNumeric(source) { + let result = ""; + for (let i = 0; i < source.length; i++) { + if (!ALPHA_NUMERIC.has(source[i])) { + result += "\\"; + } + result += source[i]; + } + return result; +} +// Adds a "format" keyword to the schema. If a format exists, both formats will be joined in an allOf-node, along with subsequent ones. +function addFormat(schema, value, message, refs) { + if (schema.format || schema.anyOf?.some((x) => x.format)) { + if (!schema.anyOf) { + schema.anyOf = []; + } + if (schema.format) { + schema.anyOf.push({ + format: schema.format, + ...(schema.errorMessage && + refs.errorMessages && { + errorMessage: { format: schema.errorMessage.format }, + }), + }); + delete schema.format; + if (schema.errorMessage) { + delete schema.errorMessage.format; + if (Object.keys(schema.errorMessage).length === 0) { + delete schema.errorMessage; + } + } + } + schema.anyOf.push({ + format: value, + ...(message && + refs.errorMessages && { errorMessage: { format: message } }), + }); + } + else { + setResponseValueAndErrors(schema, "format", value, message, refs); + } +} +// Adds a "pattern" keyword to the schema. If a pattern exists, both patterns will be joined in an allOf-node, along with subsequent ones. +function addPattern(schema, regex, message, refs) { + if (schema.pattern || schema.allOf?.some((x) => x.pattern)) { + if (!schema.allOf) { + schema.allOf = []; + } + if (schema.pattern) { + schema.allOf.push({ + pattern: schema.pattern, + ...(schema.errorMessage && + refs.errorMessages && { + errorMessage: { pattern: schema.errorMessage.pattern }, + }), + }); + delete schema.pattern; + if (schema.errorMessage) { + delete schema.errorMessage.pattern; + if (Object.keys(schema.errorMessage).length === 0) { + delete schema.errorMessage; + } + } + } + schema.allOf.push({ + pattern: stringifyRegExpWithFlags(regex, refs), + ...(message && + refs.errorMessages && { errorMessage: { pattern: message } }), + }); + } + else { + setResponseValueAndErrors(schema, "pattern", stringifyRegExpWithFlags(regex, refs), message, refs); + } +} +// Mutate z.string.regex() in a best attempt to accommodate for regex flags when applyRegexFlags is true +function stringifyRegExpWithFlags(regex, refs) { + if (!refs.applyRegexFlags || !regex.flags) { + return regex.source; + } + // Currently handled flags + const flags = { + i: regex.flags.includes("i"), + m: regex.flags.includes("m"), + s: regex.flags.includes("s"), // `.` matches newlines + }; + // The general principle here is to step through each character, one at a time, applying mutations as flags require. We keep track when the current character is escaped, and when it's inside a group /like [this]/ or (also) a range like /[a-z]/. The following is fairly brittle imperative code; edit at your peril! + const source = flags.i ? regex.source.toLowerCase() : regex.source; + let pattern = ""; + let isEscaped = false; + let inCharGroup = false; + let inCharRange = false; + for (let i = 0; i < source.length; i++) { + if (isEscaped) { + pattern += source[i]; + isEscaped = false; + continue; + } + if (flags.i) { + if (inCharGroup) { + if (source[i].match(/[a-z]/)) { + if (inCharRange) { + pattern += source[i]; + pattern += `${source[i - 2]}-${source[i]}`.toUpperCase(); + inCharRange = false; + } + else if (source[i + 1] === "-" && source[i + 2]?.match(/[a-z]/)) { + pattern += source[i]; + inCharRange = true; + } + else { + pattern += `${source[i]}${source[i].toUpperCase()}`; + } + continue; + } + } + else if (source[i].match(/[a-z]/)) { + pattern += `[${source[i]}${source[i].toUpperCase()}]`; + continue; + } + } + if (flags.m) { + if (source[i] === "^") { + pattern += `(^|(?<=[\r\n]))`; + continue; + } + else if (source[i] === "$") { + pattern += `($|(?=[\r\n]))`; + continue; + } + } + if (flags.s && source[i] === ".") { + pattern += inCharGroup ? `${source[i]}\r\n` : `[${source[i]}\r\n]`; + continue; + } + pattern += source[i]; + if (source[i] === "\\") { + isEscaped = true; + } + else if (inCharGroup && source[i] === "]") { + inCharGroup = false; + } + else if (!inCharGroup && source[i] === "[") { + inCharGroup = true; + } + } + try { + new RegExp(pattern); + } + catch { + console.warn(`Could not convert regex pattern at ${refs.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`); + return regex.source; + } + return pattern; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js new file mode 100644 index 0000000000000000000000000000000000000000..5387936219afb06b89899b253a630fd544ba0e6f --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js @@ -0,0 +1,32 @@ +import { parseDef } from "../parseDef.js"; +export function parseTupleDef(def, refs) { + if (def.rest) { + return { + type: "array", + minItems: def.items.length, + items: def.items + .map((x, i) => parseDef(x._def, { + ...refs, + currentPath: [...refs.currentPath, "items", `${i}`], + })) + .reduce((acc, x) => (x === undefined ? acc : [...acc, x]), []), + additionalItems: parseDef(def.rest._def, { + ...refs, + currentPath: [...refs.currentPath, "additionalItems"], + }), + }; + } + else { + return { + type: "array", + minItems: def.items.length, + maxItems: def.items.length, + items: def.items + .map((x, i) => parseDef(x._def, { + ...refs, + currentPath: [...refs.currentPath, "items", `${i}`], + })) + .reduce((acc, x) => (x === undefined ? acc : [...acc, x]), []), + }; + } +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js new file mode 100644 index 0000000000000000000000000000000000000000..2209eff2d0b64e0e6ca51e4e41107a897fe61e1f --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js @@ -0,0 +1,6 @@ +import { parseAnyDef } from "./any.js"; +export function parseUndefinedDef(refs) { + return { + not: parseAnyDef(refs), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/union.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/union.js new file mode 100644 index 0000000000000000000000000000000000000000..45a105fe4d1e160be0ac6a988627763efee335df --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/union.js @@ -0,0 +1,80 @@ +import { parseDef } from "../parseDef.js"; +export const primitiveMappings = { + ZodString: "string", + ZodNumber: "number", + ZodBigInt: "integer", + ZodBoolean: "boolean", + ZodNull: "null", +}; +export function parseUnionDef(def, refs) { + if (refs.target === "openApi3") + return asAnyOf(def, refs); + const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options; + // This blocks tries to look ahead a bit to produce nicer looking schemas with type array instead of anyOf. + if (options.every((x) => x._def.typeName in primitiveMappings && + (!x._def.checks || !x._def.checks.length))) { + // all types in union are primitive and lack checks, so might as well squash into {type: [...]} + const types = options.reduce((types, x) => { + const type = primitiveMappings[x._def.typeName]; //Can be safely casted due to row 43 + return type && !types.includes(type) ? [...types, type] : types; + }, []); + return { + type: types.length > 1 ? types : types[0], + }; + } + else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) { + // all options literals + const types = options.reduce((acc, x) => { + const type = typeof x._def.value; + switch (type) { + case "string": + case "number": + case "boolean": + return [...acc, type]; + case "bigint": + return [...acc, "integer"]; + case "object": + if (x._def.value === null) + return [...acc, "null"]; + case "symbol": + case "undefined": + case "function": + default: + return acc; + } + }, []); + if (types.length === options.length) { + // all the literals are primitive, as far as null can be considered primitive + const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i); + return { + type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0], + enum: options.reduce((acc, x) => { + return acc.includes(x._def.value) ? acc : [...acc, x._def.value]; + }, []), + }; + } + } + else if (options.every((x) => x._def.typeName === "ZodEnum")) { + return { + type: "string", + enum: options.reduce((acc, x) => [ + ...acc, + ...x._def.values.filter((x) => !acc.includes(x)), + ], []), + }; + } + return asAnyOf(def, refs); +} +const asAnyOf = (def, refs) => { + const anyOf = (def.options instanceof Map + ? Array.from(def.options.values()) + : def.options) + .map((x, i) => parseDef(x._def, { + ...refs, + currentPath: [...refs.currentPath, "anyOf", `${i}`], + })) + .filter((x) => !!x && + (!refs.strictUnions || + (typeof x === "object" && Object.keys(x).length > 0))); + return anyOf.length ? { anyOf } : undefined; +}; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js new file mode 100644 index 0000000000000000000000000000000000000000..6d73f8276710195a936d71dee2c158d7e8a55e74 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js @@ -0,0 +1,4 @@ +import { parseAnyDef } from "./any.js"; +export function parseUnknownDef(refs) { + return parseAnyDef(refs); +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/selectParser.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/selectParser.js new file mode 100644 index 0000000000000000000000000000000000000000..c4a05bb6afde2b082400643b408d78af76707158 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/selectParser.js @@ -0,0 +1,105 @@ +import { ZodFirstPartyTypeKind } from "zod/v3"; +import { parseAnyDef } from "./parsers/any.js"; +import { parseArrayDef } from "./parsers/array.js"; +import { parseBigintDef } from "./parsers/bigint.js"; +import { parseBooleanDef } from "./parsers/boolean.js"; +import { parseBrandedDef } from "./parsers/branded.js"; +import { parseCatchDef } from "./parsers/catch.js"; +import { parseDateDef } from "./parsers/date.js"; +import { parseDefaultDef } from "./parsers/default.js"; +import { parseEffectsDef } from "./parsers/effects.js"; +import { parseEnumDef } from "./parsers/enum.js"; +import { parseIntersectionDef } from "./parsers/intersection.js"; +import { parseLiteralDef } from "./parsers/literal.js"; +import { parseMapDef } from "./parsers/map.js"; +import { parseNativeEnumDef } from "./parsers/nativeEnum.js"; +import { parseNeverDef } from "./parsers/never.js"; +import { parseNullDef } from "./parsers/null.js"; +import { parseNullableDef } from "./parsers/nullable.js"; +import { parseNumberDef } from "./parsers/number.js"; +import { parseObjectDef } from "./parsers/object.js"; +import { parseOptionalDef } from "./parsers/optional.js"; +import { parsePipelineDef } from "./parsers/pipeline.js"; +import { parsePromiseDef } from "./parsers/promise.js"; +import { parseRecordDef } from "./parsers/record.js"; +import { parseSetDef } from "./parsers/set.js"; +import { parseStringDef } from "./parsers/string.js"; +import { parseTupleDef } from "./parsers/tuple.js"; +import { parseUndefinedDef } from "./parsers/undefined.js"; +import { parseUnionDef } from "./parsers/union.js"; +import { parseUnknownDef } from "./parsers/unknown.js"; +import { parseReadonlyDef } from "./parsers/readonly.js"; +export const selectParser = (def, typeName, refs) => { + switch (typeName) { + case ZodFirstPartyTypeKind.ZodString: + return parseStringDef(def, refs); + case ZodFirstPartyTypeKind.ZodNumber: + return parseNumberDef(def, refs); + case ZodFirstPartyTypeKind.ZodObject: + return parseObjectDef(def, refs); + case ZodFirstPartyTypeKind.ZodBigInt: + return parseBigintDef(def, refs); + case ZodFirstPartyTypeKind.ZodBoolean: + return parseBooleanDef(); + case ZodFirstPartyTypeKind.ZodDate: + return parseDateDef(def, refs); + case ZodFirstPartyTypeKind.ZodUndefined: + return parseUndefinedDef(refs); + case ZodFirstPartyTypeKind.ZodNull: + return parseNullDef(refs); + case ZodFirstPartyTypeKind.ZodArray: + return parseArrayDef(def, refs); + case ZodFirstPartyTypeKind.ZodUnion: + case ZodFirstPartyTypeKind.ZodDiscriminatedUnion: + return parseUnionDef(def, refs); + case ZodFirstPartyTypeKind.ZodIntersection: + return parseIntersectionDef(def, refs); + case ZodFirstPartyTypeKind.ZodTuple: + return parseTupleDef(def, refs); + case ZodFirstPartyTypeKind.ZodRecord: + return parseRecordDef(def, refs); + case ZodFirstPartyTypeKind.ZodLiteral: + return parseLiteralDef(def, refs); + case ZodFirstPartyTypeKind.ZodEnum: + return parseEnumDef(def); + case ZodFirstPartyTypeKind.ZodNativeEnum: + return parseNativeEnumDef(def); + case ZodFirstPartyTypeKind.ZodNullable: + return parseNullableDef(def, refs); + case ZodFirstPartyTypeKind.ZodOptional: + return parseOptionalDef(def, refs); + case ZodFirstPartyTypeKind.ZodMap: + return parseMapDef(def, refs); + case ZodFirstPartyTypeKind.ZodSet: + return parseSetDef(def, refs); + case ZodFirstPartyTypeKind.ZodLazy: + return () => def.getter()._def; + case ZodFirstPartyTypeKind.ZodPromise: + return parsePromiseDef(def, refs); + case ZodFirstPartyTypeKind.ZodNaN: + case ZodFirstPartyTypeKind.ZodNever: + return parseNeverDef(refs); + case ZodFirstPartyTypeKind.ZodEffects: + return parseEffectsDef(def, refs); + case ZodFirstPartyTypeKind.ZodAny: + return parseAnyDef(refs); + case ZodFirstPartyTypeKind.ZodUnknown: + return parseUnknownDef(refs); + case ZodFirstPartyTypeKind.ZodDefault: + return parseDefaultDef(def, refs); + case ZodFirstPartyTypeKind.ZodBranded: + return parseBrandedDef(def, refs); + case ZodFirstPartyTypeKind.ZodReadonly: + return parseReadonlyDef(def, refs); + case ZodFirstPartyTypeKind.ZodCatch: + return parseCatchDef(def, refs); + case ZodFirstPartyTypeKind.ZodPipeline: + return parsePipelineDef(def, refs); + case ZodFirstPartyTypeKind.ZodFunction: + case ZodFirstPartyTypeKind.ZodVoid: + case ZodFirstPartyTypeKind.ZodSymbol: + return undefined; + default: + return ((_) => undefined)(typeName); + } +}; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js new file mode 100644 index 0000000000000000000000000000000000000000..6359a758fcb92e480afebbfb94fef5f0f5a14c30 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js @@ -0,0 +1,87 @@ +import { parseDef } from "./parseDef.js"; +import { getRefs } from "./Refs.js"; +import { parseAnyDef } from "./parsers/any.js"; +const zodToJsonSchema = (schema, options) => { + const refs = getRefs(options); + let definitions = typeof options === "object" && options.definitions + ? Object.entries(options.definitions).reduce((acc, [name, schema]) => ({ + ...acc, + [name]: parseDef(schema._def, { + ...refs, + currentPath: [...refs.basePath, refs.definitionPath, name], + }, true) ?? parseAnyDef(refs), + }), {}) + : undefined; + const name = typeof options === "string" + ? options + : options?.nameStrategy === "title" + ? undefined + : options?.name; + const main = parseDef(schema._def, name === undefined + ? refs + : { + ...refs, + currentPath: [...refs.basePath, refs.definitionPath, name], + }, false) ?? parseAnyDef(refs); + const title = typeof options === "object" && + options.name !== undefined && + options.nameStrategy === "title" + ? options.name + : undefined; + if (title !== undefined) { + main.title = title; + } + if (refs.flags.hasReferencedOpenAiAnyType) { + if (!definitions) { + definitions = {}; + } + if (!definitions[refs.openAiAnyTypeName]) { + definitions[refs.openAiAnyTypeName] = { + // Skipping "object" as no properties can be defined and additionalProperties must be "false" + type: ["string", "number", "integer", "boolean", "array", "null"], + items: { + $ref: refs.$refStrategy === "relative" + ? "1" + : [ + ...refs.basePath, + refs.definitionPath, + refs.openAiAnyTypeName, + ].join("/"), + }, + }; + } + } + const combined = name === undefined + ? definitions + ? { + ...main, + [refs.definitionPath]: definitions, + } + : main + : { + $ref: [ + ...(refs.$refStrategy === "relative" ? [] : refs.basePath), + refs.definitionPath, + name, + ].join("/"), + [refs.definitionPath]: { + ...definitions, + [name]: main, + }, + }; + if (refs.target === "jsonSchema7") { + combined.$schema = "http://json-schema.org/draft-07/schema#"; + } + else if (refs.target === "jsonSchema2019-09" || refs.target === "openAi") { + combined.$schema = "https://json-schema.org/draft/2019-09/schema#"; + } + if (refs.target === "openAi" && + ("anyOf" in combined || + "oneOf" in combined || + "allOf" in combined || + ("type" in combined && Array.isArray(combined.type)))) { + console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."); + } + return combined; +}; +export { zodToJsonSchema }; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/Options.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/Options.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..882f6ac77a3d0f6b1f4f72033e0b37d5104fb8ff --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/Options.d.ts @@ -0,0 +1,37 @@ +import { ZodSchema, ZodTypeDef } from "zod/v3"; +import { Refs, Seen } from "./Refs"; +import { JsonSchema7Type } from "./parseTypes"; +export type Targets = "jsonSchema7" | "jsonSchema2019-09" | "openApi3" | "openAi"; +export type DateStrategy = "format:date-time" | "format:date" | "string" | "integer"; +export declare const ignoreOverride: unique symbol; +export type OverrideCallback = (def: ZodTypeDef, refs: Refs, seen: Seen | undefined, forceResolution?: boolean) => JsonSchema7Type | undefined | typeof ignoreOverride; +export type PostProcessCallback = (jsonSchema: JsonSchema7Type | undefined, def: ZodTypeDef, refs: Refs) => JsonSchema7Type | undefined; +export declare const jsonDescription: PostProcessCallback; +export type Options = { + name: string | undefined; + $refStrategy: "root" | "relative" | "none" | "seen"; + basePath: string[]; + effectStrategy: "input" | "any"; + pipeStrategy: "input" | "output" | "all"; + dateStrategy: DateStrategy | DateStrategy[]; + mapStrategy: "entries" | "record"; + removeAdditionalStrategy: "passthrough" | "strict"; + allowedAdditionalProperties: true | undefined; + rejectedAdditionalProperties: false | undefined; + target: Target; + strictUnions: boolean; + definitionPath: string; + definitions: Record; + errorMessages: boolean; + markdownDescription: boolean; + patternStrategy: "escape" | "preserve"; + applyRegexFlags: boolean; + emailStrategy: "format:email" | "format:idn-email" | "pattern:zod"; + base64Strategy: "format:binary" | "contentEncoding:base64" | "pattern:zod"; + nameStrategy: "ref" | "title"; + override?: OverrideCallback; + postProcess?: PostProcessCallback; + openAiAnyTypeName: string; +}; +export declare const defaultOptions: Options; +export declare const getDefaultOptions: (options: string | Partial> | undefined) => Options; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/Refs.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/Refs.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..482838f3b4456ed0b1013d8f9fca22bd0709a831 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/Refs.d.ts @@ -0,0 +1,17 @@ +import { ZodTypeDef } from "zod/v3"; +import { Options, Targets } from "./Options.js"; +import { JsonSchema7Type } from "./parseTypes.js"; +export type Refs = { + seen: Map; + currentPath: string[]; + propertyPath: string[] | undefined; + flags: { + hasReferencedOpenAiAnyType: boolean; + }; +} & Options; +export type Seen = { + def: ZodTypeDef; + path: string[]; + jsonSchema: JsonSchema7Type | undefined; +}; +export declare const getRefs: (options?: string | Partial>) => Refs; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/errorMessages.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/errorMessages.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..85cb5624803cfdd58233746e30713251eba27c86 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/errorMessages.d.ts @@ -0,0 +1,15 @@ +import { JsonSchema7TypeUnion } from "./parseTypes.js"; +import { Refs } from "./Refs.js"; +export type ErrorMessages = Partial>; +export declare function addErrorMessage; +}>(res: T, key: keyof T, errorMessage: string | undefined, refs: Refs): void; +export declare function setResponseValueAndErrors; +}, Key extends keyof Omit>(res: Json7Type, key: Key, value: Json7Type[Key], errorMessage: string | undefined, refs: Refs): void; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/getRelativePath.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/getRelativePath.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5cf67e314fb847562ebc542cfa4d533534ff2fc8 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/getRelativePath.d.ts @@ -0,0 +1 @@ +export declare const getRelativePath: (pathA: string[], pathB: string[]) => string; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/index.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cdfb5306e4cb4f7362c269baeff84c525cda93be --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/index.d.ts @@ -0,0 +1,40 @@ +export * from "./Options.js"; +export * from "./Refs.js"; +export * from "./errorMessages.js"; +export * from "./getRelativePath.js"; +export * from "./parseDef.js"; +export * from "./parseTypes.js"; +export * from "./parsers/any.js"; +export * from "./parsers/array.js"; +export * from "./parsers/bigint.js"; +export * from "./parsers/boolean.js"; +export * from "./parsers/branded.js"; +export * from "./parsers/catch.js"; +export * from "./parsers/date.js"; +export * from "./parsers/default.js"; +export * from "./parsers/effects.js"; +export * from "./parsers/enum.js"; +export * from "./parsers/intersection.js"; +export * from "./parsers/literal.js"; +export * from "./parsers/map.js"; +export * from "./parsers/nativeEnum.js"; +export * from "./parsers/never.js"; +export * from "./parsers/null.js"; +export * from "./parsers/nullable.js"; +export * from "./parsers/number.js"; +export * from "./parsers/object.js"; +export * from "./parsers/optional.js"; +export * from "./parsers/pipeline.js"; +export * from "./parsers/promise.js"; +export * from "./parsers/readonly.js"; +export * from "./parsers/record.js"; +export * from "./parsers/set.js"; +export * from "./parsers/string.js"; +export * from "./parsers/tuple.js"; +export * from "./parsers/undefined.js"; +export * from "./parsers/union.js"; +export * from "./parsers/unknown.js"; +export * from "./selectParser.js"; +export * from "./zodToJsonSchema.js"; +import { zodToJsonSchema } from "./zodToJsonSchema.js"; +export default zodToJsonSchema; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parseDef.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parseDef.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cbbf0d7eeda0b2875ccfed7f83a24116ceef7228 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parseDef.d.ts @@ -0,0 +1,4 @@ +import { ZodTypeDef } from "zod/v3"; +import { Refs } from "./Refs.js"; +import { JsonSchema7Type } from "./parseTypes.js"; +export declare function parseDef(def: ZodTypeDef, refs: Refs, forceResolution?: boolean): JsonSchema7Type | undefined; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parseTypes.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parseTypes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dbfa17c84459253b55bd441440d4ce6b254e344d --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parseTypes.d.ts @@ -0,0 +1,34 @@ +import { JsonSchema7AnyType } from "./parsers/any.js"; +import { JsonSchema7ArrayType } from "./parsers/array.js"; +import { JsonSchema7BigintType } from "./parsers/bigint.js"; +import { JsonSchema7BooleanType } from "./parsers/boolean.js"; +import { JsonSchema7DateType } from "./parsers/date.js"; +import { JsonSchema7EnumType } from "./parsers/enum.js"; +import { JsonSchema7AllOfType } from "./parsers/intersection.js"; +import { JsonSchema7LiteralType } from "./parsers/literal.js"; +import { JsonSchema7MapType } from "./parsers/map.js"; +import { JsonSchema7NativeEnumType } from "./parsers/nativeEnum.js"; +import { JsonSchema7NeverType } from "./parsers/never.js"; +import { JsonSchema7NullType } from "./parsers/null.js"; +import { JsonSchema7NullableType } from "./parsers/nullable.js"; +import { JsonSchema7NumberType } from "./parsers/number.js"; +import { JsonSchema7ObjectType } from "./parsers/object.js"; +import { JsonSchema7RecordType } from "./parsers/record.js"; +import { JsonSchema7SetType } from "./parsers/set.js"; +import { JsonSchema7StringType } from "./parsers/string.js"; +import { JsonSchema7TupleType } from "./parsers/tuple.js"; +import { JsonSchema7UndefinedType } from "./parsers/undefined.js"; +import { JsonSchema7UnionType } from "./parsers/union.js"; +import { JsonSchema7UnknownType } from "./parsers/unknown.js"; +type JsonSchema7RefType = { + $ref: string; +}; +type JsonSchema7Meta = { + title?: string; + default?: any; + description?: string; + markdownDescription?: string; +}; +export type JsonSchema7TypeUnion = JsonSchema7StringType | JsonSchema7ArrayType | JsonSchema7NumberType | JsonSchema7BigintType | JsonSchema7BooleanType | JsonSchema7DateType | JsonSchema7EnumType | JsonSchema7LiteralType | JsonSchema7NativeEnumType | JsonSchema7NullType | JsonSchema7NumberType | JsonSchema7ObjectType | JsonSchema7RecordType | JsonSchema7TupleType | JsonSchema7UnionType | JsonSchema7UndefinedType | JsonSchema7RefType | JsonSchema7NeverType | JsonSchema7MapType | JsonSchema7AnyType | JsonSchema7NullableType | JsonSchema7AllOfType | JsonSchema7UnknownType | JsonSchema7SetType; +export type JsonSchema7Type = JsonSchema7TypeUnion & JsonSchema7Meta; +export {}; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/any.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/any.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..88deab458bfc1bb933a112d9250d10b2f5d5f99b --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/any.d.ts @@ -0,0 +1,5 @@ +import { Refs } from "../Refs.js"; +export type JsonSchema7AnyType = { + $ref?: string; +}; +export declare function parseAnyDef(refs: Refs): JsonSchema7AnyType; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/array.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/array.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a8049318e1e7f870564b5670a6abf695e08876e8 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/array.d.ts @@ -0,0 +1,12 @@ +import { ZodArrayDef } from "zod/v3"; +import { ErrorMessages } from "../errorMessages.js"; +import { JsonSchema7Type } from "../parseTypes.js"; +import { Refs } from "../Refs.js"; +export type JsonSchema7ArrayType = { + type: "array"; + items?: JsonSchema7Type; + minItems?: number; + maxItems?: number; + errorMessages?: ErrorMessages; +}; +export declare function parseArrayDef(def: ZodArrayDef, refs: Refs): JsonSchema7ArrayType; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/bigint.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/bigint.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..44ad42b9446084690f0ab1803a15565e6a42a43a --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/bigint.d.ts @@ -0,0 +1,14 @@ +import { ZodBigIntDef } from "zod/v3"; +import { Refs } from "../Refs.js"; +import { ErrorMessages } from "../errorMessages.js"; +export type JsonSchema7BigintType = { + type: "integer"; + format: "int64"; + minimum?: BigInt; + exclusiveMinimum?: BigInt; + maximum?: BigInt; + exclusiveMaximum?: BigInt; + multipleOf?: BigInt; + errorMessage?: ErrorMessages; +}; +export declare function parseBigintDef(def: ZodBigIntDef, refs: Refs): JsonSchema7BigintType; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/boolean.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/boolean.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c69bb884f0adf0d8f6ffef25f42bc5571055f33c --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/boolean.d.ts @@ -0,0 +1,4 @@ +export type JsonSchema7BooleanType = { + type: "boolean"; +}; +export declare function parseBooleanDef(): JsonSchema7BooleanType; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/branded.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/branded.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cf319c2a77f3f552b0ebb8af16ee1578a33d45e4 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/branded.d.ts @@ -0,0 +1,3 @@ +import { ZodBrandedDef } from "zod/v3"; +import { Refs } from "../Refs.js"; +export declare function parseBrandedDef(_def: ZodBrandedDef, refs: Refs): import("../parseTypes.js").JsonSchema7Type | undefined; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/catch.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/catch.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..92693e92e8619d458a2b3b6e59259895f31b50ec --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/catch.d.ts @@ -0,0 +1,3 @@ +import { ZodCatchDef } from "zod/v3"; +import { Refs } from "../Refs.js"; +export declare const parseCatchDef: (def: ZodCatchDef, refs: Refs) => import("../parseTypes.js").JsonSchema7Type | undefined; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/date.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/date.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d3cc800bf0e4b4976ffc25f8cf3154247a94edaf --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/date.d.ts @@ -0,0 +1,15 @@ +import { ZodDateDef } from "zod/v3"; +import { Refs } from "../Refs.js"; +import { ErrorMessages } from "../errorMessages.js"; +import { JsonSchema7NumberType } from "./number.js"; +import { DateStrategy } from "../Options.js"; +export type JsonSchema7DateType = { + type: "integer" | "string"; + format: "unix-time" | "date-time" | "date"; + minimum?: number; + maximum?: number; + errorMessage?: ErrorMessages; +} | { + anyOf: JsonSchema7DateType[]; +}; +export declare function parseDateDef(def: ZodDateDef, refs: Refs, overrideDateStrategy?: DateStrategy): JsonSchema7DateType; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/default.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/default.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..58c6ae94f1f98546346c2908a7a7cd66adc9bf90 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/default.d.ts @@ -0,0 +1,6 @@ +import { ZodDefaultDef } from "zod/v3"; +import { JsonSchema7Type } from "../parseTypes.js"; +import { Refs } from "../Refs.js"; +export declare function parseDefaultDef(_def: ZodDefaultDef, refs: Refs): JsonSchema7Type & { + default: any; +}; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/effects.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/effects.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..15239c720a20691f9bc10b18e3351fe7066416b2 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/effects.d.ts @@ -0,0 +1,4 @@ +import { ZodEffectsDef } from "zod/v3"; +import { JsonSchema7Type } from "../parseTypes.js"; +import { Refs } from "../Refs.js"; +export declare function parseEffectsDef(_def: ZodEffectsDef, refs: Refs): JsonSchema7Type | undefined; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/enum.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/enum.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ce30dbb7c05c50939eec04dbc942047de1dd0919 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/enum.d.ts @@ -0,0 +1,6 @@ +import { ZodEnumDef } from "zod/v3"; +export type JsonSchema7EnumType = { + type: "string"; + enum: string[]; +}; +export declare function parseEnumDef(def: ZodEnumDef): JsonSchema7EnumType; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/intersection.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/intersection.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d86a349b591996c79aaf509a21fa0611b2346b2c --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/intersection.d.ts @@ -0,0 +1,8 @@ +import { ZodIntersectionDef } from "zod/v3"; +import { JsonSchema7Type } from "../parseTypes.js"; +import { Refs } from "../Refs.js"; +export type JsonSchema7AllOfType = { + allOf: JsonSchema7Type[]; + unevaluatedProperties?: boolean; +}; +export declare function parseIntersectionDef(def: ZodIntersectionDef, refs: Refs): JsonSchema7AllOfType | JsonSchema7Type | undefined; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/literal.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/literal.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1e55226a89d410cd73667a92f2f522c5588bc70d --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/literal.d.ts @@ -0,0 +1,9 @@ +import { ZodLiteralDef } from "zod/v3"; +import { Refs } from "../Refs.js"; +export type JsonSchema7LiteralType = { + type: "string" | "number" | "integer" | "boolean"; + const: string | number | boolean; +} | { + type: "object" | "array"; +}; +export declare function parseLiteralDef(def: ZodLiteralDef, refs: Refs): JsonSchema7LiteralType; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/map.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/map.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3663e7ae2aa6089eacb756c3e4b4761caf9bd0b1 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/map.d.ts @@ -0,0 +1,15 @@ +import { ZodMapDef } from "zod/v3"; +import { JsonSchema7Type } from "../parseTypes.js"; +import { Refs } from "../Refs.js"; +import { JsonSchema7RecordType } from "./record.js"; +export type JsonSchema7MapType = { + type: "array"; + maxItems: 125; + items: { + type: "array"; + items: [JsonSchema7Type, JsonSchema7Type]; + minItems: 2; + maxItems: 2; + }; +}; +export declare function parseMapDef(def: ZodMapDef, refs: Refs): JsonSchema7MapType | JsonSchema7RecordType; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/nativeEnum.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/nativeEnum.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6be16b02e25f7406781de58f2d65c2d2b5c718ef --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/nativeEnum.d.ts @@ -0,0 +1,6 @@ +import { ZodNativeEnumDef } from "zod/v3"; +export type JsonSchema7NativeEnumType = { + type: "string" | "number" | ["string", "number"]; + enum: (string | number)[]; +}; +export declare function parseNativeEnumDef(def: ZodNativeEnumDef): JsonSchema7NativeEnumType; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/never.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/never.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1301358fe414c7ab06ecdef624273c13532ca896 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/never.d.ts @@ -0,0 +1,6 @@ +import { Refs } from "../Refs.js"; +import { JsonSchema7AnyType } from "./any.js"; +export type JsonSchema7NeverType = { + not: JsonSchema7AnyType; +}; +export declare function parseNeverDef(refs: Refs): JsonSchema7NeverType | undefined; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/null.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/null.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..509a568a817d0e245445045c61f48aa488e755c2 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/null.d.ts @@ -0,0 +1,5 @@ +import { Refs } from "../Refs.js"; +export type JsonSchema7NullType = { + type: "null"; +}; +export declare function parseNullDef(refs: Refs): JsonSchema7NullType; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/nullable.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/nullable.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..68fc4daca400abd5dbb475dc9b113c5b3c2275ce --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/nullable.d.ts @@ -0,0 +1,10 @@ +import { ZodNullableDef } from "zod/v3"; +import { JsonSchema7Type } from "../parseTypes.js"; +import { Refs } from "../Refs.js"; +import { JsonSchema7NullType } from "./null.js"; +export type JsonSchema7NullableType = { + anyOf: [JsonSchema7Type, JsonSchema7NullType]; +} | { + type: [string, "null"]; +}; +export declare function parseNullableDef(def: ZodNullableDef, refs: Refs): JsonSchema7NullableType | undefined; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/number.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/number.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6aca58678a07e29ad675be9f591bc9b9e356f5ff --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/number.d.ts @@ -0,0 +1,13 @@ +import { ZodNumberDef } from "zod/v3"; +import { ErrorMessages } from "../errorMessages.js"; +import { Refs } from "../Refs.js"; +export type JsonSchema7NumberType = { + type: "number" | "integer"; + minimum?: number; + exclusiveMinimum?: number; + maximum?: number; + exclusiveMaximum?: number; + multipleOf?: number; + errorMessage?: ErrorMessages; +}; +export declare function parseNumberDef(def: ZodNumberDef, refs: Refs): JsonSchema7NumberType; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/object.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/object.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6269c6206e8c319c73de332f1a62656077bd69b5 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/object.d.ts @@ -0,0 +1,10 @@ +import { ZodObjectDef } from "zod/v3"; +import { JsonSchema7Type } from "../parseTypes.js"; +import { Refs } from "../Refs.js"; +export type JsonSchema7ObjectType = { + type: "object"; + properties: Record; + additionalProperties?: boolean | JsonSchema7Type; + required?: string[]; +}; +export declare function parseObjectDef(def: ZodObjectDef, refs: Refs): JsonSchema7ObjectType; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/optional.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/optional.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7799cd0608795183ef6ea8c302456c00181cf2da --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/optional.d.ts @@ -0,0 +1,4 @@ +import { ZodOptionalDef } from "zod/v3"; +import { JsonSchema7Type } from "../parseTypes.js"; +import { Refs } from "../Refs.js"; +export declare const parseOptionalDef: (def: ZodOptionalDef, refs: Refs) => JsonSchema7Type | undefined; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/pipeline.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/pipeline.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0382eacf3098e4437928afdb02bc2c3f28d26a2a --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/pipeline.d.ts @@ -0,0 +1,5 @@ +import { ZodPipelineDef } from "zod/v3"; +import { JsonSchema7Type } from "../parseTypes.js"; +import { Refs } from "../Refs.js"; +import { JsonSchema7AllOfType } from "./intersection.js"; +export declare const parsePipelineDef: (def: ZodPipelineDef, refs: Refs) => JsonSchema7AllOfType | JsonSchema7Type | undefined; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/promise.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/promise.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9b0d55a838987bff92f5a619e7e94c5c747d74f4 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/promise.d.ts @@ -0,0 +1,4 @@ +import { ZodPromiseDef } from "zod/v3"; +import { JsonSchema7Type } from "../parseTypes.js"; +import { Refs } from "../Refs.js"; +export declare function parsePromiseDef(def: ZodPromiseDef, refs: Refs): JsonSchema7Type | undefined; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/readonly.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/readonly.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bf5b480262bff422e5536f8bb71141918f24f829 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/readonly.d.ts @@ -0,0 +1,3 @@ +import { ZodReadonlyDef } from "zod/v3"; +import { Refs } from "../Refs.js"; +export declare const parseReadonlyDef: (def: ZodReadonlyDef, refs: Refs) => import("../parseTypes.js").JsonSchema7Type | undefined; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/record.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/record.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..784d378d100d8b31c807a1fba0b9a513304673d1 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/record.d.ts @@ -0,0 +1,13 @@ +import { ZodMapDef, ZodRecordDef, ZodTypeAny } from "zod/v3"; +import { JsonSchema7Type } from "../parseTypes.js"; +import { Refs } from "../Refs.js"; +import { JsonSchema7EnumType } from "./enum.js"; +import { JsonSchema7StringType } from "./string.js"; +type JsonSchema7RecordPropertyNamesType = Omit | Omit; +export type JsonSchema7RecordType = { + type: "object"; + additionalProperties?: JsonSchema7Type | true; + propertyNames?: JsonSchema7RecordPropertyNamesType; +}; +export declare function parseRecordDef(def: ZodRecordDef | ZodMapDef, refs: Refs): JsonSchema7RecordType; +export {}; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/set.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/set.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d527b48f5009d7dc5326258cff9688ed8e33c6a1 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/set.d.ts @@ -0,0 +1,13 @@ +import { ZodSetDef } from "zod/v3"; +import { ErrorMessages } from "../errorMessages.js"; +import { JsonSchema7Type } from "../parseTypes.js"; +import { Refs } from "../Refs.js"; +export type JsonSchema7SetType = { + type: "array"; + uniqueItems: true; + items?: JsonSchema7Type; + minItems?: number; + maxItems?: number; + errorMessage?: ErrorMessages; +}; +export declare function parseSetDef(def: ZodSetDef, refs: Refs): JsonSchema7SetType; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/string.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/string.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..296e75c3f1e6424090dab686f81765ccd29a903d --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/string.d.ts @@ -0,0 +1,73 @@ +import { ZodStringDef } from "zod/v3"; +import { ErrorMessages } from "../errorMessages.js"; +import { Refs } from "../Refs.js"; +/** + * Generated from the regular expressions found here as of 2024-05-22: + * https://github.com/colinhacks/zod/blob/master/src/types.ts. + * + * Expressions with /i flag have been changed accordingly. + */ +export declare const zodPatterns: { + /** + * `c` was changed to `[cC]` to replicate /i flag + */ + readonly cuid: RegExp; + readonly cuid2: RegExp; + readonly ulid: RegExp; + /** + * `a-z` was added to replicate /i flag + */ + readonly email: RegExp; + /** + * Constructed a valid Unicode RegExp + * + * Lazily instantiate since this type of regex isn't supported + * in all envs (e.g. React Native). + * + * See: + * https://github.com/colinhacks/zod/issues/2433 + * Fix in Zod: + * https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b + */ + readonly emoji: () => RegExp; + /** + * Unused + */ + readonly uuid: RegExp; + /** + * Unused + */ + readonly ipv4: RegExp; + readonly ipv4Cidr: RegExp; + /** + * Unused + */ + readonly ipv6: RegExp; + readonly ipv6Cidr: RegExp; + readonly base64: RegExp; + readonly base64url: RegExp; + readonly nanoid: RegExp; + readonly jwt: RegExp; +}; +export type JsonSchema7StringType = { + type: "string"; + minLength?: number; + maxLength?: number; + format?: "email" | "idn-email" | "uri" | "uuid" | "date-time" | "ipv4" | "ipv6" | "date" | "time" | "duration"; + pattern?: string; + allOf?: { + pattern: string; + errorMessage?: ErrorMessages<{ + pattern: string; + }>; + }[]; + anyOf?: { + format: string; + errorMessage?: ErrorMessages<{ + format: string; + }>; + }[]; + errorMessage?: ErrorMessages; + contentEncoding?: string; +}; +export declare function parseStringDef(def: ZodStringDef, refs: Refs): JsonSchema7StringType; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/tuple.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/tuple.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..25a5833be43b975575d4ee30c85c33148fd16b87 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/tuple.d.ts @@ -0,0 +1,13 @@ +import { ZodTupleDef, ZodTupleItems, ZodTypeAny } from "zod/v3"; +import { JsonSchema7Type } from "../parseTypes.js"; +import { Refs } from "../Refs.js"; +export type JsonSchema7TupleType = { + type: "array"; + minItems: number; + items: JsonSchema7Type[]; +} & ({ + maxItems: number; +} | { + additionalItems?: JsonSchema7Type; +}); +export declare function parseTupleDef(def: ZodTupleDef, refs: Refs): JsonSchema7TupleType; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/undefined.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/undefined.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..48e891921dfcb344623b6b409c243b3d5fc9dd6c --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/undefined.d.ts @@ -0,0 +1,6 @@ +import { Refs } from "../Refs.js"; +import { JsonSchema7AnyType } from "./any.js"; +export type JsonSchema7UndefinedType = { + not: JsonSchema7AnyType; +}; +export declare function parseUndefinedDef(refs: Refs): JsonSchema7UndefinedType; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/union.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/union.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cd9e498005a1ca6cc533939caf9b1316c7945307 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/union.d.ts @@ -0,0 +1,23 @@ +import { ZodDiscriminatedUnionDef, ZodUnionDef } from "zod/v3"; +import { JsonSchema7Type } from "../parseTypes.js"; +import { Refs } from "../Refs.js"; +export declare const primitiveMappings: { + readonly ZodString: "string"; + readonly ZodNumber: "number"; + readonly ZodBigInt: "integer"; + readonly ZodBoolean: "boolean"; + readonly ZodNull: "null"; +}; +type JsonSchema7Primitive = (typeof primitiveMappings)[keyof typeof primitiveMappings]; +export type JsonSchema7UnionType = JsonSchema7PrimitiveUnionType | JsonSchema7AnyOfType; +type JsonSchema7PrimitiveUnionType = { + type: JsonSchema7Primitive | JsonSchema7Primitive[]; +} | { + type: JsonSchema7Primitive | JsonSchema7Primitive[]; + enum: (string | number | bigint | boolean | null)[]; +}; +type JsonSchema7AnyOfType = { + anyOf: JsonSchema7Type[]; +}; +export declare function parseUnionDef(def: ZodUnionDef | ZodDiscriminatedUnionDef, refs: Refs): JsonSchema7PrimitiveUnionType | JsonSchema7AnyOfType | undefined; +export {}; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/unknown.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/unknown.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a905d03530a71b8509c31ac24e8d6947f2f13c79 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/parsers/unknown.d.ts @@ -0,0 +1,4 @@ +import { Refs } from "../Refs"; +import { JsonSchema7AnyType } from "./any.js"; +export type JsonSchema7UnknownType = JsonSchema7AnyType; +export declare function parseUnknownDef(refs: Refs): JsonSchema7UnknownType; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/selectParser.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/selectParser.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..39bee49509718c11a97d6b4b33efc9e16bdc9861 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/selectParser.d.ts @@ -0,0 +1,5 @@ +import { ZodFirstPartyTypeKind } from "zod/v3"; +import { Refs } from "./Refs.js"; +import { JsonSchema7Type } from "./parseTypes.js"; +export type InnerDefGetter = () => any; +export declare const selectParser: (def: any, typeName: ZodFirstPartyTypeKind, refs: Refs) => JsonSchema7Type | undefined | InnerDefGetter; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/zodToJsonSchema.d.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/zodToJsonSchema.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..17853b7e0382d61de7eb79e700850ec642fd0db0 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/dist/types/zodToJsonSchema.d.ts @@ -0,0 +1,10 @@ +import { ZodSchema } from "zod/v3"; +import { Options, Targets } from "./Options.js"; +import { JsonSchema7Type } from "./parseTypes.js"; +declare const zodToJsonSchema: (schema: ZodSchema, options?: string | Partial> | undefined) => (Target extends "jsonSchema7" ? JsonSchema7Type : object) & { + $schema?: string | undefined; + definitions?: { + [key: string]: Target extends "jsonSchema7" ? JsonSchema7Type : Target extends "jsonSchema2019-09" ? JsonSchema7Type : object; + } | undefined; +}; +export { zodToJsonSchema }; diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/package.json b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/package.json new file mode 100644 index 0000000000000000000000000000000000000000..75b3274a2624d7786ba8f6e7b250c15a2aa8311f --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/package.json @@ -0,0 +1,85 @@ +{ + "name": "zod-to-json-schema", + "version": "3.25.2", + "description": "Converts Zod schemas to Json Schemas", + "types": "./dist/types/index.d.ts", + "main": "./dist/cjs/index.js", + "module": "./dist/esm/index.js", + "exports": { + "import": { + "types": "./dist/types/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/types/index.d.ts", + "default": "./dist/cjs/index.js" + } + }, + "scripts": { + "build:test": "npm --prefix ./dist-test-v3 test && npm --prefix ./dist-test-v4 test", + "build:types": "tsc -p tsconfig.types.json", + "build:cjs": "tsc -p tsconfig.cjs.json && tsx postcjs.ts", + "build:esm": "tsc -p tsconfig.esm.json && tsx postesm.ts", + "build": "npm i && npm run gen && npm test && rimraf ./dist && npm run build:types && npm run build:cjs && npm run build:esm && npm run build:test", + "dry": "npm run build && npm pub --dry-run", + "test:watch": "tsx watch test/index.ts", + "test:gen": "tsx test/createIndex.ts", + "test": "tsx test/index.ts", + "gen": "tsx createIndex.ts" + }, + "keywords": [ + "zod", + "json", + "schema", + "open", + "api", + "conversion" + ], + "author": "Stefan Terdell", + "contributors": [ + "Hammad Asif (https://github.com/mrhammadasif)", + "Noah Rosenzweig (https://github.com/Noah2610)", + "John Wright (https://github.com/johngeorgewright)", + "Krzysztof Ciombor (https://github.com/krzysztofciombor)", + "Yuta Mombetsu (https://github.com/mokocm)", + "Tom Arad (https://github.com/tomarad)", + "Isaac Way (https://github.com/iway1)", + "Andreas Berger (https://github.com/Andy2003)", + "Jan Potoms (https://github.com/Janpot)", + "Santiago Cammi (https://github.com/scammi)", + "Philipp Burckhardt (https://github.com/Planeshifter)", + "Bram del Canho (https://github.com/Bram-dc)", + "Gilad Hecht (https://github.com/gthecht)", + "Colin McDonnell (https://github.com/colinhacks)", + "Spappz (https://github.com/Spappz)", + "Jacob Lee (https://github.com/jacoblee93)", + "Brett Zamir (https://github.com/brettz9)", + "Isaiah Marc Sanchez (https://github.com/imsanchez)", + "Mitchell Merry (https://github.com/mitchell-merry)", + "Enzo Monjardín (https://github.com/enzomonjardin)", + "Víctor Hernández (https://github.com/NanezX)", + "Faïz Hernawan Abdillah (https://github.com/Abdillah)", + "Felix Mosheev (https://github.com/felixmosh)" + ], + "repository": { + "type": "git", + "url": "https://github.com/StefanTerdell/zod-to-json-schema" + }, + "license": "ISC", + "peerDependencies": { + "zod": "^3.25.28 || ^4" + }, + "devDependencies": { + "@types/json-schema": "^7.0.9", + "@types/node": "^20.9.0", + "ajv": "^8.6.3", + "ajv-errors": "^3.0.0", + "ajv-formats": "^2.1.1", + "fast-diff": "^1.3.0", + "local-ref-resolver": "^0.2.0", + "rimraf": "^6.1.3", + "tsx": "^4.19.0", + "typescript": "^5.1.3", + "zod": "^3.25.28 || ^4" + } +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/postcjs.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/postcjs.ts new file mode 100644 index 0000000000000000000000000000000000000000..57c29eb60908798cb61c26613d4150cf25e2af20 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/postcjs.ts @@ -0,0 +1,3 @@ +import { writeFileSync } from "fs"; + +writeFileSync("./dist/cjs/package.json", '{"type":"commonjs"}', "utf-8"); diff --git a/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/postesm.ts b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/postesm.ts new file mode 100644 index 0000000000000000000000000000000000000000..d9a7429fe55f096a22086ab037fc503c6f88344d --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod-to-json-schema/postesm.ts @@ -0,0 +1,3 @@ +import { writeFileSync } from "fs"; + +writeFileSync("./dist/esm/package.json", '{"type":"module","main":"index.js"}', "utf-8"); diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4-mini/index.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4-mini/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..bb95da0a24829980395bc1300b1edcc8474b3dfb --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4-mini/index.ts @@ -0,0 +1,3 @@ +import * as z from "../v4/mini/external.js"; +export * from "../v4/mini/external.js"; +export { z }; diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/locales/es.test.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/locales/es.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..280934e11409651a5e9cf9af66bee4b834fd7171 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/locales/es.test.ts @@ -0,0 +1,181 @@ +import { expect, test } from "vitest"; +import { z } from "../../../../index.js"; +import es from "../../../locales/es.js"; + +test("Spanish locale - type name translations in too_small errors", () => { + z.config(es()); + + // Test string type translation + const stringSchema = z.string().min(5); + const stringResult = stringSchema.safeParse("abc"); + expect(stringResult.success).toBe(false); + if (!stringResult.success) { + expect(stringResult.error.issues[0].message).toBe( + "Demasiado pequeño: se esperaba que texto tuviera >=5 caracteres" + ); + } + + // Test number type translation + const numberSchema = z.number().min(10); + const numberResult = numberSchema.safeParse(5); + expect(numberResult.success).toBe(false); + if (!numberResult.success) { + expect(numberResult.error.issues[0].message).toBe("Demasiado pequeño: se esperaba que número fuera >=10"); + } + + // Test array type translation + const arraySchema = z.array(z.string()).min(3); + const arrayResult = arraySchema.safeParse(["a", "b"]); + expect(arrayResult.success).toBe(false); + if (!arrayResult.success) { + expect(arrayResult.error.issues[0].message).toBe( + "Demasiado pequeño: se esperaba que arreglo tuviera >=3 elementos" + ); + } + + // Test set type translation + const setSchema = z.set(z.string()).min(2); + const setResult = setSchema.safeParse(new Set(["a"])); + expect(setResult.success).toBe(false); + if (!setResult.success) { + expect(setResult.error.issues[0].message).toBe("Demasiado pequeño: se esperaba que conjunto tuviera >=2 elementos"); + } +}); + +test("Spanish locale - type name translations in too_big errors", () => { + z.config(es()); + + // Test string type translation + const stringSchema = z.string().max(3); + const stringResult = stringSchema.safeParse("abcde"); + expect(stringResult.success).toBe(false); + if (!stringResult.success) { + expect(stringResult.error.issues[0].message).toBe("Demasiado grande: se esperaba que texto tuviera <=3 caracteres"); + } + + // Test number type translation + const numberSchema = z.number().max(10); + const numberResult = numberSchema.safeParse(15); + expect(numberResult.success).toBe(false); + if (!numberResult.success) { + expect(numberResult.error.issues[0].message).toBe("Demasiado grande: se esperaba que número fuera <=10"); + } + + // Test array type translation + const arraySchema = z.array(z.string()).max(2); + const arrayResult = arraySchema.safeParse(["a", "b", "c"]); + expect(arrayResult.success).toBe(false); + if (!arrayResult.success) { + expect(arrayResult.error.issues[0].message).toBe("Demasiado grande: se esperaba que arreglo tuviera <=2 elementos"); + } +}); + +test("Spanish locale - type name translations in invalid_type errors", () => { + z.config(es()); + + // Test string expected, number received + const stringSchema = z.string(); + const stringResult = stringSchema.safeParse(123); + expect(stringResult.success).toBe(false); + if (!stringResult.success) { + expect(stringResult.error.issues[0].message).toBe("Entrada inválida: se esperaba texto, recibido número"); + } + + // Test number expected, string received + const numberSchema = z.number(); + const numberResult = numberSchema.safeParse("abc"); + expect(numberResult.success).toBe(false); + if (!numberResult.success) { + expect(numberResult.error.issues[0].message).toBe("Entrada inválida: se esperaba número, recibido texto"); + } + + // Test boolean expected, null received + const booleanSchema = z.boolean(); + const booleanResult = booleanSchema.safeParse(null); + expect(booleanResult.success).toBe(false); + if (!booleanResult.success) { + expect(booleanResult.error.issues[0].message).toBe("Entrada inválida: se esperaba booleano, recibido nulo"); + } + + // Test array expected, object received + const arraySchema = z.array(z.string()); + const arrayResult = arraySchema.safeParse({}); + expect(arrayResult.success).toBe(false); + if (!arrayResult.success) { + expect(arrayResult.error.issues[0].message).toBe("Entrada inválida: se esperaba arreglo, recibido objeto"); + } +}); + +test("Spanish locale - fallback for unknown type names", () => { + z.config(es()); + + // Test with a type that's not in the TypeNames dictionary + // This will test the fallback behavior + const dateSchema = z.date().min(new Date("2025-01-01")); + const dateResult = dateSchema.safeParse(new Date("2024-01-01")); + expect(dateResult.success).toBe(false); + if (!dateResult.success) { + // Should use "fecha" since we included it in TypeNames + expect(dateResult.error.issues[0].message).toContain("fecha"); + } +}); + +test("Spanish locale - other error cases", () => { + z.config(es()); + + // Test invalid_element with tuple + const tupleSchema = z.tuple([z.string(), z.number()]); + const tupleResult = tupleSchema.safeParse(["abc", "not a number"]); + expect(tupleResult.success).toBe(false); + if (!tupleResult.success) { + expect(tupleResult.error.issues[0].message).toContain("Entrada inválida"); + } + + // Test invalid_value with enum + const enumSchema = z.enum(["a", "b"]); + const enumResult = enumSchema.safeParse("c"); + expect(enumResult.success).toBe(false); + if (!enumResult.success) { + expect(enumResult.error.issues[0].message).toBe('Opción inválida: se esperaba una de "a"|"b"'); + } + + // Test not_multiple_of + const multipleSchema = z.number().multipleOf(3); + const multipleResult = multipleSchema.safeParse(10); + expect(multipleResult.success).toBe(false); + if (!multipleResult.success) { + expect(multipleResult.error.issues[0].message).toBe("Número inválido: debe ser múltiplo de 3"); + } + + // Test unrecognized_keys + const strictSchema = z.object({ a: z.string() }).strict(); + const strictResult = strictSchema.safeParse({ a: "test", b: "extra" }); + expect(strictResult.success).toBe(false); + if (!strictResult.success) { + expect(strictResult.error.issues[0].message).toBe('Llave desconocida: "b"'); + } + + // Test invalid_union + const unionSchema = z.union([z.string(), z.number()]); + const unionResult = unionSchema.safeParse(true); + expect(unionResult.success).toBe(false); + if (!unionResult.success) { + expect(unionResult.error.issues[0].message).toBe("Entrada inválida"); + } + + // Test invalid_format with regex + const regexSchema = z.string().regex(/^[a-z]+$/); + const regexResult = regexSchema.safeParse("ABC123"); + expect(regexResult.success).toBe(false); + if (!regexResult.success) { + expect(regexResult.error.issues[0].message).toBe("Cadena inválida: debe coincidir con el patrón /^[a-z]+$/"); + } + + // Test invalid_format with startsWith + const startsWithSchema = z.string().startsWith("hello"); + const startsWithResult = startsWithSchema.safeParse("world"); + expect(startsWithResult.success).toBe(false); + if (!startsWithResult.success) { + expect(startsWithResult.error.issues[0].message).toBe('Cadena inválida: debe comenzar con "hello"'); + } +}); diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/locales/fr.test.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/locales/fr.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..48112b73fe9d6b3282283c435ceb3d777440a1cf --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/locales/fr.test.ts @@ -0,0 +1,72 @@ +import { expect, test } from "vitest"; +import { z } from "../../../../index.js"; +import fr from "../../../locales/fr.js"; + +test("French locale - type name translations in too_small errors", () => { + z.config(fr()); + + const stringResult = z.string().min(5).safeParse("abc"); + expect(stringResult.success).toBe(false); + if (!stringResult.success) { + expect(stringResult.error.issues[0].message).toBe("Trop petit : chaîne doit avoir >=5 caractères"); + } + + const numberResult = z.number().min(10).safeParse(5); + expect(numberResult.success).toBe(false); + if (!numberResult.success) { + expect(numberResult.error.issues[0].message).toBe("Trop petit : nombre doit être >=10"); + } + + const arrayResult = z.array(z.string()).min(3).safeParse(["a", "b"]); + expect(arrayResult.success).toBe(false); + if (!arrayResult.success) { + expect(arrayResult.error.issues[0].message).toBe("Trop petit : tableau doit avoir >=3 éléments"); + } + + const setResult = z + .set(z.string()) + .min(2) + .safeParse(new Set(["a"])); + expect(setResult.success).toBe(false); + if (!setResult.success) { + expect(setResult.error.issues[0].message).toBe("Trop petit : ensemble doit avoir >=2 éléments"); + } +}); + +test("French locale - type name translations in too_big errors", () => { + z.config(fr()); + + const stringResult = z.string().max(3).safeParse("abcde"); + expect(stringResult.success).toBe(false); + if (!stringResult.success) { + expect(stringResult.error.issues[0].message).toBe("Trop grand : chaîne doit avoir <=3 caractères"); + } + + const numberResult = z.number().max(10).safeParse(15); + expect(numberResult.success).toBe(false); + if (!numberResult.success) { + expect(numberResult.error.issues[0].message).toBe("Trop grand : nombre doit être <=10"); + } + + const arrayResult = z.array(z.string()).max(2).safeParse(["a", "b", "c"]); + expect(arrayResult.success).toBe(false); + if (!arrayResult.success) { + expect(arrayResult.error.issues[0].message).toBe("Trop grand : tableau doit avoir <=2 éléments"); + } +}); + +test("French locale - type name translations in invalid_type errors", () => { + z.config(fr()); + + const stringResult = z.string().safeParse(123); + expect(stringResult.success).toBe(false); + if (!stringResult.success) { + expect(stringResult.error.issues[0].message).toBe("Entrée invalide : chaîne attendu, nombre reçu"); + } + + const arrayResult = z.array(z.string()).safeParse({}); + expect(arrayResult.success).toBe(false); + if (!arrayResult.success) { + expect(arrayResult.error.issues[0].message).toBe("Entrée invalide : tableau attendu, objet reçu"); + } +}); diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/locales/he.test.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/locales/he.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..50724314afc695f4ee0c74add4ccf6765c39ccfd --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/locales/he.test.ts @@ -0,0 +1,379 @@ +import { beforeEach, describe, expect, test } from "vitest"; +import { z } from "../../../../index.js"; +import he from "../../../locales/he.js"; + +describe("Hebrew localization", () => { + beforeEach(() => { + z.config(he()); + }); + + describe("too_small errors with definite article and gendered verbs", () => { + test("string type (feminine - צריכה)", () => { + const schema = z.string().min(3); + const result = schema.safeParse("ab"); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe("קצר מדי: המחרוזת צריכה להכיל 3 תווים או יותר"); + } + }); + + test("number type (masculine - צריך)", () => { + const schema = z.number().min(10); + const result = schema.safeParse(5); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe("קטן מדי: המספר צריך להיות גדול או שווה ל-10"); + } + }); + + test("array type (masculine - צריך)", () => { + const schema = z.array(z.string()).min(1); + const result = schema.safeParse([]); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe("קטן מדי: המערך צריך להכיל לפחות פריט אחד"); + } + }); + + test("set type (feminine - צריכה)", () => { + const schema = z.set(z.string()).min(2); + const result = schema.safeParse(new Set(["a"])); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe("קטן מדי: הקבוצה (Set) צריכה להכיל 2 פריטים או יותר"); + } + }); + }); + + describe("too_big errors with definite article and gendered verbs", () => { + test("string type (feminine - צריכה)", () => { + const schema = z.string().max(3); + const result = schema.safeParse("abcde"); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe("ארוך מדי: המחרוזת צריכה להכיל 3 תווים או פחות"); + } + }); + + test("number type (masculine - צריך)", () => { + const schema = z.number().max(365); + const result = schema.safeParse(400); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe("גדול מדי: המספר צריך להיות קטן או שווה ל-365"); + } + }); + + test("array max", () => { + const schema = z.array(z.string()).max(2); + const result = schema.safeParse(["a", "b", "c"]); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe("גדול מדי: המערך צריך להכיל 2 פריטים או פחות"); + } + }); + }); + + describe("invalid_type errors with definite article and gendered verbs", () => { + test("string expected (feminine), number received", () => { + const schema = z.string(); + const result = schema.safeParse(123); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe("קלט לא תקין: צריך להיות מחרוזת, התקבל מספר"); + } + }); + + test("number expected (masculine), string received", () => { + const schema = z.number(); + const result = schema.safeParse("abc"); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe("קלט לא תקין: צריך להיות מספר, התקבל מחרוזת"); + } + }); + + test("boolean expected (masculine), null received", () => { + const schema = z.boolean(); + const result = schema.safeParse(null); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe("קלט לא תקין: צריך להיות ערך בוליאני, התקבל ערך ריק (null)"); + } + }); + + test("array expected (masculine), object received", () => { + const schema = z.array(z.string()); + const result = schema.safeParse({}); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe("קלט לא תקין: צריך להיות מערך, התקבל אובייקט"); + } + }); + + test("object expected (masculine), array received", () => { + const schema = z.object({ a: z.string() }); + const result = schema.safeParse([]); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe("קלט לא תקין: צריך להיות אובייקט, התקבל מערך"); + } + }); + + test("function expected (feminine), string received", () => { + const schema = z.function(); + const result = schema.safeParse("not a function"); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe("קלט לא תקין: צריך להיות פונקציה, התקבל מחרוזת"); + } + }); + }); + + describe("gendered verbs consistency", () => { + test("feminine types use צריכה", () => { + const feminineTypes = [ + { schema: z.string().min(5), input: "abc" }, + { schema: z.set(z.string()).min(2), input: new Set(["a"]) }, + ]; + + for (const { schema, input } of feminineTypes) { + const result = schema.safeParse(input); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toContain("צריכה"); + } + } + }); + + test("masculine types use צריך", () => { + const masculineTypes = [ + { schema: z.number().min(10), input: 5 }, + { schema: z.array(z.string()).min(2), input: ["a"] }, + ]; + + for (const { schema, input } of masculineTypes) { + const result = schema.safeParse(input); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toContain("צריך"); + } + } + }); + }); + + describe("invalid_value with enum", () => { + test("single value", () => { + const schema = z.enum(["a"]); + const result = schema.safeParse("b"); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe('ערך לא תקין: הערך חייב להיות "a"'); + } + }); + + test("two values", () => { + const schema = z.enum(["a", "b"]); + const result = schema.safeParse("c"); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe('ערך לא תקין: האפשרויות המתאימות הן "a" או "b"'); + } + }); + + test("multiple values", () => { + const schema = z.enum(["a", "b", "c"]); + const result = schema.safeParse("d"); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe('ערך לא תקין: האפשרויות המתאימות הן "a", "b" או "c"'); + } + }); + }); + + describe("other error types", () => { + test("not_multiple_of", () => { + const schema = z.number().multipleOf(3); + const result = schema.safeParse(10); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe("מספר לא תקין: חייב להיות מכפלה של 3"); + } + }); + + test("unrecognized_keys - single key", () => { + const schema = z.object({ a: z.string() }).strict(); + const result = schema.safeParse({ a: "test", b: "extra" }); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe('מפתח לא מזוהה: "b"'); + } + }); + + test("unrecognized_keys - multiple keys", () => { + const schema = z.object({ a: z.string() }).strict(); + const result = schema.safeParse({ a: "test", b: "extra", c: "more" }); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe('מפתחות לא מזוהים: "b", "c"'); + } + }); + + test("invalid_union", () => { + const schema = z.union([z.string(), z.number()]); + const result = schema.safeParse(true); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe("קלט לא תקין"); + } + }); + + test("invalid_key in object", () => { + const schema = z.record(z.number(), z.string()); + const result = schema.safeParse({ notANumber: "value" }); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe("שדה לא תקין באובייקט"); + } + }); + }); + + describe("invalid_format with string checks", () => { + test("startsWith", () => { + const schema = z.string().startsWith("hello"); + const result = schema.safeParse("world"); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe('המחרוזת חייבת להתחיל ב "hello"'); + } + }); + + test("endsWith", () => { + const schema = z.string().endsWith("world"); + const result = schema.safeParse("hello"); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe('המחרוזת חייבת להסתיים ב "world"'); + } + }); + + test("includes", () => { + const schema = z.string().includes("test"); + const result = schema.safeParse("hello world"); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe('המחרוזת חייבת לכלול "test"'); + } + }); + + test("regex", () => { + const schema = z.string().regex(/^[a-z]+$/); + const result = schema.safeParse("ABC123"); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe("המחרוזת חייבת להתאים לתבנית /^[a-z]+$/"); + } + }); + }); + + describe("invalid_format with common formats", () => { + test("email", () => { + const schema = z.string().email(); + const result = schema.safeParse("not-an-email"); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe("כתובת אימייל לא תקינה"); + } + }); + + test("url", () => { + const schema = z.string().url(); + const result = schema.safeParse("not-a-url"); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe("כתובת רשת לא תקינה"); + } + }); + + test("uuid", () => { + const schema = z.string().uuid(); + const result = schema.safeParse("not-a-uuid"); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe("UUID לא תקין"); + } + }); + }); + + describe("tuple validation", () => { + test("invalid element type in tuple shows full error message", () => { + const schema = z.tuple([z.string(), z.number()]); + const result = schema.safeParse(["abc", "not a number"]); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe("קלט לא תקין: צריך להיות מספר, התקבל מחרוזת"); + } + }); + }); + + describe("inclusive vs exclusive bounds", () => { + test("inclusive minimum (>=)", () => { + const schema = z.number().min(10); + const result = schema.safeParse(5); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe("קטן מדי: המספר צריך להיות גדול או שווה ל-10"); + } + }); + + test("exclusive minimum (>)", () => { + const schema = z.number().gt(10); + const result = schema.safeParse(10); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe("קטן מדי: המספר צריך להיות גדול מ-10"); + } + }); + + test("inclusive maximum (<=)", () => { + const schema = z.number().max(10); + const result = schema.safeParse(15); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe("גדול מדי: המספר צריך להיות קטן או שווה ל-10"); + } + }); + + test("exclusive maximum (<)", () => { + const schema = z.number().lt(10); + const result = schema.safeParse(10); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toBe("גדול מדי: המספר צריך להיות קטן מ-10"); + } + }); + }); + + describe("all type names with definite article", () => { + test("verifies all type translations are correct", () => { + const types = [ + { schema: z.string(), expected: "מחרוזת", input: 123 }, + { schema: z.number(), expected: "מספר", input: "abc" }, + { schema: z.boolean(), expected: "ערך בוליאני", input: "abc" }, + { schema: z.bigint(), expected: "BigInt", input: "abc" }, + { schema: z.date(), expected: "תאריך", input: "abc" }, + { schema: z.array(z.any()), expected: "מערך", input: "abc" }, + { schema: z.object({}), expected: "אובייקט", input: "abc" }, + { schema: z.function(), expected: "פונקציה", input: "abc" }, + ]; + + for (const { schema, expected, input } of types) { + const result = schema.safeParse(input); + expect(result.success).toBe(false); + if (!result.success) { + expect(result.error.issues[0].message).toContain(expected); + } + } + }); + }); +}); diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/locales/hr.test.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/locales/hr.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..14b529424091e7785c7f5998bea9f6d734c0c081 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/locales/hr.test.ts @@ -0,0 +1,163 @@ +import { expect, test } from "vitest"; +import { z } from "../../../../index.js"; +import hr from "../../../locales/hr.js"; + +test("Croatian locale - type name translations in too_small errors", () => { + z.config(hr()); + + // Test string type translation + const stringSchema = z.string().min(5); + const stringResult = stringSchema.safeParse("abc"); + expect(stringResult.success).toBe(false); + if (!stringResult.success) { + expect(stringResult.error.issues[0].message).toBe("Premalo: očekivano da tekst ima >=5 znakova"); + } + + // Test number type translation + const numberSchema = z.number().min(10); + const numberResult = numberSchema.safeParse(5); + expect(numberResult.success).toBe(false); + if (!numberResult.success) { + expect(numberResult.error.issues[0].message).toBe("Premalo: očekivano da broj bude >=10"); + } + + // Test array type translation + const arraySchema = z.array(z.string()).min(3); + const arrayResult = arraySchema.safeParse(["a", "b"]); + expect(arrayResult.success).toBe(false); + if (!arrayResult.success) { + expect(arrayResult.error.issues[0].message).toBe("Premalo: očekivano da niz ima >=3 stavki"); + } + + // Test set type translation + const setSchema = z.set(z.string()).min(2); + const setResult = setSchema.safeParse(new Set(["a"])); + expect(setResult.success).toBe(false); + if (!setResult.success) { + expect(setResult.error.issues[0].message).toBe("Premalo: očekivano da skup ima >=2 stavki"); + } +}); + +test("Croatian locale - type name translations in too_big errors", () => { + z.config(hr()); + + // Test string type translation + const stringSchema = z.string().max(3); + const stringResult = stringSchema.safeParse("abcde"); + expect(stringResult.success).toBe(false); + if (!stringResult.success) { + expect(stringResult.error.issues[0].message).toBe("Preveliko: očekivano da tekst ima <=3 znakova"); + } + + // Test number type translation + const numberSchema = z.number().max(10); + const numberResult = numberSchema.safeParse(15); + expect(numberResult.success).toBe(false); + if (!numberResult.success) { + expect(numberResult.error.issues[0].message).toBe("Preveliko: očekivano da broj bude <=10"); + } + + // Test array type translation + const arraySchema = z.array(z.string()).max(2); + const arrayResult = arraySchema.safeParse(["a", "b", "c"]); + expect(arrayResult.success).toBe(false); + if (!arrayResult.success) { + expect(arrayResult.error.issues[0].message).toBe("Preveliko: očekivano da niz ima <=2 stavki"); + } +}); + +test("Croatian locale - type name translations in invalid_type errors", () => { + z.config(hr()); + + // Test string expected, number received + const stringSchema = z.string(); + const stringResult = stringSchema.safeParse(123); + expect(stringResult.success).toBe(false); + if (!stringResult.success) { + expect(stringResult.error.issues[0].message).toBe("Neispravan unos: očekuje se tekst, a primljeno je broj"); + } + + // Test number expected, string received + const numberSchema = z.number(); + const numberResult = numberSchema.safeParse("abc"); + expect(numberResult.success).toBe(false); + if (!numberResult.success) { + expect(numberResult.error.issues[0].message).toBe("Neispravan unos: očekuje se broj, a primljeno je tekst"); + } + + // Test boolean expected, null received + const booleanSchema = z.boolean(); + const booleanResult = booleanSchema.safeParse(null); + expect(booleanResult.success).toBe(false); + if (!booleanResult.success) { + expect(booleanResult.error.issues[0].message).toBe("Neispravan unos: očekuje se boolean, a primljeno je null"); + } + + // Test array expected, object received + const arraySchema = z.array(z.string()); + const arrayResult = arraySchema.safeParse({}); + expect(arrayResult.success).toBe(false); + if (!arrayResult.success) { + expect(arrayResult.error.issues[0].message).toBe("Neispravan unos: očekuje se niz, a primljeno je objekt"); + } +}); + +test("Croatian locale - other error cases", () => { + z.config(hr()); + + // Test invalid_element with tuple + const tupleSchema = z.tuple([z.string(), z.number()]); + const tupleResult = tupleSchema.safeParse(["abc", "not a number"]); + expect(tupleResult.success).toBe(false); + if (!tupleResult.success) { + expect(tupleResult.error.issues[0].message).toContain("Neispravan unos"); + } + + // Test invalid_value with enum + const enumSchema = z.enum(["a", "b"]); + const enumResult = enumSchema.safeParse("c"); + expect(enumResult.success).toBe(false); + if (!enumResult.success) { + expect(enumResult.error.issues[0].message).toBe('Neispravna opcija: očekivano jedno od "a"|"b"'); + } + + // Test not_multiple_of + const multipleSchema = z.number().multipleOf(3); + const multipleResult = multipleSchema.safeParse(10); + expect(multipleResult.success).toBe(false); + if (!multipleResult.success) { + expect(multipleResult.error.issues[0].message).toBe("Neispravan broj: mora biti višekratnik od 3"); + } + + // Test unrecognized_keys + const strictSchema = z.object({ a: z.string() }).strict(); + const strictResult = strictSchema.safeParse({ a: "test", b: "extra" }); + expect(strictResult.success).toBe(false); + if (!strictResult.success) { + expect(strictResult.error.issues[0].message).toBe('Neprepoznat ključ: "b"'); + } + + // Test invalid_union + const unionSchema = z.union([z.string(), z.number()]); + const unionResult = unionSchema.safeParse(true); + expect(unionResult.success).toBe(false); + if (!unionResult.success) { + expect(unionResult.error.issues[0].message).toBe("Neispravan unos"); + } + + // Test invalid_format with regex + const regexSchema = z.string().regex(/^[a-z]+$/); + const regexResult = regexSchema.safeParse("ABC123"); + expect(regexResult.success).toBe(false); + if (!regexResult.success) { + expect(regexResult.error.issues[0].message).toBe("Neispravan tekst: mora odgovarati uzorku /^[a-z]+$/"); + } + + // Test invalid_format with startsWith + const startsWithSchema = z.string().startsWith("hello"); + const startsWithResult = startsWithSchema.safeParse("world"); + expect(startsWithResult.success).toBe(false); + if (!startsWithResult.success) { + expect(startsWithResult.error.issues[0].message).toBe('Neispravan tekst: mora započinjati s "hello"'); + } +}); diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/locales/nl.test.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/locales/nl.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..02a6e05d10047ab2cb844e5e886b699c42748f1b --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/locales/nl.test.ts @@ -0,0 +1,46 @@ +import { expect, test } from "vitest"; +import nl from "../../../locales/nl.js"; + +test("Dutch locale error messages", () => { + const { localeError } = nl(); + + // Test invalid_type + expect( + localeError({ + code: "invalid_type", + expected: "string", + input: 123, + }) + ).toBe("Ongeldige invoer: verwacht string, ontving getal"); + + // Test too_big with sizing + expect( + localeError({ + code: "too_big", + origin: "string", + maximum: 10, + inclusive: true, + input: "test string that is too long", + }) + ).toBe("Te lang: verwacht dat string <=10 tekens heeft"); + + // Test too_small with sizing + expect( + localeError({ + code: "too_small", + origin: "array", + minimum: 5, + inclusive: false, + input: [1, 2], + }) + ).toBe("Te klein: verwacht dat array >5 elementen heeft"); + + // Test invalid_format + expect( + localeError({ + code: "invalid_format", + format: "email", + input: "invalid-email", + }) + ).toBe("Ongeldig: emailadres"); +}); diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/locales/ru.test.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/locales/ru.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..6fb7c95f40b634914483f8dde056f52f71410047 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/locales/ru.test.ts @@ -0,0 +1,128 @@ +import { describe, expect, it } from "vitest"; +import ru from "../../../locales/ru.js"; + +describe("Russian localization", () => { + const localeError = ru().localeError; + + describe("pluralization rules", () => { + for (const { type, cases } of TEST_CASES) { + describe(`${type} pluralization`, () => { + for (const { count, expected } of cases) { + it(`correctly pluralizes ${count} ${type}`, () => { + const error = localeError({ + code: "too_small", + minimum: count, + type: "number", + inclusive: true, + path: [], + origin: type, + input: count - 1, + }); + + expect(error).toContain(expected); + }); + } + }); + } + + it("handles negative numbers correctly", () => { + const error = localeError({ + code: "too_small", + minimum: -2, + type: "number", + inclusive: true, + path: [], + origin: "array", + input: -3, + }); + + expect(error).toContain("-2 элемента"); + }); + + it("handles zero correctly", () => { + const error = localeError({ + code: "too_small", + minimum: 0, + type: "number", + inclusive: true, + path: [], + origin: "array", + input: -1, + }); + + expect(error).toContain("0 элементов"); + }); + + it("handles bigint values correctly", () => { + const error = localeError({ + code: "too_small", + minimum: BigInt(21), + type: "number", + inclusive: true, + path: [], + origin: "array", + input: BigInt(20), + }); + + expect(error).toContain("21 элемент"); + }); + }); +}); + +const TEST_CASES = [ + { + type: "array", + cases: [ + { count: 1, expected: "1 элемент" }, + { count: 2, expected: "2 элемента" }, + { count: 5, expected: "5 элементов" }, + { count: 11, expected: "11 элементов" }, + { count: 21, expected: "21 элемент" }, + { count: 22, expected: "22 элемента" }, + { count: 25, expected: "25 элементов" }, + { count: 101, expected: "101 элемент" }, + { count: 111, expected: "111 элементов" }, + ], + }, + { + type: "set", + cases: [ + { count: 1, expected: "1 элемент" }, + { count: 2, expected: "2 элемента" }, + { count: 5, expected: "5 элементов" }, + { count: 11, expected: "11 элементов" }, + { count: 21, expected: "21 элемент" }, + { count: 22, expected: "22 элемента" }, + { count: 25, expected: "25 элементов" }, + { count: 101, expected: "101 элемент" }, + { count: 111, expected: "111 элементов" }, + ], + }, + { + type: "string", + cases: [ + { count: 1, expected: "1 символ" }, + { count: 2, expected: "2 символа" }, + { count: 5, expected: "5 символов" }, + { count: 11, expected: "11 символов" }, + { count: 21, expected: "21 символ" }, + { count: 22, expected: "22 символа" }, + { count: 25, expected: "25 символов" }, + ], + }, + { + type: "file", + cases: [ + { count: 0, expected: "0 байт" }, + { count: 1, expected: "1 байт" }, + { count: 2, expected: "2 байта" }, + { count: 5, expected: "5 байт" }, + { count: 11, expected: "11 байт" }, + { count: 21, expected: "21 байт" }, + { count: 22, expected: "22 байта" }, + { count: 25, expected: "25 байт" }, + { count: 101, expected: "101 байт" }, + { count: 110, expected: "110 байт" }, + ], + }, +] as const; diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/locales/tr.test.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/locales/tr.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..bc46bf41e9f2535d94d4325d0b85a4bbfd0b6410 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/locales/tr.test.ts @@ -0,0 +1,69 @@ +import { expect, test } from "vitest"; +import * as z from "zod/v4"; +import { parsedType } from "../../util.js"; + +test("parsedType", () => { + expect(parsedType("string")).toBe("string"); + expect(parsedType(1)).toBe("number"); + expect(parsedType(true)).toBe("boolean"); + expect(parsedType(null)).toBe("null"); + expect(parsedType(undefined)).toBe("undefined"); + expect(parsedType([])).toBe("array"); + expect(parsedType({})).toBe("object"); + expect(parsedType(new Date())).toBe("Date"); + expect(parsedType(new Map())).toBe("Map"); + expect(parsedType(new Set())).toBe("Set"); + expect(parsedType(new Error())).toBe("Error"); + + const nullPrototype = Object.create(null); + expect(parsedType(nullPrototype)).toBe("object"); + + const doubleNullPrototype = Object.create(Object.create(null)); + expect(parsedType(doubleNullPrototype)).toBe("object"); + + expect(parsedType(Number.NaN)).toBe("nan"); +}); + +test("locales - tr", () => { + z.config(z.locales.tr()); + + const invalidType = z.number().safeParse("a"); + expect(invalidType.error!.issues[0].code).toBe("invalid_type"); + expect(invalidType.error!.issues[0].message).toBe("Geçersiz değer: beklenen number, alınan string"); + + const invalidType2 = z.string().safeParse(1); + expect(invalidType2.error!.issues[0].code).toBe("invalid_type"); + expect(invalidType2.error!.issues[0].message).toBe("Geçersiz değer: beklenen string, alınan number"); + + const invalidValue = z.enum(["a", "b"]).safeParse(1); + expect(invalidValue.error!.issues[0].code).toBe("invalid_value"); + expect(invalidValue.error!.issues[0].message).toBe('Geçersiz seçenek: aşağıdakilerden biri olmalı: "a"|"b"'); + + const tooBig = z.number().max(10).safeParse(15); + expect(tooBig.error!.issues[0].code).toBe("too_big"); + expect(tooBig.error!.issues[0].message).toBe("Çok büyük: beklenen number <=10"); + + const tooSmall = z.number().min(10).safeParse(5); + expect(tooSmall.error!.issues[0].code).toBe("too_small"); + expect(tooSmall.error!.issues[0].message).toBe("Çok küçük: beklenen number >=10"); + + const invalidFormatRegex = z.string().regex(/abcd/).safeParse("invalid-string"); + expect(invalidFormatRegex.error!.issues[0].code).toBe("invalid_format"); + expect(invalidFormatRegex.error!.issues[0].message).toBe("Geçersiz metin: /abcd/ desenine uymalı"); + + const invalidFormatStartsWith = z.string().startsWith("abcd").safeParse("invalid-string"); + expect(invalidFormatStartsWith.error!.issues[0].code).toBe("invalid_format"); + expect(invalidFormatStartsWith.error!.issues[0].message).toBe('Geçersiz metin: "abcd" ile başlamalı'); + + const notMultipleOf = z.number().multipleOf(3).safeParse(10); + expect(notMultipleOf.error!.issues[0].code).toBe("not_multiple_of"); + expect(notMultipleOf.error!.issues[0].message).toBe("Geçersiz sayı: 3 ile tam bölünebilmeli"); + + const unrecognizedKeys = z.object({ a: z.string(), b: z.number() }).strict().safeParse({ a: "a", b: 1, c: 2 }); + expect(unrecognizedKeys.error!.issues[0].code).toBe("unrecognized_keys"); + expect(unrecognizedKeys.error!.issues[0].message).toBe('Tanınmayan anahtar: "c"'); + + const invalidUnion = z.union([z.string(), z.number()]).safeParse(true); + expect(invalidUnion.error!.issues[0].code).toBe("invalid_union"); + expect(invalidUnion.error!.issues[0].message).toBe("Geçersiz değer"); +}); diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/locales/uz.test.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/locales/uz.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..bcb43a2785b5aaf8c942a068b203e111a29ff49a --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/locales/uz.test.ts @@ -0,0 +1,105 @@ +import { expect, test } from "vitest"; +import * as z from "zod/v4"; + +test("locales - uz", () => { + z.config(z.locales.uz()); + + const invalidType = z.number().safeParse("a"); + expect(invalidType.error!.issues[0].code).toBe("invalid_type"); + expect(invalidType.error!.issues[0].message).toBe("Noto‘g‘ri kirish: kutilgan raqam, qabul qilingan string"); + + const invalidType2 = z.string().safeParse(1); + expect(invalidType2.error!.issues[0].code).toBe("invalid_type"); + expect(invalidType2.error!.issues[0].message).toBe("Noto‘g‘ri kirish: kutilgan string, qabul qilingan raqam"); + + const invalidValue = z.enum(["a", "b"]).safeParse(1); + expect(invalidValue.error!.issues[0].code).toBe("invalid_value"); + expect(invalidValue.error!.issues[0].message).toBe('Noto‘g‘ri variant: quyidagilardan biri kutilgan "a"|"b"'); + + const tooBig = z.number().max(10).safeParse(15); + expect(tooBig.error!.issues[0].code).toBe("too_big"); + expect(tooBig.error!.issues[0].message).toBe("Juda katta: kutilgan number <=10"); + + const tooSmall = z.number().min(10).safeParse(5); + expect(tooSmall.error!.issues[0].code).toBe("too_small"); + expect(tooSmall.error!.issues[0].message).toBe("Juda kichik: kutilgan number >=10"); + + const invalidFormatRegex = z.string().regex(/abcd/).safeParse("invalid-string"); + expect(invalidFormatRegex.error!.issues[0].code).toBe("invalid_format"); + expect(invalidFormatRegex.error!.issues[0].message).toContain("shabloniga mos kelishi kerak"); + + const invalidFormatStartsWith = z.string().startsWith("abcd").safeParse("invalid-string"); + expect(invalidFormatStartsWith.error!.issues[0].code).toBe("invalid_format"); + expect(invalidFormatStartsWith.error!.issues[0].message).toContain('"abcd" bilan boshlanishi kerak'); + + const notMultipleOf = z.number().multipleOf(3).safeParse(10); + expect(notMultipleOf.error!.issues[0].code).toBe("not_multiple_of"); + expect(notMultipleOf.error!.issues[0].message).toContain("3 ning karralisi bo‘lishi kerak"); + + const unrecognizedKeys = z.object({ a: z.string(), b: z.number() }).strict().safeParse({ a: "a", b: 1, c: 2 }); + expect(unrecognizedKeys.error!.issues[0].code).toBe("unrecognized_keys"); + expect(unrecognizedKeys.error!.issues[0].message).toContain('Noma’lum kalit: "c"'); + + const invalidUnion = z.union([z.string(), z.number()]).safeParse(true); + expect(invalidUnion.error!.issues[0].code).toBe("invalid_union"); + expect(invalidUnion.error!.issues[0].message).toBe("Noto‘g‘ri kirish"); + + const tooBigString = z.string().max(5).safeParse("too long string"); + expect(tooBigString.error!.issues[0].code).toBe("too_big"); + expect(tooBigString.error!.issues[0].message).toContain("belgi"); + expect(tooBigString.error!.issues[0].message).toContain("bo‘lishi kerak"); + + const tooSmallArray = z.array(z.string()).min(3).safeParse(["a", "b"]); + expect(tooSmallArray.error!.issues[0].code).toBe("too_small"); + expect(tooSmallArray.error!.issues[0].message).toContain("element"); + expect(tooSmallArray.error!.issues[0].message).toContain("bo‘lishi kerak"); + + const invalidFormatEndsWith = z.string().endsWith("xyz").safeParse("invalid-string"); + expect(invalidFormatEndsWith.error!.issues[0].code).toBe("invalid_format"); + expect(invalidFormatEndsWith.error!.issues[0].message).toContain('"xyz" bilan tugashi kerak'); + + const invalidFormatIncludes = z.string().includes("test").safeParse("invalid-string"); + expect(invalidFormatIncludes.error!.issues[0].code).toBe("invalid_format"); + expect(invalidFormatIncludes.error!.issues[0].message).toContain('"test" ni o‘z ichiga olishi kerak'); + + const invalidFormatEmail = z.string().email().safeParse("invalid-email"); + expect(invalidFormatEmail.error!.issues[0].code).toBe("invalid_format"); + expect(invalidFormatEmail.error!.issues[0].message).toContain("elektron pochta manzili"); + + const invalidFormatUrl = z.string().url().safeParse("invalid-url"); + expect(invalidFormatUrl.error!.issues[0].code).toBe("invalid_format"); + expect(invalidFormatUrl.error!.issues[0].message).toContain("URL"); + + const unrecognizedKeysMultiple = z + .object({ a: z.string(), b: z.number() }) + .strict() + .safeParse({ a: "a", b: 1, c: 2, d: 3 }); + expect(unrecognizedKeysMultiple.error!.issues[0].code).toBe("unrecognized_keys"); + expect(unrecognizedKeysMultiple.error!.issues[0].message).toContain("Noma’lum kalitlar"); + + const invalidElement = z.array(z.string()).safeParse([1, 2, 3]); + expect(invalidElement.error!.issues[0].code).toBe("invalid_type"); + expect(invalidElement.error!.issues[0].message).toContain("raqam"); + + const tooSmallMap = z + .map(z.string(), z.string()) + .min(3) + .safeParse(new Map([["a", "b"]])); + expect(tooSmallMap.error!.issues[0].code).toBe("too_small"); + expect(tooSmallMap.error!.issues[0].message).toContain("yozuv"); + expect(tooSmallMap.error!.issues[0].message).toContain("bo‘lishi kerak"); + + const tooBigMap = z + .map(z.string(), z.string()) + .max(2) + .safeParse( + new Map([ + ["a", "b"], + ["c", "d"], + ["e", "f"], + ]) + ); + expect(tooBigMap.error!.issues[0].code).toBe("too_big"); + expect(tooBigMap.error!.issues[0].message).toContain("yozuv"); + expect(tooBigMap.error!.issues[0].message).toContain("bo‘lishi kerak"); +}); diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/record-constructor.test.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/record-constructor.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..91b5d5c0f660941e206277f47e4ec59155614adf --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/record-constructor.test.ts @@ -0,0 +1,125 @@ +import { expect, test } from "vitest"; +import * as z from "zod/v4"; + +test("record should parse objects with non-function constructor field", () => { + const schema = z.record(z.string(), z.any()); + + expect(() => schema.parse({ constructor: "string", key: "value" })).not.toThrow(); + + const result1 = schema.parse({ constructor: "string", key: "value" }); + expect(result1).toEqual({ constructor: "string", key: "value" }); + + expect(() => schema.parse({ constructor: 123, key: "value" })).not.toThrow(); + + const result2 = schema.parse({ constructor: 123, key: "value" }); + expect(result2).toEqual({ constructor: 123, key: "value" }); + + expect(() => schema.parse({ constructor: null, key: "value" })).not.toThrow(); + + const result3 = schema.parse({ constructor: null, key: "value" }); + expect(result3).toEqual({ constructor: null, key: "value" }); + + expect(() => schema.parse({ constructor: {}, key: "value" })).not.toThrow(); + + const result4 = schema.parse({ constructor: {}, key: "value" }); + expect(result4).toEqual({ constructor: {}, key: "value" }); + + expect(() => schema.parse({ constructor: [], key: "value" })).not.toThrow(); + + const result5 = schema.parse({ constructor: [], key: "value" }); + expect(result5).toEqual({ constructor: [], key: "value" }); + + expect(() => schema.parse({ constructor: true, key: "value" })).not.toThrow(); + + const result6 = schema.parse({ constructor: true, key: "value" }); + expect(result6).toEqual({ constructor: true, key: "value" }); +}); + +test("record should still work with normal objects", () => { + const schema = z.record(z.string(), z.string()); + + expect(() => schema.parse({ normalKey: "value" })).not.toThrow(); + + const result1 = schema.parse({ normalKey: "value" }); + expect(result1).toEqual({ normalKey: "value" }); + + expect(() => schema.parse({ key1: "value1", key2: "value2" })).not.toThrow(); + + const result2 = schema.parse({ key1: "value1", key2: "value2" }); + expect(result2).toEqual({ key1: "value1", key2: "value2" }); +}); + +test("record should validate values according to schema even with constructor field", () => { + const stringSchema = z.record(z.string(), z.string()); + + expect(() => stringSchema.parse({ constructor: "string", key: "value" })).not.toThrow(); + + expect(() => stringSchema.parse({ constructor: 123, key: "value" })).toThrow(); +}); + +test("record should work with different key types and constructor field", () => { + const enumSchema = z.record(z.enum(["constructor", "key"]), z.string()); + + expect(() => enumSchema.parse({ constructor: "value1", key: "value2" })).not.toThrow(); + + const result = enumSchema.parse({ constructor: "value1", key: "value2" }); + expect(result).toEqual({ constructor: "value1", key: "value2" }); +}); + +test("record should skip non-enumerable own properties", () => { + const schema = z.record(z.string(), z.string()); + + const input = { key: "value" }; + Object.defineProperty(input, "~standard", { + value: { validate: () => {}, vendor: "zod", version: 1 }, + enumerable: false, + writable: false, + configurable: false, + }); + + const result = schema.safeParse(input); + expect(result.success).toBe(true); + if (result.success) { + expect(result.data).toEqual({ key: "value" }); + expect("~standard" in result.data).toBe(false); + } +}); + +test("record fails on enumerable invalid values even when non-enumerable properties are present", () => { + const schema = z.record(z.string(), z.string()); + + const input = { key: "value", bad: 123 }; + Object.defineProperty(input, "hidden", { + value: "should be ignored", + enumerable: false, + }); + + const result = schema.safeParse(input); + expect(result.success).toBe(false); +}); + +test("record validates enumerable Symbol keys and skips non-enumerable Symbol keys", () => { + const enumerableSym = Symbol.for("included"); + const nonEnumerableSym = Symbol.for("hidden"); + const schema = z.record(z.symbol(), z.string()); + + const input: Record = { [enumerableSym]: "value" }; + Object.defineProperty(input, nonEnumerableSym, { + value: 123, + enumerable: false, + }); + + const result = schema.safeParse(input); + expect(result.success).toBe(true); + if (result.success) { + expect(result.data[enumerableSym]).toBe("value"); + expect(Object.prototype.hasOwnProperty.call(result.data, nonEnumerableSym)).toBe(false); + } +}); + +test("z.json() accepts z.toJSONSchema() output (issue #5714)", () => { + const schema = z.object({ name: z.string() }); + const jsonSchema = z.toJSONSchema(schema); + + expect(z.json().safeParse(jsonSchema).success).toBe(true); +}); diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..c8d0e631be6b5f20b9b63b1d1fcc933bac63e8db --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts @@ -0,0 +1,45 @@ +import { describe, expect, it } from "vitest"; +import * as z from "zod/v4"; + +describe("Recursive Tuples Regression #5089", () => { + it("creates recursive tuple without crash", () => { + expect(() => { + const y = z.lazy((): any => z.tuple([y, y]).or(z.string())); + }).not.toThrow(); + }); + + it("parses recursive tuple data correctly", () => { + const y = z.lazy((): any => z.tuple([y, y]).or(z.string())); + + // Base case + expect(y.parse("hello")).toBe("hello"); + + // Recursive cases + expect(() => y.parse(["a", "b"])).not.toThrow(); + expect(() => y.parse(["a", ["b", "c"]])).not.toThrow(); + }); + + it("matches #5089 expected behavior", () => { + // Exact code from the issue + expect(() => { + const y = z.lazy((): any => z.tuple([y, y]).or(z.string())); + y.parse(["a", ["b", "c"]]); + }).not.toThrow(); + }); + + it("handles workaround pattern", () => { + // Alternative pattern from issue discussion + expect(() => { + const y = z.lazy((): any => z.string().or(z.lazy(() => z.tuple([y, y])))); + y.parse(["a", ["b", "c"]]); + }).not.toThrow(); + }); + + it("recursive arrays still work (comparison)", () => { + const y = z.lazy((): any => z.array(y).or(z.string())); + + expect(y.parse("hello")).toBe("hello"); + expect(y.parse(["hello", "world"])).toEqual(["hello", "world"]); + expect(y.parse(["a", ["b", "c"]])).toEqual(["a", ["b", "c"]]); + }); +}); diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/to-json-schema.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/to-json-schema.ts new file mode 100644 index 0000000000000000000000000000000000000000..c7c744049d425935408e995c5c23c77cac0daf9a --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/to-json-schema.ts @@ -0,0 +1,622 @@ +import type * as core from "../core/index.js"; +import type * as JSONSchema from "./json-schema.js"; +import { type $ZodRegistry, globalRegistry } from "./registries.js"; +import type * as schemas from "./schemas.js"; +import type { StandardJSONSchemaV1, StandardSchemaWithJSONProps } from "./standard-schema.js"; + +export type Processor = ( + schema: T, + ctx: ToJSONSchemaContext, + json: JSONSchema.BaseSchema, + params: ProcessParams +) => void; + +export interface JSONSchemaGeneratorParams { + processors: Record; + /** A registry used to look up metadata for each schema. Any schema with an `id` property will be extracted as a $def. + * @default globalRegistry */ + metadata?: $ZodRegistry>; + /** The JSON Schema version to target. + * - `"draft-2020-12"` — Default. JSON Schema Draft 2020-12 + * - `"draft-07"` — JSON Schema Draft 7 + * - `"draft-04"` — JSON Schema Draft 4 + * - `"openapi-3.0"` — OpenAPI 3.0 Schema Object */ + target?: "draft-04" | "draft-07" | "draft-2020-12" | "openapi-3.0" | ({} & string) | undefined; + /** How to handle unrepresentable types. + * - `"throw"` — Default. Unrepresentable types throw an error + * - `"any"` — Unrepresentable types become `{}` */ + unrepresentable?: "throw" | "any"; + /** Arbitrary custom logic that can be used to modify the generated JSON Schema. */ + override?: (ctx: { + zodSchema: schemas.$ZodTypes; + jsonSchema: JSONSchema.BaseSchema; + path: (string | number)[]; + }) => void; + /** Whether to extract the `"input"` or `"output"` type. Relevant to transforms, defaults, coerced primitives, etc. + * - `"output"` — Default. Convert the output schema. + * - `"input"` — Convert the input schema. */ + io?: "input" | "output"; + cycles?: "ref" | "throw"; + reused?: "ref" | "inline"; + external?: + | { + registry: $ZodRegistry<{ id?: string | undefined }>; + uri?: ((id: string) => string) | undefined; + defs: Record; + } + | undefined; +} + +/** + * Parameters for the toJSONSchema function. + */ +export type ToJSONSchemaParams = Omit; + +/** + * Parameters for the toJSONSchema function when passing a registry. + */ +export interface RegistryToJSONSchemaParams extends ToJSONSchemaParams { + uri?: (id: string) => string; +} + +export interface ProcessParams { + schemaPath: schemas.$ZodType[]; + path: (string | number)[]; +} + +export interface Seen { + /** JSON Schema result for this Zod schema */ + schema: JSONSchema.BaseSchema; + /** A cached version of the schema that doesn't get overwritten during ref resolution */ + def?: JSONSchema.BaseSchema; + defId?: string | undefined; + /** Number of times this schema was encountered during traversal */ + count: number; + /** Cycle path */ + cycle?: (string | number)[] | undefined; + isParent?: boolean | undefined; + /** Schema to inherit JSON Schema properties from (set by processor for wrappers) */ + ref?: schemas.$ZodType | null; + /** JSON Schema property path for this schema */ + path?: (string | number)[] | undefined; +} + +export interface ToJSONSchemaContext { + processors: Record; + metadataRegistry: $ZodRegistry>; + target: "draft-04" | "draft-07" | "draft-2020-12" | "openapi-3.0" | ({} & string); + unrepresentable: "throw" | "any"; + override: (ctx: { + // must be schemas.$ZodType to prevent recursive type resolution error + zodSchema: schemas.$ZodType; + jsonSchema: JSONSchema.BaseSchema; + path: (string | number)[]; + }) => void; + io: "input" | "output"; + counter: number; + seen: Map; + cycles: "ref" | "throw"; + reused: "ref" | "inline"; + external?: + | { + registry: $ZodRegistry<{ id?: string | undefined }>; + uri?: ((id: string) => string) | undefined; + defs: Record; + } + | undefined; +} + +// function initializeContext(inputs: JSONSchemaGeneratorParams): ToJSONSchemaContext { +// return { +// processor: inputs.processor, +// metadataRegistry: inputs.metadata ?? globalRegistry, +// target: inputs.target ?? "draft-2020-12", +// unrepresentable: inputs.unrepresentable ?? "throw", +// }; +// } + +export function initializeContext(params: JSONSchemaGeneratorParams): ToJSONSchemaContext { + // Normalize target: convert old non-hyphenated versions to hyphenated versions + let target: ToJSONSchemaContext["target"] = params?.target ?? "draft-2020-12"; + if (target === "draft-4") target = "draft-04"; + if (target === "draft-7") target = "draft-07"; + + return { + processors: params.processors ?? {}, + metadataRegistry: params?.metadata ?? globalRegistry, + target, + unrepresentable: params?.unrepresentable ?? "throw", + override: (params?.override as any) ?? (() => {}), + io: params?.io ?? "output", + counter: 0, + seen: new Map(), + cycles: params?.cycles ?? "ref", + reused: params?.reused ?? "inline", + external: params?.external ?? undefined, + }; +} + +export function process( + schema: T, + ctx: ToJSONSchemaContext, + _params: ProcessParams = { path: [], schemaPath: [] } +): JSONSchema.BaseSchema { + const def = schema._zod.def as schemas.$ZodTypes["_zod"]["def"]; + + // check for schema in seens + const seen = ctx.seen.get(schema); + + if (seen) { + seen.count++; + + // check if cycle + const isCycle = _params.schemaPath.includes(schema); + if (isCycle) { + seen.cycle = _params.path; + } + + return seen.schema; + } + + // initialize + const result: Seen = { schema: {}, count: 1, cycle: undefined, path: _params.path }; + ctx.seen.set(schema, result); + + // custom method overrides default behavior + const overrideSchema = schema._zod.toJSONSchema?.(); + if (overrideSchema) { + result.schema = overrideSchema as any; + } else { + const params = { + ..._params, + schemaPath: [..._params.schemaPath, schema], + path: _params.path, + }; + + if (schema._zod.processJSONSchema) { + schema._zod.processJSONSchema(ctx, result.schema, params); + } else { + const _json = result.schema; + const processor = ctx.processors[def.type]; + if (!processor) { + throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`); + } + processor(schema, ctx, _json, params); + } + + const parent = schema._zod.parent as T; + + if (parent) { + // Also set ref if processor didn't (for inheritance) + if (!result.ref) result.ref = parent; + process(parent, ctx, params); + ctx.seen.get(parent)!.isParent = true; + } + } + + // metadata + const meta = ctx.metadataRegistry.get(schema); + if (meta) Object.assign(result.schema, meta); + + if (ctx.io === "input" && isTransforming(schema)) { + // examples/defaults only apply to output type of pipe + delete result.schema.examples; + delete result.schema.default; + } + + // set prefault as default + if (ctx.io === "input" && "_prefault" in result.schema) result.schema.default ??= result.schema._prefault; + delete result.schema._prefault; + + // pulling fresh from ctx.seen in case it was overwritten + const _result = ctx.seen.get(schema)!; + + return _result.schema; +} + +export function extractDefs( + ctx: ToJSONSchemaContext, + schema: T + // params: EmitParams +): void { + // iterate over seen map; + const root = ctx.seen.get(schema); + + if (!root) throw new Error("Unprocessed schema. This is a bug in Zod."); + + // Track ids to detect duplicates across different schemas + const idToSchema = new Map(); + for (const entry of ctx.seen.entries()) { + const id = ctx.metadataRegistry.get(entry[0])?.id; + if (id) { + const existing = idToSchema.get(id); + if (existing && existing !== entry[0]) { + throw new Error( + `Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.` + ); + } + idToSchema.set(id, entry[0]); + } + } + + // returns a ref to the schema + // defId will be empty if the ref points to an external schema (or #) + const makeURI = (entry: [schemas.$ZodType, Seen]): { ref: string; defId?: string } => { + // comparing the seen objects because sometimes + // multiple schemas map to the same seen object. + // e.g. lazy + + // external is configured + const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions"; + if (ctx.external) { + const externalId = ctx.external.registry.get(entry[0])?.id; // ?? "__shared";// `__schema${ctx.counter++}`; + + // check if schema is in the external registry + const uriGenerator = ctx.external.uri ?? ((id: string) => id); + if (externalId) { + return { ref: uriGenerator(externalId) }; + } + + // otherwise, add to __shared + const id: string = entry[1].defId ?? (entry[1].schema.id as string) ?? `schema${ctx.counter++}`; + entry[1].defId = id; // set defId so it will be reused if needed + return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` }; + } + + if (entry[1] === root) { + return { ref: "#" }; + } + + // self-contained schema + const uriPrefix = `#`; + const defUriPrefix = `${uriPrefix}/${defsSegment}/`; + const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`; + return { defId, ref: defUriPrefix + defId }; + }; + + // stored cached version in `def` property + // remove all properties, set $ref + const extractToDef = (entry: [schemas.$ZodType, Seen]): void => { + // if the schema is already a reference, do not extract it + if (entry[1].schema.$ref) { + return; + } + const seen = entry[1]; + const { ref, defId } = makeURI(entry); + + seen.def = { ...seen.schema }; + // defId won't be set if the schema is a reference to an external schema + // or if the schema is the root schema + if (defId) seen.defId = defId; + // wipe away all properties except $ref + const schema = seen.schema; + for (const key in schema) { + delete schema[key]; + } + schema.$ref = ref; + }; + + // throw on cycles + + // break cycles + if (ctx.cycles === "throw") { + for (const entry of ctx.seen.entries()) { + const seen = entry[1]; + if (seen.cycle) { + throw new Error( + "Cycle detected: " + + `#/${seen.cycle?.join("/")}/` + + '\n\nSet the `cycles` parameter to `"ref"` to resolve cyclical schemas with defs.' + ); + } + } + } + + // extract schemas into $defs + for (const entry of ctx.seen.entries()) { + const seen = entry[1]; + + // convert root schema to # $ref + if (schema === entry[0]) { + extractToDef(entry); // this has special handling for the root schema + continue; + } + + // extract schemas that are in the external registry + if (ctx.external) { + const ext = ctx.external.registry.get(entry[0])?.id; + if (schema !== entry[0] && ext) { + extractToDef(entry); + continue; + } + } + + // extract schemas with `id` meta + const id = ctx.metadataRegistry.get(entry[0])?.id; + if (id) { + extractToDef(entry); + continue; + } + + // break cycles + if (seen.cycle) { + // any + extractToDef(entry); + continue; + } + + // extract reused schemas + if (seen.count > 1) { + if (ctx.reused === "ref") { + extractToDef(entry); + // biome-ignore lint: + continue; + } + } + } +} + +export function finalize( + ctx: ToJSONSchemaContext, + schema: T +): ZodStandardJSONSchemaPayload { + const root = ctx.seen.get(schema); + if (!root) throw new Error("Unprocessed schema. This is a bug in Zod."); + + // flatten refs - inherit properties from parent schemas + const flattenRef = (zodSchema: schemas.$ZodType) => { + const seen = ctx.seen.get(zodSchema)!; + + // already processed + if (seen.ref === null) return; + + const schema = seen.def ?? seen.schema; + const _cached = { ...schema }; + + const ref = seen.ref; + seen.ref = null; // prevent infinite recursion + + if (ref) { + flattenRef(ref); + + const refSeen = ctx.seen.get(ref)!; + const refSchema = refSeen.schema; + + // merge referenced schema into current + if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) { + // older drafts can't combine $ref with other properties + schema.allOf = schema.allOf ?? []; + schema.allOf.push(refSchema); + } else { + Object.assign(schema, refSchema); + } + // restore child's own properties (child wins) + Object.assign(schema, _cached); + + const isParentRef = zodSchema._zod.parent === ref; + + // For parent chain, child is a refinement - remove parent-only properties + if (isParentRef) { + for (const key in schema) { + if (key === "$ref" || key === "allOf") continue; + if (!(key in _cached)) { + delete schema[key]; + } + } + } + + // When ref was extracted to $defs, remove properties that match the definition + if (refSchema.$ref && refSeen.def) { + for (const key in schema) { + if (key === "$ref" || key === "allOf") continue; + if (key in refSeen.def && JSON.stringify(schema[key]) === JSON.stringify(refSeen.def[key])) { + delete schema[key]; + } + } + } + } + + // If parent was extracted (has $ref), propagate $ref to this schema + // This handles cases like: readonly().meta({id}).describe() + // where processor sets ref to innerType but parent should be referenced + const parent = zodSchema._zod.parent; + if (parent && parent !== ref) { + // Ensure parent is processed first so its def has inherited properties + flattenRef(parent); + const parentSeen = ctx.seen.get(parent); + if (parentSeen?.schema.$ref) { + schema.$ref = parentSeen.schema.$ref; + // De-duplicate with parent's definition + if (parentSeen.def) { + for (const key in schema) { + if (key === "$ref" || key === "allOf") continue; + if (key in parentSeen.def && JSON.stringify(schema[key]) === JSON.stringify(parentSeen.def[key])) { + delete schema[key]; + } + } + } + } + } + + // execute overrides + ctx.override({ + zodSchema: zodSchema as schemas.$ZodTypes, + jsonSchema: schema, + path: seen.path ?? [], + }); + }; + + for (const entry of [...ctx.seen.entries()].reverse()) { + flattenRef(entry[0]); + } + + const result: JSONSchema.BaseSchema = {}; + if (ctx.target === "draft-2020-12") { + result.$schema = "https://json-schema.org/draft/2020-12/schema"; + } else if (ctx.target === "draft-07") { + result.$schema = "http://json-schema.org/draft-07/schema#"; + } else if (ctx.target === "draft-04") { + result.$schema = "http://json-schema.org/draft-04/schema#"; + } else if (ctx.target === "openapi-3.0") { + // OpenAPI 3.0 schema objects should not include a $schema property + } else { + // Arbitrary string values are allowed but won't have a $schema property set + } + + if (ctx.external?.uri) { + const id = ctx.external.registry.get(schema)?.id; + if (!id) throw new Error("Schema is missing an `id` property"); + result.$id = ctx.external.uri(id); + } + + Object.assign(result, root.def ?? root.schema); + + // The `id` in `.meta()` is a Zod-specific registration tag used to extract + // schemas into $defs — it is not user-facing JSON Schema metadata. Strip it + // from the output body where it would otherwise leak. The id is preserved + // implicitly via the $defs key (and via $ref paths). + const rootMetaId = ctx.metadataRegistry.get(schema)?.id; + if (rootMetaId !== undefined && result.id === rootMetaId) delete result.id; + + // build defs object + const defs: JSONSchema.BaseSchema["$defs"] = ctx.external?.defs ?? {}; + for (const entry of ctx.seen.entries()) { + const seen = entry[1]; + if (seen.def && seen.defId) { + if (seen.def.id === seen.defId) delete seen.def.id; + defs[seen.defId] = seen.def; + } + } + + // set definitions in result + if (ctx.external) { + } else { + if (Object.keys(defs).length > 0) { + if (ctx.target === "draft-2020-12") { + result.$defs = defs; + } else { + result.definitions = defs; + } + } + } + + try { + // this "finalizes" this schema and ensures all cycles are removed + // each call to finalize() is functionally independent + // though the seen map is shared + const finalized = JSON.parse(JSON.stringify(result)); + Object.defineProperty(finalized, "~standard", { + value: { + ...schema["~standard"], + jsonSchema: { + input: createStandardJSONSchemaMethod(schema, "input", ctx.processors), + output: createStandardJSONSchemaMethod(schema, "output", ctx.processors), + }, + }, + enumerable: false, + writable: false, + }); + + return finalized; + } catch (_err) { + throw new Error("Error converting schema to JSON."); + } +} + +function isTransforming( + _schema: schemas.$ZodType, + _ctx?: { + seen: Set; + } +): boolean { + const ctx = _ctx ?? { seen: new Set() }; + + if (ctx.seen.has(_schema)) return false; + ctx.seen.add(_schema); + + const def = (_schema as schemas.$ZodTypes)._zod.def; + + if (def.type === "transform") return true; + + if (def.type === "array") return isTransforming(def.element, ctx); + if (def.type === "set") return isTransforming(def.valueType, ctx); + if (def.type === "lazy") return isTransforming(def.getter(), ctx); + + if ( + def.type === "promise" || + def.type === "optional" || + def.type === "nonoptional" || + def.type === "nullable" || + def.type === "readonly" || + def.type === "default" || + def.type === "prefault" + ) { + return isTransforming(def.innerType, ctx); + } + + if (def.type === "intersection") { + return isTransforming(def.left, ctx) || isTransforming(def.right, ctx); + } + if (def.type === "record" || def.type === "map") { + return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx); + } + if (def.type === "pipe") { + if (_schema._zod.traits.has("$ZodCodec")) return true; + return isTransforming(def.in, ctx) || isTransforming(def.out, ctx); + } + + if (def.type === "object") { + for (const key in def.shape) { + if (isTransforming(def.shape[key]!, ctx)) return true; + } + return false; + } + if (def.type === "union") { + for (const option of def.options) { + if (isTransforming(option, ctx)) return true; + } + return false; + } + if (def.type === "tuple") { + for (const item of def.items) { + if (isTransforming(item, ctx)) return true; + } + if (def.rest && isTransforming(def.rest, ctx)) return true; + return false; + } + + return false; +} + +export type ZodStandardSchemaWithJSON = StandardSchemaWithJSONProps, core.output>; +export interface ZodStandardJSONSchemaPayload extends JSONSchema.BaseSchema { + "~standard": ZodStandardSchemaWithJSON; +} + +/** + * Creates a toJSONSchema method for a schema instance. + * This encapsulates the logic of initializing context, processing, extracting defs, and finalizing. + */ +export const createToJSONSchemaMethod = + (schema: T, processors: Record = {}) => + (params?: ToJSONSchemaParams): ZodStandardJSONSchemaPayload => { + const ctx = initializeContext({ ...params, processors }); + process(schema, ctx); + extractDefs(ctx, schema); + return finalize(ctx, schema); + }; + +/** + * Creates a toJSONSchema method for a schema instance. + * This encapsulates the logic of initializing context, processing, extracting defs, and finalizing. + */ +type StandardJSONSchemaMethodParams = Parameters[0]; +export const createStandardJSONSchemaMethod = + (schema: T, io: "input" | "output", processors: Record = {}) => + (params?: StandardJSONSchemaMethodParams): JSONSchema.BaseSchema => { + const { libraryOptions, target } = params ?? {}; + const ctx = initializeContext({ ...(libraryOptions ?? {}), target, io, processors }); + process(schema, ctx); + extractDefs(ctx, schema); + return finalize(ctx, schema); + }; diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/util.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/util.ts new file mode 100644 index 0000000000000000000000000000000000000000..8738df4ed090c9c700376f2f2e4e1fd92ec73560 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/util.ts @@ -0,0 +1,983 @@ +import type * as checks from "./checks.js"; +import { globalConfig } from "./core.js"; +import type { $ZodConfig } from "./core.js"; +import type * as errors from "./errors.js"; +import type * as schemas from "./schemas.js"; + +// json +export type JSONType = string | number | boolean | null | JSONType[] | { [key: string]: JSONType }; +export type JWTAlgorithm = + | "HS256" + | "HS384" + | "HS512" + | "RS256" + | "RS384" + | "RS512" + | "ES256" + | "ES384" + | "ES512" + | "PS256" + | "PS384" + | "PS512" + | "EdDSA" + | (string & {}); + +export type HashAlgorithm = "md5" | "sha1" | "sha256" | "sha384" | "sha512"; +export type HashEncoding = "hex" | "base64" | "base64url"; +export type HashFormat = `${HashAlgorithm}_${HashEncoding}`; +export type IPVersion = "v4" | "v6"; +export type MimeTypes = + | "application/json" + | "application/xml" + | "application/x-www-form-urlencoded" + | "application/javascript" + | "application/pdf" + | "application/zip" + | "application/vnd.ms-excel" + | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" + | "application/msword" + | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" + | "application/vnd.ms-powerpoint" + | "application/vnd.openxmlformats-officedocument.presentationml.presentation" + | "application/octet-stream" + | "application/graphql" + | "text/html" + | "text/plain" + | "text/css" + | "text/javascript" + | "text/csv" + | "image/png" + | "image/jpeg" + | "image/gif" + | "image/svg+xml" + | "image/webp" + | "audio/mpeg" + | "audio/ogg" + | "audio/wav" + | "audio/webm" + | "video/mp4" + | "video/webm" + | "video/ogg" + | "font/woff" + | "font/woff2" + | "font/ttf" + | "font/otf" + | "multipart/form-data" + | (string & {}); +export type ParsedTypes = + | "string" + | "number" + | "bigint" + | "boolean" + | "symbol" + | "undefined" + | "object" + | "function" + | "file" + | "date" + | "array" + | "map" + | "set" + | "nan" + | "null" + | "promise"; + +// utils +export type AssertEqual = (() => V extends T ? 1 : 2) extends () => V extends U ? 1 : 2 ? true : false; +export type AssertNotEqual = (() => V extends T ? 1 : 2) extends () => V extends U ? 1 : 2 ? false : true; +export type AssertExtends = T extends U ? T : never; +export type IsAny = 0 extends 1 & T ? true : false; +export type Omit = Pick>; +export type OmitKeys = Pick>; +export type MakePartial = Omit & InexactPartial>; +export type MakeRequired = Omit & Required>; + +export type Exactly = T & Record, never>; +export type NoUndefined = T extends undefined ? never : T; +export type Whatever = {} | undefined | null; +export type LoosePartial = InexactPartial & { + [k: string]: unknown; +}; +export type Mask = { [K in Keys]?: true }; +export type Writeable = { -readonly [P in keyof T]: T[P] } & {}; +export type InexactPartial = { + [P in keyof T]?: T[P] | undefined; +}; +export type EmptyObject = Record; +export type BuiltIn = + | (((...args: any[]) => any) | (new (...args: any[]) => any)) + | { readonly [Symbol.toStringTag]: string } + | Date + | Error + | Generator + | Promise + | RegExp; +export type MakeReadonly = T extends Map + ? ReadonlyMap + : T extends Set + ? ReadonlySet + : T extends [infer Head, ...infer Tail] + ? readonly [Head, ...Tail] + : T extends Array + ? ReadonlyArray + : T extends BuiltIn + ? T + : Readonly; +export type SomeObject = Record; +export type Identity = T; +export type Flatten = Identity<{ [k in keyof T]: T[k] }>; +export type Mapped = { [k in keyof T]: T[k] }; +export type Prettify = { + // @ts-ignore + [K in keyof T]: T[K]; +} & {}; + +export type NoNeverKeys = { + [k in keyof T]: [T[k]] extends [never] ? never : k; +}[keyof T]; +export type NoNever = Identity<{ + [k in NoNeverKeys]: k extends keyof T ? T[k] : never; +}>; +export type Extend = Flatten< + // fast path when there is no keys overlap + keyof A & keyof B extends never + ? A & B + : { + [K in keyof A as K extends keyof B ? never : K]: A[K]; + } & { + [K in keyof B]: B[K]; + } +>; + +export type TupleItems = ReadonlyArray; +export type AnyFunc = (...args: any[]) => any; +export type IsProp = T[K] extends AnyFunc ? never : K; +export type MaybeAsync = T | Promise; +export type KeyOf = keyof OmitIndexSignature; +export type OmitIndexSignature = { + [K in keyof T as string extends K ? never : K extends string ? K : never]: T[K]; +}; +export type ExtractIndexSignature = { + [K in keyof T as string extends K ? K : K extends string ? never : K]: T[K]; +}; +export type Keys = keyof OmitIndexSignature; + +export type SchemaClass = { + new (def: T["_zod"]["def"]): T; +}; +export type EnumValue = string | number; // | bigint | boolean | symbol; +export type EnumLike = Readonly>; +export type ToEnum = Flatten<{ [k in T]: k }>; +export type KeysEnum = ToEnum>; +export type KeysArray = Flatten<(keyof T & string)[]>; +export type Literal = string | number | bigint | boolean | null | undefined; +export type LiteralArray = Array; +export type Primitive = string | number | symbol | bigint | boolean | null | undefined; +export type PrimitiveArray = Array; +export type HasSize = { size: number }; +export type HasLength = { length: number }; // string | Array | Set | File; +export type Numeric = number | bigint | Date; +export type SafeParseResult = SafeParseSuccess | SafeParseError; +export type SafeParseSuccess = { success: true; data: T; error?: never }; +export type SafeParseError = { + success: false; + data?: never; + error: errors.$ZodError; +}; + +export type PropValues = Record>; +export type PrimitiveSet = Set; + +// functions +export function assertEqual(val: AssertEqual): AssertEqual { + return val; +} + +export function assertNotEqual(val: AssertNotEqual): AssertNotEqual { + return val; +} + +export function assertIs(_arg: T): void {} + +export function assertNever(_x: never): never { + throw new Error("Unexpected value in exhaustive check"); +} +export function assert(_: any): asserts _ is T {} + +export function getEnumValues(entries: EnumLike): EnumValue[] { + const numericValues = Object.values(entries).filter((v) => typeof v === "number"); + const values = Object.entries(entries) + .filter(([k, _]) => numericValues.indexOf(+k) === -1) + .map(([_, v]) => v); + return values; +} + +export function joinValues(array: T, separator = "|"): string { + return array.map((val) => stringifyPrimitive(val)).join(separator); +} + +export function jsonStringifyReplacer(_: string, value: any): any { + if (typeof value === "bigint") return value.toString(); + return value; +} + +export function cached(getter: () => T): { value: T } { + const set = false; + return { + get value() { + if (!set) { + const value = getter(); + Object.defineProperty(this, "value", { value }); + return value; + } + throw new Error("cached value already set"); + }, + }; +} + +export function nullish(input: any): boolean { + return input === null || input === undefined; +} + +export function cleanRegex(source: string): string { + const start = source.startsWith("^") ? 1 : 0; + const end = source.endsWith("$") ? source.length - 1 : source.length; + return source.slice(start, end); +} + +export function floatSafeRemainder(val: number, step: number): number { + const ratio = val / step; + const roundedRatio = Math.round(ratio); + // Use a relative epsilon scaled to the magnitude of the result + const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1); + if (Math.abs(ratio - roundedRatio) < tolerance) return 0; + return ratio - roundedRatio; +} + +const EVALUATING = /* @__PURE__*/ Symbol("evaluating"); + +export function defineLazy(object: T, key: K, getter: () => T[K]): void { + let value: T[K] | typeof EVALUATING | undefined = undefined; + Object.defineProperty(object, key, { + get() { + if (value === EVALUATING) { + // Circular reference detected, return undefined to break the cycle + return undefined as T[K]; + } + if (value === undefined) { + value = EVALUATING; + value = getter(); + } + return value; + }, + set(v) { + Object.defineProperty(object, key, { + value: v, + // configurable: true, + }); + // object[key] = v; + }, + configurable: true, + }); +} + +export function objectClone(obj: object) { + return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj)); +} + +export function assignProp( + target: T, + prop: K, + value: K extends keyof T ? T[K] : any +): void { + Object.defineProperty(target, prop, { + value, + writable: true, + enumerable: true, + configurable: true, + }); +} + +export function mergeDefs(...defs: Record[]): any { + const mergedDescriptors: Record = {}; + + for (const def of defs) { + const descriptors = Object.getOwnPropertyDescriptors(def); + Object.assign(mergedDescriptors, descriptors); + } + + return Object.defineProperties({}, mergedDescriptors); +} + +export function cloneDef(schema: schemas.$ZodType): any { + return mergeDefs(schema._zod.def); +} + +export function getElementAtPath(obj: any, path: (string | number)[] | null | undefined): any { + if (!path) return obj; + return path.reduce((acc, key) => acc?.[key], obj); +} + +export function promiseAllObject(promisesObj: T): Promise<{ [k in keyof T]: Awaited }> { + const keys = Object.keys(promisesObj); + const promises = keys.map((key) => (promisesObj as any)[key]); + + return Promise.all(promises).then((results) => { + const resolvedObj: any = {}; + for (let i = 0; i < keys.length; i++) { + resolvedObj[keys[i]!] = results[i]; + } + return resolvedObj; + }); +} + +export function randomString(length = 10): string { + const chars = "abcdefghijklmnopqrstuvwxyz"; + let str = ""; + for (let i = 0; i < length; i++) { + str += chars[Math.floor(Math.random() * chars.length)]; + } + return str; +} + +export function esc(str: string): string { + return JSON.stringify(str); +} + +export function slugify(input: string): string { + return input + .toLowerCase() + .trim() + .replace(/[^\w\s-]/g, "") + .replace(/[\s_-]+/g, "-") + .replace(/^-+|-+$/g, ""); +} + +export const captureStackTrace: (targetObject: object, constructorOpt?: Function) => void = ( + "captureStackTrace" in Error ? Error.captureStackTrace : (..._args: any[]) => {} +) as any; + +export function isObject(data: any): data is Record { + return typeof data === "object" && data !== null && !Array.isArray(data); +} + +export const allowsEval: { value: boolean } = /* @__PURE__*/ cached(() => { + // Skip the probe under `jitless`: strict CSPs report the caught `new Function` + // as a `securitypolicyviolation` even though the throw is swallowed. + if (globalConfig.jitless) { + return false; + } + + // @ts-ignore + if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) { + return false; + } + + try { + const F = Function; + new F(""); + return true; + } catch (_) { + return false; + } +}); + +export function isPlainObject(o: any): o is Record { + if (isObject(o) === false) return false; + + // modified constructor + const ctor = o.constructor; + if (ctor === undefined) return true; + + if (typeof ctor !== "function") return true; + + // modified prototype + const prot = ctor.prototype; + if (isObject(prot) === false) return false; + + // ctor doesn't have static `isPrototypeOf` + if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) { + return false; + } + + return true; +} + +export function shallowClone(o: any): any { + if (isPlainObject(o)) return { ...o }; + if (Array.isArray(o)) return [...o]; + if (o instanceof Map) return new Map(o); + if (o instanceof Set) return new Set(o); + return o; +} + +export function numKeys(data: any): number { + let keyCount = 0; + for (const key in data) { + if (Object.prototype.hasOwnProperty.call(data, key)) { + keyCount++; + } + } + return keyCount; +} + +export const getParsedType = (data: any): ParsedTypes => { + const t = typeof data; + + switch (t) { + case "undefined": + return "undefined"; + + case "string": + return "string"; + + case "number": + return Number.isNaN(data) ? "nan" : "number"; + + case "boolean": + return "boolean"; + + case "function": + return "function"; + + case "bigint": + return "bigint"; + + case "symbol": + return "symbol"; + + case "object": + if (Array.isArray(data)) { + return "array"; + } + if (data === null) { + return "null"; + } + if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") { + return "promise"; + } + if (typeof Map !== "undefined" && data instanceof Map) { + return "map"; + } + if (typeof Set !== "undefined" && data instanceof Set) { + return "set"; + } + if (typeof Date !== "undefined" && data instanceof Date) { + return "date"; + } + // @ts-ignore + if (typeof File !== "undefined" && data instanceof File) { + return "file"; + } + return "object"; + + default: + throw new Error(`Unknown data type: ${t}`); + } +}; + +export const propertyKeyTypes: Set = /* @__PURE__*/ new Set(["string", "number", "symbol"]); +export const primitiveTypes: Set = /* @__PURE__*/ new Set([ + "string", + "number", + "bigint", + "boolean", + "symbol", + "undefined", +]); +export function escapeRegex(str: string): string { + return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); +} + +// zod-specific utils +export function clone(inst: T, def?: T["_zod"]["def"], params?: { parent: boolean }): T { + const cl = new inst._zod.constr(def ?? inst._zod.def); + if (!def || params?.parent) cl._zod.parent = inst; + return cl as any; +} + +export type EmptyToNever = keyof T extends never ? never : T; + +export type Normalize = T extends undefined + ? never + : T extends Record + ? Flatten< + { + [k in keyof Omit]: T[k]; + } & ("error" extends keyof T + ? { + error?: Exclude; + // path?: PropertyKey[] | undefined; + // message?: string | undefined; + } + : unknown) + > + : never; + +export function normalizeParams(_params: T): Normalize { + const params: any = _params; + + if (!params) return {} as any; + if (typeof params === "string") return { error: () => params } as any; + if (params?.message !== undefined) { + if (params?.error !== undefined) throw new Error("Cannot specify both `message` and `error` params"); + params.error = params.message; + } + delete params.message; + if (typeof params.error === "string") return { ...params, error: () => params.error } as any; + return params; +} + +export function createTransparentProxy(getter: () => T): T { + let target: T; + return new Proxy( + {}, + { + get(_, prop, receiver) { + target ??= getter(); + return Reflect.get(target, prop, receiver); + }, + set(_, prop, value, receiver) { + target ??= getter(); + return Reflect.set(target, prop, value, receiver); + }, + has(_, prop) { + target ??= getter(); + return Reflect.has(target, prop); + }, + deleteProperty(_, prop) { + target ??= getter(); + return Reflect.deleteProperty(target, prop); + }, + ownKeys(_) { + target ??= getter(); + return Reflect.ownKeys(target); + }, + getOwnPropertyDescriptor(_, prop) { + target ??= getter(); + return Reflect.getOwnPropertyDescriptor(target, prop); + }, + defineProperty(_, prop, descriptor) { + target ??= getter(); + return Reflect.defineProperty(target, prop, descriptor); + }, + } + ) as T; +} + +export function stringifyPrimitive(value: any): string { + if (typeof value === "bigint") return value.toString() + "n"; + if (typeof value === "string") return `"${value}"`; + return `${value}`; +} + +export function optionalKeys(shape: schemas.$ZodShape): string[] { + return Object.keys(shape).filter((k) => { + return shape[k]!._zod.optin === "optional" && shape[k]!._zod.optout === "optional"; + }); +} + +export type CleanKey = T extends `?${infer K}` ? K : T extends `${infer K}?` ? K : T; +export type ToCleanMap = { + [k in keyof T]: k extends `?${infer K}` ? K : k extends `${infer K}?` ? K : k; +}; +export type FromCleanMap = { + [k in keyof T as k extends `?${infer K}` ? K : k extends `${infer K}?` ? K : k]: k; +}; + +export const NUMBER_FORMAT_RANGES: Record = { + safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER], + int32: [-2147483648, 2147483647], + uint32: [0, 4294967295], + float32: [-3.4028234663852886e38, 3.4028234663852886e38], + float64: [-Number.MAX_VALUE, Number.MAX_VALUE], +}; + +export const BIGINT_FORMAT_RANGES: Record = { + int64: [/* @__PURE__*/ BigInt("-9223372036854775808"), /* @__PURE__*/ BigInt("9223372036854775807")], + uint64: [/* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt("18446744073709551615")], +}; + +export function pick(schema: schemas.$ZodObject, mask: Record): any { + const currDef = schema._zod.def; + + const checks = currDef.checks; + const hasChecks = checks && checks.length > 0; + if (hasChecks) { + throw new Error(".pick() cannot be used on object schemas containing refinements"); + } + + const def = mergeDefs(schema._zod.def, { + get shape() { + const newShape: Writeable = {}; + for (const key in mask) { + if (!(key in currDef.shape)) { + throw new Error(`Unrecognized key: "${key}"`); + } + if (!mask[key]) continue; + newShape[key] = currDef.shape[key]!; + } + + assignProp(this, "shape", newShape); // self-caching + return newShape; + }, + checks: [], + }); + + return clone(schema, def) as any; +} + +export function omit(schema: schemas.$ZodObject, mask: object): any { + const currDef = schema._zod.def; + + const checks = currDef.checks; + const hasChecks = checks && checks.length > 0; + if (hasChecks) { + throw new Error(".omit() cannot be used on object schemas containing refinements"); + } + + const def = mergeDefs(schema._zod.def, { + get shape() { + const newShape: Writeable = { ...schema._zod.def.shape }; + for (const key in mask) { + if (!(key in currDef.shape)) { + throw new Error(`Unrecognized key: "${key}"`); + } + if (!(mask as any)[key]) continue; + + delete newShape[key]; + } + assignProp(this, "shape", newShape); // self-caching + return newShape; + }, + checks: [], + }); + + return clone(schema, def); +} + +export function extend(schema: schemas.$ZodObject, shape: schemas.$ZodShape): any { + if (!isPlainObject(shape)) { + throw new Error("Invalid input to extend: expected a plain object"); + } + + const checks = schema._zod.def.checks; + const hasChecks = checks && checks.length > 0; + if (hasChecks) { + // Only throw if new shape overlaps with existing shape + // Use getOwnPropertyDescriptor to check key existence without accessing values + const existingShape = schema._zod.def.shape; + for (const key in shape) { + if (Object.getOwnPropertyDescriptor(existingShape, key) !== undefined) { + throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead."); + } + } + } + + const def = mergeDefs(schema._zod.def, { + get shape() { + const _shape = { ...schema._zod.def.shape, ...shape }; + assignProp(this, "shape", _shape); // self-caching + return _shape; + }, + }); + return clone(schema, def) as any; +} + +export function safeExtend(schema: schemas.$ZodObject, shape: schemas.$ZodShape): any { + if (!isPlainObject(shape)) { + throw new Error("Invalid input to safeExtend: expected a plain object"); + } + const def = mergeDefs(schema._zod.def, { + get shape() { + const _shape = { ...schema._zod.def.shape, ...shape }; + assignProp(this, "shape", _shape); // self-caching + return _shape; + }, + }); + return clone(schema, def) as any; +} + +export function merge(a: schemas.$ZodObject, b: schemas.$ZodObject): any { + if (a._zod.def.checks?.length) { + throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead."); + } + const def = mergeDefs(a._zod.def, { + get shape() { + const _shape = { ...a._zod.def.shape, ...b._zod.def.shape }; + assignProp(this, "shape", _shape); // self-caching + return _shape; + }, + get catchall() { + return b._zod.def.catchall; + }, + checks: b._zod.def.checks ?? [], + }); + + return clone(a, def) as any; +} + +export function partial( + Class: SchemaClass | null, + schema: schemas.$ZodObject, + mask: object | undefined +): any { + const currDef = schema._zod.def; + const checks = currDef.checks; + const hasChecks = checks && checks.length > 0; + if (hasChecks) { + throw new Error(".partial() cannot be used on object schemas containing refinements"); + } + + const def = mergeDefs(schema._zod.def, { + get shape() { + const oldShape = schema._zod.def.shape; + const shape: Writeable = { ...oldShape }; + + if (mask) { + for (const key in mask) { + if (!(key in oldShape)) { + throw new Error(`Unrecognized key: "${key}"`); + } + if (!(mask as any)[key]) continue; + // if (oldShape[key]!._zod.optin === "optional") continue; + shape[key] = Class + ? new Class({ + type: "optional", + innerType: oldShape[key]!, + }) + : oldShape[key]!; + } + } else { + for (const key in oldShape) { + // if (oldShape[key]!._zod.optin === "optional") continue; + shape[key] = Class + ? new Class({ + type: "optional", + innerType: oldShape[key]!, + }) + : oldShape[key]!; + } + } + + assignProp(this, "shape", shape); // self-caching + return shape; + }, + checks: [], + }); + + return clone(schema, def) as any; +} + +export function required( + Class: SchemaClass, + schema: schemas.$ZodObject, + mask: object | undefined +): any { + const def = mergeDefs(schema._zod.def, { + get shape() { + const oldShape = schema._zod.def.shape; + const shape: Writeable = { ...oldShape }; + + if (mask) { + for (const key in mask) { + if (!(key in shape)) { + throw new Error(`Unrecognized key: "${key}"`); + } + if (!(mask as any)[key]) continue; + // overwrite with non-optional + shape[key] = new Class({ + type: "nonoptional", + innerType: oldShape[key]!, + }); + } + } else { + for (const key in oldShape) { + // overwrite with non-optional + shape[key] = new Class({ + type: "nonoptional", + innerType: oldShape[key]!, + }); + } + } + + assignProp(this, "shape", shape); // self-caching + return shape; + }, + }); + + return clone(schema, def) as any; +} + +export type Constructor = new (...args: Def) => T; + +// invalid_type | too_big | too_small | invalid_format | not_multiple_of | unrecognized_keys | invalid_union | invalid_key | invalid_element | invalid_value | custom +export function aborted(x: schemas.ParsePayload, startIndex = 0): boolean { + if (x.aborted === true) return true; + for (let i = startIndex; i < x.issues.length; i++) { + if (x.issues[i]?.continue !== true) { + return true; + } + } + return false; +} + +// Checks for explicit abort (continue === false), as opposed to implicit abort (continue === undefined). +// Used to respect `abort: true` in .refine() even for checks that have a `when` function. +export function explicitlyAborted(x: schemas.ParsePayload, startIndex = 0): boolean { + if (x.aborted === true) return true; + for (let i = startIndex; i < x.issues.length; i++) { + if (x.issues[i]?.continue === false) { + return true; + } + } + return false; +} + +export function prefixIssues(path: PropertyKey, issues: errors.$ZodRawIssue[]): errors.$ZodRawIssue[] { + return issues.map((iss) => { + (iss as any).path ??= []; + (iss as any).path.unshift(path); + return iss; + }); +} + +export function unwrapMessage(message: string | { message: string } | undefined | null): string | undefined { + return typeof message === "string" ? message : message?.message; +} + +export function finalizeIssue( + iss: errors.$ZodRawIssue, + ctx: schemas.ParseContextInternal | undefined, + config: $ZodConfig +): errors.$ZodIssue { + const message = iss.message + ? iss.message + : (unwrapMessage(iss.inst?._zod.def?.error?.(iss as never)) ?? + unwrapMessage(ctx?.error?.(iss as never)) ?? + unwrapMessage(config.customError?.(iss)) ?? + unwrapMessage(config.localeError?.(iss)) ?? + "Invalid input"); + + const { inst: _inst, continue: _continue, input: _input, ...rest } = iss as any; + rest.path ??= []; + rest.message = message; + if (ctx?.reportInput) { + rest.input = _input; + } + return rest; +} + +export function getSizableOrigin(input: any): "set" | "map" | "file" | "unknown" { + if (input instanceof Set) return "set"; + if (input instanceof Map) return "map"; + // @ts-ignore + if (input instanceof File) return "file"; + return "unknown"; +} + +export function getLengthableOrigin(input: any): "array" | "string" | "unknown" { + if (Array.isArray(input)) return "array"; + if (typeof input === "string") return "string"; + return "unknown"; +} + +export function parsedType(data: unknown): errors.$ZodInvalidTypeExpected { + const t = typeof data; + switch (t) { + case "number": { + return Number.isNaN(data) ? "nan" : "number"; + } + case "object": { + if (data === null) { + return "null"; + } + if (Array.isArray(data)) { + return "array"; + } + + const obj = data as object; + if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) { + return (obj.constructor as { name: string }).name; + } + } + } + return t; +} + +////////// REFINES ////////// +export function issue(_iss: string, input: any, inst: any): errors.$ZodRawIssue; +export function issue(_iss: errors.$ZodRawIssue): errors.$ZodRawIssue; +export function issue(...args: [string | errors.$ZodRawIssue, any?, any?]): errors.$ZodRawIssue { + const [iss, input, inst] = args; + if (typeof iss === "string") { + return { + message: iss, + code: "custom", + input, + inst, + }; + } + + return { ...iss }; +} + +export function cleanEnum(obj: Record): EnumValue[] { + return Object.entries(obj) + .filter(([k, _]) => { + // return true if NaN, meaning it's not a number, thus a string key + return Number.isNaN(Number.parseInt(k, 10)); + }) + .map((el) => el[1]); +} + +// Codec utility functions +export function base64ToUint8Array(base64: string): InstanceType { + const binaryString = atob(base64); + const bytes = new Uint8Array(binaryString.length); + for (let i = 0; i < binaryString.length; i++) { + bytes[i] = binaryString.charCodeAt(i); + } + return bytes; +} + +export function uint8ArrayToBase64(bytes: Uint8Array): string { + let binaryString = ""; + for (let i = 0; i < bytes.length; i++) { + binaryString += String.fromCharCode(bytes[i]); + } + return btoa(binaryString); +} + +export function base64urlToUint8Array(base64url: string): InstanceType { + const base64 = base64url.replace(/-/g, "+").replace(/_/g, "/"); + const padding = "=".repeat((4 - (base64.length % 4)) % 4); + return base64ToUint8Array(base64 + padding); +} + +export function uint8ArrayToBase64url(bytes: Uint8Array): string { + return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, ""); +} + +export function hexToUint8Array(hex: string): InstanceType { + const cleanHex = hex.replace(/^0x/, ""); + if (cleanHex.length % 2 !== 0) { + throw new Error("Invalid hex string length"); + } + const bytes = new Uint8Array(cleanHex.length / 2); + for (let i = 0; i < cleanHex.length; i += 2) { + bytes[i / 2] = Number.parseInt(cleanHex.slice(i, i + 2), 16); + } + return bytes; +} + +export function uint8ArrayToHex(bytes: Uint8Array): string { + return Array.from(bytes) + .map((b) => b.toString(16).padStart(2, "0")) + .join(""); +} + +// instanceof +export abstract class Class { + constructor(..._args: any[]) {} +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/versions.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/versions.ts new file mode 100644 index 0000000000000000000000000000000000000000..49bb43ffd07fd6ef8227e37354f120d163fd5c93 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/versions.ts @@ -0,0 +1,5 @@ +export const version = { + major: 4, + minor: 4, + patch: 3 as number, +} as const; diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/zsf.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/zsf.ts new file mode 100644 index 0000000000000000000000000000000000000000..8966cf646b2c7bc3960d9047d1b07d00e91eff41 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/core/zsf.ts @@ -0,0 +1,323 @@ +/////////////////////////////////////////////////// +//////////////// TYPES /////////////////// +/////////////////////////////////////////////////// + +export interface $ZSF { + $zsf: { version: number }; + type: string; + // default value if not defined + default: unknown; + // fallback value if validation fails + fallback: unknown; +} + +export interface $ZSFString extends $ZSF { + type: "string"; + min_length?: number; + max_length?: number; + pattern?: string; +} + +export type NumberTypes = "float32" | "int32" | "uint32" | "float64" | "int64" | "uint64" | "bigint" | "bigdecimal"; + +export interface $ZSFNumber extends $ZSF { + type: "number"; + format?: NumberTypes; + minimum?: number; + maximum?: number; + multiple_of?: number; +} + +export interface $ZSFBoolean extends $ZSF { + type: "boolean"; +} + +export interface $ZSFNull extends $ZSF { + type: "null"; +} + +export interface $ZSFUndefined extends $ZSF { + type: "undefined"; +} + +export interface $ZSFOptional extends $ZSF { + type: "optional"; + inner: T; +} + +export interface $ZSFNever extends $ZSF { + type: "never"; +} + +export interface $ZSFAny extends $ZSF { + type: "any"; +} + +/** Supports */ +export interface $ZSFEnum extends $ZSF { + type: "enum"; + elements: Elements; +} + +export interface $ZSFArray extends $ZSF { + type: "array"; + prefixItems: PrefixItems; + items: Items; +} + +// type $ZSFObjectProperties = { [k: string]: $ZSF }; +type $ZSFObjectProperties = Array<{ + key: string; + value: $ZSF; + format?: "literal" | "pattern"; + ordering?: number; +}>; +export interface $ZSFObject extends $ZSF { + type: "object"; + properties: Properties; +} + +// export interface $ZSFTuple< +// Items extends $ZSF[] = $ZSF[], +// Rest extends $ZSF = $ZSF, +// > extends $ZSF { +// type: "array"; +// items: Items; +// rest: Rest; +// } + +/** Supports arbitrary literal values */ +export interface $ZSFLiteral extends $ZSF { + type: "literal"; + schema: T; + value: unknown; +} + +export interface $ZSFUnion extends $ZSF { + type: "union"; + elements: Elements; +} + +export interface $ZSFIntersection extends $ZSF { + type: "intersection"; + elements: $ZSF[]; +} + +export interface $ZSFMap extends $ZSF { + type: "map"; + keys: K; + values: V; +} + +export interface $ZSFConditional extends $ZSF { + type: "conditional"; + if: If; + then: Then; + else: Else; +} + +///////////////////////////////////////////////// +//////////////// CHECKS //////////////// +///////////////////////////////////////////////// + +// export interface $ZSFCheckRegex { +// check: "regex"; +// pattern: string; +// } + +// export interface $ZSFCheckEmail { +// check: "email"; +// } + +// export interface $ZSFCheckURL { +// check: "url"; +// } + +// export interface $ZSFCheckEmoji { +// check: "emoji"; +// } + +// export interface $ZSFCheckUUID { +// check: "uuid"; +// } + +// export interface $ZSFCheckUUIDv4 { +// check: "uuidv4"; +// } + +// export interface $ZSFCheckUUIDv6 { +// check: "uuidv6"; +// } + +// export interface $ZSFCheckNanoid { +// check: "nanoid"; +// } + +// export interface $ZSFCheckGUID { +// check: "guid"; +// } + +// export interface $ZSFCheckCUID { +// check: "cuid"; +// } + +// export interface $ZSFCheckCUID2 { +// check: "cuid2"; +// } + +// export interface $ZSFCheckULID { +// check: "ulid"; +// } + +// export interface $ZSFCheckXID { +// check: "xid"; +// } + +// export interface $ZSFCheckKSUID { +// check: "ksuid"; +// } + +// export interface $ZSFCheckISODateTime { +// check: "datetime"; +// precision?: number; +// local?: boolean; +// } + +// export interface $ZSFCheckISODate { +// check: "date"; +// } + +// export interface $ZSFCheckISOTime { +// check: "time"; +// precision?: number; +// local?: boolean; +// } + +// export interface $ZSFCheckDuration { +// check: "duration"; +// } + +// export interface $ZSFCheckIP { +// check: "ip"; +// } + +// export interface $ZSFCheckIPv4 { +// check: "ipv4"; +// } + +// export interface $ZSFCheckIPv6 { +// check: "ipv6"; +// } + +// export interface $ZSFCheckBase64 { +// check: "base64"; +// } + +// export interface $ZSFCheckJWT { +// check: "jwt"; +// } + +// export interface $ZSFCheckJSONString { +// check: "json_string"; +// } + +// export interface $ZSFCheckPrefix { +// check: "prefix"; +// prefix: string; +// } + +// export interface $ZSFCheckSuffix { +// check: "suffix"; +// suffix: string; +// } + +// export interface $ZSFCheckIncludes { +// check: "includes"; +// includes: string; +// } + +// export interface $ZSFCheckMinSize { +// check: "min_size"; +// minimum: number; +// } + +// export interface $ZSFCheckMaxSize { +// check: "max_size"; +// maximum: number; +// } + +// export interface $ZSFCheckSizeEquals { +// check: "size_equals"; +// size: number; +// } + +// export interface $ZSFCheckLessThan { +// check: "less_than"; +// maximum: number | bigint | Date; +// } + +// export interface $ZSFCheckLessThanOrEqual { +// check: "less_than_or_equal"; +// maximum: number | bigint | Date; +// } + +// export interface $ZSFCheckGreaterThan { +// check: "greater_than"; +// minimum: number | bigint | Date; +// } + +// export interface $ZSFCheckGreaterThanOrEqual { +// check: "greater_than_or_equal"; +// minimum: number | bigint | Date; +// } + +// export interface $ZSFCheckEquals { +// check: "equals"; +// value: number | bigint | Date; +// } + +// export interface $ZSFCheckMultipleOf { +// check: "multiple_of"; +// multipleOf: number; +// } + +// export type $ZSFStringFormatChecks = +// | $ZSFCheckRegex +// | $ZSFCheckEmail +// | $ZSFCheckURL +// | $ZSFCheckEmoji +// | $ZSFCheckUUID +// | $ZSFCheckUUIDv4 +// | $ZSFCheckUUIDv6 +// | $ZSFCheckNanoid +// | $ZSFCheckGUID +// | $ZSFCheckCUID +// | $ZSFCheckCUID2 +// | $ZSFCheckULID +// | $ZSFCheckXID +// | $ZSFCheckKSUID +// | $ZSFCheckISODateTime +// | $ZSFCheckISODate +// | $ZSFCheckISOTime +// | $ZSFCheckDuration +// | $ZSFCheckIP +// | $ZSFCheckIPv4 +// | $ZSFCheckIPv6 +// | $ZSFCheckBase64 +// | $ZSFCheckJWT +// | $ZSFCheckJSONString +// | $ZSFCheckPrefix +// | $ZSFCheckSuffix +// | $ZSFCheckIncludes; + +// export type $ZSFCheck = +// | $ZSFStringFormatChecks +// | $ZSFCheckMinSize +// | $ZSFCheckMaxSize +// | $ZSFCheckSizeEquals +// | $ZSFCheckLessThan +// | $ZSFCheckLessThanOrEqual +// | $ZSFCheckGreaterThan +// | $ZSFCheckGreaterThanOrEqual +// | $ZSFCheckEquals +// | $ZSFCheckMultipleOf; diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/index.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..31110e977d5b83532c6eb34ded964c364e452cf4 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/index.ts @@ -0,0 +1,4 @@ +import z4 from "./classic/index.js"; +export * from "./classic/index.js"; + +export default z4; diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ar.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ar.ts new file mode 100644 index 0000000000000000000000000000000000000000..f28bde9907870075cdcdcfe0d0056d00a4361708 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ar.ts @@ -0,0 +1,115 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "حرف", verb: "أن يحوي" }, + file: { unit: "بايت", verb: "أن يحوي" }, + array: { unit: "عنصر", verb: "أن يحوي" }, + set: { unit: "عنصر", verb: "أن يحوي" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "مدخل", + email: "بريد إلكتروني", + url: "رابط", + emoji: "إيموجي", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "تاريخ ووقت بمعيار ISO", + date: "تاريخ بمعيار ISO", + time: "وقت بمعيار ISO", + duration: "مدة بمعيار ISO", + ipv4: "عنوان IPv4", + ipv6: "عنوان IPv6", + cidrv4: "مدى عناوين بصيغة IPv4", + cidrv6: "مدى عناوين بصيغة IPv6", + base64: "نَص بترميز base64-encoded", + base64url: "نَص بترميز base64url-encoded", + json_string: "نَص على هيئة JSON", + e164: "رقم هاتف بمعيار E.164", + jwt: "JWT", + template_literal: "مدخل", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `مدخلات غير مقبولة: يفترض إدخال instanceof ${issue.expected}، ولكن تم إدخال ${received}`; + } + return `مدخلات غير مقبولة: يفترض إدخال ${expected}، ولكن تم إدخال ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) + return `مدخلات غير مقبولة: يفترض إدخال ${util.stringifyPrimitive(issue.values[0])}`; + return `اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return ` أكبر من اللازم: يفترض أن تكون ${issue.origin ?? "القيمة"} ${adj} ${issue.maximum.toString()} ${sizing.unit ?? "عنصر"}`; + return `أكبر من اللازم: يفترض أن تكون ${issue.origin ?? "القيمة"} ${adj} ${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `أصغر من اللازم: يفترض لـ ${issue.origin} أن يكون ${adj} ${issue.minimum.toString()} ${sizing.unit}`; + } + + return `أصغر من اللازم: يفترض لـ ${issue.origin} أن يكون ${adj} ${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `نَص غير مقبول: يجب أن يبدأ بـ "${issue.prefix}"`; + if (_issue.format === "ends_with") return `نَص غير مقبول: يجب أن ينتهي بـ "${_issue.suffix}"`; + if (_issue.format === "includes") return `نَص غير مقبول: يجب أن يتضمَّن "${_issue.includes}"`; + if (_issue.format === "regex") return `نَص غير مقبول: يجب أن يطابق النمط ${_issue.pattern}`; + return `${FormatDictionary[_issue.format] ?? issue.format} غير مقبول`; + } + case "not_multiple_of": + return `رقم غير مقبول: يجب أن يكون من مضاعفات ${issue.divisor}`; + case "unrecognized_keys": + return `معرف${issue.keys.length > 1 ? "ات" : ""} غريب${issue.keys.length > 1 ? "ة" : ""}: ${util.joinValues(issue.keys, "، ")}`; + case "invalid_key": + return `معرف غير مقبول في ${issue.origin}`; + case "invalid_union": + return "مدخل غير مقبول"; + case "invalid_element": + return `مدخل غير مقبول في ${issue.origin}`; + default: + return "مدخل غير مقبول"; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/az.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/az.ts new file mode 100644 index 0000000000000000000000000000000000000000..d6ae91fb1a2ab45b900a3a15b605cf892b7125e2 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/az.ts @@ -0,0 +1,111 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "simvol", verb: "olmalıdır" }, + file: { unit: "bayt", verb: "olmalıdır" }, + array: { unit: "element", verb: "olmalıdır" }, + set: { unit: "element", verb: "olmalıdır" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "input", + email: "email address", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO datetime", + date: "ISO date", + time: "ISO time", + duration: "ISO duration", + ipv4: "IPv4 address", + ipv6: "IPv6 address", + cidrv4: "IPv4 range", + cidrv6: "IPv6 range", + base64: "base64-encoded string", + base64url: "base64url-encoded string", + json_string: "JSON string", + e164: "E.164 number", + jwt: "JWT", + template_literal: "input", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Yanlış dəyər: gözlənilən instanceof ${issue.expected}, daxil olan ${received}`; + } + return `Yanlış dəyər: gözlənilən ${expected}, daxil olan ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) return `Yanlış dəyər: gözlənilən ${util.stringifyPrimitive(issue.values[0])}`; + return `Yanlış seçim: aşağıdakılardan biri olmalıdır: ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Çox böyük: gözlənilən ${issue.origin ?? "dəyər"} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "element"}`; + return `Çox böyük: gözlənilən ${issue.origin ?? "dəyər"} ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) return `Çox kiçik: gözlənilən ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit}`; + return `Çox kiçik: gözlənilən ${issue.origin} ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `Yanlış mətn: "${_issue.prefix}" ilə başlamalıdır`; + if (_issue.format === "ends_with") return `Yanlış mətn: "${_issue.suffix}" ilə bitməlidir`; + if (_issue.format === "includes") return `Yanlış mətn: "${_issue.includes}" daxil olmalıdır`; + if (_issue.format === "regex") return `Yanlış mətn: ${_issue.pattern} şablonuna uyğun olmalıdır`; + return `Yanlış ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Yanlış ədəd: ${issue.divisor} ilə bölünə bilən olmalıdır`; + case "unrecognized_keys": + return `Tanınmayan açar${issue.keys.length > 1 ? "lar" : ""}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `${issue.origin} daxilində yanlış açar`; + case "invalid_union": + return "Yanlış dəyər"; + case "invalid_element": + return `${issue.origin} daxilində yanlış dəyər`; + default: + return `Yanlış dəyər`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/be.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/be.ts new file mode 100644 index 0000000000000000000000000000000000000000..e8a7bad9cb09f79760f00fa6b4a99579a74d2326 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/be.ts @@ -0,0 +1,176 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +function getBelarusianPlural(count: number, one: string, few: string, many: string): string { + const absCount = Math.abs(count); + const lastDigit = absCount % 10; + const lastTwoDigits = absCount % 100; + + if (lastTwoDigits >= 11 && lastTwoDigits <= 19) { + return many; + } + + if (lastDigit === 1) { + return one; + } + + if (lastDigit >= 2 && lastDigit <= 4) { + return few; + } + + return many; +} + +interface BelarusianSizable { + unit: { + one: string; + few: string; + many: string; + }; + verb: string; +} +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { + unit: { + one: "сімвал", + few: "сімвалы", + many: "сімвалаў", + }, + verb: "мець", + }, + array: { + unit: { + one: "элемент", + few: "элементы", + many: "элементаў", + }, + verb: "мець", + }, + set: { + unit: { + one: "элемент", + few: "элементы", + many: "элементаў", + }, + verb: "мець", + }, + file: { + unit: { + one: "байт", + few: "байты", + many: "байтаў", + }, + verb: "мець", + }, + }; + + function getSizing(origin: string): BelarusianSizable | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "увод", + email: "email адрас", + url: "URL", + emoji: "эмодзі", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO дата і час", + date: "ISO дата", + time: "ISO час", + duration: "ISO працягласць", + ipv4: "IPv4 адрас", + ipv6: "IPv6 адрас", + cidrv4: "IPv4 дыяпазон", + cidrv6: "IPv6 дыяпазон", + base64: "радок у фармаце base64", + base64url: "радок у фармаце base64url", + json_string: "JSON радок", + e164: "нумар E.164", + jwt: "JWT", + template_literal: "увод", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "лік", + array: "масіў", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Няправільны ўвод: чакаўся instanceof ${issue.expected}, атрымана ${received}`; + } + return `Няправільны ўвод: чакаўся ${expected}, атрымана ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) return `Няправільны ўвод: чакалася ${util.stringifyPrimitive(issue.values[0])}`; + return `Няправільны варыянт: чакаўся адзін з ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) { + const maxValue = Number(issue.maximum); + const unit = getBelarusianPlural(maxValue, sizing.unit.one, sizing.unit.few, sizing.unit.many); + return `Занадта вялікі: чакалася, што ${issue.origin ?? "значэнне"} павінна ${sizing.verb} ${adj}${issue.maximum.toString()} ${unit}`; + } + return `Занадта вялікі: чакалася, што ${issue.origin ?? "значэнне"} павінна быць ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + const minValue = Number(issue.minimum); + const unit = getBelarusianPlural(minValue, sizing.unit.one, sizing.unit.few, sizing.unit.many); + return `Занадта малы: чакалася, што ${issue.origin} павінна ${sizing.verb} ${adj}${issue.minimum.toString()} ${unit}`; + } + return `Занадта малы: чакалася, што ${issue.origin} павінна быць ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `Няправільны радок: павінен пачынацца з "${_issue.prefix}"`; + if (_issue.format === "ends_with") return `Няправільны радок: павінен заканчвацца на "${_issue.suffix}"`; + if (_issue.format === "includes") return `Няправільны радок: павінен змяшчаць "${_issue.includes}"`; + if (_issue.format === "regex") return `Няправільны радок: павінен адпавядаць шаблону ${_issue.pattern}`; + return `Няправільны ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Няправільны лік: павінен быць кратным ${issue.divisor}`; + case "unrecognized_keys": + return `Нераспазнаны ${issue.keys.length > 1 ? "ключы" : "ключ"}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Няправільны ключ у ${issue.origin}`; + case "invalid_union": + return "Няправільны ўвод"; + case "invalid_element": + return `Няправільнае значэнне ў ${issue.origin}`; + default: + return `Няправільны ўвод`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/bg.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/bg.ts new file mode 100644 index 0000000000000000000000000000000000000000..f103d48fa8c0c75da09a9fbb3f84d07843842a41 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/bg.ts @@ -0,0 +1,128 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "символа", verb: "да съдържа" }, + file: { unit: "байта", verb: "да съдържа" }, + array: { unit: "елемента", verb: "да съдържа" }, + set: { unit: "елемента", verb: "да съдържа" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "вход", + email: "имейл адрес", + url: "URL", + emoji: "емоджи", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO време", + date: "ISO дата", + time: "ISO време", + duration: "ISO продължителност", + ipv4: "IPv4 адрес", + ipv6: "IPv6 адрес", + cidrv4: "IPv4 диапазон", + cidrv6: "IPv6 диапазон", + base64: "base64-кодиран низ", + base64url: "base64url-кодиран низ", + json_string: "JSON низ", + e164: "E.164 номер", + jwt: "JWT", + template_literal: "вход", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "число", + array: "масив", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Невалиден вход: очакван instanceof ${issue.expected}, получен ${received}`; + } + return `Невалиден вход: очакван ${expected}, получен ${received}`; + } + + case "invalid_value": + if (issue.values.length === 1) return `Невалиден вход: очакван ${util.stringifyPrimitive(issue.values[0])}`; + return `Невалидна опция: очаквано едно от ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Твърде голямо: очаква се ${issue.origin ?? "стойност"} да съдържа ${adj}${issue.maximum.toString()} ${sizing.unit ?? "елемента"}`; + return `Твърде голямо: очаква се ${issue.origin ?? "стойност"} да бъде ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Твърде малко: очаква се ${issue.origin} да съдържа ${adj}${issue.minimum.toString()} ${sizing.unit}`; + } + + return `Твърде малко: очаква се ${issue.origin} да бъде ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") { + return `Невалиден низ: трябва да започва с "${_issue.prefix}"`; + } + if (_issue.format === "ends_with") return `Невалиден низ: трябва да завършва с "${_issue.suffix}"`; + if (_issue.format === "includes") return `Невалиден низ: трябва да включва "${_issue.includes}"`; + if (_issue.format === "regex") return `Невалиден низ: трябва да съвпада с ${_issue.pattern}`; + + let invalid_adj = "Невалиден"; + + if (_issue.format === "emoji") invalid_adj = "Невалидно"; + if (_issue.format === "datetime") invalid_adj = "Невалидно"; + if (_issue.format === "date") invalid_adj = "Невалидна"; + if (_issue.format === "time") invalid_adj = "Невалидно"; + if (_issue.format === "duration") invalid_adj = "Невалидна"; + + return `${invalid_adj} ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Невалидно число: трябва да бъде кратно на ${issue.divisor}`; + case "unrecognized_keys": + return `Неразпознат${issue.keys.length > 1 ? "и" : ""} ключ${issue.keys.length > 1 ? "ове" : ""}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Невалиден ключ в ${issue.origin}`; + case "invalid_union": + return "Невалиден вход"; + case "invalid_element": + return `Невалидна стойност в ${issue.origin}`; + default: + return `Невалиден вход`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ca.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ca.ts new file mode 100644 index 0000000000000000000000000000000000000000..13d38b653157af1fae1db2917a901b937cf2b1e3 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ca.ts @@ -0,0 +1,116 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "caràcters", verb: "contenir" }, + file: { unit: "bytes", verb: "contenir" }, + array: { unit: "elements", verb: "contenir" }, + set: { unit: "elements", verb: "contenir" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "entrada", + email: "adreça electrònica", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "data i hora ISO", + date: "data ISO", + time: "hora ISO", + duration: "durada ISO", + ipv4: "adreça IPv4", + ipv6: "adreça IPv6", + cidrv4: "rang IPv4", + cidrv6: "rang IPv6", + base64: "cadena codificada en base64", + base64url: "cadena codificada en base64url", + json_string: "cadena JSON", + e164: "número E.164", + jwt: "JWT", + template_literal: "entrada", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Tipus invàlid: s'esperava instanceof ${issue.expected}, s'ha rebut ${received}`; + } + return `Tipus invàlid: s'esperava ${expected}, s'ha rebut ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) return `Valor invàlid: s'esperava ${util.stringifyPrimitive(issue.values[0])}`; + return `Opció invàlida: s'esperava una de ${util.joinValues(issue.values, " o ")}`; + case "too_big": { + const adj = issue.inclusive ? "com a màxim" : "menys de"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Massa gran: s'esperava que ${issue.origin ?? "el valor"} contingués ${adj} ${issue.maximum.toString()} ${sizing.unit ?? "elements"}`; + return `Massa gran: s'esperava que ${issue.origin ?? "el valor"} fos ${adj} ${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? "com a mínim" : "més de"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Massa petit: s'esperava que ${issue.origin} contingués ${adj} ${issue.minimum.toString()} ${sizing.unit}`; + } + + return `Massa petit: s'esperava que ${issue.origin} fos ${adj} ${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") { + return `Format invàlid: ha de començar amb "${_issue.prefix}"`; + } + if (_issue.format === "ends_with") return `Format invàlid: ha d'acabar amb "${_issue.suffix}"`; + if (_issue.format === "includes") return `Format invàlid: ha d'incloure "${_issue.includes}"`; + if (_issue.format === "regex") return `Format invàlid: ha de coincidir amb el patró ${_issue.pattern}`; + return `Format invàlid per a ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Número invàlid: ha de ser múltiple de ${issue.divisor}`; + case "unrecognized_keys": + return `Clau${issue.keys.length > 1 ? "s" : ""} no reconeguda${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Clau invàlida a ${issue.origin}`; + case "invalid_union": + return "Entrada invàlida"; // Could also be "Tipus d'unió invàlid" but "Entrada invàlida" is more general + case "invalid_element": + return `Element invàlid a ${issue.origin}`; + default: + return `Entrada invàlida`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/cs.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/cs.ts new file mode 100644 index 0000000000000000000000000000000000000000..75d59714140d79bafe10165fe508a1b7db6c11f0 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/cs.ts @@ -0,0 +1,118 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "znaků", verb: "mít" }, + file: { unit: "bajtů", verb: "mít" }, + array: { unit: "prvků", verb: "mít" }, + set: { unit: "prvků", verb: "mít" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "regulární výraz", + email: "e-mailová adresa", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "datum a čas ve formátu ISO", + date: "datum ve formátu ISO", + time: "čas ve formátu ISO", + duration: "doba trvání ISO", + ipv4: "IPv4 adresa", + ipv6: "IPv6 adresa", + cidrv4: "rozsah IPv4", + cidrv6: "rozsah IPv6", + base64: "řetězec zakódovaný ve formátu base64", + base64url: "řetězec zakódovaný ve formátu base64url", + json_string: "řetězec ve formátu JSON", + e164: "číslo E.164", + jwt: "JWT", + template_literal: "vstup", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "číslo", + string: "řetězec", + function: "funkce", + array: "pole", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Neplatný vstup: očekáváno instanceof ${issue.expected}, obdrženo ${received}`; + } + return `Neplatný vstup: očekáváno ${expected}, obdrženo ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) return `Neplatný vstup: očekáváno ${util.stringifyPrimitive(issue.values[0])}`; + return `Neplatná možnost: očekávána jedna z hodnot ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Hodnota je příliš velká: ${issue.origin ?? "hodnota"} musí mít ${adj}${issue.maximum.toString()} ${sizing.unit ?? "prvků"}`; + } + return `Hodnota je příliš velká: ${issue.origin ?? "hodnota"} musí být ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Hodnota je příliš malá: ${issue.origin ?? "hodnota"} musí mít ${adj}${issue.minimum.toString()} ${sizing.unit ?? "prvků"}`; + } + return `Hodnota je příliš malá: ${issue.origin ?? "hodnota"} musí být ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `Neplatný řetězec: musí začínat na "${_issue.prefix}"`; + if (_issue.format === "ends_with") return `Neplatný řetězec: musí končit na "${_issue.suffix}"`; + if (_issue.format === "includes") return `Neplatný řetězec: musí obsahovat "${_issue.includes}"`; + if (_issue.format === "regex") return `Neplatný řetězec: musí odpovídat vzoru ${_issue.pattern}`; + return `Neplatný formát ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Neplatné číslo: musí být násobkem ${issue.divisor}`; + case "unrecognized_keys": + return `Neznámé klíče: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Neplatný klíč v ${issue.origin}`; + case "invalid_union": + return "Neplatný vstup"; + case "invalid_element": + return `Neplatná hodnota v ${issue.origin}`; + default: + return `Neplatný vstup`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/da.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/da.ts new file mode 100644 index 0000000000000000000000000000000000000000..e28062a43d1c8b9a0a4b1f7918f3b2050e38d30f --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/da.ts @@ -0,0 +1,123 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "tegn", verb: "havde" }, + file: { unit: "bytes", verb: "havde" }, + array: { unit: "elementer", verb: "indeholdt" }, + set: { unit: "elementer", verb: "indeholdt" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "input", + email: "e-mailadresse", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO dato- og klokkeslæt", + date: "ISO-dato", + time: "ISO-klokkeslæt", + duration: "ISO-varighed", + ipv4: "IPv4-område", + ipv6: "IPv6-område", + cidrv4: "IPv4-spektrum", + cidrv6: "IPv6-spektrum", + base64: "base64-kodet streng", + base64url: "base64url-kodet streng", + json_string: "JSON-streng", + e164: "E.164-nummer", + jwt: "JWT", + template_literal: "input", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + string: "streng", + number: "tal", + boolean: "boolean", + array: "liste", + object: "objekt", + set: "sæt", + file: "fil", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Ugyldigt input: forventede instanceof ${issue.expected}, fik ${received}`; + } + return `Ugyldigt input: forventede ${expected}, fik ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) return `Ugyldig værdi: forventede ${util.stringifyPrimitive(issue.values[0])}`; + return `Ugyldigt valg: forventede en af følgende ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + const origin = TypeDictionary[issue.origin] ?? issue.origin; + if (sizing) + return `For stor: forventede ${origin ?? "value"} ${sizing.verb} ${adj} ${issue.maximum.toString()} ${sizing.unit ?? "elementer"}`; + return `For stor: forventede ${origin ?? "value"} havde ${adj} ${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + const origin = TypeDictionary[issue.origin] ?? issue.origin; + if (sizing) { + return `For lille: forventede ${origin} ${sizing.verb} ${adj} ${issue.minimum.toString()} ${sizing.unit}`; + } + + return `For lille: forventede ${origin} havde ${adj} ${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `Ugyldig streng: skal starte med "${_issue.prefix}"`; + if (_issue.format === "ends_with") return `Ugyldig streng: skal ende med "${_issue.suffix}"`; + if (_issue.format === "includes") return `Ugyldig streng: skal indeholde "${_issue.includes}"`; + if (_issue.format === "regex") return `Ugyldig streng: skal matche mønsteret ${_issue.pattern}`; + return `Ugyldig ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Ugyldigt tal: skal være deleligt med ${issue.divisor}`; + case "unrecognized_keys": + return `${issue.keys.length > 1 ? "Ukendte nøgler" : "Ukendt nøgle"}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Ugyldig nøgle i ${issue.origin}`; + case "invalid_union": + return "Ugyldigt input: matcher ingen af de tilladte typer"; + case "invalid_element": + return `Ugyldig værdi i ${issue.origin}`; + default: + return `Ugyldigt input`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/de.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/de.ts new file mode 100644 index 0000000000000000000000000000000000000000..dbcae388a3f703e678444da657f8830873dd9a60 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/de.ts @@ -0,0 +1,116 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "Zeichen", verb: "zu haben" }, + file: { unit: "Bytes", verb: "zu haben" }, + array: { unit: "Elemente", verb: "zu haben" }, + set: { unit: "Elemente", verb: "zu haben" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "Eingabe", + email: "E-Mail-Adresse", + url: "URL", + emoji: "Emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO-Datum und -Uhrzeit", + date: "ISO-Datum", + time: "ISO-Uhrzeit", + duration: "ISO-Dauer", + ipv4: "IPv4-Adresse", + ipv6: "IPv6-Adresse", + cidrv4: "IPv4-Bereich", + cidrv6: "IPv6-Bereich", + base64: "Base64-codierter String", + base64url: "Base64-URL-codierter String", + json_string: "JSON-String", + e164: "E.164-Nummer", + jwt: "JWT", + template_literal: "Eingabe", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "Zahl", + array: "Array", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Ungültige Eingabe: erwartet instanceof ${issue.expected}, erhalten ${received}`; + } + return `Ungültige Eingabe: erwartet ${expected}, erhalten ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) return `Ungültige Eingabe: erwartet ${util.stringifyPrimitive(issue.values[0])}`; + return `Ungültige Option: erwartet eine von ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Zu groß: erwartet, dass ${issue.origin ?? "Wert"} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "Elemente"} hat`; + return `Zu groß: erwartet, dass ${issue.origin ?? "Wert"} ${adj}${issue.maximum.toString()} ist`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Zu klein: erwartet, dass ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit} hat`; + } + + return `Zu klein: erwartet, dass ${issue.origin} ${adj}${issue.minimum.toString()} ist`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `Ungültiger String: muss mit "${_issue.prefix}" beginnen`; + if (_issue.format === "ends_with") return `Ungültiger String: muss mit "${_issue.suffix}" enden`; + if (_issue.format === "includes") return `Ungültiger String: muss "${_issue.includes}" enthalten`; + if (_issue.format === "regex") return `Ungültiger String: muss dem Muster ${_issue.pattern} entsprechen`; + return `Ungültig: ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Ungültige Zahl: muss ein Vielfaches von ${issue.divisor} sein`; + case "unrecognized_keys": + return `${issue.keys.length > 1 ? "Unbekannte Schlüssel" : "Unbekannter Schlüssel"}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Ungültiger Schlüssel in ${issue.origin}`; + case "invalid_union": + return "Ungültige Eingabe"; + case "invalid_element": + return `Ungültiger Wert in ${issue.origin}`; + default: + return `Ungültige Eingabe`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/el.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/el.ts new file mode 100644 index 0000000000000000000000000000000000000000..d2a394d08fba666447fbcccbc408d4288c55d9eb --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/el.ts @@ -0,0 +1,121 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "χαρακτήρες", verb: "να έχει" }, + file: { unit: "bytes", verb: "να έχει" }, + array: { unit: "στοιχεία", verb: "να έχει" }, + set: { unit: "στοιχεία", verb: "να έχει" }, + map: { unit: "καταχωρήσεις", verb: "να έχει" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "είσοδος", + email: "διεύθυνση email", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO ημερομηνία και ώρα", + date: "ISO ημερομηνία", + time: "ISO ώρα", + duration: "ISO διάρκεια", + ipv4: "διεύθυνση IPv4", + ipv6: "διεύθυνση IPv6", + mac: "διεύθυνση MAC", + cidrv4: "εύρος IPv4", + cidrv6: "εύρος IPv6", + base64: "συμβολοσειρά κωδικοποιημένη σε base64", + base64url: "συμβολοσειρά κωδικοποιημένη σε base64url", + json_string: "συμβολοσειρά JSON", + e164: "αριθμός E.164", + jwt: "JWT", + template_literal: "είσοδος", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (typeof issue.expected === "string" && /^[A-Z]/.test(issue.expected)) { + return `Μη έγκυρη είσοδος: αναμενόταν instanceof ${issue.expected}, λήφθηκε ${received}`; + } + return `Μη έγκυρη είσοδος: αναμενόταν ${expected}, λήφθηκε ${received}`; + } + + case "invalid_value": + if (issue.values.length === 1) + return `Μη έγκυρη είσοδος: αναμενόταν ${util.stringifyPrimitive(issue.values[0])}`; + return `Μη έγκυρη επιλογή: αναμενόταν ένα από ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Πολύ μεγάλο: αναμενόταν ${issue.origin ?? "τιμή"} να έχει ${adj}${issue.maximum.toString()} ${sizing.unit ?? "στοιχεία"}`; + return `Πολύ μεγάλο: αναμενόταν ${issue.origin ?? "τιμή"} να είναι ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Πολύ μικρό: αναμενόταν ${issue.origin} να έχει ${adj}${issue.minimum.toString()} ${sizing.unit}`; + } + + return `Πολύ μικρό: αναμενόταν ${issue.origin} να είναι ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") { + return `Μη έγκυρη συμβολοσειρά: πρέπει να ξεκινά με "${_issue.prefix}"`; + } + if (_issue.format === "ends_with") return `Μη έγκυρη συμβολοσειρά: πρέπει να τελειώνει με "${_issue.suffix}"`; + if (_issue.format === "includes") return `Μη έγκυρη συμβολοσειρά: πρέπει να περιέχει "${_issue.includes}"`; + if (_issue.format === "regex") + return `Μη έγκυρη συμβολοσειρά: πρέπει να ταιριάζει με το μοτίβο ${_issue.pattern}`; + return `Μη έγκυρο: ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Μη έγκυρος αριθμός: πρέπει να είναι πολλαπλάσιο του ${issue.divisor}`; + case "unrecognized_keys": + return `Άγνωστ${issue.keys.length > 1 ? "α" : "ο"} κλειδ${issue.keys.length > 1 ? "ιά" : "ί"}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Μη έγκυρο κλειδί στο ${issue.origin}`; + case "invalid_union": + return "Μη έγκυρη είσοδος"; + case "invalid_element": + return `Μη έγκυρη τιμή στο ${issue.origin}`; + default: + return `Μη έγκυρη είσοδος`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/en.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/en.ts new file mode 100644 index 0000000000000000000000000000000000000000..08bf45fc5dd8f1cbf07464c800b03cc3e1acc6b1 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/en.ts @@ -0,0 +1,123 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "characters", verb: "to have" }, + file: { unit: "bytes", verb: "to have" }, + array: { unit: "items", verb: "to have" }, + set: { unit: "items", verb: "to have" }, + map: { unit: "entries", verb: "to have" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "input", + email: "email address", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO datetime", + date: "ISO date", + time: "ISO time", + duration: "ISO duration", + ipv4: "IPv4 address", + ipv6: "IPv6 address", + mac: "MAC address", + cidrv4: "IPv4 range", + cidrv6: "IPv6 range", + base64: "base64-encoded string", + base64url: "base64url-encoded string", + json_string: "JSON string", + e164: "E.164 number", + jwt: "JWT", + template_literal: "input", + }; + + // type names: missing keys = do not translate (use raw value via ?? fallback) + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + // Compatibility: "nan" -> "NaN" for display + nan: "NaN", + // All other type names omitted - they fall back to raw values via ?? operator + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + return `Invalid input: expected ${expected}, received ${received}`; + } + + case "invalid_value": + if (issue.values.length === 1) return `Invalid input: expected ${util.stringifyPrimitive(issue.values[0])}`; + return `Invalid option: expected one of ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`; + return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`; + } + + return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") { + return `Invalid string: must start with "${_issue.prefix}"`; + } + if (_issue.format === "ends_with") return `Invalid string: must end with "${_issue.suffix}"`; + if (_issue.format === "includes") return `Invalid string: must include "${_issue.includes}"`; + if (_issue.format === "regex") return `Invalid string: must match pattern ${_issue.pattern}`; + return `Invalid ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Invalid number: must be a multiple of ${issue.divisor}`; + case "unrecognized_keys": + return `Unrecognized key${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Invalid key in ${issue.origin}`; + case "invalid_union": + if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) { + const opts = issue.options.map((o) => `'${o}'`).join(" | "); + return `Invalid discriminator value. Expected ${opts}`; + } + return "Invalid input"; + case "invalid_element": + return `Invalid value in ${issue.origin}`; + default: + return `Invalid input`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/eo.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/eo.ts new file mode 100644 index 0000000000000000000000000000000000000000..f848cc65a09a9e6a101a8b19e8dfc5f8ae330367 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/eo.ts @@ -0,0 +1,118 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "karaktrojn", verb: "havi" }, + file: { unit: "bajtojn", verb: "havi" }, + array: { unit: "elementojn", verb: "havi" }, + set: { unit: "elementojn", verb: "havi" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "enigo", + email: "retadreso", + url: "URL", + emoji: "emoĝio", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO-datotempo", + date: "ISO-dato", + time: "ISO-tempo", + duration: "ISO-daŭro", + ipv4: "IPv4-adreso", + ipv6: "IPv6-adreso", + cidrv4: "IPv4-rango", + cidrv6: "IPv6-rango", + base64: "64-ume kodita karaktraro", + base64url: "URL-64-ume kodita karaktraro", + json_string: "JSON-karaktraro", + e164: "E.164-nombro", + jwt: "JWT", + template_literal: "enigo", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "nombro", + array: "tabelo", + null: "senvalora", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Nevalida enigo: atendiĝis instanceof ${issue.expected}, riceviĝis ${received}`; + } + return `Nevalida enigo: atendiĝis ${expected}, riceviĝis ${received}`; + } + + case "invalid_value": + if (issue.values.length === 1) return `Nevalida enigo: atendiĝis ${util.stringifyPrimitive(issue.values[0])}`; + return `Nevalida opcio: atendiĝis unu el ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Tro granda: atendiĝis ke ${issue.origin ?? "valoro"} havu ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementojn"}`; + return `Tro granda: atendiĝis ke ${issue.origin ?? "valoro"} havu ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Tro malgranda: atendiĝis ke ${issue.origin} havu ${adj}${issue.minimum.toString()} ${sizing.unit}`; + } + + return `Tro malgranda: atendiĝis ke ${issue.origin} estu ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `Nevalida karaktraro: devas komenciĝi per "${_issue.prefix}"`; + if (_issue.format === "ends_with") return `Nevalida karaktraro: devas finiĝi per "${_issue.suffix}"`; + if (_issue.format === "includes") return `Nevalida karaktraro: devas inkluzivi "${_issue.includes}"`; + if (_issue.format === "regex") return `Nevalida karaktraro: devas kongrui kun la modelo ${_issue.pattern}`; + return `Nevalida ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Nevalida nombro: devas esti oblo de ${issue.divisor}`; + case "unrecognized_keys": + return `Nekonata${issue.keys.length > 1 ? "j" : ""} ŝlosilo${issue.keys.length > 1 ? "j" : ""}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Nevalida ŝlosilo en ${issue.origin}`; + case "invalid_union": + return "Nevalida enigo"; + case "invalid_element": + return `Nevalida valoro en ${issue.origin}`; + default: + return `Nevalida enigo`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/es.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/es.ts new file mode 100644 index 0000000000000000000000000000000000000000..7b890a6952973f0617338b4c9d8e5a917655a6ed --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/es.ts @@ -0,0 +1,141 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "caracteres", verb: "tener" }, + file: { unit: "bytes", verb: "tener" }, + array: { unit: "elementos", verb: "tener" }, + set: { unit: "elementos", verb: "tener" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "entrada", + email: "dirección de correo electrónico", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "fecha y hora ISO", + date: "fecha ISO", + time: "hora ISO", + duration: "duración ISO", + ipv4: "dirección IPv4", + ipv6: "dirección IPv6", + cidrv4: "rango IPv4", + cidrv6: "rango IPv6", + base64: "cadena codificada en base64", + base64url: "URL codificada en base64", + json_string: "cadena JSON", + e164: "número E.164", + jwt: "JWT", + template_literal: "entrada", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + string: "texto", + number: "número", + boolean: "booleano", + array: "arreglo", + object: "objeto", + set: "conjunto", + file: "archivo", + date: "fecha", + bigint: "número grande", + symbol: "símbolo", + undefined: "indefinido", + null: "nulo", + function: "función", + map: "mapa", + record: "registro", + tuple: "tupla", + enum: "enumeración", + union: "unión", + literal: "literal", + promise: "promesa", + void: "vacío", + never: "nunca", + unknown: "desconocido", + any: "cualquiera", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Entrada inválida: se esperaba instanceof ${issue.expected}, recibido ${received}`; + } + return `Entrada inválida: se esperaba ${expected}, recibido ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) + return `Entrada inválida: se esperaba ${util.stringifyPrimitive(issue.values[0])}`; + return `Opción inválida: se esperaba una de ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + const origin = TypeDictionary[issue.origin] ?? issue.origin; + if (sizing) + return `Demasiado grande: se esperaba que ${origin ?? "valor"} tuviera ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementos"}`; + return `Demasiado grande: se esperaba que ${origin ?? "valor"} fuera ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + const origin = TypeDictionary[issue.origin] ?? issue.origin; + if (sizing) { + return `Demasiado pequeño: se esperaba que ${origin} tuviera ${adj}${issue.minimum.toString()} ${sizing.unit}`; + } + + return `Demasiado pequeño: se esperaba que ${origin} fuera ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `Cadena inválida: debe comenzar con "${_issue.prefix}"`; + if (_issue.format === "ends_with") return `Cadena inválida: debe terminar en "${_issue.suffix}"`; + if (_issue.format === "includes") return `Cadena inválida: debe incluir "${_issue.includes}"`; + if (_issue.format === "regex") return `Cadena inválida: debe coincidir con el patrón ${_issue.pattern}`; + return `Inválido ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Número inválido: debe ser múltiplo de ${issue.divisor}`; + case "unrecognized_keys": + return `Llave${issue.keys.length > 1 ? "s" : ""} desconocida${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Llave inválida en ${TypeDictionary[issue.origin] ?? issue.origin}`; + case "invalid_union": + return "Entrada inválida"; + case "invalid_element": + return `Valor inválido en ${TypeDictionary[issue.origin] ?? issue.origin}`; + default: + return `Entrada inválida`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/fa.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/fa.ts new file mode 100644 index 0000000000000000000000000000000000000000..524894a4e0467f95b370aba86bfbd229c262b133 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/fa.ts @@ -0,0 +1,126 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "کاراکتر", verb: "داشته باشد" }, + file: { unit: "بایت", verb: "داشته باشد" }, + array: { unit: "آیتم", verb: "داشته باشد" }, + set: { unit: "آیتم", verb: "داشته باشد" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "ورودی", + email: "آدرس ایمیل", + url: "URL", + emoji: "ایموجی", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "تاریخ و زمان ایزو", + date: "تاریخ ایزو", + time: "زمان ایزو", + duration: "مدت زمان ایزو", + ipv4: "IPv4 آدرس", + ipv6: "IPv6 آدرس", + cidrv4: "IPv4 دامنه", + cidrv6: "IPv6 دامنه", + base64: "base64-encoded رشته", + base64url: "base64url-encoded رشته", + json_string: "JSON رشته", + e164: "E.164 عدد", + jwt: "JWT", + template_literal: "ورودی", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "عدد", + array: "آرایه", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `ورودی نامعتبر: می‌بایست instanceof ${issue.expected} می‌بود، ${received} دریافت شد`; + } + return `ورودی نامعتبر: می‌بایست ${expected} می‌بود، ${received} دریافت شد`; + } + case "invalid_value": + if (issue.values.length === 1) { + return `ورودی نامعتبر: می‌بایست ${util.stringifyPrimitive(issue.values[0])} می‌بود`; + } + return `گزینه نامعتبر: می‌بایست یکی از ${util.joinValues(issue.values, "|")} می‌بود`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `خیلی بزرگ: ${issue.origin ?? "مقدار"} باید ${adj}${issue.maximum.toString()} ${sizing.unit ?? "عنصر"} باشد`; + } + return `خیلی بزرگ: ${issue.origin ?? "مقدار"} باید ${adj}${issue.maximum.toString()} باشد`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `خیلی کوچک: ${issue.origin} باید ${adj}${issue.minimum.toString()} ${sizing.unit} باشد`; + } + return `خیلی کوچک: ${issue.origin} باید ${adj}${issue.minimum.toString()} باشد`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") { + return `رشته نامعتبر: باید با "${_issue.prefix}" شروع شود`; + } + if (_issue.format === "ends_with") { + return `رشته نامعتبر: باید با "${_issue.suffix}" تمام شود`; + } + if (_issue.format === "includes") { + return `رشته نامعتبر: باید شامل "${_issue.includes}" باشد`; + } + if (_issue.format === "regex") { + return `رشته نامعتبر: باید با الگوی ${_issue.pattern} مطابقت داشته باشد`; + } + return `${FormatDictionary[_issue.format] ?? issue.format} نامعتبر`; + } + case "not_multiple_of": + return `عدد نامعتبر: باید مضرب ${issue.divisor} باشد`; + case "unrecognized_keys": + return `کلید${issue.keys.length > 1 ? "های" : ""} ناشناس: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `کلید ناشناس در ${issue.origin}`; + case "invalid_union": + return `ورودی نامعتبر`; + case "invalid_element": + return `مقدار نامعتبر در ${issue.origin}`; + default: + return `ورودی نامعتبر`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/fi.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/fi.ts new file mode 100644 index 0000000000000000000000000000000000000000..c6e8a982b78f0b692488da1850cada6d3b1a75b1 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/fi.ts @@ -0,0 +1,121 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "merkkiä", subject: "merkkijonon" }, + file: { unit: "tavua", subject: "tiedoston" }, + array: { unit: "alkiota", subject: "listan" }, + set: { unit: "alkiota", subject: "joukon" }, + number: { unit: "", subject: "luvun" }, + bigint: { unit: "", subject: "suuren kokonaisluvun" }, + int: { unit: "", subject: "kokonaisluvun" }, + date: { unit: "", subject: "päivämäärän" }, + }; + + function getSizing(origin: string): { unit: string; subject: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "säännöllinen lauseke", + email: "sähköpostiosoite", + url: "URL-osoite", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO-aikaleima", + date: "ISO-päivämäärä", + time: "ISO-aika", + duration: "ISO-kesto", + ipv4: "IPv4-osoite", + ipv6: "IPv6-osoite", + cidrv4: "IPv4-alue", + cidrv6: "IPv6-alue", + base64: "base64-koodattu merkkijono", + base64url: "base64url-koodattu merkkijono", + json_string: "JSON-merkkijono", + e164: "E.164-luku", + jwt: "JWT", + template_literal: "templaattimerkkijono", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Virheellinen tyyppi: odotettiin instanceof ${issue.expected}, oli ${received}`; + } + return `Virheellinen tyyppi: odotettiin ${expected}, oli ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) + return `Virheellinen syöte: täytyy olla ${util.stringifyPrimitive(issue.values[0])}`; + return `Virheellinen valinta: täytyy olla yksi seuraavista: ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Liian suuri: ${sizing.subject} täytyy olla ${adj}${issue.maximum.toString()} ${sizing.unit}`.trim(); + } + return `Liian suuri: arvon täytyy olla ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Liian pieni: ${sizing.subject} täytyy olla ${adj}${issue.minimum.toString()} ${sizing.unit}`.trim(); + } + return `Liian pieni: arvon täytyy olla ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `Virheellinen syöte: täytyy alkaa "${_issue.prefix}"`; + if (_issue.format === "ends_with") return `Virheellinen syöte: täytyy loppua "${_issue.suffix}"`; + if (_issue.format === "includes") return `Virheellinen syöte: täytyy sisältää "${_issue.includes}"`; + if (_issue.format === "regex") { + return `Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${_issue.pattern}`; + } + return `Virheellinen ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Virheellinen luku: täytyy olla luvun ${issue.divisor} monikerta`; + case "unrecognized_keys": + return `${issue.keys.length > 1 ? "Tuntemattomat avaimet" : "Tuntematon avain"}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return "Virheellinen avain tietueessa"; + case "invalid_union": + return "Virheellinen unioni"; + case "invalid_element": + return "Virheellinen arvo joukossa"; + default: + return `Virheellinen syöte`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/fr-CA.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/fr-CA.ts new file mode 100644 index 0000000000000000000000000000000000000000..91406077e964533e757c6734e7b7524be3721f8c --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/fr-CA.ts @@ -0,0 +1,116 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "caractères", verb: "avoir" }, + file: { unit: "octets", verb: "avoir" }, + array: { unit: "éléments", verb: "avoir" }, + set: { unit: "éléments", verb: "avoir" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "entrée", + email: "adresse courriel", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "date-heure ISO", + date: "date ISO", + time: "heure ISO", + duration: "durée ISO", + ipv4: "adresse IPv4", + ipv6: "adresse IPv6", + cidrv4: "plage IPv4", + cidrv6: "plage IPv6", + base64: "chaîne encodée en base64", + base64url: "chaîne encodée en base64url", + json_string: "chaîne JSON", + e164: "numéro E.164", + jwt: "JWT", + template_literal: "entrée", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Entrée invalide : attendu instanceof ${issue.expected}, reçu ${received}`; + } + return `Entrée invalide : attendu ${expected}, reçu ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) return `Entrée invalide : attendu ${util.stringifyPrimitive(issue.values[0])}`; + return `Option invalide : attendu l'une des valeurs suivantes ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "≤" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Trop grand : attendu que ${issue.origin ?? "la valeur"} ait ${adj}${issue.maximum.toString()} ${sizing.unit}`; + return `Trop grand : attendu que ${issue.origin ?? "la valeur"} soit ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? "≥" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Trop petit : attendu que ${issue.origin} ait ${adj}${issue.minimum.toString()} ${sizing.unit}`; + } + + return `Trop petit : attendu que ${issue.origin} soit ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") { + return `Chaîne invalide : doit commencer par "${_issue.prefix}"`; + } + if (_issue.format === "ends_with") return `Chaîne invalide : doit se terminer par "${_issue.suffix}"`; + if (_issue.format === "includes") return `Chaîne invalide : doit inclure "${_issue.includes}"`; + if (_issue.format === "regex") return `Chaîne invalide : doit correspondre au motif ${_issue.pattern}`; + return `${FormatDictionary[_issue.format] ?? issue.format} invalide`; + } + case "not_multiple_of": + return `Nombre invalide : doit être un multiple de ${issue.divisor}`; + case "unrecognized_keys": + return `Clé${issue.keys.length > 1 ? "s" : ""} non reconnue${issue.keys.length > 1 ? "s" : ""} : ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Clé invalide dans ${issue.origin}`; + case "invalid_union": + return "Entrée invalide"; + case "invalid_element": + return `Valeur invalide dans ${issue.origin}`; + default: + return `Entrée invalide`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/fr.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/fr.ts new file mode 100644 index 0000000000000000000000000000000000000000..8578fc4eb5b02e9cd6e9e9d6baad35d6ebe190b5 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/fr.ts @@ -0,0 +1,132 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "caractères", verb: "avoir" }, + file: { unit: "octets", verb: "avoir" }, + array: { unit: "éléments", verb: "avoir" }, + set: { unit: "éléments", verb: "avoir" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "entrée", + email: "adresse e-mail", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "date et heure ISO", + date: "date ISO", + time: "heure ISO", + duration: "durée ISO", + ipv4: "adresse IPv4", + ipv6: "adresse IPv6", + cidrv4: "plage IPv4", + cidrv6: "plage IPv6", + base64: "chaîne encodée en base64", + base64url: "chaîne encodée en base64url", + json_string: "chaîne JSON", + e164: "numéro E.164", + jwt: "JWT", + template_literal: "entrée", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + string: "chaîne", + number: "nombre", + int: "entier", + boolean: "booléen", + bigint: "grand entier", + symbol: "symbole", + undefined: "indéfini", + null: "null", + never: "jamais", + void: "vide", + date: "date", + array: "tableau", + object: "objet", + tuple: "tuple", + record: "enregistrement", + map: "carte", + set: "ensemble", + file: "fichier", + nonoptional: "non-optionnel", + nan: "NaN", + function: "fonction", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Entrée invalide : instanceof ${issue.expected} attendu, ${received} reçu`; + } + return `Entrée invalide : ${expected} attendu, ${received} reçu`; + } + case "invalid_value": + if (issue.values.length === 1) return `Entrée invalide : ${util.stringifyPrimitive(issue.values[0])} attendu`; + return `Option invalide : une valeur parmi ${util.joinValues(issue.values, "|")} attendue`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Trop grand : ${TypeDictionary[issue.origin] ?? "valeur"} doit ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "élément(s)"}`; + return `Trop grand : ${TypeDictionary[issue.origin] ?? "valeur"} doit être ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Trop petit : ${TypeDictionary[issue.origin] ?? "valeur"} doit ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`; + return `Trop petit : ${TypeDictionary[issue.origin] ?? "valeur"} doit être ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `Chaîne invalide : doit commencer par "${_issue.prefix}"`; + if (_issue.format === "ends_with") return `Chaîne invalide : doit se terminer par "${_issue.suffix}"`; + if (_issue.format === "includes") return `Chaîne invalide : doit inclure "${_issue.includes}"`; + if (_issue.format === "regex") return `Chaîne invalide : doit correspondre au modèle ${_issue.pattern}`; + return `${FormatDictionary[_issue.format] ?? issue.format} invalide`; + } + case "not_multiple_of": + return `Nombre invalide : doit être un multiple de ${issue.divisor}`; + case "unrecognized_keys": + return `Clé${issue.keys.length > 1 ? "s" : ""} non reconnue${issue.keys.length > 1 ? "s" : ""} : ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Clé invalide dans ${issue.origin}`; + case "invalid_union": + return "Entrée invalide"; + case "invalid_element": + return `Valeur invalide dans ${issue.origin}`; + default: + return `Entrée invalide`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/he.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/he.ts new file mode 100644 index 0000000000000000000000000000000000000000..fd85db333c41991390bb91be6439b43587ab20af --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/he.ts @@ -0,0 +1,246 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + // Hebrew labels + grammatical gender + const TypeNames: Record = { + string: { label: "מחרוזת", gender: "f" }, + number: { label: "מספר", gender: "m" }, + boolean: { label: "ערך בוליאני", gender: "m" }, + bigint: { label: "BigInt", gender: "m" }, + date: { label: "תאריך", gender: "m" }, + array: { label: "מערך", gender: "m" }, + object: { label: "אובייקט", gender: "m" }, + null: { label: "ערך ריק (null)", gender: "m" }, + undefined: { label: "ערך לא מוגדר (undefined)", gender: "m" }, + symbol: { label: "סימבול (Symbol)", gender: "m" }, + function: { label: "פונקציה", gender: "f" }, + map: { label: "מפה (Map)", gender: "f" }, + set: { label: "קבוצה (Set)", gender: "f" }, + file: { label: "קובץ", gender: "m" }, + promise: { label: "Promise", gender: "m" }, + NaN: { label: "NaN", gender: "m" }, + unknown: { label: "ערך לא ידוע", gender: "m" }, + value: { label: "ערך", gender: "m" }, + }; + + // Sizing units for size-related messages + localized origin labels + const Sizable: Record = { + string: { unit: "תווים", shortLabel: "קצר", longLabel: "ארוך" }, + file: { unit: "בייטים", shortLabel: "קטן", longLabel: "גדול" }, + array: { unit: "פריטים", shortLabel: "קטן", longLabel: "גדול" }, + set: { unit: "פריטים", shortLabel: "קטן", longLabel: "גדול" }, + number: { unit: "", shortLabel: "קטן", longLabel: "גדול" }, // no unit + }; + + // Helpers — labels, articles, and verbs + const typeEntry = (t?: string | null) => (t ? TypeNames[t] : undefined); + + const typeLabel = (t?: string | null): string => { + const e = typeEntry(t); + if (e) return e.label; + // fallback: show raw string if unknown + return t ?? TypeNames.unknown.label; + }; + + const withDefinite = (t?: string | null): string => `ה${typeLabel(t)}`; + + const verbFor = (t?: string | null): string => { + const e = typeEntry(t); + const gender = e?.gender ?? "m"; + return gender === "f" ? "צריכה להיות" : "צריך להיות"; + }; + + const getSizing = (origin?: string | null) => { + if (!origin) return null; + return Sizable[origin] ?? null; + }; + + const FormatDictionary: { + [k in $ZodStringFormats]: { label: string; gender: "m" | "f" }; + } = { + regex: { label: "קלט", gender: "m" }, + email: { label: "כתובת אימייל", gender: "f" }, + url: { label: "כתובת רשת", gender: "f" }, + emoji: { label: "אימוג'י", gender: "m" }, + uuid: { label: "UUID", gender: "m" }, + nanoid: { label: "nanoid", gender: "m" }, + guid: { label: "GUID", gender: "m" }, + cuid: { label: "cuid", gender: "m" }, + cuid2: { label: "cuid2", gender: "m" }, + ulid: { label: "ULID", gender: "m" }, + xid: { label: "XID", gender: "m" }, + ksuid: { label: "KSUID", gender: "m" }, + datetime: { label: "תאריך וזמן ISO", gender: "m" }, + date: { label: "תאריך ISO", gender: "m" }, + time: { label: "זמן ISO", gender: "m" }, + duration: { label: "משך זמן ISO", gender: "m" }, + ipv4: { label: "כתובת IPv4", gender: "f" }, + ipv6: { label: "כתובת IPv6", gender: "f" }, + cidrv4: { label: "טווח IPv4", gender: "m" }, + cidrv6: { label: "טווח IPv6", gender: "m" }, + base64: { label: "מחרוזת בבסיס 64", gender: "f" }, + base64url: { label: "מחרוזת בבסיס 64 לכתובות רשת", gender: "f" }, + json_string: { label: "מחרוזת JSON", gender: "f" }, + e164: { label: "מספר E.164", gender: "m" }, + jwt: { label: "JWT", gender: "m" }, + ends_with: { label: "קלט", gender: "m" }, + includes: { label: "קלט", gender: "m" }, + lowercase: { label: "קלט", gender: "m" }, + starts_with: { label: "קלט", gender: "m" }, + uppercase: { label: "קלט", gender: "m" }, + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + // Expected type: show without definite article for clearer Hebrew + const expectedKey = issue.expected as string | undefined; + const expected = TypeDictionary[expectedKey ?? ""] ?? typeLabel(expectedKey); + // Received: show localized label if known, otherwise constructor/raw + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? TypeNames[receivedType]?.label ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `קלט לא תקין: צריך להיות instanceof ${issue.expected}, התקבל ${received}`; + } + return `קלט לא תקין: צריך להיות ${expected}, התקבל ${received}`; + } + + case "invalid_value": { + if (issue.values.length === 1) { + return `ערך לא תקין: הערך חייב להיות ${util.stringifyPrimitive(issue.values[0])}`; + } + // Join values with proper Hebrew formatting + const stringified = issue.values.map((v) => util.stringifyPrimitive(v)); + if (issue.values.length === 2) { + return `ערך לא תקין: האפשרויות המתאימות הן ${stringified[0]} או ${stringified[1]}`; + } + // For 3+ values: "a", "b" או "c" + const lastValue = stringified[stringified.length - 1]; + const restValues = stringified.slice(0, -1).join(", "); + return `ערך לא תקין: האפשרויות המתאימות הן ${restValues} או ${lastValue}`; + } + + case "too_big": { + const sizing = getSizing(issue.origin); + const subject = withDefinite(issue.origin ?? "value"); + + if (issue.origin === "string") { + // Special handling for strings - more natural Hebrew + return `${sizing?.longLabel ?? "ארוך"} מדי: ${subject} צריכה להכיל ${issue.maximum.toString()} ${sizing?.unit ?? ""} ${issue.inclusive ? "או פחות" : "לכל היותר"}`.trim(); + } + + if (issue.origin === "number") { + // Natural Hebrew for numbers + const comparison = issue.inclusive ? `קטן או שווה ל-${issue.maximum}` : `קטן מ-${issue.maximum}`; + return `גדול מדי: ${subject} צריך להיות ${comparison}`; + } + + if (issue.origin === "array" || issue.origin === "set") { + // Natural Hebrew for arrays and sets + const verb = issue.origin === "set" ? "צריכה" : "צריך"; + const comparison = issue.inclusive + ? `${issue.maximum} ${sizing?.unit ?? ""} או פחות` + : `פחות מ-${issue.maximum} ${sizing?.unit ?? ""}`; + return `גדול מדי: ${subject} ${verb} להכיל ${comparison}`.trim(); + } + + const adj = issue.inclusive ? "<=" : "<"; + const be = verbFor(issue.origin ?? "value"); + if (sizing?.unit) { + return `${sizing.longLabel} מדי: ${subject} ${be} ${adj}${issue.maximum.toString()} ${sizing.unit}`; + } + return `${sizing?.longLabel ?? "גדול"} מדי: ${subject} ${be} ${adj}${issue.maximum.toString()}`; + } + + case "too_small": { + const sizing = getSizing(issue.origin); + const subject = withDefinite(issue.origin ?? "value"); + + if (issue.origin === "string") { + // Special handling for strings - more natural Hebrew + return `${sizing?.shortLabel ?? "קצר"} מדי: ${subject} צריכה להכיל ${issue.minimum.toString()} ${sizing?.unit ?? ""} ${issue.inclusive ? "או יותר" : "לפחות"}`.trim(); + } + + if (issue.origin === "number") { + // Natural Hebrew for numbers + const comparison = issue.inclusive ? `גדול או שווה ל-${issue.minimum}` : `גדול מ-${issue.minimum}`; + return `קטן מדי: ${subject} צריך להיות ${comparison}`; + } + + if (issue.origin === "array" || issue.origin === "set") { + // Natural Hebrew for arrays and sets + const verb = issue.origin === "set" ? "צריכה" : "צריך"; + + // Special case for singular (minimum === 1) + if (issue.minimum === 1 && issue.inclusive) { + const singularPhrase = issue.origin === "set" ? "לפחות פריט אחד" : "לפחות פריט אחד"; + return `קטן מדי: ${subject} ${verb} להכיל ${singularPhrase}`; + } + + const comparison = issue.inclusive + ? `${issue.minimum} ${sizing?.unit ?? ""} או יותר` + : `יותר מ-${issue.minimum} ${sizing?.unit ?? ""}`; + return `קטן מדי: ${subject} ${verb} להכיל ${comparison}`.trim(); + } + + const adj = issue.inclusive ? ">=" : ">"; + const be = verbFor(issue.origin ?? "value"); + if (sizing?.unit) { + return `${sizing.shortLabel} מדי: ${subject} ${be} ${adj}${issue.minimum.toString()} ${sizing.unit}`; + } + return `${sizing?.shortLabel ?? "קטן"} מדי: ${subject} ${be} ${adj}${issue.minimum.toString()}`; + } + + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + // These apply to strings — use feminine grammar + ה׳ הידיעה + if (_issue.format === "starts_with") return `המחרוזת חייבת להתחיל ב "${_issue.prefix}"`; + if (_issue.format === "ends_with") return `המחרוזת חייבת להסתיים ב "${_issue.suffix}"`; + if (_issue.format === "includes") return `המחרוזת חייבת לכלול "${_issue.includes}"`; + if (_issue.format === "regex") return `המחרוזת חייבת להתאים לתבנית ${_issue.pattern}`; + + // Handle gender agreement for formats + const nounEntry = FormatDictionary[_issue.format]; + const noun = nounEntry?.label ?? _issue.format; + const gender = nounEntry?.gender ?? "m"; + const adjective = gender === "f" ? "תקינה" : "תקין"; + return `${noun} לא ${adjective}`; + } + + case "not_multiple_of": + return `מספר לא תקין: חייב להיות מכפלה של ${issue.divisor}`; + + case "unrecognized_keys": + return `מפתח${issue.keys.length > 1 ? "ות" : ""} לא מזוה${issue.keys.length > 1 ? "ים" : "ה"}: ${util.joinValues(issue.keys, ", ")}`; + + case "invalid_key": { + return `שדה לא תקין באובייקט`; + } + + case "invalid_union": + return "קלט לא תקין"; + + case "invalid_element": { + const place = withDefinite(issue.origin ?? "array"); + return `ערך לא תקין ב${place}`; + } + + default: + return `קלט לא תקין`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/hr.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/hr.ts new file mode 100644 index 0000000000000000000000000000000000000000..124c5a27994a538ce33b44f29a424098b20306d8 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/hr.ts @@ -0,0 +1,131 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "znakova", verb: "imati" }, + file: { unit: "bajtova", verb: "imati" }, + array: { unit: "stavki", verb: "imati" }, + set: { unit: "stavki", verb: "imati" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "unos", + email: "email adresa", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO datum i vrijeme", + date: "ISO datum", + time: "ISO vrijeme", + duration: "ISO trajanje", + ipv4: "IPv4 adresa", + ipv6: "IPv6 adresa", + cidrv4: "IPv4 raspon", + cidrv6: "IPv6 raspon", + base64: "base64 kodirani tekst", + base64url: "base64url kodirani tekst", + json_string: "JSON tekst", + e164: "E.164 broj", + jwt: "JWT", + template_literal: "unos", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + string: "tekst", + number: "broj", + boolean: "boolean", + array: "niz", + object: "objekt", + set: "skup", + file: "datoteka", + date: "datum", + bigint: "bigint", + symbol: "simbol", + undefined: "undefined", + null: "null", + function: "funkcija", + map: "mapa", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Neispravan unos: očekuje se instanceof ${issue.expected}, a primljeno je ${received}`; + } + return `Neispravan unos: očekuje se ${expected}, a primljeno je ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) + return `Neispravna vrijednost: očekivano ${util.stringifyPrimitive(issue.values[0])}`; + return `Neispravna opcija: očekivano jedno od ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + const origin = TypeDictionary[issue.origin] ?? issue.origin; + if (sizing) + return `Preveliko: očekivano da ${origin ?? "vrijednost"} ima ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elemenata"}`; + return `Preveliko: očekivano da ${origin ?? "vrijednost"} bude ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + const origin = TypeDictionary[issue.origin] ?? issue.origin; + if (sizing) { + return `Premalo: očekivano da ${origin} ima ${adj}${issue.minimum.toString()} ${sizing.unit}`; + } + + return `Premalo: očekivano da ${origin} bude ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `Neispravan tekst: mora započinjati s "${_issue.prefix}"`; + if (_issue.format === "ends_with") return `Neispravan tekst: mora završavati s "${_issue.suffix}"`; + if (_issue.format === "includes") return `Neispravan tekst: mora sadržavati "${_issue.includes}"`; + if (_issue.format === "regex") return `Neispravan tekst: mora odgovarati uzorku ${_issue.pattern}`; + return `Neispravna ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Neispravan broj: mora biti višekratnik od ${issue.divisor}`; + case "unrecognized_keys": + return `Neprepoznat${issue.keys.length > 1 ? "i ključevi" : " ključ"}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Neispravan ključ u ${TypeDictionary[issue.origin] ?? issue.origin}`; + case "invalid_union": + return "Neispravan unos"; + case "invalid_element": + return `Neispravna vrijednost u ${TypeDictionary[issue.origin] ?? issue.origin}`; + default: + return `Neispravan unos`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/hu.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/hu.ts new file mode 100644 index 0000000000000000000000000000000000000000..5ea46a9d38715b84bbf4f6d16532498fbbb5bb82 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/hu.ts @@ -0,0 +1,117 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "karakter", verb: "legyen" }, + file: { unit: "byte", verb: "legyen" }, + array: { unit: "elem", verb: "legyen" }, + set: { unit: "elem", verb: "legyen" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "bemenet", + email: "email cím", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO időbélyeg", + date: "ISO dátum", + time: "ISO idő", + duration: "ISO időintervallum", + ipv4: "IPv4 cím", + ipv6: "IPv6 cím", + cidrv4: "IPv4 tartomány", + cidrv6: "IPv6 tartomány", + base64: "base64-kódolt string", + base64url: "base64url-kódolt string", + json_string: "JSON string", + e164: "E.164 szám", + jwt: "JWT", + template_literal: "bemenet", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "szám", + array: "tömb", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Érvénytelen bemenet: a várt érték instanceof ${issue.expected}, a kapott érték ${received}`; + } + return `Érvénytelen bemenet: a várt érték ${expected}, a kapott érték ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) + return `Érvénytelen bemenet: a várt érték ${util.stringifyPrimitive(issue.values[0])}`; + return `Érvénytelen opció: valamelyik érték várt ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Túl nagy: ${issue.origin ?? "érték"} mérete túl nagy ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elem"}`; + return `Túl nagy: a bemeneti érték ${issue.origin ?? "érték"} túl nagy: ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Túl kicsi: a bemeneti érték ${issue.origin} mérete túl kicsi ${adj}${issue.minimum.toString()} ${sizing.unit}`; + } + + return `Túl kicsi: a bemeneti érték ${issue.origin} túl kicsi ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `Érvénytelen string: "${_issue.prefix}" értékkel kell kezdődnie`; + if (_issue.format === "ends_with") return `Érvénytelen string: "${_issue.suffix}" értékkel kell végződnie`; + if (_issue.format === "includes") return `Érvénytelen string: "${_issue.includes}" értéket kell tartalmaznia`; + if (_issue.format === "regex") return `Érvénytelen string: ${_issue.pattern} mintának kell megfelelnie`; + return `Érvénytelen ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Érvénytelen szám: ${issue.divisor} többszörösének kell lennie`; + case "unrecognized_keys": + return `Ismeretlen kulcs${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Érvénytelen kulcs ${issue.origin}`; + case "invalid_union": + return "Érvénytelen bemenet"; + case "invalid_element": + return `Érvénytelen érték: ${issue.origin}`; + default: + return `Érvénytelen bemenet`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/hy.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/hy.ts new file mode 100644 index 0000000000000000000000000000000000000000..8635804d6068d7f09d4ce30a50a1ea3293e5da85 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/hy.ts @@ -0,0 +1,164 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +function getArmenianPlural(count: number, one: string, many: string): string { + return Math.abs(count) === 1 ? one : many; +} + +function withDefiniteArticle(word: string | undefined): string { + if (!word) return ""; + const vowels = ["ա", "ե", "ը", "ի", "ո", "ու", "օ"]; + const lastChar = word[word.length - 1]; + return word + (vowels.includes(lastChar) ? "ն" : "ը"); +} + +interface ArmenianSizable { + unit: { + one: string; + many: string; + }; + verb: string; +} + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { + unit: { + one: "նշան", + many: "նշաններ", + }, + verb: "ունենալ", + }, + file: { + unit: { + one: "բայթ", + many: "բայթեր", + }, + verb: "ունենալ", + }, + array: { + unit: { + one: "տարր", + many: "տարրեր", + }, + verb: "ունենալ", + }, + set: { + unit: { + one: "տարր", + many: "տարրեր", + }, + verb: "ունենալ", + }, + }; + + function getSizing(origin: string): ArmenianSizable | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "մուտք", + email: "էլ. հասցե", + url: "URL", + emoji: "էմոջի", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO ամսաթիվ և ժամ", + date: "ISO ամսաթիվ", + time: "ISO ժամ", + duration: "ISO տևողություն", + ipv4: "IPv4 հասցե", + ipv6: "IPv6 հասցե", + cidrv4: "IPv4 միջակայք", + cidrv6: "IPv6 միջակայք", + base64: "base64 ձևաչափով տող", + base64url: "base64url ձևաչափով տող", + json_string: "JSON տող", + e164: "E.164 համար", + jwt: "JWT", + template_literal: "մուտք", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "թիվ", + array: "զանգված", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Սխալ մուտքագրում․ սպասվում էր instanceof ${issue.expected}, ստացվել է ${received}`; + } + return `Սխալ մուտքագրում․ սպասվում էր ${expected}, ստացվել է ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) + return `Սխալ մուտքագրում․ սպասվում էր ${util.stringifyPrimitive(issue.values[1])}`; + return `Սխալ տարբերակ․ սպասվում էր հետևյալներից մեկը՝ ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) { + const maxValue = Number(issue.maximum); + const unit = getArmenianPlural(maxValue, sizing.unit.one, sizing.unit.many); + return `Չափազանց մեծ արժեք․ սպասվում է, որ ${withDefiniteArticle(issue.origin ?? "արժեք")} կունենա ${adj}${issue.maximum.toString()} ${unit}`; + } + return `Չափազանց մեծ արժեք․ սպասվում է, որ ${withDefiniteArticle(issue.origin ?? "արժեք")} լինի ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + const minValue = Number(issue.minimum); + const unit = getArmenianPlural(minValue, sizing.unit.one, sizing.unit.many); + return `Չափազանց փոքր արժեք․ սպասվում է, որ ${withDefiniteArticle(issue.origin)} կունենա ${adj}${issue.minimum.toString()} ${unit}`; + } + return `Չափազանց փոքր արժեք․ սպասվում է, որ ${withDefiniteArticle(issue.origin)} լինի ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `Սխալ տող․ պետք է սկսվի "${_issue.prefix}"-ով`; + if (_issue.format === "ends_with") return `Սխալ տող․ պետք է ավարտվի "${_issue.suffix}"-ով`; + if (_issue.format === "includes") return `Սխալ տող․ պետք է պարունակի "${_issue.includes}"`; + if (_issue.format === "regex") return `Սխալ տող․ պետք է համապատասխանի ${_issue.pattern} ձևաչափին`; + return `Սխալ ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Սխալ թիվ․ պետք է բազմապատիկ լինի ${issue.divisor}-ի`; + case "unrecognized_keys": + return `Չճանաչված բանալի${issue.keys.length > 1 ? "ներ" : ""}. ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Սխալ բանալի ${withDefiniteArticle(issue.origin)}-ում`; + case "invalid_union": + return "Սխալ մուտքագրում"; + case "invalid_element": + return `Սխալ արժեք ${withDefiniteArticle(issue.origin)}-ում`; + default: + return `Սխալ մուտքագրում`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/id.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/id.ts new file mode 100644 index 0000000000000000000000000000000000000000..72ca30579999d8e849b31a8289cfb937d75ae93c --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/id.ts @@ -0,0 +1,115 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "karakter", verb: "memiliki" }, + file: { unit: "byte", verb: "memiliki" }, + array: { unit: "item", verb: "memiliki" }, + set: { unit: "item", verb: "memiliki" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "input", + email: "alamat email", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "tanggal dan waktu format ISO", + date: "tanggal format ISO", + time: "jam format ISO", + duration: "durasi format ISO", + ipv4: "alamat IPv4", + ipv6: "alamat IPv6", + cidrv4: "rentang alamat IPv4", + cidrv6: "rentang alamat IPv6", + base64: "string dengan enkode base64", + base64url: "string dengan enkode base64url", + json_string: "string JSON", + e164: "angka E.164", + jwt: "JWT", + template_literal: "input", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Input tidak valid: diharapkan instanceof ${issue.expected}, diterima ${received}`; + } + return `Input tidak valid: diharapkan ${expected}, diterima ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) + return `Input tidak valid: diharapkan ${util.stringifyPrimitive(issue.values[0])}`; + return `Pilihan tidak valid: diharapkan salah satu dari ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Terlalu besar: diharapkan ${issue.origin ?? "value"} memiliki ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elemen"}`; + return `Terlalu besar: diharapkan ${issue.origin ?? "value"} menjadi ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Terlalu kecil: diharapkan ${issue.origin} memiliki ${adj}${issue.minimum.toString()} ${sizing.unit}`; + } + + return `Terlalu kecil: diharapkan ${issue.origin} menjadi ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `String tidak valid: harus dimulai dengan "${_issue.prefix}"`; + if (_issue.format === "ends_with") return `String tidak valid: harus berakhir dengan "${_issue.suffix}"`; + if (_issue.format === "includes") return `String tidak valid: harus menyertakan "${_issue.includes}"`; + if (_issue.format === "regex") return `String tidak valid: harus sesuai pola ${_issue.pattern}`; + return `${FormatDictionary[_issue.format] ?? issue.format} tidak valid`; + } + case "not_multiple_of": + return `Angka tidak valid: harus kelipatan dari ${issue.divisor}`; + case "unrecognized_keys": + return `Kunci tidak dikenali ${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Kunci tidak valid di ${issue.origin}`; + case "invalid_union": + return "Input tidak valid"; + case "invalid_element": + return `Nilai tidak valid di ${issue.origin}`; + default: + return `Input tidak valid`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/index.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..2e0c03994bc12a75f58f2c15b91bf4f6e0b4ed6b --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/index.ts @@ -0,0 +1,52 @@ +export { default as ar } from "./ar.js"; +export { default as az } from "./az.js"; +export { default as be } from "./be.js"; +export { default as bg } from "./bg.js"; +export { default as ca } from "./ca.js"; +export { default as cs } from "./cs.js"; +export { default as da } from "./da.js"; +export { default as de } from "./de.js"; +export { default as el } from "./el.js"; +export { default as en } from "./en.js"; +export { default as eo } from "./eo.js"; +export { default as es } from "./es.js"; +export { default as fa } from "./fa.js"; +export { default as fi } from "./fi.js"; +export { default as fr } from "./fr.js"; +export { default as frCA } from "./fr-CA.js"; +export { default as he } from "./he.js"; +export { default as hr } from "./hr.js"; +export { default as hu } from "./hu.js"; +export { default as hy } from "./hy.js"; +export { default as id } from "./id.js"; +export { default as is } from "./is.js"; +export { default as it } from "./it.js"; +export { default as ja } from "./ja.js"; +export { default as ka } from "./ka.js"; +export { default as kh } from "./kh.js"; +export { default as km } from "./km.js"; +export { default as ko } from "./ko.js"; +export { default as lt } from "./lt.js"; +export { default as mk } from "./mk.js"; +export { default as ms } from "./ms.js"; +export { default as nl } from "./nl.js"; +export { default as no } from "./no.js"; +export { default as ota } from "./ota.js"; +export { default as ps } from "./ps.js"; +export { default as pl } from "./pl.js"; +export { default as pt } from "./pt.js"; +export { default as ro } from "./ro.js"; +export { default as ru } from "./ru.js"; +export { default as sl } from "./sl.js"; +export { default as sv } from "./sv.js"; +export { default as ta } from "./ta.js"; +export { default as th } from "./th.js"; +export { default as tr } from "./tr.js"; +export { default as ua } from "./ua.js"; +export { default as uk } from "./uk.js"; +export { default as ur } from "./ur.js"; +export { default as uz } from "./uz.js"; +export { default as vi } from "./vi.js"; +export { default as zhCN } from "./zh-CN.js"; +export { default as zhTW } from "./zh-TW.js"; +export { default as yo } from "./yo.js"; diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/is.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/is.ts new file mode 100644 index 0000000000000000000000000000000000000000..7b3e9f775b0c4d17eb85f42072b8795bb33a3628 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/is.ts @@ -0,0 +1,119 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "stafi", verb: "að hafa" }, + file: { unit: "bæti", verb: "að hafa" }, + array: { unit: "hluti", verb: "að hafa" }, + set: { unit: "hluti", verb: "að hafa" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "gildi", + email: "netfang", + url: "vefslóð", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO dagsetning og tími", + date: "ISO dagsetning", + time: "ISO tími", + duration: "ISO tímalengd", + ipv4: "IPv4 address", + ipv6: "IPv6 address", + cidrv4: "IPv4 range", + cidrv6: "IPv6 range", + base64: "base64-encoded strengur", + base64url: "base64url-encoded strengur", + json_string: "JSON strengur", + e164: "E.164 tölugildi", + jwt: "JWT", + template_literal: "gildi", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "númer", + array: "fylki", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Rangt gildi: Þú slóst inn ${received} þar sem á að vera instanceof ${issue.expected}`; + } + return `Rangt gildi: Þú slóst inn ${received} þar sem á að vera ${expected}`; + } + + case "invalid_value": + if (issue.values.length === 1) return `Rangt gildi: gert ráð fyrir ${util.stringifyPrimitive(issue.values[0])}`; + return `Ógilt val: má vera eitt af eftirfarandi ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Of stórt: gert er ráð fyrir að ${issue.origin ?? "gildi"} hafi ${adj}${issue.maximum.toString()} ${sizing.unit ?? "hluti"}`; + return `Of stórt: gert er ráð fyrir að ${issue.origin ?? "gildi"} sé ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Of lítið: gert er ráð fyrir að ${issue.origin} hafi ${adj}${issue.minimum.toString()} ${sizing.unit}`; + } + + return `Of lítið: gert er ráð fyrir að ${issue.origin} sé ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") { + return `Ógildur strengur: verður að byrja á "${_issue.prefix}"`; + } + if (_issue.format === "ends_with") return `Ógildur strengur: verður að enda á "${_issue.suffix}"`; + if (_issue.format === "includes") return `Ógildur strengur: verður að innihalda "${_issue.includes}"`; + if (_issue.format === "regex") return `Ógildur strengur: verður að fylgja mynstri ${_issue.pattern}`; + return `Rangt ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Röng tala: verður að vera margfeldi af ${issue.divisor}`; + case "unrecognized_keys": + return `Óþekkt ${issue.keys.length > 1 ? "ir lyklar" : "ur lykill"}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Rangur lykill í ${issue.origin}`; + case "invalid_union": + return "Rangt gildi"; + case "invalid_element": + return `Rangt gildi í ${issue.origin}`; + default: + return `Rangt gildi`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/it.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/it.ts new file mode 100644 index 0000000000000000000000000000000000000000..68074fac8f3be801bd52f6bfb6347cb3b8d0331c --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/it.ts @@ -0,0 +1,116 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "caratteri", verb: "avere" }, + file: { unit: "byte", verb: "avere" }, + array: { unit: "elementi", verb: "avere" }, + set: { unit: "elementi", verb: "avere" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "input", + email: "indirizzo email", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "data e ora ISO", + date: "data ISO", + time: "ora ISO", + duration: "durata ISO", + ipv4: "indirizzo IPv4", + ipv6: "indirizzo IPv6", + cidrv4: "intervallo IPv4", + cidrv6: "intervallo IPv6", + base64: "stringa codificata in base64", + base64url: "URL codificata in base64", + json_string: "stringa JSON", + e164: "numero E.164", + jwt: "JWT", + template_literal: "input", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "numero", + array: "vettore", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Input non valido: atteso instanceof ${issue.expected}, ricevuto ${received}`; + } + return `Input non valido: atteso ${expected}, ricevuto ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) return `Input non valido: atteso ${util.stringifyPrimitive(issue.values[0])}`; + return `Opzione non valida: atteso uno tra ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Troppo grande: ${issue.origin ?? "valore"} deve avere ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementi"}`; + return `Troppo grande: ${issue.origin ?? "valore"} deve essere ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Troppo piccolo: ${issue.origin} deve avere ${adj}${issue.minimum.toString()} ${sizing.unit}`; + } + + return `Troppo piccolo: ${issue.origin} deve essere ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `Stringa non valida: deve iniziare con "${_issue.prefix}"`; + if (_issue.format === "ends_with") return `Stringa non valida: deve terminare con "${_issue.suffix}"`; + if (_issue.format === "includes") return `Stringa non valida: deve includere "${_issue.includes}"`; + if (_issue.format === "regex") return `Stringa non valida: deve corrispondere al pattern ${_issue.pattern}`; + return `Input non valido: ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Numero non valido: deve essere un multiplo di ${issue.divisor}`; + case "unrecognized_keys": + return `Chiav${issue.keys.length > 1 ? "i" : "e"} non riconosciut${issue.keys.length > 1 ? "e" : "a"}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Chiave non valida in ${issue.origin}`; + case "invalid_union": + return "Input non valido"; + case "invalid_element": + return `Valore non valido in ${issue.origin}`; + default: + return `Input non valido`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ja.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ja.ts new file mode 100644 index 0000000000000000000000000000000000000000..0cb3c5c8057e86af6740b1c0b42093ff255de58d --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ja.ts @@ -0,0 +1,114 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "文字", verb: "である" }, + file: { unit: "バイト", verb: "である" }, + array: { unit: "要素", verb: "である" }, + set: { unit: "要素", verb: "である" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "入力値", + email: "メールアドレス", + url: "URL", + emoji: "絵文字", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO日時", + date: "ISO日付", + time: "ISO時刻", + duration: "ISO期間", + ipv4: "IPv4アドレス", + ipv6: "IPv6アドレス", + cidrv4: "IPv4範囲", + cidrv6: "IPv6範囲", + base64: "base64エンコード文字列", + base64url: "base64urlエンコード文字列", + json_string: "JSON文字列", + e164: "E.164番号", + jwt: "JWT", + template_literal: "入力値", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "数値", + array: "配列", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `無効な入力: instanceof ${issue.expected}が期待されましたが、${received}が入力されました`; + } + return `無効な入力: ${expected}が期待されましたが、${received}が入力されました`; + } + case "invalid_value": + if (issue.values.length === 1) return `無効な入力: ${util.stringifyPrimitive(issue.values[0])}が期待されました`; + return `無効な選択: ${util.joinValues(issue.values, "、")}のいずれかである必要があります`; + case "too_big": { + const adj = issue.inclusive ? "以下である" : "より小さい"; + const sizing = getSizing(issue.origin); + if (sizing) + return `大きすぎる値: ${issue.origin ?? "値"}は${issue.maximum.toString()}${sizing.unit ?? "要素"}${adj}必要があります`; + return `大きすぎる値: ${issue.origin ?? "値"}は${issue.maximum.toString()}${adj}必要があります`; + } + case "too_small": { + const adj = issue.inclusive ? "以上である" : "より大きい"; + const sizing = getSizing(issue.origin); + if (sizing) + return `小さすぎる値: ${issue.origin}は${issue.minimum.toString()}${sizing.unit}${adj}必要があります`; + return `小さすぎる値: ${issue.origin}は${issue.minimum.toString()}${adj}必要があります`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `無効な文字列: "${_issue.prefix}"で始まる必要があります`; + if (_issue.format === "ends_with") return `無効な文字列: "${_issue.suffix}"で終わる必要があります`; + if (_issue.format === "includes") return `無効な文字列: "${_issue.includes}"を含む必要があります`; + if (_issue.format === "regex") return `無効な文字列: パターン${_issue.pattern}に一致する必要があります`; + return `無効な${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `無効な数値: ${issue.divisor}の倍数である必要があります`; + case "unrecognized_keys": + return `認識されていないキー${issue.keys.length > 1 ? "群" : ""}: ${util.joinValues(issue.keys, "、")}`; + case "invalid_key": + return `${issue.origin}内の無効なキー`; + case "invalid_union": + return "無効な入力"; + case "invalid_element": + return `${issue.origin}内の無効な値`; + default: + return `無効な入力`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ka.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ka.ts new file mode 100644 index 0000000000000000000000000000000000000000..867843fbcc8333010b3d88e9faa10622a9654a09 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ka.ts @@ -0,0 +1,123 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "სიმბოლო", verb: "უნდა შეიცავდეს" }, + file: { unit: "ბაიტი", verb: "უნდა შეიცავდეს" }, + array: { unit: "ელემენტი", verb: "უნდა შეიცავდეს" }, + set: { unit: "ელემენტი", verb: "უნდა შეიცავდეს" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "შეყვანა", + email: "ელ-ფოსტის მისამართი", + url: "URL", + emoji: "ემოჯი", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "თარიღი-დრო", + date: "თარიღი", + time: "დრო", + duration: "ხანგრძლივობა", + ipv4: "IPv4 მისამართი", + ipv6: "IPv6 მისამართი", + cidrv4: "IPv4 დიაპაზონი", + cidrv6: "IPv6 დიაპაზონი", + base64: "base64-კოდირებული ველი", + base64url: "base64url-კოდირებული ველი", + json_string: "JSON ველი", + e164: "E.164 ნომერი", + jwt: "JWT", + template_literal: "შეყვანა", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "რიცხვი", + string: "ველი", + boolean: "ბულეანი", + function: "ფუნქცია", + array: "მასივი", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `არასწორი შეყვანა: მოსალოდნელი instanceof ${issue.expected}, მიღებული ${received}`; + } + return `არასწორი შეყვანა: მოსალოდნელი ${expected}, მიღებული ${received}`; + } + + case "invalid_value": + if (issue.values.length === 1) + return `არასწორი შეყვანა: მოსალოდნელი ${util.stringifyPrimitive(issue.values[0])}`; + return `არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${util.joinValues(issue.values, "|")}-დან`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `ზედმეტად დიდი: მოსალოდნელი ${issue.origin ?? "მნიშვნელობა"} ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit}`; + return `ზედმეტად დიდი: მოსალოდნელი ${issue.origin ?? "მნიშვნელობა"} იყოს ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `ზედმეტად პატარა: მოსალოდნელი ${issue.origin} ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`; + } + + return `ზედმეტად პატარა: მოსალოდნელი ${issue.origin} იყოს ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") { + return `არასწორი ველი: უნდა იწყებოდეს "${_issue.prefix}"-ით`; + } + if (_issue.format === "ends_with") return `არასწორი ველი: უნდა მთავრდებოდეს "${_issue.suffix}"-ით`; + if (_issue.format === "includes") return `არასწორი ველი: უნდა შეიცავდეს "${_issue.includes}"-ს`; + if (_issue.format === "regex") return `არასწორი ველი: უნდა შეესაბამებოდეს შაბლონს ${_issue.pattern}`; + return `არასწორი ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `არასწორი რიცხვი: უნდა იყოს ${issue.divisor}-ის ჯერადი`; + case "unrecognized_keys": + return `უცნობი გასაღებ${issue.keys.length > 1 ? "ები" : "ი"}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `არასწორი გასაღები ${issue.origin}-ში`; + case "invalid_union": + return "არასწორი შეყვანა"; + case "invalid_element": + return `არასწორი მნიშვნელობა ${issue.origin}-ში`; + default: + return `არასწორი შეყვანა`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/kh.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/kh.ts new file mode 100644 index 0000000000000000000000000000000000000000..84371b306d97564f3bacc90e443c0b3c46243230 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/kh.ts @@ -0,0 +1,7 @@ +import type * as errors from "../core/errors.js"; +import km from "./km.js"; + +/** @deprecated Use `km` instead. */ +export default function (): { localeError: errors.$ZodErrorMap } { + return km(); +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/km.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/km.ts new file mode 100644 index 0000000000000000000000000000000000000000..9988eadc8f55159bcc58c61e10d1278c528dd197 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/km.ts @@ -0,0 +1,119 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "តួអក្សរ", verb: "គួរមាន" }, + file: { unit: "បៃ", verb: "គួរមាន" }, + array: { unit: "ធាតុ", verb: "គួរមាន" }, + set: { unit: "ធាតុ", verb: "គួរមាន" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "ទិន្នន័យបញ្ចូល", + email: "អាសយដ្ឋានអ៊ីមែល", + url: "URL", + emoji: "សញ្ញាអារម្មណ៍", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "កាលបរិច្ឆេទ និងម៉ោង ISO", + date: "កាលបរិច្ឆេទ ISO", + time: "ម៉ោង ISO", + duration: "រយៈពេល ISO", + ipv4: "អាសយដ្ឋាន IPv4", + ipv6: "អាសយដ្ឋាន IPv6", + cidrv4: "ដែនអាសយដ្ឋាន IPv4", + cidrv6: "ដែនអាសយដ្ឋាន IPv6", + base64: "ខ្សែអក្សរអ៊ិកូដ base64", + base64url: "ខ្សែអក្សរអ៊ិកូដ base64url", + json_string: "ខ្សែអក្សរ JSON", + e164: "លេខ E.164", + jwt: "JWT", + template_literal: "ទិន្នន័យបញ្ចូល", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "លេខ", + array: "អារេ (Array)", + null: "គ្មានតម្លៃ (null)", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${issue.expected} ប៉ុន្តែទទួលបាន ${received}`; + } + return `ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${expected} ប៉ុន្តែទទួលបាន ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) return `ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${util.stringifyPrimitive(issue.values[0])}`; + return `ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `ធំពេក៖ ត្រូវការ ${issue.origin ?? "តម្លៃ"} ${adj} ${issue.maximum.toString()} ${sizing.unit ?? "ធាតុ"}`; + return `ធំពេក៖ ត្រូវការ ${issue.origin ?? "តម្លៃ"} ${adj} ${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `តូចពេក៖ ត្រូវការ ${issue.origin} ${adj} ${issue.minimum.toString()} ${sizing.unit}`; + } + + return `តូចពេក៖ ត្រូវការ ${issue.origin} ${adj} ${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") { + return `ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${_issue.prefix}"`; + } + if (_issue.format === "ends_with") return `ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${_issue.suffix}"`; + if (_issue.format === "includes") return `ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${_issue.includes}"`; + if (_issue.format === "regex") return `ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${_issue.pattern}`; + return `មិនត្រឹមត្រូវ៖ ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${issue.divisor}`; + case "unrecognized_keys": + return `រកឃើញសោមិនស្គាល់៖ ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `សោមិនត្រឹមត្រូវនៅក្នុង ${issue.origin}`; + case "invalid_union": + return `ទិន្នន័យមិនត្រឹមត្រូវ`; + case "invalid_element": + return `ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${issue.origin}`; + default: + return `ទិន្នន័យមិនត្រឹមត្រូវ`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ko.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ko.ts new file mode 100644 index 0000000000000000000000000000000000000000..fb55b0d6d407bd03eaeb0a17888fe13106eccb6c --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ko.ts @@ -0,0 +1,121 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "문자", verb: "to have" }, + file: { unit: "바이트", verb: "to have" }, + array: { unit: "개", verb: "to have" }, + set: { unit: "개", verb: "to have" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "입력", + email: "이메일 주소", + url: "URL", + emoji: "이모지", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO 날짜시간", + date: "ISO 날짜", + time: "ISO 시간", + duration: "ISO 기간", + ipv4: "IPv4 주소", + ipv6: "IPv6 주소", + cidrv4: "IPv4 범위", + cidrv6: "IPv6 범위", + base64: "base64 인코딩 문자열", + base64url: "base64url 인코딩 문자열", + json_string: "JSON 문자열", + e164: "E.164 번호", + jwt: "JWT", + template_literal: "입력", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `잘못된 입력: 예상 타입은 instanceof ${issue.expected}, 받은 타입은 ${received}입니다`; + } + return `잘못된 입력: 예상 타입은 ${expected}, 받은 타입은 ${received}입니다`; + } + case "invalid_value": + if (issue.values.length === 1) + return `잘못된 입력: 값은 ${util.stringifyPrimitive(issue.values[0])} 이어야 합니다`; + return `잘못된 옵션: ${util.joinValues(issue.values, "또는 ")} 중 하나여야 합니다`; + case "too_big": { + const adj = issue.inclusive ? "이하" : "미만"; + const suffix = adj === "미만" ? "이어야 합니다" : "여야 합니다"; + const sizing = getSizing(issue.origin); + const unit = sizing?.unit ?? "요소"; + if (sizing) return `${issue.origin ?? "값"}이 너무 큽니다: ${issue.maximum.toString()}${unit} ${adj}${suffix}`; + + return `${issue.origin ?? "값"}이 너무 큽니다: ${issue.maximum.toString()} ${adj}${suffix}`; + } + case "too_small": { + const adj = issue.inclusive ? "이상" : "초과"; + const suffix = adj === "이상" ? "이어야 합니다" : "여야 합니다"; + const sizing = getSizing(issue.origin); + const unit = sizing?.unit ?? "요소"; + if (sizing) { + return `${issue.origin ?? "값"}이 너무 작습니다: ${issue.minimum.toString()}${unit} ${adj}${suffix}`; + } + + return `${issue.origin ?? "값"}이 너무 작습니다: ${issue.minimum.toString()} ${adj}${suffix}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") { + return `잘못된 문자열: "${_issue.prefix}"(으)로 시작해야 합니다`; + } + if (_issue.format === "ends_with") return `잘못된 문자열: "${_issue.suffix}"(으)로 끝나야 합니다`; + if (_issue.format === "includes") return `잘못된 문자열: "${_issue.includes}"을(를) 포함해야 합니다`; + if (_issue.format === "regex") return `잘못된 문자열: 정규식 ${_issue.pattern} 패턴과 일치해야 합니다`; + return `잘못된 ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `잘못된 숫자: ${issue.divisor}의 배수여야 합니다`; + case "unrecognized_keys": + return `인식할 수 없는 키: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `잘못된 키: ${issue.origin}`; + case "invalid_union": + return `잘못된 입력`; + case "invalid_element": + return `잘못된 값: ${issue.origin}`; + default: + return `잘못된 입력`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/lt.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/lt.ts new file mode 100644 index 0000000000000000000000000000000000000000..f4d4e17713e983869a0497dc5efab0068481e9dc --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/lt.ts @@ -0,0 +1,239 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const capitalizeFirstCharacter = (text: string): string => { + return text.charAt(0).toUpperCase() + text.slice(1); +}; + +type UnitType = "one" | "few" | "many"; +type SizeableComparisonType = "smaller" | "bigger"; + +function getUnitTypeFromNumber(number: number): UnitType { + const abs = Math.abs(number); + const last = abs % 10; + const last2 = abs % 100; + + if ((last2 >= 11 && last2 <= 19) || last === 0) return "many"; + if (last === 1) return "one"; + return "few"; +} + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record< + string, + { + unit: Record; + verb: Record; + } + > = { + string: { + unit: { + one: "simbolis", + few: "simboliai", + many: "simbolių", + }, + verb: { + smaller: { + inclusive: "turi būti ne ilgesnė kaip", + notInclusive: "turi būti trumpesnė kaip", + }, + bigger: { + inclusive: "turi būti ne trumpesnė kaip", + notInclusive: "turi būti ilgesnė kaip", + }, + }, + }, + file: { + unit: { + one: "baitas", + few: "baitai", + many: "baitų", + }, + verb: { + smaller: { + inclusive: "turi būti ne didesnis kaip", + notInclusive: "turi būti mažesnis kaip", + }, + bigger: { + inclusive: "turi būti ne mažesnis kaip", + notInclusive: "turi būti didesnis kaip", + }, + }, + }, + array: { + unit: { + one: "elementą", + few: "elementus", + many: "elementų", + }, + verb: { + smaller: { + inclusive: "turi turėti ne daugiau kaip", + notInclusive: "turi turėti mažiau kaip", + }, + bigger: { + inclusive: "turi turėti ne mažiau kaip", + notInclusive: "turi turėti daugiau kaip", + }, + }, + }, + set: { + unit: { + one: "elementą", + few: "elementus", + many: "elementų", + }, + verb: { + smaller: { + inclusive: "turi turėti ne daugiau kaip", + notInclusive: "turi turėti mažiau kaip", + }, + bigger: { + inclusive: "turi turėti ne mažiau kaip", + notInclusive: "turi turėti daugiau kaip", + }, + }, + }, + }; + + function getSizing( + origin: string, + unitType: UnitType, + inclusive: boolean, + targetShouldBe: SizeableComparisonType + ): { + unit: string; + verb: string; + } | null { + const result = Sizable[origin] ?? null; + if (result === null) return result; + + return { + unit: result.unit[unitType], + verb: result.verb[targetShouldBe][inclusive ? "inclusive" : "notInclusive"], + }; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "įvestis", + email: "el. pašto adresas", + url: "URL", + emoji: "jaustukas", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO data ir laikas", + date: "ISO data", + time: "ISO laikas", + duration: "ISO trukmė", + ipv4: "IPv4 adresas", + ipv6: "IPv6 adresas", + cidrv4: "IPv4 tinklo prefiksas (CIDR)", + cidrv6: "IPv6 tinklo prefiksas (CIDR)", + base64: "base64 užkoduota eilutė", + base64url: "base64url užkoduota eilutė", + json_string: "JSON eilutė", + e164: "E.164 numeris", + jwt: "JWT", + template_literal: "įvestis", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "skaičius", + bigint: "sveikasis skaičius", + string: "eilutė", + boolean: "loginė reikšmė", + undefined: "neapibrėžta reikšmė", + function: "funkcija", + symbol: "simbolis", + array: "masyvas", + object: "objektas", + null: "nulinė reikšmė", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Gautas tipas ${received}, o tikėtasi - instanceof ${issue.expected}`; + } + return `Gautas tipas ${received}, o tikėtasi - ${expected}`; + } + case "invalid_value": + if (issue.values.length === 1) return `Privalo būti ${util.stringifyPrimitive(issue.values[0])}`; + return `Privalo būti vienas iš ${util.joinValues(issue.values, "|")} pasirinkimų`; + case "too_big": { + const origin = TypeDictionary[issue.origin] ?? issue.origin; + const sizing = getSizing( + issue.origin, + getUnitTypeFromNumber(Number(issue.maximum)), + issue.inclusive ?? false, + "smaller" + ); + if (sizing?.verb) + return `${capitalizeFirstCharacter(origin ?? issue.origin ?? "reikšmė")} ${sizing.verb} ${issue.maximum.toString()} ${sizing.unit ?? "elementų"}`; + const adj = issue.inclusive ? "ne didesnis kaip" : "mažesnis kaip"; + return `${capitalizeFirstCharacter(origin ?? issue.origin ?? "reikšmė")} turi būti ${adj} ${issue.maximum.toString()} ${sizing?.unit}`; + } + case "too_small": { + const origin = TypeDictionary[issue.origin] ?? issue.origin; + const sizing = getSizing( + issue.origin, + getUnitTypeFromNumber(Number(issue.minimum)), + issue.inclusive ?? false, + "bigger" + ); + if (sizing?.verb) + return `${capitalizeFirstCharacter(origin ?? issue.origin ?? "reikšmė")} ${sizing.verb} ${issue.minimum.toString()} ${sizing.unit ?? "elementų"}`; + const adj = issue.inclusive ? "ne mažesnis kaip" : "didesnis kaip"; + return `${capitalizeFirstCharacter(origin ?? issue.origin ?? "reikšmė")} turi būti ${adj} ${issue.minimum.toString()} ${sizing?.unit}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") { + return `Eilutė privalo prasidėti "${_issue.prefix}"`; + } + if (_issue.format === "ends_with") return `Eilutė privalo pasibaigti "${_issue.suffix}"`; + if (_issue.format === "includes") return `Eilutė privalo įtraukti "${_issue.includes}"`; + if (_issue.format === "regex") return `Eilutė privalo atitikti ${_issue.pattern}`; + return `Neteisingas ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Skaičius privalo būti ${issue.divisor} kartotinis.`; + case "unrecognized_keys": + return `Neatpažint${issue.keys.length > 1 ? "i" : "as"} rakt${issue.keys.length > 1 ? "ai" : "as"}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return "Rastas klaidingas raktas"; + case "invalid_union": + return "Klaidinga įvestis"; + case "invalid_element": { + const origin = TypeDictionary[issue.origin] ?? issue.origin; + return `${capitalizeFirstCharacter(origin ?? issue.origin ?? "reikšmė")} turi klaidingą įvestį`; + } + default: + return "Klaidinga įvestis"; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/mk.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/mk.ts new file mode 100644 index 0000000000000000000000000000000000000000..f320fa83aedb58c63c7f42c4bca16a433e786591 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/mk.ts @@ -0,0 +1,118 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "знаци", verb: "да имаат" }, + file: { unit: "бајти", verb: "да имаат" }, + array: { unit: "ставки", verb: "да имаат" }, + set: { unit: "ставки", verb: "да имаат" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "внес", + email: "адреса на е-пошта", + url: "URL", + emoji: "емоџи", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO датум и време", + date: "ISO датум", + time: "ISO време", + duration: "ISO времетраење", + ipv4: "IPv4 адреса", + ipv6: "IPv6 адреса", + cidrv4: "IPv4 опсег", + cidrv6: "IPv6 опсег", + base64: "base64-енкодирана низа", + base64url: "base64url-енкодирана низа", + json_string: "JSON низа", + e164: "E.164 број", + jwt: "JWT", + template_literal: "внес", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "број", + array: "низа", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Грешен внес: се очекува instanceof ${issue.expected}, примено ${received}`; + } + return `Грешен внес: се очекува ${expected}, примено ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) return `Invalid input: expected ${util.stringifyPrimitive(issue.values[0])}`; + return `Грешана опција: се очекува една ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Премногу голем: се очекува ${issue.origin ?? "вредноста"} да има ${adj}${issue.maximum.toString()} ${sizing.unit ?? "елементи"}`; + return `Премногу голем: се очекува ${issue.origin ?? "вредноста"} да биде ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Премногу мал: се очекува ${issue.origin} да има ${adj}${issue.minimum.toString()} ${sizing.unit}`; + } + + return `Премногу мал: се очекува ${issue.origin} да биде ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") { + return `Неважечка низа: мора да започнува со "${_issue.prefix}"`; + } + if (_issue.format === "ends_with") return `Неважечка низа: мора да завршува со "${_issue.suffix}"`; + if (_issue.format === "includes") return `Неважечка низа: мора да вклучува "${_issue.includes}"`; + if (_issue.format === "regex") return `Неважечка низа: мора да одгоара на патернот ${_issue.pattern}`; + return `Invalid ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Грешен број: мора да биде делив со ${issue.divisor}`; + case "unrecognized_keys": + return `${issue.keys.length > 1 ? "Непрепознаени клучеви" : "Непрепознаен клуч"}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Грешен клуч во ${issue.origin}`; + case "invalid_union": + return "Грешен внес"; + case "invalid_element": + return `Грешна вредност во ${issue.origin}`; + default: + return `Грешен внес`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ms.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ms.ts new file mode 100644 index 0000000000000000000000000000000000000000..8ead32da42980807c3bf327506a8a98fd0ab974d --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ms.ts @@ -0,0 +1,115 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "aksara", verb: "mempunyai" }, + file: { unit: "bait", verb: "mempunyai" }, + array: { unit: "elemen", verb: "mempunyai" }, + set: { unit: "elemen", verb: "mempunyai" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "input", + email: "alamat e-mel", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "tarikh masa ISO", + date: "tarikh ISO", + time: "masa ISO", + duration: "tempoh ISO", + ipv4: "alamat IPv4", + ipv6: "alamat IPv6", + cidrv4: "julat IPv4", + cidrv6: "julat IPv6", + base64: "string dikodkan base64", + base64url: "string dikodkan base64url", + json_string: "string JSON", + e164: "nombor E.164", + jwt: "JWT", + template_literal: "input", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "nombor", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Input tidak sah: dijangka instanceof ${issue.expected}, diterima ${received}`; + } + return `Input tidak sah: dijangka ${expected}, diterima ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) return `Input tidak sah: dijangka ${util.stringifyPrimitive(issue.values[0])}`; + return `Pilihan tidak sah: dijangka salah satu daripada ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Terlalu besar: dijangka ${issue.origin ?? "nilai"} ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elemen"}`; + return `Terlalu besar: dijangka ${issue.origin ?? "nilai"} adalah ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Terlalu kecil: dijangka ${issue.origin} ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`; + } + + return `Terlalu kecil: dijangka ${issue.origin} adalah ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `String tidak sah: mesti bermula dengan "${_issue.prefix}"`; + if (_issue.format === "ends_with") return `String tidak sah: mesti berakhir dengan "${_issue.suffix}"`; + if (_issue.format === "includes") return `String tidak sah: mesti mengandungi "${_issue.includes}"`; + if (_issue.format === "regex") return `String tidak sah: mesti sepadan dengan corak ${_issue.pattern}`; + return `${FormatDictionary[_issue.format] ?? issue.format} tidak sah`; + } + case "not_multiple_of": + return `Nombor tidak sah: perlu gandaan ${issue.divisor}`; + case "unrecognized_keys": + return `Kunci tidak dikenali: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Kunci tidak sah dalam ${issue.origin}`; + case "invalid_union": + return "Input tidak sah"; + case "invalid_element": + return `Nilai tidak sah dalam ${issue.origin}`; + default: + return `Input tidak sah`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/nl.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/nl.ts new file mode 100644 index 0000000000000000000000000000000000000000..3ed3099e5e9cc5ad7d1bd65bb5be98e4bff7f6d6 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/nl.ts @@ -0,0 +1,121 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "tekens", verb: "heeft" }, + file: { unit: "bytes", verb: "heeft" }, + array: { unit: "elementen", verb: "heeft" }, + set: { unit: "elementen", verb: "heeft" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "invoer", + email: "emailadres", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO datum en tijd", + date: "ISO datum", + time: "ISO tijd", + duration: "ISO duur", + ipv4: "IPv4-adres", + ipv6: "IPv6-adres", + cidrv4: "IPv4-bereik", + cidrv6: "IPv6-bereik", + base64: "base64-gecodeerde tekst", + base64url: "base64 URL-gecodeerde tekst", + json_string: "JSON string", + e164: "E.164-nummer", + jwt: "JWT", + template_literal: "invoer", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "getal", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Ongeldige invoer: verwacht instanceof ${issue.expected}, ontving ${received}`; + } + return `Ongeldige invoer: verwacht ${expected}, ontving ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) return `Ongeldige invoer: verwacht ${util.stringifyPrimitive(issue.values[0])}`; + return `Ongeldige optie: verwacht één van ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + const longName = issue.origin === "date" ? "laat" : issue.origin === "string" ? "lang" : "groot"; + + if (sizing) + return `Te ${longName}: verwacht dat ${issue.origin ?? "waarde"} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementen"} ${sizing.verb}`; + return `Te ${longName}: verwacht dat ${issue.origin ?? "waarde"} ${adj}${issue.maximum.toString()} is`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + const shortName = issue.origin === "date" ? "vroeg" : issue.origin === "string" ? "kort" : "klein"; + + if (sizing) { + return `Te ${shortName}: verwacht dat ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit} ${sizing.verb}`; + } + + return `Te ${shortName}: verwacht dat ${issue.origin} ${adj}${issue.minimum.toString()} is`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") { + return `Ongeldige tekst: moet met "${_issue.prefix}" beginnen`; + } + if (_issue.format === "ends_with") return `Ongeldige tekst: moet op "${_issue.suffix}" eindigen`; + if (_issue.format === "includes") return `Ongeldige tekst: moet "${_issue.includes}" bevatten`; + if (_issue.format === "regex") return `Ongeldige tekst: moet overeenkomen met patroon ${_issue.pattern}`; + return `Ongeldig: ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Ongeldig getal: moet een veelvoud van ${issue.divisor} zijn`; + case "unrecognized_keys": + return `Onbekende key${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Ongeldige key in ${issue.origin}`; + case "invalid_union": + return "Ongeldige invoer"; + case "invalid_element": + return `Ongeldige waarde in ${issue.origin}`; + default: + return `Ongeldige invoer`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/no.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/no.ts new file mode 100644 index 0000000000000000000000000000000000000000..ca3028eb2a8283137456f9919b4c36c3f041942b --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/no.ts @@ -0,0 +1,116 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "tegn", verb: "å ha" }, + file: { unit: "bytes", verb: "å ha" }, + array: { unit: "elementer", verb: "å inneholde" }, + set: { unit: "elementer", verb: "å inneholde" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "input", + email: "e-postadresse", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO dato- og klokkeslett", + date: "ISO-dato", + time: "ISO-klokkeslett", + duration: "ISO-varighet", + ipv4: "IPv4-område", + ipv6: "IPv6-område", + cidrv4: "IPv4-spekter", + cidrv6: "IPv6-spekter", + base64: "base64-enkodet streng", + base64url: "base64url-enkodet streng", + json_string: "JSON-streng", + e164: "E.164-nummer", + jwt: "JWT", + template_literal: "input", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "tall", + array: "liste", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Ugyldig input: forventet instanceof ${issue.expected}, fikk ${received}`; + } + return `Ugyldig input: forventet ${expected}, fikk ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) return `Ugyldig verdi: forventet ${util.stringifyPrimitive(issue.values[0])}`; + return `Ugyldig valg: forventet en av ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `For stor(t): forventet ${issue.origin ?? "value"} til å ha ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementer"}`; + return `For stor(t): forventet ${issue.origin ?? "value"} til å ha ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `For lite(n): forventet ${issue.origin} til å ha ${adj}${issue.minimum.toString()} ${sizing.unit}`; + } + + return `For lite(n): forventet ${issue.origin} til å ha ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `Ugyldig streng: må starte med "${_issue.prefix}"`; + if (_issue.format === "ends_with") return `Ugyldig streng: må ende med "${_issue.suffix}"`; + if (_issue.format === "includes") return `Ugyldig streng: må inneholde "${_issue.includes}"`; + if (_issue.format === "regex") return `Ugyldig streng: må matche mønsteret ${_issue.pattern}`; + return `Ugyldig ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Ugyldig tall: må være et multiplum av ${issue.divisor}`; + case "unrecognized_keys": + return `${issue.keys.length > 1 ? "Ukjente nøkler" : "Ukjent nøkkel"}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Ugyldig nøkkel i ${issue.origin}`; + case "invalid_union": + return "Ugyldig input"; + case "invalid_element": + return `Ugyldig verdi i ${issue.origin}`; + default: + return `Ugyldig input`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ota.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ota.ts new file mode 100644 index 0000000000000000000000000000000000000000..d157d864db39b9329d5c0e306326b849fd772523 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ota.ts @@ -0,0 +1,117 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "harf", verb: "olmalıdır" }, + file: { unit: "bayt", verb: "olmalıdır" }, + array: { unit: "unsur", verb: "olmalıdır" }, + set: { unit: "unsur", verb: "olmalıdır" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "giren", + email: "epostagâh", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO hengâmı", + date: "ISO tarihi", + time: "ISO zamanı", + duration: "ISO müddeti", + ipv4: "IPv4 nişânı", + ipv6: "IPv6 nişânı", + cidrv4: "IPv4 menzili", + cidrv6: "IPv6 menzili", + base64: "base64-şifreli metin", + base64url: "base64url-şifreli metin", + json_string: "JSON metin", + e164: "E.164 sayısı", + jwt: "JWT", + template_literal: "giren", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "numara", + array: "saf", + null: "gayb", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Fâsit giren: umulan instanceof ${issue.expected}, alınan ${received}`; + } + return `Fâsit giren: umulan ${expected}, alınan ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) return `Fâsit giren: umulan ${util.stringifyPrimitive(issue.values[0])}`; + return `Fâsit tercih: mûteberler ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Fazla büyük: ${issue.origin ?? "value"}, ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"} sahip olmalıydı.`; + return `Fazla büyük: ${issue.origin ?? "value"}, ${adj}${issue.maximum.toString()} olmalıydı.`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Fazla küçük: ${issue.origin}, ${adj}${issue.minimum.toString()} ${sizing.unit} sahip olmalıydı.`; + } + + return `Fazla küçük: ${issue.origin}, ${adj}${issue.minimum.toString()} olmalıydı.`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `Fâsit metin: "${_issue.prefix}" ile başlamalı.`; + if (_issue.format === "ends_with") return `Fâsit metin: "${_issue.suffix}" ile bitmeli.`; + if (_issue.format === "includes") return `Fâsit metin: "${_issue.includes}" ihtivâ etmeli.`; + if (_issue.format === "regex") return `Fâsit metin: ${_issue.pattern} nakşına uymalı.`; + return `Fâsit ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Fâsit sayı: ${issue.divisor} katı olmalıydı.`; + case "unrecognized_keys": + return `Tanınmayan anahtar ${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `${issue.origin} için tanınmayan anahtar var.`; + case "invalid_union": + return "Giren tanınamadı."; + case "invalid_element": + return `${issue.origin} için tanınmayan kıymet var.`; + default: + return `Kıymet tanınamadı.`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/pl.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/pl.ts new file mode 100644 index 0000000000000000000000000000000000000000..df7a7c60ca660839db565b849b2f326c9e79b3bd --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/pl.ts @@ -0,0 +1,118 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "znaków", verb: "mieć" }, + file: { unit: "bajtów", verb: "mieć" }, + array: { unit: "elementów", verb: "mieć" }, + set: { unit: "elementów", verb: "mieć" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "wyrażenie", + email: "adres email", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "data i godzina w formacie ISO", + date: "data w formacie ISO", + time: "godzina w formacie ISO", + duration: "czas trwania ISO", + ipv4: "adres IPv4", + ipv6: "adres IPv6", + cidrv4: "zakres IPv4", + cidrv6: "zakres IPv6", + base64: "ciąg znaków zakodowany w formacie base64", + base64url: "ciąg znaków zakodowany w formacie base64url", + json_string: "ciąg znaków w formacie JSON", + e164: "liczba E.164", + jwt: "JWT", + template_literal: "wejście", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "liczba", + array: "tablica", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Nieprawidłowe dane wejściowe: oczekiwano instanceof ${issue.expected}, otrzymano ${received}`; + } + return `Nieprawidłowe dane wejściowe: oczekiwano ${expected}, otrzymano ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) + return `Nieprawidłowe dane wejściowe: oczekiwano ${util.stringifyPrimitive(issue.values[0])}`; + return `Nieprawidłowa opcja: oczekiwano jednej z wartości ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Za duża wartość: oczekiwano, że ${issue.origin ?? "wartość"} będzie mieć ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementów"}`; + } + return `Zbyt duż(y/a/e): oczekiwano, że ${issue.origin ?? "wartość"} będzie wynosić ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Za mała wartość: oczekiwano, że ${issue.origin ?? "wartość"} będzie mieć ${adj}${issue.minimum.toString()} ${sizing.unit ?? "elementów"}`; + } + return `Zbyt mał(y/a/e): oczekiwano, że ${issue.origin ?? "wartość"} będzie wynosić ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") + return `Nieprawidłowy ciąg znaków: musi zaczynać się od "${_issue.prefix}"`; + if (_issue.format === "ends_with") return `Nieprawidłowy ciąg znaków: musi kończyć się na "${_issue.suffix}"`; + if (_issue.format === "includes") return `Nieprawidłowy ciąg znaków: musi zawierać "${_issue.includes}"`; + if (_issue.format === "regex") return `Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${_issue.pattern}`; + return `Nieprawidłow(y/a/e) ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Nieprawidłowa liczba: musi być wielokrotnością ${issue.divisor}`; + case "unrecognized_keys": + return `Nierozpoznane klucze${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Nieprawidłowy klucz w ${issue.origin}`; + case "invalid_union": + return "Nieprawidłowe dane wejściowe"; + case "invalid_element": + return `Nieprawidłowa wartość w ${issue.origin}`; + default: + return `Nieprawidłowe dane wejściowe`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ps.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ps.ts new file mode 100644 index 0000000000000000000000000000000000000000..dc60fdd5038c51ee9d045c8b3b511f16556d24c3 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ps.ts @@ -0,0 +1,126 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "توکي", verb: "ولري" }, + file: { unit: "بایټس", verb: "ولري" }, + array: { unit: "توکي", verb: "ولري" }, + set: { unit: "توکي", verb: "ولري" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "ورودي", + email: "بریښنالیک", + url: "یو آر ال", + emoji: "ایموجي", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "نیټه او وخت", + date: "نېټه", + time: "وخت", + duration: "موده", + ipv4: "د IPv4 پته", + ipv6: "د IPv6 پته", + cidrv4: "د IPv4 ساحه", + cidrv6: "د IPv6 ساحه", + base64: "base64-encoded متن", + base64url: "base64url-encoded متن", + json_string: "JSON متن", + e164: "د E.164 شمېره", + jwt: "JWT", + template_literal: "ورودي", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "عدد", + array: "ارې", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `ناسم ورودي: باید instanceof ${issue.expected} وای, مګر ${received} ترلاسه شو`; + } + return `ناسم ورودي: باید ${expected} وای, مګر ${received} ترلاسه شو`; + } + case "invalid_value": + if (issue.values.length === 1) { + return `ناسم ورودي: باید ${util.stringifyPrimitive(issue.values[0])} وای`; + } + return `ناسم انتخاب: باید یو له ${util.joinValues(issue.values, "|")} څخه وای`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `ډیر لوی: ${issue.origin ?? "ارزښت"} باید ${adj}${issue.maximum.toString()} ${sizing.unit ?? "عنصرونه"} ولري`; + } + return `ډیر لوی: ${issue.origin ?? "ارزښت"} باید ${adj}${issue.maximum.toString()} وي`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `ډیر کوچنی: ${issue.origin} باید ${adj}${issue.minimum.toString()} ${sizing.unit} ولري`; + } + return `ډیر کوچنی: ${issue.origin} باید ${adj}${issue.minimum.toString()} وي`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") { + return `ناسم متن: باید د "${_issue.prefix}" سره پیل شي`; + } + if (_issue.format === "ends_with") { + return `ناسم متن: باید د "${_issue.suffix}" سره پای ته ورسيږي`; + } + if (_issue.format === "includes") { + return `ناسم متن: باید "${_issue.includes}" ولري`; + } + if (_issue.format === "regex") { + return `ناسم متن: باید د ${_issue.pattern} سره مطابقت ولري`; + } + return `${FormatDictionary[_issue.format] ?? issue.format} ناسم دی`; + } + case "not_multiple_of": + return `ناسم عدد: باید د ${issue.divisor} مضرب وي`; + case "unrecognized_keys": + return `ناسم ${issue.keys.length > 1 ? "کلیډونه" : "کلیډ"}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `ناسم کلیډ په ${issue.origin} کې`; + case "invalid_union": + return `ناسمه ورودي`; + case "invalid_element": + return `ناسم عنصر په ${issue.origin} کې`; + default: + return `ناسمه ورودي`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/pt.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/pt.ts new file mode 100644 index 0000000000000000000000000000000000000000..9ded285b58f5a09cc1a39748e91f4d7fd0a29283 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/pt.ts @@ -0,0 +1,116 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "caracteres", verb: "ter" }, + file: { unit: "bytes", verb: "ter" }, + array: { unit: "itens", verb: "ter" }, + set: { unit: "itens", verb: "ter" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "padrão", + email: "endereço de e-mail", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "data e hora ISO", + date: "data ISO", + time: "hora ISO", + duration: "duração ISO", + ipv4: "endereço IPv4", + ipv6: "endereço IPv6", + cidrv4: "faixa de IPv4", + cidrv6: "faixa de IPv6", + base64: "texto codificado em base64", + base64url: "URL codificada em base64", + json_string: "texto JSON", + e164: "número E.164", + jwt: "JWT", + template_literal: "entrada", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "número", + null: "nulo", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Tipo inválido: esperado instanceof ${issue.expected}, recebido ${received}`; + } + return `Tipo inválido: esperado ${expected}, recebido ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) return `Entrada inválida: esperado ${util.stringifyPrimitive(issue.values[0])}`; + return `Opção inválida: esperada uma das ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Muito grande: esperado que ${issue.origin ?? "valor"} tivesse ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementos"}`; + return `Muito grande: esperado que ${issue.origin ?? "valor"} fosse ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Muito pequeno: esperado que ${issue.origin} tivesse ${adj}${issue.minimum.toString()} ${sizing.unit}`; + } + + return `Muito pequeno: esperado que ${issue.origin} fosse ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `Texto inválido: deve começar com "${_issue.prefix}"`; + if (_issue.format === "ends_with") return `Texto inválido: deve terminar com "${_issue.suffix}"`; + if (_issue.format === "includes") return `Texto inválido: deve incluir "${_issue.includes}"`; + if (_issue.format === "regex") return `Texto inválido: deve corresponder ao padrão ${_issue.pattern}`; + return `${FormatDictionary[_issue.format] ?? issue.format} inválido`; + } + case "not_multiple_of": + return `Número inválido: deve ser múltiplo de ${issue.divisor}`; + case "unrecognized_keys": + return `Chave${issue.keys.length > 1 ? "s" : ""} desconhecida${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Chave inválida em ${issue.origin}`; + case "invalid_union": + return "Entrada inválida"; + case "invalid_element": + return `Valor inválido em ${issue.origin}`; + default: + return `Campo inválido`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ro.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ro.ts new file mode 100644 index 0000000000000000000000000000000000000000..8ac116dbd57b76fe5c44cd26fe4131943b7bc1f2 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ro.ts @@ -0,0 +1,129 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "caractere", verb: "să aibă" }, + file: { unit: "octeți", verb: "să aibă" }, + array: { unit: "elemente", verb: "să aibă" }, + set: { unit: "elemente", verb: "să aibă" }, + map: { unit: "intrări", verb: "să aibă" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "intrare", + email: "adresă de email", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "dată și oră ISO", + date: "dată ISO", + time: "oră ISO", + duration: "durată ISO", + ipv4: "adresă IPv4", + ipv6: "adresă IPv6", + mac: "adresă MAC", + cidrv4: "interval IPv4", + cidrv6: "interval IPv6", + base64: "șir codat base64", + base64url: "șir codat base64url", + json_string: "șir JSON", + e164: "număr E.164", + jwt: "JWT", + template_literal: "intrare", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + string: "șir", + number: "număr", + boolean: "boolean", + function: "funcție", + array: "matrice", + object: "obiect", + undefined: "nedefinit", + symbol: "simbol", + bigint: "număr mare", + void: "void", + never: "never", + map: "hartă", + set: "set", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + return `Intrare invalidă: așteptat ${expected}, primit ${received}`; + } + + case "invalid_value": + if (issue.values.length === 1) return `Intrare invalidă: așteptat ${util.stringifyPrimitive(issue.values[0])}`; + return `Opțiune invalidă: așteptat una dintre ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Prea mare: așteptat ca ${issue.origin ?? "valoarea"} ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elemente"}`; + return `Prea mare: așteptat ca ${issue.origin ?? "valoarea"} să fie ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Prea mic: așteptat ca ${issue.origin} ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`; + } + + return `Prea mic: așteptat ca ${issue.origin} să fie ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") { + return `Șir invalid: trebuie să înceapă cu "${_issue.prefix}"`; + } + if (_issue.format === "ends_with") return `Șir invalid: trebuie să se termine cu "${_issue.suffix}"`; + if (_issue.format === "includes") return `Șir invalid: trebuie să includă "${_issue.includes}"`; + if (_issue.format === "regex") return `Șir invalid: trebuie să se potrivească cu modelul ${_issue.pattern}`; + return `Format invalid: ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Număr invalid: trebuie să fie multiplu de ${issue.divisor}`; + case "unrecognized_keys": + return `Chei nerecunoscute: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Cheie invalidă în ${issue.origin}`; + case "invalid_union": + return "Intrare invalidă"; + case "invalid_element": + return `Valoare invalidă în ${issue.origin}`; + default: + return `Intrare invalidă`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ru.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ru.ts new file mode 100644 index 0000000000000000000000000000000000000000..cf223db405a8ca5fee6914613edc3ba6415cab9f --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ru.ts @@ -0,0 +1,176 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +function getRussianPlural(count: number, one: string, few: string, many: string): string { + const absCount = Math.abs(count); + const lastDigit = absCount % 10; + const lastTwoDigits = absCount % 100; + + if (lastTwoDigits >= 11 && lastTwoDigits <= 19) { + return many; + } + + if (lastDigit === 1) { + return one; + } + + if (lastDigit >= 2 && lastDigit <= 4) { + return few; + } + + return many; +} + +interface RussianSizable { + unit: { + one: string; + few: string; + many: string; + }; + verb: string; +} +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { + unit: { + one: "символ", + few: "символа", + many: "символов", + }, + verb: "иметь", + }, + file: { + unit: { + one: "байт", + few: "байта", + many: "байт", + }, + verb: "иметь", + }, + array: { + unit: { + one: "элемент", + few: "элемента", + many: "элементов", + }, + verb: "иметь", + }, + set: { + unit: { + one: "элемент", + few: "элемента", + many: "элементов", + }, + verb: "иметь", + }, + }; + + function getSizing(origin: string): RussianSizable | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "ввод", + email: "email адрес", + url: "URL", + emoji: "эмодзи", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO дата и время", + date: "ISO дата", + time: "ISO время", + duration: "ISO длительность", + ipv4: "IPv4 адрес", + ipv6: "IPv6 адрес", + cidrv4: "IPv4 диапазон", + cidrv6: "IPv6 диапазон", + base64: "строка в формате base64", + base64url: "строка в формате base64url", + json_string: "JSON строка", + e164: "номер E.164", + jwt: "JWT", + template_literal: "ввод", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "число", + array: "массив", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Неверный ввод: ожидалось instanceof ${issue.expected}, получено ${received}`; + } + return `Неверный ввод: ожидалось ${expected}, получено ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) return `Неверный ввод: ожидалось ${util.stringifyPrimitive(issue.values[0])}`; + return `Неверный вариант: ожидалось одно из ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) { + const maxValue = Number(issue.maximum); + const unit = getRussianPlural(maxValue, sizing.unit.one, sizing.unit.few, sizing.unit.many); + return `Слишком большое значение: ожидалось, что ${issue.origin ?? "значение"} будет иметь ${adj}${issue.maximum.toString()} ${unit}`; + } + return `Слишком большое значение: ожидалось, что ${issue.origin ?? "значение"} будет ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + const minValue = Number(issue.minimum); + const unit = getRussianPlural(minValue, sizing.unit.one, sizing.unit.few, sizing.unit.many); + return `Слишком маленькое значение: ожидалось, что ${issue.origin} будет иметь ${adj}${issue.minimum.toString()} ${unit}`; + } + return `Слишком маленькое значение: ожидалось, что ${issue.origin} будет ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `Неверная строка: должна начинаться с "${_issue.prefix}"`; + if (_issue.format === "ends_with") return `Неверная строка: должна заканчиваться на "${_issue.suffix}"`; + if (_issue.format === "includes") return `Неверная строка: должна содержать "${_issue.includes}"`; + if (_issue.format === "regex") return `Неверная строка: должна соответствовать шаблону ${_issue.pattern}`; + return `Неверный ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Неверное число: должно быть кратным ${issue.divisor}`; + case "unrecognized_keys": + return `Нераспознанн${issue.keys.length > 1 ? "ые" : "ый"} ключ${issue.keys.length > 1 ? "и" : ""}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Неверный ключ в ${issue.origin}`; + case "invalid_union": + return "Неверные входные данные"; + case "invalid_element": + return `Неверное значение в ${issue.origin}`; + default: + return `Неверные входные данные`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/sl.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/sl.ts new file mode 100644 index 0000000000000000000000000000000000000000..1b83c44349f94b5cc16dd38eb18196133528ffee --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/sl.ts @@ -0,0 +1,118 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "znakov", verb: "imeti" }, + file: { unit: "bajtov", verb: "imeti" }, + array: { unit: "elementov", verb: "imeti" }, + set: { unit: "elementov", verb: "imeti" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "vnos", + email: "e-poštni naslov", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO datum in čas", + date: "ISO datum", + time: "ISO čas", + duration: "ISO trajanje", + ipv4: "IPv4 naslov", + ipv6: "IPv6 naslov", + cidrv4: "obseg IPv4", + cidrv6: "obseg IPv6", + base64: "base64 kodiran niz", + base64url: "base64url kodiran niz", + json_string: "JSON niz", + e164: "E.164 številka", + jwt: "JWT", + template_literal: "vnos", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "število", + array: "tabela", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Neveljaven vnos: pričakovano instanceof ${issue.expected}, prejeto ${received}`; + } + return `Neveljaven vnos: pričakovano ${expected}, prejeto ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) + return `Neveljaven vnos: pričakovano ${util.stringifyPrimitive(issue.values[0])}`; + return `Neveljavna možnost: pričakovano eno izmed ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Preveliko: pričakovano, da bo ${issue.origin ?? "vrednost"} imelo ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementov"}`; + return `Preveliko: pričakovano, da bo ${issue.origin ?? "vrednost"} ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Premajhno: pričakovano, da bo ${issue.origin} imelo ${adj}${issue.minimum.toString()} ${sizing.unit}`; + } + return `Premajhno: pričakovano, da bo ${issue.origin} ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") { + return `Neveljaven niz: mora se začeti z "${_issue.prefix}"`; + } + if (_issue.format === "ends_with") return `Neveljaven niz: mora se končati z "${_issue.suffix}"`; + if (_issue.format === "includes") return `Neveljaven niz: mora vsebovati "${_issue.includes}"`; + if (_issue.format === "regex") return `Neveljaven niz: mora ustrezati vzorcu ${_issue.pattern}`; + return `Neveljaven ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Neveljavno število: mora biti večkratnik ${issue.divisor}`; + case "unrecognized_keys": + return `Neprepoznan${issue.keys.length > 1 ? "i ključi" : " ključ"}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Neveljaven ključ v ${issue.origin}`; + case "invalid_union": + return "Neveljaven vnos"; + case "invalid_element": + return `Neveljavna vrednost v ${issue.origin}`; + default: + return "Neveljaven vnos"; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/sv.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/sv.ts new file mode 100644 index 0000000000000000000000000000000000000000..a25aed8f23b900aac9f1fef0639bd8663b073394 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/sv.ts @@ -0,0 +1,119 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "tecken", verb: "att ha" }, + file: { unit: "bytes", verb: "att ha" }, + array: { unit: "objekt", verb: "att innehålla" }, + set: { unit: "objekt", verb: "att innehålla" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "reguljärt uttryck", + email: "e-postadress", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO-datum och tid", + date: "ISO-datum", + time: "ISO-tid", + duration: "ISO-varaktighet", + ipv4: "IPv4-intervall", + ipv6: "IPv6-intervall", + cidrv4: "IPv4-spektrum", + cidrv6: "IPv6-spektrum", + base64: "base64-kodad sträng", + base64url: "base64url-kodad sträng", + json_string: "JSON-sträng", + e164: "E.164-nummer", + jwt: "JWT", + template_literal: "mall-literal", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "antal", + array: "lista", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Ogiltig inmatning: förväntat instanceof ${issue.expected}, fick ${received}`; + } + return `Ogiltig inmatning: förväntat ${expected}, fick ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) + return `Ogiltig inmatning: förväntat ${util.stringifyPrimitive(issue.values[0])}`; + return `Ogiltigt val: förväntade en av ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `För stor(t): förväntade ${issue.origin ?? "värdet"} att ha ${adj}${issue.maximum.toString()} ${sizing.unit ?? "element"}`; + } + return `För stor(t): förväntat ${issue.origin ?? "värdet"} att ha ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `För lite(t): förväntade ${issue.origin ?? "värdet"} att ha ${adj}${issue.minimum.toString()} ${sizing.unit}`; + } + return `För lite(t): förväntade ${issue.origin ?? "värdet"} att ha ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") { + return `Ogiltig sträng: måste börja med "${_issue.prefix}"`; + } + if (_issue.format === "ends_with") return `Ogiltig sträng: måste sluta med "${_issue.suffix}"`; + if (_issue.format === "includes") return `Ogiltig sträng: måste innehålla "${_issue.includes}"`; + if (_issue.format === "regex") return `Ogiltig sträng: måste matcha mönstret "${_issue.pattern}"`; + return `Ogiltig(t) ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Ogiltigt tal: måste vara en multipel av ${issue.divisor}`; + case "unrecognized_keys": + return `${issue.keys.length > 1 ? "Okända nycklar" : "Okänd nyckel"}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Ogiltig nyckel i ${issue.origin ?? "värdet"}`; + case "invalid_union": + return "Ogiltig input"; + case "invalid_element": + return `Ogiltigt värde i ${issue.origin ?? "värdet"}`; + default: + return `Ogiltig input`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ta.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ta.ts new file mode 100644 index 0000000000000000000000000000000000000000..ea83f8b7aa1e742c3f79eeeb7d42fc8cf1384bb3 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ta.ts @@ -0,0 +1,118 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "எழுத்துக்கள்", verb: "கொண்டிருக்க வேண்டும்" }, + file: { unit: "பைட்டுகள்", verb: "கொண்டிருக்க வேண்டும்" }, + array: { unit: "உறுப்புகள்", verb: "கொண்டிருக்க வேண்டும்" }, + set: { unit: "உறுப்புகள்", verb: "கொண்டிருக்க வேண்டும்" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "உள்ளீடு", + email: "மின்னஞ்சல் முகவரி", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO தேதி நேரம்", + date: "ISO தேதி", + time: "ISO நேரம்", + duration: "ISO கால அளவு", + ipv4: "IPv4 முகவரி", + ipv6: "IPv6 முகவரி", + cidrv4: "IPv4 வரம்பு", + cidrv6: "IPv6 வரம்பு", + base64: "base64-encoded சரம்", + base64url: "base64url-encoded சரம்", + json_string: "JSON சரம்", + e164: "E.164 எண்", + jwt: "JWT", + template_literal: "input", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "எண்", + array: "அணி", + null: "வெறுமை", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${issue.expected}, பெறப்பட்டது ${received}`; + } + return `தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${expected}, பெறப்பட்டது ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) return `தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${util.stringifyPrimitive(issue.values[0])}`; + return `தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${util.joinValues(issue.values, "|")} இல் ஒன்று`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `மிக பெரியது: எதிர்பார்க்கப்பட்டது ${issue.origin ?? "மதிப்பு"} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "உறுப்புகள்"} ஆக இருக்க வேண்டும்`; + } + return `மிக பெரியது: எதிர்பார்க்கப்பட்டது ${issue.origin ?? "மதிப்பு"} ${adj}${issue.maximum.toString()} ஆக இருக்க வேண்டும்`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit} ஆக இருக்க வேண்டும்`; // + } + + return `மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${issue.origin} ${adj}${issue.minimum.toString()} ஆக இருக்க வேண்டும்`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `தவறான சரம்: "${_issue.prefix}" இல் தொடங்க வேண்டும்`; + if (_issue.format === "ends_with") return `தவறான சரம்: "${_issue.suffix}" இல் முடிவடைய வேண்டும்`; + if (_issue.format === "includes") return `தவறான சரம்: "${_issue.includes}" ஐ உள்ளடக்க வேண்டும்`; + if (_issue.format === "regex") return `தவறான சரம்: ${_issue.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`; + return `தவறான ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `தவறான எண்: ${issue.divisor} இன் பலமாக இருக்க வேண்டும்`; + case "unrecognized_keys": + return `அடையாளம் தெரியாத விசை${issue.keys.length > 1 ? "கள்" : ""}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `${issue.origin} இல் தவறான விசை`; + case "invalid_union": + return "தவறான உள்ளீடு"; + case "invalid_element": + return `${issue.origin} இல் தவறான மதிப்பு`; + default: + return `தவறான உள்ளீடு`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/th.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/th.ts new file mode 100644 index 0000000000000000000000000000000000000000..47f435154ba38100dab422f689b34c65a0e0b548 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/th.ts @@ -0,0 +1,119 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "ตัวอักษร", verb: "ควรมี" }, + file: { unit: "ไบต์", verb: "ควรมี" }, + array: { unit: "รายการ", verb: "ควรมี" }, + set: { unit: "รายการ", verb: "ควรมี" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "ข้อมูลที่ป้อน", + email: "ที่อยู่อีเมล", + url: "URL", + emoji: "อิโมจิ", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "วันที่เวลาแบบ ISO", + date: "วันที่แบบ ISO", + time: "เวลาแบบ ISO", + duration: "ช่วงเวลาแบบ ISO", + ipv4: "ที่อยู่ IPv4", + ipv6: "ที่อยู่ IPv6", + cidrv4: "ช่วง IP แบบ IPv4", + cidrv6: "ช่วง IP แบบ IPv6", + base64: "ข้อความแบบ Base64", + base64url: "ข้อความแบบ Base64 สำหรับ URL", + json_string: "ข้อความแบบ JSON", + e164: "เบอร์โทรศัพท์ระหว่างประเทศ (E.164)", + jwt: "โทเคน JWT", + template_literal: "ข้อมูลที่ป้อน", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "ตัวเลข", + array: "อาร์เรย์ (Array)", + null: "ไม่มีค่า (null)", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น instanceof ${issue.expected} แต่ได้รับ ${received}`; + } + return `ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${expected} แต่ได้รับ ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) return `ค่าไม่ถูกต้อง: ควรเป็น ${util.stringifyPrimitive(issue.values[0])}`; + return `ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "ไม่เกิน" : "น้อยกว่า"; + const sizing = getSizing(issue.origin); + if (sizing) + return `เกินกำหนด: ${issue.origin ?? "ค่า"} ควรมี${adj} ${issue.maximum.toString()} ${sizing.unit ?? "รายการ"}`; + return `เกินกำหนด: ${issue.origin ?? "ค่า"} ควรมี${adj} ${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? "อย่างน้อย" : "มากกว่า"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `น้อยกว่ากำหนด: ${issue.origin} ควรมี${adj} ${issue.minimum.toString()} ${sizing.unit}`; + } + + return `น้อยกว่ากำหนด: ${issue.origin} ควรมี${adj} ${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") { + return `รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${_issue.prefix}"`; + } + if (_issue.format === "ends_with") return `รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${_issue.suffix}"`; + if (_issue.format === "includes") return `รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${_issue.includes}" อยู่ในข้อความ`; + if (_issue.format === "regex") return `รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${_issue.pattern}`; + return `รูปแบบไม่ถูกต้อง: ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${issue.divisor} ได้ลงตัว`; + case "unrecognized_keys": + return `พบคีย์ที่ไม่รู้จัก: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `คีย์ไม่ถูกต้องใน ${issue.origin}`; + case "invalid_union": + return "ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้"; + case "invalid_element": + return `ข้อมูลไม่ถูกต้องใน ${issue.origin}`; + default: + return `ข้อมูลไม่ถูกต้อง`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/tr.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/tr.ts new file mode 100644 index 0000000000000000000000000000000000000000..2bc578d7b20a6c5c7ab7e34d5f591812165b1eae --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/tr.ts @@ -0,0 +1,111 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "karakter", verb: "olmalı" }, + file: { unit: "bayt", verb: "olmalı" }, + array: { unit: "öğe", verb: "olmalı" }, + set: { unit: "öğe", verb: "olmalı" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "girdi", + email: "e-posta adresi", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO tarih ve saat", + date: "ISO tarih", + time: "ISO saat", + duration: "ISO süre", + ipv4: "IPv4 adresi", + ipv6: "IPv6 adresi", + cidrv4: "IPv4 aralığı", + cidrv6: "IPv6 aralığı", + base64: "base64 ile şifrelenmiş metin", + base64url: "base64url ile şifrelenmiş metin", + json_string: "JSON dizesi", + e164: "E.164 sayısı", + jwt: "JWT", + template_literal: "Şablon dizesi", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Geçersiz değer: beklenen instanceof ${issue.expected}, alınan ${received}`; + } + return `Geçersiz değer: beklenen ${expected}, alınan ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) return `Geçersiz değer: beklenen ${util.stringifyPrimitive(issue.values[0])}`; + return `Geçersiz seçenek: aşağıdakilerden biri olmalı: ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Çok büyük: beklenen ${issue.origin ?? "değer"} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "öğe"}`; + return `Çok büyük: beklenen ${issue.origin ?? "değer"} ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) return `Çok küçük: beklenen ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit}`; + return `Çok küçük: beklenen ${issue.origin} ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `Geçersiz metin: "${_issue.prefix}" ile başlamalı`; + if (_issue.format === "ends_with") return `Geçersiz metin: "${_issue.suffix}" ile bitmeli`; + if (_issue.format === "includes") return `Geçersiz metin: "${_issue.includes}" içermeli`; + if (_issue.format === "regex") return `Geçersiz metin: ${_issue.pattern} desenine uymalı`; + return `Geçersiz ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Geçersiz sayı: ${issue.divisor} ile tam bölünebilmeli`; + case "unrecognized_keys": + return `Tanınmayan anahtar${issue.keys.length > 1 ? "lar" : ""}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `${issue.origin} içinde geçersiz anahtar`; + case "invalid_union": + return "Geçersiz değer"; + case "invalid_element": + return `${issue.origin} içinde geçersiz değer`; + default: + return `Geçersiz değer`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ua.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ua.ts new file mode 100644 index 0000000000000000000000000000000000000000..e43526272e9c345dc603b4e4918b85f22ef97ad6 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ua.ts @@ -0,0 +1,7 @@ +import type * as errors from "../core/errors.js"; +import uk from "./uk.js"; + +/** @deprecated Use `uk` instead. */ +export default function (): { localeError: errors.$ZodErrorMap } { + return uk(); +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/uk.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/uk.ts new file mode 100644 index 0000000000000000000000000000000000000000..424e2f3b2fd266404b4e9b3eeccab75043e8479a --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/uk.ts @@ -0,0 +1,117 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "символів", verb: "матиме" }, + file: { unit: "байтів", verb: "матиме" }, + array: { unit: "елементів", verb: "матиме" }, + set: { unit: "елементів", verb: "матиме" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "вхідні дані", + email: "адреса електронної пошти", + url: "URL", + emoji: "емодзі", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "дата та час ISO", + date: "дата ISO", + time: "час ISO", + duration: "тривалість ISO", + ipv4: "адреса IPv4", + ipv6: "адреса IPv6", + cidrv4: "діапазон IPv4", + cidrv6: "діапазон IPv6", + base64: "рядок у кодуванні base64", + base64url: "рядок у кодуванні base64url", + json_string: "рядок JSON", + e164: "номер E.164", + jwt: "JWT", + template_literal: "вхідні дані", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "число", + array: "масив", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Неправильні вхідні дані: очікується instanceof ${issue.expected}, отримано ${received}`; + } + return `Неправильні вхідні дані: очікується ${expected}, отримано ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) + return `Неправильні вхідні дані: очікується ${util.stringifyPrimitive(issue.values[0])}`; + return `Неправильна опція: очікується одне з ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Занадто велике: очікується, що ${issue.origin ?? "значення"} ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "елементів"}`; + return `Занадто велике: очікується, що ${issue.origin ?? "значення"} буде ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Занадто мале: очікується, що ${issue.origin} ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`; + } + + return `Занадто мале: очікується, що ${issue.origin} буде ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `Неправильний рядок: повинен починатися з "${_issue.prefix}"`; + if (_issue.format === "ends_with") return `Неправильний рядок: повинен закінчуватися на "${_issue.suffix}"`; + if (_issue.format === "includes") return `Неправильний рядок: повинен містити "${_issue.includes}"`; + if (_issue.format === "regex") return `Неправильний рядок: повинен відповідати шаблону ${_issue.pattern}`; + return `Неправильний ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Неправильне число: повинно бути кратним ${issue.divisor}`; + case "unrecognized_keys": + return `Нерозпізнаний ключ${issue.keys.length > 1 ? "і" : ""}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Неправильний ключ у ${issue.origin}`; + case "invalid_union": + return "Неправильні вхідні дані"; + case "invalid_element": + return `Неправильне значення у ${issue.origin}`; + default: + return `Неправильні вхідні дані`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ur.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ur.ts new file mode 100644 index 0000000000000000000000000000000000000000..86f4cb2022d529f2122708f366ee118e97dbafee --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/ur.ts @@ -0,0 +1,119 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "حروف", verb: "ہونا" }, + file: { unit: "بائٹس", verb: "ہونا" }, + array: { unit: "آئٹمز", verb: "ہونا" }, + set: { unit: "آئٹمز", verb: "ہونا" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "ان پٹ", + email: "ای میل ایڈریس", + url: "یو آر ایل", + emoji: "ایموجی", + uuid: "یو یو آئی ڈی", + uuidv4: "یو یو آئی ڈی وی 4", + uuidv6: "یو یو آئی ڈی وی 6", + nanoid: "نینو آئی ڈی", + guid: "جی یو آئی ڈی", + cuid: "سی یو آئی ڈی", + cuid2: "سی یو آئی ڈی 2", + ulid: "یو ایل آئی ڈی", + xid: "ایکس آئی ڈی", + ksuid: "کے ایس یو آئی ڈی", + datetime: "آئی ایس او ڈیٹ ٹائم", + date: "آئی ایس او تاریخ", + time: "آئی ایس او وقت", + duration: "آئی ایس او مدت", + ipv4: "آئی پی وی 4 ایڈریس", + ipv6: "آئی پی وی 6 ایڈریس", + cidrv4: "آئی پی وی 4 رینج", + cidrv6: "آئی پی وی 6 رینج", + base64: "بیس 64 ان کوڈڈ سٹرنگ", + base64url: "بیس 64 یو آر ایل ان کوڈڈ سٹرنگ", + json_string: "جے ایس او این سٹرنگ", + e164: "ای 164 نمبر", + jwt: "جے ڈبلیو ٹی", + template_literal: "ان پٹ", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "نمبر", + array: "آرے", + null: "نل", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `غلط ان پٹ: instanceof ${issue.expected} متوقع تھا، ${received} موصول ہوا`; + } + return `غلط ان پٹ: ${expected} متوقع تھا، ${received} موصول ہوا`; + } + case "invalid_value": + if (issue.values.length === 1) return `غلط ان پٹ: ${util.stringifyPrimitive(issue.values[0])} متوقع تھا`; + return `غلط آپشن: ${util.joinValues(issue.values, "|")} میں سے ایک متوقع تھا`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `بہت بڑا: ${issue.origin ?? "ویلیو"} کے ${adj}${issue.maximum.toString()} ${sizing.unit ?? "عناصر"} ہونے متوقع تھے`; + return `بہت بڑا: ${issue.origin ?? "ویلیو"} کا ${adj}${issue.maximum.toString()} ہونا متوقع تھا`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `بہت چھوٹا: ${issue.origin} کے ${adj}${issue.minimum.toString()} ${sizing.unit} ہونے متوقع تھے`; + } + + return `بہت چھوٹا: ${issue.origin} کا ${adj}${issue.minimum.toString()} ہونا متوقع تھا`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") { + return `غلط سٹرنگ: "${_issue.prefix}" سے شروع ہونا چاہیے`; + } + if (_issue.format === "ends_with") return `غلط سٹرنگ: "${_issue.suffix}" پر ختم ہونا چاہیے`; + if (_issue.format === "includes") return `غلط سٹرنگ: "${_issue.includes}" شامل ہونا چاہیے`; + if (_issue.format === "regex") return `غلط سٹرنگ: پیٹرن ${_issue.pattern} سے میچ ہونا چاہیے`; + return `غلط ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `غلط نمبر: ${issue.divisor} کا مضاعف ہونا چاہیے`; + case "unrecognized_keys": + return `غیر تسلیم شدہ کی${issue.keys.length > 1 ? "ز" : ""}: ${util.joinValues(issue.keys, "، ")}`; + case "invalid_key": + return `${issue.origin} میں غلط کی`; + case "invalid_union": + return "غلط ان پٹ"; + case "invalid_element": + return `${issue.origin} میں غلط ویلیو`; + default: + return `غلط ان پٹ`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/uz.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/uz.ts new file mode 100644 index 0000000000000000000000000000000000000000..08b690eb1203213212ab556eff7fb5d79e1682dc --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/uz.ts @@ -0,0 +1,117 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "belgi", verb: "bo‘lishi kerak" }, + file: { unit: "bayt", verb: "bo‘lishi kerak" }, + array: { unit: "element", verb: "bo‘lishi kerak" }, + set: { unit: "element", verb: "bo‘lishi kerak" }, + map: { unit: "yozuv", verb: "bo‘lishi kerak" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "kirish", + email: "elektron pochta manzili", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO sana va vaqti", + date: "ISO sana", + time: "ISO vaqt", + duration: "ISO davomiylik", + ipv4: "IPv4 manzil", + ipv6: "IPv6 manzil", + mac: "MAC manzil", + cidrv4: "IPv4 diapazon", + cidrv6: "IPv6 diapazon", + base64: "base64 kodlangan satr", + base64url: "base64url kodlangan satr", + json_string: "JSON satr", + e164: "E.164 raqam", + jwt: "JWT", + template_literal: "kirish", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "raqam", + array: "massiv", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Noto‘g‘ri kirish: kutilgan instanceof ${issue.expected}, qabul qilingan ${received}`; + } + return `Noto‘g‘ri kirish: kutilgan ${expected}, qabul qilingan ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) return `Noto‘g‘ri kirish: kutilgan ${util.stringifyPrimitive(issue.values[0])}`; + return `Noto‘g‘ri variant: quyidagilardan biri kutilgan ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Juda katta: kutilgan ${issue.origin ?? "qiymat"} ${adj}${issue.maximum.toString()} ${sizing.unit} ${sizing.verb}`; + return `Juda katta: kutilgan ${issue.origin ?? "qiymat"} ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Juda kichik: kutilgan ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit} ${sizing.verb}`; + } + return `Juda kichik: kutilgan ${issue.origin} ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `Noto‘g‘ri satr: "${_issue.prefix}" bilan boshlanishi kerak`; + if (_issue.format === "ends_with") return `Noto‘g‘ri satr: "${_issue.suffix}" bilan tugashi kerak`; + if (_issue.format === "includes") return `Noto‘g‘ri satr: "${_issue.includes}" ni o‘z ichiga olishi kerak`; + if (_issue.format === "regex") return `Noto‘g‘ri satr: ${_issue.pattern} shabloniga mos kelishi kerak`; + return `Noto‘g‘ri ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `Noto‘g‘ri raqam: ${issue.divisor} ning karralisi bo‘lishi kerak`; + case "unrecognized_keys": + return `Noma’lum kalit${issue.keys.length > 1 ? "lar" : ""}: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `${issue.origin} dagi kalit noto‘g‘ri`; + case "invalid_union": + return "Noto‘g‘ri kirish"; + case "invalid_element": + return `${issue.origin} da noto‘g‘ri qiymat`; + default: + return `Noto‘g‘ri kirish`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/vi.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/vi.ts new file mode 100644 index 0000000000000000000000000000000000000000..673594d1a83eb1a199fe5866b9a5cb6ce04126c7 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/vi.ts @@ -0,0 +1,117 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "ký tự", verb: "có" }, + file: { unit: "byte", verb: "có" }, + array: { unit: "phần tử", verb: "có" }, + set: { unit: "phần tử", verb: "có" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "đầu vào", + email: "địa chỉ email", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ngày giờ ISO", + date: "ngày ISO", + time: "giờ ISO", + duration: "khoảng thời gian ISO", + ipv4: "địa chỉ IPv4", + ipv6: "địa chỉ IPv6", + cidrv4: "dải IPv4", + cidrv6: "dải IPv6", + base64: "chuỗi mã hóa base64", + base64url: "chuỗi mã hóa base64url", + json_string: "chuỗi JSON", + e164: "số E.164", + jwt: "JWT", + template_literal: "đầu vào", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "số", + array: "mảng", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Đầu vào không hợp lệ: mong đợi instanceof ${issue.expected}, nhận được ${received}`; + } + return `Đầu vào không hợp lệ: mong đợi ${expected}, nhận được ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) + return `Đầu vào không hợp lệ: mong đợi ${util.stringifyPrimitive(issue.values[0])}`; + return `Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Quá lớn: mong đợi ${issue.origin ?? "giá trị"} ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "phần tử"}`; + return `Quá lớn: mong đợi ${issue.origin ?? "giá trị"} ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `Quá nhỏ: mong đợi ${issue.origin} ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`; + } + + return `Quá nhỏ: mong đợi ${issue.origin} ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `Chuỗi không hợp lệ: phải bắt đầu bằng "${_issue.prefix}"`; + if (_issue.format === "ends_with") return `Chuỗi không hợp lệ: phải kết thúc bằng "${_issue.suffix}"`; + if (_issue.format === "includes") return `Chuỗi không hợp lệ: phải bao gồm "${_issue.includes}"`; + if (_issue.format === "regex") return `Chuỗi không hợp lệ: phải khớp với mẫu ${_issue.pattern}`; + return `${FormatDictionary[_issue.format] ?? issue.format} không hợp lệ`; + } + case "not_multiple_of": + return `Số không hợp lệ: phải là bội số của ${issue.divisor}`; + case "unrecognized_keys": + return `Khóa không được nhận dạng: ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `Khóa không hợp lệ trong ${issue.origin}`; + case "invalid_union": + return "Đầu vào không hợp lệ"; + case "invalid_element": + return `Giá trị không hợp lệ trong ${issue.origin}`; + default: + return `Đầu vào không hợp lệ`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/yo.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/yo.ts new file mode 100644 index 0000000000000000000000000000000000000000..c821d229c98d66e3caac1a8fb4c5611a81e94ca2 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/yo.ts @@ -0,0 +1,124 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "àmi", verb: "ní" }, + file: { unit: "bytes", verb: "ní" }, + array: { unit: "nkan", verb: "ní" }, + set: { unit: "nkan", verb: "ní" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "ẹ̀rọ ìbáwọlé", + email: "àdírẹ́sì ìmẹ́lì", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "àkókò ISO", + date: "ọjọ́ ISO", + time: "àkókò ISO", + duration: "àkókò tó pé ISO", + ipv4: "àdírẹ́sì IPv4", + ipv6: "àdírẹ́sì IPv6", + cidrv4: "àgbègbè IPv4", + cidrv6: "àgbègbè IPv6", + base64: "ọ̀rọ̀ tí a kọ́ ní base64", + base64url: "ọ̀rọ̀ base64url", + json_string: "ọ̀rọ̀ JSON", + e164: "nọ́mbà E.164", + jwt: "JWT", + template_literal: "ẹ̀rọ ìbáwọlé", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "nọ́mbà", + array: "akopọ", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${issue.expected}, àmọ̀ a rí ${received}`; + } + return `Ìbáwọlé aṣìṣe: a ní láti fi ${expected}, àmọ̀ a rí ${received}`; + } + + case "invalid_value": + if (issue.values.length === 1) return `Ìbáwọlé aṣìṣe: a ní láti fi ${util.stringifyPrimitive(issue.values[0])}`; + return `Àṣàyàn aṣìṣe: yan ọ̀kan lára ${util.joinValues(issue.values, "|")}`; + + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Tó pọ̀ jù: a ní láti jẹ́ pé ${issue.origin ?? "iye"} ${sizing.verb} ${adj}${issue.maximum} ${sizing.unit}`; + return `Tó pọ̀ jù: a ní láti jẹ́ ${adj}${issue.maximum}`; + } + + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) + return `Kéré ju: a ní láti jẹ́ pé ${issue.origin} ${sizing.verb} ${adj}${issue.minimum} ${sizing.unit}`; + return `Kéré ju: a ní láti jẹ́ ${adj}${issue.minimum}`; + } + + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${_issue.prefix}"`; + if (_issue.format === "ends_with") return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${_issue.suffix}"`; + if (_issue.format === "includes") return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${_issue.includes}"`; + if (_issue.format === "regex") return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${_issue.pattern}`; + return `Aṣìṣe: ${FormatDictionary[_issue.format] ?? issue.format}`; + } + + case "not_multiple_of": + return `Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${issue.divisor}`; + + case "unrecognized_keys": + return `Bọtìnì àìmọ̀: ${util.joinValues(issue.keys, ", ")}`; + + case "invalid_key": + return `Bọtìnì aṣìṣe nínú ${issue.origin}`; + + case "invalid_union": + return "Ìbáwọlé aṣìṣe"; + + case "invalid_element": + return `Iye aṣìṣe nínú ${issue.origin}`; + + default: + return "Ìbáwọlé aṣìṣe"; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/zh-CN.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/zh-CN.ts new file mode 100644 index 0000000000000000000000000000000000000000..728759ad8ac06d4fef7ea3eca33fcfcfc220b303 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/zh-CN.ts @@ -0,0 +1,116 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "字符", verb: "包含" }, + file: { unit: "字节", verb: "包含" }, + array: { unit: "项", verb: "包含" }, + set: { unit: "项", verb: "包含" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "输入", + email: "电子邮件", + url: "URL", + emoji: "表情符号", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO日期时间", + date: "ISO日期", + time: "ISO时间", + duration: "ISO时长", + ipv4: "IPv4地址", + ipv6: "IPv6地址", + cidrv4: "IPv4网段", + cidrv6: "IPv6网段", + base64: "base64编码字符串", + base64url: "base64url编码字符串", + json_string: "JSON字符串", + e164: "E.164号码", + jwt: "JWT", + template_literal: "输入", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + number: "数字", + array: "数组", + null: "空值(null)", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `无效输入:期望 instanceof ${issue.expected},实际接收 ${received}`; + } + return `无效输入:期望 ${expected},实际接收 ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) return `无效输入:期望 ${util.stringifyPrimitive(issue.values[0])}`; + return `无效选项:期望以下之一 ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `数值过大:期望 ${issue.origin ?? "值"} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "个元素"}`; + return `数值过大:期望 ${issue.origin ?? "值"} ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `数值过小:期望 ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit}`; + } + return `数值过小:期望 ${issue.origin} ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") return `无效字符串:必须以 "${_issue.prefix}" 开头`; + if (_issue.format === "ends_with") return `无效字符串:必须以 "${_issue.suffix}" 结尾`; + if (_issue.format === "includes") return `无效字符串:必须包含 "${_issue.includes}"`; + if (_issue.format === "regex") return `无效字符串:必须满足正则表达式 ${_issue.pattern}`; + return `无效${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `无效数字:必须是 ${issue.divisor} 的倍数`; + case "unrecognized_keys": + return `出现未知的键(key): ${util.joinValues(issue.keys, ", ")}`; + case "invalid_key": + return `${issue.origin} 中的键(key)无效`; + case "invalid_union": + return "无效输入"; + case "invalid_element": + return `${issue.origin} 中包含无效值(value)`; + default: + return `无效输入`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/zh-TW.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/zh-TW.ts new file mode 100644 index 0000000000000000000000000000000000000000..62a02defb2433aba12d420c0f0670a6e6f47e5a5 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/locales/zh-TW.ts @@ -0,0 +1,115 @@ +import type { $ZodStringFormats } from "../core/checks.js"; +import type * as errors from "../core/errors.js"; +import * as util from "../core/util.js"; + +const error: () => errors.$ZodErrorMap = () => { + const Sizable: Record = { + string: { unit: "字元", verb: "擁有" }, + file: { unit: "位元組", verb: "擁有" }, + array: { unit: "項目", verb: "擁有" }, + set: { unit: "項目", verb: "擁有" }, + }; + + function getSizing(origin: string): { unit: string; verb: string } | null { + return Sizable[origin] ?? null; + } + + const FormatDictionary: { + [k in $ZodStringFormats | (string & {})]?: string; + } = { + regex: "輸入", + email: "郵件地址", + url: "URL", + emoji: "emoji", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO 日期時間", + date: "ISO 日期", + time: "ISO 時間", + duration: "ISO 期間", + ipv4: "IPv4 位址", + ipv6: "IPv6 位址", + cidrv4: "IPv4 範圍", + cidrv6: "IPv6 範圍", + base64: "base64 編碼字串", + base64url: "base64url 編碼字串", + json_string: "JSON 字串", + e164: "E.164 數值", + jwt: "JWT", + template_literal: "輸入", + }; + + const TypeDictionary: { + [k in errors.$ZodInvalidTypeExpected | (string & {})]?: string; + } = { + nan: "NaN", + }; + + return (issue) => { + switch (issue.code) { + case "invalid_type": { + const expected = TypeDictionary[issue.expected] ?? issue.expected; + const receivedType = util.parsedType(issue.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue.expected)) { + return `無效的輸入值:預期為 instanceof ${issue.expected},但收到 ${received}`; + } + return `無效的輸入值:預期為 ${expected},但收到 ${received}`; + } + case "invalid_value": + if (issue.values.length === 1) return `無效的輸入值:預期為 ${util.stringifyPrimitive(issue.values[0])}`; + return `無效的選項:預期為以下其中之一 ${util.joinValues(issue.values, "|")}`; + case "too_big": { + const adj = issue.inclusive ? "<=" : "<"; + const sizing = getSizing(issue.origin); + if (sizing) + return `數值過大:預期 ${issue.origin ?? "值"} 應為 ${adj}${issue.maximum.toString()} ${sizing.unit ?? "個元素"}`; + return `數值過大:預期 ${issue.origin ?? "值"} 應為 ${adj}${issue.maximum.toString()}`; + } + case "too_small": { + const adj = issue.inclusive ? ">=" : ">"; + const sizing = getSizing(issue.origin); + if (sizing) { + return `數值過小:預期 ${issue.origin} 應為 ${adj}${issue.minimum.toString()} ${sizing.unit}`; + } + return `數值過小:預期 ${issue.origin} 應為 ${adj}${issue.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue as errors.$ZodStringFormatIssues; + if (_issue.format === "starts_with") { + return `無效的字串:必須以 "${_issue.prefix}" 開頭`; + } + if (_issue.format === "ends_with") return `無效的字串:必須以 "${_issue.suffix}" 結尾`; + if (_issue.format === "includes") return `無效的字串:必須包含 "${_issue.includes}"`; + if (_issue.format === "regex") return `無效的字串:必須符合格式 ${_issue.pattern}`; + return `無效的 ${FormatDictionary[_issue.format] ?? issue.format}`; + } + case "not_multiple_of": + return `無效的數字:必須為 ${issue.divisor} 的倍數`; + case "unrecognized_keys": + return `無法識別的鍵值${issue.keys.length > 1 ? "們" : ""}:${util.joinValues(issue.keys, "、")}`; + case "invalid_key": + return `${issue.origin} 中有無效的鍵值`; + case "invalid_union": + return "無效的輸入值"; + case "invalid_element": + return `${issue.origin} 中有無效的值`; + default: + return `無效的輸入值`; + } + }; +}; + +export default function (): { localeError: errors.$ZodErrorMap } { + return { + localeError: error(), + }; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/mini/checks.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/mini/checks.ts new file mode 100644 index 0000000000000000000000000000000000000000..c3e47c642aa457fb318325ab2c6847dfd5cc3f06 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/mini/checks.ts @@ -0,0 +1,32 @@ +export { + _lt as lt, + _lte as lte, + _lte as maximum, + _gt as gt, + _gte as gte, + _gte as minimum, + _positive as positive, + _negative as negative, + _nonpositive as nonpositive, + _nonnegative as nonnegative, + _multipleOf as multipleOf, + _maxSize as maxSize, + _minSize as minSize, + _size as size, + _maxLength as maxLength, + _minLength as minLength, + _length as length, + _regex as regex, + _lowercase as lowercase, + _uppercase as uppercase, + _includes as includes, + _startsWith as startsWith, + _endsWith as endsWith, + _property as property, + _mime as mime, + _overwrite as overwrite, + _normalize as normalize, + _trim as trim, + _toLowerCase as toLowerCase, + _toUpperCase as toUpperCase, +} from "../core/index.js"; diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/mini/coerce.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/mini/coerce.ts new file mode 100644 index 0000000000000000000000000000000000000000..79ff95c3a2e679a6ae35b711c666512cb177deaa --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/mini/coerce.ts @@ -0,0 +1,27 @@ +import * as core from "../core/index.js"; +import * as schemas from "./schemas.js"; + +// @__NO_SIDE_EFFECTS__ +export function string(params?: string | core.$ZodStringParams): schemas.ZodMiniString { + return core._coercedString(schemas.ZodMiniString, params) as schemas.ZodMiniString; +} + +// @__NO_SIDE_EFFECTS__ +export function number(params?: string | core.$ZodNumberParams): schemas.ZodMiniNumber { + return core._coercedNumber(schemas.ZodMiniNumber, params) as schemas.ZodMiniNumber; +} + +// @__NO_SIDE_EFFECTS__ +export function boolean(params?: string | core.$ZodBooleanParams): schemas.ZodMiniBoolean { + return core._coercedBoolean(schemas.ZodMiniBoolean, params) as schemas.ZodMiniBoolean; +} + +// @__NO_SIDE_EFFECTS__ +export function bigint(params?: string | core.$ZodBigIntParams): schemas.ZodMiniBigInt { + return core._coercedBigint(schemas.ZodMiniBigInt, params) as schemas.ZodMiniBigInt; +} + +// @__NO_SIDE_EFFECTS__ +export function date(params?: string | core.$ZodDateParams): schemas.ZodMiniDate { + return core._coercedDate(schemas.ZodMiniDate, params) as schemas.ZodMiniDate; +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/mini/external.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/mini/external.ts new file mode 100644 index 0000000000000000000000000000000000000000..67661e9e81a2752cb013fcf0176f4a7f51d68a5e --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/mini/external.ts @@ -0,0 +1,41 @@ +export * as core from "../core/index.js"; +export * from "./parse.js"; +export * from "./schemas.js"; +export * from "./checks.js"; + +export type { infer, output, input } from "../core/index.js"; +export type { JSONType } from "../core/util.js"; +export { + globalRegistry, + registry, + config, + $output, + $input, + $brand, + clone, + regexes, + treeifyError, + prettifyError, + formatError, + flattenError, + TimePrecision, + util, + NEVER, +} from "../core/index.js"; +export { toJSONSchema } from "../core/json-schema-processors.js"; + +export * as locales from "../locales/index.js"; +/** A special constant with type `never` */ +// export const NEVER = {} as never; + +// iso +export * as iso from "./iso.js"; +export { + ZodMiniISODateTime, + ZodMiniISODate, + ZodMiniISOTime, + ZodMiniISODuration, +} from "./iso.js"; + +// coerce +export * as coerce from "./coerce.js"; diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/mini/index.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/mini/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..f6c2a264981d92dee01551b7236a648a958f728a --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/mini/index.ts @@ -0,0 +1,3 @@ +import * as z from "./external.js"; +export * from "./external.js"; +export { z }; diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/mini/iso.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/mini/iso.ts new file mode 100644 index 0000000000000000000000000000000000000000..55569ee60e3edc948f845bf0168e87703fa55207 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/mini/iso.ts @@ -0,0 +1,66 @@ +import * as core from "../core/index.js"; +import * as schemas from "./schemas.js"; + +// iso time +export interface ZodMiniISODateTime extends schemas.ZodMiniStringFormat<"datetime"> { + _zod: core.$ZodISODateTimeInternals; +} +export const ZodMiniISODateTime: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniISODateTime", + (inst, def) => { + core.$ZodISODateTime.init(inst, def); + schemas.ZodMiniStringFormat.init(inst, def); + } +); +// @__NO_SIDE_EFFECTS__ +export function datetime(params?: string | core.$ZodISODateTimeParams): ZodMiniISODateTime { + return core._isoDateTime(ZodMiniISODateTime, params); +} + +// iso date +export interface ZodMiniISODate extends schemas.ZodMiniStringFormat<"date"> { + _zod: core.$ZodISODateInternals; +} +export const ZodMiniISODate: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniISODate", + (inst, def) => { + core.$ZodISODate.init(inst, def); + schemas.ZodMiniStringFormat.init(inst, def); + } +); +// @__NO_SIDE_EFFECTS__ +export function date(params?: string | core.$ZodISODateParams): ZodMiniISODate { + return core._isoDate(ZodMiniISODate, params); +} + +// iso time +export interface ZodMiniISOTime extends schemas.ZodMiniStringFormat<"time"> { + _zod: core.$ZodISOTimeInternals; +} +export const ZodMiniISOTime: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniISOTime", + (inst, def) => { + core.$ZodISOTime.init(inst, def); + schemas.ZodMiniStringFormat.init(inst, def); + } +); +// @__NO_SIDE_EFFECTS__ +export function time(params?: string | core.$ZodISOTimeParams): ZodMiniISOTime { + return core._isoTime(ZodMiniISOTime, params); +} + +// iso duration +export interface ZodMiniISODuration extends schemas.ZodMiniStringFormat<"duration"> { + _zod: core.$ZodISODurationInternals; +} +export const ZodMiniISODuration: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniISODuration", + (inst, def) => { + core.$ZodISODuration.init(inst, def); + schemas.ZodMiniStringFormat.init(inst, def); + } +); +// @__NO_SIDE_EFFECTS__ +export function duration(params?: string | core.$ZodISODurationParams): ZodMiniISODuration { + return core._isoDuration(ZodMiniISODuration, params); +} diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/mini/parse.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/mini/parse.ts new file mode 100644 index 0000000000000000000000000000000000000000..d4d1ee2f15742251c67c3454814364c2d69e1b4b --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/mini/parse.ts @@ -0,0 +1,14 @@ +export { + parse, + safeParse, + parseAsync, + safeParseAsync, + encode, + decode, + encodeAsync, + decodeAsync, + safeEncode, + safeDecode, + safeEncodeAsync, + safeDecodeAsync, +} from "../core/index.js"; diff --git a/loan-advisor-chatgpt-app/node_modules/zod/src/v4/mini/schemas.ts b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/mini/schemas.ts new file mode 100644 index 0000000000000000000000000000000000000000..38978a03d5aaa21b2dd79904c7cbe8da03874a35 --- /dev/null +++ b/loan-advisor-chatgpt-app/node_modules/zod/src/v4/mini/schemas.ts @@ -0,0 +1,1947 @@ +import * as core from "../core/index.js"; +import * as util from "../core/util.js"; +import * as parse from "./parse.js"; + +type SomeType = core.SomeType; + +export interface ZodMiniType< + out Output = unknown, + out Input = unknown, + out Internals extends core.$ZodTypeInternals = core.$ZodTypeInternals, +> extends core.$ZodType { + type: Internals["def"]["type"]; + check(...checks: (core.CheckFn> | core.$ZodCheck>)[]): this; + with(...checks: (core.CheckFn> | core.$ZodCheck>)[]): this; + clone(def?: Internals["def"], params?: { parent: boolean }): this; + register( + registry: R, + ...meta: this extends R["_schema"] + ? undefined extends R["_meta"] + ? [core.$replace?] + : [core.$replace] + : ["Incompatible schema"] + ): this; + brand( + value?: T + ): PropertyKey extends T ? this : core.$ZodBranded; + + def: Internals["def"]; + + parse(data: unknown, params?: core.ParseContext): core.output; + safeParse(data: unknown, params?: core.ParseContext): util.SafeParseResult>; + parseAsync(data: unknown, params?: core.ParseContext): Promise>; + safeParseAsync( + data: unknown, + params?: core.ParseContext + ): Promise>>; + apply(fn: (schema: this) => T): T; +} + +interface _ZodMiniType + extends ZodMiniType {} + +export const ZodMiniType: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniType", + (inst, def) => { + if (!inst._zod) throw new Error("Uninitialized schema in ZodMiniType."); + + core.$ZodType.init(inst, def); + + inst.def = def; + inst.type = def.type; + inst.parse = (data, params) => parse.parse(inst, data, params, { callee: inst.parse }); + inst.safeParse = (data, params) => parse.safeParse(inst, data, params); + inst.parseAsync = async (data, params) => parse.parseAsync(inst, data, params, { callee: inst.parseAsync }); + inst.safeParseAsync = async (data, params) => parse.safeParseAsync(inst, data, params); + inst.check = (...checks) => { + return inst.clone( + { + ...def, + checks: [ + ...(def.checks ?? []), + ...checks.map((ch) => + typeof ch === "function" + ? { + _zod: { check: ch, def: { check: "custom" }, onattach: [] }, + } + : ch + ), + ], + }, + { parent: true } + ); + }; + inst.with = inst.check; + inst.clone = (_def, params) => core.clone(inst, _def, params); + inst.brand = () => inst as any; + inst.register = ((reg: any, meta: any) => { + reg.add(inst, meta); + return inst; + }) as any; + inst.apply = (fn) => fn(inst); + } +); + +export interface _ZodMiniString = core.$ZodStringInternals> + extends _ZodMiniType, + core.$ZodString { + _zod: T; +} + +// ZodMiniString +export interface ZodMiniString + extends _ZodMiniString>, + core.$ZodString {} +export const ZodMiniString: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniString", + (inst, def) => { + core.$ZodString.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function string(params?: string | core.$ZodStringParams): ZodMiniString { + return core._string(ZodMiniString, params) as any; +} + +// ZodMiniStringFormat +export interface ZodMiniStringFormat + extends _ZodMiniString>, + core.$ZodStringFormat { + // _zod: core.$ZodStringFormatInternals; +} +export const ZodMiniStringFormat: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniStringFormat", + (inst, def) => { + core.$ZodStringFormat.init(inst, def); + ZodMiniString.init(inst, def); + } +); + +// ZodMiniEmail +export interface ZodMiniEmail extends _ZodMiniString {} +export const ZodMiniEmail: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniEmail", + (inst, def) => { + core.$ZodEmail.init(inst, def); + ZodMiniStringFormat.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function email(params?: string | core.$ZodEmailParams): ZodMiniEmail { + return core._email(ZodMiniEmail, params); +} + +// ZodMiniGUID +export interface ZodMiniGUID extends _ZodMiniString { + // _zod: core.$ZodGUIDInternals; +} +export const ZodMiniGUID: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniGUID", + (inst, def) => { + core.$ZodGUID.init(inst, def); + ZodMiniStringFormat.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function guid(params?: string | core.$ZodGUIDParams): ZodMiniGUID { + return core._guid(ZodMiniGUID, params); +} + +// ZodMiniUUID +export interface ZodMiniUUID extends _ZodMiniString { + // _zod: core.$ZodUUIDInternals; +} +export const ZodMiniUUID: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniUUID", + (inst, def) => { + core.$ZodUUID.init(inst, def); + ZodMiniStringFormat.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function uuid(params?: string | core.$ZodUUIDParams): ZodMiniUUID { + return core._uuid(ZodMiniUUID, params); +} + +// @__NO_SIDE_EFFECTS__ +export function uuidv4(params?: string | core.$ZodUUIDv4Params): ZodMiniUUID { + return core._uuidv4(ZodMiniUUID, params); +} + +// ZodMiniUUIDv6 + +// @__NO_SIDE_EFFECTS__ +export function uuidv6(params?: string | core.$ZodUUIDv6Params): ZodMiniUUID { + return core._uuidv6(ZodMiniUUID, params); +} + +// ZodMiniUUIDv7 + +// @__NO_SIDE_EFFECTS__ +export function uuidv7(params?: string | core.$ZodUUIDv7Params): ZodMiniUUID { + return core._uuidv7(ZodMiniUUID, params); +} + +// ZodMiniURL +export interface ZodMiniURL extends _ZodMiniString { + // _zod: core.$ZodURLInternals; +} +export const ZodMiniURL: core.$constructor = /*@__PURE__*/ core.$constructor("ZodMiniURL", (inst, def) => { + core.$ZodURL.init(inst, def); + ZodMiniStringFormat.init(inst, def); +}); + +// @__NO_SIDE_EFFECTS__ +export function url(params?: string | core.$ZodURLParams): ZodMiniURL { + return core._url(ZodMiniURL, params); +} + +// @__NO_SIDE_EFFECTS__ +export function httpUrl(params?: string | Omit): ZodMiniURL { + return core._url(ZodMiniURL, { + protocol: core.regexes.httpProtocol, + hostname: core.regexes.domain, + ...util.normalizeParams(params), + }); +} + +// ZodMiniEmoji +export interface ZodMiniEmoji extends _ZodMiniString { + // _zod: core.$ZodEmojiInternals; +} +export const ZodMiniEmoji: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniEmoji", + (inst, def) => { + core.$ZodEmoji.init(inst, def); + ZodMiniStringFormat.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function emoji(params?: string | core.$ZodEmojiParams): ZodMiniEmoji { + return core._emoji(ZodMiniEmoji, params); +} + +// ZodMiniNanoID +export interface ZodMiniNanoID extends _ZodMiniString { + // _zod: core.$ZodNanoIDInternals; +} +export const ZodMiniNanoID: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniNanoID", + (inst, def) => { + core.$ZodNanoID.init(inst, def); + ZodMiniStringFormat.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function nanoid(params?: string | core.$ZodNanoIDParams): ZodMiniNanoID { + return core._nanoid(ZodMiniNanoID, params); +} + +// ZodMiniCUID +/** + * @deprecated CUID v1 is deprecated by its authors due to information leakage + * (timestamps embedded in the id). Use {@link ZodMiniCUID2} instead. + * See https://github.com/paralleldrive/cuid. + */ +export interface ZodMiniCUID extends _ZodMiniString { + // _zod: core.$ZodCUIDInternals; +} +/** + * @deprecated CUID v1 is deprecated by its authors due to information leakage + * (timestamps embedded in the id). Use {@link ZodMiniCUID2} instead. + * See https://github.com/paralleldrive/cuid. + */ +export const ZodMiniCUID: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniCUID", + (inst, def) => { + core.$ZodCUID.init(inst, def); + ZodMiniStringFormat.init(inst, def); + } +); + +/** + * Validates a CUID v1 string. + * + * @deprecated CUID v1 is deprecated by its authors due to information leakage + * (timestamps embedded in the id). Use {@link cuid2 | `z.cuid2()`} instead. + * See https://github.com/paralleldrive/cuid. + */ +// @__NO_SIDE_EFFECTS__ +export function cuid(params?: string | core.$ZodCUIDParams): ZodMiniCUID { + return core._cuid(ZodMiniCUID, params); +} + +// ZodMiniCUID2 +export interface ZodMiniCUID2 extends _ZodMiniString { + // _zod: core.$ZodCUID2Internals; +} +export const ZodMiniCUID2: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniCUID2", + (inst, def) => { + core.$ZodCUID2.init(inst, def); + ZodMiniStringFormat.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function cuid2(params?: string | core.$ZodCUID2Params): ZodMiniCUID2 { + return core._cuid2(ZodMiniCUID2, params); +} + +// ZodMiniULID +export interface ZodMiniULID extends _ZodMiniString { + // _zod: core.$ZodULIDInternals; +} +export const ZodMiniULID: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniULID", + (inst, def) => { + core.$ZodULID.init(inst, def); + ZodMiniStringFormat.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function ulid(params?: string | core.$ZodULIDParams): ZodMiniULID { + return core._ulid(ZodMiniULID, params); +} + +// ZodMiniXID +export interface ZodMiniXID extends _ZodMiniString { + // _zod: core.$ZodXIDInternals; +} +export const ZodMiniXID: core.$constructor = /*@__PURE__*/ core.$constructor("ZodMiniXID", (inst, def) => { + core.$ZodXID.init(inst, def); + ZodMiniStringFormat.init(inst, def); +}); + +// @__NO_SIDE_EFFECTS__ +export function xid(params?: string | core.$ZodXIDParams): ZodMiniXID { + return core._xid(ZodMiniXID, params); +} + +// ZodMiniKSUID +export interface ZodMiniKSUID extends _ZodMiniString { + // _zod: core.$ZodKSUIDInternals; +} +export const ZodMiniKSUID: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniKSUID", + (inst, def) => { + core.$ZodKSUID.init(inst, def); + ZodMiniStringFormat.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function ksuid(params?: string | core.$ZodKSUIDParams): ZodMiniKSUID { + return core._ksuid(ZodMiniKSUID, params); +} + +// ZodMiniIPv4 +export interface ZodMiniIPv4 extends _ZodMiniString { + // _zod: core.$ZodIPv4Internals; +} +export const ZodMiniIPv4: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniIPv4", + (inst, def) => { + core.$ZodIPv4.init(inst, def); + ZodMiniStringFormat.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function ipv4(params?: string | core.$ZodIPv4Params): ZodMiniIPv4 { + return core._ipv4(ZodMiniIPv4, params); +} + +// ZodMiniIPv6 +export interface ZodMiniIPv6 extends _ZodMiniString { + // _zod: core.$ZodIPv6Internals; +} +export const ZodMiniIPv6: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniIPv6", + (inst, def) => { + core.$ZodIPv6.init(inst, def); + ZodMiniStringFormat.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function ipv6(params?: string | core.$ZodIPv6Params): ZodMiniIPv6 { + return core._ipv6(ZodMiniIPv6, params); +} + +// ZodMiniCIDRv4 +export interface ZodMiniCIDRv4 extends _ZodMiniString { + // _zod: core.$ZodCIDRv4Internals; +} +export const ZodMiniCIDRv4: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniCIDRv4", + (inst, def) => { + core.$ZodCIDRv4.init(inst, def); + ZodMiniStringFormat.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function cidrv4(params?: string | core.$ZodCIDRv4Params): ZodMiniCIDRv4 { + return core._cidrv4(ZodMiniCIDRv4, params); +} + +// ZodMiniCIDRv6 +export interface ZodMiniCIDRv6 extends _ZodMiniString { + // _zod: core.$ZodCIDRv6Internals; +} +export const ZodMiniCIDRv6: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniCIDRv6", + (inst, def) => { + core.$ZodCIDRv6.init(inst, def); + ZodMiniStringFormat.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function cidrv6(params?: string | core.$ZodCIDRv6Params): ZodMiniCIDRv6 { + return core._cidrv6(ZodMiniCIDRv6, params); +} + +// ZodMiniMAC +export interface ZodMiniMAC extends _ZodMiniString { + // _zod: core.$ZodMACInternals; +} +export const ZodMiniMAC: core.$constructor = /*@__PURE__*/ core.$constructor("ZodMiniMAC", (inst, def) => { + core.$ZodMAC.init(inst, def); + ZodMiniStringFormat.init(inst, def); +}); + +// @__NO_SIDE_EFFECTS__ +export function mac(params?: string | core.$ZodMACParams): ZodMiniMAC { + return core._mac(ZodMiniMAC, params); +} + +// ZodMiniBase64 +export interface ZodMiniBase64 extends _ZodMiniString { + // _zod: core.$ZodBase64Internals; +} +export const ZodMiniBase64: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniBase64", + (inst, def) => { + core.$ZodBase64.init(inst, def); + ZodMiniStringFormat.init(inst, def); + } +); +// @__NO_SIDE_EFFECTS__ +export function base64(params?: string | core.$ZodBase64Params): ZodMiniBase64 { + return core._base64(ZodMiniBase64, params); +} + +// ZodMiniBase64URL +export interface ZodMiniBase64URL extends _ZodMiniString { + // _zod: core.$ZodBase64URLInternals; +} +export const ZodMiniBase64URL: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniBase64URL", + (inst, def) => { + core.$ZodBase64URL.init(inst, def); + ZodMiniStringFormat.init(inst, def); + } +); +// @__NO_SIDE_EFFECTS__ +export function base64url(params?: string | core.$ZodBase64URLParams): ZodMiniBase64URL { + return core._base64url(ZodMiniBase64URL, params); +} + +// ZodMiniE164 +export interface ZodMiniE164 extends _ZodMiniString { + // _zod: core.$ZodE164Internals; +} +export const ZodMiniE164: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniE164", + (inst, def) => { + core.$ZodE164.init(inst, def); + ZodMiniStringFormat.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function e164(params?: string | core.$ZodE164Params): ZodMiniE164 { + return core._e164(ZodMiniE164, params); +} + +// ZodMiniJWT +export interface ZodMiniJWT extends _ZodMiniString { + // _zod: core.$ZodJWTInternals; +} +export const ZodMiniJWT: core.$constructor = /*@__PURE__*/ core.$constructor("ZodMiniJWT", (inst, def) => { + core.$ZodJWT.init(inst, def); + ZodMiniStringFormat.init(inst, def); +}); + +// @__NO_SIDE_EFFECTS__ +export function jwt(params?: string | core.$ZodJWTParams): ZodMiniJWT { + return core._jwt(ZodMiniJWT, params); +} + +// ZodMiniCustomStringFormat +export interface ZodMiniCustomStringFormat + extends ZodMiniStringFormat, + core.$ZodCustomStringFormat { + _zod: core.$ZodCustomStringFormatInternals; +} +export const ZodMiniCustomStringFormat: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniCustomStringFormat", + (inst, def) => { + core.$ZodCustomStringFormat.init(inst, def); + ZodMiniStringFormat.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function stringFormat( + format: Format, + fnOrRegex: ((arg: string) => util.MaybeAsync) | RegExp, + _params: string | core.$ZodStringFormatParams = {} +): ZodMiniCustomStringFormat { + return core._stringFormat(ZodMiniCustomStringFormat, format, fnOrRegex, _params) as any; +} + +// @__NO_SIDE_EFFECTS__ +export function hostname(_params?: string | core.$ZodStringFormatParams): ZodMiniCustomStringFormat<"hostname"> { + return core._stringFormat(ZodMiniCustomStringFormat, "hostname", core.regexes.hostname, _params) as any; +} + +// @__NO_SIDE_EFFECTS__ +export function hex(_params?: string | core.$ZodStringFormatParams): ZodMiniCustomStringFormat<"hex"> { + return core._stringFormat(ZodMiniCustomStringFormat, "hex", core.regexes.hex, _params) as any; +} + +// @__NO_SIDE_EFFECTS__ +export function hash( + alg: Alg, + params?: { + enc?: Enc; + } & core.$ZodStringFormatParams +): ZodMiniCustomStringFormat<`${Alg}_${Enc}`> { + const enc = params?.enc ?? "hex"; + const format = `${alg}_${enc}` as const; + const regex = core.regexes[format as keyof typeof core.regexes] as RegExp; + // check for unrecognized format + if (!regex) throw new Error(`Unrecognized hash format: ${format}`); + return core._stringFormat(ZodMiniCustomStringFormat, format, regex, params) as any; +} + +// ZodMiniNumber +interface _ZodMiniNumber = core.$ZodNumberInternals> + extends _ZodMiniType, + core.$ZodNumber { + _zod: T; +} +export interface ZodMiniNumber + extends _ZodMiniNumber>, + core.$ZodNumber {} +export const ZodMiniNumber: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniNumber", + (inst, def) => { + core.$ZodNumber.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function number(params?: string | core.$ZodNumberParams): ZodMiniNumber { + return core._number(ZodMiniNumber, params) as any; +} + +// ZodMiniNumberFormat +export interface ZodMiniNumberFormat extends _ZodMiniNumber, core.$ZodNumberFormat {} +export const ZodMiniNumberFormat: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniNumberFormat", + (inst, def) => { + core.$ZodNumberFormat.init(inst, def); + ZodMiniNumber.init(inst, def); + } +); + +// int + +// @__NO_SIDE_EFFECTS__ +export function int(params?: string | core.$ZodCheckNumberFormatParams): ZodMiniNumberFormat { + return core._int(ZodMiniNumberFormat, params); +} + +// float32 + +// @__NO_SIDE_EFFECTS__ +export function float32(params?: string | core.$ZodCheckNumberFormatParams): ZodMiniNumberFormat { + return core._float32(ZodMiniNumberFormat, params); +} + +// float64 + +// @__NO_SIDE_EFFECTS__ +export function float64(params?: string | core.$ZodCheckNumberFormatParams): ZodMiniNumberFormat { + return core._float64(ZodMiniNumberFormat, params); +} + +// int32 + +// @__NO_SIDE_EFFECTS__ +export function int32(params?: string | core.$ZodCheckNumberFormatParams): ZodMiniNumberFormat { + return core._int32(ZodMiniNumberFormat, params); +} + +// uint32 + +// @__NO_SIDE_EFFECTS__ +export function uint32(params?: string | core.$ZodCheckNumberFormatParams): ZodMiniNumberFormat { + return core._uint32(ZodMiniNumberFormat, params); +} + +// ZodMiniBoolean +export interface ZodMiniBoolean extends _ZodMiniType> { + // _zod: core.$ZodBooleanInternals; +} +export const ZodMiniBoolean: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniBoolean", + (inst, def) => { + core.$ZodBoolean.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function boolean(params?: string | core.$ZodBooleanParams): ZodMiniBoolean { + return core._boolean(ZodMiniBoolean, params) as any; +} + +// ZodMiniBigInt +export interface ZodMiniBigInt extends _ZodMiniType>, core.$ZodBigInt { + // _zod: core.$ZodBigIntInternals; +} +export const ZodMiniBigInt: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniBigInt", + (inst, def) => { + core.$ZodBigInt.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function bigint(params?: string | core.$ZodBigIntParams): ZodMiniBigInt { + return core._bigint(ZodMiniBigInt, params) as any; +} + +// bigint formats + +// ZodMiniBigIntFormat +export interface ZodMiniBigIntFormat extends _ZodMiniType { + // _zod: core.$ZodBigIntFormatInternals; +} +export const ZodMiniBigIntFormat: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniBigIntFormat", + (inst, def) => { + core.$ZodBigIntFormat.init(inst, def); + ZodMiniBigInt.init(inst, def); + } +); + +// int64 + +// @__NO_SIDE_EFFECTS__ +export function int64(params?: string | core.$ZodBigIntFormatParams): ZodMiniBigIntFormat { + return core._int64(ZodMiniBigIntFormat, params); +} + +// uint64 + +// @__NO_SIDE_EFFECTS__ +export function uint64(params?: string | core.$ZodBigIntFormatParams): ZodMiniBigIntFormat { + return core._uint64(ZodMiniBigIntFormat, params); +} + +// ZodMiniSymbol +export interface ZodMiniSymbol extends _ZodMiniType { + // _zod: core.$ZodSymbolInternals; +} +export const ZodMiniSymbol: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniSymbol", + (inst, def) => { + core.$ZodSymbol.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function symbol(params?: string | core.$ZodSymbolParams): ZodMiniSymbol { + return core._symbol(ZodMiniSymbol, params) as any; +} + +// ZodMiniUndefined +export interface ZodMiniUndefined extends _ZodMiniType { + // _zod: core.$ZodUndefinedInternals; +} +export const ZodMiniUndefined: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniUndefined", + (inst, def) => { + core.$ZodUndefined.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +function _undefined(params?: string | core.$ZodUndefinedParams): ZodMiniUndefined { + return core._undefined(ZodMiniUndefined, params) as any; +} +export { _undefined as undefined }; + +// ZodMiniNull +export interface ZodMiniNull extends _ZodMiniType { + // _zod: core.$ZodNullInternals; +} +export const ZodMiniNull: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniNull", + (inst, def) => { + core.$ZodNull.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +function _null(params?: string | core.$ZodNullParams): ZodMiniNull { + return core._null(ZodMiniNull, params) as any; +} +export { _null as null }; + +// ZodMiniAny +export interface ZodMiniAny extends _ZodMiniType { + // _zod: core.$ZodAnyInternals; +} +export const ZodMiniAny: core.$constructor = /*@__PURE__*/ core.$constructor("ZodMiniAny", (inst, def) => { + core.$ZodAny.init(inst, def); + ZodMiniType.init(inst, def); +}); + +// @__NO_SIDE_EFFECTS__ +export function any(): ZodMiniAny { + return core._any(ZodMiniAny) as any; +} + +// ZodMiniUnknown +export interface ZodMiniUnknown extends _ZodMiniType { + // _zod: core.$ZodUnknownInternals; +} +export const ZodMiniUnknown: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniUnknown", + (inst, def) => { + core.$ZodUnknown.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function unknown(): ZodMiniUnknown { + return core._unknown(ZodMiniUnknown) as any; +} + +// ZodMiniNever +export interface ZodMiniNever extends _ZodMiniType { + // _zod: core.$ZodNeverInternals; +} +export const ZodMiniNever: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniNever", + (inst, def) => { + core.$ZodNever.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function never(params?: string | core.$ZodNeverParams): ZodMiniNever { + return core._never(ZodMiniNever, params) as any; +} + +// ZodMiniVoid +export interface ZodMiniVoid extends _ZodMiniType { + // _zod: core.$ZodVoidInternals; +} +export const ZodMiniVoid: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniVoid", + (inst, def) => { + core.$ZodVoid.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +function _void(params?: string | core.$ZodVoidParams): ZodMiniVoid { + return core._void(ZodMiniVoid, params) as any; +} +export { _void as void }; + +// ZodMiniDate +export interface ZodMiniDate extends _ZodMiniType> { + // _zod: core.$ZodDateInternals; +} + +export const ZodMiniDate: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniDate", + (inst, def) => { + core.$ZodDate.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function date(params?: string | core.$ZodDateParams): ZodMiniDate { + return core._date(ZodMiniDate, params) as any; +} + +// ZodMiniArray +export interface ZodMiniArray + extends _ZodMiniType>, + core.$ZodArray { + // _zod: core.$ZodArrayInternals; +} +export const ZodMiniArray: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniArray", + (inst, def) => { + core.$ZodArray.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +export function array(element: T, params?: string | core.$ZodArrayParams): ZodMiniArray; +// @__NO_SIDE_EFFECTS__ +export function array(element: SomeType, params?: any): ZodMiniArray { + return new ZodMiniArray({ + type: "array", + element: element as core.$ZodType, + ...util.normalizeParams(params), + }) as any; +} + +// .keyof +// @__NO_SIDE_EFFECTS__ +export function keyof(schema: T): ZodMiniEnum> { + const shape = schema._zod.def.shape; + return _enum(Object.keys(shape)) as any; +} + +// ZodMiniObject +export interface ZodMiniObject< + /** @ts-ignore Cast variance */ + out Shape extends core.$ZodShape = core.$ZodShape, + out Config extends core.$ZodObjectConfig = core.$strip, +> extends ZodMiniType>, + core.$ZodObject { + shape: Shape; +} +export const ZodMiniObject: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniObject", + (inst, def) => { + core.$ZodObject.init(inst, def); + ZodMiniType.init(inst, def); + util.defineLazy(inst, "shape", () => def.shape); + } +); +// @__NO_SIDE_EFFECTS__ +export function object>( + shape?: T, + params?: string | core.$ZodObjectParams +): ZodMiniObject, core.$strip> { + const def: core.$ZodObjectDef = { + type: "object", + shape: shape ?? {}, + ...util.normalizeParams(params), + }; + return new ZodMiniObject(def) as any; +} + +// strictObject +// @__NO_SIDE_EFFECTS__ +export function strictObject( + shape: T, + params?: string | core.$ZodObjectParams +): ZodMiniObject, core.$strict> { + return new ZodMiniObject({ + type: "object", + shape, + catchall: never(), + ...util.normalizeParams(params), + }) as any; +} + +// looseObject +// @__NO_SIDE_EFFECTS__ +export function looseObject( + shape: T, + params?: string | core.$ZodObjectParams +): ZodMiniObject, core.$loose> { + return new ZodMiniObject({ + type: "object", + shape, + catchall: unknown(), + ...util.normalizeParams(params), + }) as any; +} + +// object methods +// @__NO_SIDE_EFFECTS__ +export function extend( + schema: T, + shape: U +): ZodMiniObject>, T["_zod"]["config"]> { + return util.extend(schema, shape); +} + +export type SafeExtendShape = { + [K in keyof Ext]: K extends keyof Base + ? core.output extends core.output + ? core.input extends core.input + ? Ext[K] + : never + : never + : Ext[K]; +}; + +// @__NO_SIDE_EFFECTS__ +export function safeExtend( + schema: T, + shape: SafeExtendShape +): ZodMiniObject>, T["_zod"]["config"]> { + return util.safeExtend(schema, shape as any); +} + +/** @deprecated Identical to `z.extend(A, B)` */ +export function merge( + a: T, + b: U +): ZodMiniObject, T["_zod"]["config"]>; +// @__NO_SIDE_EFFECTS__ +export function merge(schema: ZodMiniObject, shape: any): ZodMiniObject { + return util.extend(schema, shape); +} + +// @__NO_SIDE_EFFECTS__ +export function pick>( + schema: T, + mask: M & Record, never> +): ZodMiniObject>, T["_zod"]["config"]> { + return util.pick(schema, mask as any); +} + +// .omit + +// @__NO_SIDE_EFFECTS__ +export function omit>( + schema: T, + mask: M & Record, never> +): ZodMiniObject>, T["_zod"]["config"]> { + return util.omit(schema, mask); +} + +// @__NO_SIDE_EFFECTS__ +export function partial( + schema: T +): ZodMiniObject< + { + -readonly [k in keyof T["shape"]]: ZodMiniOptional; + }, + T["_zod"]["config"] +>; +// @__NO_SIDE_EFFECTS__ +export function partial>( + schema: T, + mask: M & Record, never> +): ZodMiniObject< + { + -readonly [k in keyof T["shape"]]: k extends keyof M ? ZodMiniOptional : T["shape"][k]; + }, + T["_zod"]["config"] +>; +// @__NO_SIDE_EFFECTS__ +export function partial(schema: ZodMiniObject, mask?: object) { + return util.partial(ZodMiniOptional, schema, mask); +} + +export type RequiredInterfaceShape< + Shape extends core.$ZodLooseShape, + Keys extends PropertyKey = keyof Shape, +> = util.Identity< + { + [k in keyof Shape as k extends Keys ? k : never]: ZodMiniNonOptional; + } & { + [k in keyof Shape as k extends Keys ? never : k]: Shape[k]; + } +>; + +// @__NO_SIDE_EFFECTS__ +export function required( + schema: T +): ZodMiniObject< + { + -readonly [k in keyof T["shape"]]: ZodMiniNonOptional; + }, + T["_zod"]["config"] +>; +// @__NO_SIDE_EFFECTS__ +export function required>( + schema: T, + mask: M & Record, never> +): ZodMiniObject< + util.Extend< + T["shape"], + { + [k in keyof M & keyof T["shape"]]: ZodMiniNonOptional; + } + >, + T["_zod"]["config"] +>; +// @__NO_SIDE_EFFECTS__ +export function required(schema: ZodMiniObject, mask?: object) { + return util.required(ZodMiniNonOptional, schema, mask); +} + +// @__NO_SIDE_EFFECTS__ +export function catchall( + inst: T, + catchall: U +): ZodMiniObject> { + return inst.clone({ ...inst._zod.def, catchall: catchall as any }) as any; +} + +// ZodMiniUnion +export interface ZodMiniUnion + extends _ZodMiniType> { + // _zod: core.$ZodUnionInternals; +} +export const ZodMiniUnion: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniUnion", + (inst, def) => { + core.$ZodUnion.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function union( + options: T, + params?: string | core.$ZodUnionParams +): ZodMiniUnion { + return new ZodMiniUnion({ + type: "union", + options: options as any as core.$ZodType[], + ...util.normalizeParams(params), + }) as any; +} + +// ZodMiniXor +export interface ZodMiniXor + extends _ZodMiniType> { + // _zod: core.$ZodXorInternals; +} +export const ZodMiniXor: core.$constructor = /*@__PURE__*/ core.$constructor("ZodMiniXor", (inst, def) => { + ZodMiniUnion.init(inst, def); + core.$ZodXor.init(inst, def); +}); + +/** Creates an exclusive union (XOR) where exactly one option must match. + * Unlike regular unions that succeed when any option matches, xor fails if + * zero or more than one option matches the input. */ +export function xor( + options: T, + params?: string | core.$ZodXorParams +): ZodMiniXor { + return new ZodMiniXor({ + type: "union", + options: options as any as core.$ZodType[], + inclusive: false, + ...util.normalizeParams(params), + }) as any; +} + +// ZodMiniDiscriminatedUnion +export interface ZodMiniDiscriminatedUnion< + Options extends readonly SomeType[] = readonly core.$ZodType[], + Disc extends string = string, +> extends ZodMiniUnion { + _zod: core.$ZodDiscriminatedUnionInternals; +} +export const ZodMiniDiscriminatedUnion: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniDiscriminatedUnion", + (inst, def) => { + core.$ZodDiscriminatedUnion.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function discriminatedUnion< + Types extends readonly [core.$ZodTypeDiscriminable, ...core.$ZodTypeDiscriminable[]], + Disc extends string, +>( + discriminator: Disc, + options: Types, + params?: string | core.$ZodDiscriminatedUnionParams +): ZodMiniDiscriminatedUnion { + return new ZodMiniDiscriminatedUnion({ + type: "union", + options, + discriminator, + ...util.normalizeParams(params), + }) as ZodMiniDiscriminatedUnion; +} + +// ZodMiniIntersection +export interface ZodMiniIntersection + extends _ZodMiniType> { + // _zod: core.$ZodIntersectionInternals; +} +export const ZodMiniIntersection: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniIntersection", + (inst, def) => { + core.$ZodIntersection.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function intersection(left: T, right: U): ZodMiniIntersection { + return new ZodMiniIntersection({ + type: "intersection", + left: left as any as core.$ZodType, + right: right as any as core.$ZodType, + }) as any; +} + +// ZodMiniTuple +export interface ZodMiniTuple< + T extends util.TupleItems = readonly core.$ZodType[], + Rest extends SomeType | null = core.$ZodType | null, +> extends _ZodMiniType> { + // _zod: core.$ZodTupleInternals; +} +export const ZodMiniTuple: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniTuple", + (inst, def) => { + core.$ZodTuple.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +export function tuple( + items: T, + params?: string | core.$ZodTupleParams +): ZodMiniTuple; +export function tuple( + items: T, + rest: Rest, + params?: string | core.$ZodTupleParams +): ZodMiniTuple; +export function tuple(items: [], params?: string | core.$ZodTupleParams): ZodMiniTuple<[], null>; +// @__NO_SIDE_EFFECTS__ +export function tuple( + items: SomeType[], + _paramsOrRest?: string | core.$ZodTupleParams | SomeType, + _params?: string | core.$ZodTupleParams +) { + const hasRest = _paramsOrRest instanceof core.$ZodType; + const params = hasRest ? _params : _paramsOrRest; + const rest = hasRest ? _paramsOrRest : null; + return new ZodMiniTuple({ + type: "tuple", + items: items as any as core.$ZodType[], + rest, + ...util.normalizeParams(params), + }); +} + +// ZodMiniRecord +export interface ZodMiniRecord< + Key extends core.$ZodRecordKey = core.$ZodRecordKey, + Value extends SomeType = core.$ZodType, +> extends _ZodMiniType> { + // _zod: core.$ZodRecordInternals; +} +export const ZodMiniRecord: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniRecord", + (inst, def) => { + core.$ZodRecord.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function record( + keyType: Key, + valueType: Value, + params?: string | core.$ZodRecordParams +): ZodMiniRecord { + // v3-compat: z.record(valueType, params?) — defaults keyType to z.string() + if (!valueType || !(valueType as any)._zod) { + return new ZodMiniRecord({ + type: "record", + keyType: string() as any, + valueType: keyType as any as core.$ZodType, + ...util.normalizeParams(valueType as string | core.$ZodRecordParams | undefined), + }) as any; + } + return new ZodMiniRecord({ + type: "record", + keyType, + valueType: valueType as any as core.$ZodType, + ...util.normalizeParams(params), + }) as any; +} +// @__NO_SIDE_EFFECTS__ +export function partialRecord( + keyType: Key, + valueType: Value, + params?: string | core.$ZodRecordParams +): ZodMiniRecord { + const k = core.clone(keyType); + k._zod.values = undefined; + return new ZodMiniRecord({ + type: "record", + keyType: k, + valueType: valueType as any, + ...util.normalizeParams(params), + }) as any; +} + +export function looseRecord( + keyType: Key, + valueType: Value, + params?: string | core.$ZodRecordParams +): ZodMiniRecord { + return new ZodMiniRecord({ + type: "record", + keyType, + valueType: valueType as any as core.$ZodType, + mode: "loose", + ...util.normalizeParams(params), + }) as any; +} + +// ZodMiniMap +export interface ZodMiniMap + extends _ZodMiniType> { + // _zod: core.$ZodMapInternals; +} +export const ZodMiniMap: core.$constructor = /*@__PURE__*/ core.$constructor("ZodMiniMap", (inst, def) => { + core.$ZodMap.init(inst, def); + ZodMiniType.init(inst, def); +}); + +// @__NO_SIDE_EFFECTS__ +export function map( + keyType: Key, + valueType: Value, + params?: string | core.$ZodMapParams +): ZodMiniMap { + return new ZodMiniMap({ + type: "map", + keyType: keyType as any as core.$ZodType, + valueType: valueType as any as core.$ZodType, + ...util.normalizeParams(params), + }) as any; +} + +// ZodMiniSet +export interface ZodMiniSet extends _ZodMiniType> { + // _zod: core.$ZodSetInternals; +} +export const ZodMiniSet: core.$constructor = /*@__PURE__*/ core.$constructor("ZodMiniSet", (inst, def) => { + core.$ZodSet.init(inst, def); + ZodMiniType.init(inst, def); +}); + +// @__NO_SIDE_EFFECTS__ +export function set(valueType: Value, params?: string | core.$ZodSetParams): ZodMiniSet { + return new ZodMiniSet({ + type: "set", + valueType: valueType as any as core.$ZodType, + ...util.normalizeParams(params), + }) as any; +} + +// ZodMiniEnum +export interface ZodMiniEnum extends _ZodMiniType> { + // _zod: core.$ZodEnumInternals; + options: Array; +} +export const ZodMiniEnum: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniEnum", + (inst, def) => { + core.$ZodEnum.init(inst, def); + ZodMiniType.init(inst, def); + + inst.options = Object.values(def.entries); + } +); + +function _enum( + values: T, + params?: string | core.$ZodEnumParams +): ZodMiniEnum>; +function _enum(entries: T, params?: string | core.$ZodEnumParams): ZodMiniEnum; +// @__NO_SIDE_EFFECTS__ +function _enum(values: any, params?: string | core.$ZodEnumParams) { + const entries: any = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values; + + return new ZodMiniEnum({ + type: "enum", + entries, + ...util.normalizeParams(params), + }) as any; +} +export { _enum as enum }; + +// @__NO_SIDE_EFFECTS__ +/** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead. + * + * ```ts + * enum Colors { red, green, blue } + * z.enum(Colors); + * ``` + */ +export function nativeEnum(entries: T, params?: string | core.$ZodEnumParams): ZodMiniEnum { + return new ZodMiniEnum({ + type: "enum", + entries, + ...util.normalizeParams(params), + }) as any as ZodMiniEnum; +} + +// ZodMiniLiteral +export interface ZodMiniLiteral + extends _ZodMiniType> { + // _zod: core.$ZodLiteralInternals; +} +export const ZodMiniLiteral: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniLiteral", + (inst, def) => { + core.$ZodLiteral.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +export function literal>( + value: T, + params?: string | core.$ZodLiteralParams +): ZodMiniLiteral; +export function literal( + value: T, + params?: string | core.$ZodLiteralParams +): ZodMiniLiteral; +// @__NO_SIDE_EFFECTS__ +export function literal(value: any, params: any) { + return new ZodMiniLiteral({ + type: "literal", + values: Array.isArray(value) ? value : [value], + ...util.normalizeParams(params), + }); +} + +// ZodMiniFile +export interface ZodMiniFile extends _ZodMiniType { + // _zod: core.$ZodFileInternals; +} +export const ZodMiniFile: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniFile", + (inst, def) => { + core.$ZodFile.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function file(params?: string | core.$ZodFileParams): ZodMiniFile { + return core._file(ZodMiniFile, params) as any; +} + +// ZodMiniTransform +export interface ZodMiniTransform extends _ZodMiniType> { + // _zod: core.$ZodTransformInternals; +} +export const ZodMiniTransform: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniTransform", + (inst, def) => { + core.$ZodTransform.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function transform( + fn: (input: I, ctx: core.ParsePayload) => O +): ZodMiniTransform, I> { + return new ZodMiniTransform({ + type: "transform", + transform: fn as any, + }) as any; +} + +// ZodMiniOptional +export interface ZodMiniOptional + extends _ZodMiniType>, + core.$ZodOptional { + // _zod: core.$ZodOptionalInternals; +} +export const ZodMiniOptional: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniOptional", + (inst, def) => { + core.$ZodOptional.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function optional(innerType: T): ZodMiniOptional { + return new ZodMiniOptional({ + type: "optional", + innerType: innerType as any as core.$ZodType, + }) as any; +} + +// ZodMiniExactOptional +export interface ZodMiniExactOptional + extends _ZodMiniType>, + core.$ZodExactOptional { + // _zod: core.$ZodExactOptionalInternals; +} +export const ZodMiniExactOptional: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniExactOptional", + (inst, def) => { + core.$ZodExactOptional.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function exactOptional(innerType: T): ZodMiniExactOptional { + return new ZodMiniExactOptional({ + type: "optional", + innerType: innerType as any as core.$ZodType, + }) as any; +} + +// ZodMiniNullable +export interface ZodMiniNullable + extends _ZodMiniType> { + // _zod: core.$ZodNullableInternals; +} +export const ZodMiniNullable: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniNullable", + (inst, def) => { + core.$ZodNullable.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function nullable(innerType: T): ZodMiniNullable { + return new ZodMiniNullable({ + type: "nullable", + innerType: innerType as any as core.$ZodType, + }) as any; +} + +// nullish +// @__NO_SIDE_EFFECTS__ +export function nullish(innerType: T): ZodMiniOptional> { + return optional(nullable(innerType)); +} + +// ZodMiniDefault +export interface ZodMiniDefault extends _ZodMiniType> { + // _zod: core.$ZodDefaultInternals; +} +export const ZodMiniDefault: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniDefault", + (inst, def) => { + core.$ZodDefault.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function _default( + innerType: T, + defaultValue: util.NoUndefined> | (() => util.NoUndefined>) +): ZodMiniDefault { + return new ZodMiniDefault({ + type: "default", + innerType: innerType as any as core.$ZodType, + get defaultValue() { + return typeof defaultValue === "function" ? (defaultValue as Function)() : util.shallowClone(defaultValue); + }, + }) as any; +} + +// ZodMiniPrefault +export interface ZodMiniPrefault + extends _ZodMiniType> { + // _zod: core.$ZodPrefaultInternals; +} +export const ZodMiniPrefault: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniPrefault", + (inst, def) => { + core.$ZodPrefault.init(inst, def); + ZodMiniType.init(inst, def); + } +); +// @__NO_SIDE_EFFECTS__ +export function prefault( + innerType: T, + defaultValue: util.NoUndefined> | (() => util.NoUndefined>) +): ZodMiniPrefault { + return new ZodMiniPrefault({ + type: "prefault", + innerType: innerType as any as core.$ZodType, + get defaultValue() { + return typeof defaultValue === "function" ? (defaultValue as Function)() : util.shallowClone(defaultValue); + }, + }) as any; +} + +// ZodMiniNonOptional +export interface ZodMiniNonOptional + extends _ZodMiniType> { + // _zod: core.$ZodNonOptionalInternals; +} +export const ZodMiniNonOptional: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniNonOptional", + (inst, def) => { + core.$ZodNonOptional.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function nonoptional( + innerType: T, + params?: string | core.$ZodNonOptionalParams +): ZodMiniNonOptional { + return new ZodMiniNonOptional({ + type: "nonoptional", + innerType: innerType as any as core.$ZodType, + ...util.normalizeParams(params), + }) as any; +} + +// ZodMiniSuccess +export interface ZodMiniSuccess extends _ZodMiniType> { + // _zod: core.$ZodSuccessInternals; +} +export const ZodMiniSuccess: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniSuccess", + (inst, def) => { + core.$ZodSuccess.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function success(innerType: T): ZodMiniSuccess { + return new ZodMiniSuccess({ + type: "success", + innerType: innerType as any as core.$ZodType, + }) as any; +} + +// ZodMiniCatch +export interface ZodMiniCatch extends _ZodMiniType> { + // _zod: core.$ZodCatchInternals; +} +export const ZodMiniCatch: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniCatch", + (inst, def) => { + core.$ZodCatch.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +function _catch( + innerType: T, + catchValue: core.output | ((ctx: core.$ZodCatchCtx) => core.output) +): ZodMiniCatch { + return new ZodMiniCatch({ + type: "catch", + innerType: innerType as any as core.$ZodType, + catchValue: (typeof catchValue === "function" ? catchValue : () => catchValue) as ( + ctx: core.$ZodCatchCtx + ) => core.output, + }) as any; +} +export { _catch as catch }; + +// ZodMiniNaN +export interface ZodMiniNaN extends _ZodMiniType { + // _zod: core.$ZodNaNInternals; +} +export const ZodMiniNaN: core.$constructor = /*@__PURE__*/ core.$constructor("ZodMiniNaN", (inst, def) => { + core.$ZodNaN.init(inst, def); + ZodMiniType.init(inst, def); +}); + +// @__NO_SIDE_EFFECTS__ +export function nan(params?: string | core.$ZodNaNParams): ZodMiniNaN { + return core._nan(ZodMiniNaN, params) as any; +} + +// ZodMiniPipe +export interface ZodMiniPipe + extends _ZodMiniType> { + // _zod: core.$ZodPipeInternals; +} +export const ZodMiniPipe: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniPipe", + (inst, def) => { + core.$ZodPipe.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function pipe< + const A extends SomeType, + B extends core.$ZodType> = core.$ZodType>, +>(in_: A, out: B | core.$ZodType>): ZodMiniPipe { + return new ZodMiniPipe({ + type: "pipe", + in: in_ as any as core.$ZodType, + out: out as any as core.$ZodType, + }) as any; +} + +// ZodMiniCodec +export interface ZodMiniCodec + extends ZodMiniPipe, + core.$ZodCodec { + _zod: core.$ZodCodecInternals; + def: core.$ZodCodecDef; +} +export const ZodMiniCodec: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniCodec", + (inst, def) => { + ZodMiniPipe.init(inst, def); + core.$ZodCodec.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function codec( + in_: A, + out: B, + params: { + decode: (value: core.output, payload: core.ParsePayload>) => core.util.MaybeAsync>; + encode: (value: core.input, payload: core.ParsePayload>) => core.util.MaybeAsync>; + } +): ZodMiniCodec { + return new ZodMiniCodec({ + type: "pipe", + in: in_ as any as core.$ZodType, + out: out as any as core.$ZodType, + transform: params.decode as any, + reverseTransform: params.encode as any, + }) as any; +} + +// @__NO_SIDE_EFFECTS__ +export function invertCodec(codec: ZodMiniCodec): ZodMiniCodec { + const def = codec._zod.def; + return new ZodMiniCodec({ + type: "pipe", + in: def.out as any, + out: def.in as any, + transform: def.reverseTransform as any, + reverseTransform: def.transform as any, + }) as any; +} + +// ZodMiniReadonly +export interface ZodMiniReadonly + extends _ZodMiniType> { + // _zod: core.$ZodReadonlyInternals; +} +export const ZodMiniReadonly: core.$constructor = /*@__PURE__*/ core.$constructor( + "ZodMiniReadonly", + (inst, def) => { + core.$ZodReadonly.init(inst, def); + ZodMiniType.init(inst, def); + } +); + +// @__NO_SIDE_EFFECTS__ +export function readonly(innerType: T): ZodMiniReadonly { + return new ZodMiniReadonly({ + type: "readonly", + innerType: innerType as any as core.$ZodType, + }) as any; +} + +// ZodMiniTemplateLiteral +export interface ZodMiniTemplateLiteral