@skmtc/core 0.0.223 → 0.0.225
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/{script → esm}/_dnt.polyfills.js +1 -2
- package/{script → esm}/_dnt.shims.js +4 -8
- package/{script → esm}/context/CoreContext.js +24 -28
- package/{script → esm}/context/GenerateContext.js +13 -17
- package/{script → esm}/context/LogStore.js +1 -5
- package/{script → esm}/context/ParseContext.js +1 -5
- package/{script → esm}/context/RenderContext.js +17 -47
- package/{script → esm}/context/Trail.js +1 -5
- package/esm/context/types.js +1 -0
- package/{script → esm}/deps/jsr.io/@std/encoding/1.0.1/_validate_binary_like.js +1 -4
- package/{script → esm}/deps/jsr.io/@std/encoding/1.0.1/ascii85.js +4 -8
- package/{script → esm}/deps/jsr.io/@std/encoding/1.0.1/base32.js +4 -8
- package/{script → esm}/deps/jsr.io/@std/encoding/1.0.1/base58.js +4 -8
- package/{script → esm}/deps/jsr.io/@std/encoding/1.0.1/base64.js +4 -8
- package/{script → esm}/deps/jsr.io/@std/encoding/1.0.1/base64url.js +3 -30
- package/{script → esm}/deps/jsr.io/@std/encoding/1.0.1/hex.js +4 -8
- package/esm/deps/jsr.io/@std/encoding/1.0.1/mod.js +22 -0
- package/{script → esm}/deps/jsr.io/@std/encoding/1.0.1/varint.js +8 -14
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/_common/assert_path.js +1 -4
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/_common/basename.js +5 -10
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/_common/common.js +1 -4
- package/esm/deps/jsr.io/@std/path/1.0.0/_common/constants.js +46 -0
- package/esm/deps/jsr.io/@std/path/1.0.0/_common/dirname.js +8 -0
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/_common/format.js +2 -6
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/_common/from_file_url.js +1 -4
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/_common/glob_to_reg_exp.js +1 -4
- package/esm/deps/jsr.io/@std/path/1.0.0/_common/normalize.js +8 -0
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/_common/normalize_string.js +6 -9
- package/esm/deps/jsr.io/@std/path/1.0.0/_common/relative.js +9 -0
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/_common/strip_trailing_separators.js +1 -4
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/_common/to_file_url.js +1 -4
- package/esm/deps/jsr.io/@std/path/1.0.0/_os.js +14 -0
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/basename.js +7 -10
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/common.js +4 -7
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/constants.js +4 -7
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/dirname.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/extname.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/format.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/from_file_url.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/glob_to_regexp.js +7 -10
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/is_absolute.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/is_glob.js +1 -4
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/join.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/join_globs.js +7 -10
- package/esm/deps/jsr.io/@std/path/1.0.0/mod.js +54 -0
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/normalize.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/normalize_glob.js +7 -10
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/parse.js +5 -8
- package/esm/deps/jsr.io/@std/path/1.0.0/posix/_util.js +8 -0
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/basename.js +8 -11
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/constants.js +3 -6
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/dirname.js +8 -11
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/extname.js +7 -10
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/format.js +4 -7
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/from_file_url.js +3 -6
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/glob_to_regexp.js +3 -6
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/is_absolute.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/join.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/join_globs.js +7 -10
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/normalize.js +8 -11
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/normalize_glob.js +6 -9
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/parse.js +10 -13
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/relative.js +14 -17
- package/esm/deps/jsr.io/@std/path/1.0.0/posix/resolve.js +59 -0
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/to_file_url.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/to_namespaced_path.js +1 -4
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/relative.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/resolve.js +7 -10
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/to_file_url.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/to_namespaced_path.js +7 -10
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/types.js +1 -2
- package/esm/deps/jsr.io/@std/path/1.0.0/windows/_util.js +15 -0
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/basename.js +11 -14
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/constants.js +3 -6
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/dirname.js +17 -20
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/extname.js +9 -12
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/format.js +4 -7
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/from_file_url.js +3 -6
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/glob_to_regexp.js +3 -6
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/is_absolute.js +9 -12
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/join.js +10 -13
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/join_globs.js +7 -10
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/normalize.js +17 -20
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/normalize_glob.js +6 -9
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/parse.js +16 -19
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/relative.js +16 -19
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/resolve.js +17 -43
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/to_file_url.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/to_namespaced_path.js +11 -14
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_dumper/dumper.js +10 -36
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_dumper/dumper_state.js +2 -6
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_error.js +1 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_loader/loader.js +9 -36
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_loader/loader_state.js +2 -6
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_mark.js +3 -7
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_state.js +3 -7
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/binary.js +2 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/bool.js +4 -7
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/float.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/function.js +2 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/int.js +4 -7
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/map.js +2 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/merge.js +2 -5
- package/esm/deps/jsr.io/@std/yaml/0.215.0/_type/mod.js +20 -0
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/nil.js +2 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/omap.js +2 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/pairs.js +2 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/regexp.js +2 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/seq.js +2 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/set.js +2 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/str.js +2 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/timestamp.js +2 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/undefined.js +2 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_utils.js +15 -32
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/mod.js +4 -20
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/parse.js +5 -9
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/schema/core.js +4 -7
- package/esm/deps/jsr.io/@std/yaml/0.215.0/schema/default.js +15 -0
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/schema/extended.js +6 -9
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/schema/failsafe.js +4 -7
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/schema/json.js +6 -9
- package/esm/deps/jsr.io/@std/yaml/0.215.0/schema/mod.js +10 -0
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/schema.js +3 -7
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/stringify.js +3 -6
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/type.js +1 -5
- package/{script → esm}/dsl/ContentSettings.js +1 -5
- package/{script → esm}/dsl/Definition.js +4 -8
- package/{script → esm}/dsl/GeneratedValueList.js +3 -7
- package/{script → esm}/dsl/Identifier.js +8 -12
- package/{script → esm}/dsl/Import.js +2 -7
- package/esm/dsl/ModelCreator.js +1 -0
- package/{script → esm}/dsl/ModelDriver.js +14 -18
- package/esm/dsl/OperationCreator.js +1 -0
- package/{script → esm}/dsl/OperationDriver.js +11 -15
- package/esm/dsl/Stringable.js +1 -0
- package/{script → esm}/dsl/ValueBase.js +1 -5
- package/{script → esm}/dsl/base.js +5 -13
- package/esm/dsl/constants.js +1 -0
- package/{script → esm}/dsl/withConfig.js +9 -15
- package/esm/generate/generate.js +47 -0
- package/esm/generate/generateModels.js +29 -0
- package/esm/generate/generateOperations.js +35 -0
- package/{script → esm}/helpers/logStatus.js +2 -7
- package/esm/helpers/naming.js +25 -0
- package/esm/helpers/refFns.js +24 -0
- package/esm/helpers/strings.js +6 -0
- package/{script → esm}/helpers/verifyType.js +1 -4
- package/esm/mod.js +61 -0
- package/{script → esm}/oas/array/Array.js +2 -6
- package/esm/oas/array/array-types.js +17 -0
- package/esm/oas/array/toArray.js +20 -0
- package/{script → esm}/oas/boolean/Boolean.js +2 -6
- package/esm/oas/boolean/boolean-types.js +8 -0
- package/esm/oas/boolean/toBoolean.js +10 -0
- package/{script → esm}/oas/components/Components.js +2 -6
- package/esm/oas/components/toComponentsV3.js +44 -0
- package/esm/oas/contact/contact-types.js +7 -0
- package/{script → esm}/oas/discriminator/Discriminator.js +2 -6
- package/esm/oas/discriminator/discriminator-types.js +6 -0
- package/esm/oas/discriminator/toDiscriminatorV3.js +11 -0
- package/{script → esm}/oas/document/Document.js +2 -6
- package/esm/oas/document/toDocumentV3.js +24 -0
- package/{script → esm}/oas/example/Example.js +2 -6
- package/esm/oas/example/example-types.js +9 -0
- package/esm/oas/example/toExamplesV3.js +45 -0
- package/{script → esm}/oas/header/Header.js +2 -6
- package/esm/oas/header/toHeadersV3.js +42 -0
- package/{script → esm}/oas/info/Info.js +2 -6
- package/{script → esm}/oas/info/toInfoV3.js +3 -7
- package/{script → esm}/oas/integer/Integer.js +2 -6
- package/esm/oas/integer/integer-types.js +18 -0
- package/esm/oas/integer/toInteger.js +13 -0
- package/{script → esm}/oas/intersection/Intersection.js +2 -6
- package/esm/oas/intersection/intersection-types.js +12 -0
- package/esm/oas/intersection/toIntersection.js +22 -0
- package/esm/oas/license/license-types.js +7 -0
- package/esm/oas/markdown/markdown-types.js +2 -0
- package/{script → esm}/oas/mediaType/MediaType.js +2 -6
- package/esm/oas/mediaType/mediaType-types.js +12 -0
- package/esm/oas/mediaType/toMediaTypeItemV3.js +37 -0
- package/esm/oas/null/null-types.js +8 -0
- package/{script → esm}/oas/number/Number.js +2 -6
- package/esm/oas/number/number-types.js +14 -0
- package/esm/oas/number/toNumber.js +10 -0
- package/{script → esm}/oas/object/Object.js +4 -8
- package/esm/oas/object/object-types.js +27 -0
- package/esm/oas/object/toAdditionalPropertiesV3.js +14 -0
- package/esm/oas/object/toObject.js +23 -0
- package/{script → esm}/oas/operation/Operation.js +2 -6
- package/{script → esm}/oas/operation/toOperationsV3.js +13 -18
- package/{script → esm}/oas/parameter/Parameter.js +2 -6
- package/esm/oas/parameter/parameter-types.js +38 -0
- package/{script → esm}/oas/parameter/toParameterV3.js +22 -28
- package/{script → esm}/oas/pathItem/PathItem.js +2 -6
- package/esm/oas/pathItem/toPathItemV3.js +15 -0
- package/{script → esm}/oas/ref/Ref.js +6 -10
- package/esm/oas/ref/ref-types.js +54 -0
- package/esm/oas/ref/toRefV31.js +11 -0
- package/{script → esm}/oas/requestBody/RequestBody.js +2 -6
- package/esm/oas/requestBody/toRequestBodiesV3.js +46 -0
- package/{script → esm}/oas/response/Response.js +2 -6
- package/esm/oas/response/toResponseV3.js +35 -0
- package/esm/oas/schema/Schema.js +1 -0
- package/esm/oas/schema/schema-types.js +23 -0
- package/esm/oas/schema/toSchemasV3.js +60 -0
- package/{script → esm}/oas/string/String.js +2 -6
- package/esm/oas/string/string-types.js +29 -0
- package/esm/oas/string/toString.js +11 -0
- package/{script → esm}/oas/tag/Tag.js +2 -6
- package/esm/oas/tag/toTagsV3.js +14 -0
- package/{script → esm}/oas/union/Union.js +2 -6
- package/esm/oas/union/toUnion.js +22 -0
- package/esm/oas/union/union-types.js +12 -0
- package/{script → esm}/oas/unknown/Unknown.js +2 -6
- package/esm/oas/unknown/toUnknown.js +9 -0
- package/esm/oas/unknown/unknown-types.js +8 -0
- package/{script → esm}/oas/void/Void.js +4 -8
- package/{script → esm}/oas-elements/OasBase.js +1 -5
- package/esm/package.json +3 -0
- package/esm/parse/parse.js +16 -0
- package/{script → esm}/schemas/client.js +2 -4
- package/{script → esm}/server/createServer.js +24 -51
- package/esm/types/Brand.js +1 -0
- package/{script → esm}/types/CustomValue.js +3 -8
- package/esm/types/GeneratedValue.js +1 -0
- package/{script → esm}/types/GenerationType.js +1 -2
- package/esm/types/GeneratorKeys.js +13 -0
- package/esm/types/Method.js +32 -0
- package/esm/types/Modifiers.js +1 -0
- package/esm/types/RefName.js +1 -0
- package/esm/types/Settings.js +42 -0
- package/esm/types/TypeSystem.js +1 -0
- package/esm/types/prettierConfig.js +46 -0
- package/{script → esm}/typescript/EntityType.js +3 -7
- package/{script → esm}/typescript/FunctionParameter.js +10 -17
- package/{script → esm}/typescript/ReactRouterPathParams.js +2 -6
- package/esm/typescript/identifiers.js +7 -0
- package/esm/typescript/keyValues.js +11 -0
- package/{script → esm}/typescript/toDestructuredObject.js +1 -5
- package/{script → esm}/typescript/toOperationArg.js +7 -14
- package/esm/typescript/toOperationResponse.js +17 -0
- package/esm/typescript/toParamsObject.js +12 -0
- package/esm/typescript/toPathTemplate.js +3 -0
- package/esm/typescript/withDescription.js +3 -0
- package/package.json +14 -8
- package/types/types/Method.d.ts +1 -0
- package/types/types/Method.d.ts.map +1 -1
- package/script/context/types.js +0 -2
- package/script/deps/jsr.io/@std/encoding/1.0.1/mod.js +0 -38
- package/script/deps/jsr.io/@std/path/1.0.0/_common/constants.js +0 -49
- package/script/deps/jsr.io/@std/path/1.0.0/_common/dirname.js +0 -11
- package/script/deps/jsr.io/@std/path/1.0.0/_common/normalize.js +0 -11
- package/script/deps/jsr.io/@std/path/1.0.0/_common/relative.js +0 -12
- package/script/deps/jsr.io/@std/path/1.0.0/_os.js +0 -40
- package/script/deps/jsr.io/@std/path/1.0.0/mod.js +0 -70
- package/script/deps/jsr.io/@std/path/1.0.0/posix/_util.js +0 -11
- package/script/deps/jsr.io/@std/path/1.0.0/posix/resolve.js +0 -85
- package/script/deps/jsr.io/@std/path/1.0.0/windows/_util.js +0 -20
- package/script/deps/jsr.io/@std/yaml/0.215.0/_type/mod.js +0 -39
- package/script/deps/jsr.io/@std/yaml/0.215.0/schema/default.js +0 -18
- package/script/deps/jsr.io/@std/yaml/0.215.0/schema/mod.js +0 -18
- package/script/dsl/ModelCreator.js +0 -2
- package/script/dsl/OperationCreator.js +0 -2
- package/script/dsl/Stringable.js +0 -2
- package/script/dsl/constants.js +0 -4
- package/script/generate/generate.js +0 -75
- package/script/generate/generateModels.js +0 -56
- package/script/generate/generateOperations.js +0 -62
- package/script/helpers/naming.js +0 -33
- package/script/helpers/refFns.js +0 -30
- package/script/helpers/strings.js +0 -11
- package/script/mod.js +0 -77
- package/script/oas/array/array-types.js +0 -20
- package/script/oas/array/toArray.js +0 -24
- package/script/oas/boolean/boolean-types.js +0 -11
- package/script/oas/boolean/toBoolean.js +0 -14
- package/script/oas/components/toComponentsV3.js +0 -48
- package/script/oas/contact/contact-types.js +0 -10
- package/script/oas/discriminator/discriminator-types.js +0 -9
- package/script/oas/discriminator/toDiscriminatorV3.js +0 -15
- package/script/oas/document/toDocumentV3.js +0 -28
- package/script/oas/example/example-types.js +0 -12
- package/script/oas/example/toExamplesV3.js +0 -51
- package/script/oas/header/toHeadersV3.js +0 -46
- package/script/oas/integer/integer-types.js +0 -21
- package/script/oas/integer/toInteger.js +0 -17
- package/script/oas/intersection/intersection-types.js +0 -15
- package/script/oas/intersection/toIntersection.js +0 -26
- package/script/oas/license/license-types.js +0 -10
- package/script/oas/markdown/markdown-types.js +0 -5
- package/script/oas/mediaType/mediaType-types.js +0 -15
- package/script/oas/mediaType/toMediaTypeItemV3.js +0 -43
- package/script/oas/null/null-types.js +0 -11
- package/script/oas/number/number-types.js +0 -17
- package/script/oas/number/toNumber.js +0 -14
- package/script/oas/object/object-types.js +0 -30
- package/script/oas/object/toAdditionalPropertiesV3.js +0 -18
- package/script/oas/object/toObject.js +0 -27
- package/script/oas/parameter/parameter-types.js +0 -41
- package/script/oas/pathItem/toPathItemV3.js +0 -19
- package/script/oas/ref/ref-types.js +0 -57
- package/script/oas/ref/toRefV31.js +0 -15
- package/script/oas/requestBody/toRequestBodiesV3.js +0 -51
- package/script/oas/response/toResponseV3.js +0 -41
- package/script/oas/schema/Schema.js +0 -2
- package/script/oas/schema/schema-types.js +0 -26
- package/script/oas/schema/toSchemasV3.js +0 -67
- package/script/oas/string/string-types.js +0 -32
- package/script/oas/string/toString.js +0 -15
- package/script/oas/tag/toTagsV3.js +0 -18
- package/script/oas/union/toUnion.js +0 -26
- package/script/oas/union/union-types.js +0 -15
- package/script/oas/unknown/toUnknown.js +0 -13
- package/script/oas/unknown/unknown-types.js +0 -11
- package/script/package.json +0 -3
- package/script/parse/parse.js +0 -20
- package/script/types/Brand.js +0 -2
- package/script/types/GeneratedValue.js +0 -2
- package/script/types/GeneratorKeys.js +0 -19
- package/script/types/Method.js +0 -34
- package/script/types/Modifiers.js +0 -2
- package/script/types/RefName.js +0 -2
- package/script/types/Settings.js +0 -45
- package/script/types/TypeSystem.js +0 -2
- package/script/types/prettierConfig.js +0 -49
- package/script/typescript/identifiers.js +0 -12
- package/script/typescript/keyValues.js +0 -15
- package/script/typescript/toOperationResponse.js +0 -21
- package/script/typescript/toParamsObject.js +0 -16
- package/script/typescript/toPathTemplate.js +0 -7
- package/script/typescript/withDescription.js +0 -7
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.GeneratedValueList = void 0;
|
|
4
|
-
const constants_js_1 = require("./constants.js");
|
|
5
|
-
class GeneratedValueList {
|
|
1
|
+
import { EMPTY } from './constants.js';
|
|
2
|
+
export class GeneratedValueList {
|
|
6
3
|
constructor(separator) {
|
|
7
4
|
Object.defineProperty(this, "separator", {
|
|
8
5
|
enumerable: true,
|
|
@@ -24,8 +21,7 @@ class GeneratedValueList {
|
|
|
24
21
|
toString() {
|
|
25
22
|
return this.items
|
|
26
23
|
.map(item => item.toString())
|
|
27
|
-
.filter(item => item !==
|
|
24
|
+
.filter(item => item !== EMPTY)
|
|
28
25
|
.join(this.separator);
|
|
29
26
|
}
|
|
30
27
|
}
|
|
31
|
-
exports.GeneratedValueList = GeneratedValueList;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const EntityType_js_1 = require("../typescript/EntityType.js");
|
|
5
|
-
const ts_pattern_1 = require("ts-pattern");
|
|
6
|
-
class Identifier {
|
|
1
|
+
import { EntityType } from '../typescript/EntityType.js';
|
|
2
|
+
import { P, match } from 'ts-pattern';
|
|
3
|
+
export class Identifier {
|
|
7
4
|
constructor({ name, tsType, entityType }) {
|
|
8
5
|
Object.defineProperty(this, "name", {
|
|
9
6
|
enumerable: true,
|
|
@@ -28,29 +25,28 @@ class Identifier {
|
|
|
28
25
|
this.entityType = entityType;
|
|
29
26
|
}
|
|
30
27
|
static createValue(args) {
|
|
31
|
-
return
|
|
32
|
-
.with(
|
|
28
|
+
return match(args)
|
|
29
|
+
.with(P.string, name => {
|
|
33
30
|
return new Identifier({
|
|
34
31
|
name,
|
|
35
|
-
entityType: new
|
|
32
|
+
entityType: new EntityType('value')
|
|
36
33
|
});
|
|
37
34
|
})
|
|
38
35
|
.otherwise(({ name, tsType }) => {
|
|
39
36
|
return new Identifier({
|
|
40
37
|
name,
|
|
41
38
|
tsType,
|
|
42
|
-
entityType: new
|
|
39
|
+
entityType: new EntityType('value')
|
|
43
40
|
});
|
|
44
41
|
});
|
|
45
42
|
}
|
|
46
43
|
static createType(name) {
|
|
47
44
|
return new Identifier({
|
|
48
45
|
name,
|
|
49
|
-
entityType: new
|
|
46
|
+
entityType: new EntityType('type')
|
|
50
47
|
});
|
|
51
48
|
}
|
|
52
49
|
toString() {
|
|
53
50
|
return this.name;
|
|
54
51
|
}
|
|
55
52
|
}
|
|
56
|
-
exports.Identifier = Identifier;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ImportName = exports.Import = void 0;
|
|
4
|
-
class Import {
|
|
1
|
+
export class Import {
|
|
5
2
|
constructor({ module, importNames }) {
|
|
6
3
|
Object.defineProperty(this, "module", {
|
|
7
4
|
enumerable: true,
|
|
@@ -29,8 +26,7 @@ class Import {
|
|
|
29
26
|
return `import { ${this.importNames.join(', ')} } from '${this.module}'`;
|
|
30
27
|
}
|
|
31
28
|
}
|
|
32
|
-
|
|
33
|
-
class ImportName {
|
|
29
|
+
export class ImportName {
|
|
34
30
|
constructor(name) {
|
|
35
31
|
Object.defineProperty(this, "name", {
|
|
36
32
|
enumerable: true,
|
|
@@ -57,4 +53,3 @@ class ImportName {
|
|
|
57
53
|
return this.alias ? `${this.name} as ${this.alias}` : this.name;
|
|
58
54
|
}
|
|
59
55
|
}
|
|
60
|
-
exports.ImportName = ImportName;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const ts_pattern_1 = require("ts-pattern");
|
|
9
|
-
const verifyType_js_1 = require("../helpers/verifyType.js");
|
|
10
|
-
class ModelDriver {
|
|
1
|
+
import { ContentSettings } from './ContentSettings.js';
|
|
2
|
+
import { normalize } from '../deps/jsr.io/@std/path/1.0.0/mod.js';
|
|
3
|
+
import { Definition } from './Definition.js';
|
|
4
|
+
import { Identifier } from './Identifier.js';
|
|
5
|
+
import { match } from 'ts-pattern';
|
|
6
|
+
import { verifyType } from '../helpers/verifyType.js';
|
|
7
|
+
export class ModelDriver {
|
|
11
8
|
constructor({ context, creator, refName, generation, destinationPath }) {
|
|
12
9
|
Object.defineProperty(this, "context", {
|
|
13
10
|
enumerable: true,
|
|
@@ -74,7 +71,7 @@ class ModelDriver {
|
|
|
74
71
|
}
|
|
75
72
|
const definition = this.getDefinition({ name, exportPath });
|
|
76
73
|
if (destinationPath &&
|
|
77
|
-
|
|
74
|
+
normalize(exportPath) !== normalize(destinationPath)) {
|
|
78
75
|
this.context.register({
|
|
79
76
|
imports: { [importFrom]: [name] },
|
|
80
77
|
destinationPath
|
|
@@ -85,7 +82,7 @@ class ModelDriver {
|
|
|
85
82
|
getDefinition({ name, exportPath }) {
|
|
86
83
|
const existing = this.context.pick({ name, exportPath });
|
|
87
84
|
if (existing) {
|
|
88
|
-
|
|
85
|
+
verifyType(existing.value, this.creator);
|
|
89
86
|
return existing;
|
|
90
87
|
}
|
|
91
88
|
const value = new this.creator({
|
|
@@ -101,11 +98,11 @@ class ModelDriver {
|
|
|
101
98
|
typeof value.tsType === 'string'
|
|
102
99
|
? value.tsType
|
|
103
100
|
: undefined;
|
|
104
|
-
const identifier =
|
|
105
|
-
.with('value', () =>
|
|
106
|
-
.with('type', () =>
|
|
101
|
+
const identifier = match(this.creator.entityType.type)
|
|
102
|
+
.with('value', () => Identifier.createValue({ name, tsType }))
|
|
103
|
+
.with('type', () => Identifier.createType(name))
|
|
107
104
|
.exhaustive();
|
|
108
|
-
const definition = new
|
|
105
|
+
const definition = new Definition({
|
|
109
106
|
context: this.context,
|
|
110
107
|
value,
|
|
111
108
|
identifier
|
|
@@ -122,7 +119,7 @@ class ModelDriver {
|
|
|
122
119
|
refName
|
|
123
120
|
});
|
|
124
121
|
const e = creator.toExportPath({ refName, baseSettings });
|
|
125
|
-
return new
|
|
122
|
+
return new ContentSettings({
|
|
126
123
|
name: creator.toName({ refName, baseSettings }),
|
|
127
124
|
selected: creator.isSelected({ refName, baseSettings }),
|
|
128
125
|
exportPath: e,
|
|
@@ -130,4 +127,3 @@ class ModelDriver {
|
|
|
130
127
|
});
|
|
131
128
|
}
|
|
132
129
|
}
|
|
133
|
-
exports.ModelDriver = ModelDriver;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const Identifier_js_1 = require("./Identifier.js");
|
|
8
|
-
const verifyType_js_1 = require("../helpers/verifyType.js");
|
|
9
|
-
class OperationDriver {
|
|
1
|
+
import { ContentSettings } from './ContentSettings.js';
|
|
2
|
+
import { normalize } from '../deps/jsr.io/@std/path/1.0.0/mod.js';
|
|
3
|
+
import { Definition } from './Definition.js';
|
|
4
|
+
import { Identifier } from './Identifier.js';
|
|
5
|
+
import { verifyType } from '../helpers/verifyType.js';
|
|
6
|
+
export class OperationDriver {
|
|
10
7
|
constructor({ context, creator, operation, generation, destinationPath }) {
|
|
11
8
|
Object.defineProperty(this, "context", {
|
|
12
9
|
enumerable: true,
|
|
@@ -76,7 +73,7 @@ class OperationDriver {
|
|
|
76
73
|
}
|
|
77
74
|
const definition = this.getDefinition({ name, exportPath });
|
|
78
75
|
if (destinationPath &&
|
|
79
|
-
|
|
76
|
+
normalize(exportPath) !== normalize(destinationPath)) {
|
|
80
77
|
this.context.register({
|
|
81
78
|
imports: { [importFrom]: [name] },
|
|
82
79
|
destinationPath
|
|
@@ -88,7 +85,7 @@ class OperationDriver {
|
|
|
88
85
|
// @TODO Throw error if output was generated using a different creator or operation
|
|
89
86
|
const existing = this.context.pick({ name, exportPath });
|
|
90
87
|
if (existing) {
|
|
91
|
-
|
|
88
|
+
verifyType(existing.value, this.creator);
|
|
92
89
|
return existing;
|
|
93
90
|
}
|
|
94
91
|
const value = new this.creator({
|
|
@@ -100,10 +97,10 @@ class OperationDriver {
|
|
|
100
97
|
const tsType = 'tsType' in value && typeof value.tsType === 'string'
|
|
101
98
|
? value.tsType
|
|
102
99
|
: undefined;
|
|
103
|
-
const definition = new
|
|
100
|
+
const definition = new Definition({
|
|
104
101
|
context: this.context,
|
|
105
102
|
value,
|
|
106
|
-
identifier:
|
|
103
|
+
identifier: Identifier.createValue({ name, tsType })
|
|
107
104
|
});
|
|
108
105
|
this.context.register({
|
|
109
106
|
definitions: [definition],
|
|
@@ -118,7 +115,7 @@ class OperationDriver {
|
|
|
118
115
|
method: operation.method
|
|
119
116
|
});
|
|
120
117
|
const e = creator.toExportPath({ operation, baseSettings });
|
|
121
|
-
return new
|
|
118
|
+
return new ContentSettings({
|
|
122
119
|
name: creator.toName({ operation, baseSettings }),
|
|
123
120
|
selected: creator.isSelected({ operation, baseSettings }),
|
|
124
121
|
exportPath: e,
|
|
@@ -126,4 +123,3 @@ class OperationDriver {
|
|
|
126
123
|
});
|
|
127
124
|
}
|
|
128
125
|
}
|
|
129
|
-
exports.OperationDriver = OperationDriver;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ValueBase = void 0;
|
|
4
|
-
class ValueBase {
|
|
1
|
+
export class ValueBase {
|
|
5
2
|
constructor({ context, generatorKey }) {
|
|
6
3
|
Object.defineProperty(this, "context", {
|
|
7
4
|
enumerable: true,
|
|
@@ -29,7 +26,6 @@ class ValueBase {
|
|
|
29
26
|
this.context.register(args);
|
|
30
27
|
}
|
|
31
28
|
}
|
|
32
|
-
exports.ValueBase = ValueBase;
|
|
33
29
|
const proxyHandler = {
|
|
34
30
|
get: (target, propertyName) => {
|
|
35
31
|
return propertyName === 'toString'
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ModelBase = exports.OperationBase = void 0;
|
|
7
|
-
const ValueBase_js_1 = require("./ValueBase.js");
|
|
8
|
-
const tiny_invariant_1 = __importDefault(require("tiny-invariant"));
|
|
9
|
-
class OperationBase extends ValueBase_js_1.ValueBase {
|
|
1
|
+
import { ValueBase } from './ValueBase.js';
|
|
2
|
+
import invariant from 'tiny-invariant';
|
|
3
|
+
export class OperationBase extends ValueBase {
|
|
10
4
|
constructor({ context, generatorKey, settings, operation }) {
|
|
11
5
|
super({ context, generatorKey });
|
|
12
6
|
Object.defineProperty(this, "settings", {
|
|
@@ -30,7 +24,7 @@ class OperationBase extends ValueBase_js_1.ValueBase {
|
|
|
30
24
|
generation: 'force',
|
|
31
25
|
destinationPath: this.settings.exportPath
|
|
32
26
|
});
|
|
33
|
-
(
|
|
27
|
+
invariant(definition, 'Definition is required');
|
|
34
28
|
return { settings, definition };
|
|
35
29
|
}
|
|
36
30
|
register(args) {
|
|
@@ -40,8 +34,7 @@ class OperationBase extends ValueBase_js_1.ValueBase {
|
|
|
40
34
|
});
|
|
41
35
|
}
|
|
42
36
|
}
|
|
43
|
-
|
|
44
|
-
class ModelBase extends ValueBase_js_1.ValueBase {
|
|
37
|
+
export class ModelBase extends ValueBase {
|
|
45
38
|
constructor({ context, settings, generatorKey, refName }) {
|
|
46
39
|
super({ context, generatorKey });
|
|
47
40
|
Object.defineProperty(this, "settings", {
|
|
@@ -73,4 +66,3 @@ class ModelBase extends ValueBase_js_1.ValueBase {
|
|
|
73
66
|
});
|
|
74
67
|
}
|
|
75
68
|
}
|
|
76
|
-
exports.ModelBase = ModelBase;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const EMPTY = '__EMPTY__';
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const GeneratorKeys_js_1 = require("../types/GeneratorKeys.js");
|
|
5
|
-
const base_js_1 = require("./base.js");
|
|
6
|
-
const toOperationCreatorBase = (config) => {
|
|
1
|
+
import { toOperationGeneratorKey, toModelGeneratorKey } from '../types/GeneratorKeys.js';
|
|
2
|
+
import { OperationBase, ModelBase } from './base.js';
|
|
3
|
+
export const toOperationCreatorBase = (config) => {
|
|
7
4
|
var _a;
|
|
8
|
-
return _a = class extends
|
|
5
|
+
return _a = class extends OperationBase {
|
|
9
6
|
constructor(args) {
|
|
10
7
|
super({
|
|
11
8
|
...args,
|
|
12
|
-
generatorKey:
|
|
9
|
+
generatorKey: toOperationGeneratorKey({
|
|
13
10
|
generatorId: config.id,
|
|
14
11
|
operation: args.operation
|
|
15
12
|
})
|
|
@@ -42,14 +39,13 @@ const toOperationCreatorBase = (config) => {
|
|
|
42
39
|
}),
|
|
43
40
|
_a;
|
|
44
41
|
};
|
|
45
|
-
|
|
46
|
-
const toModelCreatorBase = (config) => {
|
|
42
|
+
export const toModelCreatorBase = (config) => {
|
|
47
43
|
var _a;
|
|
48
|
-
return _a = class extends
|
|
44
|
+
return _a = class extends ModelBase {
|
|
49
45
|
constructor(args) {
|
|
50
46
|
super({
|
|
51
47
|
...args,
|
|
52
|
-
generatorKey:
|
|
48
|
+
generatorKey: toModelGeneratorKey({
|
|
53
49
|
generatorId: config.id,
|
|
54
50
|
refName: args.refName
|
|
55
51
|
})
|
|
@@ -94,8 +90,7 @@ const toModelCreatorBase = (config) => {
|
|
|
94
90
|
}),
|
|
95
91
|
_a;
|
|
96
92
|
};
|
|
97
|
-
|
|
98
|
-
const toGeneratorBase = (config) => {
|
|
93
|
+
export const toGeneratorBase = (config) => {
|
|
99
94
|
var _a;
|
|
100
95
|
return _a = class {
|
|
101
96
|
constructor({ context }) {
|
|
@@ -128,4 +123,3 @@ const toGeneratorBase = (config) => {
|
|
|
128
123
|
}),
|
|
129
124
|
_a;
|
|
130
125
|
};
|
|
131
|
-
exports.toGeneratorBase = toGeneratorBase;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as Sentry from '@sentry/deno';
|
|
2
|
+
import { oasToSkmtc } from '../parse/parse.js';
|
|
3
|
+
import { ParseContext } from '../context/ParseContext.js';
|
|
4
|
+
import { CoreContext } from '../context/CoreContext.js';
|
|
5
|
+
import { generateModels } from './generateModels.js';
|
|
6
|
+
import { generateOperations } from './generateOperations.js';
|
|
7
|
+
import { parse as parseYaml } from '../deps/jsr.io/@std/yaml/0.215.0/mod.js';
|
|
8
|
+
export const generate = async ({ schema, settings, prettier, generatorsMap }) => {
|
|
9
|
+
const parsedDocument = Sentry.startSpan({ name: 'Parse schema to document' }, () => parseSchema(schema));
|
|
10
|
+
const parseContext = new ParseContext({
|
|
11
|
+
parsedDocument
|
|
12
|
+
});
|
|
13
|
+
const context = new CoreContext({
|
|
14
|
+
phase: { type: 'parse', context: parseContext }
|
|
15
|
+
});
|
|
16
|
+
const schemaModel = Sentry.startSpan({ name: 'Schema document to object' }, () => oasToSkmtc(context));
|
|
17
|
+
if (!schemaModel.openapi.startsWith('3.0.')) {
|
|
18
|
+
throw new Error('Only OpenAPI v3 is supported');
|
|
19
|
+
}
|
|
20
|
+
context.setupGeneratePhase({
|
|
21
|
+
schemaModel,
|
|
22
|
+
generatorsMap,
|
|
23
|
+
settings
|
|
24
|
+
});
|
|
25
|
+
Sentry.startSpan({ name: 'Generate operations' }, () => generateOperations(context));
|
|
26
|
+
Sentry.startSpan({ name: 'Generate models' }, () => generateModels(context));
|
|
27
|
+
context.setupRenderPhase({
|
|
28
|
+
files: context.files,
|
|
29
|
+
renderDependencies: context.renderDependencies,
|
|
30
|
+
packageDependencies: context.packageDependencies,
|
|
31
|
+
pinnableGenerators: Object.values(generatorsMap)
|
|
32
|
+
.map(({ id, pinnable }) => (pinnable ? id : null))
|
|
33
|
+
.filter(generatorId => generatorId !== null),
|
|
34
|
+
prettier,
|
|
35
|
+
settings
|
|
36
|
+
});
|
|
37
|
+
const renderResult = await Sentry.startSpan({ name: 'Render artifacts' }, async () => await context.render({}));
|
|
38
|
+
return renderResult;
|
|
39
|
+
};
|
|
40
|
+
export const parseSchema = (schema) => {
|
|
41
|
+
if (schema.trimStart().startsWith('{')) {
|
|
42
|
+
return JSON.parse(schema);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
return parseYaml(schema);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { logModelStatus } from '../helpers/logStatus.js';
|
|
2
|
+
import * as Sentry from '@sentry/deno';
|
|
3
|
+
export const generateModels = (context) => {
|
|
4
|
+
const { schemaModel, generatorsMap } = context;
|
|
5
|
+
Object.values(generatorsMap)
|
|
6
|
+
.filter(generator => generator.type === 'model')
|
|
7
|
+
.forEach(generator => {
|
|
8
|
+
const generatorInstance = new generator(context);
|
|
9
|
+
Object.keys(schemaModel.components?.schemas ?? {}).forEach((rn, index) => {
|
|
10
|
+
const refName = rn;
|
|
11
|
+
Sentry.addBreadcrumb({
|
|
12
|
+
level: 'info',
|
|
13
|
+
message: `Transforming model`,
|
|
14
|
+
data: {
|
|
15
|
+
generatorId: generator.id,
|
|
16
|
+
method: refName
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
try {
|
|
20
|
+
generatorInstance.transformModel(refName);
|
|
21
|
+
logModelStatus({ index, status: 'success', refName });
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
Sentry.captureException(error);
|
|
25
|
+
logModelStatus({ index, status: 'error', refName, error });
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { logOperationStatus } from '../helpers/logStatus.js';
|
|
2
|
+
import * as Sentry from '@sentry/deno';
|
|
3
|
+
export const generateOperations = (context) => {
|
|
4
|
+
const { schemaModel, generatorsMap } = context;
|
|
5
|
+
Object.values(generatorsMap)
|
|
6
|
+
.filter(generator => generator.type === 'operation')
|
|
7
|
+
.forEach(generator => {
|
|
8
|
+
const generatorInstance = new generator(context);
|
|
9
|
+
schemaModel.operations.forEach((operation, index) => {
|
|
10
|
+
const isSupportedOperation = typeof generator.isSupported === 'function'
|
|
11
|
+
? generator.isSupported(operation)
|
|
12
|
+
: true;
|
|
13
|
+
if (!isSupportedOperation) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
Sentry.addBreadcrumb({
|
|
17
|
+
level: 'info',
|
|
18
|
+
message: `Transforming operation`,
|
|
19
|
+
data: {
|
|
20
|
+
generatorId: generator.id,
|
|
21
|
+
method: operation.method,
|
|
22
|
+
path: operation.path
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
try {
|
|
26
|
+
generatorInstance.transformOperation(operation);
|
|
27
|
+
logOperationStatus({ index, status: 'success', operation });
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
Sentry.captureException(error);
|
|
31
|
+
logOperationStatus({ index, status: 'error', operation, error });
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.logModelStatus = exports.logOperationStatus = void 0;
|
|
4
|
-
const logOperationStatus = ({ index, status, operation, error }) => {
|
|
1
|
+
export const logOperationStatus = ({ index, status, operation, error }) => {
|
|
5
2
|
if (status !== 'error') {
|
|
6
3
|
return;
|
|
7
4
|
}
|
|
@@ -9,8 +6,7 @@ const logOperationStatus = ({ index, status, operation, error }) => {
|
|
|
9
6
|
console.log(status === 'error' ? '❌ ' : ' ', `${index + 1}. `.padEnd(5), operation.method.toUpperCase().padEnd(8), operation.path.padEnd(5), status === 'error' ? `- ${message}` : '');
|
|
10
7
|
error && console.error(error.toString());
|
|
11
8
|
};
|
|
12
|
-
|
|
13
|
-
const logModelStatus = ({ index, status, refName, error }) => {
|
|
9
|
+
export const logModelStatus = ({ index, status, refName, error }) => {
|
|
14
10
|
if (status !== 'error') {
|
|
15
11
|
return;
|
|
16
12
|
}
|
|
@@ -18,4 +14,3 @@ const logModelStatus = ({ index, status, refName, error }) => {
|
|
|
18
14
|
console.log(status === 'error' ? '❌ ' : ' ', `${index + 1}. `.padEnd(5), refName, status === 'error' ? `- ${message}` : '');
|
|
19
15
|
error && console.error(error.toString());
|
|
20
16
|
};
|
|
21
|
-
exports.logModelStatus = logModelStatus;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { camelCase } from 'lodash-es';
|
|
2
|
+
import { match } from 'ts-pattern';
|
|
3
|
+
export const toEndpointType = (operation) => {
|
|
4
|
+
return operation.method === 'get' ? 'query' : 'mutation';
|
|
5
|
+
};
|
|
6
|
+
/** generates endpoint name in the `camelCase{method}Api{path}` format */
|
|
7
|
+
export const toEndpointName = (operation) => {
|
|
8
|
+
const { path, method } = operation;
|
|
9
|
+
const verb = toMethodVerb(method);
|
|
10
|
+
return camelCase(`${verb}Api${path}`);
|
|
11
|
+
};
|
|
12
|
+
export const toResponseName = (operation) => {
|
|
13
|
+
const operationName = toEndpointName(operation);
|
|
14
|
+
return `${operationName}Response`;
|
|
15
|
+
};
|
|
16
|
+
export const toArgsName = (operation) => {
|
|
17
|
+
const operationName = toEndpointName(operation);
|
|
18
|
+
return `${operationName}Args`;
|
|
19
|
+
};
|
|
20
|
+
export const toMethodVerb = (method) => {
|
|
21
|
+
return match(method)
|
|
22
|
+
.with('post', () => 'Create')
|
|
23
|
+
.with('put', () => 'Update')
|
|
24
|
+
.otherwise(matched => matched);
|
|
25
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { normalize } from '../deps/jsr.io/@std/path/1.0.0/mod.js';
|
|
2
|
+
export const toRefName = ($ref) => {
|
|
3
|
+
// TODO: Add validation here to ensure reference exists
|
|
4
|
+
const refName = $ref.split('/').slice(-1)[0];
|
|
5
|
+
if (!refName) {
|
|
6
|
+
throw new Error('Invalid reference');
|
|
7
|
+
}
|
|
8
|
+
return refName;
|
|
9
|
+
};
|
|
10
|
+
export const isRef = (value) => {
|
|
11
|
+
if (value &&
|
|
12
|
+
typeof value === 'object' &&
|
|
13
|
+
'$ref' in value &&
|
|
14
|
+
typeof value.$ref === 'string') {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
// @TODO move to own file
|
|
22
|
+
export const isImported = (pathOne, pathTwo) => {
|
|
23
|
+
return normalize(pathOne) !== normalize(pathTwo);
|
|
24
|
+
};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// From https://stackoverflow.com/questions/74185545/type-representing-a-generic-class-with-a-private-constructor
|
|
3
|
-
|
|
4
|
-
exports.verifyType = verifyType;
|
|
5
|
-
function verifyType(instance,
|
|
2
|
+
export function verifyType(instance,
|
|
6
3
|
// deno-lint-ignore ban-types
|
|
7
4
|
classType) {
|
|
8
5
|
if (!classType.prototype) {
|
package/esm/mod.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import "./_dnt.polyfills.js";
|
|
2
|
+
export * from './context/CoreContext.js';
|
|
3
|
+
export * from './context/LogStore.js';
|
|
4
|
+
export * from './context/ParseContext.js';
|
|
5
|
+
export * from './context/Trail.js';
|
|
6
|
+
export * from './dsl/base.js';
|
|
7
|
+
export * from './dsl/constants.js';
|
|
8
|
+
export * from './dsl/ContentSettings.js';
|
|
9
|
+
export * from './dsl/Definition.js';
|
|
10
|
+
export * from './dsl/GeneratedValueList.js';
|
|
11
|
+
export * from './dsl/Identifier.js';
|
|
12
|
+
export * from './dsl/Import.js';
|
|
13
|
+
export * from './dsl/ModelCreator.js';
|
|
14
|
+
export * from './dsl/ModelDriver.js';
|
|
15
|
+
export * from './dsl/OperationCreator.js';
|
|
16
|
+
export * from './dsl/OperationDriver.js';
|
|
17
|
+
export * from './dsl/Stringable.js';
|
|
18
|
+
export * from './dsl/ValueBase.js';
|
|
19
|
+
export * from './dsl/withConfig.js';
|
|
20
|
+
export * from './generate/generate.js';
|
|
21
|
+
export * from './helpers/logStatus.js';
|
|
22
|
+
export * from './helpers/naming.js';
|
|
23
|
+
export * from './helpers/refFns.js';
|
|
24
|
+
export * from './helpers/strings.js';
|
|
25
|
+
export * from './helpers/verifyType.js';
|
|
26
|
+
export * from './oas/discriminator/Discriminator.js';
|
|
27
|
+
export * from './oas/document/Document.js';
|
|
28
|
+
export * from './oas/integer/Integer.js';
|
|
29
|
+
export * from './oas/object/Object.js';
|
|
30
|
+
export * from './oas/operation/Operation.js';
|
|
31
|
+
export * from './oas/parameter/Parameter.js';
|
|
32
|
+
export * from './oas/ref/Ref.js';
|
|
33
|
+
export * from './oas/requestBody/RequestBody.js';
|
|
34
|
+
export * from './oas/schema/Schema.js';
|
|
35
|
+
export * from './oas/string/String.js';
|
|
36
|
+
export * from './oas/tag/Tag.js';
|
|
37
|
+
export * from './oas/void/Void.js';
|
|
38
|
+
export * from './parse/parse.js';
|
|
39
|
+
export * from './dsl/ContentSettings.js';
|
|
40
|
+
export * from './types/Settings.js';
|
|
41
|
+
export * from './server/createServer.js';
|
|
42
|
+
export * from './types/CustomValue.js';
|
|
43
|
+
export * from './types/GeneratedValue.js';
|
|
44
|
+
export * from './types/GeneratorKeys.js';
|
|
45
|
+
export * from './types/Method.js';
|
|
46
|
+
export * from './types/Modifiers.js';
|
|
47
|
+
export * from './types/prettierConfig.js';
|
|
48
|
+
export * from './types/RefName.js';
|
|
49
|
+
export * from './types/Settings.js';
|
|
50
|
+
export * from './types/TypeSystem.js';
|
|
51
|
+
export * from './typescript/EntityType.js';
|
|
52
|
+
export * from './typescript/FunctionParameter.js';
|
|
53
|
+
export * from './typescript/identifiers.js';
|
|
54
|
+
export * from './typescript/keyValues.js';
|
|
55
|
+
export * from './typescript/ReactRouterPathParams.js';
|
|
56
|
+
export * from './typescript/toDestructuredObject.js';
|
|
57
|
+
export * from './typescript/toOperationArg.js';
|
|
58
|
+
export * from './typescript/toOperationResponse.js';
|
|
59
|
+
export * from './typescript/toParamsObject.js';
|
|
60
|
+
export * from './typescript/toPathTemplate.js';
|
|
61
|
+
export * from './typescript/withDescription.js';
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.OasArray = void 0;
|
|
4
|
-
const OasBase_js_1 = require("../../oas-elements/OasBase.js");
|
|
5
|
-
class OasArray extends OasBase_js_1.OasBase {
|
|
1
|
+
import { OasBase } from '../../oas-elements/OasBase.js';
|
|
2
|
+
export class OasArray extends OasBase {
|
|
6
3
|
constructor({ fields, trail, skipped, context }) {
|
|
7
4
|
super({ trail, skipped, context });
|
|
8
5
|
Object.defineProperty(this, "oasType", {
|
|
@@ -50,4 +47,3 @@ class OasArray extends OasBase_js_1.OasBase {
|
|
|
50
47
|
return this;
|
|
51
48
|
}
|
|
52
49
|
}
|
|
53
|
-
exports.OasArray = OasArray;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { oasSchemaData } from '../schema/schema-types.js';
|
|
3
|
+
import { oasSchemaRefData } from '../ref/ref-types.js';
|
|
4
|
+
export const oasArrayData = z.object({
|
|
5
|
+
oasType: z.literal('schema'),
|
|
6
|
+
// Add soon
|
|
7
|
+
type: z.literal('array'),
|
|
8
|
+
// additionalItems: z.lazy(() => z.union([z.boolean(), jsonSchema4]).optional()),
|
|
9
|
+
items: z.lazy(() => z.union([oasSchemaData, oasSchemaRefData])),
|
|
10
|
+
title: z.string().optional(),
|
|
11
|
+
description: z.string().optional(),
|
|
12
|
+
default: z.array(z.unknown()).optional()
|
|
13
|
+
// Add soon
|
|
14
|
+
// maxItems: z.number().optional(),
|
|
15
|
+
// minItems: z.number().optional(),
|
|
16
|
+
// uniqueItems: z.boolean().optional()
|
|
17
|
+
});
|