@techspokes/typescript-wsdl-client 1.1.5 → 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.
Files changed (480) hide show
  1. package/README.md +64 -66
  2. package/dist/app/generateApp.d.ts +0 -1
  3. package/dist/app/generateApp.js +1 -1
  4. package/dist/app/generateCheckedApp.d.ts +38 -0
  5. package/dist/app/generateCheckedApp.js +108 -0
  6. package/dist/checkedPipeline.d.ts +155 -0
  7. package/dist/checkedPipeline.js +448 -0
  8. package/dist/checkedPlanning.d.ts +123 -0
  9. package/dist/checkedPlanning.js +245 -0
  10. package/dist/cli.d.ts +0 -1
  11. package/dist/cli.js +75 -1
  12. package/dist/client/checkedDirectRuntime.d.ts +40 -3
  13. package/dist/client/checkedDirectRuntime.js +28 -8
  14. package/dist/client/directClientRuntime.d.ts +27 -2
  15. package/dist/client/directClientRuntime.js +142 -89
  16. package/dist/client/directClientVersion.d.ts +3 -1
  17. package/dist/client/directClientVersion.js +3 -0
  18. package/dist/client/generateClient.d.ts +0 -1
  19. package/dist/client/generateClient.js +26 -12
  20. package/dist/client/generateDirectClient.d.ts +21 -3
  21. package/dist/client/generateDirectClient.js +138 -6
  22. package/dist/client/generateOperations.d.ts +0 -1
  23. package/dist/client/generateTypes.d.ts +0 -1
  24. package/dist/client/generateUtils.d.ts +0 -1
  25. package/dist/client/generateUtils.js +3 -1
  26. package/dist/compiler/applicationGroups.d.ts +53 -0
  27. package/dist/compiler/applicationGroups.js +403 -0
  28. package/dist/compiler/buildCanonicalGraph.d.ts +0 -1
  29. package/dist/compiler/canonicalGraph.d.ts +0 -1
  30. package/dist/compiler/catalogErrors.d.ts +0 -1
  31. package/dist/compiler/catalogProvenance.d.ts +0 -1
  32. package/dist/compiler/checkedAssessment.d.ts +0 -1
  33. package/dist/compiler/checkedAssessment.js +1 -1
  34. package/dist/compiler/checkedComponentSource.d.ts +16 -0
  35. package/dist/compiler/checkedComponentSource.js +31 -0
  36. package/dist/compiler/checkedSourcePreparation.d.ts +38 -1
  37. package/dist/compiler/checkedSourcePreparation.js +71 -0
  38. package/dist/compiler/complexTypeContent.d.ts +5 -6
  39. package/dist/compiler/complexTypeContent.js +2 -2
  40. package/dist/compiler/componentCorrespondence.d.ts +32 -0
  41. package/dist/compiler/componentCorrespondence.js +140 -0
  42. package/dist/compiler/componentRecordProjection.d.ts +109 -0
  43. package/dist/compiler/componentRecordProjection.js +319 -0
  44. package/dist/compiler/componentSoapPreparation.d.ts +20 -0
  45. package/dist/compiler/componentSoapPreparation.js +36 -0
  46. package/dist/compiler/composeCanonicalGraph.d.ts +0 -1
  47. package/dist/compiler/dataOwnership.d.ts +0 -1
  48. package/dist/compiler/dataOwnership.js +14 -4
  49. package/dist/compiler/datatypeValues.d.ts +0 -1
  50. package/dist/compiler/directCodec.d.ts +59 -2
  51. package/dist/compiler/directCodec.js +275 -90
  52. package/dist/compiler/directExecutionPolicy.d.ts +0 -1
  53. package/dist/compiler/directOperation.d.ts +46 -4
  54. package/dist/compiler/directOperation.js +105 -14
  55. package/dist/compiler/directSoap.d.ts +29 -5
  56. package/dist/compiler/directSoap.js +130 -37
  57. package/dist/compiler/directSoapSource.d.ts +24 -1
  58. package/dist/compiler/directSoapSource.js +166 -19
  59. package/dist/compiler/directSourceCapsule.d.ts +74 -2
  60. package/dist/compiler/directSourceCapsule.js +428 -6
  61. package/dist/compiler/directStructure.d.ts +83 -6
  62. package/dist/compiler/directStructure.js +349 -58
  63. package/dist/compiler/directStructurePlan.d.ts +135 -2
  64. package/dist/compiler/directStructurePlan.js +594 -29
  65. package/dist/compiler/directValues.d.ts +63 -4
  66. package/dist/compiler/directValues.js +950 -116
  67. package/dist/compiler/finiteRe01Construction.d.ts +69 -0
  68. package/dist/compiler/finiteRe01Construction.js +422 -0
  69. package/dist/compiler/finiteRe01Verification.d.ts +81 -3
  70. package/dist/compiler/finiteRe01Verification.js +391 -4
  71. package/dist/compiler/generateCatalog.d.ts +0 -1
  72. package/dist/compiler/graphTraversal.d.ts +0 -1
  73. package/dist/compiler/hypotheticalScopedIdentity.d.ts +0 -1
  74. package/dist/compiler/occurrenceAnalysis.d.ts +2 -1
  75. package/dist/compiler/occurrenceAnalysis.js +23 -7
  76. package/dist/compiler/originalSourceMembership.d.ts +0 -1
  77. package/dist/compiler/particleAttribution.d.ts +0 -1
  78. package/dist/compiler/particleAttribution.js +20 -0
  79. package/dist/compiler/particleDeclarationConsistency.d.ts +0 -1
  80. package/dist/compiler/particleDeclarationConsistency.js +9 -0
  81. package/dist/compiler/particleExtension.d.ts +0 -1
  82. package/dist/compiler/particleExtension.js +5 -1
  83. package/dist/compiler/particleLocalAssessment.d.ts +0 -1
  84. package/dist/compiler/particleRestriction.d.ts +0 -1
  85. package/dist/compiler/particleRestriction.js +6 -1
  86. package/dist/compiler/particleSemanticView.d.ts +2 -1
  87. package/dist/compiler/particleSemanticView.js +16 -3
  88. package/dist/compiler/particleWildcardRelation.d.ts +0 -1
  89. package/dist/compiler/projectionScalar.d.ts +32 -0
  90. package/dist/compiler/projectionScalar.js +184 -0
  91. package/dist/compiler/re01CandidateAssignments.d.ts +95 -0
  92. package/dist/compiler/re01CandidateAssignments.js +341 -0
  93. package/dist/compiler/re01CandidateCorrespondence.d.ts +22 -1
  94. package/dist/compiler/re01CandidateCorrespondence.js +167 -38
  95. package/dist/compiler/re01TypeProperties.d.ts +0 -1
  96. package/dist/compiler/re01TypePropertyValidation.d.ts +0 -1
  97. package/dist/compiler/resolveCanonicalGraph.d.ts +5 -2
  98. package/dist/compiler/resolveCanonicalGraph.js +77 -7
  99. package/dist/compiler/scalarSchemaAssessment.d.ts +0 -1
  100. package/dist/compiler/schemaAttributeGroupProperties.d.ts +0 -1
  101. package/dist/compiler/schemaAttributeProperties.d.ts +0 -1
  102. package/dist/compiler/schemaAttributeUses.d.ts +22 -2
  103. package/dist/compiler/schemaAttributeUses.js +86 -13
  104. package/dist/compiler/schemaBinaryWordReconstruction.d.ts +0 -1
  105. package/dist/compiler/schemaBuiltinFacets.d.ts +0 -1
  106. package/dist/compiler/schemaCalendarImages.d.ts +0 -1
  107. package/dist/compiler/schemaCalendarLanguage.d.ts +0 -1
  108. package/dist/compiler/schemaCompiler.d.ts +0 -1
  109. package/dist/compiler/schemaComponentEquality.d.ts +0 -1
  110. package/dist/compiler/schemaConstructionAssessment.d.ts +34 -1
  111. package/dist/compiler/schemaConstructionAssessment.js +88 -6
  112. package/dist/compiler/schemaDatatypeValues.d.ts +0 -1
  113. package/dist/compiler/schemaDecimalLanguage.d.ts +0 -1
  114. package/dist/compiler/schemaDeclarationPrimitives.d.ts +7 -2
  115. package/dist/compiler/schemaDeclarationPrimitives.js +18 -1
  116. package/dist/compiler/schemaDocumentSyntax.d.ts +0 -1
  117. package/dist/compiler/schemaDurationLanguage.d.ts +0 -1
  118. package/dist/compiler/schemaElementInstance.d.ts +30 -0
  119. package/dist/compiler/schemaElementInstance.js +45 -0
  120. package/dist/compiler/schemaElementProperties.d.ts +0 -1
  121. package/dist/compiler/schemaEndpointWordCapacity.d.ts +0 -1
  122. package/dist/compiler/schemaExactCalendar.d.ts +0 -1
  123. package/dist/compiler/schemaFacetAnnotation.d.ts +0 -1
  124. package/dist/compiler/schemaGeneratedScalarShape.d.ts +0 -1
  125. package/dist/compiler/schemaGeneratedScalarShape.js +2 -0
  126. package/dist/compiler/schemaIdentityConstraints.d.ts +0 -1
  127. package/dist/compiler/schemaIeeeLanguage.d.ts +0 -1
  128. package/dist/compiler/schemaIntegerImages.d.ts +0 -1
  129. package/dist/compiler/schemaLexicalPredicates.d.ts +0 -1
  130. package/dist/compiler/schemaNotationProperties.d.ts +0 -1
  131. package/dist/compiler/schemaNumericImageConditions.d.ts +0 -1
  132. package/dist/compiler/schemaParticleWildcardProperties.d.ts +0 -1
  133. package/dist/compiler/schemaPattern.d.ts +0 -1
  134. package/dist/compiler/schemaRegularLanguage.d.ts +0 -1
  135. package/dist/compiler/schemaScalarContext.d.ts +5 -1
  136. package/dist/compiler/schemaScalarKernel.d.ts +0 -1
  137. package/dist/compiler/schemaScalarWitnesses.d.ts +0 -1
  138. package/dist/compiler/schemaSimpleTypeProperties.d.ts +0 -1
  139. package/dist/compiler/schemaSourceGrammar.d.ts +0 -1
  140. package/dist/compiler/schemaSourceLexical.d.ts +0 -1
  141. package/dist/compiler/schemaSourceValues.d.ts +0 -1
  142. package/dist/compiler/schemaSourceWildcards.d.ts +1 -2
  143. package/dist/compiler/schemaSourceWildcards.js +3 -1
  144. package/dist/compiler/schemaSymbolicSequences.d.ts +0 -1
  145. package/dist/compiler/schemaSymbolicValueSets.d.ts +0 -1
  146. package/dist/compiler/schemaSyntaxAssessment.d.ts +0 -1
  147. package/dist/compiler/schemaTemporalAliases.d.ts +0 -1
  148. package/dist/compiler/schemaTokenImages.d.ts +0 -1
  149. package/dist/compiler/schemaTypeIdentity.d.ts +0 -1
  150. package/dist/compiler/schemaTypeIdentity.js +2 -0
  151. package/dist/compiler/schemaTypeRelations.d.ts +0 -1
  152. package/dist/compiler/schemaUri.d.ts +0 -1
  153. package/dist/compiler/schemaValueContext.d.ts +0 -1
  154. package/dist/compiler/schemaValueImages.d.ts +0 -1
  155. package/dist/compiler/schemaValueSequences.d.ts +0 -1
  156. package/dist/compiler/semanticBudget.d.ts +18 -1
  157. package/dist/compiler/semanticBudget.js +17 -2
  158. package/dist/compiler/semanticCatalog.d.ts +1 -2
  159. package/dist/compiler/semanticContext.d.ts +12 -1
  160. package/dist/compiler/semanticContext.js +39 -0
  161. package/dist/compiler/semanticTypeDependencies.d.ts +0 -1
  162. package/dist/compiler/semanticTypeReference.d.ts +0 -1
  163. package/dist/compiler/shapeResolver.d.ts +0 -1
  164. package/dist/compiler/soapHeaders.d.ts +16 -0
  165. package/dist/compiler/soapHeaders.js +42 -0
  166. package/dist/compiler/sourceSchemaBinding.d.ts +0 -1
  167. package/dist/compiler/standardSchemaComponents.d.ts +71 -0
  168. package/dist/compiler/standardSchemaComponents.js +74 -0
  169. package/dist/compiler/standardSchemaConstruction.d.ts +20 -0
  170. package/dist/compiler/standardSchemaConstruction.js +34 -0
  171. package/dist/compiler/structuralCompanions.d.ts +0 -1
  172. package/dist/compiler/validateSemanticGraph.d.ts +0 -1
  173. package/dist/compiler/wildcardAlgebra.d.ts +0 -1
  174. package/dist/compiler/wsdlPolicyRequirements.d.ts +43 -0
  175. package/dist/compiler/wsdlPolicyRequirements.js +239 -0
  176. package/dist/config.d.ts +0 -1
  177. package/dist/gateway/generateCheckedGateway.d.ts +32 -0
  178. package/dist/gateway/generateCheckedGateway.js +293 -0
  179. package/dist/gateway/generateGateway.d.ts +0 -1
  180. package/dist/gateway/generators.d.ts +0 -1
  181. package/dist/gateway/helpers.d.ts +0 -1
  182. package/dist/generation/componentShape.d.ts +14 -0
  183. package/dist/generation/componentShape.js +269 -0
  184. package/dist/generation/preamble.d.ts +0 -1
  185. package/dist/generation/sourceLayout.d.ts +13 -0
  186. package/dist/generation/sourceLayout.js +40 -0
  187. package/dist/generation/writeGeneratedSource.d.ts +0 -1
  188. package/dist/index.d.ts +7 -2
  189. package/dist/index.js +2 -1
  190. package/dist/loader/fetch.d.ts +0 -1
  191. package/dist/loader/orderedSyntax.d.ts +8 -1
  192. package/dist/loader/orderedSyntax.js +26 -6
  193. package/dist/loader/resolutionDepth.d.ts +0 -1
  194. package/dist/loader/schemaInput.d.ts +28 -1
  195. package/dist/loader/schemaInput.js +41 -4
  196. package/dist/loader/schemaResources.d.ts +2 -1
  197. package/dist/loader/schemaResources.js +45 -4
  198. package/dist/loader/wsdlLoader.d.ts +0 -1
  199. package/dist/openapi/casing.d.ts +0 -1
  200. package/dist/openapi/generateOpenAPI.d.ts +0 -1
  201. package/dist/openapi/generatePaths.d.ts +0 -1
  202. package/dist/openapi/generateSchemas.d.ts +0 -1
  203. package/dist/openapi/security.d.ts +0 -1
  204. package/dist/pipeline.d.ts +6 -2
  205. package/dist/pipeline.js +13 -0
  206. package/dist/test/generateCheckedTests.d.ts +17 -0
  207. package/dist/test/generateCheckedTests.js +60 -0
  208. package/dist/test/generateTests.d.ts +0 -1
  209. package/dist/test/generators.d.ts +0 -1
  210. package/dist/test/mockData.d.ts +0 -1
  211. package/dist/test/mockData.js +20 -14
  212. package/dist/util/attributeWildcards.d.ts +0 -1
  213. package/dist/util/builder.d.ts +0 -1
  214. package/dist/util/catalogMeta.d.ts +0 -1
  215. package/dist/util/checkedCliDiagnostics.d.ts +11 -0
  216. package/dist/util/checkedCliDiagnostics.js +22 -0
  217. package/dist/util/cli.d.ts +0 -1
  218. package/dist/util/errors.d.ts +0 -1
  219. package/dist/util/imports.d.ts +0 -1
  220. package/dist/util/runtimeSource.d.ts +0 -1
  221. package/dist/util/runtimeSource.js +3 -5
  222. package/dist/util/securityConfig.d.ts +0 -1
  223. package/dist/util/streamConfig.d.ts +0 -1
  224. package/dist/util/tools.d.ts +0 -1
  225. package/dist/util/xmlWhitespace.d.ts +0 -1
  226. package/dist/xsd/primitives.d.ts +0 -1
  227. package/docs/agent-skill.md +2 -0
  228. package/docs/api-reference.md +1 -1
  229. package/docs/checked-gateway.md +210 -0
  230. package/docs/checked-generation.md +161 -0
  231. package/docs/cli-reference.md +23 -1
  232. package/docs/concepts.md +136 -1
  233. package/docs/configuration.md +5 -1
  234. package/docs/corpus.md +33 -0
  235. package/docs/direct-values.md +13 -13
  236. package/docs/examples/checked-forecast.wsdl +19 -0
  237. package/docs/gateway-guide.md +1 -1
  238. package/docs/generated-code.md +10 -5
  239. package/docs/mapping-contract.md +114 -0
  240. package/docs/migration-playbook.md +1 -1
  241. package/docs/output-anatomy.md +1 -1
  242. package/docs/start-here.md +8 -2
  243. package/docs/supported-patterns.md +7 -3
  244. package/docs/testing.md +117 -31
  245. package/llms.txt +7 -7
  246. package/package.json +63 -22
  247. package/src/runtime/checkedGatewayHost.tpl.txt +157 -0
  248. package/src/runtime/streamXml.ts +1 -1
  249. package/dist/app/generateApp.d.ts.map +0 -1
  250. package/dist/cli.d.ts.map +0 -1
  251. package/dist/client/checkedDirectRuntime.d.ts.map +0 -1
  252. package/dist/client/directClientRuntime.d.ts.map +0 -1
  253. package/dist/client/directClientVersion.d.ts.map +0 -1
  254. package/dist/client/generateClient.d.ts.map +0 -1
  255. package/dist/client/generateDirectClient.d.ts.map +0 -1
  256. package/dist/client/generateOperations.d.ts.map +0 -1
  257. package/dist/client/generateTypes.d.ts.map +0 -1
  258. package/dist/client/generateUtils.d.ts.map +0 -1
  259. package/dist/compiler/buildCanonicalGraph.d.ts.map +0 -1
  260. package/dist/compiler/canonicalGraph.d.ts.map +0 -1
  261. package/dist/compiler/catalogErrors.d.ts.map +0 -1
  262. package/dist/compiler/catalogProvenance.d.ts.map +0 -1
  263. package/dist/compiler/checkedAssessment.d.ts.map +0 -1
  264. package/dist/compiler/checkedSourcePreparation.d.ts.map +0 -1
  265. package/dist/compiler/complexTypeContent.d.ts.map +0 -1
  266. package/dist/compiler/composeCanonicalGraph.d.ts.map +0 -1
  267. package/dist/compiler/dataOwnership.d.ts.map +0 -1
  268. package/dist/compiler/datatypeValues.d.ts.map +0 -1
  269. package/dist/compiler/directCodec.d.ts.map +0 -1
  270. package/dist/compiler/directExecutionPolicy.d.ts.map +0 -1
  271. package/dist/compiler/directOperation.d.ts.map +0 -1
  272. package/dist/compiler/directSoap.d.ts.map +0 -1
  273. package/dist/compiler/directSoapSource.d.ts.map +0 -1
  274. package/dist/compiler/directSourceCapsule.d.ts.map +0 -1
  275. package/dist/compiler/directStructure.d.ts.map +0 -1
  276. package/dist/compiler/directStructurePlan.d.ts.map +0 -1
  277. package/dist/compiler/directValues.d.ts.map +0 -1
  278. package/dist/compiler/finiteRe01Verification.d.ts.map +0 -1
  279. package/dist/compiler/generateCatalog.d.ts.map +0 -1
  280. package/dist/compiler/graphTraversal.d.ts.map +0 -1
  281. package/dist/compiler/hypotheticalScopedIdentity.d.ts.map +0 -1
  282. package/dist/compiler/occurrenceAnalysis.d.ts.map +0 -1
  283. package/dist/compiler/originalSourceMembership.d.ts.map +0 -1
  284. package/dist/compiler/particleAttribution.d.ts.map +0 -1
  285. package/dist/compiler/particleDeclarationConsistency.d.ts.map +0 -1
  286. package/dist/compiler/particleExtension.d.ts.map +0 -1
  287. package/dist/compiler/particleLocalAssessment.d.ts.map +0 -1
  288. package/dist/compiler/particleRestriction.d.ts.map +0 -1
  289. package/dist/compiler/particleSemanticView.d.ts.map +0 -1
  290. package/dist/compiler/particleWildcardRelation.d.ts.map +0 -1
  291. package/dist/compiler/re01CandidateCorrespondence.d.ts.map +0 -1
  292. package/dist/compiler/re01TypeProperties.d.ts.map +0 -1
  293. package/dist/compiler/re01TypePropertyValidation.d.ts.map +0 -1
  294. package/dist/compiler/resolveCanonicalGraph.d.ts.map +0 -1
  295. package/dist/compiler/scalarSchemaAssessment.d.ts.map +0 -1
  296. package/dist/compiler/schemaAttributeGroupProperties.d.ts.map +0 -1
  297. package/dist/compiler/schemaAttributeProperties.d.ts.map +0 -1
  298. package/dist/compiler/schemaAttributeUses.d.ts.map +0 -1
  299. package/dist/compiler/schemaBinaryWordReconstruction.d.ts.map +0 -1
  300. package/dist/compiler/schemaBuiltinFacets.d.ts.map +0 -1
  301. package/dist/compiler/schemaCalendarImages.d.ts.map +0 -1
  302. package/dist/compiler/schemaCalendarLanguage.d.ts.map +0 -1
  303. package/dist/compiler/schemaCompiler.d.ts.map +0 -1
  304. package/dist/compiler/schemaComponentEquality.d.ts.map +0 -1
  305. package/dist/compiler/schemaConstructionAssessment.d.ts.map +0 -1
  306. package/dist/compiler/schemaDatatypeValues.d.ts.map +0 -1
  307. package/dist/compiler/schemaDecimalLanguage.d.ts.map +0 -1
  308. package/dist/compiler/schemaDeclarationPrimitives.d.ts.map +0 -1
  309. package/dist/compiler/schemaDocumentSyntax.d.ts.map +0 -1
  310. package/dist/compiler/schemaDurationLanguage.d.ts.map +0 -1
  311. package/dist/compiler/schemaElementProperties.d.ts.map +0 -1
  312. package/dist/compiler/schemaEndpointWordCapacity.d.ts.map +0 -1
  313. package/dist/compiler/schemaExactCalendar.d.ts.map +0 -1
  314. package/dist/compiler/schemaFacetAnnotation.d.ts.map +0 -1
  315. package/dist/compiler/schemaGeneratedScalarShape.d.ts.map +0 -1
  316. package/dist/compiler/schemaIdentityConstraints.d.ts.map +0 -1
  317. package/dist/compiler/schemaIeeeLanguage.d.ts.map +0 -1
  318. package/dist/compiler/schemaIntegerImages.d.ts.map +0 -1
  319. package/dist/compiler/schemaLexicalPredicates.d.ts.map +0 -1
  320. package/dist/compiler/schemaNotationProperties.d.ts.map +0 -1
  321. package/dist/compiler/schemaNumericImageConditions.d.ts.map +0 -1
  322. package/dist/compiler/schemaParticleWildcardProperties.d.ts.map +0 -1
  323. package/dist/compiler/schemaPattern.d.ts.map +0 -1
  324. package/dist/compiler/schemaRegularLanguage.d.ts.map +0 -1
  325. package/dist/compiler/schemaScalarContext.d.ts.map +0 -1
  326. package/dist/compiler/schemaScalarKernel.d.ts.map +0 -1
  327. package/dist/compiler/schemaScalarWitnesses.d.ts.map +0 -1
  328. package/dist/compiler/schemaSimpleTypeProperties.d.ts.map +0 -1
  329. package/dist/compiler/schemaSourceGrammar.d.ts.map +0 -1
  330. package/dist/compiler/schemaSourceLexical.d.ts.map +0 -1
  331. package/dist/compiler/schemaSourceValues.d.ts.map +0 -1
  332. package/dist/compiler/schemaSourceWildcards.d.ts.map +0 -1
  333. package/dist/compiler/schemaSymbolicSequences.d.ts.map +0 -1
  334. package/dist/compiler/schemaSymbolicValueSets.d.ts.map +0 -1
  335. package/dist/compiler/schemaSyntaxAssessment.d.ts.map +0 -1
  336. package/dist/compiler/schemaTemporalAliases.d.ts.map +0 -1
  337. package/dist/compiler/schemaTokenImages.d.ts.map +0 -1
  338. package/dist/compiler/schemaTypeIdentity.d.ts.map +0 -1
  339. package/dist/compiler/schemaTypeRelations.d.ts.map +0 -1
  340. package/dist/compiler/schemaUri.d.ts.map +0 -1
  341. package/dist/compiler/schemaValueContext.d.ts.map +0 -1
  342. package/dist/compiler/schemaValueImages.d.ts.map +0 -1
  343. package/dist/compiler/schemaValueSequences.d.ts.map +0 -1
  344. package/dist/compiler/semanticBudget.d.ts.map +0 -1
  345. package/dist/compiler/semanticCatalog.d.ts.map +0 -1
  346. package/dist/compiler/semanticContext.d.ts.map +0 -1
  347. package/dist/compiler/semanticTypeDependencies.d.ts.map +0 -1
  348. package/dist/compiler/semanticTypeReference.d.ts.map +0 -1
  349. package/dist/compiler/shapeResolver.d.ts.map +0 -1
  350. package/dist/compiler/sourceSchemaBinding.d.ts.map +0 -1
  351. package/dist/compiler/structuralCompanions.d.ts.map +0 -1
  352. package/dist/compiler/validateSemanticGraph.d.ts.map +0 -1
  353. package/dist/compiler/wildcardAlgebra.d.ts.map +0 -1
  354. package/dist/config.d.ts.map +0 -1
  355. package/dist/gateway/generateGateway.d.ts.map +0 -1
  356. package/dist/gateway/generators.d.ts.map +0 -1
  357. package/dist/gateway/helpers.d.ts.map +0 -1
  358. package/dist/generation/preamble.d.ts.map +0 -1
  359. package/dist/generation/writeGeneratedSource.d.ts.map +0 -1
  360. package/dist/index.d.ts.map +0 -1
  361. package/dist/loader/fetch.d.ts.map +0 -1
  362. package/dist/loader/orderedSyntax.d.ts.map +0 -1
  363. package/dist/loader/resolutionDepth.d.ts.map +0 -1
  364. package/dist/loader/schemaInput.d.ts.map +0 -1
  365. package/dist/loader/schemaResources.d.ts.map +0 -1
  366. package/dist/loader/wsdlLoader.d.ts.map +0 -1
  367. package/dist/openapi/casing.d.ts.map +0 -1
  368. package/dist/openapi/generateOpenAPI.d.ts.map +0 -1
  369. package/dist/openapi/generatePaths.d.ts.map +0 -1
  370. package/dist/openapi/generateSchemas.d.ts.map +0 -1
  371. package/dist/openapi/security.d.ts.map +0 -1
  372. package/dist/pipeline.d.ts.map +0 -1
  373. package/dist/runtime/jsonArray.d.ts +0 -24
  374. package/dist/runtime/jsonArray.d.ts.map +0 -1
  375. package/dist/runtime/jsonArray.js +0 -52
  376. package/dist/runtime/ndjson.d.ts +0 -24
  377. package/dist/runtime/ndjson.d.ts.map +0 -1
  378. package/dist/runtime/ndjson.js +0 -30
  379. package/dist/runtime/streamXml.d.ts +0 -45
  380. package/dist/runtime/streamXml.d.ts.map +0 -1
  381. package/dist/runtime/streamXml.js +0 -212
  382. package/dist/test/generateTests.d.ts.map +0 -1
  383. package/dist/test/generators.d.ts.map +0 -1
  384. package/dist/test/mockData.d.ts.map +0 -1
  385. package/dist/util/attributeWildcards.d.ts.map +0 -1
  386. package/dist/util/builder.d.ts.map +0 -1
  387. package/dist/util/catalogMeta.d.ts.map +0 -1
  388. package/dist/util/cli.d.ts.map +0 -1
  389. package/dist/util/errors.d.ts.map +0 -1
  390. package/dist/util/imports.d.ts.map +0 -1
  391. package/dist/util/runtimeSource.d.ts.map +0 -1
  392. package/dist/util/securityConfig.d.ts.map +0 -1
  393. package/dist/util/streamConfig.d.ts.map +0 -1
  394. package/dist/util/tools.d.ts.map +0 -1
  395. package/dist/util/xmlWhitespace.d.ts.map +0 -1
  396. package/dist/xsd/primitives.d.ts.map +0 -1
  397. package/docs/AGENTS.md +0 -47
  398. package/docs/README.md +0 -69
  399. package/docs/architecture.md +0 -158
  400. package/docs/content-model-analysis.md +0 -92
  401. package/docs/content-model-baseline.md +0 -121
  402. package/docs/content-model-catalog.md +0 -116
  403. package/docs/content-model-companions.md +0 -90
  404. package/docs/content-model-composition.md +0 -103
  405. package/docs/content-model-decisions.md +0 -79
  406. package/docs/content-model-gateway-feasibility.md +0 -169
  407. package/docs/content-model-graph.md +0 -121
  408. package/docs/content-model-loading.md +0 -163
  409. package/docs/content-model-matching.md +0 -85
  410. package/docs/content-model-readiness.md +0 -144
  411. package/docs/content-model-resolution.md +0 -81
  412. package/docs/content-model-s02-handoff.md +0 -98
  413. package/docs/content-model-s06-au-01.md +0 -425
  414. package/docs/content-model-s06-dt-01.md +0 -386
  415. package/docs/content-model-s06-pw-01.md +0 -350
  416. package/docs/content-model-s06-re-01-resolver-implementation.md +0 -869
  417. package/docs/content-model-s06-re-01-resolver.md +0 -513
  418. package/docs/content-model-s06-re-01-scalar-witnesses.md +0 -1423
  419. package/docs/content-model-s06-re-01-support-reconstruction.md +0 -6337
  420. package/docs/content-model-s06-re-01.md +0 -7477
  421. package/docs/content-model-s06-research-handoff.md +0 -909
  422. package/docs/content-model-shipped-fix.md +0 -83
  423. package/docs/content-model-soap-feasibility.md +0 -165
  424. package/docs/decisions/001-test-generation.md +0 -36
  425. package/docs/decisions/002-streamable-responses.md +0 -332
  426. package/docs/decisions/003-content-model-contracts.md +0 -280
  427. package/docs/file-naming-and-path-organization.md +0 -213
  428. package/docs/reference-validation.md +0 -243
  429. package/docs/releases/README.md +0 -94
  430. package/docs/releases/v0.20.0.md +0 -22
  431. package/docs/releases/v0.21.0.md +0 -30
  432. package/docs/releases/v0.22.0.md +0 -30
  433. package/docs/releases/v0.23.0.md +0 -31
  434. package/docs/releases/v0.24.0.md +0 -38
  435. package/docs/releases/v0.25.0.md +0 -31
  436. package/docs/releases/v0.25.2.md +0 -32
  437. package/docs/releases/v0.26.0.md +0 -32
  438. package/docs/releases/v0.27.0.md +0 -31
  439. package/docs/releases/v0.28.0.md +0 -32
  440. package/docs/releases/v0.29.0.md +0 -32
  441. package/docs/releases/v0.30.0.md +0 -30
  442. package/docs/releases/v0.30.1.md +0 -31
  443. package/docs/releases/v0.30.2.md +0 -30
  444. package/docs/releases/v0.30.3.md +0 -33
  445. package/docs/releases/v0.31.0.md +0 -33
  446. package/docs/releases/v0.32.0.md +0 -33
  447. package/docs/releases/v0.33.0.md +0 -34
  448. package/docs/releases/v0.34.0.md +0 -30
  449. package/docs/releases/v0.35.0.md +0 -33
  450. package/docs/releases/v0.36.0.md +0 -32
  451. package/docs/releases/v0.37.0.md +0 -33
  452. package/docs/releases/v0.38.0.md +0 -35
  453. package/docs/releases/v0.39.0.md +0 -35
  454. package/docs/releases/v0.40.0.md +0 -45
  455. package/docs/releases/v0.40.1.md +0 -34
  456. package/docs/releases/v1.0.0.md +0 -42
  457. package/docs/releases/v1.0.1.md +0 -38
  458. package/docs/releases/v1.0.2.md +0 -51
  459. package/docs/releases/v1.0.3.md +0 -37
  460. package/docs/releases/v1.0.4.md +0 -45
  461. package/docs/releases/v1.0.5.md +0 -41
  462. package/docs/releases/v1.0.6.md +0 -35
  463. package/docs/releases/v1.0.7.md +0 -36
  464. package/docs/releases/v1.1.0.md +0 -42
  465. package/docs/releases/v1.1.1.md +0 -44
  466. package/docs/releases/v1.1.2.md +0 -42
  467. package/docs/releases/v1.1.3.md +0 -36
  468. package/docs/releases/v1.1.4.md +0 -36
  469. package/docs/releases/v1.1.5.md +0 -38
  470. package/docs/roadmap/README.md +0 -107
  471. package/docs/roadmap/v1.0-capability-conformance-framework.md +0 -582
  472. package/docs/roadmap/v1.0-choice-union-mode.md +0 -90
  473. package/docs/roadmap/v1.0-contract-audit.md +0 -75
  474. package/docs/roadmap/v1.0-json-array-streaming.md +0 -101
  475. package/docs/roadmap/v1.0-openapi-fastify-compatibility.md +0 -99
  476. package/docs/roadmap/v1.0-release-candidate-gates.md +0 -92
  477. package/docs/roadmap/v1.0-wsdl-coverage-matrix.md +0 -200
  478. package/docs/roadmap/v1.0-xs-anyattribute-wildcard-bag.md +0 -932
  479. package/src/runtime/jsonArray.ts +0 -55
  480. package/src/runtime/ndjson.ts +0 -32
@@ -1,18 +1,43 @@
1
1
  import { directDataOwnership, directLimit } from './directExecutionPolicy.js';
2
+ import { types } from 'node:util';
2
3
  /** Internal direct value chain. No XML encoding, transport or runtime admission. */
3
4
  import { checkSemanticBudget } from './semanticBudget.js';
4
5
  import { DataOwnershipLimitError } from './dataOwnership.js';
5
6
  import { inspectDirectOperation } from './directOperation.js';
6
7
  import { inspectDirectStructuralMatch, matchDirectOperation } from './directStructure.js';
7
- import { planDirectRoot } from './directStructurePlan.js';
8
+ import { planDirectProjection, flatDirectProjection, projectionScalarRepresentation, resolveProjectionWildcard, selectProjectionWildcard, selectProjectionAttribute, isXmlCharacters, isXmlNamespaceBinding } from './directStructurePlan.js';
9
+ import { assertSemanticContext } from './semanticContext.js';
10
+ import { inspectProjectionStructuralMatch, matchDirectProjection } from './directStructure.js';
8
11
  import { datatypeValues, normalizeWhitespace, whitespaceFor } from './datatypeValues.js';
12
+ import { assessProjectionScalarOperand } from './projectionScalar.js';
13
+ import { isXmlNCName, XML_NAMESPACE, XSD_NAMESPACE } from '../loader/orderedSyntax.js';
14
+ import { planApplicationGroups, mapApplicationGroups, parseApplicationGroups, ApplicationGroupValueError } from './applicationGroups.js';
9
15
  /** Inverse construction caps; XML encoding may impose smaller byte/text/node limits. */
10
16
  export const DIRECT_VALUE_LIMITS = Object.freeze({ maxText: 1024 * 1024, maxItems: 100_000 });
11
17
  export const DIRECT_VALUE_VERSION = 'direct-values-v1';
12
18
  export const DIRECT_SCALAR_POLICY = 'direct-string-boolean-int-v1';
13
19
  const mappings = new WeakMap();
20
+ // @why Keep the exact native-derived plan with its issued mapping without widening portable preview data.
21
+ const mappingProjections = new WeakMap();
22
+ const componentMappings = new WeakMap();
14
23
  const values = new WeakMap();
15
24
  const expansions = new WeakMap();
25
+ const projectionValues = new WeakMap();
26
+ const projectionExpansions = new WeakMap();
27
+ /** Inspect only the exact context-issued expansion; no operation or portable authority is conferred. */
28
+ export function inspectProjectionExpandedValue(value, context) {
29
+ assertSemanticContext(context);
30
+ if (!value || typeof value !== 'object' || projectionExpansions.get(value) !== context)
31
+ throw new TypeError('Unauthenticated or foreign projection expansion');
32
+ return value;
33
+ }
34
+ /** Context-owned value evidence does not authenticate an operation, portable bundle or runtime admission. */
35
+ export function inspectProjectionValue(value, context) {
36
+ assertSemanticContext(context);
37
+ if (!value || typeof value !== 'object' || projectionValues.get(value) !== context)
38
+ throw new TypeError('Unauthenticated or foreign projection value');
39
+ return value;
40
+ }
16
41
  function authentic(registry, receipt, contract, label) {
17
42
  if (!receipt || typeof receipt !== 'object' || registry.get(receipt) !== contract)
18
43
  throw new TypeError(`Unauthenticated or foreign direct ${label}`);
@@ -43,7 +68,11 @@ class Stop extends Error {
43
68
  }
44
69
  }
45
70
  function run(contract, options, work) {
46
- const { budget } = inspectDirectOperation(contract).context;
71
+ return runContext(inspectDirectOperation(contract).context, options, work);
72
+ }
73
+ function runContext(context, options, work) {
74
+ assertSemanticContext(context);
75
+ const { budget } = context;
47
76
  const check = () => { checkSemanticBudget(budget); if (options.signal?.aborted)
48
77
  throw new Stop('cancelled', 'cooperative-cancellation'); };
49
78
  try {
@@ -67,11 +96,13 @@ function run(contract, options, work) {
67
96
  if (error instanceof Stop)
68
97
  return Object.freeze({ kind: error.kind, rule: error.rule, schemaPath: error.schemaPath,
69
98
  payloadPath: error.payloadPath, usage: Object.freeze({ ...budget.usage() }) });
99
+ if (error instanceof ApplicationGroupValueError)
100
+ return Object.freeze({ kind: 'value-invalid', rule: error.message, usage: Object.freeze({ ...budget.usage() }) });
70
101
  throw error;
71
102
  }
72
103
  }
73
- function mappingFor(contract, direction, s) {
74
- const { context } = inspectDirectOperation(contract);
104
+ function mappingRoot(contract, direction, s) {
105
+ inspectDirectOperation(contract);
75
106
  const { budget, check } = s;
76
107
  const owned = directDataOwnership(budget).snapshot(direction, check);
77
108
  if (!owned || typeof owned !== 'object' || Array.isArray(owned))
@@ -87,17 +118,65 @@ function mappingFor(contract, direction, s) {
87
118
  }
88
119
  else
89
120
  throw new Stop('unsupported', 'unknown-direction');
90
- const plan = planDirectRoot(context, root, check, () => { throw new Stop('unsupported', 'native-direct-shape', root.element.context.source.path); });
121
+ return { root, direction: owned.kind === 'fault' ? { kind: 'fault', name: owned.name } : { kind: owned.kind } };
122
+ }
123
+ function mappingFor(contract, direction, s) {
124
+ const { context } = inspectDirectOperation(contract), { check } = s;
125
+ if (contract.basis !== 'native-direct-premises-v1' || contract.correspondence !== 'dated-XSD-2004-direct-v1')
126
+ throw new Stop('unsupported', 'direct-mapping-version');
127
+ const selected = mappingRoot(contract, direction, s), { root } = selected;
128
+ const unsupported = () => { throw new Stop('unsupported', 'native-direct-shape', root.element.context.source.path); };
129
+ const projection = planDirectProjection(context, root.element, check, unsupported);
130
+ const plan = flatDirectProjection(projection, check, unsupported);
91
131
  const mapping = s.publish({ kind: 'direct-mapping', version: DIRECT_VALUE_VERSION, admitted: false,
92
- root, direction: owned.kind === 'fault' ? { kind: 'fault', name: owned.name } : { kind: owned.kind }, contextId: context.contextId, ...plan });
132
+ root, direction: selected.direction, contextId: context.contextId, ...plan });
93
133
  mappings.set(mapping, contract);
134
+ mappingProjections.set(mapping, projection);
94
135
  return mapping;
95
136
  }
96
137
  /** Includes absent optional/zero-count slots; no observed payload is needed. */
97
138
  export function createDirectValueMapping(contract, direction, options = {}) {
98
139
  return run(contract, options, s => mappingFor(contract, direction, s));
99
140
  }
100
- function scalar(duty, s) {
141
+ /** Plan an operation direction through the existing native structured owner without flattening or preview admission.
142
+ * @remarks This transient mapping carries a distinct version and retains the exact native projection privately.
143
+ * It grants no codec, artifact or transport authority; copied mappings and mappings for other operations refuse.
144
+ * @returns An operation-owned structured mapping or the existing unsupported/cancellation/resource diagnostic.
145
+ */
146
+ export function createComponentValueMapping(contract, direction, options = {}, applicationGroups) {
147
+ return run(contract, options, s => {
148
+ const { context } = inspectDirectOperation(contract);
149
+ if (contract.basis !== 'native-component-premises-v1' || contract.correspondence !== 'dated-XSD-2004-components-v1')
150
+ throw new Stop('unsupported', 'component-mapping-version');
151
+ const selected = mappingRoot(contract, direction, s);
152
+ const projection = planDirectProjection(context, selected.root.element, s.check, () => { throw new Stop('unsupported', 'native-component-shape', selected.root.element.context.source.path); });
153
+ const mapping = s.publish({ kind: 'component-mapping', version: 'component-values-v1',
154
+ admitted: false, root: selected.root, direction: selected.direction, contextId: context.contextId });
155
+ const groupOptions = applicationGroups ? directDataOwnership(s.budget).freeze(parseApplicationGroups(applicationGroups)) : undefined;
156
+ const groups = groupOptions ? planApplicationGroups(context, projection, groupOptions, s.check) : undefined;
157
+ componentMappings.set(mapping, Object.freeze({ mapping, contract, projection, ...(groups ? { applicationGroups: groups, applicationGroupsOptions: groupOptions } : {}) }));
158
+ return mapping;
159
+ });
160
+ }
161
+ /** Reconstruct another operation direction using the exact issued presentation, without payload configuration.
162
+ * @returns A fresh source-owned mapping retaining request-selected naming options, or a native refusal.
163
+ * @throws TypeError For foreign/copy-shaped input mappings or malformed presentation options.
164
+ */
165
+ export function createComponentDirectionalMapping(contract, supplied, direction, options = {}) {
166
+ const input = inspectComponentValueMapping(supplied, contract).mapping;
167
+ return createComponentValueMapping(contract, direction, options, componentMappings.get(input).applicationGroupsOptions);
168
+ }
169
+ /** Authenticate the exact structured mapping and expose its existing native plan to local consumers only. */
170
+ export function inspectComponentValueMapping(value, contract) {
171
+ inspectDirectOperation(contract);
172
+ if (!value || typeof value !== 'object')
173
+ throw new TypeError('Fresh matching component value mapping required');
174
+ const owned = componentMappings.get(value);
175
+ if (!owned || owned.contract !== contract)
176
+ throw new TypeError('Fresh matching component value mapping required');
177
+ return Object.freeze({ mapping: owned.mapping, projection: owned.projection, ...(owned.applicationGroups ? { applicationGroups: owned.applicationGroups } : {}) });
178
+ }
179
+ function scalar(duty, s, context) {
101
180
  const { budget, check } = s;
102
181
  const fail = (_owner, rule) => { throw new Stop('scalar-invalid', rule, duty.schemaPath, duty.payloadPath); };
103
182
  const unavailable = () => { throw new Stop('unsupported', 'direct-datatype-prerequisite', duty.schemaPath, duty.payloadPath); };
@@ -107,43 +186,275 @@ function scalar(duty, s) {
107
186
  text: text => { check(); return text; },
108
187
  fail, unsupported: unavailable, unresolved: unavailable, notation: unavailable,
109
188
  });
110
- const result = core.atomic(duty.builtin.local, { value: duty.lexical, context: { namespaces: duty.namespaces, source: duty.payloadSource } }, duty);
111
- const value = duty.builtin.local === 'int' ? Number(result.canonical) : duty.builtin.local === 'boolean' ? result.canonical === 'true' : result.canonical;
112
- return { ...duty, normalized: normalizeWhitespace(duty.lexical, whitespaceFor(duty.builtin.local)), canonical: result.canonical, value };
189
+ let result;
190
+ const lexical = { value: duty.lexical, context: { namespaces: duty.namespaces, source: duty.payloadSource } };
191
+ if (duty.type.kind === 'builtin' && !duty.list)
192
+ result = core.atomic(duty.builtin.local, lexical, duty);
193
+ else {
194
+ const assessed = assessProjectionScalarOperand(context, duty.declaration, lexical, check);
195
+ check();
196
+ if (assessed.kind !== 'projection-scalar-operand')
197
+ throw new Stop(assessed.kind === 'scalar-invalid' ? 'scalar-invalid' : assessed.kind === 'resource-limit' ? 'resource-limit' : 'unsupported', 'rule' in assessed ? assessed.rule : 'request-budget', duty.schemaPath, duty.payloadPath);
198
+ result = assessed.operand;
199
+ }
200
+ if (duty.fixedCanonical !== undefined && budget.compareText(result.canonical, duty.fixedCanonical) !== 0)
201
+ throw new Stop('scalar-invalid', duty.declaration.kind === 'attribute' ? 'fixed-attribute-value' : 'fixed-element-value', duty.schemaPath, duty.payloadPath);
202
+ const normalized = result.normalized ?? normalizeWhitespace(duty.lexical, whitespaceFor(duty.builtin.local));
203
+ const present = (operand, builtin, lexical, retainLexical) => {
204
+ check();
205
+ if (retainLexical)
206
+ return lexical;
207
+ if (builtin.local === 'int')
208
+ return Number(operand.canonical);
209
+ if (builtin.local === 'boolean')
210
+ return operand.canonical === 'true';
211
+ if (operand.family === 'hexBinary') {
212
+ budget.chargeWork(64 + operand.canonical.length * 2);
213
+ return operand.canonical.toUpperCase();
214
+ }
215
+ if (operand.family === 'base64Binary') {
216
+ budget.chargeWork(64 + operand.canonical.length * 4);
217
+ return Buffer.from(operand.canonical, 'hex').toString('base64');
218
+ }
219
+ // @why Neutral temporal/IEEE comparison keys are not XML lexicals.
220
+ return operand.calendar || operand.duration || operand.family === 'float' || operand.family === 'double' ? lexical : operand.canonical;
221
+ };
222
+ let value;
223
+ if (duty.list && !duty.retainLexical) {
224
+ if (!result.items)
225
+ throw new TypeError('Missing native list item operands');
226
+ const items = [];
227
+ for (const item of result.items) {
228
+ check();
229
+ budget.chargeWork(64);
230
+ if (item.normalized === undefined)
231
+ throw new TypeError('Missing native list item lexical');
232
+ items.push(present(item, duty.list.builtin, item.normalized, duty.list.retainLexical));
233
+ }
234
+ value = items;
235
+ // @why #422 primitive-string unions re-assess the complete pre-member lexical input on every inverse.
236
+ }
237
+ else
238
+ value = present(result, duty.builtin, result.selectedMembers ? duty.lexical : normalized, duty.retainLexical);
239
+ return { ...duty, normalized, canonical: result.canonical, value };
113
240
  }
114
241
  function assessed(contract, structural, mapping, s) {
115
- const { budget, check } = s;
242
+ const { check } = s;
116
243
  const operands = [];
117
244
  for (const duty of structural.occurrences) {
118
245
  check();
119
- operands.push(scalar(duty, s));
246
+ operands.push(scalar(duty, s, inspectDirectOperation(contract).context));
120
247
  }
121
- let value;
122
- if (mapping.rootBuiltin)
123
- value = operands[0].value;
124
- else {
248
+ const value = projectValue(structural.tree, operands, s);
249
+ const receipt = s.publish({ kind: 'direct-value', scope: 'direct-structure-and-scalars', admitted: false,
250
+ mapping, structural, operands, value });
251
+ values.set(receipt, contract);
252
+ return receipt;
253
+ }
254
+ /** Project authenticated matched record boundaries; scalar checks remain the existing native datatype owner. */
255
+ function projectValue(tree, operands, s) {
256
+ const { budget, check } = s;
257
+ let result;
258
+ const frames = [{ node: tree, set: value => { result = value; } }];
259
+ while (frames.length) {
260
+ check();
261
+ const { node, set, scope } = frames.pop();
262
+ budget.chargeWork(128);
263
+ if (node.kind === 'mixed-text') {
264
+ set(node.value);
265
+ continue;
266
+ }
267
+ const retain = (target, effective) => {
268
+ const delta = Object.create(null);
269
+ for (const key of budget.sorted(Object.keys(effective), (a, b) => budget.compareText(a, b))) {
270
+ check();
271
+ budget.chargeWork(32 + key.length + effective[key].length);
272
+ if (key !== 'xml' && (!scope || scope[key] !== effective[key]))
273
+ delta[key] = effective[key];
274
+ }
275
+ if (!scope || Object.keys(delta).length)
276
+ target.$namespaces = delta;
277
+ };
278
+ if (node.kind === 'unassessed') {
279
+ const payload = node.payload;
280
+ const value = Object.create(null);
281
+ value.$namespace = payload.name.namespace;
282
+ retain(value, payload.namespaces);
283
+ if (payload.attributes.length) {
284
+ value.$attributes = budget.sorted([...payload.attributes], (a, b) => budget.compareText(JSON.stringify([a.name.namespace, a.name.local]), JSON.stringify([b.name.namespace, b.name.local]))).map(attribute => {
285
+ const entry = Object.create(null);
286
+ entry[attribute.name.local] = attribute.name.namespace ? { $namespace: attribute.name.namespace, $value: attribute.value } : attribute.value;
287
+ return entry;
288
+ });
289
+ }
290
+ const content = [];
291
+ value.$content = content;
292
+ set(value);
293
+ const children = [];
294
+ for (const child of payload.children) {
295
+ check();
296
+ budget.chargeWork(128);
297
+ if (child.kind === 'text') {
298
+ children.push({ node: { kind: 'mixed-text', declaration: node.declaration, payloadPath: node.payloadPath, value: child.value }, set(text) {
299
+ if (!text)
300
+ return;
301
+ const last = content.at(-1);
302
+ if (last && Object.hasOwn(last, '$value'))
303
+ last.$value = String(last.$value) + String(text);
304
+ else
305
+ content.push({ $value: text });
306
+ } });
307
+ }
308
+ else
309
+ children.push({ node: { ...node, payload: child }, scope: payload.namespaces, set(value) {
310
+ const entry = Object.create(null);
311
+ entry[child.name.local] = value;
312
+ content.push(entry);
313
+ } });
314
+ }
315
+ for (let index = children.length - 1; index >= 0; index--)
316
+ frames.push(children[index]);
317
+ continue;
318
+ }
319
+ if (node.kind === 'scalar') {
320
+ const operand = operands[node.operand];
321
+ if (!operand || operand.declaration !== node.declaration || operand.payloadPath !== node.payloadPath)
322
+ throw new TypeError('Foreign projection scalar operand');
323
+ set(operand.value);
324
+ continue;
325
+ }
125
326
  const record = Object.create(null);
126
- let cursor = 0;
127
- for (const slot of mapping.slots) {
327
+ set(record);
328
+ if (node.namespaces)
329
+ retain(record, node.namespaces);
330
+ if (node.nil)
331
+ record.$nil = true;
332
+ const attributeIdentities = new Map();
333
+ for (const attribute of node.attributes) {
334
+ check();
335
+ const operand = operands[attribute.operand];
336
+ if (!operand || operand.declaration !== attribute.declaration || operand.payloadPath !== attribute.payloadPath)
337
+ throw new TypeError('Foreign projection attribute operand');
338
+ const key = attribute.declaration.name.local;
339
+ budget.chargeWork(64 + key.length * 4);
340
+ if (attribute.bag) {
341
+ const bag = (record.$attributes ??= []);
342
+ const entry = Object.create(null);
343
+ entry[key] = attribute.namespaceChoice ? { $namespace: attribute.declaration.name.namespace, $value: operand.value } : operand.value;
344
+ bag.push(entry);
345
+ attributeIdentities.set(entry, attribute.declaration.name);
346
+ }
347
+ else
348
+ record[key] = operand.value;
349
+ }
350
+ if (node.openAttributes?.length) {
351
+ const bag = (record.$attributes ??= []);
352
+ for (const attribute of node.openAttributes) {
353
+ check();
354
+ budget.chargeWork(128 + attribute.value.length * 4);
355
+ const entry = Object.create(null);
356
+ entry[attribute.name.local] = attribute.name.namespace ? { $namespace: attribute.name.namespace, $value: attribute.value } : attribute.value;
357
+ bag.push(entry);
358
+ attributeIdentities.set(entry, attribute.name);
359
+ }
360
+ }
361
+ if (Array.isArray(record.$attributes)) {
362
+ const identity = (entry) => {
363
+ const name = attributeIdentities.get(entry);
364
+ return JSON.stringify([name.namespace, name.local]);
365
+ };
366
+ record.$attributes = budget.sorted([...record.$attributes], (a, b) => budget.compareText(identity(a), identity(b)));
367
+ }
368
+ const children = [];
369
+ if (node.text)
370
+ children.push({ node: node.text, set: value => { record.$value = value; } });
371
+ if (node.content) {
372
+ const content = [];
373
+ record.$content = content;
374
+ for (const item of node.content) {
375
+ check();
376
+ budget.chargeWork(128 + item.declaration.name.local.length * 4 + item.declaration.name.namespace.length * 4);
377
+ children.push({ node: item, scope: node.namespaces ?? scope, set: value => {
378
+ if (item.kind === 'mixed-text') {
379
+ const text = value;
380
+ if (!text)
381
+ return;
382
+ const last = content.at(-1);
383
+ if (last && typeof last === 'object' && !Array.isArray(last) && Object.hasOwn(last, '$value')) {
384
+ last.$value = String(last.$value) + text;
385
+ }
386
+ else
387
+ content.push({ $value: text });
388
+ }
389
+ else if (node.keyed) {
390
+ const entry = Object.create(null);
391
+ if (item.kind === 'unassessed') {
392
+ entry[item.payload.name.local] = value;
393
+ content.push(entry);
394
+ return;
395
+ }
396
+ if (node.namespaceChoices?.includes(item.declaration.name.local) || node.dynamicDeclarations?.includes(item.declaration)) {
397
+ if (item.kind === 'scalar')
398
+ value = { $namespace: item.declaration.name.namespace, $value: value };
399
+ // @why Records publish their owned container before child frames fill it; preserve that reference.
400
+ else
401
+ value.$namespace = item.declaration.name.namespace;
402
+ }
403
+ entry[item.declaration.name.local] = value;
404
+ content.push(entry);
405
+ }
406
+ else
407
+ content.push({ name: { ...item.declaration.name }, value });
408
+ } });
409
+ }
410
+ }
411
+ for (const { slot, items } of node.slots) {
128
412
  check();
129
413
  const key = slot.element.name.local;
414
+ budget.chargeWork(64 + key.length * 4);
130
415
  if (slot.particle.occurs.max === 'unbounded') {
131
- const items = [];
132
- record[key] = items;
133
- while (cursor < operands.length && operands[cursor].declaration === slot.element) {
416
+ const values = [];
417
+ record[key] = values;
418
+ for (const item of items) {
134
419
  check();
135
- items.push(operands[cursor++].value);
420
+ budget.chargeWork(128);
421
+ children.push({ node: item, scope: node.namespaces ?? scope, set: value => { values.push(value); } });
136
422
  }
137
423
  }
138
- else if (cursor < operands.length && operands[cursor].declaration === slot.element)
139
- record[key] = operands[cursor++].value;
424
+ else if (items.length) {
425
+ if (items.length !== 1)
426
+ throw new TypeError('Invalid projection singleton boundary');
427
+ budget.chargeWork(128);
428
+ children.push({ node: items[0], scope: node.namespaces ?? scope, set: value => { record[key] = value; } });
429
+ }
430
+ }
431
+ for (let i = children.length - 1; i >= 0; i--) {
432
+ check();
433
+ frames.push(children[i]);
140
434
  }
141
- value = record;
142
435
  }
143
- const receipt = s.publish({ kind: 'direct-value', scope: 'direct-structure-and-scalars', admitted: false,
144
- mapping, structural, operands, value });
145
- values.set(receipt, contract);
146
- return receipt;
436
+ if (result === undefined)
437
+ throw new TypeError('Missing projection root');
438
+ return result;
439
+ }
440
+ /** Validate scalar operands and retain nested application records without claiming source or operation admission. */
441
+ export function assessProjectionScalars(context, supplied, options = {}, mapping) {
442
+ const structural = inspectProjectionStructuralMatch(supplied, context);
443
+ return runContext(context, options, s => {
444
+ const operands = [];
445
+ for (const duty of structural.occurrences) {
446
+ s.check();
447
+ operands.push(scalar(duty, s, context));
448
+ }
449
+ let value = projectValue(structural.tree, operands, s);
450
+ const owned = mapping && componentMappings.get(mapping);
451
+ if (owned?.applicationGroups)
452
+ value = mapApplicationGroups(owned.applicationGroups, owned.projection, value, 'from-native', s.check);
453
+ const receipt = s.publish({ kind: 'projection-value', scope: 'direct-structure-and-scalars', admitted: false,
454
+ root: structural.root, contextId: context.contextId, structural, operands, value });
455
+ projectionValues.set(receipt, context);
456
+ return receipt;
457
+ });
147
458
  }
148
459
  export function assessDirectScalars(contract, match, options = {}) {
149
460
  const structural = inspectDirectStructuralMatch(match, contract);
@@ -155,119 +466,642 @@ export function assessDirectScalars(contract, match, options = {}) {
155
466
  return assessed(contract, structural, mapping, s);
156
467
  });
157
468
  }
158
- /** Pure shape validation plus lexical reconstruction, followed by existing validators. */
159
- export function expandDirectValue(contract, suppliedMapping, application, options = {}) {
160
- const mapping = inspectDirectValueMapping(suppliedMapping, contract);
161
- return run(contract, options, s => {
162
- const { budget, check } = s;
163
- const invalid = (rule, path = '/value') => { throw new Stop('value-invalid', rule, mapping.root.element.context.source.path, path); };
164
- let textUnits = 0, items = 0;
165
- const data = (object, key) => {
166
- check();
167
- const descriptor = Object.getOwnPropertyDescriptor(object, key);
168
- if (!descriptor || !('value' in descriptor) || !descriptor.enumerable && !(Array.isArray(object) && key === 'length'))
169
- return invalid('own-data-property');
170
- return descriptor.value;
171
- };
172
- const keys = (object, maximum) => {
173
- // Refuse extra keys without traversal. Reflect.ownKeys still allocates its
174
- // intrinsic vector before we can inspect its size; no hard heap bound is claimed.
175
- check();
176
- const result = Reflect.ownKeys(object);
177
- if (result.length > maximum)
178
- return invalid('unknown-key');
469
+ /**
470
+ * Construct fresh ordered syntax without coercion, defaults or field removal.
471
+ * @remarks maxItems counts scalar/simple-content roots, member elements, present attributes and list array items, excluding a record document wrapper.
472
+ * Repeated members each count; pending descendants reserve their item count before allocation.
473
+ * Native structural and scalar owners must validate the result before any successful expansion is issued.
474
+ */
475
+ function buildProjectionPayload(context, root, plan, application, options, s) {
476
+ const { budget, check } = s;
477
+ const invalid = (rule, path = '/value', element = root) => { throw new Stop('value-invalid', rule, element.context.source.path, path); };
478
+ let textUnits = 0, items = 0;
479
+ const maxItems = options.maxItems ?? directLimit(budget, DIRECT_VALUE_LIMITS.maxItems);
480
+ const maxText = options.maxText ?? directLimit(budget, DIRECT_VALUE_LIMITS.maxText);
481
+ if (![maxItems, maxText].every(value => Number.isSafeInteger(value) && value >= 0))
482
+ throw new RangeError('Application value limits must be nonnegative safe integers');
483
+ const data = (object, key, path, element) => {
484
+ check();
485
+ const descriptor = Object.getOwnPropertyDescriptor(object, key);
486
+ if (!descriptor || !('value' in descriptor) || !descriptor.enumerable && !(Array.isArray(object) && key === 'length'))
487
+ return invalid('own-data-property', path, element);
488
+ return descriptor.value;
489
+ };
490
+ const keys = (object, maximum, path, element) => {
491
+ // Refuse extra keys without traversal. Reflect.ownKeys still allocates its
492
+ // intrinsic vector before we can inspect its size; no hard heap bound is claimed.
493
+ check();
494
+ const result = Reflect.ownKeys(object);
495
+ if (result.length > maximum)
496
+ return invalid('unknown-key', path, element);
497
+ return result;
498
+ };
499
+ const spelling = (value, builtin, path, element, retainLexical, list) => {
500
+ check();
501
+ if (list && !retainLexical) {
502
+ if (types.isProxy(value) || !Array.isArray(value) || Object.getPrototypeOf(value) !== Array.prototype)
503
+ return invalid('dense-list-array-required', path, element);
504
+ const length = data(value, 'length', path, element);
505
+ if (length > maxItems - items)
506
+ throw new Stop('resource-limit', 'application item limit');
507
+ const own = keys(value, length + 1, path, element);
508
+ if (own.length !== length + 1)
509
+ return invalid('dense-list-array-required', path, element);
510
+ items += length;
511
+ const parts = [];
512
+ let units = 0;
513
+ for (let index = 0; index < length; index++) {
514
+ check();
515
+ const memberPath = `${path}/${index}`;
516
+ const raw = spelling(data(value, String(index), memberPath, element), list.builtin, memberPath, element, list.retainLexical);
517
+ budget.chargeWork(64 + raw.length * 4);
518
+ const normalized = normalizeWhitespace(raw, list.whitespace);
519
+ if (!normalized || /[\t\r\n ]/.test(normalized))
520
+ return invalid('list-item-token-required', memberPath, element);
521
+ units += normalized.length;
522
+ parts.push(normalized);
523
+ }
524
+ budget.chargeWork(64 + units * 2 + length * 2);
525
+ return parts.join(' ');
526
+ }
527
+ if (retainLexical || projectionScalarRepresentation(builtin) === 'string') {
528
+ if (typeof value !== 'string')
529
+ return invalid('string-required', path, element);
530
+ if (value.length > maxText - textUnits)
531
+ throw new Stop('resource-limit', 'application text limit');
532
+ textUnits += value.length;
533
+ return value;
534
+ }
535
+ if (builtin.local === 'boolean') {
536
+ if (typeof value !== 'boolean')
537
+ return invalid('boolean-required', path, element);
538
+ return value ? 'true' : 'false';
539
+ }
540
+ if (typeof value !== 'number' || !Number.isInteger(value))
541
+ return invalid('integer-number-required', path, element);
542
+ // Range and XML lexical validity are checked by the same neutral core below.
543
+ return String(value === 0 ? 0 : value);
544
+ };
545
+ const lexical = (value, path, element) => {
546
+ const text = spelling(value, { namespace: XSD_NAMESPACE, local: 'string' }, path, element);
547
+ if (!isXmlCharacters(text))
548
+ return invalid('xml-characters', path, element);
549
+ return text;
550
+ };
551
+ const source = (path) => {
552
+ return { uri: 'urn:typescript-wsdl-client:generated-direct-value', digest: '', path,
553
+ start: { offset: 0, line: 0, column: 0 }, end: { offset: 0, line: 0, column: 0 } };
554
+ };
555
+ const leaf = (name, lexical, path) => {
556
+ check();
557
+ return { kind: 'element', name, lexicalName: name.local, namespaces: Object.create(null),
558
+ baseUri: 'urn:typescript-wsdl-client:generated-direct-value', attributes: [], source: source(path),
559
+ children: [{ kind: 'text', value: lexical, source: source(path + '/text') }] };
560
+ };
561
+ const records = new Map(plan.records.map(record => [record.type.id, record]));
562
+ const wildcardPlans = new Map([[root, plan]]);
563
+ const wildcardValue = (element) => {
564
+ let selected = wildcardPlans.get(element);
565
+ if (!selected) {
566
+ selected = planDirectProjection(context, element, check, () => { throw new Stop('unsupported', 'native-wildcard-target-shape', element.context.source.path); });
567
+ budget.chargeWork(64 + selected.records.length * 64);
568
+ for (const record of selected.records) {
569
+ check();
570
+ if (!records.has(record.type.id))
571
+ records.set(record.type.id, record);
572
+ }
573
+ wildcardPlans.set(element, selected);
574
+ }
575
+ return selected.root;
576
+ };
577
+ const active = new WeakSet();
578
+ const scopeFor = (value, inherited, required, path, element) => {
579
+ if (!Object.hasOwn(value, '$namespaces') && required && !inherited)
580
+ return invalid('namespace-boundary-required', path, element);
581
+ const result = Object.assign(Object.create(null), inherited ?? { xml: XML_NAMESPACE, '': '' });
582
+ if (!Object.hasOwn(value, '$namespaces'))
179
583
  return result;
180
- };
181
- const spelling = (value, builtin) => {
182
- check();
183
- if (builtin.local === 'string') {
184
- if (typeof value !== 'string')
185
- return invalid('string-required');
186
- if (value.length > (options.maxText ?? directLimit(budget, DIRECT_VALUE_LIMITS.maxText)) - textUnits)
187
- throw new Stop('resource-limit', 'application text limit');
188
- textUnits += value.length;
189
- return value;
584
+ const raw = data(value, '$namespaces', path, element);
585
+ if (!raw || typeof raw !== 'object' || types.isProxy(raw) || Array.isArray(raw) || ![null, Object.prototype].includes(Object.getPrototypeOf(raw)))
586
+ return invalid('namespace-map-required', path, element);
587
+ for (const key of keys(raw, maxItems, path, element)) {
588
+ if (typeof key !== 'string')
589
+ return invalid('namespace-binding', path, element);
590
+ const namespace = lexical(data(raw, key, path, element), path, element);
591
+ if (!isXmlNamespaceBinding(key, namespace))
592
+ return invalid('namespace-binding', path, element);
593
+ budget.chargeWork(64 + key.length * 4 + namespace.length * 4);
594
+ result[key] = namespace;
595
+ }
596
+ return result;
597
+ };
598
+ const frames = [];
599
+ const roots = [];
600
+ const schedule = (pending, element, shape, value, xmlPath, valuePath, into, scope, identity) => {
601
+ check();
602
+ if ((shape.kind === 'scalar' || xmlPath !== '/0' || records.get(shape.type)?.content === 'simple') && ++items > maxItems)
603
+ throw new Stop('resource-limit', 'application item limit');
604
+ pending.push({ kind: 'node', element, shape, value, xmlPath, valuePath, into, scope, identity });
605
+ };
606
+ schedule(frames, root, plan.root, application, '/0', '/value', roots);
607
+ while (frames.length) {
608
+ check();
609
+ const frame = frames.pop();
610
+ if (frame.kind === 'leave') {
611
+ active.delete(frame.value);
612
+ continue;
613
+ }
614
+ if (frame.kind === 'text') {
615
+ frame.into.push({ kind: 'text', value: frame.text, source: source(frame.xmlPath) });
616
+ continue;
617
+ }
618
+ if (frame.kind === 'open') {
619
+ const { element, name, value, valuePath, xmlPath, into } = frame;
620
+ const object = (raw, maximum) => {
621
+ if (!raw || typeof raw !== 'object' || types.isProxy(raw) || Array.isArray(raw) || ![null, Object.prototype].includes(Object.getPrototypeOf(raw)))
622
+ return invalid('plain-record-required', valuePath, element);
623
+ const own = keys(raw, maximum, valuePath, element);
624
+ if (own.some(key => typeof key !== 'string'))
625
+ return invalid('unknown-key', valuePath, element);
626
+ return { value: raw, keys: own };
627
+ };
628
+ const holder = object(value, 4);
629
+ if (holder.keys.some(key => !['$namespace', '$namespaces', '$attributes', '$content'].includes(key)))
630
+ return invalid('unknown-key', valuePath, element);
631
+ if (!isXmlNCName(name.local) || !isXmlCharacters(name.namespace) || name.namespace === 'http://www.w3.org/2000/xmlns/')
632
+ return invalid('expanded-name-required', valuePath, element);
633
+ if (data(holder.value, '$namespace', valuePath, element) !== name.namespace)
634
+ return invalid('element-namespace-required', valuePath, element);
635
+ if (active.has(holder.value))
636
+ return invalid('cyclic-value', valuePath, element);
637
+ active.add(holder.value);
638
+ const scope = scopeFor(holder.value, frame.scope, true, valuePath, element);
639
+ const array = (raw) => {
640
+ if (!raw || typeof raw !== 'object' || types.isProxy(raw) || !Array.isArray(raw) || Object.getPrototypeOf(raw) !== Array.prototype)
641
+ return invalid('dense-array-required', valuePath, element);
642
+ const length = data(raw, 'length', valuePath, element);
643
+ if (length > maxItems - items)
644
+ throw new Stop('resource-limit', 'application item limit');
645
+ if (keys(raw, length + 1, valuePath, element).length !== length + 1)
646
+ return invalid('dense-array-required', valuePath, element);
647
+ items += length;
648
+ return raw;
649
+ };
650
+ const attributes = [], seen = new Set();
651
+ if (Object.hasOwn(holder.value, '$attributes')) {
652
+ const bag = array(data(holder.value, '$attributes', valuePath, element));
653
+ for (let index = 0; index < bag.length; index++) {
654
+ check();
655
+ const entry = object(data(bag, String(index), valuePath, element), 1);
656
+ if (entry.keys.length !== 1)
657
+ return invalid('attribute-entry-shape', valuePath, element);
658
+ const key = entry.keys[0];
659
+ if (!isXmlNCName(key))
660
+ return invalid('attribute-name', valuePath, element);
661
+ let member = data(entry.value, key, valuePath, element), namespace = '';
662
+ if (typeof member !== 'string') {
663
+ const identity = object(member, 2);
664
+ if (identity.keys.length !== 2 || !identity.keys.includes('$namespace') || !identity.keys.includes('$value'))
665
+ return invalid('attribute-holder-shape', valuePath, element);
666
+ const uri = data(identity.value, '$namespace', valuePath, element);
667
+ if (typeof uri !== 'string' || !uri || !isXmlCharacters(uri) || uri === 'http://www.w3.org/2000/xmlns/')
668
+ return invalid('attribute-namespace', valuePath, element);
669
+ namespace = uri;
670
+ member = data(identity.value, '$value', valuePath, element);
671
+ }
672
+ const identity = JSON.stringify([namespace, key]);
673
+ if (!namespace && key === 'xmlns')
674
+ return invalid('attribute-name', valuePath, element);
675
+ if (seen.has(identity))
676
+ return invalid('duplicate-attribute', valuePath, element);
677
+ seen.add(identity);
678
+ attributes.push({ name: { namespace, local: key }, lexicalName: key, value: lexical(member, valuePath, element) });
679
+ }
190
680
  }
191
- if (builtin.local === 'boolean') {
192
- if (typeof value !== 'boolean')
193
- return invalid('boolean-required');
194
- return value ? 'true' : 'false';
681
+ const children = [];
682
+ into.push({ kind: 'element', name, lexicalName: name.local, namespaces: scope, attributes, children, baseUri: 'urn:typescript-wsdl-client:generated-direct-value', source: source(xmlPath) });
683
+ const content = array(data(holder.value, '$content', valuePath, element)), pending = [];
684
+ for (let index = 0; index < content.length; index++) {
685
+ check();
686
+ const entry = object(data(content, String(index), valuePath, element), 1);
687
+ if (entry.keys.length !== 1)
688
+ return invalid('ordered-entry-shape', valuePath, element);
689
+ const key = entry.keys[0], member = data(entry.value, key, valuePath, element), at = `${valuePath}/$content/${index}`;
690
+ if (key === '$value')
691
+ pending.push({ kind: 'text', text: lexical(member, at, element), xmlPath: `${xmlPath}/children/${index}`, into: children });
692
+ else {
693
+ const child = object(member, 4), namespace = data(child.value, '$namespace', at, element);
694
+ if (typeof namespace !== 'string')
695
+ return invalid('element-namespace-required', at, element);
696
+ pending.push({ kind: 'open', name: { namespace, local: key }, element, value: member, scope, xmlPath: `${xmlPath}/children/${index}`, valuePath: at, into: children });
697
+ }
195
698
  }
196
- if (typeof value !== 'number' || !Number.isInteger(value))
197
- return invalid('integer-number-required');
198
- // Range and XML lexical validity are checked by the same neutral core below.
199
- return String(value === 0 ? 0 : value);
200
- };
201
- const source = (path) => {
202
- return { uri: 'urn:typescript-wsdl-client:generated-direct-value', digest: '', path,
203
- start: { offset: 0, line: 0, column: 0 }, end: { offset: 0, line: 0, column: 0 } };
204
- };
205
- const leaf = (name, lexical, path) => {
699
+ frames.push({ kind: 'leave', value: holder.value });
700
+ for (let index = pending.length - 1; index >= 0; index--)
701
+ frames.push(pending[index]);
702
+ continue;
703
+ }
704
+ const { element, shape, value, xmlPath, valuePath, into } = frame;
705
+ const nil = !!value && typeof value === 'object' && !types.isProxy(value) && Object.hasOwn(value, '$nil');
706
+ if (nil && (!shape.nillable || shape.constraint?.kind === 'fixed'))
707
+ return invalid('nil-not-permitted', valuePath, element);
708
+ if (shape.kind === 'scalar' && !nil) {
709
+ into.push(leaf(element.name, spelling(value, shape.builtin, valuePath, element, shape.retainLexical, shape.list), xmlPath));
710
+ continue;
711
+ }
712
+ if (!value || typeof value !== 'object')
713
+ return invalid('record-required', valuePath, element);
714
+ if (types.isProxy(value))
715
+ return invalid('plain-record-required', valuePath, element);
716
+ if (Array.isArray(value))
717
+ return invalid('record-required', valuePath, element);
718
+ check();
719
+ const proto = Object.getPrototypeOf(value);
720
+ if (proto !== Object.prototype && proto !== null)
721
+ return invalid('plain-record-required', valuePath, element);
722
+ if (active.has(value))
723
+ return invalid('cyclic-value', valuePath, element);
724
+ active.add(value);
725
+ const record = shape.kind === 'record' ? records.get(shape.type) : { attributes: [], slots: [], text: undefined, ordered: undefined, keyed: undefined, fixedOrder: undefined, contextual: undefined, attributeWildcard: undefined, content: 'empty' };
726
+ if (!record)
727
+ throw new TypeError('Missing native projection record');
728
+ const declared = new Set();
729
+ if (frame.identity !== undefined) {
730
+ if (data(value, '$namespace', valuePath, element) !== frame.identity)
731
+ return invalid('element-namespace-required', valuePath, element);
732
+ declared.add('$namespace');
733
+ }
734
+ if (record.contextual)
735
+ declared.add('$namespaces');
736
+ if (record.attributeWildcard)
737
+ declared.add('$attributes');
738
+ if (nil) {
739
+ if (data(value, '$nil', valuePath + '/$nil', element) !== true)
740
+ return invalid('nil-marker-true-required', valuePath, element);
741
+ declared.add('$nil');
742
+ }
743
+ else if (record.ordered)
744
+ declared.add('$content');
745
+ else
746
+ for (const slot of record.slots) {
747
+ check();
748
+ declared.add(slot.element.name.local);
749
+ }
750
+ for (const attribute of record.attributes) {
751
+ check();
752
+ declared.add(attribute.bag ? '$attributes' : attribute.declaration.name.local);
753
+ }
754
+ if (record.text && !nil)
755
+ declared.add('$value');
756
+ for (const key of keys(value, declared.size, valuePath, element)) {
206
757
  check();
207
- if (++items > (options.maxItems ?? directLimit(budget, DIRECT_VALUE_LIMITS.maxItems)))
758
+ if (typeof key !== 'string')
759
+ return invalid('unknown-key', valuePath, element);
760
+ if (!declared.has(key))
761
+ return invalid('unknown-key', valuePath, element);
762
+ data(value, key, valuePath, element);
763
+ }
764
+ const children = [];
765
+ if (record.text && !nil) {
766
+ const path = valuePath + '/$value';
767
+ if (!Object.hasOwn(value, '$value'))
768
+ return invalid('missing-simple-content', path, element);
769
+ children.push({ kind: 'text', value: spelling(data(value, '$value', path, element), record.text.builtin, path, element, record.text.retainLexical, record.text.list), source: source(xmlPath + '/text') });
770
+ }
771
+ const attributes = [];
772
+ if (nil)
773
+ attributes.push({ name: { namespace: 'http://www.w3.org/2001/XMLSchema-instance', local: 'nil' }, lexicalName: 'xsi:nil', value: 'true' });
774
+ const bagValues = new Map();
775
+ const bagIdentities = new Set();
776
+ if (Object.hasOwn(value, '$attributes')) {
777
+ const path = valuePath + '/$attributes', bag = data(value, '$attributes', path, element);
778
+ if (!bag || typeof bag !== 'object' || types.isProxy(bag) || !Array.isArray(bag) || Object.getPrototypeOf(bag) !== Array.prototype)
779
+ return invalid('dense-array-required', path, element);
780
+ const length = data(bag, 'length', path, element);
781
+ if (length > maxItems - items)
208
782
  throw new Stop('resource-limit', 'application item limit');
209
- return { kind: 'element', name, lexicalName: name.local, namespaces: Object.create(null),
210
- baseUri: 'urn:typescript-wsdl-client:generated-direct-value', attributes: [], source: source(path),
211
- children: [{ kind: 'text', value: lexical, source: source(path + '/text') }] };
212
- };
213
- let payload;
214
- if (mapping.rootBuiltin)
215
- payload = leaf(mapping.root.element.name, spelling(application, mapping.rootBuiltin), '/0');
216
- else {
217
- if (!application || typeof application !== 'object' || Array.isArray(application))
218
- return invalid('record-required');
783
+ if (keys(bag, length + 1, path, element).length !== length + 1)
784
+ return invalid('dense-array-required', path, element);
785
+ items += length;
786
+ for (let index = 0; index < length; index++) {
787
+ const at = `${path}/${index}`, entry = data(bag, String(index), at, element);
788
+ if (!entry || typeof entry !== 'object' || types.isProxy(entry) || Array.isArray(entry))
789
+ return invalid('attribute-entry-shape', at, element);
790
+ const own = keys(entry, 1, at, element);
791
+ if (own.length !== 1 || typeof own[0] !== 'string')
792
+ return invalid('attribute-entry-shape', at, element);
793
+ const key = own[0], candidates = record.attributes.filter(attribute => attribute.bag && attribute.declaration.name.local === key);
794
+ if (!isXmlNCName(key))
795
+ return invalid('attribute-name', at, element);
796
+ let member = data(entry, key, at, element);
797
+ let selected = candidates.length === 1 ? candidates[0] : undefined;
798
+ let namespace = selected?.declaration.name.namespace ?? '';
799
+ if (candidates.length > 1 || record.attributeWildcard) {
800
+ namespace = '';
801
+ if (member && typeof member === 'object' && !Array.isArray(member)) {
802
+ if (!member || typeof member !== 'object' || types.isProxy(member) || Array.isArray(member))
803
+ return invalid('attribute-namespace-required', at, element);
804
+ const own = keys(member, 2, at, element);
805
+ if (own.length !== 2 || !own.includes('$namespace') || !own.includes('$value'))
806
+ return invalid('attribute-holder-shape', at, element);
807
+ const uri = data(member, '$namespace', at, element);
808
+ if (typeof uri !== 'string' || !uri || !isXmlCharacters(uri) || uri === 'http://www.w3.org/2000/xmlns/')
809
+ return invalid('attribute-namespace-required', at, element);
810
+ namespace = uri;
811
+ member = data(member, '$value', at, element);
812
+ }
813
+ selected = candidates.find(candidate => candidate.declaration.name.namespace === namespace);
814
+ }
815
+ const identity = JSON.stringify([namespace, key]);
816
+ if (!namespace && key === 'xmlns')
817
+ return invalid('attribute-name', at, element);
818
+ if (bagIdentities.has(identity))
819
+ return invalid('duplicate-attribute', at, element);
820
+ bagIdentities.add(identity);
821
+ if (!selected && record.attributeWildcard) {
822
+ if (record.attributes.some(attribute => attribute.declaration.name.local === key && attribute.declaration.name.namespace === namespace))
823
+ return invalid('duplicate-attribute-channel', at, element);
824
+ const selection = selectProjectionAttribute(context, record, { namespace, local: key }, check, () => { throw new Stop('unsupported', 'native-wildcard-attribute-scalar', element.context.source.path, at); });
825
+ if (!selection)
826
+ return invalid('unknown-attribute', at, element);
827
+ const descriptor = selection.attribute;
828
+ attributes.push({ name: { namespace, local: key }, lexicalName: key, value: descriptor
829
+ ? spelling(member, descriptor.builtin, at, element, descriptor.retainLexical, descriptor.list) : lexical(member, at, element) });
830
+ continue;
831
+ }
832
+ if (!selected)
833
+ return invalid('unknown-attribute', at, element);
834
+ if (bagValues.has(selected.declaration.id))
835
+ return invalid('duplicate-attribute', at, element);
836
+ bagValues.set(selected.declaration.id, member);
837
+ }
838
+ }
839
+ for (const attribute of record.attributes) {
219
840
  check();
220
- const proto = Object.getPrototypeOf(application);
221
- if (proto !== Object.prototype && proto !== null)
222
- return invalid('plain-record-required');
223
- const declared = new Set();
224
- for (const slot of mapping.slots) {
225
- check();
226
- declared.add(slot.element.name.local);
841
+ const name = attribute.declaration.name;
842
+ const path = `${valuePath}/${name.local.replaceAll('~', '~0').replaceAll('/', '~1')}`;
843
+ if (attribute.bag ? !bagValues.has(attribute.declaration.id) : !Object.hasOwn(value, name.local)) {
844
+ if (attribute.required)
845
+ return invalid('missing-attribute', path, element);
846
+ continue;
227
847
  }
228
- for (const key of keys(application, mapping.slots.length)) {
848
+ if (++items > maxItems)
849
+ throw new Stop('resource-limit', 'application item limit');
850
+ budget.chargeWork(128 + name.local.length * 4);
851
+ attributes.push({ name, lexicalName: name.local, value: spelling(attribute.bag ? bagValues.get(attribute.declaration.id) : data(value, name.local, path, element), attribute.builtin, path, element, attribute.retainLexical, attribute.list) });
852
+ }
853
+ const scope = record.contextual ? scopeFor(value, frame.scope, true, valuePath, element) : frame.scope;
854
+ into.push({ kind: 'element', name: element.name, lexicalName: element.name.local,
855
+ namespaces: scope ?? Object.create(null), baseUri: 'urn:typescript-wsdl-client:generated-direct-value',
856
+ attributes, source: source(xmlPath), children });
857
+ if (nil) {
858
+ active.delete(value);
859
+ continue;
860
+ }
861
+ const pending = [];
862
+ if (record.ordered) {
863
+ const path = `${valuePath}/$content`;
864
+ if (!Object.hasOwn(value, '$content'))
865
+ return invalid('missing-ordered-content', path, element);
866
+ const content = data(value, '$content', path, element);
867
+ if (!content || typeof content !== 'object' || types.isProxy(content) || !Array.isArray(content) || Object.getPrototypeOf(content) !== Array.prototype)
868
+ return invalid('dense-array-required', path, element);
869
+ const length = data(content, 'length', path, element);
870
+ if (length > maxItems - items)
871
+ throw new Stop('resource-limit', 'application item limit');
872
+ if (keys(content, length + 1, path, element).length !== length + 1)
873
+ return invalid('dense-array-required', path, element);
874
+ const object = (input, at, fields) => {
875
+ if (!input || typeof input !== 'object' || types.isProxy(input) || Array.isArray(input))
876
+ return invalid('plain-record-required', at, element);
877
+ const proto = Object.getPrototypeOf(input);
878
+ if (proto !== Object.prototype && proto !== null)
879
+ return invalid('plain-record-required', at, element);
880
+ const own = keys(input, fields.length, at, element);
881
+ if (own.length !== fields.length || own.some(key => { check(); return typeof key !== 'string' || !fields.includes(key); }))
882
+ return invalid('ordered-entry-shape', at, element);
883
+ return input;
884
+ };
885
+ let fixedIndex = 0;
886
+ for (let index = 0; index < length; index++) {
229
887
  check();
230
- if (typeof key !== 'string')
231
- return invalid('unknown-key');
232
- if (!declared.has(key))
233
- return invalid('unknown-key');
234
- data(application, key);
888
+ const at = `${path}/${index}`;
889
+ if (record.keyed) {
890
+ const raw = data(content, String(index), at, element);
891
+ if (!raw || typeof raw !== 'object' || types.isProxy(raw) || Array.isArray(raw))
892
+ return invalid('ordered-entry-shape', at, element);
893
+ const own = keys(raw, 1, at, element);
894
+ if (own.length !== 1 || typeof own[0] !== 'string')
895
+ return invalid('ordered-entry-shape', at, element);
896
+ const key = own[0], entry = object(raw, at, [key]);
897
+ const member = data(entry, key, at, element);
898
+ if (key === '$value') {
899
+ if (record.content !== 'mixed')
900
+ return invalid('complex-text', at, element);
901
+ const text = lexical(member, at, element);
902
+ if (++items > maxItems)
903
+ throw new Stop('resource-limit', 'application item limit');
904
+ // @why Schedule text with elements so mixed positions survive the iterative construction order.
905
+ pending.push({ kind: 'text', text, xmlPath: `${xmlPath}/children/${index}`, into: children });
906
+ continue;
907
+ }
908
+ const slots = record.slots.filter(slot => slot.element.name.local === key);
909
+ let selectedValue = member;
910
+ let selectedIdentity;
911
+ let slot = record.fixedOrder ? record.slots[fixedIndex++] : slots.length === 1 ? slots[0] : undefined;
912
+ if (record.fixedOrder && slot?.element.name.local !== key)
913
+ return invalid('ordered-particle-language', at, element);
914
+ if (!record.fixedOrder && slot && member && typeof member === 'object' && !types.isProxy(member) && !Array.isArray(member) && Object.hasOwn(member, '$namespace')
915
+ && data(member, '$namespace', at, element) !== slot.element.name.namespace)
916
+ slot = undefined;
917
+ if (!record.fixedOrder && slots.length > 1) {
918
+ if (!member || typeof member !== 'object' || types.isProxy(member) || Array.isArray(member))
919
+ return invalid('element-namespace-required', at, element);
920
+ const namespace = data(member, '$namespace', at, element);
921
+ slot = slots.find(candidate => candidate.element.name.namespace === namespace);
922
+ if (!slot)
923
+ return invalid('unknown-ordered-element', at, element);
924
+ if (slot.value.kind === 'scalar') {
925
+ if (Object.hasOwn(member, '$nil')) {
926
+ object(member, at, ['$namespace', '$nil']);
927
+ selectedValue = { $nil: data(member, '$nil', at, element) };
928
+ }
929
+ else {
930
+ object(member, at, ['$namespace', '$value']);
931
+ selectedValue = data(member, '$value', at, element);
932
+ }
933
+ }
934
+ else {
935
+ selectedIdentity = namespace;
936
+ }
937
+ }
938
+ if (!slot) {
939
+ if (!isXmlNCName(key) || !member || typeof member !== 'object' || types.isProxy(member) || Array.isArray(member))
940
+ return invalid('unknown-ordered-element', at, element);
941
+ const namespace = data(member, '$namespace', at, element);
942
+ if (typeof namespace !== 'string')
943
+ return invalid('element-namespace-required', at, element);
944
+ const selected = selectProjectionWildcard(context, record, { namespace, local: key }, check);
945
+ if (!selected)
946
+ return invalid('unknown-ordered-element', at, element);
947
+ if (!selected.element) {
948
+ // @why Nested open entries count through their parent array; this assessed-to-open boundary has no such parent charge.
949
+ if (++items > maxItems)
950
+ throw new Stop('resource-limit', 'application item limit');
951
+ pending.push({ kind: 'open', name: { namespace, local: key }, value: member, element, scope, xmlPath: `${xmlPath}/children/${index}`, valuePath: at, into: children });
952
+ }
953
+ else {
954
+ const shape = wildcardValue(selected.element);
955
+ const selectedValue = shape.kind === 'scalar' ? (() => {
956
+ if (Object.hasOwn(member, '$nil')) {
957
+ object(member, at, ['$namespace', '$nil']);
958
+ return { $nil: data(member, '$nil', at, element) };
959
+ }
960
+ object(member, at, ['$namespace', '$value']);
961
+ return data(member, '$value', at, element);
962
+ })() : member;
963
+ schedule(pending, selected.element, shape, selectedValue, `${xmlPath}/children/${index}`, at, children, scope, shape.kind === 'record' ? namespace : undefined);
964
+ }
965
+ continue;
966
+ }
967
+ schedule(pending, slot.element, slot.value, selectedValue, `${xmlPath}/children/${index}`, at + '/' + key, children, scope, selectedIdentity);
968
+ continue;
969
+ }
970
+ const entry = object(data(content, String(index), at, element), at, ['name', 'value']);
971
+ const name = object(data(entry, 'name', at + '/name', element), at + '/name', ['namespace', 'local']);
972
+ const namespace = data(name, 'namespace', at + '/name/namespace', element), local = data(name, 'local', at + '/name/local', element);
973
+ if (typeof namespace !== 'string' || typeof local !== 'string')
974
+ return invalid('expanded-name-required', at + '/name', element);
975
+ budget.chargeWork(64 + namespace.length * 4 + local.length * 4);
976
+ const slot = record.slots.find(item => { check(); return item.element.name.namespace === namespace && item.element.name.local === local; });
977
+ const selected = slot?.element ?? resolveProjectionWildcard(context, record, { namespace, local }, check);
978
+ if (!selected)
979
+ return invalid('unknown-ordered-element', at, element);
980
+ schedule(pending, selected, slot?.value ?? wildcardValue(selected), data(entry, 'value', at + '/value', element), `${xmlPath}/children/${index}`, at + '/value', children, scope);
235
981
  }
236
- const children = [];
237
- for (const slot of mapping.slots) {
982
+ }
983
+ else
984
+ for (const slot of record.slots) {
238
985
  check();
239
986
  const key = slot.element.name.local;
240
- if (!Object.hasOwn(application, key)) {
987
+ const memberPath = `${valuePath}/${key.replaceAll('~', '~0').replaceAll('/', '~1')}`;
988
+ if (!Object.hasOwn(value, key)) {
241
989
  if (slot.particle.occurs.max === 'unbounded' || slot.particle.occurs.min === '1')
242
- return invalid('missing-member');
990
+ return invalid('missing-member', memberPath, slot.element);
243
991
  continue;
244
992
  }
245
- const value = data(application, key);
246
- const append = (item) => { check(); children.push(leaf(slot.element.name, spelling(item, slot.builtin), `/0/children/${children.length}`)); };
993
+ const member = data(value, key, memberPath, slot.element);
994
+ const append = (item, path) => {
995
+ check();
996
+ schedule(pending, slot.element, slot.value, item, `${xmlPath}/children/${pending.length}`, path, children, scope);
997
+ };
247
998
  if (slot.particle.occurs.max === 'unbounded') {
248
- if (!Array.isArray(value) || Object.getPrototypeOf(value) !== Array.prototype)
249
- return invalid('dense-array-required');
250
- const length = data(value, 'length');
251
- if (length > (options.maxItems ?? directLimit(budget, DIRECT_VALUE_LIMITS.maxItems)) - items)
999
+ if (types.isProxy(member) || !Array.isArray(member) || Object.getPrototypeOf(member) !== Array.prototype)
1000
+ return invalid('dense-array-required', memberPath, slot.element);
1001
+ const length = data(member, 'length', memberPath, slot.element);
1002
+ if (length > maxItems - items)
252
1003
  throw new Stop('resource-limit', 'application item limit');
253
1004
  if (slot.particle.occurs.min === '1' && length === 0)
254
- return invalid('required-repetition');
1005
+ return invalid('required-repetition', memberPath, slot.element);
255
1006
  // Check actual repetition length before key enumeration or inverse construction.
256
- const own = keys(value, length + 1);
1007
+ const own = keys(member, length + 1, memberPath, slot.element);
257
1008
  if (own.length !== length + 1)
258
- return invalid('dense-array-required');
1009
+ return invalid('dense-array-required', memberPath, slot.element);
259
1010
  for (let i = 0; i < length; i++) {
260
1011
  check();
261
- append(data(value, String(i)));
1012
+ const path = `${memberPath}/${i}`;
1013
+ append(data(member, String(i), path, slot.element), path);
262
1014
  }
263
1015
  }
264
1016
  else
265
- append(value);
1017
+ append(member, memberPath);
266
1018
  }
267
- payload = { kind: 'element', name: mapping.root.element.name, lexicalName: mapping.root.element.name.local,
268
- namespaces: Object.create(null), baseUri: 'urn:typescript-wsdl-client:generated-direct-value',
269
- attributes: [], source: source('/0'), children };
1019
+ frames.push({ kind: 'leave', value });
1020
+ for (let i = pending.length - 1; i >= 0; i--) {
1021
+ check();
1022
+ frames.push(pending[i]);
270
1023
  }
1024
+ }
1025
+ const payload = roots[0];
1026
+ if (!payload || payload.kind !== 'element')
1027
+ throw new TypeError('Missing projection payload');
1028
+ return payload;
1029
+ }
1030
+ /** Validate structured application values with the same native structural/scalar owners, without operation admission. */
1031
+ export function expandProjectionValue(context, root, application, options = {}, mapping) {
1032
+ return runContext(context, options, s => {
1033
+ const plan = planDirectProjection(context, root, s.check, () => { throw new Stop('unsupported', 'native-direct-shape'); });
1034
+ const owned = mapping && componentMappings.get(mapping);
1035
+ if (owned?.applicationGroups) {
1036
+ const pending = [{ value: application, depth: 0 }], seen = new Set();
1037
+ while (pending.length) {
1038
+ s.check();
1039
+ const { value, depth } = pending.pop();
1040
+ if (!value || typeof value !== 'object')
1041
+ continue;
1042
+ if (depth > 200)
1043
+ throw new ApplicationGroupValueError('application-group-depth-limit');
1044
+ if (types.isProxy(value))
1045
+ throw new ApplicationGroupValueError('application-group-data-required');
1046
+ if (seen.has(value))
1047
+ continue;
1048
+ seen.add(value);
1049
+ const array = Array.isArray(value), prototype = Object.getPrototypeOf(value);
1050
+ if (array ? prototype !== Array.prototype : prototype !== Object.prototype && prototype !== null)
1051
+ throw new ApplicationGroupValueError('application-group-data-required');
1052
+ const keys = Reflect.ownKeys(value);
1053
+ s.budget.chargeWork(64 + keys.length * 32);
1054
+ const length = array ? Object.getOwnPropertyDescriptor(value, 'length').value : undefined;
1055
+ if (array && keys.length !== length + 1)
1056
+ throw new ApplicationGroupValueError('application-group-dense-array-required');
1057
+ for (const key of keys) {
1058
+ s.check();
1059
+ if (array && key === 'length')
1060
+ continue;
1061
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
1062
+ if (typeof key !== 'string' || !('value' in descriptor) || !descriptor.enumerable
1063
+ || array && (!/^(0|[1-9][0-9]*)$/.test(key) || Number(key) >= length))
1064
+ throw new ApplicationGroupValueError('application-group-data-required');
1065
+ pending.push({ value: descriptor.value, depth: depth + 1 });
1066
+ }
1067
+ }
1068
+ let copied;
1069
+ try {
1070
+ copied = directDataOwnership(s.budget).snapshot(application, s.check);
1071
+ }
1072
+ catch (error) {
1073
+ if (error instanceof TypeError)
1074
+ throw new ApplicationGroupValueError('application-group-data-required');
1075
+ throw error;
1076
+ }
1077
+ application = mapApplicationGroups(owned.applicationGroups, owned.projection, copied, 'to-native', s.check);
1078
+ }
1079
+ const payload = buildProjectionPayload(context, root, plan, application, options, s);
1080
+ const structural = matchDirectProjection(context, root, payload, options);
1081
+ if (structural.kind !== 'projection-match') {
1082
+ if (structural.kind === 'mismatch') {
1083
+ if (structural.rule === 'ordered-particle-language')
1084
+ throw new Stop('value-invalid', structural.rule, structural.schemaPath, structural.payloadPath);
1085
+ throw new Error('Internal projection expansion violated its source mapping');
1086
+ }
1087
+ throw new Stop(structural.kind, structural.rule, structural.schemaPath, structural.payloadPath);
1088
+ }
1089
+ const validated = assessProjectionScalars(context, structural, options, mapping);
1090
+ if (validated.kind !== 'projection-value')
1091
+ throw new Stop(validated.kind, validated.rule, validated.schemaPath, validated.payloadPath);
1092
+ const expanded = s.publish({ kind: 'projection-expanded', provenance: 'generated-direct-value', admitted: false, payload, validated });
1093
+ projectionExpansions.set(expanded, context);
1094
+ return expanded;
1095
+ });
1096
+ }
1097
+ /** Pure shape validation plus lexical reconstruction, followed by existing validators. */
1098
+ export function expandDirectValue(contract, suppliedMapping, application, options = {}) {
1099
+ const mapping = inspectDirectValueMapping(suppliedMapping, contract);
1100
+ return run(contract, options, s => {
1101
+ const plan = mappingProjections.get(mapping);
1102
+ if (!plan)
1103
+ throw new TypeError('Missing native mapping projection');
1104
+ const payload = buildProjectionPayload(inspectDirectOperation(contract).context, mapping.root.element, plan, application, options, s);
271
1105
  const structural = matchDirectOperation(contract, mapping.direction, payload, options);
272
1106
  if (structural.kind !== 'structural-match') {
273
1107
  if (structural.kind === 'mismatch')