oas 38.3.0 → 38.4.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/README.md +38 -4
- package/dist/chunk-4CWJNFV5.js +709 -0
- package/dist/chunk-4CWJNFV5.js.map +1 -0
- package/dist/{chunk-XXX6U72S.js → chunk-5ZBXVQYR.js} +17 -3
- package/dist/chunk-5ZBXVQYR.js.map +1 -0
- package/dist/{chunk-3ZXZMZXT.cjs → chunk-Y64TRECN.cjs} +18 -4
- package/dist/chunk-Y64TRECN.cjs.map +1 -0
- package/dist/chunk-Z2WDQGCU.cjs +709 -0
- package/dist/chunk-Z2WDQGCU.cjs.map +1 -0
- package/dist/index-Borb1VXh.d.cts +174 -0
- package/dist/index-Br-eJMCh.d.ts +174 -0
- package/dist/index.cjs +29 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/dist/operation/index.cjs +2 -2
- package/dist/operation/index.js +1 -1
- package/dist/pruner/index.cjs +87 -0
- package/dist/pruner/index.cjs.map +1 -0
- package/dist/pruner/index.d.cts +72 -0
- package/dist/pruner/index.d.ts +72 -0
- package/dist/pruner/index.js +87 -0
- package/dist/pruner/index.js.map +1 -0
- package/dist/reducer/index.cjs +39 -520
- package/dist/reducer/index.cjs.map +1 -1
- package/dist/reducer/index.d.cts +22 -108
- package/dist/reducer/index.d.ts +22 -108
- package/dist/reducer/index.js +37 -518
- package/dist/reducer/index.js.map +1 -1
- package/package.json +6 -2
- package/dist/chunk-3ZXZMZXT.cjs.map +0 -1
- package/dist/chunk-XXX6U72S.js.map +0 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkZ2WDQGCUcjs = require('../chunk-Z2WDQGCU.cjs');
|
|
4
|
+
require('../chunk-COHEPMUP.cjs');
|
|
5
|
+
require('../chunk-Y64TRECN.cjs');
|
|
6
|
+
require('../chunk-7WBPPWYI.cjs');
|
|
7
|
+
require('../chunk-6HXOZ5GY.cjs');
|
|
8
|
+
require('../chunk-7PWF3F2W.cjs');
|
|
9
|
+
|
|
10
|
+
// src/pruner/index.ts
|
|
11
|
+
var OpenAPIPruner = class _OpenAPIPruner extends _chunkZ2WDQGCUcjs.OpenAPITransformer {
|
|
12
|
+
constructor(definition) {
|
|
13
|
+
super(definition, {
|
|
14
|
+
mode: "prune"
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Initialize a new `OpenAPIPruner`. The pruner removes selected tags, paths, operations,
|
|
19
|
+
* operation IDs, and webhooks together with components and tags that are no longer reachable
|
|
20
|
+
* from the remaining operations. Removal filters are additive, so an operation matching any
|
|
21
|
+
* configured filter is removed.
|
|
22
|
+
*
|
|
23
|
+
* @param definition OpenAPI definition to prune.
|
|
24
|
+
*/
|
|
25
|
+
static init(definition) {
|
|
26
|
+
return new _OpenAPIPruner(definition);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Remove every OpenAPI operation containing a tag. Operations without any tags are retained. Tag
|
|
30
|
+
* casing does not matter.
|
|
31
|
+
*
|
|
32
|
+
* When combined with operation ID, path, operation, or webhook removals, the filters remain
|
|
33
|
+
* additive. Any operation matching the tag OR another removal filter will be removed.
|
|
34
|
+
*
|
|
35
|
+
* @param tag Tag whose operations should be removed.
|
|
36
|
+
*/
|
|
37
|
+
removeTag(tag) {
|
|
38
|
+
this.selectTag(tag);
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Remove an entire OpenAPI path and all operations that it contains. Path casing does not matter.
|
|
43
|
+
*
|
|
44
|
+
* @param path Path to remove.
|
|
45
|
+
*/
|
|
46
|
+
removePath(path) {
|
|
47
|
+
this.selectPath(path);
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Remove a single OpenAPI operation. Path and method casing does not matter.
|
|
52
|
+
*
|
|
53
|
+
* If you previously called `.removePath()` to remove the entire path, calling
|
|
54
|
+
* `.removeOperation()` will not narrow that selection. The entire path will still be removed.
|
|
55
|
+
*
|
|
56
|
+
* @param path Path containing the operation.
|
|
57
|
+
* @param method HTTP method of the operation to remove.
|
|
58
|
+
*/
|
|
59
|
+
removeOperation(path, method) {
|
|
60
|
+
this.selectOperation(path, method);
|
|
61
|
+
return this;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Remove an OpenAPI operation by its operation ID. IDs are matched exactly. If an operation does
|
|
65
|
+
* not have an authored ID, the generated ID from `Operation.getOperationId()` can be used instead.
|
|
66
|
+
*
|
|
67
|
+
* Operation ID filters are additive with tag, path, operation, and webhook filters.
|
|
68
|
+
*
|
|
69
|
+
* @param operationId Operation ID to remove.
|
|
70
|
+
*/
|
|
71
|
+
removeOperationId(operationId) {
|
|
72
|
+
this.selectOperationId(operationId);
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
removeWebhook(webhookName, method) {
|
|
76
|
+
this.selectWebhook(webhookName, method);
|
|
77
|
+
return this;
|
|
78
|
+
}
|
|
79
|
+
/** Prune the configured tags, paths, operations, operation IDs, and webhooks from the definition. */
|
|
80
|
+
prune() {
|
|
81
|
+
return this.transform();
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
exports.OpenAPIPruner = OpenAPIPruner;
|
|
87
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/erunion/code/readme/oas/packages/oas/dist/pruner/index.cjs","../../src/pruner/index.ts"],"names":[],"mappings":"AAAA;AACE;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B;AACA;ACLO,IAAM,cAAA,EAAN,MAAM,eAAA,QAAsB,qCAAmB;AAAA,EAC5C,WAAA,CAAY,UAAA,EAAyB;AAC3C,IAAA,KAAA,CAAM,UAAA,EAAY;AAAA,MAChB,IAAA,EAAM;AAAA,IACR,CAAC,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,OAAO,IAAA,CAAK,UAAA,EAAwC;AAClD,IAAA,OAAO,IAAI,cAAA,CAAc,UAAU,CAAA;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,SAAA,CAAU,GAAA,EAA4B;AACpC,IAAA,IAAA,CAAK,SAAA,CAAU,GAAG,CAAA;AAClB,IAAA,OAAO,IAAA;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,UAAA,CAAW,IAAA,EAA6B;AACtC,IAAA,IAAA,CAAK,UAAA,CAAW,IAAI,CAAA;AACpB,IAAA,OAAO,IAAA;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,eAAA,CAAgB,IAAA,EAAc,MAAA,EAA+B;AAC3D,IAAA,IAAA,CAAK,eAAA,CAAgB,IAAA,EAAM,MAAM,CAAA;AACjC,IAAA,OAAO,IAAA;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,iBAAA,CAAkB,WAAA,EAAoC;AACpD,IAAA,IAAA,CAAK,iBAAA,CAAkB,WAAW,CAAA;AAClC,IAAA,OAAO,IAAA;AAAA,EACT;AAAA,EAoBA,aAAA,CAAc,WAAA,EAAqB,MAAA,EAAgC;AACjE,IAAA,IAAA,CAAK,aAAA,CAAc,WAAA,EAAa,MAAM,CAAA;AACtC,IAAA,OAAO,IAAA;AAAA,EACT;AAAA;AAAA,EAGA,KAAA,CAAA,EAAqB;AACnB,IAAA,OAAO,IAAA,CAAK,SAAA,CAAU,CAAA;AAAA,EACxB;AACF,CAAA;ADlBA;AACE;AACF,sCAAC","file":"/Users/erunion/code/readme/oas/packages/oas/dist/pruner/index.cjs","sourcesContent":[null,"import type { OASDocument } from '../types.js';\n\nimport { OpenAPITransformer } from '../lib/transformer/index.js';\n\nexport class OpenAPIPruner extends OpenAPITransformer {\n private constructor(definition: OASDocument) {\n super(definition, {\n mode: 'prune',\n });\n }\n\n /**\n * Initialize a new `OpenAPIPruner`. The pruner removes selected tags, paths, operations,\n * operation IDs, and webhooks together with components and tags that are no longer reachable\n * from the remaining operations. Removal filters are additive, so an operation matching any\n * configured filter is removed.\n *\n * @param definition OpenAPI definition to prune.\n */\n static init(definition: OASDocument): OpenAPIPruner {\n return new OpenAPIPruner(definition);\n }\n\n /**\n * Remove every OpenAPI operation containing a tag. Operations without any tags are retained. Tag\n * casing does not matter.\n *\n * When combined with operation ID, path, operation, or webhook removals, the filters remain\n * additive. Any operation matching the tag OR another removal filter will be removed.\n *\n * @param tag Tag whose operations should be removed.\n */\n removeTag(tag: string): OpenAPIPruner {\n this.selectTag(tag);\n return this;\n }\n\n /**\n * Remove an entire OpenAPI path and all operations that it contains. Path casing does not matter.\n *\n * @param path Path to remove.\n */\n removePath(path: string): OpenAPIPruner {\n this.selectPath(path);\n return this;\n }\n\n /**\n * Remove a single OpenAPI operation. Path and method casing does not matter.\n *\n * If you previously called `.removePath()` to remove the entire path, calling\n * `.removeOperation()` will not narrow that selection. The entire path will still be removed.\n *\n * @param path Path containing the operation.\n * @param method HTTP method of the operation to remove.\n */\n removeOperation(path: string, method: string): OpenAPIPruner {\n this.selectOperation(path, method);\n return this;\n }\n\n /**\n * Remove an OpenAPI operation by its operation ID. IDs are matched exactly. If an operation does\n * not have an authored ID, the generated ID from `Operation.getOperationId()` can be used instead.\n *\n * Operation ID filters are additive with tag, path, operation, and webhook filters.\n *\n * @param operationId Operation ID to remove.\n */\n removeOperationId(operationId: string): OpenAPIPruner {\n this.selectOperationId(operationId);\n return this;\n }\n\n /**\n * Remove an OpenAPI webhook and all operations that it contains. Webhook casing does not matter.\n *\n * @param webhookName Webhook to remove.\n */\n removeWebhook(webhookName: string): OpenAPIPruner;\n\n /**\n * Remove a single OpenAPI webhook operation. Webhook and method casing does not matter.\n *\n * If you previously called `.removeWebhook()` to remove the entire webhook, calling it again\n * with a method will not narrow that selection. The entire webhook will still be removed.\n *\n * @param webhookName Webhook containing the operation.\n * @param method HTTP method of the operation to remove.\n */\n removeWebhook(webhookName: string, method: string): OpenAPIPruner;\n\n removeWebhook(webhookName: string, method?: string): OpenAPIPruner {\n this.selectWebhook(webhookName, method);\n return this;\n }\n\n /** Prune the configured tags, paths, operations, operation IDs, and webhooks from the definition. */\n prune(): OASDocument {\n return this.transform();\n }\n}\n"]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { OASDocument } from '../types.cjs';
|
|
2
|
+
import { O as OpenAPITransformer } from '../index-Borb1VXh.cjs';
|
|
3
|
+
import 'json-schema';
|
|
4
|
+
import 'openapi-types';
|
|
5
|
+
|
|
6
|
+
declare class OpenAPIPruner extends OpenAPITransformer {
|
|
7
|
+
private constructor();
|
|
8
|
+
/**
|
|
9
|
+
* Initialize a new `OpenAPIPruner`. The pruner removes selected tags, paths, operations,
|
|
10
|
+
* operation IDs, and webhooks together with components and tags that are no longer reachable
|
|
11
|
+
* from the remaining operations. Removal filters are additive, so an operation matching any
|
|
12
|
+
* configured filter is removed.
|
|
13
|
+
*
|
|
14
|
+
* @param definition OpenAPI definition to prune.
|
|
15
|
+
*/
|
|
16
|
+
static init(definition: OASDocument): OpenAPIPruner;
|
|
17
|
+
/**
|
|
18
|
+
* Remove every OpenAPI operation containing a tag. Operations without any tags are retained. Tag
|
|
19
|
+
* casing does not matter.
|
|
20
|
+
*
|
|
21
|
+
* When combined with operation ID, path, operation, or webhook removals, the filters remain
|
|
22
|
+
* additive. Any operation matching the tag OR another removal filter will be removed.
|
|
23
|
+
*
|
|
24
|
+
* @param tag Tag whose operations should be removed.
|
|
25
|
+
*/
|
|
26
|
+
removeTag(tag: string): OpenAPIPruner;
|
|
27
|
+
/**
|
|
28
|
+
* Remove an entire OpenAPI path and all operations that it contains. Path casing does not matter.
|
|
29
|
+
*
|
|
30
|
+
* @param path Path to remove.
|
|
31
|
+
*/
|
|
32
|
+
removePath(path: string): OpenAPIPruner;
|
|
33
|
+
/**
|
|
34
|
+
* Remove a single OpenAPI operation. Path and method casing does not matter.
|
|
35
|
+
*
|
|
36
|
+
* If you previously called `.removePath()` to remove the entire path, calling
|
|
37
|
+
* `.removeOperation()` will not narrow that selection. The entire path will still be removed.
|
|
38
|
+
*
|
|
39
|
+
* @param path Path containing the operation.
|
|
40
|
+
* @param method HTTP method of the operation to remove.
|
|
41
|
+
*/
|
|
42
|
+
removeOperation(path: string, method: string): OpenAPIPruner;
|
|
43
|
+
/**
|
|
44
|
+
* Remove an OpenAPI operation by its operation ID. IDs are matched exactly. If an operation does
|
|
45
|
+
* not have an authored ID, the generated ID from `Operation.getOperationId()` can be used instead.
|
|
46
|
+
*
|
|
47
|
+
* Operation ID filters are additive with tag, path, operation, and webhook filters.
|
|
48
|
+
*
|
|
49
|
+
* @param operationId Operation ID to remove.
|
|
50
|
+
*/
|
|
51
|
+
removeOperationId(operationId: string): OpenAPIPruner;
|
|
52
|
+
/**
|
|
53
|
+
* Remove an OpenAPI webhook and all operations that it contains. Webhook casing does not matter.
|
|
54
|
+
*
|
|
55
|
+
* @param webhookName Webhook to remove.
|
|
56
|
+
*/
|
|
57
|
+
removeWebhook(webhookName: string): OpenAPIPruner;
|
|
58
|
+
/**
|
|
59
|
+
* Remove a single OpenAPI webhook operation. Webhook and method casing does not matter.
|
|
60
|
+
*
|
|
61
|
+
* If you previously called `.removeWebhook()` to remove the entire webhook, calling it again
|
|
62
|
+
* with a method will not narrow that selection. The entire webhook will still be removed.
|
|
63
|
+
*
|
|
64
|
+
* @param webhookName Webhook containing the operation.
|
|
65
|
+
* @param method HTTP method of the operation to remove.
|
|
66
|
+
*/
|
|
67
|
+
removeWebhook(webhookName: string, method: string): OpenAPIPruner;
|
|
68
|
+
/** Prune the configured tags, paths, operations, operation IDs, and webhooks from the definition. */
|
|
69
|
+
prune(): OASDocument;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export { OpenAPIPruner };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { OASDocument } from '../types.js';
|
|
2
|
+
import { O as OpenAPITransformer } from '../index-Br-eJMCh.js';
|
|
3
|
+
import 'json-schema';
|
|
4
|
+
import 'openapi-types';
|
|
5
|
+
|
|
6
|
+
declare class OpenAPIPruner extends OpenAPITransformer {
|
|
7
|
+
private constructor();
|
|
8
|
+
/**
|
|
9
|
+
* Initialize a new `OpenAPIPruner`. The pruner removes selected tags, paths, operations,
|
|
10
|
+
* operation IDs, and webhooks together with components and tags that are no longer reachable
|
|
11
|
+
* from the remaining operations. Removal filters are additive, so an operation matching any
|
|
12
|
+
* configured filter is removed.
|
|
13
|
+
*
|
|
14
|
+
* @param definition OpenAPI definition to prune.
|
|
15
|
+
*/
|
|
16
|
+
static init(definition: OASDocument): OpenAPIPruner;
|
|
17
|
+
/**
|
|
18
|
+
* Remove every OpenAPI operation containing a tag. Operations without any tags are retained. Tag
|
|
19
|
+
* casing does not matter.
|
|
20
|
+
*
|
|
21
|
+
* When combined with operation ID, path, operation, or webhook removals, the filters remain
|
|
22
|
+
* additive. Any operation matching the tag OR another removal filter will be removed.
|
|
23
|
+
*
|
|
24
|
+
* @param tag Tag whose operations should be removed.
|
|
25
|
+
*/
|
|
26
|
+
removeTag(tag: string): OpenAPIPruner;
|
|
27
|
+
/**
|
|
28
|
+
* Remove an entire OpenAPI path and all operations that it contains. Path casing does not matter.
|
|
29
|
+
*
|
|
30
|
+
* @param path Path to remove.
|
|
31
|
+
*/
|
|
32
|
+
removePath(path: string): OpenAPIPruner;
|
|
33
|
+
/**
|
|
34
|
+
* Remove a single OpenAPI operation. Path and method casing does not matter.
|
|
35
|
+
*
|
|
36
|
+
* If you previously called `.removePath()` to remove the entire path, calling
|
|
37
|
+
* `.removeOperation()` will not narrow that selection. The entire path will still be removed.
|
|
38
|
+
*
|
|
39
|
+
* @param path Path containing the operation.
|
|
40
|
+
* @param method HTTP method of the operation to remove.
|
|
41
|
+
*/
|
|
42
|
+
removeOperation(path: string, method: string): OpenAPIPruner;
|
|
43
|
+
/**
|
|
44
|
+
* Remove an OpenAPI operation by its operation ID. IDs are matched exactly. If an operation does
|
|
45
|
+
* not have an authored ID, the generated ID from `Operation.getOperationId()` can be used instead.
|
|
46
|
+
*
|
|
47
|
+
* Operation ID filters are additive with tag, path, operation, and webhook filters.
|
|
48
|
+
*
|
|
49
|
+
* @param operationId Operation ID to remove.
|
|
50
|
+
*/
|
|
51
|
+
removeOperationId(operationId: string): OpenAPIPruner;
|
|
52
|
+
/**
|
|
53
|
+
* Remove an OpenAPI webhook and all operations that it contains. Webhook casing does not matter.
|
|
54
|
+
*
|
|
55
|
+
* @param webhookName Webhook to remove.
|
|
56
|
+
*/
|
|
57
|
+
removeWebhook(webhookName: string): OpenAPIPruner;
|
|
58
|
+
/**
|
|
59
|
+
* Remove a single OpenAPI webhook operation. Webhook and method casing does not matter.
|
|
60
|
+
*
|
|
61
|
+
* If you previously called `.removeWebhook()` to remove the entire webhook, calling it again
|
|
62
|
+
* with a method will not narrow that selection. The entire webhook will still be removed.
|
|
63
|
+
*
|
|
64
|
+
* @param webhookName Webhook containing the operation.
|
|
65
|
+
* @param method HTTP method of the operation to remove.
|
|
66
|
+
*/
|
|
67
|
+
removeWebhook(webhookName: string, method: string): OpenAPIPruner;
|
|
68
|
+
/** Prune the configured tags, paths, operations, operation IDs, and webhooks from the definition. */
|
|
69
|
+
prune(): OASDocument;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export { OpenAPIPruner };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OpenAPITransformer
|
|
3
|
+
} from "../chunk-4CWJNFV5.js";
|
|
4
|
+
import "../chunk-QTPMJRIE.js";
|
|
5
|
+
import "../chunk-5ZBXVQYR.js";
|
|
6
|
+
import "../chunk-ANZIKNVX.js";
|
|
7
|
+
import "../chunk-LZNTJ4ZR.js";
|
|
8
|
+
import "../chunk-XG4HGNCN.js";
|
|
9
|
+
|
|
10
|
+
// src/pruner/index.ts
|
|
11
|
+
var OpenAPIPruner = class _OpenAPIPruner extends OpenAPITransformer {
|
|
12
|
+
constructor(definition) {
|
|
13
|
+
super(definition, {
|
|
14
|
+
mode: "prune"
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Initialize a new `OpenAPIPruner`. The pruner removes selected tags, paths, operations,
|
|
19
|
+
* operation IDs, and webhooks together with components and tags that are no longer reachable
|
|
20
|
+
* from the remaining operations. Removal filters are additive, so an operation matching any
|
|
21
|
+
* configured filter is removed.
|
|
22
|
+
*
|
|
23
|
+
* @param definition OpenAPI definition to prune.
|
|
24
|
+
*/
|
|
25
|
+
static init(definition) {
|
|
26
|
+
return new _OpenAPIPruner(definition);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Remove every OpenAPI operation containing a tag. Operations without any tags are retained. Tag
|
|
30
|
+
* casing does not matter.
|
|
31
|
+
*
|
|
32
|
+
* When combined with operation ID, path, operation, or webhook removals, the filters remain
|
|
33
|
+
* additive. Any operation matching the tag OR another removal filter will be removed.
|
|
34
|
+
*
|
|
35
|
+
* @param tag Tag whose operations should be removed.
|
|
36
|
+
*/
|
|
37
|
+
removeTag(tag) {
|
|
38
|
+
this.selectTag(tag);
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Remove an entire OpenAPI path and all operations that it contains. Path casing does not matter.
|
|
43
|
+
*
|
|
44
|
+
* @param path Path to remove.
|
|
45
|
+
*/
|
|
46
|
+
removePath(path) {
|
|
47
|
+
this.selectPath(path);
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Remove a single OpenAPI operation. Path and method casing does not matter.
|
|
52
|
+
*
|
|
53
|
+
* If you previously called `.removePath()` to remove the entire path, calling
|
|
54
|
+
* `.removeOperation()` will not narrow that selection. The entire path will still be removed.
|
|
55
|
+
*
|
|
56
|
+
* @param path Path containing the operation.
|
|
57
|
+
* @param method HTTP method of the operation to remove.
|
|
58
|
+
*/
|
|
59
|
+
removeOperation(path, method) {
|
|
60
|
+
this.selectOperation(path, method);
|
|
61
|
+
return this;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Remove an OpenAPI operation by its operation ID. IDs are matched exactly. If an operation does
|
|
65
|
+
* not have an authored ID, the generated ID from `Operation.getOperationId()` can be used instead.
|
|
66
|
+
*
|
|
67
|
+
* Operation ID filters are additive with tag, path, operation, and webhook filters.
|
|
68
|
+
*
|
|
69
|
+
* @param operationId Operation ID to remove.
|
|
70
|
+
*/
|
|
71
|
+
removeOperationId(operationId) {
|
|
72
|
+
this.selectOperationId(operationId);
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
removeWebhook(webhookName, method) {
|
|
76
|
+
this.selectWebhook(webhookName, method);
|
|
77
|
+
return this;
|
|
78
|
+
}
|
|
79
|
+
/** Prune the configured tags, paths, operations, operation IDs, and webhooks from the definition. */
|
|
80
|
+
prune() {
|
|
81
|
+
return this.transform();
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
export {
|
|
85
|
+
OpenAPIPruner
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/pruner/index.ts"],"sourcesContent":["import type { OASDocument } from '../types.js';\n\nimport { OpenAPITransformer } from '../lib/transformer/index.js';\n\nexport class OpenAPIPruner extends OpenAPITransformer {\n private constructor(definition: OASDocument) {\n super(definition, {\n mode: 'prune',\n });\n }\n\n /**\n * Initialize a new `OpenAPIPruner`. The pruner removes selected tags, paths, operations,\n * operation IDs, and webhooks together with components and tags that are no longer reachable\n * from the remaining operations. Removal filters are additive, so an operation matching any\n * configured filter is removed.\n *\n * @param definition OpenAPI definition to prune.\n */\n static init(definition: OASDocument): OpenAPIPruner {\n return new OpenAPIPruner(definition);\n }\n\n /**\n * Remove every OpenAPI operation containing a tag. Operations without any tags are retained. Tag\n * casing does not matter.\n *\n * When combined with operation ID, path, operation, or webhook removals, the filters remain\n * additive. Any operation matching the tag OR another removal filter will be removed.\n *\n * @param tag Tag whose operations should be removed.\n */\n removeTag(tag: string): OpenAPIPruner {\n this.selectTag(tag);\n return this;\n }\n\n /**\n * Remove an entire OpenAPI path and all operations that it contains. Path casing does not matter.\n *\n * @param path Path to remove.\n */\n removePath(path: string): OpenAPIPruner {\n this.selectPath(path);\n return this;\n }\n\n /**\n * Remove a single OpenAPI operation. Path and method casing does not matter.\n *\n * If you previously called `.removePath()` to remove the entire path, calling\n * `.removeOperation()` will not narrow that selection. The entire path will still be removed.\n *\n * @param path Path containing the operation.\n * @param method HTTP method of the operation to remove.\n */\n removeOperation(path: string, method: string): OpenAPIPruner {\n this.selectOperation(path, method);\n return this;\n }\n\n /**\n * Remove an OpenAPI operation by its operation ID. IDs are matched exactly. If an operation does\n * not have an authored ID, the generated ID from `Operation.getOperationId()` can be used instead.\n *\n * Operation ID filters are additive with tag, path, operation, and webhook filters.\n *\n * @param operationId Operation ID to remove.\n */\n removeOperationId(operationId: string): OpenAPIPruner {\n this.selectOperationId(operationId);\n return this;\n }\n\n /**\n * Remove an OpenAPI webhook and all operations that it contains. Webhook casing does not matter.\n *\n * @param webhookName Webhook to remove.\n */\n removeWebhook(webhookName: string): OpenAPIPruner;\n\n /**\n * Remove a single OpenAPI webhook operation. Webhook and method casing does not matter.\n *\n * If you previously called `.removeWebhook()` to remove the entire webhook, calling it again\n * with a method will not narrow that selection. The entire webhook will still be removed.\n *\n * @param webhookName Webhook containing the operation.\n * @param method HTTP method of the operation to remove.\n */\n removeWebhook(webhookName: string, method: string): OpenAPIPruner;\n\n removeWebhook(webhookName: string, method?: string): OpenAPIPruner {\n this.selectWebhook(webhookName, method);\n return this;\n }\n\n /** Prune the configured tags, paths, operations, operation IDs, and webhooks from the definition. */\n prune(): OASDocument {\n return this.transform();\n }\n}\n"],"mappings":";;;;;;;;;;AAIO,IAAM,gBAAN,MAAM,uBAAsB,mBAAmB;AAAA,EAC5C,YAAY,YAAyB;AAC3C,UAAM,YAAY;AAAA,MAChB,MAAM;AAAA,IACR,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,OAAO,KAAK,YAAwC;AAClD,WAAO,IAAI,eAAc,UAAU;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,UAAU,KAA4B;AACpC,SAAK,UAAU,GAAG;AAClB,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,WAAW,MAA6B;AACtC,SAAK,WAAW,IAAI;AACpB,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,gBAAgB,MAAc,QAA+B;AAC3D,SAAK,gBAAgB,MAAM,MAAM;AACjC,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,kBAAkB,aAAoC;AACpD,SAAK,kBAAkB,WAAW;AAClC,WAAO;AAAA,EACT;AAAA,EAoBA,cAAc,aAAqB,QAAgC;AACjE,SAAK,cAAc,aAAa,MAAM;AACtC,WAAO;AAAA,EACT;AAAA;AAAA,EAGA,QAAqB;AACnB,WAAO,KAAK,UAAU;AAAA,EACxB;AACF;","names":[]}
|