@skmtc/core 0.39.0 → 0.41.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/esm/context/CoreContext.js +22 -8
- package/esm/context/GenerateContext.d.ts +6 -5
- package/esm/context/GenerateContext.js +112 -38
- package/esm/context/ParseContext.d.ts +18 -1
- package/esm/context/ParseContext.js +102 -3
- package/esm/context/generateTypes.d.ts +33 -4
- package/esm/context/generateTypes.js +4 -0
- package/esm/context/toGenerationFailure.d.ts +21 -0
- package/esm/context/toGenerationFailure.js +38 -0
- package/esm/context/tryParseAt.d.ts +4 -1
- package/esm/context/tryParseAt.js +10 -3
- package/esm/dsl/CustomValue.d.ts +4 -0
- package/esm/dsl/CustomValue.js +8 -0
- package/esm/dsl/Definition.d.ts +10 -0
- package/esm/dsl/Definition.js +14 -0
- package/esm/dsl/PendingDefinition.d.ts +47 -0
- package/esm/dsl/PendingDefinition.js +83 -0
- package/esm/dsl/model/ModelDriver.d.ts +55 -1
- package/esm/dsl/model/ModelDriver.js +228 -51
- package/esm/dsl/model/toModelEntry.d.ts +1 -1
- package/esm/dsl/model/toModelEntry.js +1 -1
- package/esm/dsl/model/types.d.ts +1 -1
- package/esm/dsl/operation/gql/GqlOperationDriver.js +1 -4
- package/esm/dsl/webhook/WebhookDriver.js +1 -4
- package/esm/enrichments/parseEnrichmentUmbrella.d.ts +5 -6
- package/esm/enrichments/parseEnrichmentUmbrella.js +23 -8
- package/esm/enrichments/parseEnrichmentValue.d.ts +17 -0
- package/esm/enrichments/parseEnrichmentValue.js +32 -0
- package/esm/enrichments/readEnrichments.d.ts +5 -5
- package/esm/enrichments/readEnrichments.js +17 -7
- package/esm/helpers/collateExamples.js +15 -5
- package/esm/helpers/refFns.d.ts +6 -2
- package/esm/helpers/refFns.js +24 -7
- package/esm/mod.d.ts +2 -0
- package/esm/mod.js +2 -0
- package/esm/oas/array/Array.d.ts +19 -0
- package/esm/oas/array/Array.js +47 -0
- package/esm/oas/boolean/Boolean.d.ts +19 -0
- package/esm/oas/boolean/Boolean.js +51 -8
- package/esm/oas/example/Example.d.ts +4 -0
- package/esm/oas/example/Example.js +8 -0
- package/esm/oas/header/Header.d.ts +4 -0
- package/esm/oas/header/Header.js +8 -0
- package/esm/oas/integer/Integer.d.ts +19 -0
- package/esm/oas/integer/Integer.js +49 -0
- package/esm/oas/link/Link.d.ts +4 -0
- package/esm/oas/link/Link.js +8 -0
- package/esm/oas/number/Number.d.ts +19 -0
- package/esm/oas/number/Number.js +49 -0
- package/esm/oas/object/Object.d.ts +19 -0
- package/esm/oas/object/Object.js +68 -18
- package/esm/oas/operation/Operation.d.ts +8 -1
- package/esm/oas/operation/Operation.js +18 -5
- package/esm/oas/operation/toEffectiveParameters.d.ts +24 -0
- package/esm/oas/operation/toEffectiveParameters.js +42 -0
- package/esm/oas/parameter/Parameter.d.ts +4 -0
- package/esm/oas/parameter/Parameter.js +8 -0
- package/esm/oas/ref/DanglingRefError.d.ts +22 -0
- package/esm/oas/ref/DanglingRefError.js +33 -0
- package/esm/oas/ref/Ref.d.ts +152 -25
- package/esm/oas/ref/Ref.js +414 -26
- package/esm/oas/requestBody/RequestBody.d.ts +4 -0
- package/esm/oas/requestBody/RequestBody.js +8 -0
- package/esm/oas/response/Response.d.ts +4 -0
- package/esm/oas/response/Response.js +8 -0
- package/esm/oas/schema/siblings.d.ts +127 -0
- package/esm/oas/schema/siblings.js +250 -0
- package/esm/oas/securitySchemes/SecurityScheme.d.ts +16 -0
- package/esm/oas/securitySchemes/SecurityScheme.js +32 -0
- package/esm/oas/string/String.d.ts +19 -0
- package/esm/oas/string/String.js +47 -0
- package/esm/oas/union/Union.d.ts +32 -0
- package/esm/oas/union/Union.js +111 -0
- package/esm/oas/unknown/Unknown.d.ts +18 -0
- package/esm/oas/unknown/Unknown.js +38 -0
- package/esm/oas/void/Void.d.ts +4 -0
- package/esm/oas/void/Void.js +8 -0
- package/esm/oas/webhook/Webhook.d.ts +2 -2
- package/esm/oas/webhook/Webhook.js +4 -5
- package/esm/parse/allOfSystem.d.ts +32 -0
- package/esm/parse/allOfSystem.js +30 -0
- package/esm/parse/anyOfSystem.d.ts +68 -0
- package/esm/parse/anyOfSystem.js +107 -0
- package/esm/parse/securityRequirements.d.ts +6 -0
- package/esm/parse/securityRequirements.js +8 -0
- package/esm/parse/toSiblingKeywords.d.ts +28 -0
- package/esm/parse/toSiblingKeywords.js +109 -0
- package/esm/parse/v3-0/_merge-all-of/decompose-union.d.ts +8 -0
- package/esm/parse/v3-0/_merge-all-of/decompose-union.js +9 -1
- package/esm/parse/v3-0/_merge-all-of/generic-merge.d.ts +2 -3
- package/esm/parse/v3-0/_merge-all-of/generic-merge.js +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-array-constraints.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-array-constraints.js +5 -5
- package/esm/parse/v3-0/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-boolean-constraints.js +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-integer-constraints.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-integer-constraints.js +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-intersection.d.ts +3 -2
- package/esm/parse/v3-0/_merge-all-of/merge-intersection.js +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-number-constraints.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-number-constraints.js +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-object-constraints.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-object-constraints.js +3 -3
- package/esm/parse/v3-0/_merge-all-of/merge-properties.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-properties.js +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-string-constraints.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-string-constraints.js +3 -3
- package/esm/parse/v3-0/_merge-all-of/merge-union.d.ts +10 -3
- package/esm/parse/v3-0/_merge-all-of/merge-union.js +50 -12
- package/esm/parse/v3-0/_merge-all-of/merge.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge.js +78 -27
- package/esm/parse/v3-0/_merge-all-of/nullable-merge.d.ts +4 -0
- package/esm/parse/v3-0/_merge-all-of/nullable-merge.js +9 -7
- package/esm/parse/v3-0/_merge-all-of/types.d.ts +33 -0
- package/esm/parse/v3-0/mediaType/toMediaTypeItemV3.js +4 -3
- package/esm/parse/v3-0/parameter/toParameterV3.js +4 -3
- package/esm/parse/v3-0/ref/toRefV31.d.ts +7 -1
- package/esm/parse/v3-0/ref/toRefV31.js +6 -3
- package/esm/parse/v3-0/schema/toSchemasV3.js +107 -15
- package/esm/parse/v3-1/_merge-all-of/decompose-union.d.ts +7 -1
- package/esm/parse/v3-1/_merge-all-of/decompose-union.js +8 -2
- package/esm/parse/v3-1/_merge-all-of/generic-merge.d.ts +2 -3
- package/esm/parse/v3-1/_merge-all-of/generic-merge.js +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-array-constraints.d.ts +3 -2
- package/esm/parse/v3-1/_merge-all-of/merge-array-constraints.js +5 -5
- package/esm/parse/v3-1/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-boolean-constraints.js +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-integer-constraints.d.ts +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-integer-constraints.js +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-intersection.d.ts +3 -2
- package/esm/parse/v3-1/_merge-all-of/merge-intersection.js +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-number-constraints.d.ts +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-number-constraints.js +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-object-constraints.d.ts +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-object-constraints.js +3 -3
- package/esm/parse/v3-1/_merge-all-of/merge-properties.d.ts +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-properties.js +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-string-constraints.d.ts +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-string-constraints.js +3 -3
- package/esm/parse/v3-1/_merge-all-of/merge-union.d.ts +10 -3
- package/esm/parse/v3-1/_merge-all-of/merge-union.js +54 -15
- package/esm/parse/v3-1/_merge-all-of/merge.d.ts +3 -2
- package/esm/parse/v3-1/_merge-all-of/merge.js +88 -29
- package/esm/parse/v3-1/_merge-all-of/nullable-merge.d.ts +4 -0
- package/esm/parse/v3-1/_merge-all-of/nullable-merge.js +9 -7
- package/esm/parse/v3-1/_merge-all-of/types.d.ts +37 -0
- package/esm/parse/v3-1/mediaType/toMediaTypeItemV3.js +4 -3
- package/esm/parse/v3-1/parameter/toParameterV3.js +4 -3
- package/esm/parse/v3-1/ref/toRefV31.d.ts +7 -1
- package/esm/parse/v3-1/ref/toRefV31.js +6 -3
- package/esm/parse/v3-1/schema/toSchemasV3.js +111 -16
- package/esm/parse/v3-2/_merge-all-of/decompose-union.d.ts +7 -1
- package/esm/parse/v3-2/_merge-all-of/decompose-union.js +8 -2
- package/esm/parse/v3-2/_merge-all-of/generic-merge.d.ts +2 -3
- package/esm/parse/v3-2/_merge-all-of/generic-merge.js +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-array-constraints.d.ts +3 -2
- package/esm/parse/v3-2/_merge-all-of/merge-array-constraints.js +5 -5
- package/esm/parse/v3-2/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-boolean-constraints.js +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-integer-constraints.d.ts +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-integer-constraints.js +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-intersection.d.ts +3 -2
- package/esm/parse/v3-2/_merge-all-of/merge-intersection.js +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-number-constraints.d.ts +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-number-constraints.js +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-object-constraints.d.ts +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-object-constraints.js +3 -3
- package/esm/parse/v3-2/_merge-all-of/merge-properties.d.ts +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-properties.js +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-string-constraints.d.ts +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-string-constraints.js +3 -3
- package/esm/parse/v3-2/_merge-all-of/merge-union.d.ts +10 -3
- package/esm/parse/v3-2/_merge-all-of/merge-union.js +54 -15
- package/esm/parse/v3-2/_merge-all-of/merge.d.ts +3 -2
- package/esm/parse/v3-2/_merge-all-of/merge.js +88 -29
- package/esm/parse/v3-2/_merge-all-of/nullable-merge.d.ts +4 -0
- package/esm/parse/v3-2/_merge-all-of/nullable-merge.js +9 -7
- package/esm/parse/v3-2/_merge-all-of/types.d.ts +37 -0
- package/esm/parse/v3-2/mediaType/toMediaTypeItemV3.js +4 -3
- package/esm/parse/v3-2/parameter/toParameterV3.js +4 -3
- package/esm/parse/v3-2/ref/toRefV31.d.ts +7 -1
- package/esm/parse/v3-2/ref/toRefV31.js +6 -3
- package/esm/parse/v3-2/schema/toSchemasV3.js +111 -16
- package/esm/types/OasBase.d.ts +1 -1
- package/esm/types/Settings.d.ts +44 -0
- package/esm/types/Settings.js +9 -0
- package/package.json +5 -1
- package/script/context/CoreContext.js +22 -8
- package/script/context/GenerateContext.d.ts +6 -5
- package/script/context/GenerateContext.js +112 -38
- package/script/context/ParseContext.d.ts +18 -1
- package/script/context/ParseContext.js +102 -3
- package/script/context/generateTypes.d.ts +33 -4
- package/script/context/generateTypes.js +4 -0
- package/script/context/toGenerationFailure.d.ts +21 -0
- package/script/context/toGenerationFailure.js +43 -0
- package/script/context/tryParseAt.d.ts +4 -1
- package/script/context/tryParseAt.js +10 -3
- package/script/dsl/CustomValue.d.ts +4 -0
- package/script/dsl/CustomValue.js +8 -0
- package/script/dsl/Definition.d.ts +10 -0
- package/script/dsl/Definition.js +14 -0
- package/script/dsl/PendingDefinition.d.ts +47 -0
- package/script/dsl/PendingDefinition.js +87 -0
- package/script/dsl/model/ModelDriver.d.ts +55 -1
- package/script/dsl/model/ModelDriver.js +231 -52
- package/script/dsl/model/toModelEntry.d.ts +1 -1
- package/script/dsl/model/toModelEntry.js +1 -1
- package/script/dsl/model/types.d.ts +1 -1
- package/script/dsl/operation/gql/GqlOperationDriver.js +1 -4
- package/script/dsl/webhook/WebhookDriver.js +1 -4
- package/script/enrichments/parseEnrichmentUmbrella.d.ts +5 -6
- package/script/enrichments/parseEnrichmentUmbrella.js +23 -41
- package/script/enrichments/parseEnrichmentValue.d.ts +17 -0
- package/script/enrichments/parseEnrichmentValue.js +69 -0
- package/script/enrichments/readEnrichments.d.ts +5 -5
- package/script/enrichments/readEnrichments.js +17 -40
- package/script/helpers/collateExamples.js +15 -5
- package/script/helpers/refFns.d.ts +6 -2
- package/script/helpers/refFns.js +24 -7
- package/script/mod.d.ts +2 -0
- package/script/mod.js +2 -0
- package/script/oas/array/Array.d.ts +19 -0
- package/script/oas/array/Array.js +47 -0
- package/script/oas/boolean/Boolean.d.ts +19 -0
- package/script/oas/boolean/Boolean.js +51 -8
- package/script/oas/example/Example.d.ts +4 -0
- package/script/oas/example/Example.js +8 -0
- package/script/oas/header/Header.d.ts +4 -0
- package/script/oas/header/Header.js +8 -0
- package/script/oas/integer/Integer.d.ts +19 -0
- package/script/oas/integer/Integer.js +49 -0
- package/script/oas/link/Link.d.ts +4 -0
- package/script/oas/link/Link.js +8 -0
- package/script/oas/number/Number.d.ts +19 -0
- package/script/oas/number/Number.js +49 -0
- package/script/oas/object/Object.d.ts +19 -0
- package/script/oas/object/Object.js +68 -18
- package/script/oas/operation/Operation.d.ts +8 -1
- package/script/oas/operation/Operation.js +18 -5
- package/script/oas/operation/toEffectiveParameters.d.ts +24 -0
- package/script/oas/operation/toEffectiveParameters.js +47 -0
- package/script/oas/parameter/Parameter.d.ts +4 -0
- package/script/oas/parameter/Parameter.js +8 -0
- package/script/oas/ref/DanglingRefError.d.ts +22 -0
- package/script/oas/ref/DanglingRefError.js +37 -0
- package/script/oas/ref/Ref.d.ts +152 -25
- package/script/oas/ref/Ref.js +414 -26
- package/script/oas/requestBody/RequestBody.d.ts +4 -0
- package/script/oas/requestBody/RequestBody.js +8 -0
- package/script/oas/response/Response.d.ts +4 -0
- package/script/oas/response/Response.js +8 -0
- package/script/oas/schema/siblings.d.ts +127 -0
- package/script/oas/schema/siblings.js +305 -0
- package/script/oas/securitySchemes/SecurityScheme.d.ts +16 -0
- package/script/oas/securitySchemes/SecurityScheme.js +32 -0
- package/script/oas/string/String.d.ts +19 -0
- package/script/oas/string/String.js +47 -0
- package/script/oas/union/Union.d.ts +32 -0
- package/script/oas/union/Union.js +111 -0
- package/script/oas/unknown/Unknown.d.ts +18 -0
- package/script/oas/unknown/Unknown.js +38 -0
- package/script/oas/void/Void.d.ts +4 -0
- package/script/oas/void/Void.js +8 -0
- package/script/oas/webhook/Webhook.d.ts +2 -2
- package/script/oas/webhook/Webhook.js +4 -5
- package/script/parse/allOfSystem.d.ts +32 -0
- package/script/parse/allOfSystem.js +35 -0
- package/script/parse/anyOfSystem.d.ts +68 -0
- package/script/parse/anyOfSystem.js +116 -0
- package/script/parse/securityRequirements.d.ts +6 -0
- package/script/parse/securityRequirements.js +8 -0
- package/script/parse/toSiblingKeywords.d.ts +28 -0
- package/script/parse/toSiblingKeywords.js +146 -0
- package/script/parse/v3-0/_merge-all-of/decompose-union.d.ts +8 -0
- package/script/parse/v3-0/_merge-all-of/decompose-union.js +11 -2
- package/script/parse/v3-0/_merge-all-of/generic-merge.d.ts +2 -3
- package/script/parse/v3-0/_merge-all-of/generic-merge.js +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-array-constraints.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-array-constraints.js +5 -5
- package/script/parse/v3-0/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-boolean-constraints.js +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-integer-constraints.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-integer-constraints.js +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-intersection.d.ts +3 -2
- package/script/parse/v3-0/_merge-all-of/merge-intersection.js +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-number-constraints.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-number-constraints.js +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-object-constraints.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-object-constraints.js +3 -3
- package/script/parse/v3-0/_merge-all-of/merge-properties.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-properties.js +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-string-constraints.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-string-constraints.js +3 -3
- package/script/parse/v3-0/_merge-all-of/merge-union.d.ts +10 -3
- package/script/parse/v3-0/_merge-all-of/merge-union.js +52 -13
- package/script/parse/v3-0/_merge-all-of/merge.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge.js +77 -26
- package/script/parse/v3-0/_merge-all-of/nullable-merge.d.ts +4 -0
- package/script/parse/v3-0/_merge-all-of/nullable-merge.js +9 -7
- package/script/parse/v3-0/_merge-all-of/types.d.ts +33 -0
- package/script/parse/v3-0/mediaType/toMediaTypeItemV3.js +4 -3
- package/script/parse/v3-0/parameter/toParameterV3.js +4 -3
- package/script/parse/v3-0/ref/toRefV31.d.ts +7 -1
- package/script/parse/v3-0/ref/toRefV31.js +6 -3
- package/script/parse/v3-0/schema/toSchemasV3.js +107 -15
- package/script/parse/v3-1/_merge-all-of/decompose-union.d.ts +7 -1
- package/script/parse/v3-1/_merge-all-of/decompose-union.js +8 -2
- package/script/parse/v3-1/_merge-all-of/generic-merge.d.ts +2 -3
- package/script/parse/v3-1/_merge-all-of/generic-merge.js +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-array-constraints.d.ts +3 -2
- package/script/parse/v3-1/_merge-all-of/merge-array-constraints.js +5 -5
- package/script/parse/v3-1/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-boolean-constraints.js +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-integer-constraints.d.ts +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-integer-constraints.js +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-intersection.d.ts +3 -2
- package/script/parse/v3-1/_merge-all-of/merge-intersection.js +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-number-constraints.d.ts +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-number-constraints.js +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-object-constraints.d.ts +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-object-constraints.js +3 -3
- package/script/parse/v3-1/_merge-all-of/merge-properties.d.ts +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-properties.js +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-string-constraints.d.ts +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-string-constraints.js +3 -3
- package/script/parse/v3-1/_merge-all-of/merge-union.d.ts +10 -3
- package/script/parse/v3-1/_merge-all-of/merge-union.js +56 -16
- package/script/parse/v3-1/_merge-all-of/merge.d.ts +3 -2
- package/script/parse/v3-1/_merge-all-of/merge.js +87 -28
- package/script/parse/v3-1/_merge-all-of/nullable-merge.d.ts +4 -0
- package/script/parse/v3-1/_merge-all-of/nullable-merge.js +9 -7
- package/script/parse/v3-1/_merge-all-of/types.d.ts +37 -0
- package/script/parse/v3-1/mediaType/toMediaTypeItemV3.js +4 -3
- package/script/parse/v3-1/parameter/toParameterV3.js +4 -3
- package/script/parse/v3-1/ref/toRefV31.d.ts +7 -1
- package/script/parse/v3-1/ref/toRefV31.js +6 -3
- package/script/parse/v3-1/schema/toSchemasV3.js +111 -16
- package/script/parse/v3-2/_merge-all-of/decompose-union.d.ts +7 -1
- package/script/parse/v3-2/_merge-all-of/decompose-union.js +8 -2
- package/script/parse/v3-2/_merge-all-of/generic-merge.d.ts +2 -3
- package/script/parse/v3-2/_merge-all-of/generic-merge.js +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-array-constraints.d.ts +3 -2
- package/script/parse/v3-2/_merge-all-of/merge-array-constraints.js +5 -5
- package/script/parse/v3-2/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-boolean-constraints.js +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-integer-constraints.d.ts +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-integer-constraints.js +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-intersection.d.ts +3 -2
- package/script/parse/v3-2/_merge-all-of/merge-intersection.js +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-number-constraints.d.ts +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-number-constraints.js +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-object-constraints.d.ts +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-object-constraints.js +3 -3
- package/script/parse/v3-2/_merge-all-of/merge-properties.d.ts +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-properties.js +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-string-constraints.d.ts +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-string-constraints.js +3 -3
- package/script/parse/v3-2/_merge-all-of/merge-union.d.ts +10 -3
- package/script/parse/v3-2/_merge-all-of/merge-union.js +56 -16
- package/script/parse/v3-2/_merge-all-of/merge.d.ts +3 -2
- package/script/parse/v3-2/_merge-all-of/merge.js +87 -28
- package/script/parse/v3-2/_merge-all-of/nullable-merge.d.ts +4 -0
- package/script/parse/v3-2/_merge-all-of/nullable-merge.js +9 -7
- package/script/parse/v3-2/_merge-all-of/types.d.ts +37 -0
- package/script/parse/v3-2/mediaType/toMediaTypeItemV3.js +4 -3
- package/script/parse/v3-2/parameter/toParameterV3.js +4 -3
- package/script/parse/v3-2/ref/toRefV31.d.ts +7 -1
- package/script/parse/v3-2/ref/toRefV31.js +6 -3
- package/script/parse/v3-2/schema/toSchemasV3.js +111 -16
- package/script/types/OasBase.d.ts +1 -1
- package/script/types/Settings.d.ts +44 -0
- package/script/types/Settings.js +10 -1
|
@@ -6,6 +6,7 @@ import type { ResultsItem } from '../types/Results.js';
|
|
|
6
6
|
import type { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';
|
|
7
7
|
import type { GeneratedValue } from '../dsl/GeneratedValue.js';
|
|
8
8
|
import type { DefinitionBase } from '../dsl/Definition.js';
|
|
9
|
+
import type { PendingDefinition } from '../dsl/PendingDefinition.js';
|
|
9
10
|
import type { OasOperation } from '../oas/operation/Operation.js';
|
|
10
11
|
import type { OasOperationProjection } from '../dsl/operation/oas/types.js';
|
|
11
12
|
import type { OasWebhook } from '../oas/webhook/Webhook.js';
|
|
@@ -176,11 +177,33 @@ export type AnyOasDocument = OpenAPIV2.Document | OpenAPIV3.Document | OpenAPIV3
|
|
|
176
177
|
* scalar schema (a text body or a file). A body with only specific
|
|
177
178
|
* non-JSON types (`multipart/form-data`, `text/plain`) logs nothing.
|
|
178
179
|
*
|
|
180
|
+
* `ALLOF_CONTRADICTION` (`warning`) — `allOf` members contradict, and
|
|
181
|
+
* `system.allOf: latestWins` kept the later member's keywords. One for each
|
|
182
|
+
* schema; the message names the keywords.
|
|
183
|
+
*
|
|
184
|
+
* `ANYOF_AS_UNKNOWN` (`warning`) — `system.anyOf: unknown` read an `anyOf`
|
|
185
|
+
* of two or more members as any value. The schema keeps its other keywords.
|
|
186
|
+
* One for each schema.
|
|
187
|
+
*
|
|
188
|
+
* `DANGLING_REF` — a `$ref` names nothing in the document. One for each
|
|
189
|
+
* place the `$ref` is written. An `error` under `system.danglingRefs:
|
|
190
|
+
* strict` (the default): what holds the ref is removed, and each item that
|
|
191
|
+
* uses it gets an `INVALID_DEPENDENCY_REF`. A `warning` under `keep`: the
|
|
192
|
+
* ref stays, and resolving it throws `DanglingRefError`. A ref to an example
|
|
193
|
+
* or a link is a `warning` in both modes. A ref that core resolves while it
|
|
194
|
+
* parses (an `allOf` member that it merges) is an `error` in both modes, at
|
|
195
|
+
* the item that holds it.
|
|
196
|
+
*
|
|
197
|
+
* `REF_TYPE_MISMATCH` (`warning`) — a `$ref` names a component of the wrong
|
|
198
|
+
* kind, such as a request body that is a `$ref` to
|
|
199
|
+
* `#/components/schemas/Pet`. One for each place the `$ref` is written. The
|
|
200
|
+
* ref stays, and resolving it throws.
|
|
201
|
+
*
|
|
179
202
|
* `RUN_FAILED` (`error`) — the run itself failed outside the per-item
|
|
180
203
|
* catches. Its `location` names the entry and phase, for example
|
|
181
204
|
* `toArtifacts:render`.
|
|
182
205
|
*/
|
|
183
|
-
export type OasIssueType = 'UNEXPECTED_PROPERTY' | 'MISSING_OBJECT_TYPE' | 'MISSING_STRING_TYPE' | 'MISSING_ARRAY_TYPE' | 'MISSING_BOOLEAN_TYPE' | 'MISSING_RESPONSES' | 'MISSING_INFO' | 'EMPTY_PARAMETER' | 'INVALID_EXAMPLE' | 'INVALID_ENUM' | 'INVALID_DEFAULT' | 'INVALID_NULLABLE' | 'UNEXPECTED_FORMAT' | 'INVALID_RESPONSE' | 'INVALID_REQUEST_BODY' | 'INVALID_HEADER' | 'INVALID_FORMAT' | 'INVALID_OPERATION' | 'INVALID_SCHEMA' | 'INVALID_PARAMETER' | 'INVALID_SECURITY_SCHEME' | 'INVALID_DEPENDENCY_REF' | 'EXAMPLE_AND_EXAMPLES_DEFINED' | 'INVALID_TAG_PARENT' | 'INVALID_TAG' | 'INVALID_EXTERNAL_DOCS' | 'UNSUPPORTED_OPERATION_METHOD' | 'WILDCARD_MEDIA_TYPE' | 'NO_JSON_MEDIA_TYPE' | 'RUN_FAILED';
|
|
206
|
+
export type OasIssueType = 'UNEXPECTED_PROPERTY' | 'MISSING_OBJECT_TYPE' | 'MISSING_STRING_TYPE' | 'MISSING_ARRAY_TYPE' | 'MISSING_BOOLEAN_TYPE' | 'MISSING_RESPONSES' | 'MISSING_INFO' | 'EMPTY_PARAMETER' | 'INVALID_EXAMPLE' | 'INVALID_ENUM' | 'INVALID_DEFAULT' | 'INVALID_NULLABLE' | 'UNEXPECTED_FORMAT' | 'INVALID_RESPONSE' | 'INVALID_REQUEST_BODY' | 'INVALID_HEADER' | 'INVALID_FORMAT' | 'INVALID_OPERATION' | 'INVALID_SCHEMA' | 'INVALID_PARAMETER' | 'INVALID_SECURITY_SCHEME' | 'INVALID_DEPENDENCY_REF' | 'EXAMPLE_AND_EXAMPLES_DEFINED' | 'INVALID_TAG_PARENT' | 'INVALID_TAG' | 'INVALID_EXTERNAL_DOCS' | 'UNSUPPORTED_OPERATION_METHOD' | 'WILDCARD_MEDIA_TYPE' | 'NO_JSON_MEDIA_TYPE' | 'ALLOF_CONTRADICTION' | 'ANYOF_AS_UNKNOWN' | 'DANGLING_REF' | 'REF_TYPE_MISMATCH' | 'RUN_FAILED';
|
|
184
207
|
/**
|
|
185
208
|
* Valibot schema for {@link OasIssueType}. Annotation deliberately omitted
|
|
186
209
|
* so the precise literal-union output type flows through to consumers
|
|
@@ -188,7 +211,7 @@ export type OasIssueType = 'UNEXPECTED_PROPERTY' | 'MISSING_OBJECT_TYPE' | 'MISS
|
|
|
188
211
|
* this list and {@link OasIssueType} is caught by `assertSchemaMatchesType`
|
|
189
212
|
* below.
|
|
190
213
|
*/
|
|
191
|
-
export declare const oasIssueType: v.UnionSchema<[v.LiteralSchema<"UNEXPECTED_PROPERTY", undefined>, v.LiteralSchema<"MISSING_OBJECT_TYPE", undefined>, v.LiteralSchema<"MISSING_STRING_TYPE", undefined>, v.LiteralSchema<"MISSING_ARRAY_TYPE", undefined>, v.LiteralSchema<"MISSING_BOOLEAN_TYPE", undefined>, v.LiteralSchema<"MISSING_RESPONSES", undefined>, v.LiteralSchema<"MISSING_INFO", undefined>, v.LiteralSchema<"EMPTY_PARAMETER", undefined>, v.LiteralSchema<"INVALID_EXAMPLE", undefined>, v.LiteralSchema<"INVALID_ENUM", undefined>, v.LiteralSchema<"INVALID_DEFAULT", undefined>, v.LiteralSchema<"INVALID_NULLABLE", undefined>, v.LiteralSchema<"UNEXPECTED_FORMAT", undefined>, v.LiteralSchema<"INVALID_RESPONSE", undefined>, v.LiteralSchema<"INVALID_REQUEST_BODY", undefined>, v.LiteralSchema<"INVALID_HEADER", undefined>, v.LiteralSchema<"INVALID_FORMAT", undefined>, v.LiteralSchema<"INVALID_OPERATION", undefined>, v.LiteralSchema<"INVALID_SCHEMA", undefined>, v.LiteralSchema<"INVALID_PARAMETER", undefined>, v.LiteralSchema<"INVALID_SECURITY_SCHEME", undefined>, v.LiteralSchema<"INVALID_DEPENDENCY_REF", undefined>, v.LiteralSchema<"EXAMPLE_AND_EXAMPLES_DEFINED", undefined>, v.LiteralSchema<"INVALID_TAG_PARENT", undefined>, v.LiteralSchema<"INVALID_TAG", undefined>, v.LiteralSchema<"INVALID_EXTERNAL_DOCS", undefined>, v.LiteralSchema<"UNSUPPORTED_OPERATION_METHOD", undefined>, v.LiteralSchema<"WILDCARD_MEDIA_TYPE", undefined>, v.LiteralSchema<"NO_JSON_MEDIA_TYPE", undefined>, v.LiteralSchema<"RUN_FAILED", undefined>], undefined>;
|
|
214
|
+
export declare const oasIssueType: v.UnionSchema<[v.LiteralSchema<"UNEXPECTED_PROPERTY", undefined>, v.LiteralSchema<"MISSING_OBJECT_TYPE", undefined>, v.LiteralSchema<"MISSING_STRING_TYPE", undefined>, v.LiteralSchema<"MISSING_ARRAY_TYPE", undefined>, v.LiteralSchema<"MISSING_BOOLEAN_TYPE", undefined>, v.LiteralSchema<"MISSING_RESPONSES", undefined>, v.LiteralSchema<"MISSING_INFO", undefined>, v.LiteralSchema<"EMPTY_PARAMETER", undefined>, v.LiteralSchema<"INVALID_EXAMPLE", undefined>, v.LiteralSchema<"INVALID_ENUM", undefined>, v.LiteralSchema<"INVALID_DEFAULT", undefined>, v.LiteralSchema<"INVALID_NULLABLE", undefined>, v.LiteralSchema<"UNEXPECTED_FORMAT", undefined>, v.LiteralSchema<"INVALID_RESPONSE", undefined>, v.LiteralSchema<"INVALID_REQUEST_BODY", undefined>, v.LiteralSchema<"INVALID_HEADER", undefined>, v.LiteralSchema<"INVALID_FORMAT", undefined>, v.LiteralSchema<"INVALID_OPERATION", undefined>, v.LiteralSchema<"INVALID_SCHEMA", undefined>, v.LiteralSchema<"INVALID_PARAMETER", undefined>, v.LiteralSchema<"INVALID_SECURITY_SCHEME", undefined>, v.LiteralSchema<"INVALID_DEPENDENCY_REF", undefined>, v.LiteralSchema<"EXAMPLE_AND_EXAMPLES_DEFINED", undefined>, v.LiteralSchema<"INVALID_TAG_PARENT", undefined>, v.LiteralSchema<"INVALID_TAG", undefined>, v.LiteralSchema<"INVALID_EXTERNAL_DOCS", undefined>, v.LiteralSchema<"UNSUPPORTED_OPERATION_METHOD", undefined>, v.LiteralSchema<"WILDCARD_MEDIA_TYPE", undefined>, v.LiteralSchema<"NO_JSON_MEDIA_TYPE", undefined>, v.LiteralSchema<"ALLOF_CONTRADICTION", undefined>, v.LiteralSchema<"ANYOF_AS_UNKNOWN", undefined>, v.LiteralSchema<"DANGLING_REF", undefined>, v.LiteralSchema<"REF_TYPE_MISMATCH", undefined>, v.LiteralSchema<"RUN_FAILED", undefined>], undefined>;
|
|
192
215
|
export type GenerateResult = {
|
|
193
216
|
files: Map<string, FileBase>;
|
|
194
217
|
previews: Record<string, Preview>;
|
|
@@ -415,7 +438,12 @@ export type GenerateContextType = {
|
|
|
415
438
|
* subject's result to `'warning'` or `'error'`.
|
|
416
439
|
*/
|
|
417
440
|
logger: Logger;
|
|
418
|
-
|
|
441
|
+
/**
|
|
442
|
+
* The pending models, outermost first: the last is the model whose
|
|
443
|
+
* projection constructor is running, the source of any reference made now.
|
|
444
|
+
* Kept by the `ModelDriver`.
|
|
445
|
+
*/
|
|
446
|
+
pendingStack: PendingDefinition[];
|
|
419
447
|
document: SkmtcParsedDocument;
|
|
420
448
|
/**
|
|
421
449
|
* Attribution (gen-maps) state. When set, every `SnippetBase`
|
|
@@ -451,7 +479,8 @@ export type GenerateContextType = {
|
|
|
451
479
|
insertWebhook: <V extends GeneratedValue, EnrichmentType = undefined, ProjectionOptions = undefined>(args: InsertWebhookArgs<V, EnrichmentType, ProjectionOptions>) => Inserted<V, EnrichmentType>;
|
|
452
480
|
toWebhookContentSettings: <V extends GeneratedValue, EnrichmentType, ProjectionOptions>(args: ToWebhookSettingsArgs<V, EnrichmentType, ProjectionOptions>) => ContentSettings<EnrichmentType>;
|
|
453
481
|
toModelContentSettings: <V extends GeneratedValue, EnrichmentType, ProjectionOptions>(args: BuildModelSettingsArgs<V, EnrichmentType, ProjectionOptions>) => ContentSettings<EnrichmentType>;
|
|
454
|
-
resolveSchemaRefOnce: (refName: RefName
|
|
482
|
+
resolveSchemaRefOnce: (refName: RefName) => OasSchema | OasRef<'schema'>;
|
|
483
|
+
/** The Definition named `name` in `exportPath` (or inside the declaration `into`), or `undefined`. */
|
|
455
484
|
findDefinition: ({ name, exportPath, into }: FindDefinitionArgs) => DefinitionBase | undefined;
|
|
456
485
|
/**
|
|
457
486
|
* The recording enrichment accessor — the single choke point every
|
|
@@ -36,6 +36,10 @@ export const oasIssueType = v.union([
|
|
|
36
36
|
v.literal('UNSUPPORTED_OPERATION_METHOD'),
|
|
37
37
|
v.literal('WILDCARD_MEDIA_TYPE'),
|
|
38
38
|
v.literal('NO_JSON_MEDIA_TYPE'),
|
|
39
|
+
v.literal('ALLOF_CONTRADICTION'),
|
|
40
|
+
v.literal('ANYOF_AS_UNKNOWN'),
|
|
41
|
+
v.literal('DANGLING_REF'),
|
|
42
|
+
v.literal('REF_TYPE_MISMATCH'),
|
|
39
43
|
v.literal('RUN_FAILED')
|
|
40
44
|
]);
|
|
41
45
|
// Compile-time drift detector: this binding fails to type-check if
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { EnrichmentWarning } from '../enrichments/EnrichmentWarning.js';
|
|
2
|
+
/** A subject whose generation threw: its trail and the error message. */
|
|
3
|
+
export type FailedItem = {
|
|
4
|
+
trail: string;
|
|
5
|
+
message: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* The message of a run that failed in generate. Each distinct error is
|
|
9
|
+
* written once, with the subjects it failed: one wrong enrichment fails
|
|
10
|
+
* every subject that reads it, and the user needs to read it only once.
|
|
11
|
+
*/
|
|
12
|
+
export declare const toGenerationFailure: (failedItems: readonly FailedItem[]) => string;
|
|
13
|
+
/**
|
|
14
|
+
* The error a run that failed in generate throws. It carries the
|
|
15
|
+
* enrichment warnings the audit found, since a misaddressed enrichment is
|
|
16
|
+
* often why a subject failed.
|
|
17
|
+
*/
|
|
18
|
+
export declare class GenerationFailure extends Error {
|
|
19
|
+
enrichmentWarnings: EnrichmentWarning[];
|
|
20
|
+
constructor(failedItems: readonly FailedItem[], enrichmentWarnings: EnrichmentWarning[]);
|
|
21
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** How many trails each message lists before it counts the rest. */
|
|
2
|
+
const SHOWN_TRAILS = 5;
|
|
3
|
+
/**
|
|
4
|
+
* The message of a run that failed in generate. Each distinct error is
|
|
5
|
+
* written once, with the subjects it failed: one wrong enrichment fails
|
|
6
|
+
* every subject that reads it, and the user needs to read it only once.
|
|
7
|
+
*/
|
|
8
|
+
export const toGenerationFailure = (failedItems) => {
|
|
9
|
+
const byMessage = Map.groupBy(failedItems, ({ message }) => message);
|
|
10
|
+
const paragraphs = [...byMessage].map(([message, items]) => {
|
|
11
|
+
const trails = items.map(({ trail }) => ` in ${trail}`);
|
|
12
|
+
const hidden = trails.length - SHOWN_TRAILS;
|
|
13
|
+
return [
|
|
14
|
+
message,
|
|
15
|
+
...trails.slice(0, SHOWN_TRAILS),
|
|
16
|
+
...(hidden > 0 ? [` and ${hidden} more`] : [])
|
|
17
|
+
].join('\n');
|
|
18
|
+
});
|
|
19
|
+
return `Generation failed for ${failedItems.length} subject(s):\n${paragraphs.join('\n\n')}`;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* The error a run that failed in generate throws. It carries the
|
|
23
|
+
* enrichment warnings the audit found, since a misaddressed enrichment is
|
|
24
|
+
* often why a subject failed.
|
|
25
|
+
*/
|
|
26
|
+
export class GenerationFailure extends Error {
|
|
27
|
+
constructor(failedItems, enrichmentWarnings) {
|
|
28
|
+
super(toGenerationFailure(failedItems));
|
|
29
|
+
Object.defineProperty(this, "enrichmentWarnings", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
configurable: true,
|
|
32
|
+
writable: true,
|
|
33
|
+
value: void 0
|
|
34
|
+
});
|
|
35
|
+
this.name = 'GenerationFailure';
|
|
36
|
+
this.enrichmentWarnings = enrichmentWarnings;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -60,7 +60,10 @@ export type TryParseAtArgs<T> = {
|
|
|
60
60
|
* Run `fn(childStack)` inside `stackTrail.trace(key, ...)`. On throw:
|
|
61
61
|
*
|
|
62
62
|
* - logs a `level: 'error'` issue at the child location with the
|
|
63
|
-
* given `type` and the thrown value as `cause`
|
|
63
|
+
* given `type` and the thrown value as `cause`. A `DanglingRefError`
|
|
64
|
+
* is logged as `DANGLING_REF`: core resolved a ref while it parsed (an
|
|
65
|
+
* `allOf` member it merges, say), so the ref cannot be kept, whatever
|
|
66
|
+
* `system.danglingRefs` is
|
|
64
67
|
* - registers a ref error if `refKey` is provided
|
|
65
68
|
* - returns `undefined`
|
|
66
69
|
*
|
|
@@ -19,11 +19,15 @@
|
|
|
19
19
|
* logging into one call so both surfaces share the failure-handling
|
|
20
20
|
* shape verbatim.
|
|
21
21
|
*/
|
|
22
|
+
import { DanglingRefError } from '../oas/ref/DanglingRefError.js';
|
|
22
23
|
/**
|
|
23
24
|
* Run `fn(childStack)` inside `stackTrail.trace(key, ...)`. On throw:
|
|
24
25
|
*
|
|
25
26
|
* - logs a `level: 'error'` issue at the child location with the
|
|
26
|
-
* given `type` and the thrown value as `cause`
|
|
27
|
+
* given `type` and the thrown value as `cause`. A `DanglingRefError`
|
|
28
|
+
* is logged as `DANGLING_REF`: core resolved a ref while it parsed (an
|
|
29
|
+
* `allOf` member it merges, say), so the ref cannot be kept, whatever
|
|
30
|
+
* `system.danglingRefs` is
|
|
27
31
|
* - registers a ref error if `refKey` is provided
|
|
28
32
|
* - returns `undefined`
|
|
29
33
|
*
|
|
@@ -35,6 +39,7 @@ export const tryParseAt = ({ stackTrail, key, context, type, parent, refKey, fn
|
|
|
35
39
|
}
|
|
36
40
|
catch (error) {
|
|
37
41
|
const normalized = error instanceof Error ? error : new Error(String(error));
|
|
42
|
+
const dangling = DanglingRefError.is(error);
|
|
38
43
|
stackTrail.trace(key, childStack => {
|
|
39
44
|
if (refKey !== undefined) {
|
|
40
45
|
context.registerRefError(error, refKey, childStack.toString());
|
|
@@ -43,9 +48,11 @@ export const tryParseAt = ({ stackTrail, key, context, type, parent, refKey, fn
|
|
|
43
48
|
level: 'error',
|
|
44
49
|
stackTrail: childStack,
|
|
45
50
|
parent,
|
|
46
|
-
message:
|
|
51
|
+
message: dangling
|
|
52
|
+
? `${normalized.message}. Core resolves it while it parses, so what holds it is removed whatever system.danglingRefs is.`
|
|
53
|
+
: normalized.message,
|
|
47
54
|
cause: normalized,
|
|
48
|
-
type
|
|
55
|
+
type: dangling ? 'DANGLING_REF' : type
|
|
49
56
|
});
|
|
50
57
|
});
|
|
51
58
|
return undefined;
|
package/esm/dsl/CustomValue.d.ts
CHANGED
|
@@ -44,6 +44,10 @@ export declare class CustomValue extends SnippetBase {
|
|
|
44
44
|
* @returns Always false since custom values are concrete content, not references
|
|
45
45
|
*/
|
|
46
46
|
isRef(): this is OasRef<'schema'>;
|
|
47
|
+
/** Always `false`: this value has no `readOnly`. */
|
|
48
|
+
isReadOnly(): boolean;
|
|
49
|
+
/** Always `false`: this value has no `writeOnly`. */
|
|
50
|
+
isWriteOnly(): boolean;
|
|
47
51
|
/**
|
|
48
52
|
* Resolves this custom value.
|
|
49
53
|
*
|
package/esm/dsl/CustomValue.js
CHANGED
|
@@ -50,6 +50,14 @@ export class CustomValue extends SnippetBase {
|
|
|
50
50
|
isRef() {
|
|
51
51
|
return false;
|
|
52
52
|
}
|
|
53
|
+
/** Always `false`: this value has no `readOnly`. */
|
|
54
|
+
isReadOnly() {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
/** Always `false`: this value has no `writeOnly`. */
|
|
58
|
+
isWriteOnly() {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
53
61
|
/**
|
|
54
62
|
* Resolves this custom value.
|
|
55
63
|
*
|
package/esm/dsl/Definition.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { GenerateContextType } from '../context/generateTypes.js';
|
|
|
2
2
|
import type { IdentifierBase } from './IdentifierBase.js';
|
|
3
3
|
import { SnippetBase } from './SnippetBase.js';
|
|
4
4
|
import type { GeneratedValue } from './GeneratedValue.js';
|
|
5
|
+
import type { PendingDefinition } from './PendingDefinition.js';
|
|
5
6
|
/**
|
|
6
7
|
* Constructor arguments for {@link DefinitionBase}.
|
|
7
8
|
*
|
|
@@ -35,6 +36,15 @@ export declare abstract class DefinitionBase<V extends GeneratedValue = Generate
|
|
|
35
36
|
identifier: IdentifierBase;
|
|
36
37
|
/** The generated value content */
|
|
37
38
|
value: V;
|
|
39
|
+
/**
|
|
40
|
+
* The models this Definition's model reached while its projection was
|
|
41
|
+
* being constructed that were pending then: the models further up the
|
|
42
|
+
* stack it refers back to, directly or through the models it refers to.
|
|
43
|
+
* A reference to this model is inside a cycle while one of them is still
|
|
44
|
+
* pending. Set by the `ModelDriver`; `undefined` for a Definition it did
|
|
45
|
+
* not construct.
|
|
46
|
+
*/
|
|
47
|
+
reaches: ReadonlySet<PendingDefinition> | undefined;
|
|
38
48
|
constructor({ context, identifier, value }: DefinitionBaseArgs<V>);
|
|
39
49
|
/** Renders the definition's code. Implemented by the concrete subclass. */
|
|
40
50
|
abstract toString(): string;
|
package/esm/dsl/Definition.js
CHANGED
|
@@ -31,6 +31,20 @@ export class DefinitionBase extends SnippetBase {
|
|
|
31
31
|
writable: true,
|
|
32
32
|
value: void 0
|
|
33
33
|
});
|
|
34
|
+
/**
|
|
35
|
+
* The models this Definition's model reached while its projection was
|
|
36
|
+
* being constructed that were pending then: the models further up the
|
|
37
|
+
* stack it refers back to, directly or through the models it refers to.
|
|
38
|
+
* A reference to this model is inside a cycle while one of them is still
|
|
39
|
+
* pending. Set by the `ModelDriver`; `undefined` for a Definition it did
|
|
40
|
+
* not construct.
|
|
41
|
+
*/
|
|
42
|
+
Object.defineProperty(this, "reaches", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
configurable: true,
|
|
45
|
+
writable: true,
|
|
46
|
+
value: void 0
|
|
47
|
+
});
|
|
34
48
|
this.value = value;
|
|
35
49
|
this.identifier = identifier;
|
|
36
50
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { IdentifierBase } from './IdentifierBase.js';
|
|
2
|
+
import type { GeneratorKey } from './GeneratorKeys.js';
|
|
3
|
+
type PendingDefinitionArgs = {
|
|
4
|
+
identifier: IdentifierBase;
|
|
5
|
+
exportPath: string;
|
|
6
|
+
generatorKey: GeneratorKey;
|
|
7
|
+
options: unknown;
|
|
8
|
+
projection: unknown;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A model whose projection is being constructed. The `ModelDriver` pushes it
|
|
12
|
+
* onto the context's `pendingStack` before it runs the projection's
|
|
13
|
+
* constructor, and pops it however the constructor ends, so the stack holds
|
|
14
|
+
* exactly the models under construction. The model's File does not see it:
|
|
15
|
+
* the Driver adds the Definition when the constructor returns.
|
|
16
|
+
*
|
|
17
|
+
* A reference to the model from inside that constructor (a cycle: the model
|
|
18
|
+
* refers to itself, or to a model that refers back to it) finds this entry,
|
|
19
|
+
* not a cache miss. `toModelRef` returns it suspended: the reference gets the
|
|
20
|
+
* model's identity, which is all a reference by name needs, and no value,
|
|
21
|
+
* which does not exist yet. A second projection for the model is never
|
|
22
|
+
* constructed.
|
|
23
|
+
*/
|
|
24
|
+
export declare class PendingDefinition {
|
|
25
|
+
identifier: IdentifierBase;
|
|
26
|
+
/** The file the Definition will go to, normalized. */
|
|
27
|
+
exportPath: string;
|
|
28
|
+
/** The key the Definition will carry: the identity check runs on the entry too. */
|
|
29
|
+
generatorKey: GeneratorKey;
|
|
30
|
+
/** The caller's options the projection is constructed with: identity, like the key. */
|
|
31
|
+
options: unknown;
|
|
32
|
+
/** The projection class being constructed: another class under this name and file is a clash. */
|
|
33
|
+
projection: unknown;
|
|
34
|
+
/** How many references found the model under construction: references back to it. */
|
|
35
|
+
backReferences: number;
|
|
36
|
+
/** True while the projection's constructor runs; false once it returned, however it returned. */
|
|
37
|
+
pending: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The models this model's construction reached while they were under
|
|
40
|
+
* construction: the targets of its references back, and what the models it
|
|
41
|
+
* refers to reached. When the constructor returns, the Driver hands the set
|
|
42
|
+
* to the Definition (`DefinitionBase.reaches`).
|
|
43
|
+
*/
|
|
44
|
+
reaches: Set<PendingDefinition>;
|
|
45
|
+
constructor({ identifier, exportPath, generatorKey, options, projection }: PendingDefinitionArgs);
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A model whose projection is being constructed. The `ModelDriver` pushes it
|
|
3
|
+
* onto the context's `pendingStack` before it runs the projection's
|
|
4
|
+
* constructor, and pops it however the constructor ends, so the stack holds
|
|
5
|
+
* exactly the models under construction. The model's File does not see it:
|
|
6
|
+
* the Driver adds the Definition when the constructor returns.
|
|
7
|
+
*
|
|
8
|
+
* A reference to the model from inside that constructor (a cycle: the model
|
|
9
|
+
* refers to itself, or to a model that refers back to it) finds this entry,
|
|
10
|
+
* not a cache miss. `toModelRef` returns it suspended: the reference gets the
|
|
11
|
+
* model's identity, which is all a reference by name needs, and no value,
|
|
12
|
+
* which does not exist yet. A second projection for the model is never
|
|
13
|
+
* constructed.
|
|
14
|
+
*/
|
|
15
|
+
export class PendingDefinition {
|
|
16
|
+
constructor({ identifier, exportPath, generatorKey, options, projection }) {
|
|
17
|
+
Object.defineProperty(this, "identifier", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
configurable: true,
|
|
20
|
+
writable: true,
|
|
21
|
+
value: void 0
|
|
22
|
+
});
|
|
23
|
+
/** The file the Definition will go to, normalized. */
|
|
24
|
+
Object.defineProperty(this, "exportPath", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
configurable: true,
|
|
27
|
+
writable: true,
|
|
28
|
+
value: void 0
|
|
29
|
+
});
|
|
30
|
+
/** The key the Definition will carry: the identity check runs on the entry too. */
|
|
31
|
+
Object.defineProperty(this, "generatorKey", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
configurable: true,
|
|
34
|
+
writable: true,
|
|
35
|
+
value: void 0
|
|
36
|
+
});
|
|
37
|
+
/** The caller's options the projection is constructed with: identity, like the key. */
|
|
38
|
+
Object.defineProperty(this, "options", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
configurable: true,
|
|
41
|
+
writable: true,
|
|
42
|
+
value: void 0
|
|
43
|
+
});
|
|
44
|
+
/** The projection class being constructed: another class under this name and file is a clash. */
|
|
45
|
+
Object.defineProperty(this, "projection", {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
configurable: true,
|
|
48
|
+
writable: true,
|
|
49
|
+
value: void 0
|
|
50
|
+
});
|
|
51
|
+
/** How many references found the model under construction: references back to it. */
|
|
52
|
+
Object.defineProperty(this, "backReferences", {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
configurable: true,
|
|
55
|
+
writable: true,
|
|
56
|
+
value: 0
|
|
57
|
+
});
|
|
58
|
+
/** True while the projection's constructor runs; false once it returned, however it returned. */
|
|
59
|
+
Object.defineProperty(this, "pending", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
configurable: true,
|
|
62
|
+
writable: true,
|
|
63
|
+
value: true
|
|
64
|
+
});
|
|
65
|
+
/**
|
|
66
|
+
* The models this model's construction reached while they were under
|
|
67
|
+
* construction: the targets of its references back, and what the models it
|
|
68
|
+
* refers to reached. When the constructor returns, the Driver hands the set
|
|
69
|
+
* to the Definition (`DefinitionBase.reaches`).
|
|
70
|
+
*/
|
|
71
|
+
Object.defineProperty(this, "reaches", {
|
|
72
|
+
enumerable: true,
|
|
73
|
+
configurable: true,
|
|
74
|
+
writable: true,
|
|
75
|
+
value: new Set()
|
|
76
|
+
});
|
|
77
|
+
this.identifier = identifier;
|
|
78
|
+
this.exportPath = exportPath;
|
|
79
|
+
this.generatorKey = generatorKey;
|
|
80
|
+
this.options = options;
|
|
81
|
+
this.projection = projection;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -36,7 +36,11 @@ export declare class ModelDriver<V extends GeneratedValue, EnrichmentType, Proje
|
|
|
36
36
|
variant: string;
|
|
37
37
|
/** The caller's options, as passed to `insertModel`. */
|
|
38
38
|
options: ProjectionOptions;
|
|
39
|
-
|
|
39
|
+
/**
|
|
40
|
+
* @param settings - The model's content settings, when the caller has
|
|
41
|
+
* already built them with the same `args` (`toModelRef` does).
|
|
42
|
+
*/
|
|
43
|
+
constructor(args: CreateModelArgs<V, EnrichmentType, ProjectionOptions>, settings?: ContentSettings<EnrichmentType>);
|
|
40
44
|
private apply;
|
|
41
45
|
/**
|
|
42
46
|
* Ensure the file at `path` exists, creating it on first write through
|
|
@@ -45,7 +49,57 @@ export declare class ModelDriver<V extends GeneratedValue, EnrichmentType, Proje
|
|
|
45
49
|
* cache-hit path). Returns the normalized path.
|
|
46
50
|
*/
|
|
47
51
|
private ensureFile;
|
|
52
|
+
/** The code File at `path`, created through the projection's language on first use. */
|
|
53
|
+
private ensureCodeFile;
|
|
48
54
|
private getDefinition;
|
|
49
55
|
private affirmDefinition;
|
|
50
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Whether anything referred back to the model of `settings` while its
|
|
59
|
+
* projection was being constructed: the model is recursive, on its own or in
|
|
60
|
+
* a cycle with others. Call it from the projection's constructor, after the
|
|
61
|
+
* value is built, while the model is still pending.
|
|
62
|
+
*/
|
|
63
|
+
export declare const isReferencedBack: ({ context, settings }: IsReferencedBackArgs) => boolean;
|
|
64
|
+
type IsReferencedBackArgs = {
|
|
65
|
+
context: GenerateContextType;
|
|
66
|
+
settings: {
|
|
67
|
+
identifier: {
|
|
68
|
+
name: string;
|
|
69
|
+
};
|
|
70
|
+
exportPath: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* What a ref snippet gets for a reference to a model: `suspended` when the
|
|
75
|
+
* model is pending (a back-reference, which the snippet renders deferred,
|
|
76
|
+
* e.g. `z.lazy(() => Name)`: the value does not exist yet), else the
|
|
77
|
+
* Definition the Driver constructed or found.
|
|
78
|
+
*/
|
|
79
|
+
export type ModelRef<V extends GeneratedValue, EnrichmentType> = {
|
|
80
|
+
suspended: true;
|
|
81
|
+
settings: ContentSettings<EnrichmentType>;
|
|
82
|
+
} | {
|
|
83
|
+
suspended: false;
|
|
84
|
+
settings: ContentSettings<EnrichmentType>;
|
|
85
|
+
definition: GeneratedDefinition<V>;
|
|
86
|
+
/**
|
|
87
|
+
* The model reached a model that is still pending, so this reference is
|
|
88
|
+
* inside a cycle. Every reference inside a cycle must be deferred where
|
|
89
|
+
* the target language reads the value when the module loads (zod's
|
|
90
|
+
* `z.lazy`): any model of the cycle can be the first one loaded.
|
|
91
|
+
*/
|
|
92
|
+
inCycle: boolean;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Reference a model from a ref snippet. A pending model (its projection is
|
|
96
|
+
* being constructed further up the stack) is a back-reference: its marker
|
|
97
|
+
* counts it, so its projection can tell that it is recursive
|
|
98
|
+
* ({@link isReferencedBack}), and its import is stitched into
|
|
99
|
+
* `destinationPath` as for any reference. The import matters when the
|
|
100
|
+
* back-reference crosses files: in a cycle of two or more models, the model
|
|
101
|
+
* that refers back lives in another file. Any other model goes through the
|
|
102
|
+
* {@link ModelDriver}.
|
|
103
|
+
*/
|
|
104
|
+
export declare const toModelRef: <V extends GeneratedValue, EnrichmentType, ProjectionOptions = undefined>(args: CreateModelArgs<V, EnrichmentType, ProjectionOptions>) => ModelRef<V, EnrichmentType>;
|
|
51
105
|
export {};
|