first commit

This commit is contained in:
2026-07-19 03:44:35 +09:00
commit 7f950339ae
23281 changed files with 3217138 additions and 0 deletions
+3940
View File
File diff suppressed because it is too large Load Diff
+201
View File
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2026 OpenAI
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+707
View File
@@ -0,0 +1,707 @@
# OpenAI TypeScript and JavaScript API Library
[![NPM version](<https://img.shields.io/npm/v/openai.svg?label=npm%20(stable)>)](https://npmjs.org/package/openai) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/openai) [![JSR Version](https://jsr.io/badges/@openai/openai)](https://jsr.io/@openai/openai)
This library provides convenient access to the OpenAI REST API from TypeScript or JavaScript.
It is generated from our [OpenAPI specification](https://github.com/openai/openai-openapi) with [Stainless](https://stainlessapi.com/).
To learn how to use the OpenAI API, check out our [API Reference](https://platform.openai.com/docs/api-reference) and [Documentation](https://platform.openai.com/docs).
## Installation
```sh
npm install openai
```
### Installation from JSR
```sh
deno add jsr:@openai/openai
npx jsr add @openai/openai
```
These commands will make the module importable from the `@openai/openai` scope. You can also [import directly from JSR](https://jsr.io/docs/using-packages#importing-with-jsr-specifiers) without an install step if you're using the Deno JavaScript runtime:
```ts
import OpenAI from 'jsr:@openai/openai';
```
## Usage
The full API of this library can be found in [api.md file](api.md) along with many [code examples](https://github.com/openai/openai-node/tree/master/examples).
The primary API for interacting with OpenAI models is the [Responses API](https://platform.openai.com/docs/api-reference/responses). You can generate text from the model with the code below.
```ts
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});
const response = await client.responses.create({
model: 'gpt-5.2',
instructions: 'You are a coding assistant that talks like a pirate',
input: 'Are semicolons optional in JavaScript?',
});
console.log(response.output_text);
```
The previous standard (supported indefinitely) for generating text is the [Chat Completions API](https://platform.openai.com/docs/api-reference/chat). You can use that API to generate text from the model with the code below.
```ts
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});
const completion = await client.chat.completions.create({
model: 'gpt-5.2',
messages: [
{ role: 'developer', content: 'Talk like a pirate.' },
{ role: 'user', content: 'Are semicolons optional in JavaScript?' },
],
});
console.log(completion.choices[0].message.content);
```
## Streaming responses
We provide support for streaming responses using Server Sent Events (SSE).
```ts
import OpenAI from 'openai';
const client = new OpenAI();
const stream = await client.responses.create({
model: 'gpt-5.2',
input: 'Say "Sheep sleep deep" ten times fast!',
stream: true,
});
for await (const event of stream) {
console.log(event);
}
```
## File uploads
Request parameters that correspond to file uploads can be passed in many different forms:
- `File` (or an object with the same structure)
- a `fetch` `Response` (or an object with the same structure)
- an `fs.ReadStream`
- the return value of our `toFile` helper
```ts
import fs from 'fs';
import OpenAI, { toFile } from 'openai';
const client = new OpenAI();
// If you have access to Node `fs` we recommend using `fs.createReadStream()`:
await client.files.create({ file: fs.createReadStream('input.jsonl'), purpose: 'fine-tune' });
// Or if you have the web `File` API you can pass a `File` instance:
await client.files.create({ file: new File(['my bytes'], 'input.jsonl'), purpose: 'fine-tune' });
// You can also pass a `fetch` `Response`:
await client.files.create({
file: await fetch('https://somesite/input.jsonl'),
purpose: 'fine-tune',
});
// Finally, if none of the above are convenient, you can use our `toFile` helper:
await client.files.create({
file: await toFile(Buffer.from('my bytes'), 'input.jsonl'),
purpose: 'fine-tune',
});
await client.files.create({
file: await toFile(new Uint8Array([0, 1, 2]), 'input.jsonl'),
purpose: 'fine-tune',
});
```
## Webhook Verification
Verifying webhook signatures is _optional but encouraged_.
For more information about webhooks, see [the API docs](https://platform.openai.com/docs/guides/webhooks).
### Parsing webhook payloads
For most use cases, you will likely want to verify the webhook and parse the payload at the same time. To achieve this, we provide the method `client.webhooks.unwrap()`, which parses a webhook request and verifies that it was sent by OpenAI. This method will throw an error if the signature is invalid.
Note that the `body` parameter must be the raw JSON string sent from the server (do not parse it first). The `.unwrap()` method will parse this JSON for you into an event object after verifying the webhook was sent from OpenAI.
```ts
import { headers } from 'next/headers';
import OpenAI from 'openai';
const client = new OpenAI({
webhookSecret: process.env.OPENAI_WEBHOOK_SECRET, // env var used by default; explicit here.
});
export async function webhook(request: Request) {
const headersList = headers();
const body = await request.text();
try {
const event = client.webhooks.unwrap(body, headersList);
switch (event.type) {
case 'response.completed':
console.log('Response completed:', event.data);
break;
case 'response.failed':
console.log('Response failed:', event.data);
break;
default:
console.log('Unhandled event type:', event.type);
}
return Response.json({ message: 'ok' });
} catch (error) {
console.error('Invalid webhook signature:', error);
return new Response('Invalid signature', { status: 400 });
}
}
```
### Verifying webhook payloads directly
In some cases, you may want to verify the webhook separately from parsing the payload. If you prefer to handle these steps separately, we provide the method `client.webhooks.verifySignature()` to _only verify_ the signature of a webhook request. Like `.unwrap()`, this method will throw an error if the signature is invalid.
Note that the `body` parameter must be the raw JSON string sent from the server (do not parse it first). You will then need to parse the body after verifying the signature.
```ts
import { headers } from 'next/headers';
import OpenAI from 'openai';
const client = new OpenAI({
webhookSecret: process.env.OPENAI_WEBHOOK_SECRET, // env var used by default; explicit here.
});
export async function webhook(request: Request) {
const headersList = headers();
const body = await request.text();
try {
client.webhooks.verifySignature(body, headersList);
// Parse the body after verification
const event = JSON.parse(body);
console.log('Verified event:', event);
return Response.json({ message: 'ok' });
} catch (error) {
console.error('Invalid webhook signature:', error);
return new Response('Invalid signature', { status: 400 });
}
}
```
## Handling errors
When the library is unable to connect to the API,
or if the API returns a non-success status code (i.e., 4xx or 5xx response),
a subclass of `APIError` will be thrown:
<!-- prettier-ignore -->
```ts
const job = await client.fineTuning.jobs
.create({ model: 'gpt-4o', training_file: 'file-abc123' })
.catch(async (err) => {
if (err instanceof OpenAI.APIError) {
console.log(err.request_id);
console.log(err.status); // 400
console.log(err.name); // BadRequestError
console.log(err.headers); // {server: 'nginx', ...}
} else {
throw err;
}
});
```
Error codes are as follows:
| Status Code | Error Type |
| ----------- | -------------------------- |
| 400 | `BadRequestError` |
| 401 | `AuthenticationError` |
| 403 | `PermissionDeniedError` |
| 404 | `NotFoundError` |
| 422 | `UnprocessableEntityError` |
| 429 | `RateLimitError` |
| >=500 | `InternalServerError` |
| N/A | `APIConnectionError` |
## Request IDs
> For more information on debugging requests, see [these docs](https://platform.openai.com/docs/api-reference/debugging-requests)
All object responses in the SDK provide a `_request_id` property which is added from the `x-request-id` response header so that you can quickly log failing requests and report them back to OpenAI.
```ts
const completion = await client.chat.completions.create({
messages: [{ role: 'user', content: 'Say this is a test' }],
model: 'gpt-5.2',
});
console.log(completion._request_id); // req_123
```
You can also access the Request ID using the `.withResponse()` method:
```ts
const { data: stream, request_id } = await openai.chat.completions
.create({
model: 'gpt-5.2',
messages: [{ role: 'user', content: 'Say this is a test' }],
stream: true,
})
.withResponse();
```
## Realtime API
The Realtime API enables you to build low-latency, multi-modal conversational experiences. It currently supports text and audio as both input and output, as well as [function calling](https://platform.openai.com/docs/guides/function-calling) through a `WebSocket` connection.
```ts
import { OpenAIRealtimeWebSocket } from 'openai/realtime/websocket';
const rt = new OpenAIRealtimeWebSocket({ model: 'gpt-realtime' });
rt.on('response.text.delta', (event) => process.stdout.write(event.delta));
```
For more information see [realtime.md](realtime.md).
## Microsoft Azure OpenAI
To use this library with [Azure OpenAI](https://learn.microsoft.com/azure/ai-services/openai/overview), use the `AzureOpenAI`
class instead of the `OpenAI` class.
> [!IMPORTANT]
> The Azure API shape slightly differs from the core API shape which means that the static types for responses / params
> won't always be correct.
```ts
import { AzureOpenAI } from 'openai';
import { getBearerTokenProvider, DefaultAzureCredential } from '@azure/identity';
const credential = new DefaultAzureCredential();
const scope = 'https://cognitiveservices.azure.com/.default';
const azureADTokenProvider = getBearerTokenProvider(credential, scope);
const openai = new AzureOpenAI({ azureADTokenProvider });
const result = await openai.chat.completions.create({
model: 'gpt-5.2',
messages: [{ role: 'user', content: 'Say hello!' }],
});
console.log(result.choices[0]!.message?.content);
```
### Retries
Certain errors will be automatically retried 2 times by default, with a short exponential backoff.
Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
429 Rate Limit, and >=500 Internal errors will all be retried by default.
You can use the `maxRetries` option to configure or disable this:
<!-- prettier-ignore -->
```js
// Configure the default for all requests:
const client = new OpenAI({
maxRetries: 0, // default is 2
});
// Or, configure per-request:
await client.chat.completions.create({ messages: [{ role: 'user', content: 'How can I get the name of the current day in JavaScript?' }], model: 'gpt-5.2' }, {
maxRetries: 5,
});
```
### Timeouts
Requests time out after 10 minutes by default. You can configure this with a `timeout` option:
<!-- prettier-ignore -->
```ts
// Configure the default for all requests:
const client = new OpenAI({
timeout: 20 * 1000, // 20 seconds (default is 10 minutes)
});
// Override per-request:
await client.chat.completions.create({ messages: [{ role: 'user', content: 'How can I list all files in a directory using Python?' }], model: 'gpt-5.2' }, {
timeout: 5 * 1000,
});
```
On timeout, an `APIConnectionTimeoutError` is thrown.
Note that requests which time out will be [retried twice by default](#retries).
## Request IDs
> For more information on debugging requests, see [these docs](https://platform.openai.com/docs/api-reference/debugging-requests)
All object responses in the SDK provide a `_request_id` property which is added from the `x-request-id` response header so that you can quickly log failing requests and report them back to OpenAI.
```ts
const response = await client.responses.create({ model: 'gpt-5.2', input: 'testing 123' });
console.log(response._request_id); // req_123
```
You can also access the Request ID using the `.withResponse()` method:
```ts
const { data: stream, request_id } = await openai.responses
.create({
model: 'gpt-5.2',
input: 'Say this is a test',
stream: true,
})
.withResponse();
```
## Auto-pagination
List methods in the OpenAI API are paginated.
You can use the `for await … of` syntax to iterate through items across all pages:
```ts
async function fetchAllFineTuningJobs(params) {
const allFineTuningJobs = [];
// Automatically fetches more pages as needed.
for await (const fineTuningJob of client.fineTuning.jobs.list({ limit: 20 })) {
allFineTuningJobs.push(fineTuningJob);
}
return allFineTuningJobs;
}
```
Alternatively, you can request a single page at a time:
```ts
let page = await client.fineTuning.jobs.list({ limit: 20 });
for (const fineTuningJob of page.data) {
console.log(fineTuningJob);
}
// Convenience methods are provided for manually paginating:
while (page.hasNextPage()) {
page = await page.getNextPage();
// ...
}
```
## Realtime API
The Realtime API enables you to build low-latency, multi-modal conversational experiences. It currently supports text and audio as both input and output, as well as [function calling](https://platform.openai.com/docs/guides/function-calling) through a `WebSocket` connection.
```ts
import { OpenAIRealtimeWebSocket } from 'openai/realtime/websocket';
const rt = new OpenAIRealtimeWebSocket({ model: 'gpt-realtime' });
rt.on('response.text.delta', (event) => process.stdout.write(event.delta));
```
For more information see [realtime.md](realtime.md).
## Microsoft Azure OpenAI
To use this library with [Azure OpenAI](https://learn.microsoft.com/azure/ai-services/openai/overview), use the `AzureOpenAI`
class instead of the `OpenAI` class.
> [!IMPORTANT]
> The Azure API shape slightly differs from the core API shape which means that the static types for responses / params
> won't always be correct.
```ts
import { AzureOpenAI } from 'openai';
import { getBearerTokenProvider, DefaultAzureCredential } from '@azure/identity';
const credential = new DefaultAzureCredential();
const scope = 'https://cognitiveservices.azure.com/.default';
const azureADTokenProvider = getBearerTokenProvider(credential, scope);
const openai = new AzureOpenAI({
azureADTokenProvider,
apiVersion: '<The API version, e.g. 2024-10-01-preview>',
});
const result = await openai.chat.completions.create({
model: 'gpt-5.2',
messages: [{ role: 'user', content: 'Say hello!' }],
});
console.log(result.choices[0]!.message?.content);
```
For more information on support for the Azure API, see [azure.md](azure.md).
## Advanced Usage
### Accessing raw Response data (e.g., headers)
The "raw" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.
This method returns as soon as the headers for a successful response are received and does not consume the response body, so you are free to write custom parsing or streaming logic.
You can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.
Unlike `.asResponse()` this method consumes the body, returning once it is parsed.
<!-- prettier-ignore -->
```ts
const client = new OpenAI();
const httpResponse = await client.responses
.create({ model: 'gpt-5.2', input: 'say this is a test.' })
.asResponse();
// access the underlying web standard Response object
console.log(httpResponse.headers.get('X-My-Header'));
console.log(httpResponse.statusText);
const { data: modelResponse, response: raw } = await client.responses
.create({ model: 'gpt-5.2', input: 'say this is a test.' })
.withResponse();
console.log(raw.headers.get('X-My-Header'));
console.log(modelResponse);
```
### Logging
> [!IMPORTANT]
> All log messages are intended for debugging only. The format and content of log messages
> may change between releases.
#### Log levels
The log level can be configured in two ways:
1. Via the `OPENAI_LOG` environment variable
2. Using the `logLevel` client option (overrides the environment variable if set)
```ts
import OpenAI from 'openai';
const client = new OpenAI({
logLevel: 'debug', // Show all log messages
});
```
Available log levels, from most to least verbose:
- `'debug'` - Show debug messages, info, warnings, and errors
- `'info'` - Show info messages, warnings, and errors
- `'warn'` - Show warnings and errors (default)
- `'error'` - Show only errors
- `'off'` - Disable all logging
At the `'debug'` level, all HTTP requests and responses are logged, including headers and bodies.
Some authentication-related headers are redacted, but sensitive data in request and response bodies
may still be visible.
#### Custom logger
By default, this library logs to `globalThis.console`. You can also provide a custom logger.
Most logging libraries are supported, including [pino](https://www.npmjs.com/package/pino), [winston](https://www.npmjs.com/package/winston), [bunyan](https://www.npmjs.com/package/bunyan), [consola](https://www.npmjs.com/package/consola), [signale](https://www.npmjs.com/package/signale), and [@std/log](https://jsr.io/@std/log). If your logger doesn't work, please open an issue.
When providing a custom logger, the `logLevel` option still controls which messages are emitted, messages
below the configured level will not be sent to your logger.
```ts
import OpenAI from 'openai';
import pino from 'pino';
const logger = pino();
const client = new OpenAI({
logger: logger.child({ name: 'OpenAI' }),
logLevel: 'debug', // Send all messages to pino, allowing it to filter
});
```
### Making custom/undocumented requests
This library is typed for convenient access to the documented API. If you need to access undocumented
endpoints, params, or response properties, the library can still be used.
#### Undocumented endpoints
To make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs.
Options on the client, such as retries, will be respected when making these requests.
```ts
await client.post('/some/path', {
body: { some_prop: 'foo' },
query: { some_query_arg: 'bar' },
});
```
#### Undocumented request params
To make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented
parameter. This library doesn't validate at runtime that the request matches the type, so any extra values you
send will be sent as-is.
```ts
client.chat.completions.create({
// ...
// @ts-expect-error baz is not yet public
baz: 'undocumented option',
});
```
For requests with the `GET` verb, any extra params will be in the query, all other requests will send the
extra param in the body.
If you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request
options.
#### Undocumented response properties
To access undocumented response properties, you may access the response object with `// @ts-expect-error` on
the response object, or cast the response object to the requisite type. Like the request params, we do not
validate or strip extra properties from the response from the API.
### Customizing the fetch client
If you want to use a different `fetch` function, you can either polyfill the global:
```ts
import fetch from 'my-fetch';
globalThis.fetch = fetch;
```
Or pass it to the client:
```ts
import OpenAI from 'openai';
import fetch from 'my-fetch';
const client = new OpenAI({ fetch });
```
### Fetch options
If you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)
```ts
import OpenAI from 'openai';
const client = new OpenAI({
fetchOptions: {
// `RequestInit` options
},
});
```
#### Configuring proxies
To modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy
options to requests:
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg" align="top" width="18" height="21"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>
```ts
import OpenAI from 'openai';
import * as undici from 'undici';
const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
const client = new OpenAI({
fetchOptions: {
dispatcher: proxyAgent,
},
});
```
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg" align="top" width="18" height="21"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>
```ts
import OpenAI from 'openai';
const client = new OpenAI({
fetchOptions: {
proxy: 'http://localhost:8888',
},
});
```
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg" align="top" width="18" height="21"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>
```ts
import OpenAI from 'npm:openai';
const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
const client = new OpenAI({
fetchOptions: {
client: httpClient,
},
});
```
## Frequently Asked Questions
## Semantic versioning
This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
1. Changes that only affect static types, without breaking runtime behavior.
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
3. Changes that we do not expect to impact the vast majority of users in practice.
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
We are keen for your feedback; please open an [issue](https://www.github.com/openai/openai-node/issues) with questions, bugs, or suggestions.
## Requirements
TypeScript >= 4.9 is supported.
The following runtimes are supported:
- Node.js 20 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.
- Deno v1.28.0 or higher.
- Bun 1.0 or later.
- Cloudflare Workers.
- Vercel Edge Runtime.
- Jest 28 or greater with the `"node"` environment (`"jsdom"` is not supported at this time).
- Nitro v2.6 or greater.
- Web browsers: disabled by default to avoid exposing your secret API credentials. Enable browser support by explicitly setting `dangerouslyAllowBrowser` to true'.
<details>
<summary>More explanation</summary>
### Why is this dangerous?
Enabling the `dangerouslyAllowBrowser` option can be dangerous because it exposes your secret API credentials in the client-side code. Web browsers are inherently less secure than server environments,
any user with access to the browser can potentially inspect, extract, and misuse these credentials. This could lead to unauthorized access using your credentials and potentially compromise sensitive data or functionality.
### When might this not be dangerous?
In certain scenarios where enabling browser support might not pose significant risks:
- Internal Tools: If the application is used solely within a controlled internal environment where the users are trusted, the risk of credential exposure can be mitigated.
- Public APIs with Limited Scope: If your API has very limited scope and the exposed credentials do not grant access to sensitive data or critical operations, the potential impact of exposure is reduced.
- Development or debugging purpose: Enabling this feature temporarily might be acceptable, provided the credentials are short-lived, aren't also used in production environments, or are frequently rotated.
</details>
Note that React Native is not supported at this time.
If you are interested in other runtime environments, please open or upvote an issue on GitHub.
## Contributing
See [the contributing documentation](./CONTRIBUTING.md).
+7
View File
@@ -0,0 +1,7 @@
declare class PartialJSON extends Error {
}
declare class MalformedJSON extends Error {
}
declare const partialParse: (input: string) => any;
export { partialParse, PartialJSON, MalformedJSON };
//# sourceMappingURL=parser.d.mts.map
@@ -0,0 +1 @@
{"version":3,"file":"parser.d.mts","sourceRoot":"","sources":["../../src/_vendor/partial-json-parser/parser.ts"],"names":[],"mappings":"AAkCA,cAAM,WAAY,SAAQ,KAAK;CAAG;AAElC,cAAM,aAAc,SAAQ,KAAK;CAAG;AAgNpC,QAAA,MAAM,YAAY,GAAI,OAAO,MAAM,QAA4C,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC"}
+7
View File
@@ -0,0 +1,7 @@
declare class PartialJSON extends Error {
}
declare class MalformedJSON extends Error {
}
declare const partialParse: (input: string) => any;
export { partialParse, PartialJSON, MalformedJSON };
//# sourceMappingURL=parser.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/_vendor/partial-json-parser/parser.ts"],"names":[],"mappings":"AAkCA,cAAM,WAAY,SAAQ,KAAK;CAAG;AAElC,cAAM,aAAc,SAAQ,KAAK;CAAG;AAgNpC,QAAA,MAAM,YAAY,GAAI,OAAO,MAAM,QAA4C,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC"}
+246
View File
@@ -0,0 +1,246 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MalformedJSON = exports.PartialJSON = exports.partialParse = void 0;
const STR = 0b000000001;
const NUM = 0b000000010;
const ARR = 0b000000100;
const OBJ = 0b000001000;
const NULL = 0b000010000;
const BOOL = 0b000100000;
const NAN = 0b001000000;
const INFINITY = 0b010000000;
const MINUS_INFINITY = 0b100000000;
const INF = INFINITY | MINUS_INFINITY;
const SPECIAL = NULL | BOOL | INF | NAN;
const ATOM = STR | NUM | SPECIAL;
const COLLECTION = ARR | OBJ;
const ALL = ATOM | COLLECTION;
const Allow = {
STR,
NUM,
ARR,
OBJ,
NULL,
BOOL,
NAN,
INFINITY,
MINUS_INFINITY,
INF,
SPECIAL,
ATOM,
COLLECTION,
ALL,
};
// The JSON string segment was unable to be parsed completely
class PartialJSON extends Error {
}
exports.PartialJSON = PartialJSON;
class MalformedJSON extends Error {
}
exports.MalformedJSON = MalformedJSON;
/**
* Parse incomplete JSON
* @param {string} jsonString Partial JSON to be parsed
* @param {number} allowPartial Specify what types are allowed to be partial, see {@link Allow} for details
* @returns The parsed JSON
* @throws {PartialJSON} If the JSON is incomplete (related to the `allow` parameter)
* @throws {MalformedJSON} If the JSON is malformed
*/
function parseJSON(jsonString, allowPartial = Allow.ALL) {
if (typeof jsonString !== 'string') {
throw new TypeError(`expecting str, got ${typeof jsonString}`);
}
if (!jsonString.trim()) {
throw new Error(`${jsonString} is empty`);
}
return _parseJSON(jsonString.trim(), allowPartial);
}
const _parseJSON = (jsonString, allow) => {
const length = jsonString.length;
let index = 0;
const markPartialJSON = (msg) => {
throw new PartialJSON(`${msg} at position ${index}`);
};
const throwMalformedError = (msg) => {
throw new MalformedJSON(`${msg} at position ${index}`);
};
const parseAny = () => {
skipBlank();
if (index >= length)
markPartialJSON('Unexpected end of input');
if (jsonString[index] === '"')
return parseStr();
if (jsonString[index] === '{')
return parseObj();
if (jsonString[index] === '[')
return parseArr();
if (jsonString.substring(index, index + 4) === 'null' ||
(Allow.NULL & allow && length - index < 4 && 'null'.startsWith(jsonString.substring(index)))) {
index += 4;
return null;
}
if (jsonString.substring(index, index + 4) === 'true' ||
(Allow.BOOL & allow && length - index < 4 && 'true'.startsWith(jsonString.substring(index)))) {
index += 4;
return true;
}
if (jsonString.substring(index, index + 5) === 'false' ||
(Allow.BOOL & allow && length - index < 5 && 'false'.startsWith(jsonString.substring(index)))) {
index += 5;
return false;
}
if (jsonString.substring(index, index + 8) === 'Infinity' ||
(Allow.INFINITY & allow && length - index < 8 && 'Infinity'.startsWith(jsonString.substring(index)))) {
index += 8;
return Infinity;
}
if (jsonString.substring(index, index + 9) === '-Infinity' ||
(Allow.MINUS_INFINITY & allow &&
1 < length - index &&
length - index < 9 &&
'-Infinity'.startsWith(jsonString.substring(index)))) {
index += 9;
return -Infinity;
}
if (jsonString.substring(index, index + 3) === 'NaN' ||
(Allow.NAN & allow && length - index < 3 && 'NaN'.startsWith(jsonString.substring(index)))) {
index += 3;
return NaN;
}
return parseNum();
};
const parseStr = () => {
const start = index;
let escape = false;
index++; // skip initial quote
while (index < length && (jsonString[index] !== '"' || (escape && jsonString[index - 1] === '\\'))) {
escape = jsonString[index] === '\\' ? !escape : false;
index++;
}
if (jsonString.charAt(index) == '"') {
try {
return JSON.parse(jsonString.substring(start, ++index - Number(escape)));
}
catch (e) {
throwMalformedError(String(e));
}
}
else if (Allow.STR & allow) {
try {
return JSON.parse(jsonString.substring(start, index - Number(escape)) + '"');
}
catch (e) {
// SyntaxError: Invalid escape sequence
return JSON.parse(jsonString.substring(start, jsonString.lastIndexOf('\\')) + '"');
}
}
markPartialJSON('Unterminated string literal');
};
const parseObj = () => {
index++; // skip initial brace
skipBlank();
const obj = {};
try {
while (jsonString[index] !== '}') {
skipBlank();
if (index >= length && Allow.OBJ & allow)
return obj;
const key = parseStr();
skipBlank();
index++; // skip colon
try {
const value = parseAny();
Object.defineProperty(obj, key, { value, writable: true, enumerable: true, configurable: true });
}
catch (e) {
if (Allow.OBJ & allow)
return obj;
else
throw e;
}
skipBlank();
if (jsonString[index] === ',')
index++; // skip comma
}
}
catch (e) {
if (Allow.OBJ & allow)
return obj;
else
markPartialJSON("Expected '}' at end of object");
}
index++; // skip final brace
return obj;
};
const parseArr = () => {
index++; // skip initial bracket
const arr = [];
try {
while (jsonString[index] !== ']') {
arr.push(parseAny());
skipBlank();
if (jsonString[index] === ',') {
index++; // skip comma
}
}
}
catch (e) {
if (Allow.ARR & allow) {
return arr;
}
markPartialJSON("Expected ']' at end of array");
}
index++; // skip final bracket
return arr;
};
const parseNum = () => {
if (index === 0) {
if (jsonString === '-' && Allow.NUM & allow)
markPartialJSON("Not sure what '-' is");
try {
return JSON.parse(jsonString);
}
catch (e) {
if (Allow.NUM & allow) {
try {
if ('.' === jsonString[jsonString.length - 1])
return JSON.parse(jsonString.substring(0, jsonString.lastIndexOf('.')));
return JSON.parse(jsonString.substring(0, jsonString.lastIndexOf('e')));
}
catch (e) { }
}
throwMalformedError(String(e));
}
}
const start = index;
if (jsonString[index] === '-')
index++;
while (jsonString[index] && !',]}'.includes(jsonString[index]))
index++;
if (index == length && !(Allow.NUM & allow))
markPartialJSON('Unterminated number literal');
try {
return JSON.parse(jsonString.substring(start, index));
}
catch (e) {
if (jsonString.substring(start, index) === '-' && Allow.NUM & allow)
markPartialJSON("Not sure what '-' is");
try {
return JSON.parse(jsonString.substring(start, jsonString.lastIndexOf('e')));
}
catch (e) {
throwMalformedError(String(e));
}
}
};
const skipBlank = () => {
while (index < length && ' \n\r\t'.includes(jsonString[index])) {
index++;
}
};
return parseAny();
};
// using this function with malformed JSON is undefined behavior
const partialParse = (input) => parseJSON(input, Allow.ALL ^ Allow.NUM);
exports.partialParse = partialParse;
//# sourceMappingURL=parser.js.map
File diff suppressed because one or more lines are too long
+241
View File
@@ -0,0 +1,241 @@
const STR = 0b000000001;
const NUM = 0b000000010;
const ARR = 0b000000100;
const OBJ = 0b000001000;
const NULL = 0b000010000;
const BOOL = 0b000100000;
const NAN = 0b001000000;
const INFINITY = 0b010000000;
const MINUS_INFINITY = 0b100000000;
const INF = INFINITY | MINUS_INFINITY;
const SPECIAL = NULL | BOOL | INF | NAN;
const ATOM = STR | NUM | SPECIAL;
const COLLECTION = ARR | OBJ;
const ALL = ATOM | COLLECTION;
const Allow = {
STR,
NUM,
ARR,
OBJ,
NULL,
BOOL,
NAN,
INFINITY,
MINUS_INFINITY,
INF,
SPECIAL,
ATOM,
COLLECTION,
ALL,
};
// The JSON string segment was unable to be parsed completely
class PartialJSON extends Error {
}
class MalformedJSON extends Error {
}
/**
* Parse incomplete JSON
* @param {string} jsonString Partial JSON to be parsed
* @param {number} allowPartial Specify what types are allowed to be partial, see {@link Allow} for details
* @returns The parsed JSON
* @throws {PartialJSON} If the JSON is incomplete (related to the `allow` parameter)
* @throws {MalformedJSON} If the JSON is malformed
*/
function parseJSON(jsonString, allowPartial = Allow.ALL) {
if (typeof jsonString !== 'string') {
throw new TypeError(`expecting str, got ${typeof jsonString}`);
}
if (!jsonString.trim()) {
throw new Error(`${jsonString} is empty`);
}
return _parseJSON(jsonString.trim(), allowPartial);
}
const _parseJSON = (jsonString, allow) => {
const length = jsonString.length;
let index = 0;
const markPartialJSON = (msg) => {
throw new PartialJSON(`${msg} at position ${index}`);
};
const throwMalformedError = (msg) => {
throw new MalformedJSON(`${msg} at position ${index}`);
};
const parseAny = () => {
skipBlank();
if (index >= length)
markPartialJSON('Unexpected end of input');
if (jsonString[index] === '"')
return parseStr();
if (jsonString[index] === '{')
return parseObj();
if (jsonString[index] === '[')
return parseArr();
if (jsonString.substring(index, index + 4) === 'null' ||
(Allow.NULL & allow && length - index < 4 && 'null'.startsWith(jsonString.substring(index)))) {
index += 4;
return null;
}
if (jsonString.substring(index, index + 4) === 'true' ||
(Allow.BOOL & allow && length - index < 4 && 'true'.startsWith(jsonString.substring(index)))) {
index += 4;
return true;
}
if (jsonString.substring(index, index + 5) === 'false' ||
(Allow.BOOL & allow && length - index < 5 && 'false'.startsWith(jsonString.substring(index)))) {
index += 5;
return false;
}
if (jsonString.substring(index, index + 8) === 'Infinity' ||
(Allow.INFINITY & allow && length - index < 8 && 'Infinity'.startsWith(jsonString.substring(index)))) {
index += 8;
return Infinity;
}
if (jsonString.substring(index, index + 9) === '-Infinity' ||
(Allow.MINUS_INFINITY & allow &&
1 < length - index &&
length - index < 9 &&
'-Infinity'.startsWith(jsonString.substring(index)))) {
index += 9;
return -Infinity;
}
if (jsonString.substring(index, index + 3) === 'NaN' ||
(Allow.NAN & allow && length - index < 3 && 'NaN'.startsWith(jsonString.substring(index)))) {
index += 3;
return NaN;
}
return parseNum();
};
const parseStr = () => {
const start = index;
let escape = false;
index++; // skip initial quote
while (index < length && (jsonString[index] !== '"' || (escape && jsonString[index - 1] === '\\'))) {
escape = jsonString[index] === '\\' ? !escape : false;
index++;
}
if (jsonString.charAt(index) == '"') {
try {
return JSON.parse(jsonString.substring(start, ++index - Number(escape)));
}
catch (e) {
throwMalformedError(String(e));
}
}
else if (Allow.STR & allow) {
try {
return JSON.parse(jsonString.substring(start, index - Number(escape)) + '"');
}
catch (e) {
// SyntaxError: Invalid escape sequence
return JSON.parse(jsonString.substring(start, jsonString.lastIndexOf('\\')) + '"');
}
}
markPartialJSON('Unterminated string literal');
};
const parseObj = () => {
index++; // skip initial brace
skipBlank();
const obj = {};
try {
while (jsonString[index] !== '}') {
skipBlank();
if (index >= length && Allow.OBJ & allow)
return obj;
const key = parseStr();
skipBlank();
index++; // skip colon
try {
const value = parseAny();
Object.defineProperty(obj, key, { value, writable: true, enumerable: true, configurable: true });
}
catch (e) {
if (Allow.OBJ & allow)
return obj;
else
throw e;
}
skipBlank();
if (jsonString[index] === ',')
index++; // skip comma
}
}
catch (e) {
if (Allow.OBJ & allow)
return obj;
else
markPartialJSON("Expected '}' at end of object");
}
index++; // skip final brace
return obj;
};
const parseArr = () => {
index++; // skip initial bracket
const arr = [];
try {
while (jsonString[index] !== ']') {
arr.push(parseAny());
skipBlank();
if (jsonString[index] === ',') {
index++; // skip comma
}
}
}
catch (e) {
if (Allow.ARR & allow) {
return arr;
}
markPartialJSON("Expected ']' at end of array");
}
index++; // skip final bracket
return arr;
};
const parseNum = () => {
if (index === 0) {
if (jsonString === '-' && Allow.NUM & allow)
markPartialJSON("Not sure what '-' is");
try {
return JSON.parse(jsonString);
}
catch (e) {
if (Allow.NUM & allow) {
try {
if ('.' === jsonString[jsonString.length - 1])
return JSON.parse(jsonString.substring(0, jsonString.lastIndexOf('.')));
return JSON.parse(jsonString.substring(0, jsonString.lastIndexOf('e')));
}
catch (e) { }
}
throwMalformedError(String(e));
}
}
const start = index;
if (jsonString[index] === '-')
index++;
while (jsonString[index] && !',]}'.includes(jsonString[index]))
index++;
if (index == length && !(Allow.NUM & allow))
markPartialJSON('Unterminated number literal');
try {
return JSON.parse(jsonString.substring(start, index));
}
catch (e) {
if (jsonString.substring(start, index) === '-' && Allow.NUM & allow)
markPartialJSON("Not sure what '-' is");
try {
return JSON.parse(jsonString.substring(start, jsonString.lastIndexOf('e')));
}
catch (e) {
throwMalformedError(String(e));
}
}
};
const skipBlank = () => {
while (index < length && ' \n\r\t'.includes(jsonString[index])) {
index++;
}
};
return parseAny();
};
// using this function with malformed JSON is undefined behavior
const partialParse = (input) => parseJSON(input, Allow.ALL ^ Allow.NUM);
export { partialParse, PartialJSON, MalformedJSON };
//# sourceMappingURL=parser.mjs.map
File diff suppressed because one or more lines are too long
+32
View File
@@ -0,0 +1,32 @@
import { ZodSchema, ZodTypeDef } from 'zod/v3';
import { Refs, Seen } from "./Refs.mjs";
import { JsonSchema7Type } from "./parseDef.mjs";
export type Targets = 'jsonSchema7' | 'jsonSchema2019-09' | 'openApi3';
export type DateStrategy = 'format:date-time' | 'format:date' | 'string' | 'integer';
export declare const ignoreOverride: unique symbol;
export type Options<Target extends Targets = 'jsonSchema7'> = {
name: string | undefined;
$refStrategy: 'root' | 'relative' | 'none' | 'seen' | 'extract-to-root';
basePath: string[];
effectStrategy: 'input' | 'any';
pipeStrategy: 'input' | 'output' | 'all';
dateStrategy: DateStrategy | DateStrategy[];
mapStrategy: 'entries' | 'record';
removeAdditionalStrategy: 'passthrough' | 'strict';
nullableStrategy: 'from-target' | 'property';
target: Target;
strictUnions: boolean;
definitionPath: string;
definitions: Record<string, ZodSchema | ZodTypeDef>;
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' | 'duplicate-ref' | 'title';
override?: (def: ZodTypeDef, refs: Refs, seen: Seen | undefined, forceResolution?: boolean) => JsonSchema7Type | undefined | typeof ignoreOverride;
openaiStrictMode?: boolean;
};
export declare const getDefaultOptions: <Target extends Targets>(options: Partial<Options<Target>> | string | undefined) => Options<Target>;
//# sourceMappingURL=Options.d.mts.map
@@ -0,0 +1 @@
{"version":3,"file":"Options.d.mts","sourceRoot":"","sources":["../../src/_vendor/zod-to-json-schema/Options.ts"],"names":[],"mappings":"OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,QAAQ;OACvC,EAAE,IAAI,EAAE,IAAI,EAAE;OACd,EAAE,eAAe,EAAE;AAE1B,MAAM,MAAM,OAAO,GAAG,aAAa,GAAG,mBAAmB,GAAG,UAAU,CAAC;AAEvE,MAAM,MAAM,YAAY,GAAG,kBAAkB,GAAG,aAAa,GAAG,QAAQ,GAAG,SAAS,CAAC;AAErF,eAAO,MAAM,cAAc,eAA8D,CAAC;AAE1F,MAAM,MAAM,OAAO,CAAC,MAAM,SAAS,OAAO,GAAG,aAAa,IAAI;IAC5D,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,YAAY,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,iBAAiB,CAAC;IACxE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,cAAc,EAAE,OAAO,GAAG,KAAK,CAAC;IAChC,YAAY,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACzC,YAAY,EAAE,YAAY,GAAG,YAAY,EAAE,CAAC;IAC5C,WAAW,EAAE,SAAS,GAAG,QAAQ,CAAC;IAClC,wBAAwB,EAAE,aAAa,GAAG,QAAQ,CAAC;IACnD,gBAAgB,EAAE,aAAa,GAAG,UAAU,CAAC;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,CAAC,CAAC;IACpD,aAAa,EAAE,OAAO,CAAC;IACvB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,eAAe,EAAE,QAAQ,GAAG,UAAU,CAAC;IACvC,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,cAAc,GAAG,kBAAkB,GAAG,aAAa,CAAC;IACnE,cAAc,EAAE,eAAe,GAAG,wBAAwB,GAAG,aAAa,CAAC;IAC3E,YAAY,EAAE,KAAK,GAAG,eAAe,GAAG,OAAO,CAAC;IAChD,QAAQ,CAAC,EAAE,CACT,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,GAAG,SAAS,EACtB,eAAe,CAAC,EAAE,OAAO,KACtB,eAAe,GAAG,SAAS,GAAG,OAAO,cAAc,CAAC;IACzD,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAuBF,eAAO,MAAM,iBAAiB,GAAI,MAAM,SAAS,OAAO,EACtD,SAAS,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,GAAG,SAAS,KAgB5C,OAAO,CAAC,MAAM,CACzB,CAAC"}
+32
View File
@@ -0,0 +1,32 @@
import { ZodSchema, ZodTypeDef } from 'zod/v3';
import { Refs, Seen } from "./Refs.js";
import { JsonSchema7Type } from "./parseDef.js";
export type Targets = 'jsonSchema7' | 'jsonSchema2019-09' | 'openApi3';
export type DateStrategy = 'format:date-time' | 'format:date' | 'string' | 'integer';
export declare const ignoreOverride: unique symbol;
export type Options<Target extends Targets = 'jsonSchema7'> = {
name: string | undefined;
$refStrategy: 'root' | 'relative' | 'none' | 'seen' | 'extract-to-root';
basePath: string[];
effectStrategy: 'input' | 'any';
pipeStrategy: 'input' | 'output' | 'all';
dateStrategy: DateStrategy | DateStrategy[];
mapStrategy: 'entries' | 'record';
removeAdditionalStrategy: 'passthrough' | 'strict';
nullableStrategy: 'from-target' | 'property';
target: Target;
strictUnions: boolean;
definitionPath: string;
definitions: Record<string, ZodSchema | ZodTypeDef>;
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' | 'duplicate-ref' | 'title';
override?: (def: ZodTypeDef, refs: Refs, seen: Seen | undefined, forceResolution?: boolean) => JsonSchema7Type | undefined | typeof ignoreOverride;
openaiStrictMode?: boolean;
};
export declare const getDefaultOptions: <Target extends Targets>(options: Partial<Options<Target>> | string | undefined) => Options<Target>;
//# sourceMappingURL=Options.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"Options.d.ts","sourceRoot":"","sources":["../../src/_vendor/zod-to-json-schema/Options.ts"],"names":[],"mappings":"OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,QAAQ;OACvC,EAAE,IAAI,EAAE,IAAI,EAAE;OACd,EAAE,eAAe,EAAE;AAE1B,MAAM,MAAM,OAAO,GAAG,aAAa,GAAG,mBAAmB,GAAG,UAAU,CAAC;AAEvE,MAAM,MAAM,YAAY,GAAG,kBAAkB,GAAG,aAAa,GAAG,QAAQ,GAAG,SAAS,CAAC;AAErF,eAAO,MAAM,cAAc,eAA8D,CAAC;AAE1F,MAAM,MAAM,OAAO,CAAC,MAAM,SAAS,OAAO,GAAG,aAAa,IAAI;IAC5D,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,YAAY,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,iBAAiB,CAAC;IACxE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,cAAc,EAAE,OAAO,GAAG,KAAK,CAAC;IAChC,YAAY,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACzC,YAAY,EAAE,YAAY,GAAG,YAAY,EAAE,CAAC;IAC5C,WAAW,EAAE,SAAS,GAAG,QAAQ,CAAC;IAClC,wBAAwB,EAAE,aAAa,GAAG,QAAQ,CAAC;IACnD,gBAAgB,EAAE,aAAa,GAAG,UAAU,CAAC;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,CAAC,CAAC;IACpD,aAAa,EAAE,OAAO,CAAC;IACvB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,eAAe,EAAE,QAAQ,GAAG,UAAU,CAAC;IACvC,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,cAAc,GAAG,kBAAkB,GAAG,aAAa,CAAC;IACnE,cAAc,EAAE,eAAe,GAAG,wBAAwB,GAAG,aAAa,CAAC;IAC3E,YAAY,EAAE,KAAK,GAAG,eAAe,GAAG,OAAO,CAAC;IAChD,QAAQ,CAAC,EAAE,CACT,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,GAAG,SAAS,EACtB,eAAe,CAAC,EAAE,OAAO,KACtB,eAAe,GAAG,SAAS,GAAG,OAAO,cAAc,CAAC;IACzD,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAuBF,eAAO,MAAM,iBAAiB,GAAI,MAAM,SAAS,OAAO,EACtD,SAAS,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,GAAG,SAAS,KAgB5C,OAAO,CAAC,MAAM,CACzB,CAAC"}
+42
View File
@@ -0,0 +1,42 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDefaultOptions = exports.ignoreOverride = void 0;
exports.ignoreOverride = Symbol('Let zodToJsonSchema decide on which parser to use');
const defaultOptions = {
name: undefined,
$refStrategy: 'root',
effectStrategy: 'input',
pipeStrategy: 'all',
dateStrategy: 'format:date-time',
mapStrategy: 'entries',
nullableStrategy: 'from-target',
removeAdditionalStrategy: 'passthrough',
definitionPath: 'definitions',
target: 'jsonSchema7',
strictUnions: false,
errorMessages: false,
markdownDescription: false,
patternStrategy: 'escape',
applyRegexFlags: false,
emailStrategy: 'format:email',
base64Strategy: 'contentEncoding:base64',
nameStrategy: 'ref',
};
const getDefaultOptions = (options) => {
// We need to add `definitions` here as we may mutate it
return (typeof options === 'string' ?
{
...defaultOptions,
basePath: ['#'],
definitions: {},
name: options,
}
: {
...defaultOptions,
basePath: ['#'],
definitions: {},
...options,
});
};
exports.getDefaultOptions = getDefaultOptions;
//# sourceMappingURL=Options.js.map
@@ -0,0 +1 @@
{"version":3,"file":"Options.js","sourceRoot":"","sources":["../../src/_vendor/zod-to-json-schema/Options.ts"],"names":[],"mappings":";;;AAQa,QAAA,cAAc,GAAG,MAAM,CAAC,mDAAmD,CAAC,CAAC;AAgC1F,MAAM,cAAc,GAA8C;IAChE,IAAI,EAAE,SAAS;IACf,YAAY,EAAE,MAAM;IACpB,cAAc,EAAE,OAAO;IACvB,YAAY,EAAE,KAAK;IACnB,YAAY,EAAE,kBAAkB;IAChC,WAAW,EAAE,SAAS;IACtB,gBAAgB,EAAE,aAAa;IAC/B,wBAAwB,EAAE,aAAa;IACvC,cAAc,EAAE,aAAa;IAC7B,MAAM,EAAE,aAAa;IACrB,YAAY,EAAE,KAAK;IACnB,aAAa,EAAE,KAAK;IACpB,mBAAmB,EAAE,KAAK;IAC1B,eAAe,EAAE,QAAQ;IACzB,eAAe,EAAE,KAAK;IACtB,aAAa,EAAE,cAAc;IAC7B,cAAc,EAAE,wBAAwB;IACxC,YAAY,EAAE,KAAK;CACpB,CAAC;AAEK,MAAM,iBAAiB,GAAG,CAC/B,OAAsD,EACtD,EAAE;IACF,wDAAwD;IACxD,OAAO,CACL,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC;QAC3B;YACE,GAAG,cAAc;YACjB,QAAQ,EAAE,CAAC,GAAG,CAAC;YACf,WAAW,EAAE,EAAE;YACf,IAAI,EAAE,OAAO;SACd;QACH,CAAC,CAAC;YACE,GAAG,cAAc;YACjB,QAAQ,EAAE,CAAC,GAAG,CAAC;YACf,WAAW,EAAE,EAAE;YACf,GAAG,OAAO;SACX,CAAoB,CAAC;AAC5B,CAAC,CAAC;AAlBW,QAAA,iBAAiB,qBAkB5B"}
+38
View File
@@ -0,0 +1,38 @@
export const ignoreOverride = Symbol('Let zodToJsonSchema decide on which parser to use');
const defaultOptions = {
name: undefined,
$refStrategy: 'root',
effectStrategy: 'input',
pipeStrategy: 'all',
dateStrategy: 'format:date-time',
mapStrategy: 'entries',
nullableStrategy: 'from-target',
removeAdditionalStrategy: 'passthrough',
definitionPath: 'definitions',
target: 'jsonSchema7',
strictUnions: false,
errorMessages: false,
markdownDescription: false,
patternStrategy: 'escape',
applyRegexFlags: false,
emailStrategy: 'format:email',
base64Strategy: 'contentEncoding:base64',
nameStrategy: 'ref',
};
export const getDefaultOptions = (options) => {
// We need to add `definitions` here as we may mutate it
return (typeof options === 'string' ?
{
...defaultOptions,
basePath: ['#'],
definitions: {},
name: options,
}
: {
...defaultOptions,
basePath: ['#'],
definitions: {},
...options,
});
};
//# sourceMappingURL=Options.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"Options.mjs","sourceRoot":"","sources":["../../src/_vendor/zod-to-json-schema/Options.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,mDAAmD,CAAC,CAAC;AAgC1F,MAAM,cAAc,GAA8C;IAChE,IAAI,EAAE,SAAS;IACf,YAAY,EAAE,MAAM;IACpB,cAAc,EAAE,OAAO;IACvB,YAAY,EAAE,KAAK;IACnB,YAAY,EAAE,kBAAkB;IAChC,WAAW,EAAE,SAAS;IACtB,gBAAgB,EAAE,aAAa;IAC/B,wBAAwB,EAAE,aAAa;IACvC,cAAc,EAAE,aAAa;IAC7B,MAAM,EAAE,aAAa;IACrB,YAAY,EAAE,KAAK;IACnB,aAAa,EAAE,KAAK;IACpB,mBAAmB,EAAE,KAAK;IAC1B,eAAe,EAAE,QAAQ;IACzB,eAAe,EAAE,KAAK;IACtB,aAAa,EAAE,cAAc;IAC7B,cAAc,EAAE,wBAAwB;IACxC,YAAY,EAAE,KAAK;CACpB,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,OAAsD,EACtD,EAAE;IACF,wDAAwD;IACxD,OAAO,CACL,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC;QAC3B;YACE,GAAG,cAAc;YACjB,QAAQ,EAAE,CAAC,GAAG,CAAC;YACf,WAAW,EAAE,EAAE;YACf,IAAI,EAAE,OAAO;SACd;QACH,CAAC,CAAC;YACE,GAAG,cAAc;YACjB,QAAQ,EAAE,CAAC,GAAG,CAAC;YACf,WAAW,EAAE,EAAE;YACf,GAAG,OAAO;SACX,CAAoB,CAAC;AAC5B,CAAC,CAAC"}
+21
View File
@@ -0,0 +1,21 @@
import type { ZodTypeDef } from 'zod/v3';
import { Options, Targets } from "./Options.mjs";
import { JsonSchema7Type } from "./parseDef.mjs";
export type Refs = {
seen: Map<ZodTypeDef, Seen>;
/**
* Set of all the `$ref`s we created, e.g. `Set(['#/$defs/ui'])`
* this notable does not include any `definitions` that were
* explicitly given as an option.
*/
seenRefs: Set<string>;
currentPath: string[];
propertyPath: string[] | undefined;
} & Options<Targets>;
export type Seen = {
def: ZodTypeDef;
path: string[];
jsonSchema: JsonSchema7Type | undefined;
};
export declare const getRefs: (options?: string | Partial<Options<Targets>>) => Refs;
//# sourceMappingURL=Refs.d.mts.map
@@ -0,0 +1 @@
{"version":3,"file":"Refs.d.mts","sourceRoot":"","sources":["../../src/_vendor/zod-to-json-schema/Refs.ts"],"names":[],"mappings":"OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ;OACjC,EAAqB,OAAO,EAAE,OAAO,EAAE;OACvC,EAAE,eAAe,EAAE;AAG1B,MAAM,MAAM,IAAI,GAAG;IACjB,IAAI,EAAE,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CACpC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAErB,MAAM,MAAM,IAAI,GAAG;IACjB,GAAG,EAAE,UAAU,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,UAAU,EAAE,eAAe,GAAG,SAAS,CAAC;CACzC,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,UAAU,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAG,IAuBtE,CAAC"}
+21
View File
@@ -0,0 +1,21 @@
import type { ZodTypeDef } from 'zod/v3';
import { Options, Targets } from "./Options.js";
import { JsonSchema7Type } from "./parseDef.js";
export type Refs = {
seen: Map<ZodTypeDef, Seen>;
/**
* Set of all the `$ref`s we created, e.g. `Set(['#/$defs/ui'])`
* this notable does not include any `definitions` that were
* explicitly given as an option.
*/
seenRefs: Set<string>;
currentPath: string[];
propertyPath: string[] | undefined;
} & Options<Targets>;
export type Seen = {
def: ZodTypeDef;
path: string[];
jsonSchema: JsonSchema7Type | undefined;
};
export declare const getRefs: (options?: string | Partial<Options<Targets>>) => Refs;
//# sourceMappingURL=Refs.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"Refs.d.ts","sourceRoot":"","sources":["../../src/_vendor/zod-to-json-schema/Refs.ts"],"names":[],"mappings":"OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ;OACjC,EAAqB,OAAO,EAAE,OAAO,EAAE;OACvC,EAAE,eAAe,EAAE;AAG1B,MAAM,MAAM,IAAI,GAAG;IACjB,IAAI,EAAE,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CACpC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAErB,MAAM,MAAM,IAAI,GAAG;IACjB,GAAG,EAAE,UAAU,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,UAAU,EAAE,eAAe,GAAG,SAAS,CAAC;CACzC,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,UAAU,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAG,IAuBtE,CAAC"}
+28
View File
@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRefs = void 0;
const Options_1 = require("./Options.js");
const util_1 = require("./util.js");
const getRefs = (options) => {
const _options = (0, Options_1.getDefaultOptions)(options);
const currentPath = _options.name !== undefined ?
[..._options.basePath, _options.definitionPath, _options.name]
: _options.basePath;
return {
..._options,
currentPath: currentPath,
propertyPath: undefined,
seenRefs: new Set(),
seen: new Map(Object.entries(_options.definitions).map(([name, def]) => [
(0, util_1.zodDef)(def),
{
def: (0, util_1.zodDef)(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;
//# sourceMappingURL=Refs.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"Refs.js","sourceRoot":"","sources":["../../src/_vendor/zod-to-json-schema/Refs.ts"],"names":[],"mappings":";;;AACA,0CAAgE;AAEhE,oCAAgC;AAoBzB,MAAM,OAAO,GAAG,CAAC,OAA4C,EAAQ,EAAE;IAC5E,MAAM,QAAQ,GAAG,IAAA,2BAAiB,EAAC,OAAO,CAAC,CAAC;IAC5C,MAAM,WAAW,GACf,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;QAC3B,CAAC,GAAG,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,IAAI,CAAC;QAChE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;IACtB,OAAO;QACL,GAAG,QAAQ;QACX,WAAW,EAAE,WAAW;QACxB,YAAY,EAAE,SAAS;QACvB,QAAQ,EAAE,IAAI,GAAG,EAAE;QACnB,IAAI,EAAE,IAAI,GAAG,CACX,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC;YACxD,IAAA,aAAM,EAAC,GAAG,CAAC;YACX;gBACE,GAAG,EAAE,IAAA,aAAM,EAAC,GAAG,CAAC;gBAChB,IAAI,EAAE,CAAC,GAAG,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,cAAc,EAAE,IAAI,CAAC;gBAC3D,kHAAkH;gBAClH,UAAU,EAAE,SAAS;aACtB;SACF,CAAC,CACH;KACF,CAAC;AACJ,CAAC,CAAC;AAvBW,QAAA,OAAO,WAuBlB"}
+24
View File
@@ -0,0 +1,24 @@
import { getDefaultOptions } from "./Options.mjs";
import { zodDef } from "./util.mjs";
export const getRefs = (options) => {
const _options = getDefaultOptions(options);
const currentPath = _options.name !== undefined ?
[..._options.basePath, _options.definitionPath, _options.name]
: _options.basePath;
return {
..._options,
currentPath: currentPath,
propertyPath: undefined,
seenRefs: new Set(),
seen: new Map(Object.entries(_options.definitions).map(([name, def]) => [
zodDef(def),
{
def: zodDef(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,
},
])),
};
};
//# sourceMappingURL=Refs.mjs.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"Refs.mjs","sourceRoot":"","sources":["../../src/_vendor/zod-to-json-schema/Refs.ts"],"names":[],"mappings":"OACO,EAAE,iBAAiB,EAAoB;OAEvC,EAAE,MAAM,EAAE;AAoBjB,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,OAA4C,EAAQ,EAAE;IAC5E,MAAM,QAAQ,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC5C,MAAM,WAAW,GACf,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;QAC3B,CAAC,GAAG,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,IAAI,CAAC;QAChE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;IACtB,OAAO;QACL,GAAG,QAAQ;QACX,WAAW,EAAE,WAAW;QACxB,YAAY,EAAE,SAAS;QACvB,QAAQ,EAAE,IAAI,GAAG,EAAE;QACnB,IAAI,EAAE,IAAI,GAAG,CACX,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC;YACxD,MAAM,CAAC,GAAG,CAAC;YACX;gBACE,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC;gBAChB,IAAI,EAAE,CAAC,GAAG,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,cAAc,EAAE,IAAI,CAAC;gBAC3D,kHAAkH;gBAClH,UAAU,EAAE,SAAS;aACtB;SACF,CAAC,CACH;KACF,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,12 @@
import { JsonSchema7TypeUnion } from "./parseDef.mjs";
import { Refs } from "./Refs.mjs";
export type ErrorMessages<T extends JsonSchema7TypeUnion, OmitProperties extends string = ''> = Partial<Omit<{
[key in keyof T]: string;
}, OmitProperties | 'type' | 'errorMessages'>>;
export declare function addErrorMessage<T extends {
errorMessage?: ErrorMessages<any>;
}>(res: T, key: keyof T, errorMessage: string | undefined, refs: Refs): void;
export declare function setResponseValueAndErrors<Json7Type extends JsonSchema7TypeUnion & {
errorMessage?: ErrorMessages<Json7Type>;
}, Key extends keyof Omit<Json7Type, 'errorMessage'>>(res: Json7Type, key: Key, value: Json7Type[Key], errorMessage: string | undefined, refs: Refs): void;
//# sourceMappingURL=errorMessages.d.mts.map
@@ -0,0 +1 @@
{"version":3,"file":"errorMessages.d.mts","sourceRoot":"","sources":["../../src/_vendor/zod-to-json-schema/errorMessages.ts"],"names":[],"mappings":"OAAO,EAAE,oBAAoB,EAAE;OACxB,EAAE,IAAI,EAAE;AAEf,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,oBAAoB,EAAE,cAAc,SAAS,MAAM,GAAG,EAAE,IAAI,OAAO,CACrG,IAAI,CAAC;KAAG,GAAG,IAAI,MAAM,CAAC,GAAG,MAAM;CAAE,EAAE,cAAc,GAAG,MAAM,GAAG,eAAe,CAAC,CAC9E,CAAC;AAEF,wBAAgB,eAAe,CAAC,CAAC,SAAS;IAAE,YAAY,CAAC,EAAE,aAAa,CAAC,GAAG,CAAC,CAAA;CAAE,EAC7E,GAAG,EAAE,CAAC,EACN,GAAG,EAAE,MAAM,CAAC,EACZ,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,IAAI,EAAE,IAAI,QASX;AAED,wBAAgB,yBAAyB,CACvC,SAAS,SAAS,oBAAoB,GAAG;IACvC,YAAY,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;CACzC,EACD,GAAG,SAAS,MAAM,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,EACjD,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,YAAY,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,IAAI,QAG9F"}
@@ -0,0 +1,12 @@
import { JsonSchema7TypeUnion } from "./parseDef.js";
import { Refs } from "./Refs.js";
export type ErrorMessages<T extends JsonSchema7TypeUnion, OmitProperties extends string = ''> = Partial<Omit<{
[key in keyof T]: string;
}, OmitProperties | 'type' | 'errorMessages'>>;
export declare function addErrorMessage<T extends {
errorMessage?: ErrorMessages<any>;
}>(res: T, key: keyof T, errorMessage: string | undefined, refs: Refs): void;
export declare function setResponseValueAndErrors<Json7Type extends JsonSchema7TypeUnion & {
errorMessage?: ErrorMessages<Json7Type>;
}, Key extends keyof Omit<Json7Type, 'errorMessage'>>(res: Json7Type, key: Key, value: Json7Type[Key], errorMessage: string | undefined, refs: Refs): void;
//# sourceMappingURL=errorMessages.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"errorMessages.d.ts","sourceRoot":"","sources":["../../src/_vendor/zod-to-json-schema/errorMessages.ts"],"names":[],"mappings":"OAAO,EAAE,oBAAoB,EAAE;OACxB,EAAE,IAAI,EAAE;AAEf,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,oBAAoB,EAAE,cAAc,SAAS,MAAM,GAAG,EAAE,IAAI,OAAO,CACrG,IAAI,CAAC;KAAG,GAAG,IAAI,MAAM,CAAC,GAAG,MAAM;CAAE,EAAE,cAAc,GAAG,MAAM,GAAG,eAAe,CAAC,CAC9E,CAAC;AAEF,wBAAgB,eAAe,CAAC,CAAC,SAAS;IAAE,YAAY,CAAC,EAAE,aAAa,CAAC,GAAG,CAAC,CAAA;CAAE,EAC7E,GAAG,EAAE,CAAC,EACN,GAAG,EAAE,MAAM,CAAC,EACZ,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,IAAI,EAAE,IAAI,QASX;AAED,wBAAgB,yBAAyB,CACvC,SAAS,SAAS,oBAAoB,GAAG;IACvC,YAAY,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;CACzC,EACD,GAAG,SAAS,MAAM,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,EACjD,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,YAAY,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,IAAI,QAG9F"}
@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.addErrorMessage = addErrorMessage;
exports.setResponseValueAndErrors = setResponseValueAndErrors;
function addErrorMessage(res, key, errorMessage, refs) {
if (!refs?.errorMessages)
return;
if (errorMessage) {
res.errorMessage = {
...res.errorMessage,
[key]: errorMessage,
};
}
}
function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
res[key] = value;
addErrorMessage(res, key, errorMessage, refs);
}
//# sourceMappingURL=errorMessages.js.map
@@ -0,0 +1 @@
{"version":3,"file":"errorMessages.js","sourceRoot":"","sources":["../../src/_vendor/zod-to-json-schema/errorMessages.ts"],"names":[],"mappings":";;AAOA,0CAaC;AAED,8DAQC;AAvBD,SAAgB,eAAe,CAC7B,GAAM,EACN,GAAY,EACZ,YAAgC,EAChC,IAAU;IAEV,IAAI,CAAC,IAAI,EAAE,aAAa;QAAE,OAAO;IACjC,IAAI,YAAY,EAAE,CAAC;QACjB,GAAG,CAAC,YAAY,GAAG;YACjB,GAAG,GAAG,CAAC,YAAY;YACnB,CAAC,GAAG,CAAC,EAAE,YAAY;SACpB,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAgB,yBAAyB,CAKvC,GAAc,EAAE,GAAQ,EAAE,KAAqB,EAAE,YAAgC,EAAE,IAAU;IAC7F,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACjB,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;AAChD,CAAC"}
@@ -0,0 +1,15 @@
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);
}
//# sourceMappingURL=errorMessages.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"errorMessages.mjs","sourceRoot":"","sources":["../../src/_vendor/zod-to-json-schema/errorMessages.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,eAAe,CAC7B,GAAM,EACN,GAAY,EACZ,YAAgC,EAChC,IAAU;IAEV,IAAI,CAAC,IAAI,EAAE,aAAa;QAAE,OAAO;IACjC,IAAI,YAAY,EAAE,CAAC;QACjB,GAAG,CAAC,YAAY,GAAG;YACjB,GAAG,GAAG,CAAC,YAAY;YACnB,CAAC,GAAG,CAAC,EAAE,YAAY;SACpB,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,yBAAyB,CAKvC,GAAc,EAAE,GAAQ,EAAE,KAAqB,EAAE,YAAgC,EAAE,IAAU;IAC7F,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACjB,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;AAChD,CAAC"}
+38
View File
@@ -0,0 +1,38 @@
export * from "./Options.mjs";
export * from "./Refs.mjs";
export * from "./errorMessages.mjs";
export * from "./parseDef.mjs";
export * from "./parsers/any.mjs";
export * from "./parsers/array.mjs";
export * from "./parsers/bigint.mjs";
export * from "./parsers/boolean.mjs";
export * from "./parsers/branded.mjs";
export * from "./parsers/catch.mjs";
export * from "./parsers/date.mjs";
export * from "./parsers/default.mjs";
export * from "./parsers/effects.mjs";
export * from "./parsers/enum.mjs";
export * from "./parsers/intersection.mjs";
export * from "./parsers/literal.mjs";
export * from "./parsers/map.mjs";
export * from "./parsers/nativeEnum.mjs";
export * from "./parsers/never.mjs";
export * from "./parsers/null.mjs";
export * from "./parsers/nullable.mjs";
export * from "./parsers/number.mjs";
export * from "./parsers/object.mjs";
export * from "./parsers/optional.mjs";
export * from "./parsers/pipeline.mjs";
export * from "./parsers/promise.mjs";
export * from "./parsers/readonly.mjs";
export * from "./parsers/record.mjs";
export * from "./parsers/set.mjs";
export * from "./parsers/string.mjs";
export * from "./parsers/tuple.mjs";
export * from "./parsers/undefined.mjs";
export * from "./parsers/union.mjs";
export * from "./parsers/unknown.mjs";
export * from "./zodToJsonSchema.mjs";
import { zodToJsonSchema } from "./zodToJsonSchema.mjs";
export default zodToJsonSchema;
//# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/_vendor/zod-to-json-schema/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCO,EAAE,eAAe,EAAE;AAC1B,eAAe,eAAe,CAAC"}
+38
View File
@@ -0,0 +1,38 @@
export * from "./Options.js";
export * from "./Refs.js";
export * from "./errorMessages.js";
export * from "./parseDef.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 "./zodToJsonSchema.js";
import { zodToJsonSchema } from "./zodToJsonSchema.js";
export default zodToJsonSchema;
//# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/_vendor/zod-to-json-schema/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCO,EAAE,eAAe,EAAE;AAC1B,eAAe,eAAe,CAAC"}
+41
View File
@@ -0,0 +1,41 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("../../internal/tslib.js");
tslib_1.__exportStar(require("./Options.js"), exports);
tslib_1.__exportStar(require("./Refs.js"), exports);
tslib_1.__exportStar(require("./errorMessages.js"), exports);
tslib_1.__exportStar(require("./parseDef.js"), exports);
tslib_1.__exportStar(require("./parsers/any.js"), exports);
tslib_1.__exportStar(require("./parsers/array.js"), exports);
tslib_1.__exportStar(require("./parsers/bigint.js"), exports);
tslib_1.__exportStar(require("./parsers/boolean.js"), exports);
tslib_1.__exportStar(require("./parsers/branded.js"), exports);
tslib_1.__exportStar(require("./parsers/catch.js"), exports);
tslib_1.__exportStar(require("./parsers/date.js"), exports);
tslib_1.__exportStar(require("./parsers/default.js"), exports);
tslib_1.__exportStar(require("./parsers/effects.js"), exports);
tslib_1.__exportStar(require("./parsers/enum.js"), exports);
tslib_1.__exportStar(require("./parsers/intersection.js"), exports);
tslib_1.__exportStar(require("./parsers/literal.js"), exports);
tslib_1.__exportStar(require("./parsers/map.js"), exports);
tslib_1.__exportStar(require("./parsers/nativeEnum.js"), exports);
tslib_1.__exportStar(require("./parsers/never.js"), exports);
tslib_1.__exportStar(require("./parsers/null.js"), exports);
tslib_1.__exportStar(require("./parsers/nullable.js"), exports);
tslib_1.__exportStar(require("./parsers/number.js"), exports);
tslib_1.__exportStar(require("./parsers/object.js"), exports);
tslib_1.__exportStar(require("./parsers/optional.js"), exports);
tslib_1.__exportStar(require("./parsers/pipeline.js"), exports);
tslib_1.__exportStar(require("./parsers/promise.js"), exports);
tslib_1.__exportStar(require("./parsers/readonly.js"), exports);
tslib_1.__exportStar(require("./parsers/record.js"), exports);
tslib_1.__exportStar(require("./parsers/set.js"), exports);
tslib_1.__exportStar(require("./parsers/string.js"), exports);
tslib_1.__exportStar(require("./parsers/tuple.js"), exports);
tslib_1.__exportStar(require("./parsers/undefined.js"), exports);
tslib_1.__exportStar(require("./parsers/union.js"), exports);
tslib_1.__exportStar(require("./parsers/unknown.js"), exports);
tslib_1.__exportStar(require("./zodToJsonSchema.js"), exports);
const zodToJsonSchema_1 = require("./zodToJsonSchema.js");
exports.default = zodToJsonSchema_1.zodToJsonSchema;
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/_vendor/zod-to-json-schema/index.ts"],"names":[],"mappings":";;;AAAA,uDAA0B;AAC1B,oDAAuB;AACvB,6DAAgC;AAChC,wDAA2B;AAC3B,2DAA8B;AAC9B,6DAAgC;AAChC,8DAAiC;AACjC,+DAAkC;AAClC,+DAAkC;AAClC,6DAAgC;AAChC,4DAA+B;AAC/B,+DAAkC;AAClC,+DAAkC;AAClC,4DAA+B;AAC/B,oEAAuC;AACvC,+DAAkC;AAClC,2DAA8B;AAC9B,kEAAqC;AACrC,6DAAgC;AAChC,4DAA+B;AAC/B,gEAAmC;AACnC,8DAAiC;AACjC,8DAAiC;AACjC,gEAAmC;AACnC,gEAAmC;AACnC,+DAAkC;AAClC,gEAAmC;AACnC,8DAAiC;AACjC,2DAA8B;AAC9B,8DAAiC;AACjC,6DAAgC;AAChC,iEAAoC;AACpC,6DAAgC;AAChC,+DAAkC;AAClC,+DAAkC;AAClC,0DAAoD;AACpD,kBAAe,iCAAe,CAAC"}
+38
View File
@@ -0,0 +1,38 @@
export * from "./Options.mjs";
export * from "./Refs.mjs";
export * from "./errorMessages.mjs";
export * from "./parseDef.mjs";
export * from "./parsers/any.mjs";
export * from "./parsers/array.mjs";
export * from "./parsers/bigint.mjs";
export * from "./parsers/boolean.mjs";
export * from "./parsers/branded.mjs";
export * from "./parsers/catch.mjs";
export * from "./parsers/date.mjs";
export * from "./parsers/default.mjs";
export * from "./parsers/effects.mjs";
export * from "./parsers/enum.mjs";
export * from "./parsers/intersection.mjs";
export * from "./parsers/literal.mjs";
export * from "./parsers/map.mjs";
export * from "./parsers/nativeEnum.mjs";
export * from "./parsers/never.mjs";
export * from "./parsers/null.mjs";
export * from "./parsers/nullable.mjs";
export * from "./parsers/number.mjs";
export * from "./parsers/object.mjs";
export * from "./parsers/optional.mjs";
export * from "./parsers/pipeline.mjs";
export * from "./parsers/promise.mjs";
export * from "./parsers/readonly.mjs";
export * from "./parsers/record.mjs";
export * from "./parsers/set.mjs";
export * from "./parsers/string.mjs";
export * from "./parsers/tuple.mjs";
export * from "./parsers/undefined.mjs";
export * from "./parsers/union.mjs";
export * from "./parsers/unknown.mjs";
export * from "./zodToJsonSchema.mjs";
import { zodToJsonSchema } from "./zodToJsonSchema.mjs";
export default zodToJsonSchema;
//# sourceMappingURL=index.mjs.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/_vendor/zod-to-json-schema/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCO,EAAE,eAAe,EAAE;AAC1B,eAAe,eAAe,CAAC"}
+38
View File
@@ -0,0 +1,38 @@
import { ZodTypeDef } from 'zod/v3';
import { JsonSchema7AnyType } from "./parsers/any.mjs";
import { JsonSchema7ArrayType } from "./parsers/array.mjs";
import { JsonSchema7BigintType } from "./parsers/bigint.mjs";
import { JsonSchema7BooleanType } from "./parsers/boolean.mjs";
import { JsonSchema7DateType } from "./parsers/date.mjs";
import { JsonSchema7EnumType } from "./parsers/enum.mjs";
import { JsonSchema7AllOfType } from "./parsers/intersection.mjs";
import { JsonSchema7LiteralType } from "./parsers/literal.mjs";
import { JsonSchema7MapType } from "./parsers/map.mjs";
import { JsonSchema7NativeEnumType } from "./parsers/nativeEnum.mjs";
import { JsonSchema7NeverType } from "./parsers/never.mjs";
import { JsonSchema7NullType } from "./parsers/null.mjs";
import { JsonSchema7NullableType } from "./parsers/nullable.mjs";
import { JsonSchema7NumberType } from "./parsers/number.mjs";
import { JsonSchema7ObjectType } from "./parsers/object.mjs";
import { JsonSchema7RecordType } from "./parsers/record.mjs";
import { JsonSchema7SetType } from "./parsers/set.mjs";
import { JsonSchema7StringType } from "./parsers/string.mjs";
import { JsonSchema7TupleType } from "./parsers/tuple.mjs";
import { JsonSchema7UndefinedType } from "./parsers/undefined.mjs";
import { JsonSchema7UnionType } from "./parsers/union.mjs";
import { JsonSchema7UnknownType } from "./parsers/unknown.mjs";
import { Refs } from "./Refs.mjs";
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 declare function parseDef(def: ZodTypeDef, refs: Refs, forceResolution?: boolean): JsonSchema7Type | undefined;
export {};
//# sourceMappingURL=parseDef.d.mts.map
@@ -0,0 +1 @@
{"version":3,"file":"parseDef.d.mts","sourceRoot":"","sources":["../../src/_vendor/zod-to-json-schema/parseDef.ts"],"names":[],"mappings":"OAAO,EAAyB,UAAU,EAAE,MAAM,QAAQ;OACnD,EAAE,kBAAkB,EAAe;OACnC,EAAE,oBAAoB,EAAiB;OACvC,EAAE,qBAAqB,EAAkB;OACzC,EAAE,sBAAsB,EAAmB;OAG3C,EAAE,mBAAmB,EAAgB;OAGrC,EAAE,mBAAmB,EAAgB;OACrC,EAAE,oBAAoB,EAAwB;OAC9C,EAAE,sBAAsB,EAAmB;OAC3C,EAAE,kBAAkB,EAAe;OACnC,EAAE,yBAAyB,EAAsB;OACjD,EAAE,oBAAoB,EAAiB;OACvC,EAAE,mBAAmB,EAAgB;OACrC,EAAE,uBAAuB,EAAoB;OAC7C,EAAE,qBAAqB,EAAkB;OACzC,EAAE,qBAAqB,EAAkB;OAIzC,EAAE,qBAAqB,EAAkB;OACzC,EAAE,kBAAkB,EAAe;OACnC,EAAE,qBAAqB,EAAkB;OACzC,EAAE,oBAAoB,EAAiB;OACvC,EAAE,wBAAwB,EAAqB;OAC/C,EAAE,oBAAoB,EAAiB;OACvC,EAAE,sBAAsB,EAAmB;OAC3C,EAAE,IAAI,EAAQ;AAIrB,KAAK,kBAAkB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAC3C,KAAK,eAAe,GAAG;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAC5B,qBAAqB,GACrB,oBAAoB,GACpB,qBAAqB,GACrB,qBAAqB,GACrB,sBAAsB,GACtB,mBAAmB,GACnB,mBAAmB,GACnB,sBAAsB,GACtB,yBAAyB,GACzB,mBAAmB,GACnB,qBAAqB,GACrB,qBAAqB,GACrB,qBAAqB,GACrB,oBAAoB,GACpB,oBAAoB,GACpB,wBAAwB,GACxB,kBAAkB,GAClB,oBAAoB,GACpB,kBAAkB,GAClB,kBAAkB,GAClB,uBAAuB,GACvB,oBAAoB,GACpB,sBAAsB,GACtB,kBAAkB,CAAC;AAEvB,MAAM,MAAM,eAAe,GAAG,oBAAoB,GAAG,eAAe,CAAC;AAErE,wBAAgB,QAAQ,CACtB,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,IAAI,EACV,eAAe,UAAQ,GACtB,eAAe,GAAG,SAAS,CAoC7B"}
+38
View File
@@ -0,0 +1,38 @@
import { ZodTypeDef } from 'zod/v3';
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";
import { Refs } from "./Refs.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 declare function parseDef(def: ZodTypeDef, refs: Refs, forceResolution?: boolean): JsonSchema7Type | undefined;
export {};
//# sourceMappingURL=parseDef.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"parseDef.d.ts","sourceRoot":"","sources":["../../src/_vendor/zod-to-json-schema/parseDef.ts"],"names":[],"mappings":"OAAO,EAAyB,UAAU,EAAE,MAAM,QAAQ;OACnD,EAAE,kBAAkB,EAAe;OACnC,EAAE,oBAAoB,EAAiB;OACvC,EAAE,qBAAqB,EAAkB;OACzC,EAAE,sBAAsB,EAAmB;OAG3C,EAAE,mBAAmB,EAAgB;OAGrC,EAAE,mBAAmB,EAAgB;OACrC,EAAE,oBAAoB,EAAwB;OAC9C,EAAE,sBAAsB,EAAmB;OAC3C,EAAE,kBAAkB,EAAe;OACnC,EAAE,yBAAyB,EAAsB;OACjD,EAAE,oBAAoB,EAAiB;OACvC,EAAE,mBAAmB,EAAgB;OACrC,EAAE,uBAAuB,EAAoB;OAC7C,EAAE,qBAAqB,EAAkB;OACzC,EAAE,qBAAqB,EAAkB;OAIzC,EAAE,qBAAqB,EAAkB;OACzC,EAAE,kBAAkB,EAAe;OACnC,EAAE,qBAAqB,EAAkB;OACzC,EAAE,oBAAoB,EAAiB;OACvC,EAAE,wBAAwB,EAAqB;OAC/C,EAAE,oBAAoB,EAAiB;OACvC,EAAE,sBAAsB,EAAmB;OAC3C,EAAE,IAAI,EAAQ;AAIrB,KAAK,kBAAkB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAC3C,KAAK,eAAe,GAAG;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAC5B,qBAAqB,GACrB,oBAAoB,GACpB,qBAAqB,GACrB,qBAAqB,GACrB,sBAAsB,GACtB,mBAAmB,GACnB,mBAAmB,GACnB,sBAAsB,GACtB,yBAAyB,GACzB,mBAAmB,GACnB,qBAAqB,GACrB,qBAAqB,GACrB,qBAAqB,GACrB,oBAAoB,GACpB,oBAAoB,GACpB,wBAAwB,GACxB,kBAAkB,GAClB,oBAAoB,GACpB,kBAAkB,GAClB,kBAAkB,GAClB,uBAAuB,GACvB,oBAAoB,GACpB,sBAAsB,GACtB,kBAAkB,CAAC;AAEvB,MAAM,MAAM,eAAe,GAAG,oBAAoB,GAAG,eAAe,CAAC;AAErE,wBAAgB,QAAQ,CACtB,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,IAAI,EACV,eAAe,UAAQ,GACtB,eAAe,GAAG,SAAS,CAoC7B"}
+186
View File
@@ -0,0 +1,186 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseDef = parseDef;
const v3_1 = require("zod/v3");
const any_1 = require("./parsers/any.js");
const array_1 = require("./parsers/array.js");
const bigint_1 = require("./parsers/bigint.js");
const boolean_1 = require("./parsers/boolean.js");
const branded_1 = require("./parsers/branded.js");
const catch_1 = require("./parsers/catch.js");
const date_1 = require("./parsers/date.js");
const default_1 = require("./parsers/default.js");
const effects_1 = require("./parsers/effects.js");
const enum_1 = require("./parsers/enum.js");
const intersection_1 = require("./parsers/intersection.js");
const literal_1 = require("./parsers/literal.js");
const map_1 = require("./parsers/map.js");
const nativeEnum_1 = require("./parsers/nativeEnum.js");
const never_1 = require("./parsers/never.js");
const null_1 = require("./parsers/null.js");
const nullable_1 = require("./parsers/nullable.js");
const number_1 = require("./parsers/number.js");
const object_1 = require("./parsers/object.js");
const optional_1 = require("./parsers/optional.js");
const pipeline_1 = require("./parsers/pipeline.js");
const promise_1 = require("./parsers/promise.js");
const record_1 = require("./parsers/record.js");
const set_1 = require("./parsers/set.js");
const string_1 = require("./parsers/string.js");
const tuple_1 = require("./parsers/tuple.js");
const undefined_1 = require("./parsers/undefined.js");
const union_1 = require("./parsers/union.js");
const unknown_1 = require("./parsers/unknown.js");
const readonly_1 = require("./parsers/readonly.js");
const Options_1 = require("./Options.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_1.ignoreOverride) {
return overrideResult;
}
}
if (seenItem && !forceResolution) {
const seenSchema = get$ref(seenItem, refs);
if (seenSchema !== undefined) {
if ('$ref' in seenSchema) {
refs.seenRefs.add(seenSchema.$ref);
}
return seenSchema;
}
}
const newItem = { def, path: refs.currentPath, jsonSchema: undefined };
refs.seen.set(def, newItem);
const jsonSchema = selectParser(def, def.typeName, refs, forceResolution);
if (jsonSchema) {
addMeta(def, refs, jsonSchema);
}
newItem.jsonSchema = jsonSchema;
return jsonSchema;
}
const get$ref = (item, refs) => {
switch (refs.$refStrategy) {
case 'root':
return { $ref: item.path.join('/') };
// this case is needed as OpenAI strict mode doesn't support top-level `$ref`s, i.e.
// the top-level schema *must* be `{"type": "object", "properties": {...}}` but if we ever
// need to define a `$ref`, relative `$ref`s aren't supported, so we need to extract
// the schema to `#/definitions/` and reference that.
//
// e.g. if we need to reference a schema at
// `["#","definitions","contactPerson","properties","person1","properties","name"]`
// then we'll extract it out to `contactPerson_properties_person1_properties_name`
case 'extract-to-root':
const name = item.path.slice(refs.basePath.length + 1).join('_');
// we don't need to extract the root schema in this case, as it's already
// been added to the definitions
if (name !== refs.name && refs.nameStrategy === 'duplicate-ref') {
refs.definitions[name] = item.def;
}
return { $ref: [...refs.basePath, refs.definitionPath, name].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 {};
}
return refs.$refStrategy === 'seen' ? {} : undefined;
}
}
};
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('/');
};
const selectParser = (def, typeName, refs, forceResolution) => {
switch (typeName) {
case v3_1.ZodFirstPartyTypeKind.ZodString:
return (0, string_1.parseStringDef)(def, refs);
case v3_1.ZodFirstPartyTypeKind.ZodNumber:
return (0, number_1.parseNumberDef)(def, refs);
case v3_1.ZodFirstPartyTypeKind.ZodObject:
return (0, object_1.parseObjectDef)(def, refs);
case v3_1.ZodFirstPartyTypeKind.ZodBigInt:
return (0, bigint_1.parseBigintDef)(def, refs);
case v3_1.ZodFirstPartyTypeKind.ZodBoolean:
return (0, boolean_1.parseBooleanDef)();
case v3_1.ZodFirstPartyTypeKind.ZodDate:
return (0, date_1.parseDateDef)(def, refs);
case v3_1.ZodFirstPartyTypeKind.ZodUndefined:
return (0, undefined_1.parseUndefinedDef)();
case v3_1.ZodFirstPartyTypeKind.ZodNull:
return (0, null_1.parseNullDef)(refs);
case v3_1.ZodFirstPartyTypeKind.ZodArray:
return (0, array_1.parseArrayDef)(def, refs);
case v3_1.ZodFirstPartyTypeKind.ZodUnion:
case v3_1.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
return (0, union_1.parseUnionDef)(def, refs);
case v3_1.ZodFirstPartyTypeKind.ZodIntersection:
return (0, intersection_1.parseIntersectionDef)(def, refs);
case v3_1.ZodFirstPartyTypeKind.ZodTuple:
return (0, tuple_1.parseTupleDef)(def, refs);
case v3_1.ZodFirstPartyTypeKind.ZodRecord:
return (0, record_1.parseRecordDef)(def, refs);
case v3_1.ZodFirstPartyTypeKind.ZodLiteral:
return (0, literal_1.parseLiteralDef)(def, refs);
case v3_1.ZodFirstPartyTypeKind.ZodEnum:
return (0, enum_1.parseEnumDef)(def);
case v3_1.ZodFirstPartyTypeKind.ZodNativeEnum:
return (0, nativeEnum_1.parseNativeEnumDef)(def);
case v3_1.ZodFirstPartyTypeKind.ZodNullable:
return (0, nullable_1.parseNullableDef)(def, refs);
case v3_1.ZodFirstPartyTypeKind.ZodOptional:
return (0, optional_1.parseOptionalDef)(def, refs);
case v3_1.ZodFirstPartyTypeKind.ZodMap:
return (0, map_1.parseMapDef)(def, refs);
case v3_1.ZodFirstPartyTypeKind.ZodSet:
return (0, set_1.parseSetDef)(def, refs);
case v3_1.ZodFirstPartyTypeKind.ZodLazy:
return parseDef(def.getter()._def, refs);
case v3_1.ZodFirstPartyTypeKind.ZodPromise:
return (0, promise_1.parsePromiseDef)(def, refs);
case v3_1.ZodFirstPartyTypeKind.ZodNaN:
case v3_1.ZodFirstPartyTypeKind.ZodNever:
return (0, never_1.parseNeverDef)();
case v3_1.ZodFirstPartyTypeKind.ZodEffects:
return (0, effects_1.parseEffectsDef)(def, refs, forceResolution);
case v3_1.ZodFirstPartyTypeKind.ZodAny:
return (0, any_1.parseAnyDef)();
case v3_1.ZodFirstPartyTypeKind.ZodUnknown:
return (0, unknown_1.parseUnknownDef)();
case v3_1.ZodFirstPartyTypeKind.ZodDefault:
return (0, default_1.parseDefaultDef)(def, refs);
case v3_1.ZodFirstPartyTypeKind.ZodBranded:
return (0, branded_1.parseBrandedDef)(def, refs);
case v3_1.ZodFirstPartyTypeKind.ZodReadonly:
return (0, readonly_1.parseReadonlyDef)(def, refs);
case v3_1.ZodFirstPartyTypeKind.ZodCatch:
return (0, catch_1.parseCatchDef)(def, refs);
case v3_1.ZodFirstPartyTypeKind.ZodPipeline:
return (0, pipeline_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);
}
};
const addMeta = (def, refs, jsonSchema) => {
if (def.description) {
jsonSchema.description = def.description;
if (refs.markdownDescription) {
jsonSchema.markdownDescription = def.description;
}
}
return jsonSchema;
};
//# sourceMappingURL=parseDef.js.map
File diff suppressed because one or more lines are too long
+183
View File
@@ -0,0 +1,183 @@
import { ZodFirstPartyTypeKind } from 'zod/v3';
import { parseAnyDef } from "./parsers/any.mjs";
import { parseArrayDef } from "./parsers/array.mjs";
import { parseBigintDef } from "./parsers/bigint.mjs";
import { parseBooleanDef } from "./parsers/boolean.mjs";
import { parseBrandedDef } from "./parsers/branded.mjs";
import { parseCatchDef } from "./parsers/catch.mjs";
import { parseDateDef } from "./parsers/date.mjs";
import { parseDefaultDef } from "./parsers/default.mjs";
import { parseEffectsDef } from "./parsers/effects.mjs";
import { parseEnumDef } from "./parsers/enum.mjs";
import { parseIntersectionDef } from "./parsers/intersection.mjs";
import { parseLiteralDef } from "./parsers/literal.mjs";
import { parseMapDef } from "./parsers/map.mjs";
import { parseNativeEnumDef } from "./parsers/nativeEnum.mjs";
import { parseNeverDef } from "./parsers/never.mjs";
import { parseNullDef } from "./parsers/null.mjs";
import { parseNullableDef } from "./parsers/nullable.mjs";
import { parseNumberDef } from "./parsers/number.mjs";
import { parseObjectDef } from "./parsers/object.mjs";
import { parseOptionalDef } from "./parsers/optional.mjs";
import { parsePipelineDef } from "./parsers/pipeline.mjs";
import { parsePromiseDef } from "./parsers/promise.mjs";
import { parseRecordDef } from "./parsers/record.mjs";
import { parseSetDef } from "./parsers/set.mjs";
import { parseStringDef } from "./parsers/string.mjs";
import { parseTupleDef } from "./parsers/tuple.mjs";
import { parseUndefinedDef } from "./parsers/undefined.mjs";
import { parseUnionDef } from "./parsers/union.mjs";
import { parseUnknownDef } from "./parsers/unknown.mjs";
import { parseReadonlyDef } from "./parsers/readonly.mjs";
import { ignoreOverride } from "./Options.mjs";
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) {
if ('$ref' in seenSchema) {
refs.seenRefs.add(seenSchema.$ref);
}
return seenSchema;
}
}
const newItem = { def, path: refs.currentPath, jsonSchema: undefined };
refs.seen.set(def, newItem);
const jsonSchema = selectParser(def, def.typeName, refs, forceResolution);
if (jsonSchema) {
addMeta(def, refs, jsonSchema);
}
newItem.jsonSchema = jsonSchema;
return jsonSchema;
}
const get$ref = (item, refs) => {
switch (refs.$refStrategy) {
case 'root':
return { $ref: item.path.join('/') };
// this case is needed as OpenAI strict mode doesn't support top-level `$ref`s, i.e.
// the top-level schema *must* be `{"type": "object", "properties": {...}}` but if we ever
// need to define a `$ref`, relative `$ref`s aren't supported, so we need to extract
// the schema to `#/definitions/` and reference that.
//
// e.g. if we need to reference a schema at
// `["#","definitions","contactPerson","properties","person1","properties","name"]`
// then we'll extract it out to `contactPerson_properties_person1_properties_name`
case 'extract-to-root':
const name = item.path.slice(refs.basePath.length + 1).join('_');
// we don't need to extract the root schema in this case, as it's already
// been added to the definitions
if (name !== refs.name && refs.nameStrategy === 'duplicate-ref') {
refs.definitions[name] = item.def;
}
return { $ref: [...refs.basePath, refs.definitionPath, name].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 {};
}
return refs.$refStrategy === 'seen' ? {} : undefined;
}
}
};
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('/');
};
const selectParser = (def, typeName, refs, forceResolution) => {
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();
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 parseDef(def.getter()._def, refs);
case ZodFirstPartyTypeKind.ZodPromise:
return parsePromiseDef(def, refs);
case ZodFirstPartyTypeKind.ZodNaN:
case ZodFirstPartyTypeKind.ZodNever:
return parseNeverDef();
case ZodFirstPartyTypeKind.ZodEffects:
return parseEffectsDef(def, refs, forceResolution);
case ZodFirstPartyTypeKind.ZodAny:
return parseAnyDef();
case ZodFirstPartyTypeKind.ZodUnknown:
return parseUnknownDef();
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);
}
};
const addMeta = (def, refs, jsonSchema) => {
if (def.description) {
jsonSchema.description = def.description;
if (refs.markdownDescription) {
jsonSchema.markdownDescription = def.description;
}
}
return jsonSchema;
};
//# sourceMappingURL=parseDef.mjs.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,3 @@
export type JsonSchema7AnyType = {};
export declare function parseAnyDef(): JsonSchema7AnyType;
//# sourceMappingURL=any.d.mts.map
@@ -0,0 +1 @@
{"version":3,"file":"any.d.mts","sourceRoot":"","sources":["../../../src/_vendor/zod-to-json-schema/parsers/any.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAEpC,wBAAgB,WAAW,IAAI,kBAAkB,CAEhD"}
@@ -0,0 +1,3 @@
export type JsonSchema7AnyType = {};
export declare function parseAnyDef(): JsonSchema7AnyType;
//# sourceMappingURL=any.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"any.d.ts","sourceRoot":"","sources":["../../../src/_vendor/zod-to-json-schema/parsers/any.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAEpC,wBAAgB,WAAW,IAAI,kBAAkB,CAEhD"}
@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseAnyDef = parseAnyDef;
function parseAnyDef() {
return {};
}
//# sourceMappingURL=any.js.map
@@ -0,0 +1 @@
{"version":3,"file":"any.js","sourceRoot":"","sources":["../../../src/_vendor/zod-to-json-schema/parsers/any.ts"],"names":[],"mappings":";;AAEA,kCAEC;AAFD,SAAgB,WAAW;IACzB,OAAO,EAAE,CAAC;AACZ,CAAC"}
@@ -0,0 +1,4 @@
export function parseAnyDef() {
return {};
}
//# sourceMappingURL=any.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"any.mjs","sourceRoot":"","sources":["../../../src/_vendor/zod-to-json-schema/parsers/any.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,WAAW;IACzB,OAAO,EAAE,CAAC;AACZ,CAAC"}
@@ -0,0 +1,13 @@
import { ZodArrayDef } from 'zod/v3';
import { ErrorMessages } from "../errorMessages.mjs";
import { JsonSchema7Type } from "../parseDef.mjs";
import { Refs } from "../Refs.mjs";
export type JsonSchema7ArrayType = {
type: 'array';
items?: JsonSchema7Type | undefined;
minItems?: number;
maxItems?: number;
errorMessages?: ErrorMessages<JsonSchema7ArrayType, 'items'>;
};
export declare function parseArrayDef(def: ZodArrayDef, refs: Refs): JsonSchema7ArrayType;
//# sourceMappingURL=array.d.mts.map
@@ -0,0 +1 @@
{"version":3,"file":"array.d.mts","sourceRoot":"","sources":["../../../src/_vendor/zod-to-json-schema/parsers/array.ts"],"names":[],"mappings":"OAAO,EAAE,WAAW,EAAyB,MAAM,QAAQ;OACpD,EAAE,aAAa,EAA6B;OAC5C,EAAE,eAAe,EAAY;OAC7B,EAAE,IAAI,EAAE;AAEf,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,aAAa,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC;CAC9D,CAAC;AAEF,wBAAgB,aAAa,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,wBAsBzD"}
@@ -0,0 +1,13 @@
import { ZodArrayDef } from 'zod/v3';
import { ErrorMessages } from "../errorMessages.js";
import { JsonSchema7Type } from "../parseDef.js";
import { Refs } from "../Refs.js";
export type JsonSchema7ArrayType = {
type: 'array';
items?: JsonSchema7Type | undefined;
minItems?: number;
maxItems?: number;
errorMessages?: ErrorMessages<JsonSchema7ArrayType, 'items'>;
};
export declare function parseArrayDef(def: ZodArrayDef, refs: Refs): JsonSchema7ArrayType;
//# sourceMappingURL=array.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../src/_vendor/zod-to-json-schema/parsers/array.ts"],"names":[],"mappings":"OAAO,EAAE,WAAW,EAAyB,MAAM,QAAQ;OACpD,EAAE,aAAa,EAA6B;OAC5C,EAAE,eAAe,EAAY;OAC7B,EAAE,IAAI,EAAE;AAEf,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,aAAa,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC;CAC9D,CAAC;AAEF,wBAAgB,aAAa,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,wBAsBzD"}
@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseArrayDef = parseArrayDef;
const v3_1 = require("zod/v3");
const errorMessages_1 = require("../errorMessages.js");
const parseDef_1 = require("../parseDef.js");
function parseArrayDef(def, refs) {
const res = {
type: 'array',
};
if (def.type?._def?.typeName !== v3_1.ZodFirstPartyTypeKind.ZodAny) {
res.items = (0, parseDef_1.parseDef)(def.type._def, {
...refs,
currentPath: [...refs.currentPath, 'items'],
});
}
if (def.minLength) {
(0, errorMessages_1.setResponseValueAndErrors)(res, 'minItems', def.minLength.value, def.minLength.message, refs);
}
if (def.maxLength) {
(0, errorMessages_1.setResponseValueAndErrors)(res, 'maxItems', def.maxLength.value, def.maxLength.message, refs);
}
if (def.exactLength) {
(0, errorMessages_1.setResponseValueAndErrors)(res, 'minItems', def.exactLength.value, def.exactLength.message, refs);
(0, errorMessages_1.setResponseValueAndErrors)(res, 'maxItems', def.exactLength.value, def.exactLength.message, refs);
}
return res;
}
//# sourceMappingURL=array.js.map
@@ -0,0 +1 @@
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../src/_vendor/zod-to-json-schema/parsers/array.ts"],"names":[],"mappings":";;AAaA,sCAsBC;AAnCD,+BAA4D;AAC5D,uDAA4E;AAC5E,6CAAwD;AAWxD,SAAgB,aAAa,CAAC,GAAgB,EAAE,IAAU;IACxD,MAAM,GAAG,GAAyB;QAChC,IAAI,EAAE,OAAO;KACd,CAAC;IACF,IAAI,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,KAAK,0BAAqB,CAAC,MAAM,EAAE,CAAC;QAC9D,GAAG,CAAC,KAAK,GAAG,IAAA,mBAAQ,EAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE;YAClC,GAAG,IAAI;YACP,WAAW,EAAE,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;SAC5C,CAAC,CAAC;IACL,CAAC;IAED,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;QAClB,IAAA,yCAAyB,EAAC,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC/F,CAAC;IACD,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;QAClB,IAAA,yCAAyB,EAAC,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC/F,CAAC;IACD,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC;QACpB,IAAA,yCAAyB,EAAC,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACjG,IAAA,yCAAyB,EAAC,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACnG,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,26 @@
import { ZodFirstPartyTypeKind } from 'zod/v3';
import { setResponseValueAndErrors } from "../errorMessages.mjs";
import { parseDef } from "../parseDef.mjs";
export function parseArrayDef(def, refs) {
const res = {
type: 'array',
};
if (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;
}
//# sourceMappingURL=array.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"array.mjs","sourceRoot":"","sources":["../../../src/_vendor/zod-to-json-schema/parsers/array.ts"],"names":[],"mappings":"OAAO,EAAe,qBAAqB,EAAE,MAAM,QAAQ;OACpD,EAAiB,yBAAyB,EAAE;OAC5C,EAAmB,QAAQ,EAAE;AAWpC,MAAM,UAAU,aAAa,CAAC,GAAgB,EAAE,IAAU;IACxD,MAAM,GAAG,GAAyB;QAChC,IAAI,EAAE,OAAO;KACd,CAAC;IACF,IAAI,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,KAAK,qBAAqB,CAAC,MAAM,EAAE,CAAC;QAC9D,GAAG,CAAC,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE;YAClC,GAAG,IAAI;YACP,WAAW,EAAE,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;SAC5C,CAAC,CAAC;IACL,CAAC;IAED,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;QAClB,yBAAyB,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC/F,CAAC;IACD,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;QAClB,yBAAyB,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC/F,CAAC;IACD,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC;QACpB,yBAAyB,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACjG,yBAAyB,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACnG,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,15 @@
import { ZodBigIntDef } from 'zod/v3';
import { Refs } from "../Refs.mjs";
import { ErrorMessages } from "../errorMessages.mjs";
export type JsonSchema7BigintType = {
type: 'integer';
format: 'int64';
minimum?: BigInt;
exclusiveMinimum?: BigInt;
maximum?: BigInt;
exclusiveMaximum?: BigInt;
multipleOf?: BigInt;
errorMessage?: ErrorMessages<JsonSchema7BigintType>;
};
export declare function parseBigintDef(def: ZodBigIntDef, refs: Refs): JsonSchema7BigintType;
//# sourceMappingURL=bigint.d.mts.map
@@ -0,0 +1 @@
{"version":3,"file":"bigint.d.mts","sourceRoot":"","sources":["../../../src/_vendor/zod-to-json-schema/parsers/bigint.ts"],"names":[],"mappings":"OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ;OAC9B,EAAE,IAAI,EAAE;OACR,EAAE,aAAa,EAA6B;AAEnD,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAC;CACrD,CAAC;AAEF,wBAAgB,cAAc,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,GAAG,qBAAqB,CA4CnF"}
@@ -0,0 +1,15 @@
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<JsonSchema7BigintType>;
};
export declare function parseBigintDef(def: ZodBigIntDef, refs: Refs): JsonSchema7BigintType;
//# sourceMappingURL=bigint.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"bigint.d.ts","sourceRoot":"","sources":["../../../src/_vendor/zod-to-json-schema/parsers/bigint.ts"],"names":[],"mappings":"OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ;OAC9B,EAAE,IAAI,EAAE;OACR,EAAE,aAAa,EAA6B;AAEnD,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAC;CACrD,CAAC;AAEF,wBAAgB,cAAc,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,GAAG,qBAAqB,CA4CnF"}
@@ -0,0 +1,53 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseBigintDef = parseBigintDef;
const errorMessages_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_1.setResponseValueAndErrors)(res, 'minimum', check.value, check.message, refs);
}
else {
(0, errorMessages_1.setResponseValueAndErrors)(res, 'exclusiveMinimum', check.value, check.message, refs);
}
}
else {
if (!check.inclusive) {
res.exclusiveMinimum = true;
}
(0, errorMessages_1.setResponseValueAndErrors)(res, 'minimum', check.value, check.message, refs);
}
break;
case 'max':
if (refs.target === 'jsonSchema7') {
if (check.inclusive) {
(0, errorMessages_1.setResponseValueAndErrors)(res, 'maximum', check.value, check.message, refs);
}
else {
(0, errorMessages_1.setResponseValueAndErrors)(res, 'exclusiveMaximum', check.value, check.message, refs);
}
}
else {
if (!check.inclusive) {
res.exclusiveMaximum = true;
}
(0, errorMessages_1.setResponseValueAndErrors)(res, 'maximum', check.value, check.message, refs);
}
break;
case 'multipleOf':
(0, errorMessages_1.setResponseValueAndErrors)(res, 'multipleOf', check.value, check.message, refs);
break;
}
}
return res;
}
//# sourceMappingURL=bigint.js.map
@@ -0,0 +1 @@
{"version":3,"file":"bigint.js","sourceRoot":"","sources":["../../../src/_vendor/zod-to-json-schema/parsers/bigint.ts"],"names":[],"mappings":";;AAeA,wCA4CC;AAzDD,uDAA4E;AAa5E,SAAgB,cAAc,CAAC,GAAiB,EAAE,IAAU;IAC1D,MAAM,GAAG,GAA0B;QACjC,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,OAAO;KAChB,CAAC;IAEF,IAAI,CAAC,GAAG,CAAC,MAAM;QAAE,OAAO,GAAG,CAAC;IAE5B,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QAC/B,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;YACnB,KAAK,KAAK;gBACR,IAAI,IAAI,CAAC,MAAM,KAAK,aAAa,EAAE,CAAC;oBAClC,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;wBACpB,IAAA,yCAAyB,EAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;oBAC9E,CAAC;yBAAM,CAAC;wBACN,IAAA,yCAAyB,EAAC,GAAG,EAAE,kBAAkB,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;oBACvF,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;wBACrB,GAAG,CAAC,gBAAgB,GAAG,IAAW,CAAC;oBACrC,CAAC;oBACD,IAAA,yCAAyB,EAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;gBAC9E,CAAC;gBACD,MAAM;YACR,KAAK,KAAK;gBACR,IAAI,IAAI,CAAC,MAAM,KAAK,aAAa,EAAE,CAAC;oBAClC,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;wBACpB,IAAA,yCAAyB,EAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;oBAC9E,CAAC;yBAAM,CAAC;wBACN,IAAA,yCAAyB,EAAC,GAAG,EAAE,kBAAkB,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;oBACvF,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;wBACrB,GAAG,CAAC,gBAAgB,GAAG,IAAW,CAAC;oBACrC,CAAC;oBACD,IAAA,yCAAyB,EAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;gBAC9E,CAAC;gBACD,MAAM;YACR,KAAK,YAAY;gBACf,IAAA,yCAAyB,EAAC,GAAG,EAAE,YAAY,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;gBAC/E,MAAM;QACV,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,50 @@
import { setResponseValueAndErrors } from "../errorMessages.mjs";
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;
}
//# sourceMappingURL=bigint.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"bigint.mjs","sourceRoot":"","sources":["../../../src/_vendor/zod-to-json-schema/parsers/bigint.ts"],"names":[],"mappings":"OAEO,EAAiB,yBAAyB,EAAE;AAanD,MAAM,UAAU,cAAc,CAAC,GAAiB,EAAE,IAAU;IAC1D,MAAM,GAAG,GAA0B;QACjC,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,OAAO;KAChB,CAAC;IAEF,IAAI,CAAC,GAAG,CAAC,MAAM;QAAE,OAAO,GAAG,CAAC;IAE5B,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QAC/B,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;YACnB,KAAK,KAAK;gBACR,IAAI,IAAI,CAAC,MAAM,KAAK,aAAa,EAAE,CAAC;oBAClC,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;wBACpB,yBAAyB,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;oBAC9E,CAAC;yBAAM,CAAC;wBACN,yBAAyB,CAAC,GAAG,EAAE,kBAAkB,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;oBACvF,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;wBACrB,GAAG,CAAC,gBAAgB,GAAG,IAAW,CAAC;oBACrC,CAAC;oBACD,yBAAyB,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;gBAC9E,CAAC;gBACD,MAAM;YACR,KAAK,KAAK;gBACR,IAAI,IAAI,CAAC,MAAM,KAAK,aAAa,EAAE,CAAC;oBAClC,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;wBACpB,yBAAyB,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;oBAC9E,CAAC;yBAAM,CAAC;wBACN,yBAAyB,CAAC,GAAG,EAAE,kBAAkB,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;oBACvF,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;wBACrB,GAAG,CAAC,gBAAgB,GAAG,IAAW,CAAC;oBACrC,CAAC;oBACD,yBAAyB,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;gBAC9E,CAAC;gBACD,MAAM;YACR,KAAK,YAAY;gBACf,yBAAyB,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;gBAC/E,MAAM;QACV,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,5 @@
export type JsonSchema7BooleanType = {
type: 'boolean';
};
export declare function parseBooleanDef(): JsonSchema7BooleanType;
//# sourceMappingURL=boolean.d.mts.map
@@ -0,0 +1 @@
{"version":3,"file":"boolean.d.mts","sourceRoot":"","sources":["../../../src/_vendor/zod-to-json-schema/parsers/boolean.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,SAAS,CAAC;CACjB,CAAC;AAEF,wBAAgB,eAAe,IAAI,sBAAsB,CAIxD"}
@@ -0,0 +1,5 @@
export type JsonSchema7BooleanType = {
type: 'boolean';
};
export declare function parseBooleanDef(): JsonSchema7BooleanType;
//# sourceMappingURL=boolean.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../../src/_vendor/zod-to-json-schema/parsers/boolean.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,SAAS,CAAC;CACjB,CAAC;AAEF,wBAAgB,eAAe,IAAI,sBAAsB,CAIxD"}
@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseBooleanDef = parseBooleanDef;
function parseBooleanDef() {
return {
type: 'boolean',
};
}
//# sourceMappingURL=boolean.js.map
@@ -0,0 +1 @@
{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../../src/_vendor/zod-to-json-schema/parsers/boolean.ts"],"names":[],"mappings":";;AAIA,0CAIC;AAJD,SAAgB,eAAe;IAC7B,OAAO;QACL,IAAI,EAAE,SAAS;KAChB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
export function parseBooleanDef() {
return {
type: 'boolean',
};
}
//# sourceMappingURL=boolean.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"boolean.mjs","sourceRoot":"","sources":["../../../src/_vendor/zod-to-json-schema/parsers/boolean.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,eAAe;IAC7B,OAAO;QACL,IAAI,EAAE,SAAS;KAChB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
import { ZodBrandedDef } from 'zod/v3';
import { Refs } from "../Refs.mjs";
export declare function parseBrandedDef(_def: ZodBrandedDef<any>, refs: Refs): import("../parseDef").JsonSchema7Type | undefined;
//# sourceMappingURL=branded.d.mts.map
@@ -0,0 +1 @@
{"version":3,"file":"branded.d.mts","sourceRoot":"","sources":["../../../src/_vendor/zod-to-json-schema/parsers/branded.ts"],"names":[],"mappings":"OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ;OAE/B,EAAE,IAAI,EAAE;AAEf,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,qDAEnE"}
@@ -0,0 +1,4 @@
import { ZodBrandedDef } from 'zod/v3';
import { Refs } from "../Refs.js";
export declare function parseBrandedDef(_def: ZodBrandedDef<any>, refs: Refs): import("../parseDef").JsonSchema7Type | undefined;
//# sourceMappingURL=branded.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"branded.d.ts","sourceRoot":"","sources":["../../../src/_vendor/zod-to-json-schema/parsers/branded.ts"],"names":[],"mappings":"OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ;OAE/B,EAAE,IAAI,EAAE;AAEf,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,qDAEnE"}
@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseBrandedDef = parseBrandedDef;
const parseDef_1 = require("../parseDef.js");
function parseBrandedDef(_def, refs) {
return (0, parseDef_1.parseDef)(_def.type._def, refs);
}
//# sourceMappingURL=branded.js.map
@@ -0,0 +1 @@
{"version":3,"file":"branded.js","sourceRoot":"","sources":["../../../src/_vendor/zod-to-json-schema/parsers/branded.ts"],"names":[],"mappings":";;AAIA,0CAEC;AALD,6CAAuC;AAGvC,SAAgB,eAAe,CAAC,IAAwB,EAAE,IAAU;IAClE,OAAO,IAAA,mBAAQ,EAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACxC,CAAC"}
@@ -0,0 +1,5 @@
import { parseDef } from "../parseDef.mjs";
export function parseBrandedDef(_def, refs) {
return parseDef(_def.type._def, refs);
}
//# sourceMappingURL=branded.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"branded.mjs","sourceRoot":"","sources":["../../../src/_vendor/zod-to-json-schema/parsers/branded.ts"],"names":[],"mappings":"OACO,EAAE,QAAQ,EAAE;AAGnB,MAAM,UAAU,eAAe,CAAC,IAAwB,EAAE,IAAU;IAClE,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACxC,CAAC"}
@@ -0,0 +1,4 @@
import { ZodCatchDef } from 'zod/v3';
import { Refs } from "../Refs.mjs";
export declare const parseCatchDef: (def: ZodCatchDef<any>, refs: Refs) => import("../parseDef").JsonSchema7Type | undefined;
//# sourceMappingURL=catch.d.mts.map
@@ -0,0 +1 @@
{"version":3,"file":"catch.d.mts","sourceRoot":"","sources":["../../../src/_vendor/zod-to-json-schema/parsers/catch.ts"],"names":[],"mappings":"OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ;OAE7B,EAAE,IAAI,EAAE;AAEf,eAAO,MAAM,aAAa,GAAI,KAAK,WAAW,CAAC,GAAG,CAAC,EAAE,MAAM,IAAI,sDAE9D,CAAC"}
@@ -0,0 +1,4 @@
import { ZodCatchDef } from 'zod/v3';
import { Refs } from "../Refs.js";
export declare const parseCatchDef: (def: ZodCatchDef<any>, refs: Refs) => import("../parseDef").JsonSchema7Type | undefined;
//# sourceMappingURL=catch.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"catch.d.ts","sourceRoot":"","sources":["../../../src/_vendor/zod-to-json-schema/parsers/catch.ts"],"names":[],"mappings":"OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ;OAE7B,EAAE,IAAI,EAAE;AAEf,eAAO,MAAM,aAAa,GAAI,KAAK,WAAW,CAAC,GAAG,CAAC,EAAE,MAAM,IAAI,sDAE9D,CAAC"}
@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseCatchDef = void 0;
const parseDef_1 = require("../parseDef.js");
const parseCatchDef = (def, refs) => {
return (0, parseDef_1.parseDef)(def.innerType._def, refs);
};
exports.parseCatchDef = parseCatchDef;
//# sourceMappingURL=catch.js.map
@@ -0,0 +1 @@
{"version":3,"file":"catch.js","sourceRoot":"","sources":["../../../src/_vendor/zod-to-json-schema/parsers/catch.ts"],"names":[],"mappings":";;;AACA,6CAAuC;AAGhC,MAAM,aAAa,GAAG,CAAC,GAAqB,EAAE,IAAU,EAAE,EAAE;IACjE,OAAO,IAAA,mBAAQ,EAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC5C,CAAC,CAAC;AAFW,QAAA,aAAa,iBAExB"}
@@ -0,0 +1,5 @@
import { parseDef } from "../parseDef.mjs";
export const parseCatchDef = (def, refs) => {
return parseDef(def.innerType._def, refs);
};
//# sourceMappingURL=catch.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"catch.mjs","sourceRoot":"","sources":["../../../src/_vendor/zod-to-json-schema/parsers/catch.ts"],"names":[],"mappings":"OACO,EAAE,QAAQ,EAAE;AAGnB,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAqB,EAAE,IAAU,EAAE,EAAE;IACjE,OAAO,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC5C,CAAC,CAAC"}
@@ -0,0 +1,16 @@
import { ZodDateDef } from 'zod/v3';
import { Refs } from "../Refs.mjs";
import { ErrorMessages } from "../errorMessages.mjs";
import { JsonSchema7NumberType } from "./number.mjs";
import { DateStrategy } from "../Options.mjs";
export type JsonSchema7DateType = {
type: 'integer' | 'string';
format: 'unix-time' | 'date-time' | 'date';
minimum?: number;
maximum?: number;
errorMessage?: ErrorMessages<JsonSchema7NumberType>;
} | {
anyOf: JsonSchema7DateType[];
};
export declare function parseDateDef(def: ZodDateDef, refs: Refs, overrideDateStrategy?: DateStrategy): JsonSchema7DateType;
//# sourceMappingURL=date.d.mts.map

Some files were not shown because too many files have changed in this diff Show More