@techspokes/typescript-wsdl-client 1.1.4 → 1.1.8
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 +81 -35
- package/dist/app/generateApp.d.ts +0 -1
- package/dist/app/generateApp.js +8 -6
- 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 +245 -0
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +123 -5
- package/dist/client/checkedDirectRuntime.d.ts +96 -0
- package/dist/client/checkedDirectRuntime.js +43 -0
- package/dist/client/directClientRuntime.d.ts +74 -0
- package/dist/client/directClientRuntime.js +165 -0
- package/dist/client/directClientVersion.d.ts +6 -0
- package/dist/client/directClientVersion.js +6 -0
- package/dist/client/generateClient.d.ts +0 -1
- package/dist/client/generateClient.js +26 -12
- package/dist/client/generateDirectClient.d.ts +32 -0
- package/dist/client/generateDirectClient.js +268 -0
- package/dist/client/generateOperations.d.ts +0 -1
- package/dist/client/generateTypes.d.ts +0 -1
- package/dist/client/generateUtils.d.ts +0 -1
- package/dist/client/generateUtils.js +3 -1
- package/dist/compiler/applicationGroups.d.ts +53 -0
- package/dist/compiler/applicationGroups.js +403 -0
- package/dist/compiler/buildCanonicalGraph.d.ts +6 -0
- package/dist/compiler/buildCanonicalGraph.js +381 -0
- package/dist/compiler/canonicalGraph.d.ts +197 -0
- package/dist/compiler/canonicalGraph.js +37 -0
- package/dist/compiler/catalogErrors.d.ts +17 -0
- package/dist/compiler/catalogErrors.js +86 -0
- package/dist/compiler/catalogProvenance.d.ts +14 -0
- package/dist/compiler/catalogProvenance.js +229 -0
- package/dist/compiler/checkedAssessment.d.ts +90 -0
- package/dist/compiler/checkedAssessment.js +300 -0
- package/dist/compiler/checkedComponentSource.d.ts +16 -0
- package/dist/compiler/checkedComponentSource.js +31 -0
- package/dist/compiler/checkedSourcePreparation.d.ts +72 -0
- package/dist/compiler/checkedSourcePreparation.js +202 -0
- package/dist/compiler/complexTypeContent.d.ts +58 -0
- package/dist/compiler/complexTypeContent.js +558 -0
- package/dist/compiler/componentCorrespondence.d.ts +32 -0
- package/dist/compiler/componentCorrespondence.js +140 -0
- package/dist/compiler/componentRecordProjection.d.ts +109 -0
- package/dist/compiler/componentRecordProjection.js +319 -0
- package/dist/compiler/componentSoapPreparation.d.ts +20 -0
- package/dist/compiler/componentSoapPreparation.js +36 -0
- package/dist/compiler/composeCanonicalGraph.d.ts +68 -0
- package/dist/compiler/composeCanonicalGraph.js +252 -0
- package/dist/compiler/dataOwnership.d.ts +21 -0
- package/dist/compiler/dataOwnership.js +167 -0
- package/dist/compiler/datatypeValues.d.ts +46 -0
- package/dist/compiler/datatypeValues.js +275 -0
- package/dist/compiler/directCodec.d.ts +116 -0
- package/dist/compiler/directCodec.js +377 -0
- package/dist/compiler/directExecutionPolicy.d.ts +9 -0
- package/dist/compiler/directExecutionPolicy.js +17 -0
- package/dist/compiler/directOperation.d.ts +114 -0
- package/dist/compiler/directOperation.js +373 -0
- package/dist/compiler/directSoap.d.ts +66 -0
- package/dist/compiler/directSoap.js +391 -0
- package/dist/compiler/directSoapSource.d.ts +38 -0
- package/dist/compiler/directSoapSource.js +233 -0
- package/dist/compiler/directSourceCapsule.d.ts +169 -0
- package/dist/compiler/directSourceCapsule.js +727 -0
- package/dist/compiler/directStructure.d.ts +128 -0
- package/dist/compiler/directStructure.js +543 -0
- package/dist/compiler/directStructurePlan.d.ts +149 -0
- package/dist/compiler/directStructurePlan.js +623 -0
- package/dist/compiler/directValues.d.ts +128 -0
- package/dist/compiler/directValues.js +1116 -0
- package/dist/compiler/finiteRe01Construction.d.ts +69 -0
- package/dist/compiler/finiteRe01Construction.js +422 -0
- package/dist/compiler/finiteRe01Verification.d.ts +218 -0
- package/dist/compiler/finiteRe01Verification.js +1217 -0
- package/dist/compiler/generateCatalog.d.ts +0 -1
- package/dist/compiler/graphTraversal.d.ts +10 -0
- package/dist/compiler/graphTraversal.js +37 -0
- package/dist/compiler/hypotheticalScopedIdentity.d.ts +22 -0
- package/dist/compiler/hypotheticalScopedIdentity.js +81 -0
- package/dist/compiler/occurrenceAnalysis.d.ts +66 -0
- package/dist/compiler/occurrenceAnalysis.js +316 -0
- package/dist/compiler/originalSourceMembership.d.ts +5 -0
- package/dist/compiler/originalSourceMembership.js +31 -0
- package/dist/compiler/particleAttribution.d.ts +16 -0
- package/dist/compiler/particleAttribution.js +494 -0
- package/dist/compiler/particleDeclarationConsistency.d.ts +23 -0
- package/dist/compiler/particleDeclarationConsistency.js +206 -0
- package/dist/compiler/particleExtension.d.ts +21 -0
- package/dist/compiler/particleExtension.js +123 -0
- package/dist/compiler/particleLocalAssessment.d.ts +19 -0
- package/dist/compiler/particleLocalAssessment.js +92 -0
- package/dist/compiler/particleRestriction.d.ts +23 -0
- package/dist/compiler/particleRestriction.js +494 -0
- package/dist/compiler/particleSemanticView.d.ts +51 -0
- package/dist/compiler/particleSemanticView.js +310 -0
- package/dist/compiler/particleWildcardRelation.d.ts +87 -0
- package/dist/compiler/particleWildcardRelation.js +143 -0
- package/dist/compiler/projectionScalar.d.ts +32 -0
- package/dist/compiler/projectionScalar.js +184 -0
- package/dist/compiler/re01CandidateAssignments.d.ts +95 -0
- package/dist/compiler/re01CandidateAssignments.js +341 -0
- package/dist/compiler/re01CandidateCorrespondence.d.ts +85 -0
- package/dist/compiler/re01CandidateCorrespondence.js +701 -0
- package/dist/compiler/re01TypeProperties.d.ts +70 -0
- package/dist/compiler/re01TypeProperties.js +120 -0
- package/dist/compiler/re01TypePropertyValidation.d.ts +22 -0
- package/dist/compiler/re01TypePropertyValidation.js +161 -0
- package/dist/compiler/resolveCanonicalGraph.d.ts +41 -0
- package/dist/compiler/resolveCanonicalGraph.js +240 -0
- package/dist/compiler/scalarSchemaAssessment.d.ts +424 -0
- package/dist/compiler/scalarSchemaAssessment.js +5198 -0
- package/dist/compiler/schemaAttributeGroupProperties.d.ts +16 -0
- package/dist/compiler/schemaAttributeGroupProperties.js +53 -0
- package/dist/compiler/schemaAttributeProperties.d.ts +9 -0
- package/dist/compiler/schemaAttributeProperties.js +11 -0
- package/dist/compiler/schemaAttributeUses.d.ts +110 -0
- package/dist/compiler/schemaAttributeUses.js +798 -0
- package/dist/compiler/schemaBinaryWordReconstruction.d.ts +9 -0
- package/dist/compiler/schemaBinaryWordReconstruction.js +33 -0
- package/dist/compiler/schemaBuiltinFacets.d.ts +13 -0
- package/dist/compiler/schemaBuiltinFacets.js +51 -0
- package/dist/compiler/schemaCalendarImages.d.ts +7 -0
- package/dist/compiler/schemaCalendarImages.js +204 -0
- package/dist/compiler/schemaCalendarLanguage.d.ts +10 -0
- package/dist/compiler/schemaCalendarLanguage.js +227 -0
- package/dist/compiler/schemaCompiler.d.ts +0 -1
- package/dist/compiler/schemaComponentEquality.d.ts +27 -0
- package/dist/compiler/schemaComponentEquality.js +446 -0
- package/dist/compiler/schemaConstructionAssessment.d.ts +79 -0
- package/dist/compiler/schemaConstructionAssessment.js +745 -0
- package/dist/compiler/schemaDatatypeValues.d.ts +3 -0
- package/dist/compiler/schemaDatatypeValues.js +2 -0
- package/dist/compiler/schemaDecimalLanguage.d.ts +6 -0
- package/dist/compiler/schemaDecimalLanguage.js +102 -0
- package/dist/compiler/schemaDeclarationPrimitives.d.ts +39 -0
- package/dist/compiler/schemaDeclarationPrimitives.js +211 -0
- package/dist/compiler/schemaDocumentSyntax.d.ts +54 -0
- package/dist/compiler/schemaDocumentSyntax.js +294 -0
- package/dist/compiler/schemaDurationLanguage.d.ts +10 -0
- package/dist/compiler/schemaDurationLanguage.js +170 -0
- package/dist/compiler/schemaElementInstance.d.ts +30 -0
- package/dist/compiler/schemaElementInstance.js +45 -0
- package/dist/compiler/schemaElementProperties.d.ts +15 -0
- package/dist/compiler/schemaElementProperties.js +23 -0
- package/dist/compiler/schemaEndpointWordCapacity.d.ts +35 -0
- package/dist/compiler/schemaEndpointWordCapacity.js +39 -0
- package/dist/compiler/schemaExactCalendar.d.ts +72 -0
- package/dist/compiler/schemaExactCalendar.js +264 -0
- package/dist/compiler/schemaFacetAnnotation.d.ts +31 -0
- package/dist/compiler/schemaFacetAnnotation.js +199 -0
- package/dist/compiler/schemaGeneratedScalarShape.d.ts +34 -0
- package/dist/compiler/schemaGeneratedScalarShape.js +178 -0
- package/dist/compiler/schemaIdentityConstraints.d.ts +72 -0
- package/dist/compiler/schemaIdentityConstraints.js +362 -0
- package/dist/compiler/schemaIeeeLanguage.d.ts +42 -0
- package/dist/compiler/schemaIeeeLanguage.js +759 -0
- package/dist/compiler/schemaIntegerImages.d.ts +10 -0
- package/dist/compiler/schemaIntegerImages.js +113 -0
- package/dist/compiler/schemaLexicalPredicates.d.ts +28 -0
- package/dist/compiler/schemaLexicalPredicates.js +63 -0
- package/dist/compiler/schemaNotationProperties.d.ts +31 -0
- package/dist/compiler/schemaNotationProperties.js +84 -0
- package/dist/compiler/schemaNumericImageConditions.d.ts +23 -0
- package/dist/compiler/schemaNumericImageConditions.js +66 -0
- package/dist/compiler/schemaParticleWildcardProperties.d.ts +19 -0
- package/dist/compiler/schemaParticleWildcardProperties.js +43 -0
- package/dist/compiler/schemaPattern.d.ts +1061 -0
- package/dist/compiler/schemaPattern.js +581 -0
- package/dist/compiler/schemaRegularLanguage.d.ts +66 -0
- package/dist/compiler/schemaRegularLanguage.js +1166 -0
- package/dist/compiler/schemaScalarContext.d.ts +85 -0
- package/dist/compiler/schemaScalarContext.js +78 -0
- package/dist/compiler/schemaScalarKernel.d.ts +181 -0
- package/dist/compiler/schemaScalarKernel.js +391 -0
- package/dist/compiler/schemaScalarWitnesses.d.ts +5 -0
- package/dist/compiler/schemaScalarWitnesses.js +118 -0
- package/dist/compiler/schemaSimpleTypeProperties.d.ts +94 -0
- package/dist/compiler/schemaSimpleTypeProperties.js +103 -0
- package/dist/compiler/schemaSourceGrammar.d.ts +26 -0
- package/dist/compiler/schemaSourceGrammar.js +290 -0
- package/dist/compiler/schemaSourceLexical.d.ts +3 -0
- package/dist/compiler/schemaSourceLexical.js +12 -0
- package/dist/compiler/schemaSourceValues.d.ts +50 -0
- package/dist/compiler/schemaSourceValues.js +225 -0
- package/dist/compiler/schemaSourceWildcards.d.ts +27 -0
- package/dist/compiler/schemaSourceWildcards.js +249 -0
- package/dist/compiler/schemaSymbolicSequences.d.ts +15 -0
- package/dist/compiler/schemaSymbolicSequences.js +99 -0
- package/dist/compiler/schemaSymbolicValueSets.d.ts +31 -0
- package/dist/compiler/schemaSymbolicValueSets.js +149 -0
- package/dist/compiler/schemaSyntaxAssessment.d.ts +24 -0
- package/dist/compiler/schemaSyntaxAssessment.js +361 -0
- package/dist/compiler/schemaTemporalAliases.d.ts +5 -0
- package/dist/compiler/schemaTemporalAliases.js +195 -0
- package/dist/compiler/schemaTokenImages.d.ts +8 -0
- package/dist/compiler/schemaTokenImages.js +142 -0
- package/dist/compiler/schemaTypeIdentity.d.ts +38 -0
- package/dist/compiler/schemaTypeIdentity.js +80 -0
- package/dist/compiler/schemaTypeRelations.d.ts +37 -0
- package/dist/compiler/schemaTypeRelations.js +576 -0
- package/dist/compiler/schemaUri.d.ts +12 -0
- package/dist/compiler/schemaUri.js +103 -0
- package/dist/compiler/schemaValueContext.d.ts +25 -0
- package/dist/compiler/schemaValueContext.js +1 -0
- package/dist/compiler/schemaValueImages.d.ts +9 -0
- package/dist/compiler/schemaValueImages.js +142 -0
- package/dist/compiler/schemaValueSequences.d.ts +14 -0
- package/dist/compiler/schemaValueSequences.js +19 -0
- package/dist/compiler/semanticBudget.d.ts +67 -0
- package/dist/compiler/semanticBudget.js +193 -0
- package/dist/compiler/semanticCatalog.d.ts +121 -0
- package/dist/compiler/semanticCatalog.js +160 -0
- package/dist/compiler/semanticContext.d.ts +183 -0
- package/dist/compiler/semanticContext.js +1207 -0
- package/dist/compiler/semanticTypeDependencies.d.ts +7 -0
- package/dist/compiler/semanticTypeDependencies.js +64 -0
- package/dist/compiler/semanticTypeReference.d.ts +23 -0
- package/dist/compiler/semanticTypeReference.js +36 -0
- package/dist/compiler/shapeResolver.d.ts +1 -1
- package/dist/compiler/shapeResolver.js +7 -9
- package/dist/compiler/soapHeaders.d.ts +16 -0
- package/dist/compiler/soapHeaders.js +42 -0
- package/dist/compiler/sourceSchemaBinding.d.ts +25 -0
- package/dist/compiler/sourceSchemaBinding.js +39 -0
- 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 +15 -0
- package/dist/compiler/structuralCompanions.js +232 -0
- package/dist/compiler/validateSemanticGraph.d.ts +4 -0
- package/dist/compiler/validateSemanticGraph.js +376 -0
- package/dist/compiler/wildcardAlgebra.d.ts +25 -0
- package/dist/compiler/wildcardAlgebra.js +155 -0
- 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/generateGateway.d.ts +0 -1
- package/dist/gateway/generateGateway.js +2 -2
- package/dist/gateway/generators.d.ts +0 -1
- package/dist/gateway/helpers.d.ts +0 -1
- package/dist/generation/componentShape.d.ts +14 -0
- package/dist/generation/componentShape.js +269 -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 +9 -1
- package/dist/index.js +3 -0
- package/dist/loader/fetch.d.ts +0 -1
- package/dist/loader/orderedSyntax.d.ts +84 -0
- package/dist/loader/orderedSyntax.js +222 -0
- package/dist/loader/resolutionDepth.d.ts +6 -0
- package/dist/loader/resolutionDepth.js +65 -0
- package/dist/loader/schemaInput.d.ts +80 -0
- package/dist/loader/schemaInput.js +249 -0
- package/dist/loader/schemaResources.d.ts +60 -0
- package/dist/loader/schemaResources.js +333 -0
- package/dist/loader/wsdlLoader.d.ts +0 -1
- package/dist/openapi/casing.d.ts +0 -1
- package/dist/openapi/generateOpenAPI.d.ts +0 -1
- package/dist/openapi/generateOpenAPI.js +2 -2
- 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 +6 -2
- package/dist/pipeline.js +13 -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/generateTests.js +2 -2
- 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 +2 -0
- package/dist/util/xmlWhitespace.js +4 -0
- package/dist/xsd/primitives.d.ts +0 -1
- package/docs/agent-skill.md +2 -0
- package/docs/api-reference.md +1 -1
- package/docs/checked-gateway.md +210 -0
- package/docs/checked-generation.md +161 -0
- package/docs/cli-reference.md +43 -1
- package/docs/concepts.md +136 -1
- package/docs/configuration.md +5 -1
- package/docs/corpus.md +33 -0
- package/docs/direct-values.md +311 -0
- package/docs/examples/checked-forecast.wsdl +19 -0
- package/docs/gateway-guide.md +1 -1
- package/docs/generated-code.md +10 -5
- package/docs/mapping-contract.md +114 -0
- package/docs/migration-playbook.md +1 -1
- package/docs/output-anatomy.md +1 -1
- package/docs/start-here.md +8 -2
- package/docs/supported-patterns.md +17 -5
- package/docs/testing.md +117 -31
- package/llms.txt +7 -7
- package/package.json +79 -25
- package/src/generation/preambles/direct-client/typescript.preamble +3 -0
- package/src/runtime/checkedGatewayHost.tpl.txt +157 -0
- package/src/runtime/streamXml.ts +1 -1
- package/dist/app/generateApp.d.ts.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/client/generateClient.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/generateCatalog.d.ts.map +0 -1
- package/dist/compiler/schemaCompiler.d.ts.map +0 -1
- package/dist/compiler/shapeResolver.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/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/xsd/primitives.d.ts.map +0 -1
- package/docs/AGENTS.md +0 -47
- package/docs/README.md +0 -56
- package/docs/architecture.md +0 -149
- package/docs/decisions/001-test-generation.md +0 -36
- package/docs/decisions/002-streamable-responses.md +0 -330
- package/docs/file-naming-and-path-organization.md +0 -213
- 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/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,74 @@
|
|
|
1
|
+
import type { SemanticBudgetLimits, ResolverUsage } from '../compiler/semanticBudget.js';
|
|
2
|
+
import type { DirectCapsuleFailure } from '../compiler/directSourceCapsule.js';
|
|
3
|
+
import type { DirectSoapOptions, ComponentSoapOptions, DirectSoapFailure } from '../compiler/directSoap.js';
|
|
4
|
+
import type { DirectOperationSelector } from '../compiler/directOperation.js';
|
|
5
|
+
import type { DirectApplicationValue } from '../compiler/directValues.js';
|
|
6
|
+
import { DIRECT_CLIENT_RUNTIME_VERSION } from './directClientVersion.js';
|
|
7
|
+
export interface DirectClientOptions {
|
|
8
|
+
readonly localSource: string;
|
|
9
|
+
readonly fileRoots: readonly string[];
|
|
10
|
+
readonly capsule: Uint8Array;
|
|
11
|
+
readonly budget?: SemanticBudgetLimits;
|
|
12
|
+
readonly soap: DirectSoapOptions;
|
|
13
|
+
}
|
|
14
|
+
export interface ComponentClientOptions extends Omit<DirectClientOptions, 'soap'> {
|
|
15
|
+
readonly sourceResources: readonly {
|
|
16
|
+
readonly uri: string;
|
|
17
|
+
readonly file: string;
|
|
18
|
+
readonly canonicalUri?: string;
|
|
19
|
+
}[];
|
|
20
|
+
readonly sourceUri?: string;
|
|
21
|
+
readonly sourceOrigins: readonly string[];
|
|
22
|
+
readonly namespaceLocations?: readonly {
|
|
23
|
+
readonly namespace: string;
|
|
24
|
+
readonly location: string;
|
|
25
|
+
}[];
|
|
26
|
+
readonly standardLibraries?: readonly string[];
|
|
27
|
+
readonly recordSources?: readonly {
|
|
28
|
+
readonly selector: DirectOperationSelector;
|
|
29
|
+
readonly source: string;
|
|
30
|
+
}[];
|
|
31
|
+
readonly soap: ComponentSoapOptions;
|
|
32
|
+
}
|
|
33
|
+
export interface DirectClientFailure {
|
|
34
|
+
readonly kind: DirectCapsuleFailure['kind'] | DirectSoapFailure['kind'];
|
|
35
|
+
readonly rule: string;
|
|
36
|
+
readonly usage: ResolverUsage;
|
|
37
|
+
readonly repair?: string;
|
|
38
|
+
readonly phase?: 'input' | 'response';
|
|
39
|
+
}
|
|
40
|
+
export type DirectClientResult = DirectClientFailure | Readonly<{
|
|
41
|
+
kind: 'soap-response';
|
|
42
|
+
value: DirectApplicationValue;
|
|
43
|
+
status: number;
|
|
44
|
+
admitted: false;
|
|
45
|
+
responseBytes: Uint8Array;
|
|
46
|
+
usage: ResolverUsage;
|
|
47
|
+
}> | Readonly<{
|
|
48
|
+
kind: 'soap-fault';
|
|
49
|
+
value: DirectApplicationValue;
|
|
50
|
+
status: number;
|
|
51
|
+
admitted: false;
|
|
52
|
+
fault: Readonly<{
|
|
53
|
+
name: string;
|
|
54
|
+
code: Readonly<{
|
|
55
|
+
namespace: string;
|
|
56
|
+
local: string;
|
|
57
|
+
}>;
|
|
58
|
+
string: string;
|
|
59
|
+
actor?: string;
|
|
60
|
+
}>;
|
|
61
|
+
responseBytes: Uint8Array;
|
|
62
|
+
usage: ResolverUsage;
|
|
63
|
+
}>;
|
|
64
|
+
export interface DirectClientRuntime {
|
|
65
|
+
readonly version: typeof DIRECT_CLIENT_RUNTIME_VERSION;
|
|
66
|
+
execute(expectedBase64: string, input: unknown, options: DirectClientOptions): Promise<DirectClientResult>;
|
|
67
|
+
}
|
|
68
|
+
/** The generated literal is the expected artifact; caller bytes never choose its static contract. */
|
|
69
|
+
export declare const directClientRuntime: DirectClientRuntime;
|
|
70
|
+
/** Same artifact/execution chain, with explicit physical dependency snapshots and component-profile reconstruction. */
|
|
71
|
+
export declare const componentClientRuntime: Readonly<{
|
|
72
|
+
version: "checked-component-runtime-v2";
|
|
73
|
+
execute: (expectedBase64: string, input: unknown, options: ComponentClientOptions) => Promise<DirectClientResult>;
|
|
74
|
+
}>;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { directDataOwnership, directLimit, directLoadingLimits } from '../compiler/directExecutionPolicy.js';
|
|
2
|
+
/** Private P3.7 binding. No public package entry or alternate SOAP implementation. */
|
|
3
|
+
import { checkSemanticBudget } from '../compiler/semanticBudget.js';
|
|
4
|
+
import { DataOwnershipLimitError } from '../compiler/dataOwnership.js';
|
|
5
|
+
import { types } from 'node:util';
|
|
6
|
+
import { createApplicationBudget } from '../compiler/semanticBudget.js';
|
|
7
|
+
import { reconstructDirectSourceCapsuleInRequest, reconstructComponentSourceCapsuleInRequest, checkDirectSourceCompatibility, DIRECT_CAPSULE_LIMITS } from '../compiler/directSourceCapsule.js';
|
|
8
|
+
import { exchangeDirectSoap, exchangeComponentSoap, directSoapOptionsShape } from '../compiler/directSoap.js';
|
|
9
|
+
import { DIRECT_CLIENT_RUNTIME_VERSION, COMPONENT_CLIENT_RUNTIME_VERSION } from './directClientVersion.js';
|
|
10
|
+
import { prepareSchemaSnapshotFiles } from '../loader/schemaInput.js';
|
|
11
|
+
import { SchemaLoadingError } from '../loader/orderedSyntax.js';
|
|
12
|
+
/** The generated literal is the expected artifact; caller bytes never choose its static contract. */
|
|
13
|
+
export const directClientRuntime = Object.freeze({
|
|
14
|
+
version: DIRECT_CLIENT_RUNTIME_VERSION,
|
|
15
|
+
execute: (expectedBase64, input, options) => executeClient(expectedBase64, input, options, false),
|
|
16
|
+
});
|
|
17
|
+
/** Same artifact/execution chain, with explicit physical dependency snapshots and component-profile reconstruction. */
|
|
18
|
+
export const componentClientRuntime = Object.freeze({
|
|
19
|
+
version: COMPONENT_CLIENT_RUNTIME_VERSION,
|
|
20
|
+
execute: (expectedBase64, input, options) => executeClient(expectedBase64, input, options, true),
|
|
21
|
+
});
|
|
22
|
+
async function executeClient(expectedBase64, input, options, component) {
|
|
23
|
+
// Constant-sized entry introspection precedes budget configuration and all reads.
|
|
24
|
+
const entryFailure = () => ({ kind: 'unsupported', rule: 'data-only client options required', usage: { nodes: 0, work: 0 } });
|
|
25
|
+
if (!options || typeof options !== 'object' || types.isProxy(options)
|
|
26
|
+
|| ![null, Object.prototype].includes(Object.getPrototypeOf(options)))
|
|
27
|
+
return entryFailure();
|
|
28
|
+
const allowed = ['localSource', 'fileRoots', 'capsule', 'budget', 'soap', ...(component ? ['sourceResources', 'sourceOrigins', 'sourceUri', 'namespaceLocations', 'standardLibraries', 'recordSources'] : [])];
|
|
29
|
+
const owned = Object.create(null);
|
|
30
|
+
for (const key of Reflect.ownKeys(options)) {
|
|
31
|
+
const descriptor = Object.getOwnPropertyDescriptor(options, key);
|
|
32
|
+
if (typeof key !== 'string' || !allowed.includes(key) || !descriptor || !('value' in descriptor))
|
|
33
|
+
return entryFailure();
|
|
34
|
+
owned[key] = descriptor.value;
|
|
35
|
+
}
|
|
36
|
+
if (!['localSource', 'fileRoots', 'capsule', 'soap', ...(component ? ['sourceResources', 'sourceOrigins'] : [])].every(key => Object.hasOwn(owned, key)))
|
|
37
|
+
return entryFailure();
|
|
38
|
+
if (owned.budget !== undefined) {
|
|
39
|
+
const limits = owned.budget;
|
|
40
|
+
if (!limits || typeof limits !== 'object' || types.isProxy(limits)
|
|
41
|
+
|| ![null, Object.prototype].includes(Object.getPrototypeOf(limits)))
|
|
42
|
+
return entryFailure();
|
|
43
|
+
const copied = Object.create(null);
|
|
44
|
+
for (const key of Reflect.ownKeys(limits)) {
|
|
45
|
+
const descriptor = Object.getOwnPropertyDescriptor(limits, key);
|
|
46
|
+
if (typeof key !== 'string' || !['maxNodes', 'maxWork'].includes(key) || !descriptor || !('value' in descriptor))
|
|
47
|
+
return entryFailure();
|
|
48
|
+
copied[key] = descriptor.value;
|
|
49
|
+
}
|
|
50
|
+
owned.budget = Object.freeze(copied);
|
|
51
|
+
}
|
|
52
|
+
options = owned;
|
|
53
|
+
const budget = createApplicationBudget(options.budget);
|
|
54
|
+
const fail = (kind, rule) => Object.freeze({ kind, rule, usage: Object.freeze({ ...budget.usage() }) });
|
|
55
|
+
try {
|
|
56
|
+
const optionRule = directSoapOptionsShape(options.soap, () => checkSemanticBudget(budget), component ? ['ca'] : []);
|
|
57
|
+
if (optionRule)
|
|
58
|
+
return fail('unsupported', optionRule);
|
|
59
|
+
if (options.soap.signal !== undefined && !(options.soap.signal instanceof AbortSignal))
|
|
60
|
+
return fail('unsupported', 'native AbortSignal required');
|
|
61
|
+
if (options.soap.signal?.aborted)
|
|
62
|
+
return fail('cancelled', 'cooperative-cancellation');
|
|
63
|
+
const signal = options.soap.signal;
|
|
64
|
+
const check = () => { checkSemanticBudget(budget); if (signal?.aborted)
|
|
65
|
+
throw new Error('cancelled'); };
|
|
66
|
+
const soap = Object.create(null);
|
|
67
|
+
for (const key of Reflect.ownKeys(options.soap))
|
|
68
|
+
soap[key] = Object.getOwnPropertyDescriptor(options.soap, key).value;
|
|
69
|
+
for (const key of ['service', 'port', 'endpoint', 'timeoutMs', 'limits', 'capabilities', ...(component ? ['ca'] : [])]) {
|
|
70
|
+
if (Object.hasOwn(soap, key))
|
|
71
|
+
soap[key] = directDataOwnership(budget).freeze(directDataOwnership(budget).snapshot(soap[key], check));
|
|
72
|
+
}
|
|
73
|
+
options = Object.freeze({ ...options, fileRoots: directDataOwnership(budget).freeze(directDataOwnership(budget).snapshot(options.fileRoots, check)), soap: Object.freeze(soap) });
|
|
74
|
+
if (typeof expectedBase64 !== 'string' || expectedBase64.length > Math.ceil(directLimit(budget, DIRECT_CAPSULE_LIMITS.maxBytes) / 3) * 4)
|
|
75
|
+
return fail('incompatible-artifact', 'generated-capsule-limit');
|
|
76
|
+
// The exact embedded artifact pins the emitted types. Check actual byte extent
|
|
77
|
+
// before copying; do not invoke caller byte getters.
|
|
78
|
+
if (!types.isUint8Array(options.capsule) || types.isProxy(options.capsule))
|
|
79
|
+
return fail('incompatible-artifact', 'capsule-bytes-required');
|
|
80
|
+
const typed = Object.getPrototypeOf(Uint8Array.prototype);
|
|
81
|
+
const backing = Object.getOwnPropertyDescriptor(typed, 'buffer').get.call(options.capsule);
|
|
82
|
+
const length = Object.getOwnPropertyDescriptor(typed, 'byteLength').get.call(options.capsule);
|
|
83
|
+
if (types.isSharedArrayBuffer(backing) || length > directLimit(budget, DIRECT_CAPSULE_LIMITS.maxBytes))
|
|
84
|
+
return fail('incompatible-artifact', 'capsule-bytes-required');
|
|
85
|
+
const bytes = new Uint8Array(length);
|
|
86
|
+
Uint8Array.prototype.set.call(bytes, options.capsule);
|
|
87
|
+
if (Buffer.from(bytes).toString('base64') !== expectedBase64)
|
|
88
|
+
return fail('incompatible-artifact', 'generated-capsule-mismatch');
|
|
89
|
+
let result;
|
|
90
|
+
if (component) {
|
|
91
|
+
if (typeof options.localSource !== 'string')
|
|
92
|
+
return fail('unsupported', 'explicit local source required');
|
|
93
|
+
const supplied = options;
|
|
94
|
+
const sources = directDataOwnership(budget).freeze(directDataOwnership(budget).snapshot({ resources: supplied.sourceResources,
|
|
95
|
+
origins: supplied.sourceOrigins, locations: supplied.namespaceLocations ?? [], standards: supplied.standardLibraries ?? [],
|
|
96
|
+
records: supplied.recordSources ?? [] }, check));
|
|
97
|
+
if (!Array.isArray(sources.resources) || !Array.isArray(sources.origins) || !sources.origins.every(origin => typeof origin === 'string')
|
|
98
|
+
|| !Array.isArray(sources.locations) || !Array.isArray(sources.standards) || !sources.standards.every(id => typeof id === 'string')
|
|
99
|
+
|| !Array.isArray(sources.records))
|
|
100
|
+
return fail('unsupported', 'explicit source snapshots required');
|
|
101
|
+
for (const resource of sources.resources) {
|
|
102
|
+
check();
|
|
103
|
+
if (!resource || typeof resource.uri !== 'string' || typeof resource.file !== 'string'
|
|
104
|
+
|| Object.keys(resource).some(k => !['uri', 'file', 'canonicalUri'].includes(k))
|
|
105
|
+
|| resource.canonicalUri !== undefined && typeof resource.canonicalUri !== 'string')
|
|
106
|
+
return fail('unsupported', 'explicit source resource required');
|
|
107
|
+
}
|
|
108
|
+
const namespaceLocations = new Map();
|
|
109
|
+
for (const location of sources.locations) {
|
|
110
|
+
check();
|
|
111
|
+
if (!location || typeof location.namespace !== 'string' || typeof location.location !== 'string'
|
|
112
|
+
|| Object.keys(location).length !== 2 || namespaceLocations.has(location.namespace))
|
|
113
|
+
return fail('unsupported', 'explicit namespace location required');
|
|
114
|
+
namespaceLocations.set(location.namespace, location.location);
|
|
115
|
+
}
|
|
116
|
+
const prepared = await prepareSchemaSnapshotFiles(options.localSource, sources.resources, { policy: {
|
|
117
|
+
fileRoots: options.fileRoots, allowedOrigins: sources.origins
|
|
118
|
+
}, limits: directLoadingLimits(budget), namespaceLocations, signal, sourceUri: supplied.sourceUri,
|
|
119
|
+
chargeWork: amount => { check(); budget.chargeWork(amount); } });
|
|
120
|
+
const fresh = await reconstructComponentSourceCapsuleInRequest(bytes, prepared.source, { loading: prepared.loading, signal,
|
|
121
|
+
standardLibraries: sources.standards, recordSources: sources.records }, budget);
|
|
122
|
+
if (fresh.kind !== 'reconstructed-component')
|
|
123
|
+
return fresh;
|
|
124
|
+
if (fresh.selection.port !== options.soap.port || fresh.selection.service.namespace !== options.soap.service.namespace
|
|
125
|
+
|| fresh.selection.service.local !== options.soap.service.local)
|
|
126
|
+
return fail('incompatible-artifact', 'explicit source selection mismatch');
|
|
127
|
+
result = fresh.responseProjection ? await exchangeComponentSoap(fresh.contract, fresh.mappings[0], input, supplied.soap, fresh.responseProjection)
|
|
128
|
+
: await exchangeComponentSoap(fresh.contract, fresh.mappings[0], input, supplied.soap);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
const fresh = await reconstructDirectSourceCapsuleInRequest(bytes, options.localSource, { policy: { fileRoots: options.fileRoots }, limits: options.budget, signal: options.soap.signal }, budget);
|
|
132
|
+
if (fresh.kind !== 'reconstructed-direct')
|
|
133
|
+
return fresh;
|
|
134
|
+
const compatible = checkDirectSourceCompatibility(fresh, fresh.contract, { service: options.soap.service, port: options.soap.port }, options.soap.signal);
|
|
135
|
+
if (compatible.kind !== 'compatible-direct')
|
|
136
|
+
return compatible;
|
|
137
|
+
// Value and byte provenance stay owned
|
|
138
|
+
// by the original adapter; no catch-and-cast turns a failure into typed success.
|
|
139
|
+
result = await exchangeDirectSoap(fresh.contract, fresh.mappings[0], input, options.soap);
|
|
140
|
+
}
|
|
141
|
+
if (!('decoded' in result))
|
|
142
|
+
return result;
|
|
143
|
+
if (options.soap.signal?.aborted)
|
|
144
|
+
return fail('cancelled', 'cooperative-cancellation');
|
|
145
|
+
const common = { value: result.decoded.validated.value, status: result.status, admitted: false,
|
|
146
|
+
responseBytes: result.responseBytes, usage: Object.freeze({ ...budget.usage() }) };
|
|
147
|
+
if (result.kind === 'soap-fault') {
|
|
148
|
+
if (!result.fault)
|
|
149
|
+
throw new TypeError('Missing native declared fault');
|
|
150
|
+
return Object.freeze({ kind: 'soap-fault', ...common, fault: result.fault });
|
|
151
|
+
}
|
|
152
|
+
return Object.freeze({ kind: 'soap-response', ...common });
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
if (budget.exhausted())
|
|
156
|
+
return fail('resource-limit', 'request-budget');
|
|
157
|
+
if (error instanceof DataOwnershipLimitError)
|
|
158
|
+
return fail('resource-limit', error.message);
|
|
159
|
+
if (options.soap.signal?.aborted)
|
|
160
|
+
return fail('cancelled', 'cooperative-cancellation');
|
|
161
|
+
if (error instanceof SchemaLoadingError)
|
|
162
|
+
return fail(error.category === 'resource-limit' ? 'resource-limit' : 'missing-authority', 'authorized-local-source-required');
|
|
163
|
+
throw error;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Generated injection protocol; independent of package, capsule and scalar-policy versions. */
|
|
2
|
+
export declare const DIRECT_CLIENT_RUNTIME_VERSION: "checked-direct-runtime-v1";
|
|
3
|
+
export declare const DIRECT_CLIENT_RUNTIME_REPAIR = "Regenerate matched direct client and capsule with the installed runtime.";
|
|
4
|
+
/** Component profile never impersonates the supported direct preview protocol. */
|
|
5
|
+
export declare const COMPONENT_CLIENT_RUNTIME_VERSION: "checked-component-runtime-v2";
|
|
6
|
+
export declare const COMPONENT_CLIENT_RUNTIME_REPAIR = "Regenerate matched component client and source artifacts with the installed runtime.";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Generated injection protocol; independent of package, capsule and scalar-policy versions. */
|
|
2
|
+
export const DIRECT_CLIENT_RUNTIME_VERSION = 'checked-direct-runtime-v1';
|
|
3
|
+
export const DIRECT_CLIENT_RUNTIME_REPAIR = 'Regenerate matched direct client and capsule with the installed runtime.';
|
|
4
|
+
/** Component profile never impersonates the supported direct preview protocol. */
|
|
5
|
+
export const COMPONENT_CLIENT_RUNTIME_VERSION = 'checked-component-runtime-v2';
|
|
6
|
+
export const COMPONENT_CLIENT_RUNTIME_REPAIR = 'Regenerate matched component client and source artifacts with the installed runtime.';
|
|
@@ -18,4 +18,3 @@ import type { CompiledCatalog } from "../compiler/schemaCompiler.js";
|
|
|
18
18
|
* @throws {Error} If a packaged preamble cannot be loaded or a TypeScript file cannot be written.
|
|
19
19
|
*/
|
|
20
20
|
export declare function generateClient(outFile: string, compiled: CompiledCatalog): void;
|
|
21
|
-
//# sourceMappingURL=generateClient.d.ts.map
|
|
@@ -298,14 +298,18 @@ ${methodsBody}
|
|
|
298
298
|
if (err) {
|
|
299
299
|
reject(err);
|
|
300
300
|
} else {
|
|
301
|
-
//
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
301
|
+
// @why Response conversion failures must reject the call rather than escape the asynchronous SOAP callback.
|
|
302
|
+
try {
|
|
303
|
+
const response = this.fromSoapResult(result, responseType);
|
|
304
|
+
resolve({
|
|
305
|
+
response,
|
|
306
|
+
headers: soapHeader || {},
|
|
307
|
+
responseRaw: rawResponse,
|
|
308
|
+
requestRaw: rawRequest
|
|
309
|
+
});
|
|
310
|
+
} catch (error) {
|
|
311
|
+
reject(error);
|
|
312
|
+
}
|
|
309
313
|
}
|
|
310
314
|
});
|
|
311
315
|
});
|
|
@@ -405,9 +409,18 @@ ${methodsBody}
|
|
|
405
409
|
if (node == null) {
|
|
406
410
|
return node;
|
|
407
411
|
}
|
|
408
|
-
|
|
412
|
+
const childrenTypes: Readonly<Record<string, string>> = (typeName && this.dataTypes?.ChildrenTypes?.[typeName]) || {};
|
|
413
|
+
const attributeTypes: Readonly<Record<string, string>> = (typeName && this.dataTypes?.AttributeTypes?.[typeName]) || {};
|
|
414
|
+
// XML boolean attributes arrive as lexical strings even when element booleans are parsed by node-soap.
|
|
415
|
+
if (typeof node === "string" && typeName === "boolean") {
|
|
416
|
+
const lexical = node.replace(/^[\\t\\r\\n ]+|[\\t\\r\\n ]+$/g, "");
|
|
417
|
+
if (lexical === "true" || lexical === "1") return true;
|
|
418
|
+
if (lexical === "false" || lexical === "0") return false;
|
|
419
|
+
throw new TypeError("Invalid XML boolean response value");
|
|
420
|
+
}
|
|
421
|
+
// A simple-content complex type retains its object shape when no attributes are present on the wire.
|
|
409
422
|
if (typeof node !== "object") {
|
|
410
|
-
return node;
|
|
423
|
+
return childrenTypes.$value ? {$value: this.fromSoapResult(node, childrenTypes.$value)} : node;
|
|
411
424
|
}
|
|
412
425
|
// Recursively process array elements
|
|
413
426
|
if (Array.isArray(node)) {
|
|
@@ -415,7 +428,6 @@ ${methodsBody}
|
|
|
415
428
|
}
|
|
416
429
|
|
|
417
430
|
// Get child type mapping for recursive processing with correct types
|
|
418
|
-
const childrenTypes: Readonly<Record<string, string>> = (typeName && this.dataTypes?.ChildrenTypes?.[typeName]) || {};
|
|
419
431
|
const repeatedElements: readonly string[] = (typeName && this.dataTypes?.RepeatedElements?.[typeName]) || [];
|
|
420
432
|
const result: any = {};
|
|
421
433
|
|
|
@@ -429,7 +441,9 @@ ${methodsBody}
|
|
|
429
441
|
const inAttrNode = (node as any)[this.attributesKeyOut] || (node as any)["attributes"] || (node as any)["$"];
|
|
430
442
|
if (inAttrNode && typeof inAttrNode === "object") {
|
|
431
443
|
// Promote all attributes to top-level properties for easier TS access
|
|
432
|
-
Object.
|
|
444
|
+
for (const [name, value] of Object.entries(inAttrNode)) {
|
|
445
|
+
result[name] = this.fromSoapResult(value, attributeTypes[name]);
|
|
446
|
+
}
|
|
433
447
|
}
|
|
434
448
|
|
|
435
449
|
// Process remaining properties as child elements
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ReconstructedDirectSource, ReconstructedComponentSource, DirectCapsuleFailure } from '../compiler/directSourceCapsule.js';
|
|
2
|
+
import type { ResolverUsage } from '../compiler/semanticBudget.js';
|
|
3
|
+
export interface GeneratedDirectClient {
|
|
4
|
+
readonly kind: 'generated-direct-client';
|
|
5
|
+
readonly source: string;
|
|
6
|
+
readonly capsule: Uint8Array;
|
|
7
|
+
readonly admitted: false;
|
|
8
|
+
readonly usage: ResolverUsage;
|
|
9
|
+
}
|
|
10
|
+
/** Roles are separate declarations, so equal local names never merge namespace identities. */
|
|
11
|
+
export declare function generateDirectClient(expected: ReconstructedDirectSource, signal?: AbortSignal): GeneratedDirectClient | DirectCapsuleFailure;
|
|
12
|
+
/** Only authentic bounded artifacts may be written; prior semantic failure remains terminal. */
|
|
13
|
+
export declare function writeDirectClient(file: string, generated: GeneratedDirectClient | GeneratedComponentClient): void;
|
|
14
|
+
export interface GeneratedComponentClient {
|
|
15
|
+
readonly kind: 'generated-component-client';
|
|
16
|
+
readonly source: string;
|
|
17
|
+
readonly capsule: Uint8Array;
|
|
18
|
+
readonly admitted: false;
|
|
19
|
+
readonly usage: ResolverUsage;
|
|
20
|
+
}
|
|
21
|
+
/** Emit recursive component types and the existing checked runtime injection protocol.
|
|
22
|
+
* @remarks Native reconstruction and mappings remain authoritative; generated TypeScript is a static description.
|
|
23
|
+
* @returns An authentic writable artifact, or explicit refusal. No legacy catalog or saved report is consumed.
|
|
24
|
+
* @throws TypeError For copied/foreign reconstruction handles. Caller cancellation returns a refusal.
|
|
25
|
+
*/
|
|
26
|
+
export declare function generateComponentClient(expected: ReconstructedComponentSource, signal?: AbortSignal): Promise<GeneratedComponentClient | DirectCapsuleFailure>;
|
|
27
|
+
/** Emit a service client index and per-operation native artifacts using the existing component emitter.
|
|
28
|
+
* @remarks All operation artifacts are prepared before writing. The index contains no source authority.
|
|
29
|
+
* @returns Generator-owned relative capsule paths, keyed by exact operation name.
|
|
30
|
+
* @throws For foreign/mixed native operations, refused generation, cancellation or filesystem failure.
|
|
31
|
+
*/
|
|
32
|
+
export declare function writeComponentServiceClient(expected: readonly ReconstructedComponentSource[], directory: string, signal?: AbortSignal, prepared?: readonly GeneratedComponentClient[]): Promise<Readonly<Record<string, string>>>;
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { directLimit } from '../compiler/directExecutionPolicy.js';
|
|
2
|
+
import { DIRECT_CLIENT_RUNTIME_VERSION, DIRECT_CLIENT_RUNTIME_REPAIR, COMPONENT_CLIENT_RUNTIME_VERSION, COMPONENT_CLIENT_RUNTIME_REPAIR } from './directClientVersion.js';
|
|
3
|
+
/** Native-plan generator consumed by the opt-in checked pipeline. */
|
|
4
|
+
import { checkSemanticBudget } from '../compiler/semanticBudget.js';
|
|
5
|
+
import { writeFileSync, mkdirSync } from 'node:fs';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import { inspectDirectOperation } from '../compiler/directOperation.js';
|
|
8
|
+
import { inspectDirectValueMapping, inspectComponentValueMapping } from '../compiler/directValues.js';
|
|
9
|
+
import { checkDirectSourceCompatibility, createDirectSourceCapsule, componentSourceCapsuleBytes, inspectReconstructedComponentSource, inspectComponentSourceService } from '../compiler/directSourceCapsule.js';
|
|
10
|
+
import { lowerComponentShape } from '../generation/componentShape.js';
|
|
11
|
+
import { composeGeneratedSource, resolvePreamble } from '../generation/preamble.js';
|
|
12
|
+
const MAX_SOURCE_BYTES = 512 * 1024;
|
|
13
|
+
const generatedArtifacts = new WeakMap();
|
|
14
|
+
const componentArtifactOwners = new WeakMap();
|
|
15
|
+
/** Roles are separate declarations, so equal local names never merge namespace identities. */
|
|
16
|
+
export function generateDirectClient(expected, signal) {
|
|
17
|
+
const { budget } = inspectDirectOperation(expected.contract).context;
|
|
18
|
+
const failure = (kind, rule) => ({ kind, rule,
|
|
19
|
+
repair: 'Regenerate matched internal direct artifacts from an explicitly authorized source.', usage: Object.freeze({ ...budget.usage() }) });
|
|
20
|
+
try {
|
|
21
|
+
const compatible = checkDirectSourceCompatibility(expected, expected.contract, expected.selection, signal);
|
|
22
|
+
if (compatible.kind !== 'compatible-direct')
|
|
23
|
+
return compatible;
|
|
24
|
+
const capsule = createDirectSourceCapsule(expected.contract, expected.selection, signal);
|
|
25
|
+
if (capsule.kind !== 'direct-capsule')
|
|
26
|
+
return capsule;
|
|
27
|
+
// Bound every variable emission before building strings. Six bytes per UTF-16
|
|
28
|
+
// unit covers JSON escapes; fixed per-slot/role costs cover TypeScript syntax.
|
|
29
|
+
let bound = 16_384 + Math.ceil(capsule.bytes.byteLength / 3) * 4;
|
|
30
|
+
for (const mapping of expected.mappings) {
|
|
31
|
+
inspectDirectValueMapping(mapping, expected.contract);
|
|
32
|
+
if (mapping.direction.kind === 'fault')
|
|
33
|
+
bound += mapping.direction.name.length * 6 + 512;
|
|
34
|
+
for (const slot of mapping.slots)
|
|
35
|
+
bound += 256 + slot.element.name.local.length * 6;
|
|
36
|
+
}
|
|
37
|
+
const selector = expected.contract.selector;
|
|
38
|
+
bound += 6 * (selector.operation.length * 2 + selector.portType.namespace.length + selector.portType.local.length
|
|
39
|
+
+ selector.binding.namespace.length + selector.binding.local.length + expected.selection.service.namespace.length
|
|
40
|
+
+ expected.selection.service.local.length + expected.selection.port.length);
|
|
41
|
+
if (bound > directLimit(budget, MAX_SOURCE_BYTES))
|
|
42
|
+
return failure('resource-limit', 'generated-source-byte-limit');
|
|
43
|
+
const literal = (text) => JSON.stringify(text).replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029');
|
|
44
|
+
const primitive = (name) => {
|
|
45
|
+
if (name === 'string')
|
|
46
|
+
return 'string';
|
|
47
|
+
if (name === 'boolean')
|
|
48
|
+
return 'boolean';
|
|
49
|
+
if (name === 'int')
|
|
50
|
+
return 'number';
|
|
51
|
+
throw new TypeError('Unsupported native scalar plan');
|
|
52
|
+
};
|
|
53
|
+
const shape = (supplied) => {
|
|
54
|
+
const mapping = inspectDirectValueMapping(supplied, expected.contract);
|
|
55
|
+
if (mapping.rootBuiltin)
|
|
56
|
+
return primitive(mapping.rootBuiltin.local);
|
|
57
|
+
if (!mapping.slots.length)
|
|
58
|
+
return 'Readonly<Record<string, never>>';
|
|
59
|
+
return '{\n' + mapping.slots.map(slot => {
|
|
60
|
+
if (signal?.aborted)
|
|
61
|
+
throw new Error('cancelled');
|
|
62
|
+
const item = primitive(slot.builtin.local), { min, max } = slot.particle.occurs;
|
|
63
|
+
const type = max === 'unbounded' ? min === '1' ? `readonly [${item}, ...${item}[]]` : `readonly ${item}[]` : item;
|
|
64
|
+
return ` readonly ${literal(slot.element.name.local)}${max === '1' && min === '0' ? '?' : ''}: ${type};`;
|
|
65
|
+
}).join('\n') + '\n}';
|
|
66
|
+
};
|
|
67
|
+
const mappings = expected.mappings;
|
|
68
|
+
const input = mappings.find(m => m.direction.kind === 'input');
|
|
69
|
+
const output = mappings.find(m => m.direction.kind === 'output');
|
|
70
|
+
const faults = mappings.filter(m => m.direction.kind === 'fault');
|
|
71
|
+
const lines = [
|
|
72
|
+
'// Checked direct client; inject checkedDirectRuntimeV1 from the package root.',
|
|
73
|
+
'// Opt-in preview binding supports only the documented direct grammar.',
|
|
74
|
+
'// Static number types require native int32 validation; native checks enforce exact shapes.',
|
|
75
|
+
`export type Request = ${shape(input)};`,
|
|
76
|
+
`export type Response = ${shape(output)};`,
|
|
77
|
+
...faults.map((m, i) => `export type Fault_${i} = ${shape(m)};`),
|
|
78
|
+
'export interface Usage { readonly nodes: number; readonly work: number }',
|
|
79
|
+
'export interface Name { readonly namespace: string; readonly local: string }',
|
|
80
|
+
'export interface Options {',
|
|
81
|
+
' readonly localSource: string; readonly fileRoots: readonly string[]; readonly capsule: Uint8Array;',
|
|
82
|
+
' readonly soap: { readonly service: Name; readonly port: string; readonly endpoint: string;',
|
|
83
|
+
' readonly allowEndpoint: (endpoint: URL) => boolean; readonly signal?: AbortSignal;',
|
|
84
|
+
' readonly timeoutMs?: number; readonly capabilities?: readonly string[];',
|
|
85
|
+
' readonly limits?: { readonly maxBytes?: number; readonly maxDepth?: number; readonly maxNodes?: number; readonly maxText?: number } };',
|
|
86
|
+
'}',
|
|
87
|
+
'export interface Failure {',
|
|
88
|
+
' readonly kind: "incompatible-artifact" | "unsupported" | "missing-authority" | "resource-limit" | "cancelled" | "inconclusive" | "invalid-schema" | "scalar-invalid" | "value-invalid" | "xml-invalid" | "mismatch" | "transport" | "protocol";',
|
|
89
|
+
' readonly rule: string; readonly repair?: string; readonly usage: Usage;',
|
|
90
|
+
'}',
|
|
91
|
+
'export interface NativeSuccess { readonly kind: "soap-response" | "soap-fault"; readonly value: unknown;',
|
|
92
|
+
' readonly admitted: false; readonly status: number; readonly usage: Usage; readonly responseBytes: Uint8Array;',
|
|
93
|
+
' readonly fault?: { readonly name: string; readonly code: Name; readonly string: string; readonly actor?: string }; }',
|
|
94
|
+
`export interface Runtime { readonly version: ${literal(DIRECT_CLIENT_RUNTIME_VERSION)}; execute(expectedBase64: string, input: unknown, options: Options, version: ${literal(DIRECT_CLIENT_RUNTIME_VERSION)}): Promise<Failure | NativeSuccess> }`,
|
|
95
|
+
'type Common = { readonly admitted: false; readonly status: number; readonly usage: Usage; readonly responseBytes: Uint8Array };',
|
|
96
|
+
'export type DeclaredFault = ' + (faults.length ? faults.map((m, i) => {
|
|
97
|
+
if (m.direction.kind !== 'fault')
|
|
98
|
+
throw new TypeError('fault direction');
|
|
99
|
+
return `(Common & { readonly kind: "soap-fault"; readonly value: Fault_${i}; readonly fault: { readonly name: ${literal(m.direction.name)}; readonly code: Name; readonly string: string; readonly actor?: string } })`;
|
|
100
|
+
}).join(' | ') : 'never') + ';',
|
|
101
|
+
'export type Result = Failure | (Common & { readonly kind: "soap-response"; readonly value: Response }) | DeclaredFault;',
|
|
102
|
+
`const capsule = ${literal(Buffer.from(capsule.bytes).toString('base64'))};`,
|
|
103
|
+
'export const expectedCapsuleBase64 = capsule;',
|
|
104
|
+
`export const selection = ${literal(JSON.stringify({ selector: expected.contract.selector, ...expected.selection }))};`,
|
|
105
|
+
'export function createClient(runtime: Runtime) {',
|
|
106
|
+
' return Object.freeze({',
|
|
107
|
+
` [${literal(expected.contract.selector.operation)}]: async (input: Request, options: Options): Promise<Result> => {`,
|
|
108
|
+
` if (runtime.version !== ${literal(DIRECT_CLIENT_RUNTIME_VERSION)}) return {kind: "incompatible-artifact", rule: "generated-runtime-version", repair: ${literal(DIRECT_CLIENT_RUNTIME_REPAIR)}, usage: {nodes: 0, work: 0}};`,
|
|
109
|
+
' // The installed native binding pins the literal capsule before issuing fresh authority.',
|
|
110
|
+
` return await runtime.execute(capsule, input, options, ${literal(DIRECT_CLIENT_RUNTIME_VERSION)}) as Result;`,
|
|
111
|
+
' },',
|
|
112
|
+
' });',
|
|
113
|
+
'}',
|
|
114
|
+
'',
|
|
115
|
+
];
|
|
116
|
+
const source = composeGeneratedSource(lines.join('\n'), resolvePreamble('direct-client'));
|
|
117
|
+
if (Buffer.byteLength(source) > directLimit(budget, MAX_SOURCE_BYTES))
|
|
118
|
+
return failure('resource-limit', 'generated-source-byte-limit');
|
|
119
|
+
if (signal?.aborted)
|
|
120
|
+
return failure('cancelled', 'cooperative-cancellation');
|
|
121
|
+
const result = Object.freeze({ kind: 'generated-direct-client', source, capsule: capsule.bytes, admitted: false, usage: Object.freeze({ ...budget.usage() }) });
|
|
122
|
+
generatedArtifacts.set(result, budget);
|
|
123
|
+
return result;
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
if (budget.exhausted())
|
|
127
|
+
return failure('resource-limit', 'request-budget');
|
|
128
|
+
if (signal?.aborted)
|
|
129
|
+
return failure('cancelled', 'cooperative-cancellation');
|
|
130
|
+
throw error;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/** Only authentic bounded artifacts may be written; prior semantic failure remains terminal. */
|
|
134
|
+
export function writeDirectClient(file, generated) {
|
|
135
|
+
const budget = generatedArtifacts.get(generated);
|
|
136
|
+
if (!budget)
|
|
137
|
+
throw new TypeError('Authentic generated artifact required');
|
|
138
|
+
checkSemanticBudget(budget);
|
|
139
|
+
writeFileSync(file, generated.source, 'utf8');
|
|
140
|
+
}
|
|
141
|
+
/** Emit recursive component types and the existing checked runtime injection protocol.
|
|
142
|
+
* @remarks Native reconstruction and mappings remain authoritative; generated TypeScript is a static description.
|
|
143
|
+
* @returns An authentic writable artifact, or explicit refusal. No legacy catalog or saved report is consumed.
|
|
144
|
+
* @throws TypeError For copied/foreign reconstruction handles. Caller cancellation returns a refusal.
|
|
145
|
+
*/
|
|
146
|
+
export async function generateComponentClient(expected, signal) {
|
|
147
|
+
inspectReconstructedComponentSource(expected);
|
|
148
|
+
const { budget } = inspectDirectOperation(expected.contract).context;
|
|
149
|
+
const failure = (kind, rule) => ({ kind, rule,
|
|
150
|
+
repair: COMPONENT_CLIENT_RUNTIME_REPAIR, usage: Object.freeze({ ...budget.usage() }) });
|
|
151
|
+
const check = () => { checkSemanticBudget(budget); if (signal?.aborted)
|
|
152
|
+
throw new Error('cancelled'); };
|
|
153
|
+
try {
|
|
154
|
+
check();
|
|
155
|
+
const capsule = { bytes: componentSourceCapsuleBytes(expected, signal) };
|
|
156
|
+
const literal = (value) => JSON.stringify(value).replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029');
|
|
157
|
+
const mappings = expected.mappings;
|
|
158
|
+
const input = mappings.find(mapping => mapping.direction.kind === 'input');
|
|
159
|
+
const output = mappings.find(mapping => mapping.direction.kind === 'output');
|
|
160
|
+
const request = lowerComponentShape(expected.contract, input, 'Request', check);
|
|
161
|
+
const response = lowerComponentShape(expected.contract, output, 'Response', check);
|
|
162
|
+
const faults = mappings.filter(mapping => mapping.direction.kind === 'fault').map((mapping, index) => ({ mapping,
|
|
163
|
+
shape: lowerComponentShape(expected.contract, mapping, `Fault_${index}`, check) }));
|
|
164
|
+
const grouped = mappings.some(mapping => mapping.kind === 'component-mapping'
|
|
165
|
+
&& inspectComponentValueMapping(mapping, expected.contract).applicationGroups);
|
|
166
|
+
const declarations = grouped ? [...new Set([...request.declarations, ...response.declarations, ...faults.flatMap(({ shape }) => shape.declarations)]),
|
|
167
|
+
`export type Request = ${request.type};`, `export type Response = ${response.type};`,
|
|
168
|
+
...faults.map(({ shape }, index) => `export type Fault_${index} = ${shape.type};`)] : [
|
|
169
|
+
...request.declarations, `export type Request = ${request.type};`,
|
|
170
|
+
...response.declarations, `export type Response = ${response.type};`,
|
|
171
|
+
...faults.flatMap(({ shape }, index) => [...shape.declarations, `export type Fault_${index} = ${shape.type};`])
|
|
172
|
+
];
|
|
173
|
+
const lines = [
|
|
174
|
+
'// Checked component client; inject checkedComponentRuntimeV1 from the package root.',
|
|
175
|
+
'// Scalar facets, ordered occurrence correlation and wildcard membership remain native runtime duties.',
|
|
176
|
+
...declarations,
|
|
177
|
+
'export interface Usage {readonly nodes: number; readonly work: number}',
|
|
178
|
+
'export interface Name {readonly namespace: string; readonly local: string}',
|
|
179
|
+
'export interface Options {',
|
|
180
|
+
' readonly localSource: string; readonly fileRoots: readonly string[]; readonly capsule: Uint8Array;',
|
|
181
|
+
' readonly sourceResources: readonly {readonly uri: string; readonly file: string; readonly canonicalUri?: string}[]; readonly sourceOrigins: readonly string[];',
|
|
182
|
+
' readonly sourceUri?: string;',
|
|
183
|
+
' readonly namespaceLocations?: readonly {readonly namespace: string; readonly location: string}[];',
|
|
184
|
+
' readonly standardLibraries?: readonly string[];',
|
|
185
|
+
' readonly recordSources?: readonly {readonly selector: {readonly portType: Name; readonly binding: Name; readonly operation: string}; readonly source: string}[];',
|
|
186
|
+
' readonly soap: {readonly service: Name; readonly port: string; readonly endpoint?: string;',
|
|
187
|
+
' readonly allowEndpoint?: (endpoint: URL) => boolean; readonly signal?: AbortSignal; readonly timeoutMs?: number;',
|
|
188
|
+
' readonly capabilities?: readonly string[]; readonly ca?: string;',
|
|
189
|
+
' readonly limits?: {readonly maxBytes?: number; readonly maxDepth?: number; readonly maxNodes?: number; readonly maxText?: number}};',
|
|
190
|
+
'}',
|
|
191
|
+
'export interface Failure {readonly kind: "incompatible-artifact" | "unsupported" | "missing-authority" | "resource-limit" | "cancelled" | "inconclusive" | "invalid-schema" | "scalar-invalid" | "value-invalid" | "xml-invalid" | "mismatch" | "transport" | "protocol";',
|
|
192
|
+
' readonly rule: string; readonly repair?: string; readonly phase?: "input" | "response"; readonly usage: Usage}',
|
|
193
|
+
'export interface NativeSuccess {readonly kind: "soap-response" | "soap-fault"; readonly value: unknown; readonly admitted: false;',
|
|
194
|
+
' readonly status: number; readonly usage: Usage; readonly responseBytes: Uint8Array;',
|
|
195
|
+
' readonly fault?: {readonly name: string; readonly code: Name; readonly string: string; readonly actor?: string}}',
|
|
196
|
+
`export interface Runtime {readonly version: ${literal(COMPONENT_CLIENT_RUNTIME_VERSION)}; execute(expectedBase64: string, input: unknown, options: Options, version: ${literal(COMPONENT_CLIENT_RUNTIME_VERSION)}): Promise<Failure | NativeSuccess>}`,
|
|
197
|
+
'type Common = {readonly admitted: false; readonly status: number; readonly usage: Usage; readonly responseBytes: Uint8Array};',
|
|
198
|
+
'export type Result = Failure | (Common & {readonly kind: "soap-response"; readonly value: Response})',
|
|
199
|
+
...faults.map(({ mapping }, index) => {
|
|
200
|
+
if (mapping.direction.kind !== 'fault')
|
|
201
|
+
throw new TypeError('Native fault mapping required');
|
|
202
|
+
return ` | (Common & {readonly kind: "soap-fault"; readonly value: Fault_${index}; readonly fault: {readonly name: ${literal(mapping.direction.name)}; readonly code: Name; readonly string: string; readonly actor?: string}})`;
|
|
203
|
+
}),
|
|
204
|
+
...(faults.length ? [] : [' | (Common & {readonly kind: "soap-fault"; readonly value: never; readonly fault: {readonly name: never; readonly code: Name; readonly string: string; readonly actor?: string}})']),
|
|
205
|
+
';',
|
|
206
|
+
`export const expectedCapsuleBase64 = ${literal(Buffer.from(capsule.bytes).toString('base64'))};`,
|
|
207
|
+
`export const selection = ${literal(JSON.stringify({ selector: expected.contract.selector, ...expected.selection }))};`,
|
|
208
|
+
'export function createClient(runtime: Runtime) {',
|
|
209
|
+
' return Object.freeze({',
|
|
210
|
+
` [${literal(expected.contract.selector.operation)}]: async (input: Request, options: Options): Promise<Result> => {`,
|
|
211
|
+
` if (runtime.version !== ${literal(COMPONENT_CLIENT_RUNTIME_VERSION)}) return {kind: "incompatible-artifact", rule: "generated-runtime-version", repair: ${literal(COMPONENT_CLIENT_RUNTIME_REPAIR)}, usage: {nodes: 0, work: 0}};`,
|
|
212
|
+
` return await runtime.execute(expectedCapsuleBase64, input, options, ${literal(COMPONENT_CLIENT_RUNTIME_VERSION)}) as Result;`,
|
|
213
|
+
' },', ' });', '}', '',
|
|
214
|
+
];
|
|
215
|
+
const source = composeGeneratedSource(lines.join('\n'), resolvePreamble('direct-client'));
|
|
216
|
+
if (Buffer.byteLength(source) > directLimit(budget, MAX_SOURCE_BYTES))
|
|
217
|
+
return failure('resource-limit', 'generated-source-byte-limit');
|
|
218
|
+
check();
|
|
219
|
+
const artifact = Object.freeze({ kind: 'generated-component-client', source, capsule: capsule.bytes,
|
|
220
|
+
admitted: false, usage: Object.freeze({ ...budget.usage() }) });
|
|
221
|
+
generatedArtifacts.set(artifact, budget);
|
|
222
|
+
componentArtifactOwners.set(artifact, expected);
|
|
223
|
+
return artifact;
|
|
224
|
+
}
|
|
225
|
+
catch (error) {
|
|
226
|
+
if (budget.exhausted())
|
|
227
|
+
return failure('resource-limit', 'request-budget');
|
|
228
|
+
if (signal?.aborted)
|
|
229
|
+
return failure('cancelled', 'cooperative-cancellation');
|
|
230
|
+
throw error;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
/** Emit a service client index and per-operation native artifacts using the existing component emitter.
|
|
234
|
+
* @remarks All operation artifacts are prepared before writing. The index contains no source authority.
|
|
235
|
+
* @returns Generator-owned relative capsule paths, keyed by exact operation name.
|
|
236
|
+
* @throws For foreign/mixed native operations, refused generation, cancellation or filesystem failure.
|
|
237
|
+
*/
|
|
238
|
+
export async function writeComponentServiceClient(expected, directory, signal, prepared) {
|
|
239
|
+
const operations = inspectComponentSourceService(expected);
|
|
240
|
+
const generated = [];
|
|
241
|
+
if (prepared && prepared.length !== operations.length)
|
|
242
|
+
throw new TypeError('Prepared operation artifacts must match the service');
|
|
243
|
+
for (const [index, operation] of operations.entries()) {
|
|
244
|
+
const artifact = prepared?.[index] ?? await generateComponentClient(operation, signal);
|
|
245
|
+
if (artifact.kind !== 'generated-component-client')
|
|
246
|
+
throw new Error(`Checked client refused: ${artifact.kind}: ${artifact.rule}`);
|
|
247
|
+
if (componentArtifactOwners.get(artifact) !== operation)
|
|
248
|
+
throw new TypeError('Prepared client belongs to another native operation');
|
|
249
|
+
generated.push(artifact);
|
|
250
|
+
}
|
|
251
|
+
const files = Object.create(null);
|
|
252
|
+
const lines = operations.flatMap((_, index) => [
|
|
253
|
+
`import {createClient as operation_${index}} from './operations/${index}/client.js';`,
|
|
254
|
+
`export * as Operation_${index} from './operations/${index}/client.js';`,
|
|
255
|
+
]);
|
|
256
|
+
lines.push("import type {Runtime, Options as OperationOptions} from './operations/0/client.js';", "export type Options = Omit<OperationOptions, 'capsule'>;", `export const selection = ${JSON.stringify(JSON.stringify(operations[0].selection))};`, 'export function createClient(runtime: Runtime) {', ' return Object.freeze({', ...operations.map((_, index) => ` ...operation_${index}(runtime),`), ' });', '}', '');
|
|
257
|
+
for (const [index, operation] of operations.entries()) {
|
|
258
|
+
const dir = path.join(directory, 'operations', String(index));
|
|
259
|
+
mkdirSync(dir, { recursive: true });
|
|
260
|
+
writeDirectClient(path.join(dir, 'client.ts'), generated[index]);
|
|
261
|
+
writeFileSync(path.join(dir, 'contract.json'), generated[index].capsule);
|
|
262
|
+
files[operation.contract.selector.operation] = `operations/${index}/contract.json`;
|
|
263
|
+
}
|
|
264
|
+
const { budget } = inspectDirectOperation(operations[0].contract).context;
|
|
265
|
+
checkSemanticBudget(budget);
|
|
266
|
+
writeFileSync(path.join(directory, 'client.ts'), composeGeneratedSource(lines.join('\n'), resolvePreamble('direct-client')), 'utf8');
|
|
267
|
+
return Object.freeze(files);
|
|
268
|
+
}
|