@kubb/agent 4.33.4 → 4.34.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.
Files changed (59) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/server/chunks/nitro/nitro.mjs +214 -4352
  3. package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
  4. package/.output/server/chunks/routes/api/health.get.mjs +1 -0
  5. package/.output/server/chunks/routes/api/health.get.mjs.map +1 -1
  6. package/.output/server/index.mjs +1 -0
  7. package/.output/server/index.mjs.map +1 -1
  8. package/.output/server/node_modules/@stoplight/ordered-object-literal/package.json +53 -0
  9. package/.output/server/node_modules/@stoplight/ordered-object-literal/src/index.cjs +221 -0
  10. package/.output/server/node_modules/@stoplight/types/dist/index.js +129 -0
  11. package/.output/server/node_modules/@stoplight/types/package.json +81 -0
  12. package/.output/server/node_modules/@stoplight/yaml/buildJsonPath.js +41 -0
  13. package/.output/server/node_modules/@stoplight/yaml/dereferenceAnchor.js +38 -0
  14. package/.output/server/node_modules/@stoplight/yaml/getJsonPathForPosition.js +98 -0
  15. package/.output/server/node_modules/@stoplight/yaml/getLocationForJsonPath.js +145 -0
  16. package/.output/server/node_modules/@stoplight/yaml/index.js +16 -0
  17. package/.output/server/node_modules/@stoplight/yaml/lineForPosition.js +31 -0
  18. package/.output/server/node_modules/@stoplight/yaml/package.json +33 -0
  19. package/.output/server/node_modules/@stoplight/yaml/parse.js +5 -0
  20. package/.output/server/node_modules/@stoplight/yaml/parseWithPointers.js +456 -0
  21. package/.output/server/node_modules/@stoplight/yaml/safeStringify.js +5 -0
  22. package/.output/server/node_modules/@stoplight/yaml/trapAccess.js +11 -0
  23. package/.output/server/node_modules/@stoplight/yaml/types.js +6 -0
  24. package/.output/server/node_modules/@stoplight/yaml/utils.js +4 -0
  25. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/common.js +45 -0
  26. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/dumper.js +710 -0
  27. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/exception.js +35 -0
  28. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/index.js +22 -0
  29. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/loader.js +1414 -0
  30. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/mark.js +58 -0
  31. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/scalarInference.js +90 -0
  32. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/schema/core.js +8 -0
  33. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/schema/default_full.js +14 -0
  34. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/schema/default_safe.js +19 -0
  35. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/schema/failsafe.js +10 -0
  36. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/schema/json.js +14 -0
  37. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/schema.js +77 -0
  38. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/binary.js +92 -0
  39. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/bool.js +32 -0
  40. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/float.js +94 -0
  41. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/int.js +159 -0
  42. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/js/regexp.js +64 -0
  43. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/js/undefined.js +22 -0
  44. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/map.js +7 -0
  45. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/merge.js +10 -0
  46. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/null.js +30 -0
  47. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/omap.js +46 -0
  48. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/pairs.js +55 -0
  49. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/seq.js +7 -0
  50. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/set.js +22 -0
  51. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/str.js +7 -0
  52. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type/timestamp.js +70 -0
  53. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/type.js +53 -0
  54. package/.output/server/node_modules/@stoplight/yaml-ast-parser/dist/src/yamlAST.js +81 -0
  55. package/.output/server/node_modules/@stoplight/yaml-ast-parser/package.json +38 -0
  56. package/.output/server/node_modules/tslib/package.json +47 -0
  57. package/.output/server/node_modules/tslib/tslib.js +484 -0
  58. package/.output/server/package.json +6 -1
  59. package/package.json +16 -16
@@ -0,0 +1,710 @@
1
+ 'use strict';
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var common = require('./common');
4
+ var YAMLException = require('./exception');
5
+ var DEFAULT_FULL_SCHEMA = require('./schema/default_full');
6
+ var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe');
7
+ var _toString = Object.prototype.toString;
8
+ var _hasOwnProperty = Object.prototype.hasOwnProperty;
9
+ var CHAR_TAB = 0x09;
10
+ var CHAR_LINE_FEED = 0x0A;
11
+ var CHAR_CARRIAGE_RETURN = 0x0D;
12
+ var CHAR_SPACE = 0x20;
13
+ var CHAR_EXCLAMATION = 0x21;
14
+ var CHAR_DOUBLE_QUOTE = 0x22;
15
+ var CHAR_SHARP = 0x23;
16
+ var CHAR_PERCENT = 0x25;
17
+ var CHAR_AMPERSAND = 0x26;
18
+ var CHAR_SINGLE_QUOTE = 0x27;
19
+ var CHAR_ASTERISK = 0x2A;
20
+ var CHAR_COMMA = 0x2C;
21
+ var CHAR_MINUS = 0x2D;
22
+ var CHAR_COLON = 0x3A;
23
+ var CHAR_EQUALS = 0x3D;
24
+ var CHAR_GREATER_THAN = 0x3E;
25
+ var CHAR_QUESTION = 0x3F;
26
+ var CHAR_COMMERCIAL_AT = 0x40;
27
+ var CHAR_LEFT_SQUARE_BRACKET = 0x5B;
28
+ var CHAR_RIGHT_SQUARE_BRACKET = 0x5D;
29
+ var CHAR_GRAVE_ACCENT = 0x60;
30
+ var CHAR_LEFT_CURLY_BRACKET = 0x7B;
31
+ var CHAR_VERTICAL_LINE = 0x7C;
32
+ var CHAR_RIGHT_CURLY_BRACKET = 0x7D;
33
+ var ESCAPE_SEQUENCES = {};
34
+ ESCAPE_SEQUENCES[0x00] = '\\0';
35
+ ESCAPE_SEQUENCES[0x07] = '\\a';
36
+ ESCAPE_SEQUENCES[0x08] = '\\b';
37
+ ESCAPE_SEQUENCES[0x09] = '\\t';
38
+ ESCAPE_SEQUENCES[0x0A] = '\\n';
39
+ ESCAPE_SEQUENCES[0x0B] = '\\v';
40
+ ESCAPE_SEQUENCES[0x0C] = '\\f';
41
+ ESCAPE_SEQUENCES[0x0D] = '\\r';
42
+ ESCAPE_SEQUENCES[0x1B] = '\\e';
43
+ ESCAPE_SEQUENCES[0x22] = '\\"';
44
+ ESCAPE_SEQUENCES[0x5C] = '\\\\';
45
+ ESCAPE_SEQUENCES[0x85] = '\\N';
46
+ ESCAPE_SEQUENCES[0xA0] = '\\_';
47
+ ESCAPE_SEQUENCES[0x2028] = '\\L';
48
+ ESCAPE_SEQUENCES[0x2029] = '\\P';
49
+ var DEPRECATED_BOOLEANS_SYNTAX = [
50
+ 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',
51
+ 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'
52
+ ];
53
+ function compileStyleMap(schema, map) {
54
+ var result, keys, index, length, tag, style, type;
55
+ if (map === null)
56
+ return {};
57
+ result = {};
58
+ keys = Object.keys(map);
59
+ for (index = 0, length = keys.length; index < length; index += 1) {
60
+ tag = keys[index];
61
+ style = String(map[tag]);
62
+ if (tag.slice(0, 2) === '!!') {
63
+ tag = 'tag:yaml.org,2002:' + tag.slice(2);
64
+ }
65
+ type = schema.compiledTypeMap['fallback'][tag];
66
+ if (type && _hasOwnProperty.call(type.styleAliases, style)) {
67
+ style = type.styleAliases[style];
68
+ }
69
+ result[tag] = style;
70
+ }
71
+ return result;
72
+ }
73
+ function encodeHex(character) {
74
+ var string, handle, length;
75
+ string = character.toString(16).toUpperCase();
76
+ if (character <= 0xFF) {
77
+ handle = 'x';
78
+ length = 2;
79
+ }
80
+ else if (character <= 0xFFFF) {
81
+ handle = 'u';
82
+ length = 4;
83
+ }
84
+ else if (character <= 0xFFFFFFFF) {
85
+ handle = 'U';
86
+ length = 8;
87
+ }
88
+ else {
89
+ throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF');
90
+ }
91
+ return '\\' + handle + common.repeat('0', length - string.length) + string;
92
+ }
93
+ function State(options) {
94
+ this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
95
+ this.indent = Math.max(1, (options['indent'] || 2));
96
+ this.noArrayIndent = options['noArrayIndent'] || false;
97
+ this.skipInvalid = options['skipInvalid'] || false;
98
+ this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
99
+ this.styleMap = compileStyleMap(this.schema, options['styles'] || null);
100
+ this.sortKeys = options['sortKeys'] || false;
101
+ this.lineWidth = options['lineWidth'] || 80;
102
+ this.noRefs = options['noRefs'] || false;
103
+ this.noCompatMode = options['noCompatMode'] || false;
104
+ this.condenseFlow = options['condenseFlow'] || false;
105
+ this.implicitTypes = this.schema.compiledImplicit;
106
+ this.explicitTypes = this.schema.compiledExplicit;
107
+ this.comments = options['comments'] || {};
108
+ this.tag = null;
109
+ this.result = '';
110
+ this.duplicates = [];
111
+ this.usedDuplicates = null;
112
+ }
113
+ function indentString(string, spaces) {
114
+ var ind = common.repeat(' ', spaces), position = 0, next = -1, result = '', line, length = string.length;
115
+ while (position < length) {
116
+ next = string.indexOf('\n', position);
117
+ if (next === -1) {
118
+ line = string.slice(position);
119
+ position = length;
120
+ }
121
+ else {
122
+ line = string.slice(position, next + 1);
123
+ position = next + 1;
124
+ }
125
+ if (line.length && line !== '\n')
126
+ result += ind;
127
+ result += line;
128
+ }
129
+ return result;
130
+ }
131
+ function generateNextLine(state, level) {
132
+ return '\n' + common.repeat(' ', state.indent * level);
133
+ }
134
+ function testImplicitResolving(state, str) {
135
+ var index, length, type;
136
+ for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
137
+ type = state.implicitTypes[index];
138
+ if (type.resolve(str)) {
139
+ return true;
140
+ }
141
+ }
142
+ return false;
143
+ }
144
+ function isWhitespace(c) {
145
+ return c === CHAR_SPACE || c === CHAR_TAB;
146
+ }
147
+ function isPrintable(c) {
148
+ return (0x00020 <= c && c <= 0x00007E)
149
+ || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029)
150
+ || ((0x0E000 <= c && c <= 0x00FFFD) && c !== 0xFEFF)
151
+ || (0x10000 <= c && c <= 0x10FFFF);
152
+ }
153
+ function isNsChar(c) {
154
+ return isPrintable(c) && !isWhitespace(c)
155
+ && c !== 0xFEFF
156
+ && c !== CHAR_CARRIAGE_RETURN
157
+ && c !== CHAR_LINE_FEED;
158
+ }
159
+ function isPlainSafe(c, prev) {
160
+ return isPrintable(c) && c !== 0xFEFF
161
+ && c !== CHAR_COMMA
162
+ && c !== CHAR_LEFT_SQUARE_BRACKET
163
+ && c !== CHAR_RIGHT_SQUARE_BRACKET
164
+ && c !== CHAR_LEFT_CURLY_BRACKET
165
+ && c !== CHAR_RIGHT_CURLY_BRACKET
166
+ && c !== CHAR_COLON
167
+ && ((c !== CHAR_SHARP) || (prev && isNsChar(prev)));
168
+ }
169
+ function isPlainSafeFirst(c) {
170
+ return isPrintable(c) && c !== 0xFEFF
171
+ && !isWhitespace(c)
172
+ && c !== CHAR_MINUS
173
+ && c !== CHAR_QUESTION
174
+ && c !== CHAR_COLON
175
+ && c !== CHAR_COMMA
176
+ && c !== CHAR_LEFT_SQUARE_BRACKET
177
+ && c !== CHAR_RIGHT_SQUARE_BRACKET
178
+ && c !== CHAR_LEFT_CURLY_BRACKET
179
+ && c !== CHAR_RIGHT_CURLY_BRACKET
180
+ && c !== CHAR_SHARP
181
+ && c !== CHAR_AMPERSAND
182
+ && c !== CHAR_ASTERISK
183
+ && c !== CHAR_EXCLAMATION
184
+ && c !== CHAR_VERTICAL_LINE
185
+ && c !== CHAR_EQUALS
186
+ && c !== CHAR_GREATER_THAN
187
+ && c !== CHAR_SINGLE_QUOTE
188
+ && c !== CHAR_DOUBLE_QUOTE
189
+ && c !== CHAR_PERCENT
190
+ && c !== CHAR_COMMERCIAL_AT
191
+ && c !== CHAR_GRAVE_ACCENT;
192
+ }
193
+ function needIndentIndicator(string) {
194
+ var leadingSpaceRe = /^\n* /;
195
+ return leadingSpaceRe.test(string);
196
+ }
197
+ var STYLE_PLAIN = 1, STYLE_SINGLE = 2, STYLE_LITERAL = 3, STYLE_FOLDED = 4, STYLE_DOUBLE = 5;
198
+ function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) {
199
+ var i;
200
+ var char, prev_char;
201
+ var hasLineBreak = false;
202
+ var hasFoldableLine = false;
203
+ var shouldTrackWidth = lineWidth !== -1;
204
+ var previousLineBreak = -1;
205
+ var plain = isPlainSafeFirst(string.charCodeAt(0))
206
+ && !isWhitespace(string.charCodeAt(string.length - 1));
207
+ if (singleLineOnly) {
208
+ for (i = 0; i < string.length; i++) {
209
+ char = string.charCodeAt(i);
210
+ if (!isPrintable(char)) {
211
+ return STYLE_DOUBLE;
212
+ }
213
+ prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
214
+ plain = plain && isPlainSafe(char, prev_char);
215
+ }
216
+ }
217
+ else {
218
+ for (i = 0; i < string.length; i++) {
219
+ char = string.charCodeAt(i);
220
+ if (char === CHAR_LINE_FEED) {
221
+ hasLineBreak = true;
222
+ if (shouldTrackWidth) {
223
+ hasFoldableLine = hasFoldableLine ||
224
+ (i - previousLineBreak - 1 > lineWidth &&
225
+ string[previousLineBreak + 1] !== ' ');
226
+ previousLineBreak = i;
227
+ }
228
+ }
229
+ else if (!isPrintable(char)) {
230
+ return STYLE_DOUBLE;
231
+ }
232
+ prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
233
+ plain = plain && isPlainSafe(char, prev_char);
234
+ }
235
+ hasFoldableLine = hasFoldableLine || (shouldTrackWidth &&
236
+ (i - previousLineBreak - 1 > lineWidth &&
237
+ string[previousLineBreak + 1] !== ' '));
238
+ }
239
+ if (!hasLineBreak && !hasFoldableLine) {
240
+ return plain && !testAmbiguousType(string)
241
+ ? STYLE_PLAIN : STYLE_SINGLE;
242
+ }
243
+ if (indentPerLevel > 9 && needIndentIndicator(string)) {
244
+ return STYLE_DOUBLE;
245
+ }
246
+ return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
247
+ }
248
+ function writeScalar(state, string, level, iskey, pointer) {
249
+ var _result = (function () {
250
+ if (string.length === 0) {
251
+ return "''";
252
+ }
253
+ if (!state.noCompatMode &&
254
+ DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) {
255
+ return "'" + string + "'";
256
+ }
257
+ var indent = state.indent * Math.max(1, level);
258
+ var lineWidth = state.lineWidth === -1
259
+ ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
260
+ var singleLineOnly = iskey
261
+ || (state.flowLevel > -1 && level >= state.flowLevel);
262
+ function testAmbiguity(string) {
263
+ return testImplicitResolving(state, string);
264
+ }
265
+ switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) {
266
+ case STYLE_PLAIN:
267
+ return string;
268
+ case STYLE_SINGLE:
269
+ return "'" + string.replace(/'/g, "''") + "'";
270
+ case STYLE_LITERAL:
271
+ return '|' + blockHeader(string, state.indent)
272
+ + dropEndingNewline(indentString(string, indent));
273
+ case STYLE_FOLDED:
274
+ return '>' + blockHeader(string, state.indent)
275
+ + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
276
+ case STYLE_DOUBLE:
277
+ return '"' + escapeString(string) + '"';
278
+ default:
279
+ throw new YAMLException('impossible error: invalid scalar style');
280
+ }
281
+ }());
282
+ if (!iskey) {
283
+ let comments = new Comments(state, pointer);
284
+ let comment = comments.write(level, 'before-eol');
285
+ if (comment !== '') {
286
+ _result += ' ' + comment;
287
+ }
288
+ }
289
+ state.dump = _result;
290
+ }
291
+ function blockHeader(string, indentPerLevel) {
292
+ var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : '';
293
+ var clip = string[string.length - 1] === '\n';
294
+ var keep = clip && (string[string.length - 2] === '\n' || string === '\n');
295
+ var chomp = keep ? '+' : (clip ? '' : '-');
296
+ return indentIndicator + chomp + '\n';
297
+ }
298
+ function dropEndingNewline(string) {
299
+ return string[string.length - 1] === '\n' ? string.slice(0, -1) : string;
300
+ }
301
+ function foldString(string, width) {
302
+ var lineRe = /(\n+)([^\n]*)/g;
303
+ var result = (function () {
304
+ var nextLF = string.indexOf('\n');
305
+ nextLF = nextLF !== -1 ? nextLF : string.length;
306
+ lineRe.lastIndex = nextLF;
307
+ return foldLine(string.slice(0, nextLF), width);
308
+ }());
309
+ var prevMoreIndented = string[0] === '\n' || string[0] === ' ';
310
+ var moreIndented;
311
+ var match;
312
+ while ((match = lineRe.exec(string))) {
313
+ var prefix = match[1], line = match[2];
314
+ moreIndented = (line[0] === ' ');
315
+ result += prefix
316
+ + (!prevMoreIndented && !moreIndented && line !== ''
317
+ ? '\n' : '')
318
+ + foldLine(line, width);
319
+ prevMoreIndented = moreIndented;
320
+ }
321
+ return result;
322
+ }
323
+ function foldLine(line, width) {
324
+ if (line === '' || line[0] === ' ')
325
+ return line;
326
+ var breakRe = / [^ ]/g;
327
+ var match;
328
+ var start = 0, end, curr = 0, next = 0;
329
+ var result = '';
330
+ while ((match = breakRe.exec(line))) {
331
+ next = match.index;
332
+ if (next - start > width) {
333
+ end = (curr > start) ? curr : next;
334
+ result += '\n' + line.slice(start, end);
335
+ start = end + 1;
336
+ }
337
+ curr = next;
338
+ }
339
+ result += '\n';
340
+ if (line.length - start > width && curr > start) {
341
+ result += line.slice(start, curr) + '\n' + line.slice(curr + 1);
342
+ }
343
+ else {
344
+ result += line.slice(start);
345
+ }
346
+ return result.slice(1);
347
+ }
348
+ function escapeString(string) {
349
+ var result = '';
350
+ var char, nextChar;
351
+ var escapeSeq;
352
+ for (var i = 0; i < string.length; i++) {
353
+ char = string.charCodeAt(i);
354
+ if (char >= 0xD800 && char <= 0xDBFF) {
355
+ nextChar = string.charCodeAt(i + 1);
356
+ if (nextChar >= 0xDC00 && nextChar <= 0xDFFF) {
357
+ result += encodeHex((char - 0xD800) * 0x400 + nextChar - 0xDC00 + 0x10000);
358
+ i++;
359
+ continue;
360
+ }
361
+ }
362
+ escapeSeq = ESCAPE_SEQUENCES[char];
363
+ result += !escapeSeq && isPrintable(char)
364
+ ? string[i]
365
+ : escapeSeq || encodeHex(char);
366
+ }
367
+ return result;
368
+ }
369
+ function writeFlowSequence(state, level, object, pointer) {
370
+ var _result = '', _tag = state.tag, index, length;
371
+ for (index = 0, length = object.length; index < length; index += 1) {
372
+ if (writeNode(state, level, object[index], false, false, false, pointer)) {
373
+ if (index !== 0)
374
+ _result += ',' + (!state.condenseFlow ? ' ' : '');
375
+ _result += state.dump;
376
+ }
377
+ }
378
+ state.tag = _tag;
379
+ state.dump = '[' + _result + ']';
380
+ }
381
+ function writeBlockSequence(state, level, object, compact, pointer) {
382
+ var _result = '', _tag = state.tag, index, length;
383
+ var comments = new Comments(state, pointer);
384
+ _result += comments.write(level, 'before-eol');
385
+ _result += comments.write(level, 'leading');
386
+ for (index = 0, length = object.length; index < length; index += 1) {
387
+ _result += comments.writeAt(String(index), level, 'before');
388
+ if (writeNode(state, level + 1, object[index], true, true, false, `${pointer}/${index}`)) {
389
+ if (!compact || index !== 0) {
390
+ _result += generateNextLine(state, level);
391
+ }
392
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
393
+ _result += '-';
394
+ }
395
+ else {
396
+ _result += '- ';
397
+ }
398
+ _result += state.dump;
399
+ }
400
+ _result += comments.writeAt(String(index), level, 'after');
401
+ }
402
+ state.tag = _tag;
403
+ state.dump = _result || '[]';
404
+ state.dump += comments.write(level, 'trailing');
405
+ }
406
+ function writeFlowMapping(state, level, object, pointer) {
407
+ var _result = '', _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer;
408
+ for (index = 0, length = objectKeyList.length; index < length; index += 1) {
409
+ pairBuffer = '';
410
+ if (index !== 0)
411
+ pairBuffer += ', ';
412
+ if (state.condenseFlow)
413
+ pairBuffer += '"';
414
+ objectKey = objectKeyList[index];
415
+ objectValue = object[objectKey];
416
+ if (!writeNode(state, level, objectKey, false, false, false, pointer)) {
417
+ continue;
418
+ }
419
+ if (state.dump.length > 1024)
420
+ pairBuffer += '? ';
421
+ pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' ');
422
+ if (!writeNode(state, level, objectValue, false, false, false, pointer)) {
423
+ continue;
424
+ }
425
+ pairBuffer += state.dump;
426
+ _result += pairBuffer;
427
+ }
428
+ state.tag = _tag;
429
+ state.dump = '{' + _result + '}';
430
+ }
431
+ function writeBlockMapping(state, level, object, compact, pointer) {
432
+ var _result = '', _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer;
433
+ if (state.sortKeys === true) {
434
+ objectKeyList.sort();
435
+ }
436
+ else if (typeof state.sortKeys === 'function') {
437
+ objectKeyList.sort(state.sortKeys);
438
+ }
439
+ else if (state.sortKeys) {
440
+ throw new YAMLException('sortKeys must be a boolean or a function');
441
+ }
442
+ var comments = new Comments(state, pointer);
443
+ _result += comments.write(level, 'before-eol');
444
+ _result += comments.write(level, 'leading');
445
+ for (index = 0, length = objectKeyList.length; index < length; index += 1) {
446
+ pairBuffer = '';
447
+ if (!compact || index !== 0) {
448
+ pairBuffer += generateNextLine(state, level);
449
+ }
450
+ objectKey = objectKeyList[index];
451
+ objectValue = object[objectKey];
452
+ _result += comments.writeAt(objectKey, level, 'before');
453
+ if (!writeNode(state, level + 1, objectKey, true, true, true, pointer)) {
454
+ continue;
455
+ }
456
+ explicitPair = (state.tag !== null && state.tag !== '?') ||
457
+ (state.dump && state.dump.length > 1024);
458
+ if (explicitPair) {
459
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
460
+ pairBuffer += '?';
461
+ }
462
+ else {
463
+ pairBuffer += '? ';
464
+ }
465
+ }
466
+ pairBuffer += state.dump;
467
+ if (explicitPair) {
468
+ pairBuffer += generateNextLine(state, level);
469
+ }
470
+ if (!writeNode(state, level + 1, objectValue, true, explicitPair, false, `${pointer}/${encodeSegment(objectKey)}`)) {
471
+ continue;
472
+ }
473
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
474
+ pairBuffer += ':';
475
+ }
476
+ else {
477
+ pairBuffer += ': ';
478
+ }
479
+ pairBuffer += state.dump;
480
+ _result += pairBuffer;
481
+ _result += comments.writeAt(level, objectKey, 'after');
482
+ }
483
+ state.tag = _tag;
484
+ state.dump = _result || '{}';
485
+ state.dump += comments.write(level, 'trailing');
486
+ }
487
+ function detectType(state, object, explicit) {
488
+ var _result, typeList, index, length, type, style;
489
+ typeList = explicit ? state.explicitTypes : state.implicitTypes;
490
+ for (index = 0, length = typeList.length; index < length; index += 1) {
491
+ type = typeList[index];
492
+ if ((type.instanceOf || type.predicate) &&
493
+ (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) &&
494
+ (!type.predicate || type.predicate(object))) {
495
+ state.tag = explicit ? type.tag : '?';
496
+ if (type.represent) {
497
+ style = state.styleMap[type.tag] || type.defaultStyle;
498
+ if (_toString.call(type.represent) === '[object Function]') {
499
+ _result = type.represent(object, style);
500
+ }
501
+ else if (_hasOwnProperty.call(type.represent, style)) {
502
+ _result = type.represent[style](object, style);
503
+ }
504
+ else {
505
+ throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style');
506
+ }
507
+ state.dump = _result;
508
+ }
509
+ return true;
510
+ }
511
+ }
512
+ return false;
513
+ }
514
+ function writeNode(state, level, object, block, compact, iskey, pointer) {
515
+ state.tag = null;
516
+ state.dump = object;
517
+ if (!detectType(state, object, false)) {
518
+ detectType(state, object, true);
519
+ }
520
+ var type = _toString.call(state.dump);
521
+ if (block) {
522
+ block = (state.flowLevel < 0 || state.flowLevel > level);
523
+ }
524
+ if ((state.tag !== null && state.tag !== '?') || (state.indent !== 2 && level > 0)) {
525
+ compact = false;
526
+ }
527
+ var objectOrArray = type === '[object Object]' || type === '[object Array]', duplicateIndex, duplicate;
528
+ if (objectOrArray) {
529
+ duplicateIndex = state.duplicates.indexOf(object);
530
+ duplicate = duplicateIndex !== -1;
531
+ }
532
+ if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) {
533
+ compact = false;
534
+ }
535
+ if (duplicate && state.usedDuplicates[duplicateIndex]) {
536
+ state.dump = '*ref_' + duplicateIndex;
537
+ }
538
+ else {
539
+ if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
540
+ state.usedDuplicates[duplicateIndex] = true;
541
+ }
542
+ if (type === '[object Object]') {
543
+ if (block && (Object.keys(state.dump).length !== 0)) {
544
+ writeBlockMapping(state, level, state.dump, compact, pointer);
545
+ if (duplicate) {
546
+ state.dump = '&ref_' + duplicateIndex + state.dump;
547
+ }
548
+ }
549
+ else {
550
+ writeFlowMapping(state, level, state.dump, pointer);
551
+ if (duplicate) {
552
+ state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
553
+ }
554
+ }
555
+ }
556
+ else if (type === '[object Array]') {
557
+ var arrayLevel = (state.noArrayIndent && (level > 0)) ? level - 1 : level;
558
+ if (block && (state.dump.length !== 0)) {
559
+ writeBlockSequence(state, arrayLevel, state.dump, compact, pointer);
560
+ if (duplicate) {
561
+ state.dump = '&ref_' + duplicateIndex + state.dump;
562
+ }
563
+ }
564
+ else {
565
+ writeFlowSequence(state, arrayLevel, state.dump, pointer);
566
+ if (duplicate) {
567
+ state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
568
+ }
569
+ }
570
+ }
571
+ else if (type === '[object String]') {
572
+ if (state.tag !== '?') {
573
+ writeScalar(state, state.dump, level, iskey, pointer);
574
+ }
575
+ }
576
+ else {
577
+ if (state.skipInvalid)
578
+ return false;
579
+ throw new YAMLException('unacceptable kind of an object to dump ' + type);
580
+ }
581
+ if (state.tag !== null && state.tag !== '?') {
582
+ state.dump = '!<' + state.tag + '> ' + state.dump;
583
+ }
584
+ }
585
+ return true;
586
+ }
587
+ function getDuplicateReferences(object, state) {
588
+ var objects = [], duplicatesIndexes = [], index, length;
589
+ inspectNode(object, objects, duplicatesIndexes);
590
+ for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
591
+ state.duplicates.push(objects[duplicatesIndexes[index]]);
592
+ }
593
+ state.usedDuplicates = new Array(length);
594
+ }
595
+ function inspectNode(object, objects, duplicatesIndexes) {
596
+ var objectKeyList, index, length;
597
+ if (object !== null && typeof object === 'object') {
598
+ index = objects.indexOf(object);
599
+ if (index !== -1) {
600
+ if (duplicatesIndexes.indexOf(index) === -1) {
601
+ duplicatesIndexes.push(index);
602
+ }
603
+ }
604
+ else {
605
+ objects.push(object);
606
+ if (Array.isArray(object)) {
607
+ for (index = 0, length = object.length; index < length; index += 1) {
608
+ inspectNode(object[index], objects, duplicatesIndexes);
609
+ }
610
+ }
611
+ else {
612
+ objectKeyList = Object.keys(object);
613
+ for (index = 0, length = objectKeyList.length; index < length; index += 1) {
614
+ inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
615
+ }
616
+ }
617
+ }
618
+ }
619
+ }
620
+ function dump(input, options) {
621
+ options = options || {};
622
+ var state = new State(options);
623
+ if (!options.noRefs)
624
+ getDuplicateReferences(input, state);
625
+ if (writeNode(state, 0, input, true, true, false, '#')) {
626
+ return state.dump + '\n';
627
+ }
628
+ return '';
629
+ }
630
+ exports.dump = dump;
631
+ function safeDump(input, options) {
632
+ return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
633
+ }
634
+ exports.safeDump = safeDump;
635
+ const TILDE_REGEXP = /~/g;
636
+ const SLASH_REGEXP = /\//g;
637
+ function encodeSegment(input) {
638
+ return input.replace(TILDE_REGEXP, '~0').replace(SLASH_REGEXP, '~1');
639
+ }
640
+ function Comments(state, pointer) {
641
+ this.state = state;
642
+ this.comments = {
643
+ 'before-eol': new Set(),
644
+ leading: new Set(),
645
+ trailing: new Set(),
646
+ before: new Map(),
647
+ after: new Map(),
648
+ };
649
+ this.written = new WeakSet();
650
+ if (state.comments !== null && pointer in state.comments) {
651
+ for (let comment of state.comments[pointer]) {
652
+ switch (comment.placement) {
653
+ case 'before-eol':
654
+ case 'leading':
655
+ case 'trailing':
656
+ this.comments[comment.placement].add(comment);
657
+ break;
658
+ case 'between':
659
+ let before = this.comments.before.get(comment.between[1]);
660
+ if (!before) {
661
+ this.comments.before.set(comment.between[1], new Set([comment]));
662
+ }
663
+ else {
664
+ before.add(comment);
665
+ }
666
+ let after = this.comments.after.get(comment.between[0]);
667
+ if (!after) {
668
+ this.comments.after.set(comment.between[0], new Set([comment]));
669
+ }
670
+ else {
671
+ after.add(comment);
672
+ }
673
+ break;
674
+ }
675
+ }
676
+ }
677
+ }
678
+ Comments.prototype.write = function (level, placement) {
679
+ let result = '';
680
+ for (let comment of this.comments[placement]) {
681
+ result += this._write(comment, level);
682
+ }
683
+ return result;
684
+ };
685
+ Comments.prototype.writeAt = function (key, level, placement) {
686
+ let result = '';
687
+ let comments = this.comments[placement].get(key);
688
+ if (comments) {
689
+ for (let comment of comments) {
690
+ result += this._write(comment, level);
691
+ }
692
+ }
693
+ return result;
694
+ };
695
+ Comments.prototype._write = function (comment, level) {
696
+ if (this.written.has(comment))
697
+ return '';
698
+ this.written.add(comment);
699
+ let result = '#' + comment.value;
700
+ if (comment.placement === 'before-eol') {
701
+ return result;
702
+ }
703
+ else if (level === 0 && comment.placement === 'leading') {
704
+ return result + '\n';
705
+ }
706
+ else {
707
+ return generateNextLine(this.state, level) + result;
708
+ }
709
+ };
710
+ //# sourceMappingURL=dumper.js.map