fumadocs-openapi 10.10.3 → 11.0.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.
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 +15 -28
  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,187 +0,0 @@
1
- import { cwd, resolve } from "./util/url.js";
2
- import { TimeoutError } from "./util/errors.js";
3
- import { getSchemaBasePath } from "./util/schema-resources.js";
4
- import Pointer from "./pointer.js";
5
- import $Ref from "./ref.js";
6
- //#region ../../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
7
- var dereference_default = dereference;
8
- /**
9
- * Crawls the JSON schema, finds all JSON references, and dereferences them.
10
- * This method mutates the JSON schema object, replacing JSON references with their resolved value.
11
- *
12
- * @param parser
13
- * @param options
14
- */
15
- function dereference(parser, options) {
16
- const start = Date.now();
17
- const rootScopeBase = parser.$refs._root$Ref.dynamicIdScope ? getSchemaBasePath(parser.$refs._root$Ref.path, parser.schema) : parser.$refs._root$Ref.path;
18
- const dereferenced = crawl(parser.schema, parser.$refs._root$Ref.path, rootScopeBase, parser.$refs._root$Ref.dynamicIdScope, "#", /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), /* @__PURE__ */ new Map(), parser.$refs, options, start, 0);
19
- parser.$refs.circular = dereferenced.circular;
20
- parser.schema = dereferenced.value;
21
- }
22
- /**
23
- * Recursively crawls the given value, and dereferences any JSON references.
24
- *
25
- * @param obj - The value to crawl. If it's not an object or array, it will be ignored.
26
- * @param path - The full path of `obj`, possibly with a JSON Pointer in the hash
27
- * @param pathFromRoot - The path of `obj` from the schema root
28
- * @param parents - An array of the parent objects that have already been dereferenced
29
- * @param processedObjects - An array of all the objects that have already been processed
30
- * @param dereferencedCache - An map of all the dereferenced objects
31
- * @param $refs
32
- * @param options
33
- * @param startTime - The time when the dereferencing started
34
- * @param depth - The current recursion depth
35
- * @returns
36
- */
37
- function crawl(obj, path, scopeBase, dynamicIdScope, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime, depth) {
38
- let dereferenced;
39
- const result = {
40
- value: obj,
41
- circular: false
42
- };
43
- checkDereferenceTimeout(startTime, options);
44
- const derefOptions = options.dereference || {};
45
- const maxDepth = derefOptions.maxDepth ?? 500;
46
- if (depth > maxDepth) throw new RangeError(`Maximum dereference depth (${maxDepth}) exceeded at ${pathFromRoot}. This likely indicates an extremely deep or recursive schema. You can increase this limit with the dereference.maxDepth option.`);
47
- const isExcludedPath = derefOptions.excludedPathMatcher || (() => false);
48
- if (derefOptions?.circular === "ignore" || !processedObjects.has(obj)) {
49
- if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj) && !isExcludedPath(pathFromRoot)) {
50
- parents.add(obj);
51
- processedObjects.add(obj);
52
- const currentScopeBase = scopeBase;
53
- if ($Ref.isAllowed$Ref(obj, options)) {
54
- dereferenced = dereference$Ref(obj, path, currentScopeBase, dynamicIdScope, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime, depth);
55
- result.circular = dereferenced.circular;
56
- result.value = dereferenced.value;
57
- } else for (const key of Object.keys(obj)) {
58
- checkDereferenceTimeout(startTime, options);
59
- const keyPath = Pointer.join(path, key);
60
- const keyPathFromRoot = Pointer.join(pathFromRoot, key);
61
- if (isExcludedPath(keyPathFromRoot)) continue;
62
- const value = obj[key];
63
- const childScopeBase = dynamicIdScope && value && typeof value === "object" && !ArrayBuffer.isView(value) ? getSchemaBasePath(currentScopeBase, value) : currentScopeBase;
64
- let circular;
65
- if ($Ref.isAllowed$Ref(value, options)) {
66
- dereferenced = dereference$Ref(value, keyPath, childScopeBase, dynamicIdScope, keyPathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime, depth);
67
- circular = dereferenced.circular;
68
- if (obj[key] !== dereferenced.value) {
69
- const preserved = /* @__PURE__ */ new Map();
70
- if (derefOptions?.preservedProperties) {
71
- if (typeof obj[key] === "object" && !Array.isArray(obj[key])) derefOptions?.preservedProperties.forEach((prop) => {
72
- if (prop in obj[key]) preserved.set(prop, obj[key][prop]);
73
- });
74
- }
75
- let assignedValue = dereferenced.value;
76
- if (derefOptions?.cloneReferences && !circular && assignedValue && typeof assignedValue === "object") assignedValue = structuredClone(assignedValue);
77
- obj[key] = assignedValue;
78
- if (derefOptions?.preservedProperties) {
79
- if (preserved.size && typeof obj[key] === "object" && !Array.isArray(obj[key])) preserved.forEach((value, prop) => {
80
- obj[key][prop] = value;
81
- });
82
- }
83
- derefOptions?.onDereference?.(value.$ref, obj[key], obj, key);
84
- }
85
- } else if (!parents.has(value)) {
86
- dereferenced = crawl(value, keyPath, childScopeBase, dynamicIdScope, keyPathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime, depth + 1);
87
- circular = dereferenced.circular;
88
- if (obj[key] !== dereferenced.value) obj[key] = dereferenced.value;
89
- } else circular = foundCircularReference(keyPath, $refs, options);
90
- result.circular = result.circular || circular;
91
- }
92
- parents.delete(obj);
93
- }
94
- }
95
- return result;
96
- }
97
- /**
98
- * Dereferences the given JSON Reference, and then crawls the resulting value.
99
- *
100
- * @param $ref - The JSON Reference to resolve
101
- * @param path - The full path of `$ref`, possibly with a JSON Pointer in the hash
102
- * @param pathFromRoot - The path of `$ref` from the schema root
103
- * @param parents - An array of the parent objects that have already been dereferenced
104
- * @param processedObjects - An array of all the objects that have already been dereferenced
105
- * @param dereferencedCache - An map of all the dereferenced objects
106
- * @param $refs
107
- * @param options
108
- * @returns
109
- */
110
- function dereference$Ref($ref, path, scopeBase, dynamicIdScope, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime, depth) {
111
- const $refPath = resolve($Ref.isExternal$Ref($ref) && options?.dereference?.externalReferenceResolution === "root" ? cwd() : dynamicIdScope ? scopeBase : path, $ref.$ref);
112
- const cache = dereferencedCache.get($refPath);
113
- if (cache) {
114
- if (!cache.circular) {
115
- const refKeys = Object.keys($ref);
116
- if (refKeys.length > 1) {
117
- const extraKeys = {};
118
- for (const key of refKeys) if (key !== "$ref" && !(key in cache.value)) extraKeys[key] = $ref[key];
119
- return {
120
- circular: cache.circular,
121
- value: Object.assign({}, cache.value, extraKeys)
122
- };
123
- }
124
- return cache;
125
- }
126
- if (typeof cache.value === "object" && "$ref" in cache.value && "$ref" in $ref) {
127
- if (cache.value.$ref === $ref.$ref) {
128
- foundCircularReference(path, $refs, options);
129
- return cache;
130
- }
131
- } else {
132
- foundCircularReference(path, $refs, options);
133
- return cache;
134
- }
135
- }
136
- const pointer = $refs._resolve($refPath, path, options);
137
- if (pointer === null) return {
138
- circular: false,
139
- value: null
140
- };
141
- const directCircular = pointer.circular;
142
- let circular = directCircular || parents.has(pointer.value);
143
- if (circular) foundCircularReference(path, $refs, options);
144
- let dereferencedValue = $Ref.dereference($ref, pointer.value, options);
145
- if (!circular) {
146
- const dereferenced = crawl(dereferencedValue, pointer.path, pointer.$ref.path, pointer.$ref.dynamicIdScope, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime, depth + 1);
147
- circular = dereferenced.circular;
148
- dereferencedValue = dereferenced.value;
149
- }
150
- if (circular && !directCircular && options.dereference?.circular === "ignore") dereferencedValue = $ref;
151
- if (directCircular) dereferencedValue.$ref = pathFromRoot;
152
- const dereferencedObject = {
153
- circular,
154
- value: dereferencedValue
155
- };
156
- if (Object.keys($ref).length === 1) dereferencedCache.set($refPath, dereferencedObject);
157
- return dereferencedObject;
158
- }
159
- /**
160
- * Check if we've run past our allowed timeout and throw an error if we have.
161
- *
162
- * @param startTime - The time when the dereferencing started.
163
- * @param options
164
- */
165
- function checkDereferenceTimeout(startTime, options) {
166
- if (options && options.timeoutMs) {
167
- if (Date.now() - startTime > options.timeoutMs) throw new TimeoutError(options.timeoutMs);
168
- }
169
- }
170
- /**
171
- * Called when a circular reference is found.
172
- * It sets the {@link $Refs#circular} flag, executes the options.dereference.onCircular callback,
173
- * and throws an error if options.dereference.circular is false.
174
- *
175
- * @param keyPath - The JSON Reference path of the circular reference
176
- * @param $refs
177
- * @param options
178
- * @returns - always returns true, to indicate that a circular reference was found
179
- */
180
- function foundCircularReference(keyPath, $refs, options) {
181
- $refs.circular = true;
182
- options?.dereference?.onCircular?.(keyPath);
183
- if (!options.dereference.circular) throw /* @__PURE__ */ new ReferenceError(`Circular $ref pointer found at ${keyPath}`);
184
- return true;
185
- }
186
- //#endregion
187
- export { dereference_default as default };
@@ -1,136 +0,0 @@
1
- import { cwd, fromFileSystemPath, isFileSystemPath, parse as parse$1, resolve as resolve$1, stripHash } from "./util/url.js";
2
- import { JSONParserErrorGroup, isHandledError } from "./util/errors.js";
3
- import { registerSchemaResources, usesDynamicIdScope } from "./util/schema-resources.js";
4
- import $Refs from "./refs.js";
5
- import parse$2 from "./parse.js";
6
- import "./resolvers/file.js";
7
- import "./resolvers/http.js";
8
- import "./options.js";
9
- import normalizeArgs from "./normalize-args.js";
10
- import resolveExternal from "./resolve-external.js";
11
- import bundle$1 from "./bundle.js";
12
- import dereference_default from "./dereference.js";
13
- import maybe from "./util/maybe.js";
14
- //#region ../../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
15
- /**
16
- * This class parses a JSON schema, builds a map of its JSON references and their resolved values,
17
- * and provides methods for traversing, manipulating, and dereferencing those references.
18
- *
19
- * @class
20
- */
21
- var $RefParser = class $RefParser {
22
- /**
23
- * The parsed (and possibly dereferenced) JSON schema object
24
- *
25
- * @type {object}
26
- * @readonly
27
- */
28
- schema = null;
29
- /**
30
- * The resolved JSON references
31
- *
32
- * @type {$Refs}
33
- * @readonly
34
- */
35
- $refs = new $Refs();
36
- async parse() {
37
- const args = normalizeArgs(arguments);
38
- let promise;
39
- if (!args.path && !args.schema) {
40
- const err = /* @__PURE__ */ new Error(`Expected a file path, URL, or object. Got ${args.path || args.schema}`);
41
- return maybe(args.callback, Promise.reject(err));
42
- }
43
- this.schema = null;
44
- this.$refs = new $Refs();
45
- let pathType = "http";
46
- if (isFileSystemPath(args.path)) {
47
- args.path = fromFileSystemPath(args.path);
48
- pathType = "file";
49
- } else if (!args.path && args.schema && "$id" in args.schema && args.schema.$id) {
50
- const params = parse$1(args.schema.$id);
51
- const port = params.port ?? (params.protocol === "https:" ? 443 : 80);
52
- args.path = `${params.protocol}//${params.hostname}:${port}`;
53
- }
54
- args.path = resolve$1(cwd(), args.path);
55
- if (args.schema && typeof args.schema === "object") {
56
- const $ref = this.$refs._add(args.path);
57
- $ref.value = args.schema;
58
- $ref.pathType = pathType;
59
- $ref.dynamicIdScope = usesDynamicIdScope($ref.value);
60
- registerSchemaResources(this.$refs, $ref.path, $ref.value, $ref.pathType, $ref.dynamicIdScope);
61
- promise = Promise.resolve(args.schema);
62
- } else promise = parse$2(args.path, this.$refs, args.options);
63
- try {
64
- const result = await promise;
65
- if (result !== null && typeof result === "object" && !Buffer.isBuffer(result)) {
66
- this.schema = result;
67
- return maybe(args.callback, Promise.resolve(this.schema));
68
- } else if (args.options.continueOnError) {
69
- this.schema = null;
70
- return maybe(args.callback, Promise.resolve(this.schema));
71
- } else throw new SyntaxError(`"${this.$refs._root$Ref.path || result}" is not a valid JSON Schema`);
72
- } catch (err) {
73
- if (!args.options.continueOnError || !isHandledError(err)) return maybe(args.callback, Promise.reject(err));
74
- if (this.$refs._$refs[stripHash(args.path)]) this.$refs._$refs[stripHash(args.path)].addError(err);
75
- return maybe(args.callback, Promise.resolve(null));
76
- }
77
- }
78
- static parse() {
79
- const parser = new $RefParser();
80
- return parser.parse.apply(parser, arguments);
81
- }
82
- async resolve() {
83
- const args = normalizeArgs(arguments);
84
- try {
85
- await this.parse(args.path, args.schema, args.options);
86
- await resolveExternal(this, args.options);
87
- finalize(this);
88
- return maybe(args.callback, Promise.resolve(this.$refs));
89
- } catch (err) {
90
- return maybe(args.callback, Promise.reject(err));
91
- }
92
- }
93
- static resolve() {
94
- const instance = new $RefParser();
95
- return instance.resolve.apply(instance, arguments);
96
- }
97
- static bundle() {
98
- const instance = new $RefParser();
99
- return instance.bundle.apply(instance, arguments);
100
- }
101
- async bundle() {
102
- const args = normalizeArgs(arguments);
103
- try {
104
- await this.resolve(args.path, args.schema, args.options);
105
- bundle$1(this, args.options);
106
- finalize(this);
107
- return maybe(args.callback, Promise.resolve(this.schema));
108
- } catch (err) {
109
- return maybe(args.callback, Promise.reject(err));
110
- }
111
- }
112
- static dereference() {
113
- const instance = new $RefParser();
114
- return instance.dereference.apply(instance, arguments);
115
- }
116
- async dereference() {
117
- const args = normalizeArgs(arguments);
118
- try {
119
- await this.resolve(args.path, args.schema, args.options);
120
- dereference_default(this, args.options);
121
- finalize(this);
122
- return maybe(args.callback, Promise.resolve(this.schema));
123
- } catch (err) {
124
- return maybe(args.callback, Promise.reject(err));
125
- }
126
- }
127
- };
128
- function finalize(parser) {
129
- if (JSONParserErrorGroup.getParserErrors(parser).length > 0) throw new JSONParserErrorGroup(parser);
130
- }
131
- $RefParser.parse;
132
- $RefParser.resolve;
133
- const bundle = $RefParser.bundle;
134
- $RefParser.dereference;
135
- //#endregion
136
- export { bundle };
@@ -1,41 +0,0 @@
1
- import { getNewOptions } from "./options.js";
2
- //#region ../../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
3
- /**
4
- * Normalizes the given arguments, accounting for optional args.
5
- */
6
- function normalizeArgs(_args) {
7
- let path;
8
- let schema;
9
- let options;
10
- let callback;
11
- const args = Array.prototype.slice.call(_args);
12
- if (typeof args[args.length - 1] === "function") callback = args.pop();
13
- if (typeof args[0] === "string") {
14
- path = args[0];
15
- if (typeof args[2] === "object") {
16
- schema = args[1];
17
- options = args[2];
18
- } else {
19
- schema = void 0;
20
- options = args[1];
21
- }
22
- } else {
23
- path = "";
24
- schema = args[0];
25
- options = args[1];
26
- }
27
- try {
28
- options = getNewOptions(options);
29
- } catch (e) {
30
- console.error(`JSON Schema Ref Parser: Error normalizing options: ${e}`);
31
- }
32
- if (!options.mutateInputSchema && typeof schema === "object") schema = JSON.parse(JSON.stringify(schema));
33
- return {
34
- path,
35
- schema,
36
- options,
37
- callback
38
- };
39
- }
40
- //#endregion
41
- export { normalizeArgs as default };
@@ -1,124 +0,0 @@
1
- import json_default from "./parsers/json.js";
2
- import yaml_default from "./parsers/yaml.js";
3
- import text_default from "./parsers/text.js";
4
- import binary_default from "./parsers/binary.js";
5
- import file_default from "./resolvers/file.js";
6
- import http_default from "./resolvers/http.js";
7
- //#region ../../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
8
- const getJsonSchemaRefParserDefaultOptions = () => {
9
- return {
10
- /**
11
- * Determines how different types of files will be parsed.
12
- *
13
- * You can add additional parsers of your own, replace an existing one with
14
- * your own implementation, or disable any parser by setting it to false.
15
- */
16
- parse: {
17
- json: { ...json_default },
18
- yaml: { ...yaml_default },
19
- text: { ...text_default },
20
- binary: { ...binary_default }
21
- },
22
- /**
23
- * Determines how JSON References will be resolved.
24
- *
25
- * You can add additional resolvers of your own, replace an existing one with
26
- * your own implementation, or disable any resolver by setting it to false.
27
- */
28
- resolve: {
29
- file: { ...file_default },
30
- http: { ...http_default },
31
- /**
32
- * Determines whether external $ref pointers will be resolved.
33
- * If this option is disabled, then none of above resolvers will be called.
34
- * Instead, external $ref pointers will simply be ignored.
35
- *
36
- * @type {boolean}
37
- */
38
- external: true
39
- },
40
- /**
41
- * By default, JSON Schema $Ref Parser throws the first error it encounters. Setting `continueOnError` to `true`
42
- * causes it to keep processing as much as possible and then throw a single error that contains all errors
43
- * that were encountered.
44
- */
45
- continueOnError: false,
46
- /**
47
- * Determines the types of JSON references that are allowed.
48
- */
49
- bundle: {
50
- /**
51
- * A function, called for each path, which can return true to stop this path and all
52
- * subpaths from being processed further. This is useful in schemas where some
53
- * subpaths contain literal $ref keys that should not be changed.
54
- *
55
- * @type {function}
56
- */
57
- excludedPathMatcher: () => false },
58
- /**
59
- * Determines the types of JSON references that are allowed.
60
- */
61
- dereference: {
62
- /**
63
- * Dereference circular (recursive) JSON references?
64
- * If false, then a {@link ReferenceError} will be thrown if a circular reference is found.
65
- * If "ignore", then circular references will not be dereferenced.
66
- *
67
- * @type {boolean|string}
68
- */
69
- circular: true,
70
- /**
71
- * A function, called for each path, which can return true to stop this path and all
72
- * subpaths from being dereferenced further. This is useful in schemas where some
73
- * subpaths contain literal $ref keys that should not be dereferenced.
74
- *
75
- * @type {function}
76
- */
77
- excludedPathMatcher: () => false,
78
- referenceResolution: "relative",
79
- mergeKeys: true
80
- },
81
- mutateInputSchema: true
82
- };
83
- };
84
- const getNewOptions = (options) => {
85
- const newOptions = getJsonSchemaRefParserDefaultOptions();
86
- if (options) merge(newOptions, options);
87
- return newOptions;
88
- };
89
- /**
90
- * Merges the properties of the source object into the target object.
91
- *
92
- * @param target - The object that we're populating
93
- * @param source - The options that are being merged
94
- * @returns
95
- */
96
- function merge(target, source) {
97
- if (isMergeable(source)) {
98
- const keys = Object.keys(source).filter((key) => ![
99
- "__proto__",
100
- "constructor",
101
- "prototype"
102
- ].includes(key));
103
- for (let i = 0; i < keys.length; i++) {
104
- const key = keys[i];
105
- const sourceSetting = source[key];
106
- const targetSetting = target[key];
107
- if (isMergeable(sourceSetting)) target[key] = merge(targetSetting || {}, sourceSetting);
108
- else if (sourceSetting !== void 0) target[key] = sourceSetting;
109
- }
110
- }
111
- return target;
112
- }
113
- /**
114
- * Determines whether the given value can be merged,
115
- * or if it is a scalar value that should just override the target value.
116
- *
117
- * @param val
118
- * @returns
119
- */
120
- function isMergeable(val) {
121
- return val && typeof val === "object" && !Array.isArray(val) && !(val instanceof RegExp) && !(val instanceof Date);
122
- }
123
- //#endregion
124
- export { getJsonSchemaRefParserDefaultOptions, getNewOptions };
@@ -1,109 +0,0 @@
1
- import { getExtension } from "./util/url.js";
2
- import { ParserError, ResolverError, UnmatchedParserError, UnmatchedResolverError, isHandledError } from "./util/errors.js";
3
- import { registerSchemaResources, usesDynamicIdScope } from "./util/schema-resources.js";
4
- import { all, filter, run, sort } from "./util/plugins.js";
5
- //#region ../../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
6
- /**
7
- * Reads and parses the specified file path or URL.
8
- */
9
- async function parse(target, $refs, options) {
10
- let path = typeof target === "string" ? target : target.url;
11
- const baseUrl = typeof target === "string" ? void 0 : target.baseUrl;
12
- let reference = typeof target === "string" ? void 0 : target.reference;
13
- const hashIndex = path.indexOf("#");
14
- let hash = "";
15
- if (hashIndex >= 0) {
16
- hash = path.substring(hashIndex);
17
- path = path.substring(0, hashIndex);
18
- }
19
- if (reference) {
20
- const referenceHashIndex = reference.indexOf("#");
21
- if (referenceHashIndex >= 0) reference = reference.substring(0, referenceHashIndex);
22
- }
23
- const $ref = $refs._add(path);
24
- const file = {
25
- url: path,
26
- hash,
27
- extension: getExtension(path),
28
- ...reference !== void 0 ? { reference } : {},
29
- ...baseUrl !== void 0 ? { baseUrl } : {}
30
- };
31
- try {
32
- const resolver = await readFile(file, options, $refs);
33
- $ref.pathType = resolver.plugin.name;
34
- file.data = resolver.result;
35
- const parser = await parseFile(file, options, $refs);
36
- $ref.value = parser.result;
37
- $ref.dynamicIdScope = usesDynamicIdScope($ref.value);
38
- registerSchemaResources($refs, $ref.path, $ref.value, $ref.pathType, $ref.dynamicIdScope);
39
- return parser.result;
40
- } catch (err) {
41
- if (isHandledError(err)) $ref.value = err;
42
- throw err;
43
- }
44
- }
45
- /**
46
- * Reads the given file, using the configured resolver plugins
47
- *
48
- * @param file - An object containing information about the referenced file
49
- * @param file.url - The full URL of the referenced file
50
- * @param file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.)
51
- * @param options
52
- * @param $refs
53
- * @returns
54
- * The promise resolves with the raw file contents and the resolver that was used.
55
- */
56
- async function readFile(file, options, $refs) {
57
- let resolvers = all(options.resolve);
58
- resolvers = filter(resolvers, "canRead", file, void 0, $refs);
59
- sort(resolvers);
60
- try {
61
- return await run(resolvers, "read", file, $refs);
62
- } catch (err) {
63
- if (!err && options.continueOnError) throw new UnmatchedResolverError(file.url);
64
- else if (!err || !("error" in err)) throw new SyntaxError(`Unable to resolve $ref pointer "${file.url}"`, { cause: err });
65
- else if (err.error instanceof ResolverError) throw err.error;
66
- else throw new ResolverError(err, file.url);
67
- }
68
- }
69
- /**
70
- * Parses the given file's contents, using the configured parser plugins.
71
- *
72
- * @param file - An object containing information about the referenced file
73
- * @param file.url - The full URL of the referenced file
74
- * @param file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.)
75
- * @param file.data - The file contents. This will be whatever data type was returned by the resolver
76
- * @param options
77
- * @param $refs
78
- *
79
- * @returns
80
- * The promise resolves with the parsed file contents and the parser that was used.
81
- */
82
- async function parseFile(file, options, $refs) {
83
- const allParsers = all(options.parse);
84
- const filteredParsers = filter(allParsers, "canParse", file);
85
- const parsers = filteredParsers.length > 0 ? filteredParsers : allParsers;
86
- sort(parsers);
87
- try {
88
- const parser = await run(parsers, "parse", file, $refs);
89
- if (!parser.plugin.allowEmpty && isEmpty(parser.result)) throw new SyntaxError(`Error parsing "${file.url}" as ${parser.plugin.name}. \nParsed value is empty`);
90
- else return parser;
91
- } catch (err) {
92
- if (!err && options.continueOnError) throw new UnmatchedParserError(file.url);
93
- else if (err && err.message && err.message.startsWith("Error parsing")) throw err;
94
- else if (!err || !("error" in err)) throw new SyntaxError(`Unable to parse ${file.url}`, { cause: err });
95
- else if (err.error instanceof ParserError) throw err.error;
96
- else throw new ParserError(err.error.message, file.url);
97
- }
98
- }
99
- /**
100
- * Determines whether the parsed value is "empty".
101
- *
102
- * @param value
103
- * @returns
104
- */
105
- function isEmpty(value) {
106
- return value === void 0 || typeof value === "object" && Object.keys(value).length === 0 || typeof value === "string" && value.trim().length === 0 || Buffer.isBuffer(value) && value.length === 0;
107
- }
108
- //#endregion
109
- export { parse as default };
@@ -1,30 +0,0 @@
1
- //#region ../../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
2
- const BINARY_REGEXP = /\.(jpeg|jpg|gif|png|bmp|ico)$/i;
3
- var binary_default = {
4
- /**
5
- * The order that this parser will run, in relation to other parsers.
6
- */
7
- order: 400,
8
- /**
9
- * Whether to allow "empty" files (zero bytes).
10
- */
11
- allowEmpty: true,
12
- /**
13
- * Determines whether this parser can parse a given file reference.
14
- * Parsers that return true will be tried, in order, until one successfully parses the file.
15
- * Parsers that return false will be skipped, UNLESS all parsers returned false, in which case
16
- * every parser will be tried.
17
- */
18
- canParse(file) {
19
- return Buffer.isBuffer(file.data) && BINARY_REGEXP.test(file.url);
20
- },
21
- /**
22
- * Parses the given data as a Buffer (byte array).
23
- */
24
- parse(file) {
25
- if (Buffer.isBuffer(file.data)) return file.data;
26
- else return Buffer.from(file.data);
27
- }
28
- };
29
- //#endregion
30
- export { binary_default as default };
@@ -1,46 +0,0 @@
1
- import { ParserError } from "../util/errors.js";
2
- //#region ../../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
3
- var json_default = {
4
- /**
5
- * The order that this parser will run, in relation to other parsers.
6
- */
7
- order: 100,
8
- /**
9
- * Whether to allow "empty" files. This includes zero-byte files, as well as empty JSON objects.
10
- */
11
- allowEmpty: true,
12
- /**
13
- * Determines whether this parser can parse a given file reference.
14
- * Parsers that match will be tried, in order, until one successfully parses the file.
15
- * Parsers that don't match will be skipped, UNLESS none of the parsers match, in which case
16
- * every parser will be tried.
17
- */
18
- canParse: ".json",
19
- /**
20
- * Allow JSON files with byte order marks (BOM)
21
- */
22
- allowBOM: true,
23
- /**
24
- * Parses the given file as JSON
25
- */
26
- async parse(file) {
27
- let data = file.data;
28
- if (Buffer.isBuffer(data)) data = data.toString();
29
- if (typeof data === "string") if (data.trim().length === 0) return;
30
- else try {
31
- return JSON.parse(data);
32
- } catch (e) {
33
- if (this.allowBOM) try {
34
- const firstCurlyBrace = data.indexOf("{");
35
- data = data.slice(firstCurlyBrace);
36
- return JSON.parse(data);
37
- } catch (e) {
38
- throw new ParserError(e.message, file.url);
39
- }
40
- throw new ParserError(e.message, file.url);
41
- }
42
- else return data;
43
- }
44
- };
45
- //#endregion
46
- export { json_default as default };