fumadocs-openapi 10.10.1 → 10.10.3

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 (127) hide show
  1. package/css/generated/shared.css +16 -8
  2. 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
  3. 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
  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/index.js +136 -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/normalize-args.js +41 -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/options.js +124 -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/parse.js +109 -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/parsers/binary.js +30 -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/parsers/json.js +46 -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/text.js +36 -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/yaml.js +49 -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/pointer.js +242 -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/ref.js +247 -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/refs.js +210 -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/resolve-external.js +100 -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/resolvers/file.js +41 -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/resolvers/http.js +112 -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/util/convert-path-to-posix.js +8 -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/util/errors.js +146 -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/is-windows.js +5 -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/maybe.js +18 -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/next.js +11 -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/plugins.js +99 -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/schema-resources.js +30 -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/url.js +315 -0
  26. package/dist/ui/schema/client.js +70 -69
  27. package/dist/utils/document/process.js +7 -12
  28. package/package.json +4 -7
  29. package/dist/node_modules/.pnpm/@scalar_helpers@0.8.0/node_modules/@scalar/helpers/dist/general/create-limiter.js +0 -43
  30. package/dist/node_modules/.pnpm/@scalar_helpers@0.8.0/node_modules/@scalar/helpers/dist/object/is-object.js +0 -27
  31. package/dist/node_modules/.pnpm/@scalar_helpers@0.8.0/node_modules/@scalar/helpers/dist/object/prevent-pollution.js +0 -33
  32. package/dist/node_modules/.pnpm/@scalar_helpers@0.8.0/node_modules/@scalar/helpers/dist/queue/queue.js +0 -106
  33. package/dist/node_modules/.pnpm/@scalar_helpers@0.8.0/node_modules/@scalar/helpers/dist/string/generate-hash.js +0 -120
  34. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/bundle.js +0 -357
  35. 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
  36. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/plugins/node.js +0 -3
  37. 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
  38. 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
  39. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/bundle/value-generator.js +0 -102
  40. 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
  41. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/escape-json-pointer.js +0 -11
  42. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/get-schemas.js +0 -44
  43. 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
  44. 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
  45. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/is-file-path.js +0 -23
  46. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/is-http-url.js +0 -23
  47. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/is-json-object.js +0 -28
  48. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/is-yaml.js +0 -21
  49. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/normalize.js +0 -33
  50. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/resolve-reference-path.js +0 -30
  51. 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
  52. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/to-relative-path.js +0 -33
  53. package/dist/node_modules/.pnpm/@scalar_json-magic@0.12.14/node_modules/@scalar/json-magic/dist/helpers/unescape-json-pointer.js +0 -12
  54. package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.js +0 -19
  55. package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.js +0 -430
  56. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/compose-collection.js +0 -50
  57. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/compose-doc.js +0 -39
  58. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/compose-node.js +0 -85
  59. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/compose-scalar.js +0 -57
  60. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/composer.js +0 -193
  61. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-block-map.js +0 -82
  62. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +0 -174
  63. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +0 -40
  64. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-end.js +0 -36
  65. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +0 -153
  66. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +0 -203
  67. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/resolve-props.js +0 -105
  68. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/util-contains-newline.js +0 -27
  69. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +0 -25
  70. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +0 -10
  71. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/compose/util-map-includes.js +0 -10
  72. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/doc/Document.js +0 -277
  73. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/doc/anchors.js +0 -62
  74. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/doc/applyReviver.js +0 -38
  75. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/doc/createNode.js +0 -61
  76. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/doc/directives.js +0 -163
  77. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/errors.js +0 -48
  78. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/index.js +0 -16
  79. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/log.js +0 -6
  80. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Alias.js +0 -92
  81. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Collection.js +0 -117
  82. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Node.js +0 -32
  83. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Pair.js +0 -29
  84. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/Scalar.js +0 -24
  85. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/YAMLMap.js +0 -106
  86. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +0 -104
  87. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +0 -49
  88. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/identity.js +0 -33
  89. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/toJS.js +0 -35
  90. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/cst-scalar.js +0 -3
  91. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/cst-visit.js +0 -89
  92. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/cst.js +0 -40
  93. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/lexer.js +0 -529
  94. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/line-counter.js +0 -45
  95. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/parse/parser.js +0 -859
  96. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/public-api.js +0 -44
  97. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/Schema.js +0 -27
  98. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/common/map.js +0 -16
  99. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/common/null.js +0 -13
  100. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/common/seq.js +0 -16
  101. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/common/string.js +0 -14
  102. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/core/bool.js +0 -17
  103. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/core/float.js +0 -38
  104. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/core/int.js +0 -37
  105. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/core/schema.js +0 -23
  106. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/json/schema.js +0 -61
  107. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/tags.js +0 -81
  108. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +0 -52
  109. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +0 -24
  110. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +0 -41
  111. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +0 -70
  112. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +0 -39
  113. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +0 -60
  114. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +0 -56
  115. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +0 -39
  116. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +0 -65
  117. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +0 -79
  118. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +0 -111
  119. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringify.js +0 -105
  120. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +0 -116
  121. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringifyComment.js +0 -16
  122. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +0 -59
  123. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +0 -19
  124. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringifyPair.js +0 -95
  125. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/stringify/stringifyString.js +0 -222
  126. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/visit.js +0 -187
  127. package/dist/node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/index.js +0 -16
@@ -0,0 +1,242 @@
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 };
@@ -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 };