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,72 +0,0 @@
1
- import { __commonJSMin } from "../../../../../../../../_virtual/_rolldown/runtime.js";
2
- import { require_codegen } from "../../compile/codegen/index.js";
3
- import { require_util } from "../../compile/util.js";
4
- import { require_code } from "../code.js";
5
- //#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/required.js
6
- var require_required = /* @__PURE__ */ __commonJSMin(((exports) => {
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- const code_1 = require_code();
9
- const codegen_1 = require_codegen();
10
- const util_1 = require_util();
11
- exports.default = {
12
- keyword: "required",
13
- type: "object",
14
- schemaType: "array",
15
- $data: true,
16
- error: {
17
- message: ({ params: { missingProperty } }) => (0, codegen_1.str)`must have required property '${missingProperty}'`,
18
- params: ({ params: { missingProperty } }) => (0, codegen_1._)`{missingProperty: ${missingProperty}}`
19
- },
20
- code(cxt) {
21
- const { gen, schema, schemaCode, data, $data, it } = cxt;
22
- const { opts } = it;
23
- if (!$data && schema.length === 0) return;
24
- const useLoop = schema.length >= opts.loopRequired;
25
- if (it.allErrors) allErrorsMode();
26
- else exitOnErrorMode();
27
- if (opts.strictRequired) {
28
- const props = cxt.parentSchema.properties;
29
- const { definedProperties } = cxt.it;
30
- for (const requiredKey of schema) if ((props === null || props === void 0 ? void 0 : props[requiredKey]) === void 0 && !definedProperties.has(requiredKey)) {
31
- const msg = `required property "${requiredKey}" is not defined at "${it.schemaEnv.baseId + it.errSchemaPath}" (strictRequired)`;
32
- (0, util_1.checkStrictMode)(it, msg, it.opts.strictRequired);
33
- }
34
- }
35
- function allErrorsMode() {
36
- if (useLoop || $data) cxt.block$data(codegen_1.nil, loopAllRequired);
37
- else for (const prop of schema) (0, code_1.checkReportMissingProp)(cxt, prop);
38
- }
39
- function exitOnErrorMode() {
40
- const missing = gen.let("missing");
41
- if (useLoop || $data) {
42
- const valid = gen.let("valid", true);
43
- cxt.block$data(valid, () => loopUntilMissing(missing, valid));
44
- cxt.ok(valid);
45
- } else {
46
- gen.if((0, code_1.checkMissingProp)(cxt, schema, missing));
47
- (0, code_1.reportMissingProp)(cxt, missing);
48
- gen.else();
49
- }
50
- }
51
- function loopAllRequired() {
52
- gen.forOf("prop", schemaCode, (prop) => {
53
- cxt.setParams({ missingProperty: prop });
54
- gen.if((0, code_1.noPropertyInData)(gen, data, prop, opts.ownProperties), () => cxt.error());
55
- });
56
- }
57
- function loopUntilMissing(missing, valid) {
58
- cxt.setParams({ missingProperty: missing });
59
- gen.forOf(missing, schemaCode, () => {
60
- gen.assign(valid, (0, code_1.propertyInData)(gen, data, missing, opts.ownProperties));
61
- gen.if((0, codegen_1.not)(valid), () => {
62
- cxt.error();
63
- gen.break();
64
- });
65
- }, codegen_1.nil);
66
- }
67
- }
68
- };
69
- }));
70
- //#endregion
71
- export default require_required();
72
- export { require_required };
@@ -1,70 +0,0 @@
1
- import { __commonJSMin } from "../../../../../../../../_virtual/_rolldown/runtime.js";
2
- import { require_codegen } from "../../compile/codegen/index.js";
3
- import { require_util } from "../../compile/util.js";
4
- import { require_dataType } from "../../compile/validate/dataType.js";
5
- import { require_equal } from "../../runtime/equal.js";
6
- //#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js
7
- var require_uniqueItems = /* @__PURE__ */ __commonJSMin(((exports) => {
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- const dataType_1 = require_dataType();
10
- const codegen_1 = require_codegen();
11
- const util_1 = require_util();
12
- const equal_1 = require_equal();
13
- exports.default = {
14
- keyword: "uniqueItems",
15
- type: "array",
16
- schemaType: "boolean",
17
- $data: true,
18
- error: {
19
- message: ({ params: { i, j } }) => (0, codegen_1.str)`must NOT have duplicate items (items ## ${j} and ${i} are identical)`,
20
- params: ({ params: { i, j } }) => (0, codegen_1._)`{i: ${i}, j: ${j}}`
21
- },
22
- code(cxt) {
23
- const { gen, data, $data, schema, parentSchema, schemaCode, it } = cxt;
24
- if (!$data && !schema) return;
25
- const valid = gen.let("valid");
26
- const itemTypes = parentSchema.items ? (0, dataType_1.getSchemaTypes)(parentSchema.items) : [];
27
- cxt.block$data(valid, validateUniqueItems, (0, codegen_1._)`${schemaCode} === false`);
28
- cxt.ok(valid);
29
- function validateUniqueItems() {
30
- const i = gen.let("i", (0, codegen_1._)`${data}.length`);
31
- const j = gen.let("j");
32
- cxt.setParams({
33
- i,
34
- j
35
- });
36
- gen.assign(valid, true);
37
- gen.if((0, codegen_1._)`${i} > 1`, () => (canOptimize() ? loopN : loopN2)(i, j));
38
- }
39
- function canOptimize() {
40
- return itemTypes.length > 0 && !itemTypes.some((t) => t === "object" || t === "array");
41
- }
42
- function loopN(i, j) {
43
- const item = gen.name("item");
44
- const wrongType = (0, dataType_1.checkDataTypes)(itemTypes, item, it.opts.strictNumbers, dataType_1.DataType.Wrong);
45
- const indices = gen.const("indices", (0, codegen_1._)`{}`);
46
- gen.for((0, codegen_1._)`;${i}--;`, () => {
47
- gen.let(item, (0, codegen_1._)`${data}[${i}]`);
48
- gen.if(wrongType, (0, codegen_1._)`continue`);
49
- if (itemTypes.length > 1) gen.if((0, codegen_1._)`typeof ${item} == "string"`, (0, codegen_1._)`${item} += "_"`);
50
- gen.if((0, codegen_1._)`typeof ${indices}[${item}] == "number"`, () => {
51
- gen.assign(j, (0, codegen_1._)`${indices}[${item}]`);
52
- cxt.error();
53
- gen.assign(valid, false).break();
54
- }).code((0, codegen_1._)`${indices}[${item}] = ${i}`);
55
- });
56
- }
57
- function loopN2(i, j) {
58
- const eql = (0, util_1.useFunc)(gen, equal_1.default);
59
- const outer = gen.name("outer");
60
- gen.label(outer).for((0, codegen_1._)`;${i}--;`, () => gen.for((0, codegen_1._)`${j} = ${i}; ${j}--;`, () => gen.if((0, codegen_1._)`${eql}(${data}[${i}], ${data}[${j}])`, () => {
61
- cxt.error();
62
- gen.assign(valid, false).break(outer);
63
- })));
64
- }
65
- }
66
- };
67
- }));
68
- //#endregion
69
- export default require_uniqueItems();
70
- export { require_uniqueItems };
@@ -1,33 +0,0 @@
1
- import { __commonJSMin } from "../../../../../_virtual/_rolldown/runtime.js";
2
- //#region ../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js
3
- var require_fast_deep_equal = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4
- module.exports = function equal(a, b) {
5
- if (a === b) return true;
6
- if (a && b && typeof a == "object" && typeof b == "object") {
7
- if (a.constructor !== b.constructor) return false;
8
- var length, i, keys;
9
- if (Array.isArray(a)) {
10
- length = a.length;
11
- if (length != b.length) return false;
12
- for (i = length; i-- !== 0;) if (!equal(a[i], b[i])) return false;
13
- return true;
14
- }
15
- if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
16
- if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
17
- if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
18
- keys = Object.keys(a);
19
- length = keys.length;
20
- if (length !== Object.keys(b).length) return false;
21
- for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
22
- for (i = length; i-- !== 0;) {
23
- var key = keys[i];
24
- if (!equal(a[key], b[key])) return false;
25
- }
26
- return true;
27
- }
28
- return a !== a && b !== b;
29
- };
30
- }));
31
- //#endregion
32
- export default require_fast_deep_equal();
33
- export { require_fast_deep_equal };
@@ -1,236 +0,0 @@
1
- import { __commonJSMin } from "../../../../../_virtual/_rolldown/runtime.js";
2
- import { require_utils } from "./lib/utils.js";
3
- import { require_schemes } from "./lib/schemes.js";
4
- //#region ../../node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js
5
- var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6
- const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils();
7
- const { SCHEMES, getSchemeHandler } = require_schemes();
8
- /**
9
- * @template {import('./types/index').URIComponent|string} T
10
- * @param {T} uri
11
- * @param {import('./types/index').Options} [options]
12
- * @returns {T}
13
- */
14
- function normalize(uri, options) {
15
- if (typeof uri === "string") uri = serialize(parse(uri, options), options);
16
- else if (typeof uri === "object") uri = parse(serialize(uri, options), options);
17
- return uri;
18
- }
19
- /**
20
- * @param {string} baseURI
21
- * @param {string} relativeURI
22
- * @param {import('./types/index').Options} [options]
23
- * @returns {string}
24
- */
25
- function resolve(baseURI, relativeURI, options) {
26
- const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
27
- const resolved = resolveComponent(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true);
28
- schemelessOptions.skipEscape = true;
29
- return serialize(resolved, schemelessOptions);
30
- }
31
- /**
32
- * @param {import ('./types/index').URIComponent} base
33
- * @param {import ('./types/index').URIComponent} relative
34
- * @param {import('./types/index').Options} [options]
35
- * @param {boolean} [skipNormalization=false]
36
- * @returns {import ('./types/index').URIComponent}
37
- */
38
- function resolveComponent(base, relative, options, skipNormalization) {
39
- /** @type {import('./types/index').URIComponent} */
40
- const target = {};
41
- if (!skipNormalization) {
42
- base = parse(serialize(base, options), options);
43
- relative = parse(serialize(relative, options), options);
44
- }
45
- options = options || {};
46
- if (!options.tolerant && relative.scheme) {
47
- target.scheme = relative.scheme;
48
- target.userinfo = relative.userinfo;
49
- target.host = relative.host;
50
- target.port = relative.port;
51
- target.path = removeDotSegments(relative.path || "");
52
- target.query = relative.query;
53
- } else {
54
- if (relative.userinfo !== void 0 || relative.host !== void 0 || relative.port !== void 0) {
55
- target.userinfo = relative.userinfo;
56
- target.host = relative.host;
57
- target.port = relative.port;
58
- target.path = removeDotSegments(relative.path || "");
59
- target.query = relative.query;
60
- } else {
61
- if (!relative.path) {
62
- target.path = base.path;
63
- if (relative.query !== void 0) target.query = relative.query;
64
- else target.query = base.query;
65
- } else {
66
- if (relative.path[0] === "/") target.path = removeDotSegments(relative.path);
67
- else {
68
- if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) target.path = "/" + relative.path;
69
- else if (!base.path) target.path = relative.path;
70
- else target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
71
- target.path = removeDotSegments(target.path);
72
- }
73
- target.query = relative.query;
74
- }
75
- target.userinfo = base.userinfo;
76
- target.host = base.host;
77
- target.port = base.port;
78
- }
79
- target.scheme = base.scheme;
80
- }
81
- target.fragment = relative.fragment;
82
- return target;
83
- }
84
- /**
85
- * @param {import ('./types/index').URIComponent|string} uriA
86
- * @param {import ('./types/index').URIComponent|string} uriB
87
- * @param {import ('./types/index').Options} options
88
- * @returns {boolean}
89
- */
90
- function equal(uriA, uriB, options) {
91
- if (typeof uriA === "string") {
92
- uriA = unescape(uriA);
93
- uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), {
94
- ...options,
95
- skipEscape: true
96
- });
97
- } else if (typeof uriA === "object") uriA = serialize(normalizeComponentEncoding(uriA, true), {
98
- ...options,
99
- skipEscape: true
100
- });
101
- if (typeof uriB === "string") {
102
- uriB = unescape(uriB);
103
- uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), {
104
- ...options,
105
- skipEscape: true
106
- });
107
- } else if (typeof uriB === "object") uriB = serialize(normalizeComponentEncoding(uriB, true), {
108
- ...options,
109
- skipEscape: true
110
- });
111
- return uriA.toLowerCase() === uriB.toLowerCase();
112
- }
113
- /**
114
- * @param {Readonly<import('./types/index').URIComponent>} cmpts
115
- * @param {import('./types/index').Options} [opts]
116
- * @returns {string}
117
- */
118
- function serialize(cmpts, opts) {
119
- const component = {
120
- host: cmpts.host,
121
- scheme: cmpts.scheme,
122
- userinfo: cmpts.userinfo,
123
- port: cmpts.port,
124
- path: cmpts.path,
125
- query: cmpts.query,
126
- nid: cmpts.nid,
127
- nss: cmpts.nss,
128
- uuid: cmpts.uuid,
129
- fragment: cmpts.fragment,
130
- reference: cmpts.reference,
131
- resourceName: cmpts.resourceName,
132
- secure: cmpts.secure,
133
- error: ""
134
- };
135
- const options = Object.assign({}, opts);
136
- const uriTokens = [];
137
- const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
138
- if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
139
- if (component.path !== void 0) if (!options.skipEscape) {
140
- component.path = escape(component.path);
141
- if (component.scheme !== void 0) component.path = component.path.split("%3A").join(":");
142
- } else component.path = unescape(component.path);
143
- if (options.reference !== "suffix" && component.scheme) uriTokens.push(component.scheme, ":");
144
- const authority = recomposeAuthority(component);
145
- if (authority !== void 0) {
146
- if (options.reference !== "suffix") uriTokens.push("//");
147
- uriTokens.push(authority);
148
- if (component.path && component.path[0] !== "/") uriTokens.push("/");
149
- }
150
- if (component.path !== void 0) {
151
- let s = component.path;
152
- if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) s = removeDotSegments(s);
153
- if (authority === void 0 && s[0] === "/" && s[1] === "/") s = "/%2F" + s.slice(2);
154
- uriTokens.push(s);
155
- }
156
- if (component.query !== void 0) uriTokens.push("?", component.query);
157
- if (component.fragment !== void 0) uriTokens.push("#", component.fragment);
158
- return uriTokens.join("");
159
- }
160
- const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
161
- /**
162
- * @param {string} uri
163
- * @param {import('./types/index').Options} [opts]
164
- * @returns
165
- */
166
- function parse(uri, opts) {
167
- const options = Object.assign({}, opts);
168
- /** @type {import('./types/index').URIComponent} */
169
- const parsed = {
170
- scheme: void 0,
171
- userinfo: void 0,
172
- host: "",
173
- port: void 0,
174
- path: "",
175
- query: void 0,
176
- fragment: void 0
177
- };
178
- let isIP = false;
179
- if (options.reference === "suffix") if (options.scheme) uri = options.scheme + ":" + uri;
180
- else uri = "//" + uri;
181
- const matches = uri.match(URI_PARSE);
182
- if (matches) {
183
- parsed.scheme = matches[1];
184
- parsed.userinfo = matches[3];
185
- parsed.host = matches[4];
186
- parsed.port = parseInt(matches[5], 10);
187
- parsed.path = matches[6] || "";
188
- parsed.query = matches[7];
189
- parsed.fragment = matches[8];
190
- if (isNaN(parsed.port)) parsed.port = matches[5];
191
- if (parsed.host) if (isIPv4(parsed.host) === false) {
192
- const ipv6result = normalizeIPv6(parsed.host);
193
- parsed.host = ipv6result.host.toLowerCase();
194
- isIP = ipv6result.isIPV6;
195
- } else isIP = true;
196
- if (parsed.scheme === void 0 && parsed.userinfo === void 0 && parsed.host === void 0 && parsed.port === void 0 && parsed.query === void 0 && !parsed.path) parsed.reference = "same-document";
197
- else if (parsed.scheme === void 0) parsed.reference = "relative";
198
- else if (parsed.fragment === void 0) parsed.reference = "absolute";
199
- else parsed.reference = "uri";
200
- if (options.reference && options.reference !== "suffix" && options.reference !== parsed.reference) parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
201
- const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
202
- if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
203
- if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) try {
204
- parsed.host = URL.domainToASCII(parsed.host.toLowerCase());
205
- } catch (e) {
206
- parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
207
- }
208
- }
209
- if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
210
- if (uri.indexOf("%") !== -1) {
211
- if (parsed.scheme !== void 0) parsed.scheme = unescape(parsed.scheme);
212
- if (parsed.host !== void 0) parsed.host = unescape(parsed.host);
213
- }
214
- if (parsed.path) parsed.path = escape(unescape(parsed.path));
215
- if (parsed.fragment) parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
216
- }
217
- if (schemeHandler && schemeHandler.parse) schemeHandler.parse(parsed, options);
218
- } else parsed.error = parsed.error || "URI can not be parsed.";
219
- return parsed;
220
- }
221
- const fastUri = {
222
- SCHEMES,
223
- normalize,
224
- resolve,
225
- resolveComponent,
226
- equal,
227
- serialize,
228
- parse
229
- };
230
- module.exports = fastUri;
231
- module.exports.default = fastUri;
232
- module.exports.fastUri = fastUri;
233
- }));
234
- //#endregion
235
- export default require_fast_uri();
236
- export { require_fast_uri };
@@ -1,187 +0,0 @@
1
- import { __commonJSMin } from "../../../../../../_virtual/_rolldown/runtime.js";
2
- import { require_utils } from "./utils.js";
3
- //#region ../../node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/schemes.js
4
- var require_schemes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
- const { isUUID } = require_utils();
6
- const URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
7
- const supportedSchemeNames = [
8
- "http",
9
- "https",
10
- "ws",
11
- "wss",
12
- "urn",
13
- "urn:uuid"
14
- ];
15
- /** @typedef {supportedSchemeNames[number]} SchemeName */
16
- /**
17
- * @param {string} name
18
- * @returns {name is SchemeName}
19
- */
20
- function isValidSchemeName(name) {
21
- return supportedSchemeNames.indexOf(name) !== -1;
22
- }
23
- /**
24
- * @callback SchemeFn
25
- * @param {import('../types/index').URIComponent} component
26
- * @param {import('../types/index').Options} options
27
- * @returns {import('../types/index').URIComponent}
28
- */
29
- /**
30
- * @typedef {Object} SchemeHandler
31
- * @property {SchemeName} scheme - The scheme name.
32
- * @property {boolean} [domainHost] - Indicates if the scheme supports domain hosts.
33
- * @property {SchemeFn} parse - Function to parse the URI component for this scheme.
34
- * @property {SchemeFn} serialize - Function to serialize the URI component for this scheme.
35
- * @property {boolean} [skipNormalize] - Indicates if normalization should be skipped for this scheme.
36
- * @property {boolean} [absolutePath] - Indicates if the scheme uses absolute paths.
37
- * @property {boolean} [unicodeSupport] - Indicates if the scheme supports Unicode.
38
- */
39
- /**
40
- * @param {import('../types/index').URIComponent} wsComponent
41
- * @returns {boolean}
42
- */
43
- function wsIsSecure(wsComponent) {
44
- if (wsComponent.secure === true) return true;
45
- else if (wsComponent.secure === false) return false;
46
- else if (wsComponent.scheme) return wsComponent.scheme.length === 3 && (wsComponent.scheme[0] === "w" || wsComponent.scheme[0] === "W") && (wsComponent.scheme[1] === "s" || wsComponent.scheme[1] === "S") && (wsComponent.scheme[2] === "s" || wsComponent.scheme[2] === "S");
47
- else return false;
48
- }
49
- /** @type {SchemeFn} */
50
- function httpParse(component) {
51
- if (!component.host) component.error = component.error || "HTTP URIs must have a host.";
52
- return component;
53
- }
54
- /** @type {SchemeFn} */
55
- function httpSerialize(component) {
56
- const secure = String(component.scheme).toLowerCase() === "https";
57
- if (component.port === (secure ? 443 : 80) || component.port === "") component.port = void 0;
58
- if (!component.path) component.path = "/";
59
- return component;
60
- }
61
- /** @type {SchemeFn} */
62
- function wsParse(wsComponent) {
63
- wsComponent.secure = wsIsSecure(wsComponent);
64
- wsComponent.resourceName = (wsComponent.path || "/") + (wsComponent.query ? "?" + wsComponent.query : "");
65
- wsComponent.path = void 0;
66
- wsComponent.query = void 0;
67
- return wsComponent;
68
- }
69
- /** @type {SchemeFn} */
70
- function wsSerialize(wsComponent) {
71
- if (wsComponent.port === (wsIsSecure(wsComponent) ? 443 : 80) || wsComponent.port === "") wsComponent.port = void 0;
72
- if (typeof wsComponent.secure === "boolean") {
73
- wsComponent.scheme = wsComponent.secure ? "wss" : "ws";
74
- wsComponent.secure = void 0;
75
- }
76
- if (wsComponent.resourceName) {
77
- const [path, query] = wsComponent.resourceName.split("?");
78
- wsComponent.path = path && path !== "/" ? path : void 0;
79
- wsComponent.query = query;
80
- wsComponent.resourceName = void 0;
81
- }
82
- wsComponent.fragment = void 0;
83
- return wsComponent;
84
- }
85
- /** @type {SchemeFn} */
86
- function urnParse(urnComponent, options) {
87
- if (!urnComponent.path) {
88
- urnComponent.error = "URN can not be parsed";
89
- return urnComponent;
90
- }
91
- const matches = urnComponent.path.match(URN_REG);
92
- if (matches) {
93
- const scheme = options.scheme || urnComponent.scheme || "urn";
94
- urnComponent.nid = matches[1].toLowerCase();
95
- urnComponent.nss = matches[2];
96
- const schemeHandler = getSchemeHandler(`${scheme}:${options.nid || urnComponent.nid}`);
97
- urnComponent.path = void 0;
98
- if (schemeHandler) urnComponent = schemeHandler.parse(urnComponent, options);
99
- } else urnComponent.error = urnComponent.error || "URN can not be parsed.";
100
- return urnComponent;
101
- }
102
- /** @type {SchemeFn} */
103
- function urnSerialize(urnComponent, options) {
104
- if (urnComponent.nid === void 0) throw new Error("URN without nid cannot be serialized");
105
- const scheme = options.scheme || urnComponent.scheme || "urn";
106
- const nid = urnComponent.nid.toLowerCase();
107
- const schemeHandler = getSchemeHandler(`${scheme}:${options.nid || nid}`);
108
- if (schemeHandler) urnComponent = schemeHandler.serialize(urnComponent, options);
109
- const uriComponent = urnComponent;
110
- const nss = urnComponent.nss;
111
- uriComponent.path = `${nid || options.nid}:${nss}`;
112
- options.skipEscape = true;
113
- return uriComponent;
114
- }
115
- /** @type {SchemeFn} */
116
- function urnuuidParse(urnComponent, options) {
117
- const uuidComponent = urnComponent;
118
- uuidComponent.uuid = uuidComponent.nss;
119
- uuidComponent.nss = void 0;
120
- if (!options.tolerant && (!uuidComponent.uuid || !isUUID(uuidComponent.uuid))) uuidComponent.error = uuidComponent.error || "UUID is not valid.";
121
- return uuidComponent;
122
- }
123
- /** @type {SchemeFn} */
124
- function urnuuidSerialize(uuidComponent) {
125
- const urnComponent = uuidComponent;
126
- urnComponent.nss = (uuidComponent.uuid || "").toLowerCase();
127
- return urnComponent;
128
- }
129
- const http = {
130
- scheme: "http",
131
- domainHost: true,
132
- parse: httpParse,
133
- serialize: httpSerialize
134
- };
135
- const https = {
136
- scheme: "https",
137
- domainHost: http.domainHost,
138
- parse: httpParse,
139
- serialize: httpSerialize
140
- };
141
- const ws = {
142
- scheme: "ws",
143
- domainHost: true,
144
- parse: wsParse,
145
- serialize: wsSerialize
146
- };
147
- const SCHEMES = {
148
- http,
149
- https,
150
- ws,
151
- wss: {
152
- scheme: "wss",
153
- domainHost: ws.domainHost,
154
- parse: ws.parse,
155
- serialize: ws.serialize
156
- },
157
- urn: {
158
- scheme: "urn",
159
- parse: urnParse,
160
- serialize: urnSerialize,
161
- skipNormalize: true
162
- },
163
- "urn:uuid": {
164
- scheme: "urn:uuid",
165
- parse: urnuuidParse,
166
- serialize: urnuuidSerialize,
167
- skipNormalize: true
168
- }
169
- };
170
- Object.setPrototypeOf(SCHEMES, null);
171
- /**
172
- * @param {string|undefined} scheme
173
- * @returns {SchemeHandler|undefined}
174
- */
175
- function getSchemeHandler(scheme) {
176
- return scheme && (SCHEMES[scheme] || SCHEMES[scheme.toLowerCase()]) || void 0;
177
- }
178
- module.exports = {
179
- wsIsSecure,
180
- SCHEMES,
181
- isValidSchemeName,
182
- getSchemeHandler
183
- };
184
- }));
185
- //#endregion
186
- export default require_schemes();
187
- export { require_schemes };