oas 21.0.3 → 21.1.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.
- package/dist/analyzer/{index.mjs → index.cjs} +38 -35
- package/dist/analyzer/{index.d.mts → index.d.cts} +1 -1
- package/dist/analyzer/index.js +35 -38
- package/dist/{chunk-5SKPBQ3A.mjs → chunk-4DSP2IAD.cjs} +6 -2
- package/dist/{chunk-554KJ3NF.mjs → chunk-AWYLU6KF.cjs} +15 -7
- package/dist/chunk-BDVPPDWX.js +14 -20
- package/dist/chunk-CKC36IL7.js +3 -6
- package/dist/chunk-EYQ3PAIA.js +1 -5
- package/dist/{chunk-JK7HBFVV.mjs → chunk-GT2RVQRP.cjs} +45 -36
- package/dist/chunk-HK3IBLG2.js +35 -44
- package/dist/{chunk-2LQJJT5I.mjs → chunk-NFN6C7L3.cjs} +21 -15
- package/dist/chunk-SS6ORC4G.js +6 -14
- package/dist/chunk-SUR6DBOY.js +18 -33
- package/dist/chunk-W6GBV2JT.cjs +25 -0
- package/dist/{chunk-Z4A553UU.mjs → chunk-Y7RSAOGJ.cjs} +34 -19
- package/dist/index.cjs +34 -0
- package/dist/{index.d.mts → index.d.cts} +4 -4
- package/dist/index.js +5 -32
- package/dist/lib/{reducer.mjs → reducer.cjs} +15 -8
- package/dist/lib/{reducer.d.mts → reducer.d.cts} +1 -1
- package/dist/lib/reducer.js +8 -15
- package/dist/operation/get-parameters-as-json-schema.cjs +19 -0
- package/dist/operation/{get-parameters-as-json-schema.d.mts → get-parameters-as-json-schema.d.cts} +2 -2
- package/dist/operation/get-parameters-as-json-schema.js +2 -17
- package/dist/{operation-8f5d4769.d.ts → operation-1a39e7d1.d.ts} +1 -1
- package/dist/operation.cjs +25 -0
- package/dist/{operation.d.mts → operation.d.cts} +2 -2
- package/dist/operation.js +4 -23
- package/dist/rmoas.types.cjs +20 -0
- package/dist/rmoas.types.js +1 -18
- package/dist/utils.cjs +20 -0
- package/dist/utils.js +3 -18
- package/package.json +22 -25
- package/.alexignore +0 -1
- package/.alexrc +0 -3
- package/.vscode/settings.json +0 -5
- package/dist/chunk-DG7M4SGH.mjs +0 -22
- package/dist/index.mjs +0 -7
- package/dist/operation/get-parameters-as-json-schema.mjs +0 -4
- package/dist/operation.mjs +0 -6
- package/dist/rmoas.types.mjs +0 -3
- package/dist/utils.mjs +0 -5
- package/src/analyzer/index.ts +0 -185
- package/src/analyzer/queries/openapi.ts +0 -184
- package/src/analyzer/queries/readme.ts +0 -133
- package/src/analyzer/util.ts +0 -45
- package/src/index.ts +0 -901
- package/src/lib/clone-object.ts +0 -7
- package/src/lib/dedupe-common-parameters.ts +0 -25
- package/src/lib/find-schema-definition.ts +0 -32
- package/src/lib/get-auth.ts +0 -93
- package/src/lib/get-mediatype-examples.ts +0 -100
- package/src/lib/get-user-variable.ts +0 -23
- package/src/lib/helpers.ts +0 -17
- package/src/lib/matches-mimetype.ts +0 -43
- package/src/lib/openapi-to-json-schema.ts +0 -945
- package/src/lib/reducer.ts +0 -215
- package/src/operation/get-callback-examples.ts +0 -47
- package/src/operation/get-parameters-as-json-schema.ts +0 -462
- package/src/operation/get-requestbody-examples.ts +0 -41
- package/src/operation/get-response-as-json-schema.ts +0 -207
- package/src/operation/get-response-examples.ts +0 -62
- package/src/operation.ts +0 -859
- package/src/rmoas.types.ts +0 -212
- package/src/samples/index.ts +0 -210
- package/src/samples/utils.ts +0 -70
- package/src/utils.ts +0 -13
- package/tsconfig.json +0 -15
- package/tsup.config.ts +0 -28
- /package/dist/analyzer/{index.mjs.map → index.cjs.map} +0 -0
- /package/dist/{chunk-5SKPBQ3A.mjs.map → chunk-4DSP2IAD.cjs.map} +0 -0
- /package/dist/{chunk-554KJ3NF.mjs.map → chunk-AWYLU6KF.cjs.map} +0 -0
- /package/dist/{chunk-JK7HBFVV.mjs.map → chunk-GT2RVQRP.cjs.map} +0 -0
- /package/dist/{chunk-2LQJJT5I.mjs.map → chunk-NFN6C7L3.cjs.map} +0 -0
- /package/dist/{chunk-DG7M4SGH.mjs.map → chunk-W6GBV2JT.cjs.map} +0 -0
- /package/dist/{chunk-Z4A553UU.mjs.map → chunk-Y7RSAOGJ.cjs.map} +0 -0
- /package/dist/{index.mjs.map → index.cjs.map} +0 -0
- /package/dist/lib/{reducer.mjs.map → reducer.cjs.map} +0 -0
- /package/dist/operation/{get-parameters-as-json-schema.mjs.map → get-parameters-as-json-schema.cjs.map} +0 -0
- /package/dist/{operation.mjs.map → operation.cjs.map} +0 -0
- /package/dist/{rmoas.types.mjs.map → rmoas.types.cjs.map} +0 -0
- /package/dist/{rmoas.types.d.mts → rmoas.types.d.cts} +0 -0
- /package/dist/{utils.mjs.map → utils.cjs.map} +0 -0
- /package/dist/{utils.d.mts → utils.d.cts} +0 -0
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkW6GBV2JT_cjs = require('../chunk-W6GBV2JT.cjs');
|
|
4
|
+
var chunkNFN6C7L3_cjs = require('../chunk-NFN6C7L3.cjs');
|
|
5
|
+
require('../chunk-GT2RVQRP.cjs');
|
|
6
|
+
require('../chunk-AWYLU6KF.cjs');
|
|
7
|
+
require('../chunk-Y7RSAOGJ.cjs');
|
|
8
|
+
require('../chunk-4DSP2IAD.cjs');
|
|
7
9
|
|
|
8
10
|
// src/analyzer/queries/openapi.ts
|
|
9
11
|
function additionalProperties(definition) {
|
|
10
|
-
return query(["$..additionalProperties"], definition).map((res) => refizePointer(res.pointer));
|
|
12
|
+
return chunkW6GBV2JT_cjs.query(["$..additionalProperties"], definition).map((res) => chunkW6GBV2JT_cjs.refizePointer(res.pointer));
|
|
11
13
|
}
|
|
12
14
|
function callbacks(definition) {
|
|
13
|
-
return query(["$.components.callbacks", "$.paths..callbacks"], definition).map((res) => refizePointer(res.pointer));
|
|
15
|
+
return chunkW6GBV2JT_cjs.query(["$.components.callbacks", "$.paths..callbacks"], definition).map((res) => chunkW6GBV2JT_cjs.refizePointer(res.pointer));
|
|
14
16
|
}
|
|
15
17
|
async function circularRefs(definition) {
|
|
16
|
-
const oas = new Oas(JSON.parse(JSON.stringify(definition)));
|
|
18
|
+
const oas = new chunkNFN6C7L3_cjs.Oas(JSON.parse(JSON.stringify(definition)));
|
|
17
19
|
await oas.dereference();
|
|
18
20
|
const results = oas.getCircularReferences();
|
|
19
21
|
results.sort();
|
|
20
22
|
return results;
|
|
21
23
|
}
|
|
22
24
|
function discriminators(definition) {
|
|
23
|
-
return query(["$..discriminator"], definition).map((res) => refizePointer(res.pointer));
|
|
25
|
+
return chunkW6GBV2JT_cjs.query(["$..discriminator"], definition).map((res) => chunkW6GBV2JT_cjs.refizePointer(res.pointer));
|
|
24
26
|
}
|
|
25
27
|
function links(definition) {
|
|
26
|
-
return query(["$..links"], definition).map((res) => refizePointer(res.pointer));
|
|
28
|
+
return chunkW6GBV2JT_cjs.query(["$..links"], definition).map((res) => chunkW6GBV2JT_cjs.refizePointer(res.pointer));
|
|
27
29
|
}
|
|
28
30
|
function mediaTypes(definition) {
|
|
29
31
|
const results = Array.from(
|
|
30
32
|
new Set(
|
|
31
|
-
query(["$..paths..content"], definition).map((res) => {
|
|
33
|
+
chunkW6GBV2JT_cjs.query(["$..paths..content"], definition).map((res) => {
|
|
32
34
|
return Object.keys(res.value);
|
|
33
35
|
}).flat()
|
|
34
36
|
)
|
|
@@ -37,29 +39,29 @@ function mediaTypes(definition) {
|
|
|
37
39
|
return results;
|
|
38
40
|
}
|
|
39
41
|
function parameterSerialization(definition) {
|
|
40
|
-
return query(["$..parameters[*].style^"], definition).map((res) => refizePointer(res.pointer));
|
|
42
|
+
return chunkW6GBV2JT_cjs.query(["$..parameters[*].style^"], definition).map((res) => chunkW6GBV2JT_cjs.refizePointer(res.pointer));
|
|
41
43
|
}
|
|
42
44
|
function polymorphism(definition) {
|
|
43
45
|
const results = Array.from(
|
|
44
|
-
new Set(query(["$..allOf^", "$..anyOf^", "$..oneOf^"], definition).map((res) => refizePointer(res.pointer)))
|
|
46
|
+
new Set(chunkW6GBV2JT_cjs.query(["$..allOf^", "$..anyOf^", "$..oneOf^"], definition).map((res) => chunkW6GBV2JT_cjs.refizePointer(res.pointer)))
|
|
45
47
|
);
|
|
46
48
|
results.sort();
|
|
47
49
|
return results;
|
|
48
50
|
}
|
|
49
51
|
function securityTypes(definition) {
|
|
50
|
-
return Array.from(new Set(query(["$.components.securitySchemes..type"], definition).map((res) => res.value)));
|
|
52
|
+
return Array.from(new Set(chunkW6GBV2JT_cjs.query(["$.components.securitySchemes..type"], definition).map((res) => res.value)));
|
|
51
53
|
}
|
|
52
54
|
function serverVariables(definition) {
|
|
53
|
-
return query(["$.servers..variables^"], definition).map((res) => refizePointer(res.pointer));
|
|
55
|
+
return chunkW6GBV2JT_cjs.query(["$.servers..variables^"], definition).map((res) => chunkW6GBV2JT_cjs.refizePointer(res.pointer));
|
|
54
56
|
}
|
|
55
57
|
function totalOperations(definition) {
|
|
56
|
-
return query(["$..paths[*]"], definition).map((res) => Object.keys(res.value)).flat().length;
|
|
58
|
+
return chunkW6GBV2JT_cjs.query(["$..paths[*]"], definition).map((res) => Object.keys(res.value)).flat().length;
|
|
57
59
|
}
|
|
58
60
|
function webhooks(definition) {
|
|
59
|
-
return query(["$.webhooks[*]"], definition).map((res) => refizePointer(res.pointer));
|
|
61
|
+
return chunkW6GBV2JT_cjs.query(["$.webhooks[*]"], definition).map((res) => chunkW6GBV2JT_cjs.refizePointer(res.pointer));
|
|
60
62
|
}
|
|
61
63
|
function xml(definition) {
|
|
62
|
-
return query(
|
|
64
|
+
return chunkW6GBV2JT_cjs.query(
|
|
63
65
|
[
|
|
64
66
|
"$.components.schemas..xml^",
|
|
65
67
|
"$..parameters..xml^",
|
|
@@ -78,17 +80,17 @@ function xml(definition) {
|
|
|
78
80
|
"$..responses[*].content[?(@property.match(/\\+xml$/i))]"
|
|
79
81
|
],
|
|
80
82
|
definition
|
|
81
|
-
).map((res) => refizePointer(res.pointer));
|
|
83
|
+
).map((res) => chunkW6GBV2JT_cjs.refizePointer(res.pointer));
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
// src/analyzer/queries/readme.ts
|
|
85
87
|
function authDefaults(definition) {
|
|
86
|
-
return query(["$.components.securitySchemes..['x-default']^"], definition).map((res) => refizePointer(res.pointer));
|
|
88
|
+
return chunkW6GBV2JT_cjs.query(["$.components.securitySchemes..['x-default']^"], definition).map((res) => chunkW6GBV2JT_cjs.refizePointer(res.pointer));
|
|
87
89
|
}
|
|
88
90
|
function codeSampleLanguages(definition) {
|
|
89
91
|
const results = Array.from(
|
|
90
92
|
new Set(
|
|
91
|
-
query(["$..['x-readme']['samples-languages']", "$..['x-samples-languages']"], definition).map((res) => res.value).reduce((prev, next) => prev.concat(next), [])
|
|
93
|
+
chunkW6GBV2JT_cjs.query(["$..['x-readme']['samples-languages']", "$..['x-samples-languages']"], definition).map((res) => res.value).reduce((prev, next) => prev.concat(next), [])
|
|
92
94
|
)
|
|
93
95
|
);
|
|
94
96
|
results.sort();
|
|
@@ -97,7 +99,7 @@ function codeSampleLanguages(definition) {
|
|
|
97
99
|
function codeSamplesDisabled(definition) {
|
|
98
100
|
return Array.from(
|
|
99
101
|
new Set(
|
|
100
|
-
query(
|
|
102
|
+
chunkW6GBV2JT_cjs.query(
|
|
101
103
|
[
|
|
102
104
|
"$['x-samples-enabled']^",
|
|
103
105
|
"$['x-readme']['samples-enabled']",
|
|
@@ -105,14 +107,14 @@ function codeSamplesDisabled(definition) {
|
|
|
105
107
|
"$..paths[*]..['x-readme']['samples-enabled']^^"
|
|
106
108
|
],
|
|
107
109
|
definition
|
|
108
|
-
).map((res) => refizePointer(res.pointer))
|
|
110
|
+
).map((res) => chunkW6GBV2JT_cjs.refizePointer(res.pointer))
|
|
109
111
|
)
|
|
110
112
|
);
|
|
111
113
|
}
|
|
112
114
|
function corsProxyDisabled(definition) {
|
|
113
115
|
return Array.from(
|
|
114
116
|
new Set(
|
|
115
|
-
query(
|
|
117
|
+
chunkW6GBV2JT_cjs.query(
|
|
116
118
|
[
|
|
117
119
|
"$['x-proxy-enabled']^",
|
|
118
120
|
"$['x-readme']['proxy-enabled']",
|
|
@@ -120,17 +122,17 @@ function corsProxyDisabled(definition) {
|
|
|
120
122
|
"$..paths[*]..['x-readme']['proxy-enabled']^^"
|
|
121
123
|
],
|
|
122
124
|
definition
|
|
123
|
-
).map((res) => refizePointer(res.pointer))
|
|
125
|
+
).map((res) => chunkW6GBV2JT_cjs.refizePointer(res.pointer))
|
|
124
126
|
)
|
|
125
127
|
);
|
|
126
128
|
}
|
|
127
129
|
function customCodeSamples(definition) {
|
|
128
|
-
return query(["$..['x-code-samples']", "$..['x-readme']['code-samples']"], definition).filter((res) => {
|
|
130
|
+
return chunkW6GBV2JT_cjs.query(["$..['x-code-samples']", "$..['x-readme']['code-samples']"], definition).filter((res) => {
|
|
129
131
|
return Array.isArray(res.value) && res.value.length ? res : false;
|
|
130
|
-
}).map((res) => refizePointer(res.pointer));
|
|
132
|
+
}).map((res) => chunkW6GBV2JT_cjs.refizePointer(res.pointer));
|
|
131
133
|
}
|
|
132
134
|
function explorerDisabled(definition) {
|
|
133
|
-
return query(
|
|
135
|
+
return chunkW6GBV2JT_cjs.query(
|
|
134
136
|
[
|
|
135
137
|
"$['x-explorer-enabled']^",
|
|
136
138
|
"$['x-readme']['explorer-enabled']",
|
|
@@ -138,15 +140,15 @@ function explorerDisabled(definition) {
|
|
|
138
140
|
"$..paths[*]..['x-readme']['explorer-enabled']^^"
|
|
139
141
|
],
|
|
140
142
|
definition
|
|
141
|
-
).map((res) => refizePointer(res.pointer));
|
|
143
|
+
).map((res) => chunkW6GBV2JT_cjs.refizePointer(res.pointer));
|
|
142
144
|
}
|
|
143
145
|
function rawBody(definition) {
|
|
144
|
-
return query(["$..RAW_BODY^^"], definition).map((res) => refizePointer(res.pointer));
|
|
146
|
+
return chunkW6GBV2JT_cjs.query(["$..RAW_BODY^^"], definition).map((res) => chunkW6GBV2JT_cjs.refizePointer(res.pointer));
|
|
145
147
|
}
|
|
146
148
|
function staticHeaders(definition) {
|
|
147
|
-
return query(["$..['x-headers']", "$..['x-readme']['headers']"], definition).filter((res) => {
|
|
149
|
+
return chunkW6GBV2JT_cjs.query(["$..['x-headers']", "$..['x-readme']['headers']"], definition).filter((res) => {
|
|
148
150
|
return Array.isArray(res.value) && res.value.length ? res : false;
|
|
149
|
-
}).map((res) => refizePointer(res.pointer));
|
|
151
|
+
}).map((res) => chunkW6GBV2JT_cjs.refizePointer(res.pointer));
|
|
150
152
|
}
|
|
151
153
|
|
|
152
154
|
// src/analyzer/index.ts
|
|
@@ -268,6 +270,7 @@ async function analyzer(definition) {
|
|
|
268
270
|
return analysis;
|
|
269
271
|
}
|
|
270
272
|
|
|
271
|
-
|
|
273
|
+
module.exports = analyzer;
|
|
272
274
|
//# sourceMappingURL=out.js.map
|
|
273
|
-
|
|
275
|
+
|
|
276
|
+
module.exports = exports.default//# sourceMappingURL=index.cjs.map
|
package/dist/analyzer/index.js
CHANGED
|
@@ -1,36 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
require('../chunk-SUR6DBOY.js');
|
|
8
|
-
require('../chunk-EYQ3PAIA.js');
|
|
1
|
+
import { query, refizePointer } from '../chunk-CKC36IL7.js';
|
|
2
|
+
import { Oas } from '../chunk-BDVPPDWX.js';
|
|
3
|
+
import '../chunk-HK3IBLG2.js';
|
|
4
|
+
import '../chunk-SS6ORC4G.js';
|
|
5
|
+
import '../chunk-SUR6DBOY.js';
|
|
6
|
+
import '../chunk-EYQ3PAIA.js';
|
|
9
7
|
|
|
10
8
|
// src/analyzer/queries/openapi.ts
|
|
11
9
|
function additionalProperties(definition) {
|
|
12
|
-
return
|
|
10
|
+
return query(["$..additionalProperties"], definition).map((res) => refizePointer(res.pointer));
|
|
13
11
|
}
|
|
14
12
|
function callbacks(definition) {
|
|
15
|
-
return
|
|
13
|
+
return query(["$.components.callbacks", "$.paths..callbacks"], definition).map((res) => refizePointer(res.pointer));
|
|
16
14
|
}
|
|
17
15
|
async function circularRefs(definition) {
|
|
18
|
-
const oas = new
|
|
16
|
+
const oas = new Oas(JSON.parse(JSON.stringify(definition)));
|
|
19
17
|
await oas.dereference();
|
|
20
18
|
const results = oas.getCircularReferences();
|
|
21
19
|
results.sort();
|
|
22
20
|
return results;
|
|
23
21
|
}
|
|
24
22
|
function discriminators(definition) {
|
|
25
|
-
return
|
|
23
|
+
return query(["$..discriminator"], definition).map((res) => refizePointer(res.pointer));
|
|
26
24
|
}
|
|
27
25
|
function links(definition) {
|
|
28
|
-
return
|
|
26
|
+
return query(["$..links"], definition).map((res) => refizePointer(res.pointer));
|
|
29
27
|
}
|
|
30
28
|
function mediaTypes(definition) {
|
|
31
29
|
const results = Array.from(
|
|
32
30
|
new Set(
|
|
33
|
-
|
|
31
|
+
query(["$..paths..content"], definition).map((res) => {
|
|
34
32
|
return Object.keys(res.value);
|
|
35
33
|
}).flat()
|
|
36
34
|
)
|
|
@@ -39,29 +37,29 @@ function mediaTypes(definition) {
|
|
|
39
37
|
return results;
|
|
40
38
|
}
|
|
41
39
|
function parameterSerialization(definition) {
|
|
42
|
-
return
|
|
40
|
+
return query(["$..parameters[*].style^"], definition).map((res) => refizePointer(res.pointer));
|
|
43
41
|
}
|
|
44
42
|
function polymorphism(definition) {
|
|
45
43
|
const results = Array.from(
|
|
46
|
-
new Set(
|
|
44
|
+
new Set(query(["$..allOf^", "$..anyOf^", "$..oneOf^"], definition).map((res) => refizePointer(res.pointer)))
|
|
47
45
|
);
|
|
48
46
|
results.sort();
|
|
49
47
|
return results;
|
|
50
48
|
}
|
|
51
49
|
function securityTypes(definition) {
|
|
52
|
-
return Array.from(new Set(
|
|
50
|
+
return Array.from(new Set(query(["$.components.securitySchemes..type"], definition).map((res) => res.value)));
|
|
53
51
|
}
|
|
54
52
|
function serverVariables(definition) {
|
|
55
|
-
return
|
|
53
|
+
return query(["$.servers..variables^"], definition).map((res) => refizePointer(res.pointer));
|
|
56
54
|
}
|
|
57
55
|
function totalOperations(definition) {
|
|
58
|
-
return
|
|
56
|
+
return query(["$..paths[*]"], definition).map((res) => Object.keys(res.value)).flat().length;
|
|
59
57
|
}
|
|
60
58
|
function webhooks(definition) {
|
|
61
|
-
return
|
|
59
|
+
return query(["$.webhooks[*]"], definition).map((res) => refizePointer(res.pointer));
|
|
62
60
|
}
|
|
63
61
|
function xml(definition) {
|
|
64
|
-
return
|
|
62
|
+
return query(
|
|
65
63
|
[
|
|
66
64
|
"$.components.schemas..xml^",
|
|
67
65
|
"$..parameters..xml^",
|
|
@@ -80,17 +78,17 @@ function xml(definition) {
|
|
|
80
78
|
"$..responses[*].content[?(@property.match(/\\+xml$/i))]"
|
|
81
79
|
],
|
|
82
80
|
definition
|
|
83
|
-
).map((res) =>
|
|
81
|
+
).map((res) => refizePointer(res.pointer));
|
|
84
82
|
}
|
|
85
83
|
|
|
86
84
|
// src/analyzer/queries/readme.ts
|
|
87
85
|
function authDefaults(definition) {
|
|
88
|
-
return
|
|
86
|
+
return query(["$.components.securitySchemes..['x-default']^"], definition).map((res) => refizePointer(res.pointer));
|
|
89
87
|
}
|
|
90
88
|
function codeSampleLanguages(definition) {
|
|
91
89
|
const results = Array.from(
|
|
92
90
|
new Set(
|
|
93
|
-
|
|
91
|
+
query(["$..['x-readme']['samples-languages']", "$..['x-samples-languages']"], definition).map((res) => res.value).reduce((prev, next) => prev.concat(next), [])
|
|
94
92
|
)
|
|
95
93
|
);
|
|
96
94
|
results.sort();
|
|
@@ -99,7 +97,7 @@ function codeSampleLanguages(definition) {
|
|
|
99
97
|
function codeSamplesDisabled(definition) {
|
|
100
98
|
return Array.from(
|
|
101
99
|
new Set(
|
|
102
|
-
|
|
100
|
+
query(
|
|
103
101
|
[
|
|
104
102
|
"$['x-samples-enabled']^",
|
|
105
103
|
"$['x-readme']['samples-enabled']",
|
|
@@ -107,14 +105,14 @@ function codeSamplesDisabled(definition) {
|
|
|
107
105
|
"$..paths[*]..['x-readme']['samples-enabled']^^"
|
|
108
106
|
],
|
|
109
107
|
definition
|
|
110
|
-
).map((res) =>
|
|
108
|
+
).map((res) => refizePointer(res.pointer))
|
|
111
109
|
)
|
|
112
110
|
);
|
|
113
111
|
}
|
|
114
112
|
function corsProxyDisabled(definition) {
|
|
115
113
|
return Array.from(
|
|
116
114
|
new Set(
|
|
117
|
-
|
|
115
|
+
query(
|
|
118
116
|
[
|
|
119
117
|
"$['x-proxy-enabled']^",
|
|
120
118
|
"$['x-readme']['proxy-enabled']",
|
|
@@ -122,17 +120,17 @@ function corsProxyDisabled(definition) {
|
|
|
122
120
|
"$..paths[*]..['x-readme']['proxy-enabled']^^"
|
|
123
121
|
],
|
|
124
122
|
definition
|
|
125
|
-
).map((res) =>
|
|
123
|
+
).map((res) => refizePointer(res.pointer))
|
|
126
124
|
)
|
|
127
125
|
);
|
|
128
126
|
}
|
|
129
127
|
function customCodeSamples(definition) {
|
|
130
|
-
return
|
|
128
|
+
return query(["$..['x-code-samples']", "$..['x-readme']['code-samples']"], definition).filter((res) => {
|
|
131
129
|
return Array.isArray(res.value) && res.value.length ? res : false;
|
|
132
|
-
}).map((res) =>
|
|
130
|
+
}).map((res) => refizePointer(res.pointer));
|
|
133
131
|
}
|
|
134
132
|
function explorerDisabled(definition) {
|
|
135
|
-
return
|
|
133
|
+
return query(
|
|
136
134
|
[
|
|
137
135
|
"$['x-explorer-enabled']^",
|
|
138
136
|
"$['x-readme']['explorer-enabled']",
|
|
@@ -140,15 +138,15 @@ function explorerDisabled(definition) {
|
|
|
140
138
|
"$..paths[*]..['x-readme']['explorer-enabled']^^"
|
|
141
139
|
],
|
|
142
140
|
definition
|
|
143
|
-
).map((res) =>
|
|
141
|
+
).map((res) => refizePointer(res.pointer));
|
|
144
142
|
}
|
|
145
143
|
function rawBody(definition) {
|
|
146
|
-
return
|
|
144
|
+
return query(["$..RAW_BODY^^"], definition).map((res) => refizePointer(res.pointer));
|
|
147
145
|
}
|
|
148
146
|
function staticHeaders(definition) {
|
|
149
|
-
return
|
|
147
|
+
return query(["$..['x-headers']", "$..['x-readme']['headers']"], definition).filter((res) => {
|
|
150
148
|
return Array.isArray(res.value) && res.value.length ? res : false;
|
|
151
|
-
}).map((res) =>
|
|
149
|
+
}).map((res) => refizePointer(res.pointer));
|
|
152
150
|
}
|
|
153
151
|
|
|
154
152
|
// src/analyzer/index.ts
|
|
@@ -270,7 +268,6 @@ async function analyzer(definition) {
|
|
|
270
268
|
return analysis;
|
|
271
269
|
}
|
|
272
270
|
|
|
273
|
-
|
|
271
|
+
export { analyzer as default };
|
|
274
272
|
//# sourceMappingURL=out.js.map
|
|
275
|
-
|
|
276
|
-
module.exports = exports.default//# sourceMappingURL=index.js.map
|
|
273
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
1
3
|
// src/rmoas.types.ts
|
|
2
4
|
function isRef(check) {
|
|
3
5
|
return check.$ref !== void 0;
|
|
@@ -9,6 +11,8 @@ function isSchema(check, isPolymorphicAllOfChild = false) {
|
|
|
9
11
|
return check.type !== void 0 || check.allOf !== void 0 || check.anyOf !== void 0 || check.oneOf !== void 0 || isPolymorphicAllOfChild;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
exports.isOAS31 = isOAS31;
|
|
15
|
+
exports.isRef = isRef;
|
|
16
|
+
exports.isSchema = isSchema;
|
|
13
17
|
//# sourceMappingURL=out.js.map
|
|
14
|
-
//# sourceMappingURL=chunk-
|
|
18
|
+
//# sourceMappingURL=chunk-4DSP2IAD.cjs.map
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkY7RSAOGJ_cjs = require('./chunk-Y7RSAOGJ.cjs');
|
|
4
|
+
var jsonpointer = require('jsonpointer');
|
|
5
|
+
|
|
6
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
|
|
8
|
+
var jsonpointer__default = /*#__PURE__*/_interopDefault(jsonpointer);
|
|
3
9
|
|
|
4
10
|
function findSchemaDefinition($ref, definition = {}) {
|
|
5
11
|
const origRef = $ref;
|
|
@@ -12,7 +18,7 @@ function findSchemaDefinition($ref, definition = {}) {
|
|
|
12
18
|
} else {
|
|
13
19
|
throw new Error(`Could not find a definition for ${origRef}.`);
|
|
14
20
|
}
|
|
15
|
-
const current =
|
|
21
|
+
const current = jsonpointer__default.default.get(definition, $ref);
|
|
16
22
|
if (current === void 0) {
|
|
17
23
|
throw new Error(`Could not find a definition for ${origRef}.`);
|
|
18
24
|
}
|
|
@@ -23,10 +29,12 @@ function findSchemaDefinition($ref, definition = {}) {
|
|
|
23
29
|
var supportedMethods = /* @__PURE__ */ new Set(["get", "put", "post", "delete", "options", "head", "patch", "trace"]);
|
|
24
30
|
var utils_default = {
|
|
25
31
|
findSchemaDefinition,
|
|
26
|
-
jsonSchemaTypes: types,
|
|
27
|
-
matchesMimeType: matches_mimetype_default
|
|
32
|
+
jsonSchemaTypes: chunkY7RSAOGJ_cjs.types,
|
|
33
|
+
matchesMimeType: chunkY7RSAOGJ_cjs.matches_mimetype_default
|
|
28
34
|
};
|
|
29
35
|
|
|
30
|
-
|
|
36
|
+
exports.findSchemaDefinition = findSchemaDefinition;
|
|
37
|
+
exports.supportedMethods = supportedMethods;
|
|
38
|
+
exports.utils_default = utils_default;
|
|
31
39
|
//# sourceMappingURL=out.js.map
|
|
32
|
-
//# sourceMappingURL=chunk-
|
|
40
|
+
//# sourceMappingURL=chunk-AWYLU6KF.cjs.map
|
package/dist/chunk-BDVPPDWX.js
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var $RefParser = require('@readme/json-schema-ref-parser');
|
|
7
|
-
var pathToRegexp = require('path-to-regexp');
|
|
8
|
-
|
|
9
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
|
|
11
|
-
var $RefParser__default = /*#__PURE__*/_interopDefault($RefParser);
|
|
1
|
+
import { Webhook, Operation } from './chunk-HK3IBLG2.js';
|
|
2
|
+
import { utils_default, supportedMethods } from './chunk-SS6ORC4G.js';
|
|
3
|
+
import { isPrimitive } from './chunk-SUR6DBOY.js';
|
|
4
|
+
import $RefParser from '@readme/json-schema-ref-parser';
|
|
5
|
+
import { match, pathToRegexp } from 'path-to-regexp';
|
|
12
6
|
|
|
13
7
|
// src/lib/get-auth.ts
|
|
14
8
|
function getKey(user, scheme) {
|
|
@@ -119,7 +113,7 @@ function generatePathMatches(paths, pathName, origin) {
|
|
|
119
113
|
const cleanedPath = normalizePath(path);
|
|
120
114
|
let matchResult;
|
|
121
115
|
try {
|
|
122
|
-
const matchStatement =
|
|
116
|
+
const matchStatement = match(cleanedPath, { decode: decodeURIComponent });
|
|
123
117
|
matchResult = matchStatement(prunedPathName);
|
|
124
118
|
} catch (err) {
|
|
125
119
|
return;
|
|
@@ -143,7 +137,7 @@ function generatePathMatches(paths, pathName, origin) {
|
|
|
143
137
|
}).filter(Boolean).filter((p) => p.match);
|
|
144
138
|
}
|
|
145
139
|
function filterPathMethods(pathMatches, targetMethod) {
|
|
146
|
-
const regExp = pathToRegexp
|
|
140
|
+
const regExp = pathToRegexp(targetMethod);
|
|
147
141
|
return pathMatches.map((p) => {
|
|
148
142
|
const captures = Object.keys(p.operation).filter((r) => regExp.exec(r));
|
|
149
143
|
if (captures.length) {
|
|
@@ -349,13 +343,13 @@ var Oas = class _Oas {
|
|
|
349
343
|
const api = this.api;
|
|
350
344
|
if (api?.webhooks[path]?.[method]) {
|
|
351
345
|
operation = api.webhooks[path][method];
|
|
352
|
-
return new
|
|
346
|
+
return new Webhook(api, path, method, operation);
|
|
353
347
|
}
|
|
354
348
|
}
|
|
355
349
|
if (this?.api?.paths?.[path]?.[method]) {
|
|
356
350
|
operation = this.api.paths[path][method];
|
|
357
351
|
}
|
|
358
|
-
return new
|
|
352
|
+
return new Operation(this.api, path, method, operation);
|
|
359
353
|
}
|
|
360
354
|
findOperationMatches(url) {
|
|
361
355
|
const { origin, hostname } = new URL(url);
|
|
@@ -485,10 +479,10 @@ var Oas = class _Oas {
|
|
|
485
479
|
}
|
|
486
480
|
paths[path] = {};
|
|
487
481
|
if ("$ref" in this.api.paths[path]) {
|
|
488
|
-
this.api.paths[path] =
|
|
482
|
+
this.api.paths[path] = utils_default.findSchemaDefinition(this.api.paths[path].$ref, this.api);
|
|
489
483
|
}
|
|
490
484
|
Object.keys(this.api.paths[path]).forEach((method) => {
|
|
491
|
-
if (!
|
|
485
|
+
if (!supportedMethods.has(method))
|
|
492
486
|
return;
|
|
493
487
|
paths[path][method] = this.operation(path, method);
|
|
494
488
|
});
|
|
@@ -592,7 +586,7 @@ var Oas = class _Oas {
|
|
|
592
586
|
const { api, promises } = this;
|
|
593
587
|
if (api && api.components && api.components.schemas && typeof api.components.schemas === "object") {
|
|
594
588
|
Object.keys(api.components.schemas).forEach((schemaName) => {
|
|
595
|
-
if (
|
|
589
|
+
if (isPrimitive(api.components.schemas[schemaName]) || Array.isArray(api.components.schemas[schemaName]) || api.components.schemas[schemaName] === null) {
|
|
596
590
|
return;
|
|
597
591
|
}
|
|
598
592
|
if (opts.preserveRefAsJSONSchemaTitle) {
|
|
@@ -601,7 +595,7 @@ var Oas = class _Oas {
|
|
|
601
595
|
api.components.schemas[schemaName]["x-readme-ref-name"] = schemaName;
|
|
602
596
|
});
|
|
603
597
|
}
|
|
604
|
-
const parser = new $
|
|
598
|
+
const parser = new $RefParser();
|
|
605
599
|
return parser.dereference(api || {}, {
|
|
606
600
|
resolve: {
|
|
607
601
|
// We shouldn't be resolving external pointers at this point so just ignore them.
|
|
@@ -635,6 +629,6 @@ var Oas = class _Oas {
|
|
|
635
629
|
}
|
|
636
630
|
};
|
|
637
631
|
|
|
638
|
-
|
|
632
|
+
export { Oas };
|
|
639
633
|
//# sourceMappingURL=out.js.map
|
|
640
634
|
//# sourceMappingURL=chunk-BDVPPDWX.js.map
|
package/dist/chunk-CKC36IL7.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var jsonpathPlus = require('jsonpath-plus');
|
|
1
|
+
import { JSONPath } from 'jsonpath-plus';
|
|
4
2
|
|
|
5
3
|
// src/analyzer/util.ts
|
|
6
4
|
function query(queries, definition) {
|
|
7
|
-
const results = queries.map((q) =>
|
|
5
|
+
const results = queries.map((q) => JSONPath({ path: q, json: definition, resultType: "all" })).filter((res) => res.length ? res : false).reduce((prev, next) => prev.concat(next), []);
|
|
8
6
|
results.sort((a, b) => {
|
|
9
7
|
if (a.pointer < b.pointer) {
|
|
10
8
|
return -1;
|
|
@@ -19,7 +17,6 @@ function refizePointer(pointer) {
|
|
|
19
17
|
return `#${pointer}`;
|
|
20
18
|
}
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
exports.refizePointer = refizePointer;
|
|
20
|
+
export { query, refizePointer };
|
|
24
21
|
//# sourceMappingURL=out.js.map
|
|
25
22
|
//# sourceMappingURL=chunk-CKC36IL7.js.map
|
package/dist/chunk-EYQ3PAIA.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
// src/rmoas.types.ts
|
|
4
2
|
function isRef(check) {
|
|
5
3
|
return check.$ref !== void 0;
|
|
@@ -11,8 +9,6 @@ function isSchema(check, isPolymorphicAllOfChild = false) {
|
|
|
11
9
|
return check.type !== void 0 || check.allOf !== void 0 || check.anyOf !== void 0 || check.oneOf !== void 0 || isPolymorphicAllOfChild;
|
|
12
10
|
}
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
exports.isRef = isRef;
|
|
16
|
-
exports.isSchema = isSchema;
|
|
12
|
+
export { isOAS31, isRef, isSchema };
|
|
17
13
|
//# sourceMappingURL=out.js.map
|
|
18
14
|
//# sourceMappingURL=chunk-EYQ3PAIA.js.map
|