fumadocs-openapi 10.10.3 → 11.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/css/generated/shared.css +1 -1159
  2. package/css/preset.css +1 -0
  3. package/dist/.translations/index.d.ts +80 -0
  4. package/dist/.translations/keys.js +80 -0
  5. package/dist/_virtual/_rolldown/runtime.js +1 -10
  6. package/dist/generate-file.d.ts +0 -4
  7. package/dist/generate-file.js +4 -5
  8. package/dist/i18n.d.ts +5 -100
  9. package/dist/i18n.js +8 -108
  10. package/dist/index.d.ts +4 -4
  11. package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.8 → @scalar_openapi-upgrader@0.2.9}/node_modules/@scalar/openapi-upgrader/dist/2.0-to-3.0/upgrade-from-two-to-three.js +1 -1
  12. package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.8 → @scalar_openapi-upgrader@0.2.9}/node_modules/@scalar/openapi-upgrader/dist/3.0-to-3.1/upgrade-from-three-to-three-one.js +1 -1
  13. package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.8 → @scalar_openapi-upgrader@0.2.9}/node_modules/@scalar/openapi-upgrader/dist/3.1-to-3.2/upgrade-from-three-one-to-three-two.js +1 -1
  14. package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.8 → @scalar_openapi-upgrader@0.2.9}/node_modules/@scalar/openapi-upgrader/dist/helpers/traverse.js +1 -1
  15. package/dist/node_modules/.pnpm/{@scalar_openapi-upgrader@0.2.8 → @scalar_openapi-upgrader@0.2.9}/node_modules/@scalar/openapi-upgrader/dist/upgrade.js +1 -1
  16. package/dist/playground/auth.js +4 -4
  17. package/dist/playground/client.d.ts +12 -21
  18. package/dist/playground/client.js +80 -59
  19. package/dist/playground/components/oauth-dialog.js +33 -33
  20. package/dist/playground/components/result-display.d.ts +1 -2
  21. package/dist/playground/components/result-display.js +7 -8
  22. package/dist/playground/components/server-select.js +11 -11
  23. package/dist/playground/status-info.js +29 -37
  24. package/dist/requests/generators/csharp.js +3 -3
  25. package/dist/requests/generators/curl.js +2 -2
  26. package/dist/requests/generators/go.js +2 -2
  27. package/dist/requests/generators/index.d.ts +28 -41
  28. package/dist/requests/generators/index.js +18 -35
  29. package/dist/requests/generators/java.js +2 -2
  30. package/dist/requests/generators/javascript.js +2 -2
  31. package/dist/requests/generators/python.js +2 -2
  32. package/dist/scalar/client.js +3 -2
  33. package/dist/scalar/index.d.ts +2 -2
  34. package/dist/scalar/index.js +10 -9
  35. package/dist/server/index.d.ts +23 -27
  36. package/dist/server/index.js +42 -38
  37. package/dist/server/proxy.d.ts +0 -6
  38. package/dist/server/proxy.js +2 -4
  39. package/dist/{_openapi/types.d.ts → types/openapi.d.ts} +127 -136
  40. package/dist/types.d.ts +14 -18
  41. package/dist/ui/base.d.ts +15 -162
  42. package/dist/ui/base.js +148 -107
  43. package/dist/ui/components/codeblock.js +6 -14
  44. package/dist/ui/components/heading.js +8 -4
  45. package/dist/ui/components/markdown.js +12 -0
  46. package/dist/ui/contexts/api.js +8 -26
  47. package/dist/ui/index.d.ts +204 -7
  48. package/dist/ui/index.js +10 -15
  49. package/dist/ui/operation/context.js +48 -0
  50. package/dist/ui/operation/index.js +168 -126
  51. package/dist/ui/operation/request-tabs.d.ts +10 -5
  52. package/dist/ui/operation/request-tabs.js +35 -22
  53. package/dist/ui/operation/response-tabs.d.ts +5 -2
  54. package/dist/ui/operation/response-tabs.js +22 -15
  55. package/dist/ui/operation/usage-tabs.js +144 -0
  56. package/dist/utils/document/dereference.d.ts +1 -1
  57. package/dist/utils/document/dereference.js +5 -8
  58. package/dist/utils/document/load.js +17 -0
  59. package/dist/utils/get-example-requests.d.ts +13 -0
  60. package/dist/{ui/operation → utils}/get-example-requests.js +31 -20
  61. package/dist/utils/pages/builder.d.ts +38 -10
  62. package/dist/utils/pages/builder.js +12 -10
  63. package/dist/utils/pages/preset-auto.d.ts +1 -2
  64. package/dist/utils/pages/preset-auto.js +15 -15
  65. package/dist/utils/pages/to-static-data.js +5 -4
  66. package/dist/utils/pages/to-text.d.ts +1 -0
  67. package/dist/utils/pages/to-text.js +21 -11
  68. package/dist/utils/remove-undefined.js +14 -9
  69. package/dist/utils/schema.d.ts +2 -0
  70. package/dist/utils/{schema/index.js → schema.js} +3 -30
  71. package/dist/{ui/client → utils}/storage-key.js +3 -3
  72. package/package.json +16 -29
  73. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/bundle.js +0 -239
  74. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/dereference.js +0 -187
  75. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/index.js +0 -136
  76. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/normalize-args.js +0 -41
  77. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/options.js +0 -124
  78. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parse.js +0 -109
  79. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/binary.js +0 -30
  80. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/json.js +0 -46
  81. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/text.js +0 -36
  82. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/yaml.js +0 -49
  83. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/pointer.js +0 -242
  84. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/ref.js +0 -247
  85. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/refs.js +0 -210
  86. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolve-external.js +0 -100
  87. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/file.js +0 -41
  88. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/http.js +0 -112
  89. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/convert-path-to-posix.js +0 -8
  90. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/errors.js +0 -146
  91. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/is-windows.js +0 -5
  92. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/maybe.js +0 -18
  93. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/next.js +0 -11
  94. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/plugins.js +0 -99
  95. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/schema-resources.js +0 -30
  96. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/url.js +0 -315
  97. package/dist/node_modules/.pnpm/@fastify_deepmerge@3.2.1/node_modules/@fastify/deepmerge/index.js +0 -108
  98. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/2020.js +0 -110
  99. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/code.js +0 -138
  100. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/index.js +0 -674
  101. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/scope.js +0 -141
  102. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/errors.js +0 -102
  103. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/index.js +0 -223
  104. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/names.js +0 -28
  105. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/ref_error.js +0 -18
  106. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/resolve.js +0 -133
  107. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/rules.js +0 -61
  108. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/util.js +0 -146
  109. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/applicability.js +0 -23
  110. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/boolSchema.js +0 -48
  111. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/dataType.js +0 -172
  112. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/defaults.js +0 -31
  113. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/index.js +0 -433
  114. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/keyword.js +0 -113
  115. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/subschema.js +0 -72
  116. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/core.js +0 -583
  117. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/data.js +0 -18
  118. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/index.js +0 -42
  119. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.js +0 -50
  120. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.js +0 -20
  121. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.js +0 -51
  122. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.js +0 -16
  123. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.js +0 -36
  124. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.js +0 -19
  125. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.js +0 -85
  126. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/schema.js +0 -59
  127. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/equal.js +0 -12
  128. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/ucs2length.js +0 -25
  129. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/uri.js +0 -12
  130. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/validation_error.js +0 -16
  131. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +0 -57
  132. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +0 -96
  133. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js +0 -29
  134. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +0 -16
  135. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/contains.js +0 -89
  136. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +0 -87
  137. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js +0 -16
  138. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/if.js +0 -62
  139. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/index.js +0 -60
  140. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items.js +0 -59
  141. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js +0 -34
  142. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/not.js +0 -31
  143. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +0 -51
  144. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +0 -61
  145. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +0 -17
  146. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/properties.js +0 -52
  147. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +0 -41
  148. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +0 -17
  149. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/code.js +0 -130
  150. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/id.js +0 -14
  151. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/index.js +0 -22
  152. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/ref.js +0 -112
  153. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/index.js +0 -101
  154. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/types.js +0 -14
  155. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/draft2020.js +0 -35
  156. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js +0 -46
  157. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js +0 -45
  158. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/index.js +0 -22
  159. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js +0 -20
  160. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js +0 -15
  161. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/format.js +0 -92
  162. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/index.js +0 -10
  163. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/metadata.js +0 -23
  164. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/next.js +0 -19
  165. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/index.js +0 -13
  166. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js +0 -46
  167. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +0 -59
  168. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/const.js +0 -27
  169. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js +0 -17
  170. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/enum.js +0 -49
  171. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/index.js +0 -48
  172. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitContains.js +0 -18
  173. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js +0 -28
  174. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js +0 -33
  175. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +0 -47
  176. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +0 -28
  177. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +0 -27
  178. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/pattern.js +0 -38
  179. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/required.js +0 -72
  180. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +0 -70
  181. package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js +0 -33
  182. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js +0 -236
  183. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/schemes.js +0 -187
  184. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js +0 -282
  185. package/dist/node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js +0 -78
  186. package/dist/playground/components/inputs.js +0 -419
  187. package/dist/playground/components/spinner.js +0 -15
  188. package/dist/playground/schema.d.ts +0 -15
  189. package/dist/playground/schema.js +0 -144
  190. package/dist/ui/api-page.d.ts +0 -31
  191. package/dist/ui/api-page.js +0 -59
  192. package/dist/ui/client/boundary.d.ts +0 -11
  193. package/dist/ui/client/boundary.js +0 -17
  194. package/dist/ui/client/boundary.lazy.js +0 -19
  195. package/dist/ui/client/full.js +0 -13
  196. package/dist/ui/client/i18n.js +0 -16
  197. package/dist/ui/client/index.d.ts +0 -42
  198. package/dist/ui/client/index.js +0 -7
  199. package/dist/ui/components/accordion.js +0 -67
  200. package/dist/ui/components/codeblock.d.ts +0 -14
  201. package/dist/ui/components/dialog.js +0 -56
  202. package/dist/ui/components/input.js +0 -17
  203. package/dist/ui/components/select-tab.js +0 -56
  204. package/dist/ui/components/select.js +0 -71
  205. package/dist/ui/contexts/api.d.ts +0 -29
  206. package/dist/ui/create-client.d.ts +0 -26
  207. package/dist/ui/create-client.js +0 -125
  208. package/dist/ui/operation/client.js +0 -78
  209. package/dist/ui/operation/get-example-requests.d.ts +0 -11
  210. package/dist/ui/operation/usage-tabs/client.d.ts +0 -14
  211. package/dist/ui/operation/usage-tabs/client.js +0 -91
  212. package/dist/ui/operation/usage-tabs/index.js +0 -54
  213. package/dist/ui/schema/client.d.ts +0 -18
  214. package/dist/ui/schema/client.js +0 -410
  215. package/dist/ui/schema/index.d.ts +0 -61
  216. package/dist/ui/schema/index.js +0 -256
  217. package/dist/utils/auto-anchor.client.js +0 -20
  218. package/dist/utils/auto-anchor.js +0 -17
  219. package/dist/utils/deep-equal.js +0 -21
  220. package/dist/utils/document/process.d.ts +0 -6
  221. package/dist/utils/document/process.js +0 -18
  222. package/dist/utils/id-to-title.js +0 -12
  223. package/dist/utils/is-plain-object.js +0 -8
  224. package/dist/utils/merge-refs.js +0 -11
  225. package/dist/utils/schema/dereference.js +0 -45
  226. package/dist/utils/schema/index.d.ts +0 -18
  227. package/dist/utils/schema/merge.js +0 -156
  228. package/dist/utils/schema/pick.js +0 -44
  229. package/dist/utils/schema/ref.js +0 -35
  230. package/dist/utils/schema/resolve-ref.js +0 -11
  231. package/dist/utils/schema/sample.js +0 -442
  232. package/dist/utils/schema/to-string.d.ts +0 -1
  233. package/dist/utils/schema/to-string.js +0 -53
  234. package/dist/utils/url.js +0 -39
@@ -1,433 +0,0 @@
1
- import { __commonJSMin } from "../../../../../../../../_virtual/_rolldown/runtime.js";
2
- import { require_codegen } from "../codegen/index.js";
3
- import { require_util } from "../util.js";
4
- import { require_names } from "../names.js";
5
- import { require_errors } from "../errors.js";
6
- import { require_boolSchema } from "./boolSchema.js";
7
- import { require_applicability } from "./applicability.js";
8
- import { require_dataType } from "./dataType.js";
9
- import { require_defaults } from "./defaults.js";
10
- import { require_keyword } from "./keyword.js";
11
- import { require_subschema } from "./subschema.js";
12
- import { require_resolve } from "../resolve.js";
13
- //#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/index.js
14
- var require_validate = /* @__PURE__ */ __commonJSMin(((exports) => {
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.getData = exports.KeywordCxt = exports.validateFunctionCode = void 0;
17
- const boolSchema_1 = require_boolSchema();
18
- const dataType_1 = require_dataType();
19
- const applicability_1 = require_applicability();
20
- const dataType_2 = require_dataType();
21
- const defaults_1 = require_defaults();
22
- const keyword_1 = require_keyword();
23
- const subschema_1 = require_subschema();
24
- const codegen_1 = require_codegen();
25
- const names_1 = require_names();
26
- const resolve_1 = require_resolve();
27
- const util_1 = require_util();
28
- const errors_1 = require_errors();
29
- function validateFunctionCode(it) {
30
- if (isSchemaObj(it)) {
31
- checkKeywords(it);
32
- if (schemaCxtHasRules(it)) {
33
- topSchemaObjCode(it);
34
- return;
35
- }
36
- }
37
- validateFunction(it, () => (0, boolSchema_1.topBoolOrEmptySchema)(it));
38
- }
39
- exports.validateFunctionCode = validateFunctionCode;
40
- function validateFunction({ gen, validateName, schema, schemaEnv, opts }, body) {
41
- if (opts.code.es5) gen.func(validateName, (0, codegen_1._)`${names_1.default.data}, ${names_1.default.valCxt}`, schemaEnv.$async, () => {
42
- gen.code((0, codegen_1._)`"use strict"; ${funcSourceUrl(schema, opts)}`);
43
- destructureValCxtES5(gen, opts);
44
- gen.code(body);
45
- });
46
- else gen.func(validateName, (0, codegen_1._)`${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema, opts)).code(body));
47
- }
48
- function destructureValCxt(opts) {
49
- return (0, codegen_1._)`{${names_1.default.instancePath}="", ${names_1.default.parentData}, ${names_1.default.parentDataProperty}, ${names_1.default.rootData}=${names_1.default.data}${opts.dynamicRef ? (0, codegen_1._)`, ${names_1.default.dynamicAnchors}={}` : codegen_1.nil}}={}`;
50
- }
51
- function destructureValCxtES5(gen, opts) {
52
- gen.if(names_1.default.valCxt, () => {
53
- gen.var(names_1.default.instancePath, (0, codegen_1._)`${names_1.default.valCxt}.${names_1.default.instancePath}`);
54
- gen.var(names_1.default.parentData, (0, codegen_1._)`${names_1.default.valCxt}.${names_1.default.parentData}`);
55
- gen.var(names_1.default.parentDataProperty, (0, codegen_1._)`${names_1.default.valCxt}.${names_1.default.parentDataProperty}`);
56
- gen.var(names_1.default.rootData, (0, codegen_1._)`${names_1.default.valCxt}.${names_1.default.rootData}`);
57
- if (opts.dynamicRef) gen.var(names_1.default.dynamicAnchors, (0, codegen_1._)`${names_1.default.valCxt}.${names_1.default.dynamicAnchors}`);
58
- }, () => {
59
- gen.var(names_1.default.instancePath, (0, codegen_1._)`""`);
60
- gen.var(names_1.default.parentData, (0, codegen_1._)`undefined`);
61
- gen.var(names_1.default.parentDataProperty, (0, codegen_1._)`undefined`);
62
- gen.var(names_1.default.rootData, names_1.default.data);
63
- if (opts.dynamicRef) gen.var(names_1.default.dynamicAnchors, (0, codegen_1._)`{}`);
64
- });
65
- }
66
- function topSchemaObjCode(it) {
67
- const { schema, opts, gen } = it;
68
- validateFunction(it, () => {
69
- if (opts.$comment && schema.$comment) commentKeyword(it);
70
- checkNoDefault(it);
71
- gen.let(names_1.default.vErrors, null);
72
- gen.let(names_1.default.errors, 0);
73
- if (opts.unevaluated) resetEvaluated(it);
74
- typeAndKeywords(it);
75
- returnResults(it);
76
- });
77
- }
78
- function resetEvaluated(it) {
79
- const { gen, validateName } = it;
80
- it.evaluated = gen.const("evaluated", (0, codegen_1._)`${validateName}.evaluated`);
81
- gen.if((0, codegen_1._)`${it.evaluated}.dynamicProps`, () => gen.assign((0, codegen_1._)`${it.evaluated}.props`, (0, codegen_1._)`undefined`));
82
- gen.if((0, codegen_1._)`${it.evaluated}.dynamicItems`, () => gen.assign((0, codegen_1._)`${it.evaluated}.items`, (0, codegen_1._)`undefined`));
83
- }
84
- function funcSourceUrl(schema, opts) {
85
- const schId = typeof schema == "object" && schema[opts.schemaId];
86
- return schId && (opts.code.source || opts.code.process) ? (0, codegen_1._)`/*# sourceURL=${schId} */` : codegen_1.nil;
87
- }
88
- function subschemaCode(it, valid) {
89
- if (isSchemaObj(it)) {
90
- checkKeywords(it);
91
- if (schemaCxtHasRules(it)) {
92
- subSchemaObjCode(it, valid);
93
- return;
94
- }
95
- }
96
- (0, boolSchema_1.boolOrEmptySchema)(it, valid);
97
- }
98
- function schemaCxtHasRules({ schema, self }) {
99
- if (typeof schema == "boolean") return !schema;
100
- for (const key in schema) if (self.RULES.all[key]) return true;
101
- return false;
102
- }
103
- function isSchemaObj(it) {
104
- return typeof it.schema != "boolean";
105
- }
106
- function subSchemaObjCode(it, valid) {
107
- const { schema, gen, opts } = it;
108
- if (opts.$comment && schema.$comment) commentKeyword(it);
109
- updateContext(it);
110
- checkAsyncSchema(it);
111
- const errsCount = gen.const("_errs", names_1.default.errors);
112
- typeAndKeywords(it, errsCount);
113
- gen.var(valid, (0, codegen_1._)`${errsCount} === ${names_1.default.errors}`);
114
- }
115
- function checkKeywords(it) {
116
- (0, util_1.checkUnknownRules)(it);
117
- checkRefsAndKeywords(it);
118
- }
119
- function typeAndKeywords(it, errsCount) {
120
- if (it.opts.jtd) return schemaKeywords(it, [], false, errsCount);
121
- const types = (0, dataType_1.getSchemaTypes)(it.schema);
122
- schemaKeywords(it, types, !(0, dataType_1.coerceAndCheckDataType)(it, types), errsCount);
123
- }
124
- function checkRefsAndKeywords(it) {
125
- const { schema, errSchemaPath, opts, self } = it;
126
- if (schema.$ref && opts.ignoreKeywordsWithRef && (0, util_1.schemaHasRulesButRef)(schema, self.RULES)) self.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`);
127
- }
128
- function checkNoDefault(it) {
129
- const { schema, opts } = it;
130
- if (schema.default !== void 0 && opts.useDefaults && opts.strictSchema) (0, util_1.checkStrictMode)(it, "default is ignored in the schema root");
131
- }
132
- function updateContext(it) {
133
- const schId = it.schema[it.opts.schemaId];
134
- if (schId) it.baseId = (0, resolve_1.resolveUrl)(it.opts.uriResolver, it.baseId, schId);
135
- }
136
- function checkAsyncSchema(it) {
137
- if (it.schema.$async && !it.schemaEnv.$async) throw new Error("async schema in sync schema");
138
- }
139
- function commentKeyword({ gen, schemaEnv, schema, errSchemaPath, opts }) {
140
- const msg = schema.$comment;
141
- if (opts.$comment === true) gen.code((0, codegen_1._)`${names_1.default.self}.logger.log(${msg})`);
142
- else if (typeof opts.$comment == "function") {
143
- const schemaPath = (0, codegen_1.str)`${errSchemaPath}/$comment`;
144
- const rootName = gen.scopeValue("root", { ref: schemaEnv.root });
145
- gen.code((0, codegen_1._)`${names_1.default.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`);
146
- }
147
- }
148
- function returnResults(it) {
149
- const { gen, schemaEnv, validateName, ValidationError, opts } = it;
150
- if (schemaEnv.$async) gen.if((0, codegen_1._)`${names_1.default.errors} === 0`, () => gen.return(names_1.default.data), () => gen.throw((0, codegen_1._)`new ${ValidationError}(${names_1.default.vErrors})`));
151
- else {
152
- gen.assign((0, codegen_1._)`${validateName}.errors`, names_1.default.vErrors);
153
- if (opts.unevaluated) assignEvaluated(it);
154
- gen.return((0, codegen_1._)`${names_1.default.errors} === 0`);
155
- }
156
- }
157
- function assignEvaluated({ gen, evaluated, props, items }) {
158
- if (props instanceof codegen_1.Name) gen.assign((0, codegen_1._)`${evaluated}.props`, props);
159
- if (items instanceof codegen_1.Name) gen.assign((0, codegen_1._)`${evaluated}.items`, items);
160
- }
161
- function schemaKeywords(it, types, typeErrors, errsCount) {
162
- const { gen, schema, data, allErrors, opts, self } = it;
163
- const { RULES } = self;
164
- if (schema.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1.schemaHasRulesButRef)(schema, RULES))) {
165
- gen.block(() => keywordCode(it, "$ref", RULES.all.$ref.definition));
166
- return;
167
- }
168
- if (!opts.jtd) checkStrictTypes(it, types);
169
- gen.block(() => {
170
- for (const group of RULES.rules) groupKeywords(group);
171
- groupKeywords(RULES.post);
172
- });
173
- function groupKeywords(group) {
174
- if (!(0, applicability_1.shouldUseGroup)(schema, group)) return;
175
- if (group.type) {
176
- gen.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers));
177
- iterateKeywords(it, group);
178
- if (types.length === 1 && types[0] === group.type && typeErrors) {
179
- gen.else();
180
- (0, dataType_2.reportTypeError)(it);
181
- }
182
- gen.endIf();
183
- } else iterateKeywords(it, group);
184
- if (!allErrors) gen.if((0, codegen_1._)`${names_1.default.errors} === ${errsCount || 0}`);
185
- }
186
- }
187
- function iterateKeywords(it, group) {
188
- const { gen, schema, opts: { useDefaults } } = it;
189
- if (useDefaults) (0, defaults_1.assignDefaults)(it, group.type);
190
- gen.block(() => {
191
- for (const rule of group.rules) if ((0, applicability_1.shouldUseRule)(schema, rule)) keywordCode(it, rule.keyword, rule.definition, group.type);
192
- });
193
- }
194
- function checkStrictTypes(it, types) {
195
- if (it.schemaEnv.meta || !it.opts.strictTypes) return;
196
- checkContextTypes(it, types);
197
- if (!it.opts.allowUnionTypes) checkMultipleTypes(it, types);
198
- checkKeywordTypes(it, it.dataTypes);
199
- }
200
- function checkContextTypes(it, types) {
201
- if (!types.length) return;
202
- if (!it.dataTypes.length) {
203
- it.dataTypes = types;
204
- return;
205
- }
206
- types.forEach((t) => {
207
- if (!includesType(it.dataTypes, t)) strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`);
208
- });
209
- narrowSchemaTypes(it, types);
210
- }
211
- function checkMultipleTypes(it, ts) {
212
- if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) strictTypesError(it, "use allowUnionTypes to allow union type keyword");
213
- }
214
- function checkKeywordTypes(it, ts) {
215
- const rules = it.self.RULES.all;
216
- for (const keyword in rules) {
217
- const rule = rules[keyword];
218
- if (typeof rule == "object" && (0, applicability_1.shouldUseRule)(it.schema, rule)) {
219
- const { type } = rule.definition;
220
- if (type.length && !type.some((t) => hasApplicableType(ts, t))) strictTypesError(it, `missing type "${type.join(",")}" for keyword "${keyword}"`);
221
- }
222
- }
223
- }
224
- function hasApplicableType(schTs, kwdT) {
225
- return schTs.includes(kwdT) || kwdT === "number" && schTs.includes("integer");
226
- }
227
- function includesType(ts, t) {
228
- return ts.includes(t) || t === "integer" && ts.includes("number");
229
- }
230
- function narrowSchemaTypes(it, withTypes) {
231
- const ts = [];
232
- for (const t of it.dataTypes) if (includesType(withTypes, t)) ts.push(t);
233
- else if (withTypes.includes("integer") && t === "number") ts.push("integer");
234
- it.dataTypes = ts;
235
- }
236
- function strictTypesError(it, msg) {
237
- const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;
238
- msg += ` at "${schemaPath}" (strictTypes)`;
239
- (0, util_1.checkStrictMode)(it, msg, it.opts.strictTypes);
240
- }
241
- var KeywordCxt = class {
242
- constructor(it, def, keyword) {
243
- (0, keyword_1.validateKeywordUsage)(it, def, keyword);
244
- this.gen = it.gen;
245
- this.allErrors = it.allErrors;
246
- this.keyword = keyword;
247
- this.data = it.data;
248
- this.schema = it.schema[keyword];
249
- this.$data = def.$data && it.opts.$data && this.schema && this.schema.$data;
250
- this.schemaValue = (0, util_1.schemaRefOrVal)(it, this.schema, keyword, this.$data);
251
- this.schemaType = def.schemaType;
252
- this.parentSchema = it.schema;
253
- this.params = {};
254
- this.it = it;
255
- this.def = def;
256
- if (this.$data) this.schemaCode = it.gen.const("vSchema", getData(this.$data, it));
257
- else {
258
- this.schemaCode = this.schemaValue;
259
- if (!(0, keyword_1.validSchemaType)(this.schema, def.schemaType, def.allowUndefined)) throw new Error(`${keyword} value must be ${JSON.stringify(def.schemaType)}`);
260
- }
261
- if ("code" in def ? def.trackErrors : def.errors !== false) this.errsCount = it.gen.const("_errs", names_1.default.errors);
262
- }
263
- result(condition, successAction, failAction) {
264
- this.failResult((0, codegen_1.not)(condition), successAction, failAction);
265
- }
266
- failResult(condition, successAction, failAction) {
267
- this.gen.if(condition);
268
- if (failAction) failAction();
269
- else this.error();
270
- if (successAction) {
271
- this.gen.else();
272
- successAction();
273
- if (this.allErrors) this.gen.endIf();
274
- } else if (this.allErrors) this.gen.endIf();
275
- else this.gen.else();
276
- }
277
- pass(condition, failAction) {
278
- this.failResult((0, codegen_1.not)(condition), void 0, failAction);
279
- }
280
- fail(condition) {
281
- if (condition === void 0) {
282
- this.error();
283
- if (!this.allErrors) this.gen.if(false);
284
- return;
285
- }
286
- this.gen.if(condition);
287
- this.error();
288
- if (this.allErrors) this.gen.endIf();
289
- else this.gen.else();
290
- }
291
- fail$data(condition) {
292
- if (!this.$data) return this.fail(condition);
293
- const { schemaCode } = this;
294
- this.fail((0, codegen_1._)`${schemaCode} !== undefined && (${(0, codegen_1.or)(this.invalid$data(), condition)})`);
295
- }
296
- error(append, errorParams, errorPaths) {
297
- if (errorParams) {
298
- this.setParams(errorParams);
299
- this._error(append, errorPaths);
300
- this.setParams({});
301
- return;
302
- }
303
- this._error(append, errorPaths);
304
- }
305
- _error(append, errorPaths) {
306
- (append ? errors_1.reportExtraError : errors_1.reportError)(this, this.def.error, errorPaths);
307
- }
308
- $dataError() {
309
- (0, errors_1.reportError)(this, this.def.$dataError || errors_1.keyword$DataError);
310
- }
311
- reset() {
312
- if (this.errsCount === void 0) throw new Error("add \"trackErrors\" to keyword definition");
313
- (0, errors_1.resetErrorsCount)(this.gen, this.errsCount);
314
- }
315
- ok(cond) {
316
- if (!this.allErrors) this.gen.if(cond);
317
- }
318
- setParams(obj, assign) {
319
- if (assign) Object.assign(this.params, obj);
320
- else this.params = obj;
321
- }
322
- block$data(valid, codeBlock, $dataValid = codegen_1.nil) {
323
- this.gen.block(() => {
324
- this.check$data(valid, $dataValid);
325
- codeBlock();
326
- });
327
- }
328
- check$data(valid = codegen_1.nil, $dataValid = codegen_1.nil) {
329
- if (!this.$data) return;
330
- const { gen, schemaCode, schemaType, def } = this;
331
- gen.if((0, codegen_1.or)((0, codegen_1._)`${schemaCode} === undefined`, $dataValid));
332
- if (valid !== codegen_1.nil) gen.assign(valid, true);
333
- if (schemaType.length || def.validateSchema) {
334
- gen.elseIf(this.invalid$data());
335
- this.$dataError();
336
- if (valid !== codegen_1.nil) gen.assign(valid, false);
337
- }
338
- gen.else();
339
- }
340
- invalid$data() {
341
- const { gen, schemaCode, schemaType, def, it } = this;
342
- return (0, codegen_1.or)(wrong$DataType(), invalid$DataSchema());
343
- function wrong$DataType() {
344
- if (schemaType.length) {
345
- /* istanbul ignore if */
346
- if (!(schemaCode instanceof codegen_1.Name)) throw new Error("ajv implementation error");
347
- const st = Array.isArray(schemaType) ? schemaType : [schemaType];
348
- return (0, codegen_1._)`${(0, dataType_2.checkDataTypes)(st, schemaCode, it.opts.strictNumbers, dataType_2.DataType.Wrong)}`;
349
- }
350
- return codegen_1.nil;
351
- }
352
- function invalid$DataSchema() {
353
- if (def.validateSchema) {
354
- const validateSchemaRef = gen.scopeValue("validate$data", { ref: def.validateSchema });
355
- return (0, codegen_1._)`!${validateSchemaRef}(${schemaCode})`;
356
- }
357
- return codegen_1.nil;
358
- }
359
- }
360
- subschema(appl, valid) {
361
- const subschema = (0, subschema_1.getSubschema)(this.it, appl);
362
- (0, subschema_1.extendSubschemaData)(subschema, this.it, appl);
363
- (0, subschema_1.extendSubschemaMode)(subschema, appl);
364
- const nextContext = {
365
- ...this.it,
366
- ...subschema,
367
- items: void 0,
368
- props: void 0
369
- };
370
- subschemaCode(nextContext, valid);
371
- return nextContext;
372
- }
373
- mergeEvaluated(schemaCxt, toName) {
374
- const { it, gen } = this;
375
- if (!it.opts.unevaluated) return;
376
- if (it.props !== true && schemaCxt.props !== void 0) it.props = util_1.mergeEvaluated.props(gen, schemaCxt.props, it.props, toName);
377
- if (it.items !== true && schemaCxt.items !== void 0) it.items = util_1.mergeEvaluated.items(gen, schemaCxt.items, it.items, toName);
378
- }
379
- mergeValidEvaluated(schemaCxt, valid) {
380
- const { it, gen } = this;
381
- if (it.opts.unevaluated && (it.props !== true || it.items !== true)) {
382
- gen.if(valid, () => this.mergeEvaluated(schemaCxt, codegen_1.Name));
383
- return true;
384
- }
385
- }
386
- };
387
- exports.KeywordCxt = KeywordCxt;
388
- function keywordCode(it, keyword, def, ruleType) {
389
- const cxt = new KeywordCxt(it, def, keyword);
390
- if ("code" in def) def.code(cxt, ruleType);
391
- else if (cxt.$data && def.validate) (0, keyword_1.funcKeywordCode)(cxt, def);
392
- else if ("macro" in def) (0, keyword_1.macroKeywordCode)(cxt, def);
393
- else if (def.compile || def.validate) (0, keyword_1.funcKeywordCode)(cxt, def);
394
- }
395
- const JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
396
- const RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
397
- function getData($data, { dataLevel, dataNames, dataPathArr }) {
398
- let jsonPointer;
399
- let data;
400
- if ($data === "") return names_1.default.rootData;
401
- if ($data[0] === "/") {
402
- if (!JSON_POINTER.test($data)) throw new Error(`Invalid JSON-pointer: ${$data}`);
403
- jsonPointer = $data;
404
- data = names_1.default.rootData;
405
- } else {
406
- const matches = RELATIVE_JSON_POINTER.exec($data);
407
- if (!matches) throw new Error(`Invalid JSON-pointer: ${$data}`);
408
- const up = +matches[1];
409
- jsonPointer = matches[2];
410
- if (jsonPointer === "#") {
411
- if (up >= dataLevel) throw new Error(errorMsg("property/index", up));
412
- return dataPathArr[dataLevel - up];
413
- }
414
- if (up > dataLevel) throw new Error(errorMsg("data", up));
415
- data = dataNames[dataLevel - up];
416
- if (!jsonPointer) return data;
417
- }
418
- let expr = data;
419
- const segments = jsonPointer.split("/");
420
- for (const segment of segments) if (segment) {
421
- data = (0, codegen_1._)`${data}${(0, codegen_1.getProperty)((0, util_1.unescapeJsonPointer)(segment))}`;
422
- expr = (0, codegen_1._)`${expr} && ${data}`;
423
- }
424
- return expr;
425
- function errorMsg(pointerType, up) {
426
- return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}`;
427
- }
428
- }
429
- exports.getData = getData;
430
- }));
431
- //#endregion
432
- export default require_validate();
433
- export { require_validate };
@@ -1,113 +0,0 @@
1
- import { __commonJSMin } from "../../../../../../../../_virtual/_rolldown/runtime.js";
2
- import { require_codegen } from "../codegen/index.js";
3
- import { require_names } from "../names.js";
4
- import { require_errors } from "../errors.js";
5
- import { require_code } from "../../vocabularies/code.js";
6
- //#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/keyword.js
7
- var require_keyword = /* @__PURE__ */ __commonJSMin(((exports) => {
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.validateKeywordUsage = exports.validSchemaType = exports.funcKeywordCode = exports.macroKeywordCode = void 0;
10
- const codegen_1 = require_codegen();
11
- const names_1 = require_names();
12
- const code_1 = require_code();
13
- const errors_1 = require_errors();
14
- function macroKeywordCode(cxt, def) {
15
- const { gen, keyword, schema, parentSchema, it } = cxt;
16
- const macroSchema = def.macro.call(it.self, schema, parentSchema, it);
17
- const schemaRef = useKeyword(gen, keyword, macroSchema);
18
- if (it.opts.validateSchema !== false) it.self.validateSchema(macroSchema, true);
19
- const valid = gen.name("valid");
20
- cxt.subschema({
21
- schema: macroSchema,
22
- schemaPath: codegen_1.nil,
23
- errSchemaPath: `${it.errSchemaPath}/${keyword}`,
24
- topSchemaRef: schemaRef,
25
- compositeRule: true
26
- }, valid);
27
- cxt.pass(valid, () => cxt.error(true));
28
- }
29
- exports.macroKeywordCode = macroKeywordCode;
30
- function funcKeywordCode(cxt, def) {
31
- var _a;
32
- const { gen, keyword, schema, parentSchema, $data, it } = cxt;
33
- checkAsyncKeyword(it, def);
34
- const validateRef = useKeyword(gen, keyword, !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate);
35
- const valid = gen.let("valid");
36
- cxt.block$data(valid, validateKeyword);
37
- cxt.ok((_a = def.valid) !== null && _a !== void 0 ? _a : valid);
38
- function validateKeyword() {
39
- if (def.errors === false) {
40
- assignValid();
41
- if (def.modifying) modifyData(cxt);
42
- reportErrs(() => cxt.error());
43
- } else {
44
- const ruleErrs = def.async ? validateAsync() : validateSync();
45
- if (def.modifying) modifyData(cxt);
46
- reportErrs(() => addErrs(cxt, ruleErrs));
47
- }
48
- }
49
- function validateAsync() {
50
- const ruleErrs = gen.let("ruleErrs", null);
51
- gen.try(() => assignValid((0, codegen_1._)`await `), (e) => gen.assign(valid, false).if((0, codegen_1._)`${e} instanceof ${it.ValidationError}`, () => gen.assign(ruleErrs, (0, codegen_1._)`${e}.errors`), () => gen.throw(e)));
52
- return ruleErrs;
53
- }
54
- function validateSync() {
55
- const validateErrs = (0, codegen_1._)`${validateRef}.errors`;
56
- gen.assign(validateErrs, null);
57
- assignValid(codegen_1.nil);
58
- return validateErrs;
59
- }
60
- function assignValid(_await = def.async ? (0, codegen_1._)`await ` : codegen_1.nil) {
61
- const passCxt = it.opts.passContext ? names_1.default.this : names_1.default.self;
62
- const passSchema = !("compile" in def && !$data || def.schema === false);
63
- gen.assign(valid, (0, codegen_1._)`${_await}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying);
64
- }
65
- function reportErrs(errors) {
66
- var _a;
67
- gen.if((0, codegen_1.not)((_a = def.valid) !== null && _a !== void 0 ? _a : valid), errors);
68
- }
69
- }
70
- exports.funcKeywordCode = funcKeywordCode;
71
- function modifyData(cxt) {
72
- const { gen, data, it } = cxt;
73
- gen.if(it.parentData, () => gen.assign(data, (0, codegen_1._)`${it.parentData}[${it.parentDataProperty}]`));
74
- }
75
- function addErrs(cxt, errs) {
76
- const { gen } = cxt;
77
- gen.if((0, codegen_1._)`Array.isArray(${errs})`, () => {
78
- gen.assign(names_1.default.vErrors, (0, codegen_1._)`${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})`).assign(names_1.default.errors, (0, codegen_1._)`${names_1.default.vErrors}.length`);
79
- (0, errors_1.extendErrors)(cxt);
80
- }, () => cxt.error());
81
- }
82
- function checkAsyncKeyword({ schemaEnv }, def) {
83
- if (def.async && !schemaEnv.$async) throw new Error("async keyword in sync schema");
84
- }
85
- function useKeyword(gen, keyword, result) {
86
- if (result === void 0) throw new Error(`keyword "${keyword}" failed to compile`);
87
- return gen.scopeValue("keyword", typeof result == "function" ? { ref: result } : {
88
- ref: result,
89
- code: (0, codegen_1.stringify)(result)
90
- });
91
- }
92
- function validSchemaType(schema, schemaType, allowUndefined = false) {
93
- return !schemaType.length || schemaType.some((st) => st === "array" ? Array.isArray(schema) : st === "object" ? schema && typeof schema == "object" && !Array.isArray(schema) : typeof schema == st || allowUndefined && typeof schema == "undefined");
94
- }
95
- exports.validSchemaType = validSchemaType;
96
- function validateKeywordUsage({ schema, opts, self, errSchemaPath }, def, keyword) {
97
- /* istanbul ignore if */
98
- if (Array.isArray(def.keyword) ? !def.keyword.includes(keyword) : def.keyword !== keyword) throw new Error("ajv implementation error");
99
- const deps = def.dependencies;
100
- if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(schema, kwd))) throw new Error(`parent schema must have dependencies of ${keyword}: ${deps.join(",")}`);
101
- if (def.validateSchema) {
102
- if (!def.validateSchema(schema[keyword])) {
103
- const msg = `keyword "${keyword}" value is invalid at path "${errSchemaPath}": ` + self.errorsText(def.validateSchema.errors);
104
- if (opts.validateSchema === "log") self.logger.error(msg);
105
- else throw new Error(msg);
106
- }
107
- }
108
- }
109
- exports.validateKeywordUsage = validateKeywordUsage;
110
- }));
111
- //#endregion
112
- export default require_keyword();
113
- export { require_keyword };
@@ -1,72 +0,0 @@
1
- import { __commonJSMin } from "../../../../../../../../_virtual/_rolldown/runtime.js";
2
- import { require_codegen } from "../codegen/index.js";
3
- import { require_util } from "../util.js";
4
- //#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/subschema.js
5
- var require_subschema = /* @__PURE__ */ __commonJSMin(((exports) => {
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.extendSubschemaMode = exports.extendSubschemaData = exports.getSubschema = void 0;
8
- const codegen_1 = require_codegen();
9
- const util_1 = require_util();
10
- function getSubschema(it, { keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }) {
11
- if (keyword !== void 0 && schema !== void 0) throw new Error("both \"keyword\" and \"schema\" passed, only one allowed");
12
- if (keyword !== void 0) {
13
- const sch = it.schema[keyword];
14
- return schemaProp === void 0 ? {
15
- schema: sch,
16
- schemaPath: (0, codegen_1._)`${it.schemaPath}${(0, codegen_1.getProperty)(keyword)}`,
17
- errSchemaPath: `${it.errSchemaPath}/${keyword}`
18
- } : {
19
- schema: sch[schemaProp],
20
- schemaPath: (0, codegen_1._)`${it.schemaPath}${(0, codegen_1.getProperty)(keyword)}${(0, codegen_1.getProperty)(schemaProp)}`,
21
- errSchemaPath: `${it.errSchemaPath}/${keyword}/${(0, util_1.escapeFragment)(schemaProp)}`
22
- };
23
- }
24
- if (schema !== void 0) {
25
- if (schemaPath === void 0 || errSchemaPath === void 0 || topSchemaRef === void 0) throw new Error("\"schemaPath\", \"errSchemaPath\" and \"topSchemaRef\" are required with \"schema\"");
26
- return {
27
- schema,
28
- schemaPath,
29
- topSchemaRef,
30
- errSchemaPath
31
- };
32
- }
33
- throw new Error("either \"keyword\" or \"schema\" must be passed");
34
- }
35
- exports.getSubschema = getSubschema;
36
- function extendSubschemaData(subschema, it, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }) {
37
- if (data !== void 0 && dataProp !== void 0) throw new Error("both \"data\" and \"dataProp\" passed, only one allowed");
38
- const { gen } = it;
39
- if (dataProp !== void 0) {
40
- const { errorPath, dataPathArr, opts } = it;
41
- dataContextProps(gen.let("data", (0, codegen_1._)`${it.data}${(0, codegen_1.getProperty)(dataProp)}`, true));
42
- subschema.errorPath = (0, codegen_1.str)`${errorPath}${(0, util_1.getErrorPath)(dataProp, dpType, opts.jsPropertySyntax)}`;
43
- subschema.parentDataProperty = (0, codegen_1._)`${dataProp}`;
44
- subschema.dataPathArr = [...dataPathArr, subschema.parentDataProperty];
45
- }
46
- if (data !== void 0) {
47
- dataContextProps(data instanceof codegen_1.Name ? data : gen.let("data", data, true));
48
- if (propertyName !== void 0) subschema.propertyName = propertyName;
49
- }
50
- if (dataTypes) subschema.dataTypes = dataTypes;
51
- function dataContextProps(_nextData) {
52
- subschema.data = _nextData;
53
- subschema.dataLevel = it.dataLevel + 1;
54
- subschema.dataTypes = [];
55
- it.definedProperties = /* @__PURE__ */ new Set();
56
- subschema.parentData = it.data;
57
- subschema.dataNames = [...it.dataNames, _nextData];
58
- }
59
- }
60
- exports.extendSubschemaData = extendSubschemaData;
61
- function extendSubschemaMode(subschema, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }) {
62
- if (compositeRule !== void 0) subschema.compositeRule = compositeRule;
63
- if (createErrors !== void 0) subschema.createErrors = createErrors;
64
- if (allErrors !== void 0) subschema.allErrors = allErrors;
65
- subschema.jtdDiscriminator = jtdDiscriminator;
66
- subschema.jtdMetadata = jtdMetadata;
67
- }
68
- exports.extendSubschemaMode = extendSubschemaMode;
69
- }));
70
- //#endregion
71
- export default require_subschema();
72
- export { require_subschema };