@langchain/core 1.0.0-alpha.3 → 1.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -19
- package/dist/caches/base.cjs +2 -2
- package/dist/caches/base.cjs.map +1 -1
- package/dist/callbacks/base.d.ts.map +1 -1
- package/dist/document_loaders/langsmith.cjs +1 -1
- package/dist/document_loaders/langsmith.cjs.map +1 -1
- package/dist/document_loaders/langsmith.js +1 -1
- package/dist/document_loaders/langsmith.js.map +1 -1
- package/dist/embeddings.cjs.map +1 -1
- package/dist/embeddings.d.cts +6 -6
- package/dist/embeddings.d.cts.map +1 -1
- package/dist/embeddings.d.ts +6 -6
- package/dist/embeddings.d.ts.map +1 -1
- package/dist/embeddings.js.map +1 -1
- package/dist/errors/index.cjs.map +1 -1
- package/dist/errors/index.js.map +1 -1
- package/dist/indexing/base.cjs +2 -2
- package/dist/indexing/base.cjs.map +1 -1
- package/dist/indexing/base.d.cts +0 -3
- package/dist/indexing/base.d.cts.map +1 -1
- package/dist/indexing/base.d.ts +0 -3
- package/dist/indexing/base.d.ts.map +1 -1
- package/dist/indexing/base.js +2 -2
- package/dist/indexing/base.js.map +1 -1
- package/dist/language_models/base.cjs +1 -1
- package/dist/language_models/base.cjs.map +1 -1
- package/dist/language_models/base.d.cts +3 -3
- package/dist/language_models/base.d.cts.map +1 -1
- package/dist/language_models/base.d.ts +3 -3
- package/dist/language_models/base.d.ts.map +1 -1
- package/dist/language_models/base.js +1 -1
- package/dist/language_models/base.js.map +1 -1
- package/dist/language_models/chat_models.cjs.map +1 -1
- package/dist/language_models/chat_models.d.ts.map +1 -1
- package/dist/language_models/chat_models.js.map +1 -1
- package/dist/language_models/llms.cjs.map +1 -1
- package/dist/language_models/llms.js.map +1 -1
- package/dist/load/import_map.cjs +1 -5
- package/dist/load/import_map.cjs.map +1 -1
- package/dist/load/import_map.js +3 -7
- package/dist/load/import_map.js.map +1 -1
- package/dist/load/index.cjs.map +1 -1
- package/dist/load/index.js.map +1 -1
- package/dist/load/serializable.cjs.map +1 -1
- package/dist/load/serializable.d.cts +1 -3
- package/dist/load/serializable.d.cts.map +1 -1
- package/dist/load/serializable.d.ts +1 -3
- package/dist/load/serializable.d.ts.map +1 -1
- package/dist/load/serializable.js.map +1 -1
- package/dist/messages/ai.cjs +2 -2
- package/dist/messages/ai.cjs.map +1 -1
- package/dist/messages/ai.js +2 -2
- package/dist/messages/ai.js.map +1 -1
- package/dist/messages/base.cjs +5 -5
- package/dist/messages/base.cjs.map +1 -1
- package/dist/messages/base.d.cts +1 -2
- package/dist/messages/base.d.cts.map +1 -1
- package/dist/messages/base.d.ts +1 -2
- package/dist/messages/base.d.ts.map +1 -1
- package/dist/messages/base.js +5 -5
- package/dist/messages/base.js.map +1 -1
- package/dist/messages/block_translators/utils.cjs +1 -1
- package/dist/messages/block_translators/utils.cjs.map +1 -1
- package/dist/messages/block_translators/utils.js +1 -1
- package/dist/messages/block_translators/utils.js.map +1 -1
- package/dist/messages/index.cjs +1 -1
- package/dist/messages/index.js +1 -1
- package/dist/messages/modifier.cjs +4 -1
- package/dist/messages/modifier.cjs.map +1 -1
- package/dist/messages/modifier.js +4 -1
- package/dist/messages/modifier.js.map +1 -1
- package/dist/messages/tool.cjs +7 -7
- package/dist/messages/tool.cjs.map +1 -1
- package/dist/messages/tool.js +7 -7
- package/dist/messages/tool.js.map +1 -1
- package/dist/messages/transformers.cjs +2 -2
- package/dist/messages/transformers.cjs.map +1 -1
- package/dist/messages/transformers.js +2 -2
- package/dist/messages/transformers.js.map +1 -1
- package/dist/messages/utils.cjs +5 -0
- package/dist/messages/utils.cjs.map +1 -1
- package/dist/messages/utils.js +5 -0
- package/dist/messages/utils.js.map +1 -1
- package/dist/output_parsers/list.cjs +1 -1
- package/dist/output_parsers/list.cjs.map +1 -1
- package/dist/output_parsers/list.js +1 -1
- package/dist/output_parsers/list.js.map +1 -1
- package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.cts +1 -1
- package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.ts +1 -1
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.cjs +1 -1
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.cjs.map +1 -1
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.js +1 -1
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.js.map +1 -1
- package/dist/output_parsers/structured.cjs +2 -1
- package/dist/output_parsers/structured.cjs.map +1 -1
- package/dist/output_parsers/structured.js +2 -1
- package/dist/output_parsers/structured.js.map +1 -1
- package/dist/prompts/chat.cjs +3 -1
- package/dist/prompts/chat.cjs.map +1 -1
- package/dist/prompts/chat.d.cts +4 -12
- package/dist/prompts/chat.d.cts.map +1 -1
- package/dist/prompts/chat.d.ts +4 -12
- package/dist/prompts/chat.d.ts.map +1 -1
- package/dist/prompts/chat.js +3 -1
- package/dist/prompts/chat.js.map +1 -1
- package/dist/prompts/image.cjs.map +1 -1
- package/dist/prompts/image.d.cts +0 -2
- package/dist/prompts/image.d.cts.map +1 -1
- package/dist/prompts/image.d.ts +0 -2
- package/dist/prompts/image.d.ts.map +1 -1
- package/dist/prompts/image.js.map +1 -1
- package/dist/prompts/pipeline.cjs.map +1 -1
- package/dist/prompts/pipeline.js.map +1 -1
- package/dist/prompts/prompt.cjs.map +1 -1
- package/dist/prompts/prompt.d.cts +4 -16
- package/dist/prompts/prompt.d.cts.map +1 -1
- package/dist/prompts/prompt.d.ts +4 -16
- package/dist/prompts/prompt.d.ts.map +1 -1
- package/dist/prompts/prompt.js.map +1 -1
- package/dist/prompts/structured.cjs.map +1 -1
- package/dist/prompts/structured.js.map +1 -1
- package/dist/prompts/template.cjs +4 -2
- package/dist/prompts/template.cjs.map +1 -1
- package/dist/prompts/template.js +4 -2
- package/dist/prompts/template.js.map +1 -1
- package/dist/runnables/base.cjs +6 -6
- package/dist/runnables/base.cjs.map +1 -1
- package/dist/runnables/base.d.cts +0 -3
- package/dist/runnables/base.d.cts.map +1 -1
- package/dist/runnables/base.d.ts +0 -3
- package/dist/runnables/base.d.ts.map +1 -1
- package/dist/runnables/base.js +6 -6
- package/dist/runnables/base.js.map +1 -1
- package/dist/runnables/branch.cjs +2 -2
- package/dist/runnables/branch.cjs.map +1 -1
- package/dist/runnables/branch.js +2 -2
- package/dist/runnables/branch.js.map +1 -1
- package/dist/runnables/config.cjs.map +1 -1
- package/dist/runnables/config.js.map +1 -1
- package/dist/runnables/graph.cjs +1 -1
- package/dist/runnables/graph.cjs.map +1 -1
- package/dist/runnables/graph.js +1 -1
- package/dist/runnables/graph.js.map +1 -1
- package/dist/runnables/graph_mermaid.cjs +26 -3
- package/dist/runnables/graph_mermaid.cjs.map +1 -1
- package/dist/runnables/graph_mermaid.js +26 -3
- package/dist/runnables/graph_mermaid.js.map +1 -1
- package/dist/runnables/remote.cjs.map +1 -1
- package/dist/runnables/remote.js.map +1 -1
- package/dist/runnables/types.d.cts +0 -1
- package/dist/runnables/types.d.cts.map +1 -1
- package/dist/runnables/types.d.ts +0 -1
- package/dist/runnables/types.d.ts.map +1 -1
- package/dist/singletons/async_local_storage/context.cjs.map +1 -1
- package/dist/singletons/async_local_storage/context.d.cts +0 -1
- package/dist/singletons/async_local_storage/context.d.cts.map +1 -1
- package/dist/singletons/async_local_storage/context.d.ts +0 -1
- package/dist/singletons/async_local_storage/context.d.ts.map +1 -1
- package/dist/singletons/async_local_storage/context.js.map +1 -1
- package/dist/singletons/callbacks.cjs.map +1 -1
- package/dist/singletons/callbacks.js.map +1 -1
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.d.cts +2 -2
- package/dist/tools/index.d.cts.map +1 -1
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/types.d.cts +5 -5
- package/dist/tools/types.d.cts.map +1 -1
- package/dist/tools/types.d.ts +5 -5
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tracers/base.cjs.map +1 -1
- package/dist/tracers/base.js.map +1 -1
- package/dist/tracers/console.cjs +1 -1
- package/dist/tracers/console.cjs.map +1 -1
- package/dist/tracers/console.js +1 -1
- package/dist/tracers/console.js.map +1 -1
- package/dist/tracers/event_stream.cjs +1 -1
- package/dist/tracers/event_stream.cjs.map +1 -1
- package/dist/tracers/event_stream.d.cts +0 -1
- package/dist/tracers/event_stream.d.cts.map +1 -1
- package/dist/tracers/event_stream.d.ts +0 -1
- package/dist/tracers/event_stream.d.ts.map +1 -1
- package/dist/tracers/event_stream.js +1 -1
- package/dist/tracers/event_stream.js.map +1 -1
- package/dist/tracers/log_stream.cjs.map +1 -1
- package/dist/tracers/log_stream.js.map +1 -1
- package/dist/tracers/tracer_langchain.cjs.map +1 -1
- package/dist/tracers/tracer_langchain.js.map +1 -1
- package/dist/utils/chunk_array.cjs.map +1 -1
- package/dist/utils/chunk_array.js.map +1 -1
- package/dist/utils/env.cjs +1 -1
- package/dist/utils/env.cjs.map +1 -1
- package/dist/utils/env.js +1 -1
- package/dist/utils/env.js.map +1 -1
- package/dist/utils/event_source_parse.cjs.map +1 -1
- package/dist/utils/event_source_parse.d.cts.map +1 -1
- package/dist/utils/event_source_parse.d.ts.map +1 -1
- package/dist/utils/event_source_parse.js.map +1 -1
- package/dist/utils/hash.cjs +3 -8
- package/dist/utils/hash.cjs.map +1 -1
- package/dist/utils/hash.d.cts +1 -2
- package/dist/utils/hash.d.cts.map +1 -1
- package/dist/utils/hash.d.ts +1 -2
- package/dist/utils/hash.d.ts.map +1 -1
- package/dist/utils/hash.js +2 -6
- package/dist/utils/hash.js.map +1 -1
- package/dist/utils/js-sha256/hash.cjs +0 -9
- package/dist/utils/js-sha256/hash.cjs.map +1 -1
- package/dist/utils/js-sha256/hash.js +1 -5
- package/dist/utils/js-sha256/hash.js.map +1 -1
- package/dist/utils/json.cjs +2 -2
- package/dist/utils/json.cjs.map +1 -1
- package/dist/utils/json.js +2 -2
- package/dist/utils/json.js.map +1 -1
- package/dist/utils/json_schema.cjs +3 -2
- package/dist/utils/json_schema.cjs.map +1 -1
- package/dist/utils/json_schema.d.cts +8 -4
- package/dist/utils/json_schema.d.cts.map +1 -1
- package/dist/utils/json_schema.d.ts +8 -4
- package/dist/utils/json_schema.d.ts.map +1 -1
- package/dist/utils/json_schema.js +2 -1
- package/dist/utils/json_schema.js.map +1 -1
- package/dist/utils/stream.cjs.map +1 -1
- package/dist/utils/stream.js.map +1 -1
- package/dist/utils/testing/index.cjs.map +1 -1
- package/dist/utils/testing/index.d.cts +4 -9
- package/dist/utils/testing/index.d.cts.map +1 -1
- package/dist/utils/testing/index.d.ts +4 -9
- package/dist/utils/testing/index.d.ts.map +1 -1
- package/dist/utils/testing/index.js.map +1 -1
- package/dist/utils/zod-to-json-schema/Options.cjs +40 -0
- package/dist/utils/zod-to-json-schema/Options.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/Options.js +37 -0
- package/dist/utils/zod-to-json-schema/Options.js.map +1 -0
- package/dist/utils/zod-to-json-schema/Refs.cjs +30 -0
- package/dist/utils/zod-to-json-schema/Refs.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/Refs.js +30 -0
- package/dist/utils/zod-to-json-schema/Refs.js.map +1 -0
- package/dist/utils/zod-to-json-schema/errorMessages.cjs +18 -0
- package/dist/utils/zod-to-json-schema/errorMessages.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/errorMessages.d.cts +11 -0
- package/dist/utils/zod-to-json-schema/errorMessages.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/errorMessages.d.ts +11 -0
- package/dist/utils/zod-to-json-schema/errorMessages.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/errorMessages.js +16 -0
- package/dist/utils/zod-to-json-schema/errorMessages.js.map +1 -0
- package/dist/utils/zod-to-json-schema/getRelativePath.cjs +11 -0
- package/dist/utils/zod-to-json-schema/getRelativePath.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/getRelativePath.js +10 -0
- package/dist/utils/zod-to-json-schema/getRelativePath.js.map +1 -0
- package/dist/utils/zod-to-json-schema/index.cjs +37 -0
- package/dist/utils/zod-to-json-schema/index.js +37 -0
- package/dist/utils/zod-to-json-schema/parseDef.cjs +57 -0
- package/dist/utils/zod-to-json-schema/parseDef.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parseDef.js +57 -0
- package/dist/utils/zod-to-json-schema/parseDef.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parseTypes.d.cts +38 -0
- package/dist/utils/zod-to-json-schema/parseTypes.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parseTypes.d.ts +38 -0
- package/dist/utils/zod-to-json-schema/parseTypes.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/any.cjs +17 -0
- package/dist/utils/zod-to-json-schema/parsers/any.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/any.d.cts +7 -0
- package/dist/utils/zod-to-json-schema/parsers/any.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/any.d.ts +7 -0
- package/dist/utils/zod-to-json-schema/parsers/any.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/any.js +17 -0
- package/dist/utils/zod-to-json-schema/parsers/any.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/array.cjs +24 -0
- package/dist/utils/zod-to-json-schema/parsers/array.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/array.d.cts +14 -0
- package/dist/utils/zod-to-json-schema/parsers/array.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/array.d.ts +15 -0
- package/dist/utils/zod-to-json-schema/parsers/array.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/array.js +23 -0
- package/dist/utils/zod-to-json-schema/parsers/array.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/bigint.cjs +36 -0
- package/dist/utils/zod-to-json-schema/parsers/bigint.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/bigint.d.cts +16 -0
- package/dist/utils/zod-to-json-schema/parsers/bigint.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/bigint.d.ts +17 -0
- package/dist/utils/zod-to-json-schema/parsers/bigint.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/bigint.js +36 -0
- package/dist/utils/zod-to-json-schema/parsers/bigint.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/boolean.cjs +9 -0
- package/dist/utils/zod-to-json-schema/parsers/boolean.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/boolean.d.cts +7 -0
- package/dist/utils/zod-to-json-schema/parsers/boolean.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/boolean.d.ts +7 -0
- package/dist/utils/zod-to-json-schema/parsers/boolean.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/boolean.js +8 -0
- package/dist/utils/zod-to-json-schema/parsers/boolean.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/branded.cjs +10 -0
- package/dist/utils/zod-to-json-schema/parsers/branded.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/branded.js +10 -0
- package/dist/utils/zod-to-json-schema/parsers/branded.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/catch.cjs +10 -0
- package/dist/utils/zod-to-json-schema/parsers/catch.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/catch.js +10 -0
- package/dist/utils/zod-to-json-schema/parsers/catch.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/date.cjs +39 -0
- package/dist/utils/zod-to-json-schema/parsers/date.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/date.d.cts +17 -0
- package/dist/utils/zod-to-json-schema/parsers/date.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/date.d.ts +17 -0
- package/dist/utils/zod-to-json-schema/parsers/date.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/date.js +39 -0
- package/dist/utils/zod-to-json-schema/parsers/date.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/default.cjs +13 -0
- package/dist/utils/zod-to-json-schema/parsers/default.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/default.js +13 -0
- package/dist/utils/zod-to-json-schema/parsers/default.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/effects.cjs +11 -0
- package/dist/utils/zod-to-json-schema/parsers/effects.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/effects.js +11 -0
- package/dist/utils/zod-to-json-schema/parsers/effects.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/enum.cjs +12 -0
- package/dist/utils/zod-to-json-schema/parsers/enum.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/enum.d.cts +8 -0
- package/dist/utils/zod-to-json-schema/parsers/enum.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/enum.d.ts +10 -0
- package/dist/utils/zod-to-json-schema/parsers/enum.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/enum.js +11 -0
- package/dist/utils/zod-to-json-schema/parsers/enum.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/intersection.cjs +47 -0
- package/dist/utils/zod-to-json-schema/parsers/intersection.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/intersection.d.cts +10 -0
- package/dist/utils/zod-to-json-schema/parsers/intersection.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/intersection.d.ts +11 -0
- package/dist/utils/zod-to-json-schema/parsers/intersection.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/intersection.js +47 -0
- package/dist/utils/zod-to-json-schema/parsers/intersection.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/literal.cjs +18 -0
- package/dist/utils/zod-to-json-schema/parsers/literal.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/literal.d.cts +11 -0
- package/dist/utils/zod-to-json-schema/parsers/literal.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/literal.d.ts +12 -0
- package/dist/utils/zod-to-json-schema/parsers/literal.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/literal.js +17 -0
- package/dist/utils/zod-to-json-schema/parsers/literal.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/map.cjs +40 -0
- package/dist/utils/zod-to-json-schema/parsers/map.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/map.d.cts +17 -0
- package/dist/utils/zod-to-json-schema/parsers/map.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/map.d.ts +17 -0
- package/dist/utils/zod-to-json-schema/parsers/map.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/map.js +40 -0
- package/dist/utils/zod-to-json-schema/parsers/map.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/nativeEnum.cjs +18 -0
- package/dist/utils/zod-to-json-schema/parsers/nativeEnum.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/nativeEnum.d.cts +8 -0
- package/dist/utils/zod-to-json-schema/parsers/nativeEnum.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/nativeEnum.d.ts +10 -0
- package/dist/utils/zod-to-json-schema/parsers/nativeEnum.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/nativeEnum.js +17 -0
- package/dist/utils/zod-to-json-schema/parsers/nativeEnum.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/never.cjs +13 -0
- package/dist/utils/zod-to-json-schema/parsers/never.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/never.d.cts +9 -0
- package/dist/utils/zod-to-json-schema/parsers/never.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/never.d.ts +9 -0
- package/dist/utils/zod-to-json-schema/parsers/never.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/never.js +13 -0
- package/dist/utils/zod-to-json-schema/parsers/never.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/null.cjs +12 -0
- package/dist/utils/zod-to-json-schema/parsers/null.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/null.d.cts +7 -0
- package/dist/utils/zod-to-json-schema/parsers/null.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/null.d.ts +7 -0
- package/dist/utils/zod-to-json-schema/parsers/null.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/null.js +11 -0
- package/dist/utils/zod-to-json-schema/parsers/null.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/nullable.cjs +46 -0
- package/dist/utils/zod-to-json-schema/parsers/nullable.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/nullable.d.cts +12 -0
- package/dist/utils/zod-to-json-schema/parsers/nullable.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/nullable.d.ts +13 -0
- package/dist/utils/zod-to-json-schema/parsers/nullable.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/nullable.js +46 -0
- package/dist/utils/zod-to-json-schema/parsers/nullable.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/number.cjs +37 -0
- package/dist/utils/zod-to-json-schema/parsers/number.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/number.d.cts +15 -0
- package/dist/utils/zod-to-json-schema/parsers/number.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/number.d.ts +16 -0
- package/dist/utils/zod-to-json-schema/parsers/number.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/number.js +37 -0
- package/dist/utils/zod-to-json-schema/parsers/number.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/object.cjs +64 -0
- package/dist/utils/zod-to-json-schema/parsers/object.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/object.d.cts +12 -0
- package/dist/utils/zod-to-json-schema/parsers/object.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/object.d.ts +13 -0
- package/dist/utils/zod-to-json-schema/parsers/object.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/object.js +64 -0
- package/dist/utils/zod-to-json-schema/parsers/object.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/optional.cjs +20 -0
- package/dist/utils/zod-to-json-schema/parsers/optional.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/optional.js +20 -0
- package/dist/utils/zod-to-json-schema/parsers/optional.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/pipeline.cjs +28 -0
- package/dist/utils/zod-to-json-schema/parsers/pipeline.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/pipeline.js +28 -0
- package/dist/utils/zod-to-json-schema/parsers/pipeline.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/promise.cjs +10 -0
- package/dist/utils/zod-to-json-schema/parsers/promise.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/promise.js +10 -0
- package/dist/utils/zod-to-json-schema/parsers/promise.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/readonly.cjs +10 -0
- package/dist/utils/zod-to-json-schema/parsers/readonly.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/readonly.js +10 -0
- package/dist/utils/zod-to-json-schema/parsers/readonly.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/record.cjs +57 -0
- package/dist/utils/zod-to-json-schema/parsers/record.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/record.d.cts +14 -0
- package/dist/utils/zod-to-json-schema/parsers/record.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/record.d.ts +15 -0
- package/dist/utils/zod-to-json-schema/parsers/record.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/record.js +56 -0
- package/dist/utils/zod-to-json-schema/parsers/record.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/set.cjs +22 -0
- package/dist/utils/zod-to-json-schema/parsers/set.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/set.d.cts +15 -0
- package/dist/utils/zod-to-json-schema/parsers/set.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/set.d.ts +16 -0
- package/dist/utils/zod-to-json-schema/parsers/set.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/set.js +22 -0
- package/dist/utils/zod-to-json-schema/parsers/set.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/string.cjs +255 -0
- package/dist/utils/zod-to-json-schema/parsers/string.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/string.d.cts +28 -0
- package/dist/utils/zod-to-json-schema/parsers/string.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/string.d.ts +29 -0
- package/dist/utils/zod-to-json-schema/parsers/string.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/string.js +254 -0
- package/dist/utils/zod-to-json-schema/parsers/string.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/tuple.cjs +38 -0
- package/dist/utils/zod-to-json-schema/parsers/tuple.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/tuple.d.cts +15 -0
- package/dist/utils/zod-to-json-schema/parsers/tuple.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/tuple.d.ts +16 -0
- package/dist/utils/zod-to-json-schema/parsers/tuple.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/tuple.js +38 -0
- package/dist/utils/zod-to-json-schema/parsers/tuple.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/undefined.cjs +10 -0
- package/dist/utils/zod-to-json-schema/parsers/undefined.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/undefined.d.cts +9 -0
- package/dist/utils/zod-to-json-schema/parsers/undefined.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/undefined.d.ts +9 -0
- package/dist/utils/zod-to-json-schema/parsers/undefined.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/undefined.js +10 -0
- package/dist/utils/zod-to-json-schema/parsers/undefined.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/union.cjs +67 -0
- package/dist/utils/zod-to-json-schema/parsers/union.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/union.d.cts +24 -0
- package/dist/utils/zod-to-json-schema/parsers/union.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/union.d.ts +25 -0
- package/dist/utils/zod-to-json-schema/parsers/union.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/union.js +66 -0
- package/dist/utils/zod-to-json-schema/parsers/union.js.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/unknown.cjs +10 -0
- package/dist/utils/zod-to-json-schema/parsers/unknown.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/unknown.d.cts +7 -0
- package/dist/utils/zod-to-json-schema/parsers/unknown.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/unknown.d.ts +7 -0
- package/dist/utils/zod-to-json-schema/parsers/unknown.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/unknown.js +10 -0
- package/dist/utils/zod-to-json-schema/parsers/unknown.js.map +1 -0
- package/dist/utils/zod-to-json-schema/selectParser.cjs +81 -0
- package/dist/utils/zod-to-json-schema/selectParser.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/selectParser.js +80 -0
- package/dist/utils/zod-to-json-schema/selectParser.js.map +1 -0
- package/dist/utils/zod-to-json-schema/zodToJsonSchema.cjs +70 -0
- package/dist/utils/zod-to-json-schema/zodToJsonSchema.cjs.map +1 -0
- package/dist/utils/zod-to-json-schema/zodToJsonSchema.js +70 -0
- package/dist/utils/zod-to-json-schema/zodToJsonSchema.js.map +1 -0
- package/package.json +7 -36
- package/dist/utils/js-sha1/hash.cjs +0 -291
- package/dist/utils/js-sha1/hash.cjs.map +0 -1
- package/dist/utils/js-sha1/hash.d.cts +0 -9
- package/dist/utils/js-sha1/hash.d.cts.map +0 -1
- package/dist/utils/js-sha1/hash.d.ts +0 -9
- package/dist/utils/js-sha1/hash.d.ts.map +0 -1
- package/dist/utils/js-sha1/hash.js +0 -284
- package/dist/utils/js-sha1/hash.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enum.cjs","names":["def: ZodEnumDef"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/enum.ts"],"sourcesContent":["import { ZodEnumDef } from \"zod/v3\";\n\nexport type JsonSchema7EnumType = {\n type: \"string\";\n enum: string[];\n};\n\nexport function parseEnumDef(def: ZodEnumDef): JsonSchema7EnumType {\n return {\n type: \"string\",\n enum: Array.from(def.values),\n };\n}\n"],"mappings":";;AAOA,SAAgB,aAAaA,KAAsC;AACjE,QAAO;EACL,MAAM;EACN,MAAM,MAAM,KAAK,IAAI,OAAO;CAC7B;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enum.d.cts","names":["ZodEnumDef","JsonSchema7EnumType","parseEnumDef"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/enum.d.ts"],"sourcesContent":["import { ZodEnumDef } from \"zod/v3\";\nexport type JsonSchema7EnumType = {\n type: \"string\";\n enum: string[];\n};\nexport declare function parseEnumDef(def: ZodEnumDef): JsonSchema7EnumType;\n"],"mappings":";AACYC,KAAAA,mBAAAA,GAAmB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enum.d.ts","names":["ZodEnumDef","JsonSchema7EnumType","parseEnumDef"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/enum.d.ts"],"sourcesContent":["import { ZodEnumDef } from \"zod/v3\";\nexport type JsonSchema7EnumType = {\n type: \"string\";\n enum: string[];\n};\nexport declare function parseEnumDef(def: ZodEnumDef): JsonSchema7EnumType;\n"],"mappings":";;;KACYC,mBAAAA;;EAAAA,IAAAA,EAAAA,MAAAA,EAAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enum.js","names":["def: ZodEnumDef"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/enum.ts"],"sourcesContent":["import { ZodEnumDef } from \"zod/v3\";\n\nexport type JsonSchema7EnumType = {\n type: \"string\";\n enum: string[];\n};\n\nexport function parseEnumDef(def: ZodEnumDef): JsonSchema7EnumType {\n return {\n type: \"string\",\n enum: Array.from(def.values),\n };\n}\n"],"mappings":";AAOA,SAAgB,aAAaA,KAAsC;AACjE,QAAO;EACL,MAAM;EACN,MAAM,MAAM,KAAK,IAAI,OAAO;CAC7B;AACF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const require_parseDef = require('../parseDef.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/utils/zod-to-json-schema/parsers/intersection.ts
|
|
4
|
+
const isJsonSchema7AllOfType = (type) => {
|
|
5
|
+
if ("type" in type && type.type === "string") return false;
|
|
6
|
+
return "allOf" in type;
|
|
7
|
+
};
|
|
8
|
+
function parseIntersectionDef(def, refs) {
|
|
9
|
+
const allOf = [require_parseDef.parseDef(def.left._def, {
|
|
10
|
+
...refs,
|
|
11
|
+
currentPath: [
|
|
12
|
+
...refs.currentPath,
|
|
13
|
+
"allOf",
|
|
14
|
+
"0"
|
|
15
|
+
]
|
|
16
|
+
}), require_parseDef.parseDef(def.right._def, {
|
|
17
|
+
...refs,
|
|
18
|
+
currentPath: [
|
|
19
|
+
...refs.currentPath,
|
|
20
|
+
"allOf",
|
|
21
|
+
"1"
|
|
22
|
+
]
|
|
23
|
+
})].filter((x) => !!x);
|
|
24
|
+
let unevaluatedProperties = refs.target === "jsonSchema2019-09" ? { unevaluatedProperties: false } : void 0;
|
|
25
|
+
const mergedAllOf = [];
|
|
26
|
+
allOf.forEach((schema) => {
|
|
27
|
+
if (isJsonSchema7AllOfType(schema)) {
|
|
28
|
+
mergedAllOf.push(...schema.allOf);
|
|
29
|
+
if (schema.unevaluatedProperties === void 0) unevaluatedProperties = void 0;
|
|
30
|
+
} else {
|
|
31
|
+
let nestedSchema = schema;
|
|
32
|
+
if ("additionalProperties" in schema && schema.additionalProperties === false) {
|
|
33
|
+
const { additionalProperties,...rest } = schema;
|
|
34
|
+
nestedSchema = rest;
|
|
35
|
+
} else unevaluatedProperties = void 0;
|
|
36
|
+
mergedAllOf.push(nestedSchema);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
return mergedAllOf.length ? {
|
|
40
|
+
allOf: mergedAllOf,
|
|
41
|
+
...unevaluatedProperties
|
|
42
|
+
} : void 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
exports.parseIntersectionDef = parseIntersectionDef;
|
|
47
|
+
//# sourceMappingURL=intersection.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intersection.cjs","names":["type: JsonSchema7Type | JsonSchema7StringType","def: ZodIntersectionDef","refs: Refs","parseDef","unevaluatedProperties:\n | Pick<JsonSchema7AllOfType, \"unevaluatedProperties\">\n | undefined","mergedAllOf: JsonSchema7Type[]","nestedSchema: JsonSchema7Type"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/intersection.ts"],"sourcesContent":["import { ZodIntersectionDef } from \"zod/v3\";\nimport { parseDef } from \"../parseDef.js\";\nimport { JsonSchema7Type } from \"../parseTypes.js\";\nimport { Refs } from \"../Refs.js\";\nimport { JsonSchema7StringType } from \"./string.js\";\n\nexport type JsonSchema7AllOfType = {\n allOf: JsonSchema7Type[];\n unevaluatedProperties?: boolean;\n};\n\nconst isJsonSchema7AllOfType = (\n type: JsonSchema7Type | JsonSchema7StringType\n): type is JsonSchema7AllOfType => {\n if (\"type\" in type && type.type === \"string\") return false;\n return \"allOf\" in type;\n};\n\nexport function parseIntersectionDef(\n def: ZodIntersectionDef,\n refs: Refs\n): JsonSchema7AllOfType | JsonSchema7Type | undefined {\n const allOf = [\n parseDef(def.left._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"allOf\", \"0\"],\n }),\n parseDef(def.right._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"allOf\", \"1\"],\n }),\n ].filter((x): x is JsonSchema7Type => !!x);\n\n let unevaluatedProperties:\n | Pick<JsonSchema7AllOfType, \"unevaluatedProperties\">\n | undefined =\n refs.target === \"jsonSchema2019-09\"\n ? { unevaluatedProperties: false }\n : undefined;\n\n const mergedAllOf: JsonSchema7Type[] = [];\n // If either of the schemas is an allOf, merge them into a single allOf\n allOf.forEach((schema) => {\n if (isJsonSchema7AllOfType(schema)) {\n mergedAllOf.push(...schema.allOf);\n if (schema.unevaluatedProperties === undefined) {\n // If one of the schemas has no unevaluatedProperties set,\n // the merged schema should also have no unevaluatedProperties set\n unevaluatedProperties = undefined;\n }\n } else {\n let nestedSchema: JsonSchema7Type = schema;\n if (\n \"additionalProperties\" in schema &&\n schema.additionalProperties === false\n ) {\n const { additionalProperties, ...rest } = schema;\n nestedSchema = rest;\n } else {\n // As soon as one of the schemas has additionalProperties set not to false, we allow unevaluatedProperties\n unevaluatedProperties = undefined;\n }\n mergedAllOf.push(nestedSchema);\n }\n });\n return mergedAllOf.length\n ? {\n allOf: mergedAllOf,\n ...unevaluatedProperties,\n }\n : undefined;\n}\n"],"mappings":";;;AAWA,MAAM,yBAAyB,CAC7BA,SACiC;AACjC,KAAI,UAAU,QAAQ,KAAK,SAAS,SAAU,QAAO;AACrD,QAAO,WAAW;AACnB;AAED,SAAgB,qBACdC,KACAC,MACoD;CACpD,MAAM,QAAQ,CACZC,0BAAS,IAAI,KAAK,MAAM;EACtB,GAAG;EACH,aAAa;GAAC,GAAG,KAAK;GAAa;GAAS;EAAI;CACjD,EAAC,EACFA,0BAAS,IAAI,MAAM,MAAM;EACvB,GAAG;EACH,aAAa;GAAC,GAAG,KAAK;GAAa;GAAS;EAAI;CACjD,EAAC,AACH,EAAC,OAAO,CAAC,MAA4B,CAAC,CAAC,EAAE;CAE1C,IAAIC,wBAGF,KAAK,WAAW,sBACZ,EAAE,uBAAuB,MAAO,IAChC;CAEN,MAAMC,cAAiC,CAAE;CAEzC,MAAM,QAAQ,CAAC,WAAW;AACxB,MAAI,uBAAuB,OAAO,EAAE;GAClC,YAAY,KAAK,GAAG,OAAO,MAAM;AACjC,OAAI,OAAO,0BAA0B,QAGnC,wBAAwB;EAE3B,OAAM;GACL,IAAIC,eAAgC;AACpC,OACE,0BAA0B,UAC1B,OAAO,yBAAyB,OAChC;IACA,MAAM,EAAE,qBAAsB,GAAG,MAAM,GAAG;IAC1C,eAAe;GAChB,OAEC,wBAAwB;GAE1B,YAAY,KAAK,aAAa;EAC/B;CACF,EAAC;AACF,QAAO,YAAY,SACf;EACE,OAAO;EACP,GAAG;CACJ,IACD;AACL"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { JsonSchema7Type } from "../parseTypes.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/zod-to-json-schema/parsers/intersection.d.ts
|
|
4
|
+
type JsonSchema7AllOfType = {
|
|
5
|
+
allOf: JsonSchema7Type[];
|
|
6
|
+
unevaluatedProperties?: boolean;
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { JsonSchema7AllOfType };
|
|
10
|
+
//# sourceMappingURL=intersection.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intersection.d.cts","names":["ZodIntersectionDef","JsonSchema7Type","Refs","JsonSchema7AllOfType","parseIntersectionDef"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/intersection.d.ts"],"sourcesContent":["import { ZodIntersectionDef } from \"zod/v3\";\nimport { JsonSchema7Type } from \"../parseTypes.js\";\nimport { Refs } from \"../Refs.js\";\nexport type JsonSchema7AllOfType = {\n allOf: JsonSchema7Type[];\n unevaluatedProperties?: boolean;\n};\nexport declare function parseIntersectionDef(def: ZodIntersectionDef, refs: Refs): JsonSchema7AllOfType | JsonSchema7Type | undefined;\n"],"mappings":";;;AAGYG,KAAAA,oBAAAA,GAAoB;SACrBF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { JsonSchema7Type } from "../parseTypes.js";
|
|
2
|
+
import "zod/v3";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/zod-to-json-schema/parsers/intersection.d.ts
|
|
5
|
+
type JsonSchema7AllOfType = {
|
|
6
|
+
allOf: JsonSchema7Type[];
|
|
7
|
+
unevaluatedProperties?: boolean;
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { JsonSchema7AllOfType };
|
|
11
|
+
//# sourceMappingURL=intersection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intersection.d.ts","names":["ZodIntersectionDef","JsonSchema7Type","Refs","JsonSchema7AllOfType","parseIntersectionDef"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/intersection.d.ts"],"sourcesContent":["import { ZodIntersectionDef } from \"zod/v3\";\nimport { JsonSchema7Type } from \"../parseTypes.js\";\nimport { Refs } from \"../Refs.js\";\nexport type JsonSchema7AllOfType = {\n allOf: JsonSchema7Type[];\n unevaluatedProperties?: boolean;\n};\nexport declare function parseIntersectionDef(def: ZodIntersectionDef, refs: Refs): JsonSchema7AllOfType | JsonSchema7Type | undefined;\n"],"mappings":";;;;KAGYG,oBAAAA;EAAAA,KAAAA,EACDF,eADCE,EAAoB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { parseDef } from "../parseDef.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/zod-to-json-schema/parsers/intersection.ts
|
|
4
|
+
const isJsonSchema7AllOfType = (type) => {
|
|
5
|
+
if ("type" in type && type.type === "string") return false;
|
|
6
|
+
return "allOf" in type;
|
|
7
|
+
};
|
|
8
|
+
function parseIntersectionDef(def, refs) {
|
|
9
|
+
const allOf = [parseDef(def.left._def, {
|
|
10
|
+
...refs,
|
|
11
|
+
currentPath: [
|
|
12
|
+
...refs.currentPath,
|
|
13
|
+
"allOf",
|
|
14
|
+
"0"
|
|
15
|
+
]
|
|
16
|
+
}), parseDef(def.right._def, {
|
|
17
|
+
...refs,
|
|
18
|
+
currentPath: [
|
|
19
|
+
...refs.currentPath,
|
|
20
|
+
"allOf",
|
|
21
|
+
"1"
|
|
22
|
+
]
|
|
23
|
+
})].filter((x) => !!x);
|
|
24
|
+
let unevaluatedProperties = refs.target === "jsonSchema2019-09" ? { unevaluatedProperties: false } : void 0;
|
|
25
|
+
const mergedAllOf = [];
|
|
26
|
+
allOf.forEach((schema) => {
|
|
27
|
+
if (isJsonSchema7AllOfType(schema)) {
|
|
28
|
+
mergedAllOf.push(...schema.allOf);
|
|
29
|
+
if (schema.unevaluatedProperties === void 0) unevaluatedProperties = void 0;
|
|
30
|
+
} else {
|
|
31
|
+
let nestedSchema = schema;
|
|
32
|
+
if ("additionalProperties" in schema && schema.additionalProperties === false) {
|
|
33
|
+
const { additionalProperties,...rest } = schema;
|
|
34
|
+
nestedSchema = rest;
|
|
35
|
+
} else unevaluatedProperties = void 0;
|
|
36
|
+
mergedAllOf.push(nestedSchema);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
return mergedAllOf.length ? {
|
|
40
|
+
allOf: mergedAllOf,
|
|
41
|
+
...unevaluatedProperties
|
|
42
|
+
} : void 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
export { parseIntersectionDef };
|
|
47
|
+
//# sourceMappingURL=intersection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intersection.js","names":["type: JsonSchema7Type | JsonSchema7StringType","def: ZodIntersectionDef","refs: Refs","unevaluatedProperties:\n | Pick<JsonSchema7AllOfType, \"unevaluatedProperties\">\n | undefined","mergedAllOf: JsonSchema7Type[]","nestedSchema: JsonSchema7Type"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/intersection.ts"],"sourcesContent":["import { ZodIntersectionDef } from \"zod/v3\";\nimport { parseDef } from \"../parseDef.js\";\nimport { JsonSchema7Type } from \"../parseTypes.js\";\nimport { Refs } from \"../Refs.js\";\nimport { JsonSchema7StringType } from \"./string.js\";\n\nexport type JsonSchema7AllOfType = {\n allOf: JsonSchema7Type[];\n unevaluatedProperties?: boolean;\n};\n\nconst isJsonSchema7AllOfType = (\n type: JsonSchema7Type | JsonSchema7StringType\n): type is JsonSchema7AllOfType => {\n if (\"type\" in type && type.type === \"string\") return false;\n return \"allOf\" in type;\n};\n\nexport function parseIntersectionDef(\n def: ZodIntersectionDef,\n refs: Refs\n): JsonSchema7AllOfType | JsonSchema7Type | undefined {\n const allOf = [\n parseDef(def.left._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"allOf\", \"0\"],\n }),\n parseDef(def.right._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"allOf\", \"1\"],\n }),\n ].filter((x): x is JsonSchema7Type => !!x);\n\n let unevaluatedProperties:\n | Pick<JsonSchema7AllOfType, \"unevaluatedProperties\">\n | undefined =\n refs.target === \"jsonSchema2019-09\"\n ? { unevaluatedProperties: false }\n : undefined;\n\n const mergedAllOf: JsonSchema7Type[] = [];\n // If either of the schemas is an allOf, merge them into a single allOf\n allOf.forEach((schema) => {\n if (isJsonSchema7AllOfType(schema)) {\n mergedAllOf.push(...schema.allOf);\n if (schema.unevaluatedProperties === undefined) {\n // If one of the schemas has no unevaluatedProperties set,\n // the merged schema should also have no unevaluatedProperties set\n unevaluatedProperties = undefined;\n }\n } else {\n let nestedSchema: JsonSchema7Type = schema;\n if (\n \"additionalProperties\" in schema &&\n schema.additionalProperties === false\n ) {\n const { additionalProperties, ...rest } = schema;\n nestedSchema = rest;\n } else {\n // As soon as one of the schemas has additionalProperties set not to false, we allow unevaluatedProperties\n unevaluatedProperties = undefined;\n }\n mergedAllOf.push(nestedSchema);\n }\n });\n return mergedAllOf.length\n ? {\n allOf: mergedAllOf,\n ...unevaluatedProperties,\n }\n : undefined;\n}\n"],"mappings":";;;AAWA,MAAM,yBAAyB,CAC7BA,SACiC;AACjC,KAAI,UAAU,QAAQ,KAAK,SAAS,SAAU,QAAO;AACrD,QAAO,WAAW;AACnB;AAED,SAAgB,qBACdC,KACAC,MACoD;CACpD,MAAM,QAAQ,CACZ,SAAS,IAAI,KAAK,MAAM;EACtB,GAAG;EACH,aAAa;GAAC,GAAG,KAAK;GAAa;GAAS;EAAI;CACjD,EAAC,EACF,SAAS,IAAI,MAAM,MAAM;EACvB,GAAG;EACH,aAAa;GAAC,GAAG,KAAK;GAAa;GAAS;EAAI;CACjD,EAAC,AACH,EAAC,OAAO,CAAC,MAA4B,CAAC,CAAC,EAAE;CAE1C,IAAIC,wBAGF,KAAK,WAAW,sBACZ,EAAE,uBAAuB,MAAO,IAChC;CAEN,MAAMC,cAAiC,CAAE;CAEzC,MAAM,QAAQ,CAAC,WAAW;AACxB,MAAI,uBAAuB,OAAO,EAAE;GAClC,YAAY,KAAK,GAAG,OAAO,MAAM;AACjC,OAAI,OAAO,0BAA0B,QAGnC,wBAAwB;EAE3B,OAAM;GACL,IAAIC,eAAgC;AACpC,OACE,0BAA0B,UAC1B,OAAO,yBAAyB,OAChC;IACA,MAAM,EAAE,qBAAsB,GAAG,MAAM,GAAG;IAC1C,eAAe;GAChB,OAEC,wBAAwB;GAE1B,YAAY,KAAK,aAAa;EAC/B;CACF,EAAC;AACF,QAAO,YAAY,SACf;EACE,OAAO;EACP,GAAG;CACJ,IACD;AACL"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/utils/zod-to-json-schema/parsers/literal.ts
|
|
3
|
+
function parseLiteralDef(def, refs) {
|
|
4
|
+
const parsedType = typeof def.value;
|
|
5
|
+
if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") return { type: Array.isArray(def.value) ? "array" : "object" };
|
|
6
|
+
if (refs.target === "openApi3") return {
|
|
7
|
+
type: parsedType === "bigint" ? "integer" : parsedType,
|
|
8
|
+
enum: [def.value]
|
|
9
|
+
};
|
|
10
|
+
return {
|
|
11
|
+
type: parsedType === "bigint" ? "integer" : parsedType,
|
|
12
|
+
const: def.value
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.parseLiteralDef = parseLiteralDef;
|
|
18
|
+
//# sourceMappingURL=literal.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"literal.cjs","names":["def: ZodLiteralDef","refs: Refs"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/literal.ts"],"sourcesContent":["import { ZodLiteralDef } from \"zod/v3\";\nimport { Refs } from \"../Refs.js\";\n\nexport type JsonSchema7LiteralType =\n | {\n type: \"string\" | \"number\" | \"integer\" | \"boolean\";\n const: string | number | boolean;\n }\n | {\n type: \"object\" | \"array\";\n };\n\nexport function parseLiteralDef(\n def: ZodLiteralDef,\n refs: Refs\n): JsonSchema7LiteralType {\n const parsedType = typeof def.value;\n if (\n parsedType !== \"bigint\" &&\n parsedType !== \"number\" &&\n parsedType !== \"boolean\" &&\n parsedType !== \"string\"\n ) {\n return {\n type: Array.isArray(def.value) ? \"array\" : \"object\",\n };\n }\n\n if (refs.target === \"openApi3\") {\n return {\n type: parsedType === \"bigint\" ? \"integer\" : parsedType,\n enum: [def.value],\n } as any;\n }\n\n return {\n type: parsedType === \"bigint\" ? \"integer\" : parsedType,\n const: def.value,\n };\n}\n"],"mappings":";;AAYA,SAAgB,gBACdA,KACAC,MACwB;CACxB,MAAM,aAAa,OAAO,IAAI;AAC9B,KACE,eAAe,YACf,eAAe,YACf,eAAe,aACf,eAAe,SAEf,QAAO,EACL,MAAM,MAAM,QAAQ,IAAI,MAAM,GAAG,UAAU,SAC5C;AAGH,KAAI,KAAK,WAAW,WAClB,QAAO;EACL,MAAM,eAAe,WAAW,YAAY;EAC5C,MAAM,CAAC,IAAI,KAAM;CAClB;AAGH,QAAO;EACL,MAAM,eAAe,WAAW,YAAY;EAC5C,OAAO,IAAI;CACZ;AACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/utils/zod-to-json-schema/parsers/literal.d.ts
|
|
2
|
+
|
|
3
|
+
type JsonSchema7LiteralType = {
|
|
4
|
+
type: "string" | "number" | "integer" | "boolean";
|
|
5
|
+
const: string | number | boolean;
|
|
6
|
+
} | {
|
|
7
|
+
type: "object" | "array";
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { JsonSchema7LiteralType };
|
|
11
|
+
//# sourceMappingURL=literal.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"literal.d.cts","names":["ZodLiteralDef","Refs","JsonSchema7LiteralType","parseLiteralDef"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/literal.d.ts"],"sourcesContent":["import { ZodLiteralDef } from \"zod/v3\";\nimport { Refs } from \"../Refs.js\";\nexport type JsonSchema7LiteralType = {\n type: \"string\" | \"number\" | \"integer\" | \"boolean\";\n const: string | number | boolean;\n} | {\n type: \"object\" | \"array\";\n};\nexport declare function parseLiteralDef(def: ZodLiteralDef, refs: Refs): JsonSchema7LiteralType;\n"],"mappings":";;KAEYE,sBAAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import "zod/v3";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/zod-to-json-schema/parsers/literal.d.ts
|
|
4
|
+
type JsonSchema7LiteralType = {
|
|
5
|
+
type: "string" | "number" | "integer" | "boolean";
|
|
6
|
+
const: string | number | boolean;
|
|
7
|
+
} | {
|
|
8
|
+
type: "object" | "array";
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { JsonSchema7LiteralType };
|
|
12
|
+
//# sourceMappingURL=literal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"literal.d.ts","names":["ZodLiteralDef","Refs","JsonSchema7LiteralType","parseLiteralDef"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/literal.d.ts"],"sourcesContent":["import { ZodLiteralDef } from \"zod/v3\";\nimport { Refs } from \"../Refs.js\";\nexport type JsonSchema7LiteralType = {\n type: \"string\" | \"number\" | \"integer\" | \"boolean\";\n const: string | number | boolean;\n} | {\n type: \"object\" | \"array\";\n};\nexport declare function parseLiteralDef(def: ZodLiteralDef, refs: Refs): JsonSchema7LiteralType;\n"],"mappings":";;;KAEYE,sBAAAA;EAAAA,IAAAA,EAAAA,QAAAA,GAAAA,QAAsB,GAAA,SAAA,GAAA,SAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/utils/zod-to-json-schema/parsers/literal.ts
|
|
2
|
+
function parseLiteralDef(def, refs) {
|
|
3
|
+
const parsedType = typeof def.value;
|
|
4
|
+
if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") return { type: Array.isArray(def.value) ? "array" : "object" };
|
|
5
|
+
if (refs.target === "openApi3") return {
|
|
6
|
+
type: parsedType === "bigint" ? "integer" : parsedType,
|
|
7
|
+
enum: [def.value]
|
|
8
|
+
};
|
|
9
|
+
return {
|
|
10
|
+
type: parsedType === "bigint" ? "integer" : parsedType,
|
|
11
|
+
const: def.value
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { parseLiteralDef };
|
|
17
|
+
//# sourceMappingURL=literal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"literal.js","names":["def: ZodLiteralDef","refs: Refs"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/literal.ts"],"sourcesContent":["import { ZodLiteralDef } from \"zod/v3\";\nimport { Refs } from \"../Refs.js\";\n\nexport type JsonSchema7LiteralType =\n | {\n type: \"string\" | \"number\" | \"integer\" | \"boolean\";\n const: string | number | boolean;\n }\n | {\n type: \"object\" | \"array\";\n };\n\nexport function parseLiteralDef(\n def: ZodLiteralDef,\n refs: Refs\n): JsonSchema7LiteralType {\n const parsedType = typeof def.value;\n if (\n parsedType !== \"bigint\" &&\n parsedType !== \"number\" &&\n parsedType !== \"boolean\" &&\n parsedType !== \"string\"\n ) {\n return {\n type: Array.isArray(def.value) ? \"array\" : \"object\",\n };\n }\n\n if (refs.target === \"openApi3\") {\n return {\n type: parsedType === \"bigint\" ? \"integer\" : parsedType,\n enum: [def.value],\n } as any;\n }\n\n return {\n type: parsedType === \"bigint\" ? \"integer\" : parsedType,\n const: def.value,\n };\n}\n"],"mappings":";AAYA,SAAgB,gBACdA,KACAC,MACwB;CACxB,MAAM,aAAa,OAAO,IAAI;AAC9B,KACE,eAAe,YACf,eAAe,YACf,eAAe,aACf,eAAe,SAEf,QAAO,EACL,MAAM,MAAM,QAAQ,IAAI,MAAM,GAAG,UAAU,SAC5C;AAGH,KAAI,KAAK,WAAW,WAClB,QAAO;EACL,MAAM,eAAe,WAAW,YAAY;EAC5C,MAAM,CAAC,IAAI,KAAM;CAClB;AAGH,QAAO;EACL,MAAM,eAAe,WAAW,YAAY;EAC5C,OAAO,IAAI;CACZ;AACF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const require_any = require('./any.cjs');
|
|
2
|
+
const require_record = require('./record.cjs');
|
|
3
|
+
const require_parseDef = require('../parseDef.cjs');
|
|
4
|
+
|
|
5
|
+
//#region src/utils/zod-to-json-schema/parsers/map.ts
|
|
6
|
+
function parseMapDef(def, refs) {
|
|
7
|
+
if (refs.mapStrategy === "record") return require_record.parseRecordDef(def, refs);
|
|
8
|
+
const keys = require_parseDef.parseDef(def.keyType._def, {
|
|
9
|
+
...refs,
|
|
10
|
+
currentPath: [
|
|
11
|
+
...refs.currentPath,
|
|
12
|
+
"items",
|
|
13
|
+
"items",
|
|
14
|
+
"0"
|
|
15
|
+
]
|
|
16
|
+
}) || require_any.parseAnyDef(refs);
|
|
17
|
+
const values = require_parseDef.parseDef(def.valueType._def, {
|
|
18
|
+
...refs,
|
|
19
|
+
currentPath: [
|
|
20
|
+
...refs.currentPath,
|
|
21
|
+
"items",
|
|
22
|
+
"items",
|
|
23
|
+
"1"
|
|
24
|
+
]
|
|
25
|
+
}) || require_any.parseAnyDef(refs);
|
|
26
|
+
return {
|
|
27
|
+
type: "array",
|
|
28
|
+
maxItems: 125,
|
|
29
|
+
items: {
|
|
30
|
+
type: "array",
|
|
31
|
+
items: [keys, values],
|
|
32
|
+
minItems: 2,
|
|
33
|
+
maxItems: 2
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
exports.parseMapDef = parseMapDef;
|
|
40
|
+
//# sourceMappingURL=map.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.cjs","names":["def: ZodMapDef","refs: Refs","parseRecordDef","parseDef","parseAnyDef"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/map.ts"],"sourcesContent":["import { ZodMapDef } from \"zod/v3\";\nimport { parseDef } from \"../parseDef.js\";\nimport { JsonSchema7Type } from \"../parseTypes.js\";\nimport { Refs } from \"../Refs.js\";\nimport { JsonSchema7RecordType, parseRecordDef } from \"./record.js\";\nimport { parseAnyDef } from \"./any.js\";\n\nexport type JsonSchema7MapType = {\n type: \"array\";\n maxItems: 125;\n items: {\n type: \"array\";\n items: [JsonSchema7Type, JsonSchema7Type];\n minItems: 2;\n maxItems: 2;\n };\n};\n\nexport function parseMapDef(\n def: ZodMapDef,\n refs: Refs\n): JsonSchema7MapType | JsonSchema7RecordType {\n if (refs.mapStrategy === \"record\") {\n return parseRecordDef(def, refs);\n }\n\n const keys =\n parseDef(def.keyType._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"items\", \"items\", \"0\"],\n }) || parseAnyDef(refs);\n const values =\n parseDef(def.valueType._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"items\", \"items\", \"1\"],\n }) || parseAnyDef(refs);\n return {\n type: \"array\",\n maxItems: 125,\n items: {\n type: \"array\",\n items: [keys, values],\n minItems: 2,\n maxItems: 2,\n },\n };\n}\n"],"mappings":";;;;;AAkBA,SAAgB,YACdA,KACAC,MAC4C;AAC5C,KAAI,KAAK,gBAAgB,SACvB,QAAOC,8BAAe,KAAK,KAAK;CAGlC,MAAM,OACJC,0BAAS,IAAI,QAAQ,MAAM;EACzB,GAAG;EACH,aAAa;GAAC,GAAG,KAAK;GAAa;GAAS;GAAS;EAAI;CAC1D,EAAC,IAAIC,wBAAY,KAAK;CACzB,MAAM,SACJD,0BAAS,IAAI,UAAU,MAAM;EAC3B,GAAG;EACH,aAAa;GAAC,GAAG,KAAK;GAAa;GAAS;GAAS;EAAI;CAC1D,EAAC,IAAIC,wBAAY,KAAK;AACzB,QAAO;EACL,MAAM;EACN,UAAU;EACV,OAAO;GACL,MAAM;GACN,OAAO,CAAC,MAAM,MAAO;GACrB,UAAU;GACV,UAAU;EACX;CACF;AACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { JsonSchema7Type } from "../parseTypes.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/zod-to-json-schema/parsers/map.d.ts
|
|
4
|
+
|
|
5
|
+
type JsonSchema7MapType = {
|
|
6
|
+
type: "array";
|
|
7
|
+
maxItems: 125;
|
|
8
|
+
items: {
|
|
9
|
+
type: "array";
|
|
10
|
+
items: [JsonSchema7Type, JsonSchema7Type];
|
|
11
|
+
minItems: 2;
|
|
12
|
+
maxItems: 2;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { JsonSchema7MapType };
|
|
17
|
+
//# sourceMappingURL=map.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.d.cts","names":["ZodMapDef","JsonSchema7Type","Refs","JsonSchema7RecordType","JsonSchema7MapType","parseMapDef"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/map.d.ts"],"sourcesContent":["import { ZodMapDef } from \"zod/v3\";\nimport { JsonSchema7Type } from \"../parseTypes.js\";\nimport { Refs } from \"../Refs.js\";\nimport { JsonSchema7RecordType } from \"./record.js\";\nexport type JsonSchema7MapType = {\n type: \"array\";\n maxItems: 125;\n items: {\n type: \"array\";\n items: [JsonSchema7Type, JsonSchema7Type];\n minItems: 2;\n maxItems: 2;\n };\n};\nexport declare function parseMapDef(def: ZodMapDef, refs: Refs): JsonSchema7MapType | JsonSchema7RecordType;\n"],"mappings":";;;;AAI8B,KAAlBI,kBAAAA,GAAkB;EAAA,IAKdH,EAAAA,OAAAA;EAAe,QAAEA,EAAAA,GAAAA;EAAe,KAAA,EAAA;;YAAhCA,iBAAiBA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { JsonSchema7Type } from "../parseTypes.js";
|
|
2
|
+
import "zod/v3";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/zod-to-json-schema/parsers/map.d.ts
|
|
5
|
+
type JsonSchema7MapType = {
|
|
6
|
+
type: "array";
|
|
7
|
+
maxItems: 125;
|
|
8
|
+
items: {
|
|
9
|
+
type: "array";
|
|
10
|
+
items: [JsonSchema7Type, JsonSchema7Type];
|
|
11
|
+
minItems: 2;
|
|
12
|
+
maxItems: 2;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { JsonSchema7MapType };
|
|
17
|
+
//# sourceMappingURL=map.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.d.ts","names":["ZodMapDef","JsonSchema7Type","Refs","JsonSchema7RecordType","JsonSchema7MapType","parseMapDef"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/map.d.ts"],"sourcesContent":["import { ZodMapDef } from \"zod/v3\";\nimport { JsonSchema7Type } from \"../parseTypes.js\";\nimport { Refs } from \"../Refs.js\";\nimport { JsonSchema7RecordType } from \"./record.js\";\nexport type JsonSchema7MapType = {\n type: \"array\";\n maxItems: 125;\n items: {\n type: \"array\";\n items: [JsonSchema7Type, JsonSchema7Type];\n minItems: 2;\n maxItems: 2;\n };\n};\nexport declare function parseMapDef(def: ZodMapDef, refs: Refs): JsonSchema7MapType | JsonSchema7RecordType;\n"],"mappings":";;;;AAIYI,KAAAA,kBAAAA,GAAkB;EAAA,IAAA,EAAA,OAAA;EAAA,QAKdH,EAAAA,GAAAA;EAAe,KAAEA,EAAAA;IAAe,IAAA,EAAA,OAAA;YAAhCA,iBAAiBA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { parseAnyDef } from "./any.js";
|
|
2
|
+
import { parseRecordDef } from "./record.js";
|
|
3
|
+
import { parseDef } from "../parseDef.js";
|
|
4
|
+
|
|
5
|
+
//#region src/utils/zod-to-json-schema/parsers/map.ts
|
|
6
|
+
function parseMapDef(def, refs) {
|
|
7
|
+
if (refs.mapStrategy === "record") return parseRecordDef(def, refs);
|
|
8
|
+
const keys = parseDef(def.keyType._def, {
|
|
9
|
+
...refs,
|
|
10
|
+
currentPath: [
|
|
11
|
+
...refs.currentPath,
|
|
12
|
+
"items",
|
|
13
|
+
"items",
|
|
14
|
+
"0"
|
|
15
|
+
]
|
|
16
|
+
}) || parseAnyDef(refs);
|
|
17
|
+
const values = parseDef(def.valueType._def, {
|
|
18
|
+
...refs,
|
|
19
|
+
currentPath: [
|
|
20
|
+
...refs.currentPath,
|
|
21
|
+
"items",
|
|
22
|
+
"items",
|
|
23
|
+
"1"
|
|
24
|
+
]
|
|
25
|
+
}) || parseAnyDef(refs);
|
|
26
|
+
return {
|
|
27
|
+
type: "array",
|
|
28
|
+
maxItems: 125,
|
|
29
|
+
items: {
|
|
30
|
+
type: "array",
|
|
31
|
+
items: [keys, values],
|
|
32
|
+
minItems: 2,
|
|
33
|
+
maxItems: 2
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
export { parseMapDef };
|
|
40
|
+
//# sourceMappingURL=map.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.js","names":["def: ZodMapDef","refs: Refs"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/map.ts"],"sourcesContent":["import { ZodMapDef } from \"zod/v3\";\nimport { parseDef } from \"../parseDef.js\";\nimport { JsonSchema7Type } from \"../parseTypes.js\";\nimport { Refs } from \"../Refs.js\";\nimport { JsonSchema7RecordType, parseRecordDef } from \"./record.js\";\nimport { parseAnyDef } from \"./any.js\";\n\nexport type JsonSchema7MapType = {\n type: \"array\";\n maxItems: 125;\n items: {\n type: \"array\";\n items: [JsonSchema7Type, JsonSchema7Type];\n minItems: 2;\n maxItems: 2;\n };\n};\n\nexport function parseMapDef(\n def: ZodMapDef,\n refs: Refs\n): JsonSchema7MapType | JsonSchema7RecordType {\n if (refs.mapStrategy === \"record\") {\n return parseRecordDef(def, refs);\n }\n\n const keys =\n parseDef(def.keyType._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"items\", \"items\", \"0\"],\n }) || parseAnyDef(refs);\n const values =\n parseDef(def.valueType._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"items\", \"items\", \"1\"],\n }) || parseAnyDef(refs);\n return {\n type: \"array\",\n maxItems: 125,\n items: {\n type: \"array\",\n items: [keys, values],\n minItems: 2,\n maxItems: 2,\n },\n };\n}\n"],"mappings":";;;;;AAkBA,SAAgB,YACdA,KACAC,MAC4C;AAC5C,KAAI,KAAK,gBAAgB,SACvB,QAAO,eAAe,KAAK,KAAK;CAGlC,MAAM,OACJ,SAAS,IAAI,QAAQ,MAAM;EACzB,GAAG;EACH,aAAa;GAAC,GAAG,KAAK;GAAa;GAAS;GAAS;EAAI;CAC1D,EAAC,IAAI,YAAY,KAAK;CACzB,MAAM,SACJ,SAAS,IAAI,UAAU,MAAM;EAC3B,GAAG;EACH,aAAa;GAAC,GAAG,KAAK;GAAa;GAAS;GAAS;EAAI;CAC1D,EAAC,IAAI,YAAY,KAAK;AACzB,QAAO;EACL,MAAM;EACN,UAAU;EACV,OAAO;GACL,MAAM;GACN,OAAO,CAAC,MAAM,MAAO;GACrB,UAAU;GACV,UAAU;EACX;CACF;AACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/utils/zod-to-json-schema/parsers/nativeEnum.ts
|
|
3
|
+
function parseNativeEnumDef(def) {
|
|
4
|
+
const object = def.values;
|
|
5
|
+
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
6
|
+
return typeof object[object[key]] !== "number";
|
|
7
|
+
});
|
|
8
|
+
const actualValues = actualKeys.map((key) => object[key]);
|
|
9
|
+
const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values)));
|
|
10
|
+
return {
|
|
11
|
+
type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
12
|
+
enum: actualValues
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.parseNativeEnumDef = parseNativeEnumDef;
|
|
18
|
+
//# sourceMappingURL=nativeEnum.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeEnum.cjs","names":["def: ZodNativeEnumDef","key: string","values: string | number"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/nativeEnum.ts"],"sourcesContent":["import { ZodNativeEnumDef } from \"zod/v3\";\n\nexport type JsonSchema7NativeEnumType = {\n type: \"string\" | \"number\" | [\"string\", \"number\"];\n enum: (string | number)[];\n};\n\nexport function parseNativeEnumDef(\n def: ZodNativeEnumDef\n): JsonSchema7NativeEnumType {\n const object = def.values;\n const actualKeys = Object.keys(def.values).filter((key: string) => {\n return typeof object[object[key]] !== \"number\";\n });\n\n const actualValues = actualKeys.map((key: string) => object[key]);\n\n const parsedTypes = Array.from(\n new Set(actualValues.map((values: string | number) => typeof values))\n );\n\n return {\n type:\n parsedTypes.length === 1\n ? parsedTypes[0] === \"string\"\n ? \"string\"\n : \"number\"\n : [\"string\", \"number\"],\n enum: actualValues,\n };\n}\n"],"mappings":";;AAOA,SAAgB,mBACdA,KAC2B;CAC3B,MAAM,SAAS,IAAI;CACnB,MAAM,aAAa,OAAO,KAAK,IAAI,OAAO,CAAC,OAAO,CAACC,QAAgB;AACjE,SAAO,OAAO,OAAO,OAAO,UAAU;CACvC,EAAC;CAEF,MAAM,eAAe,WAAW,IAAI,CAACA,QAAgB,OAAO,KAAK;CAEjE,MAAM,cAAc,MAAM,KACxB,IAAI,IAAI,aAAa,IAAI,CAACC,WAA4B,OAAO,OAAO,EACrE;AAED,QAAO;EACL,MACE,YAAY,WAAW,IACnB,YAAY,OAAO,WACjB,WACA,WACF,CAAC,UAAU,QAAS;EAC1B,MAAM;CACP;AACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/utils/zod-to-json-schema/parsers/nativeEnum.d.ts
|
|
2
|
+
type JsonSchema7NativeEnumType = {
|
|
3
|
+
type: "string" | "number" | ["string", "number"];
|
|
4
|
+
enum: (string | number)[];
|
|
5
|
+
};
|
|
6
|
+
//#endregion
|
|
7
|
+
export { JsonSchema7NativeEnumType };
|
|
8
|
+
//# sourceMappingURL=nativeEnum.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeEnum.d.cts","names":["ZodNativeEnumDef","JsonSchema7NativeEnumType","parseNativeEnumDef"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/nativeEnum.d.ts"],"sourcesContent":["import { ZodNativeEnumDef } from \"zod/v3\";\nexport type JsonSchema7NativeEnumType = {\n type: \"string\" | \"number\" | [\"string\", \"number\"];\n enum: (string | number)[];\n};\nexport declare function parseNativeEnumDef(def: ZodNativeEnumDef): JsonSchema7NativeEnumType;\n"],"mappings":";AACYC,KAAAA,yBAAAA,GAAyB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "zod/v3";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/zod-to-json-schema/parsers/nativeEnum.d.ts
|
|
4
|
+
type JsonSchema7NativeEnumType = {
|
|
5
|
+
type: "string" | "number" | ["string", "number"];
|
|
6
|
+
enum: (string | number)[];
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { JsonSchema7NativeEnumType };
|
|
10
|
+
//# sourceMappingURL=nativeEnum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeEnum.d.ts","names":["ZodNativeEnumDef","JsonSchema7NativeEnumType","parseNativeEnumDef"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/nativeEnum.d.ts"],"sourcesContent":["import { ZodNativeEnumDef } from \"zod/v3\";\nexport type JsonSchema7NativeEnumType = {\n type: \"string\" | \"number\" | [\"string\", \"number\"];\n enum: (string | number)[];\n};\nexport declare function parseNativeEnumDef(def: ZodNativeEnumDef): JsonSchema7NativeEnumType;\n"],"mappings":";;;KACYC,yBAAAA;;EAAAA,IAAAA,EAAAA,CAAAA,MAAAA,GAAAA,MAAAA,CAAAA,EAAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/utils/zod-to-json-schema/parsers/nativeEnum.ts
|
|
2
|
+
function parseNativeEnumDef(def) {
|
|
3
|
+
const object = def.values;
|
|
4
|
+
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
5
|
+
return typeof object[object[key]] !== "number";
|
|
6
|
+
});
|
|
7
|
+
const actualValues = actualKeys.map((key) => object[key]);
|
|
8
|
+
const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values)));
|
|
9
|
+
return {
|
|
10
|
+
type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
11
|
+
enum: actualValues
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { parseNativeEnumDef };
|
|
17
|
+
//# sourceMappingURL=nativeEnum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeEnum.js","names":["def: ZodNativeEnumDef","key: string","values: string | number"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/nativeEnum.ts"],"sourcesContent":["import { ZodNativeEnumDef } from \"zod/v3\";\n\nexport type JsonSchema7NativeEnumType = {\n type: \"string\" | \"number\" | [\"string\", \"number\"];\n enum: (string | number)[];\n};\n\nexport function parseNativeEnumDef(\n def: ZodNativeEnumDef\n): JsonSchema7NativeEnumType {\n const object = def.values;\n const actualKeys = Object.keys(def.values).filter((key: string) => {\n return typeof object[object[key]] !== \"number\";\n });\n\n const actualValues = actualKeys.map((key: string) => object[key]);\n\n const parsedTypes = Array.from(\n new Set(actualValues.map((values: string | number) => typeof values))\n );\n\n return {\n type:\n parsedTypes.length === 1\n ? parsedTypes[0] === \"string\"\n ? \"string\"\n : \"number\"\n : [\"string\", \"number\"],\n enum: actualValues,\n };\n}\n"],"mappings":";AAOA,SAAgB,mBACdA,KAC2B;CAC3B,MAAM,SAAS,IAAI;CACnB,MAAM,aAAa,OAAO,KAAK,IAAI,OAAO,CAAC,OAAO,CAACC,QAAgB;AACjE,SAAO,OAAO,OAAO,OAAO,UAAU;CACvC,EAAC;CAEF,MAAM,eAAe,WAAW,IAAI,CAACA,QAAgB,OAAO,KAAK;CAEjE,MAAM,cAAc,MAAM,KACxB,IAAI,IAAI,aAAa,IAAI,CAACC,WAA4B,OAAO,OAAO,EACrE;AAED,QAAO;EACL,MACE,YAAY,WAAW,IACnB,YAAY,OAAO,WACjB,WACA,WACF,CAAC,UAAU,QAAS;EAC1B,MAAM;CACP;AACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const require_any = require('./any.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/utils/zod-to-json-schema/parsers/never.ts
|
|
4
|
+
function parseNeverDef(refs) {
|
|
5
|
+
return refs.target === "openAi" ? void 0 : { not: require_any.parseAnyDef({
|
|
6
|
+
...refs,
|
|
7
|
+
currentPath: [...refs.currentPath, "not"]
|
|
8
|
+
}) };
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
exports.parseNeverDef = parseNeverDef;
|
|
13
|
+
//# sourceMappingURL=never.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"never.cjs","names":["refs: Refs","parseAnyDef"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/never.ts"],"sourcesContent":["import { Refs } from \"../Refs.js\";\nimport { JsonSchema7AnyType, parseAnyDef } from \"./any.js\";\n\nexport type JsonSchema7NeverType = {\n not: JsonSchema7AnyType;\n};\n\nexport function parseNeverDef(refs: Refs): JsonSchema7NeverType | undefined {\n return refs.target === \"openAi\"\n ? undefined\n : {\n not: parseAnyDef({\n ...refs,\n currentPath: [...refs.currentPath, \"not\"],\n }),\n };\n}\n"],"mappings":";;;AAOA,SAAgB,cAAcA,MAA8C;AAC1E,QAAO,KAAK,WAAW,WACnB,SACA,EACE,KAAKC,wBAAY;EACf,GAAG;EACH,aAAa,CAAC,GAAG,KAAK,aAAa,KAAM;CAC1C,EAAC,CACH;AACN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"never.d.cts","names":["Refs","JsonSchema7AnyType","JsonSchema7NeverType","parseNeverDef"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/never.d.ts"],"sourcesContent":["import { Refs } from \"../Refs.js\";\nimport { JsonSchema7AnyType } from \"./any.js\";\nexport type JsonSchema7NeverType = {\n not: JsonSchema7AnyType;\n};\nexport declare function parseNeverDef(refs: Refs): JsonSchema7NeverType | undefined;\n"],"mappings":";;;KAEYE,oBAAAA;EAAAA,GAAAA,EACHD,kBADuB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"never.d.ts","names":["Refs","JsonSchema7AnyType","JsonSchema7NeverType","parseNeverDef"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/never.d.ts"],"sourcesContent":["import { Refs } from \"../Refs.js\";\nimport { JsonSchema7AnyType } from \"./any.js\";\nexport type JsonSchema7NeverType = {\n not: JsonSchema7AnyType;\n};\nexport declare function parseNeverDef(refs: Refs): JsonSchema7NeverType | undefined;\n"],"mappings":";;;KAEYE,oBAAAA;EAAAA,GAAAA,EACHD,kBADuB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { parseAnyDef } from "./any.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/zod-to-json-schema/parsers/never.ts
|
|
4
|
+
function parseNeverDef(refs) {
|
|
5
|
+
return refs.target === "openAi" ? void 0 : { not: parseAnyDef({
|
|
6
|
+
...refs,
|
|
7
|
+
currentPath: [...refs.currentPath, "not"]
|
|
8
|
+
}) };
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { parseNeverDef };
|
|
13
|
+
//# sourceMappingURL=never.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"never.js","names":["refs: Refs"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/never.ts"],"sourcesContent":["import { Refs } from \"../Refs.js\";\nimport { JsonSchema7AnyType, parseAnyDef } from \"./any.js\";\n\nexport type JsonSchema7NeverType = {\n not: JsonSchema7AnyType;\n};\n\nexport function parseNeverDef(refs: Refs): JsonSchema7NeverType | undefined {\n return refs.target === \"openAi\"\n ? undefined\n : {\n not: parseAnyDef({\n ...refs,\n currentPath: [...refs.currentPath, \"not\"],\n }),\n };\n}\n"],"mappings":";;;AAOA,SAAgB,cAAcA,MAA8C;AAC1E,QAAO,KAAK,WAAW,WACnB,SACA,EACE,KAAK,YAAY;EACf,GAAG;EACH,aAAa,CAAC,GAAG,KAAK,aAAa,KAAM;CAC1C,EAAC,CACH;AACN"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/utils/zod-to-json-schema/parsers/null.ts
|
|
3
|
+
function parseNullDef(refs) {
|
|
4
|
+
return refs.target === "openApi3" ? {
|
|
5
|
+
enum: ["null"],
|
|
6
|
+
nullable: true
|
|
7
|
+
} : { type: "null" };
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
exports.parseNullDef = parseNullDef;
|
|
12
|
+
//# sourceMappingURL=null.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"null.cjs","names":["refs: Refs"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/null.ts"],"sourcesContent":["import { Refs } from \"../Refs.js\";\n\nexport type JsonSchema7NullType = {\n type: \"null\";\n};\n\nexport function parseNullDef(refs: Refs): JsonSchema7NullType {\n return refs.target === \"openApi3\"\n ? ({\n enum: [\"null\"],\n nullable: true,\n } as any)\n : {\n type: \"null\",\n };\n}\n"],"mappings":";;AAMA,SAAgB,aAAaA,MAAiC;AAC5D,QAAO,KAAK,WAAW,aAClB;EACC,MAAM,CAAC,MAAO;EACd,UAAU;CACX,IACD,EACE,MAAM,OACP;AACN"}
|