cdklabs-projen-project-types 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitattributes +22 -0
- package/.jsii +421 -0
- package/API.md +14712 -0
- package/LICENSE +202 -0
- package/README.md +1 -0
- package/lib/cdk.d.ts +40 -0
- package/lib/cdk.js +68 -0
- package/lib/cdklabs.d.ts +45 -0
- package/lib/cdklabs.js +101 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +15 -0
- package/lib/private.d.ts +13 -0
- package/lib/private.js +25 -0
- package/node_modules/yaml/LICENSE +13 -0
- package/node_modules/yaml/README.md +143 -0
- package/node_modules/yaml/browser/dist/compose/compose-collection.js +59 -0
- package/node_modules/yaml/browser/dist/compose/compose-doc.js +40 -0
- package/node_modules/yaml/browser/dist/compose/compose-node.js +92 -0
- package/node_modules/yaml/browser/dist/compose/compose-scalar.js +80 -0
- package/node_modules/yaml/browser/dist/compose/composer.js +217 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +110 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +194 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +45 -0
- package/node_modules/yaml/browser/dist/compose/resolve-end.js +37 -0
- package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +200 -0
- package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +223 -0
- package/node_modules/yaml/browser/dist/compose/resolve-props.js +134 -0
- package/node_modules/yaml/browser/dist/compose/util-contains-newline.js +34 -0
- package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +27 -0
- package/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +15 -0
- package/node_modules/yaml/browser/dist/compose/util-map-includes.js +17 -0
- package/node_modules/yaml/browser/dist/doc/Document.js +332 -0
- package/node_modules/yaml/browser/dist/doc/anchors.js +72 -0
- package/node_modules/yaml/browser/dist/doc/applyReviver.js +54 -0
- package/node_modules/yaml/browser/dist/doc/createNode.js +85 -0
- package/node_modules/yaml/browser/dist/doc/directives.js +169 -0
- package/node_modules/yaml/browser/dist/errors.js +57 -0
- package/node_modules/yaml/browser/dist/index.js +17 -0
- package/node_modules/yaml/browser/dist/log.js +14 -0
- package/node_modules/yaml/browser/dist/node_modules/tslib/tslib.es6.js +164 -0
- package/node_modules/yaml/browser/dist/nodes/Alias.js +94 -0
- package/node_modules/yaml/browser/dist/nodes/Collection.js +147 -0
- package/node_modules/yaml/browser/dist/nodes/Node.js +48 -0
- package/node_modules/yaml/browser/dist/nodes/Pair.js +36 -0
- package/node_modules/yaml/browser/dist/nodes/Scalar.js +23 -0
- package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +116 -0
- package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +97 -0
- package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +104 -0
- package/node_modules/yaml/browser/dist/nodes/toJS.js +37 -0
- package/node_modules/yaml/browser/dist/parse/cst-scalar.js +214 -0
- package/node_modules/yaml/browser/dist/parse/cst-stringify.js +61 -0
- package/node_modules/yaml/browser/dist/parse/cst-visit.js +97 -0
- package/node_modules/yaml/browser/dist/parse/cst.js +98 -0
- package/node_modules/yaml/browser/dist/parse/lexer.js +701 -0
- package/node_modules/yaml/browser/dist/parse/line-counter.js +39 -0
- package/node_modules/yaml/browser/dist/parse/parser.js +950 -0
- package/node_modules/yaml/browser/dist/public-api.js +99 -0
- package/node_modules/yaml/browser/dist/schema/Schema.js +38 -0
- package/node_modules/yaml/browser/dist/schema/common/map.js +42 -0
- package/node_modules/yaml/browser/dist/schema/common/null.js +15 -0
- package/node_modules/yaml/browser/dist/schema/common/seq.js +33 -0
- package/node_modules/yaml/browser/dist/schema/common/string.js +14 -0
- package/node_modules/yaml/browser/dist/schema/core/bool.js +19 -0
- package/node_modules/yaml/browser/dist/schema/core/float.js +43 -0
- package/node_modules/yaml/browser/dist/schema/core/int.js +38 -0
- package/node_modules/yaml/browser/dist/schema/core/schema.js +23 -0
- package/node_modules/yaml/browser/dist/schema/json/schema.js +62 -0
- package/node_modules/yaml/browser/dist/schema/tags.js +83 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +66 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +26 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +46 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +71 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +73 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +77 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +37 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +92 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +101 -0
- package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +135 -0
- package/node_modules/yaml/browser/dist/stringify/stringify.js +124 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +151 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyComment.js +20 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +85 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +24 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +150 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyString.js +319 -0
- package/node_modules/yaml/browser/dist/util.js +9 -0
- package/node_modules/yaml/browser/dist/visit.js +233 -0
- package/node_modules/yaml/browser/index.js +5 -0
- package/node_modules/yaml/browser/package.json +3 -0
- package/node_modules/yaml/dist/compose/compose-collection.d.ts +5 -0
- package/node_modules/yaml/dist/compose/compose-collection.js +61 -0
- package/node_modules/yaml/dist/compose/compose-doc.d.ts +6 -0
- package/node_modules/yaml/dist/compose/compose-doc.js +42 -0
- package/node_modules/yaml/dist/compose/compose-node.d.ts +27 -0
- package/node_modules/yaml/dist/compose/compose-node.js +95 -0
- package/node_modules/yaml/dist/compose/compose-scalar.d.ts +5 -0
- package/node_modules/yaml/dist/compose/compose-scalar.js +82 -0
- package/node_modules/yaml/dist/compose/composer.d.ts +62 -0
- package/node_modules/yaml/dist/compose/composer.js +221 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.js +112 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +10 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.js +196 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +5 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.js +47 -0
- package/node_modules/yaml/dist/compose/resolve-end.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-end.js +39 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.js +202 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +10 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +225 -0
- package/node_modules/yaml/dist/compose/resolve-props.d.ts +22 -0
- package/node_modules/yaml/dist/compose/resolve-props.js +136 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +29 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +3 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
- package/node_modules/yaml/dist/compose/util-map-includes.d.ts +4 -0
- package/node_modules/yaml/dist/compose/util-map-includes.js +19 -0
- package/node_modules/yaml/dist/doc/Document.d.ts +139 -0
- package/node_modules/yaml/dist/doc/Document.js +334 -0
- package/node_modules/yaml/dist/doc/anchors.d.ts +24 -0
- package/node_modules/yaml/dist/doc/anchors.js +77 -0
- package/node_modules/yaml/dist/doc/applyReviver.d.ts +9 -0
- package/node_modules/yaml/dist/doc/applyReviver.js +56 -0
- package/node_modules/yaml/dist/doc/createNode.d.ts +17 -0
- package/node_modules/yaml/dist/doc/createNode.js +87 -0
- package/node_modules/yaml/dist/doc/directives.d.ts +49 -0
- package/node_modules/yaml/dist/doc/directives.js +171 -0
- package/node_modules/yaml/dist/errors.d.ts +21 -0
- package/node_modules/yaml/dist/errors.js +62 -0
- package/node_modules/yaml/dist/index.d.ts +21 -0
- package/node_modules/yaml/dist/index.js +50 -0
- package/node_modules/yaml/dist/log.d.ts +3 -0
- package/node_modules/yaml/dist/log.js +17 -0
- package/node_modules/yaml/dist/nodes/Alias.d.ts +28 -0
- package/node_modules/yaml/dist/nodes/Alias.js +96 -0
- package/node_modules/yaml/dist/nodes/Collection.d.ts +73 -0
- package/node_modules/yaml/dist/nodes/Collection.js +151 -0
- package/node_modules/yaml/dist/nodes/Node.d.ts +59 -0
- package/node_modules/yaml/dist/nodes/Node.js +66 -0
- package/node_modules/yaml/dist/nodes/Pair.d.ts +21 -0
- package/node_modules/yaml/dist/nodes/Pair.js +39 -0
- package/node_modules/yaml/dist/nodes/Scalar.d.ts +42 -0
- package/node_modules/yaml/dist/nodes/Scalar.js +26 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +47 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.js +119 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +58 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.js +99 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +4 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.js +106 -0
- package/node_modules/yaml/dist/nodes/toJS.d.ts +30 -0
- package/node_modules/yaml/dist/nodes/toJS.js +39 -0
- package/node_modules/yaml/dist/options.d.ts +338 -0
- package/node_modules/yaml/dist/parse/cst-scalar.d.ts +64 -0
- package/node_modules/yaml/dist/parse/cst-scalar.js +218 -0
- package/node_modules/yaml/dist/parse/cst-stringify.d.ts +8 -0
- package/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
- package/node_modules/yaml/dist/parse/cst-visit.d.ts +39 -0
- package/node_modules/yaml/dist/parse/cst-visit.js +99 -0
- package/node_modules/yaml/dist/parse/cst.d.ts +106 -0
- package/node_modules/yaml/dist/parse/cst.js +112 -0
- package/node_modules/yaml/dist/parse/lexer.d.ts +87 -0
- package/node_modules/yaml/dist/parse/lexer.js +703 -0
- package/node_modules/yaml/dist/parse/line-counter.d.ts +22 -0
- package/node_modules/yaml/dist/parse/line-counter.js +41 -0
- package/node_modules/yaml/dist/parse/parser.d.ts +84 -0
- package/node_modules/yaml/dist/parse/parser.js +954 -0
- package/node_modules/yaml/dist/public-api.d.ts +43 -0
- package/node_modules/yaml/dist/public-api.js +104 -0
- package/node_modules/yaml/dist/schema/Schema.d.ts +18 -0
- package/node_modules/yaml/dist/schema/Schema.js +40 -0
- package/node_modules/yaml/dist/schema/common/map.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/map.js +44 -0
- package/node_modules/yaml/dist/schema/common/null.d.ts +4 -0
- package/node_modules/yaml/dist/schema/common/null.js +17 -0
- package/node_modules/yaml/dist/schema/common/seq.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/seq.js +35 -0
- package/node_modules/yaml/dist/schema/common/string.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/string.js +16 -0
- package/node_modules/yaml/dist/schema/core/bool.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/bool.js +21 -0
- package/node_modules/yaml/dist/schema/core/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/float.js +47 -0
- package/node_modules/yaml/dist/schema/core/int.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/int.js +42 -0
- package/node_modules/yaml/dist/schema/core/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/core/schema.js +25 -0
- package/node_modules/yaml/dist/schema/json/schema.d.ts +2 -0
- package/node_modules/yaml/dist/schema/json/schema.js +64 -0
- package/node_modules/yaml/dist/schema/json-schema.d.ts +69 -0
- package/node_modules/yaml/dist/schema/tags.d.ts +40 -0
- package/node_modules/yaml/dist/schema/tags.js +86 -0
- package/node_modules/yaml/dist/schema/types.d.ts +82 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +2 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +68 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +7 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +5 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +25 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +76 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +10 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +81 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.js +39 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +26 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.js +95 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +6 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +34 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.js +140 -0
- package/node_modules/yaml/dist/stringify/stringify.d.ts +21 -0
- package/node_modules/yaml/dist/stringify/stringify.js +127 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +17 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.js +153 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.d.ts +10 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.js +24 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +3 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.js +87 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +2 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.js +26 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +3 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.js +152 -0
- package/node_modules/yaml/dist/stringify/stringifyString.d.ts +9 -0
- package/node_modules/yaml/dist/stringify/stringifyString.js +321 -0
- package/node_modules/yaml/dist/test-events.d.ts +4 -0
- package/node_modules/yaml/dist/test-events.js +134 -0
- package/node_modules/yaml/dist/util.d.ts +9 -0
- package/node_modules/yaml/dist/util.js +24 -0
- package/node_modules/yaml/dist/visit.d.ts +102 -0
- package/node_modules/yaml/dist/visit.js +236 -0
- package/node_modules/yaml/package.json +94 -0
- package/node_modules/yaml/util.d.ts +3 -0
- package/node_modules/yaml/util.js +2 -0
- package/package.json +126 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Node = require('../nodes/Node.js');
|
|
4
|
+
var visit = require('../visit.js');
|
|
5
|
+
|
|
6
|
+
const escapeChars = {
|
|
7
|
+
'!': '%21',
|
|
8
|
+
',': '%2C',
|
|
9
|
+
'[': '%5B',
|
|
10
|
+
']': '%5D',
|
|
11
|
+
'{': '%7B',
|
|
12
|
+
'}': '%7D'
|
|
13
|
+
};
|
|
14
|
+
const escapeTagName = (tn) => tn.replace(/[!,[\]{}]/g, ch => escapeChars[ch]);
|
|
15
|
+
class Directives {
|
|
16
|
+
constructor(yaml, tags) {
|
|
17
|
+
/**
|
|
18
|
+
* The directives-end/doc-start marker `---`. If `null`, a marker may still be
|
|
19
|
+
* included in the document's stringified representation.
|
|
20
|
+
*/
|
|
21
|
+
this.docStart = null;
|
|
22
|
+
/** The doc-end marker `...`. */
|
|
23
|
+
this.docEnd = false;
|
|
24
|
+
this.yaml = Object.assign({}, Directives.defaultYaml, yaml);
|
|
25
|
+
this.tags = Object.assign({}, Directives.defaultTags, tags);
|
|
26
|
+
}
|
|
27
|
+
clone() {
|
|
28
|
+
const copy = new Directives(this.yaml, this.tags);
|
|
29
|
+
copy.docStart = this.docStart;
|
|
30
|
+
return copy;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* During parsing, get a Directives instance for the current document and
|
|
34
|
+
* update the stream state according to the current version's spec.
|
|
35
|
+
*/
|
|
36
|
+
atDocument() {
|
|
37
|
+
const res = new Directives(this.yaml, this.tags);
|
|
38
|
+
switch (this.yaml.version) {
|
|
39
|
+
case '1.1':
|
|
40
|
+
this.atNextDocument = true;
|
|
41
|
+
break;
|
|
42
|
+
case '1.2':
|
|
43
|
+
this.atNextDocument = false;
|
|
44
|
+
this.yaml = {
|
|
45
|
+
explicit: Directives.defaultYaml.explicit,
|
|
46
|
+
version: '1.2'
|
|
47
|
+
};
|
|
48
|
+
this.tags = Object.assign({}, Directives.defaultTags);
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
return res;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* @param onError - May be called even if the action was successful
|
|
55
|
+
* @returns `true` on success
|
|
56
|
+
*/
|
|
57
|
+
add(line, onError) {
|
|
58
|
+
if (this.atNextDocument) {
|
|
59
|
+
this.yaml = { explicit: Directives.defaultYaml.explicit, version: '1.1' };
|
|
60
|
+
this.tags = Object.assign({}, Directives.defaultTags);
|
|
61
|
+
this.atNextDocument = false;
|
|
62
|
+
}
|
|
63
|
+
const parts = line.trim().split(/[ \t]+/);
|
|
64
|
+
const name = parts.shift();
|
|
65
|
+
switch (name) {
|
|
66
|
+
case '%TAG': {
|
|
67
|
+
if (parts.length !== 2) {
|
|
68
|
+
onError(0, '%TAG directive should contain exactly two parts');
|
|
69
|
+
if (parts.length < 2)
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
const [handle, prefix] = parts;
|
|
73
|
+
this.tags[handle] = prefix;
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
case '%YAML': {
|
|
77
|
+
this.yaml.explicit = true;
|
|
78
|
+
if (parts.length !== 1) {
|
|
79
|
+
onError(0, '%YAML directive should contain exactly one part');
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
const [version] = parts;
|
|
83
|
+
if (version === '1.1' || version === '1.2') {
|
|
84
|
+
this.yaml.version = version;
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
const isValid = /^\d+\.\d+$/.test(version);
|
|
89
|
+
onError(6, `Unsupported YAML version ${version}`, isValid);
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
default:
|
|
94
|
+
onError(0, `Unknown directive ${name}`, true);
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Resolves a tag, matching handles to those defined in %TAG directives.
|
|
100
|
+
*
|
|
101
|
+
* @returns Resolved tag, which may also be the non-specific tag `'!'` or a
|
|
102
|
+
* `'!local'` tag, or `null` if unresolvable.
|
|
103
|
+
*/
|
|
104
|
+
tagName(source, onError) {
|
|
105
|
+
if (source === '!')
|
|
106
|
+
return '!'; // non-specific tag
|
|
107
|
+
if (source[0] !== '!') {
|
|
108
|
+
onError(`Not a valid tag: ${source}`);
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
if (source[1] === '<') {
|
|
112
|
+
const verbatim = source.slice(2, -1);
|
|
113
|
+
if (verbatim === '!' || verbatim === '!!') {
|
|
114
|
+
onError(`Verbatim tags aren't resolved, so ${source} is invalid.`);
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
if (source[source.length - 1] !== '>')
|
|
118
|
+
onError('Verbatim tags must end with a >');
|
|
119
|
+
return verbatim;
|
|
120
|
+
}
|
|
121
|
+
const [, handle, suffix] = source.match(/^(.*!)([^!]*)$/);
|
|
122
|
+
if (!suffix)
|
|
123
|
+
onError(`The ${source} tag has no suffix`);
|
|
124
|
+
const prefix = this.tags[handle];
|
|
125
|
+
if (prefix)
|
|
126
|
+
return prefix + decodeURIComponent(suffix);
|
|
127
|
+
if (handle === '!')
|
|
128
|
+
return source; // local tag
|
|
129
|
+
onError(`Could not resolve tag: ${source}`);
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Given a fully resolved tag, returns its printable string form,
|
|
134
|
+
* taking into account current tag prefixes and defaults.
|
|
135
|
+
*/
|
|
136
|
+
tagString(tag) {
|
|
137
|
+
for (const [handle, prefix] of Object.entries(this.tags)) {
|
|
138
|
+
if (tag.startsWith(prefix))
|
|
139
|
+
return handle + escapeTagName(tag.substring(prefix.length));
|
|
140
|
+
}
|
|
141
|
+
return tag[0] === '!' ? tag : `!<${tag}>`;
|
|
142
|
+
}
|
|
143
|
+
toString(doc) {
|
|
144
|
+
const lines = this.yaml.explicit
|
|
145
|
+
? [`%YAML ${this.yaml.version || '1.2'}`]
|
|
146
|
+
: [];
|
|
147
|
+
const tagEntries = Object.entries(this.tags);
|
|
148
|
+
let tagNames;
|
|
149
|
+
if (doc && tagEntries.length > 0 && Node.isNode(doc.contents)) {
|
|
150
|
+
const tags = {};
|
|
151
|
+
visit.visit(doc.contents, (_key, node) => {
|
|
152
|
+
if (Node.isNode(node) && node.tag)
|
|
153
|
+
tags[node.tag] = true;
|
|
154
|
+
});
|
|
155
|
+
tagNames = Object.keys(tags);
|
|
156
|
+
}
|
|
157
|
+
else
|
|
158
|
+
tagNames = [];
|
|
159
|
+
for (const [handle, prefix] of tagEntries) {
|
|
160
|
+
if (handle === '!!' && prefix === 'tag:yaml.org,2002:')
|
|
161
|
+
continue;
|
|
162
|
+
if (!doc || tagNames.some(tn => tn.startsWith(prefix)))
|
|
163
|
+
lines.push(`%TAG ${handle} ${prefix}`);
|
|
164
|
+
}
|
|
165
|
+
return lines.join('\n');
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
Directives.defaultYaml = { explicit: false, version: '1.2' };
|
|
169
|
+
Directives.defaultTags = { '!!': 'tag:yaml.org,2002:' };
|
|
170
|
+
|
|
171
|
+
exports.Directives = Directives;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { LineCounter } from './parse/line-counter';
|
|
2
|
+
export type ErrorCode = 'ALIAS_PROPS' | 'BAD_ALIAS' | 'BAD_DIRECTIVE' | 'BAD_DQ_ESCAPE' | 'BAD_INDENT' | 'BAD_PROP_ORDER' | 'BAD_SCALAR_START' | 'BLOCK_AS_IMPLICIT_KEY' | 'BLOCK_IN_FLOW' | 'DUPLICATE_KEY' | 'IMPOSSIBLE' | 'KEY_OVER_1024_CHARS' | 'MISSING_CHAR' | 'MULTILINE_IMPLICIT_KEY' | 'MULTIPLE_ANCHORS' | 'MULTIPLE_DOCS' | 'MULTIPLE_TAGS' | 'TAB_AS_INDENT' | 'TAG_RESOLVE_FAILED' | 'UNEXPECTED_TOKEN';
|
|
3
|
+
export type LinePos = {
|
|
4
|
+
line: number;
|
|
5
|
+
col: number;
|
|
6
|
+
};
|
|
7
|
+
export declare class YAMLError extends Error {
|
|
8
|
+
name: 'YAMLParseError' | 'YAMLWarning';
|
|
9
|
+
code: ErrorCode;
|
|
10
|
+
message: string;
|
|
11
|
+
pos: [number, number];
|
|
12
|
+
linePos?: [LinePos] | [LinePos, LinePos];
|
|
13
|
+
constructor(name: YAMLError['name'], pos: [number, number], code: ErrorCode, message: string);
|
|
14
|
+
}
|
|
15
|
+
export declare class YAMLParseError extends YAMLError {
|
|
16
|
+
constructor(pos: [number, number], code: ErrorCode, message: string);
|
|
17
|
+
}
|
|
18
|
+
export declare class YAMLWarning extends YAMLError {
|
|
19
|
+
constructor(pos: [number, number], code: ErrorCode, message: string);
|
|
20
|
+
}
|
|
21
|
+
export declare const prettifyError: (src: string, lc: LineCounter) => (error: YAMLError) => void;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
class YAMLError extends Error {
|
|
4
|
+
constructor(name, pos, code, message) {
|
|
5
|
+
super();
|
|
6
|
+
this.name = name;
|
|
7
|
+
this.code = code;
|
|
8
|
+
this.message = message;
|
|
9
|
+
this.pos = pos;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
class YAMLParseError extends YAMLError {
|
|
13
|
+
constructor(pos, code, message) {
|
|
14
|
+
super('YAMLParseError', pos, code, message);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
class YAMLWarning extends YAMLError {
|
|
18
|
+
constructor(pos, code, message) {
|
|
19
|
+
super('YAMLWarning', pos, code, message);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const prettifyError = (src, lc) => (error) => {
|
|
23
|
+
if (error.pos[0] === -1)
|
|
24
|
+
return;
|
|
25
|
+
error.linePos = error.pos.map(pos => lc.linePos(pos));
|
|
26
|
+
const { line, col } = error.linePos[0];
|
|
27
|
+
error.message += ` at line ${line}, column ${col}`;
|
|
28
|
+
let ci = col - 1;
|
|
29
|
+
let lineStr = src
|
|
30
|
+
.substring(lc.lineStarts[line - 1], lc.lineStarts[line])
|
|
31
|
+
.replace(/[\n\r]+$/, '');
|
|
32
|
+
// Trim to max 80 chars, keeping col position near the middle
|
|
33
|
+
if (ci >= 60 && lineStr.length > 80) {
|
|
34
|
+
const trimStart = Math.min(ci - 39, lineStr.length - 79);
|
|
35
|
+
lineStr = '…' + lineStr.substring(trimStart);
|
|
36
|
+
ci -= trimStart - 1;
|
|
37
|
+
}
|
|
38
|
+
if (lineStr.length > 80)
|
|
39
|
+
lineStr = lineStr.substring(0, 79) + '…';
|
|
40
|
+
// Include previous line in context if pointing at line start
|
|
41
|
+
if (line > 1 && /^ *$/.test(lineStr.substring(0, ci))) {
|
|
42
|
+
// Regexp won't match if start is trimmed
|
|
43
|
+
let prev = src.substring(lc.lineStarts[line - 2], lc.lineStarts[line - 1]);
|
|
44
|
+
if (prev.length > 80)
|
|
45
|
+
prev = prev.substring(0, 79) + '…\n';
|
|
46
|
+
lineStr = prev + lineStr;
|
|
47
|
+
}
|
|
48
|
+
if (/[^ ]/.test(lineStr)) {
|
|
49
|
+
let count = 1;
|
|
50
|
+
const end = error.linePos[1];
|
|
51
|
+
if (end && end.line === line && end.col > col) {
|
|
52
|
+
count = Math.min(end.col - col, 80 - ci);
|
|
53
|
+
}
|
|
54
|
+
const pointer = ' '.repeat(ci) + '^'.repeat(count);
|
|
55
|
+
error.message += `:\n\n${lineStr}\n${pointer}\n`;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
exports.YAMLError = YAMLError;
|
|
60
|
+
exports.YAMLParseError = YAMLParseError;
|
|
61
|
+
exports.YAMLWarning = YAMLWarning;
|
|
62
|
+
exports.prettifyError = prettifyError;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { Composer } from './compose/composer.js';
|
|
2
|
+
export { Document } from './doc/Document.js';
|
|
3
|
+
export { Schema } from './schema/Schema.js';
|
|
4
|
+
export { ErrorCode, YAMLError, YAMLParseError, YAMLWarning } from './errors.js';
|
|
5
|
+
export { Alias } from './nodes/Alias.js';
|
|
6
|
+
export { isAlias, isCollection, isDocument, isMap, isNode, isPair, isScalar, isSeq, Node, ParsedNode, Range } from './nodes/Node.js';
|
|
7
|
+
export { Pair } from './nodes/Pair.js';
|
|
8
|
+
export { Scalar } from './nodes/Scalar.js';
|
|
9
|
+
export { YAMLMap } from './nodes/YAMLMap.js';
|
|
10
|
+
export { YAMLSeq } from './nodes/YAMLSeq.js';
|
|
11
|
+
export type { CreateNodeOptions, DocumentOptions, ParseOptions, SchemaOptions, ToJSOptions, ToStringOptions } from './options.js';
|
|
12
|
+
export * as CST from './parse/cst.js';
|
|
13
|
+
export { Lexer } from './parse/lexer.js';
|
|
14
|
+
export { LineCounter } from './parse/line-counter.js';
|
|
15
|
+
export { Parser } from './parse/parser.js';
|
|
16
|
+
export { EmptyStream, parse, parseAllDocuments, parseDocument, stringify } from './public-api.js';
|
|
17
|
+
export type { TagId, Tags } from './schema/tags';
|
|
18
|
+
export type { CollectionTag, ScalarTag } from './schema/types';
|
|
19
|
+
export type { YAMLOMap } from './schema/yaml-1.1/omap';
|
|
20
|
+
export type { YAMLSet } from './schema/yaml-1.1/set';
|
|
21
|
+
export { asyncVisitor, asyncVisitorFn, visit, visitAsync, visitor, visitorFn } from './visit.js';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var composer = require('./compose/composer.js');
|
|
4
|
+
var Document = require('./doc/Document.js');
|
|
5
|
+
var Schema = require('./schema/Schema.js');
|
|
6
|
+
var errors = require('./errors.js');
|
|
7
|
+
var Alias = require('./nodes/Alias.js');
|
|
8
|
+
var Node = require('./nodes/Node.js');
|
|
9
|
+
var Pair = require('./nodes/Pair.js');
|
|
10
|
+
var Scalar = require('./nodes/Scalar.js');
|
|
11
|
+
var YAMLMap = require('./nodes/YAMLMap.js');
|
|
12
|
+
var YAMLSeq = require('./nodes/YAMLSeq.js');
|
|
13
|
+
var cst = require('./parse/cst.js');
|
|
14
|
+
var lexer = require('./parse/lexer.js');
|
|
15
|
+
var lineCounter = require('./parse/line-counter.js');
|
|
16
|
+
var parser = require('./parse/parser.js');
|
|
17
|
+
var publicApi = require('./public-api.js');
|
|
18
|
+
var visit = require('./visit.js');
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
exports.Composer = composer.Composer;
|
|
23
|
+
exports.Document = Document.Document;
|
|
24
|
+
exports.Schema = Schema.Schema;
|
|
25
|
+
exports.YAMLError = errors.YAMLError;
|
|
26
|
+
exports.YAMLParseError = errors.YAMLParseError;
|
|
27
|
+
exports.YAMLWarning = errors.YAMLWarning;
|
|
28
|
+
exports.Alias = Alias.Alias;
|
|
29
|
+
exports.isAlias = Node.isAlias;
|
|
30
|
+
exports.isCollection = Node.isCollection;
|
|
31
|
+
exports.isDocument = Node.isDocument;
|
|
32
|
+
exports.isMap = Node.isMap;
|
|
33
|
+
exports.isNode = Node.isNode;
|
|
34
|
+
exports.isPair = Node.isPair;
|
|
35
|
+
exports.isScalar = Node.isScalar;
|
|
36
|
+
exports.isSeq = Node.isSeq;
|
|
37
|
+
exports.Pair = Pair.Pair;
|
|
38
|
+
exports.Scalar = Scalar.Scalar;
|
|
39
|
+
exports.YAMLMap = YAMLMap.YAMLMap;
|
|
40
|
+
exports.YAMLSeq = YAMLSeq.YAMLSeq;
|
|
41
|
+
exports.CST = cst;
|
|
42
|
+
exports.Lexer = lexer.Lexer;
|
|
43
|
+
exports.LineCounter = lineCounter.LineCounter;
|
|
44
|
+
exports.Parser = parser.Parser;
|
|
45
|
+
exports.parse = publicApi.parse;
|
|
46
|
+
exports.parseAllDocuments = publicApi.parseAllDocuments;
|
|
47
|
+
exports.parseDocument = publicApi.parseDocument;
|
|
48
|
+
exports.stringify = publicApi.stringify;
|
|
49
|
+
exports.visit = visit.visit;
|
|
50
|
+
exports.visitAsync = visit.visitAsync;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function debug(logLevel, ...messages) {
|
|
4
|
+
if (logLevel === 'debug')
|
|
5
|
+
console.log(...messages);
|
|
6
|
+
}
|
|
7
|
+
function warn(logLevel, warning) {
|
|
8
|
+
if (logLevel === 'debug' || logLevel === 'warn') {
|
|
9
|
+
if (typeof process !== 'undefined' && process.emitWarning)
|
|
10
|
+
process.emitWarning(warning);
|
|
11
|
+
else
|
|
12
|
+
console.warn(warning);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
exports.debug = debug;
|
|
17
|
+
exports.warn = warn;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Document } from '../doc/Document.js';
|
|
2
|
+
import type { FlowScalar } from '../parse/cst.js';
|
|
3
|
+
import type { StringifyContext } from '../stringify/stringify.js';
|
|
4
|
+
import { NodeBase, Range } from './Node.js';
|
|
5
|
+
import type { Scalar } from './Scalar';
|
|
6
|
+
import type { ToJSContext } from './toJS.js';
|
|
7
|
+
import type { YAMLMap } from './YAMLMap.js';
|
|
8
|
+
import type { YAMLSeq } from './YAMLSeq.js';
|
|
9
|
+
export declare namespace Alias {
|
|
10
|
+
interface Parsed extends Alias {
|
|
11
|
+
range: Range;
|
|
12
|
+
srcToken?: FlowScalar & {
|
|
13
|
+
type: 'alias';
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export declare class Alias extends NodeBase {
|
|
18
|
+
source: string;
|
|
19
|
+
anchor?: never;
|
|
20
|
+
constructor(source: string);
|
|
21
|
+
/**
|
|
22
|
+
* Resolve the value of this alias within `doc`, finding the last
|
|
23
|
+
* instance of the `source` anchor before this node.
|
|
24
|
+
*/
|
|
25
|
+
resolve(doc: Document): Scalar | YAMLMap | YAMLSeq | undefined;
|
|
26
|
+
toJSON(_arg?: unknown, ctx?: ToJSContext): {} | null;
|
|
27
|
+
toString(ctx?: StringifyContext, _onComment?: () => void, _onChompKeep?: () => void): string;
|
|
28
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var anchors = require('../doc/anchors.js');
|
|
4
|
+
var visit = require('../visit.js');
|
|
5
|
+
var Node = require('./Node.js');
|
|
6
|
+
|
|
7
|
+
class Alias extends Node.NodeBase {
|
|
8
|
+
constructor(source) {
|
|
9
|
+
super(Node.ALIAS);
|
|
10
|
+
this.source = source;
|
|
11
|
+
Object.defineProperty(this, 'tag', {
|
|
12
|
+
set() {
|
|
13
|
+
throw new Error('Alias nodes cannot have tags');
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Resolve the value of this alias within `doc`, finding the last
|
|
19
|
+
* instance of the `source` anchor before this node.
|
|
20
|
+
*/
|
|
21
|
+
resolve(doc) {
|
|
22
|
+
let found = undefined;
|
|
23
|
+
visit.visit(doc, {
|
|
24
|
+
Node: (_key, node) => {
|
|
25
|
+
if (node === this)
|
|
26
|
+
return visit.visit.BREAK;
|
|
27
|
+
if (node.anchor === this.source)
|
|
28
|
+
found = node;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
return found;
|
|
32
|
+
}
|
|
33
|
+
toJSON(_arg, ctx) {
|
|
34
|
+
if (!ctx)
|
|
35
|
+
return { source: this.source };
|
|
36
|
+
const { anchors, doc, maxAliasCount } = ctx;
|
|
37
|
+
const source = this.resolve(doc);
|
|
38
|
+
if (!source) {
|
|
39
|
+
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
40
|
+
throw new ReferenceError(msg);
|
|
41
|
+
}
|
|
42
|
+
const data = anchors.get(source);
|
|
43
|
+
/* istanbul ignore if */
|
|
44
|
+
if (!data || data.res === undefined) {
|
|
45
|
+
const msg = 'This should not happen: Alias anchor was not resolved?';
|
|
46
|
+
throw new ReferenceError(msg);
|
|
47
|
+
}
|
|
48
|
+
if (maxAliasCount >= 0) {
|
|
49
|
+
data.count += 1;
|
|
50
|
+
if (data.aliasCount === 0)
|
|
51
|
+
data.aliasCount = getAliasCount(doc, source, anchors);
|
|
52
|
+
if (data.count * data.aliasCount > maxAliasCount) {
|
|
53
|
+
const msg = 'Excessive alias count indicates a resource exhaustion attack';
|
|
54
|
+
throw new ReferenceError(msg);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return data.res;
|
|
58
|
+
}
|
|
59
|
+
toString(ctx, _onComment, _onChompKeep) {
|
|
60
|
+
const src = `*${this.source}`;
|
|
61
|
+
if (ctx) {
|
|
62
|
+
anchors.anchorIsValid(this.source);
|
|
63
|
+
if (ctx.options.verifyAliasOrder && !ctx.anchors.has(this.source)) {
|
|
64
|
+
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
65
|
+
throw new Error(msg);
|
|
66
|
+
}
|
|
67
|
+
if (ctx.implicitKey)
|
|
68
|
+
return `${src} `;
|
|
69
|
+
}
|
|
70
|
+
return src;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function getAliasCount(doc, node, anchors) {
|
|
74
|
+
if (Node.isAlias(node)) {
|
|
75
|
+
const source = node.resolve(doc);
|
|
76
|
+
const anchor = anchors && source && anchors.get(source);
|
|
77
|
+
return anchor ? anchor.count * anchor.aliasCount : 0;
|
|
78
|
+
}
|
|
79
|
+
else if (Node.isCollection(node)) {
|
|
80
|
+
let count = 0;
|
|
81
|
+
for (const item of node.items) {
|
|
82
|
+
const c = getAliasCount(doc, item, anchors);
|
|
83
|
+
if (c > count)
|
|
84
|
+
count = c;
|
|
85
|
+
}
|
|
86
|
+
return count;
|
|
87
|
+
}
|
|
88
|
+
else if (Node.isPair(node)) {
|
|
89
|
+
const kc = getAliasCount(doc, node.key, anchors);
|
|
90
|
+
const vc = getAliasCount(doc, node.value, anchors);
|
|
91
|
+
return Math.max(kc, vc);
|
|
92
|
+
}
|
|
93
|
+
return 1;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
exports.Alias = Alias;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { Schema } from '../schema/Schema.js';
|
|
2
|
+
import { NodeBase, NODE_TYPE } from './Node.js';
|
|
3
|
+
export declare function collectionFromPath(schema: Schema, path: unknown[], value: unknown): import("./Node.js").Node<unknown>;
|
|
4
|
+
export declare const isEmptyPath: (path: Iterable<unknown> | null | undefined) => path is null | undefined;
|
|
5
|
+
export declare abstract class Collection extends NodeBase {
|
|
6
|
+
static maxFlowStringSingleLineLength: number;
|
|
7
|
+
schema: Schema | undefined;
|
|
8
|
+
[NODE_TYPE]: symbol;
|
|
9
|
+
items: unknown[];
|
|
10
|
+
/** An optional anchor on this node. Used by alias nodes. */
|
|
11
|
+
anchor?: string;
|
|
12
|
+
/**
|
|
13
|
+
* If true, stringify this and all child nodes using flow rather than
|
|
14
|
+
* block styles.
|
|
15
|
+
*/
|
|
16
|
+
flow?: boolean;
|
|
17
|
+
constructor(type: symbol, schema?: Schema);
|
|
18
|
+
/**
|
|
19
|
+
* Create a copy of this collection.
|
|
20
|
+
*
|
|
21
|
+
* @param schema - If defined, overwrites the original's schema
|
|
22
|
+
*/
|
|
23
|
+
clone(schema?: Schema): Collection;
|
|
24
|
+
/** Adds a value to the collection. */
|
|
25
|
+
abstract add(value: unknown): void;
|
|
26
|
+
/**
|
|
27
|
+
* Removes a value from the collection.
|
|
28
|
+
* @returns `true` if the item was found and removed.
|
|
29
|
+
*/
|
|
30
|
+
abstract delete(key: unknown): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
33
|
+
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
34
|
+
* `true` (collections are always returned intact).
|
|
35
|
+
*/
|
|
36
|
+
abstract get(key: unknown, keepScalar?: boolean): unknown;
|
|
37
|
+
/**
|
|
38
|
+
* Checks if the collection includes a value with the key `key`.
|
|
39
|
+
*/
|
|
40
|
+
abstract has(key: unknown): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
43
|
+
* boolean to add/remove the item from the set.
|
|
44
|
+
*/
|
|
45
|
+
abstract set(key: unknown, value: unknown): void;
|
|
46
|
+
/**
|
|
47
|
+
* Adds a value to the collection. For `!!map` and `!!omap` the value must
|
|
48
|
+
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
49
|
+
* that already exists in the map.
|
|
50
|
+
*/
|
|
51
|
+
addIn(path: Iterable<unknown>, value: unknown): void;
|
|
52
|
+
/**
|
|
53
|
+
* Removes a value from the collection.
|
|
54
|
+
* @returns `true` if the item was found and removed.
|
|
55
|
+
*/
|
|
56
|
+
deleteIn(path: Iterable<unknown>): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
59
|
+
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
60
|
+
* `true` (collections are always returned intact).
|
|
61
|
+
*/
|
|
62
|
+
getIn(path: Iterable<unknown>, keepScalar?: boolean): unknown;
|
|
63
|
+
hasAllNullValues(allowScalar?: boolean): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Checks if the collection includes a value with the key `key`.
|
|
66
|
+
*/
|
|
67
|
+
hasIn(path: Iterable<unknown>): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
70
|
+
* boolean to add/remove the item from the set.
|
|
71
|
+
*/
|
|
72
|
+
setIn(path: Iterable<unknown>, value: unknown): void;
|
|
73
|
+
}
|