@techspokes/typescript-wsdl-client 1.1.5 → 1.2.0

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