@skmtc/core 0.38.0 → 0.40.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 (343) hide show
  1. package/esm/context/CoreContext.js +22 -8
  2. package/esm/context/GenerateContext.d.ts +5 -4
  3. package/esm/context/GenerateContext.js +110 -37
  4. package/esm/context/ParseContext.d.ts +9 -1
  5. package/esm/context/ParseContext.js +12 -1
  6. package/esm/context/generateTypes.d.ts +19 -4
  7. package/esm/context/generateTypes.js +2 -0
  8. package/esm/context/toGenerationFailure.d.ts +21 -0
  9. package/esm/context/toGenerationFailure.js +38 -0
  10. package/esm/dsl/CustomValue.d.ts +4 -0
  11. package/esm/dsl/CustomValue.js +8 -0
  12. package/esm/dsl/Definition.d.ts +10 -0
  13. package/esm/dsl/Definition.js +14 -0
  14. package/esm/dsl/PendingDefinition.d.ts +47 -0
  15. package/esm/dsl/PendingDefinition.js +83 -0
  16. package/esm/dsl/model/ModelDriver.d.ts +55 -1
  17. package/esm/dsl/model/ModelDriver.js +228 -51
  18. package/esm/dsl/model/toModelEntry.d.ts +1 -1
  19. package/esm/dsl/model/toModelEntry.js +1 -1
  20. package/esm/dsl/model/types.d.ts +1 -1
  21. package/esm/dsl/operation/gql/GqlOperationDriver.js +1 -4
  22. package/esm/dsl/webhook/WebhookDriver.js +1 -4
  23. package/esm/enrichments/parseEnrichmentUmbrella.d.ts +5 -6
  24. package/esm/enrichments/parseEnrichmentUmbrella.js +23 -8
  25. package/esm/enrichments/parseEnrichmentValue.d.ts +17 -0
  26. package/esm/enrichments/parseEnrichmentValue.js +32 -0
  27. package/esm/enrichments/readEnrichments.d.ts +5 -5
  28. package/esm/enrichments/readEnrichments.js +17 -7
  29. package/esm/mod.d.ts +1 -0
  30. package/esm/mod.js +1 -0
  31. package/esm/oas/array/Array.d.ts +19 -0
  32. package/esm/oas/array/Array.js +47 -0
  33. package/esm/oas/boolean/Boolean.d.ts +19 -0
  34. package/esm/oas/boolean/Boolean.js +51 -8
  35. package/esm/oas/example/Example.d.ts +4 -0
  36. package/esm/oas/example/Example.js +8 -0
  37. package/esm/oas/header/Header.d.ts +4 -0
  38. package/esm/oas/header/Header.js +8 -0
  39. package/esm/oas/integer/Integer.d.ts +19 -0
  40. package/esm/oas/integer/Integer.js +49 -0
  41. package/esm/oas/link/Link.d.ts +4 -0
  42. package/esm/oas/link/Link.js +8 -0
  43. package/esm/oas/number/Number.d.ts +19 -0
  44. package/esm/oas/number/Number.js +49 -0
  45. package/esm/oas/object/Object.d.ts +19 -0
  46. package/esm/oas/object/Object.js +68 -18
  47. package/esm/oas/operation/Operation.d.ts +5 -1
  48. package/esm/oas/operation/Operation.js +17 -5
  49. package/esm/oas/operation/toEffectiveParameters.d.ts +16 -0
  50. package/esm/oas/operation/toEffectiveParameters.js +13 -0
  51. package/esm/oas/parameter/Parameter.d.ts +4 -0
  52. package/esm/oas/parameter/Parameter.js +8 -0
  53. package/esm/oas/ref/Ref.d.ts +147 -25
  54. package/esm/oas/ref/Ref.js +387 -25
  55. package/esm/oas/requestBody/RequestBody.d.ts +4 -0
  56. package/esm/oas/requestBody/RequestBody.js +8 -0
  57. package/esm/oas/response/Response.d.ts +4 -0
  58. package/esm/oas/response/Response.js +8 -0
  59. package/esm/oas/schema/siblings.d.ts +127 -0
  60. package/esm/oas/schema/siblings.js +240 -0
  61. package/esm/oas/securitySchemes/SecurityScheme.d.ts +16 -0
  62. package/esm/oas/securitySchemes/SecurityScheme.js +32 -0
  63. package/esm/oas/string/String.d.ts +19 -0
  64. package/esm/oas/string/String.js +47 -0
  65. package/esm/oas/union/Union.d.ts +31 -0
  66. package/esm/oas/union/Union.js +100 -0
  67. package/esm/oas/unknown/Unknown.d.ts +18 -0
  68. package/esm/oas/unknown/Unknown.js +38 -0
  69. package/esm/oas/void/Void.d.ts +4 -0
  70. package/esm/oas/void/Void.js +8 -0
  71. package/esm/oas/webhook/Webhook.d.ts +2 -2
  72. package/esm/oas/webhook/Webhook.js +6 -5
  73. package/esm/parse/allOfSystem.d.ts +32 -0
  74. package/esm/parse/allOfSystem.js +30 -0
  75. package/esm/parse/anyOfSystem.d.ts +68 -0
  76. package/esm/parse/anyOfSystem.js +107 -0
  77. package/esm/parse/toSiblingKeywords.d.ts +28 -0
  78. package/esm/parse/toSiblingKeywords.js +109 -0
  79. package/esm/parse/v3-0/_merge-all-of/decompose-union.d.ts +8 -0
  80. package/esm/parse/v3-0/_merge-all-of/decompose-union.js +9 -1
  81. package/esm/parse/v3-0/_merge-all-of/generic-merge.d.ts +2 -3
  82. package/esm/parse/v3-0/_merge-all-of/generic-merge.js +2 -2
  83. package/esm/parse/v3-0/_merge-all-of/merge-array-constraints.d.ts +2 -2
  84. package/esm/parse/v3-0/_merge-all-of/merge-array-constraints.js +5 -5
  85. package/esm/parse/v3-0/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  86. package/esm/parse/v3-0/_merge-all-of/merge-boolean-constraints.js +2 -2
  87. package/esm/parse/v3-0/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  88. package/esm/parse/v3-0/_merge-all-of/merge-integer-constraints.js +2 -2
  89. package/esm/parse/v3-0/_merge-all-of/merge-intersection.d.ts +3 -2
  90. package/esm/parse/v3-0/_merge-all-of/merge-intersection.js +2 -2
  91. package/esm/parse/v3-0/_merge-all-of/merge-number-constraints.d.ts +2 -2
  92. package/esm/parse/v3-0/_merge-all-of/merge-number-constraints.js +2 -2
  93. package/esm/parse/v3-0/_merge-all-of/merge-object-constraints.d.ts +2 -2
  94. package/esm/parse/v3-0/_merge-all-of/merge-object-constraints.js +3 -3
  95. package/esm/parse/v3-0/_merge-all-of/merge-properties.d.ts +2 -2
  96. package/esm/parse/v3-0/_merge-all-of/merge-properties.js +2 -2
  97. package/esm/parse/v3-0/_merge-all-of/merge-string-constraints.d.ts +2 -2
  98. package/esm/parse/v3-0/_merge-all-of/merge-string-constraints.js +3 -3
  99. package/esm/parse/v3-0/_merge-all-of/merge-union.d.ts +10 -3
  100. package/esm/parse/v3-0/_merge-all-of/merge-union.js +50 -12
  101. package/esm/parse/v3-0/_merge-all-of/merge.d.ts +2 -2
  102. package/esm/parse/v3-0/_merge-all-of/merge.js +78 -27
  103. package/esm/parse/v3-0/_merge-all-of/nullable-merge.d.ts +4 -0
  104. package/esm/parse/v3-0/_merge-all-of/nullable-merge.js +9 -7
  105. package/esm/parse/v3-0/_merge-all-of/types.d.ts +33 -0
  106. package/esm/parse/v3-0/ref/toRefV31.d.ts +7 -1
  107. package/esm/parse/v3-0/ref/toRefV31.js +2 -2
  108. package/esm/parse/v3-0/schema/toSchemasV3.js +107 -15
  109. package/esm/parse/v3-1/_merge-all-of/decompose-union.d.ts +7 -1
  110. package/esm/parse/v3-1/_merge-all-of/decompose-union.js +8 -2
  111. package/esm/parse/v3-1/_merge-all-of/generic-merge.d.ts +2 -3
  112. package/esm/parse/v3-1/_merge-all-of/generic-merge.js +2 -2
  113. package/esm/parse/v3-1/_merge-all-of/merge-array-constraints.d.ts +3 -2
  114. package/esm/parse/v3-1/_merge-all-of/merge-array-constraints.js +5 -5
  115. package/esm/parse/v3-1/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  116. package/esm/parse/v3-1/_merge-all-of/merge-boolean-constraints.js +2 -2
  117. package/esm/parse/v3-1/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  118. package/esm/parse/v3-1/_merge-all-of/merge-integer-constraints.js +2 -2
  119. package/esm/parse/v3-1/_merge-all-of/merge-intersection.d.ts +3 -2
  120. package/esm/parse/v3-1/_merge-all-of/merge-intersection.js +2 -2
  121. package/esm/parse/v3-1/_merge-all-of/merge-number-constraints.d.ts +2 -2
  122. package/esm/parse/v3-1/_merge-all-of/merge-number-constraints.js +2 -2
  123. package/esm/parse/v3-1/_merge-all-of/merge-object-constraints.d.ts +2 -2
  124. package/esm/parse/v3-1/_merge-all-of/merge-object-constraints.js +3 -3
  125. package/esm/parse/v3-1/_merge-all-of/merge-properties.d.ts +2 -2
  126. package/esm/parse/v3-1/_merge-all-of/merge-properties.js +2 -2
  127. package/esm/parse/v3-1/_merge-all-of/merge-string-constraints.d.ts +2 -2
  128. package/esm/parse/v3-1/_merge-all-of/merge-string-constraints.js +3 -3
  129. package/esm/parse/v3-1/_merge-all-of/merge-union.d.ts +10 -3
  130. package/esm/parse/v3-1/_merge-all-of/merge-union.js +54 -15
  131. package/esm/parse/v3-1/_merge-all-of/merge.d.ts +3 -2
  132. package/esm/parse/v3-1/_merge-all-of/merge.js +88 -29
  133. package/esm/parse/v3-1/_merge-all-of/nullable-merge.d.ts +4 -0
  134. package/esm/parse/v3-1/_merge-all-of/nullable-merge.js +9 -7
  135. package/esm/parse/v3-1/_merge-all-of/types.d.ts +37 -0
  136. package/esm/parse/v3-1/ref/toRefV31.d.ts +7 -1
  137. package/esm/parse/v3-1/ref/toRefV31.js +2 -2
  138. package/esm/parse/v3-1/schema/toSchemasV3.js +111 -16
  139. package/esm/parse/v3-2/_merge-all-of/decompose-union.d.ts +7 -1
  140. package/esm/parse/v3-2/_merge-all-of/decompose-union.js +8 -2
  141. package/esm/parse/v3-2/_merge-all-of/generic-merge.d.ts +2 -3
  142. package/esm/parse/v3-2/_merge-all-of/generic-merge.js +2 -2
  143. package/esm/parse/v3-2/_merge-all-of/merge-array-constraints.d.ts +3 -2
  144. package/esm/parse/v3-2/_merge-all-of/merge-array-constraints.js +5 -5
  145. package/esm/parse/v3-2/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  146. package/esm/parse/v3-2/_merge-all-of/merge-boolean-constraints.js +2 -2
  147. package/esm/parse/v3-2/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  148. package/esm/parse/v3-2/_merge-all-of/merge-integer-constraints.js +2 -2
  149. package/esm/parse/v3-2/_merge-all-of/merge-intersection.d.ts +3 -2
  150. package/esm/parse/v3-2/_merge-all-of/merge-intersection.js +2 -2
  151. package/esm/parse/v3-2/_merge-all-of/merge-number-constraints.d.ts +2 -2
  152. package/esm/parse/v3-2/_merge-all-of/merge-number-constraints.js +2 -2
  153. package/esm/parse/v3-2/_merge-all-of/merge-object-constraints.d.ts +2 -2
  154. package/esm/parse/v3-2/_merge-all-of/merge-object-constraints.js +3 -3
  155. package/esm/parse/v3-2/_merge-all-of/merge-properties.d.ts +2 -2
  156. package/esm/parse/v3-2/_merge-all-of/merge-properties.js +2 -2
  157. package/esm/parse/v3-2/_merge-all-of/merge-string-constraints.d.ts +2 -2
  158. package/esm/parse/v3-2/_merge-all-of/merge-string-constraints.js +3 -3
  159. package/esm/parse/v3-2/_merge-all-of/merge-union.d.ts +10 -3
  160. package/esm/parse/v3-2/_merge-all-of/merge-union.js +54 -15
  161. package/esm/parse/v3-2/_merge-all-of/merge.d.ts +3 -2
  162. package/esm/parse/v3-2/_merge-all-of/merge.js +88 -29
  163. package/esm/parse/v3-2/_merge-all-of/nullable-merge.d.ts +4 -0
  164. package/esm/parse/v3-2/_merge-all-of/nullable-merge.js +9 -7
  165. package/esm/parse/v3-2/_merge-all-of/types.d.ts +37 -0
  166. package/esm/parse/v3-2/ref/toRefV31.d.ts +7 -1
  167. package/esm/parse/v3-2/ref/toRefV31.js +2 -2
  168. package/esm/parse/v3-2/schema/toSchemasV3.js +111 -16
  169. package/esm/types/OasBase.d.ts +1 -1
  170. package/esm/types/Settings.d.ts +34 -0
  171. package/esm/types/Settings.js +8 -0
  172. package/package.json +1 -1
  173. package/script/context/CoreContext.js +22 -8
  174. package/script/context/GenerateContext.d.ts +5 -4
  175. package/script/context/GenerateContext.js +110 -37
  176. package/script/context/ParseContext.d.ts +9 -1
  177. package/script/context/ParseContext.js +12 -1
  178. package/script/context/generateTypes.d.ts +19 -4
  179. package/script/context/generateTypes.js +2 -0
  180. package/script/context/toGenerationFailure.d.ts +21 -0
  181. package/script/context/toGenerationFailure.js +43 -0
  182. package/script/dsl/CustomValue.d.ts +4 -0
  183. package/script/dsl/CustomValue.js +8 -0
  184. package/script/dsl/Definition.d.ts +10 -0
  185. package/script/dsl/Definition.js +14 -0
  186. package/script/dsl/PendingDefinition.d.ts +47 -0
  187. package/script/dsl/PendingDefinition.js +87 -0
  188. package/script/dsl/model/ModelDriver.d.ts +55 -1
  189. package/script/dsl/model/ModelDriver.js +231 -52
  190. package/script/dsl/model/toModelEntry.d.ts +1 -1
  191. package/script/dsl/model/toModelEntry.js +1 -1
  192. package/script/dsl/model/types.d.ts +1 -1
  193. package/script/dsl/operation/gql/GqlOperationDriver.js +1 -4
  194. package/script/dsl/webhook/WebhookDriver.js +1 -4
  195. package/script/enrichments/parseEnrichmentUmbrella.d.ts +5 -6
  196. package/script/enrichments/parseEnrichmentUmbrella.js +23 -41
  197. package/script/enrichments/parseEnrichmentValue.d.ts +17 -0
  198. package/script/enrichments/parseEnrichmentValue.js +69 -0
  199. package/script/enrichments/readEnrichments.d.ts +5 -5
  200. package/script/enrichments/readEnrichments.js +17 -40
  201. package/script/mod.d.ts +1 -0
  202. package/script/mod.js +1 -0
  203. package/script/oas/array/Array.d.ts +19 -0
  204. package/script/oas/array/Array.js +47 -0
  205. package/script/oas/boolean/Boolean.d.ts +19 -0
  206. package/script/oas/boolean/Boolean.js +51 -8
  207. package/script/oas/example/Example.d.ts +4 -0
  208. package/script/oas/example/Example.js +8 -0
  209. package/script/oas/header/Header.d.ts +4 -0
  210. package/script/oas/header/Header.js +8 -0
  211. package/script/oas/integer/Integer.d.ts +19 -0
  212. package/script/oas/integer/Integer.js +49 -0
  213. package/script/oas/link/Link.d.ts +4 -0
  214. package/script/oas/link/Link.js +8 -0
  215. package/script/oas/number/Number.d.ts +19 -0
  216. package/script/oas/number/Number.js +49 -0
  217. package/script/oas/object/Object.d.ts +19 -0
  218. package/script/oas/object/Object.js +68 -18
  219. package/script/oas/operation/Operation.d.ts +5 -1
  220. package/script/oas/operation/Operation.js +17 -5
  221. package/script/oas/operation/toEffectiveParameters.d.ts +16 -0
  222. package/script/oas/operation/toEffectiveParameters.js +17 -0
  223. package/script/oas/parameter/Parameter.d.ts +4 -0
  224. package/script/oas/parameter/Parameter.js +8 -0
  225. package/script/oas/ref/Ref.d.ts +147 -25
  226. package/script/oas/ref/Ref.js +387 -25
  227. package/script/oas/requestBody/RequestBody.d.ts +4 -0
  228. package/script/oas/requestBody/RequestBody.js +8 -0
  229. package/script/oas/response/Response.d.ts +4 -0
  230. package/script/oas/response/Response.js +8 -0
  231. package/script/oas/schema/siblings.d.ts +127 -0
  232. package/script/oas/schema/siblings.js +295 -0
  233. package/script/oas/securitySchemes/SecurityScheme.d.ts +16 -0
  234. package/script/oas/securitySchemes/SecurityScheme.js +32 -0
  235. package/script/oas/string/String.d.ts +19 -0
  236. package/script/oas/string/String.js +47 -0
  237. package/script/oas/union/Union.d.ts +31 -0
  238. package/script/oas/union/Union.js +100 -0
  239. package/script/oas/unknown/Unknown.d.ts +18 -0
  240. package/script/oas/unknown/Unknown.js +38 -0
  241. package/script/oas/void/Void.d.ts +4 -0
  242. package/script/oas/void/Void.js +8 -0
  243. package/script/oas/webhook/Webhook.d.ts +2 -2
  244. package/script/oas/webhook/Webhook.js +6 -5
  245. package/script/parse/allOfSystem.d.ts +32 -0
  246. package/script/parse/allOfSystem.js +35 -0
  247. package/script/parse/anyOfSystem.d.ts +68 -0
  248. package/script/parse/anyOfSystem.js +116 -0
  249. package/script/parse/toSiblingKeywords.d.ts +28 -0
  250. package/script/parse/toSiblingKeywords.js +146 -0
  251. package/script/parse/v3-0/_merge-all-of/decompose-union.d.ts +8 -0
  252. package/script/parse/v3-0/_merge-all-of/decompose-union.js +11 -2
  253. package/script/parse/v3-0/_merge-all-of/generic-merge.d.ts +2 -3
  254. package/script/parse/v3-0/_merge-all-of/generic-merge.js +2 -2
  255. package/script/parse/v3-0/_merge-all-of/merge-array-constraints.d.ts +2 -2
  256. package/script/parse/v3-0/_merge-all-of/merge-array-constraints.js +5 -5
  257. package/script/parse/v3-0/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  258. package/script/parse/v3-0/_merge-all-of/merge-boolean-constraints.js +2 -2
  259. package/script/parse/v3-0/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  260. package/script/parse/v3-0/_merge-all-of/merge-integer-constraints.js +2 -2
  261. package/script/parse/v3-0/_merge-all-of/merge-intersection.d.ts +3 -2
  262. package/script/parse/v3-0/_merge-all-of/merge-intersection.js +2 -2
  263. package/script/parse/v3-0/_merge-all-of/merge-number-constraints.d.ts +2 -2
  264. package/script/parse/v3-0/_merge-all-of/merge-number-constraints.js +2 -2
  265. package/script/parse/v3-0/_merge-all-of/merge-object-constraints.d.ts +2 -2
  266. package/script/parse/v3-0/_merge-all-of/merge-object-constraints.js +3 -3
  267. package/script/parse/v3-0/_merge-all-of/merge-properties.d.ts +2 -2
  268. package/script/parse/v3-0/_merge-all-of/merge-properties.js +2 -2
  269. package/script/parse/v3-0/_merge-all-of/merge-string-constraints.d.ts +2 -2
  270. package/script/parse/v3-0/_merge-all-of/merge-string-constraints.js +3 -3
  271. package/script/parse/v3-0/_merge-all-of/merge-union.d.ts +10 -3
  272. package/script/parse/v3-0/_merge-all-of/merge-union.js +52 -13
  273. package/script/parse/v3-0/_merge-all-of/merge.d.ts +2 -2
  274. package/script/parse/v3-0/_merge-all-of/merge.js +77 -26
  275. package/script/parse/v3-0/_merge-all-of/nullable-merge.d.ts +4 -0
  276. package/script/parse/v3-0/_merge-all-of/nullable-merge.js +9 -7
  277. package/script/parse/v3-0/_merge-all-of/types.d.ts +33 -0
  278. package/script/parse/v3-0/ref/toRefV31.d.ts +7 -1
  279. package/script/parse/v3-0/ref/toRefV31.js +2 -2
  280. package/script/parse/v3-0/schema/toSchemasV3.js +107 -15
  281. package/script/parse/v3-1/_merge-all-of/decompose-union.d.ts +7 -1
  282. package/script/parse/v3-1/_merge-all-of/decompose-union.js +8 -2
  283. package/script/parse/v3-1/_merge-all-of/generic-merge.d.ts +2 -3
  284. package/script/parse/v3-1/_merge-all-of/generic-merge.js +2 -2
  285. package/script/parse/v3-1/_merge-all-of/merge-array-constraints.d.ts +3 -2
  286. package/script/parse/v3-1/_merge-all-of/merge-array-constraints.js +5 -5
  287. package/script/parse/v3-1/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  288. package/script/parse/v3-1/_merge-all-of/merge-boolean-constraints.js +2 -2
  289. package/script/parse/v3-1/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  290. package/script/parse/v3-1/_merge-all-of/merge-integer-constraints.js +2 -2
  291. package/script/parse/v3-1/_merge-all-of/merge-intersection.d.ts +3 -2
  292. package/script/parse/v3-1/_merge-all-of/merge-intersection.js +2 -2
  293. package/script/parse/v3-1/_merge-all-of/merge-number-constraints.d.ts +2 -2
  294. package/script/parse/v3-1/_merge-all-of/merge-number-constraints.js +2 -2
  295. package/script/parse/v3-1/_merge-all-of/merge-object-constraints.d.ts +2 -2
  296. package/script/parse/v3-1/_merge-all-of/merge-object-constraints.js +3 -3
  297. package/script/parse/v3-1/_merge-all-of/merge-properties.d.ts +2 -2
  298. package/script/parse/v3-1/_merge-all-of/merge-properties.js +2 -2
  299. package/script/parse/v3-1/_merge-all-of/merge-string-constraints.d.ts +2 -2
  300. package/script/parse/v3-1/_merge-all-of/merge-string-constraints.js +3 -3
  301. package/script/parse/v3-1/_merge-all-of/merge-union.d.ts +10 -3
  302. package/script/parse/v3-1/_merge-all-of/merge-union.js +56 -16
  303. package/script/parse/v3-1/_merge-all-of/merge.d.ts +3 -2
  304. package/script/parse/v3-1/_merge-all-of/merge.js +87 -28
  305. package/script/parse/v3-1/_merge-all-of/nullable-merge.d.ts +4 -0
  306. package/script/parse/v3-1/_merge-all-of/nullable-merge.js +9 -7
  307. package/script/parse/v3-1/_merge-all-of/types.d.ts +37 -0
  308. package/script/parse/v3-1/ref/toRefV31.d.ts +7 -1
  309. package/script/parse/v3-1/ref/toRefV31.js +2 -2
  310. package/script/parse/v3-1/schema/toSchemasV3.js +111 -16
  311. package/script/parse/v3-2/_merge-all-of/decompose-union.d.ts +7 -1
  312. package/script/parse/v3-2/_merge-all-of/decompose-union.js +8 -2
  313. package/script/parse/v3-2/_merge-all-of/generic-merge.d.ts +2 -3
  314. package/script/parse/v3-2/_merge-all-of/generic-merge.js +2 -2
  315. package/script/parse/v3-2/_merge-all-of/merge-array-constraints.d.ts +3 -2
  316. package/script/parse/v3-2/_merge-all-of/merge-array-constraints.js +5 -5
  317. package/script/parse/v3-2/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  318. package/script/parse/v3-2/_merge-all-of/merge-boolean-constraints.js +2 -2
  319. package/script/parse/v3-2/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  320. package/script/parse/v3-2/_merge-all-of/merge-integer-constraints.js +2 -2
  321. package/script/parse/v3-2/_merge-all-of/merge-intersection.d.ts +3 -2
  322. package/script/parse/v3-2/_merge-all-of/merge-intersection.js +2 -2
  323. package/script/parse/v3-2/_merge-all-of/merge-number-constraints.d.ts +2 -2
  324. package/script/parse/v3-2/_merge-all-of/merge-number-constraints.js +2 -2
  325. package/script/parse/v3-2/_merge-all-of/merge-object-constraints.d.ts +2 -2
  326. package/script/parse/v3-2/_merge-all-of/merge-object-constraints.js +3 -3
  327. package/script/parse/v3-2/_merge-all-of/merge-properties.d.ts +2 -2
  328. package/script/parse/v3-2/_merge-all-of/merge-properties.js +2 -2
  329. package/script/parse/v3-2/_merge-all-of/merge-string-constraints.d.ts +2 -2
  330. package/script/parse/v3-2/_merge-all-of/merge-string-constraints.js +3 -3
  331. package/script/parse/v3-2/_merge-all-of/merge-union.d.ts +10 -3
  332. package/script/parse/v3-2/_merge-all-of/merge-union.js +56 -16
  333. package/script/parse/v3-2/_merge-all-of/merge.d.ts +3 -2
  334. package/script/parse/v3-2/_merge-all-of/merge.js +87 -28
  335. package/script/parse/v3-2/_merge-all-of/nullable-merge.d.ts +4 -0
  336. package/script/parse/v3-2/_merge-all-of/nullable-merge.js +9 -7
  337. package/script/parse/v3-2/_merge-all-of/types.d.ts +37 -0
  338. package/script/parse/v3-2/ref/toRefV31.d.ts +7 -1
  339. package/script/parse/v3-2/ref/toRefV31.js +2 -2
  340. package/script/parse/v3-2/schema/toSchemasV3.js +111 -16
  341. package/script/types/OasBase.d.ts +1 -1
  342. package/script/types/Settings.d.ts +34 -0
  343. package/script/types/Settings.js +9 -1
@@ -13,11 +13,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
- var _GenerateContext_instances, _GenerateContext_files, _GenerateContext_previews, _GenerateContext_captureChannel, _GenerateContext_enrichmentAudit, _GenerateContext_currentSubjectTrail, _GenerateContext_reportSkippedEnrichment, _GenerateContext_logError, _GenerateContext_schemaRefNames, _GenerateContext_subjectDefaults, _GenerateContext_runOasOperationGenerator, _GenerateContext_runWebhookGenerator, _GenerateContext_runGqlOperationGenerator, _GenerateContext_runModelGenerator, _GenerateContext_addPreview, _GenerateContext_toContentSettingsExportPath, _GenerateContext_ejectedBySuffixedPath_get, _GenerateContext_ejectedBySuffixedPathCache, _GenerateContext_findContainer, _GenerateContext_toContainer;
16
+ var _GenerateContext_instances, _GenerateContext_files, _GenerateContext_failedItems, _GenerateContext_foldedPaths, _GenerateContext_previews, _GenerateContext_captureChannel, _GenerateContext_enrichmentAudit, _GenerateContext_currentSubjectTrail, _GenerateContext_reportSkippedEnrichment, _GenerateContext_logError, _GenerateContext_failItem, _GenerateContext_schemaRefNames, _GenerateContext_subjectDefaults, _GenerateContext_runOasOperationGenerator, _GenerateContext_runWebhookGenerator, _GenerateContext_runGqlOperationGenerator, _GenerateContext_runModelGenerator, _GenerateContext_addPreview, _GenerateContext_toContentSettingsExportPath, _GenerateContext_ejectedBySuffixedPath_get, _GenerateContext_ejectedBySuffixedPathCache, _GenerateContext_findContainer, _GenerateContext_toContainer;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.toModelSource = exports.toGqlOperationSource = exports.toWebhookSource = exports.toOasOperationSource = exports.GenerateContext = void 0;
19
19
  const normalizeWorkspacePath_js_1 = require("../helpers/normalizeWorkspacePath.js");
20
20
  const applyGeneratedSuffix_js_1 = require("../helpers/applyGeneratedSuffix.js");
21
+ const Method_js_1 = require("../types/Method.js");
21
22
  const OasOperationDriver_js_1 = require("../dsl/operation/oas/OasOperationDriver.js");
22
23
  const WebhookDriver_js_1 = require("../dsl/webhook/WebhookDriver.js");
23
24
  const GqlOperationDriver_js_1 = require("../dsl/operation/gql/GqlOperationDriver.js");
@@ -36,6 +37,7 @@ const MarkdownFile_js_1 = require("../dsl/MarkdownFile.js");
36
37
  const tiny_invariant_1 = __importDefault(require("tiny-invariant"));
37
38
  const EnrichmentAudit_js_1 = require("../enrichments/EnrichmentAudit.js");
38
39
  const SerializedError_js_1 = require("../types/SerializedError.js");
40
+ const toGenerationFailure_js_1 = require("./toGenerationFailure.js");
39
41
  const EnrichmentWarning_js_1 = require("../enrichments/EnrichmentWarning.js");
40
42
  /**
41
43
  * The generation context for the second phase of the SKMTC transformation pipeline.
@@ -89,6 +91,12 @@ class GenerateContext {
89
91
  constructor({ document, settings, logger, captureCurrentResult, toGeneratorConfigMap, captureChannel }) {
90
92
  _GenerateContext_instances.add(this);
91
93
  _GenerateContext_files.set(this, void 0);
94
+ /** Each subject whose generation threw: its trail and the error message. */
95
+ _GenerateContext_failedItems.set(this, []
96
+ /** Each file's path folded (case, Unicode form) → the path: a file system that ignores case sees one file. */
97
+ );
98
+ /** Each file's path folded (case, Unicode form) → the path: a file system that ignores case sees one file. */
99
+ _GenerateContext_foldedPaths.set(this, new Map());
92
100
  _GenerateContext_previews.set(this, void 0);
93
101
  /**
94
102
  * Parsed source document, wrapped in the {@link SkmtcParsedDocument}
@@ -129,12 +137,12 @@ class GenerateContext {
129
137
  writable: true,
130
138
  value: void 0
131
139
  });
132
- /** Tracking model nesting depth to prevent infinite recursion */
133
- Object.defineProperty(this, "modelDepth", {
140
+ /** The pending models, outermost first: the last is the model whose projection constructor is running. */
141
+ Object.defineProperty(this, "pendingStack", {
134
142
  enumerable: true,
135
143
  configurable: true,
136
144
  writable: true,
137
- value: void 0
145
+ value: []
138
146
  });
139
147
  /**
140
148
  * Creates a new GenerateContext instance for the generation phase.
@@ -158,7 +166,6 @@ class GenerateContext {
158
166
  this.settings = settings;
159
167
  this.captureCurrentResult = captureCurrentResult;
160
168
  this.toGeneratorConfigMap = toGeneratorConfigMap;
161
- this.modelDepth = {};
162
169
  __classPrivateFieldSet(this, _GenerateContext_captureChannel, captureChannel, "f");
163
170
  __classPrivateFieldSet(this, _GenerateContext_enrichmentAudit, new EnrichmentAudit_js_1.EnrichmentAudit(), "f");
164
171
  }
@@ -234,18 +241,15 @@ class GenerateContext {
234
241
  // extracted below is applied per-operation in the run* arms.
235
242
  // (Whole-generator opt-out is `skip`. A bare-string `include`
236
243
  // entry carries no per-operation filter and is a no-op.)
237
- const skip = this.settings?.skip?.find((skip) => {
238
- return typeof skip === 'object' && Boolean(skip[generatorConfig.id]);
239
- });
244
+ // skmtc#330: every object entry for this generator, merged, not only the first one.
245
+ const skip = toGeneratorFilter(this.settings?.skip, generatorConfig.id);
240
246
  // Extract the per-generator include slice (if any). Same
241
247
  // dispatch shape as skip: object entries get matched by key,
242
248
  // string entries don't produce a per-op filter (they mean
243
249
  // "everything from this generator is included", which is
244
250
  // semantically equivalent to "no per-op filter" once the
245
251
  // whole-generator gate above has admitted us).
246
- const include = this.settings?.include?.find((entry) => {
247
- return typeof entry === 'object' && Boolean(entry[generatorConfig.id]);
248
- });
252
+ const include = toGeneratorFilter(this.settings?.include, generatorConfig.id);
249
253
  switch (generatorConfig.type) {
250
254
  case 'oasOperation':
251
255
  if (this.document.type !== 'oas') {
@@ -295,6 +299,13 @@ class GenerateContext {
295
299
  generators: generators.map(({ id, type }) => ({ id, type })),
296
300
  skippedGeneratorIds: (this.settings?.skip ?? []).filter((entry) => typeof entry === 'string')
297
301
  });
302
+ // Generation runs our code over a document parsing has already made
303
+ // safe, so an error here is a bug to fix, not data to tolerate: the run
304
+ // fails, and writes nothing. Every subject that failed is in the log
305
+ // and in the results.
306
+ if (__classPrivateFieldGet(this, _GenerateContext_failedItems, "f").length > 0) {
307
+ throw new toGenerationFailure_js_1.GenerationFailure(__classPrivateFieldGet(this, _GenerateContext_failedItems, "f"), enrichmentWarnings);
308
+ }
298
309
  return {
299
310
  files: __classPrivateFieldGet(this, _GenerateContext_files, "f"),
300
311
  previews: __classPrivateFieldGet(this, _GenerateContext_previews, "f"),
@@ -502,7 +513,16 @@ class GenerateContext {
502
513
  if (__classPrivateFieldGet(this, _GenerateContext_files, "f").has(normalizedPath)) {
503
514
  throw new Error(`File already exists: ${normalizedPath}`);
504
515
  }
516
+ // Two paths that differ only in case are one file on a file system that
517
+ // ignores case, as macOS's and Windows' do by default: writing the
518
+ // second would replace the first without a word.
519
+ const foldedPath = normalizedPath.normalize('NFD').toLowerCase();
520
+ const existingPath = __classPrivateFieldGet(this, _GenerateContext_foldedPaths, "f").get(foldedPath);
521
+ if (existingPath !== undefined) {
522
+ throw new Error(`File '${normalizedPath}' differs from '${existingPath}' only in case. On a file system that ignores case, as macOS's and Windows' do by default, they are one file.`);
523
+ }
505
524
  __classPrivateFieldGet(this, _GenerateContext_files, "f").set(normalizedPath, file);
525
+ __classPrivateFieldGet(this, _GenerateContext_foldedPaths, "f").set(foldedPath, normalizedPath);
506
526
  return file;
507
527
  }
508
528
  /**
@@ -640,10 +660,7 @@ class GenerateContext {
640
660
  // @TODO Using mapped types would help avoid generics casting
641
661
  return definition;
642
662
  }
643
- const cachedDefinition = this.findDefinition({
644
- name: fallbackName,
645
- exportPath: destinationPath
646
- });
663
+ const cachedDefinition = this.findDefinition({ name: fallbackName, exportPath: destinationPath });
647
664
  // @TODO add check to make sure retrieved definition
648
665
  // used same generator and same schema #SKM-47
649
666
  if (cachedDefinition) {
@@ -821,20 +838,34 @@ class GenerateContext {
821
838
  * @returns Matching schema or ref
822
839
  * @throws if schema is not found
823
840
  */
824
- resolveSchemaRefOnce(refName, generatorId) {
825
- this.modelDepth[`${generatorId}:${refName}`]++;
826
- const schema = this.document.type === 'oas'
827
- ? this.document.value.components?.schemas?.[refName]?.resolveOnce()
828
- : this.document.value.registry.schemas[refName];
829
- if (!schema) {
830
- throw new Error(`Schema not found: ${refName}`);
831
- }
832
- // GqlRegistry stores raw OasSchema | OasRef entries that we need to
833
- // resolve once for parity with the OAS code path.
834
- if (this.document.type === 'gql' && 'resolveOnce' in schema) {
835
- return schema.resolveOnce();
841
+ resolveSchemaRefOnce(refName) {
842
+ switch (this.document.type) {
843
+ case 'oas': {
844
+ const component = this.document.value.components?.schemas?.[refName];
845
+ if (!component) {
846
+ throw new Error(`Schema not found: ${refName}`);
847
+ }
848
+ const target = component.resolveOnce();
849
+ // One step, with what the component adds next to its reference
850
+ // (`{ allOf: [{ $ref: Name }], maxLength: 10, nullable: true }`)
851
+ // applied to a copy: the model is the target at this site. When the
852
+ // step is itself a reference, the copy is a reference, and the
853
+ // model's router decides whether it renders inline or by name.
854
+ return component.isRef() && component.hasSiblings() ? target.clone(component) : target;
855
+ }
856
+ case 'gql': {
857
+ const schema = this.document.value.registry.schemas[refName];
858
+ if (!schema) {
859
+ throw new Error(`Schema not found: ${refName}`);
860
+ }
861
+ // GqlRegistry stores OasSchema | OasRef entries: one step, as for OAS.
862
+ return schema.resolveOnce();
863
+ }
864
+ default: {
865
+ const _exhaustive = this.document;
866
+ throw new Error(`Unhandled document type: ${JSON.stringify(_exhaustive)}`);
867
+ }
836
868
  }
837
- return schema;
838
869
  }
839
870
  /**
840
871
  * Check if definition name `name` in file with path `exportPath`
@@ -860,7 +891,7 @@ class GenerateContext {
860
891
  }
861
892
  }
862
893
  exports.GenerateContext = GenerateContext;
863
- _GenerateContext_files = new WeakMap(), _GenerateContext_previews = new WeakMap(), _GenerateContext_captureChannel = new WeakMap(), _GenerateContext_enrichmentAudit = new WeakMap(), _GenerateContext_currentSubjectTrail = new WeakMap(), _GenerateContext_ejectedBySuffixedPathCache = new WeakMap(), _GenerateContext_instances = new WeakSet(), _GenerateContext_reportSkippedEnrichment = function _GenerateContext_reportSkippedEnrichment(block, variant, path) {
894
+ _GenerateContext_files = new WeakMap(), _GenerateContext_failedItems = new WeakMap(), _GenerateContext_foldedPaths = new WeakMap(), _GenerateContext_previews = new WeakMap(), _GenerateContext_captureChannel = new WeakMap(), _GenerateContext_enrichmentAudit = new WeakMap(), _GenerateContext_currentSubjectTrail = new WeakMap(), _GenerateContext_ejectedBySuffixedPathCache = new WeakMap(), _GenerateContext_instances = new WeakSet(), _GenerateContext_reportSkippedEnrichment = function _GenerateContext_reportSkippedEnrichment(block, variant, path) {
864
895
  if (!(0, EnrichmentAudit_js_1.hasVariantEnrichment)(block, variant))
865
896
  return;
866
897
  __classPrivateFieldGet(this, _GenerateContext_enrichmentAudit, "f").report({
@@ -872,6 +903,10 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_previews = new WeakMap(
872
903
  });
873
904
  }, _GenerateContext_logError = function _GenerateContext_logError(error) {
874
905
  this.logger.error((0, SerializedError_js_1.toSerializedError)(error).message, error);
906
+ }, _GenerateContext_failItem = function _GenerateContext_failItem(error, stackTrail) {
907
+ __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_logError).call(this, error);
908
+ this.captureCurrentResult('error', stackTrail);
909
+ __classPrivateFieldGet(this, _GenerateContext_failedItems, "f").push({ trail: `${stackTrail}`, message: (0, SerializedError_js_1.toSerializedError)(error).message });
875
910
  }, _GenerateContext_schemaRefNames = function _GenerateContext_schemaRefNames() {
876
911
  switch (this.document.type) {
877
912
  case 'oas':
@@ -978,8 +1013,7 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_previews = new WeakMap(
978
1013
  this.captureCurrentResult('success', st);
979
1014
  }
980
1015
  catch (error) {
981
- __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_logError).call(this, error);
982
- this.captureCurrentResult('error', st);
1016
+ __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_failItem).call(this, error, st);
983
1017
  }
984
1018
  }));
985
1019
  });
@@ -1059,8 +1093,7 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_previews = new WeakMap(
1059
1093
  this.captureCurrentResult('success', st);
1060
1094
  }
1061
1095
  catch (error) {
1062
- __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_logError).call(this, error);
1063
- this.captureCurrentResult('error', st);
1096
+ __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_failItem).call(this, error, st);
1064
1097
  }
1065
1098
  }));
1066
1099
  });
@@ -1103,8 +1136,7 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_previews = new WeakMap(
1103
1136
  this.captureCurrentResult('success', st);
1104
1137
  }
1105
1138
  catch (error) {
1106
- __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_logError).call(this, error);
1107
- this.captureCurrentResult('error', st);
1139
+ __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_failItem).call(this, error, st);
1108
1140
  }
1109
1141
  }));
1110
1142
  });
@@ -1178,8 +1210,7 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_previews = new WeakMap(
1178
1210
  this.captureCurrentResult('success', st);
1179
1211
  }
1180
1212
  catch (error) {
1181
- __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_logError).call(this, error);
1182
- this.captureCurrentResult('error', st);
1213
+ __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_failItem).call(this, error, st);
1183
1214
  }
1184
1215
  }));
1185
1216
  });
@@ -1341,6 +1372,48 @@ const toModelSource = ({ refName, generatorId, variant }) => ({
1341
1372
  variant
1342
1373
  });
1343
1374
  exports.toModelSource = toModelSource;
1375
+ /** Variants of one subject. `[]` is every variant, so it wins a merge. */
1376
+ const mergeVariants = (a, b) => a.length === 0 || b.length === 0 ? [] : [...new Set([...a, ...b])];
1377
+ /** Whether a filter is operation-shaped: its values are records of methods, not lists of variants. */
1378
+ const isPathsFilter = (filter) => Object.values(filter).every(value => !Array.isArray(value));
1379
+ const mergePathsFilters = (a, b) => Object.entries(b).reduce((merged, [path, methods]) => {
1380
+ const existing = merged[path] ?? {};
1381
+ const combined = Object.entries(methods).reduce((acc, [method, variants]) => {
1382
+ if (!(0, Method_js_1.isMethod)(method) || variants === undefined) {
1383
+ return acc;
1384
+ }
1385
+ const current = acc[method];
1386
+ return { ...acc, [method]: current === undefined ? variants : mergeVariants(current, variants) };
1387
+ }, { ...existing });
1388
+ return { ...merged, [path]: combined };
1389
+ }, { ...a });
1390
+ const mergeModelsFilters = (a, b) => Object.entries(b).reduce((merged, [refName, variants]) => {
1391
+ const current = merged[refName];
1392
+ return { ...merged, [refName]: current === undefined ? variants : mergeVariants(current, variants) };
1393
+ }, { ...a });
1394
+ /** Two filters of one generator, merged. Filters of two shapes cannot merge: the first stays. */
1395
+ const mergeFilters = (a, b) => {
1396
+ if (isPathsFilter(a) && isPathsFilter(b)) {
1397
+ return mergePathsFilters(a, b);
1398
+ }
1399
+ if (!isPathsFilter(a) && !isPathsFilter(b)) {
1400
+ return mergeModelsFilters(a, b);
1401
+ }
1402
+ return a;
1403
+ };
1404
+ /**
1405
+ * The `skip` or `include` filter of one generator: every object entry that
1406
+ * names it, merged (skmtc#330). Before, only the first entry applied, and a
1407
+ * later one was ignored with no warning. `undefined` when no entry names it.
1408
+ */
1409
+ const toGeneratorFilter = (entries, generatorId) => {
1410
+ const filters = (entries ?? []).flatMap(entry => {
1411
+ const filter = typeof entry === 'object' ? entry[generatorId] : undefined;
1412
+ return filter === undefined ? [] : [filter];
1413
+ });
1414
+ const [first, ...rest] = filters;
1415
+ return first === undefined ? undefined : { [generatorId]: rest.reduce(mergeFilters, first) };
1416
+ };
1344
1417
  const toSkipPaths = (skip, generatorId) => {
1345
1418
  const generatorSkip = skip?.[generatorId];
1346
1419
  // Operation-shaped entries have records-of-records at the inner
@@ -18,6 +18,7 @@
18
18
  import "../_dnt.polyfills.js";
19
19
  import type { OpenAPIV3 } from 'openapi-types';
20
20
  import { type GraphQLSchema } from 'graphql';
21
+ import type { SystemSettings } from '../types/Settings.js';
21
22
  import { OasDocument } from '../oas/document/Document.js';
22
23
  import { GqlRegistry } from '../gql/registry/GqlRegistry.js';
23
24
  import { GqlDocument } from '../gql/document/GqlDocument.js';
@@ -61,6 +62,8 @@ type ConstructorArgs = {
61
62
  options?: {
62
63
  gql?: GqlParseOptions;
63
64
  };
65
+ /** `client.json#settings.system`: how the OpenAPI parsers treat what they cannot read faithfully. */
66
+ system?: SystemSettings;
64
67
  };
65
68
  export declare class ParseContext {
66
69
  #private;
@@ -75,7 +78,12 @@ export declare class ParseContext {
75
78
  * `undefined` outside an active `withStackTrail` scope.
76
79
  */
77
80
  currentStackTrail: StackTrail | undefined;
78
- constructor({ input, logger, silent, options }: ConstructorArgs);
81
+ /**
82
+ * How the OpenAPI parsers treat what they cannot read faithfully
83
+ * (`client.json#settings.system`). Each setting left out is `strict`.
84
+ */
85
+ system: SystemSettings;
86
+ constructor({ input, logger, silent, options, system }: ConstructorArgs);
79
87
  /**
80
88
  * OAS-only accessor. Throws when called on a GQL-protocol context —
81
89
  * deliberate, because OAS parser code uses this and a misroute is a
@@ -63,7 +63,7 @@ const toParseIssue = (issue) => {
63
63
  }
64
64
  };
65
65
  class ParseContext {
66
- constructor({ input, logger, silent = true, options }) {
66
+ constructor({ input, logger, silent = true, options, system }) {
67
67
  _ParseContext_instances.add(this);
68
68
  Object.defineProperty(this, "issues", {
69
69
  enumerable: true,
@@ -101,6 +101,16 @@ class ParseContext {
101
101
  writable: true,
102
102
  value: void 0
103
103
  });
104
+ /**
105
+ * How the OpenAPI parsers treat what they cannot read faithfully
106
+ * (`client.json#settings.system`). Each setting left out is `strict`.
107
+ */
108
+ Object.defineProperty(this, "system", {
109
+ enumerable: true,
110
+ configurable: true,
111
+ writable: true,
112
+ value: void 0
113
+ });
104
114
  // Universal dependency-ref tracking. Populated by parsers as they
105
115
  // encounter references. OAS uses `$ref` strings as keys; GQL would
106
116
  // use type names. The maps don't care about the encoding.
@@ -120,6 +130,7 @@ class ParseContext {
120
130
  _ParseContext_rootFrames.set(this, []);
121
131
  this.logger = logger;
122
132
  this.silent = silent;
133
+ this.system = system ?? {};
123
134
  switch (input.type) {
124
135
  case 'oas': {
125
136
  this.protocol = {
@@ -6,6 +6,7 @@ import type { ResultsItem } from '../types/Results.js';
6
6
  import type { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';
7
7
  import type { GeneratedValue } from '../dsl/GeneratedValue.js';
8
8
  import type { DefinitionBase } from '../dsl/Definition.js';
9
+ import type { PendingDefinition } from '../dsl/PendingDefinition.js';
9
10
  import type { OasOperation } from '../oas/operation/Operation.js';
10
11
  import type { OasOperationProjection } from '../dsl/operation/oas/types.js';
11
12
  import type { OasWebhook } from '../oas/webhook/Webhook.js';
@@ -176,11 +177,19 @@ export type AnyOasDocument = OpenAPIV2.Document | OpenAPIV3.Document | OpenAPIV3
176
177
  * scalar schema (a text body or a file). A body with only specific
177
178
  * non-JSON types (`multipart/form-data`, `text/plain`) logs nothing.
178
179
  *
180
+ * `ALLOF_CONTRADICTION` (`warning`) — `allOf` members contradict, and
181
+ * `system.allOf: latestWins` kept the later member's keywords. One for each
182
+ * schema; the message names the keywords.
183
+ *
184
+ * `ANYOF_AS_UNKNOWN` (`warning`) — `system.anyOf: unknown` read an `anyOf`
185
+ * of two or more members as any value. The schema keeps its other keywords.
186
+ * One for each schema.
187
+ *
179
188
  * `RUN_FAILED` (`error`) — the run itself failed outside the per-item
180
189
  * catches. Its `location` names the entry and phase, for example
181
190
  * `toArtifacts:render`.
182
191
  */
183
- export type OasIssueType = 'UNEXPECTED_PROPERTY' | 'MISSING_OBJECT_TYPE' | 'MISSING_STRING_TYPE' | 'MISSING_ARRAY_TYPE' | 'MISSING_BOOLEAN_TYPE' | 'MISSING_RESPONSES' | 'MISSING_INFO' | 'EMPTY_PARAMETER' | 'INVALID_EXAMPLE' | 'INVALID_ENUM' | 'INVALID_DEFAULT' | 'INVALID_NULLABLE' | 'UNEXPECTED_FORMAT' | 'INVALID_RESPONSE' | 'INVALID_REQUEST_BODY' | 'INVALID_HEADER' | 'INVALID_FORMAT' | 'INVALID_OPERATION' | 'INVALID_SCHEMA' | 'INVALID_PARAMETER' | 'INVALID_SECURITY_SCHEME' | 'INVALID_DEPENDENCY_REF' | 'EXAMPLE_AND_EXAMPLES_DEFINED' | 'INVALID_TAG_PARENT' | 'INVALID_TAG' | 'INVALID_EXTERNAL_DOCS' | 'UNSUPPORTED_OPERATION_METHOD' | 'WILDCARD_MEDIA_TYPE' | 'NO_JSON_MEDIA_TYPE' | 'RUN_FAILED';
192
+ export type OasIssueType = 'UNEXPECTED_PROPERTY' | 'MISSING_OBJECT_TYPE' | 'MISSING_STRING_TYPE' | 'MISSING_ARRAY_TYPE' | 'MISSING_BOOLEAN_TYPE' | 'MISSING_RESPONSES' | 'MISSING_INFO' | 'EMPTY_PARAMETER' | 'INVALID_EXAMPLE' | 'INVALID_ENUM' | 'INVALID_DEFAULT' | 'INVALID_NULLABLE' | 'UNEXPECTED_FORMAT' | 'INVALID_RESPONSE' | 'INVALID_REQUEST_BODY' | 'INVALID_HEADER' | 'INVALID_FORMAT' | 'INVALID_OPERATION' | 'INVALID_SCHEMA' | 'INVALID_PARAMETER' | 'INVALID_SECURITY_SCHEME' | 'INVALID_DEPENDENCY_REF' | 'EXAMPLE_AND_EXAMPLES_DEFINED' | 'INVALID_TAG_PARENT' | 'INVALID_TAG' | 'INVALID_EXTERNAL_DOCS' | 'UNSUPPORTED_OPERATION_METHOD' | 'WILDCARD_MEDIA_TYPE' | 'NO_JSON_MEDIA_TYPE' | 'ALLOF_CONTRADICTION' | 'ANYOF_AS_UNKNOWN' | 'RUN_FAILED';
184
193
  /**
185
194
  * Valibot schema for {@link OasIssueType}. Annotation deliberately omitted
186
195
  * so the precise literal-union output type flows through to consumers
@@ -188,7 +197,7 @@ export type OasIssueType = 'UNEXPECTED_PROPERTY' | 'MISSING_OBJECT_TYPE' | 'MISS
188
197
  * this list and {@link OasIssueType} is caught by `assertSchemaMatchesType`
189
198
  * below.
190
199
  */
191
- export declare const oasIssueType: v.UnionSchema<[v.LiteralSchema<"UNEXPECTED_PROPERTY", undefined>, v.LiteralSchema<"MISSING_OBJECT_TYPE", undefined>, v.LiteralSchema<"MISSING_STRING_TYPE", undefined>, v.LiteralSchema<"MISSING_ARRAY_TYPE", undefined>, v.LiteralSchema<"MISSING_BOOLEAN_TYPE", undefined>, v.LiteralSchema<"MISSING_RESPONSES", undefined>, v.LiteralSchema<"MISSING_INFO", undefined>, v.LiteralSchema<"EMPTY_PARAMETER", undefined>, v.LiteralSchema<"INVALID_EXAMPLE", undefined>, v.LiteralSchema<"INVALID_ENUM", undefined>, v.LiteralSchema<"INVALID_DEFAULT", undefined>, v.LiteralSchema<"INVALID_NULLABLE", undefined>, v.LiteralSchema<"UNEXPECTED_FORMAT", undefined>, v.LiteralSchema<"INVALID_RESPONSE", undefined>, v.LiteralSchema<"INVALID_REQUEST_BODY", undefined>, v.LiteralSchema<"INVALID_HEADER", undefined>, v.LiteralSchema<"INVALID_FORMAT", undefined>, v.LiteralSchema<"INVALID_OPERATION", undefined>, v.LiteralSchema<"INVALID_SCHEMA", undefined>, v.LiteralSchema<"INVALID_PARAMETER", undefined>, v.LiteralSchema<"INVALID_SECURITY_SCHEME", undefined>, v.LiteralSchema<"INVALID_DEPENDENCY_REF", undefined>, v.LiteralSchema<"EXAMPLE_AND_EXAMPLES_DEFINED", undefined>, v.LiteralSchema<"INVALID_TAG_PARENT", undefined>, v.LiteralSchema<"INVALID_TAG", undefined>, v.LiteralSchema<"INVALID_EXTERNAL_DOCS", undefined>, v.LiteralSchema<"UNSUPPORTED_OPERATION_METHOD", undefined>, v.LiteralSchema<"WILDCARD_MEDIA_TYPE", undefined>, v.LiteralSchema<"NO_JSON_MEDIA_TYPE", undefined>, v.LiteralSchema<"RUN_FAILED", undefined>], undefined>;
200
+ export declare const oasIssueType: v.UnionSchema<[v.LiteralSchema<"UNEXPECTED_PROPERTY", undefined>, v.LiteralSchema<"MISSING_OBJECT_TYPE", undefined>, v.LiteralSchema<"MISSING_STRING_TYPE", undefined>, v.LiteralSchema<"MISSING_ARRAY_TYPE", undefined>, v.LiteralSchema<"MISSING_BOOLEAN_TYPE", undefined>, v.LiteralSchema<"MISSING_RESPONSES", undefined>, v.LiteralSchema<"MISSING_INFO", undefined>, v.LiteralSchema<"EMPTY_PARAMETER", undefined>, v.LiteralSchema<"INVALID_EXAMPLE", undefined>, v.LiteralSchema<"INVALID_ENUM", undefined>, v.LiteralSchema<"INVALID_DEFAULT", undefined>, v.LiteralSchema<"INVALID_NULLABLE", undefined>, v.LiteralSchema<"UNEXPECTED_FORMAT", undefined>, v.LiteralSchema<"INVALID_RESPONSE", undefined>, v.LiteralSchema<"INVALID_REQUEST_BODY", undefined>, v.LiteralSchema<"INVALID_HEADER", undefined>, v.LiteralSchema<"INVALID_FORMAT", undefined>, v.LiteralSchema<"INVALID_OPERATION", undefined>, v.LiteralSchema<"INVALID_SCHEMA", undefined>, v.LiteralSchema<"INVALID_PARAMETER", undefined>, v.LiteralSchema<"INVALID_SECURITY_SCHEME", undefined>, v.LiteralSchema<"INVALID_DEPENDENCY_REF", undefined>, v.LiteralSchema<"EXAMPLE_AND_EXAMPLES_DEFINED", undefined>, v.LiteralSchema<"INVALID_TAG_PARENT", undefined>, v.LiteralSchema<"INVALID_TAG", undefined>, v.LiteralSchema<"INVALID_EXTERNAL_DOCS", undefined>, v.LiteralSchema<"UNSUPPORTED_OPERATION_METHOD", undefined>, v.LiteralSchema<"WILDCARD_MEDIA_TYPE", undefined>, v.LiteralSchema<"NO_JSON_MEDIA_TYPE", undefined>, v.LiteralSchema<"ALLOF_CONTRADICTION", undefined>, v.LiteralSchema<"ANYOF_AS_UNKNOWN", undefined>, v.LiteralSchema<"RUN_FAILED", undefined>], undefined>;
192
201
  export type GenerateResult = {
193
202
  files: Map<string, FileBase>;
194
203
  previews: Record<string, Preview>;
@@ -415,7 +424,12 @@ export type GenerateContextType = {
415
424
  * subject's result to `'warning'` or `'error'`.
416
425
  */
417
426
  logger: Logger;
418
- modelDepth: Record<string, number>;
427
+ /**
428
+ * The pending models, outermost first: the last is the model whose
429
+ * projection constructor is running, the source of any reference made now.
430
+ * Kept by the `ModelDriver`.
431
+ */
432
+ pendingStack: PendingDefinition[];
419
433
  document: SkmtcParsedDocument;
420
434
  /**
421
435
  * Attribution (gen-maps) state. When set, every `SnippetBase`
@@ -451,7 +465,8 @@ export type GenerateContextType = {
451
465
  insertWebhook: <V extends GeneratedValue, EnrichmentType = undefined, ProjectionOptions = undefined>(args: InsertWebhookArgs<V, EnrichmentType, ProjectionOptions>) => Inserted<V, EnrichmentType>;
452
466
  toWebhookContentSettings: <V extends GeneratedValue, EnrichmentType, ProjectionOptions>(args: ToWebhookSettingsArgs<V, EnrichmentType, ProjectionOptions>) => ContentSettings<EnrichmentType>;
453
467
  toModelContentSettings: <V extends GeneratedValue, EnrichmentType, ProjectionOptions>(args: BuildModelSettingsArgs<V, EnrichmentType, ProjectionOptions>) => ContentSettings<EnrichmentType>;
454
- resolveSchemaRefOnce: (refName: RefName, generatorId: string) => OasSchema | OasRef<'schema'>;
468
+ resolveSchemaRefOnce: (refName: RefName) => OasSchema | OasRef<'schema'>;
469
+ /** The Definition named `name` in `exportPath` (or inside the declaration `into`), or `undefined`. */
455
470
  findDefinition: ({ name, exportPath, into }: FindDefinitionArgs) => DefinitionBase | undefined;
456
471
  /**
457
472
  * The recording enrichment accessor — the single choke point every
@@ -72,6 +72,8 @@ exports.oasIssueType = v.union([
72
72
  v.literal('UNSUPPORTED_OPERATION_METHOD'),
73
73
  v.literal('WILDCARD_MEDIA_TYPE'),
74
74
  v.literal('NO_JSON_MEDIA_TYPE'),
75
+ v.literal('ALLOF_CONTRADICTION'),
76
+ v.literal('ANYOF_AS_UNKNOWN'),
75
77
  v.literal('RUN_FAILED')
76
78
  ]);
77
79
  // Compile-time drift detector: this binding fails to type-check if
@@ -0,0 +1,21 @@
1
+ import type { EnrichmentWarning } from '../enrichments/EnrichmentWarning.js';
2
+ /** A subject whose generation threw: its trail and the error message. */
3
+ export type FailedItem = {
4
+ trail: string;
5
+ message: string;
6
+ };
7
+ /**
8
+ * The message of a run that failed in generate. Each distinct error is
9
+ * written once, with the subjects it failed: one wrong enrichment fails
10
+ * every subject that reads it, and the user needs to read it only once.
11
+ */
12
+ export declare const toGenerationFailure: (failedItems: readonly FailedItem[]) => string;
13
+ /**
14
+ * The error a run that failed in generate throws. It carries the
15
+ * enrichment warnings the audit found, since a misaddressed enrichment is
16
+ * often why a subject failed.
17
+ */
18
+ export declare class GenerationFailure extends Error {
19
+ enrichmentWarnings: EnrichmentWarning[];
20
+ constructor(failedItems: readonly FailedItem[], enrichmentWarnings: EnrichmentWarning[]);
21
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GenerationFailure = exports.toGenerationFailure = void 0;
4
+ /** How many trails each message lists before it counts the rest. */
5
+ const SHOWN_TRAILS = 5;
6
+ /**
7
+ * The message of a run that failed in generate. Each distinct error is
8
+ * written once, with the subjects it failed: one wrong enrichment fails
9
+ * every subject that reads it, and the user needs to read it only once.
10
+ */
11
+ const toGenerationFailure = (failedItems) => {
12
+ const byMessage = Map.groupBy(failedItems, ({ message }) => message);
13
+ const paragraphs = [...byMessage].map(([message, items]) => {
14
+ const trails = items.map(({ trail }) => ` in ${trail}`);
15
+ const hidden = trails.length - SHOWN_TRAILS;
16
+ return [
17
+ message,
18
+ ...trails.slice(0, SHOWN_TRAILS),
19
+ ...(hidden > 0 ? [` and ${hidden} more`] : [])
20
+ ].join('\n');
21
+ });
22
+ return `Generation failed for ${failedItems.length} subject(s):\n${paragraphs.join('\n\n')}`;
23
+ };
24
+ exports.toGenerationFailure = toGenerationFailure;
25
+ /**
26
+ * The error a run that failed in generate throws. It carries the
27
+ * enrichment warnings the audit found, since a misaddressed enrichment is
28
+ * often why a subject failed.
29
+ */
30
+ class GenerationFailure extends Error {
31
+ constructor(failedItems, enrichmentWarnings) {
32
+ super((0, exports.toGenerationFailure)(failedItems));
33
+ Object.defineProperty(this, "enrichmentWarnings", {
34
+ enumerable: true,
35
+ configurable: true,
36
+ writable: true,
37
+ value: void 0
38
+ });
39
+ this.name = 'GenerationFailure';
40
+ this.enrichmentWarnings = enrichmentWarnings;
41
+ }
42
+ }
43
+ exports.GenerationFailure = GenerationFailure;
@@ -44,6 +44,10 @@ export declare class CustomValue extends SnippetBase {
44
44
  * @returns Always false since custom values are concrete content, not references
45
45
  */
46
46
  isRef(): this is OasRef<'schema'>;
47
+ /** Always `false`: this value has no `readOnly`. */
48
+ isReadOnly(): boolean;
49
+ /** Always `false`: this value has no `writeOnly`. */
50
+ isWriteOnly(): boolean;
47
51
  /**
48
52
  * Resolves this custom value.
49
53
  *
@@ -53,6 +53,14 @@ class CustomValue extends SnippetBase_js_1.SnippetBase {
53
53
  isRef() {
54
54
  return false;
55
55
  }
56
+ /** Always `false`: this value has no `readOnly`. */
57
+ isReadOnly() {
58
+ return false;
59
+ }
60
+ /** Always `false`: this value has no `writeOnly`. */
61
+ isWriteOnly() {
62
+ return false;
63
+ }
56
64
  /**
57
65
  * Resolves this custom value.
58
66
  *
@@ -2,6 +2,7 @@ import type { GenerateContextType } from '../context/generateTypes.js';
2
2
  import type { IdentifierBase } from './IdentifierBase.js';
3
3
  import { SnippetBase } from './SnippetBase.js';
4
4
  import type { GeneratedValue } from './GeneratedValue.js';
5
+ import type { PendingDefinition } from './PendingDefinition.js';
5
6
  /**
6
7
  * Constructor arguments for {@link DefinitionBase}.
7
8
  *
@@ -35,6 +36,15 @@ export declare abstract class DefinitionBase<V extends GeneratedValue = Generate
35
36
  identifier: IdentifierBase;
36
37
  /** The generated value content */
37
38
  value: V;
39
+ /**
40
+ * The models this Definition's model reached while its projection was
41
+ * being constructed that were pending then: the models further up the
42
+ * stack it refers back to, directly or through the models it refers to.
43
+ * A reference to this model is inside a cycle while one of them is still
44
+ * pending. Set by the `ModelDriver`; `undefined` for a Definition it did
45
+ * not construct.
46
+ */
47
+ reaches: ReadonlySet<PendingDefinition> | undefined;
38
48
  constructor({ context, identifier, value }: DefinitionBaseArgs<V>);
39
49
  /** Renders the definition's code. Implemented by the concrete subclass. */
40
50
  abstract toString(): string;
@@ -34,6 +34,20 @@ class DefinitionBase extends SnippetBase_js_1.SnippetBase {
34
34
  writable: true,
35
35
  value: void 0
36
36
  });
37
+ /**
38
+ * The models this Definition's model reached while its projection was
39
+ * being constructed that were pending then: the models further up the
40
+ * stack it refers back to, directly or through the models it refers to.
41
+ * A reference to this model is inside a cycle while one of them is still
42
+ * pending. Set by the `ModelDriver`; `undefined` for a Definition it did
43
+ * not construct.
44
+ */
45
+ Object.defineProperty(this, "reaches", {
46
+ enumerable: true,
47
+ configurable: true,
48
+ writable: true,
49
+ value: void 0
50
+ });
37
51
  this.value = value;
38
52
  this.identifier = identifier;
39
53
  }
@@ -0,0 +1,47 @@
1
+ import type { IdentifierBase } from './IdentifierBase.js';
2
+ import type { GeneratorKey } from './GeneratorKeys.js';
3
+ type PendingDefinitionArgs = {
4
+ identifier: IdentifierBase;
5
+ exportPath: string;
6
+ generatorKey: GeneratorKey;
7
+ options: unknown;
8
+ projection: unknown;
9
+ };
10
+ /**
11
+ * A model whose projection is being constructed. The `ModelDriver` pushes it
12
+ * onto the context's `pendingStack` before it runs the projection's
13
+ * constructor, and pops it however the constructor ends, so the stack holds
14
+ * exactly the models under construction. The model's File does not see it:
15
+ * the Driver adds the Definition when the constructor returns.
16
+ *
17
+ * A reference to the model from inside that constructor (a cycle: the model
18
+ * refers to itself, or to a model that refers back to it) finds this entry,
19
+ * not a cache miss. `toModelRef` returns it suspended: the reference gets the
20
+ * model's identity, which is all a reference by name needs, and no value,
21
+ * which does not exist yet. A second projection for the model is never
22
+ * constructed.
23
+ */
24
+ export declare class PendingDefinition {
25
+ identifier: IdentifierBase;
26
+ /** The file the Definition will go to, normalized. */
27
+ exportPath: string;
28
+ /** The key the Definition will carry: the identity check runs on the entry too. */
29
+ generatorKey: GeneratorKey;
30
+ /** The caller's options the projection is constructed with: identity, like the key. */
31
+ options: unknown;
32
+ /** The projection class being constructed: another class under this name and file is a clash. */
33
+ projection: unknown;
34
+ /** How many references found the model under construction: references back to it. */
35
+ backReferences: number;
36
+ /** True while the projection's constructor runs; false once it returned, however it returned. */
37
+ pending: boolean;
38
+ /**
39
+ * The models this model's construction reached while they were under
40
+ * construction: the targets of its references back, and what the models it
41
+ * refers to reached. When the constructor returns, the Driver hands the set
42
+ * to the Definition (`DefinitionBase.reaches`).
43
+ */
44
+ reaches: Set<PendingDefinition>;
45
+ constructor({ identifier, exportPath, generatorKey, options, projection }: PendingDefinitionArgs);
46
+ }
47
+ export {};