@automatons/parser 0.0.2
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/LICENSE +21 -0
- package/README.md +47 -0
- package/converters/allOf.d.ts +4 -0
- package/converters/allOf.d.ts.map +1 -0
- package/converters/allOf.js +10 -0
- package/converters/allOf.js.map +1 -0
- package/converters/array.d.ts +4 -0
- package/converters/array.d.ts.map +1 -0
- package/converters/array.js +13 -0
- package/converters/array.js.map +1 -0
- package/converters/boolean.d.ts +4 -0
- package/converters/boolean.d.ts.map +1 -0
- package/converters/boolean.js +9 -0
- package/converters/boolean.js.map +1 -0
- package/converters/map.d.ts +7 -0
- package/converters/map.d.ts.map +1 -0
- package/converters/map.js +5 -0
- package/converters/map.js.map +1 -0
- package/converters/model.d.ts +3 -0
- package/converters/model.d.ts.map +1 -0
- package/converters/model.js +11 -0
- package/converters/model.js.map +1 -0
- package/converters/number.d.ts +4 -0
- package/converters/number.d.ts.map +1 -0
- package/converters/number.js +11 -0
- package/converters/number.js.map +1 -0
- package/converters/object.d.ts +4 -0
- package/converters/object.d.ts.map +1 -0
- package/converters/object.js +10 -0
- package/converters/object.js.map +1 -0
- package/converters/oneOf.d.ts +4 -0
- package/converters/oneOf.d.ts.map +1 -0
- package/converters/oneOf.js +10 -0
- package/converters/oneOf.js.map +1 -0
- package/converters/schema.d.ts +4 -0
- package/converters/schema.d.ts.map +1 -0
- package/converters/schema.js +13 -0
- package/converters/schema.js.map +1 -0
- package/converters/schemaModel.d.ts +4 -0
- package/converters/schemaModel.d.ts.map +1 -0
- package/converters/schemaModel.js +11 -0
- package/converters/schemaModel.js.map +1 -0
- package/converters/security.d.ts +4 -0
- package/converters/security.d.ts.map +1 -0
- package/converters/security.js +18 -0
- package/converters/security.js.map +1 -0
- package/converters/server.d.ts +4 -0
- package/converters/server.d.ts.map +1 -0
- package/converters/server.js +11 -0
- package/converters/server.js.map +1 -0
- package/converters/string.d.ts +4 -0
- package/converters/string.d.ts.map +1 -0
- package/converters/string.js +11 -0
- package/converters/string.js.map +1 -0
- package/extractors/index.d.ts +4 -0
- package/extractors/index.d.ts.map +1 -0
- package/extractors/index.js +16 -0
- package/extractors/index.js.map +1 -0
- package/extractors/model/allOf.d.ts +4 -0
- package/extractors/model/allOf.d.ts.map +1 -0
- package/extractors/model/allOf.js +11 -0
- package/extractors/model/allOf.js.map +1 -0
- package/extractors/model/array.d.ts +4 -0
- package/extractors/model/array.d.ts.map +1 -0
- package/extractors/model/array.js +15 -0
- package/extractors/model/array.js.map +1 -0
- package/extractors/model/index.d.ts +4 -0
- package/extractors/model/index.d.ts.map +1 -0
- package/extractors/model/index.js +41 -0
- package/extractors/model/index.js.map +1 -0
- package/extractors/model/object.d.ts +4 -0
- package/extractors/model/object.d.ts.map +1 -0
- package/extractors/model/object.js +22 -0
- package/extractors/model/object.js.map +1 -0
- package/extractors/model/of.d.ts +8 -0
- package/extractors/model/of.d.ts.map +1 -0
- package/extractors/model/of.js +14 -0
- package/extractors/model/of.js.map +1 -0
- package/extractors/model/oneOf.d.ts +6 -0
- package/extractors/model/oneOf.d.ts.map +1 -0
- package/extractors/model/oneOf.js +11 -0
- package/extractors/model/oneOf.js.map +1 -0
- package/extractors/model/ref.d.ts +4 -0
- package/extractors/model/ref.d.ts.map +1 -0
- package/extractors/model/ref.js +13 -0
- package/extractors/model/ref.js.map +1 -0
- package/extractors/model/type.d.ts +6 -0
- package/extractors/model/type.d.ts.map +1 -0
- package/extractors/model/type.js +3 -0
- package/extractors/model/type.js.map +1 -0
- package/extractors/path/index.d.ts +8 -0
- package/extractors/path/index.d.ts.map +1 -0
- package/extractors/path/index.js +17 -0
- package/extractors/path/index.js.map +1 -0
- package/extractors/path/mediaType.d.ts +3 -0
- package/extractors/path/mediaType.d.ts.map +1 -0
- package/extractors/path/mediaType.js +10 -0
- package/extractors/path/mediaType.js.map +1 -0
- package/extractors/path/method.d.ts +4 -0
- package/extractors/path/method.d.ts.map +1 -0
- package/extractors/path/method.js +75 -0
- package/extractors/path/method.js.map +1 -0
- package/extractors/path/parameter.d.ts +4 -0
- package/extractors/path/parameter.d.ts.map +1 -0
- package/extractors/path/parameter.js +83 -0
- package/extractors/path/parameter.js.map +1 -0
- package/extractors/path/requestBody.d.ts +8 -0
- package/extractors/path/requestBody.d.ts.map +1 -0
- package/extractors/path/requestBody.js +34 -0
- package/extractors/path/requestBody.js.map +1 -0
- package/extractors/path/response.d.ts +5 -0
- package/extractors/path/response.d.ts.map +1 -0
- package/extractors/path/response.js +19 -0
- package/extractors/path/response.js.map +1 -0
- package/extractors/path/security.d.ts +4 -0
- package/extractors/path/security.d.ts.map +1 -0
- package/extractors/path/security.js +10 -0
- package/extractors/path/security.js.map +1 -0
- package/extractors/path/status.d.ts +3 -0
- package/extractors/path/status.d.ts.map +1 -0
- package/extractors/path/status.js +11 -0
- package/extractors/path/status.js.map +1 -0
- package/extractors/path/type.d.ts +20 -0
- package/extractors/path/type.d.ts.map +1 -0
- package/extractors/path/type.js +3 -0
- package/extractors/path/type.js.map +1 -0
- package/extractors/schema/allOf.d.ts +7 -0
- package/extractors/schema/allOf.d.ts.map +1 -0
- package/extractors/schema/allOf.js +16 -0
- package/extractors/schema/allOf.js.map +1 -0
- package/extractors/schema/array.d.ts +12 -0
- package/extractors/schema/array.d.ts.map +1 -0
- package/extractors/schema/array.js +30 -0
- package/extractors/schema/array.js.map +1 -0
- package/extractors/schema/boolean.d.ts +11 -0
- package/extractors/schema/boolean.d.ts.map +1 -0
- package/extractors/schema/boolean.js +15 -0
- package/extractors/schema/boolean.js.map +1 -0
- package/extractors/schema/index.d.ts +9 -0
- package/extractors/schema/index.d.ts.map +1 -0
- package/extractors/schema/index.js +40 -0
- package/extractors/schema/index.js.map +1 -0
- package/extractors/schema/number.d.ts +11 -0
- package/extractors/schema/number.d.ts.map +1 -0
- package/extractors/schema/number.js +15 -0
- package/extractors/schema/number.js.map +1 -0
- package/extractors/schema/object.d.ts +7 -0
- package/extractors/schema/object.d.ts.map +1 -0
- package/extractors/schema/object.js +16 -0
- package/extractors/schema/object.js.map +1 -0
- package/extractors/schema/oneOf.d.ts +7 -0
- package/extractors/schema/oneOf.d.ts.map +1 -0
- package/extractors/schema/oneOf.js +16 -0
- package/extractors/schema/oneOf.js.map +1 -0
- package/extractors/schema/ref.d.ts +7 -0
- package/extractors/schema/ref.d.ts.map +1 -0
- package/extractors/schema/ref.js +16 -0
- package/extractors/schema/ref.js.map +1 -0
- package/extractors/schema/string.d.ts +11 -0
- package/extractors/schema/string.d.ts.map +1 -0
- package/extractors/schema/string.js +15 -0
- package/extractors/schema/string.js.map +1 -0
- package/index.d.ts +3 -0
- package/index.d.ts.map +1 -0
- package/index.js +15 -0
- package/index.js.map +1 -0
- package/package.json +55 -0
- package/parser.d.ts +8 -0
- package/parser.d.ts.map +1 -0
- package/parser.js +15 -0
- package/parser.js.map +1 -0
- package/parsers/api.d.ts +7 -0
- package/parsers/api.d.ts.map +1 -0
- package/parsers/api.js +29 -0
- package/parsers/api.js.map +1 -0
- package/parsers/model.d.ts +4 -0
- package/parsers/model.d.ts.map +1 -0
- package/parsers/model.js +11 -0
- package/parsers/model.js.map +1 -0
- package/types/api.d.ts +105 -0
- package/types/api.d.ts.map +1 -0
- package/types/api.js +3 -0
- package/types/api.js.map +1 -0
- package/types/index.d.ts +3 -0
- package/types/index.d.ts.map +1 -0
- package/types/index.js +15 -0
- package/types/index.js.map +1 -0
- package/types/model.d.ts +94 -0
- package/types/model.d.ts.map +1 -0
- package/types/model.js +3 -0
- package/types/model.js.map +1 -0
- package/utils/method.d.ts +4 -0
- package/utils/method.d.ts.map +1 -0
- package/utils/method.js +5 -0
- package/utils/method.js.map +1 -0
- package/utils/omitCopy.d.ts +2 -0
- package/utils/omitCopy.d.ts.map +1 -0
- package/utils/omitCopy.js +6 -0
- package/utils/omitCopy.js.map +1 -0
- package/utils/overwrite.d.ts +2 -0
- package/utils/overwrite.d.ts.map +1 -0
- package/utils/overwrite.js +5 -0
- package/utils/overwrite.js.map +1 -0
- package/utils/sort.d.ts +6 -0
- package/utils/sort.d.ts.map +1 -0
- package/utils/sort.js +5 -0
- package/utils/sort.js.map +1 -0
- package/utils/uniq.d.ts +2 -0
- package/utils/uniq.d.ts.map +1 -0
- package/utils/uniq.js +5 -0
- package/utils/uniq.js.map +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) tanmen (yt.prog@gmail.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# OpenapiAutomatons
|
|
2
|
+
[](https://github.com/openapi-automatons/openapi-automatons/actions/workflows/ci-cd.yml)
|
|
3
|
+
[](https://codecov.io/gh/openapi-automatons/openapi-automatons)
|
|
4
|
+
[](https://github.com/semantic-release/semantic-release)
|
|
5
|
+
[](https://www.npmjs.com/package/openapi-automatons)
|
|
6
|
+
|
|
7
|
+
## What OpenapiAutomatons
|
|
8
|
+
This library is a generator using openapi file.
|
|
9
|
+
|
|
10
|
+
## What code can generate?
|
|
11
|
+
| name | language | type | example |
|
|
12
|
+
| ---- | -------- | ---- | ------- |
|
|
13
|
+
| @automatons/typescript-axios | typescript | client | [example](https://github.com/openapi-automatons/openapi-automatons/tree/main/examples/typescript/clients/axios "example") |
|
|
14
|
+
|
|
15
|
+
## Get Started
|
|
16
|
+
1. Install library to your project
|
|
17
|
+
```shell script
|
|
18
|
+
yarn add -D openapi-automatons @automatons/typescript-axios
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
2. Create settings in your project root
|
|
22
|
+
```json:automatons.json
|
|
23
|
+
{
|
|
24
|
+
"openapi": "openapi.yml",
|
|
25
|
+
"automatons": [{
|
|
26
|
+
"automaton": "@automatons/typescript-axios",
|
|
27
|
+
"outDir": "src/clients"
|
|
28
|
+
}]
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
3. Add generate command your package.json
|
|
33
|
+
```json:package.json
|
|
34
|
+
{
|
|
35
|
+
"scripts": {
|
|
36
|
+
"generate": "openapi-automatons"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Automatons.json
|
|
42
|
+
| property | | type | required | description |
|
|
43
|
+
| -------- | --- | ---- | -------- | ----------- |
|
|
44
|
+
| openapi | | string | true | This is openapi path. It can be relative or absolute. Also, there is no problem with the url format.|
|
|
45
|
+
| automatons | | array | true | This is the property that contains the module. |
|
|
46
|
+
| automatons | automaton | string | true | This is the module name. You can embed your own module. It is also possible to include it with a relative path. |
|
|
47
|
+
| automatons | outDir | string | true | This is the output directory of module. |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"allOf.d.ts","sourceRoot":"","sources":["../../src/converters/allOf.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAC,WAAW,EAAE,MAAM,EAAC,MAAM,UAAU,CAAC;AAGlD,eAAO,MAAM,YAAY,WAAY,kBAAkB,WAAW,MAAM,EAAE,KAAG,WAI3E,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertAllOf = void 0;
|
|
4
|
+
const schema_1 = require("./schema");
|
|
5
|
+
exports.convertAllOf = (schema, schemas) => ({
|
|
6
|
+
type: 'allOf',
|
|
7
|
+
...schema_1.convertSchema(schema),
|
|
8
|
+
schemas,
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=allOf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"allOf.js","sourceRoot":"","sources":["../../src/converters/allOf.ts"],"names":[],"mappings":";;;AAEA,qCAAuC;AAE1B,QAAA,YAAY,GAAG,CAAC,MAA0B,EAAE,OAAiB,EAAe,EAAE,CAAC,CAAC;IAC3F,IAAI,EAAE,OAAO;IACb,GAAG,sBAAa,CAAC,MAAM,CAAC;IACxB,OAAO;CACR,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { OpenapiSchemaArray } from '@automatons/tools';
|
|
2
|
+
import type { ArraySchema } from '../types';
|
|
3
|
+
export declare const convertArray: (schema: OpenapiSchemaArray, itemSchema?: import("../types").StringSchema | import("../types").IntegerSchema | import("../types").NumberSchema | import("../types").BooleanSchema | ArraySchema | import("../types").ObjectSchema | import("../types").AllOfSchema | import("../types").OneOfSchema | import("../types").ModelSchema | undefined) => ArraySchema;
|
|
4
|
+
//# sourceMappingURL=array.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../src/converters/array.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAC,WAAW,EAAS,MAAM,UAAU,CAAC;AAGlD,eAAO,MAAM,YAAY,WAAY,kBAAkB,0TAAwB,WAO7E,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertArray = void 0;
|
|
4
|
+
const schema_1 = require("./schema");
|
|
5
|
+
exports.convertArray = (schema, itemSchema) => ({
|
|
6
|
+
type: 'array',
|
|
7
|
+
...schema_1.convertSchema(schema),
|
|
8
|
+
uniqueItems: schema.uniqueItems,
|
|
9
|
+
minItems: schema.minItems,
|
|
10
|
+
maxItems: schema.maxItems,
|
|
11
|
+
items: itemSchema,
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=array.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../src/converters/array.ts"],"names":[],"mappings":";;;AAEA,qCAAuC;AAE1B,QAAA,YAAY,GAAG,CAAC,MAA0B,EAAE,UAAmB,EAAe,EAAE,CAAC,CAAC;IAC7F,IAAI,EAAE,OAAO;IACb,GAAG,sBAAa,CAAC,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC,WAAW;IAC/B,QAAQ,EAAE,MAAM,CAAC,QAAQ;IACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;IACzB,KAAK,EAAE,UAAU;CAClB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../src/converters/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,mBAAmB,CAAC;AAG5D,eAAO,MAAM,cAAc,WAAY,oBAAoB,KAAG,aAG5D,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertBoolean = void 0;
|
|
4
|
+
const schema_1 = require("./schema");
|
|
5
|
+
exports.convertBoolean = (schema) => ({
|
|
6
|
+
type: 'boolean',
|
|
7
|
+
...schema_1.convertSchema(schema),
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=boolean.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../src/converters/boolean.ts"],"names":[],"mappings":";;;AAEA,qCAAuC;AAE1B,QAAA,cAAc,GAAG,CAAC,MAA4B,EAAiB,EAAE,CAAC,CAAC;IAC9E,IAAI,EAAE,SAAS;IACf,GAAG,sBAAa,CAAC,MAAM,CAAC;CACzB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/converters/map.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAElD,oBAAY,YAAY,CAAC,CAAC,IAAI;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,CAAC,CAAC;CACX,CAAA;AAED,eAAO,MAAM,UAAU,qDACmC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.js","sourceRoot":"","sources":["../../src/converters/map.ts"],"names":[],"mappings":";;;AAOa,QAAA,UAAU,GAAG,CAAU,MAAqB,EAAE,EAA0B,EAAE,CACrF,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,EAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/converters/model.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,KAAK,EAAE,MAAM,EAAC,MAAM,UAAU,CAAC;AAE5C,eAAO,MAAM,YAAY,UAAW,MAAM,UAAU,MAAM,YAAW,KAAK,EAAE,KAAQ,KAKlF,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertModel = void 0;
|
|
4
|
+
const change_case_1 = require("change-case");
|
|
5
|
+
exports.convertModel = (title, schema, imports = []) => ({
|
|
6
|
+
title: change_case_1.pascalCase(title),
|
|
7
|
+
filename: change_case_1.camelCase(title),
|
|
8
|
+
imports,
|
|
9
|
+
schema,
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/converters/model.ts"],"names":[],"mappings":";;;AAAA,6CAAkD;AAGrC,QAAA,YAAY,GAAG,CAAC,KAAa,EAAE,MAAc,EAAE,UAAmB,EAAE,EAAS,EAAE,CAAC,CAAC;IAC5F,KAAK,EAAE,wBAAU,CAAC,KAAK,CAAC;IACxB,QAAQ,EAAE,uBAAS,CAAC,KAAK,CAAC;IAC1B,OAAO;IACP,MAAM;CACP,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../src/converters/number.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAE,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AAGtC,eAAO,MAAM,aAAa,WAAY,mBAAmB,GAAG,oBAAoB,KAAG,YAKjF,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertNumber = void 0;
|
|
4
|
+
const schema_1 = require("./schema");
|
|
5
|
+
exports.convertNumber = (schema) => ({
|
|
6
|
+
type: 'number',
|
|
7
|
+
format: schema.format,
|
|
8
|
+
...schema_1.convertSchema(schema),
|
|
9
|
+
enum: schema.enum ?? [],
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=number.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.js","sourceRoot":"","sources":["../../src/converters/number.ts"],"names":[],"mappings":";;;AAEA,qCAAuC;AAE1B,QAAA,aAAa,GAAG,CAAC,MAAkD,EAAgB,EAAE,CAAC,CAAC;IAClG,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE,MAAM,CAAC,MAAM;IACrB,GAAG,sBAAa,CAAC,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,EAAE;CACxB,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { OpenapiSchemaObject } from '@automatons/tools';
|
|
2
|
+
import { ObjectSchema, Property } from '../types';
|
|
3
|
+
export declare const convertObjectSchema: (schema: OpenapiSchemaObject, properties?: Property[] | undefined) => ObjectSchema;
|
|
4
|
+
//# sourceMappingURL=object.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../src/converters/object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,UAAU,CAAC;AAGhD,eAAO,MAAM,mBAAmB,WAAY,mBAAmB,0CAA4B,YAIzF,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertObjectSchema = void 0;
|
|
4
|
+
const schema_1 = require("./schema");
|
|
5
|
+
exports.convertObjectSchema = (schema, properties) => ({
|
|
6
|
+
type: 'object',
|
|
7
|
+
...schema_1.convertSchema(schema),
|
|
8
|
+
properties,
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=object.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../src/converters/object.ts"],"names":[],"mappings":";;;AAEA,qCAAuC;AAE1B,QAAA,mBAAmB,GAAG,CAAC,MAA2B,EAAE,UAAuB,EAAgB,EAAE,CAAC,CAAC;IAC1G,IAAI,EAAE,QAAQ;IACd,GAAG,sBAAa,CAAC,MAAM,CAAC;IACxB,UAAU;CACX,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oneOf.d.ts","sourceRoot":"","sources":["../../src/converters/oneOf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAC,WAAW,EAAE,MAAM,EAAC,MAAM,UAAU,CAAC;AAG7C,eAAO,MAAM,YAAY,WAAY,kBAAkB,WAAW,MAAM,EAAE,KAAG,WAI3E,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertOneOf = void 0;
|
|
4
|
+
const schema_1 = require("./schema");
|
|
5
|
+
exports.convertOneOf = (schema, schemas) => ({
|
|
6
|
+
type: 'oneOf',
|
|
7
|
+
...schema_1.convertSchema(schema),
|
|
8
|
+
schemas,
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=oneOf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oneOf.js","sourceRoot":"","sources":["../../src/converters/oneOf.ts"],"names":[],"mappings":";;;AAEA,qCAAuC;AAE1B,QAAA,YAAY,GAAG,CAAC,MAA0B,EAAE,OAAiB,EAAe,EAAE,CAAC,CAAC;IAC3F,IAAI,EAAE,OAAO;IACb,GAAG,sBAAa,CAAC,MAAM,CAAC;IACxB,OAAO;CACR,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/converters/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAErD,eAAO,MAAM,aAAa,WAAY,aAAa,KAAG,YAQpD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertSchema = void 0;
|
|
4
|
+
exports.convertSchema = (schema) => ({
|
|
5
|
+
description: schema.description,
|
|
6
|
+
nullable: schema.nullable,
|
|
7
|
+
readOnly: schema.readOnly,
|
|
8
|
+
writeOnly: schema.writeOnly,
|
|
9
|
+
deprecated: schema.deprecated,
|
|
10
|
+
example: schema.example,
|
|
11
|
+
defaultValue: schema.default,
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/converters/schema.ts"],"names":[],"mappings":";;;AAGa,QAAA,aAAa,GAAG,CAAC,MAAqB,EAAgB,EAAE,CAAC,CAAC;IACrE,WAAW,EAAE,MAAM,CAAC,WAAW;IAC/B,QAAQ,EAAE,MAAM,CAAC,QAAQ;IACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;IACzB,SAAS,EAAE,MAAM,CAAC,SAAS;IAC3B,UAAU,EAAE,MAAM,CAAC,UAAU;IAC7B,OAAO,EAAE,MAAM,CAAC,OAAO;IACvB,YAAY,EAAE,MAAM,CAAC,OAAO;CAC7B,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemaModel.d.ts","sourceRoot":"","sources":["../../src/converters/schemaModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAC,WAAW,EAAC,MAAM,UAAU,CAAC;AAGrC,eAAO,MAAM,kBAAkB,UAAW,MAAM,UAAU,aAAa,KAAG,WAIxE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertSchemaModel = void 0;
|
|
4
|
+
const change_case_1 = require("change-case");
|
|
5
|
+
const schema_1 = require("./schema");
|
|
6
|
+
exports.convertSchemaModel = (model, schema) => ({
|
|
7
|
+
type: 'model',
|
|
8
|
+
name: change_case_1.pascalCase(model),
|
|
9
|
+
...schema_1.convertSchema(schema),
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=schemaModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemaModel.js","sourceRoot":"","sources":["../../src/converters/schemaModel.ts"],"names":[],"mappings":";;;AACA,6CAAuC;AAEvC,qCAAuC;AAE1B,QAAA,kBAAkB,GAAG,CAAC,KAAa,EAAE,MAAqB,EAAe,EAAE,CAAC,CAAC;IACxF,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,wBAAU,CAAC,KAAK,CAAC;IACvB,GAAG,sBAAa,CAAC,MAAM,CAAC;CACzB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../src/converters/security.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAC,QAAQ,EAAC,MAAM,UAAU,CAAC;AAElC,eAAO,MAAM,eAAe,SACnB,MAAM,YAAY,qBAAqB,UAAU,MAAM,EAAE,KAAG,QAAQ,GAAG,SAY7E,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertSecurity = void 0;
|
|
4
|
+
const change_case_1 = require("change-case");
|
|
5
|
+
exports.convertSecurity = (name, security, scopes) => {
|
|
6
|
+
switch (security.type) {
|
|
7
|
+
case 'apiKey':
|
|
8
|
+
return { ...security, name: change_case_1.camelCase(name), key: security.name };
|
|
9
|
+
case 'http':
|
|
10
|
+
return { ...security, name: change_case_1.camelCase(name) };
|
|
11
|
+
case 'oauth2':
|
|
12
|
+
case 'openIdConnect':
|
|
13
|
+
return { ...security, name: change_case_1.camelCase(name), scopes };
|
|
14
|
+
default:
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=security.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.js","sourceRoot":"","sources":["../../src/converters/security.ts"],"names":[],"mappings":";;;AACA,6CAAsC;AAGzB,QAAA,eAAe,GAC1B,CAAC,IAAY,EAAE,QAA+B,EAAE,MAAgB,EAAwB,EAAE;IACxF,QAAQ,QAAQ,CAAC,IAAI,EAAE;QACvB,KAAK,QAAQ;YACX,OAAO,EAAC,GAAG,QAAQ,EAAE,IAAI,EAAE,uBAAS,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,IAAI,EAAC,CAAC;QAClE,KAAK,MAAM;YACT,OAAO,EAAC,GAAG,QAAQ,EAAE,IAAI,EAAE,uBAAS,CAAC,IAAI,CAAC,EAAC,CAAC;QAC9C,KAAK,QAAQ,CAAC;QACd,KAAK,eAAe;YAClB,OAAO,EAAC,GAAG,QAAQ,EAAE,IAAI,EAAE,uBAAS,CAAC,IAAI,CAAC,EAAE,MAAM,EAAC,CAAC;QACtD;YACE,OAAO,SAAS,CAAC;KAClB;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/converters/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAIhC,eAAO,MAAM,aAAa,WAAY,aAAa,KAAG,MAKpD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertServer = void 0;
|
|
4
|
+
const map_1 = require("./map");
|
|
5
|
+
const change_case_1 = require("change-case");
|
|
6
|
+
exports.convertServer = (schema) => ({
|
|
7
|
+
name: change_case_1.pascalCase(schema['x-name'] ?? schema.url),
|
|
8
|
+
url: schema.url,
|
|
9
|
+
values: map_1.convertMap(schema.variables).map(({ key, schema }) => ({ name: key, defaultValue: schema.default, enums: schema.enum })),
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/converters/server.ts"],"names":[],"mappings":";;;AAEA,+BAAiC;AACjC,6CAAuC;AAE1B,QAAA,aAAa,GAAG,CAAC,MAAqB,EAAU,EAAE,CAAC,CAAC;IAC/D,IAAI,EAAE,wBAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC;IAChD,GAAG,EAAE,MAAM,CAAC,GAAG;IACf,MAAM,EAAE,gBAAU,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,EAAC,GAAG,EAAE,MAAM,EAAC,EAAE,EAAE,CACzD,CAAC,EAAC,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,EAAC,CAAC,CAAC;CACnE,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/converters/string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AAGtC,eAAO,MAAM,aAAa,WAAY,mBAAmB,KAAG,YAK1D,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertString = void 0;
|
|
4
|
+
const schema_1 = require("./schema");
|
|
5
|
+
exports.convertString = (schema) => ({
|
|
6
|
+
type: 'string',
|
|
7
|
+
format: schema.format,
|
|
8
|
+
enum: schema.enum ?? [],
|
|
9
|
+
...schema_1.convertSchema(schema),
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=string.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../src/converters/string.ts"],"names":[],"mappings":";;;AAEA,qCAAuC;AAE1B,QAAA,aAAa,GAAG,CAAC,MAA2B,EAAgB,EAAE,CAAC,CAAC;IAC3E,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE,MAAM,CAAC,MAAM;IACrB,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,EAAE;IACvB,GAAG,sBAAa,CAAC,MAAM,CAAC;CACzB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/extractors/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./model"), exports);
|
|
14
|
+
__exportStar(require("./schema"), exports);
|
|
15
|
+
__exportStar(require("./path"), exports);
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/extractors/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAAwB;AACxB,2CAAyB;AACzB,yCAAuB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AutomatonContext, OpenapiSchemaAllOf } from '@automatons/tools';
|
|
2
|
+
import { ExtractModel } from './type';
|
|
3
|
+
export declare const extractAllOfModel: (title: string, schema: OpenapiSchemaAllOf, context: AutomatonContext) => Promise<ExtractModel>;
|
|
4
|
+
//# sourceMappingURL=allOf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"allOf.d.ts","sourceRoot":"","sources":["../../../src/extractors/model/allOf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAE,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AAIvE,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAEpC,eAAO,MAAM,iBAAiB,UACd,MAAM,UAAU,kBAAkB,WAAW,gBAAgB,KAAG,OAAO,CAAC,YAAY,CAGjG,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractAllOfModel = void 0;
|
|
4
|
+
const allOf_1 = require("../../converters/allOf");
|
|
5
|
+
const model_1 = require("../../converters/model");
|
|
6
|
+
const of_1 = require("./of");
|
|
7
|
+
exports.extractAllOfModel = async (title, schema, context) => {
|
|
8
|
+
const { models, schemas, imports } = await of_1.extractOfModel(title, schema.allOf, context);
|
|
9
|
+
return { model: model_1.convertModel(title, allOf_1.convertAllOf(schema, schemas), imports), insides: models };
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=allOf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"allOf.js","sourceRoot":"","sources":["../../../src/extractors/model/allOf.ts"],"names":[],"mappings":";;;AACA,kDAAoD;AACpD,kDAAoD;AACpD,6BAAoC;AAGvB,QAAA,iBAAiB,GAC5B,KAAK,EAAE,KAAa,EAAE,MAA0B,EAAE,OAAyB,EAAyB,EAAE;IACpG,MAAM,EAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAC,GAAG,MAAM,mBAAc,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACtF,OAAO,EAAC,KAAK,EAAE,oBAAY,CAAC,KAAK,EAAE,oBAAY,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,MAAM,EAAC,CAAC;AAC/F,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AutomatonContext, OpenapiSchemaArray } from '@automatons/tools';
|
|
2
|
+
import { ExtractModel } from './type';
|
|
3
|
+
export declare const extractArrayModel: (title: string, schema: OpenapiSchemaArray, context: AutomatonContext) => Promise<ExtractModel>;
|
|
4
|
+
//# sourceMappingURL=array.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../src/extractors/model/array.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAE,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AAKvE,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAEpC,eAAO,MAAM,iBAAiB,UACd,MAAM,UAAU,kBAAkB,WAAW,gBAAgB,KAAG,OAAO,CAAC,YAAY,CAOjG,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractArrayModel = void 0;
|
|
4
|
+
const change_case_1 = require("change-case");
|
|
5
|
+
const array_1 = require("../../converters/array");
|
|
6
|
+
const model_1 = require("../../converters/model");
|
|
7
|
+
const schema_1 = require("../schema");
|
|
8
|
+
exports.extractArrayModel = async (title, schema, context) => {
|
|
9
|
+
if (schema.items) {
|
|
10
|
+
const { schema: shm, models, imports } = await schema_1.extractSchema(change_case_1.pascalCase([title, 'Item'].join(' ')), schema.items, context);
|
|
11
|
+
return { model: model_1.convertModel(title, array_1.convertArray(schema, shm), imports), insides: models };
|
|
12
|
+
}
|
|
13
|
+
return { model: model_1.convertModel(title, array_1.convertArray(schema)), insides: [] };
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=array.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../src/extractors/model/array.ts"],"names":[],"mappings":";;;AACA,6CAAuC;AACvC,kDAAoD;AACpD,kDAAoD;AACpD,sCAAwC;AAG3B,QAAA,iBAAiB,GAC5B,KAAK,EAAE,KAAa,EAAE,MAA0B,EAAE,OAAyB,EAAyB,EAAE;IACpG,IAAI,MAAM,CAAC,KAAK,EAAE;QAChB,MAAM,EAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAC,GAClC,MAAM,sBAAa,CAAC,wBAAU,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACpF,OAAO,EAAC,KAAK,EAAE,oBAAY,CAAC,KAAK,EAAE,oBAAY,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,MAAM,EAAC,CAAC;KAC1F;IACD,OAAO,EAAC,KAAK,EAAE,oBAAY,CAAC,KAAK,EAAE,oBAAY,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAC,CAAC;AACzE,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AutomatonContext, OpenapiSchema } from '@automatons/tools';
|
|
2
|
+
import { ExtractModel } from './type';
|
|
3
|
+
export declare const extractModel: (title: string, schema: OpenapiSchema, context: AutomatonContext) => Promise<ExtractModel>;
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extractors/model/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAUhB,aAAa,EACd,MAAM,mBAAmB,CAAC;AAU3B,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAEpC,eAAO,MAAM,YAAY,UACT,MAAM,UAAU,aAAa,WAAW,gBAAgB,KAAG,OAAO,CAAC,YAAY,CAmB5F,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractModel = void 0;
|
|
4
|
+
const tools_1 = require("@automatons/tools");
|
|
5
|
+
const boolean_1 = require("../../converters/boolean");
|
|
6
|
+
const model_1 = require("../../converters/model");
|
|
7
|
+
const number_1 = require("../../converters/number");
|
|
8
|
+
const string_1 = require("../../converters/string");
|
|
9
|
+
const allOf_1 = require("./allOf");
|
|
10
|
+
const array_1 = require("./array");
|
|
11
|
+
const object_1 = require("./object");
|
|
12
|
+
const oneOf_1 = require("./oneOf");
|
|
13
|
+
const ref_1 = require("./ref");
|
|
14
|
+
exports.extractModel = async (title, schema, context) => {
|
|
15
|
+
if (tools_1.isSchemaString(schema)) {
|
|
16
|
+
return { model: model_1.convertModel(title, string_1.convertString(schema)), insides: [] };
|
|
17
|
+
}
|
|
18
|
+
else if (tools_1.isSchemaNumber(schema) || tools_1.isSchemaInteger(schema)) {
|
|
19
|
+
return { model: model_1.convertModel(title, number_1.convertNumber(schema)), insides: [] };
|
|
20
|
+
}
|
|
21
|
+
else if (tools_1.isSchemaBoolean(schema)) {
|
|
22
|
+
return { model: model_1.convertModel(title, boolean_1.convertBoolean(schema)), insides: [] };
|
|
23
|
+
}
|
|
24
|
+
else if (tools_1.isSchemaArray(schema)) {
|
|
25
|
+
return array_1.extractArrayModel(title, schema, context);
|
|
26
|
+
}
|
|
27
|
+
else if (tools_1.isSchemaObject(schema)) {
|
|
28
|
+
return object_1.extractObjectModel(title, schema, context);
|
|
29
|
+
}
|
|
30
|
+
else if (tools_1.isSchemaAllOf(schema)) {
|
|
31
|
+
return allOf_1.extractAllOfModel(title, schema, context);
|
|
32
|
+
}
|
|
33
|
+
else if (tools_1.isSchemaOneOf(schema)) {
|
|
34
|
+
return oneOf_1.extractOneOfModel(title, schema, context);
|
|
35
|
+
}
|
|
36
|
+
else if (tools_1.isSchemaRef(schema)) {
|
|
37
|
+
return ref_1.extractRefModel(title, schema, context);
|
|
38
|
+
}
|
|
39
|
+
throw new Error(`Unknown type\n${JSON.stringify(schema, undefined, 2)}`);
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/extractors/model/index.ts"],"names":[],"mappings":";;;AAAA,6CAY2B;AAC3B,sDAAwD;AACxD,kDAAoD;AACpD,oDAAsD;AACtD,oDAAsD;AACtD,mCAA0C;AAC1C,mCAA0C;AAC1C,qCAA4C;AAC5C,mCAA0C;AAC1C,+BAAsC;AAGzB,QAAA,YAAY,GACvB,KAAK,EAAE,KAAa,EAAE,MAAqB,EAAE,OAAyB,EAAyB,EAAE;IAC/F,IAAI,sBAAc,CAAC,MAAM,CAAC,EAAE;QAC1B,OAAO,EAAC,KAAK,EAAE,oBAAY,CAAC,KAAK,EAAE,sBAAa,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAC,CAAC;KACzE;SAAM,IAAI,sBAAc,CAAC,MAAM,CAAC,IAAI,uBAAe,CAAC,MAAM,CAAC,EAAE;QAC5D,OAAO,EAAC,KAAK,EAAE,oBAAY,CAAC,KAAK,EAAE,sBAAa,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAC,CAAC;KACzE;SAAM,IAAI,uBAAe,CAAC,MAAM,CAAC,EAAE;QAClC,OAAO,EAAC,KAAK,EAAE,oBAAY,CAAC,KAAK,EAAE,wBAAc,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAC,CAAC;KAC1E;SAAM,IAAI,qBAAa,CAAC,MAAM,CAAC,EAAE;QAChC,OAAO,yBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;KAClD;SAAM,IAAI,sBAAc,CAAC,MAAM,CAAC,EAAE;QACjC,OAAO,2BAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;KACnD;SAAM,IAAI,qBAAa,CAAC,MAAM,CAAC,EAAE;QAChC,OAAO,yBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;KAClD;SAAM,IAAI,qBAAa,CAAC,MAAM,CAAC,EAAE;QAChC,OAAO,yBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;KAClD;SAAM,IAAI,mBAAW,CAAC,MAAM,CAAC,EAAE;QAC9B,OAAO,qBAAe,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;KAChD;IACD,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AAC3E,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AutomatonContext, OpenapiSchemaObject } from '@automatons/tools';
|
|
2
|
+
import { ExtractModel } from './type';
|
|
3
|
+
export declare const extractObjectModel: (title: string, schema: OpenapiSchemaObject, context: AutomatonContext) => Promise<ExtractModel>;
|
|
4
|
+
//# sourceMappingURL=object.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../../src/extractors/model/object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAE,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AAOxE,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAEpC,eAAO,MAAM,kBAAkB,UACf,MAAM,UAAU,mBAAmB,WAAW,gBAAgB,KAAG,OAAO,CAAC,YAAY,CAYlG,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractObjectModel = void 0;
|
|
4
|
+
const change_case_1 = require("change-case");
|
|
5
|
+
const map_1 = require("../../converters/map");
|
|
6
|
+
const model_1 = require("../../converters/model");
|
|
7
|
+
const object_1 = require("../../converters/object");
|
|
8
|
+
const schema_1 = require("../schema");
|
|
9
|
+
exports.extractObjectModel = async (title, schema, context) => {
|
|
10
|
+
const models = [];
|
|
11
|
+
const imports = [];
|
|
12
|
+
const propertySchemas = schema.properties;
|
|
13
|
+
const properties = await Promise.all(map_1.convertMap(propertySchemas)
|
|
14
|
+
.map(async ({ key, schema: propertySchema }) => {
|
|
15
|
+
const extractPropertySchema = await schema_1.extractSchema(change_case_1.pascalCase([title, key].join(' ')), propertySchema, context);
|
|
16
|
+
models.push(...extractPropertySchema.models);
|
|
17
|
+
imports.push(...(extractPropertySchema.imports ?? []));
|
|
18
|
+
return { name: key, required: schema.required?.includes(key) ?? false, schema: extractPropertySchema.schema };
|
|
19
|
+
}));
|
|
20
|
+
return { model: model_1.convertModel(title, object_1.convertObjectSchema(schema, properties), imports), insides: models };
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=object.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../../src/extractors/model/object.ts"],"names":[],"mappings":";;;AACA,6CAAuC;AACvC,8CAAgD;AAChD,kDAAoD;AACpD,oDAA4D;AAE5D,sCAAwC;AAG3B,QAAA,kBAAkB,GAC7B,KAAK,EAAE,KAAa,EAAE,MAA2B,EAAE,OAAyB,EAAyB,EAAE;IACrG,MAAM,MAAM,GAAY,EAAE,CAAC;IAC3B,MAAM,OAAO,GAAY,EAAE,CAAC;IAC5B,MAAM,eAAe,GAAG,MAAM,CAAC,UAAU,CAAC;IAC1C,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,gBAAU,CAAC,eAAe,CAAC;SAC7D,GAAG,CAAC,KAAK,EAAE,EAAC,GAAG,EAAE,MAAM,EAAE,cAAc,EAAC,EAAE,EAAE;QAC3C,MAAM,qBAAqB,GAAG,MAAM,sBAAa,CAAC,wBAAU,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;QAC/G,MAAM,CAAC,IAAI,CAAC,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;QAC7C,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC;QACvD,OAAO,EAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,KAAK,EAAE,MAAM,EAAE,qBAAqB,CAAC,MAAM,EAAC,CAAC;IAC9G,CAAC,CAAC,CAAC,CAAC;IACN,OAAO,EAAC,KAAK,EAAE,oBAAY,CAAC,KAAK,EAAE,4BAAmB,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,MAAM,EAAC,CAAC;AACzG,CAAC,CAAC"}
|