@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
@@ -0,0 +1,115 @@
1
+ import { getLocationContext, } from "@typespec/compiler";
2
+ import { unpackAdditionalQueryParameters } from "./additional-query-parameters.js";
3
+ import { getIsOwnerAttribute, hasIsOwner } from "./is-owner.js";
4
+ import { isPrivileged } from "./privileged.js";
5
+ import { getWorkloadNameMsa } from "./workload-name-msa.js";
6
+ import { getWorkloadName } from "./workload-name.js";
7
+ import { isContains } from "./contains.js";
8
+ import { isReferences } from "./references.js";
9
+ import { isPartial } from "../index.js";
10
+ import { MsGraphModelKind } from "../entities/model.js";
11
+ import { isPrivatePreview } from "./private-preview.js";
12
+ const agsAttributeKey = Symbol("agsAttribute");
13
+ /**
14
+ * `@agsAttribute` - Allows all AGS CSDL extensions that are not yet modelled explicitly in TypeSpec to be maintained
15
+ *
16
+ * `@agsAttribute` - Applies to models.
17
+ */
18
+ export function $agsAttribute(context, target, name, value) {
19
+ const agsAttributes = getAgsAttributes(context.program, target);
20
+ agsAttributes.set(name, value);
21
+ context.program.stateMap(agsAttributeKey).set(target, agsAttributes);
22
+ }
23
+ export function getAgsAttributes(program, target) {
24
+ return program.stateMap(agsAttributeKey).get(target) || new Map();
25
+ }
26
+ export function unpackAgsAttributes(program, target) {
27
+ const attributes = getAgsAttributes(program, target);
28
+ let params = {};
29
+ attributes.forEach((value, name) => (params = { ...params, ...{ [`ags:${name}`]: value } }));
30
+ return params;
31
+ }
32
+ const decoratorToMethodMapper = {
33
+ isOwner: hasIsOwner,
34
+ privileged: isPrivileged,
35
+ workloadName: getWorkloadName,
36
+ workloadNameMsa: getWorkloadNameMsa,
37
+ additionalQueryParameters: unpackAdditionalQueryParameters,
38
+ agsAttribute: unpackAgsAttributes,
39
+ };
40
+ const decoratorToAgsAttributeMapper = {
41
+ isOwner: "ags:IsOwner",
42
+ privileged: "ags:IsHidden",
43
+ workloadName: "ags:WorkloadName",
44
+ workloadNameMsa: "ags:WorkloadNameMsa",
45
+ };
46
+ export function buildAttributes(program, type, kind) {
47
+ const declaredDecorators = [
48
+ "isOwner",
49
+ "privileged",
50
+ "workloadName",
51
+ "workloadNameMsa",
52
+ "additionalQueryParameters",
53
+ "agsAttribute",
54
+ ];
55
+ let attrs = {};
56
+ type.decorators
57
+ // only handle declared decorators
58
+ .filter((d) => declaredDecorators.some((s) => s === d.decorator.name.substring(1)))
59
+ .forEach((d) => {
60
+ const attrName = d.decorator.name.substring(1); // name prefixed with $
61
+ let key = attrName;
62
+ const agsAttrParams = decoratorToMethodMapper[key](program, type);
63
+ if (typeof agsAttrParams === "object") {
64
+ attrs = { ...attrs, ...agsAttrParams };
65
+ }
66
+ else {
67
+ key = attrName;
68
+ const agsAttr = decoratorToAgsAttributeMapper[key];
69
+ attrs = { ...attrs, ...{ [agsAttr]: agsAttrParams } };
70
+ }
71
+ });
72
+ attrs = enrichAttributesWithIsOwner(program, type, attrs, kind);
73
+ attrs = enrichAttributesWithIsHidden(program, type, attrs);
74
+ return attrs;
75
+ }
76
+ function enrichAttributesWithIsOwner(program, type, attrs, kind) {
77
+ if (kind === MsGraphModelKind.Complex) {
78
+ return attrs;
79
+ }
80
+ if (type.kind === 'Model' || type.kind === 'ModelProperty') {
81
+ const locationContext = getLocationContext(program, type);
82
+ if (type.kind === 'ModelProperty' && !(isContains(program, type) || isReferences(program, type))) {
83
+ return attrs;
84
+ }
85
+ const isOwnerAttribute = getIsOwnerAttribute(program, type);
86
+ if (isOwnerAttribute === false) {
87
+ attrs["ags:IsOwner"] = "false";
88
+ return attrs;
89
+ }
90
+ else if (isOwnerAttribute === true) {
91
+ attrs["ags:IsOwner"] = "true";
92
+ return attrs;
93
+ }
94
+ else {
95
+ const isOwner = locationContext.type === "project";
96
+ if (isOwner && type.kind === 'Model' && isPartial(program, type)) {
97
+ attrs["ags:IsOwner"] = "false";
98
+ return attrs;
99
+ }
100
+ attrs = { ...attrs, ...{ "ags:IsOwner": `${isOwner}` } };
101
+ }
102
+ }
103
+ return attrs;
104
+ }
105
+ function enrichAttributesWithIsHidden(program, type, attrs) {
106
+ const privatePreview = isPrivatePreview(program, type);
107
+ if (privatePreview) {
108
+ if (Object.prototype.hasOwnProperty.call(attrs, 'ags:IsHidden')) {
109
+ return attrs;
110
+ }
111
+ attrs = { ...attrs, ...{ "ags:IsHidden": "true" } };
112
+ }
113
+ return attrs;
114
+ }
115
+ //# sourceMappingURL=ags-attribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ags-attribute.js","sourceRoot":"","sources":["../../../src/decorators/ags-attribute.ts"],"names":[],"mappings":"AAAA,OAAO,EAWL,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC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AAE,aAAa,EAAE,GAAG,OAAO,EAAE,EAAE,EAAE,CAAC;SAC1D;KAEF;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,4BAA4B,CAAC,OAAgB,EAAE,IAAU,EAAE,KAA6B;IAC/F,MAAM,cAAc,GAAG,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACvD,IAAG,cAAc,EAAC;QAChB,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,cAAc,CAAC,EAAE;YAC/D,OAAO,KAAK,CAAC;SACd;QACD,KAAK,GAAG,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,EAAE,EAAE,CAAC;KACrD;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { DecoratorContext, ModelProperty, Program } from "@typespec/compiler";
2
+ import { AllowedValues } from "../entities/model.js";
3
+ /**
4
+ * `@allowedValues` - mark a model property with allowedValues
5
+ *
6
+ * `@allowedValues` can only be applied to model properties.
7
+ */
8
+ export declare function $allowedValues(context: DecoratorContext, target: ModelProperty, ...values: unknown[]): void;
9
+ export declare function hasAllowedValues(program: Program, target: ModelProperty): boolean;
10
+ export declare function getAllowedValues(program: Program, target: ModelProperty): AllowedValues;
11
+ export declare function isAllowedValuesArgumentsEmpty(program: Program, target: ModelProperty): boolean;
12
+ export declare function isAllowedValuesPrimitive(program: Program, target: ModelProperty): boolean;
13
+ //# sourceMappingURL=allowed-values.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allowed-values.d.ts","sourceRoot":"","sources":["../../../src/decorators/allowed-values.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD;;;;GAIG;AAEH,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,QAEpG;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,WAEvE;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,GAAG,aAAa,CAOvF;AAED,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,WAEpF;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAQzF"}
@@ -0,0 +1,35 @@
1
+ const allowedValuesKey = Symbol("allowedValues");
2
+ /**
3
+ * `@allowedValues` - mark a model property with allowedValues
4
+ *
5
+ * `@allowedValues` can only be applied to model properties.
6
+ */
7
+ export function $allowedValues(context, target, ...values) {
8
+ context.program.stateMap(allowedValuesKey).set(target, values);
9
+ }
10
+ export function hasAllowedValues(program, target) {
11
+ return program.stateMap(allowedValuesKey).has(target);
12
+ }
13
+ export function getAllowedValues(program, target) {
14
+ var _a;
15
+ const values = program.stateMap(allowedValuesKey).get(target);
16
+ const type = (_a = target.type.node) === null || _a === void 0 ? void 0 : _a.symbol.name;
17
+ return {
18
+ type: type,
19
+ values: values
20
+ };
21
+ }
22
+ export function isAllowedValuesArgumentsEmpty(program, target) {
23
+ var _a, _b;
24
+ return ((_b = (_a = getAllowedValues(program, target)) === null || _a === void 0 ? void 0 : _a.values) === null || _b === void 0 ? void 0 : _b.length) === 0;
25
+ }
26
+ export function isAllowedValuesPrimitive(program, target) {
27
+ const values = program.stateMap(allowedValuesKey).get(target);
28
+ for (let i = 0; i < (values === null || values === void 0 ? void 0 : values.length); i++) {
29
+ if (typeof values[i] === 'object' || values[i] === null || Array.isArray(values[i]) || typeof values[i] === 'function') {
30
+ return false;
31
+ }
32
+ }
33
+ return true;
34
+ }
35
+ //# sourceMappingURL=allowed-values.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allowed-values.js","sourceRoot":"","sources":["../../../src/decorators/allowed-values.ts"],"names":[],"mappings":"AAGA,MAAM,gBAAgB,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AACjD;;;;GAIG;AAEH,MAAM,UAAU,cAAc,CAAC,OAAyB,EAAE,MAAqB,EAAE,GAAG,MAAiB;IACnG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAgB,EAAE,MAAqB;IACtE,OAAO,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAgB,EAAE,MAAqB;;IACtE,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9D,MAAM,IAAI,GAAG,MAAA,MAAM,CAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,IAAI,CAAC;IAC3C,OAAO;QACL,IAAI,EAAE,IAAK;QACX,MAAM,EAAE,MAAM;KACf,CAAA;AACH,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,OAAgB,EAAE,MAAqB;;IACnF,OAAO,CAAA,MAAA,MAAA,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,0CAAE,MAAM,0CAAE,MAAM,MAAK,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,OAAgB,EAAE,MAAqB;IAC9E,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9D,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,IAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,CAAA,EAAG,CAAC,EAAE,EAAC;QACnC,IAAG,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,UAAU,EAAC;YACpH,OAAO,KAAK,CAAC;SACd;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"complex.d.ts","sourceRoot":"","sources":["../../../src/decorators/complex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAA2B,MAAM,oBAAoB,CAAC;AAI/F;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,KAAK,QAQjE;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,WAEzD"}
1
+ {"version":3,"file":"complex.d.ts","sourceRoot":"","sources":["../../../src/decorators/complex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAItE;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,KAAK,QAEjE;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,WAEzD"}
@@ -1,4 +1,3 @@
1
- import { validateDecoratorTarget } from "@typespec/compiler";
2
1
  const complexKey = Symbol("complex");
3
2
  /**
4
3
  * `@complex` - mark a model as a complex type
@@ -6,11 +5,6 @@ const complexKey = Symbol("complex");
6
5
  * `@complex` can only be applied to models.
7
6
  */
8
7
  export function $complex(context, complex) {
9
- // TODO: Remove this and move to extern dec once Model type is defined in TypeSpec.Reflection https://github.com/microsoft/typespec/issues/1655
10
- if (!validateDecoratorTarget(context, complex, "@complex", "Model")) {
11
- return;
12
- }
13
- // Register the complex property
14
8
  context.program.stateSet(complexKey).add(complex);
15
9
  }
16
10
  export function isComplex(program, complex) {
@@ -1 +1 @@
1
- {"version":3,"file":"complex.js","sourceRoot":"","sources":["../../../src/decorators/complex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE/F,MAAM,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AAErC;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAyB,EAAE,OAAc;IAChE,+IAA+I;IAC/I,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE;QACnE,OAAO;KACR;IAED,gCAAgC;IAChC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,OAAgB,EAAE,OAAc;IACxD,OAAO,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACnD,CAAC"}
1
+ {"version":3,"file":"complex.js","sourceRoot":"","sources":["../../../src/decorators/complex.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AAErC;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAyB,EAAE,OAAc;IAChE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,OAAgB,EAAE,OAAc;IACxD,OAAO,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACnD,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { DecoratorContext, Model, Program } from "@typespec/compiler";
2
+ /**
3
+ * `@deltaCollection` - Applies to: models.
4
+ * Indicates that the model is a body response containing a delta paged collection.
5
+ */
6
+ export declare function $deltaCollection(context: DecoratorContext, target: Model): void;
7
+ export declare function isDeltaCollection(program: Program, target: Model): boolean;
8
+ //# sourceMappingURL=delta-collection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delta-collection.d.ts","sourceRoot":"","sources":["../../../src/decorators/delta-collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAItE;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,QAExE;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,WAEhE"}
@@ -0,0 +1,12 @@
1
+ const deltaCollectionKey = Symbol("deltaCollection");
2
+ /**
3
+ * `@deltaCollection` - Applies to: models.
4
+ * Indicates that the model is a body response containing a delta paged collection.
5
+ */
6
+ export function $deltaCollection(context, target) {
7
+ context.program.stateSet(deltaCollectionKey).add(target);
8
+ }
9
+ export function isDeltaCollection(program, target) {
10
+ return program.stateSet(deltaCollectionKey).has(target);
11
+ }
12
+ //# sourceMappingURL=delta-collection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delta-collection.js","sourceRoot":"","sources":["../../../src/decorators/delta-collection.ts"],"names":[],"mappings":"AAEA,MAAM,kBAAkB,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAErD;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAyB,EAAE,MAAa;IACvE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAgB,EAAE,MAAa;IAC/D,OAAO,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAC1D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/decorators/entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAA2B,MAAM,oBAAoB,CAAC;AAI/F;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,QAQ/D;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,WAEvD;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAM3E"}
1
+ {"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/decorators/entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAItE;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,QAE/D;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,WAEvD;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAM3E"}
@@ -1,4 +1,3 @@
1
- import { validateDecoratorTarget } from "@typespec/compiler";
2
1
  const entityKey = Symbol("entity");
3
2
  /**
4
3
  * `@entity` - mark a model as an entity type
@@ -6,11 +5,6 @@ const entityKey = Symbol("entity");
6
5
  * `@entity` can only be applied to models.
7
6
  */
8
7
  export function $entity(context, entity) {
9
- // TODO: Remove this and move to extern dec once Model type is defined in TypeSpec.Reflection https://github.com/microsoft/typespec/issues/1655
10
- if (!validateDecoratorTarget(context, entity, "@entity", "Model")) {
11
- return;
12
- }
13
- // Register the entity property
14
8
  context.program.stateSet(entityKey).add(entity);
15
9
  }
16
10
  export function isEntity(program, entity) {
@@ -1 +1 @@
1
- {"version":3,"file":"entity.js","sourceRoot":"","sources":["../../../src/decorators/entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE/F,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AAEnC;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,OAAyB,EAAE,MAAa;IAC9D,+IAA+I;IAC/I,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE;QACjE,OAAO;KACR;IAED,+BAA+B;IAC/B,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,OAAgB,EAAE,MAAa;IACtD,OAAO,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,OAAgB,EAAE,IAAY;IACtD,MAAM,OAAO,GAAG,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CACrD,CAAC,IAAI,EAAiB,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CACrE,CAAC;IAEF,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACjD,CAAC"}
1
+ {"version":3,"file":"entity.js","sourceRoot":"","sources":["../../../src/decorators/entity.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AAEnC;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,OAAyB,EAAE,MAAa;IAC9D,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,OAAgB,EAAE,MAAa;IACtD,OAAO,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,OAAgB,EAAE,IAAY;IACtD,MAAM,OAAO,GAAG,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CACrD,CAAC,IAAI,EAAiB,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CACrE,CAAC;IAEF,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACjD,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { DecoratorContext, Operation, Program } from "@typespec/compiler";
2
+ /**
3
+ * `@filter` - Applies to: get operations that return collections of @entity or @complex models.
4
+ * Indicates that the get operation supports OData $filter query parameter.
5
+ *
6
+ * `properties` - List of property names in the model returned from the get operation that can be used in $filter query parameter.
7
+ */
8
+ export declare function $filter(context: DecoratorContext, target: Operation, ...properties: string[]): void;
9
+ export declare function getFilter(program: Program, target: Operation): string[];
10
+ export declare function isFilter(program: Program, target: Operation): boolean;
11
+ //# sourceMappingURL=filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../src/decorators/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAI1E;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,UAAU,EAAE,MAAM,EAAE,QAG5F;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,GAAG,MAAM,EAAE,CAEvE;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,WAE3D"}
@@ -0,0 +1,27 @@
1
+ const filterKey = Symbol("filter");
2
+ /**
3
+ * `@filter` - Applies to: get operations that return collections of @entity or @complex models.
4
+ * Indicates that the get operation supports OData $filter query parameter.
5
+ *
6
+ * `properties` - List of property names in the model returned from the get operation that can be used in $filter query parameter.
7
+ */
8
+ export function $filter(context, target, ...properties) {
9
+ const filterProperties = unpackFilterProperties(properties);
10
+ context.program.stateMap(filterKey).set(target, filterProperties);
11
+ }
12
+ export function getFilter(program, target) {
13
+ return program.stateMap(filterKey).get(target) || [];
14
+ }
15
+ export function isFilter(program, target) {
16
+ return program.stateMap(filterKey).has(target);
17
+ }
18
+ /**
19
+ * Filters out all empty strings that could be part of the properties string array.
20
+ *
21
+ * @param properties string array containing filter parameters.
22
+ * @returns string array of the filter parameters
23
+ */
24
+ function unpackFilterProperties(properties) {
25
+ return properties ? properties.filter(property => property.trim() !== '') : [];
26
+ }
27
+ //# sourceMappingURL=filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../src/decorators/filter.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,OAAyB,EAAE,MAAiB,EAAE,GAAG,UAAoB;IAC3F,MAAM,gBAAgB,GAAG,sBAAsB,CAAC,UAAU,CAAC,CAAC;IAC5D,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,OAAgB,EAAE,MAAiB;IAC3D,OAAO,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,OAAgB,EAAE,MAAiB;IAC1D,OAAO,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACjD,CAAC;AAED;;;;;GAKG;AACH,SAAS,sBAAsB,CAAC,UAAoB;IAClD,OAAO,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AAChF,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { DecoratorContext, Enum, Program } from "@typespec/compiler";
2
+ /**
3
+ * `@flags` - mark an enum as a flag.
4
+ *
5
+ * `@flags` can only be applied to enums.
6
+ */
7
+ export declare function $flags(context: DecoratorContext, target: Enum): void;
8
+ export declare function isFlags(program: Program, target: Enum): boolean;
9
+ //# sourceMappingURL=flags.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../../src/decorators/flags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAIrE;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,QAE7D;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,WAErD"}
@@ -0,0 +1,13 @@
1
+ const flagsKey = Symbol("flags");
2
+ /**
3
+ * `@flags` - mark an enum as a flag.
4
+ *
5
+ * `@flags` can only be applied to enums.
6
+ */
7
+ export function $flags(context, target) {
8
+ context.program.stateSet(flagsKey).add(target);
9
+ }
10
+ export function isFlags(program, target) {
11
+ return program.stateSet(flagsKey).has(target);
12
+ }
13
+ //# sourceMappingURL=flags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flags.js","sourceRoot":"","sources":["../../../src/decorators/flags.ts"],"names":[],"mappings":"AAEA,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;AAEjC;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,OAAyB,EAAE,MAAY;IAC5D,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,OAAgB,EAAE,MAAY;IACpD,OAAO,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAChD,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { DecoratorContext, Operation, Program } from "@typespec/compiler";
2
+ /**
3
+ * `@function` - mark an operation as a function
4
+ *
5
+ * `@function` can only be applied to operations.
6
+ */
7
+ export declare function $function(context: DecoratorContext, target: Operation, name?: string): void;
8
+ export declare function isFunction(program: Program, target: Operation): boolean;
9
+ export declare function getFunction(program: Program, target: Operation): string | undefined;
10
+ //# sourceMappingURL=function.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../../src/decorators/function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAI1E;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,MAAM,QAEpF;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,WAE7D;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAEnF"}
@@ -0,0 +1,16 @@
1
+ const functionKey = Symbol("function");
2
+ /**
3
+ * `@function` - mark an operation as a function
4
+ *
5
+ * `@function` can only be applied to operations.
6
+ */
7
+ export function $function(context, target, name) {
8
+ context.program.stateMap(functionKey).set(target, name || target.name);
9
+ }
10
+ export function isFunction(program, target) {
11
+ return program.stateMap(functionKey).has(target);
12
+ }
13
+ export function getFunction(program, target) {
14
+ return program.stateMap(functionKey).get(target);
15
+ }
16
+ //# sourceMappingURL=function.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function.js","sourceRoot":"","sources":["../../../src/decorators/function.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAEvC;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,OAAyB,EAAE,MAAiB,EAAE,IAAa;IACnF,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC;AACzE,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,OAAgB,EAAE,MAAiB;IAC5D,OAAO,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAgB,EAAE,MAAiB;IAC7D,OAAO,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACnD,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { DecoratorContext, Interface, Operation, Program, Type, ModelProperty, RekeyableMap } from "@typespec/compiler";
2
+ /**
3
+ * `@graphRoute` - Allow us to define an HTTP route for an interface or operation.
4
+ * `@graphRoute` - Applies to interfaces and operations.
5
+ */
6
+ export declare function $graphRoute(context: DecoratorContext, target: Interface | Operation, path: string): void;
7
+ export declare function resolveOperationParametersForGraphRoute(operation: Operation, graphRoute: string): RekeyableMap<string, ModelProperty>;
8
+ /**
9
+ * Extract params to be interpolated(Wrapped in '{' and '}'}) from a path/url.
10
+ * @param path Path/Url
11
+ *
12
+ * @example "foo/{name}/bar" -> ["name"]
13
+ */
14
+ export declare function extractParamsFromPath(path: string): string[];
15
+ export declare function getGraphRoutePaths(program: Program, target: Type): string[] | undefined;
16
+ export declare function hasGraphRoute(program: Program, target: Type): boolean;
17
+ //# sourceMappingURL=graph-route.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-route.d.ts","sourceRoot":"","sources":["../../../src/decorators/graph-route.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,OAAO,EACP,IAAI,EAEJ,aAAa,EAEb,YAAY,EAEb,MAAM,oBAAoB,CAAC;AAK5B;;;GAGG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,SAAS,GAAG,SAAS,EAC7B,IAAI,EAAE,MAAM,QA6Bb;AAyBD,wBAAgB,uCAAuC,CACrD,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,MAAM,GACjB,YAAY,CAAC,MAAM,EAAE,aAAa,CAAC,CAuBrC;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAG5D;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAG,MAAM,EAAE,GAAG,SAAS,CAGvF;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,WAE3D"}
@@ -0,0 +1,92 @@
1
+ import { createRekeyableMap, } from "@typespec/compiler";
2
+ import { getNavigationSourceType } from "../utils.js";
3
+ const graphRouteKey = Symbol("graphRoute");
4
+ /**
5
+ * `@graphRoute` - Allow us to define an HTTP route for an interface or operation.
6
+ * `@graphRoute` - Applies to interfaces and operations.
7
+ */
8
+ export function $graphRoute(context, target, path) {
9
+ const state = context.program.stateMap(graphRouteKey);
10
+ if (state.has(target)) {
11
+ state.set(target, [...state.get(target), path]);
12
+ }
13
+ else {
14
+ state.set(target, [path]);
15
+ }
16
+ // Modify the operations to inject path parameters and correct resource type from interface base interface.
17
+ // TODO: Using @graphRoute on an operation currently does not work due to the following TypeSpec core issue
18
+ // https://github.com/microsoft/typespec/issues/2106
19
+ // Disabling all related features while we await the outcome.
20
+ /*
21
+ if (target.kind === "Operation") {
22
+ const returnType = getNavigationSourceType(context.program, target as Operation);
23
+ if (returnType !== undefined) {
24
+ replaceParametersOnOperation(target as Operation, routeParams);
25
+ replaceResourceType(context.program, target as Operation, returnType);
26
+ }
27
+ } else */
28
+ if (target.kind === "Interface") {
29
+ target.operations.forEach((operation) => {
30
+ const returnType = getNavigationSourceType(context.program, operation);
31
+ if (returnType !== undefined) {
32
+ replaceResourceType(context.program, operation, returnType);
33
+ }
34
+ });
35
+ }
36
+ }
37
+ function replaceResourceType(program, operation, resourceType) {
38
+ const [calculatedResourceType, _] = program.resolveTypeReference("MsGraph.Automatic.CalculatedResourceType");
39
+ if (!calculatedResourceType) {
40
+ return;
41
+ }
42
+ const resourceCoreType = getResourceCoreType(resourceType);
43
+ // Replace body, if any.
44
+ if (operation.parameters.properties.has("body")) {
45
+ const property = operation.parameters.properties.get("body");
46
+ if ((property === null || property === void 0 ? void 0 : property.type) === calculatedResourceType) {
47
+ property.type = resourceCoreType;
48
+ }
49
+ }
50
+ }
51
+ function getResourceCoreType(resourceType) {
52
+ var _a;
53
+ return resourceType.indexer !== undefined ? (_a = resourceType.indexer) === null || _a === void 0 ? void 0 : _a.value : resourceType;
54
+ }
55
+ export function resolveOperationParametersForGraphRoute(operation, graphRoute) {
56
+ const routeParams = extractParamsFromPath(graphRoute);
57
+ const parameters = createRekeyableMap();
58
+ operation.parameters.properties.forEach((property, key) => {
59
+ parameters.set(key, property);
60
+ });
61
+ if (parameters.has("graphRouteParams")) {
62
+ parameters.delete("graphRouteParams");
63
+ routeParams.forEach((param) => {
64
+ const property = {
65
+ name: param,
66
+ kind: "ModelProperty",
67
+ type: { name: "string", kind: "Scalar" },
68
+ };
69
+ parameters.set(param, property);
70
+ });
71
+ }
72
+ return parameters;
73
+ }
74
+ /**
75
+ * Extract params to be interpolated(Wrapped in '{' and '}'}) from a path/url.
76
+ * @param path Path/Url
77
+ *
78
+ * @example "foo/{name}/bar" -> ["name"]
79
+ */
80
+ export function extractParamsFromPath(path) {
81
+ var _a;
82
+ const matchResults = path.match(/\{\w+\}/g);
83
+ return (_a = matchResults === null || matchResults === void 0 ? void 0 : matchResults.map((s) => s.slice(1, -1))) !== null && _a !== void 0 ? _a : [];
84
+ }
85
+ export function getGraphRoutePaths(program, target) {
86
+ const graphRoute = program.stateMap(graphRouteKey).get(target);
87
+ return graphRoute;
88
+ }
89
+ export function hasGraphRoute(program, target) {
90
+ return program.stateMap(graphRouteKey).has(target);
91
+ }
92
+ //# sourceMappingURL=graph-route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-route.js","sourceRoot":"","sources":["../../../src/decorators/graph-route.ts"],"names":[],"mappings":"AAAA,OAAO,EAUL,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AAE3C;;;GAGG;AACH,MAAM,UAAU,WAAW,CACzB,OAAyB,EACzB,MAA6B,EAC7B,IAAY;IAEZ,MAAM,KAAK,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,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,mCAAI,EAAE,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,OAAgB,EAAE,MAAY;IAC/D,MAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/D,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAgB,EAAE,MAAY;IAC1D,OAAO,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACrD,CAAC"}
@@ -2,8 +2,7 @@ import { DecoratorContext, Model, Program } from "@typespec/compiler";
2
2
  /**
3
3
  * `@hasStream` - indicates that an `@entity` model has a stream.
4
4
  *
5
- * `mediaTypes` - list of media types supported by the stream.
6
- * If not specified, the stream supports any media type.
5
+ * `mediaTypes` - list of media types supported by the stream. If not specified, the stream supports any media type.
7
6
  */
8
7
  export declare function $hasStream(context: DecoratorContext, target: Model, args?: string, ...mediaTypes: string[]): void;
9
8
  export declare function hasStream(program: Program, target: Model): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"has-stream.d.ts","sourceRoot":"","sources":["../../../src/decorators/has-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAajG;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,KAAK,EACb,IAAI,CAAC,EAAE,MAAM,EACb,GAAG,UAAU,EAAE,MAAM,EAAE,QAWxB;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,GAAG,OAAO,CAElE;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,GAAG,MAAM,EAAE,CAExE"}
1
+ {"version":3,"file":"has-stream.d.ts","sourceRoot":"","sources":["../../../src/decorators/has-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAItE;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,KAAK,EACb,IAAI,CAAC,EAAE,MAAM,EACb,GAAG,UAAU,EAAE,MAAM,EAAE,QAOxB;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,GAAG,OAAO,CAElE;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,GAAG,MAAM,EAAE,CAExE"}
@@ -1,24 +1,11 @@
1
- import { createDecoratorDefinition } from "@typespec/compiler";
2
- // -- @hasStream decorator
3
1
  const hasStreamKey = Symbol("hasStream");
4
- // TODO: Remove this and move to extern dec once Model type is defined in TypeSpec.Reflection https://github.com/microsoft/typespec/issues/1655
5
- const hasStreamDecorator = createDecoratorDefinition({
6
- name: "@hasStream",
7
- target: ["Model"],
8
- args: [],
9
- spreadArgs: { kind: "String" },
10
- });
11
2
  /**
12
3
  * `@hasStream` - indicates that an `@entity` model has a stream.
13
4
  *
14
- * `mediaTypes` - list of media types supported by the stream.
15
- * If not specified, the stream supports any media type.
5
+ * `mediaTypes` - list of media types supported by the stream. If not specified, the stream supports any media type.
16
6
  */
17
7
  export function $hasStream(context, target, args, ...mediaTypes) {
18
8
  const types = args ? [args, ...mediaTypes] : [];
19
- if (!hasStreamDecorator.validate(context, target, types)) {
20
- return;
21
- }
22
9
  context.program.stateMap(hasStreamKey).set(target, types.filter((t) => t.trim()));
23
10
  }
24
11
  export function hasStream(program, target) {
@@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"}
1
+ {"version":3,"file":"has-stream.js","sourceRoot":"","sources":["../../../src/decorators/has-stream.ts"],"names":[],"mappings":"AAEA,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AAEzC;;;;GAIG;AACH,MAAM,UAAU,UAAU,CACxB,OAAyB,EACzB,MAAa,EACb,IAAa,EACb,GAAG,UAAoB;IAEvB,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAChD,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,GAAG,CACxC,MAAM,EACN,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAC9B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,OAAgB,EAAE,MAAa;IACvD,OAAO,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAAgB,EAAE,MAAa;IAC5D,OAAO,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { DecoratorContext, ModelProperty, Program } from "@typespec/compiler";
2
+ /**
3
+ * `@immutable` - mark a model property as immutable
4
+ * '@immutable' can only be applied to Model properties.
5
+ */
6
+ export declare function $immutable(context: DecoratorContext, target: ModelProperty): void;
7
+ export declare function isImmutable(program: Program, target: ModelProperty): boolean;
8
+ //# sourceMappingURL=immutable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"immutable.d.ts","sourceRoot":"","sources":["../../../src/decorators/immutable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAI9E;;;GAGG;AAEH,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,CAEjF;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,WAElE"}
@@ -0,0 +1,12 @@
1
+ const immutableKey = Symbol("immutable");
2
+ /**
3
+ * `@immutable` - mark a model property as immutable
4
+ * '@immutable' can only be applied to Model properties.
5
+ */
6
+ export function $immutable(context, target) {
7
+ context.program.stateSet(immutableKey).add(target);
8
+ }
9
+ export function isImmutable(program, target) {
10
+ return program.stateSet(immutableKey).has(target);
11
+ }
12
+ //# sourceMappingURL=immutable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"immutable.js","sourceRoot":"","sources":["../../../src/decorators/immutable.ts"],"names":[],"mappings":"AAEA,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AAEzC;;;GAGG;AAEH,MAAM,UAAU,UAAU,CAAC,OAAyB,EAAE,MAAqB;IACzE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAgB,EAAE,MAAqB;IACjE,OAAO,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACpD,CAAC"}