@kubb/agent 4.33.5 → 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 +22 -4176
  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,98 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const buildJsonPath_1 = require("./buildJsonPath");
4
+ const types_1 = require("./types");
5
+ const utils_1 = require("./utils");
6
+ exports.getJsonPathForPosition = ({ ast, lineMap }, { line, character }) => {
7
+ if (line >= lineMap.length || character >= lineMap[line]) {
8
+ return;
9
+ }
10
+ const startOffset = line === 0 ? 0 : lineMap[line - 1] + 1;
11
+ const node = findClosestScalar(ast, Math.min(lineMap[line] - 1, startOffset + character), line, lineMap);
12
+ if (!utils_1.isObject(node))
13
+ return;
14
+ const path = buildJsonPath_1.buildJsonPath(node);
15
+ if (path.length === 0)
16
+ return;
17
+ return path;
18
+ };
19
+ function* walk(node) {
20
+ switch (node.kind) {
21
+ case types_1.Kind.MAP:
22
+ if (node.mappings.length !== 0) {
23
+ for (const mapping of node.mappings) {
24
+ if (utils_1.isObject(mapping)) {
25
+ yield mapping;
26
+ }
27
+ }
28
+ }
29
+ break;
30
+ case types_1.Kind.MAPPING:
31
+ if (utils_1.isObject(node.key)) {
32
+ yield node.key;
33
+ }
34
+ if (utils_1.isObject(node.value)) {
35
+ yield node.value;
36
+ }
37
+ break;
38
+ case types_1.Kind.SEQ:
39
+ if (node.items.length !== 0) {
40
+ for (const item of node.items) {
41
+ if (utils_1.isObject(item)) {
42
+ yield item;
43
+ }
44
+ }
45
+ }
46
+ break;
47
+ case types_1.Kind.SCALAR:
48
+ yield node;
49
+ break;
50
+ }
51
+ }
52
+ function getFirstScalarChild(node, line, lineMap) {
53
+ const startOffset = lineMap[line - 1] + 1;
54
+ const endOffset = lineMap[line];
55
+ switch (node.kind) {
56
+ case types_1.Kind.MAPPING:
57
+ return node.key;
58
+ case types_1.Kind.MAP:
59
+ if (node.mappings.length !== 0) {
60
+ for (const mapping of node.mappings) {
61
+ if (mapping.startPosition > startOffset && mapping.startPosition <= endOffset) {
62
+ return getFirstScalarChild(mapping, line, lineMap);
63
+ }
64
+ }
65
+ }
66
+ break;
67
+ case types_1.Kind.SEQ:
68
+ if (node.items.length !== 0) {
69
+ for (const item of node.items) {
70
+ if (item !== null && item.startPosition > startOffset && item.startPosition <= endOffset) {
71
+ return getFirstScalarChild(item, line, lineMap);
72
+ }
73
+ }
74
+ }
75
+ break;
76
+ }
77
+ return node;
78
+ }
79
+ function findClosestScalar(container, offset, line, lineMap) {
80
+ for (const node of walk(container)) {
81
+ if (node.startPosition <= offset && offset <= node.endPosition) {
82
+ return node.kind === types_1.Kind.SCALAR ? node : findClosestScalar(node, offset, line, lineMap);
83
+ }
84
+ }
85
+ if (lineMap[line - 1] === lineMap[line] - 1) {
86
+ return container;
87
+ }
88
+ if (container.startPosition < lineMap[line - 1] && offset <= container.endPosition) {
89
+ if (container.kind !== types_1.Kind.MAPPING) {
90
+ return getFirstScalarChild(container, line, lineMap);
91
+ }
92
+ if (container.value && container.key.endPosition < offset) {
93
+ return getFirstScalarChild(container.value, line, lineMap);
94
+ }
95
+ }
96
+ return container;
97
+ }
98
+ //# sourceMappingURL=getJsonPathForPosition.js.map
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const lineForPosition_1 = require("./lineForPosition");
4
+ const types_1 = require("./types");
5
+ const utils_1 = require("./utils");
6
+ exports.getLocationForJsonPath = ({ ast, lineMap, metadata }, path, closest = false) => {
7
+ const node = findNodeAtPath(ast, path, { closest, mergeKeys: metadata !== undefined && metadata.mergeKeys === true });
8
+ if (node === void 0)
9
+ return;
10
+ return getLoc(lineMap, {
11
+ start: getStartPosition(node, lineMap.length > 0 ? lineMap[0] : 0),
12
+ end: getEndPosition(node),
13
+ });
14
+ };
15
+ function getStartPosition(node, offset) {
16
+ if (node.parent && node.parent.kind === types_1.Kind.MAPPING) {
17
+ if (node.parent.value === null) {
18
+ return node.parent.endPosition;
19
+ }
20
+ if (node.kind !== types_1.Kind.SCALAR) {
21
+ return node.parent.key.endPosition + 1;
22
+ }
23
+ }
24
+ if (node.parent === null && offset - node.startPosition === 0) {
25
+ return 0;
26
+ }
27
+ return node.startPosition;
28
+ }
29
+ function getEndPosition(node) {
30
+ switch (node.kind) {
31
+ case types_1.Kind.SEQ:
32
+ const { items } = node;
33
+ if (items.length !== 0) {
34
+ const lastItem = items[items.length - 1];
35
+ if (lastItem !== null) {
36
+ return getEndPosition(lastItem);
37
+ }
38
+ }
39
+ break;
40
+ case types_1.Kind.MAPPING:
41
+ if (node.value !== null) {
42
+ return getEndPosition(node.value);
43
+ }
44
+ break;
45
+ case types_1.Kind.MAP:
46
+ if (node.value !== null && node.mappings.length !== 0) {
47
+ return getEndPosition(node.mappings[node.mappings.length - 1]);
48
+ }
49
+ break;
50
+ case types_1.Kind.SCALAR:
51
+ if (node.parent !== null && node.parent.kind === types_1.Kind.MAPPING && node.parent.value === null) {
52
+ return node.parent.endPosition;
53
+ }
54
+ break;
55
+ }
56
+ return node.endPosition;
57
+ }
58
+ function findNodeAtPath(node, path, { closest, mergeKeys }) {
59
+ pathLoop: for (const segment of path) {
60
+ if (!utils_1.isObject(node)) {
61
+ return closest ? node : void 0;
62
+ }
63
+ switch (node.kind) {
64
+ case types_1.Kind.MAP:
65
+ const mappings = getMappings(node.mappings, mergeKeys);
66
+ for (let i = mappings.length - 1; i >= 0; i--) {
67
+ const item = mappings[i];
68
+ if (item.key.value === segment) {
69
+ if (item.value === null) {
70
+ node = item.key;
71
+ }
72
+ else {
73
+ node = item.value;
74
+ }
75
+ continue pathLoop;
76
+ }
77
+ }
78
+ return closest ? node : void 0;
79
+ case types_1.Kind.SEQ:
80
+ for (let i = 0; i < node.items.length; i++) {
81
+ if (i === Number(segment)) {
82
+ const item = node.items[i];
83
+ if (item === null) {
84
+ break;
85
+ }
86
+ node = item;
87
+ continue pathLoop;
88
+ }
89
+ }
90
+ return closest ? node : void 0;
91
+ default:
92
+ return closest ? node : void 0;
93
+ }
94
+ }
95
+ return node;
96
+ }
97
+ function getMappings(mappings, mergeKeys) {
98
+ if (!mergeKeys)
99
+ return mappings;
100
+ return mappings.reduce((mergedMappings, mapping) => {
101
+ if (utils_1.isObject(mapping)) {
102
+ if (mapping.key.value === "<<") {
103
+ mergedMappings.push(...reduceMergeKeys(mapping.value));
104
+ }
105
+ else {
106
+ mergedMappings.push(mapping);
107
+ }
108
+ }
109
+ return mergedMappings;
110
+ }, []);
111
+ }
112
+ function reduceMergeKeys(node) {
113
+ if (!utils_1.isObject(node))
114
+ return [];
115
+ switch (node.kind) {
116
+ case types_1.Kind.SEQ:
117
+ return node.items.reduceRight((items, item) => {
118
+ items.push(...reduceMergeKeys(item));
119
+ return items;
120
+ }, []);
121
+ case types_1.Kind.MAP:
122
+ return node.mappings;
123
+ case types_1.Kind.ANCHOR_REF:
124
+ return reduceMergeKeys(node.value);
125
+ default:
126
+ return [];
127
+ }
128
+ }
129
+ const getLoc = (lineMap, { start = 0, end = 0 }) => {
130
+ const startLine = lineForPosition_1.lineForPosition(start, lineMap);
131
+ const endLine = lineForPosition_1.lineForPosition(end, lineMap);
132
+ return {
133
+ range: {
134
+ start: {
135
+ line: startLine,
136
+ character: start - (startLine === 0 ? 0 : lineMap[startLine - 1]),
137
+ },
138
+ end: {
139
+ line: endLine,
140
+ character: end - (endLine === 0 ? 0 : lineMap[endLine - 1]),
141
+ },
142
+ },
143
+ };
144
+ };
145
+ //# sourceMappingURL=getLocationForJsonPath.js.map
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./buildJsonPath"), exports);
5
+ tslib_1.__exportStar(require("./dereferenceAnchor"), exports);
6
+ tslib_1.__exportStar(require("./getJsonPathForPosition"), exports);
7
+ tslib_1.__exportStar(require("./getLocationForJsonPath"), exports);
8
+ tslib_1.__exportStar(require("./lineForPosition"), exports);
9
+ var parse_1 = require("./parse");
10
+ exports.parse = parse_1.parse;
11
+ var parseWithPointers_1 = require("./parseWithPointers");
12
+ exports.parseWithPointers = parseWithPointers_1.parseWithPointers;
13
+ tslib_1.__exportStar(require("./safeStringify"), exports);
14
+ tslib_1.__exportStar(require("./types"), exports);
15
+ tslib_1.__exportStar(require("./trapAccess"), exports);
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.lineForPosition = (pos, lines, start = 0, end) => {
4
+ if (pos === 0 || lines.length === 0 || pos < lines[0]) {
5
+ return 0;
6
+ }
7
+ if (typeof end === 'undefined') {
8
+ end = lines.length;
9
+ }
10
+ const target = Math.floor((end - start) / 2) + start;
11
+ if (pos >= lines[target] && !lines[target + 1]) {
12
+ return target + 1;
13
+ }
14
+ const nextLinePos = lines[Math.min(target + 1, lines.length)];
15
+ if (pos === lines[target] - 1) {
16
+ return target;
17
+ }
18
+ if (pos >= lines[target] && pos <= nextLinePos) {
19
+ if (pos === nextLinePos) {
20
+ return target + 2;
21
+ }
22
+ return target + 1;
23
+ }
24
+ if (pos > lines[target]) {
25
+ return exports.lineForPosition(pos, lines, target + 1, end);
26
+ }
27
+ else {
28
+ return exports.lineForPosition(pos, lines, start, target - 1);
29
+ }
30
+ };
31
+ //# sourceMappingURL=lineForPosition.js.map
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@stoplight/yaml",
3
+ "version": "4.3.0",
4
+ "description": "Useful functions when working with YAML.",
5
+ "keywords": [
6
+ "yaml",
7
+ "yaml parser",
8
+ "yaml.parse",
9
+ "parser",
10
+ "sourcemap"
11
+ ],
12
+ "main": "index.js",
13
+ "sideEffects": false,
14
+ "files": [
15
+ "**/*"
16
+ ],
17
+ "author": "Stoplight <support@stoplight.io>",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/stoplightio/yaml"
21
+ },
22
+ "license": "Apache-2.0",
23
+ "engines": {
24
+ "node": ">=10.8"
25
+ },
26
+ "dependencies": {
27
+ "@stoplight/ordered-object-literal": "^1.0.5",
28
+ "@stoplight/types": "^14.1.1",
29
+ "@stoplight/yaml-ast-parser": "0.0.50",
30
+ "tslib": "^2.2.0"
31
+ },
32
+ "typings": "index.d.ts"
33
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const parseWithPointers_1 = require("./parseWithPointers");
4
+ exports.parse = (value) => parseWithPointers_1.parseWithPointers(value).data;
5
+ //# sourceMappingURL=parse.js.map