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,36 +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/text.js
3
- const TEXT_REGEXP = /\.(txt|htm|html|md|xml|js|min|map|css|scss|less|svg)$/i;
4
- var text_default = {
5
- /**
6
- * The order that this parser will run, in relation to other parsers.
7
- */
8
- order: 300,
9
- /**
10
- * Whether to allow "empty" files (zero bytes).
11
- */
12
- allowEmpty: true,
13
- /**
14
- * The encoding that the text is expected to be in.
15
- */
16
- encoding: "utf8",
17
- /**
18
- * Determines whether this parser can parse a given file reference.
19
- * Parsers that return true will be tried, in order, until one successfully parses the file.
20
- * Parsers that return false will be skipped, UNLESS all parsers returned false, in which case
21
- * every parser will be tried.
22
- */
23
- canParse(file) {
24
- return (typeof file.data === "string" || Buffer.isBuffer(file.data)) && TEXT_REGEXP.test(file.url);
25
- },
26
- /**
27
- * Parses the given file as text
28
- */
29
- parse(file) {
30
- if (typeof file.data === "string") return file.data;
31
- else if (Buffer.isBuffer(file.data)) return file.data.toString(this.encoding);
32
- else throw new ParserError("data is not text", file.url);
33
- }
34
- };
35
- //#endregion
36
- export { text_default as default };
@@ -1,49 +0,0 @@
1
- import { ParserError } from "../util/errors.js";
2
- import yaml, { JSON_SCHEMA } from "js-yaml";
3
- //#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/yaml.js
4
- var yaml_default = {
5
- /**
6
- * The order that this parser will run, in relation to other parsers.
7
- */
8
- order: 200,
9
- /**
10
- * Whether to allow "empty" files. This includes zero-byte files, as well as empty JSON objects.
11
- */
12
- allowEmpty: true,
13
- /**
14
- * Determines whether this parser can parse a given file reference.
15
- * Parsers that match will be tried, in order, until one successfully parses the file.
16
- * Parsers that don't match will be skipped, UNLESS none of the parsers match, in which case
17
- * every parser will be tried.
18
- */
19
- canParse: [
20
- ".yaml",
21
- ".yml",
22
- ".json"
23
- ],
24
- /**
25
- * Parses the given file as YAML
26
- *
27
- * @param file - An object containing information about the referenced file
28
- * @param file.url - The full URL of the referenced file
29
- * @param file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.)
30
- * @param file.data - The file contents. This will be whatever data type was returned by the resolver
31
- * @returns
32
- */
33
- async parse(file) {
34
- let data = file.data;
35
- if (Buffer.isBuffer(data)) data = data.toString();
36
- if (typeof data === "string") try {
37
- return yaml.load(data, { schema: JSON_SCHEMA });
38
- } catch {
39
- try {
40
- return yaml.load(data);
41
- } catch (e) {
42
- throw new ParserError(e?.message || "Parser Error", file.url);
43
- }
44
- }
45
- else return data;
46
- }
47
- };
48
- //#endregion
49
- export { yaml_default as default };
@@ -1,242 +0,0 @@
1
- import { getHash, resolve, stripHash } from "./util/url.js";
2
- import { InvalidPointerError, JSONParserError, MissingPointerError, isHandledError } from "./util/errors.js";
3
- import { getSchemaBasePath } from "./util/schema-resources.js";
4
- import $Ref from "./ref.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/pointer.js
6
- const nullSymbol = Symbol("null");
7
- const slashes = /\//g;
8
- const tildes = /~/g;
9
- const escapedSlash = /~1/g;
10
- const escapedTilde = /~0/g;
11
- /**
12
- * This class represents a single JSON pointer and its resolved value.
13
- *
14
- * @param $ref
15
- * @param path
16
- * @param [friendlyPath] - The original user-specified path (used for error messages)
17
- * @class
18
- */
19
- var Pointer = class Pointer {
20
- /**
21
- * The {@link $Ref} object that contains this {@link Pointer} object.
22
- */
23
- $ref;
24
- /**
25
- * The file path or URL, containing the JSON pointer in the hash.
26
- * This path is relative to the path of the main JSON schema file.
27
- */
28
- path;
29
- /**
30
- * The original path or URL, used for error messages.
31
- */
32
- originalPath;
33
- /**
34
- * The current base URI used to resolve nested $ref pointers while walking this pointer.
35
- */
36
- scopeBase;
37
- /**
38
- * The value of the JSON pointer.
39
- * Can be any JSON type, not just objects. Unknown file types are represented as Buffers (byte arrays).
40
- */
41
- value;
42
- /**
43
- * Indicates whether the pointer references itself.
44
- */
45
- circular;
46
- /**
47
- * The number of indirect references that were traversed to resolve the value.
48
- * Resolving a single pointer may require resolving multiple $Refs.
49
- */
50
- indirections;
51
- constructor($ref, path, friendlyPath) {
52
- this.$ref = $ref;
53
- this.path = path;
54
- this.originalPath = friendlyPath || path;
55
- this.scopeBase = $ref.path || stripHash(path);
56
- this.value = void 0;
57
- this.circular = false;
58
- this.indirections = 0;
59
- }
60
- /**
61
- * Resolves the value of a nested property within the given object.
62
- *
63
- * @param obj - The object that will be crawled
64
- * @param options
65
- * @param pathFromRoot - the path of place that initiated resolving
66
- *
67
- * @returns
68
- * Returns a JSON pointer whose {@link Pointer#value} is the resolved value.
69
- * If resolving this value required resolving other JSON references, then
70
- * the {@link Pointer#$ref} and {@link Pointer#path} will reflect the resolution path
71
- * of the resolved value.
72
- */
73
- resolve(obj, options, pathFromRoot) {
74
- const tokens = Pointer.parse(this.path, this.originalPath);
75
- const found = [];
76
- this.value = unwrapOrThrow(obj);
77
- if (this.$ref.dynamicIdScope && !isAliasedResource(this.$ref)) this.scopeBase = getSchemaBasePath(this.scopeBase, this.value);
78
- for (let i = 0; i < tokens.length; i++) {
79
- const wasCircular = this.circular;
80
- const isExtendedRef = $Ref.isExtended$Ref(this.value);
81
- if (resolveIf$Ref(this, options, pathFromRoot)) this.path = Pointer.join(this.path, tokens.slice(i));
82
- else if (!wasCircular && this.circular && isExtendedRef) this.circular = false;
83
- const token = tokens[i];
84
- if (this.value[token] === void 0 || this.value[token] === null && i === tokens.length - 1) {
85
- let didFindSubstringSlashMatch = false;
86
- for (let j = tokens.length - 1; j > i; j--) {
87
- const joinedToken = tokens.slice(i, j + 1).join("/");
88
- if (this.value[joinedToken] !== void 0) {
89
- this.value = this.value[joinedToken];
90
- i = j;
91
- didFindSubstringSlashMatch = true;
92
- break;
93
- }
94
- }
95
- if (didFindSubstringSlashMatch) continue;
96
- if (token in this.value && this.value[token] === null) {
97
- this.value = nullSymbol;
98
- continue;
99
- }
100
- this.value = null;
101
- const path = this.$ref.path || "";
102
- const targetRef = this.path.replace(path, "");
103
- const targetFound = Pointer.join("", found);
104
- const parentPath = pathFromRoot?.replace(path, "");
105
- throw new MissingPointerError(token, decodeURI(this.originalPath), targetRef, targetFound, parentPath);
106
- } else this.value = this.value[token];
107
- found.push(token);
108
- if (this.$ref.dynamicIdScope) this.scopeBase = getSchemaBasePath(this.scopeBase, this.value);
109
- }
110
- const finalResolutionBase = this.$ref.dynamicIdScope ? this.scopeBase : this.path;
111
- if (!this.value || this.value.$ref && resolve(finalResolutionBase, this.value.$ref) !== pathFromRoot) resolveIf$Ref(this, options, pathFromRoot);
112
- return this;
113
- }
114
- /**
115
- * Sets the value of a nested property within the given object.
116
- *
117
- * @param obj - The object that will be crawled
118
- * @param value - the value to assign
119
- * @param options
120
- *
121
- * @returns
122
- * Returns the modified object, or an entirely new object if the entire object is overwritten.
123
- */
124
- set(obj, value, options) {
125
- const tokens = Pointer.parse(this.path);
126
- let token;
127
- if (tokens.length === 0) {
128
- this.value = value;
129
- return value;
130
- }
131
- this.value = unwrapOrThrow(obj);
132
- if (this.$ref.dynamicIdScope && !isAliasedResource(this.$ref)) this.scopeBase = getSchemaBasePath(this.scopeBase, this.value);
133
- for (let i = 0; i < tokens.length - 1; i++) {
134
- resolveIf$Ref(this, options);
135
- token = tokens[i];
136
- if (this.value && this.value[token] !== void 0) this.value = this.value[token];
137
- else this.value = setValue(this, token, {});
138
- if (this.$ref.dynamicIdScope) this.scopeBase = getSchemaBasePath(this.scopeBase, this.value);
139
- }
140
- resolveIf$Ref(this, options);
141
- token = tokens[tokens.length - 1];
142
- setValue(this, token, value);
143
- return obj;
144
- }
145
- /**
146
- * Parses a JSON pointer (or a path containing a JSON pointer in the hash)
147
- * and returns an array of the pointer's tokens.
148
- * (e.g. "schema.json#/definitions/person/name" => ["definitions", "person", "name"])
149
- *
150
- * The pointer is parsed according to RFC 6901
151
- * {@link https://tools.ietf.org/html/rfc6901#section-3}
152
- *
153
- * @param path
154
- * @param [originalPath]
155
- * @returns
156
- */
157
- static parse(path, originalPath) {
158
- const pointer = getHash(path).substring(1);
159
- if (!pointer) return [];
160
- const split = pointer.split("/");
161
- for (let i = 0; i < split.length; i++) split[i] = split[i].replace(escapedSlash, "/").replace(escapedTilde, "~");
162
- if (split[0] !== "") throw new InvalidPointerError(pointer, originalPath === void 0 ? path : originalPath);
163
- return split.slice(1);
164
- }
165
- /**
166
- * Creates a JSON pointer path, by joining one or more tokens to a base path.
167
- *
168
- * @param base - The base path (e.g. "schema.json#/definitions/person")
169
- * @param tokens - The token(s) to append (e.g. ["name", "first"])
170
- * @returns
171
- */
172
- static join(base, tokens) {
173
- if (base.indexOf("#") === -1) base += "#";
174
- tokens = Array.isArray(tokens) ? tokens : [tokens];
175
- for (let i = 0; i < tokens.length; i++) {
176
- const token = tokens[i];
177
- base += "/" + token.replace(tildes, "~0").replace(slashes, "~1");
178
- }
179
- return base;
180
- }
181
- };
182
- /**
183
- * If the given pointer's {@link Pointer#value} is a JSON reference,
184
- * then the reference is resolved and {@link Pointer#value} is replaced with the resolved value.
185
- * In addition, {@link Pointer#path} and {@link Pointer#$ref} are updated to reflect the
186
- * resolution path of the new value.
187
- *
188
- * @param pointer
189
- * @param options
190
- * @param [pathFromRoot] - the path of place that initiated resolving
191
- * @returns - Returns `true` if the resolution path changed
192
- */
193
- function resolveIf$Ref(pointer, options, pathFromRoot) {
194
- if ($Ref.isAllowed$Ref(pointer.value, options)) {
195
- const $refPath = resolve(pointer.$ref.dynamicIdScope ? pointer.scopeBase : pointer.path, pointer.value.$ref);
196
- if ($refPath === pointer.path && !isRootPath(pathFromRoot)) pointer.circular = true;
197
- else {
198
- const resolved = pointer.$ref.$refs._resolve($refPath, pointer.path, options);
199
- if (resolved === null) return false;
200
- pointer.indirections += resolved.indirections + 1;
201
- if ($Ref.isExtended$Ref(pointer.value)) {
202
- pointer.value = $Ref.dereference(pointer.value, resolved.value, options);
203
- return false;
204
- } else {
205
- pointer.$ref = resolved.$ref;
206
- pointer.path = resolved.path;
207
- pointer.value = resolved.value;
208
- pointer.scopeBase = pointer.$ref.path;
209
- }
210
- return true;
211
- }
212
- }
213
- }
214
- /**
215
- * Sets the specified token value of the {@link Pointer#value}.
216
- *
217
- * The token is evaluated according to RFC 6901.
218
- * {@link https://tools.ietf.org/html/rfc6901#section-4}
219
- *
220
- * @param pointer - The JSON Pointer whose value will be modified
221
- * @param token - A JSON Pointer token that indicates how to modify `obj`
222
- * @param value - The value to assign
223
- * @returns - Returns the assigned value
224
- */
225
- function setValue(pointer, token, value) {
226
- if (pointer.value && typeof pointer.value === "object") if (token === "-" && Array.isArray(pointer.value)) pointer.value.push(value);
227
- else pointer.value[token] = value;
228
- else throw new JSONParserError(`Error assigning $ref pointer "${pointer.path}". \nCannot set "${token}" of a non-object.`);
229
- return value;
230
- }
231
- function unwrapOrThrow(value) {
232
- if (isHandledError(value)) throw value;
233
- return value;
234
- }
235
- function isRootPath(pathFromRoot) {
236
- return typeof pathFromRoot == "string" && Pointer.parse(pathFromRoot).length == 0;
237
- }
238
- function isAliasedResource($ref) {
239
- return Boolean($ref.path && $ref.path in $ref.$refs._aliases);
240
- }
241
- //#endregion
242
- export { Pointer as default, nullSymbol };
@@ -1,247 +0,0 @@
1
- import { getHash, safePointerToPath, stripHash } from "./util/url.js";
2
- import { InvalidPointerError, isHandledError, normalizeError } from "./util/errors.js";
3
- import Pointer, { nullSymbol } from "./pointer.js";
4
- //#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/ref.js
5
- /**
6
- * This class represents a single JSON reference and its resolved value.
7
- *
8
- * @class
9
- */
10
- var $Ref = class $Ref {
11
- /**
12
- * The file path or URL of the referenced file.
13
- * This path is relative to the path of the main JSON schema file.
14
- *
15
- * This path does NOT contain document fragments (JSON pointers). It always references an ENTIRE file.
16
- * Use methods such as {@link $Ref#get}, {@link $Ref#resolve}, and {@link $Ref#exists} to get
17
- * specific JSON pointers within the file.
18
- *
19
- * @type {string}
20
- */
21
- path;
22
- /**
23
- * The resolved value of the JSON reference.
24
- * Can be any JSON type, not just objects. Unknown file types are represented as Buffers (byte arrays).
25
- *
26
- * @type {?*}
27
- */
28
- value;
29
- /**
30
- * The {@link $Refs} object that contains this {@link $Ref} object.
31
- *
32
- * @type {$Refs}
33
- */
34
- $refs;
35
- /**
36
- * Indicates the type of {@link $Ref#path} (e.g. "file", "http", etc.)
37
- */
38
- pathType;
39
- /**
40
- * Whether this document/resource should use JSON Schema 2019-09+ nested $id scope semantics.
41
- */
42
- dynamicIdScope = false;
43
- /**
44
- * List of all errors. Undefined if no errors.
45
- */
46
- errors = [];
47
- constructor($refs) {
48
- this.$refs = $refs;
49
- }
50
- /**
51
- * Pushes an error to errors array.
52
- *
53
- * @param err - The error to be pushed
54
- * @returns
55
- */
56
- addError(err) {
57
- if (this.errors === void 0) this.errors = [];
58
- const existingErrors = this.errors.map(({ footprint }) => footprint);
59
- if ("errors" in err && Array.isArray(err.errors)) this.errors.push(...err.errors.map(normalizeError).filter(({ footprint }) => !existingErrors.includes(footprint)));
60
- else if (!("footprint" in err) || !existingErrors.includes(err.footprint)) this.errors.push(normalizeError(err));
61
- }
62
- /**
63
- * Determines whether the given JSON reference exists within this {@link $Ref#value}.
64
- *
65
- * @param path - The full path being resolved, optionally with a JSON pointer in the hash
66
- * @param options
67
- * @returns
68
- */
69
- exists(path, options) {
70
- try {
71
- this.resolve(path, options);
72
- return true;
73
- } catch {
74
- return false;
75
- }
76
- }
77
- /**
78
- * Resolves the given JSON reference within this {@link $Ref#value} and returns the resolved value.
79
- *
80
- * @param path - The full path being resolved, optionally with a JSON pointer in the hash
81
- * @param options
82
- * @returns - Returns the resolved value
83
- */
84
- get(path, options) {
85
- return this.resolve(path, options)?.value;
86
- }
87
- /**
88
- * Resolves the given JSON reference within this {@link $Ref#value}.
89
- *
90
- * @param path - The full path being resolved, optionally with a JSON pointer in the hash
91
- * @param options
92
- * @param friendlyPath - The original user-specified path (used for error messages)
93
- * @param pathFromRoot - The path of `obj` from the schema root
94
- * @returns
95
- */
96
- resolve(path, options, friendlyPath, pathFromRoot) {
97
- const pointer = new Pointer(this, path, friendlyPath);
98
- try {
99
- const resolved = pointer.resolve(this.value, options, pathFromRoot);
100
- if (resolved.value === nullSymbol) resolved.value = null;
101
- return resolved;
102
- } catch (err) {
103
- if (!options || !options.continueOnError || !isHandledError(err)) throw err;
104
- if (err.path === null) err.path = safePointerToPath(getHash(pathFromRoot));
105
- if (err instanceof InvalidPointerError) err.source = decodeURI(stripHash(pathFromRoot));
106
- this.addError(err);
107
- return null;
108
- }
109
- }
110
- /**
111
- * Sets the value of a nested property within this {@link $Ref#value}.
112
- * If the property, or any of its parents don't exist, they will be created.
113
- *
114
- * @param path - The full path of the property to set, optionally with a JSON pointer in the hash
115
- * @param value - The value to assign
116
- */
117
- set(path, value) {
118
- const pointer = new Pointer(this, path);
119
- this.value = pointer.set(this.value, value);
120
- if (this.value === nullSymbol) this.value = null;
121
- }
122
- /**
123
- * Determines whether the given value is a JSON reference.
124
- *
125
- * @param value - The value to inspect
126
- * @returns
127
- */
128
- static is$Ref(value) {
129
- return Boolean(value) && typeof value === "object" && value !== null && "$ref" in value && typeof value.$ref === "string" && value.$ref.length > 0;
130
- }
131
- /**
132
- * Determines whether the given value is an external JSON reference.
133
- *
134
- * @param value - The value to inspect
135
- * @returns
136
- */
137
- static isExternal$Ref(value) {
138
- return $Ref.is$Ref(value) && value.$ref[0] !== "#";
139
- }
140
- /**
141
- * Determines whether the given value is a JSON reference, and whether it is allowed by the options.
142
- * For example, if it references an external file, then options.resolve.external must be true.
143
- *
144
- * @param value - The value to inspect
145
- * @param options
146
- * @returns
147
- */
148
- static isAllowed$Ref(value, options) {
149
- if (this.is$Ref(value)) {
150
- if (value.$ref.substring(0, 2) === "#/" || value.$ref === "#") return true;
151
- else if (value.$ref[0] !== "#" && (!options || options.resolve?.external)) return true;
152
- }
153
- }
154
- /**
155
- * Determines whether the given value is a JSON reference that "extends" its resolved value.
156
- * That is, it has extra properties (in addition to "$ref"), so rather than simply pointing to
157
- * an existing value, this $ref actually creates a NEW value that is a shallow copy of the resolved
158
- * value, plus the extra properties.
159
- *
160
- * @example: {
161
- person: {
162
- properties: {
163
- firstName: { type: string }
164
- lastName: { type: string }
165
- }
166
- }
167
- employee: {
168
- properties: {
169
- $ref: #/person/properties
170
- salary: { type: number }
171
- }
172
- }
173
- }
174
- * In this example, "employee" is an extended $ref, since it extends "person" with an additional
175
- * property (salary). The result is a NEW value that looks like this:
176
- *
177
- * {
178
- * properties: {
179
- * firstName: { type: string }
180
- * lastName: { type: string }
181
- * salary: { type: number }
182
- * }
183
- * }
184
- *
185
- * @param value - The value to inspect
186
- * @returns
187
- */
188
- static isExtended$Ref(value) {
189
- return $Ref.is$Ref(value) && Object.keys(value).length > 1;
190
- }
191
- /**
192
- * Returns the resolved value of a JSON Reference.
193
- * If necessary, the resolved value is merged with the JSON Reference to create a new object
194
- *
195
- * @example: {
196
- person: {
197
- properties: {
198
- firstName: { type: string }
199
- lastName: { type: string }
200
- }
201
- }
202
- employee: {
203
- properties: {
204
- $ref: #/person/properties
205
- salary: { type: number }
206
- }
207
- }
208
- } When "person" and "employee" are merged, you end up with the following object:
209
- *
210
- * {
211
- * properties: {
212
- * firstName: { type: string }
213
- * lastName: { type: string }
214
- * salary: { type: number }
215
- * }
216
- * }
217
- *
218
- * @param $ref - The JSON reference object (the one with the "$ref" property)
219
- * @param resolvedValue - The resolved value, which can be any type
220
- * @param options - The options
221
- * @returns - Returns the dereferenced value
222
- */
223
- static dereference($ref, resolvedValue, options) {
224
- if (resolvedValue && typeof resolvedValue === "object" && $Ref.isExtended$Ref($ref)) {
225
- const merged = {};
226
- for (const key of Object.keys($ref)) if (key !== "$ref") merged[key] = $ref[key];
227
- const mergeKeys = options?.dereference?.mergeKeys ?? true;
228
- for (const _key of Object.keys(resolvedValue)) {
229
- const key = _key;
230
- if (!(key in merged)) merged[key] = resolvedValue[key];
231
- else if (mergeKeys && typeof merged[key] === "object" && merged[key] !== null && typeof resolvedValue[key] === "object" && resolvedValue[key] !== null) merged[key] = deepMerge(resolvedValue[key], merged[key]);
232
- }
233
- return merged;
234
- } else return resolvedValue;
235
- }
236
- };
237
- function deepMerge(target, source) {
238
- if (typeof target !== "object" || target === null) return source;
239
- if (typeof source !== "object" || source === null) return source;
240
- const output = Array.isArray(target) ? [...target] : { ...target };
241
- for (const key of Object.keys(source)) if (Array.isArray(source[key])) output[key] = [...source[key]];
242
- else if (typeof source[key] === "object" && source[key] !== null) output[key] = deepMerge(target[key], source[key]);
243
- else output[key] = source[key];
244
- return output;
245
- }
246
- //#endregion
247
- export { $Ref as default };