@techspokes/typescript-wsdl-client 1.1.5 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -68
- package/dist/app/generateApp.d.ts +0 -1
- package/dist/app/generateApp.js +1 -1
- package/dist/app/generateCheckedApp.d.ts +38 -0
- package/dist/app/generateCheckedApp.js +108 -0
- package/dist/checkedPipeline.d.ts +155 -0
- package/dist/checkedPipeline.js +448 -0
- package/dist/checkedPlanning.d.ts +123 -0
- package/dist/checkedPlanning.js +268 -0
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +92 -2
- package/dist/client/checkedDirectRuntime.d.ts +40 -3
- package/dist/client/checkedDirectRuntime.js +28 -8
- package/dist/client/directClientRuntime.d.ts +27 -2
- package/dist/client/directClientRuntime.js +142 -89
- package/dist/client/directClientVersion.d.ts +3 -1
- package/dist/client/directClientVersion.js +3 -0
- package/dist/client/generateClient.d.ts +0 -1
- package/dist/client/generateClient.js +98 -28
- package/dist/client/generateDirectClient.d.ts +21 -3
- package/dist/client/generateDirectClient.js +138 -6
- package/dist/client/generateOperations.d.ts +0 -1
- package/dist/client/generateOperations.js +30 -11
- package/dist/client/generateTypes.d.ts +0 -1
- package/dist/client/generateUtils.d.ts +0 -1
- package/dist/client/generateUtils.js +7 -1
- package/dist/compiler/applicationGroups.d.ts +53 -0
- package/dist/compiler/applicationGroups.js +403 -0
- package/dist/compiler/buildCanonicalGraph.d.ts +0 -1
- package/dist/compiler/canonicalGraph.d.ts +4 -16
- package/dist/compiler/canonicalGraph.js +1 -8
- package/dist/compiler/catalogErrors.d.ts +0 -1
- package/dist/compiler/catalogProvenance.d.ts +0 -1
- package/dist/compiler/checkedAssessment.d.ts +0 -1
- package/dist/compiler/checkedAssessment.js +1 -1
- package/dist/compiler/checkedComponentSource.d.ts +16 -0
- package/dist/compiler/checkedComponentSource.js +31 -0
- package/dist/compiler/checkedSourcePreparation.d.ts +38 -1
- package/dist/compiler/checkedSourcePreparation.js +71 -0
- package/dist/compiler/complexTypeContent.d.ts +5 -6
- package/dist/compiler/complexTypeContent.js +2 -2
- package/dist/compiler/componentCorrespondence.d.ts +32 -0
- package/dist/compiler/componentCorrespondence.js +140 -0
- package/dist/compiler/componentRecordProjection.d.ts +112 -0
- package/dist/compiler/componentRecordProjection.js +329 -0
- package/dist/compiler/componentSoapPreparation.d.ts +20 -0
- package/dist/compiler/componentSoapPreparation.js +36 -0
- package/dist/compiler/composeCanonicalGraph.d.ts +0 -1
- package/dist/compiler/dataOwnership.d.ts +0 -1
- package/dist/compiler/dataOwnership.js +14 -4
- package/dist/compiler/datatypeValues.d.ts +0 -1
- package/dist/compiler/declarationIdentity.d.ts +22 -0
- package/dist/compiler/declarationIdentity.js +9 -0
- package/dist/compiler/directCodec.d.ts +79 -2
- package/dist/compiler/directCodec.js +310 -92
- package/dist/compiler/directExecutionPolicy.d.ts +0 -1
- package/dist/compiler/directOperation.d.ts +72 -8
- package/dist/compiler/directOperation.js +164 -19
- package/dist/compiler/directSoap.d.ts +29 -5
- package/dist/compiler/directSoap.js +154 -44
- package/dist/compiler/directSoapSource.d.ts +24 -1
- package/dist/compiler/directSoapSource.js +166 -19
- package/dist/compiler/directSourceCapsule.d.ts +74 -2
- package/dist/compiler/directSourceCapsule.js +484 -6
- package/dist/compiler/directStructure.d.ts +83 -6
- package/dist/compiler/directStructure.js +353 -58
- package/dist/compiler/directStructurePlan.d.ts +144 -2
- package/dist/compiler/directStructurePlan.js +615 -30
- package/dist/compiler/directValues.d.ts +76 -5
- package/dist/compiler/directValues.js +967 -117
- package/dist/compiler/finiteRe01Construction.d.ts +69 -0
- package/dist/compiler/finiteRe01Construction.js +422 -0
- package/dist/compiler/finiteRe01Verification.d.ts +81 -3
- package/dist/compiler/finiteRe01Verification.js +391 -4
- package/dist/compiler/generateCatalog.d.ts +0 -1
- package/dist/compiler/graphTraversal.d.ts +0 -1
- package/dist/compiler/hypotheticalScopedIdentity.d.ts +0 -1
- package/dist/compiler/legacyDeclarations.d.ts +26 -0
- package/dist/compiler/legacyDeclarations.js +144 -0
- package/dist/compiler/occurrenceAnalysis.d.ts +2 -1
- package/dist/compiler/occurrenceAnalysis.js +23 -7
- package/dist/compiler/originalSourceMembership.d.ts +0 -1
- package/dist/compiler/particleAttribution.d.ts +0 -1
- package/dist/compiler/particleAttribution.js +20 -0
- package/dist/compiler/particleDeclarationConsistency.d.ts +0 -1
- package/dist/compiler/particleDeclarationConsistency.js +9 -0
- package/dist/compiler/particleExtension.d.ts +0 -1
- package/dist/compiler/particleExtension.js +5 -1
- package/dist/compiler/particleLocalAssessment.d.ts +0 -1
- package/dist/compiler/particleRestriction.d.ts +0 -1
- package/dist/compiler/particleRestriction.js +6 -1
- package/dist/compiler/particleSemanticView.d.ts +2 -1
- package/dist/compiler/particleSemanticView.js +16 -3
- package/dist/compiler/particleWildcardRelation.d.ts +0 -1
- package/dist/compiler/projectionScalar.d.ts +49 -0
- package/dist/compiler/projectionScalar.js +218 -0
- package/dist/compiler/re01CandidateAssignments.d.ts +95 -0
- package/dist/compiler/re01CandidateAssignments.js +341 -0
- package/dist/compiler/re01CandidateCorrespondence.d.ts +22 -1
- package/dist/compiler/re01CandidateCorrespondence.js +167 -38
- package/dist/compiler/re01TypeProperties.d.ts +0 -1
- package/dist/compiler/re01TypePropertyValidation.d.ts +0 -1
- package/dist/compiler/resolveCanonicalGraph.d.ts +5 -2
- package/dist/compiler/resolveCanonicalGraph.js +77 -7
- package/dist/compiler/rpcStringValues.d.ts +30 -0
- package/dist/compiler/rpcStringValues.js +196 -0
- package/dist/compiler/rpcTypedValues.d.ts +48 -0
- package/dist/compiler/rpcTypedValues.js +190 -0
- package/dist/compiler/scalarSchemaAssessment.d.ts +0 -1
- package/dist/compiler/schemaAttributeGroupProperties.d.ts +0 -1
- package/dist/compiler/schemaAttributeProperties.d.ts +0 -1
- package/dist/compiler/schemaAttributeUses.d.ts +22 -2
- package/dist/compiler/schemaAttributeUses.js +86 -13
- package/dist/compiler/schemaBinaryWordReconstruction.d.ts +0 -1
- package/dist/compiler/schemaBuiltinFacets.d.ts +0 -1
- package/dist/compiler/schemaCalendarImages.d.ts +0 -1
- package/dist/compiler/schemaCalendarLanguage.d.ts +0 -1
- package/dist/compiler/schemaCompiler.d.ts +0 -1
- package/dist/compiler/schemaCompiler.js +44 -109
- package/dist/compiler/schemaComponentEquality.d.ts +0 -1
- package/dist/compiler/schemaConstructionAssessment.d.ts +34 -1
- package/dist/compiler/schemaConstructionAssessment.js +88 -6
- package/dist/compiler/schemaDatatypeValues.d.ts +0 -1
- package/dist/compiler/schemaDecimalLanguage.d.ts +0 -1
- package/dist/compiler/schemaDeclarationPrimitives.d.ts +7 -2
- package/dist/compiler/schemaDeclarationPrimitives.js +18 -1
- package/dist/compiler/schemaDocumentSyntax.d.ts +0 -1
- package/dist/compiler/schemaDurationLanguage.d.ts +0 -1
- package/dist/compiler/schemaElementInstance.d.ts +30 -0
- package/dist/compiler/schemaElementInstance.js +45 -0
- package/dist/compiler/schemaElementProperties.d.ts +0 -1
- package/dist/compiler/schemaEndpointWordCapacity.d.ts +0 -1
- package/dist/compiler/schemaExactCalendar.d.ts +0 -1
- package/dist/compiler/schemaFacetAnnotation.d.ts +0 -1
- package/dist/compiler/schemaGeneratedScalarShape.d.ts +0 -1
- package/dist/compiler/schemaGeneratedScalarShape.js +2 -0
- package/dist/compiler/schemaIdentityConstraints.d.ts +0 -1
- package/dist/compiler/schemaIeeeLanguage.d.ts +0 -1
- package/dist/compiler/schemaIntegerImages.d.ts +0 -1
- package/dist/compiler/schemaLexicalPredicates.d.ts +0 -1
- package/dist/compiler/schemaNotationProperties.d.ts +0 -1
- package/dist/compiler/schemaNumericImageConditions.d.ts +0 -1
- package/dist/compiler/schemaParticleWildcardProperties.d.ts +0 -1
- package/dist/compiler/schemaPattern.d.ts +0 -1
- package/dist/compiler/schemaRegularLanguage.d.ts +0 -1
- package/dist/compiler/schemaScalarContext.d.ts +5 -1
- package/dist/compiler/schemaScalarKernel.d.ts +0 -1
- package/dist/compiler/schemaScalarWitnesses.d.ts +0 -1
- package/dist/compiler/schemaSimpleTypeProperties.d.ts +0 -1
- package/dist/compiler/schemaSourceGrammar.d.ts +0 -1
- package/dist/compiler/schemaSourceLexical.d.ts +0 -1
- package/dist/compiler/schemaSourceValues.d.ts +0 -1
- package/dist/compiler/schemaSourceWildcards.d.ts +1 -2
- package/dist/compiler/schemaSourceWildcards.js +3 -1
- package/dist/compiler/schemaSymbolicSequences.d.ts +0 -1
- package/dist/compiler/schemaSymbolicValueSets.d.ts +0 -1
- package/dist/compiler/schemaSyntaxAssessment.d.ts +0 -1
- package/dist/compiler/schemaTemporalAliases.d.ts +0 -1
- package/dist/compiler/schemaTokenImages.d.ts +0 -1
- package/dist/compiler/schemaTypeIdentity.d.ts +0 -1
- package/dist/compiler/schemaTypeIdentity.js +2 -0
- package/dist/compiler/schemaTypeRelations.d.ts +0 -1
- package/dist/compiler/schemaUri.d.ts +0 -1
- package/dist/compiler/schemaValueContext.d.ts +0 -1
- package/dist/compiler/schemaValueImages.d.ts +0 -1
- package/dist/compiler/schemaValueSequences.d.ts +0 -1
- package/dist/compiler/semanticBudget.d.ts +18 -1
- package/dist/compiler/semanticBudget.js +17 -2
- package/dist/compiler/semanticCatalog.d.ts +2 -3
- package/dist/compiler/semanticContext.d.ts +12 -1
- package/dist/compiler/semanticContext.js +39 -0
- package/dist/compiler/semanticTypeDependencies.d.ts +0 -1
- package/dist/compiler/semanticTypeReference.d.ts +0 -1
- package/dist/compiler/shapeResolver.d.ts +0 -1
- package/dist/compiler/soapHeaders.d.ts +16 -0
- package/dist/compiler/soapHeaders.js +42 -0
- package/dist/compiler/sourceSchemaBinding.d.ts +0 -1
- package/dist/compiler/standardSchemaComponents.d.ts +71 -0
- package/dist/compiler/standardSchemaComponents.js +74 -0
- package/dist/compiler/standardSchemaConstruction.d.ts +20 -0
- package/dist/compiler/standardSchemaConstruction.js +34 -0
- package/dist/compiler/structuralCompanions.d.ts +0 -1
- package/dist/compiler/validateSemanticGraph.d.ts +0 -1
- package/dist/compiler/wildcardAlgebra.d.ts +0 -1
- package/dist/compiler/wsdlPolicyRequirements.d.ts +43 -0
- package/dist/compiler/wsdlPolicyRequirements.js +239 -0
- package/dist/config.d.ts +0 -1
- package/dist/gateway/generateCheckedGateway.d.ts +32 -0
- package/dist/gateway/generateCheckedGateway.js +293 -0
- package/dist/gateway/generateComposedGateway.d.ts +16 -0
- package/dist/gateway/generateComposedGateway.js +65 -0
- package/dist/gateway/generateGateway.d.ts +0 -1
- package/dist/gateway/generateGateway.js +1 -0
- package/dist/gateway/generators.d.ts +0 -1
- package/dist/gateway/generators.js +19 -4
- package/dist/gateway/helpers.d.ts +1 -1
- package/dist/gateway/helpers.js +15 -0
- package/dist/generation/componentShape.d.ts +14 -0
- package/dist/generation/componentShape.js +293 -0
- package/dist/generation/preamble.d.ts +0 -1
- package/dist/generation/sourceLayout.d.ts +13 -0
- package/dist/generation/sourceLayout.js +40 -0
- package/dist/generation/writeGeneratedSource.d.ts +0 -1
- package/dist/index.d.ts +11 -2
- package/dist/index.js +4 -1
- package/dist/loader/fetch.d.ts +0 -1
- package/dist/loader/orderedSyntax.d.ts +12 -1
- package/dist/loader/orderedSyntax.js +40 -6
- package/dist/loader/resolutionDepth.d.ts +0 -1
- package/dist/loader/schemaInput.d.ts +28 -1
- package/dist/loader/schemaInput.js +41 -4
- package/dist/loader/schemaResources.d.ts +2 -1
- package/dist/loader/schemaResources.js +45 -4
- package/dist/loader/wsdlLoader.d.ts +0 -1
- package/dist/multiServicePipeline.d.ts +41 -0
- package/dist/multiServicePipeline.js +287 -0
- package/dist/openapi/casing.d.ts +0 -1
- package/dist/openapi/composeOpenAPI.d.ts +29 -0
- package/dist/openapi/composeOpenAPI.js +322 -0
- package/dist/openapi/generateOpenAPI.d.ts +0 -1
- package/dist/openapi/generatePaths.d.ts +0 -1
- package/dist/openapi/generateSchemas.d.ts +0 -1
- package/dist/openapi/security.d.ts +0 -1
- package/dist/pipeline.d.ts +7 -3
- package/dist/pipeline.js +15 -0
- package/dist/test/generateCheckedTests.d.ts +17 -0
- package/dist/test/generateCheckedTests.js +60 -0
- package/dist/test/generateTests.d.ts +0 -1
- package/dist/test/generators.d.ts +0 -1
- package/dist/test/mockData.d.ts +0 -1
- package/dist/test/mockData.js +20 -14
- package/dist/util/attributeWildcards.d.ts +0 -1
- package/dist/util/builder.d.ts +0 -1
- package/dist/util/catalogMeta.d.ts +0 -1
- package/dist/util/checkedCliDiagnostics.d.ts +11 -0
- package/dist/util/checkedCliDiagnostics.js +22 -0
- package/dist/util/cli.d.ts +0 -1
- package/dist/util/errors.d.ts +0 -1
- package/dist/util/imports.d.ts +0 -1
- package/dist/util/runtimeSource.d.ts +0 -1
- package/dist/util/runtimeSource.js +3 -5
- package/dist/util/securityConfig.d.ts +0 -1
- package/dist/util/streamConfig.d.ts +0 -1
- package/dist/util/tools.d.ts +0 -1
- package/dist/util/xmlWhitespace.d.ts +0 -1
- package/dist/xsd/primitives.d.ts +0 -1
- package/docs/agent-skill.md +12 -1
- package/docs/api-reference.md +127 -9
- package/docs/checked-gateway.md +212 -0
- package/docs/checked-generation.md +167 -0
- package/docs/cli-reference.md +48 -6
- package/docs/concepts.md +139 -5
- package/docs/configuration.md +15 -4
- package/docs/corpus.md +33 -0
- package/docs/direct-values.md +13 -13
- package/docs/examples/checked-forecast.wsdl +19 -0
- package/docs/gateway-guide.md +104 -27
- package/docs/generated-code.md +22 -11
- package/docs/mapping-contract.md +114 -0
- package/docs/migration-playbook.md +5 -1
- package/docs/migration.md +124 -6
- package/docs/output-anatomy.md +21 -18
- package/docs/production.md +7 -5
- package/docs/start-here.md +19 -3
- package/docs/supported-patterns.md +24 -3
- package/docs/testing.md +119 -31
- package/docs/troubleshooting.md +3 -1
- package/llms.txt +16 -8
- package/package.json +64 -23
- package/src/runtime/checkedGatewayHost.tpl.txt +157 -0
- package/src/runtime/clientStreamMethods.tpl.txt +156 -148
- package/src/runtime/operationsStreamHelper.tpl.txt +6 -6
- package/src/runtime/streamXml.ts +49 -21
- package/dist/app/generateApp.d.ts.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/client/checkedDirectRuntime.d.ts.map +0 -1
- package/dist/client/directClientRuntime.d.ts.map +0 -1
- package/dist/client/directClientVersion.d.ts.map +0 -1
- package/dist/client/generateClient.d.ts.map +0 -1
- package/dist/client/generateDirectClient.d.ts.map +0 -1
- package/dist/client/generateOperations.d.ts.map +0 -1
- package/dist/client/generateTypes.d.ts.map +0 -1
- package/dist/client/generateUtils.d.ts.map +0 -1
- package/dist/compiler/buildCanonicalGraph.d.ts.map +0 -1
- package/dist/compiler/canonicalGraph.d.ts.map +0 -1
- package/dist/compiler/catalogErrors.d.ts.map +0 -1
- package/dist/compiler/catalogProvenance.d.ts.map +0 -1
- package/dist/compiler/checkedAssessment.d.ts.map +0 -1
- package/dist/compiler/checkedSourcePreparation.d.ts.map +0 -1
- package/dist/compiler/complexTypeContent.d.ts.map +0 -1
- package/dist/compiler/composeCanonicalGraph.d.ts.map +0 -1
- package/dist/compiler/dataOwnership.d.ts.map +0 -1
- package/dist/compiler/datatypeValues.d.ts.map +0 -1
- package/dist/compiler/directCodec.d.ts.map +0 -1
- package/dist/compiler/directExecutionPolicy.d.ts.map +0 -1
- package/dist/compiler/directOperation.d.ts.map +0 -1
- package/dist/compiler/directSoap.d.ts.map +0 -1
- package/dist/compiler/directSoapSource.d.ts.map +0 -1
- package/dist/compiler/directSourceCapsule.d.ts.map +0 -1
- package/dist/compiler/directStructure.d.ts.map +0 -1
- package/dist/compiler/directStructurePlan.d.ts.map +0 -1
- package/dist/compiler/directValues.d.ts.map +0 -1
- package/dist/compiler/finiteRe01Verification.d.ts.map +0 -1
- package/dist/compiler/generateCatalog.d.ts.map +0 -1
- package/dist/compiler/graphTraversal.d.ts.map +0 -1
- package/dist/compiler/hypotheticalScopedIdentity.d.ts.map +0 -1
- package/dist/compiler/occurrenceAnalysis.d.ts.map +0 -1
- package/dist/compiler/originalSourceMembership.d.ts.map +0 -1
- package/dist/compiler/particleAttribution.d.ts.map +0 -1
- package/dist/compiler/particleDeclarationConsistency.d.ts.map +0 -1
- package/dist/compiler/particleExtension.d.ts.map +0 -1
- package/dist/compiler/particleLocalAssessment.d.ts.map +0 -1
- package/dist/compiler/particleRestriction.d.ts.map +0 -1
- package/dist/compiler/particleSemanticView.d.ts.map +0 -1
- package/dist/compiler/particleWildcardRelation.d.ts.map +0 -1
- package/dist/compiler/re01CandidateCorrespondence.d.ts.map +0 -1
- package/dist/compiler/re01TypeProperties.d.ts.map +0 -1
- package/dist/compiler/re01TypePropertyValidation.d.ts.map +0 -1
- package/dist/compiler/resolveCanonicalGraph.d.ts.map +0 -1
- package/dist/compiler/scalarSchemaAssessment.d.ts.map +0 -1
- package/dist/compiler/schemaAttributeGroupProperties.d.ts.map +0 -1
- package/dist/compiler/schemaAttributeProperties.d.ts.map +0 -1
- package/dist/compiler/schemaAttributeUses.d.ts.map +0 -1
- package/dist/compiler/schemaBinaryWordReconstruction.d.ts.map +0 -1
- package/dist/compiler/schemaBuiltinFacets.d.ts.map +0 -1
- package/dist/compiler/schemaCalendarImages.d.ts.map +0 -1
- package/dist/compiler/schemaCalendarLanguage.d.ts.map +0 -1
- package/dist/compiler/schemaCompiler.d.ts.map +0 -1
- package/dist/compiler/schemaComponentEquality.d.ts.map +0 -1
- package/dist/compiler/schemaConstructionAssessment.d.ts.map +0 -1
- package/dist/compiler/schemaDatatypeValues.d.ts.map +0 -1
- package/dist/compiler/schemaDecimalLanguage.d.ts.map +0 -1
- package/dist/compiler/schemaDeclarationPrimitives.d.ts.map +0 -1
- package/dist/compiler/schemaDocumentSyntax.d.ts.map +0 -1
- package/dist/compiler/schemaDurationLanguage.d.ts.map +0 -1
- package/dist/compiler/schemaElementProperties.d.ts.map +0 -1
- package/dist/compiler/schemaEndpointWordCapacity.d.ts.map +0 -1
- package/dist/compiler/schemaExactCalendar.d.ts.map +0 -1
- package/dist/compiler/schemaFacetAnnotation.d.ts.map +0 -1
- package/dist/compiler/schemaGeneratedScalarShape.d.ts.map +0 -1
- package/dist/compiler/schemaIdentityConstraints.d.ts.map +0 -1
- package/dist/compiler/schemaIeeeLanguage.d.ts.map +0 -1
- package/dist/compiler/schemaIntegerImages.d.ts.map +0 -1
- package/dist/compiler/schemaLexicalPredicates.d.ts.map +0 -1
- package/dist/compiler/schemaNotationProperties.d.ts.map +0 -1
- package/dist/compiler/schemaNumericImageConditions.d.ts.map +0 -1
- package/dist/compiler/schemaParticleWildcardProperties.d.ts.map +0 -1
- package/dist/compiler/schemaPattern.d.ts.map +0 -1
- package/dist/compiler/schemaRegularLanguage.d.ts.map +0 -1
- package/dist/compiler/schemaScalarContext.d.ts.map +0 -1
- package/dist/compiler/schemaScalarKernel.d.ts.map +0 -1
- package/dist/compiler/schemaScalarWitnesses.d.ts.map +0 -1
- package/dist/compiler/schemaSimpleTypeProperties.d.ts.map +0 -1
- package/dist/compiler/schemaSourceGrammar.d.ts.map +0 -1
- package/dist/compiler/schemaSourceLexical.d.ts.map +0 -1
- package/dist/compiler/schemaSourceValues.d.ts.map +0 -1
- package/dist/compiler/schemaSourceWildcards.d.ts.map +0 -1
- package/dist/compiler/schemaSymbolicSequences.d.ts.map +0 -1
- package/dist/compiler/schemaSymbolicValueSets.d.ts.map +0 -1
- package/dist/compiler/schemaSyntaxAssessment.d.ts.map +0 -1
- package/dist/compiler/schemaTemporalAliases.d.ts.map +0 -1
- package/dist/compiler/schemaTokenImages.d.ts.map +0 -1
- package/dist/compiler/schemaTypeIdentity.d.ts.map +0 -1
- package/dist/compiler/schemaTypeRelations.d.ts.map +0 -1
- package/dist/compiler/schemaUri.d.ts.map +0 -1
- package/dist/compiler/schemaValueContext.d.ts.map +0 -1
- package/dist/compiler/schemaValueImages.d.ts.map +0 -1
- package/dist/compiler/schemaValueSequences.d.ts.map +0 -1
- package/dist/compiler/semanticBudget.d.ts.map +0 -1
- package/dist/compiler/semanticCatalog.d.ts.map +0 -1
- package/dist/compiler/semanticContext.d.ts.map +0 -1
- package/dist/compiler/semanticTypeDependencies.d.ts.map +0 -1
- package/dist/compiler/semanticTypeReference.d.ts.map +0 -1
- package/dist/compiler/shapeResolver.d.ts.map +0 -1
- package/dist/compiler/sourceSchemaBinding.d.ts.map +0 -1
- package/dist/compiler/structuralCompanions.d.ts.map +0 -1
- package/dist/compiler/validateSemanticGraph.d.ts.map +0 -1
- package/dist/compiler/wildcardAlgebra.d.ts.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/gateway/generateGateway.d.ts.map +0 -1
- package/dist/gateway/generators.d.ts.map +0 -1
- package/dist/gateway/helpers.d.ts.map +0 -1
- package/dist/generation/preamble.d.ts.map +0 -1
- package/dist/generation/writeGeneratedSource.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/loader/fetch.d.ts.map +0 -1
- package/dist/loader/orderedSyntax.d.ts.map +0 -1
- package/dist/loader/resolutionDepth.d.ts.map +0 -1
- package/dist/loader/schemaInput.d.ts.map +0 -1
- package/dist/loader/schemaResources.d.ts.map +0 -1
- package/dist/loader/wsdlLoader.d.ts.map +0 -1
- package/dist/openapi/casing.d.ts.map +0 -1
- package/dist/openapi/generateOpenAPI.d.ts.map +0 -1
- package/dist/openapi/generatePaths.d.ts.map +0 -1
- package/dist/openapi/generateSchemas.d.ts.map +0 -1
- package/dist/openapi/security.d.ts.map +0 -1
- package/dist/pipeline.d.ts.map +0 -1
- package/dist/runtime/jsonArray.d.ts +0 -24
- package/dist/runtime/jsonArray.d.ts.map +0 -1
- package/dist/runtime/jsonArray.js +0 -52
- package/dist/runtime/ndjson.d.ts +0 -24
- package/dist/runtime/ndjson.d.ts.map +0 -1
- package/dist/runtime/ndjson.js +0 -30
- package/dist/runtime/streamXml.d.ts +0 -45
- package/dist/runtime/streamXml.d.ts.map +0 -1
- package/dist/runtime/streamXml.js +0 -212
- package/dist/test/generateTests.d.ts.map +0 -1
- package/dist/test/generators.d.ts.map +0 -1
- package/dist/test/mockData.d.ts.map +0 -1
- package/dist/util/attributeWildcards.d.ts.map +0 -1
- package/dist/util/builder.d.ts.map +0 -1
- package/dist/util/catalogMeta.d.ts.map +0 -1
- package/dist/util/cli.d.ts.map +0 -1
- package/dist/util/errors.d.ts.map +0 -1
- package/dist/util/imports.d.ts.map +0 -1
- package/dist/util/runtimeSource.d.ts.map +0 -1
- package/dist/util/securityConfig.d.ts.map +0 -1
- package/dist/util/streamConfig.d.ts.map +0 -1
- package/dist/util/tools.d.ts.map +0 -1
- package/dist/util/xmlWhitespace.d.ts.map +0 -1
- package/dist/xsd/primitives.d.ts.map +0 -1
- package/docs/AGENTS.md +0 -47
- package/docs/README.md +0 -69
- package/docs/architecture.md +0 -158
- package/docs/content-model-analysis.md +0 -92
- package/docs/content-model-baseline.md +0 -121
- package/docs/content-model-catalog.md +0 -116
- package/docs/content-model-companions.md +0 -90
- package/docs/content-model-composition.md +0 -103
- package/docs/content-model-decisions.md +0 -79
- package/docs/content-model-gateway-feasibility.md +0 -169
- package/docs/content-model-graph.md +0 -121
- package/docs/content-model-loading.md +0 -163
- package/docs/content-model-matching.md +0 -85
- package/docs/content-model-readiness.md +0 -144
- package/docs/content-model-resolution.md +0 -81
- package/docs/content-model-s02-handoff.md +0 -98
- package/docs/content-model-s06-au-01.md +0 -425
- package/docs/content-model-s06-dt-01.md +0 -386
- package/docs/content-model-s06-pw-01.md +0 -350
- package/docs/content-model-s06-re-01-resolver-implementation.md +0 -869
- package/docs/content-model-s06-re-01-resolver.md +0 -513
- package/docs/content-model-s06-re-01-scalar-witnesses.md +0 -1423
- package/docs/content-model-s06-re-01-support-reconstruction.md +0 -6337
- package/docs/content-model-s06-re-01.md +0 -7477
- package/docs/content-model-s06-research-handoff.md +0 -909
- package/docs/content-model-shipped-fix.md +0 -83
- package/docs/content-model-soap-feasibility.md +0 -165
- package/docs/decisions/001-test-generation.md +0 -36
- package/docs/decisions/002-streamable-responses.md +0 -332
- package/docs/decisions/003-content-model-contracts.md +0 -280
- package/docs/file-naming-and-path-organization.md +0 -213
- package/docs/reference-validation.md +0 -243
- package/docs/releases/README.md +0 -94
- package/docs/releases/v0.20.0.md +0 -22
- package/docs/releases/v0.21.0.md +0 -30
- package/docs/releases/v0.22.0.md +0 -30
- package/docs/releases/v0.23.0.md +0 -31
- package/docs/releases/v0.24.0.md +0 -38
- package/docs/releases/v0.25.0.md +0 -31
- package/docs/releases/v0.25.2.md +0 -32
- package/docs/releases/v0.26.0.md +0 -32
- package/docs/releases/v0.27.0.md +0 -31
- package/docs/releases/v0.28.0.md +0 -32
- package/docs/releases/v0.29.0.md +0 -32
- package/docs/releases/v0.30.0.md +0 -30
- package/docs/releases/v0.30.1.md +0 -31
- package/docs/releases/v0.30.2.md +0 -30
- package/docs/releases/v0.30.3.md +0 -33
- package/docs/releases/v0.31.0.md +0 -33
- package/docs/releases/v0.32.0.md +0 -33
- package/docs/releases/v0.33.0.md +0 -34
- package/docs/releases/v0.34.0.md +0 -30
- package/docs/releases/v0.35.0.md +0 -33
- package/docs/releases/v0.36.0.md +0 -32
- package/docs/releases/v0.37.0.md +0 -33
- package/docs/releases/v0.38.0.md +0 -35
- package/docs/releases/v0.39.0.md +0 -35
- package/docs/releases/v0.40.0.md +0 -45
- package/docs/releases/v0.40.1.md +0 -34
- package/docs/releases/v1.0.0.md +0 -42
- package/docs/releases/v1.0.1.md +0 -38
- package/docs/releases/v1.0.2.md +0 -51
- package/docs/releases/v1.0.3.md +0 -37
- package/docs/releases/v1.0.4.md +0 -45
- package/docs/releases/v1.0.5.md +0 -41
- package/docs/releases/v1.0.6.md +0 -35
- package/docs/releases/v1.0.7.md +0 -36
- package/docs/releases/v1.1.0.md +0 -42
- package/docs/releases/v1.1.1.md +0 -44
- package/docs/releases/v1.1.2.md +0 -42
- package/docs/releases/v1.1.3.md +0 -36
- package/docs/releases/v1.1.4.md +0 -36
- package/docs/releases/v1.1.5.md +0 -38
- package/docs/roadmap/README.md +0 -107
- package/docs/roadmap/v1.0-capability-conformance-framework.md +0 -582
- package/docs/roadmap/v1.0-choice-union-mode.md +0 -90
- package/docs/roadmap/v1.0-contract-audit.md +0 -75
- package/docs/roadmap/v1.0-json-array-streaming.md +0 -101
- package/docs/roadmap/v1.0-openapi-fastify-compatibility.md +0 -99
- package/docs/roadmap/v1.0-release-candidate-gates.md +0 -92
- package/docs/roadmap/v1.0-wsdl-coverage-matrix.md +0 -200
- package/docs/roadmap/v1.0-xs-anyattribute-wildcard-bag.md +0 -932
- package/src/runtime/jsonArray.ts +0 -55
- package/src/runtime/ndjson.ts +0 -32
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lowers issued direct mappings into HTTP documentation and a checked gateway.
|
|
3
|
+
* @since 1.1.6
|
|
4
|
+
* @constraints Serialized descriptions never issue native source or execution authority.
|
|
5
|
+
*/
|
|
6
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import { componentSourceCapsuleBytes, inspectReconstructedComponentSource, inspectComponentSourceService } from '../compiler/directSourceCapsule.js';
|
|
9
|
+
import { lowerComponentShape } from '../generation/componentShape.js';
|
|
10
|
+
import { checkSemanticBudget } from '../compiler/semanticBudget.js';
|
|
11
|
+
import { inspectDirectOperation } from '../compiler/directOperation.js';
|
|
12
|
+
import { inspectComponentValueMapping } from '../compiler/directValues.js';
|
|
13
|
+
import { composeGeneratedSource, resolvePreamble } from '../generation/preamble.js';
|
|
14
|
+
const draft07 = 'http://json-schema.org/draft-07/schema#';
|
|
15
|
+
/** Lower component mappings through the existing checked gateway emitter, retaining native supplemental validation. */
|
|
16
|
+
export async function generateComponentGateway(expected, options) {
|
|
17
|
+
inspectReconstructedComponentSource(expected);
|
|
18
|
+
return generateGatewayFromReconstruction(expected, options);
|
|
19
|
+
}
|
|
20
|
+
async function generateGatewayFromReconstruction(expected, options) {
|
|
21
|
+
if (options.signal?.aborted)
|
|
22
|
+
throw new Error('Checked gateway generation cancelled');
|
|
23
|
+
inspectReconstructedComponentSource(expected);
|
|
24
|
+
const capsule = { bytes: componentSourceCapsuleBytes(expected, options.signal) };
|
|
25
|
+
const runtime = 'checkedComponentRuntimeV1';
|
|
26
|
+
if (!options.routePath.startsWith('/') || options.routePath.split('/').slice(1)
|
|
27
|
+
.some(segment => !segment || !/^(?:[A-Za-z0-9._~-]|%[0-9A-Fa-f]{2})+$/.test(segment))) {
|
|
28
|
+
throw new TypeError('Checked routePath requires literal nonempty path segments');
|
|
29
|
+
}
|
|
30
|
+
const input = expected.mappings.find(mapping => mapping.direction.kind === 'input');
|
|
31
|
+
const output = expected.mappings.find(mapping => mapping.direction.kind === 'output');
|
|
32
|
+
if (!input || !output)
|
|
33
|
+
throw new TypeError('Issued input and output mappings required');
|
|
34
|
+
const schema = (mapping, role) => {
|
|
35
|
+
const { budget } = inspectDirectOperation(expected.contract).context;
|
|
36
|
+
return lowerComponentShape(expected.contract, mapping, role, () => {
|
|
37
|
+
checkSemanticBudget(budget);
|
|
38
|
+
if (options.signal?.aborted)
|
|
39
|
+
throw new Error('Checked gateway generation cancelled');
|
|
40
|
+
}).schema;
|
|
41
|
+
};
|
|
42
|
+
const request = schema(input, 'Request'), response = schema(output, 'Response');
|
|
43
|
+
const faults = expected.mappings.filter(mapping => mapping.direction.kind === 'fault').map(mapping => {
|
|
44
|
+
if (mapping.direction.kind !== 'fault')
|
|
45
|
+
throw new TypeError('Declared fault mapping required');
|
|
46
|
+
return { name: mapping.direction.name, value: schema(mapping, `Fault_${expected.mappings.filter(item => item.direction.kind === 'fault').indexOf(mapping)}`) };
|
|
47
|
+
});
|
|
48
|
+
const faultVariants = faults.map(fault => ({
|
|
49
|
+
type: 'object', additionalProperties: false, required: ['fault', 'value'],
|
|
50
|
+
properties: {
|
|
51
|
+
value: fault.value,
|
|
52
|
+
fault: {
|
|
53
|
+
type: 'object', additionalProperties: false, required: ['name', 'code', 'string'],
|
|
54
|
+
properties: {
|
|
55
|
+
name: { const: fault.name }, string: { type: 'string' }, actor: { type: 'string' },
|
|
56
|
+
code: { type: 'object', additionalProperties: false, required: ['namespace', 'local'],
|
|
57
|
+
properties: { namespace: { type: 'string' }, local: { type: 'string' } } },
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
}));
|
|
62
|
+
const fault = faultVariants.length ? { oneOf: faultVariants } : { not: {} };
|
|
63
|
+
const schemas = { request: { $schema: draft07, ...request }, response: { $schema: draft07, ...response }, fault: { $schema: draft07, ...fault } };
|
|
64
|
+
const grouped = expected.mappings.some(mapping => mapping.kind === 'component-mapping'
|
|
65
|
+
&& inspectComponentValueMapping(mapping, expected.contract).applicationGroups);
|
|
66
|
+
const components = Object.create(null);
|
|
67
|
+
const documented = (value, dictionary = false) => {
|
|
68
|
+
if (Array.isArray(value))
|
|
69
|
+
return value.map(item => documented(item));
|
|
70
|
+
if (!value || typeof value !== 'object')
|
|
71
|
+
return value;
|
|
72
|
+
const record = value, result = Object.create(null);
|
|
73
|
+
// @why Property names belong to the application; definitions and $id are keywords only at schema nodes.
|
|
74
|
+
if (dictionary) {
|
|
75
|
+
for (const [key, item] of Object.entries(record))
|
|
76
|
+
result[key] = documented(item);
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
if (Object.hasOwn(record, 'definitions'))
|
|
80
|
+
for (const [key, definition] of Object.entries(record.definitions)) {
|
|
81
|
+
const resolved = documented(definition);
|
|
82
|
+
if (components[key] && JSON.stringify(components[key]) !== JSON.stringify(resolved))
|
|
83
|
+
throw new TypeError(`applicationGroups OpenAPI component collision ${key}`);
|
|
84
|
+
components[key] = resolved;
|
|
85
|
+
}
|
|
86
|
+
for (const [key, item] of Object.entries(record)) {
|
|
87
|
+
if (key === 'definitions' || key === '$id')
|
|
88
|
+
continue;
|
|
89
|
+
result[key] = ['const', 'enum', 'default', 'examples'].includes(key) ? item
|
|
90
|
+
: key === '$ref' && typeof item === 'string' && item.startsWith('#/definitions/') ? item.replace('#/definitions/', '#/components/schemas/')
|
|
91
|
+
: documented(item, ['properties', 'patternProperties', 'dependencies', 'dependentSchemas'].includes(key));
|
|
92
|
+
}
|
|
93
|
+
return result;
|
|
94
|
+
};
|
|
95
|
+
const documentation = grouped ? { request: documented(request), response: documented(response), fault: documented(fault) } : { request, response, fault };
|
|
96
|
+
const doc = {
|
|
97
|
+
openapi: '3.1.1', jsonSchemaDialect: 'https://json-schema.org/draft/2020-12/schema',
|
|
98
|
+
info: { title: expected.selection.service.local, version: '1.0.0' },
|
|
99
|
+
...(grouped ? { components: { schemas: components } } : {}),
|
|
100
|
+
'x-checked-model': { model: 'checked-components-v1', scope: 'native-component-structured-soap11',
|
|
101
|
+
...(expected.responseProjection
|
|
102
|
+
? { responseProjection: { spec: expected.responseProjection.spec, delivery: 'buffered', retainedValue: 'complete-companion-payload' } } : {}),
|
|
103
|
+
documentationDialect: '2020-12', runtimeDialect: 'draft-07', jsonShapeComplete: false,
|
|
104
|
+
supplementalValidation: ['native-source-compatibility', 'native-xml-scalar-and-particle'], admitted: false,
|
|
105
|
+
selection: { selector: expected.contract.selector, ...expected.selection } },
|
|
106
|
+
paths: { [options.routePath]: { post: { operationId: expected.contract.selector.operation,
|
|
107
|
+
...(expected.responseProjection
|
|
108
|
+
? { 'x-response-projection': { spec: expected.responseProjection.spec, delivery: 'buffered', retainedValue: 'complete-companion-payload' } } : {}),
|
|
109
|
+
requestBody: { required: true, content: { 'application/json': { schema: documentation.request } } },
|
|
110
|
+
responses: { '200': { description: 'Independently validated SOAP response', content: { 'application/json': { schema: documentation.response } } },
|
|
111
|
+
'400': { description: 'Invalid HTTP request; no SOAP request is dispatched' },
|
|
112
|
+
'502': { description: 'Declared SOAP fault or refused upstream response', content: { 'application/json': { schema: { oneOf: [documentation.fault,
|
|
113
|
+
{ type: 'object', additionalProperties: false, required: ['kind', 'rule'], properties: { kind: { type: 'string' }, rule: { type: 'string' } } }] } } } },
|
|
114
|
+
'500': { description: 'Incompatible artifacts or gateway configuration' } } } } },
|
|
115
|
+
};
|
|
116
|
+
let clientImport = path.relative(options.gatewayDir, path.join(options.clientDir, 'client.js')).replace(/\\/g, '/');
|
|
117
|
+
if (!clientImport.startsWith('.'))
|
|
118
|
+
clientImport = './' + clientImport;
|
|
119
|
+
const literal = (value) => JSON.stringify(value).replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029');
|
|
120
|
+
// language=TypeScript
|
|
121
|
+
const body = `import type {FastifyPluginAsync} from 'fastify';
|
|
122
|
+
import {Ajv} from 'ajv';
|
|
123
|
+
import {types} from 'node:util';
|
|
124
|
+
import {${runtime}} from '@techspokes/typescript-wsdl-client';
|
|
125
|
+
import {createClient, expectedCapsuleBase64, type Options, type Request} from ${literal(clientImport)};
|
|
126
|
+
|
|
127
|
+
export interface CheckedGatewayOptions { readonly clientOptions: Options }
|
|
128
|
+
// @constraints JSON parsing preserves XML names such as __proto__ as ordinary own data properties.
|
|
129
|
+
export const schemas = JSON.parse(${literal(JSON.stringify(schemas))}) as {request: Record<string, unknown>; response: Record<string, unknown>; fault: Record<string, unknown>};
|
|
130
|
+
export const expectedOpenApiJson = ${literal(JSON.stringify(doc))};
|
|
131
|
+
|
|
132
|
+
// @constraints Read only data properties before composing per-request cancellation.
|
|
133
|
+
function dataCopy<T extends object>(value: T): T {
|
|
134
|
+
if (!value || typeof value !== 'object' || types.isProxy(value)
|
|
135
|
+
|| ![Object.prototype, null].includes(Object.getPrototypeOf(value) as object | null)) throw new TypeError('Data-only checked gateway options required');
|
|
136
|
+
const copy: Record<string, unknown> = Object.create(null) as Record<string, unknown>;
|
|
137
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
138
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key)!;
|
|
139
|
+
if (typeof key !== 'string' || !Object.hasOwn(descriptor, 'value')) throw new TypeError('Data-only checked gateway options required');
|
|
140
|
+
copy[key] = descriptor.value;
|
|
141
|
+
}
|
|
142
|
+
return copy as T;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const plugin: FastifyPluginAsync<CheckedGatewayOptions> = async (fastify, options) => {
|
|
146
|
+
if (expectedCapsuleBase64 !== ${literal(Buffer.from(capsule.bytes).toString('base64'))}) throw new Error('incompatible-artifact: generated gateway/client mismatch; regenerate the complete project');
|
|
147
|
+
const client = createClient(${runtime});
|
|
148
|
+
const ajv = new Ajv({coerceTypes: false, useDefaults: false, removeAdditional: false, ownProperties: true, strict: true, allErrors: true});
|
|
149
|
+
const validateRequest = ajv.compile(schemas.request);
|
|
150
|
+
const validateResponse = ajv.compile(schemas.response);
|
|
151
|
+
const validateFault = ajv.compile(schemas.fault);
|
|
152
|
+
const base = dataCopy(options.clientOptions);
|
|
153
|
+
const soap = dataCopy(base.soap);
|
|
154
|
+
fastify.post(${literal(options.routePath)}, {
|
|
155
|
+
schema: {body: schemas.request},
|
|
156
|
+
validatorCompiler: () => validateRequest,
|
|
157
|
+
// @constraints Serialization preserves every validated member and never establishes validity.
|
|
158
|
+
serializerCompiler: () => value => JSON.stringify(value),
|
|
159
|
+
}, async (request, reply) => {
|
|
160
|
+
const controller = new AbortController();
|
|
161
|
+
const disconnected = () => {if (!reply.raw.writableEnded) controller.abort();};
|
|
162
|
+
request.raw.once('aborted', disconnected);
|
|
163
|
+
reply.raw.once('close', disconnected);
|
|
164
|
+
if (request.raw.aborted || reply.raw.destroyed) controller.abort();
|
|
165
|
+
try {
|
|
166
|
+
const signal = soap.signal ? AbortSignal.any([soap.signal, controller.signal]) : controller.signal;
|
|
167
|
+
const result = await client[${literal(expected.contract.selector.operation)}](request.body as Request,
|
|
168
|
+
{...base, soap: {...soap, signal}});
|
|
169
|
+
if (result.kind === 'soap-response') {
|
|
170
|
+
if (!validateResponse(result.value)) return reply.code(502).send({kind: 'value-invalid', rule: 'http-response-shape'});
|
|
171
|
+
return reply.type('application/json').serializer(value => JSON.stringify(value)).send(result.value);
|
|
172
|
+
}
|
|
173
|
+
if (result.kind === 'soap-fault') {
|
|
174
|
+
const fault = {name: result.fault.name, code: {namespace: result.fault.code.namespace, local: result.fault.code.local},
|
|
175
|
+
string: result.fault.string, ...(result.fault.actor === undefined ? {} : {actor: result.fault.actor})};
|
|
176
|
+
const value = {fault, value: result.value};
|
|
177
|
+
if (!validateFault(value)) return reply.code(502).send({kind: 'value-invalid', rule: 'http-fault-shape'});
|
|
178
|
+
return reply.code(502).type('application/json').serializer(value => JSON.stringify(value)).send(value);
|
|
179
|
+
}
|
|
180
|
+
const status = result.kind === 'incompatible-artifact' || result.kind === 'missing-authority' ? 500
|
|
181
|
+
: result.kind === 'cancelled' ? 499 : result.phase === 'input' ? 400 : 502;
|
|
182
|
+
return reply.code(status).send({kind: result.kind, rule: result.rule});
|
|
183
|
+
} finally {
|
|
184
|
+
request.raw.removeListener('aborted', disconnected);
|
|
185
|
+
reply.raw.removeListener('close', disconnected);
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
export default plugin;
|
|
190
|
+
`;
|
|
191
|
+
if (options.signal?.aborted)
|
|
192
|
+
throw new Error('Checked gateway generation cancelled');
|
|
193
|
+
const source = composeGeneratedSource(body, resolvePreamble('gateway'));
|
|
194
|
+
const emit = async () => {
|
|
195
|
+
inspectReconstructedComponentSource(expected);
|
|
196
|
+
checkSemanticBudget(inspectDirectOperation(expected.contract).context.budget);
|
|
197
|
+
if (options.signal?.aborted)
|
|
198
|
+
throw new Error('Checked gateway generation cancelled');
|
|
199
|
+
await mkdir(options.gatewayDir, { recursive: true });
|
|
200
|
+
await mkdir(path.dirname(options.openapiFile), { recursive: true });
|
|
201
|
+
await writeFile(path.join(options.gatewayDir, 'plugin.ts'), source, 'utf8');
|
|
202
|
+
await writeFile(path.join(options.gatewayDir, 'schemas.json'), JSON.stringify(schemas, null, 2) + '\n', 'utf8');
|
|
203
|
+
await writeFile(options.openapiFile, JSON.stringify(doc, null, 2) + '\n', 'utf8');
|
|
204
|
+
};
|
|
205
|
+
if (options.emit !== false)
|
|
206
|
+
await emit();
|
|
207
|
+
return { doc, emit };
|
|
208
|
+
}
|
|
209
|
+
/** Compose per-operation checked routers without merging native source, service or binding identities.
|
|
210
|
+
* @returns One OpenAPI document and exact operation-to-route mapping, both descriptions rather than authority.
|
|
211
|
+
* @throws For mixed native handles, invalid/colliding paths, cancellation or filesystem failures.
|
|
212
|
+
*/
|
|
213
|
+
export async function generateComponentServiceGateway(expected, options) {
|
|
214
|
+
const operations = inspectComponentSourceService(expected), routes = Object.create(null);
|
|
215
|
+
const paths = Object.create(null);
|
|
216
|
+
const documents = [];
|
|
217
|
+
const emissions = [];
|
|
218
|
+
const tick = () => {
|
|
219
|
+
checkSemanticBudget(inspectDirectOperation(operations[0].contract).context.budget);
|
|
220
|
+
if (options.signal?.aborted)
|
|
221
|
+
throw new Error('Checked gateway generation cancelled');
|
|
222
|
+
};
|
|
223
|
+
for (const [index, operation] of operations.entries()) {
|
|
224
|
+
tick();
|
|
225
|
+
const name = operation.contract.selector.operation, routePath = `${options.basePath}/${encodeURIComponent(name)}`;
|
|
226
|
+
const result = await generateComponentGateway(operation, { clientDir: path.join(options.clientDir, 'operations', String(index)),
|
|
227
|
+
gatewayDir: path.join(options.gatewayDir, 'routes', String(index)), openapiFile: path.join(options.gatewayDir, 'routes', String(index), 'openapi.json'), routePath, signal: options.signal, emit: false });
|
|
228
|
+
emissions.push(result.emit);
|
|
229
|
+
const doc = result.doc;
|
|
230
|
+
documents.push(doc);
|
|
231
|
+
routes[name] = routePath;
|
|
232
|
+
for (const [route, value] of Object.entries(doc.paths)) {
|
|
233
|
+
if (Object.hasOwn(paths, route))
|
|
234
|
+
throw new TypeError('Duplicate checked route');
|
|
235
|
+
paths[route] = value;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
const { responseProjection: firstProjection, ...serviceModel } = documents[0]['x-checked-model'];
|
|
239
|
+
void firstProjection;
|
|
240
|
+
const componentSchemas = Object.create(null);
|
|
241
|
+
for (const document of documents) {
|
|
242
|
+
const schemas = document.components?.schemas ?? {};
|
|
243
|
+
for (const [name, schema] of Object.entries(schemas)) {
|
|
244
|
+
if (componentSchemas[name] && JSON.stringify(componentSchemas[name]) !== JSON.stringify(schema))
|
|
245
|
+
throw new TypeError(`applicationGroups OpenAPI component collision ${name}`);
|
|
246
|
+
componentSchemas[name] = schema;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
const doc = { ...documents[0], ...(Object.keys(componentSchemas).length ? { components: { schemas: componentSchemas } } : {}), 'x-checked-model': { ...serviceModel,
|
|
250
|
+
selection: { service: operations[0].selection.service, port: operations[0].selection.port,
|
|
251
|
+
selectors: operations.map(operation => operation.contract.selector) } }, paths };
|
|
252
|
+
let clientImport = path.relative(options.gatewayDir, path.join(options.clientDir, 'client.js')).replaceAll('\\', '/');
|
|
253
|
+
if (!clientImport.startsWith('.'))
|
|
254
|
+
clientImport = './' + clientImport;
|
|
255
|
+
const literal = (value) => JSON.stringify(value).replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029');
|
|
256
|
+
const names = operations.map(operation => operation.contract.selector.operation);
|
|
257
|
+
const lines = ["import type {FastifyPluginAsync} from 'fastify';", "import {types} from 'node:util';",
|
|
258
|
+
`import type {Options} from ${literal(clientImport)};`,
|
|
259
|
+
...operations.map((_, index) => `import operation_${index} from './routes/${index}/plugin.js';`),
|
|
260
|
+
'export interface CheckedGatewayOptions {readonly clientOptions: Options; readonly capsules: Readonly<Record<string, Uint8Array>>}',
|
|
261
|
+
`export const expectedOpenApiJson = ${literal(JSON.stringify(doc))};`,
|
|
262
|
+
'function data(value: unknown, allowed: readonly string[]): Record<string, unknown> {',
|
|
263
|
+
" if (!value || typeof value !== 'object' || types.isProxy(value) || ![null, Object.prototype].includes(Object.getPrototypeOf(value) as object | null)) throw new TypeError('Data-only service options required');",
|
|
264
|
+
' const result: Record<string, unknown> = Object.create(null) as Record<string, unknown>;',
|
|
265
|
+
' for (const key of Reflect.ownKeys(value)) {',
|
|
266
|
+
' const descriptor = Object.getOwnPropertyDescriptor(value, key)!;',
|
|
267
|
+
" if (typeof key !== 'string' || !allowed.includes(key) || !Object.hasOwn(descriptor, 'value')) throw new TypeError('Unsupported service option');",
|
|
268
|
+
' result[key] = descriptor.value;', ' }', ' return result;', '}',
|
|
269
|
+
'const plugin: FastifyPluginAsync<CheckedGatewayOptions> = async (fastify, options) => {',
|
|
270
|
+
" const outer = data(options, ['clientOptions', 'capsules', 'prefix']);",
|
|
271
|
+
" const clientOptions = data(outer.clientOptions, ['localSource', 'fileRoots', 'sourceResources', 'sourceOrigins', 'sourceUri', 'namespaceLocations', 'standardLibraries', 'recordSources', 'soap']) as unknown as Options;",
|
|
272
|
+
` const capsules = data(outer.capsules, ${literal(names)});`,
|
|
273
|
+
...operations.map((operation, index) => ` if (!Object.hasOwn(capsules, ${literal(operation.contract.selector.operation)})) throw new TypeError('Missing operation capsule');
|
|
274
|
+
await fastify.register(operation_${index}, {clientOptions: {...clientOptions, capsule: capsules[${literal(operation.contract.selector.operation)}] as Uint8Array}});`),
|
|
275
|
+
'};', 'export default plugin;', '',
|
|
276
|
+
];
|
|
277
|
+
tick();
|
|
278
|
+
const source = composeGeneratedSource(lines.join('\n'), resolvePreamble('gateway'));
|
|
279
|
+
const emit = async () => {
|
|
280
|
+
tick();
|
|
281
|
+
for (const write of emissions) {
|
|
282
|
+
tick();
|
|
283
|
+
await write();
|
|
284
|
+
}
|
|
285
|
+
await mkdir(options.gatewayDir, { recursive: true });
|
|
286
|
+
await mkdir(path.dirname(options.openapiFile), { recursive: true });
|
|
287
|
+
await writeFile(path.join(options.gatewayDir, 'plugin.ts'), source, 'utf8');
|
|
288
|
+
await writeFile(options.openapiFile, JSON.stringify(doc, null, 2) + '\n', 'utf8');
|
|
289
|
+
};
|
|
290
|
+
if (options.emit !== false)
|
|
291
|
+
await emit();
|
|
292
|
+
return { doc, routes: Object.freeze(routes), emit };
|
|
293
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ComposedGatewayService {
|
|
2
|
+
key: string;
|
|
3
|
+
clientDir: string;
|
|
4
|
+
gatewayDir: string;
|
|
5
|
+
clientClassName: string;
|
|
6
|
+
}
|
|
7
|
+
/** Build a typed aggregate over independently generated service routers.
|
|
8
|
+
* @returns Complete generated source; the caller publishes it only after composition succeeds.
|
|
9
|
+
* @constraints Routes already carry generation-time prefixes. Runtime prefixing is refused to keep the served definition accurate.
|
|
10
|
+
*/
|
|
11
|
+
export declare function buildComposedGatewaySource(services: readonly ComposedGatewayService[], options: {
|
|
12
|
+
outDir: string;
|
|
13
|
+
openapiFile: string;
|
|
14
|
+
imports?: "js" | "ts" | "bare";
|
|
15
|
+
openapiPath?: string | false;
|
|
16
|
+
}): string;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { composeGeneratedSource, resolvePreamble } from "../generation/preamble.js";
|
|
3
|
+
/** Build a typed aggregate over independently generated service routers.
|
|
4
|
+
* @returns Complete generated source; the caller publishes it only after composition succeeds.
|
|
5
|
+
* @constraints Routes already carry generation-time prefixes. Runtime prefixing is refused to keep the served definition accurate.
|
|
6
|
+
*/
|
|
7
|
+
export function buildComposedGatewaySource(services, options) {
|
|
8
|
+
const suffix = options.imports === "bare" ? "" : `.${options.imports ?? "js"}`;
|
|
9
|
+
const literal = (value) => JSON.stringify(value).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
10
|
+
const relative = (target) => {
|
|
11
|
+
const resolved = path.relative(options.outDir, target).replaceAll("\\", "/");
|
|
12
|
+
if (path.isAbsolute(resolved) || /^[a-z]:/i.test(resolved))
|
|
13
|
+
throw new Error("Composed outputs must share a filesystem root");
|
|
14
|
+
return resolved.startsWith(".") ? resolved : "./" + resolved;
|
|
15
|
+
};
|
|
16
|
+
const ordered = [...services].sort((a, b) => a.key.localeCompare(b.key));
|
|
17
|
+
const lines = [
|
|
18
|
+
'import type {FastifyPluginAsync} from "fastify";',
|
|
19
|
+
'import {types} from "node:util";',
|
|
20
|
+
`import definition from ${literal(relative(options.openapiFile))} with {type: "json"};`,
|
|
21
|
+
...ordered.flatMap((service, index) => [
|
|
22
|
+
`import {${service.clientClassName} as Client${index}} from ${literal(relative(path.join(service.clientDir, "client" + suffix)))};`,
|
|
23
|
+
`import type {${service.clientClassName}Operations as Operations${index}} from ${literal(relative(path.join(service.clientDir, "operations" + suffix)))};`,
|
|
24
|
+
`import service${index} from ${literal(relative(path.join(service.gatewayDir, "plugin" + suffix)))};`,
|
|
25
|
+
]),
|
|
26
|
+
"",
|
|
27
|
+
"export const openapi = definition;",
|
|
28
|
+
"export interface MultiServiceClients {",
|
|
29
|
+
...ordered.map((service, index) => ` ${literal(service.key)}: Operations${index};`),
|
|
30
|
+
"}",
|
|
31
|
+
"export interface MultiServiceClientOptions {",
|
|
32
|
+
...ordered.map((service, index) => ` ${literal(service.key)}: ConstructorParameters<typeof Client${index}>[0];`),
|
|
33
|
+
"}",
|
|
34
|
+
"export interface MultiServiceGatewayOptions {clients: MultiServiceClients}",
|
|
35
|
+
"function registry(value: unknown): void {",
|
|
36
|
+
' if (!value || typeof value !== "object" || types.isProxy(value) || ![null, Object.prototype].includes(Object.getPrototypeOf(value) as object | null)) throw new TypeError("Service registry must be a data object");',
|
|
37
|
+
` const expected = ${literal(ordered.map(service => service.key))};`,
|
|
38
|
+
' if (Reflect.ownKeys(value).length !== expected.length) throw new TypeError("Service registry must contain exactly the configured services");',
|
|
39
|
+
" for (const key of expected) {",
|
|
40
|
+
" const property = Object.getOwnPropertyDescriptor(value, key);",
|
|
41
|
+
' if (!property || !Object.hasOwn(property, "value") || !property.value) throw new TypeError("Missing service registry value: " + key);',
|
|
42
|
+
" }",
|
|
43
|
+
"}",
|
|
44
|
+
"",
|
|
45
|
+
"/** Bind each generated SOAP client to its own explicit runtime WSDL and options. */",
|
|
46
|
+
"export function createClients(options: MultiServiceClientOptions): {",
|
|
47
|
+
...ordered.map((service, index) => ` ${literal(service.key)}: Client${index};`),
|
|
48
|
+
"} {",
|
|
49
|
+
" registry(options);",
|
|
50
|
+
" return {",
|
|
51
|
+
...ordered.map((service, index) => ` ${literal(service.key)}: new Client${index}(options[${literal(service.key)}]),`),
|
|
52
|
+
" };",
|
|
53
|
+
"}",
|
|
54
|
+
"",
|
|
55
|
+
"const plugin: FastifyPluginAsync<MultiServiceGatewayOptions> = async (fastify, options) => {",
|
|
56
|
+
' if (fastify.prefix) throw new TypeError("Configure service OpenAPI basePath instead of a runtime aggregate prefix");',
|
|
57
|
+
" registry(options.clients);",
|
|
58
|
+
...ordered.map((service, index) => ` await fastify.register(async scope => {await scope.register(service${index}, {client: options.clients[${literal(service.key)}]});});`),
|
|
59
|
+
...(options.openapiPath === false ? [] : [` fastify.get(${literal(options.openapiPath ?? "/openapi.json")}, async () => openapi);`]),
|
|
60
|
+
"};",
|
|
61
|
+
"export default plugin;",
|
|
62
|
+
"",
|
|
63
|
+
];
|
|
64
|
+
return composeGeneratedSource(lines.join("\n"), resolvePreamble("gateway"));
|
|
65
|
+
}
|
|
@@ -131,6 +131,7 @@ export async function generateGateway(opts) {
|
|
|
131
131
|
}
|
|
132
132
|
// Resolve client metadata for full handler generation
|
|
133
133
|
const clientMeta = resolveClientMeta({
|
|
134
|
+
gatewayDir: opts.outDir,
|
|
134
135
|
clientDir: opts.clientDir,
|
|
135
136
|
catalogFile: opts.catalogFile,
|
|
136
137
|
clientClassName: opts.clientClassName,
|
|
@@ -170,4 +170,3 @@ export declare function emitTypeCheckFixture(outDir: string, clientMeta: ClientM
|
|
|
170
170
|
* @param {any} [catalog] - Compiled catalog for detecting ArrayOf* wrapper types to unwrap
|
|
171
171
|
*/
|
|
172
172
|
export declare function emitRouteFilesWithHandlers(outDir: string, routesDir: string, versionSlug: string, serviceSlug: string, operations: OperationMetadata[], importsMode: "js" | "ts" | "bare", clientMeta: ClientMeta, catalog?: any): void;
|
|
173
|
-
//# sourceMappingURL=generators.d.ts.map
|
|
@@ -922,7 +922,7 @@ export function emitRouteFilesWithHandlers(outDir, routesDir, versionSlug, servi
|
|
|
922
922
|
? "toJsonArray"
|
|
923
923
|
: "toNdjson";
|
|
924
924
|
const runtimeImport = op.stream
|
|
925
|
-
? `import { ${streamHelperName} } from "../runtime${suffix}";`
|
|
925
|
+
? `import { ${streamHelperName}${hasUnwrap ? ", unwrapArrayWrappers" : ""} } from "../runtime${suffix}";`
|
|
926
926
|
: hasUnwrap
|
|
927
927
|
? `import { buildSuccessEnvelope, unwrapArrayWrappers } from "../runtime${suffix}";`
|
|
928
928
|
: `import { buildSuccessEnvelope } from "../runtime${suffix}";`;
|
|
@@ -942,9 +942,24 @@ export function emitRouteFilesWithHandlers(outDir, routesDir, versionSlug, servi
|
|
|
942
942
|
const handlerBody = op.stream
|
|
943
943
|
? ` handler: async (request, reply) => {
|
|
944
944
|
const client = fastify.${clientMeta.decoratorName};
|
|
945
|
-
const
|
|
946
|
-
|
|
947
|
-
|
|
945
|
+
const controller = new AbortController();
|
|
946
|
+
const disconnected = () => { if (!reply.raw.writableEnded) controller.abort(); };
|
|
947
|
+
request.raw.once("aborted", disconnected);
|
|
948
|
+
reply.raw.once("close", disconnected);
|
|
949
|
+
if (request.raw.aborted || reply.raw.destroyed) controller.abort();
|
|
950
|
+
try {
|
|
951
|
+
const result = await client.${clientMethod}(${bodyArg}, { signal: controller.signal });
|
|
952
|
+
reply.type(${JSON.stringify(op.stream.mediaType)});
|
|
953
|
+
${hasUnwrap ? `async function* mappedRecords() {
|
|
954
|
+
for await (const record of result.records) yield unwrapArrayWrappers(record, ${JSON.stringify(op.stream.recordTypeName ?? "unknown")});
|
|
955
|
+
}
|
|
956
|
+
// @constraints Keep disconnect cancellation active until the response stream finishes.
|
|
957
|
+
return await reply.send(${streamHelperName}(mappedRecords()));` : `// @constraints Keep disconnect cancellation active until the response stream finishes.
|
|
958
|
+
return await reply.send(${streamHelperName}(result.records));`}
|
|
959
|
+
} finally {
|
|
960
|
+
request.raw.removeListener("aborted", disconnected);
|
|
961
|
+
reply.raw.removeListener("close", disconnected);
|
|
962
|
+
}
|
|
948
963
|
},`
|
|
949
964
|
: ` handler: async (request) => {
|
|
950
965
|
const client = fastify.${clientMeta.decoratorName};
|
|
@@ -199,6 +199,7 @@ export interface ResolvedOperationMeta {
|
|
|
199
199
|
* @property {"js"|"ts"|"bare"} importsMode - Import extension mode
|
|
200
200
|
*/
|
|
201
201
|
export interface ResolveClientMetaOptions {
|
|
202
|
+
gatewayDir?: string;
|
|
202
203
|
clientDir?: string;
|
|
203
204
|
catalogFile?: string;
|
|
204
205
|
clientClassName?: string;
|
|
@@ -256,4 +257,3 @@ export declare function resolveOperationMeta(operationId: string, operationSlug:
|
|
|
256
257
|
* @returns Number of unique schema components reachable via $ref
|
|
257
258
|
*/
|
|
258
259
|
export declare function measureSchemaRefComplexity(startSchemaName: string, allSchemas: Record<string, any>, limit?: number): number;
|
|
259
|
-
//# sourceMappingURL=helpers.d.ts.map
|
package/dist/gateway/helpers.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* - Automatic version/service detection from OpenAPI paths
|
|
12
12
|
*/
|
|
13
13
|
import { pascal, trimRepeatedEdgeChar } from "../util/tools.js";
|
|
14
|
+
import path from "node:path";
|
|
14
15
|
/**
|
|
15
16
|
* Converts a name to a deterministic slug for use in file names and URN IDs
|
|
16
17
|
*
|
|
@@ -393,6 +394,20 @@ export function resolveClientMeta(opts, catalog) {
|
|
|
393
394
|
const operationsImportPath = opts.clientDir
|
|
394
395
|
? `../client/operations${suffix}`
|
|
395
396
|
: `./client/operations${suffix}`;
|
|
397
|
+
const modulePath = (from, module) => {
|
|
398
|
+
const relative = path.relative(from, path.join(opts.clientDir, module + suffix)).replaceAll("\\", "/");
|
|
399
|
+
if (path.isAbsolute(relative) || /^[a-z]:/i.test(relative))
|
|
400
|
+
throw new Error("Generated client and gateway modules must share a filesystem root");
|
|
401
|
+
return relative.startsWith(".") ? relative : "./" + relative;
|
|
402
|
+
};
|
|
403
|
+
if (opts.clientDir && opts.gatewayDir)
|
|
404
|
+
return {
|
|
405
|
+
className, decoratorName,
|
|
406
|
+
importPath: modulePath(path.join(opts.gatewayDir, "routes"), "client"),
|
|
407
|
+
typesImportPath: modulePath(path.join(opts.gatewayDir, "routes"), "types"),
|
|
408
|
+
pluginImportPath: modulePath(opts.gatewayDir, "client"),
|
|
409
|
+
operationsImportPath: modulePath(opts.gatewayDir, "operations"),
|
|
410
|
+
};
|
|
396
411
|
return {
|
|
397
412
|
className,
|
|
398
413
|
decoratorName,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DirectOperationContract } from '../compiler/directOperation.js';
|
|
2
|
+
type Schema = Record<string, unknown>;
|
|
3
|
+
/** Lower an authenticated mapping to recursive TypeScript and JSON shape descriptions.
|
|
4
|
+
* @remarks Scalar restrictions, fixed/default semantics, ordered occurrence correlation and strict wildcard
|
|
5
|
+
* declaration membership require native validation. These descriptions never grant source/runtime authority.
|
|
6
|
+
* @returns Role-scoped definitions and root descriptions; no native handles or retrieval paths are emitted.
|
|
7
|
+
* @throws TypeError For foreign mappings or unsupported scalar representation. Caller cancellation propagates.
|
|
8
|
+
*/
|
|
9
|
+
export declare function lowerComponentShape(contract: DirectOperationContract, supplied: unknown, role: string, check: () => void): {
|
|
10
|
+
type: string;
|
|
11
|
+
declarations: readonly string[];
|
|
12
|
+
schema: Schema;
|
|
13
|
+
};
|
|
14
|
+
export {};
|