@speclynx/apidom-reference 5.2.4 → 5.2.6
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.
- package/CHANGELOG.md +19 -0
- package/README.md +37 -14
- package/dist/apidom-reference.browser.js +1234 -596
- package/dist/apidom-reference.browser.min.js +1 -1
- package/package.json +29 -29
- package/src/bundle/strategies/arazzo-1/visitor.cjs +105 -22
- package/src/bundle/strategies/arazzo-1/visitor.mjs +107 -24
- package/src/bundle/strategies/openapi-3-1/visitor.cjs +197 -47
- package/src/bundle/strategies/openapi-3-1/visitor.mjs +200 -50
- package/src/bundle/util.cjs +57 -2
- package/src/bundle/util.mjs +52 -0
- package/src/dereference/strategies/arazzo-1/index.cjs +20 -17
- package/src/dereference/strategies/arazzo-1/index.mjs +14 -11
- package/src/dereference/strategies/arazzo-1/selectors/$anchor.cjs +6 -0
- package/src/dereference/strategies/arazzo-1/selectors/$anchor.mjs +1 -1
- package/src/dereference/strategies/arazzo-1/selectors/uri.cjs +6 -0
- package/src/dereference/strategies/arazzo-1/selectors/uri.mjs +1 -1
- package/src/dereference/strategies/arazzo-1/source-descriptions.cjs +65 -42
- package/src/dereference/strategies/arazzo-1/source-descriptions.mjs +64 -42
- package/src/dereference/strategies/arazzo-1/util.cjs +6 -0
- package/src/dereference/strategies/arazzo-1/util.mjs +1 -1
- package/src/dereference/strategies/arazzo-1/visitor.cjs +97 -35
- package/src/dereference/strategies/arazzo-1/visitor.mjs +101 -39
- package/src/dereference/strategies/openapi-3-1/index.cjs +2 -1
- package/src/dereference/strategies/openapi-3-1/index.mjs +3 -1
- package/src/dereference/strategies/openapi-3-1/selectors/$anchor.cjs +16 -4
- package/src/dereference/strategies/openapi-3-1/selectors/$anchor.mjs +14 -3
- package/src/dereference/strategies/openapi-3-1/selectors/json-pointer.cjs +29 -0
- package/src/dereference/strategies/openapi-3-1/selectors/json-pointer.mjs +22 -0
- package/src/dereference/strategies/openapi-3-1/selectors/uri.cjs +54 -27
- package/src/dereference/strategies/openapi-3-1/selectors/uri.mjs +51 -27
- package/src/dereference/strategies/openapi-3-1/util.cjs +75 -14
- package/src/dereference/strategies/openapi-3-1/util.mjs +68 -14
- package/src/dereference/strategies/openapi-3-1/visitor.cjs +85 -9
- package/src/dereference/strategies/openapi-3-1/visitor.mjs +89 -13
- package/src/util/url.cjs +35 -2
- package/src/util/url.mjs +32 -0
- package/types/apidom-reference.d.ts +12 -0
- package/types/bundle/strategies/arazzo-1/index.d.ts +1 -1
- package/types/bundle/strategies/arazzo-1/visitor.d.ts +51 -6
- package/types/bundle/strategies/openapi-3-1/index.d.ts +1 -1
- package/types/bundle/strategies/openapi-3-1/visitor.d.ts +59 -3
- package/types/bundle/util.d.ts +39 -0
- package/types/dereference/strategies/arazzo-1/selectors/$anchor.d.ts +1 -1
- package/types/dereference/strategies/arazzo-1/selectors/uri.d.ts +1 -1
- package/types/dereference/strategies/arazzo-1/util.d.ts +1 -1
- package/types/dereference/strategies/arazzo-1/visitor.d.ts +17 -1
- package/types/dereference/strategies/openapi-3-1/selectors/$anchor.d.ts +8 -0
- package/types/dereference/strategies/openapi-3-1/selectors/json-pointer.d.ts +9 -0
- package/types/dereference/strategies/openapi-3-1/selectors/uri.d.ts +37 -4
- package/types/dereference/strategies/openapi-3-1/util.d.ts +53 -2
- package/types/dereference/strategies/openapi-3-1/visitor.d.ts +17 -1
- package/types/util/url.d.ts +10 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Element } from '@speclynx/apidom-datamodel';
|
|
2
2
|
import { type Path } from '@speclynx/apidom-traverse';
|
|
3
|
+
import { type Schema$idIndex } from './selectors/uri.ts';
|
|
3
4
|
import Reference from '../../../Reference.ts';
|
|
4
5
|
import { AncestorLineage } from '../../util.ts';
|
|
5
6
|
import type { ReferenceOptions } from '../../../options/index.ts';
|
|
@@ -11,8 +12,10 @@ export interface OpenAPI3_1DereferenceVisitorOptions {
|
|
|
11
12
|
readonly options: ReferenceOptions;
|
|
12
13
|
readonly indirections?: Element[];
|
|
13
14
|
readonly refractCache?: WeakMap<Element, Element>;
|
|
15
|
+
readonly schema$idIndex?: Schema$idIndex;
|
|
14
16
|
readonly ancestors?: AncestorLineage<Element>;
|
|
15
17
|
readonly visited?: WeakSet<Element>;
|
|
18
|
+
readonly ancestorSchema$ids?: string[];
|
|
16
19
|
}
|
|
17
20
|
/**
|
|
18
21
|
* @public
|
|
@@ -22,14 +25,27 @@ declare class OpenAPI3_1DereferenceVisitor {
|
|
|
22
25
|
protected readonly reference: Reference;
|
|
23
26
|
protected readonly options: ReferenceOptions;
|
|
24
27
|
protected readonly refractCache: WeakMap<Element, Element>;
|
|
28
|
+
/**
|
|
29
|
+
* Index of `$id`-bearing schemas per document, shared across nested visitors
|
|
30
|
+
* of a single dereference run so it never outlives mutations of the documents.
|
|
31
|
+
*/
|
|
32
|
+
protected readonly schema$idIndex: Schema$idIndex;
|
|
25
33
|
protected readonly visited: WeakSet<Element>;
|
|
34
|
+
/**
|
|
35
|
+
* `$id`s of the JSON Schema elements enclosing the traversal root within its
|
|
36
|
+
* document (outermost first). Empty when the root is the document itself; a
|
|
37
|
+
* nested visitor traversing a fragment is seeded with the `$id`s of the
|
|
38
|
+
* schemas the fragment sits under, so the `$ref`s and `$id`s within resolve
|
|
39
|
+
* against the same base as they would from the document root.
|
|
40
|
+
*/
|
|
41
|
+
protected readonly ancestorSchema$ids: string[];
|
|
26
42
|
/**
|
|
27
43
|
* Tracks element ancestors across dive-deep traversal boundaries.
|
|
28
44
|
* Used for cycle detection: if a referenced element is found in
|
|
29
45
|
* the ancestor lineage, a circular reference is detected.
|
|
30
46
|
*/
|
|
31
47
|
protected readonly ancestors: AncestorLineage<Element>;
|
|
32
|
-
constructor({ reference, options, indirections, refractCache, ancestors, visited, }: OpenAPI3_1DereferenceVisitorOptions);
|
|
48
|
+
constructor({ reference, options, indirections, refractCache, schema$idIndex, ancestors, visited, ancestorSchema$ids, }: OpenAPI3_1DereferenceVisitorOptions);
|
|
33
49
|
protected toAncestorLineage(path: Path<Element>): [AncestorLineage<Element>, Set<Element>];
|
|
34
50
|
protected toBaseURI(uri: string): string;
|
|
35
51
|
protected toReference(uri: string): Promise<Reference>;
|
package/types/util/url.d.ts
CHANGED
|
@@ -96,6 +96,16 @@ export declare const cwd: () => string;
|
|
|
96
96
|
* @public
|
|
97
97
|
*/
|
|
98
98
|
export declare const resolve: (from: string, to: string) => string;
|
|
99
|
+
/**
|
|
100
|
+
* Computes the URI reference that resolves to `to` against `from` — the inverse
|
|
101
|
+
* of `resolve`: `resolve(from, relative(from, to)) === to`. The reference is
|
|
102
|
+
* relative to the directory of `from` (its last path segment is the document,
|
|
103
|
+
* not a directory). When the two URIs differ in scheme or authority, or either
|
|
104
|
+
* has no hierarchical path (e.g. a URN), no relative form exists and `to` is
|
|
105
|
+
* returned unchanged.
|
|
106
|
+
* @public
|
|
107
|
+
*/
|
|
108
|
+
export declare const relative: (from: string, to: string) => string;
|
|
99
109
|
/**
|
|
100
110
|
* Sanitizes/Encodes URI to it's url encoded form.
|
|
101
111
|
*
|