@kubb/agent 4.33.5 → 4.35.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 (63) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/server/chunks/nitro/nitro.mjs +409 -4248
  3. package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
  4. package/.output/server/chunks/routes/api/health.get.mjs +3 -1
  5. package/.output/server/chunks/routes/api/health.get.mjs.map +1 -1
  6. package/.output/server/index.mjs +3 -1
  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/fflate/esm/index.mjs +2679 -0
  57. package/.output/server/node_modules/fflate/package.json +127 -0
  58. package/.output/server/node_modules/tinyexec/dist/{main.js → main.mjs} +158 -149
  59. package/.output/server/node_modules/tinyexec/package.json +15 -14
  60. package/.output/server/node_modules/tslib/package.json +47 -0
  61. package/.output/server/node_modules/tslib/tslib.js +484 -0
  62. package/.output/server/package.json +8 -2
  63. package/package.json +18 -18
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+ const common = require("./common");
3
+ class Mark {
4
+ constructor(name, buffer, position, line, column) {
5
+ this.name = name;
6
+ this.buffer = buffer;
7
+ this.position = position;
8
+ this.line = line;
9
+ this.column = column;
10
+ }
11
+ getSnippet(indent = 0, maxLength = 75) {
12
+ var head, start, tail, end, snippet;
13
+ if (!this.buffer) {
14
+ return null;
15
+ }
16
+ indent = indent || 4;
17
+ maxLength = maxLength || 75;
18
+ head = '';
19
+ start = this.position;
20
+ while (start > 0 && -1 === '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1))) {
21
+ start -= 1;
22
+ if (this.position - start > (maxLength / 2 - 1)) {
23
+ head = ' ... ';
24
+ start += 5;
25
+ break;
26
+ }
27
+ }
28
+ tail = '';
29
+ end = this.position;
30
+ while (end < this.buffer.length && -1 === '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end))) {
31
+ end += 1;
32
+ if (end - this.position > (maxLength / 2 - 1)) {
33
+ tail = ' ... ';
34
+ end -= 5;
35
+ break;
36
+ }
37
+ }
38
+ snippet = this.buffer.slice(start, end);
39
+ return common.repeat(' ', indent) + head + snippet + tail + '\n' +
40
+ common.repeat(' ', indent + this.position - start + head.length) + '^';
41
+ }
42
+ toString(compact = true) {
43
+ var snippet, where = '';
44
+ if (this.name) {
45
+ where += 'in "' + this.name + '" ';
46
+ }
47
+ where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1);
48
+ if (!compact) {
49
+ snippet = this.getSnippet();
50
+ if (snippet) {
51
+ where += ':\n' + snippet;
52
+ }
53
+ }
54
+ return where;
55
+ }
56
+ }
57
+ module.exports = Mark;
58
+ //# sourceMappingURL=mark.js.map
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function parseYamlBoolean(input) {
4
+ if (["true", "True", "TRUE"].lastIndexOf(input) >= 0) {
5
+ return true;
6
+ }
7
+ else if (["false", "False", "FALSE"].lastIndexOf(input) >= 0) {
8
+ return false;
9
+ }
10
+ throw `Invalid boolean "${input}"`;
11
+ }
12
+ exports.parseYamlBoolean = parseYamlBoolean;
13
+ function safeParseYamlInteger(input) {
14
+ if (input.lastIndexOf('0o', 0) === 0) {
15
+ return parseInt(input.substring(2), 8);
16
+ }
17
+ return parseInt(input);
18
+ }
19
+ function parseYamlInteger(input) {
20
+ const result = safeParseYamlInteger(input);
21
+ if (Number.isNaN(result)) {
22
+ throw `Invalid integer "${input}"`;
23
+ }
24
+ return result;
25
+ }
26
+ exports.parseYamlInteger = parseYamlInteger;
27
+ function parseYamlBigInteger(input) {
28
+ const result = parseYamlInteger(input);
29
+ if (result > Number.MAX_SAFE_INTEGER && input.lastIndexOf('0o', 0) === -1) {
30
+ return BigInt(input);
31
+ }
32
+ return result;
33
+ }
34
+ exports.parseYamlBigInteger = parseYamlBigInteger;
35
+ function parseYamlFloat(input) {
36
+ if ([".nan", ".NaN", ".NAN"].lastIndexOf(input) >= 0) {
37
+ return NaN;
38
+ }
39
+ const infinity = /^([-+])?(?:\.inf|\.Inf|\.INF)$/;
40
+ const match = infinity.exec(input);
41
+ if (match) {
42
+ return (match[1] === '-') ? -Infinity : Infinity;
43
+ }
44
+ const result = parseFloat(input);
45
+ if (!isNaN(result)) {
46
+ return result;
47
+ }
48
+ throw `Invalid float "${input}"`;
49
+ }
50
+ exports.parseYamlFloat = parseYamlFloat;
51
+ var ScalarType;
52
+ (function (ScalarType) {
53
+ ScalarType[ScalarType["null"] = 0] = "null";
54
+ ScalarType[ScalarType["bool"] = 1] = "bool";
55
+ ScalarType[ScalarType["int"] = 2] = "int";
56
+ ScalarType[ScalarType["float"] = 3] = "float";
57
+ ScalarType[ScalarType["string"] = 4] = "string";
58
+ })(ScalarType = exports.ScalarType || (exports.ScalarType = {}));
59
+ function determineScalarType(node) {
60
+ if (node === undefined) {
61
+ return ScalarType.null;
62
+ }
63
+ if (node.doubleQuoted || !node.plainScalar || node['singleQuoted']) {
64
+ return ScalarType.string;
65
+ }
66
+ const value = node.value;
67
+ if (["null", "Null", "NULL", "~", ''].indexOf(value) >= 0) {
68
+ return ScalarType.null;
69
+ }
70
+ if (value === null || value === undefined) {
71
+ return ScalarType.null;
72
+ }
73
+ if (["true", "True", "TRUE", "false", "False", "FALSE"].indexOf(value) >= 0) {
74
+ return ScalarType.bool;
75
+ }
76
+ const base10 = /^[-+]?[0-9]+$/;
77
+ const base8 = /^0o[0-7]+$/;
78
+ const base16 = /^0x[0-9a-fA-F]+$/;
79
+ if (base10.test(value) || base8.test(value) || base16.test(value)) {
80
+ return ScalarType.int;
81
+ }
82
+ const float = /^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$/;
83
+ const infinity = /^[-+]?(\.inf|\.Inf|\.INF)$/;
84
+ if (float.test(value) || infinity.test(value) || [".nan", ".NaN", ".NAN"].indexOf(value) >= 0) {
85
+ return ScalarType.float;
86
+ }
87
+ return ScalarType.string;
88
+ }
89
+ exports.determineScalarType = determineScalarType;
90
+ //# sourceMappingURL=scalarInference.js.map
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+ const schema_1 = require("../schema");
3
+ module.exports = new schema_1.Schema({
4
+ include: [
5
+ require('./json')
6
+ ]
7
+ });
8
+ //# sourceMappingURL=core.js.map
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+ const schema_1 = require("../schema");
3
+ var schema = new schema_1.Schema({
4
+ include: [
5
+ require('./default_safe')
6
+ ],
7
+ explicit: [
8
+ require('../type/js/undefined'),
9
+ require('../type/js/regexp')
10
+ ]
11
+ });
12
+ schema_1.Schema.DEFAULT = schema;
13
+ module.exports = schema;
14
+ //# sourceMappingURL=default_full.js.map
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+ const schema_1 = require("../schema");
3
+ var schema = new schema_1.Schema({
4
+ include: [
5
+ require('./core')
6
+ ],
7
+ implicit: [
8
+ require('../type/timestamp'),
9
+ require('../type/merge')
10
+ ],
11
+ explicit: [
12
+ require('../type/binary'),
13
+ require('../type/omap'),
14
+ require('../type/pairs'),
15
+ require('../type/set')
16
+ ]
17
+ });
18
+ module.exports = schema;
19
+ //# sourceMappingURL=default_safe.js.map
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+ const schema_1 = require("../schema");
3
+ module.exports = new schema_1.Schema({
4
+ explicit: [
5
+ require('../type/str'),
6
+ require('../type/seq'),
7
+ require('../type/map')
8
+ ]
9
+ });
10
+ //# sourceMappingURL=failsafe.js.map
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+ const schema_1 = require("../schema");
3
+ module.exports = new schema_1.Schema({
4
+ include: [
5
+ require('./failsafe')
6
+ ],
7
+ implicit: [
8
+ require('../type/null'),
9
+ require('../type/bool'),
10
+ require('../type/int'),
11
+ require('../type/float')
12
+ ]
13
+ });
14
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1,77 @@
1
+ 'use strict';
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const common = require("./common");
4
+ const YAMLException = require("./exception");
5
+ const type_1 = require("./type");
6
+ function compileList(schema, name, result) {
7
+ var exclude = [];
8
+ schema.include.forEach(function (includedSchema) {
9
+ result = compileList(includedSchema, name, result);
10
+ });
11
+ schema[name].forEach(function (currentType) {
12
+ result.forEach(function (previousType, previousIndex) {
13
+ if (previousType.tag === currentType.tag) {
14
+ exclude.push(previousIndex);
15
+ }
16
+ });
17
+ result.push(currentType);
18
+ });
19
+ return result.filter(function (type, index) {
20
+ return -1 === exclude.indexOf(index);
21
+ });
22
+ }
23
+ function compileMap() {
24
+ var result = {}, index, length;
25
+ function collectType(type) {
26
+ result[type.tag] = type;
27
+ }
28
+ for (index = 0, length = arguments.length; index < length; index += 1) {
29
+ arguments[index].forEach(collectType);
30
+ }
31
+ return result;
32
+ }
33
+ class Schema {
34
+ constructor(definition) {
35
+ this.include = definition.include || [];
36
+ this.implicit = definition.implicit || [];
37
+ this.explicit = definition.explicit || [];
38
+ this.implicit.forEach(function (type) {
39
+ if (type.loadKind && 'scalar' !== type.loadKind) {
40
+ throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
41
+ }
42
+ });
43
+ this.compiledImplicit = compileList(this, 'implicit', []);
44
+ this.compiledExplicit = compileList(this, 'explicit', []);
45
+ this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);
46
+ }
47
+ }
48
+ exports.Schema = Schema;
49
+ Schema.DEFAULT = null;
50
+ Schema.create = function createSchema() {
51
+ var schemas, types;
52
+ switch (arguments.length) {
53
+ case 1:
54
+ schemas = Schema.DEFAULT;
55
+ types = arguments[0];
56
+ break;
57
+ case 2:
58
+ schemas = arguments[0];
59
+ types = arguments[1];
60
+ break;
61
+ default:
62
+ throw new YAMLException('Wrong number of arguments for Schema.create function');
63
+ }
64
+ schemas = common.toArray(schemas);
65
+ types = common.toArray(types);
66
+ if (!schemas.every(function (schema) { return schema instanceof Schema; })) {
67
+ throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.');
68
+ }
69
+ if (!types.every(function (type) { return type instanceof type_1.Type; })) {
70
+ throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.');
71
+ }
72
+ return new Schema({
73
+ include: schemas,
74
+ explicit: types
75
+ });
76
+ };
77
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1,92 @@
1
+ 'use strict';
2
+ var NodeBuffer = require('buffer').Buffer;
3
+ const type_1 = require("../type");
4
+ var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
5
+ function resolveYamlBinary(data) {
6
+ if (null === data) {
7
+ return false;
8
+ }
9
+ var code, idx, bitlen = 0, len = 0, max = data.length, map = BASE64_MAP;
10
+ for (idx = 0; idx < max; idx++) {
11
+ code = map.indexOf(data.charAt(idx));
12
+ if (code > 64) {
13
+ continue;
14
+ }
15
+ if (code < 0) {
16
+ return false;
17
+ }
18
+ bitlen += 6;
19
+ }
20
+ return (bitlen % 8) === 0;
21
+ }
22
+ function constructYamlBinary(data) {
23
+ var code, idx, tailbits, input = data.replace(/[\r\n=]/g, ''), max = input.length, map = BASE64_MAP, bits = 0, result = [];
24
+ for (idx = 0; idx < max; idx++) {
25
+ if ((idx % 4 === 0) && idx) {
26
+ result.push((bits >> 16) & 0xFF);
27
+ result.push((bits >> 8) & 0xFF);
28
+ result.push(bits & 0xFF);
29
+ }
30
+ bits = (bits << 6) | map.indexOf(input.charAt(idx));
31
+ }
32
+ tailbits = (max % 4) * 6;
33
+ if (tailbits === 0) {
34
+ result.push((bits >> 16) & 0xFF);
35
+ result.push((bits >> 8) & 0xFF);
36
+ result.push(bits & 0xFF);
37
+ }
38
+ else if (tailbits === 18) {
39
+ result.push((bits >> 10) & 0xFF);
40
+ result.push((bits >> 2) & 0xFF);
41
+ }
42
+ else if (tailbits === 12) {
43
+ result.push((bits >> 4) & 0xFF);
44
+ }
45
+ if (NodeBuffer) {
46
+ return new NodeBuffer(result);
47
+ }
48
+ return result;
49
+ }
50
+ function representYamlBinary(object) {
51
+ var result = '', bits = 0, idx, tail, max = object.length, map = BASE64_MAP;
52
+ for (idx = 0; idx < max; idx++) {
53
+ if ((idx % 3 === 0) && idx) {
54
+ result += map[(bits >> 18) & 0x3F];
55
+ result += map[(bits >> 12) & 0x3F];
56
+ result += map[(bits >> 6) & 0x3F];
57
+ result += map[bits & 0x3F];
58
+ }
59
+ bits = (bits << 8) + object[idx];
60
+ }
61
+ tail = max % 3;
62
+ if (tail === 0) {
63
+ result += map[(bits >> 18) & 0x3F];
64
+ result += map[(bits >> 12) & 0x3F];
65
+ result += map[(bits >> 6) & 0x3F];
66
+ result += map[bits & 0x3F];
67
+ }
68
+ else if (tail === 2) {
69
+ result += map[(bits >> 10) & 0x3F];
70
+ result += map[(bits >> 4) & 0x3F];
71
+ result += map[(bits << 2) & 0x3F];
72
+ result += map[64];
73
+ }
74
+ else if (tail === 1) {
75
+ result += map[(bits >> 2) & 0x3F];
76
+ result += map[(bits << 4) & 0x3F];
77
+ result += map[64];
78
+ result += map[64];
79
+ }
80
+ return result;
81
+ }
82
+ function isBinary(object) {
83
+ return NodeBuffer && NodeBuffer.isBuffer(object);
84
+ }
85
+ module.exports = new type_1.Type('tag:yaml.org,2002:binary', {
86
+ kind: 'scalar',
87
+ resolve: resolveYamlBinary,
88
+ construct: constructYamlBinary,
89
+ predicate: isBinary,
90
+ represent: representYamlBinary
91
+ });
92
+ //# sourceMappingURL=binary.js.map
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ 'use strict';
3
+ const type_1 = require("../type");
4
+ function resolveYamlBoolean(data) {
5
+ if (null === data) {
6
+ return false;
7
+ }
8
+ var max = data.length;
9
+ return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||
10
+ (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));
11
+ }
12
+ function constructYamlBoolean(data) {
13
+ return data === 'true' ||
14
+ data === 'True' ||
15
+ data === 'TRUE';
16
+ }
17
+ function isBoolean(object) {
18
+ return '[object Boolean]' === Object.prototype.toString.call(object);
19
+ }
20
+ module.exports = new type_1.Type('tag:yaml.org,2002:bool', {
21
+ kind: 'scalar',
22
+ resolve: resolveYamlBoolean,
23
+ construct: constructYamlBoolean,
24
+ predicate: isBoolean,
25
+ represent: {
26
+ lowercase: function (object) { return object ? 'true' : 'false'; },
27
+ uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },
28
+ camelcase: function (object) { return object ? 'True' : 'False'; }
29
+ },
30
+ defaultStyle: 'lowercase'
31
+ });
32
+ //# sourceMappingURL=bool.js.map
@@ -0,0 +1,94 @@
1
+ 'use strict';
2
+ const common = require("../common");
3
+ const type_1 = require("../type");
4
+ var YAML_FLOAT_PATTERN = new RegExp('^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' +
5
+ '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' +
6
+ '|[-+]?\\.(?:inf|Inf|INF)' +
7
+ '|\\.(?:nan|NaN|NAN))$');
8
+ function resolveYamlFloat(data) {
9
+ if (null === data) {
10
+ return false;
11
+ }
12
+ var value, sign, base, digits;
13
+ if (!YAML_FLOAT_PATTERN.test(data)) {
14
+ return false;
15
+ }
16
+ return true;
17
+ }
18
+ function constructYamlFloat(data) {
19
+ var value, sign, base, digits;
20
+ value = data.replace(/_/g, '').toLowerCase();
21
+ sign = '-' === value[0] ? -1 : 1;
22
+ digits = [];
23
+ if (0 <= '+-'.indexOf(value[0])) {
24
+ value = value.slice(1);
25
+ }
26
+ if ('.inf' === value) {
27
+ return (1 === sign) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
28
+ }
29
+ else if ('.nan' === value) {
30
+ return NaN;
31
+ }
32
+ else if (0 <= value.indexOf(':')) {
33
+ value.split(':').forEach(function (v) {
34
+ digits.unshift(parseFloat(v, 10));
35
+ });
36
+ value = 0.0;
37
+ base = 1;
38
+ digits.forEach(function (d) {
39
+ value += d * base;
40
+ base *= 60;
41
+ });
42
+ return sign * value;
43
+ }
44
+ return sign * parseFloat(value, 10);
45
+ }
46
+ function representYamlFloat(object, style) {
47
+ if (isNaN(object)) {
48
+ switch (style) {
49
+ case 'lowercase':
50
+ return '.nan';
51
+ case 'uppercase':
52
+ return '.NAN';
53
+ case 'camelcase':
54
+ return '.NaN';
55
+ }
56
+ }
57
+ else if (Number.POSITIVE_INFINITY === object) {
58
+ switch (style) {
59
+ case 'lowercase':
60
+ return '.inf';
61
+ case 'uppercase':
62
+ return '.INF';
63
+ case 'camelcase':
64
+ return '.Inf';
65
+ }
66
+ }
67
+ else if (Number.NEGATIVE_INFINITY === object) {
68
+ switch (style) {
69
+ case 'lowercase':
70
+ return '-.inf';
71
+ case 'uppercase':
72
+ return '-.INF';
73
+ case 'camelcase':
74
+ return '-.Inf';
75
+ }
76
+ }
77
+ else if (common.isNegativeZero(object)) {
78
+ return '-0.0';
79
+ }
80
+ return object.toString(10);
81
+ }
82
+ function isFloat(object) {
83
+ return ('[object Number]' === Object.prototype.toString.call(object)) &&
84
+ (0 !== object % 1 || common.isNegativeZero(object));
85
+ }
86
+ module.exports = new type_1.Type('tag:yaml.org,2002:float', {
87
+ kind: 'scalar',
88
+ resolve: resolveYamlFloat,
89
+ construct: constructYamlFloat,
90
+ predicate: isFloat,
91
+ represent: representYamlFloat,
92
+ defaultStyle: 'lowercase'
93
+ });
94
+ //# sourceMappingURL=float.js.map
@@ -0,0 +1,159 @@
1
+ 'use strict';
2
+ const common = require("../common");
3
+ const type_1 = require("../type");
4
+ function isHexCode(c) {
5
+ return ((0x30 <= c) && (c <= 0x39)) ||
6
+ ((0x41 <= c) && (c <= 0x46)) ||
7
+ ((0x61 <= c) && (c <= 0x66));
8
+ }
9
+ function isOctCode(c) {
10
+ return ((0x30 <= c) && (c <= 0x37));
11
+ }
12
+ function isDecCode(c) {
13
+ return ((0x30 <= c) && (c <= 0x39));
14
+ }
15
+ function resolveYamlInteger(data) {
16
+ if (null === data) {
17
+ return false;
18
+ }
19
+ var max = data.length, index = 0, hasDigits = false, ch;
20
+ if (!max) {
21
+ return false;
22
+ }
23
+ ch = data[index];
24
+ if (ch === '-' || ch === '+') {
25
+ ch = data[++index];
26
+ }
27
+ if (ch === '0') {
28
+ if (index + 1 === max) {
29
+ return true;
30
+ }
31
+ ch = data[++index];
32
+ if (ch === 'b') {
33
+ index++;
34
+ for (; index < max; index++) {
35
+ ch = data[index];
36
+ if (ch === '_') {
37
+ continue;
38
+ }
39
+ if (ch !== '0' && ch !== '1') {
40
+ return false;
41
+ }
42
+ hasDigits = true;
43
+ }
44
+ return hasDigits;
45
+ }
46
+ if (ch === 'x') {
47
+ index++;
48
+ for (; index < max; index++) {
49
+ ch = data[index];
50
+ if (ch === '_') {
51
+ continue;
52
+ }
53
+ if (!isHexCode(data.charCodeAt(index))) {
54
+ return false;
55
+ }
56
+ hasDigits = true;
57
+ }
58
+ return hasDigits;
59
+ }
60
+ for (; index < max; index++) {
61
+ ch = data[index];
62
+ if (ch === '_') {
63
+ continue;
64
+ }
65
+ if (!isOctCode(data.charCodeAt(index))) {
66
+ hasDigits = false;
67
+ break;
68
+ }
69
+ hasDigits = true;
70
+ }
71
+ if (hasDigits) {
72
+ return hasDigits;
73
+ }
74
+ }
75
+ for (; index < max; index++) {
76
+ ch = data[index];
77
+ if (ch === '_') {
78
+ continue;
79
+ }
80
+ if (ch === ':') {
81
+ break;
82
+ }
83
+ if (!isDecCode(data.charCodeAt(index))) {
84
+ return false;
85
+ }
86
+ hasDigits = true;
87
+ }
88
+ if (!hasDigits) {
89
+ return false;
90
+ }
91
+ if (ch !== ':') {
92
+ return true;
93
+ }
94
+ return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
95
+ }
96
+ function constructYamlInteger(data) {
97
+ var value = data, sign = 1, ch, base, digits = [];
98
+ if (value.indexOf('_') !== -1) {
99
+ value = value.replace(/_/g, '');
100
+ }
101
+ ch = value[0];
102
+ if (ch === '-' || ch === '+') {
103
+ if (ch === '-') {
104
+ sign = -1;
105
+ }
106
+ value = value.slice(1);
107
+ ch = value[0];
108
+ }
109
+ if ('0' === value) {
110
+ return 0;
111
+ }
112
+ if (ch === '0') {
113
+ if (value[1] === 'b') {
114
+ return sign * parseInt(value.slice(2), 2);
115
+ }
116
+ if (value[1] === 'x') {
117
+ return sign * parseInt(value, 16);
118
+ }
119
+ return sign * parseInt(value, 8);
120
+ }
121
+ if (value.indexOf(':') !== -1) {
122
+ value.split(':').forEach(function (v) {
123
+ digits.unshift(parseInt(v, 10));
124
+ });
125
+ value = 0;
126
+ base = 1;
127
+ digits.forEach(function (d) {
128
+ value += (d * base);
129
+ base *= 60;
130
+ });
131
+ return sign * value;
132
+ }
133
+ return sign * parseInt(value, 10);
134
+ }
135
+ function isInteger(object) {
136
+ const type = Object.prototype.toString.call(object);
137
+ return (('[object Number]' === type && (0 === object % 1 && !common.isNegativeZero(object))) ||
138
+ '[object BigInt]' === type);
139
+ }
140
+ module.exports = new type_1.Type('tag:yaml.org,2002:int', {
141
+ kind: 'scalar',
142
+ resolve: resolveYamlInteger,
143
+ construct: constructYamlInteger,
144
+ predicate: isInteger,
145
+ represent: {
146
+ binary: function (object) { return '0b' + object.toString(2); },
147
+ octal: function (object) { return '0' + object.toString(8); },
148
+ decimal: function (object) { return object.toString(10); },
149
+ hexadecimal: function (object) { return '0x' + object.toString(16).toUpperCase(); }
150
+ },
151
+ defaultStyle: 'decimal',
152
+ styleAliases: {
153
+ binary: [2, 'bin'],
154
+ octal: [8, 'oct'],
155
+ decimal: [10, 'dec'],
156
+ hexadecimal: [16, 'hex']
157
+ }
158
+ });
159
+ //# sourceMappingURL=int.js.map