@techspokes/typescript-wsdl-client 1.1.4 → 1.1.8

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