@microsoft/api-extractor-model 7.32.1 → 7.33.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 (298) hide show
  1. package/CHANGELOG.json +29 -0
  2. package/CHANGELOG.md +13 -1
  3. package/dist/tsdoc-metadata.json +1 -1
  4. package/lib-esm/aedoc/AedocDefinitions.js +57 -0
  5. package/lib-esm/aedoc/AedocDefinitions.js.map +1 -0
  6. package/lib-esm/aedoc/ReleaseTag.js +87 -0
  7. package/lib-esm/aedoc/ReleaseTag.js.map +1 -0
  8. package/lib-esm/index.js +58 -0
  9. package/lib-esm/index.js.map +1 -0
  10. package/lib-esm/items/ApiDeclaredItem.js +137 -0
  11. package/lib-esm/items/ApiDeclaredItem.js.map +1 -0
  12. package/lib-esm/items/ApiDocumentedItem.js +48 -0
  13. package/lib-esm/items/ApiDocumentedItem.js.map +1 -0
  14. package/lib-esm/items/ApiItem.js +270 -0
  15. package/lib-esm/items/ApiItem.js.map +1 -0
  16. package/lib-esm/items/ApiPropertyItem.js +45 -0
  17. package/lib-esm/items/ApiPropertyItem.js.map +1 -0
  18. package/lib-esm/mixins/ApiAbstractMixin.js +58 -0
  19. package/lib-esm/mixins/ApiAbstractMixin.js.map +1 -0
  20. package/lib-esm/mixins/ApiExportedMixin.js +63 -0
  21. package/lib-esm/mixins/ApiExportedMixin.js.map +1 -0
  22. package/lib-esm/mixins/ApiInitializerMixin.js +70 -0
  23. package/lib-esm/mixins/ApiInitializerMixin.js.map +1 -0
  24. package/lib-esm/mixins/ApiItemContainerMixin.js +319 -0
  25. package/lib-esm/mixins/ApiItemContainerMixin.js.map +1 -0
  26. package/lib-esm/mixins/ApiNameMixin.js +61 -0
  27. package/lib-esm/mixins/ApiNameMixin.js.map +1 -0
  28. package/lib-esm/mixins/ApiOptionalMixin.js +57 -0
  29. package/lib-esm/mixins/ApiOptionalMixin.js.map +1 -0
  30. package/lib-esm/mixins/ApiParameterListMixin.js +93 -0
  31. package/lib-esm/mixins/ApiParameterListMixin.js.map +1 -0
  32. package/lib-esm/mixins/ApiProtectedMixin.js +57 -0
  33. package/lib-esm/mixins/ApiProtectedMixin.js.map +1 -0
  34. package/lib-esm/mixins/ApiReadonlyMixin.js +58 -0
  35. package/lib-esm/mixins/ApiReadonlyMixin.js.map +1 -0
  36. package/lib-esm/mixins/ApiReleaseTagMixin.js +65 -0
  37. package/lib-esm/mixins/ApiReleaseTagMixin.js.map +1 -0
  38. package/lib-esm/mixins/ApiReturnTypeMixin.js +65 -0
  39. package/lib-esm/mixins/ApiReturnTypeMixin.js.map +1 -0
  40. package/lib-esm/mixins/ApiStaticMixin.js +57 -0
  41. package/lib-esm/mixins/ApiStaticMixin.js.map +1 -0
  42. package/lib-esm/mixins/ApiTypeParameterListMixin.js +90 -0
  43. package/lib-esm/mixins/ApiTypeParameterListMixin.js.map +1 -0
  44. package/lib-esm/mixins/Excerpt.js +101 -0
  45. package/lib-esm/mixins/Excerpt.js.map +1 -0
  46. package/lib-esm/mixins/IFindApiItemsResult.js +26 -0
  47. package/lib-esm/mixins/IFindApiItemsResult.js.map +1 -0
  48. package/lib-esm/mixins/Mixin.js +4 -0
  49. package/lib-esm/mixins/Mixin.js.map +1 -0
  50. package/lib-esm/model/ApiCallSignature.js +63 -0
  51. package/lib-esm/model/ApiCallSignature.js.map +1 -0
  52. package/lib-esm/model/ApiClass.js +84 -0
  53. package/lib-esm/model/ApiClass.js.map +1 -0
  54. package/lib-esm/model/ApiConstructSignature.js +76 -0
  55. package/lib-esm/model/ApiConstructSignature.js.map +1 -0
  56. package/lib-esm/model/ApiConstructor.js +60 -0
  57. package/lib-esm/model/ApiConstructor.js.map +1 -0
  58. package/lib-esm/model/ApiEntryPoint.js +71 -0
  59. package/lib-esm/model/ApiEntryPoint.js.map +1 -0
  60. package/lib-esm/model/ApiEnum.js +65 -0
  61. package/lib-esm/model/ApiEnum.js.map +1 -0
  62. package/lib-esm/model/ApiEnumMember.js +80 -0
  63. package/lib-esm/model/ApiEnumMember.js.map +1 -0
  64. package/lib-esm/model/ApiFunction.js +58 -0
  65. package/lib-esm/model/ApiFunction.js.map +1 -0
  66. package/lib-esm/model/ApiIndexSignature.js +56 -0
  67. package/lib-esm/model/ApiIndexSignature.js.map +1 -0
  68. package/lib-esm/model/ApiInterface.js +73 -0
  69. package/lib-esm/model/ApiInterface.js.map +1 -0
  70. package/lib-esm/model/ApiMethod.js +65 -0
  71. package/lib-esm/model/ApiMethod.js.map +1 -0
  72. package/lib-esm/model/ApiMethodSignature.js +57 -0
  73. package/lib-esm/model/ApiMethodSignature.js.map +1 -0
  74. package/lib-esm/model/ApiModel.js +170 -0
  75. package/lib-esm/model/ApiModel.js.map +1 -0
  76. package/lib-esm/model/ApiNamespace.js +56 -0
  77. package/lib-esm/model/ApiNamespace.js.map +1 -0
  78. package/lib-esm/model/ApiPackage.js +148 -0
  79. package/lib-esm/model/ApiPackage.js.map +1 -0
  80. package/lib-esm/model/ApiProperty.js +72 -0
  81. package/lib-esm/model/ApiProperty.js.map +1 -0
  82. package/lib-esm/model/ApiPropertySignature.js +51 -0
  83. package/lib-esm/model/ApiPropertySignature.js.map +1 -0
  84. package/lib-esm/model/ApiTypeAlias.js +71 -0
  85. package/lib-esm/model/ApiTypeAlias.js.map +1 -0
  86. package/lib-esm/model/ApiVariable.js +66 -0
  87. package/lib-esm/model/ApiVariable.js.map +1 -0
  88. package/lib-esm/model/Deserializer.js +88 -0
  89. package/lib-esm/model/Deserializer.js.map +1 -0
  90. package/lib-esm/model/DeserializerContext.js +111 -0
  91. package/lib-esm/model/DeserializerContext.js.map +1 -0
  92. package/lib-esm/model/HeritageType.js +25 -0
  93. package/lib-esm/model/HeritageType.js.map +1 -0
  94. package/lib-esm/model/ModelReferenceResolver.js +177 -0
  95. package/lib-esm/model/ModelReferenceResolver.js.map +1 -0
  96. package/lib-esm/model/Parameter.js +39 -0
  97. package/lib-esm/model/Parameter.js.map +1 -0
  98. package/lib-esm/model/SourceLocation.js +35 -0
  99. package/lib-esm/model/SourceLocation.js.map +1 -0
  100. package/lib-esm/model/TypeParameter.js +49 -0
  101. package/lib-esm/model/TypeParameter.js.map +1 -0
  102. package/package.json +27 -5
  103. /package/{lib → lib-commonjs}/aedoc/AedocDefinitions.js +0 -0
  104. /package/{lib → lib-commonjs}/aedoc/AedocDefinitions.js.map +0 -0
  105. /package/{lib → lib-commonjs}/aedoc/ReleaseTag.js +0 -0
  106. /package/{lib → lib-commonjs}/aedoc/ReleaseTag.js.map +0 -0
  107. /package/{lib → lib-commonjs}/index.js +0 -0
  108. /package/{lib → lib-commonjs}/index.js.map +0 -0
  109. /package/{lib → lib-commonjs}/items/ApiDeclaredItem.js +0 -0
  110. /package/{lib → lib-commonjs}/items/ApiDeclaredItem.js.map +0 -0
  111. /package/{lib → lib-commonjs}/items/ApiDocumentedItem.js +0 -0
  112. /package/{lib → lib-commonjs}/items/ApiDocumentedItem.js.map +0 -0
  113. /package/{lib → lib-commonjs}/items/ApiItem.js +0 -0
  114. /package/{lib → lib-commonjs}/items/ApiItem.js.map +0 -0
  115. /package/{lib → lib-commonjs}/items/ApiPropertyItem.js +0 -0
  116. /package/{lib → lib-commonjs}/items/ApiPropertyItem.js.map +0 -0
  117. /package/{lib → lib-commonjs}/mixins/ApiAbstractMixin.js +0 -0
  118. /package/{lib → lib-commonjs}/mixins/ApiAbstractMixin.js.map +0 -0
  119. /package/{lib → lib-commonjs}/mixins/ApiExportedMixin.js +0 -0
  120. /package/{lib → lib-commonjs}/mixins/ApiExportedMixin.js.map +0 -0
  121. /package/{lib → lib-commonjs}/mixins/ApiInitializerMixin.js +0 -0
  122. /package/{lib → lib-commonjs}/mixins/ApiInitializerMixin.js.map +0 -0
  123. /package/{lib → lib-commonjs}/mixins/ApiItemContainerMixin.js +0 -0
  124. /package/{lib → lib-commonjs}/mixins/ApiItemContainerMixin.js.map +0 -0
  125. /package/{lib → lib-commonjs}/mixins/ApiNameMixin.js +0 -0
  126. /package/{lib → lib-commonjs}/mixins/ApiNameMixin.js.map +0 -0
  127. /package/{lib → lib-commonjs}/mixins/ApiOptionalMixin.js +0 -0
  128. /package/{lib → lib-commonjs}/mixins/ApiOptionalMixin.js.map +0 -0
  129. /package/{lib → lib-commonjs}/mixins/ApiParameterListMixin.js +0 -0
  130. /package/{lib → lib-commonjs}/mixins/ApiParameterListMixin.js.map +0 -0
  131. /package/{lib → lib-commonjs}/mixins/ApiProtectedMixin.js +0 -0
  132. /package/{lib → lib-commonjs}/mixins/ApiProtectedMixin.js.map +0 -0
  133. /package/{lib → lib-commonjs}/mixins/ApiReadonlyMixin.js +0 -0
  134. /package/{lib → lib-commonjs}/mixins/ApiReadonlyMixin.js.map +0 -0
  135. /package/{lib → lib-commonjs}/mixins/ApiReleaseTagMixin.js +0 -0
  136. /package/{lib → lib-commonjs}/mixins/ApiReleaseTagMixin.js.map +0 -0
  137. /package/{lib → lib-commonjs}/mixins/ApiReturnTypeMixin.js +0 -0
  138. /package/{lib → lib-commonjs}/mixins/ApiReturnTypeMixin.js.map +0 -0
  139. /package/{lib → lib-commonjs}/mixins/ApiStaticMixin.js +0 -0
  140. /package/{lib → lib-commonjs}/mixins/ApiStaticMixin.js.map +0 -0
  141. /package/{lib → lib-commonjs}/mixins/ApiTypeParameterListMixin.js +0 -0
  142. /package/{lib → lib-commonjs}/mixins/ApiTypeParameterListMixin.js.map +0 -0
  143. /package/{lib → lib-commonjs}/mixins/Excerpt.js +0 -0
  144. /package/{lib → lib-commonjs}/mixins/Excerpt.js.map +0 -0
  145. /package/{lib → lib-commonjs}/mixins/IFindApiItemsResult.js +0 -0
  146. /package/{lib → lib-commonjs}/mixins/IFindApiItemsResult.js.map +0 -0
  147. /package/{lib → lib-commonjs}/mixins/Mixin.js +0 -0
  148. /package/{lib → lib-commonjs}/mixins/Mixin.js.map +0 -0
  149. /package/{lib → lib-commonjs}/model/ApiCallSignature.js +0 -0
  150. /package/{lib → lib-commonjs}/model/ApiCallSignature.js.map +0 -0
  151. /package/{lib → lib-commonjs}/model/ApiClass.js +0 -0
  152. /package/{lib → lib-commonjs}/model/ApiClass.js.map +0 -0
  153. /package/{lib → lib-commonjs}/model/ApiConstructSignature.js +0 -0
  154. /package/{lib → lib-commonjs}/model/ApiConstructSignature.js.map +0 -0
  155. /package/{lib → lib-commonjs}/model/ApiConstructor.js +0 -0
  156. /package/{lib → lib-commonjs}/model/ApiConstructor.js.map +0 -0
  157. /package/{lib → lib-commonjs}/model/ApiEntryPoint.js +0 -0
  158. /package/{lib → lib-commonjs}/model/ApiEntryPoint.js.map +0 -0
  159. /package/{lib → lib-commonjs}/model/ApiEnum.js +0 -0
  160. /package/{lib → lib-commonjs}/model/ApiEnum.js.map +0 -0
  161. /package/{lib → lib-commonjs}/model/ApiEnumMember.js +0 -0
  162. /package/{lib → lib-commonjs}/model/ApiEnumMember.js.map +0 -0
  163. /package/{lib → lib-commonjs}/model/ApiFunction.js +0 -0
  164. /package/{lib → lib-commonjs}/model/ApiFunction.js.map +0 -0
  165. /package/{lib → lib-commonjs}/model/ApiIndexSignature.js +0 -0
  166. /package/{lib → lib-commonjs}/model/ApiIndexSignature.js.map +0 -0
  167. /package/{lib → lib-commonjs}/model/ApiInterface.js +0 -0
  168. /package/{lib → lib-commonjs}/model/ApiInterface.js.map +0 -0
  169. /package/{lib → lib-commonjs}/model/ApiMethod.js +0 -0
  170. /package/{lib → lib-commonjs}/model/ApiMethod.js.map +0 -0
  171. /package/{lib → lib-commonjs}/model/ApiMethodSignature.js +0 -0
  172. /package/{lib → lib-commonjs}/model/ApiMethodSignature.js.map +0 -0
  173. /package/{lib → lib-commonjs}/model/ApiModel.js +0 -0
  174. /package/{lib → lib-commonjs}/model/ApiModel.js.map +0 -0
  175. /package/{lib → lib-commonjs}/model/ApiNamespace.js +0 -0
  176. /package/{lib → lib-commonjs}/model/ApiNamespace.js.map +0 -0
  177. /package/{lib → lib-commonjs}/model/ApiPackage.js +0 -0
  178. /package/{lib → lib-commonjs}/model/ApiPackage.js.map +0 -0
  179. /package/{lib → lib-commonjs}/model/ApiProperty.js +0 -0
  180. /package/{lib → lib-commonjs}/model/ApiProperty.js.map +0 -0
  181. /package/{lib → lib-commonjs}/model/ApiPropertySignature.js +0 -0
  182. /package/{lib → lib-commonjs}/model/ApiPropertySignature.js.map +0 -0
  183. /package/{lib → lib-commonjs}/model/ApiTypeAlias.js +0 -0
  184. /package/{lib → lib-commonjs}/model/ApiTypeAlias.js.map +0 -0
  185. /package/{lib → lib-commonjs}/model/ApiVariable.js +0 -0
  186. /package/{lib → lib-commonjs}/model/ApiVariable.js.map +0 -0
  187. /package/{lib → lib-commonjs}/model/Deserializer.js +0 -0
  188. /package/{lib → lib-commonjs}/model/Deserializer.js.map +0 -0
  189. /package/{lib → lib-commonjs}/model/DeserializerContext.js +0 -0
  190. /package/{lib → lib-commonjs}/model/DeserializerContext.js.map +0 -0
  191. /package/{lib → lib-commonjs}/model/HeritageType.js +0 -0
  192. /package/{lib → lib-commonjs}/model/HeritageType.js.map +0 -0
  193. /package/{lib → lib-commonjs}/model/ModelReferenceResolver.js +0 -0
  194. /package/{lib → lib-commonjs}/model/ModelReferenceResolver.js.map +0 -0
  195. /package/{lib → lib-commonjs}/model/Parameter.js +0 -0
  196. /package/{lib → lib-commonjs}/model/Parameter.js.map +0 -0
  197. /package/{lib → lib-commonjs}/model/SourceLocation.js +0 -0
  198. /package/{lib → lib-commonjs}/model/SourceLocation.js.map +0 -0
  199. /package/{lib → lib-commonjs}/model/TypeParameter.js +0 -0
  200. /package/{lib → lib-commonjs}/model/TypeParameter.js.map +0 -0
  201. /package/{lib → lib-dts}/aedoc/AedocDefinitions.d.ts +0 -0
  202. /package/{lib → lib-dts}/aedoc/AedocDefinitions.d.ts.map +0 -0
  203. /package/{lib → lib-dts}/aedoc/ReleaseTag.d.ts +0 -0
  204. /package/{lib → lib-dts}/aedoc/ReleaseTag.d.ts.map +0 -0
  205. /package/{lib → lib-dts}/index.d.ts +0 -0
  206. /package/{lib → lib-dts}/index.d.ts.map +0 -0
  207. /package/{lib → lib-dts}/items/ApiDeclaredItem.d.ts +0 -0
  208. /package/{lib → lib-dts}/items/ApiDeclaredItem.d.ts.map +0 -0
  209. /package/{lib → lib-dts}/items/ApiDocumentedItem.d.ts +0 -0
  210. /package/{lib → lib-dts}/items/ApiDocumentedItem.d.ts.map +0 -0
  211. /package/{lib → lib-dts}/items/ApiItem.d.ts +0 -0
  212. /package/{lib → lib-dts}/items/ApiItem.d.ts.map +0 -0
  213. /package/{lib → lib-dts}/items/ApiPropertyItem.d.ts +0 -0
  214. /package/{lib → lib-dts}/items/ApiPropertyItem.d.ts.map +0 -0
  215. /package/{lib → lib-dts}/mixins/ApiAbstractMixin.d.ts +0 -0
  216. /package/{lib → lib-dts}/mixins/ApiAbstractMixin.d.ts.map +0 -0
  217. /package/{lib → lib-dts}/mixins/ApiExportedMixin.d.ts +0 -0
  218. /package/{lib → lib-dts}/mixins/ApiExportedMixin.d.ts.map +0 -0
  219. /package/{lib → lib-dts}/mixins/ApiInitializerMixin.d.ts +0 -0
  220. /package/{lib → lib-dts}/mixins/ApiInitializerMixin.d.ts.map +0 -0
  221. /package/{lib → lib-dts}/mixins/ApiItemContainerMixin.d.ts +0 -0
  222. /package/{lib → lib-dts}/mixins/ApiItemContainerMixin.d.ts.map +0 -0
  223. /package/{lib → lib-dts}/mixins/ApiNameMixin.d.ts +0 -0
  224. /package/{lib → lib-dts}/mixins/ApiNameMixin.d.ts.map +0 -0
  225. /package/{lib → lib-dts}/mixins/ApiOptionalMixin.d.ts +0 -0
  226. /package/{lib → lib-dts}/mixins/ApiOptionalMixin.d.ts.map +0 -0
  227. /package/{lib → lib-dts}/mixins/ApiParameterListMixin.d.ts +0 -0
  228. /package/{lib → lib-dts}/mixins/ApiParameterListMixin.d.ts.map +0 -0
  229. /package/{lib → lib-dts}/mixins/ApiProtectedMixin.d.ts +0 -0
  230. /package/{lib → lib-dts}/mixins/ApiProtectedMixin.d.ts.map +0 -0
  231. /package/{lib → lib-dts}/mixins/ApiReadonlyMixin.d.ts +0 -0
  232. /package/{lib → lib-dts}/mixins/ApiReadonlyMixin.d.ts.map +0 -0
  233. /package/{lib → lib-dts}/mixins/ApiReleaseTagMixin.d.ts +0 -0
  234. /package/{lib → lib-dts}/mixins/ApiReleaseTagMixin.d.ts.map +0 -0
  235. /package/{lib → lib-dts}/mixins/ApiReturnTypeMixin.d.ts +0 -0
  236. /package/{lib → lib-dts}/mixins/ApiReturnTypeMixin.d.ts.map +0 -0
  237. /package/{lib → lib-dts}/mixins/ApiStaticMixin.d.ts +0 -0
  238. /package/{lib → lib-dts}/mixins/ApiStaticMixin.d.ts.map +0 -0
  239. /package/{lib → lib-dts}/mixins/ApiTypeParameterListMixin.d.ts +0 -0
  240. /package/{lib → lib-dts}/mixins/ApiTypeParameterListMixin.d.ts.map +0 -0
  241. /package/{lib → lib-dts}/mixins/Excerpt.d.ts +0 -0
  242. /package/{lib → lib-dts}/mixins/Excerpt.d.ts.map +0 -0
  243. /package/{lib → lib-dts}/mixins/IFindApiItemsResult.d.ts +0 -0
  244. /package/{lib → lib-dts}/mixins/IFindApiItemsResult.d.ts.map +0 -0
  245. /package/{lib → lib-dts}/mixins/Mixin.d.ts +0 -0
  246. /package/{lib → lib-dts}/mixins/Mixin.d.ts.map +0 -0
  247. /package/{lib → lib-dts}/model/ApiCallSignature.d.ts +0 -0
  248. /package/{lib → lib-dts}/model/ApiCallSignature.d.ts.map +0 -0
  249. /package/{lib → lib-dts}/model/ApiClass.d.ts +0 -0
  250. /package/{lib → lib-dts}/model/ApiClass.d.ts.map +0 -0
  251. /package/{lib → lib-dts}/model/ApiConstructSignature.d.ts +0 -0
  252. /package/{lib → lib-dts}/model/ApiConstructSignature.d.ts.map +0 -0
  253. /package/{lib → lib-dts}/model/ApiConstructor.d.ts +0 -0
  254. /package/{lib → lib-dts}/model/ApiConstructor.d.ts.map +0 -0
  255. /package/{lib → lib-dts}/model/ApiEntryPoint.d.ts +0 -0
  256. /package/{lib → lib-dts}/model/ApiEntryPoint.d.ts.map +0 -0
  257. /package/{lib → lib-dts}/model/ApiEnum.d.ts +0 -0
  258. /package/{lib → lib-dts}/model/ApiEnum.d.ts.map +0 -0
  259. /package/{lib → lib-dts}/model/ApiEnumMember.d.ts +0 -0
  260. /package/{lib → lib-dts}/model/ApiEnumMember.d.ts.map +0 -0
  261. /package/{lib → lib-dts}/model/ApiFunction.d.ts +0 -0
  262. /package/{lib → lib-dts}/model/ApiFunction.d.ts.map +0 -0
  263. /package/{lib → lib-dts}/model/ApiIndexSignature.d.ts +0 -0
  264. /package/{lib → lib-dts}/model/ApiIndexSignature.d.ts.map +0 -0
  265. /package/{lib → lib-dts}/model/ApiInterface.d.ts +0 -0
  266. /package/{lib → lib-dts}/model/ApiInterface.d.ts.map +0 -0
  267. /package/{lib → lib-dts}/model/ApiMethod.d.ts +0 -0
  268. /package/{lib → lib-dts}/model/ApiMethod.d.ts.map +0 -0
  269. /package/{lib → lib-dts}/model/ApiMethodSignature.d.ts +0 -0
  270. /package/{lib → lib-dts}/model/ApiMethodSignature.d.ts.map +0 -0
  271. /package/{lib → lib-dts}/model/ApiModel.d.ts +0 -0
  272. /package/{lib → lib-dts}/model/ApiModel.d.ts.map +0 -0
  273. /package/{lib → lib-dts}/model/ApiNamespace.d.ts +0 -0
  274. /package/{lib → lib-dts}/model/ApiNamespace.d.ts.map +0 -0
  275. /package/{lib → lib-dts}/model/ApiPackage.d.ts +0 -0
  276. /package/{lib → lib-dts}/model/ApiPackage.d.ts.map +0 -0
  277. /package/{lib → lib-dts}/model/ApiProperty.d.ts +0 -0
  278. /package/{lib → lib-dts}/model/ApiProperty.d.ts.map +0 -0
  279. /package/{lib → lib-dts}/model/ApiPropertySignature.d.ts +0 -0
  280. /package/{lib → lib-dts}/model/ApiPropertySignature.d.ts.map +0 -0
  281. /package/{lib → lib-dts}/model/ApiTypeAlias.d.ts +0 -0
  282. /package/{lib → lib-dts}/model/ApiTypeAlias.d.ts.map +0 -0
  283. /package/{lib → lib-dts}/model/ApiVariable.d.ts +0 -0
  284. /package/{lib → lib-dts}/model/ApiVariable.d.ts.map +0 -0
  285. /package/{lib → lib-dts}/model/Deserializer.d.ts +0 -0
  286. /package/{lib → lib-dts}/model/Deserializer.d.ts.map +0 -0
  287. /package/{lib → lib-dts}/model/DeserializerContext.d.ts +0 -0
  288. /package/{lib → lib-dts}/model/DeserializerContext.d.ts.map +0 -0
  289. /package/{lib → lib-dts}/model/HeritageType.d.ts +0 -0
  290. /package/{lib → lib-dts}/model/HeritageType.d.ts.map +0 -0
  291. /package/{lib → lib-dts}/model/ModelReferenceResolver.d.ts +0 -0
  292. /package/{lib → lib-dts}/model/ModelReferenceResolver.d.ts.map +0 -0
  293. /package/{lib → lib-dts}/model/Parameter.d.ts +0 -0
  294. /package/{lib → lib-dts}/model/Parameter.d.ts.map +0 -0
  295. /package/{lib → lib-dts}/model/SourceLocation.d.ts +0 -0
  296. /package/{lib → lib-dts}/model/SourceLocation.d.ts.map +0 -0
  297. /package/{lib → lib-dts}/model/TypeParameter.d.ts +0 -0
  298. /package/{lib → lib-dts}/model/TypeParameter.d.ts.map +0 -0
@@ -0,0 +1,319 @@
1
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
2
+ // See LICENSE in the project root for license information.
3
+ /* eslint-disable @typescript-eslint/no-redeclare */
4
+ import { InternalError } from '@rushstack/node-core-library';
5
+ import { ApiItem, apiItem_onParentChanged, ApiItemKind } from '../items/ApiItem';
6
+ import { ApiNameMixin } from './ApiNameMixin';
7
+ import { ExcerptTokenKind } from './Excerpt';
8
+ import { FindApiItemsMessageId } from './IFindApiItemsResult';
9
+ const _members = Symbol('ApiItemContainerMixin._members');
10
+ const _membersSorted = Symbol('ApiItemContainerMixin._membersSorted');
11
+ const _membersByContainerKey = Symbol('ApiItemContainerMixin._membersByContainerKey');
12
+ const _membersByName = Symbol('ApiItemContainerMixin._membersByName');
13
+ const _membersByKind = Symbol('ApiItemContainerMixin._membersByKind');
14
+ const _preserveMemberOrder = Symbol('ApiItemContainerMixin._preserveMemberOrder');
15
+ /**
16
+ * Mixin function for {@link ApiDeclaredItem}.
17
+ *
18
+ * @param baseClass - The base class to be extended
19
+ * @returns A child class that extends baseClass, adding the {@link (ApiItemContainerMixin:interface)} functionality.
20
+ *
21
+ * @public
22
+ */
23
+ export function ApiItemContainerMixin(baseClass
24
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
+ ) {
26
+ class MixedClass extends baseClass {
27
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
+ constructor(...args) {
29
+ var _a;
30
+ super(...args);
31
+ const options = args[0];
32
+ this[_members] = [];
33
+ this[_membersSorted] = false;
34
+ this[_membersByContainerKey] = new Map();
35
+ this[_preserveMemberOrder] = (_a = options.preserveMemberOrder) !== null && _a !== void 0 ? _a : false;
36
+ if (options.members) {
37
+ for (const member of options.members) {
38
+ this.addMember(member);
39
+ }
40
+ }
41
+ }
42
+ /** @override */
43
+ static onDeserializeInto(options, context, jsonObject) {
44
+ baseClass.onDeserializeInto(options, context, jsonObject);
45
+ options.preserveMemberOrder = jsonObject.preserveMemberOrder;
46
+ options.members = [];
47
+ for (const memberObject of jsonObject.members) {
48
+ options.members.push(ApiItem.deserialize(memberObject, context));
49
+ }
50
+ }
51
+ /** @override */
52
+ get members() {
53
+ if (!this[_membersSorted] && !this[_preserveMemberOrder]) {
54
+ this[_members].sort((x, y) => x.getSortKey().localeCompare(y.getSortKey()));
55
+ this[_membersSorted] = true;
56
+ }
57
+ return this[_members];
58
+ }
59
+ get preserveMemberOrder() {
60
+ return this[_preserveMemberOrder];
61
+ }
62
+ addMember(member) {
63
+ if (this[_membersByContainerKey].has(member.containerKey)) {
64
+ throw new Error(`Another member has already been added with the same name (${member.displayName})` +
65
+ ` and containerKey (${member.containerKey})`);
66
+ }
67
+ const existingParent = member.parent;
68
+ if (existingParent !== undefined) {
69
+ throw new Error(`This item has already been added to another container: "${existingParent.displayName}"`);
70
+ }
71
+ this[_members].push(member);
72
+ this[_membersByName] = undefined; // invalidate the lookup
73
+ this[_membersByKind] = undefined; // invalidate the lookup
74
+ this[_membersSorted] = false;
75
+ this[_membersByContainerKey].set(member.containerKey, member);
76
+ member[apiItem_onParentChanged](this);
77
+ }
78
+ tryGetMemberByKey(containerKey) {
79
+ return this[_membersByContainerKey].get(containerKey);
80
+ }
81
+ findMembersByName(name) {
82
+ this._ensureMemberMaps();
83
+ return this[_membersByName].get(name) || [];
84
+ }
85
+ findMembersWithInheritance() {
86
+ const messages = [];
87
+ let maybeIncompleteResult = false;
88
+ // For API items that don't support inheritance, this method just returns the item's
89
+ // immediate members.
90
+ switch (this.kind) {
91
+ case ApiItemKind.Class:
92
+ case ApiItemKind.Interface:
93
+ break;
94
+ default: {
95
+ return {
96
+ items: this.members.concat(),
97
+ messages,
98
+ maybeIncompleteResult
99
+ };
100
+ }
101
+ }
102
+ const membersByName = new Map();
103
+ const membersByKind = new Map();
104
+ const toVisit = [];
105
+ let next = this;
106
+ while (next) {
107
+ const membersToAdd = [];
108
+ // For each member, check to see if we've already seen a member with the same name
109
+ // previously in the inheritance tree. If so, we know we won't inherit it, and thus
110
+ // do not add it to our `membersToAdd` array.
111
+ for (const member of next.members) {
112
+ // We add the to-be-added members to an intermediate array instead of immediately
113
+ // to the maps themselves to support method overloads with the same name.
114
+ if (ApiNameMixin.isBaseClassOf(member)) {
115
+ if (!membersByName.has(member.name)) {
116
+ membersToAdd.push(member);
117
+ }
118
+ }
119
+ else {
120
+ if (!membersByKind.has(member.kind)) {
121
+ membersToAdd.push(member);
122
+ }
123
+ }
124
+ }
125
+ for (const member of membersToAdd) {
126
+ if (ApiNameMixin.isBaseClassOf(member)) {
127
+ const members = membersByName.get(member.name) || [];
128
+ members.push(member);
129
+ membersByName.set(member.name, members);
130
+ }
131
+ else {
132
+ const members = membersByKind.get(member.kind) || [];
133
+ members.push(member);
134
+ membersByKind.set(member.kind, members);
135
+ }
136
+ }
137
+ // Interfaces can extend multiple interfaces, so iterate through all of them.
138
+ const extendedItems = [];
139
+ let extendsTypes;
140
+ switch (next.kind) {
141
+ case ApiItemKind.Class: {
142
+ const apiClass = next;
143
+ extendsTypes = apiClass.extendsType ? [apiClass.extendsType] : [];
144
+ break;
145
+ }
146
+ case ApiItemKind.Interface: {
147
+ const apiInterface = next;
148
+ extendsTypes = apiInterface.extendsTypes;
149
+ break;
150
+ }
151
+ }
152
+ if (extendsTypes === undefined) {
153
+ messages.push({
154
+ messageId: FindApiItemsMessageId.UnsupportedKind,
155
+ text: `Unable to analyze references of API item ${next.displayName} because it is of unsupported kind ${next.kind}`
156
+ });
157
+ maybeIncompleteResult = true;
158
+ next = toVisit.shift();
159
+ continue;
160
+ }
161
+ for (const extendsType of extendsTypes) {
162
+ // We want to find the reference token associated with the actual inherited declaration.
163
+ // In every case we support, this is the first reference token. For example:
164
+ //
165
+ // ```
166
+ // export class A extends B {}
167
+ // ^
168
+ // export class A extends B<C> {}
169
+ // ^
170
+ // export class A extends B.C {}
171
+ // ^^^
172
+ // ```
173
+ const firstReferenceToken = extendsType.excerpt.spannedTokens.find((token) => {
174
+ return token.kind === ExcerptTokenKind.Reference && token.canonicalReference;
175
+ });
176
+ if (!firstReferenceToken) {
177
+ messages.push({
178
+ messageId: FindApiItemsMessageId.ExtendsClauseMissingReference,
179
+ text: `Unable to analyze extends clause ${extendsType.excerpt.text} of API item ${next.displayName} because no canonical reference was found`
180
+ });
181
+ maybeIncompleteResult = true;
182
+ continue;
183
+ }
184
+ const apiModel = this.getAssociatedModel();
185
+ if (!apiModel) {
186
+ messages.push({
187
+ messageId: FindApiItemsMessageId.NoAssociatedApiModel,
188
+ text: `Unable to analyze references of API item ${next.displayName} because it is not associated with an ApiModel`
189
+ });
190
+ maybeIncompleteResult = true;
191
+ continue;
192
+ }
193
+ const canonicalReference = firstReferenceToken.canonicalReference;
194
+ const apiItemResult = apiModel.resolveDeclarationReference(canonicalReference, undefined);
195
+ const apiItem = apiItemResult.resolvedApiItem;
196
+ if (!apiItem) {
197
+ messages.push({
198
+ messageId: FindApiItemsMessageId.DeclarationResolutionFailed,
199
+ text: `Unable to resolve declaration reference within API item ${next.displayName}: ${apiItemResult.errorMessage}`
200
+ });
201
+ maybeIncompleteResult = true;
202
+ continue;
203
+ }
204
+ extendedItems.push(apiItem);
205
+ }
206
+ // For classes, this array will only have one item. For interfaces, there may be multiple items. Sort the array
207
+ // into alphabetical order before adding to our list of API items to visit. This ensures that in the case
208
+ // of multiple interface inheritance, a member inherited from multiple interfaces is attributed to the interface
209
+ // earlier in alphabetical order (as opposed to source order).
210
+ //
211
+ // For example, in the code block below, `Bar.x` is reported as the inherited item, not `Foo.x`.
212
+ //
213
+ // ```
214
+ // interface Foo {
215
+ // public x: string;
216
+ // }
217
+ //
218
+ // interface Bar {
219
+ // public x: string;
220
+ // }
221
+ //
222
+ // interface FooBar extends Foo, Bar {}
223
+ // ```
224
+ extendedItems.sort((x, y) => x.getSortKey().localeCompare(y.getSortKey()));
225
+ toVisit.push(...extendedItems);
226
+ next = toVisit.shift();
227
+ }
228
+ const items = [];
229
+ for (const members of membersByName.values()) {
230
+ items.push(...members);
231
+ }
232
+ for (const members of membersByKind.values()) {
233
+ items.push(...members);
234
+ }
235
+ items.sort((x, y) => x.getSortKey().localeCompare(y.getSortKey()));
236
+ return {
237
+ items,
238
+ messages,
239
+ maybeIncompleteResult
240
+ };
241
+ }
242
+ /** @internal */
243
+ _getMergedSiblingsForMember(memberApiItem) {
244
+ this._ensureMemberMaps();
245
+ let result;
246
+ if (ApiNameMixin.isBaseClassOf(memberApiItem)) {
247
+ result = this[_membersByName].get(memberApiItem.name);
248
+ }
249
+ else {
250
+ result = this[_membersByKind].get(memberApiItem.kind);
251
+ }
252
+ if (!result) {
253
+ throw new InternalError('Item was not found in the _membersByName/_membersByKind lookup');
254
+ }
255
+ return result;
256
+ }
257
+ /** @internal */
258
+ _ensureMemberMaps() {
259
+ // Build the _membersByName and _membersByKind tables if they don't already exist
260
+ if (this[_membersByName] === undefined) {
261
+ const membersByName = new Map();
262
+ const membersByKind = new Map();
263
+ for (const member of this[_members]) {
264
+ let map;
265
+ let key;
266
+ if (ApiNameMixin.isBaseClassOf(member)) {
267
+ map = membersByName;
268
+ key = member.name;
269
+ }
270
+ else {
271
+ map = membersByKind;
272
+ key = member.kind;
273
+ }
274
+ let list = map.get(key);
275
+ if (list === undefined) {
276
+ list = [];
277
+ map.set(key, list);
278
+ }
279
+ list.push(member);
280
+ }
281
+ this[_membersByName] = membersByName;
282
+ this[_membersByKind] = membersByKind;
283
+ }
284
+ }
285
+ /** @override */
286
+ serializeInto(jsonObject) {
287
+ super.serializeInto(jsonObject);
288
+ const memberObjects = [];
289
+ for (const member of this.members) {
290
+ const memberJsonObject = {};
291
+ member.serializeInto(memberJsonObject);
292
+ memberObjects.push(memberJsonObject);
293
+ }
294
+ jsonObject.preserveMemberOrder = this.preserveMemberOrder;
295
+ jsonObject.members = memberObjects;
296
+ }
297
+ }
298
+ return MixedClass;
299
+ }
300
+ /**
301
+ * Static members for {@link (ApiItemContainerMixin:interface)}.
302
+ * @public
303
+ */
304
+ (function (ApiItemContainerMixin) {
305
+ /**
306
+ * A type guard that tests whether the specified `ApiItem` subclass extends the `ApiItemContainerMixin` mixin.
307
+ *
308
+ * @remarks
309
+ *
310
+ * The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
311
+ * the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
312
+ * the TypeScript type system cannot invoke a runtime test.)
313
+ */
314
+ function isBaseClassOf(apiItem) {
315
+ return apiItem.hasOwnProperty(_members);
316
+ }
317
+ ApiItemContainerMixin.isBaseClassOf = isBaseClassOf;
318
+ })(ApiItemContainerMixin || (ApiItemContainerMixin = {}));
319
+ //# sourceMappingURL=ApiItemContainerMixin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApiItemContainerMixin.js","sourceRoot":"","sources":["../../src/mixins/ApiItemContainerMixin.ts"],"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C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;wBACvB,IAAI,GAAG,EAAE,CAAC;wBACV,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;oBACrB,CAAC;oBACD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACpB,CAAC;gBAED,IAAI,CAAC,cAAc,CAAC,GAAG,aAAa,CAAC;gBACrC,IAAI,CAAC,cAAc,CAAC,GAAG,aAAa,CAAC;YACvC,CAAC;QACH,CAAC;QAED,gBAAgB;QACT,aAAa,CAAC,UAA0C;YAC7D,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAEhC,MAAM,aAAa,GAAmB,EAAE,CAAC;YAEzC,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBAClC,MAAM,gBAAgB,GAA0B,EAAE,CAAC;gBACnD,MAAM,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;gBACvC,aAAa,CAAC,IAAI,CAAC,gBAAgC,CAAC,CAAC;YACvD,CAAC;YAED,UAAU,CAAC,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAC;YAC1D,UAAU,CAAC,OAAO,GAAG,aAAa,CAAC;QACrC,CAAC;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;GAGG;AACH,WAAiB,qBAAqB;IACpC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAgB;QAC5C,OAAO,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAFe,mCAAa,gBAE5B,CAAA;AACH,CAAC,EAbgB,qBAAqB,KAArB,qBAAqB,QAarC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/* eslint-disable @typescript-eslint/no-redeclare */\n\nimport { InternalError } from '@rushstack/node-core-library';\nimport type { DeclarationReference } from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';\n\nimport {\n ApiItem,\n apiItem_onParentChanged,\n type IApiItemJson,\n type IApiItemOptions,\n type IApiItemConstructor,\n ApiItemKind\n} from '../items/ApiItem';\nimport { ApiNameMixin } from './ApiNameMixin';\nimport type { DeserializerContext } from '../model/DeserializerContext';\nimport type { ApiModel } from '../model/ApiModel';\nimport type { ApiClass } from '../model/ApiClass';\nimport type { ApiInterface } from '../model/ApiInterface';\nimport { type ExcerptToken, ExcerptTokenKind } from './Excerpt';\nimport {\n type IFindApiItemsResult,\n type IFindApiItemsMessage,\n FindApiItemsMessageId\n} from './IFindApiItemsResult';\nimport type { HeritageType } from '../model/HeritageType';\nimport type { IResolveDeclarationReferenceResult } from '../model/ModelReferenceResolver';\n\n/**\n * Constructor options for {@link (ApiItemContainerMixin:interface)}.\n * @public\n */\nexport interface IApiItemContainerMixinOptions extends IApiItemOptions {\n preserveMemberOrder?: boolean;\n members?: ApiItem[];\n}\n\nexport interface IApiItemContainerJson extends IApiItemJson {\n preserveMemberOrder?: boolean;\n members: IApiItemJson[];\n}\n\nconst _members: unique symbol = Symbol('ApiItemContainerMixin._members');\nconst _membersSorted: unique symbol = Symbol('ApiItemContainerMixin._membersSorted');\nconst _membersByContainerKey: unique symbol = Symbol('ApiItemContainerMixin._membersByContainerKey');\nconst _membersByName: unique symbol = Symbol('ApiItemContainerMixin._membersByName');\nconst _membersByKind: unique symbol = Symbol('ApiItemContainerMixin._membersByKind');\nconst _preserveMemberOrder: unique symbol = Symbol('ApiItemContainerMixin._preserveMemberOrder');\n\n/**\n * The mixin base class for API items that act as containers for other child items.\n *\n * @remarks\n *\n * This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of\n * API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use\n * TypeScript \"mixin\" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various\n * features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class\n * to extend more than one base class). The \"mixin\" is a TypeScript merged declaration with three components:\n * the function that generates a subclass, an interface that describes the members of the subclass, and\n * a namespace containing static members of the class.\n *\n * Examples of `ApiItemContainerMixin` child classes include `ApiModel`, `ApiPackage`, `ApiEntryPoint`,\n * and `ApiEnum`. But note that `Parameter` is not considered a \"member\" of an `ApiMethod`; this relationship\n * is modeled using {@link (ApiParameterListMixin:interface).parameters} instead\n * of {@link ApiItem.members}.\n *\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface ApiItemContainerMixin extends ApiItem {\n /**\n * Disables automatic sorting of {@link ApiItem.members}.\n *\n * @remarks\n * By default `ApiItemContainerMixin` will automatically sort its members according to their\n * {@link ApiItem.getSortKey} string, which provides a standardized mostly alphabetical ordering\n * that is appropriate for most API items. When loading older .api.json files the automatic sorting\n * is reapplied and may update the ordering.\n *\n * Set `preserveMemberOrder` to true to disable automatic sorting for this container; instead, the\n * members will retain whatever ordering appeared in the {@link IApiItemContainerMixinOptions.members} array.\n * The `preserveMemberOrder` option is saved in the .api.json file.\n */\n readonly preserveMemberOrder: boolean;\n\n /**\n * Adds a new member to the container.\n *\n * @remarks\n * An ApiItem cannot be added to more than one container.\n */\n addMember(member: ApiItem): void;\n\n /**\n * Attempts to retrieve a member using its containerKey, or returns `undefined` if no matching member was found.\n *\n * @remarks\n * Use the `getContainerKey()` static member to construct the key. Each subclass has a different implementation\n * of this function, according to the aspects that are important for identifying it.\n *\n * See {@link ApiItem.containerKey} for more information.\n */\n tryGetMemberByKey(containerKey: string): ApiItem | undefined;\n\n /**\n * Returns a list of members with the specified name.\n */\n findMembersByName(name: string): ReadonlyArray<ApiItem>;\n\n /**\n * Finds all of the ApiItem's immediate and inherited members by walking up the inheritance tree.\n *\n * @remarks\n *\n * Given the following class heritage:\n *\n * ```\n * export class A {\n * public a: number|boolean;\n * }\n *\n * export class B extends A {\n * public a: number;\n * public b: string;\n * }\n *\n * export class C extends B {\n * public c: boolean;\n * }\n * ```\n *\n * Calling `findMembersWithInheritance` on `C` will return `B.a`, `B.b`, and `C.c`. Calling the\n * method on `B` will return `B.a` and `B.b`. And calling the method on `A` will return just\n * `A.a`.\n *\n * The inherited members returned by this method may be incomplete. If so, there will be a flag\n * on the result object indicating this as well as messages explaining the errors in more detail.\n * Some scenarios include:\n *\n * - Interface extending from a type alias.\n *\n * - Class extending from a variable.\n *\n * - Extending from a declaration not present in the model (e.g. external package).\n *\n * - Extending from an unexported declaration (e.g. ae-forgotten-export). Common in mixin\n * patterns.\n *\n * - Unexpected runtime errors...\n *\n * Lastly, be aware that the types of inherited members are returned with respect to their\n * defining class as opposed to with respect to the inheriting class. For example, consider\n * the following:\n *\n * ```\n * export class A<T> {\n * public a: T;\n * }\n *\n * export class B extends A<number> {}\n * ```\n *\n * When called on `B`, this method will return `B.a` with type `T` as opposed to type\n * `number`, although the latter is more accurate.\n */\n findMembersWithInheritance(): IFindApiItemsResult;\n\n /**\n * For a given member of this container, return its `ApiItem.getMergedSiblings()` list.\n * @internal\n */\n _getMergedSiblingsForMember(memberApiItem: ApiItem): ReadonlyArray<ApiItem>;\n\n /** @override */\n serializeInto(jsonObject: Partial<IApiItemJson>): void;\n}\n\n/**\n * Mixin function for {@link ApiDeclaredItem}.\n *\n * @param baseClass - The base class to be extended\n * @returns A child class that extends baseClass, adding the {@link (ApiItemContainerMixin:interface)} functionality.\n *\n * @public\n */\nexport function ApiItemContainerMixin<TBaseClass extends IApiItemConstructor>(\n baseClass: TBaseClass\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): TBaseClass & (new (...args: any[]) => ApiItemContainerMixin) {\n class MixedClass extends baseClass implements ApiItemContainerMixin {\n public readonly [_members]: ApiItem[];\n public [_membersSorted]: boolean;\n public [_membersByContainerKey]: Map<string, ApiItem>;\n public [_preserveMemberOrder]: boolean;\n\n // For members of this container that extend ApiNameMixin, this stores the list of members with a given name.\n // Examples include merged declarations, overloaded functions, etc.\n public [_membersByName]: Map<string, ApiItem[]> | undefined;\n\n // For members of this container that do NOT extend ApiNameMixin, this stores the list of members\n // that share a common ApiItemKind. Examples include overloaded constructors or index signatures.\n public [_membersByKind]: Map<string, ApiItem[]> | undefined; // key is ApiItemKind\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public constructor(...args: any[]) {\n super(...args);\n const options: IApiItemContainerMixinOptions = args[0] as IApiItemContainerMixinOptions;\n\n this[_members] = [];\n this[_membersSorted] = false;\n this[_membersByContainerKey] = new Map<string, ApiItem>();\n this[_preserveMemberOrder] = options.preserveMemberOrder ?? false;\n\n if (options.members) {\n for (const member of options.members) {\n this.addMember(member);\n }\n }\n }\n\n /** @override */\n public static onDeserializeInto(\n options: Partial<IApiItemContainerMixinOptions>,\n context: DeserializerContext,\n jsonObject: IApiItemContainerJson\n ): void {\n baseClass.onDeserializeInto(options, context, jsonObject);\n options.preserveMemberOrder = jsonObject.preserveMemberOrder;\n options.members = [];\n for (const memberObject of jsonObject.members) {\n options.members.push(ApiItem.deserialize(memberObject, context));\n }\n }\n\n /** @override */\n public get members(): ReadonlyArray<ApiItem> {\n if (!this[_membersSorted] && !this[_preserveMemberOrder]) {\n this[_members].sort((x, y) => x.getSortKey().localeCompare(y.getSortKey()));\n this[_membersSorted] = true;\n }\n\n return this[_members];\n }\n\n public get preserveMemberOrder(): boolean {\n return this[_preserveMemberOrder];\n }\n\n public addMember(member: ApiItem): void {\n if (this[_membersByContainerKey].has(member.containerKey)) {\n throw new Error(\n `Another member has already been added with the same name (${member.displayName})` +\n ` and containerKey (${member.containerKey})`\n );\n }\n\n const existingParent: ApiItem | undefined = member.parent;\n if (existingParent !== undefined) {\n throw new Error(\n `This item has already been added to another container: \"${existingParent.displayName}\"`\n );\n }\n\n this[_members].push(member);\n this[_membersByName] = undefined; // invalidate the lookup\n this[_membersByKind] = undefined; // invalidate the lookup\n this[_membersSorted] = false;\n this[_membersByContainerKey].set(member.containerKey, member);\n\n member[apiItem_onParentChanged](this);\n }\n\n public tryGetMemberByKey(containerKey: string): ApiItem | undefined {\n return this[_membersByContainerKey].get(containerKey);\n }\n\n public findMembersByName(name: string): ReadonlyArray<ApiItem> {\n this._ensureMemberMaps();\n return this[_membersByName]!.get(name) || [];\n }\n\n public findMembersWithInheritance(): IFindApiItemsResult {\n const messages: IFindApiItemsMessage[] = [];\n let maybeIncompleteResult: boolean = false;\n\n // For API items that don't support inheritance, this method just returns the item's\n // immediate members.\n switch (this.kind) {\n case ApiItemKind.Class:\n case ApiItemKind.Interface:\n break;\n default: {\n return {\n items: this.members.concat(),\n messages,\n maybeIncompleteResult\n };\n }\n }\n\n const membersByName: Map<string, ApiItem[]> = new Map();\n const membersByKind: Map<ApiItemKind, ApiItem[]> = new Map();\n\n const toVisit: ApiItem[] = [];\n let next: ApiItem | undefined = this;\n\n while (next) {\n const membersToAdd: ApiItem[] = [];\n\n // For each member, check to see if we've already seen a member with the same name\n // previously in the inheritance tree. If so, we know we won't inherit it, and thus\n // do not add it to our `membersToAdd` array.\n for (const member of next.members) {\n // We add the to-be-added members to an intermediate array instead of immediately\n // to the maps themselves to support method overloads with the same name.\n if (ApiNameMixin.isBaseClassOf(member)) {\n if (!membersByName.has(member.name)) {\n membersToAdd.push(member);\n }\n } else {\n if (!membersByKind.has(member.kind)) {\n membersToAdd.push(member);\n }\n }\n }\n\n for (const member of membersToAdd) {\n if (ApiNameMixin.isBaseClassOf(member)) {\n const members: ApiItem[] = membersByName.get(member.name) || [];\n members.push(member);\n membersByName.set(member.name, members);\n } else {\n const members: ApiItem[] = membersByKind.get(member.kind) || [];\n members.push(member);\n membersByKind.set(member.kind, members);\n }\n }\n\n // Interfaces can extend multiple interfaces, so iterate through all of them.\n const extendedItems: ApiItem[] = [];\n let extendsTypes: readonly HeritageType[] | undefined;\n\n switch (next.kind) {\n case ApiItemKind.Class: {\n const apiClass: ApiClass = next as ApiClass;\n extendsTypes = apiClass.extendsType ? [apiClass.extendsType] : [];\n break;\n }\n case ApiItemKind.Interface: {\n const apiInterface: ApiInterface = next as ApiInterface;\n extendsTypes = apiInterface.extendsTypes;\n break;\n }\n }\n\n if (extendsTypes === undefined) {\n messages.push({\n messageId: FindApiItemsMessageId.UnsupportedKind,\n text: `Unable to analyze references of API item ${next.displayName} because it is of unsupported kind ${next.kind}`\n });\n maybeIncompleteResult = true;\n next = toVisit.shift();\n continue;\n }\n\n for (const extendsType of extendsTypes) {\n // We want to find the reference token associated with the actual inherited declaration.\n // In every case we support, this is the first reference token. For example:\n //\n // ```\n // export class A extends B {}\n // ^\n // export class A extends B<C> {}\n // ^\n // export class A extends B.C {}\n // ^^^\n // ```\n const firstReferenceToken: ExcerptToken | undefined = extendsType.excerpt.spannedTokens.find(\n (token: ExcerptToken) => {\n return token.kind === ExcerptTokenKind.Reference && token.canonicalReference;\n }\n );\n\n if (!firstReferenceToken) {\n messages.push({\n messageId: FindApiItemsMessageId.ExtendsClauseMissingReference,\n text: `Unable to analyze extends clause ${extendsType.excerpt.text} of API item ${next.displayName} because no canonical reference was found`\n });\n maybeIncompleteResult = true;\n continue;\n }\n\n const apiModel: ApiModel | undefined = this.getAssociatedModel();\n if (!apiModel) {\n messages.push({\n messageId: FindApiItemsMessageId.NoAssociatedApiModel,\n text: `Unable to analyze references of API item ${next.displayName} because it is not associated with an ApiModel`\n });\n maybeIncompleteResult = true;\n continue;\n }\n\n const canonicalReference: DeclarationReference = firstReferenceToken.canonicalReference!;\n const apiItemResult: IResolveDeclarationReferenceResult = apiModel.resolveDeclarationReference(\n canonicalReference,\n undefined\n );\n\n const apiItem: ApiItem | undefined = apiItemResult.resolvedApiItem;\n if (!apiItem) {\n messages.push({\n messageId: FindApiItemsMessageId.DeclarationResolutionFailed,\n text: `Unable to resolve declaration reference within API item ${next.displayName}: ${apiItemResult.errorMessage}`\n });\n maybeIncompleteResult = true;\n continue;\n }\n\n extendedItems.push(apiItem);\n }\n\n // For classes, this array will only have one item. For interfaces, there may be multiple items. Sort the array\n // into alphabetical order before adding to our list of API items to visit. This ensures that in the case\n // of multiple interface inheritance, a member inherited from multiple interfaces is attributed to the interface\n // earlier in alphabetical order (as opposed to source order).\n //\n // For example, in the code block below, `Bar.x` is reported as the inherited item, not `Foo.x`.\n //\n // ```\n // interface Foo {\n // public x: string;\n // }\n //\n // interface Bar {\n // public x: string;\n // }\n //\n // interface FooBar extends Foo, Bar {}\n // ```\n extendedItems.sort((x: ApiItem, y: ApiItem) => x.getSortKey().localeCompare(y.getSortKey()));\n\n toVisit.push(...extendedItems);\n next = toVisit.shift();\n }\n\n const items: ApiItem[] = [];\n for (const members of membersByName.values()) {\n items.push(...members);\n }\n for (const members of membersByKind.values()) {\n items.push(...members);\n }\n items.sort((x: ApiItem, y: ApiItem) => x.getSortKey().localeCompare(y.getSortKey()));\n\n return {\n items,\n messages,\n maybeIncompleteResult\n };\n }\n\n /** @internal */\n public _getMergedSiblingsForMember(memberApiItem: ApiItem): ReadonlyArray<ApiItem> {\n this._ensureMemberMaps();\n let result: ApiItem[] | undefined;\n if (ApiNameMixin.isBaseClassOf(memberApiItem)) {\n result = this[_membersByName]!.get(memberApiItem.name);\n } else {\n result = this[_membersByKind]!.get(memberApiItem.kind);\n }\n if (!result) {\n throw new InternalError('Item was not found in the _membersByName/_membersByKind lookup');\n }\n return result;\n }\n\n /** @internal */\n public _ensureMemberMaps(): void {\n // Build the _membersByName and _membersByKind tables if they don't already exist\n if (this[_membersByName] === undefined) {\n const membersByName: Map<string, ApiItem[]> = new Map<string, ApiItem[]>();\n const membersByKind: Map<string, ApiItem[]> = new Map<string, ApiItem[]>();\n\n for (const member of this[_members]) {\n let map: Map<string, ApiItem[]> | Map<ApiItemKind, ApiItem[]>;\n let key: string | ApiItemKind;\n\n if (ApiNameMixin.isBaseClassOf(member)) {\n map = membersByName;\n key = member.name;\n } else {\n map = membersByKind;\n key = member.kind;\n }\n\n let list: ApiItem[] | undefined = map.get(key);\n if (list === undefined) {\n list = [];\n map.set(key, list);\n }\n list.push(member);\n }\n\n this[_membersByName] = membersByName;\n this[_membersByKind] = membersByKind;\n }\n }\n\n /** @override */\n public serializeInto(jsonObject: Partial<IApiItemContainerJson>): void {\n super.serializeInto(jsonObject);\n\n const memberObjects: IApiItemJson[] = [];\n\n for (const member of this.members) {\n const memberJsonObject: Partial<IApiItemJson> = {};\n member.serializeInto(memberJsonObject);\n memberObjects.push(memberJsonObject as IApiItemJson);\n }\n\n jsonObject.preserveMemberOrder = this.preserveMemberOrder;\n jsonObject.members = memberObjects;\n }\n }\n\n return MixedClass;\n}\n\n/**\n * Static members for {@link (ApiItemContainerMixin:interface)}.\n * @public\n */\nexport namespace ApiItemContainerMixin {\n /**\n * A type guard that tests whether the specified `ApiItem` subclass extends the `ApiItemContainerMixin` mixin.\n *\n * @remarks\n *\n * The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of\n * the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however\n * the TypeScript type system cannot invoke a runtime test.)\n */\n export function isBaseClassOf(apiItem: ApiItem): apiItem is ApiItemContainerMixin {\n return apiItem.hasOwnProperty(_members);\n }\n}\n"]}
@@ -0,0 +1,61 @@
1
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
2
+ // See LICENSE in the project root for license information.
3
+ const _name = Symbol('ApiNameMixin._name');
4
+ /**
5
+ * Mixin function for {@link (ApiNameMixin:interface)}.
6
+ *
7
+ * @param baseClass - The base class to be extended
8
+ * @returns A child class that extends baseClass, adding the {@link (ApiNameMixin:interface)} functionality.
9
+ *
10
+ * @public
11
+ */
12
+ export function ApiNameMixin(baseClass
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
+ ) {
15
+ class MixedClass extends baseClass {
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
+ constructor(...args) {
18
+ super(...args);
19
+ const options = args[0];
20
+ this[_name] = options.name;
21
+ }
22
+ /** @override */
23
+ static onDeserializeInto(options, context, jsonObject) {
24
+ baseClass.onDeserializeInto(options, context, jsonObject);
25
+ options.name = jsonObject.name;
26
+ }
27
+ get name() {
28
+ return this[_name];
29
+ }
30
+ /** @override */
31
+ get displayName() {
32
+ return this[_name];
33
+ }
34
+ /** @override */
35
+ serializeInto(jsonObject) {
36
+ super.serializeInto(jsonObject);
37
+ jsonObject.name = this.name;
38
+ }
39
+ }
40
+ return MixedClass;
41
+ }
42
+ /**
43
+ * Static members for {@link (ApiNameMixin:interface)}.
44
+ * @public
45
+ */
46
+ (function (ApiNameMixin) {
47
+ /**
48
+ * A type guard that tests whether the specified `ApiItem` subclass extends the `ApiNameMixin` mixin.
49
+ *
50
+ * @remarks
51
+ *
52
+ * The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
53
+ * the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
54
+ * the TypeScript type system cannot invoke a runtime test.)
55
+ */
56
+ function isBaseClassOf(apiItem) {
57
+ return apiItem.hasOwnProperty(_name);
58
+ }
59
+ ApiNameMixin.isBaseClassOf = isBaseClassOf;
60
+ })(ApiNameMixin || (ApiNameMixin = {}));
61
+ //# sourceMappingURL=ApiNameMixin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApiNameMixin.js","sourceRoot":"","sources":["../../src/mixins/ApiNameMixin.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAmB3D,MAAM,KAAK,GAAkB,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAgC1D;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAC1B,SAAqB;AACrB,8DAA8D;;IAE9D,MAAM,UAAW,SAAQ,SAAS;QAGhC,8DAA8D;QAC9D,YAAmB,GAAG,IAAW;YAC/B,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;YAEf,MAAM,OAAO,GAAyB,IAAI,CAAC,CAAC,CAAC,CAAC;YAC9C,IAAI,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;QAC7B,CAAC;QAED,gBAAgB;QACT,MAAM,CAAC,iBAAiB,CAC7B,OAAsC,EACtC,OAA4B,EAC5B,UAA6B;YAE7B,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;YAE1D,OAAO,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QACjC,CAAC;QAED,IAAW,IAAI;YACb,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;QAED,gBAAgB;QAChB,IAAW,WAAW;YACpB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;QAED,gBAAgB;QACT,aAAa,CAAC,UAAsC;YACzD,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAEhC,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAC9B,CAAC;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;GAGG;AACH,WAAiB,YAAY;IAC3B;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAgB;QAC5C,OAAO,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAFe,0BAAa,gBAE5B,CAAA;AACH,CAAC,EAbgB,YAAY,KAAZ,YAAY,QAa5B","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/* eslint-disable @typescript-eslint/no-redeclare */\n\nimport type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';\nimport type { DeserializerContext } from '../model/DeserializerContext';\n\n/**\n * Constructor options for {@link (IApiNameMixinOptions:interface)}.\n * @public\n */\nexport interface IApiNameMixinOptions extends IApiItemOptions {\n name: string;\n}\n\nexport interface IApiNameMixinJson extends IApiItemJson {\n name: string;\n}\n\nconst _name: unique symbol = Symbol('ApiNameMixin._name');\n\n/**\n * The mixin base class for API items that have a name. For example, a class has a name, but a class constructor\n * does not.\n *\n * @remarks\n *\n * This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of\n * API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use\n * TypeScript \"mixin\" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various\n * features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class\n * to extend more than one base class). The \"mixin\" is a TypeScript merged declaration with three components:\n * the function that generates a subclass, an interface that describes the members of the subclass, and\n * a namespace containing static members of the class.\n *\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface ApiNameMixin extends ApiItem {\n /**\n * The exported name of this API item.\n *\n * @remarks\n * Note that due tue type aliasing, the exported name may be different from the locally declared name.\n */\n readonly name: string;\n\n /** @override */\n serializeInto(jsonObject: Partial<IApiItemJson>): void;\n}\n\n/**\n * Mixin function for {@link (ApiNameMixin:interface)}.\n *\n * @param baseClass - The base class to be extended\n * @returns A child class that extends baseClass, adding the {@link (ApiNameMixin:interface)} functionality.\n *\n * @public\n */\nexport function ApiNameMixin<TBaseClass extends IApiItemConstructor>(\n baseClass: TBaseClass\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): TBaseClass & (new (...args: any[]) => ApiNameMixin) {\n class MixedClass extends baseClass implements ApiNameMixin {\n public readonly [_name]: string;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public constructor(...args: any[]) {\n super(...args);\n\n const options: IApiNameMixinOptions = args[0];\n this[_name] = options.name;\n }\n\n /** @override */\n public static onDeserializeInto(\n options: Partial<IApiNameMixinOptions>,\n context: DeserializerContext,\n jsonObject: IApiNameMixinJson\n ): void {\n baseClass.onDeserializeInto(options, context, jsonObject);\n\n options.name = jsonObject.name;\n }\n\n public get name(): string {\n return this[_name];\n }\n\n /** @override */\n public get displayName(): string {\n return this[_name];\n }\n\n /** @override */\n public serializeInto(jsonObject: Partial<IApiNameMixinJson>): void {\n super.serializeInto(jsonObject);\n\n jsonObject.name = this.name;\n }\n }\n\n return MixedClass;\n}\n\n/**\n * Static members for {@link (ApiNameMixin:interface)}.\n * @public\n */\nexport namespace ApiNameMixin {\n /**\n * A type guard that tests whether the specified `ApiItem` subclass extends the `ApiNameMixin` mixin.\n *\n * @remarks\n *\n * The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of\n * the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however\n * the TypeScript type system cannot invoke a runtime test.)\n */\n export function isBaseClassOf(apiItem: ApiItem): apiItem is ApiNameMixin {\n return apiItem.hasOwnProperty(_name);\n }\n}\n"]}
@@ -0,0 +1,57 @@
1
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
2
+ // See LICENSE in the project root for license information.
3
+ const _isOptional = Symbol('ApiOptionalMixin._isOptional');
4
+ /**
5
+ * Mixin function for {@link (ApiOptionalMixin:interface)}.
6
+ *
7
+ * @param baseClass - The base class to be extended
8
+ * @returns A child class that extends baseClass, adding the {@link (ApiOptionalMixin:interface)} functionality.
9
+ *
10
+ * @public
11
+ */
12
+ export function ApiOptionalMixin(baseClass
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
+ ) {
15
+ class MixedClass extends baseClass {
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
+ constructor(...args) {
18
+ super(...args);
19
+ const options = args[0];
20
+ this[_isOptional] = !!options.isOptional;
21
+ }
22
+ /** @override */
23
+ static onDeserializeInto(options, context, jsonObject) {
24
+ baseClass.onDeserializeInto(options, context, jsonObject);
25
+ options.isOptional = !!jsonObject.isOptional;
26
+ }
27
+ get isOptional() {
28
+ return this[_isOptional];
29
+ }
30
+ /** @override */
31
+ serializeInto(jsonObject) {
32
+ super.serializeInto(jsonObject);
33
+ jsonObject.isOptional = this.isOptional;
34
+ }
35
+ }
36
+ return MixedClass;
37
+ }
38
+ /**
39
+ * Optional members for {@link (ApiOptionalMixin:interface)}.
40
+ * @public
41
+ */
42
+ (function (ApiOptionalMixin) {
43
+ /**
44
+ * A type guard that tests whether the specified `ApiItem` subclass extends the `ApiOptionalMixin` mixin.
45
+ *
46
+ * @remarks
47
+ *
48
+ * The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
49
+ * the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
50
+ * the TypeScript type system cannot invoke a runtime test.)
51
+ */
52
+ function isBaseClassOf(apiItem) {
53
+ return apiItem.hasOwnProperty(_isOptional);
54
+ }
55
+ ApiOptionalMixin.isBaseClassOf = isBaseClassOf;
56
+ })(ApiOptionalMixin || (ApiOptionalMixin = {}));
57
+ //# sourceMappingURL=ApiOptionalMixin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApiOptionalMixin.js","sourceRoot":"","sources":["../../src/mixins/ApiOptionalMixin.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAmB3D,MAAM,WAAW,GAAkB,MAAM,CAAC,8BAA8B,CAAC,CAAC;AAqC1E;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAAqB;AACrB,8DAA8D;;IAE9D,MAAM,UAAW,SAAQ,SAAS;QAGhC,8DAA8D;QAC9D,YAAmB,GAAG,IAAW;YAC/B,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;YAEf,MAAM,OAAO,GAA6B,IAAI,CAAC,CAAC,CAAC,CAAC;YAClD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;QAC3C,CAAC;QAED,gBAAgB;QACT,MAAM,CAAC,iBAAiB,CAC7B,OAA0C,EAC1C,OAA4B,EAC5B,UAAiC;YAEjC,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;YAE1D,OAAO,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC;QAC/C,CAAC;QAED,IAAW,UAAU;YACnB,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC;QAC3B,CAAC;QAED,gBAAgB;QACT,aAAa,CAAC,UAA0C;YAC7D,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAEhC,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAC1C,CAAC;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;GAGG;AACH,WAAiB,gBAAgB;IAC/B;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAgB;QAC5C,OAAO,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IAC7C,CAAC;IAFe,8BAAa,gBAE5B,CAAA;AACH,CAAC,EAbgB,gBAAgB,KAAhB,gBAAgB,QAahC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/* eslint-disable @typescript-eslint/no-redeclare */\n\nimport type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';\nimport type { DeserializerContext } from '../model/DeserializerContext';\n\n/**\n * Constructor options for {@link (IApiOptionalMixinOptions:interface)}.\n * @public\n */\nexport interface IApiOptionalMixinOptions extends IApiItemOptions {\n isOptional: boolean;\n}\n\nexport interface IApiOptionalMixinJson extends IApiItemJson {\n isOptional: boolean;\n}\n\nconst _isOptional: unique symbol = Symbol('ApiOptionalMixin._isOptional');\n\n/**\n * The mixin base class for API items that can be marked as optional by appending a `?` to them.\n * For example, a property of an interface can be optional.\n *\n * @remarks\n *\n * This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of\n * API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use\n * TypeScript \"mixin\" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various\n * features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class\n * to extend more than one base class). The \"mixin\" is a TypeScript merged declaration with three components:\n * the function that generates a subclass, an interface that describes the members of the subclass, and\n * a namespace containing static members of the class.\n *\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface ApiOptionalMixin extends ApiItem {\n /**\n * True if this is an optional property.\n * @remarks\n * For example:\n * ```ts\n * interface X {\n * y: string; // not optional\n * z?: string; // optional\n * }\n * ```\n */\n readonly isOptional: boolean;\n\n /** @override */\n serializeInto(jsonObject: Partial<IApiItemJson>): void;\n}\n\n/**\n * Mixin function for {@link (ApiOptionalMixin:interface)}.\n *\n * @param baseClass - The base class to be extended\n * @returns A child class that extends baseClass, adding the {@link (ApiOptionalMixin:interface)} functionality.\n *\n * @public\n */\nexport function ApiOptionalMixin<TBaseClass extends IApiItemConstructor>(\n baseClass: TBaseClass\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): TBaseClass & (new (...args: any[]) => ApiOptionalMixin) {\n class MixedClass extends baseClass implements ApiOptionalMixin {\n public [_isOptional]: boolean;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public constructor(...args: any[]) {\n super(...args);\n\n const options: IApiOptionalMixinOptions = args[0];\n this[_isOptional] = !!options.isOptional;\n }\n\n /** @override */\n public static onDeserializeInto(\n options: Partial<IApiOptionalMixinOptions>,\n context: DeserializerContext,\n jsonObject: IApiOptionalMixinJson\n ): void {\n baseClass.onDeserializeInto(options, context, jsonObject);\n\n options.isOptional = !!jsonObject.isOptional;\n }\n\n public get isOptional(): boolean {\n return this[_isOptional];\n }\n\n /** @override */\n public serializeInto(jsonObject: Partial<IApiOptionalMixinJson>): void {\n super.serializeInto(jsonObject);\n\n jsonObject.isOptional = this.isOptional;\n }\n }\n\n return MixedClass;\n}\n\n/**\n * Optional members for {@link (ApiOptionalMixin:interface)}.\n * @public\n */\nexport namespace ApiOptionalMixin {\n /**\n * A type guard that tests whether the specified `ApiItem` subclass extends the `ApiOptionalMixin` mixin.\n *\n * @remarks\n *\n * The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of\n * the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however\n * the TypeScript type system cannot invoke a runtime test.)\n */\n export function isBaseClassOf(apiItem: ApiItem): apiItem is ApiOptionalMixin {\n return apiItem.hasOwnProperty(_isOptional);\n }\n}\n"]}
@@ -0,0 +1,93 @@
1
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
2
+ // See LICENSE in the project root for license information.
3
+ /* eslint-disable @typescript-eslint/no-redeclare */
4
+ import { InternalError } from '@rushstack/node-core-library';
5
+ import { Parameter } from '../model/Parameter';
6
+ import { ApiDeclaredItem } from '../items/ApiDeclaredItem';
7
+ const _overloadIndex = Symbol('ApiParameterListMixin._overloadIndex');
8
+ const _parameters = Symbol('ApiParameterListMixin._parameters');
9
+ /**
10
+ * Mixin function for {@link (ApiParameterListMixin:interface)}.
11
+ *
12
+ * @param baseClass - The base class to be extended
13
+ * @returns A child class that extends baseClass, adding the {@link (ApiParameterListMixin:interface)} functionality.
14
+ *
15
+ * @public
16
+ */
17
+ export function ApiParameterListMixin(baseClass
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
+ ) {
20
+ class MixedClass extends baseClass {
21
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
+ constructor(...args) {
23
+ super(...args);
24
+ const options = args[0];
25
+ this[_overloadIndex] = options.overloadIndex;
26
+ this[_parameters] = [];
27
+ if (this instanceof ApiDeclaredItem) {
28
+ if (options.parameters) {
29
+ for (const parameterOptions of options.parameters) {
30
+ const parameter = new Parameter({
31
+ name: parameterOptions.parameterName,
32
+ parameterTypeExcerpt: this.buildExcerpt(parameterOptions.parameterTypeTokenRange),
33
+ // Prior to ApiJsonSchemaVersion.V_1005 this input will be undefined
34
+ isOptional: !!parameterOptions.isOptional,
35
+ parent: this
36
+ });
37
+ this[_parameters].push(parameter);
38
+ }
39
+ }
40
+ }
41
+ else {
42
+ throw new InternalError('ApiReturnTypeMixin expects a base class that inherits from ApiDeclaredItem');
43
+ }
44
+ }
45
+ /** @override */
46
+ static onDeserializeInto(options, context, jsonObject) {
47
+ baseClass.onDeserializeInto(options, context, jsonObject);
48
+ options.overloadIndex = jsonObject.overloadIndex;
49
+ options.parameters = jsonObject.parameters || [];
50
+ }
51
+ get overloadIndex() {
52
+ return this[_overloadIndex];
53
+ }
54
+ get parameters() {
55
+ return this[_parameters];
56
+ }
57
+ /** @override */
58
+ serializeInto(jsonObject) {
59
+ super.serializeInto(jsonObject);
60
+ jsonObject.overloadIndex = this.overloadIndex;
61
+ const parameterObjects = [];
62
+ for (const parameter of this.parameters) {
63
+ parameterObjects.push({
64
+ parameterName: parameter.name,
65
+ parameterTypeTokenRange: parameter.parameterTypeExcerpt.tokenRange,
66
+ isOptional: parameter.isOptional
67
+ });
68
+ }
69
+ jsonObject.parameters = parameterObjects;
70
+ }
71
+ }
72
+ return MixedClass;
73
+ }
74
+ /**
75
+ * Static members for {@link (ApiParameterListMixin:interface)}.
76
+ * @public
77
+ */
78
+ (function (ApiParameterListMixin) {
79
+ /**
80
+ * A type guard that tests whether the specified `ApiItem` subclass extends the `ApiParameterListMixin` mixin.
81
+ *
82
+ * @remarks
83
+ *
84
+ * The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of
85
+ * the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however
86
+ * the TypeScript type system cannot invoke a runtime test.)
87
+ */
88
+ function isBaseClassOf(apiItem) {
89
+ return apiItem.hasOwnProperty(_parameters);
90
+ }
91
+ ApiParameterListMixin.isBaseClassOf = isBaseClassOf;
92
+ })(ApiParameterListMixin || (ApiParameterListMixin = {}));
93
+ //# sourceMappingURL=ApiParameterListMixin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApiParameterListMixin.js","sourceRoot":"","sources":["../../src/mixins/ApiParameterListMixin.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,oDAAoD;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAG7D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,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,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;YAE1D,OAAO,CAAC,aAAa,GAAG,UAAU,CAAC,aAAa,CAAC;YACjD,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,IAAI,EAAE,CAAC;QACnD,CAAC;QAED,IAAW,aAAa;YACtB,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC;QAC9B,CAAC;QAED,IAAW,UAAU;YACnB,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC;QAC3B,CAAC;QAED,gBAAgB;QACT,aAAa,CAAC,UAA0C;YAC7D,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAEhC,UAAU,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;YAE9C,MAAM,gBAAgB,GAA2B,EAAE,CAAC;YACpD,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBACxC,gBAAgB,CAAC,IAAI,CAAC;oBACpB,aAAa,EAAE,SAAS,CAAC,IAAI;oBAC7B,uBAAuB,EAAE,SAAS,CAAC,oBAAoB,CAAC,UAAU;oBAClE,UAAU,EAAE,SAAS,CAAC,UAAU;iBACjC,CAAC,CAAC;YACL,CAAC;YAED,UAAU,CAAC,UAAU,GAAG,gBAAgB,CAAC;QAC3C,CAAC;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;GAGG;AACH,WAAiB,qBAAqB;IACpC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAgB;QAC5C,OAAO,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IAC7C,CAAC;IAFe,mCAAa,gBAE5B,CAAA;AACH,CAAC,EAbgB,qBAAqB,KAArB,qBAAqB,QAarC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/* eslint-disable @typescript-eslint/no-redeclare */\n\nimport { InternalError } from '@rushstack/node-core-library';\n\nimport type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';\nimport { Parameter } from '../model/Parameter';\nimport { ApiDeclaredItem } from '../items/ApiDeclaredItem';\nimport type { IExcerptTokenRange } from './Excerpt';\nimport type { DeserializerContext } from '../model/DeserializerContext';\n\n/**\n * Represents parameter information that is part of {@link IApiParameterListMixinOptions}\n * @public\n */\nexport interface IApiParameterOptions {\n parameterName: string;\n parameterTypeTokenRange: IExcerptTokenRange;\n isOptional: boolean;\n}\n\n/**\n * Constructor options for {@link (ApiParameterListMixin:interface)}.\n * @public\n */\nexport interface IApiParameterListMixinOptions extends IApiItemOptions {\n overloadIndex: number;\n parameters: IApiParameterOptions[];\n}\n\nexport interface IApiParameterListJson extends IApiItemJson {\n overloadIndex: number;\n parameters: IApiParameterOptions[];\n}\n\nconst _overloadIndex: unique symbol = Symbol('ApiParameterListMixin._overloadIndex');\nconst _parameters: unique symbol = Symbol('ApiParameterListMixin._parameters');\n\n/**\n * The mixin base class for API items that can have function parameters (but not necessarily a return value).\n *\n * @remarks\n *\n * This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of\n * API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use\n * TypeScript \"mixin\" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various\n * features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class\n * to extend more than one base class). The \"mixin\" is a TypeScript merged declaration with three components:\n * the function that generates a subclass, an interface that describes the members of the subclass, and\n * a namespace containing static members of the class.\n *\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface ApiParameterListMixin extends ApiItem {\n /**\n * When a function has multiple overloaded declarations, this one-based integer index can be used to uniquely\n * identify them.\n *\n * @remarks\n *\n * Consider this overloaded declaration:\n *\n * ```ts\n * export namespace Versioning {\n * // TSDoc: Versioning.(addVersions:1)\n * export function addVersions(x: number, y: number): number;\n *\n * // TSDoc: Versioning.(addVersions:2)\n * export function addVersions(x: string, y: string): string;\n *\n * // (implementation)\n * export function addVersions(x: number|string, y: number|string): number|string {\n * // . . .\n * }\n * }\n * ```\n *\n * In the above example, there are two overloaded declarations. The overload using numbers will have\n * `overloadIndex = 1`. The overload using strings will have `overloadIndex = 2`. The third declaration that\n * accepts all possible inputs is considered part of the implementation, and is not processed by API Extractor.\n */\n readonly overloadIndex: number;\n\n /**\n * The function parameters.\n */\n readonly parameters: ReadonlyArray<Parameter>;\n\n serializeInto(jsonObject: Partial<IApiItemJson>): void;\n}\n\n/**\n * Mixin function for {@link (ApiParameterListMixin:interface)}.\n *\n * @param baseClass - The base class to be extended\n * @returns A child class that extends baseClass, adding the {@link (ApiParameterListMixin:interface)} functionality.\n *\n * @public\n */\nexport function ApiParameterListMixin<TBaseClass extends IApiItemConstructor>(\n baseClass: TBaseClass\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): TBaseClass & (new (...args: any[]) => ApiParameterListMixin) {\n class MixedClass extends baseClass implements ApiParameterListMixin {\n public readonly [_overloadIndex]: number;\n public readonly [_parameters]: Parameter[];\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public constructor(...args: any[]) {\n super(...args);\n\n const options: IApiParameterListMixinOptions = args[0];\n this[_overloadIndex] = options.overloadIndex;\n\n this[_parameters] = [];\n\n if (this instanceof ApiDeclaredItem) {\n if (options.parameters) {\n for (const parameterOptions of options.parameters) {\n const parameter: Parameter = new Parameter({\n name: parameterOptions.parameterName,\n parameterTypeExcerpt: this.buildExcerpt(parameterOptions.parameterTypeTokenRange),\n // Prior to ApiJsonSchemaVersion.V_1005 this input will be undefined\n isOptional: !!parameterOptions.isOptional,\n parent: this\n });\n\n this[_parameters].push(parameter);\n }\n }\n } else {\n throw new InternalError('ApiReturnTypeMixin expects a base class that inherits from ApiDeclaredItem');\n }\n }\n\n /** @override */\n public static onDeserializeInto(\n options: Partial<IApiParameterListMixinOptions>,\n context: DeserializerContext,\n jsonObject: IApiParameterListJson\n ): void {\n baseClass.onDeserializeInto(options, context, jsonObject);\n\n options.overloadIndex = jsonObject.overloadIndex;\n options.parameters = jsonObject.parameters || [];\n }\n\n public get overloadIndex(): number {\n return this[_overloadIndex];\n }\n\n public get parameters(): ReadonlyArray<Parameter> {\n return this[_parameters];\n }\n\n /** @override */\n public serializeInto(jsonObject: Partial<IApiParameterListJson>): void {\n super.serializeInto(jsonObject);\n\n jsonObject.overloadIndex = this.overloadIndex;\n\n const parameterObjects: IApiParameterOptions[] = [];\n for (const parameter of this.parameters) {\n parameterObjects.push({\n parameterName: parameter.name,\n parameterTypeTokenRange: parameter.parameterTypeExcerpt.tokenRange,\n isOptional: parameter.isOptional\n });\n }\n\n jsonObject.parameters = parameterObjects;\n }\n }\n\n return MixedClass;\n}\n\n/**\n * Static members for {@link (ApiParameterListMixin:interface)}.\n * @public\n */\nexport namespace ApiParameterListMixin {\n /**\n * A type guard that tests whether the specified `ApiItem` subclass extends the `ApiParameterListMixin` mixin.\n *\n * @remarks\n *\n * The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of\n * the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however\n * the TypeScript type system cannot invoke a runtime test.)\n */\n export function isBaseClassOf(apiItem: ApiItem): apiItem is ApiParameterListMixin {\n return apiItem.hasOwnProperty(_parameters);\n }\n}\n"]}