@fumadocs/api-docs 0.0.3 → 0.0.4

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 (53) hide show
  1. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/index.js +1 -1
  2. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/resolve.js +2 -2
  3. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/rules.js +1 -1
  4. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/dataType.js +1 -1
  5. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/core.js +1 -1
  6. package/dist/ref-parser/bundle.d.ts +10 -0
  7. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/bundle.js +76 -6
  8. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/normalize-args.js +1 -1
  9. package/dist/ref-parser/options.d.ts +28 -0
  10. package/dist/ref-parser/options.js +27 -0
  11. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/parse.js +1 -1
  12. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/parsers/json.js +1 -1
  13. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/parsers/yaml.js +6 -12
  14. package/dist/ref-parser/pointer.d.ts +1 -0
  15. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/pointer.js +16 -54
  16. package/dist/ref-parser/ref.d.ts +1 -0
  17. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/ref.js +6 -48
  18. package/dist/ref-parser/refs.d.ts +1 -0
  19. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/refs.js +4 -41
  20. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/resolve-external.js +3 -3
  21. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/resolvers/file.js +1 -1
  22. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/types/index.d.ts +8 -40
  23. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/util/convert-path-to-posix.js +1 -1
  24. package/dist/ref-parser/util/errors.d.ts +1 -0
  25. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/util/errors.js +16 -34
  26. package/dist/ref-parser/util/is-windows.js +5 -0
  27. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/util/maybe.js +1 -1
  28. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/util/next.js +1 -1
  29. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/util/plugins.js +1 -1
  30. package/dist/{node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib → ref-parser}/util/schema-resources.js +1 -1
  31. package/dist/ref-parser/util/url.js +206 -0
  32. package/dist/schema/bundle.d.ts +1 -1
  33. package/dist/schema/bundle.js +1 -1
  34. package/dist/schema/ref.d.ts +3 -1
  35. package/dist/schema/ref.js +1 -1
  36. package/dist/schema/sample.js +5 -7
  37. package/dist/utils/cn.js +1 -1
  38. package/dist/utils/deep-merge.js +8 -0
  39. package/package.json +8 -10
  40. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/dereference.js +0 -187
  41. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/index.d.ts +0 -157
  42. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/index.js +0 -136
  43. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/options.d.ts +0 -166
  44. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/options.js +0 -124
  45. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/binary.js +0 -30
  46. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/text.js +0 -36
  47. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/pointer.d.ts +0 -96
  48. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/ref.d.ts +0 -190
  49. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/refs.d.ts +0 -134
  50. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/http.js +0 -121
  51. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/errors.d.ts +0 -34
  52. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/is-windows.js +0 -5
  53. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.6_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/url.js +0 -381
@@ -1,124 +0,0 @@
1
- import json_default from "./parsers/json.js";
2
- import yaml_default from "./parsers/yaml.js";
3
- import text_default from "./parsers/text.js";
4
- import binary_default from "./parsers/binary.js";
5
- import file_default from "./resolvers/file.js";
6
- import http_default from "./resolvers/http.js";
7
- //#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.6_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/options.js
8
- const getJsonSchemaRefParserDefaultOptions = () => {
9
- return {
10
- /**
11
- * Determines how different types of files will be parsed.
12
- *
13
- * You can add additional parsers of your own, replace an existing one with
14
- * your own implementation, or disable any parser by setting it to false.
15
- */
16
- parse: {
17
- json: { ...json_default },
18
- yaml: { ...yaml_default },
19
- text: { ...text_default },
20
- binary: { ...binary_default }
21
- },
22
- /**
23
- * Determines how JSON References will be resolved.
24
- *
25
- * You can add additional resolvers of your own, replace an existing one with
26
- * your own implementation, or disable any resolver by setting it to false.
27
- */
28
- resolve: {
29
- file: { ...file_default },
30
- http: { ...http_default },
31
- /**
32
- * Determines whether external $ref pointers will be resolved.
33
- * If this option is disabled, then none of above resolvers will be called.
34
- * Instead, external $ref pointers will simply be ignored.
35
- *
36
- * @type {boolean}
37
- */
38
- external: true
39
- },
40
- /**
41
- * By default, JSON Schema $Ref Parser throws the first error it encounters. Setting `continueOnError` to `true`
42
- * causes it to keep processing as much as possible and then throw a single error that contains all errors
43
- * that were encountered.
44
- */
45
- continueOnError: false,
46
- /**
47
- * Determines the types of JSON references that are allowed.
48
- */
49
- bundle: {
50
- /**
51
- * A function, called for each path, which can return true to stop this path and all
52
- * subpaths from being processed further. This is useful in schemas where some
53
- * subpaths contain literal $ref keys that should not be changed.
54
- *
55
- * @type {function}
56
- */
57
- excludedPathMatcher: () => false },
58
- /**
59
- * Determines the types of JSON references that are allowed.
60
- */
61
- dereference: {
62
- /**
63
- * Dereference circular (recursive) JSON references?
64
- * If false, then a {@link ReferenceError} will be thrown if a circular reference is found.
65
- * If "ignore", then circular references will not be dereferenced.
66
- *
67
- * @type {boolean|string}
68
- */
69
- circular: true,
70
- /**
71
- * A function, called for each path, which can return true to stop this path and all
72
- * subpaths from being dereferenced further. This is useful in schemas where some
73
- * subpaths contain literal $ref keys that should not be dereferenced.
74
- *
75
- * @type {function}
76
- */
77
- excludedPathMatcher: () => false,
78
- referenceResolution: "relative",
79
- mergeKeys: true
80
- },
81
- mutateInputSchema: true
82
- };
83
- };
84
- const getNewOptions = (options) => {
85
- const newOptions = getJsonSchemaRefParserDefaultOptions();
86
- if (options) merge(newOptions, options);
87
- return newOptions;
88
- };
89
- /**
90
- * Merges the properties of the source object into the target object.
91
- *
92
- * @param target - The object that we're populating
93
- * @param source - The options that are being merged
94
- * @returns
95
- */
96
- function merge(target, source) {
97
- if (isMergeable(source)) {
98
- const keys = Object.keys(source).filter((key) => ![
99
- "__proto__",
100
- "constructor",
101
- "prototype"
102
- ].includes(key));
103
- for (let i = 0; i < keys.length; i++) {
104
- const key = keys[i];
105
- const sourceSetting = source[key];
106
- const targetSetting = target[key];
107
- if (isMergeable(sourceSetting)) target[key] = merge(targetSetting || {}, sourceSetting);
108
- else if (sourceSetting !== void 0) target[key] = sourceSetting;
109
- }
110
- }
111
- return target;
112
- }
113
- /**
114
- * Determines whether the given value can be merged,
115
- * or if it is a scalar value that should just override the target value.
116
- *
117
- * @param val
118
- * @returns
119
- */
120
- function isMergeable(val) {
121
- return val && typeof val === "object" && !Array.isArray(val) && !(val instanceof RegExp) && !(val instanceof Date);
122
- }
123
- //#endregion
124
- export { getJsonSchemaRefParserDefaultOptions, getNewOptions };
@@ -1,30 +0,0 @@
1
- //#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.6_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/binary.js
2
- const BINARY_REGEXP = /\.(jpeg|jpg|gif|png|bmp|ico)$/i;
3
- var binary_default = {
4
- /**
5
- * The order that this parser will run, in relation to other parsers.
6
- */
7
- order: 400,
8
- /**
9
- * Whether to allow "empty" files (zero bytes).
10
- */
11
- allowEmpty: true,
12
- /**
13
- * Determines whether this parser can parse a given file reference.
14
- * Parsers that return true will be tried, in order, until one successfully parses the file.
15
- * Parsers that return false will be skipped, UNLESS all parsers returned false, in which case
16
- * every parser will be tried.
17
- */
18
- canParse(file) {
19
- return Buffer.isBuffer(file.data) && BINARY_REGEXP.test(file.url);
20
- },
21
- /**
22
- * Parses the given data as a Buffer (byte array).
23
- */
24
- parse(file) {
25
- if (Buffer.isBuffer(file.data)) return file.data;
26
- else return Buffer.from(file.data);
27
- }
28
- };
29
- //#endregion
30
- export { binary_default as default };
@@ -1,36 +0,0 @@
1
- import { ParserError } from "../util/errors.js";
2
- //#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.6_@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,96 +0,0 @@
1
- import { JSONSchema } from "./types/index.js";
2
- import { ParserOptions } from "./options.js";
3
- import { $Ref } from "./ref.js";
4
- import { JSONSchema4Type, JSONSchema6Type, JSONSchema7Type } from "json-schema";
5
-
6
- //#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.6_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/pointer.d.ts
7
- /**
8
- * This class represents a single JSON pointer and its resolved value.
9
- *
10
- * @param $ref
11
- * @param path
12
- * @param [friendlyPath] - The original user-specified path (used for error messages)
13
- * @class
14
- */
15
- declare class Pointer<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>> {
16
- /**
17
- * The {@link $Ref} object that contains this {@link Pointer} object.
18
- */
19
- $ref: $Ref<S, O>;
20
- /**
21
- * The file path or URL, containing the JSON pointer in the hash.
22
- * This path is relative to the path of the main JSON schema file.
23
- */
24
- path: string;
25
- /**
26
- * The original path or URL, used for error messages.
27
- */
28
- originalPath: string;
29
- /**
30
- * The current base URI used to resolve nested $ref pointers while walking this pointer.
31
- */
32
- scopeBase: string;
33
- /**
34
- * The value of the JSON pointer.
35
- * Can be any JSON type, not just objects. Unknown file types are represented as Buffers (byte arrays).
36
- */
37
- value: any;
38
- /**
39
- * Indicates whether the pointer references itself.
40
- */
41
- circular: boolean;
42
- /**
43
- * The number of indirect references that were traversed to resolve the value.
44
- * Resolving a single pointer may require resolving multiple $Refs.
45
- */
46
- indirections: number;
47
- constructor($ref: $Ref<S, O>, path: string, friendlyPath?: string);
48
- /**
49
- * Resolves the value of a nested property within the given object.
50
- *
51
- * @param obj - The object that will be crawled
52
- * @param options
53
- * @param pathFromRoot - the path of place that initiated resolving
54
- *
55
- * @returns
56
- * Returns a JSON pointer whose {@link Pointer#value} is the resolved value.
57
- * If resolving this value required resolving other JSON references, then
58
- * the {@link Pointer#$ref} and {@link Pointer#path} will reflect the resolution path
59
- * of the resolved value.
60
- */
61
- resolve(obj: S, options?: O, pathFromRoot?: string): this;
62
- /**
63
- * Sets the value of a nested property within the given object.
64
- *
65
- * @param obj - The object that will be crawled
66
- * @param value - the value to assign
67
- * @param options
68
- *
69
- * @returns
70
- * Returns the modified object, or an entirely new object if the entire object is overwritten.
71
- */
72
- set(obj: S, value: JSONSchema4Type | JSONSchema6Type | JSONSchema7Type, options?: O): string | number | boolean | import("json-schema").JSONSchema4Object | import("json-schema").JSONSchema4Array | S | null;
73
- /**
74
- * Parses a JSON pointer (or a path containing a JSON pointer in the hash)
75
- * and returns an array of the pointer's tokens.
76
- * (e.g. "schema.json#/definitions/person/name" => ["definitions", "person", "name"])
77
- *
78
- * The pointer is parsed according to RFC 6901
79
- * {@link https://tools.ietf.org/html/rfc6901#section-3}
80
- *
81
- * @param path
82
- * @param [originalPath]
83
- * @returns
84
- */
85
- static parse(path: string, originalPath?: string): string[];
86
- /**
87
- * Creates a JSON pointer path, by joining one or more tokens to a base path.
88
- *
89
- * @param base - The base path (e.g. "schema.json#/definitions/person")
90
- * @param tokens - The token(s) to append (e.g. ["name", "first"])
91
- * @returns
92
- */
93
- static join(base: string, tokens: string | string[]): string;
94
- }
95
- //#endregion
96
- export { Pointer };
@@ -1,190 +0,0 @@
1
- import { JSONSchema } from "./types/index.js";
2
- import { ParserOptions } from "./options.js";
3
- import { JSONParserError, MissingPointerError, ParserError, ResolverError } from "./util/errors.js";
4
- import { Pointer } from "./pointer.js";
5
- import { $Refs } from "./refs.js";
6
- import { JSONSchema4Type, JSONSchema6Type, JSONSchema7Type } from "json-schema";
7
-
8
- //#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.6_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/ref.d.ts
9
- type $RefError = JSONParserError | ResolverError | ParserError | MissingPointerError;
10
- /**
11
- * This class represents a single JSON reference and its resolved value.
12
- *
13
- * @class
14
- */
15
- declare class $Ref<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>> {
16
- /**
17
- * The file path or URL of the referenced file.
18
- * This path is relative to the path of the main JSON schema file.
19
- *
20
- * This path does NOT contain document fragments (JSON pointers). It always references an ENTIRE file.
21
- * Use methods such as {@link $Ref#get}, {@link $Ref#resolve}, and {@link $Ref#exists} to get
22
- * specific JSON pointers within the file.
23
- *
24
- * @type {string}
25
- */
26
- path: undefined | string;
27
- /**
28
- * The resolved value of the JSON reference.
29
- * Can be any JSON type, not just objects. Unknown file types are represented as Buffers (byte arrays).
30
- *
31
- * @type {?*}
32
- */
33
- value: any;
34
- /**
35
- * The {@link $Refs} object that contains this {@link $Ref} object.
36
- *
37
- * @type {$Refs}
38
- */
39
- $refs: $Refs<S, O>;
40
- /**
41
- * Indicates the type of {@link $Ref#path} (e.g. "file", "http", etc.)
42
- */
43
- pathType: string | unknown;
44
- /**
45
- * Whether this document/resource should use JSON Schema 2019-09+ nested $id scope semantics.
46
- */
47
- dynamicIdScope: boolean;
48
- /**
49
- * List of all errors. Undefined if no errors.
50
- */
51
- errors: Array<$RefError>;
52
- constructor($refs: $Refs<S, O>);
53
- /**
54
- * Pushes an error to errors array.
55
- *
56
- * @param err - The error to be pushed
57
- * @returns
58
- */
59
- addError(err: $RefError): void;
60
- /**
61
- * Determines whether the given JSON reference exists within this {@link $Ref#value}.
62
- *
63
- * @param path - The full path being resolved, optionally with a JSON pointer in the hash
64
- * @param options
65
- * @returns
66
- */
67
- exists(path: string, options?: O): boolean;
68
- /**
69
- * Resolves the given JSON reference within this {@link $Ref#value} and returns the resolved value.
70
- *
71
- * @param path - The full path being resolved, optionally with a JSON pointer in the hash
72
- * @param options
73
- * @returns - Returns the resolved value
74
- */
75
- get(path: string, options?: O): any;
76
- /**
77
- * Resolves the given JSON reference within this {@link $Ref#value}.
78
- *
79
- * @param path - The full path being resolved, optionally with a JSON pointer in the hash
80
- * @param options
81
- * @param friendlyPath - The original user-specified path (used for error messages)
82
- * @param pathFromRoot - The path of `obj` from the schema root
83
- * @returns
84
- */
85
- resolve(path: string, options?: O, friendlyPath?: string, pathFromRoot?: string): Pointer<S, O> | null;
86
- /**
87
- * Sets the value of a nested property within this {@link $Ref#value}.
88
- * If the property, or any of its parents don't exist, they will be created.
89
- *
90
- * @param path - The full path of the property to set, optionally with a JSON pointer in the hash
91
- * @param value - The value to assign
92
- */
93
- set(path: string, value: JSONSchema4Type | JSONSchema6Type | JSONSchema7Type): void;
94
- /**
95
- * Determines whether the given value is a JSON reference.
96
- *
97
- * @param value - The value to inspect
98
- * @returns
99
- */
100
- static is$Ref(value: unknown): value is {
101
- $ref: string;
102
- length?: number;
103
- };
104
- /**
105
- * Determines whether the given value is an external JSON reference.
106
- *
107
- * @param value - The value to inspect
108
- * @returns
109
- */
110
- static isExternal$Ref(value: unknown): boolean;
111
- /**
112
- * Determines whether the given value is a JSON reference, and whether it is allowed by the options.
113
- * For example, if it references an external file, then options.resolve.external must be true.
114
- *
115
- * @param value - The value to inspect
116
- * @param options
117
- * @returns
118
- */
119
- static isAllowed$Ref<S extends object = JSONSchema>(value: unknown, options?: ParserOptions<S>): true | undefined;
120
- /**
121
- * Determines whether the given value is a JSON reference that "extends" its resolved value.
122
- * That is, it has extra properties (in addition to "$ref"), so rather than simply pointing to
123
- * an existing value, this $ref actually creates a NEW value that is a shallow copy of the resolved
124
- * value, plus the extra properties.
125
- *
126
- * @example: {
127
- person: {
128
- properties: {
129
- firstName: { type: string }
130
- lastName: { type: string }
131
- }
132
- }
133
- employee: {
134
- properties: {
135
- $ref: #/person/properties
136
- salary: { type: number }
137
- }
138
- }
139
- }
140
- * In this example, "employee" is an extended $ref, since it extends "person" with an additional
141
- * property (salary). The result is a NEW value that looks like this:
142
- *
143
- * {
144
- * properties: {
145
- * firstName: { type: string }
146
- * lastName: { type: string }
147
- * salary: { type: number }
148
- * }
149
- * }
150
- *
151
- * @param value - The value to inspect
152
- * @returns
153
- */
154
- static isExtended$Ref(value: unknown): boolean;
155
- /**
156
- * Returns the resolved value of a JSON Reference.
157
- * If necessary, the resolved value is merged with the JSON Reference to create a new object
158
- *
159
- * @example: {
160
- person: {
161
- properties: {
162
- firstName: { type: string }
163
- lastName: { type: string }
164
- }
165
- }
166
- employee: {
167
- properties: {
168
- $ref: #/person/properties
169
- salary: { type: number }
170
- }
171
- }
172
- } When "person" and "employee" are merged, you end up with the following object:
173
- *
174
- * {
175
- * properties: {
176
- * firstName: { type: string }
177
- * lastName: { type: string }
178
- * salary: { type: number }
179
- * }
180
- * }
181
- *
182
- * @param $ref - The JSON reference object (the one with the "$ref" property)
183
- * @param resolvedValue - The resolved value, which can be any type
184
- * @param options - The options
185
- * @returns - Returns the dereferenced value
186
- */
187
- static dereference<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>($ref: $Ref<S, O>, resolvedValue: S, options?: O): S;
188
- }
189
- //#endregion
190
- export { $Ref };
@@ -1,134 +0,0 @@
1
- import { JSONSchema } from "./types/index.js";
2
- import { ParserOptions } from "./options.js";
3
- import { $Ref } from "./ref.js";
4
- import { Pointer } from "./pointer.js";
5
- import { JSONSchema4Type, JSONSchema6Type, JSONSchema7Type } from "json-schema";
6
-
7
- //#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.6_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/refs.d.ts
8
- interface $RefsMap<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>> {
9
- [url: string]: $Ref<S, O>;
10
- }
11
- /**
12
- * 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.
13
- *
14
- * 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.
15
- *
16
- * See https://apidevtools.com/json-schema-ref-parser/docs/refs.html
17
- */
18
- declare class $Refs<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>> {
19
- /**
20
- * 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.
21
- *
22
- * See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#circular
23
- */
24
- circular: boolean;
25
- /**
26
- * Returns the paths/URLs of all the files in your schema (including the main schema file).
27
- *
28
- * See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#pathstypes
29
- *
30
- * @param types (optional) Optionally only return certain types of paths ("file", "http", etc.)
31
- */
32
- paths(...types: (string | string[])[]): string[];
33
- /**
34
- * Returns a map of paths/URLs and their correspond values.
35
- *
36
- * See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#valuestypes
37
- *
38
- * @param types (optional) Optionally only return values from certain locations ("file", "http", etc.)
39
- */
40
- values(...types: (string | string[])[]): S;
41
- /**
42
- * Returns `true` if the given path exists in the schema; otherwise, returns `false`
43
- *
44
- * See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#existsref
45
- *
46
- * @param $ref The JSON Reference path, optionally with a JSON Pointer in the hash
47
- */
48
- /**
49
- * Determines whether the given JSON reference exists.
50
- *
51
- * @param path - The path being resolved, optionally with a JSON pointer in the hash
52
- * @param [options]
53
- * @returns
54
- */
55
- exists(path: string, options: any): boolean;
56
- /**
57
- * Resolves the given JSON reference and returns the resolved value.
58
- *
59
- * @param path - The path being resolved, with a JSON pointer in the hash
60
- * @param [options]
61
- * @returns - Returns the resolved value
62
- */
63
- get(path: string, options?: O): JSONSchema4Type | JSONSchema6Type | JSONSchema7Type;
64
- /**
65
- * 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.
66
- *
67
- * @param path The JSON Reference path, optionally with a JSON Pointer in the hash
68
- * @param value The value to assign. Can be anything (object, string, number, etc.)
69
- */
70
- set(path: string, value: JSONSchema4Type | JSONSchema6Type | JSONSchema7Type): void;
71
- /**
72
- * Returns the specified {@link $Ref} object, or undefined.
73
- *
74
- * @param path - The path being resolved, optionally with a JSON pointer in the hash
75
- * @returns
76
- * @protected
77
- */
78
- _get$Ref(path: string): $Ref<S, O>;
79
- /**
80
- * Creates a new {@link $Ref} object and adds it to this {@link $Refs} object.
81
- *
82
- * @param path - The file path or URL of the referenced file
83
- */
84
- _add(path: string): $Ref<S, O>;
85
- _addAlias(path: string, value: S, pathType?: string | unknown, dynamicIdScope?: boolean): $Ref<S, O>;
86
- /**
87
- * Resolves the given JSON reference.
88
- *
89
- * @param path - The path being resolved, optionally with a JSON pointer in the hash
90
- * @param pathFromRoot - The path of `obj` from the schema root
91
- * @param [options]
92
- * @returns
93
- * @protected
94
- */
95
- _resolve(path: string, pathFromRoot: string, options?: O): Pointer<S, O> | null;
96
- /**
97
- * A map of paths/urls to {@link $Ref} objects
98
- *
99
- * @type {object}
100
- * @protected
101
- */
102
- _$refs: $RefsMap<S, O>;
103
- _aliases: $RefsMap<S, O>;
104
- /**
105
- * The {@link $Ref} object that is the root of the JSON schema.
106
- *
107
- * @type {$Ref}
108
- * @protected
109
- */
110
- _root$Ref: $Ref<S, O>;
111
- constructor();
112
- /**
113
- * Returns the paths of all the files/URLs that are referenced by the JSON schema,
114
- * including the schema itself.
115
- *
116
- * @param [types] - Only return paths of the given types ("file", "http", etc.)
117
- * @returns
118
- */
119
- /**
120
- * Returns the map of JSON references and their resolved values.
121
- *
122
- * @param [types] - Only return references of the given types ("file", "http", etc.)
123
- * @returns
124
- */
125
- /**
126
- * Returns a POJO (plain old JavaScript object) for serialization as JSON.
127
- *
128
- * @returns {object}
129
- */
130
- toJSON: (...types: (string | string[])[]) => S;
131
- private _getRef;
132
- }
133
- //#endregion
134
- export { $Refs };