@langchain/core 1.0.0-alpha.2 → 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/agents.d.ts.map +1 -1
- package/dist/caches/base.cjs +5 -18
- package/dist/caches/base.cjs.map +1 -1
- package/dist/caches/base.d.cts +4 -20
- package/dist/caches/base.d.cts.map +1 -1
- package/dist/caches/base.d.ts +4 -20
- package/dist/caches/base.d.ts.map +1 -1
- package/dist/caches/base.js +5 -18
- package/dist/caches/base.js.map +1 -1
- package/dist/callbacks/base.d.cts +3 -2
- package/dist/callbacks/base.d.cts.map +1 -1
- package/dist/callbacks/base.d.ts +3 -2
- package/dist/callbacks/base.d.ts.map +1 -1
- package/dist/callbacks/manager.d.cts +1 -1
- package/dist/callbacks/manager.d.ts +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 +4 -4
- package/dist/language_models/base.d.cts.map +1 -1
- package/dist/language_models/base.d.ts +4 -4
- 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 +1 -0
- package/dist/language_models/chat_models.cjs.map +1 -1
- package/dist/language_models/chat_models.d.cts +2 -1
- package/dist/language_models/chat_models.d.cts.map +1 -1
- package/dist/language_models/chat_models.d.ts +2 -1
- package/dist/language_models/chat_models.d.ts.map +1 -1
- package/dist/language_models/chat_models.js +2 -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 +34 -62
- package/dist/messages/ai.cjs.map +1 -1
- package/dist/messages/ai.d.cts +26 -119
- package/dist/messages/ai.d.cts.map +1 -1
- package/dist/messages/ai.d.ts +26 -119
- package/dist/messages/ai.d.ts.map +1 -1
- package/dist/messages/ai.js +34 -62
- package/dist/messages/ai.js.map +1 -1
- package/dist/messages/base.cjs +53 -33
- package/dist/messages/base.cjs.map +1 -1
- package/dist/messages/base.d.cts +38 -41
- package/dist/messages/base.d.cts.map +1 -1
- package/dist/messages/base.d.ts +38 -41
- package/dist/messages/base.d.ts.map +1 -1
- package/dist/messages/base.js +53 -33
- 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/chat.cjs +18 -12
- package/dist/messages/chat.cjs.map +1 -1
- package/dist/messages/chat.d.cts +21 -13
- package/dist/messages/chat.d.cts.map +1 -1
- package/dist/messages/chat.d.ts +21 -13
- package/dist/messages/chat.d.ts.map +1 -1
- package/dist/messages/chat.js +18 -12
- package/dist/messages/chat.js.map +1 -1
- package/dist/messages/content/index.cjs.map +1 -1
- package/dist/messages/content/index.d.cts +1 -1
- package/dist/messages/content/index.d.cts.map +1 -1
- package/dist/messages/content/index.d.ts +1 -1
- package/dist/messages/content/index.d.ts.map +1 -1
- package/dist/messages/content/index.js.map +1 -1
- package/dist/messages/function.cjs +8 -13
- package/dist/messages/function.cjs.map +1 -1
- package/dist/messages/function.d.cts +11 -11
- package/dist/messages/function.d.cts.map +1 -1
- package/dist/messages/function.d.ts +11 -11
- package/dist/messages/function.d.ts.map +1 -1
- package/dist/messages/function.js +8 -13
- package/dist/messages/function.js.map +1 -1
- package/dist/messages/human.cjs +20 -11
- package/dist/messages/human.cjs.map +1 -1
- package/dist/messages/human.d.cts +20 -15
- package/dist/messages/human.d.cts.map +1 -1
- package/dist/messages/human.d.ts +20 -15
- package/dist/messages/human.d.ts.map +1 -1
- package/dist/messages/human.js +20 -11
- package/dist/messages/human.js.map +1 -1
- package/dist/messages/index.cjs +11 -1
- package/dist/messages/index.cjs.map +1 -1
- package/dist/messages/index.d.cts +9 -7
- package/dist/messages/index.d.ts +9 -7
- package/dist/messages/index.js +8 -2
- package/dist/messages/index.js.map +1 -1
- package/dist/messages/message.cjs +15 -0
- package/dist/messages/message.cjs.map +1 -0
- package/dist/messages/message.d.cts +598 -0
- package/dist/messages/message.d.cts.map +1 -0
- package/dist/messages/message.d.ts +598 -0
- package/dist/messages/message.d.ts.map +1 -0
- package/dist/messages/message.js +14 -0
- package/dist/messages/message.js.map +1 -0
- package/dist/messages/metadata.cjs +41 -0
- package/dist/messages/metadata.cjs.map +1 -0
- package/dist/messages/metadata.d.cts +98 -0
- package/dist/messages/metadata.d.cts.map +1 -0
- package/dist/messages/metadata.d.ts +98 -0
- package/dist/messages/metadata.d.ts.map +1 -0
- package/dist/messages/metadata.js +40 -0
- package/dist/messages/metadata.js.map +1 -0
- package/dist/messages/modifier.cjs +5 -4
- package/dist/messages/modifier.cjs.map +1 -1
- package/dist/messages/modifier.d.cts +7 -5
- package/dist/messages/modifier.d.cts.map +1 -1
- package/dist/messages/modifier.d.ts +7 -5
- package/dist/messages/modifier.d.ts.map +1 -1
- package/dist/messages/modifier.js +5 -4
- package/dist/messages/modifier.js.map +1 -1
- package/dist/messages/system.cjs +20 -11
- package/dist/messages/system.cjs.map +1 -1
- package/dist/messages/system.d.cts +20 -15
- package/dist/messages/system.d.cts.map +1 -1
- package/dist/messages/system.d.ts +20 -15
- package/dist/messages/system.d.ts.map +1 -1
- package/dist/messages/system.js +20 -11
- package/dist/messages/system.js.map +1 -1
- package/dist/messages/tool.cjs +21 -19
- package/dist/messages/tool.cjs.map +1 -1
- package/dist/messages/tool.d.cts +72 -46
- package/dist/messages/tool.d.cts.map +1 -1
- package/dist/messages/tool.d.ts +72 -46
- package/dist/messages/tool.d.ts.map +1 -1
- package/dist/messages/tool.js +21 -19
- 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.d.cts +2 -1
- package/dist/messages/transformers.d.cts.map +1 -1
- package/dist/messages/transformers.d.ts +2 -1
- package/dist/messages/transformers.d.ts.map +1 -1
- package/dist/messages/transformers.js +2 -2
- package/dist/messages/transformers.js.map +1 -1
- package/dist/messages/utils.cjs +13 -1
- package/dist/messages/utils.cjs.map +1 -1
- package/dist/messages/utils.d.cts +83 -3
- package/dist/messages/utils.d.cts.map +1 -1
- package/dist/messages/utils.d.ts +83 -3
- package/dist/messages/utils.d.ts.map +1 -1
- package/dist/messages/utils.js +13 -2
- 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.d.cts +1 -1
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.ts +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/prompt_values.d.cts +4 -3
- package/dist/prompt_values.d.cts.map +1 -1
- package/dist/prompt_values.d.ts +4 -3
- package/dist/prompt_values.d.ts.map +1 -1
- package/dist/prompts/chat.cjs +3 -1
- package/dist/prompts/chat.cjs.map +1 -1
- package/dist/prompts/chat.d.cts +7 -15
- package/dist/prompts/chat.d.cts.map +1 -1
- package/dist/prompts/chat.d.ts +7 -15
- 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/few_shot.d.cts +1 -1
- package/dist/prompts/few_shot.d.ts +1 -1
- package/dist/prompts/image.cjs.map +1 -1
- package/dist/prompts/image.d.cts +1 -3
- package/dist/prompts/image.d.cts.map +1 -1
- package/dist/prompts/image.d.ts +1 -3
- 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 +5 -17
- package/dist/prompts/prompt.d.cts.map +1 -1
- package/dist/prompts/prompt.d.ts +5 -17
- 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.d.cts +1 -1
- package/dist/prompts/template.d.ts +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 +1 -4
- package/dist/runnables/base.d.cts.map +1 -1
- package/dist/runnables/base.d.ts +1 -4
- 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 +3 -3
- package/dist/tools/index.d.cts.map +1 -1
- package/dist/tools/index.d.ts +3 -3
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/types.d.cts +6 -6
- package/dist/tools/types.d.cts.map +1 -1
- package/dist/tools/types.d.ts +6 -6
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tracers/base.cjs.map +1 -1
- package/dist/tracers/base.d.cts +1 -1
- package/dist/tracers/base.d.ts +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/tracers/tracer_langchain_v1.d.cts +1 -1
- package/dist/tracers/tracer_langchain_v1.d.ts +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 +8 -12
- package/dist/utils/testing/index.d.cts.map +1 -1
- package/dist/utils/testing/index.d.ts +8 -12
- 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,25 @@
|
|
|
1
|
+
import { JsonSchema7Type } from "../parseTypes.js";
|
|
2
|
+
import "zod/v3";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/zod-to-json-schema/parsers/union.d.ts
|
|
5
|
+
declare const primitiveMappings: {
|
|
6
|
+
readonly ZodString: "string";
|
|
7
|
+
readonly ZodNumber: "number";
|
|
8
|
+
readonly ZodBigInt: "integer";
|
|
9
|
+
readonly ZodBoolean: "boolean";
|
|
10
|
+
readonly ZodNull: "null";
|
|
11
|
+
};
|
|
12
|
+
type JsonSchema7Primitive = (typeof primitiveMappings)[keyof typeof primitiveMappings];
|
|
13
|
+
type JsonSchema7UnionType = JsonSchema7PrimitiveUnionType | JsonSchema7AnyOfType;
|
|
14
|
+
type JsonSchema7PrimitiveUnionType = {
|
|
15
|
+
type: JsonSchema7Primitive | JsonSchema7Primitive[];
|
|
16
|
+
} | {
|
|
17
|
+
type: JsonSchema7Primitive | JsonSchema7Primitive[];
|
|
18
|
+
enum: (string | number | bigint | boolean | null)[];
|
|
19
|
+
};
|
|
20
|
+
type JsonSchema7AnyOfType = {
|
|
21
|
+
anyOf: JsonSchema7Type[];
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { JsonSchema7UnionType };
|
|
25
|
+
//# sourceMappingURL=union.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"union.d.ts","names":["ZodDiscriminatedUnionDef","ZodUnionDef","JsonSchema7Type","Refs","primitiveMappings","JsonSchema7Primitive","JsonSchema7UnionType","JsonSchema7PrimitiveUnionType","JsonSchema7AnyOfType","parseUnionDef"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/union.d.ts"],"sourcesContent":["import { ZodDiscriminatedUnionDef, ZodUnionDef } from \"zod/v3\";\nimport { JsonSchema7Type } from \"../parseTypes.js\";\nimport { Refs } from \"../Refs.js\";\nexport declare const primitiveMappings: {\n readonly ZodString: \"string\";\n readonly ZodNumber: \"number\";\n readonly ZodBigInt: \"integer\";\n readonly ZodBoolean: \"boolean\";\n readonly ZodNull: \"null\";\n};\ntype JsonSchema7Primitive = (typeof primitiveMappings)[keyof typeof primitiveMappings];\nexport type JsonSchema7UnionType = JsonSchema7PrimitiveUnionType | JsonSchema7AnyOfType;\ntype JsonSchema7PrimitiveUnionType = {\n type: JsonSchema7Primitive | JsonSchema7Primitive[];\n} | {\n type: JsonSchema7Primitive | JsonSchema7Primitive[];\n enum: (string | number | bigint | boolean | null)[];\n};\ntype JsonSchema7AnyOfType = {\n anyOf: JsonSchema7Type[];\n};\nexport declare function parseUnionDef(def: ZodUnionDef | ZodDiscriminatedUnionDef<any, any>, refs: Refs): JsonSchema7PrimitiveUnionType | JsonSchema7AnyOfType | undefined;\nexport {};\n"],"mappings":";;;;cAGqBI;EAAAA,SAAAA,SAAAA,EAMpB,QAAA;EACIC,SAAAA,SAAAA,EAAAA,QAAoB;EAAA,SAAA,SAAA,EAAA,SAAA;EAAA,SAAWD,UAAAA,EAAAA,SAAAA;EAAiB,SAAeA,OAAAA,EAAAA,MAAAA;AAAiB,CAAA;AACrF,KADKC,oBAAAA,GAC2B,CAAA,OADID,iBACJ,CAAA,CAAA,MAAA,OADoCA,iBACpC,CAAA;AAAA,KAApBE,oBAAAA,GAAuBC,6BAAH,GAAmCC,oBAAnC;KAC3BD,6BAAAA,GAD8BA;EAA6B,IAAGC,EAEzDH,oBAFyDG,GAElCH,oBAFkCG,EAAAA;AAAoB,CAAA,GAAA;EAClFD,IAAAA,EAGKF,oBAHLE,GAG4BF,oBAHC,EAAA;EAAA,IAAA,EAAA,CAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,OAAA,GAAA,IAAA,CAAA,EAAA;CAAA;KAM7BG,oBAAAA,GAL4BH;EAAoB,KAE3CA,EAICH,eAJDG,EAAAA;CAAoB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { parseDef } from "../parseDef.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/zod-to-json-schema/parsers/union.ts
|
|
4
|
+
const primitiveMappings = {
|
|
5
|
+
ZodString: "string",
|
|
6
|
+
ZodNumber: "number",
|
|
7
|
+
ZodBigInt: "integer",
|
|
8
|
+
ZodBoolean: "boolean",
|
|
9
|
+
ZodNull: "null"
|
|
10
|
+
};
|
|
11
|
+
function parseUnionDef(def, refs) {
|
|
12
|
+
if (refs.target === "openApi3") return asAnyOf(def, refs);
|
|
13
|
+
const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
|
|
14
|
+
if (options.every((x) => x._def.typeName in primitiveMappings && (!x._def.checks || !x._def.checks.length))) {
|
|
15
|
+
const types = options.reduce((types$1, x) => {
|
|
16
|
+
const type = primitiveMappings[x._def.typeName];
|
|
17
|
+
return type && !types$1.includes(type) ? [...types$1, type] : types$1;
|
|
18
|
+
}, []);
|
|
19
|
+
return { type: types.length > 1 ? types : types[0] };
|
|
20
|
+
} else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
|
|
21
|
+
const types = options.reduce((acc, x) => {
|
|
22
|
+
const type = typeof x._def.value;
|
|
23
|
+
switch (type) {
|
|
24
|
+
case "string":
|
|
25
|
+
case "number":
|
|
26
|
+
case "boolean": return [...acc, type];
|
|
27
|
+
case "bigint": return [...acc, "integer"];
|
|
28
|
+
case "object":
|
|
29
|
+
if (x._def.value === null) return [...acc, "null"];
|
|
30
|
+
return acc;
|
|
31
|
+
case "symbol":
|
|
32
|
+
case "undefined":
|
|
33
|
+
case "function":
|
|
34
|
+
default: return acc;
|
|
35
|
+
}
|
|
36
|
+
}, []);
|
|
37
|
+
if (types.length === options.length) {
|
|
38
|
+
const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);
|
|
39
|
+
return {
|
|
40
|
+
type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
|
|
41
|
+
enum: options.reduce((acc, x) => {
|
|
42
|
+
return acc.includes(x._def.value) ? acc : [...acc, x._def.value];
|
|
43
|
+
}, [])
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
} else if (options.every((x) => x._def.typeName === "ZodEnum")) return {
|
|
47
|
+
type: "string",
|
|
48
|
+
enum: options.reduce((acc, x) => [...acc, ...x._def.values.filter((x$1) => !acc.includes(x$1))], [])
|
|
49
|
+
};
|
|
50
|
+
return asAnyOf(def, refs);
|
|
51
|
+
}
|
|
52
|
+
const asAnyOf = (def, refs) => {
|
|
53
|
+
const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map((x, i) => parseDef(x._def, {
|
|
54
|
+
...refs,
|
|
55
|
+
currentPath: [
|
|
56
|
+
...refs.currentPath,
|
|
57
|
+
"anyOf",
|
|
58
|
+
`${i}`
|
|
59
|
+
]
|
|
60
|
+
})).filter((x) => !!x && (!refs.strictUnions || typeof x === "object" && Object.keys(x).length > 0));
|
|
61
|
+
return anyOf.length ? { anyOf } : void 0;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
export { parseUnionDef, primitiveMappings };
|
|
66
|
+
//# sourceMappingURL=union.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"union.js","names":["def: ZodUnionDef | ZodDiscriminatedUnionDef<any, any>","refs: Refs","options: readonly ZodTypeAny[]","types: JsonSchema7Primitive[]","types","acc: JsonSchema7Primitive[]","x: { _def: ZodLiteralDef }","acc: string[]","x: string","x"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/union.ts"],"sourcesContent":["import {\n ZodDiscriminatedUnionDef,\n ZodLiteralDef,\n ZodTypeAny,\n ZodUnionDef,\n} from \"zod/v3\";\nimport { parseDef } from \"../parseDef.js\";\nimport { JsonSchema7Type } from \"../parseTypes.js\";\nimport { Refs } from \"../Refs.js\";\n\nexport const primitiveMappings = {\n ZodString: \"string\",\n ZodNumber: \"number\",\n ZodBigInt: \"integer\",\n ZodBoolean: \"boolean\",\n ZodNull: \"null\",\n} as const;\ntype ZodPrimitive = keyof typeof primitiveMappings;\ntype JsonSchema7Primitive =\n (typeof primitiveMappings)[keyof typeof primitiveMappings];\n\nexport type JsonSchema7UnionType =\n | JsonSchema7PrimitiveUnionType\n | JsonSchema7AnyOfType;\n\ntype JsonSchema7PrimitiveUnionType =\n | {\n type: JsonSchema7Primitive | JsonSchema7Primitive[];\n }\n | {\n type: JsonSchema7Primitive | JsonSchema7Primitive[];\n enum: (string | number | bigint | boolean | null)[];\n };\n\ntype JsonSchema7AnyOfType = {\n anyOf: JsonSchema7Type[];\n};\n\nexport function parseUnionDef(\n def: ZodUnionDef | ZodDiscriminatedUnionDef<any, any>,\n refs: Refs\n): JsonSchema7PrimitiveUnionType | JsonSchema7AnyOfType | undefined {\n if (refs.target === \"openApi3\") return asAnyOf(def, refs);\n\n const options: readonly ZodTypeAny[] =\n def.options instanceof Map ? Array.from(def.options.values()) : def.options;\n\n // This blocks tries to look ahead a bit to produce nicer looking schemas with type array instead of anyOf.\n if (\n options.every(\n (x) =>\n x._def.typeName in primitiveMappings &&\n (!x._def.checks || !x._def.checks.length)\n )\n ) {\n // all types in union are primitive and lack checks, so might as well squash into {type: [...]}\n\n const types = options.reduce((types: JsonSchema7Primitive[], x) => {\n const type = primitiveMappings[x._def.typeName as ZodPrimitive]; //Can be safely casted due to row 43\n return type && !types.includes(type) ? [...types, type] : types;\n }, []);\n\n return {\n type: types.length > 1 ? types : types[0],\n };\n } else if (\n options.every((x) => x._def.typeName === \"ZodLiteral\" && !x.description)\n ) {\n // all options literals\n\n const types = options.reduce(\n (acc: JsonSchema7Primitive[], x: { _def: ZodLiteralDef }) => {\n const type = typeof x._def.value;\n switch (type) {\n case \"string\":\n case \"number\":\n case \"boolean\":\n return [...acc, type];\n case \"bigint\":\n return [...acc, \"integer\" as const];\n case \"object\":\n if (x._def.value === null) return [...acc, \"null\" as const];\n return acc;\n case \"symbol\":\n case \"undefined\":\n case \"function\":\n default:\n return acc;\n }\n },\n []\n );\n\n if (types.length === options.length) {\n // all the literals are primitive, as far as null can be considered primitive\n\n const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);\n return {\n type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],\n enum: options.reduce((acc, x) => {\n return acc.includes(x._def.value) ? acc : [...acc, x._def.value];\n }, [] as (string | number | bigint | boolean | null)[]),\n };\n }\n } else if (options.every((x) => x._def.typeName === \"ZodEnum\")) {\n return {\n type: \"string\",\n enum: options.reduce(\n (acc: string[], x) => [\n ...acc,\n ...x._def.values.filter((x: string) => !acc.includes(x)),\n ],\n []\n ),\n };\n }\n\n return asAnyOf(def, refs);\n}\n\nconst asAnyOf = (\n def: ZodUnionDef | ZodDiscriminatedUnionDef<any, any>,\n refs: Refs\n): JsonSchema7PrimitiveUnionType | JsonSchema7AnyOfType | undefined => {\n const anyOf = (\n (def.options instanceof Map\n ? Array.from(def.options.values())\n : def.options) as any[]\n )\n .map((x, i) =>\n parseDef(x._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"anyOf\", `${i}`],\n })\n )\n .filter(\n (x): x is JsonSchema7Type =>\n !!x &&\n (!refs.strictUnions ||\n (typeof x === \"object\" && Object.keys(x).length > 0))\n );\n\n return anyOf.length ? { anyOf } : undefined;\n};\n"],"mappings":";;;AAUA,MAAa,oBAAoB;CAC/B,WAAW;CACX,WAAW;CACX,WAAW;CACX,YAAY;CACZ,SAAS;AACV;AAsBD,SAAgB,cACdA,KACAC,MACkE;AAClE,KAAI,KAAK,WAAW,WAAY,QAAO,QAAQ,KAAK,KAAK;CAEzD,MAAMC,UACJ,IAAI,mBAAmB,MAAM,MAAM,KAAK,IAAI,QAAQ,QAAQ,CAAC,GAAG,IAAI;AAGtE,KACE,QAAQ,MACN,CAAC,MACC,EAAE,KAAK,YAAY,sBAClB,CAAC,EAAE,KAAK,UAAU,CAAC,EAAE,KAAK,OAAO,QACrC,EACD;EAGA,MAAM,QAAQ,QAAQ,OAAO,CAACC,SAA+B,MAAM;GACjE,MAAM,OAAO,kBAAkB,EAAE,KAAK;AACtC,UAAO,QAAQ,CAACC,QAAM,SAAS,KAAK,GAAG,CAAC,GAAGA,SAAO,IAAK,IAAGA;EAC3D,GAAE,CAAE,EAAC;AAEN,SAAO,EACL,MAAM,MAAM,SAAS,IAAI,QAAQ,MAAM,GACxC;CACF,WACC,QAAQ,MAAM,CAAC,MAAM,EAAE,KAAK,aAAa,gBAAgB,CAAC,EAAE,YAAY,EACxE;EAGA,MAAM,QAAQ,QAAQ,OACpB,CAACC,KAA6BC,MAA+B;GAC3D,MAAM,OAAO,OAAO,EAAE,KAAK;AAC3B,WAAQ,MAAR;IACE,KAAK;IACL,KAAK;IACL,KAAK,UACH,QAAO,CAAC,GAAG,KAAK,IAAK;IACvB,KAAK,SACH,QAAO,CAAC,GAAG,KAAK,SAAmB;IACrC,KAAK;AACH,SAAI,EAAE,KAAK,UAAU,KAAM,QAAO,CAAC,GAAG,KAAK,MAAgB;AAC3D,YAAO;IACT,KAAK;IACL,KAAK;IACL,KAAK;IACL,QACE,QAAO;GACV;EACF,GACD,CAAE,EACH;AAED,MAAI,MAAM,WAAW,QAAQ,QAAQ;GAGnC,MAAM,cAAc,MAAM,OAAO,CAAC,GAAG,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE;AACjE,UAAO;IACL,MAAM,YAAY,SAAS,IAAI,cAAc,YAAY;IACzD,MAAM,QAAQ,OAAO,CAAC,KAAK,MAAM;AAC/B,YAAO,IAAI,SAAS,EAAE,KAAK,MAAM,GAAG,MAAM,CAAC,GAAG,KAAK,EAAE,KAAK,KAAM;IACjE,GAAE,CAAE,EAAkD;GACxD;EACF;CACF,WAAU,QAAQ,MAAM,CAAC,MAAM,EAAE,KAAK,aAAa,UAAU,CAC5D,QAAO;EACL,MAAM;EACN,MAAM,QAAQ,OACZ,CAACC,KAAe,MAAM,CACpB,GAAG,KACH,GAAG,EAAE,KAAK,OAAO,OAAO,CAACC,QAAc,CAAC,IAAI,SAASC,IAAE,CAAC,AACzD,GACD,CAAE,EACH;CACF;AAGH,QAAO,QAAQ,KAAK,KAAK;AAC1B;AAED,MAAM,UAAU,CACdT,KACAC,SACqE;CACrE,MAAM,SACH,IAAI,mBAAmB,MACpB,MAAM,KAAK,IAAI,QAAQ,QAAQ,CAAC,GAChC,IAAI,SAEP,IAAI,CAAC,GAAG,MACP,SAAS,EAAE,MAAM;EACf,GAAG;EACH,aAAa;GAAC,GAAG,KAAK;GAAa;GAAS,GAAG,GAAG;EAAC;CACpD,EAAC,CACH,CACA,OACC,CAAC,MACC,CAAC,CAAC,MACD,CAAC,KAAK,gBACJ,OAAO,MAAM,YAAY,OAAO,KAAK,EAAE,CAAC,SAAS,GACvD;AAEH,QAAO,MAAM,SAAS,EAAE,MAAO,IAAG;AACnC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const require_any = require('./any.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/utils/zod-to-json-schema/parsers/unknown.ts
|
|
4
|
+
function parseUnknownDef(refs) {
|
|
5
|
+
return require_any.parseAnyDef(refs);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
exports.parseUnknownDef = parseUnknownDef;
|
|
10
|
+
//# sourceMappingURL=unknown.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unknown.cjs","names":["refs: Refs","parseAnyDef"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/unknown.ts"],"sourcesContent":["import { Refs } from \"../Refs\";\nimport { JsonSchema7AnyType, parseAnyDef } from \"./any.js\";\n\nexport type JsonSchema7UnknownType = JsonSchema7AnyType;\n\nexport function parseUnknownDef(refs: Refs): JsonSchema7UnknownType {\n return parseAnyDef(refs);\n}\n"],"mappings":";;;AAKA,SAAgB,gBAAgBA,MAAoC;AAClE,QAAOC,wBAAY,KAAK;AACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unknown.d.cts","names":["Refs","JsonSchema7AnyType","JsonSchema7UnknownType","parseUnknownDef"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/unknown.d.ts"],"sourcesContent":["import { Refs } from \"../Refs\";\nimport { JsonSchema7AnyType } from \"./any.js\";\nexport type JsonSchema7UnknownType = JsonSchema7AnyType;\nexport declare function parseUnknownDef(refs: Refs): JsonSchema7UnknownType;\n"],"mappings":";;;KAEYE,sBAAAA,GAAyBD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unknown.d.ts","names":["Refs","JsonSchema7AnyType","JsonSchema7UnknownType","parseUnknownDef"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/unknown.d.ts"],"sourcesContent":["import { Refs } from \"../Refs\";\nimport { JsonSchema7AnyType } from \"./any.js\";\nexport type JsonSchema7UnknownType = JsonSchema7AnyType;\nexport declare function parseUnknownDef(refs: Refs): JsonSchema7UnknownType;\n"],"mappings":";;;KAEYE,sBAAAA,GAAyBD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unknown.js","names":["refs: Refs"],"sources":["../../../../src/utils/zod-to-json-schema/parsers/unknown.ts"],"sourcesContent":["import { Refs } from \"../Refs\";\nimport { JsonSchema7AnyType, parseAnyDef } from \"./any.js\";\n\nexport type JsonSchema7UnknownType = JsonSchema7AnyType;\n\nexport function parseUnknownDef(refs: Refs): JsonSchema7UnknownType {\n return parseAnyDef(refs);\n}\n"],"mappings":";;;AAKA,SAAgB,gBAAgBA,MAAoC;AAClE,QAAO,YAAY,KAAK;AACzB"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_any = require('./parsers/any.cjs');
|
|
3
|
+
const require_array = require('./parsers/array.cjs');
|
|
4
|
+
const require_bigint = require('./parsers/bigint.cjs');
|
|
5
|
+
const require_boolean = require('./parsers/boolean.cjs');
|
|
6
|
+
const require_branded = require('./parsers/branded.cjs');
|
|
7
|
+
const require_catch = require('./parsers/catch.cjs');
|
|
8
|
+
const require_date = require('./parsers/date.cjs');
|
|
9
|
+
const require_default = require('./parsers/default.cjs');
|
|
10
|
+
const require_effects = require('./parsers/effects.cjs');
|
|
11
|
+
const require_enum = require('./parsers/enum.cjs');
|
|
12
|
+
const require_intersection = require('./parsers/intersection.cjs');
|
|
13
|
+
const require_literal = require('./parsers/literal.cjs');
|
|
14
|
+
const require_string = require('./parsers/string.cjs');
|
|
15
|
+
const require_record = require('./parsers/record.cjs');
|
|
16
|
+
const require_map = require('./parsers/map.cjs');
|
|
17
|
+
const require_nativeEnum = require('./parsers/nativeEnum.cjs');
|
|
18
|
+
const require_never = require('./parsers/never.cjs');
|
|
19
|
+
const require_null = require('./parsers/null.cjs');
|
|
20
|
+
const require_union = require('./parsers/union.cjs');
|
|
21
|
+
const require_nullable = require('./parsers/nullable.cjs');
|
|
22
|
+
const require_number = require('./parsers/number.cjs');
|
|
23
|
+
const require_object = require('./parsers/object.cjs');
|
|
24
|
+
const require_optional = require('./parsers/optional.cjs');
|
|
25
|
+
const require_pipeline = require('./parsers/pipeline.cjs');
|
|
26
|
+
const require_promise = require('./parsers/promise.cjs');
|
|
27
|
+
const require_set = require('./parsers/set.cjs');
|
|
28
|
+
const require_tuple = require('./parsers/tuple.cjs');
|
|
29
|
+
const require_undefined = require('./parsers/undefined.cjs');
|
|
30
|
+
const require_unknown = require('./parsers/unknown.cjs');
|
|
31
|
+
const require_readonly = require('./parsers/readonly.cjs');
|
|
32
|
+
const zod_v3 = require_rolldown_runtime.__toESM(require("zod/v3"));
|
|
33
|
+
|
|
34
|
+
//#region src/utils/zod-to-json-schema/selectParser.ts
|
|
35
|
+
const selectParser = (def, typeName, refs) => {
|
|
36
|
+
switch (typeName) {
|
|
37
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodString: return require_string.parseStringDef(def, refs);
|
|
38
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodNumber: return require_number.parseNumberDef(def, refs);
|
|
39
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodObject: return require_object.parseObjectDef(def, refs);
|
|
40
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodBigInt: return require_bigint.parseBigintDef(def, refs);
|
|
41
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodBoolean: return require_boolean.parseBooleanDef();
|
|
42
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodDate: return require_date.parseDateDef(def, refs);
|
|
43
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodUndefined: return require_undefined.parseUndefinedDef(refs);
|
|
44
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodNull: return require_null.parseNullDef(refs);
|
|
45
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodArray: return require_array.parseArrayDef(def, refs);
|
|
46
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodUnion:
|
|
47
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodDiscriminatedUnion: return require_union.parseUnionDef(def, refs);
|
|
48
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodIntersection: return require_intersection.parseIntersectionDef(def, refs);
|
|
49
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodTuple: return require_tuple.parseTupleDef(def, refs);
|
|
50
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodRecord: return require_record.parseRecordDef(def, refs);
|
|
51
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodLiteral: return require_literal.parseLiteralDef(def, refs);
|
|
52
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodEnum: return require_enum.parseEnumDef(def);
|
|
53
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodNativeEnum: return require_nativeEnum.parseNativeEnumDef(def);
|
|
54
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodNullable: return require_nullable.parseNullableDef(def, refs);
|
|
55
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodOptional: return require_optional.parseOptionalDef(def, refs);
|
|
56
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodMap: return require_map.parseMapDef(def, refs);
|
|
57
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodSet: return require_set.parseSetDef(def, refs);
|
|
58
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodLazy: return () => def.getter()._def;
|
|
59
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodPromise: return require_promise.parsePromiseDef(def, refs);
|
|
60
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodNaN:
|
|
61
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodNever: return require_never.parseNeverDef(refs);
|
|
62
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodEffects: return require_effects.parseEffectsDef(def, refs);
|
|
63
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodAny: return require_any.parseAnyDef(refs);
|
|
64
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodUnknown: return require_unknown.parseUnknownDef(refs);
|
|
65
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodDefault: return require_default.parseDefaultDef(def, refs);
|
|
66
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodBranded: return require_branded.parseBrandedDef(def, refs);
|
|
67
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodReadonly: return require_readonly.parseReadonlyDef(def, refs);
|
|
68
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodCatch: return require_catch.parseCatchDef(def, refs);
|
|
69
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodPipeline: return require_pipeline.parsePipelineDef(def, refs);
|
|
70
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodFunction:
|
|
71
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodVoid:
|
|
72
|
+
case zod_v3.ZodFirstPartyTypeKind.ZodSymbol: return void 0;
|
|
73
|
+
default:
|
|
74
|
+
/* c8 ignore next */
|
|
75
|
+
return ((_) => void 0)(typeName);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
//#endregion
|
|
80
|
+
exports.selectParser = selectParser;
|
|
81
|
+
//# sourceMappingURL=selectParser.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectParser.cjs","names":["def: any","typeName: ZodFirstPartyTypeKind","refs: Refs","ZodFirstPartyTypeKind","parseStringDef","parseNumberDef","parseObjectDef","parseBigintDef","parseBooleanDef","parseDateDef","parseUndefinedDef","parseNullDef","parseArrayDef","parseUnionDef","parseIntersectionDef","parseTupleDef","parseRecordDef","parseLiteralDef","parseEnumDef","parseNativeEnumDef","parseNullableDef","parseOptionalDef","parseMapDef","parseSetDef","parsePromiseDef","parseNeverDef","parseEffectsDef","parseAnyDef","parseUnknownDef","parseDefaultDef","parseBrandedDef","parseReadonlyDef","parseCatchDef","parsePipelineDef","_: never"],"sources":["../../../src/utils/zod-to-json-schema/selectParser.ts"],"sourcesContent":["import { ZodFirstPartyTypeKind } from \"zod/v3\";\nimport { parseAnyDef } from \"./parsers/any.js\";\nimport { parseArrayDef } from \"./parsers/array.js\";\nimport { parseBigintDef } from \"./parsers/bigint.js\";\nimport { parseBooleanDef } from \"./parsers/boolean.js\";\nimport { parseBrandedDef } from \"./parsers/branded.js\";\nimport { parseCatchDef } from \"./parsers/catch.js\";\nimport { parseDateDef } from \"./parsers/date.js\";\nimport { parseDefaultDef } from \"./parsers/default.js\";\nimport { parseEffectsDef } from \"./parsers/effects.js\";\nimport { parseEnumDef } from \"./parsers/enum.js\";\nimport { parseIntersectionDef } from \"./parsers/intersection.js\";\nimport { parseLiteralDef } from \"./parsers/literal.js\";\nimport { parseMapDef } from \"./parsers/map.js\";\nimport { parseNativeEnumDef } from \"./parsers/nativeEnum.js\";\nimport { parseNeverDef } from \"./parsers/never.js\";\nimport { parseNullDef } from \"./parsers/null.js\";\nimport { parseNullableDef } from \"./parsers/nullable.js\";\nimport { parseNumberDef } from \"./parsers/number.js\";\nimport { parseObjectDef } from \"./parsers/object.js\";\nimport { parseOptionalDef } from \"./parsers/optional.js\";\nimport { parsePipelineDef } from \"./parsers/pipeline.js\";\nimport { parsePromiseDef } from \"./parsers/promise.js\";\nimport { parseRecordDef } from \"./parsers/record.js\";\nimport { parseSetDef } from \"./parsers/set.js\";\nimport { parseStringDef } from \"./parsers/string.js\";\nimport { parseTupleDef } from \"./parsers/tuple.js\";\nimport { parseUndefinedDef } from \"./parsers/undefined.js\";\nimport { parseUnionDef } from \"./parsers/union.js\";\nimport { parseUnknownDef } from \"./parsers/unknown.js\";\nimport { Refs } from \"./Refs.js\";\nimport { parseReadonlyDef } from \"./parsers/readonly.js\";\nimport { JsonSchema7Type } from \"./parseTypes.js\";\n\nexport type InnerDefGetter = () => any;\n\nexport const selectParser = (\n def: any,\n typeName: ZodFirstPartyTypeKind,\n refs: Refs\n): JsonSchema7Type | undefined | InnerDefGetter => {\n switch (typeName) {\n case ZodFirstPartyTypeKind.ZodString:\n return parseStringDef(def, refs);\n case ZodFirstPartyTypeKind.ZodNumber:\n return parseNumberDef(def, refs);\n case ZodFirstPartyTypeKind.ZodObject:\n return parseObjectDef(def, refs);\n case ZodFirstPartyTypeKind.ZodBigInt:\n return parseBigintDef(def, refs);\n case ZodFirstPartyTypeKind.ZodBoolean:\n return parseBooleanDef();\n case ZodFirstPartyTypeKind.ZodDate:\n return parseDateDef(def, refs);\n case ZodFirstPartyTypeKind.ZodUndefined:\n return parseUndefinedDef(refs);\n case ZodFirstPartyTypeKind.ZodNull:\n return parseNullDef(refs);\n case ZodFirstPartyTypeKind.ZodArray:\n return parseArrayDef(def, refs);\n case ZodFirstPartyTypeKind.ZodUnion:\n case ZodFirstPartyTypeKind.ZodDiscriminatedUnion:\n return parseUnionDef(def, refs);\n case ZodFirstPartyTypeKind.ZodIntersection:\n return parseIntersectionDef(def, refs);\n case ZodFirstPartyTypeKind.ZodTuple:\n return parseTupleDef(def, refs);\n case ZodFirstPartyTypeKind.ZodRecord:\n return parseRecordDef(def, refs);\n case ZodFirstPartyTypeKind.ZodLiteral:\n return parseLiteralDef(def, refs);\n case ZodFirstPartyTypeKind.ZodEnum:\n return parseEnumDef(def);\n case ZodFirstPartyTypeKind.ZodNativeEnum:\n return parseNativeEnumDef(def);\n case ZodFirstPartyTypeKind.ZodNullable:\n return parseNullableDef(def, refs);\n case ZodFirstPartyTypeKind.ZodOptional:\n return parseOptionalDef(def, refs);\n case ZodFirstPartyTypeKind.ZodMap:\n return parseMapDef(def, refs);\n case ZodFirstPartyTypeKind.ZodSet:\n return parseSetDef(def, refs);\n case ZodFirstPartyTypeKind.ZodLazy:\n return () => (def as any).getter()._def;\n case ZodFirstPartyTypeKind.ZodPromise:\n return parsePromiseDef(def, refs);\n case ZodFirstPartyTypeKind.ZodNaN:\n case ZodFirstPartyTypeKind.ZodNever:\n return parseNeverDef(refs);\n case ZodFirstPartyTypeKind.ZodEffects:\n return parseEffectsDef(def, refs);\n case ZodFirstPartyTypeKind.ZodAny:\n return parseAnyDef(refs);\n case ZodFirstPartyTypeKind.ZodUnknown:\n return parseUnknownDef(refs);\n case ZodFirstPartyTypeKind.ZodDefault:\n return parseDefaultDef(def, refs);\n case ZodFirstPartyTypeKind.ZodBranded:\n return parseBrandedDef(def, refs);\n case ZodFirstPartyTypeKind.ZodReadonly:\n return parseReadonlyDef(def, refs);\n case ZodFirstPartyTypeKind.ZodCatch:\n return parseCatchDef(def, refs);\n case ZodFirstPartyTypeKind.ZodPipeline:\n return parsePipelineDef(def, refs);\n case ZodFirstPartyTypeKind.ZodFunction:\n case ZodFirstPartyTypeKind.ZodVoid:\n case ZodFirstPartyTypeKind.ZodSymbol:\n return undefined;\n default:\n /* c8 ignore next */\n return ((_: never) => undefined)(typeName);\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAa,eAAe,CAC1BA,KACAC,UACAC,SACiD;AACjD,SAAQ,UAAR;EACE,KAAKC,6BAAsB,UACzB,QAAOC,8BAAe,KAAK,KAAK;EAClC,KAAKD,6BAAsB,UACzB,QAAOE,8BAAe,KAAK,KAAK;EAClC,KAAKF,6BAAsB,UACzB,QAAOG,8BAAe,KAAK,KAAK;EAClC,KAAKH,6BAAsB,UACzB,QAAOI,8BAAe,KAAK,KAAK;EAClC,KAAKJ,6BAAsB,WACzB,QAAOK,iCAAiB;EAC1B,KAAKL,6BAAsB,QACzB,QAAOM,0BAAa,KAAK,KAAK;EAChC,KAAKN,6BAAsB,aACzB,QAAOO,oCAAkB,KAAK;EAChC,KAAKP,6BAAsB,QACzB,QAAOQ,0BAAa,KAAK;EAC3B,KAAKR,6BAAsB,SACzB,QAAOS,4BAAc,KAAK,KAAK;EACjC,KAAKT,6BAAsB;EAC3B,KAAKA,6BAAsB,sBACzB,QAAOU,4BAAc,KAAK,KAAK;EACjC,KAAKV,6BAAsB,gBACzB,QAAOW,0CAAqB,KAAK,KAAK;EACxC,KAAKX,6BAAsB,SACzB,QAAOY,4BAAc,KAAK,KAAK;EACjC,KAAKZ,6BAAsB,UACzB,QAAOa,8BAAe,KAAK,KAAK;EAClC,KAAKb,6BAAsB,WACzB,QAAOc,gCAAgB,KAAK,KAAK;EACnC,KAAKd,6BAAsB,QACzB,QAAOe,0BAAa,IAAI;EAC1B,KAAKf,6BAAsB,cACzB,QAAOgB,sCAAmB,IAAI;EAChC,KAAKhB,6BAAsB,YACzB,QAAOiB,kCAAiB,KAAK,KAAK;EACpC,KAAKjB,6BAAsB,YACzB,QAAOkB,kCAAiB,KAAK,KAAK;EACpC,KAAKlB,6BAAsB,OACzB,QAAOmB,wBAAY,KAAK,KAAK;EAC/B,KAAKnB,6BAAsB,OACzB,QAAOoB,wBAAY,KAAK,KAAK;EAC/B,KAAKpB,6BAAsB,QACzB,QAAO,MAAO,IAAY,QAAQ,CAAC;EACrC,KAAKA,6BAAsB,WACzB,QAAOqB,gCAAgB,KAAK,KAAK;EACnC,KAAKrB,6BAAsB;EAC3B,KAAKA,6BAAsB,SACzB,QAAOsB,4BAAc,KAAK;EAC5B,KAAKtB,6BAAsB,WACzB,QAAOuB,gCAAgB,KAAK,KAAK;EACnC,KAAKvB,6BAAsB,OACzB,QAAOwB,wBAAY,KAAK;EAC1B,KAAKxB,6BAAsB,WACzB,QAAOyB,gCAAgB,KAAK;EAC9B,KAAKzB,6BAAsB,WACzB,QAAO0B,gCAAgB,KAAK,KAAK;EACnC,KAAK1B,6BAAsB,WACzB,QAAO2B,gCAAgB,KAAK,KAAK;EACnC,KAAK3B,6BAAsB,YACzB,QAAO4B,kCAAiB,KAAK,KAAK;EACpC,KAAK5B,6BAAsB,SACzB,QAAO6B,4BAAc,KAAK,KAAK;EACjC,KAAK7B,6BAAsB,YACzB,QAAO8B,kCAAiB,KAAK,KAAK;EACpC,KAAK9B,6BAAsB;EAC3B,KAAKA,6BAAsB;EAC3B,KAAKA,6BAAsB,UACzB,QAAO;EACT;;AAEE,UAAQ,CAAC+B,MAAa,QAAW,SAAS;CAC7C;AACF"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { parseAnyDef } from "./parsers/any.js";
|
|
2
|
+
import { parseArrayDef } from "./parsers/array.js";
|
|
3
|
+
import { parseBigintDef } from "./parsers/bigint.js";
|
|
4
|
+
import { parseBooleanDef } from "./parsers/boolean.js";
|
|
5
|
+
import { parseBrandedDef } from "./parsers/branded.js";
|
|
6
|
+
import { parseCatchDef } from "./parsers/catch.js";
|
|
7
|
+
import { parseDateDef } from "./parsers/date.js";
|
|
8
|
+
import { parseDefaultDef } from "./parsers/default.js";
|
|
9
|
+
import { parseEffectsDef } from "./parsers/effects.js";
|
|
10
|
+
import { parseEnumDef } from "./parsers/enum.js";
|
|
11
|
+
import { parseIntersectionDef } from "./parsers/intersection.js";
|
|
12
|
+
import { parseLiteralDef } from "./parsers/literal.js";
|
|
13
|
+
import { parseStringDef } from "./parsers/string.js";
|
|
14
|
+
import { parseRecordDef } from "./parsers/record.js";
|
|
15
|
+
import { parseMapDef } from "./parsers/map.js";
|
|
16
|
+
import { parseNativeEnumDef } from "./parsers/nativeEnum.js";
|
|
17
|
+
import { parseNeverDef } from "./parsers/never.js";
|
|
18
|
+
import { parseNullDef } from "./parsers/null.js";
|
|
19
|
+
import { parseUnionDef } from "./parsers/union.js";
|
|
20
|
+
import { parseNullableDef } from "./parsers/nullable.js";
|
|
21
|
+
import { parseNumberDef } from "./parsers/number.js";
|
|
22
|
+
import { parseObjectDef } from "./parsers/object.js";
|
|
23
|
+
import { parseOptionalDef } from "./parsers/optional.js";
|
|
24
|
+
import { parsePipelineDef } from "./parsers/pipeline.js";
|
|
25
|
+
import { parsePromiseDef } from "./parsers/promise.js";
|
|
26
|
+
import { parseSetDef } from "./parsers/set.js";
|
|
27
|
+
import { parseTupleDef } from "./parsers/tuple.js";
|
|
28
|
+
import { parseUndefinedDef } from "./parsers/undefined.js";
|
|
29
|
+
import { parseUnknownDef } from "./parsers/unknown.js";
|
|
30
|
+
import { parseReadonlyDef } from "./parsers/readonly.js";
|
|
31
|
+
import { ZodFirstPartyTypeKind } from "zod/v3";
|
|
32
|
+
|
|
33
|
+
//#region src/utils/zod-to-json-schema/selectParser.ts
|
|
34
|
+
const selectParser = (def, typeName, refs) => {
|
|
35
|
+
switch (typeName) {
|
|
36
|
+
case ZodFirstPartyTypeKind.ZodString: return parseStringDef(def, refs);
|
|
37
|
+
case ZodFirstPartyTypeKind.ZodNumber: return parseNumberDef(def, refs);
|
|
38
|
+
case ZodFirstPartyTypeKind.ZodObject: return parseObjectDef(def, refs);
|
|
39
|
+
case ZodFirstPartyTypeKind.ZodBigInt: return parseBigintDef(def, refs);
|
|
40
|
+
case ZodFirstPartyTypeKind.ZodBoolean: return parseBooleanDef();
|
|
41
|
+
case ZodFirstPartyTypeKind.ZodDate: return parseDateDef(def, refs);
|
|
42
|
+
case ZodFirstPartyTypeKind.ZodUndefined: return parseUndefinedDef(refs);
|
|
43
|
+
case ZodFirstPartyTypeKind.ZodNull: return parseNullDef(refs);
|
|
44
|
+
case ZodFirstPartyTypeKind.ZodArray: return parseArrayDef(def, refs);
|
|
45
|
+
case ZodFirstPartyTypeKind.ZodUnion:
|
|
46
|
+
case ZodFirstPartyTypeKind.ZodDiscriminatedUnion: return parseUnionDef(def, refs);
|
|
47
|
+
case ZodFirstPartyTypeKind.ZodIntersection: return parseIntersectionDef(def, refs);
|
|
48
|
+
case ZodFirstPartyTypeKind.ZodTuple: return parseTupleDef(def, refs);
|
|
49
|
+
case ZodFirstPartyTypeKind.ZodRecord: return parseRecordDef(def, refs);
|
|
50
|
+
case ZodFirstPartyTypeKind.ZodLiteral: return parseLiteralDef(def, refs);
|
|
51
|
+
case ZodFirstPartyTypeKind.ZodEnum: return parseEnumDef(def);
|
|
52
|
+
case ZodFirstPartyTypeKind.ZodNativeEnum: return parseNativeEnumDef(def);
|
|
53
|
+
case ZodFirstPartyTypeKind.ZodNullable: return parseNullableDef(def, refs);
|
|
54
|
+
case ZodFirstPartyTypeKind.ZodOptional: return parseOptionalDef(def, refs);
|
|
55
|
+
case ZodFirstPartyTypeKind.ZodMap: return parseMapDef(def, refs);
|
|
56
|
+
case ZodFirstPartyTypeKind.ZodSet: return parseSetDef(def, refs);
|
|
57
|
+
case ZodFirstPartyTypeKind.ZodLazy: return () => def.getter()._def;
|
|
58
|
+
case ZodFirstPartyTypeKind.ZodPromise: return parsePromiseDef(def, refs);
|
|
59
|
+
case ZodFirstPartyTypeKind.ZodNaN:
|
|
60
|
+
case ZodFirstPartyTypeKind.ZodNever: return parseNeverDef(refs);
|
|
61
|
+
case ZodFirstPartyTypeKind.ZodEffects: return parseEffectsDef(def, refs);
|
|
62
|
+
case ZodFirstPartyTypeKind.ZodAny: return parseAnyDef(refs);
|
|
63
|
+
case ZodFirstPartyTypeKind.ZodUnknown: return parseUnknownDef(refs);
|
|
64
|
+
case ZodFirstPartyTypeKind.ZodDefault: return parseDefaultDef(def, refs);
|
|
65
|
+
case ZodFirstPartyTypeKind.ZodBranded: return parseBrandedDef(def, refs);
|
|
66
|
+
case ZodFirstPartyTypeKind.ZodReadonly: return parseReadonlyDef(def, refs);
|
|
67
|
+
case ZodFirstPartyTypeKind.ZodCatch: return parseCatchDef(def, refs);
|
|
68
|
+
case ZodFirstPartyTypeKind.ZodPipeline: return parsePipelineDef(def, refs);
|
|
69
|
+
case ZodFirstPartyTypeKind.ZodFunction:
|
|
70
|
+
case ZodFirstPartyTypeKind.ZodVoid:
|
|
71
|
+
case ZodFirstPartyTypeKind.ZodSymbol: return void 0;
|
|
72
|
+
default:
|
|
73
|
+
/* c8 ignore next */
|
|
74
|
+
return ((_) => void 0)(typeName);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
//#endregion
|
|
79
|
+
export { selectParser };
|
|
80
|
+
//# sourceMappingURL=selectParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectParser.js","names":["def: any","typeName: ZodFirstPartyTypeKind","refs: Refs","_: never"],"sources":["../../../src/utils/zod-to-json-schema/selectParser.ts"],"sourcesContent":["import { ZodFirstPartyTypeKind } from \"zod/v3\";\nimport { parseAnyDef } from \"./parsers/any.js\";\nimport { parseArrayDef } from \"./parsers/array.js\";\nimport { parseBigintDef } from \"./parsers/bigint.js\";\nimport { parseBooleanDef } from \"./parsers/boolean.js\";\nimport { parseBrandedDef } from \"./parsers/branded.js\";\nimport { parseCatchDef } from \"./parsers/catch.js\";\nimport { parseDateDef } from \"./parsers/date.js\";\nimport { parseDefaultDef } from \"./parsers/default.js\";\nimport { parseEffectsDef } from \"./parsers/effects.js\";\nimport { parseEnumDef } from \"./parsers/enum.js\";\nimport { parseIntersectionDef } from \"./parsers/intersection.js\";\nimport { parseLiteralDef } from \"./parsers/literal.js\";\nimport { parseMapDef } from \"./parsers/map.js\";\nimport { parseNativeEnumDef } from \"./parsers/nativeEnum.js\";\nimport { parseNeverDef } from \"./parsers/never.js\";\nimport { parseNullDef } from \"./parsers/null.js\";\nimport { parseNullableDef } from \"./parsers/nullable.js\";\nimport { parseNumberDef } from \"./parsers/number.js\";\nimport { parseObjectDef } from \"./parsers/object.js\";\nimport { parseOptionalDef } from \"./parsers/optional.js\";\nimport { parsePipelineDef } from \"./parsers/pipeline.js\";\nimport { parsePromiseDef } from \"./parsers/promise.js\";\nimport { parseRecordDef } from \"./parsers/record.js\";\nimport { parseSetDef } from \"./parsers/set.js\";\nimport { parseStringDef } from \"./parsers/string.js\";\nimport { parseTupleDef } from \"./parsers/tuple.js\";\nimport { parseUndefinedDef } from \"./parsers/undefined.js\";\nimport { parseUnionDef } from \"./parsers/union.js\";\nimport { parseUnknownDef } from \"./parsers/unknown.js\";\nimport { Refs } from \"./Refs.js\";\nimport { parseReadonlyDef } from \"./parsers/readonly.js\";\nimport { JsonSchema7Type } from \"./parseTypes.js\";\n\nexport type InnerDefGetter = () => any;\n\nexport const selectParser = (\n def: any,\n typeName: ZodFirstPartyTypeKind,\n refs: Refs\n): JsonSchema7Type | undefined | InnerDefGetter => {\n switch (typeName) {\n case ZodFirstPartyTypeKind.ZodString:\n return parseStringDef(def, refs);\n case ZodFirstPartyTypeKind.ZodNumber:\n return parseNumberDef(def, refs);\n case ZodFirstPartyTypeKind.ZodObject:\n return parseObjectDef(def, refs);\n case ZodFirstPartyTypeKind.ZodBigInt:\n return parseBigintDef(def, refs);\n case ZodFirstPartyTypeKind.ZodBoolean:\n return parseBooleanDef();\n case ZodFirstPartyTypeKind.ZodDate:\n return parseDateDef(def, refs);\n case ZodFirstPartyTypeKind.ZodUndefined:\n return parseUndefinedDef(refs);\n case ZodFirstPartyTypeKind.ZodNull:\n return parseNullDef(refs);\n case ZodFirstPartyTypeKind.ZodArray:\n return parseArrayDef(def, refs);\n case ZodFirstPartyTypeKind.ZodUnion:\n case ZodFirstPartyTypeKind.ZodDiscriminatedUnion:\n return parseUnionDef(def, refs);\n case ZodFirstPartyTypeKind.ZodIntersection:\n return parseIntersectionDef(def, refs);\n case ZodFirstPartyTypeKind.ZodTuple:\n return parseTupleDef(def, refs);\n case ZodFirstPartyTypeKind.ZodRecord:\n return parseRecordDef(def, refs);\n case ZodFirstPartyTypeKind.ZodLiteral:\n return parseLiteralDef(def, refs);\n case ZodFirstPartyTypeKind.ZodEnum:\n return parseEnumDef(def);\n case ZodFirstPartyTypeKind.ZodNativeEnum:\n return parseNativeEnumDef(def);\n case ZodFirstPartyTypeKind.ZodNullable:\n return parseNullableDef(def, refs);\n case ZodFirstPartyTypeKind.ZodOptional:\n return parseOptionalDef(def, refs);\n case ZodFirstPartyTypeKind.ZodMap:\n return parseMapDef(def, refs);\n case ZodFirstPartyTypeKind.ZodSet:\n return parseSetDef(def, refs);\n case ZodFirstPartyTypeKind.ZodLazy:\n return () => (def as any).getter()._def;\n case ZodFirstPartyTypeKind.ZodPromise:\n return parsePromiseDef(def, refs);\n case ZodFirstPartyTypeKind.ZodNaN:\n case ZodFirstPartyTypeKind.ZodNever:\n return parseNeverDef(refs);\n case ZodFirstPartyTypeKind.ZodEffects:\n return parseEffectsDef(def, refs);\n case ZodFirstPartyTypeKind.ZodAny:\n return parseAnyDef(refs);\n case ZodFirstPartyTypeKind.ZodUnknown:\n return parseUnknownDef(refs);\n case ZodFirstPartyTypeKind.ZodDefault:\n return parseDefaultDef(def, refs);\n case ZodFirstPartyTypeKind.ZodBranded:\n return parseBrandedDef(def, refs);\n case ZodFirstPartyTypeKind.ZodReadonly:\n return parseReadonlyDef(def, refs);\n case ZodFirstPartyTypeKind.ZodCatch:\n return parseCatchDef(def, refs);\n case ZodFirstPartyTypeKind.ZodPipeline:\n return parsePipelineDef(def, refs);\n case ZodFirstPartyTypeKind.ZodFunction:\n case ZodFirstPartyTypeKind.ZodVoid:\n case ZodFirstPartyTypeKind.ZodSymbol:\n return undefined;\n default:\n /* c8 ignore next */\n return ((_: never) => undefined)(typeName);\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAa,eAAe,CAC1BA,KACAC,UACAC,SACiD;AACjD,SAAQ,UAAR;EACE,KAAK,sBAAsB,UACzB,QAAO,eAAe,KAAK,KAAK;EAClC,KAAK,sBAAsB,UACzB,QAAO,eAAe,KAAK,KAAK;EAClC,KAAK,sBAAsB,UACzB,QAAO,eAAe,KAAK,KAAK;EAClC,KAAK,sBAAsB,UACzB,QAAO,eAAe,KAAK,KAAK;EAClC,KAAK,sBAAsB,WACzB,QAAO,iBAAiB;EAC1B,KAAK,sBAAsB,QACzB,QAAO,aAAa,KAAK,KAAK;EAChC,KAAK,sBAAsB,aACzB,QAAO,kBAAkB,KAAK;EAChC,KAAK,sBAAsB,QACzB,QAAO,aAAa,KAAK;EAC3B,KAAK,sBAAsB,SACzB,QAAO,cAAc,KAAK,KAAK;EACjC,KAAK,sBAAsB;EAC3B,KAAK,sBAAsB,sBACzB,QAAO,cAAc,KAAK,KAAK;EACjC,KAAK,sBAAsB,gBACzB,QAAO,qBAAqB,KAAK,KAAK;EACxC,KAAK,sBAAsB,SACzB,QAAO,cAAc,KAAK,KAAK;EACjC,KAAK,sBAAsB,UACzB,QAAO,eAAe,KAAK,KAAK;EAClC,KAAK,sBAAsB,WACzB,QAAO,gBAAgB,KAAK,KAAK;EACnC,KAAK,sBAAsB,QACzB,QAAO,aAAa,IAAI;EAC1B,KAAK,sBAAsB,cACzB,QAAO,mBAAmB,IAAI;EAChC,KAAK,sBAAsB,YACzB,QAAO,iBAAiB,KAAK,KAAK;EACpC,KAAK,sBAAsB,YACzB,QAAO,iBAAiB,KAAK,KAAK;EACpC,KAAK,sBAAsB,OACzB,QAAO,YAAY,KAAK,KAAK;EAC/B,KAAK,sBAAsB,OACzB,QAAO,YAAY,KAAK,KAAK;EAC/B,KAAK,sBAAsB,QACzB,QAAO,MAAO,IAAY,QAAQ,CAAC;EACrC,KAAK,sBAAsB,WACzB,QAAO,gBAAgB,KAAK,KAAK;EACnC,KAAK,sBAAsB;EAC3B,KAAK,sBAAsB,SACzB,QAAO,cAAc,KAAK;EAC5B,KAAK,sBAAsB,WACzB,QAAO,gBAAgB,KAAK,KAAK;EACnC,KAAK,sBAAsB,OACzB,QAAO,YAAY,KAAK;EAC1B,KAAK,sBAAsB,WACzB,QAAO,gBAAgB,KAAK;EAC9B,KAAK,sBAAsB,WACzB,QAAO,gBAAgB,KAAK,KAAK;EACnC,KAAK,sBAAsB,WACzB,QAAO,gBAAgB,KAAK,KAAK;EACnC,KAAK,sBAAsB,YACzB,QAAO,iBAAiB,KAAK,KAAK;EACpC,KAAK,sBAAsB,SACzB,QAAO,cAAc,KAAK,KAAK;EACjC,KAAK,sBAAsB,YACzB,QAAO,iBAAiB,KAAK,KAAK;EACpC,KAAK,sBAAsB;EAC3B,KAAK,sBAAsB;EAC3B,KAAK,sBAAsB,UACzB,QAAO;EACT;;AAEE,UAAQ,CAACC,MAAa,QAAW,SAAS;CAC7C;AACF"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const require_Refs = require('./Refs.cjs');
|
|
2
|
+
const require_any = require('./parsers/any.cjs');
|
|
3
|
+
const require_parseDef = require('./parseDef.cjs');
|
|
4
|
+
|
|
5
|
+
//#region src/utils/zod-to-json-schema/zodToJsonSchema.ts
|
|
6
|
+
const zodToJsonSchema = (schema, options) => {
|
|
7
|
+
const refs = require_Refs.getRefs(options);
|
|
8
|
+
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name$1, schema$1]) => ({
|
|
9
|
+
...acc,
|
|
10
|
+
[name$1]: require_parseDef.parseDef(schema$1._def, {
|
|
11
|
+
...refs,
|
|
12
|
+
currentPath: [
|
|
13
|
+
...refs.basePath,
|
|
14
|
+
refs.definitionPath,
|
|
15
|
+
name$1
|
|
16
|
+
]
|
|
17
|
+
}, true) ?? require_any.parseAnyDef(refs)
|
|
18
|
+
}), {}) : void 0;
|
|
19
|
+
const name = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
|
|
20
|
+
const main = require_parseDef.parseDef(schema._def, name === void 0 ? refs : {
|
|
21
|
+
...refs,
|
|
22
|
+
currentPath: [
|
|
23
|
+
...refs.basePath,
|
|
24
|
+
refs.definitionPath,
|
|
25
|
+
name
|
|
26
|
+
]
|
|
27
|
+
}, false) ?? require_any.parseAnyDef(refs);
|
|
28
|
+
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
29
|
+
if (title !== void 0) main.title = title;
|
|
30
|
+
if (refs.flags.hasReferencedOpenAiAnyType) {
|
|
31
|
+
if (!definitions) definitions = {};
|
|
32
|
+
if (!definitions[refs.openAiAnyTypeName]) definitions[refs.openAiAnyTypeName] = {
|
|
33
|
+
type: [
|
|
34
|
+
"string",
|
|
35
|
+
"number",
|
|
36
|
+
"integer",
|
|
37
|
+
"boolean",
|
|
38
|
+
"array",
|
|
39
|
+
"null"
|
|
40
|
+
],
|
|
41
|
+
items: { $ref: refs.$refStrategy === "relative" ? "1" : [
|
|
42
|
+
...refs.basePath,
|
|
43
|
+
refs.definitionPath,
|
|
44
|
+
refs.openAiAnyTypeName
|
|
45
|
+
].join("/") }
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const combined = name === void 0 ? definitions ? {
|
|
49
|
+
...main,
|
|
50
|
+
[refs.definitionPath]: definitions
|
|
51
|
+
} : main : {
|
|
52
|
+
$ref: [
|
|
53
|
+
...refs.$refStrategy === "relative" ? [] : refs.basePath,
|
|
54
|
+
refs.definitionPath,
|
|
55
|
+
name
|
|
56
|
+
].join("/"),
|
|
57
|
+
[refs.definitionPath]: {
|
|
58
|
+
...definitions,
|
|
59
|
+
[name]: main
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
if (refs.target === "jsonSchema7") combined.$schema = "http://json-schema.org/draft-07/schema#";
|
|
63
|
+
else if (refs.target === "jsonSchema2019-09" || refs.target === "openAi") combined.$schema = "https://json-schema.org/draft/2019-09/schema#";
|
|
64
|
+
if (refs.target === "openAi" && ("anyOf" in combined || "oneOf" in combined || "allOf" in combined || "type" in combined && Array.isArray(combined.type))) console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");
|
|
65
|
+
return combined;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
exports.zodToJsonSchema = zodToJsonSchema;
|
|
70
|
+
//# sourceMappingURL=zodToJsonSchema.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zodToJsonSchema.cjs","names":["schema: ZodSchema<any>","options?: Partial<Options<Target>> | string","getRefs","acc: { [key: string]: JsonSchema7Type }","name","schema","parseDef","parseAnyDef","combined: ReturnType<typeof zodToJsonSchema<Target>>"],"sources":["../../../src/utils/zod-to-json-schema/zodToJsonSchema.ts"],"sourcesContent":["import { ZodSchema } from \"zod/v3\";\nimport { Options, Targets } from \"./Options.js\";\nimport { parseDef } from \"./parseDef.js\";\nimport { JsonSchema7Type } from \"./parseTypes.js\";\nimport { getRefs } from \"./Refs.js\";\nimport { parseAnyDef } from \"./parsers/any.js\";\n\nconst zodToJsonSchema = <Target extends Targets = \"jsonSchema7\">(\n schema: ZodSchema<any>,\n options?: Partial<Options<Target>> | string\n): (Target extends \"jsonSchema7\" ? JsonSchema7Type : object) & {\n $schema?: string;\n definitions?: {\n [key: string]: Target extends \"jsonSchema7\"\n ? JsonSchema7Type\n : Target extends \"jsonSchema2019-09\"\n ? JsonSchema7Type\n : object;\n };\n} => {\n const refs = getRefs(options);\n\n let definitions =\n typeof options === \"object\" && options.definitions\n ? Object.entries(options.definitions).reduce(\n (acc: { [key: string]: JsonSchema7Type }, [name, schema]) => ({\n ...acc,\n [name]:\n parseDef(\n schema._def,\n {\n ...refs,\n currentPath: [...refs.basePath, refs.definitionPath, name],\n },\n true\n ) ?? parseAnyDef(refs),\n }),\n {}\n )\n : undefined;\n\n const name =\n typeof options === \"string\"\n ? options\n : options?.nameStrategy === \"title\"\n ? undefined\n : options?.name;\n\n const main =\n parseDef(\n schema._def,\n name === undefined\n ? refs\n : {\n ...refs,\n currentPath: [...refs.basePath, refs.definitionPath, name],\n },\n false\n ) ?? (parseAnyDef(refs) as JsonSchema7Type);\n\n const title =\n typeof options === \"object\" &&\n options.name !== undefined &&\n options.nameStrategy === \"title\"\n ? options.name\n : undefined;\n\n if (title !== undefined) {\n main.title = title;\n }\n\n if (refs.flags.hasReferencedOpenAiAnyType) {\n if (!definitions) {\n definitions = {};\n }\n\n if (!definitions[refs.openAiAnyTypeName]) {\n definitions[refs.openAiAnyTypeName] = {\n // Skipping \"object\" as no properties can be defined and additionalProperties must be \"false\"\n type: [\"string\", \"number\", \"integer\", \"boolean\", \"array\", \"null\"],\n items: {\n $ref:\n refs.$refStrategy === \"relative\"\n ? \"1\"\n : [\n ...refs.basePath,\n refs.definitionPath,\n refs.openAiAnyTypeName,\n ].join(\"/\"),\n },\n } as JsonSchema7Type;\n }\n }\n\n const combined: ReturnType<typeof zodToJsonSchema<Target>> =\n name === undefined\n ? definitions\n ? {\n ...main,\n [refs.definitionPath]: definitions,\n }\n : main\n : {\n $ref: [\n ...(refs.$refStrategy === \"relative\" ? [] : refs.basePath),\n refs.definitionPath,\n name,\n ].join(\"/\"),\n [refs.definitionPath]: {\n ...definitions,\n [name]: main,\n },\n };\n\n if (refs.target === \"jsonSchema7\") {\n combined.$schema = \"http://json-schema.org/draft-07/schema#\";\n } else if (refs.target === \"jsonSchema2019-09\" || refs.target === \"openAi\") {\n combined.$schema = \"https://json-schema.org/draft/2019-09/schema#\";\n }\n\n if (\n refs.target === \"openAi\" &&\n (\"anyOf\" in combined ||\n \"oneOf\" in combined ||\n \"allOf\" in combined ||\n (\"type\" in combined && Array.isArray(combined.type)))\n ) {\n console.warn(\n \"Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.\"\n );\n }\n\n return combined;\n};\n\nexport { zodToJsonSchema };\n"],"mappings":";;;;;AAOA,MAAM,kBAAkB,CACtBA,QACAC,YAUG;CACH,MAAM,OAAOC,qBAAQ,QAAQ;CAE7B,IAAI,cACF,OAAO,YAAY,YAAY,QAAQ,cACnC,OAAO,QAAQ,QAAQ,YAAY,CAAC,OAClC,CAACC,KAAyC,CAACC,QAAMC,SAAO,MAAM;EAC5D,GAAG;GACFD,SACCE,0BACED,SAAO,MACP;GACE,GAAG;GACH,aAAa;IAAC,GAAG,KAAK;IAAU,KAAK;IAAgBD;GAAK;EAC3D,GACD,KACD,IAAIG,wBAAY,KAAK;CACzB,IACD,CAAE,EACH,GACD;CAEN,MAAM,OACJ,OAAO,YAAY,WACf,UACA,SAAS,iBAAiB,UAC1B,SACA,SAAS;CAEf,MAAM,OACJD,0BACE,OAAO,MACP,SAAS,SACL,OACA;EACE,GAAG;EACH,aAAa;GAAC,GAAG,KAAK;GAAU,KAAK;GAAgB;EAAK;CAC3D,GACL,MACD,IAAKC,wBAAY,KAAK;CAEzB,MAAM,QACJ,OAAO,YAAY,YACnB,QAAQ,SAAS,UACjB,QAAQ,iBAAiB,UACrB,QAAQ,OACR;AAEN,KAAI,UAAU,QACZ,KAAK,QAAQ;AAGf,KAAI,KAAK,MAAM,4BAA4B;AACzC,MAAI,CAAC,aACH,cAAc,CAAE;AAGlB,MAAI,CAAC,YAAY,KAAK,oBACpB,YAAY,KAAK,qBAAqB;GAEpC,MAAM;IAAC;IAAU;IAAU;IAAW;IAAW;IAAS;GAAO;GACjE,OAAO,EACL,MACE,KAAK,iBAAiB,aAClB,MACA;IACE,GAAG,KAAK;IACR,KAAK;IACL,KAAK;GACN,EAAC,KAAK,IAAI,CAClB;EACF;CAEJ;CAED,MAAMC,WACJ,SAAS,SACL,cACE;EACE,GAAG;GACF,KAAK,iBAAiB;CACxB,IACD,OACF;EACE,MAAM;GACJ,GAAI,KAAK,iBAAiB,aAAa,CAAE,IAAG,KAAK;GACjD,KAAK;GACL;EACD,EAAC,KAAK,IAAI;GACV,KAAK,iBAAiB;GACrB,GAAG;IACF,OAAO;EACT;CACF;AAEP,KAAI,KAAK,WAAW,eAClB,SAAS,UAAU;UACV,KAAK,WAAW,uBAAuB,KAAK,WAAW,UAChE,SAAS,UAAU;AAGrB,KACE,KAAK,WAAW,aACf,WAAW,YACV,WAAW,YACX,WAAW,YACV,UAAU,YAAY,MAAM,QAAQ,SAAS,KAAK,GAErD,QAAQ,KACN,uGACD;AAGH,QAAO;AACR"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { getRefs } from "./Refs.js";
|
|
2
|
+
import { parseAnyDef } from "./parsers/any.js";
|
|
3
|
+
import { parseDef } from "./parseDef.js";
|
|
4
|
+
|
|
5
|
+
//#region src/utils/zod-to-json-schema/zodToJsonSchema.ts
|
|
6
|
+
const zodToJsonSchema = (schema, options) => {
|
|
7
|
+
const refs = getRefs(options);
|
|
8
|
+
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name$1, schema$1]) => ({
|
|
9
|
+
...acc,
|
|
10
|
+
[name$1]: parseDef(schema$1._def, {
|
|
11
|
+
...refs,
|
|
12
|
+
currentPath: [
|
|
13
|
+
...refs.basePath,
|
|
14
|
+
refs.definitionPath,
|
|
15
|
+
name$1
|
|
16
|
+
]
|
|
17
|
+
}, true) ?? parseAnyDef(refs)
|
|
18
|
+
}), {}) : void 0;
|
|
19
|
+
const name = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
|
|
20
|
+
const main = parseDef(schema._def, name === void 0 ? refs : {
|
|
21
|
+
...refs,
|
|
22
|
+
currentPath: [
|
|
23
|
+
...refs.basePath,
|
|
24
|
+
refs.definitionPath,
|
|
25
|
+
name
|
|
26
|
+
]
|
|
27
|
+
}, false) ?? parseAnyDef(refs);
|
|
28
|
+
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
29
|
+
if (title !== void 0) main.title = title;
|
|
30
|
+
if (refs.flags.hasReferencedOpenAiAnyType) {
|
|
31
|
+
if (!definitions) definitions = {};
|
|
32
|
+
if (!definitions[refs.openAiAnyTypeName]) definitions[refs.openAiAnyTypeName] = {
|
|
33
|
+
type: [
|
|
34
|
+
"string",
|
|
35
|
+
"number",
|
|
36
|
+
"integer",
|
|
37
|
+
"boolean",
|
|
38
|
+
"array",
|
|
39
|
+
"null"
|
|
40
|
+
],
|
|
41
|
+
items: { $ref: refs.$refStrategy === "relative" ? "1" : [
|
|
42
|
+
...refs.basePath,
|
|
43
|
+
refs.definitionPath,
|
|
44
|
+
refs.openAiAnyTypeName
|
|
45
|
+
].join("/") }
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const combined = name === void 0 ? definitions ? {
|
|
49
|
+
...main,
|
|
50
|
+
[refs.definitionPath]: definitions
|
|
51
|
+
} : main : {
|
|
52
|
+
$ref: [
|
|
53
|
+
...refs.$refStrategy === "relative" ? [] : refs.basePath,
|
|
54
|
+
refs.definitionPath,
|
|
55
|
+
name
|
|
56
|
+
].join("/"),
|
|
57
|
+
[refs.definitionPath]: {
|
|
58
|
+
...definitions,
|
|
59
|
+
[name]: main
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
if (refs.target === "jsonSchema7") combined.$schema = "http://json-schema.org/draft-07/schema#";
|
|
63
|
+
else if (refs.target === "jsonSchema2019-09" || refs.target === "openAi") combined.$schema = "https://json-schema.org/draft/2019-09/schema#";
|
|
64
|
+
if (refs.target === "openAi" && ("anyOf" in combined || "oneOf" in combined || "allOf" in combined || "type" in combined && Array.isArray(combined.type))) console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");
|
|
65
|
+
return combined;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
export { zodToJsonSchema };
|
|
70
|
+
//# sourceMappingURL=zodToJsonSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zodToJsonSchema.js","names":["schema: ZodSchema<any>","options?: Partial<Options<Target>> | string","acc: { [key: string]: JsonSchema7Type }","name","schema","combined: ReturnType<typeof zodToJsonSchema<Target>>"],"sources":["../../../src/utils/zod-to-json-schema/zodToJsonSchema.ts"],"sourcesContent":["import { ZodSchema } from \"zod/v3\";\nimport { Options, Targets } from \"./Options.js\";\nimport { parseDef } from \"./parseDef.js\";\nimport { JsonSchema7Type } from \"./parseTypes.js\";\nimport { getRefs } from \"./Refs.js\";\nimport { parseAnyDef } from \"./parsers/any.js\";\n\nconst zodToJsonSchema = <Target extends Targets = \"jsonSchema7\">(\n schema: ZodSchema<any>,\n options?: Partial<Options<Target>> | string\n): (Target extends \"jsonSchema7\" ? JsonSchema7Type : object) & {\n $schema?: string;\n definitions?: {\n [key: string]: Target extends \"jsonSchema7\"\n ? JsonSchema7Type\n : Target extends \"jsonSchema2019-09\"\n ? JsonSchema7Type\n : object;\n };\n} => {\n const refs = getRefs(options);\n\n let definitions =\n typeof options === \"object\" && options.definitions\n ? Object.entries(options.definitions).reduce(\n (acc: { [key: string]: JsonSchema7Type }, [name, schema]) => ({\n ...acc,\n [name]:\n parseDef(\n schema._def,\n {\n ...refs,\n currentPath: [...refs.basePath, refs.definitionPath, name],\n },\n true\n ) ?? parseAnyDef(refs),\n }),\n {}\n )\n : undefined;\n\n const name =\n typeof options === \"string\"\n ? options\n : options?.nameStrategy === \"title\"\n ? undefined\n : options?.name;\n\n const main =\n parseDef(\n schema._def,\n name === undefined\n ? refs\n : {\n ...refs,\n currentPath: [...refs.basePath, refs.definitionPath, name],\n },\n false\n ) ?? (parseAnyDef(refs) as JsonSchema7Type);\n\n const title =\n typeof options === \"object\" &&\n options.name !== undefined &&\n options.nameStrategy === \"title\"\n ? options.name\n : undefined;\n\n if (title !== undefined) {\n main.title = title;\n }\n\n if (refs.flags.hasReferencedOpenAiAnyType) {\n if (!definitions) {\n definitions = {};\n }\n\n if (!definitions[refs.openAiAnyTypeName]) {\n definitions[refs.openAiAnyTypeName] = {\n // Skipping \"object\" as no properties can be defined and additionalProperties must be \"false\"\n type: [\"string\", \"number\", \"integer\", \"boolean\", \"array\", \"null\"],\n items: {\n $ref:\n refs.$refStrategy === \"relative\"\n ? \"1\"\n : [\n ...refs.basePath,\n refs.definitionPath,\n refs.openAiAnyTypeName,\n ].join(\"/\"),\n },\n } as JsonSchema7Type;\n }\n }\n\n const combined: ReturnType<typeof zodToJsonSchema<Target>> =\n name === undefined\n ? definitions\n ? {\n ...main,\n [refs.definitionPath]: definitions,\n }\n : main\n : {\n $ref: [\n ...(refs.$refStrategy === \"relative\" ? [] : refs.basePath),\n refs.definitionPath,\n name,\n ].join(\"/\"),\n [refs.definitionPath]: {\n ...definitions,\n [name]: main,\n },\n };\n\n if (refs.target === \"jsonSchema7\") {\n combined.$schema = \"http://json-schema.org/draft-07/schema#\";\n } else if (refs.target === \"jsonSchema2019-09\" || refs.target === \"openAi\") {\n combined.$schema = \"https://json-schema.org/draft/2019-09/schema#\";\n }\n\n if (\n refs.target === \"openAi\" &&\n (\"anyOf\" in combined ||\n \"oneOf\" in combined ||\n \"allOf\" in combined ||\n (\"type\" in combined && Array.isArray(combined.type)))\n ) {\n console.warn(\n \"Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.\"\n );\n }\n\n return combined;\n};\n\nexport { zodToJsonSchema };\n"],"mappings":";;;;;AAOA,MAAM,kBAAkB,CACtBA,QACAC,YAUG;CACH,MAAM,OAAO,QAAQ,QAAQ;CAE7B,IAAI,cACF,OAAO,YAAY,YAAY,QAAQ,cACnC,OAAO,QAAQ,QAAQ,YAAY,CAAC,OAClC,CAACC,KAAyC,CAACC,QAAMC,SAAO,MAAM;EAC5D,GAAG;GACFD,SACC,SACEC,SAAO,MACP;GACE,GAAG;GACH,aAAa;IAAC,GAAG,KAAK;IAAU,KAAK;IAAgBD;GAAK;EAC3D,GACD,KACD,IAAI,YAAY,KAAK;CACzB,IACD,CAAE,EACH,GACD;CAEN,MAAM,OACJ,OAAO,YAAY,WACf,UACA,SAAS,iBAAiB,UAC1B,SACA,SAAS;CAEf,MAAM,OACJ,SACE,OAAO,MACP,SAAS,SACL,OACA;EACE,GAAG;EACH,aAAa;GAAC,GAAG,KAAK;GAAU,KAAK;GAAgB;EAAK;CAC3D,GACL,MACD,IAAK,YAAY,KAAK;CAEzB,MAAM,QACJ,OAAO,YAAY,YACnB,QAAQ,SAAS,UACjB,QAAQ,iBAAiB,UACrB,QAAQ,OACR;AAEN,KAAI,UAAU,QACZ,KAAK,QAAQ;AAGf,KAAI,KAAK,MAAM,4BAA4B;AACzC,MAAI,CAAC,aACH,cAAc,CAAE;AAGlB,MAAI,CAAC,YAAY,KAAK,oBACpB,YAAY,KAAK,qBAAqB;GAEpC,MAAM;IAAC;IAAU;IAAU;IAAW;IAAW;IAAS;GAAO;GACjE,OAAO,EACL,MACE,KAAK,iBAAiB,aAClB,MACA;IACE,GAAG,KAAK;IACR,KAAK;IACL,KAAK;GACN,EAAC,KAAK,IAAI,CAClB;EACF;CAEJ;CAED,MAAME,WACJ,SAAS,SACL,cACE;EACE,GAAG;GACF,KAAK,iBAAiB;CACxB,IACD,OACF;EACE,MAAM;GACJ,GAAI,KAAK,iBAAiB,aAAa,CAAE,IAAG,KAAK;GACjD,KAAK;GACL;EACD,EAAC,KAAK,IAAI;GACV,KAAK,iBAAiB;GACrB,GAAG;IACF,OAAO;EACT;CACF;AAEP,KAAI,KAAK,WAAW,eAClB,SAAS,UAAU;UACV,KAAK,WAAW,uBAAuB,KAAK,WAAW,UAChE,SAAS,UAAU;AAGrB,KACE,KAAK,WAAW,aACf,WAAW,YACV,WAAW,YACX,WAAW,YACV,UAAU,YAAY,MAAM,QAAQ,SAAS,KAAK,GAErD,QAAQ,KACN,uGACD;AAGH,QAAO;AACR"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/core",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.4",
|
|
4
4
|
"description": "Core LangChain.js abstractions and schemas",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -26,23 +26,15 @@
|
|
|
26
26
|
"p-queue": "^6.6.2",
|
|
27
27
|
"p-retry": "4",
|
|
28
28
|
"uuid": "^10.0.0",
|
|
29
|
-
"zod": "^3.25.
|
|
30
|
-
"zod-to-json-schema": "^3.22.3"
|
|
29
|
+
"zod": "^3.25.76 || ^4"
|
|
31
30
|
},
|
|
32
31
|
"devDependencies": {
|
|
33
32
|
"@types/decamelize": "^1.2.0",
|
|
34
33
|
"@types/mustache": "^4",
|
|
35
34
|
"@types/uuid": "^10.0.0",
|
|
36
|
-
"@typescript-eslint/eslint-plugin": "^6.12.0",
|
|
37
|
-
"@typescript-eslint/parser": "^6.12.0",
|
|
38
35
|
"dotenv": "^17.2.1",
|
|
39
36
|
"dpdm": "^3.14.0",
|
|
40
|
-
"eslint": "^
|
|
41
|
-
"eslint-config-airbnb-base": "^15.0.0",
|
|
42
|
-
"eslint-config-prettier": "^8.6.0",
|
|
43
|
-
"eslint-plugin-import": "^2.27.5",
|
|
44
|
-
"eslint-plugin-no-instanceof": "^1.0.1",
|
|
45
|
-
"eslint-plugin-prettier": "^4.2.1",
|
|
37
|
+
"eslint": "^9.34.0",
|
|
46
38
|
"ml-matrix": "^6.10.4",
|
|
47
39
|
"prettier": "^2.8.3",
|
|
48
40
|
"release-it": "^19.0.4",
|
|
@@ -50,7 +42,8 @@
|
|
|
50
42
|
"rimraf": "^5.0.1",
|
|
51
43
|
"typescript": "~5.8.3",
|
|
52
44
|
"vitest": "^3.2.4",
|
|
53
|
-
"web-streams-polyfill": "^4.0.0"
|
|
45
|
+
"web-streams-polyfill": "^4.0.0",
|
|
46
|
+
"@langchain/eslint": "0.1.0"
|
|
54
47
|
},
|
|
55
48
|
"publishConfig": {
|
|
56
49
|
"access": "public"
|
|
@@ -653,28 +646,6 @@
|
|
|
653
646
|
},
|
|
654
647
|
"input": "./src/utils/hash.ts"
|
|
655
648
|
},
|
|
656
|
-
"./utils/hash/insecure": {
|
|
657
|
-
"require": {
|
|
658
|
-
"types": "./dist/utils/js-sha1/hash.d.cts",
|
|
659
|
-
"default": "./dist/utils/js-sha1/hash.cjs"
|
|
660
|
-
},
|
|
661
|
-
"import": {
|
|
662
|
-
"types": "./dist/utils/js-sha1/hash.d.ts",
|
|
663
|
-
"default": "./dist/utils/js-sha1/hash.js"
|
|
664
|
-
},
|
|
665
|
-
"input": "./src/utils/js-sha1/hash.ts"
|
|
666
|
-
},
|
|
667
|
-
"./utils/hash/sha256": {
|
|
668
|
-
"require": {
|
|
669
|
-
"types": "./dist/utils/js-sha256/hash.d.cts",
|
|
670
|
-
"default": "./dist/utils/js-sha256/hash.cjs"
|
|
671
|
-
},
|
|
672
|
-
"import": {
|
|
673
|
-
"types": "./dist/utils/js-sha256/hash.d.ts",
|
|
674
|
-
"default": "./dist/utils/js-sha256/hash.js"
|
|
675
|
-
},
|
|
676
|
-
"input": "./src/utils/js-sha256/hash.ts"
|
|
677
|
-
},
|
|
678
649
|
"./utils/json_patch": {
|
|
679
650
|
"require": {
|
|
680
651
|
"types": "./dist/utils/json_patch.d.cts",
|
|
@@ -771,8 +742,8 @@
|
|
|
771
742
|
"scripts": {
|
|
772
743
|
"build": "pnpm --filter @langchain/build compile @langchain/core",
|
|
773
744
|
"clean": "rm -rf .turbo dist/",
|
|
774
|
-
"lint:eslint": "
|
|
775
|
-
"lint:dpdm": "dpdm --skip-dynamic-imports circular --exit-code circular:1 --no-warning --no-tree src/*.ts src/**/*.ts --transform",
|
|
745
|
+
"lint:eslint": "eslint --cache src/",
|
|
746
|
+
"lint:dpdm": "dpdm --skip-dynamic-imports circular --exit-code circular:1 --no-warning --no-tree src/*.ts src/**/*.ts --exclude \"(node_modules|src/utils/zod-to-json-schema)\" --transform",
|
|
776
747
|
"lint": "pnpm lint:eslint && pnpm lint:dpdm",
|
|
777
748
|
"lint:fix": "pnpm lint:eslint --fix && pnpm lint:dpdm",
|
|
778
749
|
"release": "release-it --only-version --config .release-it.json",
|