fumadocs-openapi 10.10.0 → 10.10.2

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 (144) hide show
  1. package/css/generated/shared.css +1 -4
  2. package/dist/_openapi/types.d.ts +27 -1
  3. package/dist/index.d.ts +5 -4
  4. 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 +239 -0
  5. 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 +187 -0
  6. 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 +136 -0
  7. 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 +41 -0
  8. 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 +124 -0
  9. 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 +109 -0
  10. 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 +30 -0
  11. 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 +46 -0
  12. 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 +36 -0
  13. 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 +49 -0
  14. 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 +242 -0
  15. 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 +247 -0
  16. 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 +210 -0
  17. 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 +100 -0
  18. 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 +41 -0
  19. 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 +112 -0
  20. 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 +8 -0
  21. 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 +146 -0
  22. 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 +5 -0
  23. 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 +18 -0
  24. 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 +11 -0
  25. 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 +99 -0
  26. 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 +30 -0
  27. 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 +315 -0
  28. package/dist/playground/client.d.ts +1 -1
  29. package/dist/requests/generators/all.d.ts +1 -1
  30. package/dist/requests/generators/all.js +1 -0
  31. package/dist/types.d.ts +3 -13
  32. package/dist/ui/base.d.ts +1 -1
  33. package/dist/ui/base.js +4 -3
  34. package/dist/ui/client/index.d.ts +15 -10
  35. package/dist/ui/components/heading.js +9 -1
  36. package/dist/ui/contexts/api.js +1 -7
  37. package/dist/ui/create-client.d.ts +2 -1
  38. package/dist/ui/create-client.js +8 -9
  39. package/dist/ui/operation/request-tabs.js +4 -1
  40. package/dist/ui/operation/response-tabs.js +4 -1
  41. package/dist/ui/operation/usage-tabs/index.js +2 -8
  42. package/dist/utils/document/process.js +7 -12
  43. package/dist/utils/pages/builder.d.ts +2 -4
  44. package/dist/utils/pages/preset-auto.d.ts +1 -2
  45. package/package.json +4 -8
  46. package/dist/node_modules/.pnpm/@scalar_helpers@0.8.0/node_modules/@scalar/helpers/dist/general/create-limiter.js +0 -43
  47. package/dist/node_modules/.pnpm/@scalar_helpers@0.8.0/node_modules/@scalar/helpers/dist/object/is-object.js +0 -27
  48. package/dist/node_modules/.pnpm/@scalar_helpers@0.8.0/node_modules/@scalar/helpers/dist/object/prevent-pollution.js +0 -33
  49. package/dist/node_modules/.pnpm/@scalar_helpers@0.8.0/node_modules/@scalar/helpers/dist/queue/queue.js +0 -106
  50. package/dist/node_modules/.pnpm/@scalar_helpers@0.8.0/node_modules/@scalar/helpers/dist/string/generate-hash.js +0 -120
  51. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/bundle.js +0 -357
  52. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/plugins/fetch-urls/index.js +0 -73
  53. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/plugins/node.js +0 -3
  54. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/plugins/parse-yaml/index.js +0 -1
  55. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/plugins/read-files/index.js +0 -51
  56. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/value-generator.js +0 -102
  57. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/convert-to-local-ref.js +0 -24
  58. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/escape-json-pointer.js +0 -11
  59. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/get-schemas.js +0 -44
  60. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/get-segments-from-path.js +0 -10
  61. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/get-value-by-path.js +0 -42
  62. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/is-file-path.js +0 -23
  63. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/is-http-url.js +0 -23
  64. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/is-json-object.js +0 -28
  65. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/is-yaml.js +0 -21
  66. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/normalize.js +0 -33
  67. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/resolve-reference-path.js +0 -30
  68. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/set-value-at-path.js +0 -70
  69. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/to-relative-path.js +0 -33
  70. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/unescape-json-pointer.js +0 -12
  71. package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.js +0 -19
  72. package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.js +0 -430
  73. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/compose-collection.js +0 -50
  74. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/compose-doc.js +0 -39
  75. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/compose-node.js +0 -85
  76. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/compose-scalar.js +0 -57
  77. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/composer.js +0 -193
  78. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-block-map.js +0 -82
  79. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +0 -174
  80. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +0 -40
  81. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-end.js +0 -36
  82. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +0 -153
  83. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +0 -203
  84. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-props.js +0 -105
  85. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/util-contains-newline.js +0 -27
  86. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +0 -25
  87. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +0 -10
  88. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/util-map-includes.js +0 -10
  89. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/doc/Document.js +0 -277
  90. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/doc/anchors.js +0 -62
  91. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/doc/applyReviver.js +0 -38
  92. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/doc/createNode.js +0 -61
  93. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/doc/directives.js +0 -163
  94. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/errors.js +0 -48
  95. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/index.js +0 -16
  96. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/log.js +0 -6
  97. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Alias.js +0 -92
  98. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Collection.js +0 -117
  99. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Node.js +0 -32
  100. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Pair.js +0 -29
  101. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Scalar.js +0 -24
  102. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/YAMLMap.js +0 -106
  103. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +0 -104
  104. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +0 -49
  105. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/identity.js +0 -33
  106. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/toJS.js +0 -35
  107. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/cst-scalar.js +0 -3
  108. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/cst-visit.js +0 -89
  109. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/cst.js +0 -40
  110. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/lexer.js +0 -529
  111. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/line-counter.js +0 -45
  112. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/parser.js +0 -859
  113. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/public-api.js +0 -44
  114. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/Schema.js +0 -27
  115. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/common/map.js +0 -16
  116. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/common/null.js +0 -13
  117. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/common/seq.js +0 -16
  118. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/common/string.js +0 -14
  119. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/core/bool.js +0 -17
  120. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/core/float.js +0 -38
  121. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/core/int.js +0 -37
  122. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/core/schema.js +0 -23
  123. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/json/schema.js +0 -61
  124. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/tags.js +0 -81
  125. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +0 -52
  126. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +0 -24
  127. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +0 -41
  128. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +0 -70
  129. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +0 -39
  130. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +0 -60
  131. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +0 -56
  132. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +0 -39
  133. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +0 -65
  134. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +0 -79
  135. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +0 -111
  136. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringify.js +0 -105
  137. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +0 -116
  138. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringifyComment.js +0 -16
  139. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +0 -59
  140. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +0 -19
  141. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringifyPair.js +0 -95
  142. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringifyString.js +0 -222
  143. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/visit.js +0 -187
  144. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/index.js +0 -16
@@ -0,0 +1,247 @@
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 };
@@ -0,0 +1,210 @@
1
+ import convertPathToPosix from "./util/convert-path-to-posix.js";
2
+ import { resolve, stripHash, toFileSystemPath } from "./util/url.js";
3
+ import $Ref from "./ref.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/refs.js
5
+ /**
6
+ * When you call the resolve method, the value that gets passed to the callback function (or Promise) is a $Refs object. This same object is accessible via the parser.$refs property of $RefParser objects.
7
+ *
8
+ * This object is a map of JSON References and their resolved values. It also has several convenient helper methods that make it easy for you to navigate and manipulate the JSON References.
9
+ *
10
+ * See https://apidevtools.com/json-schema-ref-parser/docs/refs.html
11
+ */
12
+ var $Refs = class {
13
+ /**
14
+ * This property is true if the schema contains any circular references. You may want to check this property before serializing the dereferenced schema as JSON, since JSON.stringify() does not support circular references by default.
15
+ *
16
+ * See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#circular
17
+ */
18
+ circular;
19
+ /**
20
+ * Returns the paths/URLs of all the files in your schema (including the main schema file).
21
+ *
22
+ * See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#pathstypes
23
+ *
24
+ * @param types (optional) Optionally only return certain types of paths ("file", "http", etc.)
25
+ */
26
+ paths(...types) {
27
+ return getPaths(this._$refs, types.flat()).map((path) => {
28
+ return convertPathToPosix(path.decoded);
29
+ });
30
+ }
31
+ /**
32
+ * Returns a map of paths/URLs and their correspond values.
33
+ *
34
+ * See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#valuestypes
35
+ *
36
+ * @param types (optional) Optionally only return values from certain locations ("file", "http", etc.)
37
+ */
38
+ values(...types) {
39
+ const $refs = this._$refs;
40
+ return getPaths($refs, types.flat()).reduce((obj, path) => {
41
+ obj[convertPathToPosix(path.decoded)] = $refs[path.encoded].value;
42
+ return obj;
43
+ }, {});
44
+ }
45
+ /**
46
+ * Returns `true` if the given path exists in the schema; otherwise, returns `false`
47
+ *
48
+ * See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#existsref
49
+ *
50
+ * @param $ref The JSON Reference path, optionally with a JSON Pointer in the hash
51
+ */
52
+ /**
53
+ * Determines whether the given JSON reference exists.
54
+ *
55
+ * @param path - The path being resolved, optionally with a JSON pointer in the hash
56
+ * @param [options]
57
+ * @returns
58
+ */
59
+ exists(path, options) {
60
+ try {
61
+ this._resolve(path, "", options);
62
+ return true;
63
+ } catch {
64
+ return false;
65
+ }
66
+ }
67
+ /**
68
+ * Resolves the given JSON reference and returns the resolved value.
69
+ *
70
+ * @param path - The path being resolved, with a JSON pointer in the hash
71
+ * @param [options]
72
+ * @returns - Returns the resolved value
73
+ */
74
+ get(path, options) {
75
+ return this._resolve(path, "", options).value;
76
+ }
77
+ /**
78
+ * Sets the value at the given path in the schema. If the property, or any of its parents, don't exist, they will be created.
79
+ *
80
+ * @param path The JSON Reference path, optionally with a JSON Pointer in the hash
81
+ * @param value The value to assign. Can be anything (object, string, number, etc.)
82
+ */
83
+ set(path, value) {
84
+ const absPath = resolve(this._root$Ref.path, path);
85
+ const $ref = this._getRef(absPath);
86
+ if (!$ref) throw new Error(`Error resolving $ref pointer "${path}". \n"${stripHash(absPath)}" not found.`);
87
+ $ref.set(absPath, value);
88
+ }
89
+ /**
90
+ * Returns the specified {@link $Ref} object, or undefined.
91
+ *
92
+ * @param path - The path being resolved, optionally with a JSON pointer in the hash
93
+ * @returns
94
+ * @protected
95
+ */
96
+ _get$Ref(path) {
97
+ path = resolve(this._root$Ref.path, path);
98
+ return this._getRef(path);
99
+ }
100
+ /**
101
+ * Creates a new {@link $Ref} object and adds it to this {@link $Refs} object.
102
+ *
103
+ * @param path - The file path or URL of the referenced file
104
+ */
105
+ _add(path) {
106
+ const withoutHash = stripHash(path);
107
+ const $ref = new $Ref(this);
108
+ $ref.path = withoutHash;
109
+ this._$refs[withoutHash] = $ref;
110
+ this._root$Ref = this._root$Ref || $ref;
111
+ return $ref;
112
+ }
113
+ _addAlias(path, value, pathType, dynamicIdScope = false) {
114
+ const withoutHash = stripHash(path);
115
+ if (!withoutHash || this._$refs[withoutHash] || this._aliases[withoutHash]) return this._$refs[withoutHash] || this._aliases[withoutHash];
116
+ const $ref = new $Ref(this);
117
+ $ref.path = withoutHash;
118
+ $ref.pathType = pathType;
119
+ $ref.value = value;
120
+ $ref.dynamicIdScope = dynamicIdScope;
121
+ this._aliases[withoutHash] = $ref;
122
+ return $ref;
123
+ }
124
+ /**
125
+ * Resolves the given JSON reference.
126
+ *
127
+ * @param path - The path being resolved, optionally with a JSON pointer in the hash
128
+ * @param pathFromRoot - The path of `obj` from the schema root
129
+ * @param [options]
130
+ * @returns
131
+ * @protected
132
+ */
133
+ _resolve(path, pathFromRoot, options) {
134
+ const absPath = resolve(this._root$Ref.path, path);
135
+ const $ref = this._getRef(absPath);
136
+ if (!$ref) throw new Error(`Error resolving $ref pointer "${path}". \n"${stripHash(absPath)}" not found.`);
137
+ return $ref.resolve(absPath, options, path, pathFromRoot);
138
+ }
139
+ /**
140
+ * A map of paths/urls to {@link $Ref} objects
141
+ *
142
+ * @type {object}
143
+ * @protected
144
+ */
145
+ _$refs = {};
146
+ _aliases = {};
147
+ /**
148
+ * The {@link $Ref} object that is the root of the JSON schema.
149
+ *
150
+ * @type {$Ref}
151
+ * @protected
152
+ */
153
+ _root$Ref;
154
+ constructor() {
155
+ /**
156
+ * Indicates whether the schema contains any circular references.
157
+ *
158
+ * @type {boolean}
159
+ */
160
+ this.circular = false;
161
+ this._$refs = {};
162
+ this._aliases = {};
163
+ this._root$Ref = null;
164
+ }
165
+ /**
166
+ * Returns the paths of all the files/URLs that are referenced by the JSON schema,
167
+ * including the schema itself.
168
+ *
169
+ * @param [types] - Only return paths of the given types ("file", "http", etc.)
170
+ * @returns
171
+ */
172
+ /**
173
+ * Returns the map of JSON references and their resolved values.
174
+ *
175
+ * @param [types] - Only return references of the given types ("file", "http", etc.)
176
+ * @returns
177
+ */
178
+ /**
179
+ * Returns a POJO (plain old JavaScript object) for serialization as JSON.
180
+ *
181
+ * @returns {object}
182
+ */
183
+ toJSON = this.values;
184
+ _getRef(path) {
185
+ const withoutHash = stripHash(path);
186
+ return this._$refs[withoutHash] || this._aliases[withoutHash];
187
+ }
188
+ };
189
+ /**
190
+ * Returns the encoded and decoded paths keys of the given object.
191
+ *
192
+ * @param $refs - The object whose keys are URL-encoded paths
193
+ * @param [types] - Only return paths of the given types ("file", "http", etc.)
194
+ * @returns
195
+ */
196
+ function getPaths($refs, types) {
197
+ let paths = Object.keys($refs);
198
+ types = Array.isArray(types[0]) ? types[0] : Array.prototype.slice.call(types);
199
+ if (types.length > 0 && types[0]) paths = paths.filter((key) => {
200
+ return types.includes($refs[key].pathType);
201
+ });
202
+ return paths.map((path) => {
203
+ return {
204
+ encoded: path,
205
+ decoded: $refs[path].pathType === "file" ? toFileSystemPath(path, true) : path
206
+ };
207
+ });
208
+ }
209
+ //#endregion
210
+ export { $Refs as default };
@@ -0,0 +1,100 @@
1
+ import { cwd, getHash, resolve, safePointerToPath, stripHash } from "./util/url.js";
2
+ import { isHandledError } 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
+ import parse from "./parse.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/resolve-external.js
8
+ /**
9
+ * Crawls the JSON schema, finds all external JSON references, and resolves their values.
10
+ * This method does not mutate the JSON schema. The resolved values are added to {@link $RefParser#$refs}.
11
+ *
12
+ * NOTE: We only care about EXTERNAL references here. INTERNAL references are only relevant when dereferencing.
13
+ *
14
+ * @returns
15
+ * The promise resolves once all JSON references in the schema have been resolved,
16
+ * including nested references that are contained in externally-referenced files.
17
+ */
18
+ function resolveExternal(parser, options) {
19
+ if (!options.resolve?.external) return Promise.resolve();
20
+ try {
21
+ const rootScopeBase = parser.$refs._root$Ref.dynamicIdScope ? getSchemaBasePath(parser.$refs._root$Ref.path, parser.schema) : parser.$refs._root$Ref.path;
22
+ const promises = crawl(parser.schema, parser.$refs._root$Ref.path + "#", rootScopeBase, parser.$refs._root$Ref.dynamicIdScope, parser.$refs, options);
23
+ return Promise.all(promises);
24
+ } catch (e) {
25
+ return Promise.reject(e);
26
+ }
27
+ }
28
+ /**
29
+ * Recursively crawls the given value, and resolves any external JSON references.
30
+ *
31
+ * @param obj - The value to crawl. If it's not an object or array, it will be ignored.
32
+ * @param path - The full path of `obj`, possibly with a JSON Pointer in the hash
33
+ * @param {boolean} external - Whether `obj` was found in an external document.
34
+ * @param $refs
35
+ * @param options
36
+ * @param seen - Internal.
37
+ *
38
+ * @returns
39
+ * Returns an array of promises. There will be one promise for each JSON reference in `obj`.
40
+ * If `obj` does not contain any JSON references, then the array will be empty.
41
+ * If any of the JSON references point to files that contain additional JSON references,
42
+ * then the corresponding promise will internally reference an array of promises.
43
+ */
44
+ function crawl(obj, path, scopeBase, dynamicIdScope, $refs, options, seen, external) {
45
+ seen ||= /* @__PURE__ */ new Set();
46
+ let promises = [];
47
+ if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj) && !seen.has(obj)) {
48
+ seen.add(obj);
49
+ const currentScopeBase = scopeBase;
50
+ if ($Ref.isExternal$Ref(obj)) promises.push(resolve$Ref(obj, path, currentScopeBase, dynamicIdScope, $refs, options));
51
+ const keys = Object.keys(obj);
52
+ for (const key of keys) {
53
+ const keyPath = Pointer.join(path, key);
54
+ const value = obj[key];
55
+ const childScopeBase = dynamicIdScope && value && typeof value === "object" && !ArrayBuffer.isView(value) ? getSchemaBasePath(currentScopeBase, value) : currentScopeBase;
56
+ promises = promises.concat(crawl(value, keyPath, childScopeBase, dynamicIdScope, $refs, options, seen, external));
57
+ }
58
+ }
59
+ return promises;
60
+ }
61
+ /**
62
+ * Resolves the given JSON Reference, and then crawls the resulting value.
63
+ *
64
+ * @param $ref - The JSON Reference to resolve
65
+ * @param path - The full path of `$ref`, possibly with a JSON Pointer in the hash
66
+ * @param $refs
67
+ * @param options
68
+ *
69
+ * @returns
70
+ * The promise resolves once all JSON references in the object have been resolved,
71
+ * including nested references that are contained in externally-referenced files.
72
+ */
73
+ async function resolve$Ref($ref, path, scopeBase, dynamicIdScope, $refs, options) {
74
+ const resolutionBase = options.dereference?.externalReferenceResolution === "root" ? cwd() : dynamicIdScope ? scopeBase : path;
75
+ const resolvedPath = resolve(resolutionBase, $ref.$ref);
76
+ const withoutHash = stripHash(resolvedPath);
77
+ const ref = $refs._get$Ref(withoutHash);
78
+ if (ref) return Promise.resolve(ref.value);
79
+ try {
80
+ const reference = $ref.$ref;
81
+ const parseTarget = {
82
+ url: resolvedPath,
83
+ baseUrl: resolutionBase
84
+ };
85
+ if (typeof reference === "string") parseTarget.reference = reference;
86
+ const result = await parse(parseTarget, $refs, options);
87
+ const parsedRef = $refs._get$Ref(withoutHash);
88
+ const promises = crawl(result, withoutHash + "#", withoutHash, parsedRef?.dynamicIdScope ?? false, $refs, options, /* @__PURE__ */ new Set(), true);
89
+ return Promise.all(promises);
90
+ } catch (err) {
91
+ if (!options?.continueOnError || !isHandledError(err)) throw err;
92
+ if ($refs._$refs[withoutHash]) {
93
+ err.source = decodeURI(stripHash(path));
94
+ err.path = safePointerToPath(getHash(path));
95
+ }
96
+ return [];
97
+ }
98
+ }
99
+ //#endregion
100
+ export { resolveExternal as default };
@@ -0,0 +1,41 @@
1
+ import { isFileSystemPath, toFileSystemPath } from "../util/url.js";
2
+ import { ResolverError } from "../util/errors.js";
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/resolvers/file.js
4
+ var file_default = {
5
+ /**
6
+ * The order that this resolver will run, in relation to other resolvers.
7
+ */
8
+ order: 100,
9
+ /**
10
+ * Determines whether this resolver can read a given file reference.
11
+ * Resolvers that return true will be tried, in order, until one successfully resolves the file.
12
+ * Resolvers that return false will not be given a chance to resolve the file.
13
+ */
14
+ canRead(file) {
15
+ return isFileSystemPath(file.url);
16
+ },
17
+ /**
18
+ * Reads the given file and returns its raw contents as a Buffer.
19
+ */
20
+ async read(file) {
21
+ let path;
22
+ const fs = await import("fs");
23
+ try {
24
+ path = toFileSystemPath(file.url);
25
+ } catch (err) {
26
+ const e = err;
27
+ e.message = `Malformed URI: ${file.url}: ${e.message}`;
28
+ throw new ResolverError(e, file.url);
29
+ }
30
+ if (path.endsWith("/") || path.endsWith("\\")) path = path.slice(0, -1);
31
+ try {
32
+ return await fs.promises.readFile(path);
33
+ } catch (err) {
34
+ const e = err;
35
+ e.message = `Error opening file ${path}: ${e.message}`;
36
+ throw new ResolverError(e, path);
37
+ }
38
+ }
39
+ };
40
+ //#endregion
41
+ export { file_default as default };