@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,543 @@
|
|
|
1
|
+
/** Internal direct case of the content-model matcher; never runtime admission. */
|
|
2
|
+
import { inspectDirectOperation } from './directOperation.js';
|
|
3
|
+
import { planDirectProjection, flatDirectProjection, matchOrderedProjection, selectProjectionAttribute, isXmlCharacters, isXmlNamespaceBinding } from './directStructurePlan.js';
|
|
4
|
+
import { assertSemanticContext } from './semanticContext.js';
|
|
5
|
+
import { isXmlNCName } from '../loader/orderedSyntax.js';
|
|
6
|
+
const projectionIssued = new WeakMap();
|
|
7
|
+
/** Native context identity authenticates structure only, never source validity or operation admission. */
|
|
8
|
+
export function inspectProjectionStructuralMatch(match, context) {
|
|
9
|
+
assertSemanticContext(context);
|
|
10
|
+
if (!match || typeof match !== 'object' || projectionIssued.get(match) !== context)
|
|
11
|
+
throw new TypeError('Unauthenticated or foreign projection structural match');
|
|
12
|
+
return match;
|
|
13
|
+
}
|
|
14
|
+
const issued = new WeakMap();
|
|
15
|
+
/** Identity is checked before any receipt fields; no retrospective authentication. */
|
|
16
|
+
export function inspectDirectStructuralMatch(match, expectedContract) {
|
|
17
|
+
if (!match || typeof match !== 'object' || issued.get(match) !== expectedContract)
|
|
18
|
+
throw new TypeError('Unauthenticated or foreign direct structural match');
|
|
19
|
+
inspectDirectOperation(expectedContract);
|
|
20
|
+
return match;
|
|
21
|
+
}
|
|
22
|
+
class Stop extends Error {
|
|
23
|
+
kind;
|
|
24
|
+
rule;
|
|
25
|
+
schemaPath;
|
|
26
|
+
payloadPath;
|
|
27
|
+
constructor(kind, rule, schemaPath, payloadPath) {
|
|
28
|
+
super(rule);
|
|
29
|
+
this.kind = kind;
|
|
30
|
+
this.rule = rule;
|
|
31
|
+
this.schemaPath = schemaPath;
|
|
32
|
+
this.payloadPath = payloadPath;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Match a data-only ordered XML tree against an actual native projection.
|
|
37
|
+
* @remarks The issued receipt establishes structure only, not source validity, scalar validity or operation admission.
|
|
38
|
+
* @constraints Plain records/arrays only; proxies and accessors are unsupported. No caller payload is frozen.
|
|
39
|
+
* @throws TypeError For malformed data-only trees or unauthenticated contexts.
|
|
40
|
+
* @returns A context-owned structural match or a mismatch, unsupported, cancellation or resource failure.
|
|
41
|
+
*/
|
|
42
|
+
export function matchDirectProjection(context, root, payload, options = {}) {
|
|
43
|
+
assertSemanticContext(context);
|
|
44
|
+
const { budget } = context;
|
|
45
|
+
const check = () => { budget.chargeWork(); if (options.signal?.aborted)
|
|
46
|
+
throw new Stop('cancelled', 'cooperative-cancellation'); };
|
|
47
|
+
const fail = (kind, rule, schemaPath, payloadPath) => { throw new Stop(kind, rule, schemaPath, payloadPath); };
|
|
48
|
+
const malformed = () => { throw new TypeError('Direct payload requires a data-only ordered syntax tree'); };
|
|
49
|
+
const field = (value, key) => {
|
|
50
|
+
budget.chargeWork(96 + key.length);
|
|
51
|
+
if (!value || typeof value !== 'object')
|
|
52
|
+
return malformed();
|
|
53
|
+
const proto = Object.getPrototypeOf(value);
|
|
54
|
+
if (!Array.isArray(value) && proto !== Object.prototype && proto !== null)
|
|
55
|
+
return malformed();
|
|
56
|
+
const d = Object.getOwnPropertyDescriptor(value, key);
|
|
57
|
+
if (!d || !('value' in d))
|
|
58
|
+
return malformed();
|
|
59
|
+
return d.value;
|
|
60
|
+
};
|
|
61
|
+
const string = (value) => typeof value === 'string';
|
|
62
|
+
const record = (value) => !!value && typeof value === 'object' && !Array.isArray(value);
|
|
63
|
+
const sourceShape = (value) => {
|
|
64
|
+
if (!record(value) || !string(value.uri) || !string(value.digest) || !string(value.path))
|
|
65
|
+
return false;
|
|
66
|
+
for (const p of [value.start, value.end])
|
|
67
|
+
if (!record(p) || ![p.offset, p.line, p.column].every(n => typeof n === 'number' && Number.isSafeInteger(n) && n >= 0))
|
|
68
|
+
return false;
|
|
69
|
+
return true;
|
|
70
|
+
};
|
|
71
|
+
const nameShape = (value) => record(value) && string(value.namespace) && string(value.local) && value.local.length > 0;
|
|
72
|
+
try {
|
|
73
|
+
const guarded = budget.guard(() => {
|
|
74
|
+
// Reserve fixed closures/state, diagnostics and terminal publication before input work.
|
|
75
|
+
budget.chargeWork(4096);
|
|
76
|
+
check();
|
|
77
|
+
const schemaPath = root.context.source.path;
|
|
78
|
+
const unsupported = () => fail('unsupported', 'native-direct-shape', schemaPath);
|
|
79
|
+
const plan = planDirectProjection(context, root, check, unsupported);
|
|
80
|
+
if (options.flatOnly)
|
|
81
|
+
flatDirectProjection(plan, check, unsupported);
|
|
82
|
+
const records = new Map(plan.records.map(record => [record.type.id, record]));
|
|
83
|
+
const wildcardPlans = new Map([[root, plan]]);
|
|
84
|
+
const wildcardValue = (element) => {
|
|
85
|
+
let selected = wildcardPlans.get(element);
|
|
86
|
+
if (!selected) {
|
|
87
|
+
selected = planDirectProjection(context, element, check, unsupported);
|
|
88
|
+
budget.chargeWork(64 + selected.records.length * 64);
|
|
89
|
+
for (const record of selected.records) {
|
|
90
|
+
check();
|
|
91
|
+
if (!records.has(record.type.id))
|
|
92
|
+
records.set(record.type.id, record);
|
|
93
|
+
}
|
|
94
|
+
wildcardPlans.set(element, selected);
|
|
95
|
+
}
|
|
96
|
+
return selected.root;
|
|
97
|
+
};
|
|
98
|
+
// Count syntax nodes before copying. Descriptor reads reject accessors without invoking
|
|
99
|
+
// them. A tree may not reuse a node, including cyclic input; proxies are out of contract.
|
|
100
|
+
budget.chargeWork(128);
|
|
101
|
+
const seen = new Set(), stack = [payload];
|
|
102
|
+
if (field(payload, 'kind') !== 'element')
|
|
103
|
+
return malformed();
|
|
104
|
+
while (stack.length) {
|
|
105
|
+
check();
|
|
106
|
+
const current = stack.pop();
|
|
107
|
+
if (!current || typeof current !== 'object' || seen.has(current))
|
|
108
|
+
return malformed();
|
|
109
|
+
budget.reserveNodes(1);
|
|
110
|
+
budget.chargeWork(64);
|
|
111
|
+
seen.add(current);
|
|
112
|
+
const kind = field(current, 'kind');
|
|
113
|
+
if (kind === 'text')
|
|
114
|
+
continue;
|
|
115
|
+
if (kind !== 'element')
|
|
116
|
+
return malformed();
|
|
117
|
+
const children = field(current, 'children');
|
|
118
|
+
if (!Array.isArray(children))
|
|
119
|
+
return malformed();
|
|
120
|
+
const length = field(children, 'length');
|
|
121
|
+
if (typeof length !== 'number')
|
|
122
|
+
return malformed();
|
|
123
|
+
for (let i = 0; i < length; i++) {
|
|
124
|
+
check();
|
|
125
|
+
budget.chargeWork(32);
|
|
126
|
+
stack.push(field(children, String(i)));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const owned = budget.snapshot(payload);
|
|
130
|
+
// Snapshot already excludes prototypes/accessors and owns all retained maps and text.
|
|
131
|
+
budget.chargeWork(64);
|
|
132
|
+
const visits = [owned];
|
|
133
|
+
while (visits.length) {
|
|
134
|
+
check();
|
|
135
|
+
const node = visits.pop();
|
|
136
|
+
budget.chargeWork(128);
|
|
137
|
+
if (!sourceShape(node.source))
|
|
138
|
+
return malformed();
|
|
139
|
+
if (node.kind === 'text') {
|
|
140
|
+
if (!string(node.value))
|
|
141
|
+
return malformed();
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
if (!nameShape(node.name) || !string(node.lexicalName) || !string(node.baseUri) || !record(node.namespaces) || !Array.isArray(node.attributes))
|
|
145
|
+
return malformed();
|
|
146
|
+
for (const key in node.namespaces) {
|
|
147
|
+
check();
|
|
148
|
+
if (!string(node.namespaces[key]))
|
|
149
|
+
return malformed();
|
|
150
|
+
}
|
|
151
|
+
for (const a of node.attributes) {
|
|
152
|
+
check();
|
|
153
|
+
if (!record(a) || !nameShape(a.name) || !string(a.lexicalName) || !string(a.value))
|
|
154
|
+
return malformed();
|
|
155
|
+
}
|
|
156
|
+
for (const child of node.children) {
|
|
157
|
+
check();
|
|
158
|
+
budget.chargeWork(32);
|
|
159
|
+
visits.push(child);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const same = (a, b) => budget.compareText(a.namespace, b.namespace) === 0 && budget.compareText(a.local, b.local) === 0;
|
|
163
|
+
const mismatch = (rule, declaration, path) => fail('mismatch', rule, declaration.context.source.path, path);
|
|
164
|
+
const attributes = (node, declaration, path) => {
|
|
165
|
+
check();
|
|
166
|
+
if (node.attributes.length)
|
|
167
|
+
fail('unsupported', 'payload-attributes', declaration.context.source.path, path);
|
|
168
|
+
};
|
|
169
|
+
if (!same(owned.name, root.name))
|
|
170
|
+
return mismatch('root-name', root, '/0');
|
|
171
|
+
budget.chargeWork(64);
|
|
172
|
+
const occurrences = [];
|
|
173
|
+
const operand = (node, declaration, builtin, lexical, path, fixedCanonical, retainLexical, list) => {
|
|
174
|
+
budget.chargeWork(256 + lexical.length * 4 + path.length * 4);
|
|
175
|
+
// Project only typed retained facts. Generic snapshots deliberately preserve
|
|
176
|
+
// unknown values; caller extension fields must not become receipt authority.
|
|
177
|
+
const namespaces = Object.create(null);
|
|
178
|
+
for (const key in node.namespaces) {
|
|
179
|
+
if (!Object.hasOwn(node.namespaces, key))
|
|
180
|
+
continue;
|
|
181
|
+
check();
|
|
182
|
+
budget.chargeWork(96 + key.length * 4 + node.namespaces[key].length * 4);
|
|
183
|
+
namespaces[key] = node.namespaces[key];
|
|
184
|
+
}
|
|
185
|
+
const s = node.source;
|
|
186
|
+
const payloadSource = budget.snapshot({ uri: s.uri, digest: s.digest, path: s.path,
|
|
187
|
+
start: { offset: s.start.offset, line: s.start.line, column: s.start.column },
|
|
188
|
+
end: { offset: s.end.offset, line: s.end.line, column: s.end.column } });
|
|
189
|
+
occurrences.push({ declaration, type: declaration.type, builtin, lexical, namespaces,
|
|
190
|
+
payloadSource, payloadPath: path, schemaPath: declaration.context.source.path,
|
|
191
|
+
...(fixedCanonical === undefined ? {} : { fixedCanonical }), ...(retainLexical ? { retainLexical } : {}), ...(list ? { list } : {}) });
|
|
192
|
+
};
|
|
193
|
+
const text = (node, declaration, path) => {
|
|
194
|
+
budget.chargeWork(64);
|
|
195
|
+
const parts = [];
|
|
196
|
+
for (const child of node.children) {
|
|
197
|
+
check();
|
|
198
|
+
if (child.kind !== 'text')
|
|
199
|
+
return mismatch('scalar-child', declaration, path);
|
|
200
|
+
budget.chargeWork(32 + child.value.length * 4);
|
|
201
|
+
parts.push(child.value);
|
|
202
|
+
}
|
|
203
|
+
return parts.join('');
|
|
204
|
+
};
|
|
205
|
+
const elementOperand = (node, declaration, builtin, path, shape, retainLexical, list) => {
|
|
206
|
+
const lexical = text(node, declaration, path);
|
|
207
|
+
operand(node, declaration, builtin, lexical === '' && shape.constraint ? shape.constraint.lexical : lexical, path, shape.constraint?.kind === 'fixed' ? shape.constraint.canonical : undefined, retainLexical, list);
|
|
208
|
+
};
|
|
209
|
+
const leaf = (node, declaration, builtin, path, shape, retainLexical, list) => {
|
|
210
|
+
attributes(node, declaration, path);
|
|
211
|
+
elementOperand(node, declaration, builtin, path, shape, retainLexical, list);
|
|
212
|
+
};
|
|
213
|
+
const roots = [];
|
|
214
|
+
const frames = [{ node: owned, declaration: root, value: plan.root, path: '/0', into: roots }];
|
|
215
|
+
while (frames.length) {
|
|
216
|
+
check();
|
|
217
|
+
const frame = frames.pop();
|
|
218
|
+
const { declaration, path: parentPath } = frame;
|
|
219
|
+
let node = frame.node;
|
|
220
|
+
budget.chargeWork(128 + parentPath.length * 4);
|
|
221
|
+
if (node.kind === 'text') {
|
|
222
|
+
if (!isXmlCharacters(node.value))
|
|
223
|
+
return mismatch('xml-characters', declaration, parentPath);
|
|
224
|
+
frame.into.push({ kind: 'mixed-text', declaration, payloadPath: parentPath, value: node.value });
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
if (frame.unassessed) {
|
|
228
|
+
const pending = [node];
|
|
229
|
+
while (pending.length) {
|
|
230
|
+
check();
|
|
231
|
+
const value = pending.pop();
|
|
232
|
+
budget.chargeWork(64);
|
|
233
|
+
if (value.kind === 'text') {
|
|
234
|
+
if (!isXmlCharacters(value.value))
|
|
235
|
+
return mismatch('xml-characters', declaration, value.source.path);
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
if (!isXmlNCName(value.name.local) || !isXmlCharacters(value.name.namespace) || value.name.namespace === 'http://www.w3.org/2000/xmlns/')
|
|
239
|
+
return mismatch('expanded-name-required', declaration, value.source.path);
|
|
240
|
+
for (const prefix in value.namespaces) {
|
|
241
|
+
check();
|
|
242
|
+
if (!isXmlNamespaceBinding(prefix, value.namespaces[prefix]))
|
|
243
|
+
return mismatch('namespace-binding', declaration, value.source.path);
|
|
244
|
+
}
|
|
245
|
+
const identities = new Set();
|
|
246
|
+
for (const attribute of value.attributes) {
|
|
247
|
+
check();
|
|
248
|
+
const key = JSON.stringify([attribute.name.namespace, attribute.name.local]);
|
|
249
|
+
budget.chargeWork(64 + key.length * 4 + attribute.value.length);
|
|
250
|
+
if (!isXmlNCName(attribute.name.local) || attribute.name.local === 'xmlns' && attribute.name.namespace === '' || attribute.name.namespace === 'http://www.w3.org/2000/xmlns/' || !isXmlCharacters(attribute.name.namespace))
|
|
251
|
+
return mismatch('attribute-name', declaration, value.source.path);
|
|
252
|
+
if (!isXmlCharacters(attribute.value))
|
|
253
|
+
return mismatch('xml-characters', declaration, value.source.path);
|
|
254
|
+
if (identities.has(key))
|
|
255
|
+
return mismatch('duplicate-attribute', declaration, value.source.path);
|
|
256
|
+
identities.add(key);
|
|
257
|
+
}
|
|
258
|
+
for (const child of value.children) {
|
|
259
|
+
check();
|
|
260
|
+
pending.push(child);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
frame.into.push({ kind: 'unassessed', declaration, payloadPath: parentPath, payload: node });
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
let nil = false;
|
|
267
|
+
const nilAttributes = node.attributes.filter(attribute => {
|
|
268
|
+
check();
|
|
269
|
+
return attribute.name.namespace === 'http://www.w3.org/2001/XMLSchema-instance' && attribute.name.local === 'nil';
|
|
270
|
+
});
|
|
271
|
+
if (nilAttributes.length) {
|
|
272
|
+
if (options.flatOnly)
|
|
273
|
+
return fail('unsupported', 'payload-attributes', declaration.context.source.path, parentPath);
|
|
274
|
+
if (nilAttributes.length !== 1)
|
|
275
|
+
return mismatch('duplicate-nil', declaration, parentPath);
|
|
276
|
+
const lexical = nilAttributes[0].value.replace(/^[\t\r\n ]+|[\t\r\n ]+$/g, '');
|
|
277
|
+
if (!['true', '1', 'false', '0'].includes(lexical))
|
|
278
|
+
return mismatch('nil-lexical', declaration, parentPath);
|
|
279
|
+
nil = lexical === 'true' || lexical === '1';
|
|
280
|
+
if (nil && !frame.value.nillable)
|
|
281
|
+
return mismatch('non-nillable', declaration, parentPath);
|
|
282
|
+
if (nil && frame.value.constraint?.kind === 'fixed')
|
|
283
|
+
return mismatch('nil-fixed-value', declaration, parentPath);
|
|
284
|
+
if (nil && node.children.length)
|
|
285
|
+
return mismatch('nil-content', declaration, parentPath);
|
|
286
|
+
node = { ...node, attributes: node.attributes.filter(attribute => { check(); return !nilAttributes.includes(attribute); }) };
|
|
287
|
+
}
|
|
288
|
+
if (frame.value.kind === 'scalar') {
|
|
289
|
+
if (nil) {
|
|
290
|
+
attributes(node, declaration, parentPath);
|
|
291
|
+
frame.into.push({ kind: 'record', nil: true, declaration, payloadPath: parentPath, attributes: [], slots: [] });
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
const operand = occurrences.length;
|
|
295
|
+
leaf(node, declaration, frame.value.builtin, parentPath, frame.value, frame.value.retainLexical, frame.value.list);
|
|
296
|
+
frame.into.push({ kind: 'scalar', declaration, payloadPath: parentPath, operand });
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
const record = records.get(frame.value.type);
|
|
300
|
+
if (!record)
|
|
301
|
+
return unsupported();
|
|
302
|
+
if (record.contextual)
|
|
303
|
+
for (const prefix in node.namespaces) {
|
|
304
|
+
check();
|
|
305
|
+
if (!isXmlNamespaceBinding(prefix, node.namespaces[prefix]))
|
|
306
|
+
return mismatch('namespace-binding', declaration, parentPath);
|
|
307
|
+
}
|
|
308
|
+
// @why XSD 1.0 cvc-complex-type.2.1 forbids even whitespace character children for empty content.
|
|
309
|
+
if (record.content === 'empty' && node.children.length)
|
|
310
|
+
return mismatch('empty-content', declaration, parentPath);
|
|
311
|
+
const matchedAttributes = [];
|
|
312
|
+
const openAttributes = [];
|
|
313
|
+
const attributeChannel = (expected) => ({ ...(expected.bag ? { bag: true } : {}),
|
|
314
|
+
...(expected.bag && expected.declaration.name.namespace && (record.attributeWildcard
|
|
315
|
+
|| record.attributes.some(other => other !== expected && other.declaration.name.local === expected.declaration.name.local)) ? { namespaceChoice: true } : {}) });
|
|
316
|
+
if (!record.attributes.length && !record.attributeWildcard)
|
|
317
|
+
attributes(node, declaration, parentPath);
|
|
318
|
+
else {
|
|
319
|
+
const present = new Set();
|
|
320
|
+
for (let index = 0; index < node.attributes.length; index++) {
|
|
321
|
+
check();
|
|
322
|
+
const attribute = node.attributes[index];
|
|
323
|
+
const path = `${parentPath}/attributes/${index}`;
|
|
324
|
+
let expected = record.attributes.find(item => { check(); return same(item.declaration.name, attribute.name); });
|
|
325
|
+
let dynamic = false;
|
|
326
|
+
if (!expected) {
|
|
327
|
+
const selected = selectProjectionAttribute(context, record, attribute.name, check, unsupported);
|
|
328
|
+
if (!selected)
|
|
329
|
+
return mismatch('unknown-attribute', declaration, path);
|
|
330
|
+
if (!selected.attribute) {
|
|
331
|
+
if (!isXmlNCName(attribute.name.local) || attribute.name.local === 'xmlns' && attribute.name.namespace === ''
|
|
332
|
+
|| attribute.name.namespace === 'http://www.w3.org/2000/xmlns/' || !isXmlCharacters(attribute.name.namespace))
|
|
333
|
+
return mismatch('attribute-name', declaration, path);
|
|
334
|
+
if (!isXmlCharacters(attribute.value))
|
|
335
|
+
return mismatch('xml-characters', declaration, path);
|
|
336
|
+
const key = JSON.stringify([attribute.name.namespace, attribute.name.local]);
|
|
337
|
+
if (present.has(key))
|
|
338
|
+
return mismatch('duplicate-attribute', declaration, path);
|
|
339
|
+
present.add(key);
|
|
340
|
+
openAttributes.push(attribute);
|
|
341
|
+
continue;
|
|
342
|
+
}
|
|
343
|
+
expected = selected.attribute;
|
|
344
|
+
dynamic = true;
|
|
345
|
+
}
|
|
346
|
+
if (present.has(expected.declaration.id))
|
|
347
|
+
return mismatch('duplicate-attribute', declaration, path);
|
|
348
|
+
budget.chargeWork(128 + expected.declaration.id.length);
|
|
349
|
+
present.add(expected.declaration.id);
|
|
350
|
+
matchedAttributes.push({ declaration: expected.declaration, operand: occurrences.length, payloadPath: path, origin: 'present',
|
|
351
|
+
...(dynamic ? { bag: true, ...(attribute.name.namespace ? { namespaceChoice: true } : {}) } : attributeChannel(expected)) });
|
|
352
|
+
operand(node, expected.declaration, expected.builtin, attribute.value, path, expected.constraint?.kind === 'fixed' ? expected.constraint.canonical : undefined, expected.retainLexical, expected.list);
|
|
353
|
+
}
|
|
354
|
+
for (const expected of record.attributes) {
|
|
355
|
+
check();
|
|
356
|
+
if (expected.required && !present.has(expected.declaration.id))
|
|
357
|
+
return mismatch('missing-required-attribute', declaration, parentPath);
|
|
358
|
+
if (!present.has(expected.declaration.id) && expected.constraint) {
|
|
359
|
+
budget.chargeWork(128 + expected.declaration.id.length * 4);
|
|
360
|
+
const path = `${parentPath}/@schema-${expected.constraint.kind}/${encodeURIComponent(expected.declaration.id)}`;
|
|
361
|
+
matchedAttributes.push({ declaration: expected.declaration, operand: occurrences.length, payloadPath: path,
|
|
362
|
+
...attributeChannel(expected),
|
|
363
|
+
origin: expected.constraint.kind === 'fixed' ? 'schema-fixed' : 'schema-default' });
|
|
364
|
+
operand(node, expected.declaration, expected.builtin, expected.constraint.lexical, path, expected.constraint.kind === 'fixed' ? expected.constraint.canonical : undefined, expected.retainLexical, expected.list);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
if (nil) {
|
|
369
|
+
frame.into.push({ kind: 'record', nil: true, declaration, payloadPath: parentPath, slots: [], attributes: matchedAttributes,
|
|
370
|
+
openAttributes,
|
|
371
|
+
...(record.contextual ? { namespaces: node.namespaces } : {}) });
|
|
372
|
+
continue;
|
|
373
|
+
}
|
|
374
|
+
if (record.content === 'simple') {
|
|
375
|
+
if (!record.text)
|
|
376
|
+
throw new TypeError('Missing native simple content plan');
|
|
377
|
+
const path = `${parentPath}/text`, index = occurrences.length;
|
|
378
|
+
elementOperand(node, declaration, record.text.builtin, path, frame.value, record.text.retainLexical, record.text.list);
|
|
379
|
+
frame.into.push({ kind: 'record', declaration, payloadPath: parentPath, slots: [], attributes: matchedAttributes,
|
|
380
|
+
openAttributes, ...(record.contextual ? { namespaces: node.namespaces } : {}),
|
|
381
|
+
text: { kind: 'scalar', declaration, payloadPath: path, operand: index } });
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
384
|
+
const slots = record.slots;
|
|
385
|
+
if (record.ordered) {
|
|
386
|
+
const elements = [];
|
|
387
|
+
for (let index = 0; index < node.children.length; index++) {
|
|
388
|
+
check();
|
|
389
|
+
const child = node.children[index], path = `${parentPath}/children/${index}`;
|
|
390
|
+
budget.chargeWork(64);
|
|
391
|
+
if (child.kind === 'text') {
|
|
392
|
+
budget.chargeWork(child.value.length * 2);
|
|
393
|
+
if (record.content !== 'mixed' && /[^\t\r\n ]/.test(child.value))
|
|
394
|
+
return mismatch('complex-text', declaration, path);
|
|
395
|
+
}
|
|
396
|
+
else
|
|
397
|
+
elements.push({ node: child, path });
|
|
398
|
+
}
|
|
399
|
+
const selected = matchOrderedProjection(context, record, elements.map(item => { check(); return item.node.name; }), check);
|
|
400
|
+
if (!selected)
|
|
401
|
+
return mismatch('ordered-particle-language', declaration, parentPath);
|
|
402
|
+
const content = [];
|
|
403
|
+
frame.into.push({ kind: 'record', declaration, payloadPath: parentPath, slots: [], attributes: matchedAttributes, content,
|
|
404
|
+
openAttributes,
|
|
405
|
+
...(record.contextual ? { namespaces: node.namespaces } : {}),
|
|
406
|
+
namespaceChoices: slots.filter(slot => !record.fixedOrder && slots.some(other => other !== slot && other.element.name.local === slot.element.name.local)).map(slot => slot.element.name.local),
|
|
407
|
+
dynamicDeclarations: selected.filter(slot => !('value' in slot) && slot.element).map(slot => slot.element),
|
|
408
|
+
...(record.keyed ? { keyed: true } : {}) });
|
|
409
|
+
let selectedIndex = elements.length - 1;
|
|
410
|
+
for (let index = node.children.length - 1; index >= 0; index--) {
|
|
411
|
+
check();
|
|
412
|
+
const child = node.children[index];
|
|
413
|
+
if (child.kind === 'text') {
|
|
414
|
+
if (record.content === 'mixed')
|
|
415
|
+
frames.push({ node: child, path: `${parentPath}/children/${index}`, declaration, value: frame.value, into: content });
|
|
416
|
+
continue;
|
|
417
|
+
}
|
|
418
|
+
const item = elements[selectedIndex], slot = selected[selectedIndex--];
|
|
419
|
+
if (!slot.element) {
|
|
420
|
+
frames.push({ node: item.node, path: item.path, declaration, value: frame.value, unassessed: true, into: content });
|
|
421
|
+
continue;
|
|
422
|
+
}
|
|
423
|
+
frames.push({ node: item.node, path: item.path, declaration: slot.element,
|
|
424
|
+
value: 'value' in slot ? slot.value : wildcardValue(slot.element), into: content });
|
|
425
|
+
}
|
|
426
|
+
continue;
|
|
427
|
+
}
|
|
428
|
+
budget.chargeWork(64 + slots.length * 128);
|
|
429
|
+
const matchedSlots = slots.map(slot => { check(); return { slot, items: [] }; });
|
|
430
|
+
frame.into.push({ kind: 'record', declaration, payloadPath: parentPath, slots: matchedSlots, attributes: matchedAttributes,
|
|
431
|
+
openAttributes,
|
|
432
|
+
...(record.contextual ? { namespaces: node.namespaces } : {}) });
|
|
433
|
+
const children = [];
|
|
434
|
+
let cursor = 0, count = 0;
|
|
435
|
+
for (let index = 0; index < node.children.length; index++) {
|
|
436
|
+
check();
|
|
437
|
+
const child = node.children[index];
|
|
438
|
+
budget.chargeWork(64);
|
|
439
|
+
const path = `${parentPath}/children/${index}`;
|
|
440
|
+
if (child.kind === 'text') {
|
|
441
|
+
budget.chargeWork(child.value.length * 2);
|
|
442
|
+
if (/[^\t\r\n ]/.test(child.value))
|
|
443
|
+
return mismatch('complex-text', declaration, path);
|
|
444
|
+
continue;
|
|
445
|
+
}
|
|
446
|
+
while (cursor < slots.length && !same(child.name, slots[cursor].element.name)) {
|
|
447
|
+
check();
|
|
448
|
+
const slot = slots[cursor];
|
|
449
|
+
if (slot.particle.occurs.min === '1' && count === 0)
|
|
450
|
+
return mismatch('missing-required', slot.element, path);
|
|
451
|
+
cursor++;
|
|
452
|
+
count = 0;
|
|
453
|
+
}
|
|
454
|
+
const slot = slots[cursor];
|
|
455
|
+
if (!slot)
|
|
456
|
+
return mismatch('unexpected-child', declaration, path);
|
|
457
|
+
if (slot.particle.occurs.max === '1' && count === 1)
|
|
458
|
+
return mismatch('duplicate-singleton', slot.element, path);
|
|
459
|
+
children.push({ node: child, declaration: slot.element, value: slot.value, path, into: matchedSlots[cursor].items });
|
|
460
|
+
count++;
|
|
461
|
+
}
|
|
462
|
+
for (; cursor < slots.length; cursor++, count = 0) {
|
|
463
|
+
check();
|
|
464
|
+
const slot = slots[cursor];
|
|
465
|
+
if (slot.particle.occurs.min === '1' && count === 0)
|
|
466
|
+
return mismatch('missing-required', slot.element, `${parentPath}/end`);
|
|
467
|
+
}
|
|
468
|
+
// @why Preserve document order and record boundaries without recursive JS calls.
|
|
469
|
+
for (let i = children.length - 1; i >= 0; i--) {
|
|
470
|
+
check();
|
|
471
|
+
frames.push(children[i]);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
check();
|
|
475
|
+
budget.chargeWork(512);
|
|
476
|
+
const result = { kind: 'projection-match', scope: 'structure-only', scalarValidity: 'unassessed', admitted: false,
|
|
477
|
+
root, contextId: context.contextId, tree: roots[0], occurrences, usage: { ...budget.usage() } };
|
|
478
|
+
budget.freeze(result);
|
|
479
|
+
check();
|
|
480
|
+
// Capture final accounting after publication traversal; the record is already reserved.
|
|
481
|
+
const published = Object.freeze({ ...result, usage: Object.freeze({ ...budget.usage() }) });
|
|
482
|
+
projectionIssued.set(published, context);
|
|
483
|
+
return published;
|
|
484
|
+
});
|
|
485
|
+
return guarded.kind === 'resource-limit' ? Object.freeze({ kind: 'resource-limit', rule: 'request-budget', usage: budget.usage() }) : guarded;
|
|
486
|
+
}
|
|
487
|
+
catch (error) {
|
|
488
|
+
if (budget.exhausted())
|
|
489
|
+
return Object.freeze({ kind: 'resource-limit', rule: 'request-budget', usage: budget.usage() });
|
|
490
|
+
if (error instanceof Stop)
|
|
491
|
+
return Object.freeze({ kind: error.kind, rule: error.rule, schemaPath: error.schemaPath, payloadPath: error.payloadPath, usage: Object.freeze({ ...budget.usage() }) });
|
|
492
|
+
throw error;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
/** Operation-owned flat preview wrapper; structured projection matches cannot bypass this gate. */
|
|
496
|
+
export function matchDirectOperation(contract, direction, payload, options = {}) {
|
|
497
|
+
const { context } = inspectDirectOperation(contract);
|
|
498
|
+
const { budget } = context;
|
|
499
|
+
try {
|
|
500
|
+
const guarded = budget.guard(() => {
|
|
501
|
+
const supplied = budget.snapshot(direction);
|
|
502
|
+
if (!supplied || typeof supplied !== 'object' || Array.isArray(supplied))
|
|
503
|
+
throw new TypeError('Direct direction requires a data-only record');
|
|
504
|
+
if (!['input', 'output', 'fault'].includes(supplied.kind))
|
|
505
|
+
throw new Stop('unsupported', 'unknown-direction');
|
|
506
|
+
const ownedDirection = supplied.kind === 'fault' ? { kind: 'fault', name: supplied.name } : { kind: supplied.kind };
|
|
507
|
+
let root;
|
|
508
|
+
if (ownedDirection.kind === 'fault') {
|
|
509
|
+
budget.chargeWork(64 + contract.faults.length * 32);
|
|
510
|
+
if (typeof ownedDirection.name !== 'string')
|
|
511
|
+
throw new Stop('unsupported', 'unknown-fault');
|
|
512
|
+
const selected = contract.faults.find(fault => budget.compareText(fault.name, ownedDirection.name) === 0);
|
|
513
|
+
if (!selected)
|
|
514
|
+
throw new Stop('unsupported', 'unknown-fault');
|
|
515
|
+
root = selected.root;
|
|
516
|
+
}
|
|
517
|
+
else
|
|
518
|
+
root = contract[ownedDirection.kind];
|
|
519
|
+
const matched = matchDirectProjection(context, root.element, payload, { ...options, flatOnly: true });
|
|
520
|
+
if (matched.kind !== 'projection-match')
|
|
521
|
+
return matched;
|
|
522
|
+
inspectProjectionStructuralMatch(matched, context);
|
|
523
|
+
budget.chargeWork(512);
|
|
524
|
+
const result = { kind: 'structural-match', scope: matched.scope, scalarValidity: matched.scalarValidity, admitted: false,
|
|
525
|
+
root, contextId: context.contextId, direction: ownedDirection, occurrences: matched.occurrences, tree: matched.tree, usage: { ...budget.usage() } };
|
|
526
|
+
budget.freeze(result);
|
|
527
|
+
budget.chargeWork();
|
|
528
|
+
if (options.signal?.aborted)
|
|
529
|
+
throw new Stop('cancelled', 'cooperative-cancellation');
|
|
530
|
+
const published = Object.freeze({ ...result, usage: Object.freeze({ ...budget.usage() }) });
|
|
531
|
+
issued.set(published, contract);
|
|
532
|
+
return published;
|
|
533
|
+
});
|
|
534
|
+
return guarded.kind === 'resource-limit' ? Object.freeze({ kind: 'resource-limit', rule: 'request-budget', usage: budget.usage() }) : guarded;
|
|
535
|
+
}
|
|
536
|
+
catch (error) {
|
|
537
|
+
if (budget.exhausted())
|
|
538
|
+
return Object.freeze({ kind: 'resource-limit', rule: 'request-budget', usage: budget.usage() });
|
|
539
|
+
if (error instanceof Stop)
|
|
540
|
+
return Object.freeze({ kind: error.kind, rule: error.rule, schemaPath: error.schemaPath, payloadPath: error.payloadPath, usage: Object.freeze({ ...budget.usage() }) });
|
|
541
|
+
throw error;
|
|
542
|
+
}
|
|
543
|
+
}
|