@athenaintel/react 0.23.3 → 0.24.1
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 +17 -4
- package/dist/assets/AssetPanel.cjs +1 -1
- package/dist/assets/AssetPanel.cjs.map +1 -1
- package/dist/assets/AssetPanel.js +1 -1
- package/dist/assets/AssetPanel.js.map +1 -1
- package/dist/assets/AthenaAssetEmbed.cjs +1 -1
- package/dist/assets/AthenaAssetEmbed.cjs.map +1 -1
- package/dist/assets/AthenaAssetEmbed.js +1 -1
- package/dist/assets/AthenaAssetEmbed.js.map +1 -1
- package/dist/chat/AthenaChat.cjs +15 -23
- package/dist/chat/AthenaChat.cjs.map +1 -1
- package/dist/chat/AthenaChat.d.ts +9 -4
- package/dist/chat/AthenaChat.js +15 -23
- package/dist/chat/AthenaChat.js.map +1 -1
- package/dist/chat/StatewireApprovalCard.cjs +34 -24
- package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
- package/dist/chat/StatewireApprovalCard.d.ts +34 -4
- package/dist/chat/StatewireApprovalCard.js +34 -24
- package/dist/chat/StatewireApprovalCard.js.map +1 -1
- package/dist/chat/StatewireClientToolBridge.cjs +2 -16
- package/dist/chat/StatewireClientToolBridge.cjs.map +1 -1
- package/dist/chat/StatewireClientToolBridge.js +2 -16
- package/dist/chat/StatewireClientToolBridge.js.map +1 -1
- package/dist/chat/StatewireQueuedMessages.cjs +5 -16
- package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
- package/dist/chat/StatewireQueuedMessages.js +5 -16
- package/dist/chat/StatewireQueuedMessages.js.map +1 -1
- package/dist/chat/WaitingOnYouBanner.cjs +3 -18
- package/dist/chat/WaitingOnYouBanner.cjs.map +1 -1
- package/dist/chat/WaitingOnYouBanner.js +3 -18
- package/dist/chat/WaitingOnYouBanner.js.map +1 -1
- package/dist/chat/run-activity.cjs +0 -16
- package/dist/chat/run-activity.cjs.map +1 -1
- package/dist/chat/run-activity.js +0 -16
- package/dist/chat/run-activity.js.map +1 -1
- package/dist/chat/statewire-client-tools.cjs +1 -17
- package/dist/chat/statewire-client-tools.cjs.map +1 -1
- package/dist/chat/statewire-client-tools.js +1 -17
- package/dist/chat/statewire-client-tools.js.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.cjs +0 -16
- package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.js +0 -16
- package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
- package/dist/chat/tiptap-text.cjs +1 -17
- package/dist/chat/tiptap-text.cjs.map +1 -1
- package/dist/chat/tiptap-text.js +1 -17
- package/dist/chat/tiptap-text.js.map +1 -1
- package/dist/chat/use-athena-run-live.cjs +0 -15
- package/dist/chat/use-athena-run-live.cjs.map +1 -1
- package/dist/chat/use-athena-run-live.js +0 -15
- package/dist/chat/use-athena-run-live.js.map +1 -1
- package/dist/chat/use-statewire-approval-request.cjs +4 -16
- package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
- package/dist/chat/use-statewire-approval-request.d.ts +2 -0
- package/dist/chat/use-statewire-approval-request.js +4 -16
- package/dist/chat/use-statewire-approval-request.js.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.cjs +1 -16
- package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.js +1 -16
- package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
- package/dist/chat-ui/index.cjs +0 -16
- package/dist/chat-ui/index.cjs.map +1 -1
- package/dist/chat-ui/index.d.ts +1 -1
- package/dist/chat-ui/index.js +0 -16
- package/dist/chat-ui/index.js.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.cjs +1 -16
- package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.js +1 -16
- package/dist/chat-ui/mentions/mention-chip.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.cjs +4 -6
- package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.js +4 -6
- package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs +2 -9
- package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/index.js +2 -9
- package/dist/chat-ui/mentions/suggestions/data/sources/index.js.map +1 -1
- package/dist/chat-ui/messages/message-components.cjs +5 -19
- package/dist/chat-ui/messages/message-components.cjs.map +1 -1
- package/dist/chat-ui/messages/message-components.js +5 -19
- package/dist/chat-ui/messages/message-components.js.map +1 -1
- package/dist/chat-ui/messages/runtime-message.cjs +1 -16
- package/dist/chat-ui/messages/runtime-message.cjs.map +1 -1
- package/dist/chat-ui/messages/runtime-message.js +1 -16
- package/dist/chat-ui/messages/runtime-message.js.map +1 -1
- package/dist/chat-ui/messages/statewire-continue-run.cjs +3 -15
- package/dist/chat-ui/messages/statewire-continue-run.cjs.map +1 -1
- package/dist/chat-ui/messages/statewire-continue-run.js +3 -15
- package/dist/chat-ui/messages/statewire-continue-run.js.map +1 -1
- package/dist/chat-ui/messages/user-edit-composer.cjs +0 -16
- package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
- package/dist/chat-ui/messages/user-edit-composer.js +0 -16
- package/dist/chat-ui/messages/user-edit-composer.js.map +1 -1
- package/dist/chat-ui/messages/wake-marker.cjs +1 -16
- package/dist/chat-ui/messages/wake-marker.cjs.map +1 -1
- package/dist/chat-ui/messages/wake-marker.js +1 -16
- package/dist/chat-ui/messages/wake-marker.js.map +1 -1
- package/dist/chat-ui/statewire.cjs +0 -16
- package/dist/chat-ui/statewire.cjs.map +1 -1
- package/dist/chat-ui/statewire.d.ts +1 -1
- package/dist/chat-ui/statewire.js +0 -16
- package/dist/chat-ui/statewire.js.map +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.cjs +2 -17
- package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.js +2 -17
- package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
- package/dist/dictation/DictationStrip.cjs +2 -1
- package/dist/dictation/DictationStrip.cjs.map +1 -1
- package/dist/dictation/DictationStrip.d.ts +2 -0
- package/dist/dictation/DictationStrip.js +2 -1
- package/dist/dictation/DictationStrip.js.map +1 -1
- package/dist/dictation/dictation-engine.cjs.map +1 -1
- package/dist/dictation/dictation-engine.d.ts +8 -0
- package/dist/dictation/dictation-engine.js.map +1 -1
- package/dist/dictation/recorded-dictation-engine.cjs +153 -0
- package/dist/dictation/recorded-dictation-engine.cjs.map +1 -0
- package/dist/dictation/recorded-dictation-engine.d.ts +66 -0
- package/dist/dictation/recorded-dictation-engine.js +153 -0
- package/dist/dictation/recorded-dictation-engine.js.map +1 -0
- package/dist/dictation/use-athena-dictation-engine.cjs +64 -0
- package/dist/dictation/use-athena-dictation-engine.cjs.map +1 -0
- package/dist/dictation/use-athena-dictation-engine.d.ts +25 -0
- package/dist/dictation/use-athena-dictation-engine.js +64 -0
- package/dist/dictation/use-athena-dictation-engine.js.map +1 -0
- package/dist/dictation/use-dictation.cjs +17 -6
- package/dist/dictation/use-dictation.cjs.map +1 -1
- package/dist/dictation/use-dictation.d.ts +20 -4
- package/dist/dictation/use-dictation.js +17 -6
- package/dist/dictation/use-dictation.js.map +1 -1
- package/dist/index.cjs +29 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.js +12 -22
- package/dist/index.js.map +1 -1
- package/dist/packages/agent-runtime/src/conversation-list.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/conversation-list.js.map +1 -1
- package/dist/packages/agent-runtime/src/edit-command.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/edit-command.js.map +1 -1
- package/dist/packages/agent-runtime/src/errors.cjs +18 -0
- package/dist/packages/agent-runtime/src/errors.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/errors.js +19 -1
- package/dist/packages/agent-runtime/src/errors.js.map +1 -1
- package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs +2 -0
- package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/generated/runconfig-contract.js +2 -0
- package/dist/packages/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
- package/dist/packages/agent-runtime/src/interrupts.cjs +83 -14
- package/dist/packages/agent-runtime/src/interrupts.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/interrupts.js +83 -14
- package/dist/packages/agent-runtime/src/interrupts.js.map +1 -1
- package/dist/packages/agent-runtime/src/messages.cjs +2 -1
- package/dist/packages/agent-runtime/src/messages.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/messages.js +2 -1
- package/dist/packages/agent-runtime/src/messages.js.map +1 -1
- package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs +49 -0
- package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js +49 -0
- package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js.map +1 -1
- package/dist/packages/agent-runtime/src/thread-status.js +1 -1
- package/dist/packages/agent-runtime/src/tool-metadata.cjs +1 -37
- package/dist/packages/agent-runtime/src/tool-metadata.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/tool-metadata.js +1 -37
- package/dist/packages/agent-runtime/src/tool-metadata.js.map +1 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-config.cjs +0 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-config.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-config.js +0 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-config.js.map +1 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
- package/dist/packages/agent-runtime/src/voice-presentation.cjs +6 -0
- package/dist/packages/agent-runtime/src/voice-presentation.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/voice-presentation.js +6 -0
- package/dist/packages/agent-runtime/src/voice-presentation.js.map +1 -1
- package/dist/packages/agent-runtime/src/voice-turn-grouping.cjs +68 -0
- package/dist/packages/agent-runtime/src/voice-turn-grouping.cjs.map +1 -0
- package/dist/packages/agent-runtime/src/voice-turn-grouping.js +68 -0
- package/dist/packages/agent-runtime/src/voice-turn-grouping.js.map +1 -0
- package/dist/packages/react/package.json.cjs +1 -1
- package/dist/packages/react/package.json.js +1 -1
- package/dist/provider/AthenaProvider.cjs +5 -18
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.js +5 -18
- package/dist/provider/AthenaProvider.js.map +1 -1
- package/dist/provider/theme-style-context.cjs +12 -0
- package/dist/provider/theme-style-context.cjs.map +1 -0
- package/dist/provider/theme-style-context.d.ts +8 -0
- package/dist/provider/theme-style-context.js +12 -0
- package/dist/provider/theme-style-context.js.map +1 -0
- package/dist/runtime/statewire-lifecycle.cjs +0 -16
- package/dist/runtime/statewire-lifecycle.cjs.map +1 -1
- package/dist/runtime/statewire-lifecycle.js +0 -16
- package/dist/runtime/statewire-lifecycle.js.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.cjs +3 -17
- package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.js +3 -17
- package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/threads/SessionList.cjs +87 -16
- package/dist/threads/SessionList.cjs.map +1 -1
- package/dist/threads/SessionList.js +88 -17
- package/dist/threads/SessionList.js.map +1 -1
- package/dist/threads/session-list-model.cjs +13 -5
- package/dist/threads/session-list-model.cjs.map +1 -1
- package/dist/threads/session-list-model.d.ts +10 -3
- package/dist/threads/session-list-model.js +13 -5
- package/dist/threads/session-list-model.js.map +1 -1
- package/dist/threads/statewire-thread-list.cjs +4 -17
- package/dist/threads/statewire-thread-list.cjs.map +1 -1
- package/dist/threads/statewire-thread-list.js +4 -17
- package/dist/threads/statewire-thread-list.js.map +1 -1
- package/dist/threads/use-rest-conversation-history.cjs +2 -16
- package/dist/threads/use-rest-conversation-history.cjs.map +1 -1
- package/dist/threads/use-rest-conversation-history.js +2 -16
- package/dist/threads/use-rest-conversation-history.js.map +1 -1
- package/dist/threads/use-statewire-conversation-history.cjs +2 -16
- package/dist/threads/use-statewire-conversation-history.cjs.map +1 -1
- package/dist/threads/use-statewire-conversation-history.js +2 -16
- package/dist/threads/use-statewire-conversation-history.js.map +1 -1
- package/dist/toolkits/index.cjs +0 -7
- package/dist/toolkits/index.cjs.map +1 -1
- package/dist/toolkits/index.d.ts +0 -2
- package/dist/toolkits/index.js +0 -7
- package/dist/toolkits/index.js.map +1 -1
- package/dist/tools/index.cjs +4 -20
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.js +1 -17
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/misc-tool-uis.cjs +2 -17
- package/dist/tools/misc-tool-uis.cjs.map +1 -1
- package/dist/tools/misc-tool-uis.js +2 -17
- package/dist/tools/misc-tool-uis.js.map +1 -1
- package/dist/tools/primitives.cjs +1 -16
- package/dist/tools/primitives.cjs.map +1 -1
- package/dist/tools/primitives.js +1 -16
- package/dist/tools/primitives.js.map +1 -1
- package/dist/tools/tool-fallback.cjs +2 -17
- package/dist/tools/tool-fallback.cjs.map +1 -1
- package/dist/tools/tool-fallback.js +2 -17
- package/dist/tools/tool-fallback.js.map +1 -1
- package/dist/tools/voice-update-tool-ui.cjs +1 -17
- package/dist/tools/voice-update-tool-ui.cjs.map +1 -1
- package/dist/tools/voice-update-tool-ui.js +1 -17
- package/dist/tools/voice-update-tool-ui.js.map +1 -1
- package/dist/ui/popover.cjs +46 -0
- package/dist/ui/popover.cjs.map +1 -0
- package/dist/ui/popover.d.ts +6 -0
- package/dist/ui/popover.js +46 -0
- package/dist/ui/popover.js.map +1 -0
- package/package.json +2 -2
- package/dist/node_modules/qrcode-generator/dist/qrcode.cjs +0 -32
- package/dist/node_modules/qrcode-generator/dist/qrcode.cjs.map +0 -1
- package/dist/node_modules/qrcode-generator/dist/qrcode.js +0 -31
- package/dist/node_modules/qrcode-generator/dist/qrcode.js.map +0 -1
- package/dist/node_modules/zod/v4/classic/errors.cjs +0 -44
- package/dist/node_modules/zod/v4/classic/errors.cjs.map +0 -1
- package/dist/node_modules/zod/v4/classic/errors.js +0 -44
- package/dist/node_modules/zod/v4/classic/errors.js.map +0 -1
- package/dist/node_modules/zod/v4/classic/iso.cjs +0 -43
- package/dist/node_modules/zod/v4/classic/iso.cjs.map +0 -1
- package/dist/node_modules/zod/v4/classic/iso.js +0 -43
- package/dist/node_modules/zod/v4/classic/iso.js.map +0 -1
- package/dist/node_modules/zod/v4/classic/parse.cjs +0 -29
- package/dist/node_modules/zod/v4/classic/parse.cjs.map +0 -1
- package/dist/node_modules/zod/v4/classic/parse.js +0 -29
- package/dist/node_modules/zod/v4/classic/parse.js.map +0 -1
- package/dist/node_modules/zod/v4/classic/schemas.cjs +0 -871
- package/dist/node_modules/zod/v4/classic/schemas.cjs.map +0 -1
- package/dist/node_modules/zod/v4/classic/schemas.js +0 -871
- package/dist/node_modules/zod/v4/classic/schemas.js.map +0 -1
- package/dist/node_modules/zod/v4/core/api.cjs +0 -570
- package/dist/node_modules/zod/v4/core/api.cjs.map +0 -1
- package/dist/node_modules/zod/v4/core/api.js +0 -570
- package/dist/node_modules/zod/v4/core/api.js.map +0 -1
- package/dist/node_modules/zod/v4/core/checks.cjs +0 -411
- package/dist/node_modules/zod/v4/core/checks.cjs.map +0 -1
- package/dist/node_modules/zod/v4/core/checks.js +0 -411
- package/dist/node_modules/zod/v4/core/checks.js.map +0 -1
- package/dist/node_modules/zod/v4/core/core.cjs +0 -77
- package/dist/node_modules/zod/v4/core/core.cjs.map +0 -1
- package/dist/node_modules/zod/v4/core/core.js +0 -77
- package/dist/node_modules/zod/v4/core/core.js.map +0 -1
- package/dist/node_modules/zod/v4/core/doc.cjs +0 -38
- package/dist/node_modules/zod/v4/core/doc.cjs.map +0 -1
- package/dist/node_modules/zod/v4/core/doc.js +0 -38
- package/dist/node_modules/zod/v4/core/doc.js.map +0 -1
- package/dist/node_modules/zod/v4/core/errors.cjs +0 -76
- package/dist/node_modules/zod/v4/core/errors.cjs.map +0 -1
- package/dist/node_modules/zod/v4/core/errors.js +0 -76
- package/dist/node_modules/zod/v4/core/errors.js.map +0 -1
- package/dist/node_modules/zod/v4/core/json-schema-processors.cjs +0 -312
- package/dist/node_modules/zod/v4/core/json-schema-processors.cjs.map +0 -1
- package/dist/node_modules/zod/v4/core/json-schema-processors.js +0 -312
- package/dist/node_modules/zod/v4/core/json-schema-processors.js.map +0 -1
- package/dist/node_modules/zod/v4/core/parse.cjs +0 -96
- package/dist/node_modules/zod/v4/core/parse.cjs.map +0 -1
- package/dist/node_modules/zod/v4/core/parse.js +0 -96
- package/dist/node_modules/zod/v4/core/parse.js.map +0 -1
- package/dist/node_modules/zod/v4/core/regexes.cjs +0 -86
- package/dist/node_modules/zod/v4/core/regexes.cjs.map +0 -1
- package/dist/node_modules/zod/v4/core/regexes.js +0 -86
- package/dist/node_modules/zod/v4/core/regexes.js.map +0 -1
- package/dist/node_modules/zod/v4/core/registries.cjs +0 -52
- package/dist/node_modules/zod/v4/core/registries.cjs.map +0 -1
- package/dist/node_modules/zod/v4/core/registries.js +0 -52
- package/dist/node_modules/zod/v4/core/registries.js.map +0 -1
- package/dist/node_modules/zod/v4/core/schemas.cjs +0 -1412
- package/dist/node_modules/zod/v4/core/schemas.cjs.map +0 -1
- package/dist/node_modules/zod/v4/core/schemas.js +0 -1413
- package/dist/node_modules/zod/v4/core/schemas.js.map +0 -1
- package/dist/node_modules/zod/v4/core/to-json-schema.cjs +0 -370
- package/dist/node_modules/zod/v4/core/to-json-schema.cjs.map +0 -1
- package/dist/node_modules/zod/v4/core/to-json-schema.js +0 -370
- package/dist/node_modules/zod/v4/core/to-json-schema.js.map +0 -1
- package/dist/node_modules/zod/v4/core/util.cjs +0 -444
- package/dist/node_modules/zod/v4/core/util.cjs.map +0 -1
- package/dist/node_modules/zod/v4/core/util.js +0 -444
- package/dist/node_modules/zod/v4/core/util.js.map +0 -1
- package/dist/node_modules/zod/v4/core/versions.cjs +0 -9
- package/dist/node_modules/zod/v4/core/versions.cjs.map +0 -1
- package/dist/node_modules/zod/v4/core/versions.js +0 -9
- package/dist/node_modules/zod/v4/core/versions.js.map +0 -1
- package/dist/packages/agent-runtime/src/thread-handoff.cjs +0 -85
- package/dist/packages/agent-runtime/src/thread-handoff.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/thread-handoff.js +0 -85
- package/dist/packages/agent-runtime/src/thread-handoff.js.map +0 -1
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
class Doc {
|
|
4
|
-
constructor(args = []) {
|
|
5
|
-
this.content = [];
|
|
6
|
-
this.indent = 0;
|
|
7
|
-
if (this)
|
|
8
|
-
this.args = args;
|
|
9
|
-
}
|
|
10
|
-
indented(fn) {
|
|
11
|
-
this.indent += 1;
|
|
12
|
-
fn(this);
|
|
13
|
-
this.indent -= 1;
|
|
14
|
-
}
|
|
15
|
-
write(arg) {
|
|
16
|
-
if (typeof arg === "function") {
|
|
17
|
-
arg(this, { execution: "sync" });
|
|
18
|
-
arg(this, { execution: "async" });
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
const content = arg;
|
|
22
|
-
const lines = content.split("\n").filter((x) => x);
|
|
23
|
-
const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
|
|
24
|
-
const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
|
|
25
|
-
for (const line of dedented) {
|
|
26
|
-
this.content.push(line);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
compile() {
|
|
30
|
-
const F = Function;
|
|
31
|
-
const args = this == null ? void 0 : this.args;
|
|
32
|
-
const content = (this == null ? void 0 : this.content) ?? [``];
|
|
33
|
-
const lines = [...content.map((x) => ` ${x}`)];
|
|
34
|
-
return new F(...args, lines.join("\n"));
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
exports.Doc = Doc;
|
|
38
|
-
//# sourceMappingURL=doc.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"doc.cjs","sources":["../../../../../../../node_modules/zod/v4/core/doc.js"],"sourcesContent":["export class Doc {\n constructor(args = []) {\n this.content = [];\n this.indent = 0;\n if (this)\n this.args = args;\n }\n indented(fn) {\n this.indent += 1;\n fn(this);\n this.indent -= 1;\n }\n write(arg) {\n if (typeof arg === \"function\") {\n arg(this, { execution: \"sync\" });\n arg(this, { execution: \"async\" });\n return;\n }\n const content = arg;\n const lines = content.split(\"\\n\").filter((x) => x);\n const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));\n const dedented = lines.map((x) => x.slice(minIndent)).map((x) => \" \".repeat(this.indent * 2) + x);\n for (const line of dedented) {\n this.content.push(line);\n }\n }\n compile() {\n const F = Function;\n const args = this?.args;\n const content = this?.content ?? [``];\n const lines = [...content.map((x) => ` ${x}`)];\n // console.log(lines.join(\"\\n\"));\n return new F(...args, lines.join(\"\\n\"));\n }\n}\n"],"names":[],"mappings":";;AAAO,MAAM,IAAI;AAAA,EACb,YAAY,OAAO,IAAI;AACnB,SAAK,UAAU,CAAA;AACf,SAAK,SAAS;AACd,QAAI;AACA,WAAK,OAAO;AAAA,EACpB;AAAA,EACA,SAAS,IAAI;AACT,SAAK,UAAU;AACf,OAAG,IAAI;AACP,SAAK,UAAU;AAAA,EACnB;AAAA,EACA,MAAM,KAAK;AACP,QAAI,OAAO,QAAQ,YAAY;AAC3B,UAAI,MAAM,EAAE,WAAW,OAAM,CAAE;AAC/B,UAAI,MAAM,EAAE,WAAW,QAAO,CAAE;AAChC;AAAA,IACJ;AACA,UAAM,UAAU;AAChB,UAAM,QAAQ,QAAQ,MAAM,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC;AACjD,UAAM,YAAY,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,UAAS,EAAG,MAAM,CAAC;AAC/E,UAAM,WAAW,MAAM,IAAI,CAAC,MAAM,EAAE,MAAM,SAAS,CAAC,EAAE,IAAI,CAAC,MAAM,IAAI,OAAO,KAAK,SAAS,CAAC,IAAI,CAAC;AAChG,eAAW,QAAQ,UAAU;AACzB,WAAK,QAAQ,KAAK,IAAI;AAAA,IAC1B;AAAA,EACJ;AAAA,EACA,UAAU;AACN,UAAM,IAAI;AACV,UAAM,OAAO,6BAAM;AACnB,UAAM,WAAU,6BAAM,YAAW,CAAC,EAAE;AACpC,UAAM,QAAQ,CAAC,GAAG,QAAQ,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;AAE9C,WAAO,IAAI,EAAE,GAAG,MAAM,MAAM,KAAK,IAAI,CAAC;AAAA,EAC1C;AACJ;;","x_google_ignoreList":[0]}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
class Doc {
|
|
2
|
-
constructor(args = []) {
|
|
3
|
-
this.content = [];
|
|
4
|
-
this.indent = 0;
|
|
5
|
-
if (this)
|
|
6
|
-
this.args = args;
|
|
7
|
-
}
|
|
8
|
-
indented(fn) {
|
|
9
|
-
this.indent += 1;
|
|
10
|
-
fn(this);
|
|
11
|
-
this.indent -= 1;
|
|
12
|
-
}
|
|
13
|
-
write(arg) {
|
|
14
|
-
if (typeof arg === "function") {
|
|
15
|
-
arg(this, { execution: "sync" });
|
|
16
|
-
arg(this, { execution: "async" });
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
const content = arg;
|
|
20
|
-
const lines = content.split("\n").filter((x) => x);
|
|
21
|
-
const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
|
|
22
|
-
const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
|
|
23
|
-
for (const line of dedented) {
|
|
24
|
-
this.content.push(line);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
compile() {
|
|
28
|
-
const F = Function;
|
|
29
|
-
const args = this == null ? void 0 : this.args;
|
|
30
|
-
const content = (this == null ? void 0 : this.content) ?? [``];
|
|
31
|
-
const lines = [...content.map((x) => ` ${x}`)];
|
|
32
|
-
return new F(...args, lines.join("\n"));
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export {
|
|
36
|
-
Doc
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=doc.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"doc.js","sources":["../../../../../../../node_modules/zod/v4/core/doc.js"],"sourcesContent":["export class Doc {\n constructor(args = []) {\n this.content = [];\n this.indent = 0;\n if (this)\n this.args = args;\n }\n indented(fn) {\n this.indent += 1;\n fn(this);\n this.indent -= 1;\n }\n write(arg) {\n if (typeof arg === \"function\") {\n arg(this, { execution: \"sync\" });\n arg(this, { execution: \"async\" });\n return;\n }\n const content = arg;\n const lines = content.split(\"\\n\").filter((x) => x);\n const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));\n const dedented = lines.map((x) => x.slice(minIndent)).map((x) => \" \".repeat(this.indent * 2) + x);\n for (const line of dedented) {\n this.content.push(line);\n }\n }\n compile() {\n const F = Function;\n const args = this?.args;\n const content = this?.content ?? [``];\n const lines = [...content.map((x) => ` ${x}`)];\n // console.log(lines.join(\"\\n\"));\n return new F(...args, lines.join(\"\\n\"));\n }\n}\n"],"names":[],"mappings":"AAAO,MAAM,IAAI;AAAA,EACb,YAAY,OAAO,IAAI;AACnB,SAAK,UAAU,CAAA;AACf,SAAK,SAAS;AACd,QAAI;AACA,WAAK,OAAO;AAAA,EACpB;AAAA,EACA,SAAS,IAAI;AACT,SAAK,UAAU;AACf,OAAG,IAAI;AACP,SAAK,UAAU;AAAA,EACnB;AAAA,EACA,MAAM,KAAK;AACP,QAAI,OAAO,QAAQ,YAAY;AAC3B,UAAI,MAAM,EAAE,WAAW,OAAM,CAAE;AAC/B,UAAI,MAAM,EAAE,WAAW,QAAO,CAAE;AAChC;AAAA,IACJ;AACA,UAAM,UAAU;AAChB,UAAM,QAAQ,QAAQ,MAAM,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC;AACjD,UAAM,YAAY,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,UAAS,EAAG,MAAM,CAAC;AAC/E,UAAM,WAAW,MAAM,IAAI,CAAC,MAAM,EAAE,MAAM,SAAS,CAAC,EAAE,IAAI,CAAC,MAAM,IAAI,OAAO,KAAK,SAAS,CAAC,IAAI,CAAC;AAChG,eAAW,QAAQ,UAAU;AACzB,WAAK,QAAQ,KAAK,IAAI;AAAA,IAC1B;AAAA,EACJ;AAAA,EACA,UAAU;AACN,UAAM,IAAI;AACV,UAAM,OAAO,6BAAM;AACnB,UAAM,WAAU,6BAAM,YAAW,CAAC,EAAE;AACpC,UAAM,QAAQ,CAAC,GAAG,QAAQ,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;AAE9C,WAAO,IAAI,EAAE,GAAG,MAAM,MAAM,KAAK,IAAI,CAAC;AAAA,EAC1C;AACJ;","x_google_ignoreList":[0]}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const core = require("./core.cjs");
|
|
4
|
-
const util = require("./util.cjs");
|
|
5
|
-
const initializer = (inst, def) => {
|
|
6
|
-
inst.name = "$ZodError";
|
|
7
|
-
Object.defineProperty(inst, "_zod", {
|
|
8
|
-
value: inst._zod,
|
|
9
|
-
enumerable: false
|
|
10
|
-
});
|
|
11
|
-
Object.defineProperty(inst, "issues", {
|
|
12
|
-
value: def,
|
|
13
|
-
enumerable: false
|
|
14
|
-
});
|
|
15
|
-
inst.message = JSON.stringify(def, util.jsonStringifyReplacer, 2);
|
|
16
|
-
Object.defineProperty(inst, "toString", {
|
|
17
|
-
value: () => inst.message,
|
|
18
|
-
enumerable: false
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
const $ZodError = core.$constructor("$ZodError", initializer);
|
|
22
|
-
const $ZodRealError = core.$constructor("$ZodError", initializer, { Parent: Error });
|
|
23
|
-
function flattenError(error, mapper = (issue) => issue.message) {
|
|
24
|
-
const fieldErrors = {};
|
|
25
|
-
const formErrors = [];
|
|
26
|
-
for (const sub of error.issues) {
|
|
27
|
-
if (sub.path.length > 0) {
|
|
28
|
-
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
29
|
-
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
30
|
-
} else {
|
|
31
|
-
formErrors.push(mapper(sub));
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return { formErrors, fieldErrors };
|
|
35
|
-
}
|
|
36
|
-
function formatError(error, mapper = (issue) => issue.message) {
|
|
37
|
-
const fieldErrors = { _errors: [] };
|
|
38
|
-
const processError = (error2, path = []) => {
|
|
39
|
-
for (const issue of error2.issues) {
|
|
40
|
-
if (issue.code === "invalid_union" && issue.errors.length) {
|
|
41
|
-
issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));
|
|
42
|
-
} else if (issue.code === "invalid_key") {
|
|
43
|
-
processError({ issues: issue.issues }, [...path, ...issue.path]);
|
|
44
|
-
} else if (issue.code === "invalid_element") {
|
|
45
|
-
processError({ issues: issue.issues }, [...path, ...issue.path]);
|
|
46
|
-
} else {
|
|
47
|
-
const fullpath = [...path, ...issue.path];
|
|
48
|
-
if (fullpath.length === 0) {
|
|
49
|
-
fieldErrors._errors.push(mapper(issue));
|
|
50
|
-
} else {
|
|
51
|
-
let curr = fieldErrors;
|
|
52
|
-
let i = 0;
|
|
53
|
-
while (i < fullpath.length) {
|
|
54
|
-
const el = fullpath[i];
|
|
55
|
-
const terminal = i === fullpath.length - 1;
|
|
56
|
-
if (!terminal) {
|
|
57
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
58
|
-
} else {
|
|
59
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
60
|
-
curr[el]._errors.push(mapper(issue));
|
|
61
|
-
}
|
|
62
|
-
curr = curr[el];
|
|
63
|
-
i++;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
processError(error);
|
|
70
|
-
return fieldErrors;
|
|
71
|
-
}
|
|
72
|
-
exports.$ZodError = $ZodError;
|
|
73
|
-
exports.$ZodRealError = $ZodRealError;
|
|
74
|
-
exports.flattenError = flattenError;
|
|
75
|
-
exports.formatError = formatError;
|
|
76
|
-
//# sourceMappingURL=errors.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.cjs","sources":["../../../../../../../node_modules/zod/v4/core/errors.js"],"sourcesContent":["import { $constructor } from \"./core.js\";\nimport * as util from \"./util.js\";\nconst initializer = (inst, def) => {\n inst.name = \"$ZodError\";\n Object.defineProperty(inst, \"_zod\", {\n value: inst._zod,\n enumerable: false,\n });\n Object.defineProperty(inst, \"issues\", {\n value: def,\n enumerable: false,\n });\n inst.message = JSON.stringify(def, util.jsonStringifyReplacer, 2);\n Object.defineProperty(inst, \"toString\", {\n value: () => inst.message,\n enumerable: false,\n });\n};\nexport const $ZodError = $constructor(\"$ZodError\", initializer);\nexport const $ZodRealError = $constructor(\"$ZodError\", initializer, { Parent: Error });\nexport function flattenError(error, mapper = (issue) => issue.message) {\n const fieldErrors = {};\n const formErrors = [];\n for (const sub of error.issues) {\n if (sub.path.length > 0) {\n fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];\n fieldErrors[sub.path[0]].push(mapper(sub));\n }\n else {\n formErrors.push(mapper(sub));\n }\n }\n return { formErrors, fieldErrors };\n}\nexport function formatError(error, mapper = (issue) => issue.message) {\n const fieldErrors = { _errors: [] };\n const processError = (error, path = []) => {\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\" && issue.errors.length) {\n issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));\n }\n else if (issue.code === \"invalid_key\") {\n processError({ issues: issue.issues }, [...path, ...issue.path]);\n }\n else if (issue.code === \"invalid_element\") {\n processError({ issues: issue.issues }, [...path, ...issue.path]);\n }\n else {\n const fullpath = [...path, ...issue.path];\n if (fullpath.length === 0) {\n fieldErrors._errors.push(mapper(issue));\n }\n else {\n let curr = fieldErrors;\n let i = 0;\n while (i < fullpath.length) {\n const el = fullpath[i];\n const terminal = i === fullpath.length - 1;\n if (!terminal) {\n curr[el] = curr[el] || { _errors: [] };\n }\n else {\n curr[el] = curr[el] || { _errors: [] };\n curr[el]._errors.push(mapper(issue));\n }\n curr = curr[el];\n i++;\n }\n }\n }\n }\n };\n processError(error);\n return fieldErrors;\n}\nexport function treeifyError(error, mapper = (issue) => issue.message) {\n const result = { errors: [] };\n const processError = (error, path = []) => {\n var _a, _b;\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\" && issue.errors.length) {\n // regular union error\n issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));\n }\n else if (issue.code === \"invalid_key\") {\n processError({ issues: issue.issues }, [...path, ...issue.path]);\n }\n else if (issue.code === \"invalid_element\") {\n processError({ issues: issue.issues }, [...path, ...issue.path]);\n }\n else {\n const fullpath = [...path, ...issue.path];\n if (fullpath.length === 0) {\n result.errors.push(mapper(issue));\n continue;\n }\n let curr = result;\n let i = 0;\n while (i < fullpath.length) {\n const el = fullpath[i];\n const terminal = i === fullpath.length - 1;\n if (typeof el === \"string\") {\n curr.properties ?? (curr.properties = {});\n (_a = curr.properties)[el] ?? (_a[el] = { errors: [] });\n curr = curr.properties[el];\n }\n else {\n curr.items ?? (curr.items = []);\n (_b = curr.items)[el] ?? (_b[el] = { errors: [] });\n curr = curr.items[el];\n }\n if (terminal) {\n curr.errors.push(mapper(issue));\n }\n i++;\n }\n }\n }\n };\n processError(error);\n return result;\n}\n/** Format a ZodError as a human-readable string in the following form.\n *\n * From\n *\n * ```ts\n * ZodError {\n * issues: [\n * {\n * expected: 'string',\n * code: 'invalid_type',\n * path: [ 'username' ],\n * message: 'Invalid input: expected string'\n * },\n * {\n * expected: 'number',\n * code: 'invalid_type',\n * path: [ 'favoriteNumbers', 1 ],\n * message: 'Invalid input: expected number'\n * }\n * ];\n * }\n * ```\n *\n * to\n *\n * ```\n * username\n * ✖ Expected number, received string at \"username\n * favoriteNumbers[0]\n * ✖ Invalid input: expected number\n * ```\n */\nexport function toDotPath(_path) {\n const segs = [];\n const path = _path.map((seg) => (typeof seg === \"object\" ? seg.key : seg));\n for (const seg of path) {\n if (typeof seg === \"number\")\n segs.push(`[${seg}]`);\n else if (typeof seg === \"symbol\")\n segs.push(`[${JSON.stringify(String(seg))}]`);\n else if (/[^\\w$]/.test(seg))\n segs.push(`[${JSON.stringify(seg)}]`);\n else {\n if (segs.length)\n segs.push(\".\");\n segs.push(seg);\n }\n }\n return segs.join(\"\");\n}\nexport function prettifyError(error) {\n const lines = [];\n // sort by path length\n const issues = [...error.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length);\n // Process each issue\n for (const issue of issues) {\n lines.push(`✖ ${issue.message}`);\n if (issue.path?.length)\n lines.push(` → at ${toDotPath(issue.path)}`);\n }\n // Convert Map to formatted string\n return lines.join(\"\\n\");\n}\n"],"names":["util.jsonStringifyReplacer","$constructor","error"],"mappings":";;;;AAEA,MAAM,cAAc,CAAC,MAAM,QAAQ;AAC/B,OAAK,OAAO;AACZ,SAAO,eAAe,MAAM,QAAQ;AAAA,IAChC,OAAO,KAAK;AAAA,IACZ,YAAY;AAAA,EACpB,CAAK;AACD,SAAO,eAAe,MAAM,UAAU;AAAA,IAClC,OAAO;AAAA,IACP,YAAY;AAAA,EACpB,CAAK;AACD,OAAK,UAAU,KAAK,UAAU,KAAKA,KAAAA,uBAA4B,CAAC;AAChE,SAAO,eAAe,MAAM,YAAY;AAAA,IACpC,OAAO,MAAM,KAAK;AAAA,IAClB,YAAY;AAAA,EACpB,CAAK;AACL;AACY,MAAC,YAAYC,KAAAA,aAAa,aAAa,WAAW;AAClD,MAAC,gBAAgBA,KAAAA,aAAa,aAAa,aAAa,EAAE,QAAQ,MAAK,CAAE;AAC9E,SAAS,aAAa,OAAO,SAAS,CAAC,UAAU,MAAM,SAAS;AACnE,QAAM,cAAc,CAAA;AACpB,QAAM,aAAa,CAAA;AACnB,aAAW,OAAO,MAAM,QAAQ;AAC5B,QAAI,IAAI,KAAK,SAAS,GAAG;AACrB,kBAAY,IAAI,KAAK,CAAC,CAAC,IAAI,YAAY,IAAI,KAAK,CAAC,CAAC,KAAK,CAAA;AACvD,kBAAY,IAAI,KAAK,CAAC,CAAC,EAAE,KAAK,OAAO,GAAG,CAAC;AAAA,IAC7C,OACK;AACD,iBAAW,KAAK,OAAO,GAAG,CAAC;AAAA,IAC/B;AAAA,EACJ;AACA,SAAO,EAAE,YAAY,YAAW;AACpC;AACO,SAAS,YAAY,OAAO,SAAS,CAAC,UAAU,MAAM,SAAS;AAClE,QAAM,cAAc,EAAE,SAAS,GAAE;AACjC,QAAM,eAAe,CAACC,QAAO,OAAO,CAAA,MAAO;AACvC,eAAW,SAASA,OAAM,QAAQ;AAC9B,UAAI,MAAM,SAAS,mBAAmB,MAAM,OAAO,QAAQ;AACvD,cAAM,OAAO,IAAI,CAAC,WAAW,aAAa,EAAE,OAAM,GAAI,CAAC,GAAG,MAAM,GAAG,MAAM,IAAI,CAAC,CAAC;AAAA,MACnF,WACS,MAAM,SAAS,eAAe;AACnC,qBAAa,EAAE,QAAQ,MAAM,OAAM,GAAI,CAAC,GAAG,MAAM,GAAG,MAAM,IAAI,CAAC;AAAA,MACnE,WACS,MAAM,SAAS,mBAAmB;AACvC,qBAAa,EAAE,QAAQ,MAAM,OAAM,GAAI,CAAC,GAAG,MAAM,GAAG,MAAM,IAAI,CAAC;AAAA,MACnE,OACK;AACD,cAAM,WAAW,CAAC,GAAG,MAAM,GAAG,MAAM,IAAI;AACxC,YAAI,SAAS,WAAW,GAAG;AACvB,sBAAY,QAAQ,KAAK,OAAO,KAAK,CAAC;AAAA,QAC1C,OACK;AACD,cAAI,OAAO;AACX,cAAI,IAAI;AACR,iBAAO,IAAI,SAAS,QAAQ;AACxB,kBAAM,KAAK,SAAS,CAAC;AACrB,kBAAM,WAAW,MAAM,SAAS,SAAS;AACzC,gBAAI,CAAC,UAAU;AACX,mBAAK,EAAE,IAAI,KAAK,EAAE,KAAK,EAAE,SAAS,GAAE;AAAA,YACxC,OACK;AACD,mBAAK,EAAE,IAAI,KAAK,EAAE,KAAK,EAAE,SAAS,GAAE;AACpC,mBAAK,EAAE,EAAE,QAAQ,KAAK,OAAO,KAAK,CAAC;AAAA,YACvC;AACA,mBAAO,KAAK,EAAE;AACd;AAAA,UACJ;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACA,eAAa,KAAK;AAClB,SAAO;AACX;;;;;","x_google_ignoreList":[0]}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { $constructor } from "./core.js";
|
|
2
|
-
import { jsonStringifyReplacer } from "./util.js";
|
|
3
|
-
const initializer = (inst, def) => {
|
|
4
|
-
inst.name = "$ZodError";
|
|
5
|
-
Object.defineProperty(inst, "_zod", {
|
|
6
|
-
value: inst._zod,
|
|
7
|
-
enumerable: false
|
|
8
|
-
});
|
|
9
|
-
Object.defineProperty(inst, "issues", {
|
|
10
|
-
value: def,
|
|
11
|
-
enumerable: false
|
|
12
|
-
});
|
|
13
|
-
inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
14
|
-
Object.defineProperty(inst, "toString", {
|
|
15
|
-
value: () => inst.message,
|
|
16
|
-
enumerable: false
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
const $ZodError = $constructor("$ZodError", initializer);
|
|
20
|
-
const $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error });
|
|
21
|
-
function flattenError(error, mapper = (issue) => issue.message) {
|
|
22
|
-
const fieldErrors = {};
|
|
23
|
-
const formErrors = [];
|
|
24
|
-
for (const sub of error.issues) {
|
|
25
|
-
if (sub.path.length > 0) {
|
|
26
|
-
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
27
|
-
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
28
|
-
} else {
|
|
29
|
-
formErrors.push(mapper(sub));
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return { formErrors, fieldErrors };
|
|
33
|
-
}
|
|
34
|
-
function formatError(error, mapper = (issue) => issue.message) {
|
|
35
|
-
const fieldErrors = { _errors: [] };
|
|
36
|
-
const processError = (error2, path = []) => {
|
|
37
|
-
for (const issue of error2.issues) {
|
|
38
|
-
if (issue.code === "invalid_union" && issue.errors.length) {
|
|
39
|
-
issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));
|
|
40
|
-
} else if (issue.code === "invalid_key") {
|
|
41
|
-
processError({ issues: issue.issues }, [...path, ...issue.path]);
|
|
42
|
-
} else if (issue.code === "invalid_element") {
|
|
43
|
-
processError({ issues: issue.issues }, [...path, ...issue.path]);
|
|
44
|
-
} else {
|
|
45
|
-
const fullpath = [...path, ...issue.path];
|
|
46
|
-
if (fullpath.length === 0) {
|
|
47
|
-
fieldErrors._errors.push(mapper(issue));
|
|
48
|
-
} else {
|
|
49
|
-
let curr = fieldErrors;
|
|
50
|
-
let i = 0;
|
|
51
|
-
while (i < fullpath.length) {
|
|
52
|
-
const el = fullpath[i];
|
|
53
|
-
const terminal = i === fullpath.length - 1;
|
|
54
|
-
if (!terminal) {
|
|
55
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
56
|
-
} else {
|
|
57
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
58
|
-
curr[el]._errors.push(mapper(issue));
|
|
59
|
-
}
|
|
60
|
-
curr = curr[el];
|
|
61
|
-
i++;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
processError(error);
|
|
68
|
-
return fieldErrors;
|
|
69
|
-
}
|
|
70
|
-
export {
|
|
71
|
-
$ZodError,
|
|
72
|
-
$ZodRealError,
|
|
73
|
-
flattenError,
|
|
74
|
-
formatError
|
|
75
|
-
};
|
|
76
|
-
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sources":["../../../../../../../node_modules/zod/v4/core/errors.js"],"sourcesContent":["import { $constructor } from \"./core.js\";\nimport * as util from \"./util.js\";\nconst initializer = (inst, def) => {\n inst.name = \"$ZodError\";\n Object.defineProperty(inst, \"_zod\", {\n value: inst._zod,\n enumerable: false,\n });\n Object.defineProperty(inst, \"issues\", {\n value: def,\n enumerable: false,\n });\n inst.message = JSON.stringify(def, util.jsonStringifyReplacer, 2);\n Object.defineProperty(inst, \"toString\", {\n value: () => inst.message,\n enumerable: false,\n });\n};\nexport const $ZodError = $constructor(\"$ZodError\", initializer);\nexport const $ZodRealError = $constructor(\"$ZodError\", initializer, { Parent: Error });\nexport function flattenError(error, mapper = (issue) => issue.message) {\n const fieldErrors = {};\n const formErrors = [];\n for (const sub of error.issues) {\n if (sub.path.length > 0) {\n fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];\n fieldErrors[sub.path[0]].push(mapper(sub));\n }\n else {\n formErrors.push(mapper(sub));\n }\n }\n return { formErrors, fieldErrors };\n}\nexport function formatError(error, mapper = (issue) => issue.message) {\n const fieldErrors = { _errors: [] };\n const processError = (error, path = []) => {\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\" && issue.errors.length) {\n issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));\n }\n else if (issue.code === \"invalid_key\") {\n processError({ issues: issue.issues }, [...path, ...issue.path]);\n }\n else if (issue.code === \"invalid_element\") {\n processError({ issues: issue.issues }, [...path, ...issue.path]);\n }\n else {\n const fullpath = [...path, ...issue.path];\n if (fullpath.length === 0) {\n fieldErrors._errors.push(mapper(issue));\n }\n else {\n let curr = fieldErrors;\n let i = 0;\n while (i < fullpath.length) {\n const el = fullpath[i];\n const terminal = i === fullpath.length - 1;\n if (!terminal) {\n curr[el] = curr[el] || { _errors: [] };\n }\n else {\n curr[el] = curr[el] || { _errors: [] };\n curr[el]._errors.push(mapper(issue));\n }\n curr = curr[el];\n i++;\n }\n }\n }\n }\n };\n processError(error);\n return fieldErrors;\n}\nexport function treeifyError(error, mapper = (issue) => issue.message) {\n const result = { errors: [] };\n const processError = (error, path = []) => {\n var _a, _b;\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\" && issue.errors.length) {\n // regular union error\n issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));\n }\n else if (issue.code === \"invalid_key\") {\n processError({ issues: issue.issues }, [...path, ...issue.path]);\n }\n else if (issue.code === \"invalid_element\") {\n processError({ issues: issue.issues }, [...path, ...issue.path]);\n }\n else {\n const fullpath = [...path, ...issue.path];\n if (fullpath.length === 0) {\n result.errors.push(mapper(issue));\n continue;\n }\n let curr = result;\n let i = 0;\n while (i < fullpath.length) {\n const el = fullpath[i];\n const terminal = i === fullpath.length - 1;\n if (typeof el === \"string\") {\n curr.properties ?? (curr.properties = {});\n (_a = curr.properties)[el] ?? (_a[el] = { errors: [] });\n curr = curr.properties[el];\n }\n else {\n curr.items ?? (curr.items = []);\n (_b = curr.items)[el] ?? (_b[el] = { errors: [] });\n curr = curr.items[el];\n }\n if (terminal) {\n curr.errors.push(mapper(issue));\n }\n i++;\n }\n }\n }\n };\n processError(error);\n return result;\n}\n/** Format a ZodError as a human-readable string in the following form.\n *\n * From\n *\n * ```ts\n * ZodError {\n * issues: [\n * {\n * expected: 'string',\n * code: 'invalid_type',\n * path: [ 'username' ],\n * message: 'Invalid input: expected string'\n * },\n * {\n * expected: 'number',\n * code: 'invalid_type',\n * path: [ 'favoriteNumbers', 1 ],\n * message: 'Invalid input: expected number'\n * }\n * ];\n * }\n * ```\n *\n * to\n *\n * ```\n * username\n * ✖ Expected number, received string at \"username\n * favoriteNumbers[0]\n * ✖ Invalid input: expected number\n * ```\n */\nexport function toDotPath(_path) {\n const segs = [];\n const path = _path.map((seg) => (typeof seg === \"object\" ? seg.key : seg));\n for (const seg of path) {\n if (typeof seg === \"number\")\n segs.push(`[${seg}]`);\n else if (typeof seg === \"symbol\")\n segs.push(`[${JSON.stringify(String(seg))}]`);\n else if (/[^\\w$]/.test(seg))\n segs.push(`[${JSON.stringify(seg)}]`);\n else {\n if (segs.length)\n segs.push(\".\");\n segs.push(seg);\n }\n }\n return segs.join(\"\");\n}\nexport function prettifyError(error) {\n const lines = [];\n // sort by path length\n const issues = [...error.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length);\n // Process each issue\n for (const issue of issues) {\n lines.push(`✖ ${issue.message}`);\n if (issue.path?.length)\n lines.push(` → at ${toDotPath(issue.path)}`);\n }\n // Convert Map to formatted string\n return lines.join(\"\\n\");\n}\n"],"names":["util.jsonStringifyReplacer","error"],"mappings":";;AAEA,MAAM,cAAc,CAAC,MAAM,QAAQ;AAC/B,OAAK,OAAO;AACZ,SAAO,eAAe,MAAM,QAAQ;AAAA,IAChC,OAAO,KAAK;AAAA,IACZ,YAAY;AAAA,EACpB,CAAK;AACD,SAAO,eAAe,MAAM,UAAU;AAAA,IAClC,OAAO;AAAA,IACP,YAAY;AAAA,EACpB,CAAK;AACD,OAAK,UAAU,KAAK,UAAU,KAAKA,uBAA4B,CAAC;AAChE,SAAO,eAAe,MAAM,YAAY;AAAA,IACpC,OAAO,MAAM,KAAK;AAAA,IAClB,YAAY;AAAA,EACpB,CAAK;AACL;AACY,MAAC,YAAY,aAAa,aAAa,WAAW;AAClD,MAAC,gBAAgB,aAAa,aAAa,aAAa,EAAE,QAAQ,MAAK,CAAE;AAC9E,SAAS,aAAa,OAAO,SAAS,CAAC,UAAU,MAAM,SAAS;AACnE,QAAM,cAAc,CAAA;AACpB,QAAM,aAAa,CAAA;AACnB,aAAW,OAAO,MAAM,QAAQ;AAC5B,QAAI,IAAI,KAAK,SAAS,GAAG;AACrB,kBAAY,IAAI,KAAK,CAAC,CAAC,IAAI,YAAY,IAAI,KAAK,CAAC,CAAC,KAAK,CAAA;AACvD,kBAAY,IAAI,KAAK,CAAC,CAAC,EAAE,KAAK,OAAO,GAAG,CAAC;AAAA,IAC7C,OACK;AACD,iBAAW,KAAK,OAAO,GAAG,CAAC;AAAA,IAC/B;AAAA,EACJ;AACA,SAAO,EAAE,YAAY,YAAW;AACpC;AACO,SAAS,YAAY,OAAO,SAAS,CAAC,UAAU,MAAM,SAAS;AAClE,QAAM,cAAc,EAAE,SAAS,GAAE;AACjC,QAAM,eAAe,CAACC,QAAO,OAAO,CAAA,MAAO;AACvC,eAAW,SAASA,OAAM,QAAQ;AAC9B,UAAI,MAAM,SAAS,mBAAmB,MAAM,OAAO,QAAQ;AACvD,cAAM,OAAO,IAAI,CAAC,WAAW,aAAa,EAAE,OAAM,GAAI,CAAC,GAAG,MAAM,GAAG,MAAM,IAAI,CAAC,CAAC;AAAA,MACnF,WACS,MAAM,SAAS,eAAe;AACnC,qBAAa,EAAE,QAAQ,MAAM,OAAM,GAAI,CAAC,GAAG,MAAM,GAAG,MAAM,IAAI,CAAC;AAAA,MACnE,WACS,MAAM,SAAS,mBAAmB;AACvC,qBAAa,EAAE,QAAQ,MAAM,OAAM,GAAI,CAAC,GAAG,MAAM,GAAG,MAAM,IAAI,CAAC;AAAA,MACnE,OACK;AACD,cAAM,WAAW,CAAC,GAAG,MAAM,GAAG,MAAM,IAAI;AACxC,YAAI,SAAS,WAAW,GAAG;AACvB,sBAAY,QAAQ,KAAK,OAAO,KAAK,CAAC;AAAA,QAC1C,OACK;AACD,cAAI,OAAO;AACX,cAAI,IAAI;AACR,iBAAO,IAAI,SAAS,QAAQ;AACxB,kBAAM,KAAK,SAAS,CAAC;AACrB,kBAAM,WAAW,MAAM,SAAS,SAAS;AACzC,gBAAI,CAAC,UAAU;AACX,mBAAK,EAAE,IAAI,KAAK,EAAE,KAAK,EAAE,SAAS,GAAE;AAAA,YACxC,OACK;AACD,mBAAK,EAAE,IAAI,KAAK,EAAE,KAAK,EAAE,SAAS,GAAE;AACpC,mBAAK,EAAE,EAAE,QAAQ,KAAK,OAAO,KAAK,CAAC;AAAA,YACvC;AACA,mBAAO,KAAK,EAAE;AACd;AAAA,UACJ;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACA,eAAa,KAAK;AAClB,SAAO;AACX;","x_google_ignoreList":[0]}
|
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const toJsonSchema = require("./to-json-schema.cjs");
|
|
4
|
-
const util = require("./util.cjs");
|
|
5
|
-
const formatMap = {
|
|
6
|
-
guid: "uuid",
|
|
7
|
-
url: "uri",
|
|
8
|
-
datetime: "date-time",
|
|
9
|
-
json_string: "json-string",
|
|
10
|
-
regex: ""
|
|
11
|
-
// do not set
|
|
12
|
-
};
|
|
13
|
-
const stringProcessor = (schema, ctx, _json, _params) => {
|
|
14
|
-
const json = _json;
|
|
15
|
-
json.type = "string";
|
|
16
|
-
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
17
|
-
if (typeof minimum === "number")
|
|
18
|
-
json.minLength = minimum;
|
|
19
|
-
if (typeof maximum === "number")
|
|
20
|
-
json.maxLength = maximum;
|
|
21
|
-
if (format) {
|
|
22
|
-
json.format = formatMap[format] ?? format;
|
|
23
|
-
if (json.format === "")
|
|
24
|
-
delete json.format;
|
|
25
|
-
if (format === "time") {
|
|
26
|
-
delete json.format;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
if (contentEncoding)
|
|
30
|
-
json.contentEncoding = contentEncoding;
|
|
31
|
-
if (patterns && patterns.size > 0) {
|
|
32
|
-
const regexes = [...patterns];
|
|
33
|
-
if (regexes.length === 1)
|
|
34
|
-
json.pattern = regexes[0].source;
|
|
35
|
-
else if (regexes.length > 1) {
|
|
36
|
-
json.allOf = [
|
|
37
|
-
...regexes.map((regex) => ({
|
|
38
|
-
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
39
|
-
pattern: regex.source
|
|
40
|
-
}))
|
|
41
|
-
];
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
const numberProcessor = (schema, ctx, _json, _params) => {
|
|
46
|
-
const json = _json;
|
|
47
|
-
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
48
|
-
if (typeof format === "string" && format.includes("int"))
|
|
49
|
-
json.type = "integer";
|
|
50
|
-
else
|
|
51
|
-
json.type = "number";
|
|
52
|
-
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
53
|
-
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
54
|
-
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
55
|
-
if (exMin) {
|
|
56
|
-
if (legacy) {
|
|
57
|
-
json.minimum = exclusiveMinimum;
|
|
58
|
-
json.exclusiveMinimum = true;
|
|
59
|
-
} else {
|
|
60
|
-
json.exclusiveMinimum = exclusiveMinimum;
|
|
61
|
-
}
|
|
62
|
-
} else if (typeof minimum === "number") {
|
|
63
|
-
json.minimum = minimum;
|
|
64
|
-
}
|
|
65
|
-
if (exMax) {
|
|
66
|
-
if (legacy) {
|
|
67
|
-
json.maximum = exclusiveMaximum;
|
|
68
|
-
json.exclusiveMaximum = true;
|
|
69
|
-
} else {
|
|
70
|
-
json.exclusiveMaximum = exclusiveMaximum;
|
|
71
|
-
}
|
|
72
|
-
} else if (typeof maximum === "number") {
|
|
73
|
-
json.maximum = maximum;
|
|
74
|
-
}
|
|
75
|
-
if (typeof multipleOf === "number")
|
|
76
|
-
json.multipleOf = multipleOf;
|
|
77
|
-
};
|
|
78
|
-
const booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
79
|
-
json.type = "boolean";
|
|
80
|
-
};
|
|
81
|
-
const neverProcessor = (_schema, _ctx, json, _params) => {
|
|
82
|
-
json.not = {};
|
|
83
|
-
};
|
|
84
|
-
const unknownProcessor = (_schema, _ctx, _json, _params) => {
|
|
85
|
-
};
|
|
86
|
-
const enumProcessor = (schema, _ctx, json, _params) => {
|
|
87
|
-
const def = schema._zod.def;
|
|
88
|
-
const values = util.getEnumValues(def.entries);
|
|
89
|
-
if (values.every((v) => typeof v === "number"))
|
|
90
|
-
json.type = "number";
|
|
91
|
-
if (values.every((v) => typeof v === "string"))
|
|
92
|
-
json.type = "string";
|
|
93
|
-
json.enum = values;
|
|
94
|
-
};
|
|
95
|
-
const literalProcessor = (schema, ctx, json, _params) => {
|
|
96
|
-
const def = schema._zod.def;
|
|
97
|
-
const vals = [];
|
|
98
|
-
for (const val of def.values) {
|
|
99
|
-
if (val === void 0) {
|
|
100
|
-
if (ctx.unrepresentable === "throw") {
|
|
101
|
-
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
102
|
-
}
|
|
103
|
-
} else if (typeof val === "bigint") {
|
|
104
|
-
if (ctx.unrepresentable === "throw") {
|
|
105
|
-
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
106
|
-
} else {
|
|
107
|
-
vals.push(Number(val));
|
|
108
|
-
}
|
|
109
|
-
} else {
|
|
110
|
-
vals.push(val);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
if (vals.length === 0) ;
|
|
114
|
-
else if (vals.length === 1) {
|
|
115
|
-
const val = vals[0];
|
|
116
|
-
json.type = val === null ? "null" : typeof val;
|
|
117
|
-
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
118
|
-
json.enum = [val];
|
|
119
|
-
} else {
|
|
120
|
-
json.const = val;
|
|
121
|
-
}
|
|
122
|
-
} else {
|
|
123
|
-
if (vals.every((v) => typeof v === "number"))
|
|
124
|
-
json.type = "number";
|
|
125
|
-
if (vals.every((v) => typeof v === "string"))
|
|
126
|
-
json.type = "string";
|
|
127
|
-
if (vals.every((v) => typeof v === "boolean"))
|
|
128
|
-
json.type = "boolean";
|
|
129
|
-
if (vals.every((v) => v === null))
|
|
130
|
-
json.type = "null";
|
|
131
|
-
json.enum = vals;
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
const customProcessor = (_schema, ctx, _json, _params) => {
|
|
135
|
-
if (ctx.unrepresentable === "throw") {
|
|
136
|
-
throw new Error("Custom types cannot be represented in JSON Schema");
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
const transformProcessor = (_schema, ctx, _json, _params) => {
|
|
140
|
-
if (ctx.unrepresentable === "throw") {
|
|
141
|
-
throw new Error("Transforms cannot be represented in JSON Schema");
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
const arrayProcessor = (schema, ctx, _json, params) => {
|
|
145
|
-
const json = _json;
|
|
146
|
-
const def = schema._zod.def;
|
|
147
|
-
const { minimum, maximum } = schema._zod.bag;
|
|
148
|
-
if (typeof minimum === "number")
|
|
149
|
-
json.minItems = minimum;
|
|
150
|
-
if (typeof maximum === "number")
|
|
151
|
-
json.maxItems = maximum;
|
|
152
|
-
json.type = "array";
|
|
153
|
-
json.items = toJsonSchema.process(def.element, ctx, {
|
|
154
|
-
...params,
|
|
155
|
-
path: [...params.path, "items"]
|
|
156
|
-
});
|
|
157
|
-
};
|
|
158
|
-
const objectProcessor = (schema, ctx, _json, params) => {
|
|
159
|
-
var _a;
|
|
160
|
-
const json = _json;
|
|
161
|
-
const def = schema._zod.def;
|
|
162
|
-
json.type = "object";
|
|
163
|
-
json.properties = {};
|
|
164
|
-
const shape = def.shape;
|
|
165
|
-
for (const key in shape) {
|
|
166
|
-
json.properties[key] = toJsonSchema.process(shape[key], ctx, {
|
|
167
|
-
...params,
|
|
168
|
-
path: [...params.path, "properties", key]
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
const allKeys = new Set(Object.keys(shape));
|
|
172
|
-
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
173
|
-
const v = def.shape[key]._zod;
|
|
174
|
-
if (ctx.io === "input") {
|
|
175
|
-
return v.optin === void 0;
|
|
176
|
-
} else {
|
|
177
|
-
return v.optout === void 0;
|
|
178
|
-
}
|
|
179
|
-
}));
|
|
180
|
-
if (requiredKeys.size > 0) {
|
|
181
|
-
json.required = Array.from(requiredKeys);
|
|
182
|
-
}
|
|
183
|
-
if (((_a = def.catchall) == null ? void 0 : _a._zod.def.type) === "never") {
|
|
184
|
-
json.additionalProperties = false;
|
|
185
|
-
} else if (!def.catchall) {
|
|
186
|
-
if (ctx.io === "output")
|
|
187
|
-
json.additionalProperties = false;
|
|
188
|
-
} else if (def.catchall) {
|
|
189
|
-
json.additionalProperties = toJsonSchema.process(def.catchall, ctx, {
|
|
190
|
-
...params,
|
|
191
|
-
path: [...params.path, "additionalProperties"]
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
const unionProcessor = (schema, ctx, json, params) => {
|
|
196
|
-
const def = schema._zod.def;
|
|
197
|
-
const isExclusive = def.inclusive === false;
|
|
198
|
-
const options = def.options.map((x, i) => toJsonSchema.process(x, ctx, {
|
|
199
|
-
...params,
|
|
200
|
-
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
|
|
201
|
-
}));
|
|
202
|
-
if (isExclusive) {
|
|
203
|
-
json.oneOf = options;
|
|
204
|
-
} else {
|
|
205
|
-
json.anyOf = options;
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
const intersectionProcessor = (schema, ctx, json, params) => {
|
|
209
|
-
const def = schema._zod.def;
|
|
210
|
-
const a = toJsonSchema.process(def.left, ctx, {
|
|
211
|
-
...params,
|
|
212
|
-
path: [...params.path, "allOf", 0]
|
|
213
|
-
});
|
|
214
|
-
const b = toJsonSchema.process(def.right, ctx, {
|
|
215
|
-
...params,
|
|
216
|
-
path: [...params.path, "allOf", 1]
|
|
217
|
-
});
|
|
218
|
-
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
219
|
-
const allOf = [
|
|
220
|
-
...isSimpleIntersection(a) ? a.allOf : [a],
|
|
221
|
-
...isSimpleIntersection(b) ? b.allOf : [b]
|
|
222
|
-
];
|
|
223
|
-
json.allOf = allOf;
|
|
224
|
-
};
|
|
225
|
-
const nullableProcessor = (schema, ctx, json, params) => {
|
|
226
|
-
const def = schema._zod.def;
|
|
227
|
-
const inner = toJsonSchema.process(def.innerType, ctx, params);
|
|
228
|
-
const seen = ctx.seen.get(schema);
|
|
229
|
-
if (ctx.target === "openapi-3.0") {
|
|
230
|
-
seen.ref = def.innerType;
|
|
231
|
-
json.nullable = true;
|
|
232
|
-
} else {
|
|
233
|
-
json.anyOf = [inner, { type: "null" }];
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
const nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
237
|
-
const def = schema._zod.def;
|
|
238
|
-
toJsonSchema.process(def.innerType, ctx, params);
|
|
239
|
-
const seen = ctx.seen.get(schema);
|
|
240
|
-
seen.ref = def.innerType;
|
|
241
|
-
};
|
|
242
|
-
const defaultProcessor = (schema, ctx, json, params) => {
|
|
243
|
-
const def = schema._zod.def;
|
|
244
|
-
toJsonSchema.process(def.innerType, ctx, params);
|
|
245
|
-
const seen = ctx.seen.get(schema);
|
|
246
|
-
seen.ref = def.innerType;
|
|
247
|
-
json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
248
|
-
};
|
|
249
|
-
const prefaultProcessor = (schema, ctx, json, params) => {
|
|
250
|
-
const def = schema._zod.def;
|
|
251
|
-
toJsonSchema.process(def.innerType, ctx, params);
|
|
252
|
-
const seen = ctx.seen.get(schema);
|
|
253
|
-
seen.ref = def.innerType;
|
|
254
|
-
if (ctx.io === "input")
|
|
255
|
-
json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
256
|
-
};
|
|
257
|
-
const catchProcessor = (schema, ctx, json, params) => {
|
|
258
|
-
const def = schema._zod.def;
|
|
259
|
-
toJsonSchema.process(def.innerType, ctx, params);
|
|
260
|
-
const seen = ctx.seen.get(schema);
|
|
261
|
-
seen.ref = def.innerType;
|
|
262
|
-
let catchValue;
|
|
263
|
-
try {
|
|
264
|
-
catchValue = def.catchValue(void 0);
|
|
265
|
-
} catch {
|
|
266
|
-
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
267
|
-
}
|
|
268
|
-
json.default = catchValue;
|
|
269
|
-
};
|
|
270
|
-
const pipeProcessor = (schema, ctx, _json, params) => {
|
|
271
|
-
const def = schema._zod.def;
|
|
272
|
-
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
273
|
-
const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
|
|
274
|
-
toJsonSchema.process(innerType, ctx, params);
|
|
275
|
-
const seen = ctx.seen.get(schema);
|
|
276
|
-
seen.ref = innerType;
|
|
277
|
-
};
|
|
278
|
-
const readonlyProcessor = (schema, ctx, json, params) => {
|
|
279
|
-
const def = schema._zod.def;
|
|
280
|
-
toJsonSchema.process(def.innerType, ctx, params);
|
|
281
|
-
const seen = ctx.seen.get(schema);
|
|
282
|
-
seen.ref = def.innerType;
|
|
283
|
-
json.readOnly = true;
|
|
284
|
-
};
|
|
285
|
-
const optionalProcessor = (schema, ctx, _json, params) => {
|
|
286
|
-
const def = schema._zod.def;
|
|
287
|
-
toJsonSchema.process(def.innerType, ctx, params);
|
|
288
|
-
const seen = ctx.seen.get(schema);
|
|
289
|
-
seen.ref = def.innerType;
|
|
290
|
-
};
|
|
291
|
-
exports.arrayProcessor = arrayProcessor;
|
|
292
|
-
exports.booleanProcessor = booleanProcessor;
|
|
293
|
-
exports.catchProcessor = catchProcessor;
|
|
294
|
-
exports.customProcessor = customProcessor;
|
|
295
|
-
exports.defaultProcessor = defaultProcessor;
|
|
296
|
-
exports.enumProcessor = enumProcessor;
|
|
297
|
-
exports.intersectionProcessor = intersectionProcessor;
|
|
298
|
-
exports.literalProcessor = literalProcessor;
|
|
299
|
-
exports.neverProcessor = neverProcessor;
|
|
300
|
-
exports.nonoptionalProcessor = nonoptionalProcessor;
|
|
301
|
-
exports.nullableProcessor = nullableProcessor;
|
|
302
|
-
exports.numberProcessor = numberProcessor;
|
|
303
|
-
exports.objectProcessor = objectProcessor;
|
|
304
|
-
exports.optionalProcessor = optionalProcessor;
|
|
305
|
-
exports.pipeProcessor = pipeProcessor;
|
|
306
|
-
exports.prefaultProcessor = prefaultProcessor;
|
|
307
|
-
exports.readonlyProcessor = readonlyProcessor;
|
|
308
|
-
exports.stringProcessor = stringProcessor;
|
|
309
|
-
exports.transformProcessor = transformProcessor;
|
|
310
|
-
exports.unionProcessor = unionProcessor;
|
|
311
|
-
exports.unknownProcessor = unknownProcessor;
|
|
312
|
-
//# sourceMappingURL=json-schema-processors.cjs.map
|