@shopify/cli 3.69.4 → 3.71.0
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/{dist/assets/cli-ruby/LICENSE → LICENSE} +0 -2
- package/dist/{lib-CPSRXLFM.js → chunk-2HGYYNE5.js} +5 -2
- package/dist/chunk-3AOK7V27.js +3792 -0
- package/dist/{chunk-PNN7RS7Y.js → chunk-3NSN5Z4N.js} +100 -11
- package/dist/{chunk-EJGKAHVK.js → chunk-455HYBGX.js} +3 -3
- package/dist/{chunk-BMTELIUS.js → chunk-4G7SL7SU.js} +4 -4
- package/dist/{chunk-OWCYMR5Y.js → chunk-5F2WGMCL.js} +4 -4
- package/dist/{chunk-2NCWYVM4.js → chunk-5JZ5AGAQ.js} +652 -654
- package/dist/chunk-5OHM64KO.js +104 -0
- package/dist/{chunk-F54UWMGQ.js → chunk-675SL4FV.js} +3 -3
- package/dist/{chunk-WHP4CEBJ.js → chunk-AXNBVGJC.js} +20 -25
- package/dist/{chunk-KM4TMAQ2.js → chunk-BEVHUPQZ.js} +13 -9
- package/dist/{chunk-6XKWVDB6.js → chunk-CBBS4CV7.js} +3 -3
- package/dist/{chunk-YNL4XNMX.js → chunk-GJ7EWRH4.js} +4 -4
- package/dist/{chunk-N3U3EHOE.js → chunk-GV72NRZZ.js} +3 -3
- package/dist/{chunk-ZGHNMRBX.js → chunk-HSTSRNLJ.js} +121 -66
- package/dist/{chunk-ISDSND4L.js → chunk-IGH7XTG6.js} +2 -2
- package/dist/chunk-IJG6JLEF.js +28 -0
- package/dist/chunk-IJSEKDUR.js +28 -0
- package/dist/{chunk-VQ3R5DHS.js → chunk-JTWM7VKM.js} +4 -4
- package/dist/{chunk-VHEJRU4K.js → chunk-K6UZ5NEO.js} +7 -7
- package/dist/{chunk-JHVVETTP.js → chunk-KBDH6IDK.js} +19 -11
- package/dist/{chunk-7B5FNNVB.js → chunk-KJJGDUT2.js} +4 -4
- package/dist/{chunk-334DJQUN.js → chunk-KOHDI3KN.js} +7 -3
- package/dist/{chunk-MX4RJDBM.js → chunk-KYB6A4PE.js} +1 -2
- package/dist/{chunk-ORDEDRCZ.js → chunk-LMK5VFZE.js} +3 -3
- package/dist/{chunk-2JRUKBKX.js → chunk-LSQU4XJZ.js} +32 -218
- package/dist/{chunk-YPWRQ5AU.js → chunk-MG6EVKFQ.js} +3 -3
- package/dist/{chunk-K3GASX6Y.js → chunk-MHLSPYVQ.js} +3 -3
- package/dist/{chunk-27ILOE3X.js → chunk-OJOHMVV7.js} +6 -6
- package/dist/{chunk-7NPDPZ22.js → chunk-PDNTPE4N.js} +4355 -5172
- package/dist/{chunk-Y3MSANL5.js → chunk-RQJF2YRM.js} +2 -2
- package/dist/{chunk-S2IXL3EU.js → chunk-RXYE2GI3.js} +2 -2
- package/dist/chunk-SVWWKVUI.js +165 -0
- package/dist/{chunk-BRO6DC7D.js → chunk-T2BV6JEL.js} +18 -24
- package/dist/{chunk-6IATSQ3X.js → chunk-UDRKRTS4.js} +3 -3
- package/dist/{chunk-RYTZQSHH.js → chunk-VNZQKLLO.js} +2 -2
- package/dist/{chunk-UQUVQV3X.js → chunk-WLNYFGYY.js} +4 -4
- package/dist/{chunk-A3JXD7N7.js → chunk-WNDN5FAY.js} +4 -4
- package/dist/chunk-WZW6P6AO.js +105 -0
- package/dist/{chunk-TLZ4ZBH3.js → chunk-XOSZOZ3F.js} +7 -5
- package/dist/{chunk-TV5WOUSX.js → chunk-YNXUXQFM.js} +2 -2
- package/dist/{chunk-HV364V3E.js → chunk-YZA6BRN3.js} +2 -2
- package/dist/cli/commands/auth/logout.js +20 -20
- package/dist/cli/commands/auth/logout.test.js +22 -22
- package/dist/cli/commands/{demo/print-ai-prompt.d.ts → cache/clear.d.ts} +1 -1
- package/dist/cli/commands/cache/clear.js +33 -0
- package/dist/cli/commands/debug/command-flags.js +19 -19
- package/dist/cli/commands/docs/generate.js +19 -19
- package/dist/cli/commands/docs/generate.test.js +20 -20
- package/dist/cli/commands/help.js +19 -19
- package/dist/cli/commands/kitchen-sink/async.js +20 -20
- package/dist/cli/commands/kitchen-sink/async.test.js +21 -21
- package/dist/cli/commands/kitchen-sink/index.js +22 -22
- package/dist/cli/commands/kitchen-sink/index.test.js +25 -25
- package/dist/cli/commands/kitchen-sink/prompts.js +20 -20
- package/dist/cli/commands/kitchen-sink/prompts.test.js +21 -21
- package/dist/cli/commands/kitchen-sink/static.js +20 -20
- package/dist/cli/commands/kitchen-sink/static.test.js +21 -21
- package/dist/cli/commands/notifications/generate.d.ts +6 -0
- package/dist/cli/commands/notifications/generate.js +34 -0
- package/dist/cli/commands/{demo/catalog.d.ts → notifications/list.d.ts} +1 -1
- package/dist/cli/commands/notifications/list.js +34 -0
- package/dist/cli/commands/search.js +20 -20
- package/dist/cli/commands/upgrade.js +20 -20
- package/dist/cli/commands/upgrade.test.js +1 -2
- package/dist/cli/commands/version.js +20 -20
- package/dist/cli/commands/version.test.js +21 -21
- package/dist/cli/services/commands/notifications.d.ts +2 -0
- package/dist/cli/services/commands/notifications.js +29 -0
- package/dist/cli/services/commands/search.js +9 -10
- package/dist/cli/services/commands/search.test.js +10 -11
- package/dist/cli/services/commands/version.js +10 -11
- package/dist/cli/services/commands/version.test.js +12 -13
- package/dist/cli/services/kitchen-sink/async.js +9 -10
- package/dist/cli/services/kitchen-sink/prompts.js +9 -10
- package/dist/cli/services/kitchen-sink/static.js +9 -10
- package/dist/cli/services/upgrade.js +10 -11
- package/dist/cli/services/upgrade.test.js +15 -16
- package/dist/configs/all.yml +15 -0
- package/dist/configs/recommended.yml +9 -0
- package/dist/{custom-oclif-loader-TBU3GENB.js → custom-oclif-loader-U43F5H7M.js} +13 -14
- package/dist/data/filters.json +137 -19
- package/dist/data/latest.json +1 -1
- package/dist/data/manifest_theme.json +1 -0
- package/dist/data/objects.json +203 -1625
- package/dist/data/preset_blocks.json +78 -0
- package/dist/data/section.json +1 -42
- package/dist/data/shopify_system_translations.json +58 -2
- package/dist/data/tags.json +10 -0
- package/dist/data/theme_block.json +1 -19
- package/dist/{del-7ZS2Z64N.js → del-K5ZJEWTD.js} +3 -3
- package/dist/{error-handler-IL72ACEX.js → error-handler-GSXEX5NX.js} +17 -18
- package/dist/hooks/postrun.js +14 -15
- package/dist/hooks/prerun.js +16 -19
- package/dist/index.js +34605 -31345
- package/dist/lib-PPXZBVZX.js +6 -0
- package/dist/{lib-JHUCJTHS.js → lib-XYCLX35G.js} +5 -5
- package/dist/{local-OE2I46PA.js → local-STC6NEOC.js} +11 -10
- package/dist/{morph-UIXWG2S7.js → morph-SEECJQ2W.js} +3 -3
- package/dist/{node-SDBKEHIV.js → node-I54BR73K.js} +21 -21
- package/dist/{node-package-manager-LPDV6HZY.js → node-package-manager-DUWCXRNZ.js} +10 -11
- package/dist/{out-ZDSLKX4N.js → out-MHEKZJWS.js} +2 -2
- package/dist/{path-T2RCZTRE.js → path-5SZGULBR.js} +2 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{ui-WB42ZV4M.js → ui-GZXRHEXO.js} +9 -10
- package/dist/{workerd-YWTPL4SF.js → workerd-WQ2CUXFS.js} +23 -23
- package/oclif.manifest.json +393 -223
- package/package.json +7 -8
- package/assets/demo-catalog.json +0 -655
- package/dist/assets/cli-ruby/.devcontainer.json +0 -5
- package/dist/assets/cli-ruby/.rubocop.yml +0 -102
- package/dist/assets/cli-ruby/.rubocop_todo.yml +0 -24
- package/dist/assets/cli-ruby/CHANGELOG.md +0 -634
- package/dist/assets/cli-ruby/CONTRIBUTING.md +0 -3
- package/dist/assets/cli-ruby/Codespace.dockerfile +0 -35
- package/dist/assets/cli-ruby/Gemfile +0 -32
- package/dist/assets/cli-ruby/README.md +0 -30
- package/dist/assets/cli-ruby/Rakefile +0 -167
- package/dist/assets/cli-ruby/SECURITY.md +0 -59
- package/dist/assets/cli-ruby/Tests.dockerfile +0 -35
- package/dist/assets/cli-ruby/assets/logo.png +0 -0
- package/dist/assets/cli-ruby/bin/console +0 -11
- package/dist/assets/cli-ruby/bin/load_shopify.rb +0 -22
- package/dist/assets/cli-ruby/bin/shopify +0 -67
- package/dist/assets/cli-ruby/bin/shopify.bat +0 -3
- package/dist/assets/cli-ruby/bin/update-deps +0 -97
- package/dist/assets/cli-ruby/dev.yml +0 -29
- package/dist/assets/cli-ruby/docs/README.md +0 -13
- package/dist/assets/cli-ruby/docs/contributors/testing.md +0 -27
- package/dist/assets/cli-ruby/docs/users/installation.md +0 -3
- package/dist/assets/cli-ruby/docs/users/migrate-from-themekit.md +0 -18
- package/dist/assets/cli-ruby/ext/javy/hashes/javy-arm-macos-v0.1.0.gz.sha256 +0 -1
- package/dist/assets/cli-ruby/ext/javy/hashes/javy-arm-macos-v0.2.0.gz.sha256 +0 -1
- package/dist/assets/cli-ruby/ext/javy/hashes/javy-arm-macos-v0.2.1.gz.sha256 +0 -1
- package/dist/assets/cli-ruby/ext/javy/hashes/javy-arm-macos-v0.3.0.gz.sha256 +0 -1
- package/dist/assets/cli-ruby/ext/javy/hashes/javy-x86_64-linux-v0.1.0.gz.sha256 +0 -1
- package/dist/assets/cli-ruby/ext/javy/hashes/javy-x86_64-linux-v0.2.0.gz.sha256 +0 -1
- package/dist/assets/cli-ruby/ext/javy/hashes/javy-x86_64-linux-v0.2.1.gz.sha256 +0 -1
- package/dist/assets/cli-ruby/ext/javy/hashes/javy-x86_64-linux-v0.3.0.gz.sha256 +0 -1
- package/dist/assets/cli-ruby/ext/javy/hashes/javy-x86_64-macos-v0.1.0.gz.sha256 +0 -1
- package/dist/assets/cli-ruby/ext/javy/hashes/javy-x86_64-macos-v0.2.0.gz.sha256 +0 -1
- package/dist/assets/cli-ruby/ext/javy/hashes/javy-x86_64-macos-v0.2.1.gz.sha256 +0 -1
- package/dist/assets/cli-ruby/ext/javy/hashes/javy-x86_64-macos-v0.3.0.gz.sha256 +0 -1
- package/dist/assets/cli-ruby/ext/javy/hashes/javy-x86_64-windows-v0.1.0.gz.sha256 +0 -1
- package/dist/assets/cli-ruby/ext/javy/hashes/javy-x86_64-windows-v0.2.0.gz.sha256 +0 -1
- package/dist/assets/cli-ruby/ext/javy/hashes/javy-x86_64-windows-v0.2.1.gz.sha256 +0 -1
- package/dist/assets/cli-ruby/ext/javy/hashes/javy-x86_64-windows-v0.3.0.gz.sha256 +0 -1
- package/dist/assets/cli-ruby/ext/javy/javy.rb +0 -204
- package/dist/assets/cli-ruby/ext/javy/version +0 -1
- package/dist/assets/cli-ruby/ext/shopify-extensions/extconf.rb +0 -21
- package/dist/assets/cli-ruby/ext/shopify-extensions/shopify_extensions.rb +0 -152
- package/dist/assets/cli-ruby/ext/shopify-extensions/version +0 -1
- package/dist/assets/cli-ruby/features/support/assertions.rb +0 -17
- package/dist/assets/cli-ruby/features/support/cli.rb +0 -7
- package/dist/assets/cli-ruby/features/support/process.rb +0 -27
- package/dist/assets/cli-ruby/features/support/requires.rb +0 -3
- package/dist/assets/cli-ruby/lib/docgen/class_template.md.erb +0 -81
- package/dist/assets/cli-ruby/lib/docgen/index_template.md.erb +0 -5
- package/dist/assets/cli-ruby/lib/docgen/markdown.rb +0 -101
- package/dist/assets/cli-ruby/lib/graphql/admin_introspection.graphql +0 -87
- package/dist/assets/cli-ruby/lib/graphql/all_organizations.graphql +0 -19
- package/dist/assets/cli-ruby/lib/graphql/all_orgs_with_apps.graphql +0 -30
- package/dist/assets/cli-ruby/lib/graphql/api_versions.graphql +0 -6
- package/dist/assets/cli-ruby/lib/graphql/convert_dev_to_test_store.graphql +0 -10
- package/dist/assets/cli-ruby/lib/graphql/create_app.graphql +0 -20
- package/dist/assets/cli-ruby/lib/graphql/create_customer.graphql +0 -9
- package/dist/assets/cli-ruby/lib/graphql/create_draft_order.graphql +0 -8
- package/dist/assets/cli-ruby/lib/graphql/create_product.graphql +0 -9
- package/dist/assets/cli-ruby/lib/graphql/extension_create.graphql +0 -37
- package/dist/assets/cli-ruby/lib/graphql/extension_update_draft.graphql +0 -19
- package/dist/assets/cli-ruby/lib/graphql/fetch_specifications.graphql +0 -14
- package/dist/assets/cli-ruby/lib/graphql/find_organization.graphql +0 -18
- package/dist/assets/cli-ruby/lib/graphql/find_organization_with_apps.graphql +0 -20
- package/dist/assets/cli-ruby/lib/graphql/get_app_by_api_key.graphql +0 -9
- package/dist/assets/cli-ruby/lib/graphql/get_app_urls.graphql +0 -6
- package/dist/assets/cli-ruby/lib/graphql/get_extension_registrations.graphql +0 -28
- package/dist/assets/cli-ruby/lib/graphql/get_variant_id.graphql +0 -16
- package/dist/assets/cli-ruby/lib/graphql/update_dashboard_urls.graphql +0 -8
- package/dist/assets/cli-ruby/lib/project_types/extension/cli.rb +0 -75
- package/dist/assets/cli-ruby/lib/project_types/extension/commands/extension_command.rb +0 -29
- package/dist/assets/cli-ruby/lib/project_types/extension/commands/serve.rb +0 -164
- package/dist/assets/cli-ruby/lib/project_types/extension/errors.rb +0 -9
- package/dist/assets/cli-ruby/lib/project_types/extension/extension_project.rb +0 -151
- package/dist/assets/cli-ruby/lib/project_types/extension/extension_project_keys.rb +0 -12
- package/dist/assets/cli-ruby/lib/project_types/extension/features/argo.rb +0 -50
- package/dist/assets/cli-ruby/lib/project_types/extension/features/argo_config.rb +0 -59
- package/dist/assets/cli-ruby/lib/project_types/extension/features/argo_dependencies.rb +0 -28
- package/dist/assets/cli-ruby/lib/project_types/extension/features/argo_runtime.rb +0 -15
- package/dist/assets/cli-ruby/lib/project_types/extension/features/argo_serve.rb +0 -115
- package/dist/assets/cli-ruby/lib/project_types/extension/features/argo_setup.rb +0 -54
- package/dist/assets/cli-ruby/lib/project_types/extension/features/argo_setup_step.rb +0 -31
- package/dist/assets/cli-ruby/lib/project_types/extension/features/argo_setup_steps.rb +0 -51
- package/dist/assets/cli-ruby/lib/project_types/extension/features/runtimes/admin.rb +0 -29
- package/dist/assets/cli-ruby/lib/project_types/extension/features/runtimes/base.rb +0 -19
- package/dist/assets/cli-ruby/lib/project_types/extension/features/runtimes/checkout_post_purchase.rb +0 -23
- package/dist/assets/cli-ruby/lib/project_types/extension/features/runtimes/checkout_ui_extension.rb +0 -29
- package/dist/assets/cli-ruby/lib/project_types/extension/loaders/project.rb +0 -50
- package/dist/assets/cli-ruby/lib/project_types/extension/loaders/specification_handler.rb +0 -22
- package/dist/assets/cli-ruby/lib/project_types/extension/messages/message_loading.rb +0 -34
- package/dist/assets/cli-ruby/lib/project_types/extension/messages/messages.rb +0 -320
- package/dist/assets/cli-ruby/lib/project_types/extension/models/app.rb +0 -14
- package/dist/assets/cli-ruby/lib/project_types/extension/models/lazy_specification_handler.rb +0 -12
- package/dist/assets/cli-ruby/lib/project_types/extension/models/specification.rb +0 -41
- package/dist/assets/cli-ruby/lib/project_types/extension/models/specification_handlers/default.rb +0 -145
- package/dist/assets/cli-ruby/lib/project_types/extension/models/specification_handlers/theme_app_extension.rb +0 -134
- package/dist/assets/cli-ruby/lib/project_types/extension/models/specifications.rb +0 -91
- package/dist/assets/cli-ruby/lib/project_types/extension/models/validation_error.rb +0 -17
- package/dist/assets/cli-ruby/lib/project_types/extension/models/version.rb +0 -15
- package/dist/assets/cli-ruby/lib/project_types/extension/tasks/configure_features.rb +0 -73
- package/dist/assets/cli-ruby/lib/project_types/extension/tasks/configure_options.rb +0 -21
- package/dist/assets/cli-ruby/lib/project_types/extension/tasks/converters/validation_error_converter.rb +0 -25
- package/dist/assets/cli-ruby/lib/project_types/extension/tasks/converters/version_converter.rb +0 -28
- package/dist/assets/cli-ruby/lib/project_types/extension/tasks/fetch_specifications.rb +0 -21
- package/dist/assets/cli-ruby/lib/project_types/node/cli.rb +0 -12
- package/dist/assets/cli-ruby/lib/project_types/node/forms/create.rb +0 -45
- package/dist/assets/cli-ruby/lib/project_types/node/messages/messages.rb +0 -33
- package/dist/assets/cli-ruby/lib/project_types/php/cli.rb +0 -16
- package/dist/assets/cli-ruby/lib/project_types/php/forms/create.rb +0 -44
- package/dist/assets/cli-ruby/lib/project_types/php/messages/messages.rb +0 -29
- package/dist/assets/cli-ruby/lib/project_types/rails/cli.rb +0 -15
- package/dist/assets/cli-ruby/lib/project_types/rails/forms/create.rb +0 -75
- package/dist/assets/cli-ruby/lib/project_types/rails/gem.rb +0 -110
- package/dist/assets/cli-ruby/lib/project_types/rails/messages/messages.rb +0 -101
- package/dist/assets/cli-ruby/lib/project_types/script/cli.rb +0 -27
- package/dist/assets/cli-ruby/lib/project_types/script/commands/connect.rb +0 -16
- package/dist/assets/cli-ruby/lib/project_types/script/commands/create.rb +0 -24
- package/dist/assets/cli-ruby/lib/project_types/script/commands/javy.rb +0 -24
- package/dist/assets/cli-ruby/lib/project_types/script/commands/push.rb +0 -26
- package/dist/assets/cli-ruby/lib/project_types/script/loaders/project.rb +0 -46
- package/dist/assets/cli-ruby/lib/project_types/script/loaders/specification_handler.rb +0 -22
- package/dist/assets/cli-ruby/lib/project_types/script/messages/messages.rb +0 -11
- package/dist/assets/cli-ruby/lib/project_types/theme/cli.rb +0 -33
- package/dist/assets/cli-ruby/lib/project_types/theme/commands/common/root_helper.rb +0 -94
- package/dist/assets/cli-ruby/lib/project_types/theme/commands/common/shop_helper.rb +0 -13
- package/dist/assets/cli-ruby/lib/project_types/theme/commands/console.rb +0 -23
- package/dist/assets/cli-ruby/lib/project_types/theme/commands/delete.rb +0 -70
- package/dist/assets/cli-ruby/lib/project_types/theme/commands/init.rb +0 -46
- package/dist/assets/cli-ruby/lib/project_types/theme/commands/list.rb +0 -33
- package/dist/assets/cli-ruby/lib/project_types/theme/commands/open.rb +0 -73
- package/dist/assets/cli-ruby/lib/project_types/theme/commands/package.rb +0 -73
- package/dist/assets/cli-ruby/lib/project_types/theme/commands/publish.rb +0 -49
- package/dist/assets/cli-ruby/lib/project_types/theme/commands/pull.rb +0 -118
- package/dist/assets/cli-ruby/lib/project_types/theme/commands/push.rb +0 -160
- package/dist/assets/cli-ruby/lib/project_types/theme/commands/serve.rb +0 -91
- package/dist/assets/cli-ruby/lib/project_types/theme/commands/share.rb +0 -62
- package/dist/assets/cli-ruby/lib/project_types/theme/commands/token.rb +0 -22
- package/dist/assets/cli-ruby/lib/project_types/theme/conversions/base_glob.rb +0 -65
- package/dist/assets/cli-ruby/lib/project_types/theme/conversions/ignore_glob.rb +0 -15
- package/dist/assets/cli-ruby/lib/project_types/theme/conversions/include_glob.rb +0 -15
- package/dist/assets/cli-ruby/lib/project_types/theme/forms/confirm_store.rb +0 -15
- package/dist/assets/cli-ruby/lib/project_types/theme/forms/select.rb +0 -34
- package/dist/assets/cli-ruby/lib/project_types/theme/messages/messages.rb +0 -429
- package/dist/assets/cli-ruby/lib/project_types/theme/models/specification_handlers/theme.rb +0 -19
- package/dist/assets/cli-ruby/lib/project_types/theme/presenters/theme_presenter.rb +0 -48
- package/dist/assets/cli-ruby/lib/project_types/theme/presenters/themes_presenter.rb +0 -29
- package/dist/assets/cli-ruby/lib/project_types/theme/ui/sync_progress_bar.rb +0 -20
- package/dist/assets/cli-ruby/lib/rubygems_plugin.rb +0 -26
- package/dist/assets/cli-ruby/lib/shopify_cli/admin_api.rb +0 -160
- package/dist/assets/cli-ruby/lib/shopify_cli/api.rb +0 -130
- package/dist/assets/cli-ruby/lib/shopify_cli/command/project_command.rb +0 -31
- package/dist/assets/cli-ruby/lib/shopify_cli/command/sub_command.rb +0 -20
- package/dist/assets/cli-ruby/lib/shopify_cli/command.rb +0 -166
- package/dist/assets/cli-ruby/lib/shopify_cli/commands.rb +0 -21
- package/dist/assets/cli-ruby/lib/shopify_cli/constants.rb +0 -101
- package/dist/assets/cli-ruby/lib/shopify_cli/context.rb +0 -709
- package/dist/assets/cli-ruby/lib/shopify_cli/core/cli_version.rb +0 -20
- package/dist/assets/cli-ruby/lib/shopify_cli/core/entry_point.rb +0 -64
- package/dist/assets/cli-ruby/lib/shopify_cli/core/executor.rb +0 -23
- package/dist/assets/cli-ruby/lib/shopify_cli/core/finalize.rb +0 -13
- package/dist/assets/cli-ruby/lib/shopify_cli/core/monorail.rb +0 -122
- package/dist/assets/cli-ruby/lib/shopify_cli/core.rb +0 -8
- package/dist/assets/cli-ruby/lib/shopify_cli/db.rb +0 -114
- package/dist/assets/cli-ruby/lib/shopify_cli/environment.rb +0 -217
- package/dist/assets/cli-ruby/lib/shopify_cli/exception_reporter.rb +0 -80
- package/dist/assets/cli-ruby/lib/shopify_cli/feature.rb +0 -95
- package/dist/assets/cli-ruby/lib/shopify_cli/file_system_listener.rb +0 -30
- package/dist/assets/cli-ruby/lib/shopify_cli/form.rb +0 -42
- package/dist/assets/cli-ruby/lib/shopify_cli/git.rb +0 -320
- package/dist/assets/cli-ruby/lib/shopify_cli/github/issue_url_generator.rb +0 -30
- package/dist/assets/cli-ruby/lib/shopify_cli/github.rb +0 -5
- package/dist/assets/cli-ruby/lib/shopify_cli/helpers/haikunator.rb +0 -92
- package/dist/assets/cli-ruby/lib/shopify_cli/helpers.rb +0 -5
- package/dist/assets/cli-ruby/lib/shopify_cli/http_request.rb +0 -43
- package/dist/assets/cli-ruby/lib/shopify_cli/identity_auth/env_auth_token.rb +0 -34
- package/dist/assets/cli-ruby/lib/shopify_cli/identity_auth.rb +0 -332
- package/dist/assets/cli-ruby/lib/shopify_cli/js_system.rb +0 -115
- package/dist/assets/cli-ruby/lib/shopify_cli/lazy_delegator.rb +0 -55
- package/dist/assets/cli-ruby/lib/shopify_cli/messages/messages.rb +0 -863
- package/dist/assets/cli-ruby/lib/shopify_cli/method_object.rb +0 -123
- package/dist/assets/cli-ruby/lib/shopify_cli/migrator/migration.rb +0 -27
- package/dist/assets/cli-ruby/lib/shopify_cli/migrator/migrations/1631709766_noop.rb +0 -13
- package/dist/assets/cli-ruby/lib/shopify_cli/migrator/migrations/1633691650_merge_reporting_configuration.rb +0 -41
- package/dist/assets/cli-ruby/lib/shopify_cli/migrator.rb +0 -46
- package/dist/assets/cli-ruby/lib/shopify_cli/options.rb +0 -40
- package/dist/assets/cli-ruby/lib/shopify_cli/partners_api/app_extensions/job.rb +0 -36
- package/dist/assets/cli-ruby/lib/shopify_cli/partners_api/app_extensions.rb +0 -46
- package/dist/assets/cli-ruby/lib/shopify_cli/partners_api/organizations.rb +0 -45
- package/dist/assets/cli-ruby/lib/shopify_cli/partners_api.rb +0 -91
- package/dist/assets/cli-ruby/lib/shopify_cli/project.rb +0 -199
- package/dist/assets/cli-ruby/lib/shopify_cli/project_type.rb +0 -66
- package/dist/assets/cli-ruby/lib/shopify_cli/reporting_configuration_controller.rb +0 -29
- package/dist/assets/cli-ruby/lib/shopify_cli/resolve_constant.rb +0 -25
- package/dist/assets/cli-ruby/lib/shopify_cli/resources/env_file.rb +0 -108
- package/dist/assets/cli-ruby/lib/shopify_cli/resources.rb +0 -5
- package/dist/assets/cli-ruby/lib/shopify_cli/result.rb +0 -448
- package/dist/assets/cli-ruby/lib/shopify_cli/shopifolk.rb +0 -82
- package/dist/assets/cli-ruby/lib/shopify_cli/task.rb +0 -20
- package/dist/assets/cli-ruby/lib/shopify_cli/tasks/confirm_store.rb +0 -18
- package/dist/assets/cli-ruby/lib/shopify_cli/tasks/create_api_client.rb +0 -40
- package/dist/assets/cli-ruby/lib/shopify_cli/tasks/ensure_authenticated.rb +0 -19
- package/dist/assets/cli-ruby/lib/shopify_cli/tasks/ensure_dev_store.rb +0 -41
- package/dist/assets/cli-ruby/lib/shopify_cli/tasks/ensure_env.rb +0 -90
- package/dist/assets/cli-ruby/lib/shopify_cli/tasks/ensure_git_dependency.rb +0 -14
- package/dist/assets/cli-ruby/lib/shopify_cli/tasks/ensure_loopback_url.rb +0 -20
- package/dist/assets/cli-ruby/lib/shopify_cli/tasks/ensure_project_type.rb +0 -14
- package/dist/assets/cli-ruby/lib/shopify_cli/tasks/select_org_and_shop.rb +0 -81
- package/dist/assets/cli-ruby/lib/shopify_cli/tasks/update_dashboard_urls.rb +0 -57
- package/dist/assets/cli-ruby/lib/shopify_cli/tasks.rb +0 -44
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/backoff_helper.rb +0 -47
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server/cdn_fonts.rb +0 -82
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server/certificate_manager.rb +0 -79
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server/errors.rb +0 -9
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server/header_hash.rb +0 -98
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hooks/file_change_hook.rb +0 -77
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/remote_file_deleter.rb +0 -62
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/remote_file_reloader.rb +0 -63
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/resources/hot-reload-no-script.html +0 -27
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/resources/hot_reload.js +0 -48
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/resources/sse_client.js +0 -43
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/resources/theme.js +0 -114
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/resources/theme_extension.js +0 -121
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/script_injector.rb +0 -57
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/sections_index.rb +0 -50
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload.rb +0 -75
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server/local_assets.rb +0 -101
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server/proxy.rb +0 -313
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server/proxy_param_builder.rb +0 -84
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server/reload_mode.rb +0 -34
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server/remote_watcher/json_files_update_job.rb +0 -35
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server/remote_watcher.rb +0 -44
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server/sse.rb +0 -75
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server/watcher.rb +0 -64
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server/web_server.rb +0 -140
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/dev_server.rb +0 -332
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/development_theme.rb +0 -101
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/extension/app_extension.rb +0 -40
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/hooks/file_change_hook.rb +0 -76
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/hot_reload/script_injector.rb +0 -30
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/hot_reload.rb +0 -13
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/local_assets.rb +0 -31
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/proxy_param_builder.rb +0 -94
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/watcher.rb +0 -49
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server.rb +0 -175
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/extension/host_theme.rb +0 -109
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/extension/ignore_helper.rb +0 -35
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/extension/syncer/extension_serve_job.rb +0 -120
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/extension/syncer/operation.rb +0 -25
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/extension/syncer.rb +0 -100
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/extension/ui/host_theme_progress_bar.rb +0 -35
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/extension/ui/host_theme_raw_progress_bar.rb +0 -40
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/file.rb +0 -133
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/filter/path_matcher.rb +0 -38
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/ignore_filter.rb +0 -112
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/ignore_helper.rb +0 -37
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/include_filter.rb +0 -67
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/mime_type.rb +0 -34
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/notifier.rb +0 -52
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/repl/api.rb +0 -109
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/repl/auth_dev_server.rb +0 -93
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/repl/auth_middleware.rb +0 -97
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/repl/remote_evaluator.rb +0 -166
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/repl/resources/success.html +0 -78
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/repl/resources/template.liquid +0 -15
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/repl/snippet.rb +0 -81
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/repl.rb +0 -88
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/root.rb +0 -62
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer/checksums.rb +0 -66
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer/downloader.rb +0 -63
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer/error_reporter.rb +0 -45
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer/merger.rb +0 -53
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer/operation.rb +0 -49
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer/standard_reporter.rb +0 -32
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer/unsupported_script_warning.rb +0 -90
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/bulk.rb +0 -133
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/bulk_item.rb +0 -64
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/bulk_job.rb +0 -139
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/bulk_request.rb +0 -30
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/forms/apply_to_all.rb +0 -41
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/forms/apply_to_all_form.rb +0 -37
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/forms/base_strategy_form.rb +0 -64
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/forms/select_delete_strategy.rb +0 -29
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/forms/select_update_strategy.rb +0 -30
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/json_delete_handler.rb +0 -49
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/json_update_handler.rb +0 -71
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader.rb +0 -231
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer.rb +0 -391
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/theme.rb +0 -212
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/theme_access_api.rb +0 -89
- package/dist/assets/cli-ruby/lib/shopify_cli/theme/theme_admin_api.rb +0 -101
- package/dist/assets/cli-ruby/lib/shopify_cli/thread_pool/job.rb +0 -35
- package/dist/assets/cli-ruby/lib/shopify_cli/thread_pool.rb +0 -49
- package/dist/assets/cli-ruby/lib/shopify_cli/transform_data_structure.rb +0 -87
- package/dist/assets/cli-ruby/lib/shopify_cli/utilities.rb +0 -21
- package/dist/assets/cli-ruby/lib/shopify_cli/version.rb +0 -3
- package/dist/assets/cli-ruby/lib/shopify_cli.rb +0 -182
- package/dist/assets/cli-ruby/shipit.rubygems.yml +0 -3
- package/dist/assets/cli-ruby/shopify-cli.gemspec +0 -46
- package/dist/assets/cli-ruby/shopify-dev +0 -16
- package/dist/assets/cli-ruby/test/minitest_ext.rb +0 -115
- package/dist/assets/cli-ruby/test/project_types/extension/extension_test_helpers.rb +0 -70
- package/dist/assets/cli-ruby/test/shopify-cli/migrator/migrations/migration_helper.rb +0 -20
- package/dist/assets/cli-ruby/test/test_helpers.rb +0 -16
- package/dist/assets/cli-ruby/utilities/constants.rb +0 -7
- package/dist/assets/cli-ruby/utilities/docker/container.rb +0 -104
- package/dist/assets/cli-ruby/utilities/docker.rb +0 -89
- package/dist/assets/cli-ruby/utilities/utilities.rb +0 -6
- package/dist/assets/cli-ruby/vendor/deps/cli-kit/REVISION +0 -1
- package/dist/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/autocall.rb +0 -21
- package/dist/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/base_command.rb +0 -49
- package/dist/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/command_registry.rb +0 -94
- package/dist/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/config.rb +0 -133
- package/dist/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb +0 -123
- package/dist/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/executor.rb +0 -79
- package/dist/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/ini.rb +0 -102
- package/dist/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/levenshtein.rb +0 -82
- package/dist/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/logger.rb +0 -82
- package/dist/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/resolver.rb +0 -60
- package/dist/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/ruby_backports/enumerable.rb +0 -6
- package/dist/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/support/test_helper.rb +0 -244
- package/dist/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/support.rb +0 -9
- package/dist/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/system.rb +0 -243
- package/dist/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/util.rb +0 -193
- package/dist/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/version.rb +0 -5
- package/dist/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit.rb +0 -60
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/REVISION +0 -1
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/ansi.rb +0 -157
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/color.rb +0 -84
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/formatter.rb +0 -193
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/frame/frame_stack.rb +0 -98
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/box.rb +0 -166
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/bracket.rb +0 -139
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +0 -120
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/frame.rb +0 -269
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +0 -84
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/os.rb +0 -73
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/printer.rb +0 -59
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/progress.rb +0 -90
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/progress_plain.rb +0 -50
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +0 -484
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/prompt/options_handler.rb +0 -29
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/prompt.rb +0 -282
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/spinner/async.rb +0 -40
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/spinner/spin_group.rb +0 -263
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +0 -66
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/stdout_router.rb +0 -232
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/terminal.rb +0 -46
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/truncater.rb +0 -102
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/version.rb +0 -5
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/widgets/base.rb +0 -27
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/widgets/status.rb +0 -61
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/widgets.rb +0 -77
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/wrap.rb +0 -56
- package/dist/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui.rb +0 -234
- package/dist/assets/cli-ruby/vendor/deps/ruby2_keywords/LICENSE +0 -22
- package/dist/assets/cli-ruby/vendor/deps/ruby2_keywords/README.md +0 -67
- package/dist/assets/cli-ruby/vendor/deps/ruby2_keywords/Rakefile +0 -54
- package/dist/assets/cli-ruby/vendor/deps/ruby2_keywords/lib/ruby2_keywords.rb +0 -57
- package/dist/assets/cli-ruby/vendor/deps/ruby2_keywords/ruby2_keywords.gemspec +0 -18
- package/dist/assets/cli-ruby/vendor/deps/ruby2_keywords/test/test_keyword.rb +0 -41
- package/dist/assets/cli-ruby/vendor/deps/smart_properties/REVISION +0 -1
- package/dist/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties/errors.rb +0 -114
- package/dist/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties/property.rb +0 -168
- package/dist/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties/property_collection.rb +0 -83
- package/dist/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties/validations/ancestor.rb +0 -27
- package/dist/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties/validations.rb +0 -8
- package/dist/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties/version.rb +0 -3
- package/dist/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties.rb +0 -174
- package/dist/assets/cli-ruby/vendor/deps/webrick/Gemfile +0 -3
- package/dist/assets/cli-ruby/vendor/deps/webrick/LICENSE.txt +0 -22
- package/dist/assets/cli-ruby/vendor/deps/webrick/README.md +0 -61
- package/dist/assets/cli-ruby/vendor/deps/webrick/Rakefile +0 -10
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/accesslog.rb +0 -157
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/cgi.rb +0 -313
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/compat.rb +0 -36
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/config.rb +0 -158
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/cookie.rb +0 -172
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/htmlutils.rb +0 -30
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/authenticator.rb +0 -117
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/basicauth.rb +0 -116
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/digestauth.rb +0 -395
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/htdigest.rb +0 -132
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/htgroup.rb +0 -97
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/htpasswd.rb +0 -158
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/userdb.rb +0 -53
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth.rb +0 -96
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpproxy.rb +0 -354
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httprequest.rb +0 -636
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpresponse.rb +0 -564
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/https.rb +0 -152
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpserver.rb +0 -294
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet/abstract.rb +0 -152
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet/cgi_runner.rb +0 -47
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet/cgihandler.rb +0 -126
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet/erbhandler.rb +0 -88
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet/filehandler.rb +0 -552
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet/prochandler.rb +0 -47
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet.rb +0 -23
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpstatus.rb +0 -194
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httputils.rb +0 -512
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpversion.rb +0 -76
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/log.rb +0 -156
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/server.rb +0 -381
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/ssl.rb +0 -215
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/utils.rb +0 -265
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick/version.rb +0 -18
- package/dist/assets/cli-ruby/vendor/deps/webrick/lib/webrick.rb +0 -232
- package/dist/assets/cli-ruby/vendor/deps/webrick/webrick.gemspec +0 -74
- package/dist/assets/cli-ruby/vendor/gen/lib/gen/commands/help.rb +0 -20
- package/dist/assets/cli-ruby/vendor/gen/lib/gen/commands/new.rb +0 -21
- package/dist/assets/cli-ruby/vendor/gen/lib/gen/commands.rb +0 -18
- package/dist/assets/cli-ruby/vendor/gen/lib/gen/entry_point.rb +0 -10
- package/dist/assets/cli-ruby/vendor/gen/lib/gen/generator.rb +0 -165
- package/dist/assets/cli-ruby/vendor/gen/lib/gen.rb +0 -39
- package/dist/assets/cli-ruby/vendor/gen/template/Gemfile +0 -10
- package/dist/assets/cli-ruby/vendor/gen/template/README.md +0 -1
- package/dist/assets/cli-ruby/vendor/gen/template/bin/testunit +0 -23
- package/dist/assets/cli-ruby/vendor/gen/template/bin/update-deps +0 -97
- package/dist/assets/cli-ruby/vendor/gen/template/dev-gems.yml +0 -3
- package/dist/assets/cli-ruby/vendor/gen/template/dev-vendor.yml +0 -4
- package/dist/assets/cli-ruby/vendor/gen/template/exe/__app__-gems +0 -17
- package/dist/assets/cli-ruby/vendor/gen/template/exe/__app__-vendor +0 -18
- package/dist/assets/cli-ruby/vendor/gen/template/lib/__app__/commands/example.rb +0 -19
- package/dist/assets/cli-ruby/vendor/gen/template/lib/__app__/commands/help.rb +0 -21
- package/dist/assets/cli-ruby/vendor/gen/template/lib/__app__/commands.rb +0 -18
- package/dist/assets/cli-ruby/vendor/gen/template/lib/__app__/entry_point.rb +0 -10
- package/dist/assets/cli-ruby/vendor/gen/template/lib/__app__.rb +0 -33
- package/dist/assets/cli-ruby/vendor/gen/template/test/example_test.rb +0 -17
- package/dist/assets/cli-ruby/vendor/gen/template/test/test_helper.rb +0 -22
- package/dist/assets/cli-ruby/vendor/lib/semantic/LICENSE +0 -20
- package/dist/assets/cli-ruby/vendor/lib/semantic/semantic.rb +0 -4
- package/dist/assets/cli-ruby/vendor/lib/semantic/version.rb +0 -179
- package/dist/assets/demo-catalog.json +0 -655
- package/dist/chunk-CPEFXM7T.js +0 -45
- package/dist/chunk-FVUAIT37.js +0 -312
- package/dist/chunk-FWX3KCDM.js +0 -116
- package/dist/chunk-FX2HB3CJ.js +0 -58
- package/dist/chunk-GYP4MV72.js +0 -59
- package/dist/chunk-NLUGD7PZ.js +0 -2731
- package/dist/chunk-P7JUHQKL.js +0 -115
- package/dist/chunk-QSUS3GJF.js +0 -3838
- package/dist/chunk-T2GATXSP.js +0 -112
- package/dist/cli/commands/demo/catalog.js +0 -34
- package/dist/cli/commands/demo/generate-file.d.ts +0 -11
- package/dist/cli/commands/demo/generate-file.js +0 -35
- package/dist/cli/commands/demo/index.d.ts +0 -10
- package/dist/cli/commands/demo/index.js +0 -34
- package/dist/cli/commands/demo/print-ai-prompt.js +0 -35
- package/dist/cli/services/demo.d.ts +0 -26440
- package/dist/cli/services/demo.js +0 -25
- package/dist/cli/services/demo.test.js +0 -42
- package/dist/constants-T7JXE5K7.js +0 -24
- package/dist/system-SGABHAU2.js +0 -29
package/dist/chunk-NLUGD7PZ.js
DELETED
|
@@ -1,2731 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
init_cjs_shims
|
|
3
|
-
} from "./chunk-POZ5MGPT.js";
|
|
4
|
-
|
|
5
|
-
// ../../node_modules/.pnpm/zod@3.22.3/node_modules/zod/lib/index.mjs
|
|
6
|
-
init_cjs_shims();
|
|
7
|
-
var util;
|
|
8
|
-
(function(util2) {
|
|
9
|
-
util2.assertEqual = (val) => val;
|
|
10
|
-
function assertIs(_arg) {
|
|
11
|
-
}
|
|
12
|
-
util2.assertIs = assertIs;
|
|
13
|
-
function assertNever(_x) {
|
|
14
|
-
throw new Error();
|
|
15
|
-
}
|
|
16
|
-
util2.assertNever = assertNever, util2.arrayToEnum = (items) => {
|
|
17
|
-
let obj = {};
|
|
18
|
-
for (let item of items)
|
|
19
|
-
obj[item] = item;
|
|
20
|
-
return obj;
|
|
21
|
-
}, util2.getValidEnumValues = (obj) => {
|
|
22
|
-
let validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] != "number"), filtered = {};
|
|
23
|
-
for (let k of validKeys)
|
|
24
|
-
filtered[k] = obj[k];
|
|
25
|
-
return util2.objectValues(filtered);
|
|
26
|
-
}, util2.objectValues = (obj) => util2.objectKeys(obj).map(function(e) {
|
|
27
|
-
return obj[e];
|
|
28
|
-
}), util2.objectKeys = typeof Object.keys == "function" ? (obj) => Object.keys(obj) : (object) => {
|
|
29
|
-
let keys = [];
|
|
30
|
-
for (let key in object)
|
|
31
|
-
Object.prototype.hasOwnProperty.call(object, key) && keys.push(key);
|
|
32
|
-
return keys;
|
|
33
|
-
}, util2.find = (arr, checker) => {
|
|
34
|
-
for (let item of arr)
|
|
35
|
-
if (checker(item))
|
|
36
|
-
return item;
|
|
37
|
-
}, util2.isInteger = typeof Number.isInteger == "function" ? (val) => Number.isInteger(val) : (val) => typeof val == "number" && isFinite(val) && Math.floor(val) === val;
|
|
38
|
-
function joinValues(array, separator = " | ") {
|
|
39
|
-
return array.map((val) => typeof val == "string" ? `'${val}'` : val).join(separator);
|
|
40
|
-
}
|
|
41
|
-
util2.joinValues = joinValues, util2.jsonStringifyReplacer = (_, value) => typeof value == "bigint" ? value.toString() : value;
|
|
42
|
-
})(util || (util = {}));
|
|
43
|
-
var objectUtil;
|
|
44
|
-
(function(objectUtil2) {
|
|
45
|
-
objectUtil2.mergeShapes = (first, second) => ({
|
|
46
|
-
...first,
|
|
47
|
-
...second
|
|
48
|
-
// second overwrites first
|
|
49
|
-
});
|
|
50
|
-
})(objectUtil || (objectUtil = {}));
|
|
51
|
-
var ZodParsedType = util.arrayToEnum([
|
|
52
|
-
"string",
|
|
53
|
-
"nan",
|
|
54
|
-
"number",
|
|
55
|
-
"integer",
|
|
56
|
-
"float",
|
|
57
|
-
"boolean",
|
|
58
|
-
"date",
|
|
59
|
-
"bigint",
|
|
60
|
-
"symbol",
|
|
61
|
-
"function",
|
|
62
|
-
"undefined",
|
|
63
|
-
"null",
|
|
64
|
-
"array",
|
|
65
|
-
"object",
|
|
66
|
-
"unknown",
|
|
67
|
-
"promise",
|
|
68
|
-
"void",
|
|
69
|
-
"never",
|
|
70
|
-
"map",
|
|
71
|
-
"set"
|
|
72
|
-
]), getParsedType = (data) => {
|
|
73
|
-
switch (typeof data) {
|
|
74
|
-
case "undefined":
|
|
75
|
-
return ZodParsedType.undefined;
|
|
76
|
-
case "string":
|
|
77
|
-
return ZodParsedType.string;
|
|
78
|
-
case "number":
|
|
79
|
-
return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
|
|
80
|
-
case "boolean":
|
|
81
|
-
return ZodParsedType.boolean;
|
|
82
|
-
case "function":
|
|
83
|
-
return ZodParsedType.function;
|
|
84
|
-
case "bigint":
|
|
85
|
-
return ZodParsedType.bigint;
|
|
86
|
-
case "symbol":
|
|
87
|
-
return ZodParsedType.symbol;
|
|
88
|
-
case "object":
|
|
89
|
-
return Array.isArray(data) ? ZodParsedType.array : data === null ? ZodParsedType.null : data.then && typeof data.then == "function" && data.catch && typeof data.catch == "function" ? ZodParsedType.promise : typeof Map < "u" && data instanceof Map ? ZodParsedType.map : typeof Set < "u" && data instanceof Set ? ZodParsedType.set : typeof Date < "u" && data instanceof Date ? ZodParsedType.date : ZodParsedType.object;
|
|
90
|
-
default:
|
|
91
|
-
return ZodParsedType.unknown;
|
|
92
|
-
}
|
|
93
|
-
}, ZodIssueCode = util.arrayToEnum([
|
|
94
|
-
"invalid_type",
|
|
95
|
-
"invalid_literal",
|
|
96
|
-
"custom",
|
|
97
|
-
"invalid_union",
|
|
98
|
-
"invalid_union_discriminator",
|
|
99
|
-
"invalid_enum_value",
|
|
100
|
-
"unrecognized_keys",
|
|
101
|
-
"invalid_arguments",
|
|
102
|
-
"invalid_return_type",
|
|
103
|
-
"invalid_date",
|
|
104
|
-
"invalid_string",
|
|
105
|
-
"too_small",
|
|
106
|
-
"too_big",
|
|
107
|
-
"invalid_intersection_types",
|
|
108
|
-
"not_multiple_of",
|
|
109
|
-
"not_finite"
|
|
110
|
-
]), quotelessJson = (obj) => JSON.stringify(obj, null, 2).replace(/"([^"]+)":/g, "$1:"), ZodError = class extends Error {
|
|
111
|
-
constructor(issues) {
|
|
112
|
-
super(), this.issues = [], this.addIssue = (sub) => {
|
|
113
|
-
this.issues = [...this.issues, sub];
|
|
114
|
-
}, this.addIssues = (subs = []) => {
|
|
115
|
-
this.issues = [...this.issues, ...subs];
|
|
116
|
-
};
|
|
117
|
-
let actualProto = new.target.prototype;
|
|
118
|
-
Object.setPrototypeOf ? Object.setPrototypeOf(this, actualProto) : this.__proto__ = actualProto, this.name = "ZodError", this.issues = issues;
|
|
119
|
-
}
|
|
120
|
-
get errors() {
|
|
121
|
-
return this.issues;
|
|
122
|
-
}
|
|
123
|
-
format(_mapper) {
|
|
124
|
-
let mapper = _mapper || function(issue) {
|
|
125
|
-
return issue.message;
|
|
126
|
-
}, fieldErrors = { _errors: [] }, processError = (error) => {
|
|
127
|
-
for (let issue of error.issues)
|
|
128
|
-
if (issue.code === "invalid_union")
|
|
129
|
-
issue.unionErrors.map(processError);
|
|
130
|
-
else if (issue.code === "invalid_return_type")
|
|
131
|
-
processError(issue.returnTypeError);
|
|
132
|
-
else if (issue.code === "invalid_arguments")
|
|
133
|
-
processError(issue.argumentsError);
|
|
134
|
-
else if (issue.path.length === 0)
|
|
135
|
-
fieldErrors._errors.push(mapper(issue));
|
|
136
|
-
else {
|
|
137
|
-
let curr = fieldErrors, i = 0;
|
|
138
|
-
for (; i < issue.path.length; ) {
|
|
139
|
-
let el = issue.path[i];
|
|
140
|
-
i === issue.path.length - 1 ? (curr[el] = curr[el] || { _errors: [] }, curr[el]._errors.push(mapper(issue))) : curr[el] = curr[el] || { _errors: [] }, curr = curr[el], i++;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
return processError(this), fieldErrors;
|
|
145
|
-
}
|
|
146
|
-
toString() {
|
|
147
|
-
return this.message;
|
|
148
|
-
}
|
|
149
|
-
get message() {
|
|
150
|
-
return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
|
|
151
|
-
}
|
|
152
|
-
get isEmpty() {
|
|
153
|
-
return this.issues.length === 0;
|
|
154
|
-
}
|
|
155
|
-
flatten(mapper = (issue) => issue.message) {
|
|
156
|
-
let fieldErrors = {}, formErrors = [];
|
|
157
|
-
for (let sub of this.issues)
|
|
158
|
-
sub.path.length > 0 ? (fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [], fieldErrors[sub.path[0]].push(mapper(sub))) : formErrors.push(mapper(sub));
|
|
159
|
-
return { formErrors, fieldErrors };
|
|
160
|
-
}
|
|
161
|
-
get formErrors() {
|
|
162
|
-
return this.flatten();
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
ZodError.create = (issues) => new ZodError(issues);
|
|
166
|
-
var errorMap = (issue, _ctx) => {
|
|
167
|
-
let message;
|
|
168
|
-
switch (issue.code) {
|
|
169
|
-
case ZodIssueCode.invalid_type:
|
|
170
|
-
issue.received === ZodParsedType.undefined ? message = "Required" : message = `Expected ${issue.expected}, received ${issue.received}`;
|
|
171
|
-
break;
|
|
172
|
-
case ZodIssueCode.invalid_literal:
|
|
173
|
-
message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
|
|
174
|
-
break;
|
|
175
|
-
case ZodIssueCode.unrecognized_keys:
|
|
176
|
-
message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
|
|
177
|
-
break;
|
|
178
|
-
case ZodIssueCode.invalid_union:
|
|
179
|
-
message = "Invalid input";
|
|
180
|
-
break;
|
|
181
|
-
case ZodIssueCode.invalid_union_discriminator:
|
|
182
|
-
message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
|
|
183
|
-
break;
|
|
184
|
-
case ZodIssueCode.invalid_enum_value:
|
|
185
|
-
message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
|
|
186
|
-
break;
|
|
187
|
-
case ZodIssueCode.invalid_arguments:
|
|
188
|
-
message = "Invalid function arguments";
|
|
189
|
-
break;
|
|
190
|
-
case ZodIssueCode.invalid_return_type:
|
|
191
|
-
message = "Invalid function return type";
|
|
192
|
-
break;
|
|
193
|
-
case ZodIssueCode.invalid_date:
|
|
194
|
-
message = "Invalid date";
|
|
195
|
-
break;
|
|
196
|
-
case ZodIssueCode.invalid_string:
|
|
197
|
-
typeof issue.validation == "object" ? "includes" in issue.validation ? (message = `Invalid input: must include "${issue.validation.includes}"`, typeof issue.validation.position == "number" && (message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`)) : "startsWith" in issue.validation ? message = `Invalid input: must start with "${issue.validation.startsWith}"` : "endsWith" in issue.validation ? message = `Invalid input: must end with "${issue.validation.endsWith}"` : util.assertNever(issue.validation) : issue.validation !== "regex" ? message = `Invalid ${issue.validation}` : message = "Invalid";
|
|
198
|
-
break;
|
|
199
|
-
case ZodIssueCode.too_small:
|
|
200
|
-
issue.type === "array" ? message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? "at least" : "more than"} ${issue.minimum} element(s)` : issue.type === "string" ? message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? "at least" : "over"} ${issue.minimum} character(s)` : issue.type === "number" ? message = `Number must be ${issue.exact ? "exactly equal to " : issue.inclusive ? "greater than or equal to " : "greater than "}${issue.minimum}` : issue.type === "date" ? message = `Date must be ${issue.exact ? "exactly equal to " : issue.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(issue.minimum))}` : message = "Invalid input";
|
|
201
|
-
break;
|
|
202
|
-
case ZodIssueCode.too_big:
|
|
203
|
-
issue.type === "array" ? message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? "at most" : "less than"} ${issue.maximum} element(s)` : issue.type === "string" ? message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? "at most" : "under"} ${issue.maximum} character(s)` : issue.type === "number" ? message = `Number must be ${issue.exact ? "exactly" : issue.inclusive ? "less than or equal to" : "less than"} ${issue.maximum}` : issue.type === "bigint" ? message = `BigInt must be ${issue.exact ? "exactly" : issue.inclusive ? "less than or equal to" : "less than"} ${issue.maximum}` : issue.type === "date" ? message = `Date must be ${issue.exact ? "exactly" : issue.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(issue.maximum))}` : message = "Invalid input";
|
|
204
|
-
break;
|
|
205
|
-
case ZodIssueCode.custom:
|
|
206
|
-
message = "Invalid input";
|
|
207
|
-
break;
|
|
208
|
-
case ZodIssueCode.invalid_intersection_types:
|
|
209
|
-
message = "Intersection results could not be merged";
|
|
210
|
-
break;
|
|
211
|
-
case ZodIssueCode.not_multiple_of:
|
|
212
|
-
message = `Number must be a multiple of ${issue.multipleOf}`;
|
|
213
|
-
break;
|
|
214
|
-
case ZodIssueCode.not_finite:
|
|
215
|
-
message = "Number must be finite";
|
|
216
|
-
break;
|
|
217
|
-
default:
|
|
218
|
-
message = _ctx.defaultError, util.assertNever(issue);
|
|
219
|
-
}
|
|
220
|
-
return { message };
|
|
221
|
-
}, overrideErrorMap = errorMap;
|
|
222
|
-
function setErrorMap(map) {
|
|
223
|
-
overrideErrorMap = map;
|
|
224
|
-
}
|
|
225
|
-
function getErrorMap() {
|
|
226
|
-
return overrideErrorMap;
|
|
227
|
-
}
|
|
228
|
-
var makeIssue = (params) => {
|
|
229
|
-
let { data, path, errorMaps, issueData } = params, fullPath = [...path, ...issueData.path || []], fullIssue = {
|
|
230
|
-
...issueData,
|
|
231
|
-
path: fullPath
|
|
232
|
-
}, errorMessage = "", maps = errorMaps.filter((m) => !!m).slice().reverse();
|
|
233
|
-
for (let map of maps)
|
|
234
|
-
errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
|
|
235
|
-
return {
|
|
236
|
-
...issueData,
|
|
237
|
-
path: fullPath,
|
|
238
|
-
message: issueData.message || errorMessage
|
|
239
|
-
};
|
|
240
|
-
}, EMPTY_PATH = [];
|
|
241
|
-
function addIssueToContext(ctx, issueData) {
|
|
242
|
-
let issue = makeIssue({
|
|
243
|
-
issueData,
|
|
244
|
-
data: ctx.data,
|
|
245
|
-
path: ctx.path,
|
|
246
|
-
errorMaps: [
|
|
247
|
-
ctx.common.contextualErrorMap,
|
|
248
|
-
ctx.schemaErrorMap,
|
|
249
|
-
getErrorMap(),
|
|
250
|
-
errorMap
|
|
251
|
-
// then global default map
|
|
252
|
-
].filter((x) => !!x)
|
|
253
|
-
});
|
|
254
|
-
ctx.common.issues.push(issue);
|
|
255
|
-
}
|
|
256
|
-
var ParseStatus = class _ParseStatus {
|
|
257
|
-
constructor() {
|
|
258
|
-
this.value = "valid";
|
|
259
|
-
}
|
|
260
|
-
dirty() {
|
|
261
|
-
this.value === "valid" && (this.value = "dirty");
|
|
262
|
-
}
|
|
263
|
-
abort() {
|
|
264
|
-
this.value !== "aborted" && (this.value = "aborted");
|
|
265
|
-
}
|
|
266
|
-
static mergeArray(status, results) {
|
|
267
|
-
let arrayValue = [];
|
|
268
|
-
for (let s of results) {
|
|
269
|
-
if (s.status === "aborted")
|
|
270
|
-
return INVALID;
|
|
271
|
-
s.status === "dirty" && status.dirty(), arrayValue.push(s.value);
|
|
272
|
-
}
|
|
273
|
-
return { status: status.value, value: arrayValue };
|
|
274
|
-
}
|
|
275
|
-
static async mergeObjectAsync(status, pairs) {
|
|
276
|
-
let syncPairs = [];
|
|
277
|
-
for (let pair of pairs)
|
|
278
|
-
syncPairs.push({
|
|
279
|
-
key: await pair.key,
|
|
280
|
-
value: await pair.value
|
|
281
|
-
});
|
|
282
|
-
return _ParseStatus.mergeObjectSync(status, syncPairs);
|
|
283
|
-
}
|
|
284
|
-
static mergeObjectSync(status, pairs) {
|
|
285
|
-
let finalObject = {};
|
|
286
|
-
for (let pair of pairs) {
|
|
287
|
-
let { key, value } = pair;
|
|
288
|
-
if (key.status === "aborted" || value.status === "aborted")
|
|
289
|
-
return INVALID;
|
|
290
|
-
key.status === "dirty" && status.dirty(), value.status === "dirty" && status.dirty(), key.value !== "__proto__" && (typeof value.value < "u" || pair.alwaysSet) && (finalObject[key.value] = value.value);
|
|
291
|
-
}
|
|
292
|
-
return { status: status.value, value: finalObject };
|
|
293
|
-
}
|
|
294
|
-
}, INVALID = Object.freeze({
|
|
295
|
-
status: "aborted"
|
|
296
|
-
}), DIRTY = (value) => ({ status: "dirty", value }), OK = (value) => ({ status: "valid", value }), isAborted = (x) => x.status === "aborted", isDirty = (x) => x.status === "dirty", isValid = (x) => x.status === "valid", isAsync = (x) => typeof Promise < "u" && x instanceof Promise, errorUtil;
|
|
297
|
-
(function(errorUtil2) {
|
|
298
|
-
errorUtil2.errToObj = (message) => typeof message == "string" ? { message } : message || {}, errorUtil2.toString = (message) => typeof message == "string" ? message : message?.message;
|
|
299
|
-
})(errorUtil || (errorUtil = {}));
|
|
300
|
-
var ParseInputLazyPath = class {
|
|
301
|
-
constructor(parent, value, path, key) {
|
|
302
|
-
this._cachedPath = [], this.parent = parent, this.data = value, this._path = path, this._key = key;
|
|
303
|
-
}
|
|
304
|
-
get path() {
|
|
305
|
-
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
306
|
-
}
|
|
307
|
-
}, handleResult = (ctx, result) => {
|
|
308
|
-
if (isValid(result))
|
|
309
|
-
return { success: !0, data: result.value };
|
|
310
|
-
if (!ctx.common.issues.length)
|
|
311
|
-
throw new Error("Validation failed but no issues detected.");
|
|
312
|
-
return {
|
|
313
|
-
success: !1,
|
|
314
|
-
get error() {
|
|
315
|
-
if (this._error)
|
|
316
|
-
return this._error;
|
|
317
|
-
let error = new ZodError(ctx.common.issues);
|
|
318
|
-
return this._error = error, this._error;
|
|
319
|
-
}
|
|
320
|
-
};
|
|
321
|
-
};
|
|
322
|
-
function processCreateParams(params) {
|
|
323
|
-
if (!params)
|
|
324
|
-
return {};
|
|
325
|
-
let { errorMap: errorMap2, invalid_type_error, required_error, description } = params;
|
|
326
|
-
if (errorMap2 && (invalid_type_error || required_error))
|
|
327
|
-
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
328
|
-
return errorMap2 ? { errorMap: errorMap2, description } : { errorMap: (iss, ctx) => iss.code !== "invalid_type" ? { message: ctx.defaultError } : typeof ctx.data > "u" ? { message: required_error ?? ctx.defaultError } : { message: invalid_type_error ?? ctx.defaultError }, description };
|
|
329
|
-
}
|
|
330
|
-
var ZodType = class {
|
|
331
|
-
constructor(def) {
|
|
332
|
-
this.spa = this.safeParseAsync, this._def = def, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this);
|
|
333
|
-
}
|
|
334
|
-
get description() {
|
|
335
|
-
return this._def.description;
|
|
336
|
-
}
|
|
337
|
-
_getType(input) {
|
|
338
|
-
return getParsedType(input.data);
|
|
339
|
-
}
|
|
340
|
-
_getOrReturnCtx(input, ctx) {
|
|
341
|
-
return ctx || {
|
|
342
|
-
common: input.parent.common,
|
|
343
|
-
data: input.data,
|
|
344
|
-
parsedType: getParsedType(input.data),
|
|
345
|
-
schemaErrorMap: this._def.errorMap,
|
|
346
|
-
path: input.path,
|
|
347
|
-
parent: input.parent
|
|
348
|
-
};
|
|
349
|
-
}
|
|
350
|
-
_processInputParams(input) {
|
|
351
|
-
return {
|
|
352
|
-
status: new ParseStatus(),
|
|
353
|
-
ctx: {
|
|
354
|
-
common: input.parent.common,
|
|
355
|
-
data: input.data,
|
|
356
|
-
parsedType: getParsedType(input.data),
|
|
357
|
-
schemaErrorMap: this._def.errorMap,
|
|
358
|
-
path: input.path,
|
|
359
|
-
parent: input.parent
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
_parseSync(input) {
|
|
364
|
-
let result = this._parse(input);
|
|
365
|
-
if (isAsync(result))
|
|
366
|
-
throw new Error("Synchronous parse encountered promise.");
|
|
367
|
-
return result;
|
|
368
|
-
}
|
|
369
|
-
_parseAsync(input) {
|
|
370
|
-
let result = this._parse(input);
|
|
371
|
-
return Promise.resolve(result);
|
|
372
|
-
}
|
|
373
|
-
parse(data, params) {
|
|
374
|
-
let result = this.safeParse(data, params);
|
|
375
|
-
if (result.success)
|
|
376
|
-
return result.data;
|
|
377
|
-
throw result.error;
|
|
378
|
-
}
|
|
379
|
-
safeParse(data, params) {
|
|
380
|
-
var _a;
|
|
381
|
-
let ctx = {
|
|
382
|
-
common: {
|
|
383
|
-
issues: [],
|
|
384
|
-
async: (_a = params?.async) !== null && _a !== void 0 ? _a : !1,
|
|
385
|
-
contextualErrorMap: params?.errorMap
|
|
386
|
-
},
|
|
387
|
-
path: params?.path || [],
|
|
388
|
-
schemaErrorMap: this._def.errorMap,
|
|
389
|
-
parent: null,
|
|
390
|
-
data,
|
|
391
|
-
parsedType: getParsedType(data)
|
|
392
|
-
}, result = this._parseSync({ data, path: ctx.path, parent: ctx });
|
|
393
|
-
return handleResult(ctx, result);
|
|
394
|
-
}
|
|
395
|
-
async parseAsync(data, params) {
|
|
396
|
-
let result = await this.safeParseAsync(data, params);
|
|
397
|
-
if (result.success)
|
|
398
|
-
return result.data;
|
|
399
|
-
throw result.error;
|
|
400
|
-
}
|
|
401
|
-
async safeParseAsync(data, params) {
|
|
402
|
-
let ctx = {
|
|
403
|
-
common: {
|
|
404
|
-
issues: [],
|
|
405
|
-
contextualErrorMap: params?.errorMap,
|
|
406
|
-
async: !0
|
|
407
|
-
},
|
|
408
|
-
path: params?.path || [],
|
|
409
|
-
schemaErrorMap: this._def.errorMap,
|
|
410
|
-
parent: null,
|
|
411
|
-
data,
|
|
412
|
-
parsedType: getParsedType(data)
|
|
413
|
-
}, maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx }), result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
|
|
414
|
-
return handleResult(ctx, result);
|
|
415
|
-
}
|
|
416
|
-
refine(check, message) {
|
|
417
|
-
let getIssueProperties = (val) => typeof message == "string" || typeof message > "u" ? { message } : typeof message == "function" ? message(val) : message;
|
|
418
|
-
return this._refinement((val, ctx) => {
|
|
419
|
-
let result = check(val), setError = () => ctx.addIssue({
|
|
420
|
-
code: ZodIssueCode.custom,
|
|
421
|
-
...getIssueProperties(val)
|
|
422
|
-
});
|
|
423
|
-
return typeof Promise < "u" && result instanceof Promise ? result.then((data) => data ? !0 : (setError(), !1)) : result ? !0 : (setError(), !1);
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
refinement(check, refinementData) {
|
|
427
|
-
return this._refinement((val, ctx) => check(val) ? !0 : (ctx.addIssue(typeof refinementData == "function" ? refinementData(val, ctx) : refinementData), !1));
|
|
428
|
-
}
|
|
429
|
-
_refinement(refinement) {
|
|
430
|
-
return new ZodEffects({
|
|
431
|
-
schema: this,
|
|
432
|
-
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
433
|
-
effect: { type: "refinement", refinement }
|
|
434
|
-
});
|
|
435
|
-
}
|
|
436
|
-
superRefine(refinement) {
|
|
437
|
-
return this._refinement(refinement);
|
|
438
|
-
}
|
|
439
|
-
optional() {
|
|
440
|
-
return ZodOptional.create(this, this._def);
|
|
441
|
-
}
|
|
442
|
-
nullable() {
|
|
443
|
-
return ZodNullable.create(this, this._def);
|
|
444
|
-
}
|
|
445
|
-
nullish() {
|
|
446
|
-
return this.nullable().optional();
|
|
447
|
-
}
|
|
448
|
-
array() {
|
|
449
|
-
return ZodArray.create(this, this._def);
|
|
450
|
-
}
|
|
451
|
-
promise() {
|
|
452
|
-
return ZodPromise.create(this, this._def);
|
|
453
|
-
}
|
|
454
|
-
or(option) {
|
|
455
|
-
return ZodUnion.create([this, option], this._def);
|
|
456
|
-
}
|
|
457
|
-
and(incoming) {
|
|
458
|
-
return ZodIntersection.create(this, incoming, this._def);
|
|
459
|
-
}
|
|
460
|
-
transform(transform) {
|
|
461
|
-
return new ZodEffects({
|
|
462
|
-
...processCreateParams(this._def),
|
|
463
|
-
schema: this,
|
|
464
|
-
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
465
|
-
effect: { type: "transform", transform }
|
|
466
|
-
});
|
|
467
|
-
}
|
|
468
|
-
default(def) {
|
|
469
|
-
let defaultValueFunc = typeof def == "function" ? def : () => def;
|
|
470
|
-
return new ZodDefault({
|
|
471
|
-
...processCreateParams(this._def),
|
|
472
|
-
innerType: this,
|
|
473
|
-
defaultValue: defaultValueFunc,
|
|
474
|
-
typeName: ZodFirstPartyTypeKind.ZodDefault
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
brand() {
|
|
478
|
-
return new ZodBranded({
|
|
479
|
-
typeName: ZodFirstPartyTypeKind.ZodBranded,
|
|
480
|
-
type: this,
|
|
481
|
-
...processCreateParams(this._def)
|
|
482
|
-
});
|
|
483
|
-
}
|
|
484
|
-
catch(def) {
|
|
485
|
-
let catchValueFunc = typeof def == "function" ? def : () => def;
|
|
486
|
-
return new ZodCatch({
|
|
487
|
-
...processCreateParams(this._def),
|
|
488
|
-
innerType: this,
|
|
489
|
-
catchValue: catchValueFunc,
|
|
490
|
-
typeName: ZodFirstPartyTypeKind.ZodCatch
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
describe(description) {
|
|
494
|
-
let This = this.constructor;
|
|
495
|
-
return new This({
|
|
496
|
-
...this._def,
|
|
497
|
-
description
|
|
498
|
-
});
|
|
499
|
-
}
|
|
500
|
-
pipe(target) {
|
|
501
|
-
return ZodPipeline.create(this, target);
|
|
502
|
-
}
|
|
503
|
-
readonly() {
|
|
504
|
-
return ZodReadonly.create(this);
|
|
505
|
-
}
|
|
506
|
-
isOptional() {
|
|
507
|
-
return this.safeParse(void 0).success;
|
|
508
|
-
}
|
|
509
|
-
isNullable() {
|
|
510
|
-
return this.safeParse(null).success;
|
|
511
|
-
}
|
|
512
|
-
}, cuidRegex = /^c[^\s-]{8,}$/i, cuid2Regex = /^[a-z][a-z0-9]*$/, ulidRegex = /[0-9A-HJKMNP-TV-Z]{26}/, uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, emojiRegex = /^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u, ipv4Regex = /^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/, ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/, datetimeRegex = (args) => args.precision ? args.offset ? new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`) : new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`) : args.precision === 0 ? args.offset ? new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$") : new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$") : args.offset ? new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$") : new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");
|
|
513
|
-
function isValidIP(ip, version) {
|
|
514
|
-
return !!((version === "v4" || !version) && ipv4Regex.test(ip) || (version === "v6" || !version) && ipv6Regex.test(ip));
|
|
515
|
-
}
|
|
516
|
-
var ZodString = class _ZodString extends ZodType {
|
|
517
|
-
constructor() {
|
|
518
|
-
super(...arguments), this._regex = (regex, validation, message) => this.refinement((data) => regex.test(data), {
|
|
519
|
-
validation,
|
|
520
|
-
code: ZodIssueCode.invalid_string,
|
|
521
|
-
...errorUtil.errToObj(message)
|
|
522
|
-
}), this.nonempty = (message) => this.min(1, errorUtil.errToObj(message)), this.trim = () => new _ZodString({
|
|
523
|
-
...this._def,
|
|
524
|
-
checks: [...this._def.checks, { kind: "trim" }]
|
|
525
|
-
}), this.toLowerCase = () => new _ZodString({
|
|
526
|
-
...this._def,
|
|
527
|
-
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
528
|
-
}), this.toUpperCase = () => new _ZodString({
|
|
529
|
-
...this._def,
|
|
530
|
-
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
531
|
-
});
|
|
532
|
-
}
|
|
533
|
-
_parse(input) {
|
|
534
|
-
if (this._def.coerce && (input.data = String(input.data)), this._getType(input) !== ZodParsedType.string) {
|
|
535
|
-
let ctx2 = this._getOrReturnCtx(input);
|
|
536
|
-
return addIssueToContext(
|
|
537
|
-
ctx2,
|
|
538
|
-
{
|
|
539
|
-
code: ZodIssueCode.invalid_type,
|
|
540
|
-
expected: ZodParsedType.string,
|
|
541
|
-
received: ctx2.parsedType
|
|
542
|
-
}
|
|
543
|
-
//
|
|
544
|
-
), INVALID;
|
|
545
|
-
}
|
|
546
|
-
let status = new ParseStatus(), ctx;
|
|
547
|
-
for (let check of this._def.checks)
|
|
548
|
-
if (check.kind === "min")
|
|
549
|
-
input.data.length < check.value && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
|
|
550
|
-
code: ZodIssueCode.too_small,
|
|
551
|
-
minimum: check.value,
|
|
552
|
-
type: "string",
|
|
553
|
-
inclusive: !0,
|
|
554
|
-
exact: !1,
|
|
555
|
-
message: check.message
|
|
556
|
-
}), status.dirty());
|
|
557
|
-
else if (check.kind === "max")
|
|
558
|
-
input.data.length > check.value && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
|
|
559
|
-
code: ZodIssueCode.too_big,
|
|
560
|
-
maximum: check.value,
|
|
561
|
-
type: "string",
|
|
562
|
-
inclusive: !0,
|
|
563
|
-
exact: !1,
|
|
564
|
-
message: check.message
|
|
565
|
-
}), status.dirty());
|
|
566
|
-
else if (check.kind === "length") {
|
|
567
|
-
let tooBig = input.data.length > check.value, tooSmall = input.data.length < check.value;
|
|
568
|
-
(tooBig || tooSmall) && (ctx = this._getOrReturnCtx(input, ctx), tooBig ? addIssueToContext(ctx, {
|
|
569
|
-
code: ZodIssueCode.too_big,
|
|
570
|
-
maximum: check.value,
|
|
571
|
-
type: "string",
|
|
572
|
-
inclusive: !0,
|
|
573
|
-
exact: !0,
|
|
574
|
-
message: check.message
|
|
575
|
-
}) : tooSmall && addIssueToContext(ctx, {
|
|
576
|
-
code: ZodIssueCode.too_small,
|
|
577
|
-
minimum: check.value,
|
|
578
|
-
type: "string",
|
|
579
|
-
inclusive: !0,
|
|
580
|
-
exact: !0,
|
|
581
|
-
message: check.message
|
|
582
|
-
}), status.dirty());
|
|
583
|
-
} else if (check.kind === "email")
|
|
584
|
-
emailRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
|
|
585
|
-
validation: "email",
|
|
586
|
-
code: ZodIssueCode.invalid_string,
|
|
587
|
-
message: check.message
|
|
588
|
-
}), status.dirty());
|
|
589
|
-
else if (check.kind === "emoji")
|
|
590
|
-
emojiRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
|
|
591
|
-
validation: "emoji",
|
|
592
|
-
code: ZodIssueCode.invalid_string,
|
|
593
|
-
message: check.message
|
|
594
|
-
}), status.dirty());
|
|
595
|
-
else if (check.kind === "uuid")
|
|
596
|
-
uuidRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
|
|
597
|
-
validation: "uuid",
|
|
598
|
-
code: ZodIssueCode.invalid_string,
|
|
599
|
-
message: check.message
|
|
600
|
-
}), status.dirty());
|
|
601
|
-
else if (check.kind === "cuid")
|
|
602
|
-
cuidRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
|
|
603
|
-
validation: "cuid",
|
|
604
|
-
code: ZodIssueCode.invalid_string,
|
|
605
|
-
message: check.message
|
|
606
|
-
}), status.dirty());
|
|
607
|
-
else if (check.kind === "cuid2")
|
|
608
|
-
cuid2Regex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
|
|
609
|
-
validation: "cuid2",
|
|
610
|
-
code: ZodIssueCode.invalid_string,
|
|
611
|
-
message: check.message
|
|
612
|
-
}), status.dirty());
|
|
613
|
-
else if (check.kind === "ulid")
|
|
614
|
-
ulidRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
|
|
615
|
-
validation: "ulid",
|
|
616
|
-
code: ZodIssueCode.invalid_string,
|
|
617
|
-
message: check.message
|
|
618
|
-
}), status.dirty());
|
|
619
|
-
else if (check.kind === "url")
|
|
620
|
-
try {
|
|
621
|
-
new URL(input.data);
|
|
622
|
-
} catch {
|
|
623
|
-
ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
|
|
624
|
-
validation: "url",
|
|
625
|
-
code: ZodIssueCode.invalid_string,
|
|
626
|
-
message: check.message
|
|
627
|
-
}), status.dirty();
|
|
628
|
-
}
|
|
629
|
-
else
|
|
630
|
-
check.kind === "regex" ? (check.regex.lastIndex = 0, check.regex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
|
|
631
|
-
validation: "regex",
|
|
632
|
-
code: ZodIssueCode.invalid_string,
|
|
633
|
-
message: check.message
|
|
634
|
-
}), status.dirty())) : check.kind === "trim" ? input.data = input.data.trim() : check.kind === "includes" ? input.data.includes(check.value, check.position) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
|
|
635
|
-
code: ZodIssueCode.invalid_string,
|
|
636
|
-
validation: { includes: check.value, position: check.position },
|
|
637
|
-
message: check.message
|
|
638
|
-
}), status.dirty()) : check.kind === "toLowerCase" ? input.data = input.data.toLowerCase() : check.kind === "toUpperCase" ? input.data = input.data.toUpperCase() : check.kind === "startsWith" ? input.data.startsWith(check.value) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
|
|
639
|
-
code: ZodIssueCode.invalid_string,
|
|
640
|
-
validation: { startsWith: check.value },
|
|
641
|
-
message: check.message
|
|
642
|
-
}), status.dirty()) : check.kind === "endsWith" ? input.data.endsWith(check.value) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
|
|
643
|
-
code: ZodIssueCode.invalid_string,
|
|
644
|
-
validation: { endsWith: check.value },
|
|
645
|
-
message: check.message
|
|
646
|
-
}), status.dirty()) : check.kind === "datetime" ? datetimeRegex(check).test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
|
|
647
|
-
code: ZodIssueCode.invalid_string,
|
|
648
|
-
validation: "datetime",
|
|
649
|
-
message: check.message
|
|
650
|
-
}), status.dirty()) : check.kind === "ip" ? isValidIP(input.data, check.version) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
|
|
651
|
-
validation: "ip",
|
|
652
|
-
code: ZodIssueCode.invalid_string,
|
|
653
|
-
message: check.message
|
|
654
|
-
}), status.dirty()) : util.assertNever(check);
|
|
655
|
-
return { status: status.value, value: input.data };
|
|
656
|
-
}
|
|
657
|
-
_addCheck(check) {
|
|
658
|
-
return new _ZodString({
|
|
659
|
-
...this._def,
|
|
660
|
-
checks: [...this._def.checks, check]
|
|
661
|
-
});
|
|
662
|
-
}
|
|
663
|
-
email(message) {
|
|
664
|
-
return this._addCheck({ kind: "email", ...errorUtil.errToObj(message) });
|
|
665
|
-
}
|
|
666
|
-
url(message) {
|
|
667
|
-
return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
|
|
668
|
-
}
|
|
669
|
-
emoji(message) {
|
|
670
|
-
return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
|
|
671
|
-
}
|
|
672
|
-
uuid(message) {
|
|
673
|
-
return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
|
|
674
|
-
}
|
|
675
|
-
cuid(message) {
|
|
676
|
-
return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
|
|
677
|
-
}
|
|
678
|
-
cuid2(message) {
|
|
679
|
-
return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
|
|
680
|
-
}
|
|
681
|
-
ulid(message) {
|
|
682
|
-
return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
|
|
683
|
-
}
|
|
684
|
-
ip(options) {
|
|
685
|
-
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
|
|
686
|
-
}
|
|
687
|
-
datetime(options) {
|
|
688
|
-
var _a;
|
|
689
|
-
return typeof options == "string" ? this._addCheck({
|
|
690
|
-
kind: "datetime",
|
|
691
|
-
precision: null,
|
|
692
|
-
offset: !1,
|
|
693
|
-
message: options
|
|
694
|
-
}) : this._addCheck({
|
|
695
|
-
kind: "datetime",
|
|
696
|
-
precision: typeof options?.precision > "u" ? null : options?.precision,
|
|
697
|
-
offset: (_a = options?.offset) !== null && _a !== void 0 ? _a : !1,
|
|
698
|
-
...errorUtil.errToObj(options?.message)
|
|
699
|
-
});
|
|
700
|
-
}
|
|
701
|
-
regex(regex, message) {
|
|
702
|
-
return this._addCheck({
|
|
703
|
-
kind: "regex",
|
|
704
|
-
regex,
|
|
705
|
-
...errorUtil.errToObj(message)
|
|
706
|
-
});
|
|
707
|
-
}
|
|
708
|
-
includes(value, options) {
|
|
709
|
-
return this._addCheck({
|
|
710
|
-
kind: "includes",
|
|
711
|
-
value,
|
|
712
|
-
position: options?.position,
|
|
713
|
-
...errorUtil.errToObj(options?.message)
|
|
714
|
-
});
|
|
715
|
-
}
|
|
716
|
-
startsWith(value, message) {
|
|
717
|
-
return this._addCheck({
|
|
718
|
-
kind: "startsWith",
|
|
719
|
-
value,
|
|
720
|
-
...errorUtil.errToObj(message)
|
|
721
|
-
});
|
|
722
|
-
}
|
|
723
|
-
endsWith(value, message) {
|
|
724
|
-
return this._addCheck({
|
|
725
|
-
kind: "endsWith",
|
|
726
|
-
value,
|
|
727
|
-
...errorUtil.errToObj(message)
|
|
728
|
-
});
|
|
729
|
-
}
|
|
730
|
-
min(minLength, message) {
|
|
731
|
-
return this._addCheck({
|
|
732
|
-
kind: "min",
|
|
733
|
-
value: minLength,
|
|
734
|
-
...errorUtil.errToObj(message)
|
|
735
|
-
});
|
|
736
|
-
}
|
|
737
|
-
max(maxLength, message) {
|
|
738
|
-
return this._addCheck({
|
|
739
|
-
kind: "max",
|
|
740
|
-
value: maxLength,
|
|
741
|
-
...errorUtil.errToObj(message)
|
|
742
|
-
});
|
|
743
|
-
}
|
|
744
|
-
length(len, message) {
|
|
745
|
-
return this._addCheck({
|
|
746
|
-
kind: "length",
|
|
747
|
-
value: len,
|
|
748
|
-
...errorUtil.errToObj(message)
|
|
749
|
-
});
|
|
750
|
-
}
|
|
751
|
-
get isDatetime() {
|
|
752
|
-
return !!this._def.checks.find((ch) => ch.kind === "datetime");
|
|
753
|
-
}
|
|
754
|
-
get isEmail() {
|
|
755
|
-
return !!this._def.checks.find((ch) => ch.kind === "email");
|
|
756
|
-
}
|
|
757
|
-
get isURL() {
|
|
758
|
-
return !!this._def.checks.find((ch) => ch.kind === "url");
|
|
759
|
-
}
|
|
760
|
-
get isEmoji() {
|
|
761
|
-
return !!this._def.checks.find((ch) => ch.kind === "emoji");
|
|
762
|
-
}
|
|
763
|
-
get isUUID() {
|
|
764
|
-
return !!this._def.checks.find((ch) => ch.kind === "uuid");
|
|
765
|
-
}
|
|
766
|
-
get isCUID() {
|
|
767
|
-
return !!this._def.checks.find((ch) => ch.kind === "cuid");
|
|
768
|
-
}
|
|
769
|
-
get isCUID2() {
|
|
770
|
-
return !!this._def.checks.find((ch) => ch.kind === "cuid2");
|
|
771
|
-
}
|
|
772
|
-
get isULID() {
|
|
773
|
-
return !!this._def.checks.find((ch) => ch.kind === "ulid");
|
|
774
|
-
}
|
|
775
|
-
get isIP() {
|
|
776
|
-
return !!this._def.checks.find((ch) => ch.kind === "ip");
|
|
777
|
-
}
|
|
778
|
-
get minLength() {
|
|
779
|
-
let min = null;
|
|
780
|
-
for (let ch of this._def.checks)
|
|
781
|
-
ch.kind === "min" && (min === null || ch.value > min) && (min = ch.value);
|
|
782
|
-
return min;
|
|
783
|
-
}
|
|
784
|
-
get maxLength() {
|
|
785
|
-
let max = null;
|
|
786
|
-
for (let ch of this._def.checks)
|
|
787
|
-
ch.kind === "max" && (max === null || ch.value < max) && (max = ch.value);
|
|
788
|
-
return max;
|
|
789
|
-
}
|
|
790
|
-
};
|
|
791
|
-
ZodString.create = (params) => {
|
|
792
|
-
var _a;
|
|
793
|
-
return new ZodString({
|
|
794
|
-
checks: [],
|
|
795
|
-
typeName: ZodFirstPartyTypeKind.ZodString,
|
|
796
|
-
coerce: (_a = params?.coerce) !== null && _a !== void 0 ? _a : !1,
|
|
797
|
-
...processCreateParams(params)
|
|
798
|
-
});
|
|
799
|
-
};
|
|
800
|
-
function floatSafeRemainder(val, step) {
|
|
801
|
-
let valDecCount = (val.toString().split(".")[1] || "").length, stepDecCount = (step.toString().split(".")[1] || "").length, decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount, valInt = parseInt(val.toFixed(decCount).replace(".", "")), stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
|
|
802
|
-
return valInt % stepInt / Math.pow(10, decCount);
|
|
803
|
-
}
|
|
804
|
-
var ZodNumber = class _ZodNumber extends ZodType {
|
|
805
|
-
constructor() {
|
|
806
|
-
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
807
|
-
}
|
|
808
|
-
_parse(input) {
|
|
809
|
-
if (this._def.coerce && (input.data = Number(input.data)), this._getType(input) !== ZodParsedType.number) {
|
|
810
|
-
let ctx2 = this._getOrReturnCtx(input);
|
|
811
|
-
return addIssueToContext(ctx2, {
|
|
812
|
-
code: ZodIssueCode.invalid_type,
|
|
813
|
-
expected: ZodParsedType.number,
|
|
814
|
-
received: ctx2.parsedType
|
|
815
|
-
}), INVALID;
|
|
816
|
-
}
|
|
817
|
-
let ctx, status = new ParseStatus();
|
|
818
|
-
for (let check of this._def.checks)
|
|
819
|
-
check.kind === "int" ? util.isInteger(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
|
|
820
|
-
code: ZodIssueCode.invalid_type,
|
|
821
|
-
expected: "integer",
|
|
822
|
-
received: "float",
|
|
823
|
-
message: check.message
|
|
824
|
-
}), status.dirty()) : check.kind === "min" ? (check.inclusive ? input.data < check.value : input.data <= check.value) && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
|
|
825
|
-
code: ZodIssueCode.too_small,
|
|
826
|
-
minimum: check.value,
|
|
827
|
-
type: "number",
|
|
828
|
-
inclusive: check.inclusive,
|
|
829
|
-
exact: !1,
|
|
830
|
-
message: check.message
|
|
831
|
-
}), status.dirty()) : check.kind === "max" ? (check.inclusive ? input.data > check.value : input.data >= check.value) && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
|
|
832
|
-
code: ZodIssueCode.too_big,
|
|
833
|
-
maximum: check.value,
|
|
834
|
-
type: "number",
|
|
835
|
-
inclusive: check.inclusive,
|
|
836
|
-
exact: !1,
|
|
837
|
-
message: check.message
|
|
838
|
-
}), status.dirty()) : check.kind === "multipleOf" ? floatSafeRemainder(input.data, check.value) !== 0 && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
|
|
839
|
-
code: ZodIssueCode.not_multiple_of,
|
|
840
|
-
multipleOf: check.value,
|
|
841
|
-
message: check.message
|
|
842
|
-
}), status.dirty()) : check.kind === "finite" ? Number.isFinite(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
|
|
843
|
-
code: ZodIssueCode.not_finite,
|
|
844
|
-
message: check.message
|
|
845
|
-
}), status.dirty()) : util.assertNever(check);
|
|
846
|
-
return { status: status.value, value: input.data };
|
|
847
|
-
}
|
|
848
|
-
gte(value, message) {
|
|
849
|
-
return this.setLimit("min", value, !0, errorUtil.toString(message));
|
|
850
|
-
}
|
|
851
|
-
gt(value, message) {
|
|
852
|
-
return this.setLimit("min", value, !1, errorUtil.toString(message));
|
|
853
|
-
}
|
|
854
|
-
lte(value, message) {
|
|
855
|
-
return this.setLimit("max", value, !0, errorUtil.toString(message));
|
|
856
|
-
}
|
|
857
|
-
lt(value, message) {
|
|
858
|
-
return this.setLimit("max", value, !1, errorUtil.toString(message));
|
|
859
|
-
}
|
|
860
|
-
setLimit(kind, value, inclusive, message) {
|
|
861
|
-
return new _ZodNumber({
|
|
862
|
-
...this._def,
|
|
863
|
-
checks: [
|
|
864
|
-
...this._def.checks,
|
|
865
|
-
{
|
|
866
|
-
kind,
|
|
867
|
-
value,
|
|
868
|
-
inclusive,
|
|
869
|
-
message: errorUtil.toString(message)
|
|
870
|
-
}
|
|
871
|
-
]
|
|
872
|
-
});
|
|
873
|
-
}
|
|
874
|
-
_addCheck(check) {
|
|
875
|
-
return new _ZodNumber({
|
|
876
|
-
...this._def,
|
|
877
|
-
checks: [...this._def.checks, check]
|
|
878
|
-
});
|
|
879
|
-
}
|
|
880
|
-
int(message) {
|
|
881
|
-
return this._addCheck({
|
|
882
|
-
kind: "int",
|
|
883
|
-
message: errorUtil.toString(message)
|
|
884
|
-
});
|
|
885
|
-
}
|
|
886
|
-
positive(message) {
|
|
887
|
-
return this._addCheck({
|
|
888
|
-
kind: "min",
|
|
889
|
-
value: 0,
|
|
890
|
-
inclusive: !1,
|
|
891
|
-
message: errorUtil.toString(message)
|
|
892
|
-
});
|
|
893
|
-
}
|
|
894
|
-
negative(message) {
|
|
895
|
-
return this._addCheck({
|
|
896
|
-
kind: "max",
|
|
897
|
-
value: 0,
|
|
898
|
-
inclusive: !1,
|
|
899
|
-
message: errorUtil.toString(message)
|
|
900
|
-
});
|
|
901
|
-
}
|
|
902
|
-
nonpositive(message) {
|
|
903
|
-
return this._addCheck({
|
|
904
|
-
kind: "max",
|
|
905
|
-
value: 0,
|
|
906
|
-
inclusive: !0,
|
|
907
|
-
message: errorUtil.toString(message)
|
|
908
|
-
});
|
|
909
|
-
}
|
|
910
|
-
nonnegative(message) {
|
|
911
|
-
return this._addCheck({
|
|
912
|
-
kind: "min",
|
|
913
|
-
value: 0,
|
|
914
|
-
inclusive: !0,
|
|
915
|
-
message: errorUtil.toString(message)
|
|
916
|
-
});
|
|
917
|
-
}
|
|
918
|
-
multipleOf(value, message) {
|
|
919
|
-
return this._addCheck({
|
|
920
|
-
kind: "multipleOf",
|
|
921
|
-
value,
|
|
922
|
-
message: errorUtil.toString(message)
|
|
923
|
-
});
|
|
924
|
-
}
|
|
925
|
-
finite(message) {
|
|
926
|
-
return this._addCheck({
|
|
927
|
-
kind: "finite",
|
|
928
|
-
message: errorUtil.toString(message)
|
|
929
|
-
});
|
|
930
|
-
}
|
|
931
|
-
safe(message) {
|
|
932
|
-
return this._addCheck({
|
|
933
|
-
kind: "min",
|
|
934
|
-
inclusive: !0,
|
|
935
|
-
value: Number.MIN_SAFE_INTEGER,
|
|
936
|
-
message: errorUtil.toString(message)
|
|
937
|
-
})._addCheck({
|
|
938
|
-
kind: "max",
|
|
939
|
-
inclusive: !0,
|
|
940
|
-
value: Number.MAX_SAFE_INTEGER,
|
|
941
|
-
message: errorUtil.toString(message)
|
|
942
|
-
});
|
|
943
|
-
}
|
|
944
|
-
get minValue() {
|
|
945
|
-
let min = null;
|
|
946
|
-
for (let ch of this._def.checks)
|
|
947
|
-
ch.kind === "min" && (min === null || ch.value > min) && (min = ch.value);
|
|
948
|
-
return min;
|
|
949
|
-
}
|
|
950
|
-
get maxValue() {
|
|
951
|
-
let max = null;
|
|
952
|
-
for (let ch of this._def.checks)
|
|
953
|
-
ch.kind === "max" && (max === null || ch.value < max) && (max = ch.value);
|
|
954
|
-
return max;
|
|
955
|
-
}
|
|
956
|
-
get isInt() {
|
|
957
|
-
return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
|
|
958
|
-
}
|
|
959
|
-
get isFinite() {
|
|
960
|
-
let max = null, min = null;
|
|
961
|
-
for (let ch of this._def.checks) {
|
|
962
|
-
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf")
|
|
963
|
-
return !0;
|
|
964
|
-
ch.kind === "min" ? (min === null || ch.value > min) && (min = ch.value) : ch.kind === "max" && (max === null || ch.value < max) && (max = ch.value);
|
|
965
|
-
}
|
|
966
|
-
return Number.isFinite(min) && Number.isFinite(max);
|
|
967
|
-
}
|
|
968
|
-
};
|
|
969
|
-
ZodNumber.create = (params) => new ZodNumber({
|
|
970
|
-
checks: [],
|
|
971
|
-
typeName: ZodFirstPartyTypeKind.ZodNumber,
|
|
972
|
-
coerce: params?.coerce || !1,
|
|
973
|
-
...processCreateParams(params)
|
|
974
|
-
});
|
|
975
|
-
var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
976
|
-
constructor() {
|
|
977
|
-
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
978
|
-
}
|
|
979
|
-
_parse(input) {
|
|
980
|
-
if (this._def.coerce && (input.data = BigInt(input.data)), this._getType(input) !== ZodParsedType.bigint) {
|
|
981
|
-
let ctx2 = this._getOrReturnCtx(input);
|
|
982
|
-
return addIssueToContext(ctx2, {
|
|
983
|
-
code: ZodIssueCode.invalid_type,
|
|
984
|
-
expected: ZodParsedType.bigint,
|
|
985
|
-
received: ctx2.parsedType
|
|
986
|
-
}), INVALID;
|
|
987
|
-
}
|
|
988
|
-
let ctx, status = new ParseStatus();
|
|
989
|
-
for (let check of this._def.checks)
|
|
990
|
-
check.kind === "min" ? (check.inclusive ? input.data < check.value : input.data <= check.value) && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
|
|
991
|
-
code: ZodIssueCode.too_small,
|
|
992
|
-
type: "bigint",
|
|
993
|
-
minimum: check.value,
|
|
994
|
-
inclusive: check.inclusive,
|
|
995
|
-
message: check.message
|
|
996
|
-
}), status.dirty()) : check.kind === "max" ? (check.inclusive ? input.data > check.value : input.data >= check.value) && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
|
|
997
|
-
code: ZodIssueCode.too_big,
|
|
998
|
-
type: "bigint",
|
|
999
|
-
maximum: check.value,
|
|
1000
|
-
inclusive: check.inclusive,
|
|
1001
|
-
message: check.message
|
|
1002
|
-
}), status.dirty()) : check.kind === "multipleOf" ? input.data % check.value !== BigInt(0) && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
|
|
1003
|
-
code: ZodIssueCode.not_multiple_of,
|
|
1004
|
-
multipleOf: check.value,
|
|
1005
|
-
message: check.message
|
|
1006
|
-
}), status.dirty()) : util.assertNever(check);
|
|
1007
|
-
return { status: status.value, value: input.data };
|
|
1008
|
-
}
|
|
1009
|
-
gte(value, message) {
|
|
1010
|
-
return this.setLimit("min", value, !0, errorUtil.toString(message));
|
|
1011
|
-
}
|
|
1012
|
-
gt(value, message) {
|
|
1013
|
-
return this.setLimit("min", value, !1, errorUtil.toString(message));
|
|
1014
|
-
}
|
|
1015
|
-
lte(value, message) {
|
|
1016
|
-
return this.setLimit("max", value, !0, errorUtil.toString(message));
|
|
1017
|
-
}
|
|
1018
|
-
lt(value, message) {
|
|
1019
|
-
return this.setLimit("max", value, !1, errorUtil.toString(message));
|
|
1020
|
-
}
|
|
1021
|
-
setLimit(kind, value, inclusive, message) {
|
|
1022
|
-
return new _ZodBigInt({
|
|
1023
|
-
...this._def,
|
|
1024
|
-
checks: [
|
|
1025
|
-
...this._def.checks,
|
|
1026
|
-
{
|
|
1027
|
-
kind,
|
|
1028
|
-
value,
|
|
1029
|
-
inclusive,
|
|
1030
|
-
message: errorUtil.toString(message)
|
|
1031
|
-
}
|
|
1032
|
-
]
|
|
1033
|
-
});
|
|
1034
|
-
}
|
|
1035
|
-
_addCheck(check) {
|
|
1036
|
-
return new _ZodBigInt({
|
|
1037
|
-
...this._def,
|
|
1038
|
-
checks: [...this._def.checks, check]
|
|
1039
|
-
});
|
|
1040
|
-
}
|
|
1041
|
-
positive(message) {
|
|
1042
|
-
return this._addCheck({
|
|
1043
|
-
kind: "min",
|
|
1044
|
-
value: BigInt(0),
|
|
1045
|
-
inclusive: !1,
|
|
1046
|
-
message: errorUtil.toString(message)
|
|
1047
|
-
});
|
|
1048
|
-
}
|
|
1049
|
-
negative(message) {
|
|
1050
|
-
return this._addCheck({
|
|
1051
|
-
kind: "max",
|
|
1052
|
-
value: BigInt(0),
|
|
1053
|
-
inclusive: !1,
|
|
1054
|
-
message: errorUtil.toString(message)
|
|
1055
|
-
});
|
|
1056
|
-
}
|
|
1057
|
-
nonpositive(message) {
|
|
1058
|
-
return this._addCheck({
|
|
1059
|
-
kind: "max",
|
|
1060
|
-
value: BigInt(0),
|
|
1061
|
-
inclusive: !0,
|
|
1062
|
-
message: errorUtil.toString(message)
|
|
1063
|
-
});
|
|
1064
|
-
}
|
|
1065
|
-
nonnegative(message) {
|
|
1066
|
-
return this._addCheck({
|
|
1067
|
-
kind: "min",
|
|
1068
|
-
value: BigInt(0),
|
|
1069
|
-
inclusive: !0,
|
|
1070
|
-
message: errorUtil.toString(message)
|
|
1071
|
-
});
|
|
1072
|
-
}
|
|
1073
|
-
multipleOf(value, message) {
|
|
1074
|
-
return this._addCheck({
|
|
1075
|
-
kind: "multipleOf",
|
|
1076
|
-
value,
|
|
1077
|
-
message: errorUtil.toString(message)
|
|
1078
|
-
});
|
|
1079
|
-
}
|
|
1080
|
-
get minValue() {
|
|
1081
|
-
let min = null;
|
|
1082
|
-
for (let ch of this._def.checks)
|
|
1083
|
-
ch.kind === "min" && (min === null || ch.value > min) && (min = ch.value);
|
|
1084
|
-
return min;
|
|
1085
|
-
}
|
|
1086
|
-
get maxValue() {
|
|
1087
|
-
let max = null;
|
|
1088
|
-
for (let ch of this._def.checks)
|
|
1089
|
-
ch.kind === "max" && (max === null || ch.value < max) && (max = ch.value);
|
|
1090
|
-
return max;
|
|
1091
|
-
}
|
|
1092
|
-
};
|
|
1093
|
-
ZodBigInt.create = (params) => {
|
|
1094
|
-
var _a;
|
|
1095
|
-
return new ZodBigInt({
|
|
1096
|
-
checks: [],
|
|
1097
|
-
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
|
1098
|
-
coerce: (_a = params?.coerce) !== null && _a !== void 0 ? _a : !1,
|
|
1099
|
-
...processCreateParams(params)
|
|
1100
|
-
});
|
|
1101
|
-
};
|
|
1102
|
-
var ZodBoolean = class extends ZodType {
|
|
1103
|
-
_parse(input) {
|
|
1104
|
-
if (this._def.coerce && (input.data = !!input.data), this._getType(input) !== ZodParsedType.boolean) {
|
|
1105
|
-
let ctx = this._getOrReturnCtx(input);
|
|
1106
|
-
return addIssueToContext(ctx, {
|
|
1107
|
-
code: ZodIssueCode.invalid_type,
|
|
1108
|
-
expected: ZodParsedType.boolean,
|
|
1109
|
-
received: ctx.parsedType
|
|
1110
|
-
}), INVALID;
|
|
1111
|
-
}
|
|
1112
|
-
return OK(input.data);
|
|
1113
|
-
}
|
|
1114
|
-
};
|
|
1115
|
-
ZodBoolean.create = (params) => new ZodBoolean({
|
|
1116
|
-
typeName: ZodFirstPartyTypeKind.ZodBoolean,
|
|
1117
|
-
coerce: params?.coerce || !1,
|
|
1118
|
-
...processCreateParams(params)
|
|
1119
|
-
});
|
|
1120
|
-
var ZodDate = class _ZodDate extends ZodType {
|
|
1121
|
-
_parse(input) {
|
|
1122
|
-
if (this._def.coerce && (input.data = new Date(input.data)), this._getType(input) !== ZodParsedType.date) {
|
|
1123
|
-
let ctx2 = this._getOrReturnCtx(input);
|
|
1124
|
-
return addIssueToContext(ctx2, {
|
|
1125
|
-
code: ZodIssueCode.invalid_type,
|
|
1126
|
-
expected: ZodParsedType.date,
|
|
1127
|
-
received: ctx2.parsedType
|
|
1128
|
-
}), INVALID;
|
|
1129
|
-
}
|
|
1130
|
-
if (isNaN(input.data.getTime())) {
|
|
1131
|
-
let ctx2 = this._getOrReturnCtx(input);
|
|
1132
|
-
return addIssueToContext(ctx2, {
|
|
1133
|
-
code: ZodIssueCode.invalid_date
|
|
1134
|
-
}), INVALID;
|
|
1135
|
-
}
|
|
1136
|
-
let status = new ParseStatus(), ctx;
|
|
1137
|
-
for (let check of this._def.checks)
|
|
1138
|
-
check.kind === "min" ? input.data.getTime() < check.value && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
|
|
1139
|
-
code: ZodIssueCode.too_small,
|
|
1140
|
-
message: check.message,
|
|
1141
|
-
inclusive: !0,
|
|
1142
|
-
exact: !1,
|
|
1143
|
-
minimum: check.value,
|
|
1144
|
-
type: "date"
|
|
1145
|
-
}), status.dirty()) : check.kind === "max" ? input.data.getTime() > check.value && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
|
|
1146
|
-
code: ZodIssueCode.too_big,
|
|
1147
|
-
message: check.message,
|
|
1148
|
-
inclusive: !0,
|
|
1149
|
-
exact: !1,
|
|
1150
|
-
maximum: check.value,
|
|
1151
|
-
type: "date"
|
|
1152
|
-
}), status.dirty()) : util.assertNever(check);
|
|
1153
|
-
return {
|
|
1154
|
-
status: status.value,
|
|
1155
|
-
value: new Date(input.data.getTime())
|
|
1156
|
-
};
|
|
1157
|
-
}
|
|
1158
|
-
_addCheck(check) {
|
|
1159
|
-
return new _ZodDate({
|
|
1160
|
-
...this._def,
|
|
1161
|
-
checks: [...this._def.checks, check]
|
|
1162
|
-
});
|
|
1163
|
-
}
|
|
1164
|
-
min(minDate, message) {
|
|
1165
|
-
return this._addCheck({
|
|
1166
|
-
kind: "min",
|
|
1167
|
-
value: minDate.getTime(),
|
|
1168
|
-
message: errorUtil.toString(message)
|
|
1169
|
-
});
|
|
1170
|
-
}
|
|
1171
|
-
max(maxDate, message) {
|
|
1172
|
-
return this._addCheck({
|
|
1173
|
-
kind: "max",
|
|
1174
|
-
value: maxDate.getTime(),
|
|
1175
|
-
message: errorUtil.toString(message)
|
|
1176
|
-
});
|
|
1177
|
-
}
|
|
1178
|
-
get minDate() {
|
|
1179
|
-
let min = null;
|
|
1180
|
-
for (let ch of this._def.checks)
|
|
1181
|
-
ch.kind === "min" && (min === null || ch.value > min) && (min = ch.value);
|
|
1182
|
-
return min != null ? new Date(min) : null;
|
|
1183
|
-
}
|
|
1184
|
-
get maxDate() {
|
|
1185
|
-
let max = null;
|
|
1186
|
-
for (let ch of this._def.checks)
|
|
1187
|
-
ch.kind === "max" && (max === null || ch.value < max) && (max = ch.value);
|
|
1188
|
-
return max != null ? new Date(max) : null;
|
|
1189
|
-
}
|
|
1190
|
-
};
|
|
1191
|
-
ZodDate.create = (params) => new ZodDate({
|
|
1192
|
-
checks: [],
|
|
1193
|
-
coerce: params?.coerce || !1,
|
|
1194
|
-
typeName: ZodFirstPartyTypeKind.ZodDate,
|
|
1195
|
-
...processCreateParams(params)
|
|
1196
|
-
});
|
|
1197
|
-
var ZodSymbol = class extends ZodType {
|
|
1198
|
-
_parse(input) {
|
|
1199
|
-
if (this._getType(input) !== ZodParsedType.symbol) {
|
|
1200
|
-
let ctx = this._getOrReturnCtx(input);
|
|
1201
|
-
return addIssueToContext(ctx, {
|
|
1202
|
-
code: ZodIssueCode.invalid_type,
|
|
1203
|
-
expected: ZodParsedType.symbol,
|
|
1204
|
-
received: ctx.parsedType
|
|
1205
|
-
}), INVALID;
|
|
1206
|
-
}
|
|
1207
|
-
return OK(input.data);
|
|
1208
|
-
}
|
|
1209
|
-
};
|
|
1210
|
-
ZodSymbol.create = (params) => new ZodSymbol({
|
|
1211
|
-
typeName: ZodFirstPartyTypeKind.ZodSymbol,
|
|
1212
|
-
...processCreateParams(params)
|
|
1213
|
-
});
|
|
1214
|
-
var ZodUndefined = class extends ZodType {
|
|
1215
|
-
_parse(input) {
|
|
1216
|
-
if (this._getType(input) !== ZodParsedType.undefined) {
|
|
1217
|
-
let ctx = this._getOrReturnCtx(input);
|
|
1218
|
-
return addIssueToContext(ctx, {
|
|
1219
|
-
code: ZodIssueCode.invalid_type,
|
|
1220
|
-
expected: ZodParsedType.undefined,
|
|
1221
|
-
received: ctx.parsedType
|
|
1222
|
-
}), INVALID;
|
|
1223
|
-
}
|
|
1224
|
-
return OK(input.data);
|
|
1225
|
-
}
|
|
1226
|
-
};
|
|
1227
|
-
ZodUndefined.create = (params) => new ZodUndefined({
|
|
1228
|
-
typeName: ZodFirstPartyTypeKind.ZodUndefined,
|
|
1229
|
-
...processCreateParams(params)
|
|
1230
|
-
});
|
|
1231
|
-
var ZodNull = class extends ZodType {
|
|
1232
|
-
_parse(input) {
|
|
1233
|
-
if (this._getType(input) !== ZodParsedType.null) {
|
|
1234
|
-
let ctx = this._getOrReturnCtx(input);
|
|
1235
|
-
return addIssueToContext(ctx, {
|
|
1236
|
-
code: ZodIssueCode.invalid_type,
|
|
1237
|
-
expected: ZodParsedType.null,
|
|
1238
|
-
received: ctx.parsedType
|
|
1239
|
-
}), INVALID;
|
|
1240
|
-
}
|
|
1241
|
-
return OK(input.data);
|
|
1242
|
-
}
|
|
1243
|
-
};
|
|
1244
|
-
ZodNull.create = (params) => new ZodNull({
|
|
1245
|
-
typeName: ZodFirstPartyTypeKind.ZodNull,
|
|
1246
|
-
...processCreateParams(params)
|
|
1247
|
-
});
|
|
1248
|
-
var ZodAny = class extends ZodType {
|
|
1249
|
-
constructor() {
|
|
1250
|
-
super(...arguments), this._any = !0;
|
|
1251
|
-
}
|
|
1252
|
-
_parse(input) {
|
|
1253
|
-
return OK(input.data);
|
|
1254
|
-
}
|
|
1255
|
-
};
|
|
1256
|
-
ZodAny.create = (params) => new ZodAny({
|
|
1257
|
-
typeName: ZodFirstPartyTypeKind.ZodAny,
|
|
1258
|
-
...processCreateParams(params)
|
|
1259
|
-
});
|
|
1260
|
-
var ZodUnknown = class extends ZodType {
|
|
1261
|
-
constructor() {
|
|
1262
|
-
super(...arguments), this._unknown = !0;
|
|
1263
|
-
}
|
|
1264
|
-
_parse(input) {
|
|
1265
|
-
return OK(input.data);
|
|
1266
|
-
}
|
|
1267
|
-
};
|
|
1268
|
-
ZodUnknown.create = (params) => new ZodUnknown({
|
|
1269
|
-
typeName: ZodFirstPartyTypeKind.ZodUnknown,
|
|
1270
|
-
...processCreateParams(params)
|
|
1271
|
-
});
|
|
1272
|
-
var ZodNever = class extends ZodType {
|
|
1273
|
-
_parse(input) {
|
|
1274
|
-
let ctx = this._getOrReturnCtx(input);
|
|
1275
|
-
return addIssueToContext(ctx, {
|
|
1276
|
-
code: ZodIssueCode.invalid_type,
|
|
1277
|
-
expected: ZodParsedType.never,
|
|
1278
|
-
received: ctx.parsedType
|
|
1279
|
-
}), INVALID;
|
|
1280
|
-
}
|
|
1281
|
-
};
|
|
1282
|
-
ZodNever.create = (params) => new ZodNever({
|
|
1283
|
-
typeName: ZodFirstPartyTypeKind.ZodNever,
|
|
1284
|
-
...processCreateParams(params)
|
|
1285
|
-
});
|
|
1286
|
-
var ZodVoid = class extends ZodType {
|
|
1287
|
-
_parse(input) {
|
|
1288
|
-
if (this._getType(input) !== ZodParsedType.undefined) {
|
|
1289
|
-
let ctx = this._getOrReturnCtx(input);
|
|
1290
|
-
return addIssueToContext(ctx, {
|
|
1291
|
-
code: ZodIssueCode.invalid_type,
|
|
1292
|
-
expected: ZodParsedType.void,
|
|
1293
|
-
received: ctx.parsedType
|
|
1294
|
-
}), INVALID;
|
|
1295
|
-
}
|
|
1296
|
-
return OK(input.data);
|
|
1297
|
-
}
|
|
1298
|
-
};
|
|
1299
|
-
ZodVoid.create = (params) => new ZodVoid({
|
|
1300
|
-
typeName: ZodFirstPartyTypeKind.ZodVoid,
|
|
1301
|
-
...processCreateParams(params)
|
|
1302
|
-
});
|
|
1303
|
-
var ZodArray = class _ZodArray extends ZodType {
|
|
1304
|
-
_parse(input) {
|
|
1305
|
-
let { ctx, status } = this._processInputParams(input), def = this._def;
|
|
1306
|
-
if (ctx.parsedType !== ZodParsedType.array)
|
|
1307
|
-
return addIssueToContext(ctx, {
|
|
1308
|
-
code: ZodIssueCode.invalid_type,
|
|
1309
|
-
expected: ZodParsedType.array,
|
|
1310
|
-
received: ctx.parsedType
|
|
1311
|
-
}), INVALID;
|
|
1312
|
-
if (def.exactLength !== null) {
|
|
1313
|
-
let tooBig = ctx.data.length > def.exactLength.value, tooSmall = ctx.data.length < def.exactLength.value;
|
|
1314
|
-
(tooBig || tooSmall) && (addIssueToContext(ctx, {
|
|
1315
|
-
code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,
|
|
1316
|
-
minimum: tooSmall ? def.exactLength.value : void 0,
|
|
1317
|
-
maximum: tooBig ? def.exactLength.value : void 0,
|
|
1318
|
-
type: "array",
|
|
1319
|
-
inclusive: !0,
|
|
1320
|
-
exact: !0,
|
|
1321
|
-
message: def.exactLength.message
|
|
1322
|
-
}), status.dirty());
|
|
1323
|
-
}
|
|
1324
|
-
if (def.minLength !== null && ctx.data.length < def.minLength.value && (addIssueToContext(ctx, {
|
|
1325
|
-
code: ZodIssueCode.too_small,
|
|
1326
|
-
minimum: def.minLength.value,
|
|
1327
|
-
type: "array",
|
|
1328
|
-
inclusive: !0,
|
|
1329
|
-
exact: !1,
|
|
1330
|
-
message: def.minLength.message
|
|
1331
|
-
}), status.dirty()), def.maxLength !== null && ctx.data.length > def.maxLength.value && (addIssueToContext(ctx, {
|
|
1332
|
-
code: ZodIssueCode.too_big,
|
|
1333
|
-
maximum: def.maxLength.value,
|
|
1334
|
-
type: "array",
|
|
1335
|
-
inclusive: !0,
|
|
1336
|
-
exact: !1,
|
|
1337
|
-
message: def.maxLength.message
|
|
1338
|
-
}), status.dirty()), ctx.common.async)
|
|
1339
|
-
return Promise.all([...ctx.data].map((item, i) => def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i)))).then((result2) => ParseStatus.mergeArray(status, result2));
|
|
1340
|
-
let result = [...ctx.data].map((item, i) => def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i)));
|
|
1341
|
-
return ParseStatus.mergeArray(status, result);
|
|
1342
|
-
}
|
|
1343
|
-
get element() {
|
|
1344
|
-
return this._def.type;
|
|
1345
|
-
}
|
|
1346
|
-
min(minLength, message) {
|
|
1347
|
-
return new _ZodArray({
|
|
1348
|
-
...this._def,
|
|
1349
|
-
minLength: { value: minLength, message: errorUtil.toString(message) }
|
|
1350
|
-
});
|
|
1351
|
-
}
|
|
1352
|
-
max(maxLength, message) {
|
|
1353
|
-
return new _ZodArray({
|
|
1354
|
-
...this._def,
|
|
1355
|
-
maxLength: { value: maxLength, message: errorUtil.toString(message) }
|
|
1356
|
-
});
|
|
1357
|
-
}
|
|
1358
|
-
length(len, message) {
|
|
1359
|
-
return new _ZodArray({
|
|
1360
|
-
...this._def,
|
|
1361
|
-
exactLength: { value: len, message: errorUtil.toString(message) }
|
|
1362
|
-
});
|
|
1363
|
-
}
|
|
1364
|
-
nonempty(message) {
|
|
1365
|
-
return this.min(1, message);
|
|
1366
|
-
}
|
|
1367
|
-
};
|
|
1368
|
-
ZodArray.create = (schema, params) => new ZodArray({
|
|
1369
|
-
type: schema,
|
|
1370
|
-
minLength: null,
|
|
1371
|
-
maxLength: null,
|
|
1372
|
-
exactLength: null,
|
|
1373
|
-
typeName: ZodFirstPartyTypeKind.ZodArray,
|
|
1374
|
-
...processCreateParams(params)
|
|
1375
|
-
});
|
|
1376
|
-
function deepPartialify(schema) {
|
|
1377
|
-
if (schema instanceof ZodObject) {
|
|
1378
|
-
let newShape = {};
|
|
1379
|
-
for (let key in schema.shape) {
|
|
1380
|
-
let fieldSchema = schema.shape[key];
|
|
1381
|
-
newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
|
|
1382
|
-
}
|
|
1383
|
-
return new ZodObject({
|
|
1384
|
-
...schema._def,
|
|
1385
|
-
shape: () => newShape
|
|
1386
|
-
});
|
|
1387
|
-
} else
|
|
1388
|
-
return schema instanceof ZodArray ? new ZodArray({
|
|
1389
|
-
...schema._def,
|
|
1390
|
-
type: deepPartialify(schema.element)
|
|
1391
|
-
}) : schema instanceof ZodOptional ? ZodOptional.create(deepPartialify(schema.unwrap())) : schema instanceof ZodNullable ? ZodNullable.create(deepPartialify(schema.unwrap())) : schema instanceof ZodTuple ? ZodTuple.create(schema.items.map((item) => deepPartialify(item))) : schema;
|
|
1392
|
-
}
|
|
1393
|
-
var ZodObject = class _ZodObject extends ZodType {
|
|
1394
|
-
constructor() {
|
|
1395
|
-
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
1396
|
-
}
|
|
1397
|
-
_getCached() {
|
|
1398
|
-
if (this._cached !== null)
|
|
1399
|
-
return this._cached;
|
|
1400
|
-
let shape = this._def.shape(), keys = util.objectKeys(shape);
|
|
1401
|
-
return this._cached = { shape, keys };
|
|
1402
|
-
}
|
|
1403
|
-
_parse(input) {
|
|
1404
|
-
if (this._getType(input) !== ZodParsedType.object) {
|
|
1405
|
-
let ctx2 = this._getOrReturnCtx(input);
|
|
1406
|
-
return addIssueToContext(ctx2, {
|
|
1407
|
-
code: ZodIssueCode.invalid_type,
|
|
1408
|
-
expected: ZodParsedType.object,
|
|
1409
|
-
received: ctx2.parsedType
|
|
1410
|
-
}), INVALID;
|
|
1411
|
-
}
|
|
1412
|
-
let { status, ctx } = this._processInputParams(input), { shape, keys: shapeKeys } = this._getCached(), extraKeys = [];
|
|
1413
|
-
if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip"))
|
|
1414
|
-
for (let key in ctx.data)
|
|
1415
|
-
shapeKeys.includes(key) || extraKeys.push(key);
|
|
1416
|
-
let pairs = [];
|
|
1417
|
-
for (let key of shapeKeys) {
|
|
1418
|
-
let keyValidator = shape[key], value = ctx.data[key];
|
|
1419
|
-
pairs.push({
|
|
1420
|
-
key: { status: "valid", value: key },
|
|
1421
|
-
value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
|
|
1422
|
-
alwaysSet: key in ctx.data
|
|
1423
|
-
});
|
|
1424
|
-
}
|
|
1425
|
-
if (this._def.catchall instanceof ZodNever) {
|
|
1426
|
-
let unknownKeys = this._def.unknownKeys;
|
|
1427
|
-
if (unknownKeys === "passthrough")
|
|
1428
|
-
for (let key of extraKeys)
|
|
1429
|
-
pairs.push({
|
|
1430
|
-
key: { status: "valid", value: key },
|
|
1431
|
-
value: { status: "valid", value: ctx.data[key] }
|
|
1432
|
-
});
|
|
1433
|
-
else if (unknownKeys === "strict")
|
|
1434
|
-
extraKeys.length > 0 && (addIssueToContext(ctx, {
|
|
1435
|
-
code: ZodIssueCode.unrecognized_keys,
|
|
1436
|
-
keys: extraKeys
|
|
1437
|
-
}), status.dirty());
|
|
1438
|
-
else if (unknownKeys !== "strip")
|
|
1439
|
-
throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1440
|
-
} else {
|
|
1441
|
-
let catchall = this._def.catchall;
|
|
1442
|
-
for (let key of extraKeys) {
|
|
1443
|
-
let value = ctx.data[key];
|
|
1444
|
-
pairs.push({
|
|
1445
|
-
key: { status: "valid", value: key },
|
|
1446
|
-
value: catchall._parse(
|
|
1447
|
-
new ParseInputLazyPath(ctx, value, ctx.path, key)
|
|
1448
|
-
//, ctx.child(key), value, getParsedType(value)
|
|
1449
|
-
),
|
|
1450
|
-
alwaysSet: key in ctx.data
|
|
1451
|
-
});
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
return ctx.common.async ? Promise.resolve().then(async () => {
|
|
1455
|
-
let syncPairs = [];
|
|
1456
|
-
for (let pair of pairs) {
|
|
1457
|
-
let key = await pair.key;
|
|
1458
|
-
syncPairs.push({
|
|
1459
|
-
key,
|
|
1460
|
-
value: await pair.value,
|
|
1461
|
-
alwaysSet: pair.alwaysSet
|
|
1462
|
-
});
|
|
1463
|
-
}
|
|
1464
|
-
return syncPairs;
|
|
1465
|
-
}).then((syncPairs) => ParseStatus.mergeObjectSync(status, syncPairs)) : ParseStatus.mergeObjectSync(status, pairs);
|
|
1466
|
-
}
|
|
1467
|
-
get shape() {
|
|
1468
|
-
return this._def.shape();
|
|
1469
|
-
}
|
|
1470
|
-
strict(message) {
|
|
1471
|
-
return errorUtil.errToObj, new _ZodObject({
|
|
1472
|
-
...this._def,
|
|
1473
|
-
unknownKeys: "strict",
|
|
1474
|
-
...message !== void 0 ? {
|
|
1475
|
-
errorMap: (issue, ctx) => {
|
|
1476
|
-
var _a, _b, _c, _d;
|
|
1477
|
-
let defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
|
|
1478
|
-
return issue.code === "unrecognized_keys" ? {
|
|
1479
|
-
message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError
|
|
1480
|
-
} : {
|
|
1481
|
-
message: defaultError
|
|
1482
|
-
};
|
|
1483
|
-
}
|
|
1484
|
-
} : {}
|
|
1485
|
-
});
|
|
1486
|
-
}
|
|
1487
|
-
strip() {
|
|
1488
|
-
return new _ZodObject({
|
|
1489
|
-
...this._def,
|
|
1490
|
-
unknownKeys: "strip"
|
|
1491
|
-
});
|
|
1492
|
-
}
|
|
1493
|
-
passthrough() {
|
|
1494
|
-
return new _ZodObject({
|
|
1495
|
-
...this._def,
|
|
1496
|
-
unknownKeys: "passthrough"
|
|
1497
|
-
});
|
|
1498
|
-
}
|
|
1499
|
-
// const AugmentFactory =
|
|
1500
|
-
// <Def extends ZodObjectDef>(def: Def) =>
|
|
1501
|
-
// <Augmentation extends ZodRawShape>(
|
|
1502
|
-
// augmentation: Augmentation
|
|
1503
|
-
// ): ZodObject<
|
|
1504
|
-
// extendShape<ReturnType<Def["shape"]>, Augmentation>,
|
|
1505
|
-
// Def["unknownKeys"],
|
|
1506
|
-
// Def["catchall"]
|
|
1507
|
-
// > => {
|
|
1508
|
-
// return new ZodObject({
|
|
1509
|
-
// ...def,
|
|
1510
|
-
// shape: () => ({
|
|
1511
|
-
// ...def.shape(),
|
|
1512
|
-
// ...augmentation,
|
|
1513
|
-
// }),
|
|
1514
|
-
// }) as any;
|
|
1515
|
-
// };
|
|
1516
|
-
extend(augmentation) {
|
|
1517
|
-
return new _ZodObject({
|
|
1518
|
-
...this._def,
|
|
1519
|
-
shape: () => ({
|
|
1520
|
-
...this._def.shape(),
|
|
1521
|
-
...augmentation
|
|
1522
|
-
})
|
|
1523
|
-
});
|
|
1524
|
-
}
|
|
1525
|
-
/**
|
|
1526
|
-
* Prior to zod@1.0.12 there was a bug in the
|
|
1527
|
-
* inferred type of merged objects. Please
|
|
1528
|
-
* upgrade if you are experiencing issues.
|
|
1529
|
-
*/
|
|
1530
|
-
merge(merging) {
|
|
1531
|
-
return new _ZodObject({
|
|
1532
|
-
unknownKeys: merging._def.unknownKeys,
|
|
1533
|
-
catchall: merging._def.catchall,
|
|
1534
|
-
shape: () => ({
|
|
1535
|
-
...this._def.shape(),
|
|
1536
|
-
...merging._def.shape()
|
|
1537
|
-
}),
|
|
1538
|
-
typeName: ZodFirstPartyTypeKind.ZodObject
|
|
1539
|
-
});
|
|
1540
|
-
}
|
|
1541
|
-
// merge<
|
|
1542
|
-
// Incoming extends AnyZodObject,
|
|
1543
|
-
// Augmentation extends Incoming["shape"],
|
|
1544
|
-
// NewOutput extends {
|
|
1545
|
-
// [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
|
|
1546
|
-
// ? Augmentation[k]["_output"]
|
|
1547
|
-
// : k extends keyof Output
|
|
1548
|
-
// ? Output[k]
|
|
1549
|
-
// : never;
|
|
1550
|
-
// },
|
|
1551
|
-
// NewInput extends {
|
|
1552
|
-
// [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
|
|
1553
|
-
// ? Augmentation[k]["_input"]
|
|
1554
|
-
// : k extends keyof Input
|
|
1555
|
-
// ? Input[k]
|
|
1556
|
-
// : never;
|
|
1557
|
-
// }
|
|
1558
|
-
// >(
|
|
1559
|
-
// merging: Incoming
|
|
1560
|
-
// ): ZodObject<
|
|
1561
|
-
// extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
|
|
1562
|
-
// Incoming["_def"]["unknownKeys"],
|
|
1563
|
-
// Incoming["_def"]["catchall"],
|
|
1564
|
-
// NewOutput,
|
|
1565
|
-
// NewInput
|
|
1566
|
-
// > {
|
|
1567
|
-
// const merged: any = new ZodObject({
|
|
1568
|
-
// unknownKeys: merging._def.unknownKeys,
|
|
1569
|
-
// catchall: merging._def.catchall,
|
|
1570
|
-
// shape: () =>
|
|
1571
|
-
// objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
|
|
1572
|
-
// typeName: ZodFirstPartyTypeKind.ZodObject,
|
|
1573
|
-
// }) as any;
|
|
1574
|
-
// return merged;
|
|
1575
|
-
// }
|
|
1576
|
-
setKey(key, schema) {
|
|
1577
|
-
return this.augment({ [key]: schema });
|
|
1578
|
-
}
|
|
1579
|
-
// merge<Incoming extends AnyZodObject>(
|
|
1580
|
-
// merging: Incoming
|
|
1581
|
-
// ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
|
|
1582
|
-
// ZodObject<
|
|
1583
|
-
// extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
|
|
1584
|
-
// Incoming["_def"]["unknownKeys"],
|
|
1585
|
-
// Incoming["_def"]["catchall"]
|
|
1586
|
-
// > {
|
|
1587
|
-
// // const mergedShape = objectUtil.mergeShapes(
|
|
1588
|
-
// // this._def.shape(),
|
|
1589
|
-
// // merging._def.shape()
|
|
1590
|
-
// // );
|
|
1591
|
-
// const merged: any = new ZodObject({
|
|
1592
|
-
// unknownKeys: merging._def.unknownKeys,
|
|
1593
|
-
// catchall: merging._def.catchall,
|
|
1594
|
-
// shape: () =>
|
|
1595
|
-
// objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
|
|
1596
|
-
// typeName: ZodFirstPartyTypeKind.ZodObject,
|
|
1597
|
-
// }) as any;
|
|
1598
|
-
// return merged;
|
|
1599
|
-
// }
|
|
1600
|
-
catchall(index) {
|
|
1601
|
-
return new _ZodObject({
|
|
1602
|
-
...this._def,
|
|
1603
|
-
catchall: index
|
|
1604
|
-
});
|
|
1605
|
-
}
|
|
1606
|
-
pick(mask) {
|
|
1607
|
-
let shape = {};
|
|
1608
|
-
return util.objectKeys(mask).forEach((key) => {
|
|
1609
|
-
mask[key] && this.shape[key] && (shape[key] = this.shape[key]);
|
|
1610
|
-
}), new _ZodObject({
|
|
1611
|
-
...this._def,
|
|
1612
|
-
shape: () => shape
|
|
1613
|
-
});
|
|
1614
|
-
}
|
|
1615
|
-
omit(mask) {
|
|
1616
|
-
let shape = {};
|
|
1617
|
-
return util.objectKeys(this.shape).forEach((key) => {
|
|
1618
|
-
mask[key] || (shape[key] = this.shape[key]);
|
|
1619
|
-
}), new _ZodObject({
|
|
1620
|
-
...this._def,
|
|
1621
|
-
shape: () => shape
|
|
1622
|
-
});
|
|
1623
|
-
}
|
|
1624
|
-
/**
|
|
1625
|
-
* @deprecated
|
|
1626
|
-
*/
|
|
1627
|
-
deepPartial() {
|
|
1628
|
-
return deepPartialify(this);
|
|
1629
|
-
}
|
|
1630
|
-
partial(mask) {
|
|
1631
|
-
let newShape = {};
|
|
1632
|
-
return util.objectKeys(this.shape).forEach((key) => {
|
|
1633
|
-
let fieldSchema = this.shape[key];
|
|
1634
|
-
mask && !mask[key] ? newShape[key] = fieldSchema : newShape[key] = fieldSchema.optional();
|
|
1635
|
-
}), new _ZodObject({
|
|
1636
|
-
...this._def,
|
|
1637
|
-
shape: () => newShape
|
|
1638
|
-
});
|
|
1639
|
-
}
|
|
1640
|
-
required(mask) {
|
|
1641
|
-
let newShape = {};
|
|
1642
|
-
return util.objectKeys(this.shape).forEach((key) => {
|
|
1643
|
-
if (mask && !mask[key])
|
|
1644
|
-
newShape[key] = this.shape[key];
|
|
1645
|
-
else {
|
|
1646
|
-
let newField = this.shape[key];
|
|
1647
|
-
for (; newField instanceof ZodOptional; )
|
|
1648
|
-
newField = newField._def.innerType;
|
|
1649
|
-
newShape[key] = newField;
|
|
1650
|
-
}
|
|
1651
|
-
}), new _ZodObject({
|
|
1652
|
-
...this._def,
|
|
1653
|
-
shape: () => newShape
|
|
1654
|
-
});
|
|
1655
|
-
}
|
|
1656
|
-
keyof() {
|
|
1657
|
-
return createZodEnum(util.objectKeys(this.shape));
|
|
1658
|
-
}
|
|
1659
|
-
};
|
|
1660
|
-
ZodObject.create = (shape, params) => new ZodObject({
|
|
1661
|
-
shape: () => shape,
|
|
1662
|
-
unknownKeys: "strip",
|
|
1663
|
-
catchall: ZodNever.create(),
|
|
1664
|
-
typeName: ZodFirstPartyTypeKind.ZodObject,
|
|
1665
|
-
...processCreateParams(params)
|
|
1666
|
-
});
|
|
1667
|
-
ZodObject.strictCreate = (shape, params) => new ZodObject({
|
|
1668
|
-
shape: () => shape,
|
|
1669
|
-
unknownKeys: "strict",
|
|
1670
|
-
catchall: ZodNever.create(),
|
|
1671
|
-
typeName: ZodFirstPartyTypeKind.ZodObject,
|
|
1672
|
-
...processCreateParams(params)
|
|
1673
|
-
});
|
|
1674
|
-
ZodObject.lazycreate = (shape, params) => new ZodObject({
|
|
1675
|
-
shape,
|
|
1676
|
-
unknownKeys: "strip",
|
|
1677
|
-
catchall: ZodNever.create(),
|
|
1678
|
-
typeName: ZodFirstPartyTypeKind.ZodObject,
|
|
1679
|
-
...processCreateParams(params)
|
|
1680
|
-
});
|
|
1681
|
-
var ZodUnion = class extends ZodType {
|
|
1682
|
-
_parse(input) {
|
|
1683
|
-
let { ctx } = this._processInputParams(input), options = this._def.options;
|
|
1684
|
-
function handleResults(results) {
|
|
1685
|
-
for (let result of results)
|
|
1686
|
-
if (result.result.status === "valid")
|
|
1687
|
-
return result.result;
|
|
1688
|
-
for (let result of results)
|
|
1689
|
-
if (result.result.status === "dirty")
|
|
1690
|
-
return ctx.common.issues.push(...result.ctx.common.issues), result.result;
|
|
1691
|
-
let unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));
|
|
1692
|
-
return addIssueToContext(ctx, {
|
|
1693
|
-
code: ZodIssueCode.invalid_union,
|
|
1694
|
-
unionErrors
|
|
1695
|
-
}), INVALID;
|
|
1696
|
-
}
|
|
1697
|
-
if (ctx.common.async)
|
|
1698
|
-
return Promise.all(options.map(async (option) => {
|
|
1699
|
-
let childCtx = {
|
|
1700
|
-
...ctx,
|
|
1701
|
-
common: {
|
|
1702
|
-
...ctx.common,
|
|
1703
|
-
issues: []
|
|
1704
|
-
},
|
|
1705
|
-
parent: null
|
|
1706
|
-
};
|
|
1707
|
-
return {
|
|
1708
|
-
result: await option._parseAsync({
|
|
1709
|
-
data: ctx.data,
|
|
1710
|
-
path: ctx.path,
|
|
1711
|
-
parent: childCtx
|
|
1712
|
-
}),
|
|
1713
|
-
ctx: childCtx
|
|
1714
|
-
};
|
|
1715
|
-
})).then(handleResults);
|
|
1716
|
-
{
|
|
1717
|
-
let dirty, issues = [];
|
|
1718
|
-
for (let option of options) {
|
|
1719
|
-
let childCtx = {
|
|
1720
|
-
...ctx,
|
|
1721
|
-
common: {
|
|
1722
|
-
...ctx.common,
|
|
1723
|
-
issues: []
|
|
1724
|
-
},
|
|
1725
|
-
parent: null
|
|
1726
|
-
}, result = option._parseSync({
|
|
1727
|
-
data: ctx.data,
|
|
1728
|
-
path: ctx.path,
|
|
1729
|
-
parent: childCtx
|
|
1730
|
-
});
|
|
1731
|
-
if (result.status === "valid")
|
|
1732
|
-
return result;
|
|
1733
|
-
result.status === "dirty" && !dirty && (dirty = { result, ctx: childCtx }), childCtx.common.issues.length && issues.push(childCtx.common.issues);
|
|
1734
|
-
}
|
|
1735
|
-
if (dirty)
|
|
1736
|
-
return ctx.common.issues.push(...dirty.ctx.common.issues), dirty.result;
|
|
1737
|
-
let unionErrors = issues.map((issues2) => new ZodError(issues2));
|
|
1738
|
-
return addIssueToContext(ctx, {
|
|
1739
|
-
code: ZodIssueCode.invalid_union,
|
|
1740
|
-
unionErrors
|
|
1741
|
-
}), INVALID;
|
|
1742
|
-
}
|
|
1743
|
-
}
|
|
1744
|
-
get options() {
|
|
1745
|
-
return this._def.options;
|
|
1746
|
-
}
|
|
1747
|
-
};
|
|
1748
|
-
ZodUnion.create = (types, params) => new ZodUnion({
|
|
1749
|
-
options: types,
|
|
1750
|
-
typeName: ZodFirstPartyTypeKind.ZodUnion,
|
|
1751
|
-
...processCreateParams(params)
|
|
1752
|
-
});
|
|
1753
|
-
var getDiscriminator = (type) => type instanceof ZodLazy ? getDiscriminator(type.schema) : type instanceof ZodEffects ? getDiscriminator(type.innerType()) : type instanceof ZodLiteral ? [type.value] : type instanceof ZodEnum ? type.options : type instanceof ZodNativeEnum ? Object.keys(type.enum) : type instanceof ZodDefault ? getDiscriminator(type._def.innerType) : type instanceof ZodUndefined ? [void 0] : type instanceof ZodNull ? [null] : null, ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
|
|
1754
|
-
_parse(input) {
|
|
1755
|
-
let { ctx } = this._processInputParams(input);
|
|
1756
|
-
if (ctx.parsedType !== ZodParsedType.object)
|
|
1757
|
-
return addIssueToContext(ctx, {
|
|
1758
|
-
code: ZodIssueCode.invalid_type,
|
|
1759
|
-
expected: ZodParsedType.object,
|
|
1760
|
-
received: ctx.parsedType
|
|
1761
|
-
}), INVALID;
|
|
1762
|
-
let discriminator = this.discriminator, discriminatorValue = ctx.data[discriminator], option = this.optionsMap.get(discriminatorValue);
|
|
1763
|
-
return option ? ctx.common.async ? option._parseAsync({
|
|
1764
|
-
data: ctx.data,
|
|
1765
|
-
path: ctx.path,
|
|
1766
|
-
parent: ctx
|
|
1767
|
-
}) : option._parseSync({
|
|
1768
|
-
data: ctx.data,
|
|
1769
|
-
path: ctx.path,
|
|
1770
|
-
parent: ctx
|
|
1771
|
-
}) : (addIssueToContext(ctx, {
|
|
1772
|
-
code: ZodIssueCode.invalid_union_discriminator,
|
|
1773
|
-
options: Array.from(this.optionsMap.keys()),
|
|
1774
|
-
path: [discriminator]
|
|
1775
|
-
}), INVALID);
|
|
1776
|
-
}
|
|
1777
|
-
get discriminator() {
|
|
1778
|
-
return this._def.discriminator;
|
|
1779
|
-
}
|
|
1780
|
-
get options() {
|
|
1781
|
-
return this._def.options;
|
|
1782
|
-
}
|
|
1783
|
-
get optionsMap() {
|
|
1784
|
-
return this._def.optionsMap;
|
|
1785
|
-
}
|
|
1786
|
-
/**
|
|
1787
|
-
* The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
|
|
1788
|
-
* However, it only allows a union of objects, all of which need to share a discriminator property. This property must
|
|
1789
|
-
* have a different value for each object in the union.
|
|
1790
|
-
* @param discriminator the name of the discriminator property
|
|
1791
|
-
* @param types an array of object schemas
|
|
1792
|
-
* @param params
|
|
1793
|
-
*/
|
|
1794
|
-
static create(discriminator, options, params) {
|
|
1795
|
-
let optionsMap = /* @__PURE__ */ new Map();
|
|
1796
|
-
for (let type of options) {
|
|
1797
|
-
let discriminatorValues = getDiscriminator(type.shape[discriminator]);
|
|
1798
|
-
if (!discriminatorValues)
|
|
1799
|
-
throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
|
|
1800
|
-
for (let value of discriminatorValues) {
|
|
1801
|
-
if (optionsMap.has(value))
|
|
1802
|
-
throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
|
|
1803
|
-
optionsMap.set(value, type);
|
|
1804
|
-
}
|
|
1805
|
-
}
|
|
1806
|
-
return new _ZodDiscriminatedUnion({
|
|
1807
|
-
typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
|
|
1808
|
-
discriminator,
|
|
1809
|
-
options,
|
|
1810
|
-
optionsMap,
|
|
1811
|
-
...processCreateParams(params)
|
|
1812
|
-
});
|
|
1813
|
-
}
|
|
1814
|
-
};
|
|
1815
|
-
function mergeValues(a, b) {
|
|
1816
|
-
let aType = getParsedType(a), bType = getParsedType(b);
|
|
1817
|
-
if (a === b)
|
|
1818
|
-
return { valid: !0, data: a };
|
|
1819
|
-
if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
|
|
1820
|
-
let bKeys = util.objectKeys(b), sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1), newObj = { ...a, ...b };
|
|
1821
|
-
for (let key of sharedKeys) {
|
|
1822
|
-
let sharedValue = mergeValues(a[key], b[key]);
|
|
1823
|
-
if (!sharedValue.valid)
|
|
1824
|
-
return { valid: !1 };
|
|
1825
|
-
newObj[key] = sharedValue.data;
|
|
1826
|
-
}
|
|
1827
|
-
return { valid: !0, data: newObj };
|
|
1828
|
-
} else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
|
|
1829
|
-
if (a.length !== b.length)
|
|
1830
|
-
return { valid: !1 };
|
|
1831
|
-
let newArray = [];
|
|
1832
|
-
for (let index = 0; index < a.length; index++) {
|
|
1833
|
-
let itemA = a[index], itemB = b[index], sharedValue = mergeValues(itemA, itemB);
|
|
1834
|
-
if (!sharedValue.valid)
|
|
1835
|
-
return { valid: !1 };
|
|
1836
|
-
newArray.push(sharedValue.data);
|
|
1837
|
-
}
|
|
1838
|
-
return { valid: !0, data: newArray };
|
|
1839
|
-
} else
|
|
1840
|
-
return aType === ZodParsedType.date && bType === ZodParsedType.date && +a == +b ? { valid: !0, data: a } : { valid: !1 };
|
|
1841
|
-
}
|
|
1842
|
-
var ZodIntersection = class extends ZodType {
|
|
1843
|
-
_parse(input) {
|
|
1844
|
-
let { status, ctx } = this._processInputParams(input), handleParsed = (parsedLeft, parsedRight) => {
|
|
1845
|
-
if (isAborted(parsedLeft) || isAborted(parsedRight))
|
|
1846
|
-
return INVALID;
|
|
1847
|
-
let merged = mergeValues(parsedLeft.value, parsedRight.value);
|
|
1848
|
-
return merged.valid ? ((isDirty(parsedLeft) || isDirty(parsedRight)) && status.dirty(), { status: status.value, value: merged.data }) : (addIssueToContext(ctx, {
|
|
1849
|
-
code: ZodIssueCode.invalid_intersection_types
|
|
1850
|
-
}), INVALID);
|
|
1851
|
-
};
|
|
1852
|
-
return ctx.common.async ? Promise.all([
|
|
1853
|
-
this._def.left._parseAsync({
|
|
1854
|
-
data: ctx.data,
|
|
1855
|
-
path: ctx.path,
|
|
1856
|
-
parent: ctx
|
|
1857
|
-
}),
|
|
1858
|
-
this._def.right._parseAsync({
|
|
1859
|
-
data: ctx.data,
|
|
1860
|
-
path: ctx.path,
|
|
1861
|
-
parent: ctx
|
|
1862
|
-
})
|
|
1863
|
-
]).then(([left, right]) => handleParsed(left, right)) : handleParsed(this._def.left._parseSync({
|
|
1864
|
-
data: ctx.data,
|
|
1865
|
-
path: ctx.path,
|
|
1866
|
-
parent: ctx
|
|
1867
|
-
}), this._def.right._parseSync({
|
|
1868
|
-
data: ctx.data,
|
|
1869
|
-
path: ctx.path,
|
|
1870
|
-
parent: ctx
|
|
1871
|
-
}));
|
|
1872
|
-
}
|
|
1873
|
-
};
|
|
1874
|
-
ZodIntersection.create = (left, right, params) => new ZodIntersection({
|
|
1875
|
-
left,
|
|
1876
|
-
right,
|
|
1877
|
-
typeName: ZodFirstPartyTypeKind.ZodIntersection,
|
|
1878
|
-
...processCreateParams(params)
|
|
1879
|
-
});
|
|
1880
|
-
var ZodTuple = class _ZodTuple extends ZodType {
|
|
1881
|
-
_parse(input) {
|
|
1882
|
-
let { status, ctx } = this._processInputParams(input);
|
|
1883
|
-
if (ctx.parsedType !== ZodParsedType.array)
|
|
1884
|
-
return addIssueToContext(ctx, {
|
|
1885
|
-
code: ZodIssueCode.invalid_type,
|
|
1886
|
-
expected: ZodParsedType.array,
|
|
1887
|
-
received: ctx.parsedType
|
|
1888
|
-
}), INVALID;
|
|
1889
|
-
if (ctx.data.length < this._def.items.length)
|
|
1890
|
-
return addIssueToContext(ctx, {
|
|
1891
|
-
code: ZodIssueCode.too_small,
|
|
1892
|
-
minimum: this._def.items.length,
|
|
1893
|
-
inclusive: !0,
|
|
1894
|
-
exact: !1,
|
|
1895
|
-
type: "array"
|
|
1896
|
-
}), INVALID;
|
|
1897
|
-
!this._def.rest && ctx.data.length > this._def.items.length && (addIssueToContext(ctx, {
|
|
1898
|
-
code: ZodIssueCode.too_big,
|
|
1899
|
-
maximum: this._def.items.length,
|
|
1900
|
-
inclusive: !0,
|
|
1901
|
-
exact: !1,
|
|
1902
|
-
type: "array"
|
|
1903
|
-
}), status.dirty());
|
|
1904
|
-
let items = [...ctx.data].map((item, itemIndex) => {
|
|
1905
|
-
let schema = this._def.items[itemIndex] || this._def.rest;
|
|
1906
|
-
return schema ? schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex)) : null;
|
|
1907
|
-
}).filter((x) => !!x);
|
|
1908
|
-
return ctx.common.async ? Promise.all(items).then((results) => ParseStatus.mergeArray(status, results)) : ParseStatus.mergeArray(status, items);
|
|
1909
|
-
}
|
|
1910
|
-
get items() {
|
|
1911
|
-
return this._def.items;
|
|
1912
|
-
}
|
|
1913
|
-
rest(rest) {
|
|
1914
|
-
return new _ZodTuple({
|
|
1915
|
-
...this._def,
|
|
1916
|
-
rest
|
|
1917
|
-
});
|
|
1918
|
-
}
|
|
1919
|
-
};
|
|
1920
|
-
ZodTuple.create = (schemas, params) => {
|
|
1921
|
-
if (!Array.isArray(schemas))
|
|
1922
|
-
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
1923
|
-
return new ZodTuple({
|
|
1924
|
-
items: schemas,
|
|
1925
|
-
typeName: ZodFirstPartyTypeKind.ZodTuple,
|
|
1926
|
-
rest: null,
|
|
1927
|
-
...processCreateParams(params)
|
|
1928
|
-
});
|
|
1929
|
-
};
|
|
1930
|
-
var ZodRecord = class _ZodRecord extends ZodType {
|
|
1931
|
-
get keySchema() {
|
|
1932
|
-
return this._def.keyType;
|
|
1933
|
-
}
|
|
1934
|
-
get valueSchema() {
|
|
1935
|
-
return this._def.valueType;
|
|
1936
|
-
}
|
|
1937
|
-
_parse(input) {
|
|
1938
|
-
let { status, ctx } = this._processInputParams(input);
|
|
1939
|
-
if (ctx.parsedType !== ZodParsedType.object)
|
|
1940
|
-
return addIssueToContext(ctx, {
|
|
1941
|
-
code: ZodIssueCode.invalid_type,
|
|
1942
|
-
expected: ZodParsedType.object,
|
|
1943
|
-
received: ctx.parsedType
|
|
1944
|
-
}), INVALID;
|
|
1945
|
-
let pairs = [], keyType = this._def.keyType, valueType = this._def.valueType;
|
|
1946
|
-
for (let key in ctx.data)
|
|
1947
|
-
pairs.push({
|
|
1948
|
-
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
|
|
1949
|
-
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key))
|
|
1950
|
-
});
|
|
1951
|
-
return ctx.common.async ? ParseStatus.mergeObjectAsync(status, pairs) : ParseStatus.mergeObjectSync(status, pairs);
|
|
1952
|
-
}
|
|
1953
|
-
get element() {
|
|
1954
|
-
return this._def.valueType;
|
|
1955
|
-
}
|
|
1956
|
-
static create(first, second, third) {
|
|
1957
|
-
return second instanceof ZodType ? new _ZodRecord({
|
|
1958
|
-
keyType: first,
|
|
1959
|
-
valueType: second,
|
|
1960
|
-
typeName: ZodFirstPartyTypeKind.ZodRecord,
|
|
1961
|
-
...processCreateParams(third)
|
|
1962
|
-
}) : new _ZodRecord({
|
|
1963
|
-
keyType: ZodString.create(),
|
|
1964
|
-
valueType: first,
|
|
1965
|
-
typeName: ZodFirstPartyTypeKind.ZodRecord,
|
|
1966
|
-
...processCreateParams(second)
|
|
1967
|
-
});
|
|
1968
|
-
}
|
|
1969
|
-
}, ZodMap = class extends ZodType {
|
|
1970
|
-
get keySchema() {
|
|
1971
|
-
return this._def.keyType;
|
|
1972
|
-
}
|
|
1973
|
-
get valueSchema() {
|
|
1974
|
-
return this._def.valueType;
|
|
1975
|
-
}
|
|
1976
|
-
_parse(input) {
|
|
1977
|
-
let { status, ctx } = this._processInputParams(input);
|
|
1978
|
-
if (ctx.parsedType !== ZodParsedType.map)
|
|
1979
|
-
return addIssueToContext(ctx, {
|
|
1980
|
-
code: ZodIssueCode.invalid_type,
|
|
1981
|
-
expected: ZodParsedType.map,
|
|
1982
|
-
received: ctx.parsedType
|
|
1983
|
-
}), INVALID;
|
|
1984
|
-
let keyType = this._def.keyType, valueType = this._def.valueType, pairs = [...ctx.data.entries()].map(([key, value], index) => ({
|
|
1985
|
-
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])),
|
|
1986
|
-
value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"]))
|
|
1987
|
-
}));
|
|
1988
|
-
if (ctx.common.async) {
|
|
1989
|
-
let finalMap = /* @__PURE__ */ new Map();
|
|
1990
|
-
return Promise.resolve().then(async () => {
|
|
1991
|
-
for (let pair of pairs) {
|
|
1992
|
-
let key = await pair.key, value = await pair.value;
|
|
1993
|
-
if (key.status === "aborted" || value.status === "aborted")
|
|
1994
|
-
return INVALID;
|
|
1995
|
-
(key.status === "dirty" || value.status === "dirty") && status.dirty(), finalMap.set(key.value, value.value);
|
|
1996
|
-
}
|
|
1997
|
-
return { status: status.value, value: finalMap };
|
|
1998
|
-
});
|
|
1999
|
-
} else {
|
|
2000
|
-
let finalMap = /* @__PURE__ */ new Map();
|
|
2001
|
-
for (let pair of pairs) {
|
|
2002
|
-
let key = pair.key, value = pair.value;
|
|
2003
|
-
if (key.status === "aborted" || value.status === "aborted")
|
|
2004
|
-
return INVALID;
|
|
2005
|
-
(key.status === "dirty" || value.status === "dirty") && status.dirty(), finalMap.set(key.value, value.value);
|
|
2006
|
-
}
|
|
2007
|
-
return { status: status.value, value: finalMap };
|
|
2008
|
-
}
|
|
2009
|
-
}
|
|
2010
|
-
};
|
|
2011
|
-
ZodMap.create = (keyType, valueType, params) => new ZodMap({
|
|
2012
|
-
valueType,
|
|
2013
|
-
keyType,
|
|
2014
|
-
typeName: ZodFirstPartyTypeKind.ZodMap,
|
|
2015
|
-
...processCreateParams(params)
|
|
2016
|
-
});
|
|
2017
|
-
var ZodSet = class _ZodSet extends ZodType {
|
|
2018
|
-
_parse(input) {
|
|
2019
|
-
let { status, ctx } = this._processInputParams(input);
|
|
2020
|
-
if (ctx.parsedType !== ZodParsedType.set)
|
|
2021
|
-
return addIssueToContext(ctx, {
|
|
2022
|
-
code: ZodIssueCode.invalid_type,
|
|
2023
|
-
expected: ZodParsedType.set,
|
|
2024
|
-
received: ctx.parsedType
|
|
2025
|
-
}), INVALID;
|
|
2026
|
-
let def = this._def;
|
|
2027
|
-
def.minSize !== null && ctx.data.size < def.minSize.value && (addIssueToContext(ctx, {
|
|
2028
|
-
code: ZodIssueCode.too_small,
|
|
2029
|
-
minimum: def.minSize.value,
|
|
2030
|
-
type: "set",
|
|
2031
|
-
inclusive: !0,
|
|
2032
|
-
exact: !1,
|
|
2033
|
-
message: def.minSize.message
|
|
2034
|
-
}), status.dirty()), def.maxSize !== null && ctx.data.size > def.maxSize.value && (addIssueToContext(ctx, {
|
|
2035
|
-
code: ZodIssueCode.too_big,
|
|
2036
|
-
maximum: def.maxSize.value,
|
|
2037
|
-
type: "set",
|
|
2038
|
-
inclusive: !0,
|
|
2039
|
-
exact: !1,
|
|
2040
|
-
message: def.maxSize.message
|
|
2041
|
-
}), status.dirty());
|
|
2042
|
-
let valueType = this._def.valueType;
|
|
2043
|
-
function finalizeSet(elements2) {
|
|
2044
|
-
let parsedSet = /* @__PURE__ */ new Set();
|
|
2045
|
-
for (let element of elements2) {
|
|
2046
|
-
if (element.status === "aborted")
|
|
2047
|
-
return INVALID;
|
|
2048
|
-
element.status === "dirty" && status.dirty(), parsedSet.add(element.value);
|
|
2049
|
-
}
|
|
2050
|
-
return { status: status.value, value: parsedSet };
|
|
2051
|
-
}
|
|
2052
|
-
let elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
|
|
2053
|
-
return ctx.common.async ? Promise.all(elements).then((elements2) => finalizeSet(elements2)) : finalizeSet(elements);
|
|
2054
|
-
}
|
|
2055
|
-
min(minSize, message) {
|
|
2056
|
-
return new _ZodSet({
|
|
2057
|
-
...this._def,
|
|
2058
|
-
minSize: { value: minSize, message: errorUtil.toString(message) }
|
|
2059
|
-
});
|
|
2060
|
-
}
|
|
2061
|
-
max(maxSize, message) {
|
|
2062
|
-
return new _ZodSet({
|
|
2063
|
-
...this._def,
|
|
2064
|
-
maxSize: { value: maxSize, message: errorUtil.toString(message) }
|
|
2065
|
-
});
|
|
2066
|
-
}
|
|
2067
|
-
size(size, message) {
|
|
2068
|
-
return this.min(size, message).max(size, message);
|
|
2069
|
-
}
|
|
2070
|
-
nonempty(message) {
|
|
2071
|
-
return this.min(1, message);
|
|
2072
|
-
}
|
|
2073
|
-
};
|
|
2074
|
-
ZodSet.create = (valueType, params) => new ZodSet({
|
|
2075
|
-
valueType,
|
|
2076
|
-
minSize: null,
|
|
2077
|
-
maxSize: null,
|
|
2078
|
-
typeName: ZodFirstPartyTypeKind.ZodSet,
|
|
2079
|
-
...processCreateParams(params)
|
|
2080
|
-
});
|
|
2081
|
-
var ZodFunction = class _ZodFunction extends ZodType {
|
|
2082
|
-
constructor() {
|
|
2083
|
-
super(...arguments), this.validate = this.implement;
|
|
2084
|
-
}
|
|
2085
|
-
_parse(input) {
|
|
2086
|
-
let { ctx } = this._processInputParams(input);
|
|
2087
|
-
if (ctx.parsedType !== ZodParsedType.function)
|
|
2088
|
-
return addIssueToContext(ctx, {
|
|
2089
|
-
code: ZodIssueCode.invalid_type,
|
|
2090
|
-
expected: ZodParsedType.function,
|
|
2091
|
-
received: ctx.parsedType
|
|
2092
|
-
}), INVALID;
|
|
2093
|
-
function makeArgsIssue(args, error) {
|
|
2094
|
-
return makeIssue({
|
|
2095
|
-
data: args,
|
|
2096
|
-
path: ctx.path,
|
|
2097
|
-
errorMaps: [
|
|
2098
|
-
ctx.common.contextualErrorMap,
|
|
2099
|
-
ctx.schemaErrorMap,
|
|
2100
|
-
getErrorMap(),
|
|
2101
|
-
errorMap
|
|
2102
|
-
].filter((x) => !!x),
|
|
2103
|
-
issueData: {
|
|
2104
|
-
code: ZodIssueCode.invalid_arguments,
|
|
2105
|
-
argumentsError: error
|
|
2106
|
-
}
|
|
2107
|
-
});
|
|
2108
|
-
}
|
|
2109
|
-
function makeReturnsIssue(returns, error) {
|
|
2110
|
-
return makeIssue({
|
|
2111
|
-
data: returns,
|
|
2112
|
-
path: ctx.path,
|
|
2113
|
-
errorMaps: [
|
|
2114
|
-
ctx.common.contextualErrorMap,
|
|
2115
|
-
ctx.schemaErrorMap,
|
|
2116
|
-
getErrorMap(),
|
|
2117
|
-
errorMap
|
|
2118
|
-
].filter((x) => !!x),
|
|
2119
|
-
issueData: {
|
|
2120
|
-
code: ZodIssueCode.invalid_return_type,
|
|
2121
|
-
returnTypeError: error
|
|
2122
|
-
}
|
|
2123
|
-
});
|
|
2124
|
-
}
|
|
2125
|
-
let params = { errorMap: ctx.common.contextualErrorMap }, fn = ctx.data;
|
|
2126
|
-
if (this._def.returns instanceof ZodPromise) {
|
|
2127
|
-
let me = this;
|
|
2128
|
-
return OK(async function(...args) {
|
|
2129
|
-
let error = new ZodError([]), parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
|
|
2130
|
-
throw error.addIssue(makeArgsIssue(args, e)), error;
|
|
2131
|
-
}), result = await Reflect.apply(fn, this, parsedArgs);
|
|
2132
|
-
return await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
|
|
2133
|
-
throw error.addIssue(makeReturnsIssue(result, e)), error;
|
|
2134
|
-
});
|
|
2135
|
-
});
|
|
2136
|
-
} else {
|
|
2137
|
-
let me = this;
|
|
2138
|
-
return OK(function(...args) {
|
|
2139
|
-
let parsedArgs = me._def.args.safeParse(args, params);
|
|
2140
|
-
if (!parsedArgs.success)
|
|
2141
|
-
throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
|
|
2142
|
-
let result = Reflect.apply(fn, this, parsedArgs.data), parsedReturns = me._def.returns.safeParse(result, params);
|
|
2143
|
-
if (!parsedReturns.success)
|
|
2144
|
-
throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
|
|
2145
|
-
return parsedReturns.data;
|
|
2146
|
-
});
|
|
2147
|
-
}
|
|
2148
|
-
}
|
|
2149
|
-
parameters() {
|
|
2150
|
-
return this._def.args;
|
|
2151
|
-
}
|
|
2152
|
-
returnType() {
|
|
2153
|
-
return this._def.returns;
|
|
2154
|
-
}
|
|
2155
|
-
args(...items) {
|
|
2156
|
-
return new _ZodFunction({
|
|
2157
|
-
...this._def,
|
|
2158
|
-
args: ZodTuple.create(items).rest(ZodUnknown.create())
|
|
2159
|
-
});
|
|
2160
|
-
}
|
|
2161
|
-
returns(returnType) {
|
|
2162
|
-
return new _ZodFunction({
|
|
2163
|
-
...this._def,
|
|
2164
|
-
returns: returnType
|
|
2165
|
-
});
|
|
2166
|
-
}
|
|
2167
|
-
implement(func) {
|
|
2168
|
-
return this.parse(func);
|
|
2169
|
-
}
|
|
2170
|
-
strictImplement(func) {
|
|
2171
|
-
return this.parse(func);
|
|
2172
|
-
}
|
|
2173
|
-
static create(args, returns, params) {
|
|
2174
|
-
return new _ZodFunction({
|
|
2175
|
-
args: args || ZodTuple.create([]).rest(ZodUnknown.create()),
|
|
2176
|
-
returns: returns || ZodUnknown.create(),
|
|
2177
|
-
typeName: ZodFirstPartyTypeKind.ZodFunction,
|
|
2178
|
-
...processCreateParams(params)
|
|
2179
|
-
});
|
|
2180
|
-
}
|
|
2181
|
-
}, ZodLazy = class extends ZodType {
|
|
2182
|
-
get schema() {
|
|
2183
|
-
return this._def.getter();
|
|
2184
|
-
}
|
|
2185
|
-
_parse(input) {
|
|
2186
|
-
let { ctx } = this._processInputParams(input);
|
|
2187
|
-
return this._def.getter()._parse({ data: ctx.data, path: ctx.path, parent: ctx });
|
|
2188
|
-
}
|
|
2189
|
-
};
|
|
2190
|
-
ZodLazy.create = (getter, params) => new ZodLazy({
|
|
2191
|
-
getter,
|
|
2192
|
-
typeName: ZodFirstPartyTypeKind.ZodLazy,
|
|
2193
|
-
...processCreateParams(params)
|
|
2194
|
-
});
|
|
2195
|
-
var ZodLiteral = class extends ZodType {
|
|
2196
|
-
_parse(input) {
|
|
2197
|
-
if (input.data !== this._def.value) {
|
|
2198
|
-
let ctx = this._getOrReturnCtx(input);
|
|
2199
|
-
return addIssueToContext(ctx, {
|
|
2200
|
-
received: ctx.data,
|
|
2201
|
-
code: ZodIssueCode.invalid_literal,
|
|
2202
|
-
expected: this._def.value
|
|
2203
|
-
}), INVALID;
|
|
2204
|
-
}
|
|
2205
|
-
return { status: "valid", value: input.data };
|
|
2206
|
-
}
|
|
2207
|
-
get value() {
|
|
2208
|
-
return this._def.value;
|
|
2209
|
-
}
|
|
2210
|
-
};
|
|
2211
|
-
ZodLiteral.create = (value, params) => new ZodLiteral({
|
|
2212
|
-
value,
|
|
2213
|
-
typeName: ZodFirstPartyTypeKind.ZodLiteral,
|
|
2214
|
-
...processCreateParams(params)
|
|
2215
|
-
});
|
|
2216
|
-
function createZodEnum(values, params) {
|
|
2217
|
-
return new ZodEnum({
|
|
2218
|
-
values,
|
|
2219
|
-
typeName: ZodFirstPartyTypeKind.ZodEnum,
|
|
2220
|
-
...processCreateParams(params)
|
|
2221
|
-
});
|
|
2222
|
-
}
|
|
2223
|
-
var ZodEnum = class _ZodEnum extends ZodType {
|
|
2224
|
-
_parse(input) {
|
|
2225
|
-
if (typeof input.data != "string") {
|
|
2226
|
-
let ctx = this._getOrReturnCtx(input), expectedValues = this._def.values;
|
|
2227
|
-
return addIssueToContext(ctx, {
|
|
2228
|
-
expected: util.joinValues(expectedValues),
|
|
2229
|
-
received: ctx.parsedType,
|
|
2230
|
-
code: ZodIssueCode.invalid_type
|
|
2231
|
-
}), INVALID;
|
|
2232
|
-
}
|
|
2233
|
-
if (this._def.values.indexOf(input.data) === -1) {
|
|
2234
|
-
let ctx = this._getOrReturnCtx(input), expectedValues = this._def.values;
|
|
2235
|
-
return addIssueToContext(ctx, {
|
|
2236
|
-
received: ctx.data,
|
|
2237
|
-
code: ZodIssueCode.invalid_enum_value,
|
|
2238
|
-
options: expectedValues
|
|
2239
|
-
}), INVALID;
|
|
2240
|
-
}
|
|
2241
|
-
return OK(input.data);
|
|
2242
|
-
}
|
|
2243
|
-
get options() {
|
|
2244
|
-
return this._def.values;
|
|
2245
|
-
}
|
|
2246
|
-
get enum() {
|
|
2247
|
-
let enumValues = {};
|
|
2248
|
-
for (let val of this._def.values)
|
|
2249
|
-
enumValues[val] = val;
|
|
2250
|
-
return enumValues;
|
|
2251
|
-
}
|
|
2252
|
-
get Values() {
|
|
2253
|
-
let enumValues = {};
|
|
2254
|
-
for (let val of this._def.values)
|
|
2255
|
-
enumValues[val] = val;
|
|
2256
|
-
return enumValues;
|
|
2257
|
-
}
|
|
2258
|
-
get Enum() {
|
|
2259
|
-
let enumValues = {};
|
|
2260
|
-
for (let val of this._def.values)
|
|
2261
|
-
enumValues[val] = val;
|
|
2262
|
-
return enumValues;
|
|
2263
|
-
}
|
|
2264
|
-
extract(values) {
|
|
2265
|
-
return _ZodEnum.create(values);
|
|
2266
|
-
}
|
|
2267
|
-
exclude(values) {
|
|
2268
|
-
return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));
|
|
2269
|
-
}
|
|
2270
|
-
};
|
|
2271
|
-
ZodEnum.create = createZodEnum;
|
|
2272
|
-
var ZodNativeEnum = class extends ZodType {
|
|
2273
|
-
_parse(input) {
|
|
2274
|
-
let nativeEnumValues = util.getValidEnumValues(this._def.values), ctx = this._getOrReturnCtx(input);
|
|
2275
|
-
if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
|
|
2276
|
-
let expectedValues = util.objectValues(nativeEnumValues);
|
|
2277
|
-
return addIssueToContext(ctx, {
|
|
2278
|
-
expected: util.joinValues(expectedValues),
|
|
2279
|
-
received: ctx.parsedType,
|
|
2280
|
-
code: ZodIssueCode.invalid_type
|
|
2281
|
-
}), INVALID;
|
|
2282
|
-
}
|
|
2283
|
-
if (nativeEnumValues.indexOf(input.data) === -1) {
|
|
2284
|
-
let expectedValues = util.objectValues(nativeEnumValues);
|
|
2285
|
-
return addIssueToContext(ctx, {
|
|
2286
|
-
received: ctx.data,
|
|
2287
|
-
code: ZodIssueCode.invalid_enum_value,
|
|
2288
|
-
options: expectedValues
|
|
2289
|
-
}), INVALID;
|
|
2290
|
-
}
|
|
2291
|
-
return OK(input.data);
|
|
2292
|
-
}
|
|
2293
|
-
get enum() {
|
|
2294
|
-
return this._def.values;
|
|
2295
|
-
}
|
|
2296
|
-
};
|
|
2297
|
-
ZodNativeEnum.create = (values, params) => new ZodNativeEnum({
|
|
2298
|
-
values,
|
|
2299
|
-
typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
|
|
2300
|
-
...processCreateParams(params)
|
|
2301
|
-
});
|
|
2302
|
-
var ZodPromise = class extends ZodType {
|
|
2303
|
-
unwrap() {
|
|
2304
|
-
return this._def.type;
|
|
2305
|
-
}
|
|
2306
|
-
_parse(input) {
|
|
2307
|
-
let { ctx } = this._processInputParams(input);
|
|
2308
|
-
if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === !1)
|
|
2309
|
-
return addIssueToContext(ctx, {
|
|
2310
|
-
code: ZodIssueCode.invalid_type,
|
|
2311
|
-
expected: ZodParsedType.promise,
|
|
2312
|
-
received: ctx.parsedType
|
|
2313
|
-
}), INVALID;
|
|
2314
|
-
let promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
|
|
2315
|
-
return OK(promisified.then((data) => this._def.type.parseAsync(data, {
|
|
2316
|
-
path: ctx.path,
|
|
2317
|
-
errorMap: ctx.common.contextualErrorMap
|
|
2318
|
-
})));
|
|
2319
|
-
}
|
|
2320
|
-
};
|
|
2321
|
-
ZodPromise.create = (schema, params) => new ZodPromise({
|
|
2322
|
-
type: schema,
|
|
2323
|
-
typeName: ZodFirstPartyTypeKind.ZodPromise,
|
|
2324
|
-
...processCreateParams(params)
|
|
2325
|
-
});
|
|
2326
|
-
var ZodEffects = class extends ZodType {
|
|
2327
|
-
innerType() {
|
|
2328
|
-
return this._def.schema;
|
|
2329
|
-
}
|
|
2330
|
-
sourceType() {
|
|
2331
|
-
return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
2332
|
-
}
|
|
2333
|
-
_parse(input) {
|
|
2334
|
-
let { status, ctx } = this._processInputParams(input), effect = this._def.effect || null, checkCtx = {
|
|
2335
|
-
addIssue: (arg) => {
|
|
2336
|
-
addIssueToContext(ctx, arg), arg.fatal ? status.abort() : status.dirty();
|
|
2337
|
-
},
|
|
2338
|
-
get path() {
|
|
2339
|
-
return ctx.path;
|
|
2340
|
-
}
|
|
2341
|
-
};
|
|
2342
|
-
if (checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx), effect.type === "preprocess") {
|
|
2343
|
-
let processed = effect.transform(ctx.data, checkCtx);
|
|
2344
|
-
return ctx.common.issues.length ? {
|
|
2345
|
-
status: "dirty",
|
|
2346
|
-
value: ctx.data
|
|
2347
|
-
} : ctx.common.async ? Promise.resolve(processed).then((processed2) => this._def.schema._parseAsync({
|
|
2348
|
-
data: processed2,
|
|
2349
|
-
path: ctx.path,
|
|
2350
|
-
parent: ctx
|
|
2351
|
-
})) : this._def.schema._parseSync({
|
|
2352
|
-
data: processed,
|
|
2353
|
-
path: ctx.path,
|
|
2354
|
-
parent: ctx
|
|
2355
|
-
});
|
|
2356
|
-
}
|
|
2357
|
-
if (effect.type === "refinement") {
|
|
2358
|
-
let executeRefinement = (acc) => {
|
|
2359
|
-
let result = effect.refinement(acc, checkCtx);
|
|
2360
|
-
if (ctx.common.async)
|
|
2361
|
-
return Promise.resolve(result);
|
|
2362
|
-
if (result instanceof Promise)
|
|
2363
|
-
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2364
|
-
return acc;
|
|
2365
|
-
};
|
|
2366
|
-
if (ctx.common.async === !1) {
|
|
2367
|
-
let inner = this._def.schema._parseSync({
|
|
2368
|
-
data: ctx.data,
|
|
2369
|
-
path: ctx.path,
|
|
2370
|
-
parent: ctx
|
|
2371
|
-
});
|
|
2372
|
-
return inner.status === "aborted" ? INVALID : (inner.status === "dirty" && status.dirty(), executeRefinement(inner.value), { status: status.value, value: inner.value });
|
|
2373
|
-
} else
|
|
2374
|
-
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => inner.status === "aborted" ? INVALID : (inner.status === "dirty" && status.dirty(), executeRefinement(inner.value).then(() => ({ status: status.value, value: inner.value }))));
|
|
2375
|
-
}
|
|
2376
|
-
if (effect.type === "transform")
|
|
2377
|
-
if (ctx.common.async === !1) {
|
|
2378
|
-
let base = this._def.schema._parseSync({
|
|
2379
|
-
data: ctx.data,
|
|
2380
|
-
path: ctx.path,
|
|
2381
|
-
parent: ctx
|
|
2382
|
-
});
|
|
2383
|
-
if (!isValid(base))
|
|
2384
|
-
return base;
|
|
2385
|
-
let result = effect.transform(base.value, checkCtx);
|
|
2386
|
-
if (result instanceof Promise)
|
|
2387
|
-
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2388
|
-
return { status: status.value, value: result };
|
|
2389
|
-
} else
|
|
2390
|
-
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => isValid(base) ? Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result })) : base);
|
|
2391
|
-
util.assertNever(effect);
|
|
2392
|
-
}
|
|
2393
|
-
};
|
|
2394
|
-
ZodEffects.create = (schema, effect, params) => new ZodEffects({
|
|
2395
|
-
schema,
|
|
2396
|
-
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
2397
|
-
effect,
|
|
2398
|
-
...processCreateParams(params)
|
|
2399
|
-
});
|
|
2400
|
-
ZodEffects.createWithPreprocess = (preprocess, schema, params) => new ZodEffects({
|
|
2401
|
-
schema,
|
|
2402
|
-
effect: { type: "preprocess", transform: preprocess },
|
|
2403
|
-
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
2404
|
-
...processCreateParams(params)
|
|
2405
|
-
});
|
|
2406
|
-
var ZodOptional = class extends ZodType {
|
|
2407
|
-
_parse(input) {
|
|
2408
|
-
return this._getType(input) === ZodParsedType.undefined ? OK(void 0) : this._def.innerType._parse(input);
|
|
2409
|
-
}
|
|
2410
|
-
unwrap() {
|
|
2411
|
-
return this._def.innerType;
|
|
2412
|
-
}
|
|
2413
|
-
};
|
|
2414
|
-
ZodOptional.create = (type, params) => new ZodOptional({
|
|
2415
|
-
innerType: type,
|
|
2416
|
-
typeName: ZodFirstPartyTypeKind.ZodOptional,
|
|
2417
|
-
...processCreateParams(params)
|
|
2418
|
-
});
|
|
2419
|
-
var ZodNullable = class extends ZodType {
|
|
2420
|
-
_parse(input) {
|
|
2421
|
-
return this._getType(input) === ZodParsedType.null ? OK(null) : this._def.innerType._parse(input);
|
|
2422
|
-
}
|
|
2423
|
-
unwrap() {
|
|
2424
|
-
return this._def.innerType;
|
|
2425
|
-
}
|
|
2426
|
-
};
|
|
2427
|
-
ZodNullable.create = (type, params) => new ZodNullable({
|
|
2428
|
-
innerType: type,
|
|
2429
|
-
typeName: ZodFirstPartyTypeKind.ZodNullable,
|
|
2430
|
-
...processCreateParams(params)
|
|
2431
|
-
});
|
|
2432
|
-
var ZodDefault = class extends ZodType {
|
|
2433
|
-
_parse(input) {
|
|
2434
|
-
let { ctx } = this._processInputParams(input), data = ctx.data;
|
|
2435
|
-
return ctx.parsedType === ZodParsedType.undefined && (data = this._def.defaultValue()), this._def.innerType._parse({
|
|
2436
|
-
data,
|
|
2437
|
-
path: ctx.path,
|
|
2438
|
-
parent: ctx
|
|
2439
|
-
});
|
|
2440
|
-
}
|
|
2441
|
-
removeDefault() {
|
|
2442
|
-
return this._def.innerType;
|
|
2443
|
-
}
|
|
2444
|
-
};
|
|
2445
|
-
ZodDefault.create = (type, params) => new ZodDefault({
|
|
2446
|
-
innerType: type,
|
|
2447
|
-
typeName: ZodFirstPartyTypeKind.ZodDefault,
|
|
2448
|
-
defaultValue: typeof params.default == "function" ? params.default : () => params.default,
|
|
2449
|
-
...processCreateParams(params)
|
|
2450
|
-
});
|
|
2451
|
-
var ZodCatch = class extends ZodType {
|
|
2452
|
-
_parse(input) {
|
|
2453
|
-
let { ctx } = this._processInputParams(input), newCtx = {
|
|
2454
|
-
...ctx,
|
|
2455
|
-
common: {
|
|
2456
|
-
...ctx.common,
|
|
2457
|
-
issues: []
|
|
2458
|
-
}
|
|
2459
|
-
}, result = this._def.innerType._parse({
|
|
2460
|
-
data: newCtx.data,
|
|
2461
|
-
path: newCtx.path,
|
|
2462
|
-
parent: {
|
|
2463
|
-
...newCtx
|
|
2464
|
-
}
|
|
2465
|
-
});
|
|
2466
|
-
return isAsync(result) ? result.then((result2) => ({
|
|
2467
|
-
status: "valid",
|
|
2468
|
-
value: result2.status === "valid" ? result2.value : this._def.catchValue({
|
|
2469
|
-
get error() {
|
|
2470
|
-
return new ZodError(newCtx.common.issues);
|
|
2471
|
-
},
|
|
2472
|
-
input: newCtx.data
|
|
2473
|
-
})
|
|
2474
|
-
})) : {
|
|
2475
|
-
status: "valid",
|
|
2476
|
-
value: result.status === "valid" ? result.value : this._def.catchValue({
|
|
2477
|
-
get error() {
|
|
2478
|
-
return new ZodError(newCtx.common.issues);
|
|
2479
|
-
},
|
|
2480
|
-
input: newCtx.data
|
|
2481
|
-
})
|
|
2482
|
-
};
|
|
2483
|
-
}
|
|
2484
|
-
removeCatch() {
|
|
2485
|
-
return this._def.innerType;
|
|
2486
|
-
}
|
|
2487
|
-
};
|
|
2488
|
-
ZodCatch.create = (type, params) => new ZodCatch({
|
|
2489
|
-
innerType: type,
|
|
2490
|
-
typeName: ZodFirstPartyTypeKind.ZodCatch,
|
|
2491
|
-
catchValue: typeof params.catch == "function" ? params.catch : () => params.catch,
|
|
2492
|
-
...processCreateParams(params)
|
|
2493
|
-
});
|
|
2494
|
-
var ZodNaN = class extends ZodType {
|
|
2495
|
-
_parse(input) {
|
|
2496
|
-
if (this._getType(input) !== ZodParsedType.nan) {
|
|
2497
|
-
let ctx = this._getOrReturnCtx(input);
|
|
2498
|
-
return addIssueToContext(ctx, {
|
|
2499
|
-
code: ZodIssueCode.invalid_type,
|
|
2500
|
-
expected: ZodParsedType.nan,
|
|
2501
|
-
received: ctx.parsedType
|
|
2502
|
-
}), INVALID;
|
|
2503
|
-
}
|
|
2504
|
-
return { status: "valid", value: input.data };
|
|
2505
|
-
}
|
|
2506
|
-
};
|
|
2507
|
-
ZodNaN.create = (params) => new ZodNaN({
|
|
2508
|
-
typeName: ZodFirstPartyTypeKind.ZodNaN,
|
|
2509
|
-
...processCreateParams(params)
|
|
2510
|
-
});
|
|
2511
|
-
var BRAND = Symbol("zod_brand"), ZodBranded = class extends ZodType {
|
|
2512
|
-
_parse(input) {
|
|
2513
|
-
let { ctx } = this._processInputParams(input), data = ctx.data;
|
|
2514
|
-
return this._def.type._parse({
|
|
2515
|
-
data,
|
|
2516
|
-
path: ctx.path,
|
|
2517
|
-
parent: ctx
|
|
2518
|
-
});
|
|
2519
|
-
}
|
|
2520
|
-
unwrap() {
|
|
2521
|
-
return this._def.type;
|
|
2522
|
-
}
|
|
2523
|
-
}, ZodPipeline = class _ZodPipeline extends ZodType {
|
|
2524
|
-
_parse(input) {
|
|
2525
|
-
let { status, ctx } = this._processInputParams(input);
|
|
2526
|
-
if (ctx.common.async)
|
|
2527
|
-
return (async () => {
|
|
2528
|
-
let inResult = await this._def.in._parseAsync({
|
|
2529
|
-
data: ctx.data,
|
|
2530
|
-
path: ctx.path,
|
|
2531
|
-
parent: ctx
|
|
2532
|
-
});
|
|
2533
|
-
return inResult.status === "aborted" ? INVALID : inResult.status === "dirty" ? (status.dirty(), DIRTY(inResult.value)) : this._def.out._parseAsync({
|
|
2534
|
-
data: inResult.value,
|
|
2535
|
-
path: ctx.path,
|
|
2536
|
-
parent: ctx
|
|
2537
|
-
});
|
|
2538
|
-
})();
|
|
2539
|
-
{
|
|
2540
|
-
let inResult = this._def.in._parseSync({
|
|
2541
|
-
data: ctx.data,
|
|
2542
|
-
path: ctx.path,
|
|
2543
|
-
parent: ctx
|
|
2544
|
-
});
|
|
2545
|
-
return inResult.status === "aborted" ? INVALID : inResult.status === "dirty" ? (status.dirty(), {
|
|
2546
|
-
status: "dirty",
|
|
2547
|
-
value: inResult.value
|
|
2548
|
-
}) : this._def.out._parseSync({
|
|
2549
|
-
data: inResult.value,
|
|
2550
|
-
path: ctx.path,
|
|
2551
|
-
parent: ctx
|
|
2552
|
-
});
|
|
2553
|
-
}
|
|
2554
|
-
}
|
|
2555
|
-
static create(a, b) {
|
|
2556
|
-
return new _ZodPipeline({
|
|
2557
|
-
in: a,
|
|
2558
|
-
out: b,
|
|
2559
|
-
typeName: ZodFirstPartyTypeKind.ZodPipeline
|
|
2560
|
-
});
|
|
2561
|
-
}
|
|
2562
|
-
}, ZodReadonly = class extends ZodType {
|
|
2563
|
-
_parse(input) {
|
|
2564
|
-
let result = this._def.innerType._parse(input);
|
|
2565
|
-
return isValid(result) && (result.value = Object.freeze(result.value)), result;
|
|
2566
|
-
}
|
|
2567
|
-
};
|
|
2568
|
-
ZodReadonly.create = (type, params) => new ZodReadonly({
|
|
2569
|
-
innerType: type,
|
|
2570
|
-
typeName: ZodFirstPartyTypeKind.ZodReadonly,
|
|
2571
|
-
...processCreateParams(params)
|
|
2572
|
-
});
|
|
2573
|
-
var custom = (check, params = {}, fatal) => check ? ZodAny.create().superRefine((data, ctx) => {
|
|
2574
|
-
var _a, _b;
|
|
2575
|
-
if (!check(data)) {
|
|
2576
|
-
let p = typeof params == "function" ? params(data) : typeof params == "string" ? { message: params } : params, _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : !0, p2 = typeof p == "string" ? { message: p } : p;
|
|
2577
|
-
ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
|
|
2578
|
-
}
|
|
2579
|
-
}) : ZodAny.create(), late = {
|
|
2580
|
-
object: ZodObject.lazycreate
|
|
2581
|
-
}, ZodFirstPartyTypeKind;
|
|
2582
|
-
(function(ZodFirstPartyTypeKind2) {
|
|
2583
|
-
ZodFirstPartyTypeKind2.ZodString = "ZodString", ZodFirstPartyTypeKind2.ZodNumber = "ZodNumber", ZodFirstPartyTypeKind2.ZodNaN = "ZodNaN", ZodFirstPartyTypeKind2.ZodBigInt = "ZodBigInt", ZodFirstPartyTypeKind2.ZodBoolean = "ZodBoolean", ZodFirstPartyTypeKind2.ZodDate = "ZodDate", ZodFirstPartyTypeKind2.ZodSymbol = "ZodSymbol", ZodFirstPartyTypeKind2.ZodUndefined = "ZodUndefined", ZodFirstPartyTypeKind2.ZodNull = "ZodNull", ZodFirstPartyTypeKind2.ZodAny = "ZodAny", ZodFirstPartyTypeKind2.ZodUnknown = "ZodUnknown", ZodFirstPartyTypeKind2.ZodNever = "ZodNever", ZodFirstPartyTypeKind2.ZodVoid = "ZodVoid", ZodFirstPartyTypeKind2.ZodArray = "ZodArray", ZodFirstPartyTypeKind2.ZodObject = "ZodObject", ZodFirstPartyTypeKind2.ZodUnion = "ZodUnion", ZodFirstPartyTypeKind2.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", ZodFirstPartyTypeKind2.ZodIntersection = "ZodIntersection", ZodFirstPartyTypeKind2.ZodTuple = "ZodTuple", ZodFirstPartyTypeKind2.ZodRecord = "ZodRecord", ZodFirstPartyTypeKind2.ZodMap = "ZodMap", ZodFirstPartyTypeKind2.ZodSet = "ZodSet", ZodFirstPartyTypeKind2.ZodFunction = "ZodFunction", ZodFirstPartyTypeKind2.ZodLazy = "ZodLazy", ZodFirstPartyTypeKind2.ZodLiteral = "ZodLiteral", ZodFirstPartyTypeKind2.ZodEnum = "ZodEnum", ZodFirstPartyTypeKind2.ZodEffects = "ZodEffects", ZodFirstPartyTypeKind2.ZodNativeEnum = "ZodNativeEnum", ZodFirstPartyTypeKind2.ZodOptional = "ZodOptional", ZodFirstPartyTypeKind2.ZodNullable = "ZodNullable", ZodFirstPartyTypeKind2.ZodDefault = "ZodDefault", ZodFirstPartyTypeKind2.ZodCatch = "ZodCatch", ZodFirstPartyTypeKind2.ZodPromise = "ZodPromise", ZodFirstPartyTypeKind2.ZodBranded = "ZodBranded", ZodFirstPartyTypeKind2.ZodPipeline = "ZodPipeline", ZodFirstPartyTypeKind2.ZodReadonly = "ZodReadonly";
|
|
2584
|
-
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
2585
|
-
var instanceOfType = (cls, params = {
|
|
2586
|
-
message: `Input not instance of ${cls.name}`
|
|
2587
|
-
}) => custom((data) => data instanceof cls, params), stringType = ZodString.create, numberType = ZodNumber.create, nanType = ZodNaN.create, bigIntType = ZodBigInt.create, booleanType = ZodBoolean.create, dateType = ZodDate.create, symbolType = ZodSymbol.create, undefinedType = ZodUndefined.create, nullType = ZodNull.create, anyType = ZodAny.create, unknownType = ZodUnknown.create, neverType = ZodNever.create, voidType = ZodVoid.create, arrayType = ZodArray.create, objectType = ZodObject.create, strictObjectType = ZodObject.strictCreate, unionType = ZodUnion.create, discriminatedUnionType = ZodDiscriminatedUnion.create, intersectionType = ZodIntersection.create, tupleType = ZodTuple.create, recordType = ZodRecord.create, mapType = ZodMap.create, setType = ZodSet.create, functionType = ZodFunction.create, lazyType = ZodLazy.create, literalType = ZodLiteral.create, enumType = ZodEnum.create, nativeEnumType = ZodNativeEnum.create, promiseType = ZodPromise.create, effectsType = ZodEffects.create, optionalType = ZodOptional.create, nullableType = ZodNullable.create, preprocessType = ZodEffects.createWithPreprocess, pipelineType = ZodPipeline.create, ostring = () => stringType().optional(), onumber = () => numberType().optional(), oboolean = () => booleanType().optional(), coerce = {
|
|
2588
|
-
string: (arg) => ZodString.create({ ...arg, coerce: !0 }),
|
|
2589
|
-
number: (arg) => ZodNumber.create({ ...arg, coerce: !0 }),
|
|
2590
|
-
boolean: (arg) => ZodBoolean.create({
|
|
2591
|
-
...arg,
|
|
2592
|
-
coerce: !0
|
|
2593
|
-
}),
|
|
2594
|
-
bigint: (arg) => ZodBigInt.create({ ...arg, coerce: !0 }),
|
|
2595
|
-
date: (arg) => ZodDate.create({ ...arg, coerce: !0 })
|
|
2596
|
-
}, NEVER = INVALID, z = /* @__PURE__ */ Object.freeze({
|
|
2597
|
-
__proto__: null,
|
|
2598
|
-
defaultErrorMap: errorMap,
|
|
2599
|
-
setErrorMap,
|
|
2600
|
-
getErrorMap,
|
|
2601
|
-
makeIssue,
|
|
2602
|
-
EMPTY_PATH,
|
|
2603
|
-
addIssueToContext,
|
|
2604
|
-
ParseStatus,
|
|
2605
|
-
INVALID,
|
|
2606
|
-
DIRTY,
|
|
2607
|
-
OK,
|
|
2608
|
-
isAborted,
|
|
2609
|
-
isDirty,
|
|
2610
|
-
isValid,
|
|
2611
|
-
isAsync,
|
|
2612
|
-
get util() {
|
|
2613
|
-
return util;
|
|
2614
|
-
},
|
|
2615
|
-
get objectUtil() {
|
|
2616
|
-
return objectUtil;
|
|
2617
|
-
},
|
|
2618
|
-
ZodParsedType,
|
|
2619
|
-
getParsedType,
|
|
2620
|
-
ZodType,
|
|
2621
|
-
ZodString,
|
|
2622
|
-
ZodNumber,
|
|
2623
|
-
ZodBigInt,
|
|
2624
|
-
ZodBoolean,
|
|
2625
|
-
ZodDate,
|
|
2626
|
-
ZodSymbol,
|
|
2627
|
-
ZodUndefined,
|
|
2628
|
-
ZodNull,
|
|
2629
|
-
ZodAny,
|
|
2630
|
-
ZodUnknown,
|
|
2631
|
-
ZodNever,
|
|
2632
|
-
ZodVoid,
|
|
2633
|
-
ZodArray,
|
|
2634
|
-
ZodObject,
|
|
2635
|
-
ZodUnion,
|
|
2636
|
-
ZodDiscriminatedUnion,
|
|
2637
|
-
ZodIntersection,
|
|
2638
|
-
ZodTuple,
|
|
2639
|
-
ZodRecord,
|
|
2640
|
-
ZodMap,
|
|
2641
|
-
ZodSet,
|
|
2642
|
-
ZodFunction,
|
|
2643
|
-
ZodLazy,
|
|
2644
|
-
ZodLiteral,
|
|
2645
|
-
ZodEnum,
|
|
2646
|
-
ZodNativeEnum,
|
|
2647
|
-
ZodPromise,
|
|
2648
|
-
ZodEffects,
|
|
2649
|
-
ZodTransformer: ZodEffects,
|
|
2650
|
-
ZodOptional,
|
|
2651
|
-
ZodNullable,
|
|
2652
|
-
ZodDefault,
|
|
2653
|
-
ZodCatch,
|
|
2654
|
-
ZodNaN,
|
|
2655
|
-
BRAND,
|
|
2656
|
-
ZodBranded,
|
|
2657
|
-
ZodPipeline,
|
|
2658
|
-
ZodReadonly,
|
|
2659
|
-
custom,
|
|
2660
|
-
Schema: ZodType,
|
|
2661
|
-
ZodSchema: ZodType,
|
|
2662
|
-
late,
|
|
2663
|
-
get ZodFirstPartyTypeKind() {
|
|
2664
|
-
return ZodFirstPartyTypeKind;
|
|
2665
|
-
},
|
|
2666
|
-
coerce,
|
|
2667
|
-
any: anyType,
|
|
2668
|
-
array: arrayType,
|
|
2669
|
-
bigint: bigIntType,
|
|
2670
|
-
boolean: booleanType,
|
|
2671
|
-
date: dateType,
|
|
2672
|
-
discriminatedUnion: discriminatedUnionType,
|
|
2673
|
-
effect: effectsType,
|
|
2674
|
-
enum: enumType,
|
|
2675
|
-
function: functionType,
|
|
2676
|
-
instanceof: instanceOfType,
|
|
2677
|
-
intersection: intersectionType,
|
|
2678
|
-
lazy: lazyType,
|
|
2679
|
-
literal: literalType,
|
|
2680
|
-
map: mapType,
|
|
2681
|
-
nan: nanType,
|
|
2682
|
-
nativeEnum: nativeEnumType,
|
|
2683
|
-
never: neverType,
|
|
2684
|
-
null: nullType,
|
|
2685
|
-
nullable: nullableType,
|
|
2686
|
-
number: numberType,
|
|
2687
|
-
object: objectType,
|
|
2688
|
-
oboolean,
|
|
2689
|
-
onumber,
|
|
2690
|
-
optional: optionalType,
|
|
2691
|
-
ostring,
|
|
2692
|
-
pipeline: pipelineType,
|
|
2693
|
-
preprocess: preprocessType,
|
|
2694
|
-
promise: promiseType,
|
|
2695
|
-
record: recordType,
|
|
2696
|
-
set: setType,
|
|
2697
|
-
strictObject: strictObjectType,
|
|
2698
|
-
string: stringType,
|
|
2699
|
-
symbol: symbolType,
|
|
2700
|
-
transformer: effectsType,
|
|
2701
|
-
tuple: tupleType,
|
|
2702
|
-
undefined: undefinedType,
|
|
2703
|
-
union: unionType,
|
|
2704
|
-
unknown: unknownType,
|
|
2705
|
-
void: voidType,
|
|
2706
|
-
NEVER,
|
|
2707
|
-
ZodIssueCode,
|
|
2708
|
-
quotelessJson,
|
|
2709
|
-
ZodError
|
|
2710
|
-
});
|
|
2711
|
-
|
|
2712
|
-
// ../cli-kit/dist/public/node/schema.js
|
|
2713
|
-
init_cjs_shims();
|
|
2714
|
-
function deepStrict(schema) {
|
|
2715
|
-
if (schema instanceof ZodObject) {
|
|
2716
|
-
let shape = schema.shape, strictShape = Object.fromEntries(Object.entries(shape).map(([key, value]) => [key, deepStrict(value)]));
|
|
2717
|
-
return z.object(strictShape).strict();
|
|
2718
|
-
} else
|
|
2719
|
-
return schema instanceof ZodOptional ? deepStrict(schema._def.innerType).optional() : schema;
|
|
2720
|
-
}
|
|
2721
|
-
function errorsToString(errors) {
|
|
2722
|
-
return errors.map((error) => error.path.join(".").concat(": ").concat(error.message ?? "Unknow error")).join(`
|
|
2723
|
-
`);
|
|
2724
|
-
}
|
|
2725
|
-
|
|
2726
|
-
export {
|
|
2727
|
-
z,
|
|
2728
|
-
deepStrict,
|
|
2729
|
-
errorsToString
|
|
2730
|
-
};
|
|
2731
|
-
//# sourceMappingURL=chunk-NLUGD7PZ.js.map
|