oas 37.1.0 → 37.2.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/{chunk-6APWNY54.js → chunk-6QP66C5V.js} +53 -57
- package/dist/chunk-6QP66C5V.js.map +1 -0
- package/dist/{chunk-OWMXX4EB.cjs → chunk-GPOPN7TQ.cjs} +53 -57
- package/dist/chunk-GPOPN7TQ.cjs.map +1 -0
- package/dist/{chunk-I7R3WTTN.js → chunk-LOR5XCEP.js} +2 -2
- package/dist/{chunk-QPYARJRD.cjs → chunk-YCSVUVAC.cjs} +70 -70
- package/dist/{chunk-QPYARJRD.cjs.map → chunk-YCSVUVAC.cjs.map} +1 -1
- package/dist/index.cjs +27 -27
- package/dist/index.js +2 -2
- package/dist/operation/index.cjs +3 -3
- package/dist/operation/index.js +2 -2
- package/dist/reducer/index.cjs +7 -7
- package/dist/reducer/index.js +1 -1
- package/dist/utils.cjs +2 -2
- package/dist/utils.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-6APWNY54.js.map +0 -1
- package/dist/chunk-OWMXX4EB.cjs.map +0 -1
- /package/dist/{chunk-I7R3WTTN.js.map → chunk-LOR5XCEP.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkYCSVUVACcjs = require('./chunk-YCSVUVAC.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkGPOPN7TQcjs = require('./chunk-GPOPN7TQ.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
@@ -73,7 +73,7 @@ function getByScheme(user, scheme = {}, selectedApp) {
|
|
|
73
73
|
}
|
|
74
74
|
function getAuth(api, user, selectedApp) {
|
|
75
75
|
return Object.keys(_optionalChain([api, 'optionalAccess', _3 => _3.components, 'optionalAccess', _4 => _4.securitySchemes]) || {}).map((scheme) => {
|
|
76
|
-
const securityScheme =
|
|
76
|
+
const securityScheme = _chunkGPOPN7TQcjs.dereferenceRef.call(void 0, _optionalChain([api, 'access', _5 => _5.components, 'optionalAccess', _6 => _6.securitySchemes, 'optionalAccess', _7 => _7[scheme]]), api);
|
|
77
77
|
if (!securityScheme || _chunk7PWF3F2Wcjs.isRef.call(void 0, securityScheme)) {
|
|
78
78
|
return false;
|
|
79
79
|
}
|
|
@@ -142,17 +142,17 @@ var Oas = class _Oas {
|
|
|
142
142
|
return this.api;
|
|
143
143
|
}
|
|
144
144
|
url(selected = 0, variables) {
|
|
145
|
-
const url =
|
|
145
|
+
const url = _chunkYCSVUVACcjs.normalizedURLFromServers.call(void 0, this.api.servers, selected);
|
|
146
146
|
return this.replaceUrl(url, variables || this.defaultVariables(selected)).trim();
|
|
147
147
|
}
|
|
148
148
|
variables(selected = 0) {
|
|
149
|
-
return
|
|
149
|
+
return _chunkYCSVUVACcjs.variablesFromServers.call(void 0, this.api.servers, selected);
|
|
150
150
|
}
|
|
151
151
|
defaultVariables(selected = 0) {
|
|
152
|
-
return
|
|
152
|
+
return _chunkYCSVUVACcjs.defaultVariablesFromServers.call(void 0, this.api.servers, selected, this.user);
|
|
153
153
|
}
|
|
154
154
|
splitUrl(selected = 0) {
|
|
155
|
-
return
|
|
155
|
+
return _chunkYCSVUVACcjs.splitUrlFromServers.call(void 0, this.api.servers, selected);
|
|
156
156
|
}
|
|
157
157
|
/**
|
|
158
158
|
* With a fully composed server URL, run through our list of known OAS servers and return back
|
|
@@ -170,13 +170,13 @@ var Oas = class _Oas {
|
|
|
170
170
|
*/
|
|
171
171
|
splitVariables(baseUrl) {
|
|
172
172
|
const matchedServer = (this.api.servers || []).map((server, i) => {
|
|
173
|
-
const rgx =
|
|
173
|
+
const rgx = _chunkYCSVUVACcjs.transformURLIntoRegex.call(void 0, server.url);
|
|
174
174
|
const found = new RegExp(rgx).exec(baseUrl);
|
|
175
175
|
if (!found) {
|
|
176
176
|
return false;
|
|
177
177
|
}
|
|
178
178
|
const variables = {};
|
|
179
|
-
Array.from(server.url.matchAll(
|
|
179
|
+
Array.from(server.url.matchAll(_chunkGPOPN7TQcjs.SERVER_VARIABLE_REGEX)).forEach((variable, y) => {
|
|
180
180
|
variables[variable[1]] = found[y + 1];
|
|
181
181
|
});
|
|
182
182
|
return {
|
|
@@ -206,8 +206,8 @@ var Oas = class _Oas {
|
|
|
206
206
|
* @param variables An object containing variables to swap into the URL.
|
|
207
207
|
*/
|
|
208
208
|
replaceUrl(url, variables = {}) {
|
|
209
|
-
return
|
|
210
|
-
url.replace(
|
|
209
|
+
return _chunkYCSVUVACcjs.stripTrailingSlash.call(void 0,
|
|
210
|
+
url.replace(_chunkGPOPN7TQcjs.SERVER_VARIABLE_REGEX, (original, key) => {
|
|
211
211
|
if (key in variables) {
|
|
212
212
|
const data = variables[key];
|
|
213
213
|
if (typeof data === "object") {
|
|
@@ -218,7 +218,7 @@ var Oas = class _Oas {
|
|
|
218
218
|
return String(data);
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
|
-
const userVariable =
|
|
221
|
+
const userVariable = _chunkYCSVUVACcjs.getUserVariable.call(void 0, this.user, key);
|
|
222
222
|
if (userVariable) {
|
|
223
223
|
return String(userVariable);
|
|
224
224
|
}
|
|
@@ -238,22 +238,22 @@ var Oas = class _Oas {
|
|
|
238
238
|
};
|
|
239
239
|
if (opts.isWebhook) {
|
|
240
240
|
if (_chunk7PWF3F2Wcjs.isOpenAPI31.call(void 0, this.api)) {
|
|
241
|
-
const webhookPath =
|
|
241
|
+
const webhookPath = _chunkGPOPN7TQcjs.dereferenceRef.call(void 0, _optionalChain([this, 'access', _8 => _8.api, 'optionalAccess', _9 => _9.webhooks, 'optionalAccess', _10 => _10[path]]), this.api);
|
|
242
242
|
if (webhookPath && !_chunk7PWF3F2Wcjs.isRef.call(void 0, webhookPath)) {
|
|
243
243
|
if (_optionalChain([webhookPath, 'optionalAccess', _11 => _11[method]])) {
|
|
244
244
|
operation = webhookPath[method];
|
|
245
|
-
return new (0,
|
|
245
|
+
return new (0, _chunkYCSVUVACcjs.Webhook)(this, path, method, operation);
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
if (_optionalChain([this, 'optionalAccess', _12 => _12.api, 'optionalAccess', _13 => _13.paths, 'optionalAccess', _14 => _14[path]])) {
|
|
251
|
-
const pathItem =
|
|
251
|
+
const pathItem = _chunkGPOPN7TQcjs.dereferenceRef.call(void 0, this.api.paths[path], this.api);
|
|
252
252
|
if (_optionalChain([pathItem, 'optionalAccess', _15 => _15[method]])) {
|
|
253
|
-
operation =
|
|
253
|
+
operation = _chunkGPOPN7TQcjs.dereferenceRef.call(void 0, pathItem[method], this.api);
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
|
-
return new (0,
|
|
256
|
+
return new (0, _chunkYCSVUVACcjs.Operation)(this, path, method, operation);
|
|
257
257
|
}
|
|
258
258
|
findOperationMatches(url) {
|
|
259
259
|
const { origin, hostname } = new URL(url);
|
|
@@ -282,7 +282,7 @@ var Oas = class _Oas {
|
|
|
282
282
|
}
|
|
283
283
|
if (!matchedServer || !pathName) {
|
|
284
284
|
const matchedServerAndPath = (servers || []).map((server) => {
|
|
285
|
-
const rgx =
|
|
285
|
+
const rgx = _chunkYCSVUVACcjs.transformURLIntoRegex.call(void 0, server.url);
|
|
286
286
|
const found = new RegExp(rgx).exec(url);
|
|
287
287
|
if (!found) {
|
|
288
288
|
return;
|
|
@@ -303,7 +303,7 @@ var Oas = class _Oas {
|
|
|
303
303
|
if (pathName === void 0) return void 0;
|
|
304
304
|
if (pathName === "") pathName = "/";
|
|
305
305
|
if (!paths || !targetServer) return void 0;
|
|
306
|
-
const annotatedPaths =
|
|
306
|
+
const annotatedPaths = _chunkYCSVUVACcjs.generatePathMatches.call(void 0, paths, pathName, targetServer.url);
|
|
307
307
|
if (!annotatedPaths.length) return void 0;
|
|
308
308
|
return annotatedPaths;
|
|
309
309
|
}
|
|
@@ -320,9 +320,9 @@ var Oas = class _Oas {
|
|
|
320
320
|
if (!annotatedPaths) {
|
|
321
321
|
return void 0;
|
|
322
322
|
}
|
|
323
|
-
const matches =
|
|
323
|
+
const matches = _chunkYCSVUVACcjs.filterPathMethods.call(void 0, annotatedPaths, method);
|
|
324
324
|
if (!matches.length) return void 0;
|
|
325
|
-
return
|
|
325
|
+
return _chunkYCSVUVACcjs.findTargetPath.call(void 0, matches);
|
|
326
326
|
}
|
|
327
327
|
/**
|
|
328
328
|
* Discover an operation in an OAS from a fully-formed URL without an HTTP method. Will return an
|
|
@@ -335,7 +335,7 @@ var Oas = class _Oas {
|
|
|
335
335
|
if (!annotatedPaths) {
|
|
336
336
|
return void 0;
|
|
337
337
|
}
|
|
338
|
-
return
|
|
338
|
+
return _chunkYCSVUVACcjs.findTargetPath.call(void 0, annotatedPaths);
|
|
339
339
|
}
|
|
340
340
|
/**
|
|
341
341
|
* Retrieve an operation in an OAS from a fully-formed URL and HTTP method. Differs from
|
|
@@ -421,7 +421,7 @@ var Oas = class _Oas {
|
|
|
421
421
|
let scheme = _optionalChain([this, 'access', _23 => _23.api, 'optionalAccess', _24 => _24.components, 'optionalAccess', _25 => _25.securitySchemes, 'optionalAccess', _26 => _26[name]]);
|
|
422
422
|
if (!scheme) return void 0;
|
|
423
423
|
if (_chunk7PWF3F2Wcjs.isRef.call(void 0, scheme)) {
|
|
424
|
-
scheme =
|
|
424
|
+
scheme = _chunkGPOPN7TQcjs.dereferenceRef.call(void 0, scheme, this.api);
|
|
425
425
|
if (!scheme || _chunk7PWF3F2Wcjs.isRef.call(void 0, scheme)) return void 0;
|
|
426
426
|
}
|
|
427
427
|
return scheme;
|
|
@@ -447,14 +447,14 @@ var Oas = class _Oas {
|
|
|
447
447
|
if (!pathItem) {
|
|
448
448
|
return;
|
|
449
449
|
} else if (_chunk7PWF3F2Wcjs.isRef.call(void 0, pathItem)) {
|
|
450
|
-
this.api.paths[path] =
|
|
450
|
+
this.api.paths[path] = _chunkGPOPN7TQcjs.dereferenceRef.call(void 0, pathItem, this.api);
|
|
451
451
|
pathItem = this.api.paths[path];
|
|
452
452
|
if (!pathItem || _chunk7PWF3F2Wcjs.isRef.call(void 0, pathItem)) {
|
|
453
453
|
return;
|
|
454
454
|
}
|
|
455
455
|
}
|
|
456
456
|
Object.keys(pathItem).forEach((method) => {
|
|
457
|
-
if (!
|
|
457
|
+
if (!_chunkGPOPN7TQcjs.supportedMethods.includes(method)) {
|
|
458
458
|
return;
|
|
459
459
|
}
|
|
460
460
|
paths[path][method] = this.operation(path, method);
|
|
@@ -476,10 +476,10 @@ var Oas = class _Oas {
|
|
|
476
476
|
}
|
|
477
477
|
Object.keys(this.api.webhooks).forEach((id) => {
|
|
478
478
|
webhooks[id] = {};
|
|
479
|
-
const webhookPath =
|
|
479
|
+
const webhookPath = _chunkGPOPN7TQcjs.dereferenceRef.call(void 0, _optionalChain([this, 'access', _27 => _27.api, 'access', _28 => _28.webhooks, 'optionalAccess', _29 => _29[id]]), this.api);
|
|
480
480
|
if (webhookPath) {
|
|
481
481
|
Object.keys(webhookPath).forEach((method) => {
|
|
482
|
-
if (!
|
|
482
|
+
if (!_chunkGPOPN7TQcjs.supportedMethods.includes(method)) {
|
|
483
483
|
return;
|
|
484
484
|
}
|
|
485
485
|
webhooks[id][method] = this.operation(id, method, {
|
package/dist/index.js
CHANGED
|
@@ -11,12 +11,12 @@ import {
|
|
|
11
11
|
stripTrailingSlash,
|
|
12
12
|
transformURLIntoRegex,
|
|
13
13
|
variablesFromServers
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-LOR5XCEP.js";
|
|
15
15
|
import {
|
|
16
16
|
SERVER_VARIABLE_REGEX,
|
|
17
17
|
dereferenceRef,
|
|
18
18
|
supportedMethods
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-6QP66C5V.js";
|
|
20
20
|
import {
|
|
21
21
|
CODE_SAMPLES,
|
|
22
22
|
HEADERS,
|
package/dist/operation/index.cjs
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('../chunk-
|
|
5
|
+
var _chunkYCSVUVACcjs = require('../chunk-YCSVUVAC.cjs');
|
|
6
|
+
require('../chunk-GPOPN7TQ.cjs');
|
|
7
7
|
require('../chunk-6HXOZ5GY.cjs');
|
|
8
8
|
require('../chunk-7PWF3F2W.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
exports.Callback =
|
|
13
|
+
exports.Callback = _chunkYCSVUVACcjs.Callback; exports.Operation = _chunkYCSVUVACcjs.Operation; exports.Webhook = _chunkYCSVUVACcjs.Webhook;
|
|
14
14
|
//# sourceMappingURL=index.cjs.map
|
package/dist/operation/index.js
CHANGED
package/dist/reducer/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@ var _chunkW6GBV2JTcjs = require('../chunk-W6GBV2JT.cjs');
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkGPOPN7TQcjs = require('../chunk-GPOPN7TQ.cjs');
|
|
8
8
|
require('../chunk-6HXOZ5GY.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
@@ -274,7 +274,7 @@ var OpenAPIReducer = (_class = class _OpenAPIReducer {
|
|
|
274
274
|
const pathSegment = match[1];
|
|
275
275
|
const method = match[2];
|
|
276
276
|
if (pathSegment && method) {
|
|
277
|
-
return { path:
|
|
277
|
+
return { path: _chunkGPOPN7TQcjs.decodePointer.call(void 0, pathSegment), method };
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
return null;
|
|
@@ -293,7 +293,7 @@ var OpenAPIReducer = (_class = class _OpenAPIReducer {
|
|
|
293
293
|
const webhookName = match[1];
|
|
294
294
|
const method = match[2];
|
|
295
295
|
if (webhookName && method) {
|
|
296
|
-
return { name:
|
|
296
|
+
return { name: _chunkGPOPN7TQcjs.decodePointer.call(void 0, webhookName), method };
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
299
|
return null;
|
|
@@ -321,7 +321,7 @@ var OpenAPIReducer = (_class = class _OpenAPIReducer {
|
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
323
|
Object.keys(_optionalChain([this, 'access', _23 => _23.definition, 'access', _24 => _24.paths, 'optionalAccess', _25 => _25[path]]) || {}).forEach((method) => {
|
|
324
|
-
if (method === "parameters" || !
|
|
324
|
+
if (method === "parameters" || !_chunkGPOPN7TQcjs.supportedMethods.includes(method.toLowerCase())) {
|
|
325
325
|
return;
|
|
326
326
|
}
|
|
327
327
|
if (this.hasPathsToReduceBy) {
|
|
@@ -395,7 +395,7 @@ var OpenAPIReducer = (_class = class _OpenAPIReducer {
|
|
|
395
395
|
return;
|
|
396
396
|
}
|
|
397
397
|
Object.keys(webhook).forEach((method) => {
|
|
398
|
-
if (method === "parameters" || !
|
|
398
|
+
if (method === "parameters" || !_chunkGPOPN7TQcjs.supportedMethods.includes(method.toLowerCase())) {
|
|
399
399
|
return;
|
|
400
400
|
}
|
|
401
401
|
if (this.hasWebhooksToReduceBy) {
|
|
@@ -470,7 +470,7 @@ var OpenAPIReducer = (_class = class _OpenAPIReducer {
|
|
|
470
470
|
}
|
|
471
471
|
Object.keys(_optionalChain([this, 'access', _39 => _39.definition, 'access', _40 => _40.paths, 'optionalAccess', _41 => _41[path]]) || {}).forEach((method) => {
|
|
472
472
|
const methodLC = method.toLowerCase();
|
|
473
|
-
if (method === "parameters" || !
|
|
473
|
+
if (method === "parameters" || !_chunkGPOPN7TQcjs.supportedMethods.includes(methodLC)) {
|
|
474
474
|
return;
|
|
475
475
|
}
|
|
476
476
|
const retainedByRef = this.retainPathMethods.has(`${pathLC}|${methodLC}`) || Array.from(this.$refs).some((ref) => {
|
|
@@ -555,7 +555,7 @@ var OpenAPIReducer = (_class = class _OpenAPIReducer {
|
|
|
555
555
|
}
|
|
556
556
|
Object.keys(webhook).forEach((method) => {
|
|
557
557
|
const methodLC = method.toLowerCase();
|
|
558
|
-
if (method === "parameters" || !
|
|
558
|
+
if (method === "parameters" || !_chunkGPOPN7TQcjs.supportedMethods.includes(methodLC)) {
|
|
559
559
|
return;
|
|
560
560
|
}
|
|
561
561
|
const retainedByRef = this.retainWebhookMethods.has(`${nameLC}|${methodLC}`);
|
package/dist/reducer/index.js
CHANGED
package/dist/utils.cjs
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkGPOPN7TQcjs = require('./chunk-GPOPN7TQ.cjs');
|
|
10
10
|
require('./chunk-6HXOZ5GY.cjs');
|
|
11
11
|
require('./chunk-7PWF3F2W.cjs');
|
|
12
12
|
|
|
@@ -17,5 +17,5 @@ require('./chunk-7PWF3F2W.cjs');
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
exports.SERVER_VARIABLE_REGEX =
|
|
20
|
+
exports.SERVER_VARIABLE_REGEX = _chunkGPOPN7TQcjs.SERVER_VARIABLE_REGEX; exports.dereferenceRef = _chunkGPOPN7TQcjs.dereferenceRef; exports.dereferenceRefDeep = _chunkGPOPN7TQcjs.dereferenceRefDeep; exports.getParameterContentType = _chunkGPOPN7TQcjs.getParameterContentType; exports.jsonSchemaTypes = _chunkGPOPN7TQcjs.types; exports.matchesMimeType = _chunkGPOPN7TQcjs.matches_mimetype_default; exports.supportedMethods = _chunkGPOPN7TQcjs.supportedMethods;
|
|
21
21
|
//# sourceMappingURL=utils.cjs.map
|
package/dist/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oas",
|
|
3
|
-
"version": "37.
|
|
3
|
+
"version": "37.2.0",
|
|
4
4
|
"description": "Comprehensive tooling for working with OpenAPI definitions",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ReadMe <support@readme.io> (https://readme.com)",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"watch": "tsc --watch"
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@readme/openapi-parser": "^6.1
|
|
86
|
+
"@readme/openapi-parser": "^6.2.1",
|
|
87
87
|
"@types/json-schema": "^7.0.11",
|
|
88
88
|
"json-schema-merge-allof": "^0.8.1",
|
|
89
89
|
"jsonpath-plus": "^10.4.0",
|