oas 28.1.0 → 28.3.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.cjs +7 -7
- package/dist/analyzer/index.cjs.map +1 -1
- package/dist/analyzer/index.js +5 -5
- package/dist/analyzer/index.js.map +1 -1
- package/dist/{chunk-UW57LXCE.cjs → chunk-4DBNE7RJ.cjs} +1 -1
- package/dist/chunk-4DBNE7RJ.cjs.map +1 -0
- package/dist/{chunk-MW5BWU34.cjs → chunk-636SYI6H.cjs} +26 -26
- package/dist/chunk-636SYI6H.cjs.map +1 -0
- package/dist/{chunk-XS7VDTTT.cjs → chunk-6JSHPV2O.cjs} +1 -1
- package/dist/chunk-6JSHPV2O.cjs.map +1 -0
- package/dist/{chunk-N4TGMVNA.cjs → chunk-G5MSDVMW.cjs} +7 -7
- package/dist/chunk-G5MSDVMW.cjs.map +1 -0
- package/dist/{chunk-64CLCOBW.cjs → chunk-GDEE6EQV.cjs} +32 -31
- package/dist/chunk-GDEE6EQV.cjs.map +1 -0
- package/dist/{chunk-L2OVXZK3.js → chunk-NBQXNFZT.js} +1 -1
- package/dist/chunk-NBQXNFZT.js.map +1 -0
- package/dist/{chunk-F42EZPPE.js → chunk-NIBF7F33.js} +16 -15
- package/dist/chunk-NIBF7F33.js.map +1 -0
- package/dist/{chunk-45FGY5MW.js → chunk-RF2D4VVK.js} +7 -7
- package/dist/chunk-RF2D4VVK.js.map +1 -0
- package/dist/{chunk-TM3VSYIS.js → chunk-T34XCOTS.js} +6 -6
- package/dist/chunk-T34XCOTS.js.map +1 -0
- package/dist/{chunk-BBB7GA2U.js → chunk-W3LSKLU6.js} +1 -1
- package/dist/chunk-W3LSKLU6.js.map +1 -0
- package/dist/{extensions-D51otYaI.d.ts → extensions-DAFceEIL.d.ts} +15 -2
- package/dist/{extensions-ViDsWf_9.d.cts → extensions-DlGC1TJ1.d.cts} +15 -2
- package/dist/extensions.cjs +2 -2
- package/dist/extensions.d.cts +1 -1
- package/dist/extensions.d.ts +1 -1
- package/dist/extensions.js +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -5
- package/dist/operation/index.cjs +5 -5
- package/dist/operation/index.d.cts +1 -1
- package/dist/operation/index.d.ts +1 -1
- package/dist/operation/index.js +4 -4
- package/dist/operation/lib/get-parameters-as-json-schema.cjs +3 -3
- package/dist/operation/lib/get-parameters-as-json-schema.d.cts +1 -1
- package/dist/operation/lib/get-parameters-as-json-schema.d.ts +1 -1
- package/dist/operation/lib/get-parameters-as-json-schema.js +2 -2
- package/dist/reducer/index.cjs.map +1 -1
- package/dist/reducer/index.js.map +1 -1
- package/dist/utils.cjs +4 -4
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +3 -3
- package/package.json +5 -5
- package/dist/chunk-45FGY5MW.js.map +0 -1
- package/dist/chunk-64CLCOBW.cjs.map +0 -1
- package/dist/chunk-BBB7GA2U.js.map +0 -1
- package/dist/chunk-F42EZPPE.js.map +0 -1
- package/dist/chunk-L2OVXZK3.js.map +0 -1
- package/dist/chunk-MW5BWU34.cjs.map +0 -1
- package/dist/chunk-N4TGMVNA.cjs.map +0 -1
- package/dist/chunk-TM3VSYIS.js.map +0 -1
- package/dist/chunk-UW57LXCE.cjs.map +0 -1
- package/dist/chunk-XS7VDTTT.cjs.map +0 -1
package/dist/extensions.cjs
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunk6JSHPV2Ocjs = require('./chunk-6JSHPV2O.cjs');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
@@ -29,5 +29,5 @@ var _chunkXS7VDTTTcjs = require('./chunk-XS7VDTTT.cjs');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
exports.CODE_SAMPLES =
|
|
32
|
+
exports.CODE_SAMPLES = _chunk6JSHPV2Ocjs.CODE_SAMPLES; exports.DISABLE_TAG_SORTING = _chunk6JSHPV2Ocjs.DISABLE_TAG_SORTING; exports.EXPLORER_ENABLED = _chunk6JSHPV2Ocjs.EXPLORER_ENABLED; exports.HEADERS = _chunk6JSHPV2Ocjs.HEADERS; exports.METRICS_ENABLED = _chunk6JSHPV2Ocjs.METRICS_ENABLED; exports.OAUTH_OPTIONS = _chunk6JSHPV2Ocjs.OAUTH_OPTIONS; exports.PARAMETER_ORDERING = _chunk6JSHPV2Ocjs.PARAMETER_ORDERING; exports.PROXY_ENABLED = _chunk6JSHPV2Ocjs.PROXY_ENABLED; exports.SAMPLES_LANGUAGES = _chunk6JSHPV2Ocjs.SAMPLES_LANGUAGES; exports.SIMPLE_MODE = _chunk6JSHPV2Ocjs.SIMPLE_MODE; exports.extensionDefaults = _chunk6JSHPV2Ocjs.extensionDefaults; exports.getExtension = _chunk6JSHPV2Ocjs.getExtension; exports.hasRootExtension = _chunk6JSHPV2Ocjs.hasRootExtension; exports.validateParameterOrdering = _chunk6JSHPV2Ocjs.validateParameterOrdering;
|
|
33
33
|
//# sourceMappingURL=extensions.cjs.map
|
package/dist/extensions.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { b as CODE_SAMPLES, D as DISABLE_TAG_SORTING, c as EXPLORER_ENABLED, E as Extensions, H as HEADERS, M as METRICS_ENABLED, d as OAUTH_OPTIONS, P as PARAMETER_ORDERING, e as PROXY_ENABLED, f as SAMPLES_LANGUAGES, h as SIMPLE_MODE, i as extensionDefaults, k as getExtension, j as hasRootExtension, v as validateParameterOrdering } from './extensions-
|
|
1
|
+
export { b as CODE_SAMPLES, D as DISABLE_TAG_SORTING, c as EXPLORER_ENABLED, E as Extensions, H as HEADERS, M as METRICS_ENABLED, d as OAUTH_OPTIONS, P as PARAMETER_ORDERING, e as PROXY_ENABLED, f as SAMPLES_LANGUAGES, h as SIMPLE_MODE, i as extensionDefaults, k as getExtension, j as hasRootExtension, v as validateParameterOrdering } from './extensions-DlGC1TJ1.cjs';
|
|
2
2
|
import './types.cjs';
|
|
3
3
|
import 'json-schema';
|
|
4
4
|
import 'openapi-types';
|
package/dist/extensions.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { b as CODE_SAMPLES, D as DISABLE_TAG_SORTING, c as EXPLORER_ENABLED, E as Extensions, H as HEADERS, M as METRICS_ENABLED, d as OAUTH_OPTIONS, P as PARAMETER_ORDERING, e as PROXY_ENABLED, f as SAMPLES_LANGUAGES, h as SIMPLE_MODE, i as extensionDefaults, k as getExtension, j as hasRootExtension, v as validateParameterOrdering } from './extensions-
|
|
1
|
+
export { b as CODE_SAMPLES, D as DISABLE_TAG_SORTING, c as EXPLORER_ENABLED, E as Extensions, H as HEADERS, M as METRICS_ENABLED, d as OAUTH_OPTIONS, P as PARAMETER_ORDERING, e as PROXY_ENABLED, f as SAMPLES_LANGUAGES, h as SIMPLE_MODE, i as extensionDefaults, k as getExtension, j as hasRootExtension, v as validateParameterOrdering } from './extensions-DAFceEIL.js';
|
|
2
2
|
import './types.js';
|
|
3
3
|
import 'json-schema';
|
|
4
4
|
import 'openapi-types';
|
package/dist/extensions.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
6
|
-
require('./chunk-
|
|
7
|
-
require('./chunk-
|
|
3
|
+
var _chunkGDEE6EQVcjs = require('./chunk-GDEE6EQV.cjs');
|
|
4
|
+
require('./chunk-636SYI6H.cjs');
|
|
5
|
+
require('./chunk-4DBNE7RJ.cjs');
|
|
6
|
+
require('./chunk-G5MSDVMW.cjs');
|
|
7
|
+
require('./chunk-6JSHPV2O.cjs');
|
|
8
8
|
require('./chunk-EQEXNJJE.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
exports.default =
|
|
11
|
+
exports.default = _chunkGDEE6EQVcjs.Oas;
|
|
12
12
|
|
|
13
13
|
module.exports = exports.default;
|
|
14
14
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Match, ParamData } from 'path-to-regexp';
|
|
2
|
-
import { O as Operation, W as Webhook, E as Extensions } from './extensions-
|
|
2
|
+
import { O as Operation, W as Webhook, E as Extensions } from './extensions-DlGC1TJ1.cjs';
|
|
3
3
|
import { OASDocument, User, ServerVariable, ServerVariablesObject, Servers, HttpMethods, PathsObject, AuthForHAR } from './types.cjs';
|
|
4
4
|
import 'json-schema';
|
|
5
5
|
import 'openapi-types';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Match, ParamData } from 'path-to-regexp';
|
|
2
|
-
import { O as Operation, W as Webhook, E as Extensions } from './extensions-
|
|
2
|
+
import { O as Operation, W as Webhook, E as Extensions } from './extensions-DAFceEIL.js';
|
|
3
3
|
import { OASDocument, User, ServerVariable, ServerVariablesObject, Servers, HttpMethods, PathsObject, AuthForHAR } from './types.js';
|
|
4
4
|
import 'json-schema';
|
|
5
5
|
import 'openapi-types';
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Oas
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-NIBF7F33.js";
|
|
4
|
+
import "./chunk-RF2D4VVK.js";
|
|
5
|
+
import "./chunk-W3LSKLU6.js";
|
|
6
|
+
import "./chunk-T34XCOTS.js";
|
|
7
|
+
import "./chunk-NBQXNFZT.js";
|
|
8
8
|
import "./chunk-UCEHCARG.js";
|
|
9
9
|
export {
|
|
10
10
|
Oas as default
|
package/dist/operation/index.cjs
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('../chunk-
|
|
7
|
-
require('../chunk-
|
|
8
|
-
require('../chunk-
|
|
5
|
+
var _chunk636SYI6Hcjs = require('../chunk-636SYI6H.cjs');
|
|
6
|
+
require('../chunk-4DBNE7RJ.cjs');
|
|
7
|
+
require('../chunk-G5MSDVMW.cjs');
|
|
8
|
+
require('../chunk-6JSHPV2O.cjs');
|
|
9
9
|
require('../chunk-EQEXNJJE.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
exports.Callback =
|
|
14
|
+
exports.Callback = _chunk636SYI6Hcjs.Callback; exports.Operation = _chunk636SYI6Hcjs.Operation; exports.Webhook = _chunk636SYI6Hcjs.Webhook;
|
|
15
15
|
//# sourceMappingURL=index.cjs.map
|
package/dist/operation/index.js
CHANGED
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
Callback,
|
|
3
3
|
Operation,
|
|
4
4
|
Webhook
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-RF2D4VVK.js";
|
|
6
|
+
import "../chunk-W3LSKLU6.js";
|
|
7
|
+
import "../chunk-T34XCOTS.js";
|
|
8
|
+
import "../chunk-NBQXNFZT.js";
|
|
9
9
|
import "../chunk-UCEHCARG.js";
|
|
10
10
|
export {
|
|
11
11
|
Callback,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../../chunk-
|
|
4
|
+
var _chunkG5MSDVMWcjs = require('../../chunk-G5MSDVMW.cjs');
|
|
5
|
+
require('../../chunk-6JSHPV2O.cjs');
|
|
6
6
|
require('../../chunk-EQEXNJJE.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
exports.getParametersAsJSONSchema =
|
|
10
|
+
exports.getParametersAsJSONSchema = _chunkG5MSDVMWcjs.getParametersAsJSONSchema; exports.types = _chunkG5MSDVMWcjs.types;
|
|
11
11
|
//# sourceMappingURL=get-parameters-as-json-schema.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '../../types.cjs';
|
|
2
|
-
export { S as SchemaWrapper, a as getParametersAsJSONSchema, g as getParametersAsJSONSchemaOptions, t as types } from '../../extensions-
|
|
2
|
+
export { S as SchemaWrapper, a as getParametersAsJSONSchema, g as getParametersAsJSONSchemaOptions, t as types } from '../../extensions-DlGC1TJ1.cjs';
|
|
3
3
|
import 'json-schema';
|
|
4
4
|
import 'openapi-types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '../../types.js';
|
|
2
|
-
export { S as SchemaWrapper, a as getParametersAsJSONSchema, g as getParametersAsJSONSchemaOptions, t as types } from '../../extensions-
|
|
2
|
+
export { S as SchemaWrapper, a as getParametersAsJSONSchema, g as getParametersAsJSONSchemaOptions, t as types } from '../../extensions-DAFceEIL.js';
|
|
3
3
|
import 'json-schema';
|
|
4
4
|
import 'openapi-types';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getParametersAsJSONSchema,
|
|
3
3
|
types
|
|
4
|
-
} from "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
4
|
+
} from "../../chunk-T34XCOTS.js";
|
|
5
|
+
import "../../chunk-NBQXNFZT.js";
|
|
6
6
|
import "../../chunk-UCEHCARG.js";
|
|
7
7
|
export {
|
|
8
8
|
getParametersAsJSONSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/erunion/code/readme/oas/packages/oas/dist/reducer/index.cjs","../../src/reducer/index.ts"],"names":[],"mappings":"AAAA;AACE;AACF,yDAAA;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;AACF,MAAA;AAE0C,MAAA;AAEX,QAAA;AACU,UAAA;AAG3B,YAAA;AAG2B,cAAA;AACjC,cAAA;AACF,YAAA;AACF,UAAA;AACF,QAAA;AAE4C,QAAA;AAGrB,QAAA;AACO,UAAA;AACO,YAAA;AACjC,YAAA;AACuC,UAAA;AACN,YAAA;AACjC,YAAA;AACF,UAAA;AACF,QAAA;AAGyB,QAAA;AACiB,UAAA;AACtB,YAAA;AACjB,UAAA;AACH,QAAA;AAG6C,QAAA;AAC9B,UAAA;AACd,QAAA;AAG4B,QAAA;AACe,UAAA;AACL,YAAA;AACS,cAAA;AAC3C,YAAA;AACF,UAAA;AACH,QAAA;AACD,MAAA;AAG6C,MAAA;AACnB,QAAA;AAC3B,MAAA;AACD,IAAA;AAIuC,IAAA;AACtB,MAAA;AAClB,IAAA;AACF,EAAA;AAGsB,EAAA;AACmB,IAAA;AACxC,EAAA;AAG4B,EAAA;AACc,IAAA;AACQ,MAAA;AAGjB,QAAA;AAMc,UAAA;AACvC,QAAA;AAEa,QAAA;AAC2B,UAAA;AAC3C,QAAA;AACD,MAAA;AAGiD,MAAA;AACT,QAAA;AACzC,MAAA;AACD,IAAA;AAG4C,IAAA;AAC5B,MAAA;AACjB,IAAA;AACF,EAAA;AAGuB,EAAA;AAC+B,IAAA;AACrB,MAAA;AACN,QAAA;AACvB,MAAA;AACD,IAAA;AAGyC,IAAA;AAEhB,IAAA;AACT,MAAA;AACjB,IAAA;AACF,EAAA;AAEO,EAAA;AACT;ADnGyD;AACA;AACA","file":"/Users/erunion/code/readme/oas/packages/oas/dist/reducer/index.cjs","sourcesContent":[null,"import type { ComponentsObject, HttpMethods, OASDocument, TagObject } from '../types.js';\n\nimport jsonPointer from 'jsonpointer';\n\nimport { query } from '../analyzer/util.js';\n\ninterface ReducerOptions {\n /** A key-value object of path + method combinations to reduce by. */\n paths?: Record<string, string[] | '*'>;\n /** An array of tags in the OpenAPI definition to reduce by. */\n tags?: string[];\n}\n\n/**\n * Query a JSON Schema object for any `$ref` pointers. Return any pointers that were found.\n *\n * @param schema JSON Schema object to look for any `$ref` pointers within it.\n */\nfunction getUsedRefs(schema: any) {\n return query([\"$..['$ref']\"], schema);\n}\n\n/**\n * Recursively process a `$ref` pointer and accumulate any other `$ref` pointers that it or its\n * children use.\n *\n * @param schema JSON Schema object to look for and accumulate any `$ref` pointers that it may have.\n * @param $refs Known set of `$ref` pointers.\n * @param $ref `$ref` pointer to fetch a schema from out of the supplied schema.\n */\nfunction accumulateUsedRefs(schema: Record<string, unknown>, $refs: Set<string>, $ref: string): void {\n let $refSchema: unknown;\n if (typeof $ref === 'string') $refSchema = jsonPointer.get(schema, $ref.substring(1));\n if ($refSchema === undefined) {\n // If the schema we have wasn't fully dereferenced or bundled for whatever reason and this\n // `$ref` that we have doesn't exist here we shouldn't try to search for more `$ref` pointers\n // in a schema that doesn't exist.\n return;\n }\n\n getUsedRefs($refSchema).forEach(({ value: currRef }) => {\n // Because it's possible to have a parameter named `$ref`, which our lookup would pick up as a\n // false positive, we want to exclude that from `$ref` matching as it's not really a reference.\n if (typeof currRef !== 'string') {\n return;\n }\n\n // If we've already processed this $ref don't send us into an infinite loop.\n if ($refs.has(currRef)) {\n return;\n }\n\n $refs.add(currRef);\n accumulateUsedRefs(schema, $refs, currRef);\n });\n}\n\n/**\n * With an array of tags or object of paths+method combinations, reduce an OpenAPI definition to a\n * new definition that just contains those tags or path + methods.\n *\n * @example <caption>Reduce by an array of tags only.</caption>\n * reducer(apiDefinition, { tags: ['pet'] })\n *\n * @example <caption>Reduce by a specific path and methods.</caption>\n * reducer(apiDefinition, { paths: { '/pet': ['get', 'post'] } })\n *\n * @example <caption>Reduce by a specific path and all methods it has.</caption>\n * reducer(apiDefinition, { paths: { '/pet': '*' } })\n *\n * @param definition A valid OpenAPI 3.x definition\n */\nexport default function reducer(definition: OASDocument, opts: ReducerOptions = {}): OASDocument {\n // Convert tags and paths to lowercase since casing should not matter.\n const reduceTags = 'tags' in opts ? opts.tags.map(tag => tag.toLowerCase()) : [];\n const reducePaths =\n 'paths' in opts\n ? Object.entries(opts.paths).reduce((acc: Record<string, string[] | string>, [key, value]) => {\n const newKey = key.toLowerCase();\n const newValue = Array.isArray(value) ? value.map(v => v.toLowerCase()) : value.toLowerCase();\n acc[newKey] = newValue;\n return acc;\n }, {})\n : {};\n\n const $refs: Set<string> = new Set();\n const usedTags: Set<string> = new Set();\n\n if (!definition.openapi) {\n throw new Error('Sorry, only OpenAPI definitions are supported.');\n }\n\n // Stringify and parse so we get a full non-reference clone of the API definition to work with.\n const reduced = JSON.parse(JSON.stringify(definition)) as OASDocument;\n\n // Retain any root-level security definitions.\n if ('security' in reduced) {\n Object.values(reduced.security).forEach(sec => {\n Object.keys(sec).forEach(scheme => {\n $refs.add(`#/components/securitySchemes/${scheme}`);\n });\n });\n }\n\n if ('paths' in reduced) {\n Object.keys(reduced.paths).forEach(path => {\n const pathLC = path.toLowerCase();\n\n if (Object.keys(reducePaths).length) {\n if (!(pathLC in reducePaths)) {\n delete reduced.paths[path];\n return;\n }\n }\n\n Object.keys(reduced.paths[path]).forEach((method: HttpMethods | 'parameters') => {\n // If this method is `parameters` we should always retain it.\n if (method !== 'parameters') {\n if (Object.keys(reducePaths).length) {\n if (\n reducePaths[pathLC] !== '*' &&\n Array.isArray(reducePaths[pathLC]) &&\n !reducePaths[pathLC].includes(method)\n ) {\n delete reduced.paths[path][method];\n return;\n }\n }\n }\n\n const operation = reduced.paths[path][method];\n\n // If we're reducing by tags and this operation doesn't live in one of those, remove it.\n if (reduceTags.length) {\n if (!('tags' in operation)) {\n delete reduced.paths[path][method];\n return;\n } else if (!operation.tags.filter(tag => reduceTags.includes(tag.toLowerCase())).length) {\n delete reduced.paths[path][method];\n return;\n }\n }\n\n // Accumulate a list of used tags so we can filter out any ones that we don't need later.\n if ('tags' in operation) {\n operation.tags.forEach((tag: string) => {\n usedTags.add(tag);\n });\n }\n\n // Accumulate a list of $ref pointers that are used within this operation.\n getUsedRefs(operation).forEach(({ value: ref }) => {\n $refs.add(ref);\n });\n\n // Accumulate any used security schemas that we need to retain.\n if ('security' in operation) {\n Object.values(operation.security).forEach(sec => {\n Object.keys(sec).forEach(scheme => {\n $refs.add(`#/components/securitySchemes/${scheme}`);\n });\n });\n }\n });\n\n // If this path no longer has any methods, delete it.\n if (!Object.keys(reduced.paths[path]).length) {\n delete reduced.paths[path];\n }\n });\n\n // If we don't have any more paths after cleanup, throw an error because an OpenAPI file must\n // have at least one path.\n if (!Object.keys(reduced.paths).length) {\n throw new Error('All paths in the API definition were removed. Did you supply the right path name to reduce by?');\n }\n }\n\n // Recursively accumulate any components that are in use.\n $refs.forEach($ref => {\n accumulateUsedRefs(reduced, $refs, $ref);\n });\n\n // Remove any unused components.\n if ('components' in reduced) {\n Object.keys(reduced.components).forEach((componentType: keyof ComponentsObject) => {\n Object.keys(reduced.components[componentType]).forEach(component => {\n // If our `$ref` either is a full, or deep match, then we should preserve it.\n const refIsUsed =\n $refs.has(`#/components/${componentType}/${component}`) ||\n Array.from($refs).some(ref => {\n // Because you can have a `$ref` like `#/components/examples/event-min/value`, which\n // would be accumulated via our `$refs` query, we want to make sure we account for them.\n // If we don't look for these then we'll end up removing them from the overall reduced\n // definition, resulting in data loss and schema corruption.\n return ref.startsWith(`#/components/${componentType}/${component}/`);\n });\n\n if (!refIsUsed) {\n delete reduced.components[componentType][component];\n }\n });\n\n // If this component group is now empty, delete it.\n if (!Object.keys(reduced.components[componentType]).length) {\n delete reduced.components[componentType];\n }\n });\n\n // If this path no longer has any components, delete it.\n if (!Object.keys(reduced.components).length) {\n delete reduced.components;\n }\n }\n\n // Remove any unused tags.\n if ('tags' in reduced) {\n reduced.tags.forEach((tag: TagObject, k: number) => {\n if (!usedTags.has(tag.name)) {\n delete reduced.tags[k];\n }\n });\n\n // Remove any now empty items from the tags array.\n reduced.tags = reduced.tags.filter(Boolean);\n\n if (!reduced.tags.length) {\n delete reduced.tags;\n }\n }\n\n return reduced;\n}\n"]}
|
|
1
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AACF,IAAA;AACH,EAAA;AAEwB,EAAA;AACqB,IAAA;AACT,MAAA;AAEK,MAAA;AACL,QAAA;AACH,UAAA;AACzB,UAAA;AACF,QAAA;AACF,MAAA;AAE0C,MAAA;AAEX,QAAA;AACU,UAAA;AAG3B,YAAA;AAG2B,cAAA;AACjC,cAAA;AACF,YAAA;AACF,UAAA;AACF,QAAA;AAE4C,QAAA;AAGrB,QAAA;AACO,UAAA;AACO,YAAA;AACjC,YAAA;AACuC,UAAA;AACN,YAAA;AACjC,YAAA;AACF,UAAA;AACF,QAAA;AAGyB,QAAA;AACiB,UAAA;AACtB,YAAA;AACjB,UAAA;AACH,QAAA;AAG6C,QAAA;AAC9B,UAAA;AACd,QAAA;AAG4B,QAAA;AACe,UAAA;AACL,YAAA;AACS,cAAA;AAC3C,YAAA;AACF,UAAA;AACH,QAAA;AACD,MAAA;AAG6C,MAAA;AACnB,QAAA;AAC3B,MAAA;AACD,IAAA;AAIuC,IAAA;AACtB,MAAA;AAClB,IAAA;AACF,EAAA;AAGsB,EAAA;AACmB,IAAA;AACxC,EAAA;AAG4B,EAAA;AACc,IAAA;AACQ,MAAA;AAGjB,QAAA;AAMc,UAAA;AACvC,QAAA;AAEa,QAAA;AAC2B,UAAA;AAC3C,QAAA;AACD,MAAA;AAGiD,MAAA;AACT,QAAA;AACzC,MAAA;AACD,IAAA;AAG4C,IAAA;AAC5B,MAAA;AACjB,IAAA;AACF,EAAA;AAGuB,EAAA;AAC+B,IAAA;AACrB,MAAA;AACN,QAAA;AACvB,MAAA;AACD,IAAA;AAGyC,IAAA;AAEhB,IAAA;AACT,MAAA;AACjB,IAAA;AACF,EAAA;AAEO,EAAA;AACT;ADpGyD;AACA;AACA","file":"/Users/erunion/code/readme/oas/packages/oas/dist/reducer/index.cjs","sourcesContent":[null,"import type { ComponentsObject, HttpMethods, OASDocument, TagObject } from '../types.js';\n\nimport jsonPointer from 'jsonpointer';\n\nimport { query } from '../analyzer/util.js';\n\ninterface ReducerOptions {\n /** A key-value object of path + method combinations to reduce by. */\n paths?: Record<string, string[] | '*'>;\n /** An array of tags in the OpenAPI definition to reduce by. */\n tags?: string[];\n}\n\n/**\n * Query a JSON Schema object for any `$ref` pointers. Return any pointers that were found.\n *\n * @param schema JSON Schema object to look for any `$ref` pointers within it.\n */\nfunction getUsedRefs(schema: any) {\n return query([\"$..['$ref']\"], schema);\n}\n\n/**\n * Recursively process a `$ref` pointer and accumulate any other `$ref` pointers that it or its\n * children use.\n *\n * @param schema JSON Schema object to look for and accumulate any `$ref` pointers that it may have.\n * @param $refs Known set of `$ref` pointers.\n * @param $ref `$ref` pointer to fetch a schema from out of the supplied schema.\n */\nfunction accumulateUsedRefs(schema: Record<string, unknown>, $refs: Set<string>, $ref: string): void {\n let $refSchema: unknown;\n if (typeof $ref === 'string') $refSchema = jsonPointer.get(schema, $ref.substring(1));\n if ($refSchema === undefined) {\n // If the schema we have wasn't fully dereferenced or bundled for whatever reason and this\n // `$ref` that we have doesn't exist here we shouldn't try to search for more `$ref` pointers\n // in a schema that doesn't exist.\n return;\n }\n\n getUsedRefs($refSchema).forEach(({ value: currRef }) => {\n // Because it's possible to have a parameter named `$ref`, which our lookup would pick up as a\n // false positive, we want to exclude that from `$ref` matching as it's not really a reference.\n if (typeof currRef !== 'string') {\n return;\n }\n\n // If we've already processed this $ref don't send us into an infinite loop.\n if ($refs.has(currRef)) {\n return;\n }\n\n $refs.add(currRef);\n accumulateUsedRefs(schema, $refs, currRef);\n });\n}\n\n/**\n * With an array of tags or object of paths+method combinations, reduce an OpenAPI definition to a\n * new definition that just contains those tags or path + methods.\n *\n * @example <caption>Reduce by an array of tags only.</caption>\n * reducer(apiDefinition, { tags: ['pet'] })\n *\n * @example <caption>Reduce by a specific path and methods.</caption>\n * reducer(apiDefinition, { paths: { '/pet': ['get', 'post'] } })\n *\n * @example <caption>Reduce by a specific path and all methods it has.</caption>\n * reducer(apiDefinition, { paths: { '/pet': '*' } })\n *\n * @param definition A valid OpenAPI 3.x definition\n */\n// biome-ignore lint/style/noDefaultExport: This is safe for now.\nexport default function reducer(definition: OASDocument, opts: ReducerOptions = {}): OASDocument {\n // Convert tags and paths to lowercase since casing should not matter.\n const reduceTags = 'tags' in opts ? opts.tags.map(tag => tag.toLowerCase()) : [];\n const reducePaths =\n 'paths' in opts\n ? Object.entries(opts.paths).reduce((acc: Record<string, string[] | string>, [key, value]) => {\n const newKey = key.toLowerCase();\n const newValue = Array.isArray(value) ? value.map(v => v.toLowerCase()) : value.toLowerCase();\n acc[newKey] = newValue;\n return acc;\n }, {})\n : {};\n\n const $refs: Set<string> = new Set();\n const usedTags: Set<string> = new Set();\n\n if (!definition.openapi) {\n throw new Error('Sorry, only OpenAPI definitions are supported.');\n }\n\n // Stringify and parse so we get a full non-reference clone of the API definition to work with.\n const reduced = JSON.parse(JSON.stringify(definition)) as OASDocument;\n\n // Retain any root-level security definitions.\n if ('security' in reduced) {\n Object.values(reduced.security).forEach(sec => {\n Object.keys(sec).forEach(scheme => {\n $refs.add(`#/components/securitySchemes/${scheme}`);\n });\n });\n }\n\n if ('paths' in reduced) {\n Object.keys(reduced.paths).forEach(path => {\n const pathLC = path.toLowerCase();\n\n if (Object.keys(reducePaths).length) {\n if (!(pathLC in reducePaths)) {\n delete reduced.paths[path];\n return;\n }\n }\n\n Object.keys(reduced.paths[path]).forEach((method: HttpMethods | 'parameters') => {\n // If this method is `parameters` we should always retain it.\n if (method !== 'parameters') {\n if (Object.keys(reducePaths).length) {\n if (\n reducePaths[pathLC] !== '*' &&\n Array.isArray(reducePaths[pathLC]) &&\n !reducePaths[pathLC].includes(method)\n ) {\n delete reduced.paths[path][method];\n return;\n }\n }\n }\n\n const operation = reduced.paths[path][method];\n\n // If we're reducing by tags and this operation doesn't live in one of those, remove it.\n if (reduceTags.length) {\n if (!('tags' in operation)) {\n delete reduced.paths[path][method];\n return;\n } else if (!operation.tags.filter(tag => reduceTags.includes(tag.toLowerCase())).length) {\n delete reduced.paths[path][method];\n return;\n }\n }\n\n // Accumulate a list of used tags so we can filter out any ones that we don't need later.\n if ('tags' in operation) {\n operation.tags.forEach((tag: string) => {\n usedTags.add(tag);\n });\n }\n\n // Accumulate a list of $ref pointers that are used within this operation.\n getUsedRefs(operation).forEach(({ value: ref }) => {\n $refs.add(ref);\n });\n\n // Accumulate any used security schemas that we need to retain.\n if ('security' in operation) {\n Object.values(operation.security).forEach(sec => {\n Object.keys(sec).forEach(scheme => {\n $refs.add(`#/components/securitySchemes/${scheme}`);\n });\n });\n }\n });\n\n // If this path no longer has any methods, delete it.\n if (!Object.keys(reduced.paths[path]).length) {\n delete reduced.paths[path];\n }\n });\n\n // If we don't have any more paths after cleanup, throw an error because an OpenAPI file must\n // have at least one path.\n if (!Object.keys(reduced.paths).length) {\n throw new Error('All paths in the API definition were removed. Did you supply the right path name to reduce by?');\n }\n }\n\n // Recursively accumulate any components that are in use.\n $refs.forEach($ref => {\n accumulateUsedRefs(reduced, $refs, $ref);\n });\n\n // Remove any unused components.\n if ('components' in reduced) {\n Object.keys(reduced.components).forEach((componentType: keyof ComponentsObject) => {\n Object.keys(reduced.components[componentType]).forEach(component => {\n // If our `$ref` either is a full, or deep match, then we should preserve it.\n const refIsUsed =\n $refs.has(`#/components/${componentType}/${component}`) ||\n Array.from($refs).some(ref => {\n // Because you can have a `$ref` like `#/components/examples/event-min/value`, which\n // would be accumulated via our `$refs` query, we want to make sure we account for them.\n // If we don't look for these then we'll end up removing them from the overall reduced\n // definition, resulting in data loss and schema corruption.\n return ref.startsWith(`#/components/${componentType}/${component}/`);\n });\n\n if (!refIsUsed) {\n delete reduced.components[componentType][component];\n }\n });\n\n // If this component group is now empty, delete it.\n if (!Object.keys(reduced.components[componentType]).length) {\n delete reduced.components[componentType];\n }\n });\n\n // If this path no longer has any components, delete it.\n if (!Object.keys(reduced.components).length) {\n delete reduced.components;\n }\n }\n\n // Remove any unused tags.\n if ('tags' in reduced) {\n reduced.tags.forEach((tag: TagObject, k: number) => {\n if (!usedTags.has(tag.name)) {\n delete reduced.tags[k];\n }\n });\n\n // Remove any now empty items from the tags array.\n reduced.tags = reduced.tags.filter(Boolean);\n\n if (!reduced.tags.length) {\n delete reduced.tags;\n }\n }\n\n return reduced;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/reducer/index.ts"],"sourcesContent":["import type { ComponentsObject, HttpMethods, OASDocument, TagObject } from '../types.js';\n\nimport jsonPointer from 'jsonpointer';\n\nimport { query } from '../analyzer/util.js';\n\ninterface ReducerOptions {\n /** A key-value object of path + method combinations to reduce by. */\n paths?: Record<string, string[] | '*'>;\n /** An array of tags in the OpenAPI definition to reduce by. */\n tags?: string[];\n}\n\n/**\n * Query a JSON Schema object for any `$ref` pointers. Return any pointers that were found.\n *\n * @param schema JSON Schema object to look for any `$ref` pointers within it.\n */\nfunction getUsedRefs(schema: any) {\n return query([\"$..['$ref']\"], schema);\n}\n\n/**\n * Recursively process a `$ref` pointer and accumulate any other `$ref` pointers that it or its\n * children use.\n *\n * @param schema JSON Schema object to look for and accumulate any `$ref` pointers that it may have.\n * @param $refs Known set of `$ref` pointers.\n * @param $ref `$ref` pointer to fetch a schema from out of the supplied schema.\n */\nfunction accumulateUsedRefs(schema: Record<string, unknown>, $refs: Set<string>, $ref: string): void {\n let $refSchema: unknown;\n if (typeof $ref === 'string') $refSchema = jsonPointer.get(schema, $ref.substring(1));\n if ($refSchema === undefined) {\n // If the schema we have wasn't fully dereferenced or bundled for whatever reason and this\n // `$ref` that we have doesn't exist here we shouldn't try to search for more `$ref` pointers\n // in a schema that doesn't exist.\n return;\n }\n\n getUsedRefs($refSchema).forEach(({ value: currRef }) => {\n // Because it's possible to have a parameter named `$ref`, which our lookup would pick up as a\n // false positive, we want to exclude that from `$ref` matching as it's not really a reference.\n if (typeof currRef !== 'string') {\n return;\n }\n\n // If we've already processed this $ref don't send us into an infinite loop.\n if ($refs.has(currRef)) {\n return;\n }\n\n $refs.add(currRef);\n accumulateUsedRefs(schema, $refs, currRef);\n });\n}\n\n/**\n * With an array of tags or object of paths+method combinations, reduce an OpenAPI definition to a\n * new definition that just contains those tags or path + methods.\n *\n * @example <caption>Reduce by an array of tags only.</caption>\n * reducer(apiDefinition, { tags: ['pet'] })\n *\n * @example <caption>Reduce by a specific path and methods.</caption>\n * reducer(apiDefinition, { paths: { '/pet': ['get', 'post'] } })\n *\n * @example <caption>Reduce by a specific path and all methods it has.</caption>\n * reducer(apiDefinition, { paths: { '/pet': '*' } })\n *\n * @param definition A valid OpenAPI 3.x definition\n */\nexport default function reducer(definition: OASDocument, opts: ReducerOptions = {}): OASDocument {\n // Convert tags and paths to lowercase since casing should not matter.\n const reduceTags = 'tags' in opts ? opts.tags.map(tag => tag.toLowerCase()) : [];\n const reducePaths =\n 'paths' in opts\n ? Object.entries(opts.paths).reduce((acc: Record<string, string[] | string>, [key, value]) => {\n const newKey = key.toLowerCase();\n const newValue = Array.isArray(value) ? value.map(v => v.toLowerCase()) : value.toLowerCase();\n acc[newKey] = newValue;\n return acc;\n }, {})\n : {};\n\n const $refs: Set<string> = new Set();\n const usedTags: Set<string> = new Set();\n\n if (!definition.openapi) {\n throw new Error('Sorry, only OpenAPI definitions are supported.');\n }\n\n // Stringify and parse so we get a full non-reference clone of the API definition to work with.\n const reduced = JSON.parse(JSON.stringify(definition)) as OASDocument;\n\n // Retain any root-level security definitions.\n if ('security' in reduced) {\n Object.values(reduced.security).forEach(sec => {\n Object.keys(sec).forEach(scheme => {\n $refs.add(`#/components/securitySchemes/${scheme}`);\n });\n });\n }\n\n if ('paths' in reduced) {\n Object.keys(reduced.paths).forEach(path => {\n const pathLC = path.toLowerCase();\n\n if (Object.keys(reducePaths).length) {\n if (!(pathLC in reducePaths)) {\n delete reduced.paths[path];\n return;\n }\n }\n\n Object.keys(reduced.paths[path]).forEach((method: HttpMethods | 'parameters') => {\n // If this method is `parameters` we should always retain it.\n if (method !== 'parameters') {\n if (Object.keys(reducePaths).length) {\n if (\n reducePaths[pathLC] !== '*' &&\n Array.isArray(reducePaths[pathLC]) &&\n !reducePaths[pathLC].includes(method)\n ) {\n delete reduced.paths[path][method];\n return;\n }\n }\n }\n\n const operation = reduced.paths[path][method];\n\n // If we're reducing by tags and this operation doesn't live in one of those, remove it.\n if (reduceTags.length) {\n if (!('tags' in operation)) {\n delete reduced.paths[path][method];\n return;\n } else if (!operation.tags.filter(tag => reduceTags.includes(tag.toLowerCase())).length) {\n delete reduced.paths[path][method];\n return;\n }\n }\n\n // Accumulate a list of used tags so we can filter out any ones that we don't need later.\n if ('tags' in operation) {\n operation.tags.forEach((tag: string) => {\n usedTags.add(tag);\n });\n }\n\n // Accumulate a list of $ref pointers that are used within this operation.\n getUsedRefs(operation).forEach(({ value: ref }) => {\n $refs.add(ref);\n });\n\n // Accumulate any used security schemas that we need to retain.\n if ('security' in operation) {\n Object.values(operation.security).forEach(sec => {\n Object.keys(sec).forEach(scheme => {\n $refs.add(`#/components/securitySchemes/${scheme}`);\n });\n });\n }\n });\n\n // If this path no longer has any methods, delete it.\n if (!Object.keys(reduced.paths[path]).length) {\n delete reduced.paths[path];\n }\n });\n\n // If we don't have any more paths after cleanup, throw an error because an OpenAPI file must\n // have at least one path.\n if (!Object.keys(reduced.paths).length) {\n throw new Error('All paths in the API definition were removed. Did you supply the right path name to reduce by?');\n }\n }\n\n // Recursively accumulate any components that are in use.\n $refs.forEach($ref => {\n accumulateUsedRefs(reduced, $refs, $ref);\n });\n\n // Remove any unused components.\n if ('components' in reduced) {\n Object.keys(reduced.components).forEach((componentType: keyof ComponentsObject) => {\n Object.keys(reduced.components[componentType]).forEach(component => {\n // If our `$ref` either is a full, or deep match, then we should preserve it.\n const refIsUsed =\n $refs.has(`#/components/${componentType}/${component}`) ||\n Array.from($refs).some(ref => {\n // Because you can have a `$ref` like `#/components/examples/event-min/value`, which\n // would be accumulated via our `$refs` query, we want to make sure we account for them.\n // If we don't look for these then we'll end up removing them from the overall reduced\n // definition, resulting in data loss and schema corruption.\n return ref.startsWith(`#/components/${componentType}/${component}/`);\n });\n\n if (!refIsUsed) {\n delete reduced.components[componentType][component];\n }\n });\n\n // If this component group is now empty, delete it.\n if (!Object.keys(reduced.components[componentType]).length) {\n delete reduced.components[componentType];\n }\n });\n\n // If this path no longer has any components, delete it.\n if (!Object.keys(reduced.components).length) {\n delete reduced.components;\n }\n }\n\n // Remove any unused tags.\n if ('tags' in reduced) {\n reduced.tags.forEach((tag: TagObject, k: number) => {\n if (!usedTags.has(tag.name)) {\n delete reduced.tags[k];\n }\n });\n\n // Remove any now empty items from the tags array.\n reduced.tags = reduced.tags.filter(Boolean);\n\n if (!reduced.tags.length) {\n delete reduced.tags;\n }\n }\n\n return reduced;\n}\n"],"mappings":";;;;;AAEA,OAAO,iBAAiB;AAgBxB,SAAS,YAAY,QAAa;AAChC,SAAO,MAAM,CAAC,aAAa,GAAG,MAAM;AACtC;AAUA,SAAS,mBAAmB,QAAiC,OAAoB,MAAoB;AACnG,MAAI;AACJ,MAAI,OAAO,SAAS,SAAU,cAAa,YAAY,IAAI,QAAQ,KAAK,UAAU,CAAC,CAAC;AACpF,MAAI,eAAe,QAAW;AAI5B;AAAA,EACF;AAEA,cAAY,UAAU,EAAE,QAAQ,CAAC,EAAE,OAAO,QAAQ,MAAM;AAGtD,QAAI,OAAO,YAAY,UAAU;AAC/B;AAAA,IACF;AAGA,QAAI,MAAM,IAAI,OAAO,GAAG;AACtB;AAAA,IACF;AAEA,UAAM,IAAI,OAAO;AACjB,uBAAmB,QAAQ,OAAO,OAAO;AAAA,EAC3C,CAAC;AACH;AAiBe,SAAR,QAAyB,YAAyB,OAAuB,CAAC,GAAgB;AAE/F,QAAM,aAAa,UAAU,OAAO,KAAK,KAAK,IAAI,SAAO,IAAI,YAAY,CAAC,IAAI,CAAC;AAC/E,QAAM,cACJ,WAAW,OACP,OAAO,QAAQ,KAAK,KAAK,EAAE,OAAO,CAAC,KAAwC,CAAC,KAAK,KAAK,MAAM;AAC1F,UAAM,SAAS,IAAI,YAAY;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MAAM,KAAK,KAAK,EAAE,KAAK,SAAO;AAK5B,iBAAO,IAAI,WAAW,gBAAgB,aAAa,IAAI,SAAS,GAAG;AAAA,QACrE,CAAC;AAEH,YAAI,CAAC,WAAW;AACd,iBAAO,QAAQ,WAAW,aAAa,EAAE,SAAS;AAAA,QACpD;AAAA,MACF,CAAC;AAGD,UAAI,CAAC,OAAO,KAAK,QAAQ,WAAW,aAAa,CAAC,EAAE,QAAQ;AAC1D,eAAO,QAAQ,WAAW,aAAa;AAAA,MACzC;AAAA,IACF,CAAC;AAGD,QAAI,CAAC,OAAO,KAAK,QAAQ,UAAU,EAAE,QAAQ;AAC3C,aAAO,QAAQ;AAAA,IACjB;AAAA,EACF;AAGA,MAAI,UAAU,SAAS;AACrB,YAAQ,KAAK,QAAQ,CAAC,KAAgB,MAAc;AAClD,UAAI,CAAC,SAAS,IAAI,IAAI,IAAI,GAAG;AAC3B,eAAO,QAAQ,KAAK,CAAC;AAAA,MACvB;AAAA,IACF,CAAC;AAGD,YAAQ,OAAO,QAAQ,KAAK,OAAO,OAAO;AAE1C,QAAI,CAAC,QAAQ,KAAK,QAAQ;AACxB,aAAO,QAAQ;AAAA,IACjB;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/reducer/index.ts"],"sourcesContent":["import type { ComponentsObject, HttpMethods, OASDocument, TagObject } from '../types.js';\n\nimport jsonPointer from 'jsonpointer';\n\nimport { query } from '../analyzer/util.js';\n\ninterface ReducerOptions {\n /** A key-value object of path + method combinations to reduce by. */\n paths?: Record<string, string[] | '*'>;\n /** An array of tags in the OpenAPI definition to reduce by. */\n tags?: string[];\n}\n\n/**\n * Query a JSON Schema object for any `$ref` pointers. Return any pointers that were found.\n *\n * @param schema JSON Schema object to look for any `$ref` pointers within it.\n */\nfunction getUsedRefs(schema: any) {\n return query([\"$..['$ref']\"], schema);\n}\n\n/**\n * Recursively process a `$ref` pointer and accumulate any other `$ref` pointers that it or its\n * children use.\n *\n * @param schema JSON Schema object to look for and accumulate any `$ref` pointers that it may have.\n * @param $refs Known set of `$ref` pointers.\n * @param $ref `$ref` pointer to fetch a schema from out of the supplied schema.\n */\nfunction accumulateUsedRefs(schema: Record<string, unknown>, $refs: Set<string>, $ref: string): void {\n let $refSchema: unknown;\n if (typeof $ref === 'string') $refSchema = jsonPointer.get(schema, $ref.substring(1));\n if ($refSchema === undefined) {\n // If the schema we have wasn't fully dereferenced or bundled for whatever reason and this\n // `$ref` that we have doesn't exist here we shouldn't try to search for more `$ref` pointers\n // in a schema that doesn't exist.\n return;\n }\n\n getUsedRefs($refSchema).forEach(({ value: currRef }) => {\n // Because it's possible to have a parameter named `$ref`, which our lookup would pick up as a\n // false positive, we want to exclude that from `$ref` matching as it's not really a reference.\n if (typeof currRef !== 'string') {\n return;\n }\n\n // If we've already processed this $ref don't send us into an infinite loop.\n if ($refs.has(currRef)) {\n return;\n }\n\n $refs.add(currRef);\n accumulateUsedRefs(schema, $refs, currRef);\n });\n}\n\n/**\n * With an array of tags or object of paths+method combinations, reduce an OpenAPI definition to a\n * new definition that just contains those tags or path + methods.\n *\n * @example <caption>Reduce by an array of tags only.</caption>\n * reducer(apiDefinition, { tags: ['pet'] })\n *\n * @example <caption>Reduce by a specific path and methods.</caption>\n * reducer(apiDefinition, { paths: { '/pet': ['get', 'post'] } })\n *\n * @example <caption>Reduce by a specific path and all methods it has.</caption>\n * reducer(apiDefinition, { paths: { '/pet': '*' } })\n *\n * @param definition A valid OpenAPI 3.x definition\n */\n// biome-ignore lint/style/noDefaultExport: This is safe for now.\nexport default function reducer(definition: OASDocument, opts: ReducerOptions = {}): OASDocument {\n // Convert tags and paths to lowercase since casing should not matter.\n const reduceTags = 'tags' in opts ? opts.tags.map(tag => tag.toLowerCase()) : [];\n const reducePaths =\n 'paths' in opts\n ? Object.entries(opts.paths).reduce((acc: Record<string, string[] | string>, [key, value]) => {\n const newKey = key.toLowerCase();\n const newValue = Array.isArray(value) ? value.map(v => v.toLowerCase()) : value.toLowerCase();\n acc[newKey] = newValue;\n return acc;\n }, {})\n : {};\n\n const $refs: Set<string> = new Set();\n const usedTags: Set<string> = new Set();\n\n if (!definition.openapi) {\n throw new Error('Sorry, only OpenAPI definitions are supported.');\n }\n\n // Stringify and parse so we get a full non-reference clone of the API definition to work with.\n const reduced = JSON.parse(JSON.stringify(definition)) as OASDocument;\n\n // Retain any root-level security definitions.\n if ('security' in reduced) {\n Object.values(reduced.security).forEach(sec => {\n Object.keys(sec).forEach(scheme => {\n $refs.add(`#/components/securitySchemes/${scheme}`);\n });\n });\n }\n\n if ('paths' in reduced) {\n Object.keys(reduced.paths).forEach(path => {\n const pathLC = path.toLowerCase();\n\n if (Object.keys(reducePaths).length) {\n if (!(pathLC in reducePaths)) {\n delete reduced.paths[path];\n return;\n }\n }\n\n Object.keys(reduced.paths[path]).forEach((method: HttpMethods | 'parameters') => {\n // If this method is `parameters` we should always retain it.\n if (method !== 'parameters') {\n if (Object.keys(reducePaths).length) {\n if (\n reducePaths[pathLC] !== '*' &&\n Array.isArray(reducePaths[pathLC]) &&\n !reducePaths[pathLC].includes(method)\n ) {\n delete reduced.paths[path][method];\n return;\n }\n }\n }\n\n const operation = reduced.paths[path][method];\n\n // If we're reducing by tags and this operation doesn't live in one of those, remove it.\n if (reduceTags.length) {\n if (!('tags' in operation)) {\n delete reduced.paths[path][method];\n return;\n } else if (!operation.tags.filter(tag => reduceTags.includes(tag.toLowerCase())).length) {\n delete reduced.paths[path][method];\n return;\n }\n }\n\n // Accumulate a list of used tags so we can filter out any ones that we don't need later.\n if ('tags' in operation) {\n operation.tags.forEach((tag: string) => {\n usedTags.add(tag);\n });\n }\n\n // Accumulate a list of $ref pointers that are used within this operation.\n getUsedRefs(operation).forEach(({ value: ref }) => {\n $refs.add(ref);\n });\n\n // Accumulate any used security schemas that we need to retain.\n if ('security' in operation) {\n Object.values(operation.security).forEach(sec => {\n Object.keys(sec).forEach(scheme => {\n $refs.add(`#/components/securitySchemes/${scheme}`);\n });\n });\n }\n });\n\n // If this path no longer has any methods, delete it.\n if (!Object.keys(reduced.paths[path]).length) {\n delete reduced.paths[path];\n }\n });\n\n // If we don't have any more paths after cleanup, throw an error because an OpenAPI file must\n // have at least one path.\n if (!Object.keys(reduced.paths).length) {\n throw new Error('All paths in the API definition were removed. Did you supply the right path name to reduce by?');\n }\n }\n\n // Recursively accumulate any components that are in use.\n $refs.forEach($ref => {\n accumulateUsedRefs(reduced, $refs, $ref);\n });\n\n // Remove any unused components.\n if ('components' in reduced) {\n Object.keys(reduced.components).forEach((componentType: keyof ComponentsObject) => {\n Object.keys(reduced.components[componentType]).forEach(component => {\n // If our `$ref` either is a full, or deep match, then we should preserve it.\n const refIsUsed =\n $refs.has(`#/components/${componentType}/${component}`) ||\n Array.from($refs).some(ref => {\n // Because you can have a `$ref` like `#/components/examples/event-min/value`, which\n // would be accumulated via our `$refs` query, we want to make sure we account for them.\n // If we don't look for these then we'll end up removing them from the overall reduced\n // definition, resulting in data loss and schema corruption.\n return ref.startsWith(`#/components/${componentType}/${component}/`);\n });\n\n if (!refIsUsed) {\n delete reduced.components[componentType][component];\n }\n });\n\n // If this component group is now empty, delete it.\n if (!Object.keys(reduced.components[componentType]).length) {\n delete reduced.components[componentType];\n }\n });\n\n // If this path no longer has any components, delete it.\n if (!Object.keys(reduced.components).length) {\n delete reduced.components;\n }\n }\n\n // Remove any unused tags.\n if ('tags' in reduced) {\n reduced.tags.forEach((tag: TagObject, k: number) => {\n if (!usedTags.has(tag.name)) {\n delete reduced.tags[k];\n }\n });\n\n // Remove any now empty items from the tags array.\n reduced.tags = reduced.tags.filter(Boolean);\n\n if (!reduced.tags.length) {\n delete reduced.tags;\n }\n }\n\n return reduced;\n}\n"],"mappings":";;;;;AAEA,OAAO,iBAAiB;AAgBxB,SAAS,YAAY,QAAa;AAChC,SAAO,MAAM,CAAC,aAAa,GAAG,MAAM;AACtC;AAUA,SAAS,mBAAmB,QAAiC,OAAoB,MAAoB;AACnG,M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AAAA,MACvB;AAAA,IACF,CAAC;AAGD,YAAQ,OAAO,QAAQ,KAAK,OAAO,OAAO;AAE1C,QAAI,CAAC,QAAQ,KAAK,QAAQ;AACxB,aAAO,QAAQ;AAAA,IACjB;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
package/dist/utils.cjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunk4DBNE7RJcjs = require('./chunk-4DBNE7RJ.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('./chunk-
|
|
8
|
+
var _chunkG5MSDVMWcjs = require('./chunk-G5MSDVMW.cjs');
|
|
9
|
+
require('./chunk-6JSHPV2O.cjs');
|
|
10
10
|
require('./chunk-EQEXNJJE.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
exports.findSchemaDefinition =
|
|
16
|
+
exports.findSchemaDefinition = _chunk4DBNE7RJcjs.findSchemaDefinition; exports.jsonSchemaTypes = _chunkG5MSDVMWcjs.types; exports.matchesMimeType = _chunkG5MSDVMWcjs.matches_mimetype_default; exports.supportedMethods = _chunk4DBNE7RJcjs.supportedMethods;
|
|
17
17
|
//# sourceMappingURL=utils.cjs.map
|
package/dist/utils.d.cts
CHANGED
package/dist/utils.d.ts
CHANGED
package/dist/utils.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
findSchemaDefinition,
|
|
3
3
|
supportedMethods
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-W3LSKLU6.js";
|
|
5
5
|
import {
|
|
6
6
|
matches_mimetype_default,
|
|
7
7
|
types
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-T34XCOTS.js";
|
|
9
|
+
import "./chunk-NBQXNFZT.js";
|
|
10
10
|
import "./chunk-UCEHCARG.js";
|
|
11
11
|
export {
|
|
12
12
|
findSchemaDefinition,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oas",
|
|
3
|
-
"version": "28.
|
|
3
|
+
"version": "28.3.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)",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"watch": "tsc --watch"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@readme/openapi-parser": "^5.0.
|
|
90
|
+
"@readme/openapi-parser": "^5.0.2",
|
|
91
91
|
"@types/json-schema": "^7.0.11",
|
|
92
92
|
"json-schema-merge-allof": "^0.8.1",
|
|
93
93
|
"jsonpath-plus": "^10.0.0",
|
|
@@ -95,10 +95,10 @@
|
|
|
95
95
|
"memoizee": "^0.4.16",
|
|
96
96
|
"openapi-types": "^12.1.1",
|
|
97
97
|
"path-to-regexp": "^8.1.0",
|
|
98
|
-
"remove-undefined-objects": "^
|
|
98
|
+
"remove-undefined-objects": "^7.0.0"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
|
-
"@readme/oas-examples": "^7.0.
|
|
101
|
+
"@readme/oas-examples": "^7.0.1",
|
|
102
102
|
"@types/json-schema-merge-allof": "^0.6.5",
|
|
103
103
|
"@types/memoizee": "^0.4.12",
|
|
104
104
|
"@types/node": "^22.14.0",
|
|
@@ -107,5 +107,5 @@
|
|
|
107
107
|
"vitest": "^3.2.1"
|
|
108
108
|
},
|
|
109
109
|
"prettier": "@readme/standards/prettier",
|
|
110
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "3d895bfa7f64a674b4462b0fd005ee96319d5263"
|
|
111
111
|
}
|