@swagger-api/apidom-ast 1.0.0-beta.8 → 1.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +184 -0
- package/dist/apidom-ast.browser.js +7334 -7491
- package/dist/apidom-ast.browser.min.js +1 -1
- package/package.json +6 -6
- package/src/Node.cjs +19 -4
- package/src/Node.mjs +19 -4
- package/src/index.cjs +1 -3
- package/src/index.mjs +1 -1
- package/src/predicates.cjs +1 -13
- package/src/predicates.mjs +0 -10
- package/src/traversal/visitor.cjs +12 -2
- package/src/traversal/visitor.mjs +12 -2
- package/src/yaml/errors/YamlTagError.cjs +12 -2
- package/src/yaml/errors/YamlTagError.mjs +12 -2
- package/src/yaml/schemas/failsafe/index.cjs +12 -3
- package/src/yaml/schemas/failsafe/index.mjs +12 -3
- package/types/apidom-ast.d.ts +27 -15
|
@@ -351,7 +351,8 @@ visitor, {
|
|
|
351
351
|
nodeTypeGetter = getNodeType,
|
|
352
352
|
nodePredicate = isNode,
|
|
353
353
|
nodeCloneFn = cloneNode,
|
|
354
|
-
detectCycles = true
|
|
354
|
+
detectCycles = true,
|
|
355
|
+
detectCyclesCallback = null
|
|
355
356
|
} = {}) => {
|
|
356
357
|
const visitorKeys = keyMap || {};
|
|
357
358
|
let stack;
|
|
@@ -423,6 +424,10 @@ visitor, {
|
|
|
423
424
|
|
|
424
425
|
// cycle detected; skipping over a sub-tree to avoid recursion
|
|
425
426
|
if (detectCycles && ancestors.includes(node)) {
|
|
427
|
+
if (typeof detectCyclesCallback === 'function') {
|
|
428
|
+
// @ts-ignore
|
|
429
|
+
detectCyclesCallback(node, key, parent, path, ancestors);
|
|
430
|
+
}
|
|
426
431
|
path.pop();
|
|
427
432
|
continue;
|
|
428
433
|
}
|
|
@@ -525,7 +530,8 @@ visitor, {
|
|
|
525
530
|
nodeTypeGetter = getNodeType,
|
|
526
531
|
nodePredicate = isNode,
|
|
527
532
|
nodeCloneFn = cloneNode,
|
|
528
|
-
detectCycles = true
|
|
533
|
+
detectCycles = true,
|
|
534
|
+
detectCyclesCallback = null
|
|
529
535
|
} = {}) => {
|
|
530
536
|
const visitorKeys = keyMap || {};
|
|
531
537
|
let stack;
|
|
@@ -596,6 +602,10 @@ visitor, {
|
|
|
596
602
|
|
|
597
603
|
// cycle detected; skipping over a sub-tree to avoid recursion
|
|
598
604
|
if (detectCycles && ancestors.includes(node)) {
|
|
605
|
+
if (typeof detectCyclesCallback === 'function') {
|
|
606
|
+
// @ts-ignore
|
|
607
|
+
detectCyclesCallback(node, key, parent, path, ancestors);
|
|
608
|
+
}
|
|
599
609
|
path.pop();
|
|
600
610
|
continue;
|
|
601
611
|
}
|
|
@@ -15,7 +15,12 @@ class YamlTagError extends _YamlSchemaError.default {
|
|
|
15
15
|
specificTagName;
|
|
16
16
|
explicitTagName;
|
|
17
17
|
tagKind;
|
|
18
|
-
|
|
18
|
+
tagStartPositionRow;
|
|
19
|
+
tagStartPositionColumn;
|
|
20
|
+
tagStartPositionIndex;
|
|
21
|
+
tagEndPositionRow;
|
|
22
|
+
tagEndPositionColumn;
|
|
23
|
+
tagEndPositionIndex;
|
|
19
24
|
nodeCanonicalContent;
|
|
20
25
|
node;
|
|
21
26
|
constructor(message, structuredOptions) {
|
|
@@ -24,7 +29,12 @@ class YamlTagError extends _YamlSchemaError.default {
|
|
|
24
29
|
this.specificTagName = structuredOptions.specificTagName;
|
|
25
30
|
this.explicitTagName = structuredOptions.explicitTagName;
|
|
26
31
|
this.tagKind = structuredOptions.tagKind;
|
|
27
|
-
this.
|
|
32
|
+
this.tagStartPositionRow = structuredOptions.tagStartPositionRow;
|
|
33
|
+
this.tagStartPositionColumn = structuredOptions.tagStartPositionColumn;
|
|
34
|
+
this.tagStartPositionIndex = structuredOptions.tagStartPositionIndex;
|
|
35
|
+
this.tagEndPositionRow = structuredOptions.tagEndPositionRow;
|
|
36
|
+
this.tagEndPositionColumn = structuredOptions.tagEndPositionColumn;
|
|
37
|
+
this.tagEndPositionIndex = structuredOptions.tagEndPositionIndex;
|
|
28
38
|
this.nodeCanonicalContent = structuredOptions.nodeCanonicalContent;
|
|
29
39
|
this.node = structuredOptions.node;
|
|
30
40
|
}
|
|
@@ -9,7 +9,12 @@ class YamlTagError extends YamlSchemaError {
|
|
|
9
9
|
specificTagName;
|
|
10
10
|
explicitTagName;
|
|
11
11
|
tagKind;
|
|
12
|
-
|
|
12
|
+
tagStartPositionRow;
|
|
13
|
+
tagStartPositionColumn;
|
|
14
|
+
tagStartPositionIndex;
|
|
15
|
+
tagEndPositionRow;
|
|
16
|
+
tagEndPositionColumn;
|
|
17
|
+
tagEndPositionIndex;
|
|
13
18
|
nodeCanonicalContent;
|
|
14
19
|
node;
|
|
15
20
|
constructor(message, structuredOptions) {
|
|
@@ -18,7 +23,12 @@ class YamlTagError extends YamlSchemaError {
|
|
|
18
23
|
this.specificTagName = structuredOptions.specificTagName;
|
|
19
24
|
this.explicitTagName = structuredOptions.explicitTagName;
|
|
20
25
|
this.tagKind = structuredOptions.tagKind;
|
|
21
|
-
this.
|
|
26
|
+
this.tagStartPositionRow = structuredOptions.tagStartPositionRow;
|
|
27
|
+
this.tagStartPositionColumn = structuredOptions.tagStartPositionColumn;
|
|
28
|
+
this.tagStartPositionIndex = structuredOptions.tagStartPositionIndex;
|
|
29
|
+
this.tagEndPositionRow = structuredOptions.tagEndPositionRow;
|
|
30
|
+
this.tagEndPositionColumn = structuredOptions.tagEndPositionColumn;
|
|
31
|
+
this.tagEndPositionIndex = structuredOptions.tagEndPositionIndex;
|
|
22
32
|
this.nodeCanonicalContent = structuredOptions.nodeCanonicalContent;
|
|
23
33
|
this.node = structuredOptions.node;
|
|
24
34
|
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.default = void 0;
|
|
6
|
-
var _ramda = require("ramda");
|
|
7
6
|
var _YamlTagError = _interopRequireDefault(require("../../errors/YamlTagError.cjs"));
|
|
8
7
|
var _YamlTag = require("../../nodes/YamlTag.cjs");
|
|
9
8
|
var _GenericMapping = _interopRequireDefault(require("./GenericMapping.cjs"));
|
|
@@ -87,7 +86,12 @@ class FailsafeSchema {
|
|
|
87
86
|
specificTagName,
|
|
88
87
|
explicitTagName: node.tag.explicitName,
|
|
89
88
|
tagKind: node.tag.kind,
|
|
90
|
-
|
|
89
|
+
tagStartPositionRow: node.tag.startPositionRow,
|
|
90
|
+
tagStartPositionColumn: node.tag.startPositionColumn,
|
|
91
|
+
tagStartPositionIndex: node.tag.startIndex,
|
|
92
|
+
tagEndPositionRow: node.tag.endPositionRow,
|
|
93
|
+
tagEndPositionColumn: node.tag.endPositionColumn,
|
|
94
|
+
tagEndPositionIndex: node.tag.endIndex,
|
|
91
95
|
node: node.clone()
|
|
92
96
|
});
|
|
93
97
|
}
|
|
@@ -98,7 +102,12 @@ class FailsafeSchema {
|
|
|
98
102
|
specificTagName,
|
|
99
103
|
explicitTagName: node.tag.explicitName,
|
|
100
104
|
tagKind: node.tag.kind,
|
|
101
|
-
|
|
105
|
+
tagStartPositionRow: node.tag.startPositionRow,
|
|
106
|
+
tagStartPositionColumn: node.tag.startPositionColumn,
|
|
107
|
+
tagStartPositionIndex: node.tag.startIndex,
|
|
108
|
+
tagEndPositionRow: node.tag.endPositionRow,
|
|
109
|
+
tagEndPositionColumn: node.tag.endPositionColumn,
|
|
110
|
+
tagEndPositionIndex: node.tag.endIndex,
|
|
102
111
|
nodeCanonicalContent: canonicalNode.content,
|
|
103
112
|
node: node.clone()
|
|
104
113
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { clone } from 'ramda';
|
|
2
1
|
import YamlTagError from "../../errors/YamlTagError.mjs";
|
|
3
2
|
import { YamlNodeKind } from "../../nodes/YamlTag.mjs";
|
|
4
3
|
import GenericMappingTag from "./GenericMapping.mjs";
|
|
@@ -82,7 +81,12 @@ class FailsafeSchema {
|
|
|
82
81
|
specificTagName,
|
|
83
82
|
explicitTagName: node.tag.explicitName,
|
|
84
83
|
tagKind: node.tag.kind,
|
|
85
|
-
|
|
84
|
+
tagStartPositionRow: node.tag.startPositionRow,
|
|
85
|
+
tagStartPositionColumn: node.tag.startPositionColumn,
|
|
86
|
+
tagStartPositionIndex: node.tag.startIndex,
|
|
87
|
+
tagEndPositionRow: node.tag.endPositionRow,
|
|
88
|
+
tagEndPositionColumn: node.tag.endPositionColumn,
|
|
89
|
+
tagEndPositionIndex: node.tag.endIndex,
|
|
86
90
|
node: node.clone()
|
|
87
91
|
});
|
|
88
92
|
}
|
|
@@ -93,7 +97,12 @@ class FailsafeSchema {
|
|
|
93
97
|
specificTagName,
|
|
94
98
|
explicitTagName: node.tag.explicitName,
|
|
95
99
|
tagKind: node.tag.kind,
|
|
96
|
-
|
|
100
|
+
tagStartPositionRow: node.tag.startPositionRow,
|
|
101
|
+
tagStartPositionColumn: node.tag.startPositionColumn,
|
|
102
|
+
tagStartPositionIndex: node.tag.startIndex,
|
|
103
|
+
tagEndPositionRow: node.tag.endPositionRow,
|
|
104
|
+
tagEndPositionColumn: node.tag.endPositionColumn,
|
|
105
|
+
tagEndPositionIndex: node.tag.endIndex,
|
|
97
106
|
nodeCanonicalContent: canonicalNode.content,
|
|
98
107
|
node: node.clone()
|
|
99
108
|
});
|
package/types/apidom-ast.d.ts
CHANGED
|
@@ -116,16 +116,6 @@ export declare const isNode: (node: any) => boolean;
|
|
|
116
116
|
*/
|
|
117
117
|
export declare const isParseResult: (node: unknown) => node is ParseResult;
|
|
118
118
|
|
|
119
|
-
/**
|
|
120
|
-
* @public
|
|
121
|
-
*/
|
|
122
|
-
export declare const isPoint: (node: unknown) => node is Point;
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* @public
|
|
126
|
-
*/
|
|
127
|
-
export declare const isPosition: (node: unknown) => node is Position;
|
|
128
|
-
|
|
129
119
|
/**
|
|
130
120
|
* @public
|
|
131
121
|
*/
|
|
@@ -367,8 +357,13 @@ declare class Node_2 {
|
|
|
367
357
|
readonly type: string;
|
|
368
358
|
readonly isMissing: boolean;
|
|
369
359
|
children: unknown[];
|
|
370
|
-
|
|
371
|
-
|
|
360
|
+
startPositionRow?: number;
|
|
361
|
+
startPositionColumn?: number;
|
|
362
|
+
startIndex?: number;
|
|
363
|
+
endPositionRow?: number;
|
|
364
|
+
endPositionColumn?: number;
|
|
365
|
+
endIndex?: number;
|
|
366
|
+
constructor({ children, isMissing, startPositionRow, startPositionColumn, startIndex, endPositionRow, endPositionColumn, endIndex, }?: NodeOptions);
|
|
372
367
|
clone(): Node_2;
|
|
373
368
|
}
|
|
374
369
|
export { Node_2 as Node }
|
|
@@ -380,6 +375,12 @@ export declare interface NodeOptions {
|
|
|
380
375
|
readonly children?: unknown[];
|
|
381
376
|
readonly position?: Position;
|
|
382
377
|
readonly isMissing?: boolean;
|
|
378
|
+
readonly startPositionRow?: number;
|
|
379
|
+
readonly startPositionColumn?: number;
|
|
380
|
+
readonly startIndex?: number;
|
|
381
|
+
readonly endPositionRow?: number;
|
|
382
|
+
readonly endPositionColumn?: number;
|
|
383
|
+
readonly endIndex?: number;
|
|
383
384
|
}
|
|
384
385
|
|
|
385
386
|
/**
|
|
@@ -525,7 +526,7 @@ export { PositionOptions_2 as PositionOptions }
|
|
|
525
526
|
*
|
|
526
527
|
* @public
|
|
527
528
|
*/
|
|
528
|
-
export declare const visit: (root: any, visitor: any, { keyMap, state, breakSymbol, deleteNodeSymbol, skipVisitingNodeSymbol, visitFnGetter, nodeTypeGetter, nodePredicate, nodeCloneFn, detectCycles, }?: {
|
|
529
|
+
export declare const visit: (root: any, visitor: any, { keyMap, state, breakSymbol, deleteNodeSymbol, skipVisitingNodeSymbol, visitFnGetter, nodeTypeGetter, nodePredicate, nodeCloneFn, detectCycles, detectCyclesCallback, }?: {
|
|
529
530
|
keyMap?: null | undefined;
|
|
530
531
|
state?: {} | undefined;
|
|
531
532
|
breakSymbol?: {} | undefined;
|
|
@@ -536,6 +537,7 @@ export declare const visit: (root: any, visitor: any, { keyMap, state, breakSymb
|
|
|
536
537
|
nodePredicate?: ((node: any) => boolean) | undefined;
|
|
537
538
|
nodeCloneFn?: ((node: any) => any) | undefined;
|
|
538
539
|
detectCycles?: boolean | undefined;
|
|
540
|
+
detectCyclesCallback?: null | undefined;
|
|
539
541
|
}) => any;
|
|
540
542
|
|
|
541
543
|
/**
|
|
@@ -797,7 +799,12 @@ export declare class YamlTagError extends YamlSchemaError {
|
|
|
797
799
|
readonly specificTagName: string;
|
|
798
800
|
readonly explicitTagName: string;
|
|
799
801
|
readonly tagKind: string;
|
|
800
|
-
readonly
|
|
802
|
+
readonly tagStartPositionRow?: number;
|
|
803
|
+
readonly tagStartPositionColumn?: number;
|
|
804
|
+
readonly tagStartPositionIndex?: number;
|
|
805
|
+
readonly tagEndPositionRow?: number;
|
|
806
|
+
readonly tagEndPositionColumn?: number;
|
|
807
|
+
readonly tagEndPositionIndex?: number;
|
|
801
808
|
readonly nodeCanonicalContent?: string;
|
|
802
809
|
readonly node?: unknown;
|
|
803
810
|
constructor(message?: string, structuredOptions?: YamlTagErrorOptions);
|
|
@@ -810,7 +817,12 @@ export declare interface YamlTagErrorOptions<T extends Node_2 = Node_2> extends
|
|
|
810
817
|
readonly specificTagName: string;
|
|
811
818
|
readonly explicitTagName: string;
|
|
812
819
|
readonly tagKind: string;
|
|
813
|
-
readonly
|
|
820
|
+
readonly tagStartPositionRow?: number;
|
|
821
|
+
readonly tagStartPositionColumn?: number;
|
|
822
|
+
readonly tagStartPositionIndex?: number;
|
|
823
|
+
readonly tagEndPositionRow?: number;
|
|
824
|
+
readonly tagEndPositionColumn?: number;
|
|
825
|
+
readonly tagEndPositionIndex?: number;
|
|
814
826
|
readonly nodeCanonicalContent?: string;
|
|
815
827
|
readonly node?: T;
|
|
816
828
|
}
|