@openapi-qraft/plugin 2.0.0-next.9 → 2.0.1-beta.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/CHANGELOG.md +111 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/QraftCommand.d.ts +2 -2
- package/dist/lib/QraftCommand.d.ts.map +1 -1
- package/dist/lib/QraftCommand.js +13 -6
- package/dist/lib/QraftCommand.js.map +1 -1
- package/dist/lib/open-api/OpenAPISchemaType.d.ts +3 -0
- package/dist/lib/open-api/OpenAPISchemaType.d.ts.map +1 -1
- package/dist/lib/open-api/OpenAPIService.d.ts +29 -0
- package/dist/lib/open-api/OpenAPIService.d.ts.map +1 -0
- package/dist/lib/open-api/OpenAPIService.js +2 -0
- package/dist/lib/open-api/OpenAPIService.js.map +1 -0
- package/dist/lib/open-api/getOperationName.d.ts +4 -1
- package/dist/lib/open-api/getOperationName.d.ts.map +1 -1
- package/dist/lib/open-api/getOperationName.js +19 -7
- package/dist/lib/open-api/getOperationName.js.map +1 -1
- package/dist/lib/open-api/getServices.d.ts +9 -30
- package/dist/lib/open-api/getServices.d.ts.map +1 -1
- package/dist/lib/open-api/getServices.js +7 -8
- package/dist/lib/open-api/getServices.js.map +1 -1
- package/dist/lib/open-api/replaceRefParametersWithComponent.d.ts +5 -0
- package/dist/lib/open-api/replaceRefParametersWithComponent.d.ts.map +1 -0
- package/dist/lib/open-api/replaceRefParametersWithComponent.js +26 -0
- package/dist/lib/open-api/replaceRefParametersWithComponent.js.map +1 -0
- package/dist/lib/parseOperationGlobs.d.ts +2 -2
- package/dist/lib/parseOperationGlobs.d.ts.map +1 -1
- package/dist/lib/predefineSchemaParameters.d.ts +0 -1
- package/dist/lib/predefineSchemaParameters.d.ts.map +1 -1
- package/dist/lib/predefineSchemaParameters.js +9 -13
- package/dist/lib/predefineSchemaParameters.js.map +1 -1
- package/dist/lib/processOperationNameModifierOption.d.ts +9 -5
- package/dist/lib/processOperationNameModifierOption.d.ts.map +1 -1
- package/dist/lib/processOperationNameModifierOption.js +23 -4
- package/dist/lib/processOperationNameModifierOption.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/package.json +12 -3
- package/src/index.ts +1 -0
- package/src/lib/QraftCommand.ts +32 -21
- package/src/lib/open-api/OpenAPISchemaType.ts +3 -0
- package/src/lib/open-api/OpenAPIService.ts +40 -0
- package/src/lib/open-api/getOperationName.ts +34 -7
- package/src/lib/open-api/getServices.ts +26 -49
- package/src/lib/open-api/replaceRefParametersWithComponent.ts +40 -0
- package/src/lib/parseOperationGlobs.ts +1 -1
- package/src/lib/predefineSchemaParameters.ts +12 -19
- package/src/lib/processOperationNameModifierOption.ts +45 -15
- package/src/packageVersion.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,116 @@
|
|
|
1
1
|
# @openapi-qraft/plugin
|
|
2
2
|
|
|
3
|
+
## 2.0.1-beta.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- def57df: Ensure external libraries are declared in `peerDependencies` to prevent conflicts and duplication.
|
|
8
|
+
|
|
9
|
+
## 2.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- 8c77eb2: Generate comprehensive operation names with consideration of the `--service-name-base` option. Operation names now
|
|
14
|
+
include all path parts and parameters, and the structure can be customized based on the `--service-name-base` value.
|
|
15
|
+
|
|
16
|
+
**Breaking Changes:**
|
|
17
|
+
|
|
18
|
+
- Operation names now include all path parts and parameters by default.
|
|
19
|
+
- `/api/v{api-version}` is no longer automatically removed from the path when generating operation names.
|
|
20
|
+
- The `--service-name-base` option now influences the generated operation names with a new structure.
|
|
21
|
+
|
|
22
|
+
**Examples:**
|
|
23
|
+
|
|
24
|
+
- With `--service-name-base=endpoint[0]`:
|
|
25
|
+
`POST /v1/users/{id}` → `api.v1.postUsersId`
|
|
26
|
+
- With `--service-name-base=endpoint[1]`:
|
|
27
|
+
`GET /v1/users/{id}` → `api.users.getId`
|
|
28
|
+
- With `--service-name-base=endpoint[1]`:
|
|
29
|
+
`POST /v1/users/suspend` → `api.users.postSuspend`
|
|
30
|
+
- With `--service-name-base=endpoint[1]`:
|
|
31
|
+
`POST /v1/users/{id}/{key}` → `api.postIdKey`
|
|
32
|
+
- With `--service-name-base=tags`:
|
|
33
|
+
`POST /v1/users/{id}/{key}` → `api.<tag>.postV1UsersIdKey`
|
|
34
|
+
|
|
35
|
+
This change provides more flexibility in operation name generation and allows for better customization based on project
|
|
36
|
+
requirements.
|
|
37
|
+
|
|
38
|
+
### Minor Changes
|
|
39
|
+
|
|
40
|
+
- 2a53608: Updated TypeScript to version 5.5.4
|
|
41
|
+
- 76634bf: ### Changeset: `createPredefinedParametersRequestFn`
|
|
42
|
+
|
|
43
|
+
Introduced `createPredefinedParametersRequestFn`, generated by the `@openapi-qraft/cli` using
|
|
44
|
+
the `--operation-predefined-parameters` option.
|
|
45
|
+
This function allows for the automatic application of predefined
|
|
46
|
+
parameters to selected API operations by wrapping the base `requestFn`. It simplifies managing parameters, reducing
|
|
47
|
+
boilerplate code, and supports both static and dynamic values, enhancing flexibility in API request handling.
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- 16b380f: Added validation for unused `--operation-name-modifier` options in the plugin. An explicit error is now thrown if a modifier is specified but does not match any paths or operations during code generation, ensuring all provided modifiers are purposeful and correctly configured.
|
|
52
|
+
- c111be6: Added support for operation parameters referencing `$ref` from OpenAPI `components/parameters`.
|
|
53
|
+
- 62ff8e0: Refactor `Service` and `ServiceOperation` types.
|
|
54
|
+
|
|
55
|
+
## 2.0.0-next.19
|
|
56
|
+
|
|
57
|
+
### Patch Changes
|
|
58
|
+
|
|
59
|
+
- 62ff8e0: Refactor `Service` and `ServiceOperation` types.
|
|
60
|
+
|
|
61
|
+
## 2.0.0-next.18
|
|
62
|
+
|
|
63
|
+
## 2.0.0-next.17
|
|
64
|
+
|
|
65
|
+
### Patch Changes
|
|
66
|
+
|
|
67
|
+
- 16b380f: Added validation for unused `--operation-name-modifier` options in the plugin. An explicit error is now thrown if a modifier is specified but does not match any paths or operations during code generation, ensuring all provided modifiers are purposeful and correctly configured.
|
|
68
|
+
|
|
69
|
+
## 2.0.0-next.16
|
|
70
|
+
|
|
71
|
+
## 2.0.0-next.15
|
|
72
|
+
|
|
73
|
+
## 2.0.0-next.14
|
|
74
|
+
|
|
75
|
+
## 2.0.0-next.13
|
|
76
|
+
|
|
77
|
+
### Patch Changes
|
|
78
|
+
|
|
79
|
+
- c111be6: Added support for operation parameters referencing `$ref` from OpenAPI `components/parameters`.
|
|
80
|
+
|
|
81
|
+
## 2.0.0-next.12
|
|
82
|
+
|
|
83
|
+
## 2.0.0-next.11
|
|
84
|
+
|
|
85
|
+
## 2.0.0-next.10
|
|
86
|
+
|
|
87
|
+
### Major Changes
|
|
88
|
+
|
|
89
|
+
- 8c77eb2: Generate comprehensive operation names with consideration of the `--service-name-base` option. Operation names now
|
|
90
|
+
include all path parts and parameters, and the structure can be customized based on the `--service-name-base` value.
|
|
91
|
+
|
|
92
|
+
**Breaking Changes:**
|
|
93
|
+
|
|
94
|
+
- Operation names now include all path parts and parameters by default.
|
|
95
|
+
- `/api/v{api-version}` is no longer automatically removed from the path when generating operation names.
|
|
96
|
+
- The `--service-name-base` option now influences the generated operation names with a new structure.
|
|
97
|
+
|
|
98
|
+
**Examples:**
|
|
99
|
+
|
|
100
|
+
- With `--service-name-base=endpoint[0]`:
|
|
101
|
+
`POST /v1/users/{id}` → `api.v1.postUsersId`
|
|
102
|
+
- With `--service-name-base=endpoint[1]`:
|
|
103
|
+
`GET /v1/users/{id}` → `api.users.getId`
|
|
104
|
+
- With `--service-name-base=endpoint[1]`:
|
|
105
|
+
`POST /v1/users/suspend` → `api.users.postSuspend`
|
|
106
|
+
- With `--service-name-base=endpoint[1]`:
|
|
107
|
+
`POST /v1/users/{id}/{key}` → `api.postIdKey`
|
|
108
|
+
- With `--service-name-base=tags`:
|
|
109
|
+
`POST /v1/users/{id}/{key}` → `api.<tag>.postV1UsersIdKey`
|
|
110
|
+
|
|
111
|
+
This change provides more flexibility in operation name generation and allows for better customization based on project
|
|
112
|
+
requirements.
|
|
113
|
+
|
|
3
114
|
## 2.0.0-next.9
|
|
4
115
|
|
|
5
116
|
## 2.0.0-next.8
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,6BAA6B,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Option } from 'commander';
|
|
2
|
-
import type { Service } from './open-api/getServices.js';
|
|
3
2
|
import { URL } from 'node:url';
|
|
4
3
|
import { Command } from 'commander';
|
|
5
4
|
import { Ora } from 'ora';
|
|
6
5
|
import { GeneratorFile } from './GeneratorFile.js';
|
|
7
6
|
import { OpenAPISchemaType } from './open-api/OpenAPISchemaType.js';
|
|
7
|
+
import { OpenAPIService } from './open-api/OpenAPIService.js';
|
|
8
8
|
import { OutputOptions } from './OutputOptions.js';
|
|
9
9
|
export declare class QraftCommand extends Command {
|
|
10
10
|
protected readonly cwd: URL;
|
|
@@ -42,7 +42,7 @@ export type QraftCommandActionCallback = (options: {
|
|
|
42
42
|
/**
|
|
43
43
|
* OpenAPI services
|
|
44
44
|
*/
|
|
45
|
-
services:
|
|
45
|
+
services: OpenAPIService[];
|
|
46
46
|
/**
|
|
47
47
|
* OpenAPI schema
|
|
48
48
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QraftCommand.d.ts","sourceRoot":"","sources":["../../src/lib/QraftCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"QraftCommand.d.ts","sourceRoot":"","sources":["../../src/lib/QraftCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGxC,OAAO,EAAiB,GAAG,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAG/B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAanD,qBAAa,YAAa,SAAQ,OAAO;IACvC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G,MAAM,EAAE,GACzC,IAAI;IA8BP,SAAS,CAAC,iBAAiB,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAE;CAe1E;AAWD,MAAM,MAAM,0BAA0B,GAAG,CACvC,OAAO,EAAE;IACP;;OAEG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B;;OAEG;IACH,OAAO,EAAE,GAAG,CAAC;IACb;;OAEG;IACH,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B;;OAEG;IACH,MAAM,EAAE,iBAAiB,CAAC;IAC1B;;OAEG;IACH,MAAM,EAAE,aAAa,CAAC;CACvB,EACD,OAAO,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,IAAI,KACtC,OAAO,CAAC,IAAI,CAAC,CAAC;AAmFnB;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM;;;EAoB7C"}
|
package/dist/lib/QraftCommand.js
CHANGED
|
@@ -69,12 +69,19 @@ export class QraftCommand extends Command {
|
|
|
69
69
|
: [args.operationNameModifier])), services);
|
|
70
70
|
if (operationNameModifierErrors.length) {
|
|
71
71
|
operationNameModifierErrors.forEach((error) => {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
.
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
if (error.type === 'conflictingOperationNameModifier') {
|
|
73
|
+
spinner.fail([
|
|
74
|
+
c.red.bold(`Error occurred during operation name modifier setup: '${error.serviceName}.${error.originalOperationName}' to '${error.replacedOperationName}'`),
|
|
75
|
+
c.yellow(error.modifiers
|
|
76
|
+
.map(({ pathGlobs, operationNameModifierRegex, operationNameModifierReplace, }) => `Conflicting operation name modifier: '${pathGlobs}': '${operationNameModifierRegex}' => '${operationNameModifierReplace}'`)
|
|
77
|
+
.join('\n')),
|
|
78
|
+
].join('\n'));
|
|
79
|
+
}
|
|
80
|
+
else if (error.type === 'unusedOperationNameModifier') {
|
|
81
|
+
spinner.fail([
|
|
82
|
+
c.yellow.bold(`Unused operation name modifier: '${error.modifier.pathGlobs}': '${error.modifier.operationNameModifierRegex}' => '${error.modifier.operationNameModifierReplace}'`),
|
|
83
|
+
].join('\n'));
|
|
84
|
+
}
|
|
78
85
|
});
|
|
79
86
|
process.exit(1);
|
|
80
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QraftCommand.js","sourceRoot":"","sources":["../../src/lib/QraftCommand.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"QraftCommand.js","sourceRoot":"","sources":["../../src/lib/QraftCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,aAAa,EAAO,MAAM,UAAU,CAAC;AAC9C,OAAO,CAAC,MAAM,aAAa,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,GAAY,MAAM,KAAK,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EACL,+BAA+B,EAC/B,wCAAwC,EACxC,yBAAyB,GAC1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,0BAA0B,EAC1B,kCAAkC,GACnC,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,mB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,CAAC;KACjB,CAAC;IACF,KAAK,EAAE;QACL,CAAC,IAAI,EAAE,MAAM,GAAG;YACd,CAAC,MAAM,EAAE,MAAM,GAAG;gBAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;gBAChB,WAAW,CAAC,EAAE,MAAM,CAAC;gBACrB,OAAO,CAAC,EAAE,MAAM,CAAC;gBACjB,WAAW,CAAC,EAAE,MAAM,CAAC;gBACrB,UAAU,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;gBACxB,UAAU,CAAC,EAAE,OAAO,CAAC;gBACrB,WAAW,CAAC,EAAE;oBACZ,OAAO,EAAE;wBACP,CAAC,WAAW,EAAE,MAAM,GAAG;4BACrB,MAAM,EAAE,GAAG,CAAC;yBACb,CAAC;qBACH,CAAC;iBACH,CAAC;gBACF,SAAS,EAAE;qBACR,UAAU,IAAI,MAAM,GAAG,SAAS,GAAG;wBAClC,WAAW,EAAE,MAAM,CAAC;wBACpB,OAAO,EAAE;4BACP,CAAC,WAAW,EAAE,MAAM,GAAG;gCACrB,MAAM,EAAE,GAAG,CAAC;6BACb,CAAC;yBACH,CAAC;qBACH;iBACF,CAAC;gBACF,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC;aACxD,CAAC;SACH,CAAC;KACH,CAAC;CACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"OpenAPISchemaType.d.ts","sourceRoot":"","sources":["../../../src/lib/open-api/OpenAPISchemaType.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,KAAK,EAAE;QACL,CAAC,IAAI,EAAE,MAAM,GAAG;YACd,CAAC,MAAM,EAAE,MAAM,GAAG;gBAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;gBAChB,WAAW,CAAC,EAAE,MAAM,CAAC;gBACrB,OAAO,CAAC,EAAE,MAAM,CAAC;gBACjB,WAAW,CAAC,EAAE,MAAM,CAAC;gBACrB,UAAU,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;gBACxB,UAAU,CAAC,EAAE,OAAO,CAAC;gBACrB,WAAW,CAAC,EAAE;oBACZ,OAAO,EAAE;wBACP,CAAC,WAAW,EAAE,MAAM,GAAG;4BACrB,MAAM,EAAE,GAAG,CAAC;yBACb,CAAC;qBACH,CAAC;iBACH,CAAC;gBACF,SAAS,EAAE;qBACR,UAAU,IAAI,MAAM,GAAG,SAAS,GAAG;wBAClC,WAAW,EAAE,MAAM,CAAC;wBACpB,OAAO,EAAE;4BACP,CAAC,WAAW,EAAE,MAAM,GAAG;gCACrB,MAAM,EAAE,GAAG,CAAC;6BACb,CAAC;yBACH,CAAC;qBACH;iBACF,CAAC;gBACF,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC;aACxD,CAAC;SACH,CAAC;KACH,CAAC;IACF,UAAU,EAAE;QACV,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;KAC7C,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { OpenAPISchemaType } from './OpenAPISchemaType.js';
|
|
2
|
+
export type OpenAPIService = {
|
|
3
|
+
name: string;
|
|
4
|
+
variableName: string;
|
|
5
|
+
typeName: string;
|
|
6
|
+
fileBaseName: string;
|
|
7
|
+
operations: ServiceOperation[];
|
|
8
|
+
};
|
|
9
|
+
export type ServiceOperation = {
|
|
10
|
+
method: 'get' | 'put' | 'post' | 'patch' | 'delete' | 'options' | 'head' | 'trace';
|
|
11
|
+
path: string;
|
|
12
|
+
name: string;
|
|
13
|
+
description: string | undefined;
|
|
14
|
+
summary: string | undefined;
|
|
15
|
+
deprecated: boolean | undefined;
|
|
16
|
+
errors: Record<string, string | undefined>;
|
|
17
|
+
requestBody: OpenAPISchemaType['paths'][string]['post']['requestBody'];
|
|
18
|
+
success: Record<string, string | undefined>;
|
|
19
|
+
parameters: {
|
|
20
|
+
name: string;
|
|
21
|
+
in: 'header' | 'query' | 'cookie';
|
|
22
|
+
description: string;
|
|
23
|
+
required: boolean;
|
|
24
|
+
schema: any;
|
|
25
|
+
example: string | undefined;
|
|
26
|
+
}[] | undefined;
|
|
27
|
+
security: Array<Record<string, string[] | undefined>> | undefined;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=OpenAPIService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenAPIService.d.ts","sourceRoot":"","sources":["../../../src/lib/open-api/OpenAPIService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,gBAAgB,EAAE,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EACF,KAAK,GACL,KAAK,GACL,MAAM,GACN,OAAO,GACP,QAAQ,GACR,SAAS,GACT,MAAM,GACN,OAAO,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,UAAU,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAC3C,WAAW,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC;IACvE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAC5C,UAAU,EACN;QACE,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;QAClC,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,OAAO,CAAC;QAClB,MAAM,EAAE,GAAG,CAAC;QACZ,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;KAC7B,EAAE,GACH,SAAS,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,GAAG,SAAS,CAAC;CACnE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenAPIService.js","sourceRoot":"","sources":["../../../src/lib/open-api/OpenAPIService.ts"],"names":[],"mappings":""}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import type { ServiceBaseNameByEndpointOption } from './getServiceNamesByOperationEndpoint.js';
|
|
2
|
+
import type { ServiceBaseName } from './getServices.js';
|
|
1
3
|
/**
|
|
2
4
|
* Convert the input value to a correct operation (method) classname.
|
|
3
5
|
* This will use the operation ID - if available - and otherwise fallback
|
|
4
6
|
* on a generated name from the URL
|
|
5
7
|
*/
|
|
6
|
-
export declare const getOperationName: (url: string, method: string, operationId: string | undefined) => string;
|
|
8
|
+
export declare const getOperationName: (url: string, method: string, operationId: string | undefined, serviceNameBase: ServiceBaseName) => string;
|
|
7
9
|
export declare const getOperationIdName: (operationId: string) => string;
|
|
10
|
+
export declare const reduceUrlByEndpointPartIndex: (url: string, serviceNameBase: ServiceBaseNameByEndpointOption) => string;
|
|
8
11
|
//# sourceMappingURL=getOperationName.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOperationName.d.ts","sourceRoot":"","sources":["../../../src/lib/open-api/getOperationName.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getOperationName.d.ts","sourceRoot":"","sources":["../../../src/lib/open-api/getOperationName.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,yCAAyC,CAAC;AAC/F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAIxD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,QACtB,MAAM,UACH,MAAM,eACD,MAAM,GAAG,SAAS,mBACd,eAAe,KAC/B,MAYF,CAAC;AAEF,eAAO,MAAM,kBAAkB,gBAAiB,MAAM,KAAG,MAOxD,CAAC;AAEF,eAAO,MAAM,4BAA4B,QAClC,MAAM,mBACM,+BAA+B,WAgBjD,CAAC"}
|
|
@@ -1,22 +1,34 @@
|
|
|
1
|
-
import
|
|
1
|
+
import camelcase from 'camelcase';
|
|
2
|
+
import { getEndpointPartIndex } from './getServiceNamesByOperationEndpoint.js';
|
|
2
3
|
/**
|
|
3
4
|
* Convert the input value to a correct operation (method) classname.
|
|
4
5
|
* This will use the operation ID - if available - and otherwise fallback
|
|
5
6
|
* on a generated name from the URL
|
|
6
7
|
*/
|
|
7
|
-
export const getOperationName = (url, method, operationId) => {
|
|
8
|
+
export const getOperationName = (url, method, operationId, serviceNameBase) => {
|
|
8
9
|
if (operationId)
|
|
9
10
|
return getOperationIdName(operationId);
|
|
10
|
-
const urlWithoutPlaceholders =
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const urlWithoutPlaceholders = (serviceNameBase === 'tags'
|
|
12
|
+
? url
|
|
13
|
+
: reduceUrlByEndpointPartIndex(url, serviceNameBase))
|
|
14
|
+
.replace(/{(.*?)}/g, '$1')
|
|
13
15
|
.replace(/\//g, '-');
|
|
14
|
-
return
|
|
16
|
+
return camelcase(`${method}-${urlWithoutPlaceholders}`);
|
|
15
17
|
};
|
|
16
18
|
export const getOperationIdName = (operationId) => {
|
|
17
|
-
return
|
|
19
|
+
return camelcase(operationId
|
|
18
20
|
.replace(/^[^a-zA-Z]+/g, '')
|
|
19
21
|
.replace(/[^\w-]+/g, '-')
|
|
20
22
|
.trim());
|
|
21
23
|
};
|
|
24
|
+
export const reduceUrlByEndpointPartIndex = (url, serviceNameBase) => {
|
|
25
|
+
const pathSegments = (url.startsWith('/') ? url.slice(1) : url).split('/');
|
|
26
|
+
// skip the first segment
|
|
27
|
+
const pathOperationNameStartIndex = getEndpointPartIndex(serviceNameBase) + 1;
|
|
28
|
+
if (pathSegments.length + 1 <= pathOperationNameStartIndex) {
|
|
29
|
+
throw new Error(`Invalid service name base '${serviceNameBase}'. The path '${url}' does not contain enough segments to generate a service name.`);
|
|
30
|
+
}
|
|
31
|
+
const reducedPath = pathSegments.slice(pathOperationNameStartIndex).join('/');
|
|
32
|
+
return url.startsWith('/') ? `/${reducedPath}` : reducedPath;
|
|
33
|
+
};
|
|
22
34
|
//# sourceMappingURL=getOperationName.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOperationName.js","sourceRoot":"","sources":["../../../src/lib/open-api/getOperationName.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getOperationName.js","sourceRoot":"","sources":["../../../src/lib/open-api/getOperationName.ts"],"names":[],"mappings":"AAEA,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAE/E;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,GAAW,EACX,MAAc,EACd,WAA+B,EAC/B,eAAgC,EACxB,EAAE;IACV,IAAI,WAAW;QAAE,OAAO,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAExD,MAAM,sBAAsB,GAAG,CAC7B,eAAe,KAAK,MAAM;QACxB,CAAC,CAAC,GAAG;QACL,CAAC,CAAC,4BAA4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ISchemaType } from './OpenAPISchemaType.js';
|
|
2
2
|
import { ServiceBaseNameByEndpointOption } from './getServiceNamesByOperationEndpoint.js';
|
|
3
|
+
import { OpenAPIService, ServiceOperation as ServiceOperationStable } from './OpenAPIService.js';
|
|
3
4
|
export type ServiceBaseName = ServiceBaseNameByEndpointOption | 'tags';
|
|
4
5
|
/**
|
|
5
|
-
* @deprecated
|
|
6
|
+
* @deprecated use `OpenAPIService` instead from './OpenAPIService.js'
|
|
6
7
|
*/
|
|
7
|
-
export type Service =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
operations: ServiceOperation[];
|
|
13
|
-
};
|
|
14
|
-
export type ServiceOperation = {
|
|
15
|
-
method: 'get' | 'put' | 'post' | 'patch' | 'delete' | 'options' | 'head' | 'trace';
|
|
16
|
-
path: string;
|
|
17
|
-
name: string;
|
|
18
|
-
description: string | undefined;
|
|
19
|
-
summary: string | undefined;
|
|
20
|
-
deprecated: boolean | undefined;
|
|
21
|
-
mediaType: string | undefined;
|
|
22
|
-
errors: Record<string, string | undefined>;
|
|
23
|
-
success: Record<string, string | undefined>;
|
|
24
|
-
parameters: {
|
|
25
|
-
name: string;
|
|
26
|
-
in: 'header' | 'query' | 'cookie';
|
|
27
|
-
description: string;
|
|
28
|
-
required: boolean;
|
|
29
|
-
schema: any;
|
|
30
|
-
example: string | undefined;
|
|
31
|
-
}[] | undefined;
|
|
32
|
-
security: Array<Record<string, string[] | undefined>> | undefined;
|
|
33
|
-
};
|
|
8
|
+
export type Service = OpenAPIService;
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated use `ServiceOperation` instead from './OpenAPIService.js'
|
|
11
|
+
*/
|
|
12
|
+
export type ServiceOperation = ServiceOperationStable;
|
|
34
13
|
export interface ServiceOutputOptions {
|
|
35
14
|
postfixServices?: string;
|
|
36
15
|
serviceNameBase?: ServiceBaseName;
|
|
37
16
|
}
|
|
38
|
-
export declare const getServices: (openApiJson: OpenAPISchemaType, { postfixServices, serviceNameBase, }?: ServiceOutputOptions) =>
|
|
17
|
+
export declare const getServices: (openApiJson: OpenAPISchemaType, { postfixServices, serviceNameBase, }?: ServiceOutputOptions) => OpenAPIService[];
|
|
39
18
|
export declare const supportedMethod: (method: unknown) => method is (typeof supportedHTTPMethods)[number];
|
|
40
|
-
declare const supportedHTTPMethods: ("get" | "put" | "post" | "
|
|
19
|
+
declare const supportedHTTPMethods: ("get" | "put" | "post" | "delete" | "options" | "head" | "patch" | "trace")[];
|
|
41
20
|
export {};
|
|
42
21
|
//# sourceMappingURL=getServices.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getServices.d.ts","sourceRoot":"","sources":["../../../src/lib/open-api/getServices.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAIhE,OAAO,EAEL,+BAA+B,EAChC,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"getServices.d.ts","sourceRoot":"","sources":["../../../src/lib/open-api/getServices.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAIhE,OAAO,EAEL,+BAA+B,EAChC,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EACL,cAAc,EACd,gBAAgB,IAAI,sBAAsB,EAC3C,MAAM,qBAAqB,CAAC;AAG7B,MAAM,MAAM,eAAe,GAAG,+BAA+B,GAAG,MAAM,CAAC;AAEvE;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,cAAc,CAAC;AAErC;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AAEtD,MAAM,WAAW,oBAAoB;IACnC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED,eAAO,MAAM,WAAW,gBACT,iBAAiB,0CAI3B,oBAAoB,qBAuGxB,CAAC;AAEF,eAAO,MAAM,eAAe,WAClB,OAAO,KACd,MAAM,IAAI,CAAC,OAAO,oBAAoB,EAAE,MAAM,CAG9C,CAAC;AAEJ,QAAA,MAAM,oBAAoB,gFASqC,CAAC"}
|
|
@@ -3,8 +3,10 @@ import { getContentMediaType } from './getContent.js';
|
|
|
3
3
|
import { getOperationName } from './getOperationName.js';
|
|
4
4
|
import { getServiceNamesByOperationEndpoint, } from './getServiceNamesByOperationEndpoint.js';
|
|
5
5
|
import { getServiceNamesByOperationTags } from './getServiceNamesByOperationTags.js';
|
|
6
|
+
import { replaceRefParametersWithComponent } from './replaceRefParametersWithComponent.js';
|
|
6
7
|
export const getServices = (openApiJson, { postfixServices = 'Service', serviceNameBase = 'endpoint[0]', } = {}) => {
|
|
7
8
|
const paths = openApiJson.paths;
|
|
9
|
+
const parametersComponents = openApiJson.components.parameters ?? {};
|
|
8
10
|
const services = new Map();
|
|
9
11
|
for (const path in paths) {
|
|
10
12
|
if (!Object.prototype.hasOwnProperty.call(paths, path))
|
|
@@ -55,17 +57,14 @@ export const getServices = (openApiJson, { postfixServices = 'Service', serviceN
|
|
|
55
57
|
method,
|
|
56
58
|
path,
|
|
57
59
|
errors,
|
|
58
|
-
name: getOperationName(path, method, methodOperation.operationId),
|
|
60
|
+
name: getOperationName(path, method, methodOperation.operationId, serviceNameBase),
|
|
59
61
|
description: methodOperation.description,
|
|
60
62
|
summary: methodOperation.summary,
|
|
61
63
|
deprecated: methodOperation.deprecated,
|
|
62
|
-
parameters:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
mediaType: methodOperation.requestBody?.content
|
|
67
|
-
? getContentMediaType(methodOperation.requestBody.content)
|
|
68
|
-
: undefined,
|
|
64
|
+
parameters: replaceRefParametersWithComponent(
|
|
65
|
+
// @ts-expect-error the issue with custom OpenAPISchemaType
|
|
66
|
+
methodOperation.parameters, parametersComponents),
|
|
67
|
+
requestBody: methodOperation.requestBody,
|
|
69
68
|
success: success,
|
|
70
69
|
security: methodOperation.security,
|
|
71
70
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getServices.js","sourceRoot":"","sources":["../../../src/lib/open-api/getServices.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACL,kCAAkC,GAEnC,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"getServices.js","sourceRoot":"","sources":["../../../src/lib/open-api/getServices.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACL,kCAAkC,GAEnC,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAKrF,OAAO,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAC;AAmB3F,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,WAA8B,EAC9B,EACE,eAAe,GAAG,SAAS,EAC3B,eAAe,GAAG,aAAa,MACP,EAAE,EAC5B,EAAE;IACF,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC;IAChC,MAAM,oBAAoB,GAAG,WAAW,CAAC,UAAU,CAAC,UAAU,IAAI,EAAE,CAAC;IAErE,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA0B,CAAC;IAEnD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC;YAAE,SAAS;QAEjE,KAAK,MAAM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AAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;AACvC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,MAAe,EACkC,EAAE,CACnD,oBAAoB,CAAC,QAAQ,CAC3B,MAA+C,CAChD,CAAC;AAEJ,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC;IACzC,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;CAC8C,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { OpenAPISchemaType } from './OpenAPISchemaType.js';
|
|
2
|
+
import { ParameterObject } from 'openapi-typescript';
|
|
3
|
+
import { ReferenceObject } from 'openapi-typescript/src/types.js';
|
|
4
|
+
export declare function replaceRefParametersWithComponent(parameters: ParameterObject | ReferenceObject | undefined, parametersComponents: OpenAPISchemaType['components']['parameters']): any[] | undefined;
|
|
5
|
+
//# sourceMappingURL=replaceRefParametersWithComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replaceRefParametersWithComponent.d.ts","sourceRoot":"","sources":["../../../src/lib/open-api/replaceRefParametersWithComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAElE,wBAAgB,iCAAiC,CAC/C,UAAU,EAAE,eAAe,GAAG,eAAe,GAAG,SAAS,EACzD,oBAAoB,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,qBAkBpE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export function replaceRefParametersWithComponent(parameters, parametersComponents) {
|
|
2
|
+
if (!Array.isArray(parameters))
|
|
3
|
+
return undefined;
|
|
4
|
+
const definedParameters = parameters
|
|
5
|
+
.map((parameter) => {
|
|
6
|
+
if (parameter.$ref)
|
|
7
|
+
return getParametersComponentByRef(parameter.$ref, parametersComponents);
|
|
8
|
+
return parameter;
|
|
9
|
+
})
|
|
10
|
+
.filter(Boolean);
|
|
11
|
+
if (!definedParameters.length)
|
|
12
|
+
return undefined;
|
|
13
|
+
return definedParameters;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get the operation from the $ref
|
|
17
|
+
* @param $ref Example: `#/components/parameters/Export`
|
|
18
|
+
* @param parameters
|
|
19
|
+
*/
|
|
20
|
+
function getParametersComponentByRef($ref, parameters) {
|
|
21
|
+
const refPath = $ref.split('/').slice(1);
|
|
22
|
+
if (refPath[1] === 'parameters') {
|
|
23
|
+
return parameters?.[refPath[2]];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=replaceRefParametersWithComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replaceRefParametersWithComponent.js","sourceRoot":"","sources":["../../../src/lib/open-api/replaceRefParametersWithComponent.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,iCAAiC,CAC/C,UAAyD,EACzD,oBAAmE;IAEnE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC;QAAE,OAAO,SAAS,CAAC;IAEjD,MAAM,iBAAiB,GAAG,UAAU;SACjC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;QACjB,IAAI,SAAS,CAAC,IAAI;YAChB,OAAO,2BAA2B,CAChC,SAAS,CAAC,IAAI,EACd,oBAAoB,CACrB,CAAC;QACJ,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;SACD,MAAM,CAAC,OAAO,CAAC,CAAC;IAEnB,IAAI,CAAC,iBAAiB,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAEhD,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED;;;;GAIG;AACH,SAAS,2BAA2B,CAClC,IAAY,EACZ,UAAyD;IAEzD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACzC,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,YAAY,EAAE,CAAC;QAChC,OAAO,UAAU,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAClC,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ServiceOperation } from './open-api/
|
|
1
|
+
import { ServiceOperation } from './open-api/OpenAPIService.js';
|
|
2
2
|
/**
|
|
3
3
|
*
|
|
4
4
|
* @param operationFullGlobs - Example: `post /**`, `/**,/foo/bar`
|
|
@@ -10,7 +10,7 @@ import { ServiceOperation } from './open-api/getServices.js';
|
|
|
10
10
|
* ```
|
|
11
11
|
*/
|
|
12
12
|
export declare const parseOperationGlobs: (operationFullGlobs: string) => {
|
|
13
|
-
methods: ("get" | "put" | "post" | "
|
|
13
|
+
methods: ("get" | "put" | "post" | "delete" | "options" | "head" | "patch" | "trace")[] | undefined;
|
|
14
14
|
pathGlobs: string;
|
|
15
15
|
};
|
|
16
16
|
export type OperationGlobMethods = ServiceOperation['method'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseOperationGlobs.d.ts","sourceRoot":"","sources":["../../src/lib/parseOperationGlobs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"parseOperationGlobs.d.ts","sourceRoot":"","sources":["../../src/lib/parseOperationGlobs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAGhE;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,uBAAwB,MAAM;;;CAmB7D,CAAC;AAsBF,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -17,7 +17,6 @@ export declare function predefineSchemaParameters(schema: OpenAPI3, predefinedPa
|
|
|
17
17
|
export declare function parseOperationPredefinedParametersOption(...optionItems: string[]): ParsedPredefinedParametersOption[];
|
|
18
18
|
export declare function createPredefinedParametersGlobs(schema: OpenAPI3, predefinedParameters: ParsedPredefinedParametersOption[]): Array<PredefinedParametersGlob>;
|
|
19
19
|
export declare function assertIsOperationObject(operationItem: OperationObject | ReferenceObject): asserts operationItem is OperationObject;
|
|
20
|
-
export declare function assertIsParameterObjects(parameterObjects: Array<ParameterObject | ReferenceObject>): asserts parameterObjects is Array<ParameterObject>;
|
|
21
20
|
type ParsedPredefinedParametersOption = {
|
|
22
21
|
methods: OperationGlobMethods[] | undefined;
|
|
23
22
|
pathGlobs: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predefineSchemaParameters.d.ts","sourceRoot":"","sources":["../../src/lib/predefineSchemaParameters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAEL,eAAe,EAChB,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"predefineSchemaParameters.d.ts","sourceRoot":"","sources":["../../src/lib/predefineSchemaParameters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAEL,eAAe,EAChB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EACL,oBAAoB,EAErB,MAAM,0BAA0B,CAAC;AAGlC,wBAAgB,yBAAyB,C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