@microsoft/typespec-msgraph 0.0.1-Preview.1 → 0.0.1-Preview.11

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 (371) hide show
  1. package/dist/src/components/acceptable-media-types-annotation.d.ts +3 -4
  2. package/dist/src/components/acceptable-media-types-annotation.d.ts.map +1 -1
  3. package/dist/src/components/acceptable-media-types-annotation.js +2 -6
  4. package/dist/src/components/acceptable-media-types-annotation.js.map +1 -1
  5. package/dist/src/components/alternate-keys-annotation.d.ts +4 -4
  6. package/dist/src/components/alternate-keys-annotation.d.ts.map +1 -1
  7. package/dist/src/components/alternate-keys-annotation.js +8 -16
  8. package/dist/src/components/alternate-keys-annotation.js.map +1 -1
  9. package/dist/src/components/annotations.d.ts +12 -0
  10. package/dist/src/components/annotations.d.ts.map +1 -0
  11. package/dist/src/components/annotations.js +63 -0
  12. package/dist/src/components/annotations.js.map +1 -0
  13. package/dist/src/components/common-elements.d.ts +15 -73
  14. package/dist/src/components/common-elements.d.ts.map +1 -1
  15. package/dist/src/components/common-elements.js +12 -26
  16. package/dist/src/components/common-elements.js.map +1 -1
  17. package/dist/src/components/computed-annotation.d.ts +3 -4
  18. package/dist/src/components/computed-annotation.d.ts.map +1 -1
  19. package/dist/src/components/computed-annotation.js +4 -10
  20. package/dist/src/components/computed-annotation.js.map +1 -1
  21. package/dist/src/components/count-restrictions-annotation.d.ts +3 -4
  22. package/dist/src/components/count-restrictions-annotation.d.ts.map +1 -1
  23. package/dist/src/components/count-restrictions-annotation.js +4 -13
  24. package/dist/src/components/count-restrictions-annotation.js.map +1 -1
  25. package/dist/src/components/description-annotation.d.ts +3 -4
  26. package/dist/src/components/description-annotation.d.ts.map +1 -1
  27. package/dist/src/components/description-annotation.js +5 -11
  28. package/dist/src/components/description-annotation.js.map +1 -1
  29. package/dist/src/components/entity-container-element.d.ts +21 -0
  30. package/dist/src/components/entity-container-element.d.ts.map +1 -0
  31. package/dist/src/components/entity-container-element.js +22 -0
  32. package/dist/src/components/entity-container-element.js.map +1 -0
  33. package/dist/src/components/enum-type-element.d.ts +6 -0
  34. package/dist/src/components/enum-type-element.d.ts.map +1 -0
  35. package/dist/src/components/enum-type-element.js +17 -0
  36. package/dist/src/components/enum-type-element.js.map +1 -0
  37. package/dist/src/components/expand-restrictions-annotation.d.ts +4 -5
  38. package/dist/src/components/expand-restrictions-annotation.d.ts.map +1 -1
  39. package/dist/src/components/expand-restrictions-annotation.js +9 -30
  40. package/dist/src/components/expand-restrictions-annotation.js.map +1 -1
  41. package/dist/src/components/filter-restrictions-annotation.d.ts +6 -0
  42. package/dist/src/components/filter-restrictions-annotation.d.ts.map +1 -0
  43. package/dist/src/components/filter-restrictions-annotation.js +10 -0
  44. package/dist/src/components/filter-restrictions-annotation.js.map +1 -0
  45. package/dist/src/components/immutable-annotation.d.ts +5 -0
  46. package/dist/src/components/immutable-annotation.d.ts.map +1 -0
  47. package/dist/src/components/immutable-annotation.js +6 -0
  48. package/dist/src/components/immutable-annotation.js.map +1 -0
  49. package/dist/src/components/index.d.ts +2 -14
  50. package/dist/src/components/index.d.ts.map +1 -1
  51. package/dist/src/components/index.js +9 -14
  52. package/dist/src/components/index.js.map +1 -1
  53. package/dist/src/components/insert-restrictions-annotation.d.ts +6 -0
  54. package/dist/src/components/insert-restrictions-annotation.d.ts.map +1 -0
  55. package/dist/src/components/insert-restrictions-annotation.js +10 -0
  56. package/dist/src/components/insert-restrictions-annotation.js.map +1 -0
  57. package/dist/src/components/operation-element.d.ts +6 -0
  58. package/dist/src/components/operation-element.d.ts.map +1 -0
  59. package/dist/src/components/operation-element.js +70 -0
  60. package/dist/src/components/operation-element.js.map +1 -0
  61. package/dist/src/components/permissions-annotation.d.ts +3 -4
  62. package/dist/src/components/permissions-annotation.d.ts.map +1 -1
  63. package/dist/src/components/permissions-annotation.js +2 -10
  64. package/dist/src/components/permissions-annotation.js.map +1 -1
  65. package/dist/src/components/property-element.d.ts +4 -4
  66. package/dist/src/components/property-element.d.ts.map +1 -1
  67. package/dist/src/components/property-element.js +16 -32
  68. package/dist/src/components/property-element.js.map +1 -1
  69. package/dist/src/components/revisions-annotation.d.ts +4 -5
  70. package/dist/src/components/revisions-annotation.d.ts.map +1 -1
  71. package/dist/src/components/revisions-annotation.js +7 -51
  72. package/dist/src/components/revisions-annotation.js.map +1 -1
  73. package/dist/src/components/schema-element.d.ts +6 -0
  74. package/dist/src/components/schema-element.d.ts.map +1 -0
  75. package/dist/src/components/schema-element.js +42 -0
  76. package/dist/src/components/schema-element.js.map +1 -0
  77. package/dist/src/components/search-restrictions-annotation.d.ts +3 -4
  78. package/dist/src/components/search-restrictions-annotation.d.ts.map +1 -1
  79. package/dist/src/components/search-restrictions-annotation.js +4 -13
  80. package/dist/src/components/search-restrictions-annotation.js.map +1 -1
  81. package/dist/src/components/skip-supported-annotation.d.ts +3 -4
  82. package/dist/src/components/skip-supported-annotation.d.ts.map +1 -1
  83. package/dist/src/components/skip-supported-annotation.js +2 -11
  84. package/dist/src/components/skip-supported-annotation.js.map +1 -1
  85. package/dist/src/components/sort-restrictions-annotation.d.ts +4 -5
  86. package/dist/src/components/sort-restrictions-annotation.d.ts.map +1 -1
  87. package/dist/src/components/sort-restrictions-annotation.js +9 -30
  88. package/dist/src/components/sort-restrictions-annotation.js.map +1 -1
  89. package/dist/src/components/structured-type-element.d.ts +7 -4
  90. package/dist/src/components/structured-type-element.d.ts.map +1 -1
  91. package/dist/src/components/structured-type-element.js +24 -66
  92. package/dist/src/components/structured-type-element.js.map +1 -1
  93. package/dist/src/components/top-supported-annotation.d.ts +3 -4
  94. package/dist/src/components/top-supported-annotation.d.ts.map +1 -1
  95. package/dist/src/components/top-supported-annotation.js +3 -10
  96. package/dist/src/components/top-supported-annotation.js.map +1 -1
  97. package/dist/src/components/update-restrictions-annotation.d.ts +5 -0
  98. package/dist/src/components/update-restrictions-annotation.d.ts.map +1 -0
  99. package/dist/src/components/update-restrictions-annotation.js +8 -0
  100. package/dist/src/components/update-restrictions-annotation.js.map +1 -0
  101. package/dist/src/decorators/abstract.d.ts.map +1 -1
  102. package/dist/src/decorators/abstract.js +0 -6
  103. package/dist/src/decorators/abstract.js.map +1 -1
  104. package/dist/src/decorators/action.d.ts +10 -0
  105. package/dist/src/decorators/action.d.ts.map +1 -0
  106. package/dist/src/decorators/action.js +16 -0
  107. package/dist/src/decorators/action.js.map +1 -0
  108. package/dist/src/decorators/{handlers/custom/additional-query-parameters.d.ts → additional-query-parameters.d.ts} +3 -1
  109. package/dist/src/decorators/additional-query-parameters.d.ts.map +1 -0
  110. package/dist/src/decorators/additional-query-parameters.js +21 -0
  111. package/dist/src/decorators/additional-query-parameters.js.map +1 -0
  112. package/dist/src/decorators/ags-attribute.d.ts +14 -0
  113. package/dist/src/decorators/ags-attribute.d.ts.map +1 -0
  114. package/dist/src/decorators/ags-attribute.js +115 -0
  115. package/dist/src/decorators/ags-attribute.js.map +1 -0
  116. package/dist/src/decorators/allowed-values.d.ts +13 -0
  117. package/dist/src/decorators/allowed-values.d.ts.map +1 -0
  118. package/dist/src/decorators/allowed-values.js +35 -0
  119. package/dist/src/decorators/allowed-values.js.map +1 -0
  120. package/dist/src/decorators/complex.d.ts.map +1 -1
  121. package/dist/src/decorators/complex.js +0 -6
  122. package/dist/src/decorators/complex.js.map +1 -1
  123. package/dist/src/decorators/delta-collection.d.ts +8 -0
  124. package/dist/src/decorators/delta-collection.d.ts.map +1 -0
  125. package/dist/src/decorators/delta-collection.js +12 -0
  126. package/dist/src/decorators/delta-collection.js.map +1 -0
  127. package/dist/src/decorators/entity.d.ts.map +1 -1
  128. package/dist/src/decorators/entity.js +0 -6
  129. package/dist/src/decorators/entity.js.map +1 -1
  130. package/dist/src/decorators/filter.d.ts +11 -0
  131. package/dist/src/decorators/filter.d.ts.map +1 -0
  132. package/dist/src/decorators/filter.js +27 -0
  133. package/dist/src/decorators/filter.js.map +1 -0
  134. package/dist/src/decorators/flags.d.ts +9 -0
  135. package/dist/src/decorators/flags.d.ts.map +1 -0
  136. package/dist/src/decorators/flags.js +13 -0
  137. package/dist/src/decorators/flags.js.map +1 -0
  138. package/dist/src/decorators/function.d.ts +10 -0
  139. package/dist/src/decorators/function.d.ts.map +1 -0
  140. package/dist/src/decorators/function.js +16 -0
  141. package/dist/src/decorators/function.js.map +1 -0
  142. package/dist/src/decorators/graph-route.d.ts +17 -0
  143. package/dist/src/decorators/graph-route.d.ts.map +1 -0
  144. package/dist/src/decorators/graph-route.js +92 -0
  145. package/dist/src/decorators/graph-route.js.map +1 -0
  146. package/dist/src/decorators/has-stream.d.ts +1 -2
  147. package/dist/src/decorators/has-stream.d.ts.map +1 -1
  148. package/dist/src/decorators/has-stream.js +1 -14
  149. package/dist/src/decorators/has-stream.js.map +1 -1
  150. package/dist/src/decorators/immutable.d.ts +8 -0
  151. package/dist/src/decorators/immutable.d.ts.map +1 -0
  152. package/dist/src/decorators/immutable.js +12 -0
  153. package/dist/src/decorators/immutable.js.map +1 -0
  154. package/dist/src/decorators/index.d.ts +20 -1
  155. package/dist/src/decorators/index.d.ts.map +1 -1
  156. package/dist/src/decorators/index.js +20 -1
  157. package/dist/src/decorators/index.js.map +1 -1
  158. package/dist/src/decorators/is-owner.d.ts +10 -0
  159. package/dist/src/decorators/is-owner.d.ts.map +1 -0
  160. package/dist/src/decorators/is-owner.js +17 -0
  161. package/dist/src/decorators/is-owner.js.map +1 -0
  162. package/dist/src/decorators/open.d.ts.map +1 -1
  163. package/dist/src/decorators/open.js +0 -6
  164. package/dist/src/decorators/open.js.map +1 -1
  165. package/dist/src/decorators/{routed-interfaces.d.ts → operation-parameters.d.ts} +3 -11
  166. package/dist/src/decorators/operation-parameters.d.ts.map +1 -0
  167. package/dist/src/decorators/operation-parameters.js +15 -0
  168. package/dist/src/decorators/operation-parameters.js.map +1 -0
  169. package/dist/src/decorators/paged-collection.d.ts +8 -0
  170. package/dist/src/decorators/paged-collection.d.ts.map +1 -0
  171. package/dist/src/decorators/paged-collection.js +12 -0
  172. package/dist/src/decorators/paged-collection.js.map +1 -0
  173. package/dist/src/decorators/partial.d.ts +10 -0
  174. package/dist/src/decorators/partial.d.ts.map +1 -0
  175. package/dist/src/decorators/partial.js +16 -0
  176. package/dist/src/decorators/partial.js.map +1 -0
  177. package/dist/src/decorators/private-preview.d.ts.map +1 -1
  178. package/dist/src/decorators/private-preview.js +0 -10
  179. package/dist/src/decorators/private-preview.js.map +1 -1
  180. package/dist/src/decorators/privileged.d.ts +9 -0
  181. package/dist/src/decorators/privileged.d.ts.map +1 -0
  182. package/dist/src/decorators/privileged.js +13 -0
  183. package/dist/src/decorators/privileged.js.map +1 -0
  184. package/dist/src/decorators/public-namespace.d.ts +10 -0
  185. package/dist/src/decorators/public-namespace.d.ts.map +1 -0
  186. package/dist/src/decorators/public-namespace.js +16 -0
  187. package/dist/src/decorators/public-namespace.js.map +1 -0
  188. package/dist/src/decorators/required-for-create.d.ts +10 -0
  189. package/dist/src/decorators/required-for-create.d.ts.map +1 -0
  190. package/dist/src/decorators/required-for-create.js +14 -0
  191. package/dist/src/decorators/required-for-create.js.map +1 -0
  192. package/dist/src/decorators/workload-name-msa.d.ts +9 -0
  193. package/dist/src/decorators/workload-name-msa.d.ts.map +1 -0
  194. package/dist/src/decorators/workload-name-msa.js +13 -0
  195. package/dist/src/decorators/workload-name-msa.js.map +1 -0
  196. package/dist/src/decorators/workload-name.d.ts +9 -0
  197. package/dist/src/decorators/workload-name.d.ts.map +1 -0
  198. package/dist/src/decorators/workload-name.js +13 -0
  199. package/dist/src/decorators/workload-name.js.map +1 -0
  200. package/dist/src/emitter.d.ts +2 -1
  201. package/dist/src/emitter.d.ts.map +1 -1
  202. package/dist/src/emitter.js +7 -3
  203. package/dist/src/emitter.js.map +1 -1
  204. package/dist/src/entities/annotations.d.ts +40 -0
  205. package/dist/src/entities/annotations.d.ts.map +1 -0
  206. package/dist/src/entities/annotations.js +139 -0
  207. package/dist/src/entities/annotations.js.map +1 -0
  208. package/dist/src/entities/entity-container.d.ts +15 -0
  209. package/dist/src/entities/entity-container.d.ts.map +1 -0
  210. package/dist/src/entities/entity-container.js +44 -0
  211. package/dist/src/entities/entity-container.js.map +1 -0
  212. package/dist/src/entities/enum.d.ts +17 -0
  213. package/dist/src/entities/enum.d.ts.map +1 -0
  214. package/dist/src/entities/enum.js +24 -0
  215. package/dist/src/entities/enum.js.map +1 -0
  216. package/dist/src/entities/model.d.ts +47 -0
  217. package/dist/src/entities/model.d.ts.map +1 -0
  218. package/dist/src/entities/model.js +104 -0
  219. package/dist/src/entities/model.js.map +1 -0
  220. package/dist/src/entities/namespace.d.ts +22 -0
  221. package/dist/src/entities/namespace.d.ts.map +1 -0
  222. package/dist/src/entities/namespace.js +84 -0
  223. package/dist/src/entities/namespace.js.map +1 -0
  224. package/dist/src/entities/operation.d.ts +28 -0
  225. package/dist/src/entities/operation.d.ts.map +1 -0
  226. package/dist/src/entities/operation.js +103 -0
  227. package/dist/src/entities/operation.js.map +1 -0
  228. package/dist/src/entities/property.d.ts +3 -0
  229. package/dist/src/entities/property.d.ts.map +1 -0
  230. package/dist/src/entities/property.js +57 -0
  231. package/dist/src/entities/property.js.map +1 -0
  232. package/dist/src/entities/revision-definition.d.ts +9 -0
  233. package/dist/src/entities/revision-definition.d.ts.map +1 -0
  234. package/dist/src/entities/revision-definition.js +42 -0
  235. package/dist/src/entities/revision-definition.js.map +1 -0
  236. package/dist/src/index.d.ts +0 -3
  237. package/dist/src/index.d.ts.map +1 -1
  238. package/dist/src/index.js +0 -3
  239. package/dist/src/index.js.map +1 -1
  240. package/dist/src/lib.d.ts +53 -2
  241. package/dist/src/lib.d.ts.map +1 -1
  242. package/dist/src/lib.js +25 -1
  243. package/dist/src/lib.js.map +1 -1
  244. package/dist/src/linter.d.ts.map +1 -1
  245. package/dist/src/linter.js +34 -25
  246. package/dist/src/linter.js.map +1 -1
  247. package/dist/src/rules/abstract.d.ts +2 -1
  248. package/dist/src/rules/abstract.d.ts.map +1 -1
  249. package/dist/src/rules/abstract.js +8 -8
  250. package/dist/src/rules/abstract.js.map +1 -1
  251. package/dist/src/rules/allowed-values.d.ts +6 -0
  252. package/dist/src/rules/allowed-values.d.ts.map +1 -0
  253. package/dist/src/rules/allowed-values.js +59 -0
  254. package/dist/src/rules/allowed-values.js.map +1 -0
  255. package/dist/src/rules/collection-navigation-properties-not-nullable.d.ts +2 -0
  256. package/dist/src/rules/collection-navigation-properties-not-nullable.d.ts.map +1 -0
  257. package/dist/src/rules/collection-navigation-properties-not-nullable.js +28 -0
  258. package/dist/src/rules/collection-navigation-properties-not-nullable.js.map +1 -0
  259. package/dist/src/rules/count.d.ts.map +1 -1
  260. package/dist/src/rules/count.js +3 -1
  261. package/dist/src/rules/count.js.map +1 -1
  262. package/dist/src/rules/disallowed-typespec-decorators.d.ts +2 -0
  263. package/dist/src/rules/disallowed-typespec-decorators.d.ts.map +1 -0
  264. package/dist/src/rules/disallowed-typespec-decorators.js +33 -0
  265. package/dist/src/rules/disallowed-typespec-decorators.js.map +1 -0
  266. package/dist/src/rules/entity.d.ts +1 -0
  267. package/dist/src/rules/entity.d.ts.map +1 -1
  268. package/dist/src/rules/entity.js +43 -1
  269. package/dist/src/rules/entity.js.map +1 -1
  270. package/dist/src/rules/enum.d.ts +2 -0
  271. package/dist/src/rules/enum.d.ts.map +1 -0
  272. package/dist/src/rules/enum.js +26 -0
  273. package/dist/src/rules/enum.js.map +1 -0
  274. package/dist/src/rules/expand.d.ts.map +1 -1
  275. package/dist/src/rules/expand.js +5 -7
  276. package/dist/src/rules/expand.js.map +1 -1
  277. package/dist/src/rules/extends-on-same-type.d.ts +2 -0
  278. package/dist/src/rules/extends-on-same-type.d.ts.map +1 -0
  279. package/dist/src/rules/extends-on-same-type.js +38 -0
  280. package/dist/src/rules/extends-on-same-type.js.map +1 -0
  281. package/dist/src/rules/filter.d.ts +4 -0
  282. package/dist/src/rules/filter.d.ts.map +1 -0
  283. package/dist/src/rules/filter.js +92 -0
  284. package/dist/src/rules/filter.js.map +1 -0
  285. package/dist/src/rules/function.d.ts +2 -0
  286. package/dist/src/rules/function.d.ts.map +1 -0
  287. package/dist/src/rules/function.js +26 -0
  288. package/dist/src/rules/function.js.map +1 -0
  289. package/dist/src/rules/graph-route.d.ts +6 -0
  290. package/dist/src/rules/graph-route.d.ts.map +1 -0
  291. package/dist/src/rules/graph-route.js +97 -0
  292. package/dist/src/rules/graph-route.js.map +1 -0
  293. package/dist/src/rules/index.d.ts +13 -6
  294. package/dist/src/rules/index.d.ts.map +1 -1
  295. package/dist/src/rules/index.js +13 -161
  296. package/dist/src/rules/index.js.map +1 -1
  297. package/dist/src/rules/namespace.d.ts +3 -0
  298. package/dist/src/rules/namespace.d.ts.map +1 -0
  299. package/dist/src/rules/namespace.js +58 -0
  300. package/dist/src/rules/namespace.js.map +1 -0
  301. package/dist/src/rules/operation-inside-interface.d.ts +2 -0
  302. package/dist/src/rules/operation-inside-interface.d.ts.map +1 -0
  303. package/dist/src/rules/operation-inside-interface.js +25 -0
  304. package/dist/src/rules/operation-inside-interface.js.map +1 -0
  305. package/dist/src/rules/order-by.d.ts +1 -1
  306. package/dist/src/rules/order-by.d.ts.map +1 -1
  307. package/dist/src/rules/order-by.js +11 -10
  308. package/dist/src/rules/order-by.js.map +1 -1
  309. package/dist/src/rules/partial.d.ts +5 -0
  310. package/dist/src/rules/partial.d.ts.map +1 -0
  311. package/dist/src/rules/partial.js +35 -0
  312. package/dist/src/rules/partial.js.map +1 -0
  313. package/dist/src/rules/required-for-create.d.ts +2 -0
  314. package/dist/src/rules/required-for-create.d.ts.map +1 -0
  315. package/dist/src/rules/required-for-create.js +40 -0
  316. package/dist/src/rules/required-for-create.js.map +1 -0
  317. package/dist/src/rules/search.d.ts.map +1 -1
  318. package/dist/src/rules/search.js +3 -1
  319. package/dist/src/rules/search.js.map +1 -1
  320. package/dist/src/rules/skip.d.ts.map +1 -1
  321. package/dist/src/rules/skip.js +3 -1
  322. package/dist/src/rules/skip.js.map +1 -1
  323. package/dist/src/rules/top.d.ts.map +1 -1
  324. package/dist/src/rules/top.js +3 -1
  325. package/dist/src/rules/top.js.map +1 -1
  326. package/dist/src/utils.d.ts +22 -0
  327. package/dist/src/utils.d.ts.map +1 -1
  328. package/dist/src/utils.js +160 -4
  329. package/dist/src/utils.js.map +1 -1
  330. package/lib/decorators.tsp +182 -39
  331. package/lib/deployment.tsp +18 -0
  332. package/lib/lib.tsp +6 -22
  333. package/lib/msgraph.tsp +4 -0
  334. package/lib/porcelain.tsp +135 -0
  335. package/lib/responses.tsp +82 -0
  336. package/lib/shared-models.tsp +75 -0
  337. package/package.json +31 -20
  338. package/dist/src/components/program-context.d.ts +0 -4
  339. package/dist/src/components/program-context.d.ts.map +0 -1
  340. package/dist/src/components/program-context.js +0 -3
  341. package/dist/src/components/program-context.js.map +0 -1
  342. package/dist/src/csdl.d.ts +0 -8
  343. package/dist/src/csdl.d.ts.map +0 -1
  344. package/dist/src/csdl.js +0 -298
  345. package/dist/src/csdl.js.map +0 -1
  346. package/dist/src/decorators/attribute-builder.d.ts +0 -2
  347. package/dist/src/decorators/attribute-builder.d.ts.map +0 -1
  348. package/dist/src/decorators/attribute-builder.js +0 -166
  349. package/dist/src/decorators/attribute-builder.js.map +0 -1
  350. package/dist/src/decorators/attributes.d.ts +0 -57
  351. package/dist/src/decorators/attributes.d.ts.map +0 -1
  352. package/dist/src/decorators/attributes.js +0 -50
  353. package/dist/src/decorators/attributes.js.map +0 -1
  354. package/dist/src/decorators/handlers/custom/additional-query-parameters.d.ts.map +0 -1
  355. package/dist/src/decorators/handlers/custom/additional-query-parameters.js +0 -36
  356. package/dist/src/decorators/handlers/custom/additional-query-parameters.js.map +0 -1
  357. package/dist/src/decorators/handlers/custom/ags-attribute.d.ts +0 -7
  358. package/dist/src/decorators/handlers/custom/ags-attribute.d.ts.map +0 -1
  359. package/dist/src/decorators/handlers/custom/ags-attribute.js +0 -36
  360. package/dist/src/decorators/handlers/custom/ags-attribute.js.map +0 -1
  361. package/dist/src/decorators/handlers/custom/index.d.ts +0 -3
  362. package/dist/src/decorators/handlers/custom/index.d.ts.map +0 -1
  363. package/dist/src/decorators/handlers/custom/index.js +0 -3
  364. package/dist/src/decorators/handlers/custom/index.js.map +0 -1
  365. package/dist/src/decorators/handlers/index.d.ts +0 -30
  366. package/dist/src/decorators/handlers/index.d.ts.map +0 -1
  367. package/dist/src/decorators/handlers/index.js +0 -121
  368. package/dist/src/decorators/handlers/index.js.map +0 -1
  369. package/dist/src/decorators/routed-interfaces.d.ts.map +0 -1
  370. package/dist/src/decorators/routed-interfaces.js +0 -43
  371. package/dist/src/decorators/routed-interfaces.js.map +0 -1
@@ -1,13 +1,13 @@
1
- import { createRule } from "@typespec/lint";
2
1
  import { isAbstract, isComplex, isEntity } from "../index.js";
3
2
  import { reportDiagnostic } from "../lib.js";
3
+ import { navigateTypesInNamespace } from "@typespec/compiler";
4
+ import { GetDeclaredNamespaces } from "../entities/namespace.js";
4
5
  /**
5
6
  * @abstract applies to either an entity or a complex type.
6
7
  */
7
- export const abstractOnlyAppliesToStructuredTypeRule = createRule({
8
- name: "abstract-only-applies-to-structured-type",
9
- create({ program }) {
10
- return {
8
+ export function validateAbstractOnlyAppliesToStructuredTypes(program) {
9
+ for (const namespace of GetDeclaredNamespaces(program)) {
10
+ navigateTypesInNamespace(namespace, {
11
11
  model: (model) => {
12
12
  if (!isAbstract(program, model)) {
13
13
  return;
@@ -25,7 +25,7 @@ export const abstractOnlyAppliesToStructuredTypeRule = createRule({
25
25
  },
26
26
  });
27
27
  },
28
- };
29
- },
30
- });
28
+ });
29
+ }
30
+ }
31
31
  //# sourceMappingURL=abstract.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"abstract.js","sourceRoot":"","sources":["../../../src/rules/abstract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC9D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EAAE;oBAC/B,OAAO;iBACR;gBAED,IAAI,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;oBACzD,OAAO;iBACR;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,KAAK;oBACb,SAAS,EAAE,WAAW;oBACtB,MAAM,EAAE;wBACN,SAAS,EAAE,WAAW;wBACtB,MAAM,EAAE,gCAAgC;qBACzC;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC,CAAC;KACJ;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ /***
2
+ * @allowedValues can only be applied to string model properties
3
+ * @allowedValues cannot have empty values
4
+ */
5
+ export declare const allowedValuesCannotBeEmptyRule: import("@typespec/lint").LintRule;
6
+ //# sourceMappingURL=allowed-values.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allowed-values.d.ts","sourceRoot":"","sources":["../../../src/rules/allowed-values.ts"],"names":[],"mappings":"AAIA;;;GAGG;AAEH,eAAO,MAAM,8BAA8B,mCAqDzC,CAAA"}
@@ -0,0 +1,59 @@
1
+ import { createRule } from "@typespec/lint";
2
+ import { getAllowedValues, hasAllowedValues, isAllowedValuesArgumentsEmpty, isAllowedValuesPrimitive } from "../index.js";
3
+ import { reportDiagnostic } from "../lib.js";
4
+ /***
5
+ * @allowedValues can only be applied to string model properties
6
+ * @allowedValues cannot have empty values
7
+ */
8
+ export const allowedValuesCannotBeEmptyRule = createRule({
9
+ name: "allowed-values-cannot-be-empty-rule",
10
+ create({ program }) {
11
+ return {
12
+ modelProperty: (property) => {
13
+ var _a;
14
+ if (!hasAllowedValues(program, property)) {
15
+ return;
16
+ }
17
+ if (isAllowedValuesArgumentsEmpty(program, property)) {
18
+ reportDiagnostic(program, {
19
+ code: "decorator-invalid-use",
20
+ target: property,
21
+ messageId: "allowedValues",
22
+ format: {
23
+ decorator: "@allowedValues"
24
+ },
25
+ });
26
+ }
27
+ const allowedValues = getAllowedValues(program, property);
28
+ if (((_a = allowedValues === null || allowedValues === void 0 ? void 0 : allowedValues.values) === null || _a === void 0 ? void 0 : _a.length) > 0) {
29
+ const values = allowedValues.values;
30
+ const expectedType = typeof values[0];
31
+ for (let i = 1; i < values.length; i++) {
32
+ if (typeof values[i] !== expectedType) {
33
+ reportDiagnostic(program, {
34
+ code: 'decorator-invalid-use',
35
+ target: property,
36
+ messageId: 'allowedValuesTypeHomogeinity',
37
+ format: {
38
+ decorator: '@allowedValues'
39
+ }
40
+ });
41
+ break;
42
+ }
43
+ }
44
+ }
45
+ if (!isAllowedValuesPrimitive(program, property)) {
46
+ reportDiagnostic(program, {
47
+ code: "decorator-invalid-use",
48
+ target: property,
49
+ messageId: "allowedValuesInvalidType",
50
+ format: {
51
+ decorator: "@allowedValues"
52
+ },
53
+ });
54
+ }
55
+ },
56
+ };
57
+ }
58
+ });
59
+ //# sourceMappingURL=allowed-values.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allowed-values.js","sourceRoot":"","sources":["../../../src/rules/allowed-values.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,6BAA6B,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC1H,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C;;;GAGG;AAEH,MAAM,CAAC,MAAM,8BAA8B,GAAG,UAAU,CAAC;IACvD,IAAI,EAAE,qCAAqC;IAC3C,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,aAAa,EAAE,CAAC,QAAQ,EAAE,EAAE;;gBAC1B,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE;oBACxC,OAAO;iBACR;gBAED,IAAG,6BAA6B,CAAC,OAAO,EAAE,QAAQ,CA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ullableRule: import("@typespec/lint").LintRule;
2
+ //# sourceMappingURL=collection-navigation-properties-not-nullable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collection-navigation-properties-not-nullable.d.ts","sourceRoot":"","sources":["../../../src/rules/collection-navigation-properties-not-nullable.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,wDAAwD,mCA2BjE,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { createRule } from "@typespec/lint";
2
+ import { isTypeCollection, isNavigationProperty, isTypeNullable, } from "../utils.js";
3
+ import { reportDiagnostic } from "../lib.js";
4
+ export const collectionValuedNavigationPropertiesCannotBeNullableRule = createRule({
5
+ name: "collection-valued-navigation-properties-cannot-be-nullable",
6
+ create({ program }) {
7
+ return {
8
+ modelProperty: (property) => {
9
+ if (!isNavigationProperty(program, property)) {
10
+ return;
11
+ }
12
+ if (!isTypeCollection(program, property.type)) {
13
+ return;
14
+ }
15
+ if (!isTypeNullable(program, property.type)) {
16
+ return;
17
+ }
18
+ reportDiagnostic(program, {
19
+ code: "element-missing-dependencies",
20
+ target: property,
21
+ messageId: "collectionNavigationPropertiesNotNullable",
22
+ format: {},
23
+ });
24
+ },
25
+ };
26
+ },
27
+ });
28
+ //# sourceMappingURL=collection-navigation-properties-not-nullable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collection-navigation-properties-not-nullable.js","sourceRoot":"","sources":["../../../src/rules/collection-navigation-properties-not-nullable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,CAAC,MAAM,wDAAwD,GACnE,UAAU,CAAC;IACT,IAAI,EAAE,4DAA4D;IAClE,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,aAAa,EAAE,CAAC,QAAQ,EAAE,EAAE;gBAC1B,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE;oBAC5C,OAAO;iBACR;gBAED,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE;oBAC7C,OAAO;iBACR;gBAED,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE;oBAC3C,OAAO;iBACR;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,8BAA8B;oBACpC,MAAM,EAAE,QAAQ;oBAChB,SAAS,EAAE,2CAA2C;oBACtD,MAAM,EAAE,EAAE;iBACX,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"count.d.ts","sourceRoot":"","sources":["../../../src/rules/count.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,oDAAoD,mCA4B/D,CAAC"}
1
+ {"version":3,"file":"count.d.ts","sourceRoot":"","sources":["../../../src/rules/count.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,eAAO,MAAM,oDAAoD,mCA6B/D,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { createRule } from "@typespec/lint";
2
2
  import { getOperationVerb } from "@typespec/http";
3
3
  import { isCount } from "../index.js";
4
+ import { isTypeCollection } from "../utils.js";
4
5
  import { reportDiagnostic } from "../lib.js";
5
6
  /**
6
7
  * @count applies to get operations that return collections.
@@ -15,7 +16,8 @@ export const countAppliesToGetOperationsThatReturnCollectionsRule = createRule({
15
16
  }
16
17
  if (getOperationVerb(program, operation) === "get") {
17
18
  const returnType = operation.returnType;
18
- if (returnType.kind === "Model" && returnType.name === "PagedListResponse") {
19
+ const isCollection = isTypeCollection(program, returnType);
20
+ if (isCollection) {
19
21
  return;
20
22
  }
21
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"count.js","sourceRoot":"","sources":["../../../src/rules/count.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,oDAAoD,GAAG,UAAU,CAAC;IAC7E,IAAI,EAAE,yDAAyD;IAC/D,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE;gBACvB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE;oBAChC,OAAO;iBACR;gBAED,IAAI,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,KAAK,KAAK,EAAE;oBAClD,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC;oBACxC,IAAI,UAAU,CAAC,IAAI,KAAK,OAAO,IAAI,UAAU,CAAC,IAAI,KAAK,mBAAmB,EAAE;wBAC1E,OAAO;qBACR;iBACF;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,SAAS;oBACjB,SAAS,EAAE,WAAW;oBACtB,MAAM,EAAE;wBACN,SAAS,EAAE,QAAQ;wBACnB,MAAM,EAAE,yCAAyC;qBAClD;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"count.js","sourceRoot":"","sources":["../../../src/rules/count.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,oDAAoD,GAAG,UAAU,CAAC;IAC7E,IAAI,EAAE,yDAAyD;IAC/D,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE;gBACvB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE;oBAChC,OAAO;iBACR;gBAED,IAAI,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,KAAK,KAAK,EAAE;oBAClD,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC;oBACxC,MAAM,YAAY,GAAG,gBAAgB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;oBAC3D,IAAI,YAAY,EAAE;wBAChB,OAAO;qBACR;iBACF;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,SAAS;oBACjB,SAAS,EAAE,WAAW;oBACtB,MAAM,EAAE;wBACN,SAAS,EAAE,QAAQ;wBACnB,MAAM,EAAE,yCAAyC;qBAClD;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const disallowedTypeSpecDecoratorsRule: import("@typespec/lint").LintRule;
2
+ //# sourceMappingURL=disallowed-typespec-decorators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disallowed-typespec-decorators.d.ts","sourceRoot":"","sources":["../../../src/rules/disallowed-typespec-decorators.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gCAAgC,mCA+B3C,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { createRule } from "@typespec/lint";
2
+ import { reportDiagnostic } from "../lib.js";
3
+ export const disallowedTypeSpecDecoratorsRule = createRule({
4
+ name: "disallowed-typespec-decorators",
5
+ create({ program }) {
6
+ return {
7
+ decorator: (decorator) => {
8
+ const denyList = [
9
+ "@friendlyName",
10
+ "@secret",
11
+ "@summary",
12
+ "@tag",
13
+ "@visibility",
14
+ "@withVisibility",
15
+ "@withUpdateableProperties",
16
+ "@withDefaultKeyVisibility",
17
+ ];
18
+ if (denyList.indexOf(decorator.name) < 0) {
19
+ return;
20
+ }
21
+ reportDiagnostic(program, {
22
+ code: "decorator-invalid-use",
23
+ target: decorator.target,
24
+ messageId: "disallowedTypeSpecDecorators",
25
+ format: {
26
+ decorator: decorator.name,
27
+ },
28
+ });
29
+ },
30
+ };
31
+ },
32
+ });
33
+ //# sourceMappingURL=disallowed-typespec-decorators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disallowed-typespec-decorators.js","sourceRoot":"","sources":["../../../src/rules/disallowed-typespec-decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,CAAC,MAAM,gCAAgC,GAAG,UAAU,CAAC;IACzD,IAAI,EAAE,gCAAgC;IACtC,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE;gBACvB,MAAM,QAAQ,GAAG;oBACf,eAAe;oBACf,SAAS;oBACT,UAAU;oBACV,MAAM;oBACN,aAAa;oBACb,iBAAiB;oBACjB,2BAA2B;oBAC3B,2BAA2B;iBAC5B,CAAC;gBAEF,IAAI,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;oBACxC,OAAO;iBACR;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,SAAS,CAAC,MAAM;oBACxB,SAAS,EAAE,8BAA8B;oBACzC,MAAM,EAAE;wBACN,SAAS,EAAE,SAAS,CAAC,IAAI;qBAC1B;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export declare const entityMustHaveKeyRule: import("@typespec/lint").LintRule;
2
+ export declare const keyOnlyOnEntityNonNullablePrimitivePropertyRule: import("@typespec/lint").LintRule;
2
3
  //# sourceMappingURL=entity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/rules/entity.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB,mCA2BhC,CAAC"}
1
+ {"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/rules/entity.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,qBAAqB,mCA+BhC,CAAC;AAEH,eAAO,MAAM,+CAA+C,mCA4C1D,CAAC"}
@@ -1,7 +1,8 @@
1
1
  import { isKey, walkPropertiesInherited } from "@typespec/compiler";
2
2
  import { createRule } from "@typespec/lint";
3
- import { isEntity } from "../index.js";
3
+ import { isEntity, isPartial } from "../index.js";
4
4
  import { reportDiagnostic } from "../lib.js";
5
+ import { isTypeNullable, isExcludedLibraryType } from "../utils.js";
5
6
  export const entityMustHaveKeyRule = createRule({
6
7
  name: "entity-must-have-key",
7
8
  create({ program }) {
@@ -15,6 +16,9 @@ export const entityMustHaveKeyRule = createRule({
15
16
  return;
16
17
  }
17
18
  }
19
+ if (isPartial(program, model)) {
20
+ return;
21
+ }
18
22
  reportDiagnostic(program, {
19
23
  code: "decorator-missing-dependencies",
20
24
  target: model,
@@ -28,4 +32,42 @@ export const entityMustHaveKeyRule = createRule({
28
32
  };
29
33
  },
30
34
  });
35
+ export const keyOnlyOnEntityNonNullablePrimitivePropertyRule = createRule({
36
+ name: "key-only-on-entity-non-nullable-primitive-property",
37
+ create({ program }) {
38
+ return {
39
+ modelProperty: (property) => {
40
+ if (!property.model || !isKey(program, property)) {
41
+ return;
42
+ }
43
+ if (isExcludedLibraryType(program, property.model)) {
44
+ return;
45
+ }
46
+ if (!isEntity(program, property.model)) {
47
+ reportDiagnostic(program, {
48
+ code: "decorator-missing-dependencies",
49
+ target: property,
50
+ format: {
51
+ decorator: "@key",
52
+ required: "@entity",
53
+ location: "entity model",
54
+ },
55
+ });
56
+ return;
57
+ }
58
+ if (isTypeNullable(program, property.type) ||
59
+ property.type.kind !== "Scalar" ||
60
+ property.name === "Array") {
61
+ reportDiagnostic(program, {
62
+ code: "decorator-invalid-use",
63
+ target: property,
64
+ messageId: "key",
65
+ format: {},
66
+ });
67
+ return;
68
+ }
69
+ },
70
+ };
71
+ },
72
+ });
31
73
  //# sourceMappingURL=entity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"entity.js","sourceRoot":"","sources":["../../../src/rules/entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,CAAC,MAAM,qBAAqB,GAAG,UAAU,CAAC;IAC9C,IAAI,EAAE,sBAAsB;IAC5B,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;gBACf,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;oBAC7B,OAAO;iBACR;gBAED,KAAK,MAAM,QAAQ,IAAI,uBAAuB,CAAC,KAAK,CAAC,EAAE;oBACrD,IAAI,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE;wBAC5B,OAAO;qBACR;iBACF;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,gCAAgC;oBACtC,MAA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3,"file":"enum.d.ts","sourceRoot":"","sources":["../../../src/rules/enum.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB,mCAuB/B,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { createRule } from "@typespec/lint";
2
+ import { reportDiagnostic } from "../lib.js";
3
+ import { isExcludedCoreType } from "../utils.js";
4
+ export const useEvolvableEnumRule = createRule({
5
+ name: "use-evolvable-enum",
6
+ create({ program }) {
7
+ return {
8
+ enum: (enumType) => {
9
+ if (isExcludedCoreType(program, enumType)) {
10
+ return;
11
+ }
12
+ if (enumType.members.has("unknownFutureValue")) {
13
+ return;
14
+ }
15
+ reportDiagnostic(program, {
16
+ code: "use-evolvable-enum",
17
+ target: enumType,
18
+ format: {
19
+ enum: enumType.name,
20
+ },
21
+ });
22
+ },
23
+ };
24
+ },
25
+ });
26
+ //# sourceMappingURL=enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../src/rules/enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC;IAC7C,IAAI,EAAE,oBAAoB;IAC1B,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE;gBACjB,IAAI,kBAAkB,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE;oBACzC,OAAO;iBACR;gBAED,IAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE;oBAC9C,OAAO;iBACR;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,oBAAoB;oBAC1B,MAAM,EAAE,QAAQ;oBAChB,MAAM,EAAE;wBACN,IAAI,EAAE,QAAQ,CAAC,IAAI;qBACpB;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"expand.d.ts","sourceRoot":"","sources":["../../../src/rules/expand.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,mCAAmC,mCA6B9C,CAAC;AAEH,eAAO,MAAM,kCAAkC,mCAyC7C,CAAC"}
1
+ {"version":3,"file":"expand.d.ts","sourceRoot":"","sources":["../../../src/rules/expand.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,mCAAmC,mCA2B9C,CAAC;AAEH,eAAO,MAAM,kCAAkC,mCAwC7C,CAAC"}
@@ -3,20 +3,19 @@ import { createRule } from "@typespec/lint";
3
3
  import { getOperationVerb } from "@typespec/http";
4
4
  import { getExpand, isContains, isExpand, isReferences } from "../index.js";
5
5
  import { reportDiagnostic } from "../lib.js";
6
+ import { getNavigationSourceType } from "../utils.js";
6
7
  export const expandOnlyOnGetNavigationSourceRule = createRule({
7
8
  name: "expand-only-on-get-navigation-source",
8
9
  create({ program }) {
9
10
  return {
10
11
  operation: (operation) => {
11
- var _a;
12
12
  if (!isExpand(program, operation)) {
13
13
  return;
14
14
  }
15
15
  if (getOperationVerb(program, operation) === "get") {
16
- return;
17
- }
18
- if ((_a = operation.interface) === null || _a === void 0 ? void 0 : _a.operations.has("_isNavigationSource")) {
19
- return;
16
+ if (getNavigationSourceType(program, operation) !== undefined) {
17
+ return;
18
+ }
20
19
  }
21
20
  reportDiagnostic(program, {
22
21
  code: "decorator-invalid-use",
@@ -36,12 +35,11 @@ export const expandOnlyNavigationPropertiesRule = createRule({
36
35
  create({ program }) {
37
36
  return {
38
37
  operation: (operation) => {
39
- var _a, _b;
40
38
  const expanded = getExpand(program, operation);
41
39
  if (!expanded.length) {
42
40
  return;
43
41
  }
44
- const returnType = (_b = (_a = operation.interface) === null || _a === void 0 ? void 0 : _a.operations.get("_isNavigationSource")) === null || _b === void 0 ? void 0 : _b.returnType;
42
+ const returnType = getNavigationSourceType(program, operation);
45
43
  if (!returnType) {
46
44
  return;
47
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"expand.js","sourceRoot":"","sources":["../../../src/rules/expand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,CAAC,MAAM,mCAAmC,GAAG,UAAU,CAAC;IAC5D,IAAI,EAAE,sCAAsC;IAC5C,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE;;gBACvB,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE;oBACjC,OAAO;iBACR;gBAED,IAAI,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,KAAK,KAAK,EAAE;oBAClD,OAAO;iBACR;gBAED,IAAI,MAAA,SAAS,CAAC,SAAS,0CAAE,UAAU,CAAC,GAAG,CAAC,qBAAqB,CAAC,EAAE;oBAC9D,OAAO;iBACR;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,SAAS;oBACjB,SAAS,EAAE,WAAW;oBACtB,MAAM,EAAE;wBACN,SAAS,EAAE,SAAS;wBACpB,MAAM,EAAE,eAAe;qBACxB;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kCAAkC,GAAG,UAAU,CA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AAC,IAAI,CAAC;qBACzC;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const extendsOnSameTypeRule: import("@typespec/lint").LintRule;
2
+ //# sourceMappingURL=extends-on-same-type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extends-on-same-type.d.ts","sourceRoot":"","sources":["../../../src/rules/extends-on-same-type.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB,mCAmChC,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { createRule } from "@typespec/lint";
2
+ import { reportDiagnostic } from "../lib.js";
3
+ import { isComplex, isEntity } from "../index.js";
4
+ import { isExcludedCoreType } from "../utils.js";
5
+ export const extendsOnSameTypeRule = createRule({
6
+ name: "extends-on-same-type",
7
+ create({ program }) {
8
+ return {
9
+ model: (model) => {
10
+ if (!model.baseModel) {
11
+ return;
12
+ }
13
+ if (isExcludedCoreType(program, model)) {
14
+ return;
15
+ }
16
+ if (isEntity(program, model) && !isEntity(program, model.baseModel)) {
17
+ reportDiagnostic(program, {
18
+ code: "extends-invalid-use",
19
+ target: model,
20
+ format: {
21
+ type: "@entity",
22
+ },
23
+ });
24
+ }
25
+ if (isComplex(program, model) && !isComplex(program, model.baseModel)) {
26
+ reportDiagnostic(program, {
27
+ code: "extends-invalid-use",
28
+ target: model,
29
+ format: {
30
+ type: "@complex",
31
+ },
32
+ });
33
+ }
34
+ },
35
+ };
36
+ },
37
+ });
38
+ //# sourceMappingURL=extends-on-same-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extends-on-same-type.js","sourceRoot":"","sources":["../../../src/rules/extends-on-same-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,CAAC,MAAM,qBAAqB,GAAG,UAAU,CAAC;IAC9C,IAAI,EAAE,sBAAsB;IAC5B,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;gBACf,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE;oBACpB,OAAO;iBACR;gBAED,IAAI,kBAAkB,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;oBACtC,OAAO;iBACR;gBAED,IAAI,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE;oBACnE,gBAAgB,CAAC,OAAO,EAAE;wBACxB,IAAI,EAAE,qBAAqB;wBAC3B,MAAM,EAAE,KAAK;wBACb,MAAM,EAAE;4BACN,IAAI,EAAE,SAAS;yBAChB;qBACF,CAAC,CAAC;iBACJ;gBAED,IAAI,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE;oBACrE,gBAAgB,CAAC,OAAO,EAAE;wBACxB,IAAI,EAAE,qBAAqB;wBAC3B,MAAM,EAAE,KAAK;wBACb,MAAM,EAAE;4BACN,IAAI,EAAE,UAAU;yBACjB;qBACF,CAAC,CAAC;iBACJ;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const filterAppliesToGetOperationsThatReturnCollectionsRule: import("@typespec/lint").LintRule;
2
+ export declare const filterOnlyAppliesToModelPropertiesRule: import("@typespec/lint").LintRule;
3
+ export declare const filterPropertiesMustNotBeEmptyRule: import("@typespec/lint").LintRule;
4
+ //# sourceMappingURL=filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../src/rules/filter.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,qDAAqD,mCA6BhE,CAAC;AAEH,eAAO,MAAM,sCAAsC,mCAuCjD,CAAC;AAEH,eAAO,MAAM,kCAAkC,mCA0B7C,CAAC"}
@@ -0,0 +1,92 @@
1
+ import { createRule } from "@typespec/lint";
2
+ import { getFilter, isFilter } from "../index.js";
3
+ import { getOperationVerb } from "@typespec/http";
4
+ import { getNavigationSourceType, isTypeCollection } from "../utils.js";
5
+ import { reportDiagnostic } from "../lib.js";
6
+ import { walkPropertiesInherited } from "@typespec/compiler";
7
+ export const filterAppliesToGetOperationsThatReturnCollectionsRule = createRule({
8
+ name: "filter-applies-to-get-operations-that-return-collections",
9
+ create({ program }) {
10
+ return {
11
+ operation: (operation) => {
12
+ if (!isFilter(program, operation)) {
13
+ return;
14
+ }
15
+ if (getOperationVerb(program, operation) === "get") {
16
+ const returnType = operation.returnType;
17
+ const isCollection = isTypeCollection(program, returnType);
18
+ if (isCollection) {
19
+ return;
20
+ }
21
+ }
22
+ reportDiagnostic(program, {
23
+ code: "decorator-invalid-use",
24
+ target: operation,
25
+ messageId: "wrongType",
26
+ format: {
27
+ decorator: "@filter",
28
+ target: "get operation that returns a collection",
29
+ },
30
+ });
31
+ },
32
+ };
33
+ },
34
+ });
35
+ export const filterOnlyAppliesToModelPropertiesRule = createRule({
36
+ name: "filter-only-on-model-properties",
37
+ create({ program }) {
38
+ return {
39
+ operation: (operation) => {
40
+ if (!isFilter(program, operation)) {
41
+ return;
42
+ }
43
+ const returnType = getNavigationSourceType(program, operation);
44
+ if (!returnType) {
45
+ return;
46
+ }
47
+ const modelType = returnType.indexer ? returnType.indexer.value : returnType;
48
+ const filterProperties = getFilter(program, operation);
49
+ const modelProperties = [...walkPropertiesInherited(modelType)].map((property) => property.name);
50
+ const invalidFilterProperties = filterProperties.filter((property) => !modelProperties.includes(property));
51
+ if (!invalidFilterProperties.length) {
52
+ return;
53
+ }
54
+ reportDiagnostic(program, {
55
+ code: "decorator-invalid-use",
56
+ target: operation,
57
+ messageId: "filterProperties",
58
+ format: {
59
+ model: modelType.name,
60
+ properties: invalidFilterProperties.join(", "),
61
+ },
62
+ });
63
+ },
64
+ };
65
+ },
66
+ });
67
+ export const filterPropertiesMustNotBeEmptyRule = createRule({
68
+ name: "filter-properties-must-not-be-empty",
69
+ create({ program }) {
70
+ return {
71
+ operation: (operation) => {
72
+ if (!isFilter(program, operation)) {
73
+ return;
74
+ }
75
+ const filterProperties = getFilter(program, operation);
76
+ if (filterProperties.length) {
77
+ return;
78
+ }
79
+ reportDiagnostic(program, {
80
+ code: "decorator-invalid-use",
81
+ target: operation,
82
+ messageId: "required",
83
+ format: {
84
+ decorator: "@filter",
85
+ parameters: "filter properties",
86
+ },
87
+ });
88
+ },
89
+ };
90
+ },
91
+ });
92
+ //# sourceMappingURL=filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../src/rules/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAS,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAEpE,MAAM,CAAC,MAAM,qDAAqD,GAAG,UAAU,CAAC;IAC9E,IAAI,EAAE,0DAA0D;IAChE,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE;gBACvB,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE;oBACjC,OAAO;iBAC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@
1
+ {"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../../src/rules/function.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB,mCAsB3B,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { isVoidType } from "@typespec/compiler";
2
+ import { createRule } from "@typespec/lint";
3
+ import { isFunction } from "../index.js";
4
+ import { reportDiagnostic } from "../lib.js";
5
+ export const voidFunctionRule = createRule({
6
+ name: "void-function",
7
+ create({ program }) {
8
+ return {
9
+ operation: (operation) => {
10
+ if (!isFunction(program, operation)) {
11
+ return;
12
+ }
13
+ if (!isVoidType(operation.returnType)) {
14
+ return;
15
+ }
16
+ reportDiagnostic(program, {
17
+ code: "decorator-missing-dependencies",
18
+ target: operation,
19
+ messageId: "function",
20
+ format: {},
21
+ });
22
+ },
23
+ };
24
+ },
25
+ });
26
+ //# sourceMappingURL=function.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function.js","sourceRoot":"","sources":["../../../src/rules/function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC;IACzC,IAAI,EAAE,eAAe;IACrB,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE;gBACvB,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE;oBACnC,OAAO;iBACR;gBAED,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE;oBACrC,OAAO;iBACR;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,gCAAgC;oBACtC,MAAM,EAAE,SAAS;oBACjB,SAAS,EAAE,UAAU;oBACrB,MAAM,EAAE,EAAE;iBACX,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @graphRoute should not have a leading forward slash
3
+ */
4
+ export declare const graphRouteLeadingSlashRule: import("@typespec/lint").LintRule;
5
+ export declare const operationParametersMatchGraphRouteParametersRule: import("@typespec/lint").LintRule;
6
+ //# sourceMappingURL=graph-route.d.ts.map