@swagger-api/apidom-ast 1.11.0 → 1.11.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swagger-api/apidom-ast",
3
- "version": "1.11.0",
3
+ "version": "1.11.2",
4
4
  "description": "Tools necessary for parsing stage of ApiDOM, specifically for syntactic analysis.",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -42,7 +42,7 @@
42
42
  "homepage": "https://github.com/swagger-api/apidom#readme",
43
43
  "dependencies": {
44
44
  "@babel/runtime-corejs3": "^7.26.10",
45
- "@swagger-api/apidom-error": "^1.11.0",
45
+ "@swagger-api/apidom-error": "^1.11.2",
46
46
  "@types/ramda": "~0.30.0",
47
47
  "ramda": "~0.30.0",
48
48
  "ramda-adjunct": "^5.0.0",
@@ -58,5 +58,5 @@
58
58
  "README.md",
59
59
  "CHANGELOG.md"
60
60
  ],
61
- "gitHead": "38799adc3fe2c9f744fab9a9a6e1f89e4e07800b"
61
+ "gitHead": "0ace20a29a3ed690af50b47734114fe06219dc20"
62
62
  }
package/src/index.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
  var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard").default;
4
4
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
5
5
  exports.__esModule = true;
6
- exports.visit = exports.mergeAllVisitors = exports.isYamlTag = exports.isYamlStream = exports.isYamlSequence = exports.isYamlScalar = exports.isYamlMapping = exports.isYamlKeyValuePair = exports.isYamlDocument = exports.isYamlDirective = exports.isYamlComment = exports.isYamlAnchor = exports.isYamlAlias = exports.isParseResult = exports.isNode = exports.isLiteral = exports.isJsonTrue = exports.isJsonStringContent = exports.isJsonString = exports.isJsonProperty = exports.isJsonObject = exports.isJsonNumber = exports.isJsonNull = exports.isJsonKey = exports.isJsonFalse = exports.isJsonEscapeSequence = exports.isJsonDocument = exports.isJsonArray = exports.getVisitFn = exports.getNodeType = exports.cloneNode = exports.YamlTagError = exports.YamlTag = exports.YamlStyleGroup = exports.YamlStyle = exports.YamlStream = exports.YamlSequence = exports.YamlSchemaError = exports.YamlScalar = exports.YamlReferenceManager = exports.YamlReferenceError = exports.YamlNodeKind = exports.YamlNode = exports.YamlMapping = exports.YamlKeyValuePair = exports.YamlJsonSchema = exports.YamlFailsafeSchema = exports.YamlError = exports.YamlDocument = exports.YamlDirective = exports.YamlComment = exports.YamlCollection = exports.YamlAnchor = exports.YamlAlias = exports.Position = exports.Point = exports.ParseResult = exports.Literal = exports.JsonValue = exports.JsonTrue = exports.JsonStringContent = exports.JsonString = exports.JsonProperty = exports.JsonObject = exports.JsonNumber = exports.JsonNull = exports.JsonNode = exports.JsonKey = exports.JsonFalse = exports.JsonEscapeSequence = exports.JsonDocument = exports.JsonArray = exports.Error = exports.BREAK = void 0;
6
+ exports.visit = exports.mergeAllVisitors = exports.isYamlTag = exports.isYamlStream = exports.isYamlSequence = exports.isYamlScalar = exports.isYamlMapping = exports.isYamlKeyValuePair = exports.isYamlDocument = exports.isYamlDirective = exports.isYamlComment = exports.isYamlAnchor = exports.isYamlAlias = exports.isParseResult = exports.isNode = exports.isLiteral = exports.isJsonTrue = exports.isJsonStringContent = exports.isJsonString = exports.isJsonProperty = exports.isJsonObject = exports.isJsonNumber = exports.isJsonNull = exports.isJsonKey = exports.isJsonFalse = exports.isJsonEscapeSequence = exports.isJsonDocument = exports.isJsonArray = exports.getVisitFn = exports.getNodeType = exports.formatFlowSingleQuoted = exports.formatFlowPlain = exports.formatFlowDoubleQuoted = exports.formatBlockLiteral = exports.formatBlockFolded = exports.cloneNode = exports.YamlTagError = exports.YamlTag = exports.YamlStyleGroup = exports.YamlStyle = exports.YamlStream = exports.YamlSequence = exports.YamlSchemaError = exports.YamlScalar = exports.YamlReferenceManager = exports.YamlReferenceError = exports.YamlNodeKind = exports.YamlNode = exports.YamlMapping = exports.YamlKeyValuePair = exports.YamlJsonSchema = exports.YamlFailsafeSchema = exports.YamlError = exports.YamlDocument = exports.YamlDirective = exports.YamlComment = exports.YamlCollection = exports.YamlAnchor = exports.YamlAlias = exports.Position = exports.Point = exports.ParseResult = exports.Literal = exports.JsonValue = exports.JsonTrue = exports.JsonStringContent = exports.JsonString = exports.JsonProperty = exports.JsonObject = exports.JsonNumber = exports.JsonNull = exports.JsonNode = exports.JsonKey = exports.JsonFalse = exports.JsonEscapeSequence = exports.JsonDocument = exports.JsonArray = exports.Error = exports.BREAK = void 0;
7
7
  var _JsonNode = _interopRequireDefault(require("./json/nodes/JsonNode.cjs"));
8
8
  exports.JsonNode = _JsonNode.default;
9
9
  var _JsonDocument = _interopRequireDefault(require("./json/nodes/JsonDocument.cjs"));
@@ -79,6 +79,12 @@ var _index = _interopRequireDefault(require("./yaml/schemas/failsafe/index.cjs")
79
79
  exports.YamlFailsafeSchema = _index.default;
80
80
  var _index2 = _interopRequireDefault(require("./yaml/schemas/json/index.cjs"));
81
81
  exports.YamlJsonSchema = _index2.default;
82
+ var _canonicalFormat = require("./yaml/schemas/canonical-format.cjs");
83
+ exports.formatFlowPlain = _canonicalFormat.formatFlowPlain;
84
+ exports.formatFlowSingleQuoted = _canonicalFormat.formatFlowSingleQuoted;
85
+ exports.formatFlowDoubleQuoted = _canonicalFormat.formatFlowDoubleQuoted;
86
+ exports.formatBlockLiteral = _canonicalFormat.formatBlockLiteral;
87
+ exports.formatBlockFolded = _canonicalFormat.formatBlockFolded;
82
88
  var _ReferenceManager = _interopRequireDefault(require("./yaml/anchors-aliases/ReferenceManager.cjs"));
83
89
  exports.YamlReferenceManager = _ReferenceManager.default;
84
90
  var _predicates2 = require("./yaml/nodes/predicates.cjs");
package/src/index.mjs CHANGED
@@ -30,6 +30,7 @@ export { default as YamlAnchor } from "./yaml/nodes/YamlAnchor.mjs";
30
30
  export { YamlStyle, YamlStyleGroup } from "./yaml/nodes/YamlStyle.mjs";
31
31
  export { default as YamlFailsafeSchema } from "./yaml/schemas/failsafe/index.mjs";
32
32
  export { default as YamlJsonSchema } from "./yaml/schemas/json/index.mjs";
33
+ export { formatFlowPlain, formatFlowSingleQuoted, formatFlowDoubleQuoted, formatBlockLiteral, formatBlockFolded } from "./yaml/schemas/canonical-format.mjs";
33
34
  export { default as YamlReferenceManager } from "./yaml/anchors-aliases/ReferenceManager.mjs";
34
35
  export { isAlias as isYamlAlias, isAnchor as isYamlAnchor, isComment as isYamlComment, isKeyValuePair as isYamlKeyValuePair, isDirective as isYamlDirective, isDocument as isYamlDocument, isMapping as isYamlMapping, isScalar as isYamlScalar, isSequence as isYamlSequence, isStream as isYamlStream, isTag as isYamlTag } from "./yaml/nodes/predicates.mjs";
35
36
  export { default as YamlError } from "./yaml/errors/YamlError.mjs";
@@ -77,12 +77,14 @@ const removeQuotes = (0, _ramda.curry)((quoteType, val) => val.replace(new RegEx
77
77
  /**
78
78
  * Formats Flow Scalar Plain style.
79
79
  * https://yaml.org/spec/1.2/spec.html#id2788859
80
+ * @public
80
81
  */
81
82
  const formatFlowPlain = exports.formatFlowPlain = (0, _ramda.pipe)(normalizeLineBreaks, _ramda.trim, collapseLineBreakToSpace, (0, _ramda.split)('\n'), (0, _ramda.map)(_ramdaAdjunct.trimStart), (0, _ramda.join)('\n'));
82
83
 
83
84
  /**
84
85
  * Formats Flow Scalar Single-Quoted style.
85
86
  * https://yaml.org/spec/1.2/spec.html#id2788097
87
+ * @public
86
88
  */
87
89
 
88
90
  const formatFlowSingleQuoted = exports.formatFlowSingleQuoted = (0, _ramda.pipe)(normalizeLineBreaks, _ramda.trim, collapseLineBreakToSpace, (0, _ramda.split)('\n'), (0, _ramda.map)(_ramdaAdjunct.trimStart), (0, _ramda.join)('\n'), removeQuotes("'"));
@@ -90,12 +92,14 @@ const formatFlowSingleQuoted = exports.formatFlowSingleQuoted = (0, _ramda.pipe)
90
92
  /**
91
93
  * Formats Flow Scalar Double-Quoted style.
92
94
  * https://yaml.org/spec/1.2/spec.html#id2787109
95
+ * @public
93
96
  */
94
97
  const formatFlowDoubleQuoted = exports.formatFlowDoubleQuoted = (0, _ramda.pipe)(normalizeLineBreaks, _ramda.trim, preventLineBreakCollapseToSpace, collapseLineBreakToSpace, _unraw.unraw, (0, _ramda.split)('\n'), (0, _ramda.map)(_ramdaAdjunct.trimStart), (0, _ramda.join)('\n'), removeQuotes('"'));
95
98
 
96
99
  /**
97
100
  * Formats Block Scalar Literal style.
98
101
  * https://yaml.org/spec/1.2/spec.html#id2795688
102
+ * @public
99
103
  */
100
104
  const formatBlockLiteral = content => {
101
105
  const indentation = getIndentation(content);
@@ -111,6 +115,7 @@ const formatBlockLiteral = content => {
111
115
  /**
112
116
  * Formats BLock Scalar Folded style.
113
117
  * https://yaml.org/spec/1.2/spec.html#id2796251
118
+ * @public
114
119
  */
115
120
  exports.formatBlockLiteral = formatBlockLiteral;
116
121
  const formatBlockFolded = content => {
@@ -74,12 +74,14 @@ const removeQuotes = curry((quoteType, val) => val.replace(new RegExp(`^${quoteT
74
74
  /**
75
75
  * Formats Flow Scalar Plain style.
76
76
  * https://yaml.org/spec/1.2/spec.html#id2788859
77
+ * @public
77
78
  */
78
79
  export const formatFlowPlain = pipe(normalizeLineBreaks, trim, collapseLineBreakToSpace, split('\n'), map(trimStart), join('\n'));
79
80
 
80
81
  /**
81
82
  * Formats Flow Scalar Single-Quoted style.
82
83
  * https://yaml.org/spec/1.2/spec.html#id2788097
84
+ * @public
83
85
  */
84
86
 
85
87
  export const formatFlowSingleQuoted = pipe(normalizeLineBreaks, trim, collapseLineBreakToSpace, split('\n'), map(trimStart), join('\n'), removeQuotes("'"));
@@ -87,12 +89,14 @@ export const formatFlowSingleQuoted = pipe(normalizeLineBreaks, trim, collapseLi
87
89
  /**
88
90
  * Formats Flow Scalar Double-Quoted style.
89
91
  * https://yaml.org/spec/1.2/spec.html#id2787109
92
+ * @public
90
93
  */
91
94
  export const formatFlowDoubleQuoted = pipe(normalizeLineBreaks, trim, preventLineBreakCollapseToSpace, collapseLineBreakToSpace, unraw, split('\n'), map(trimStart), join('\n'), removeQuotes('"'));
92
95
 
93
96
  /**
94
97
  * Formats Block Scalar Literal style.
95
98
  * https://yaml.org/spec/1.2/spec.html#id2795688
99
+ * @public
96
100
  */
97
101
  export const formatBlockLiteral = content => {
98
102
  const indentation = getIndentation(content);
@@ -108,6 +112,7 @@ export const formatBlockLiteral = content => {
108
112
  /**
109
113
  * Formats BLock Scalar Folded style.
110
114
  * https://yaml.org/spec/1.2/spec.html#id2796251
115
+ * @public
111
116
  */
112
117
  export const formatBlockFolded = content => {
113
118
  const indentation = getIndentation(content);
@@ -1,5 +1,6 @@
1
1
  import type { ApiDOMErrorOptions } from '@swagger-api/apidom-error';
2
2
  import { ApiDOMStructuredError } from '@swagger-api/apidom-error';
3
+ import { Curry } from 'ts-toolbelt/out/Function/Curry.js';
3
4
 
4
5
  /**
5
6
  * @public
@@ -31,6 +32,41 @@ declare interface ErrorOptions_2 extends NodeOptions {
31
32
  }
32
33
  export { ErrorOptions_2 as ErrorOptions }
33
34
 
35
+ /**
36
+ * Formats BLock Scalar Folded style.
37
+ * https://yaml.org/spec/1.2/spec.html#id2796251
38
+ * @public
39
+ */
40
+ export declare const formatBlockFolded: (content: string) => string;
41
+
42
+ /**
43
+ * Formats Block Scalar Literal style.
44
+ * https://yaml.org/spec/1.2/spec.html#id2795688
45
+ * @public
46
+ */
47
+ export declare const formatBlockLiteral: (content: string) => string;
48
+
49
+ /**
50
+ * Formats Flow Scalar Double-Quoted style.
51
+ * https://yaml.org/spec/1.2/spec.html#id2787109
52
+ * @public
53
+ */
54
+ export declare const formatFlowDoubleQuoted: (val: string) => Curry<(...p: [] | [val: any]) => (a: any) => never>;
55
+
56
+ /**
57
+ * Formats Flow Scalar Plain style.
58
+ * https://yaml.org/spec/1.2/spec.html#id2788859
59
+ * @public
60
+ */
61
+ export declare const formatFlowPlain: (val: string) => string;
62
+
63
+ /**
64
+ * Formats Flow Scalar Single-Quoted style.
65
+ * https://yaml.org/spec/1.2/spec.html#id2788097
66
+ * @public
67
+ */
68
+ export declare const formatFlowSingleQuoted: (val: string) => (a: string) => never;
69
+
34
70
  /**
35
71
  * @public
36
72
  */