@microsoft/typespec-msgraph 0.0.1-Preview.1

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 (286) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +7 -0
  3. package/dist/src/components/acceptable-media-types-annotation.d.ts +6 -0
  4. package/dist/src/components/acceptable-media-types-annotation.d.ts.map +1 -0
  5. package/dist/src/components/acceptable-media-types-annotation.js +15 -0
  6. package/dist/src/components/acceptable-media-types-annotation.js.map +1 -0
  7. package/dist/src/components/alternate-keys-annotation.d.ts +6 -0
  8. package/dist/src/components/alternate-keys-annotation.d.ts.map +1 -0
  9. package/dist/src/components/alternate-keys-annotation.js +30 -0
  10. package/dist/src/components/alternate-keys-annotation.js.map +1 -0
  11. package/dist/src/components/common-elements.d.ts +128 -0
  12. package/dist/src/components/common-elements.d.ts.map +1 -0
  13. package/dist/src/components/common-elements.js +38 -0
  14. package/dist/src/components/common-elements.js.map +1 -0
  15. package/dist/src/components/computed-annotation.d.ts +6 -0
  16. package/dist/src/components/computed-annotation.d.ts.map +1 -0
  17. package/dist/src/components/computed-annotation.js +12 -0
  18. package/dist/src/components/computed-annotation.js.map +1 -0
  19. package/dist/src/components/count-restrictions-annotation.d.ts +6 -0
  20. package/dist/src/components/count-restrictions-annotation.d.ts.map +1 -0
  21. package/dist/src/components/count-restrictions-annotation.js +15 -0
  22. package/dist/src/components/count-restrictions-annotation.js.map +1 -0
  23. package/dist/src/components/description-annotation.d.ts +6 -0
  24. package/dist/src/components/description-annotation.d.ts.map +1 -0
  25. package/dist/src/components/description-annotation.js +13 -0
  26. package/dist/src/components/description-annotation.js.map +1 -0
  27. package/dist/src/components/expand-restrictions-annotation.d.ts +7 -0
  28. package/dist/src/components/expand-restrictions-annotation.d.ts.map +1 -0
  29. package/dist/src/components/expand-restrictions-annotation.js +31 -0
  30. package/dist/src/components/expand-restrictions-annotation.js.map +1 -0
  31. package/dist/src/components/index.d.ts +15 -0
  32. package/dist/src/components/index.d.ts.map +1 -0
  33. package/dist/src/components/index.js +15 -0
  34. package/dist/src/components/index.js.map +1 -0
  35. package/dist/src/components/permissions-annotation.d.ts +6 -0
  36. package/dist/src/components/permissions-annotation.d.ts.map +1 -0
  37. package/dist/src/components/permissions-annotation.js +20 -0
  38. package/dist/src/components/permissions-annotation.js.map +1 -0
  39. package/dist/src/components/program-context.d.ts +4 -0
  40. package/dist/src/components/program-context.d.ts.map +1 -0
  41. package/dist/src/components/program-context.js +3 -0
  42. package/dist/src/components/program-context.js.map +1 -0
  43. package/dist/src/components/property-element.d.ts +6 -0
  44. package/dist/src/components/property-element.d.ts.map +1 -0
  45. package/dist/src/components/property-element.js +41 -0
  46. package/dist/src/components/property-element.js.map +1 -0
  47. package/dist/src/components/revisions-annotation.d.ts +7 -0
  48. package/dist/src/components/revisions-annotation.d.ts.map +1 -0
  49. package/dist/src/components/revisions-annotation.js +60 -0
  50. package/dist/src/components/revisions-annotation.js.map +1 -0
  51. package/dist/src/components/search-restrictions-annotation.d.ts +6 -0
  52. package/dist/src/components/search-restrictions-annotation.d.ts.map +1 -0
  53. package/dist/src/components/search-restrictions-annotation.js +15 -0
  54. package/dist/src/components/search-restrictions-annotation.js.map +1 -0
  55. package/dist/src/components/skip-supported-annotation.d.ts +6 -0
  56. package/dist/src/components/skip-supported-annotation.d.ts.map +1 -0
  57. package/dist/src/components/skip-supported-annotation.js +13 -0
  58. package/dist/src/components/skip-supported-annotation.js.map +1 -0
  59. package/dist/src/components/sort-restrictions-annotation.d.ts +7 -0
  60. package/dist/src/components/sort-restrictions-annotation.d.ts.map +1 -0
  61. package/dist/src/components/sort-restrictions-annotation.js +31 -0
  62. package/dist/src/components/sort-restrictions-annotation.js.map +1 -0
  63. package/dist/src/components/structured-type-element.d.ts +6 -0
  64. package/dist/src/components/structured-type-element.d.ts.map +1 -0
  65. package/dist/src/components/structured-type-element.js +77 -0
  66. package/dist/src/components/structured-type-element.js.map +1 -0
  67. package/dist/src/components/top-supported-annotation.d.ts +6 -0
  68. package/dist/src/components/top-supported-annotation.d.ts.map +1 -0
  69. package/dist/src/components/top-supported-annotation.js +13 -0
  70. package/dist/src/components/top-supported-annotation.js.map +1 -0
  71. package/dist/src/csdl.d.ts +8 -0
  72. package/dist/src/csdl.d.ts.map +1 -0
  73. package/dist/src/csdl.js +298 -0
  74. package/dist/src/csdl.js.map +1 -0
  75. package/dist/src/decorators/abstract.d.ts +9 -0
  76. package/dist/src/decorators/abstract.d.ts.map +1 -0
  77. package/dist/src/decorators/abstract.js +19 -0
  78. package/dist/src/decorators/abstract.js.map +1 -0
  79. package/dist/src/decorators/alternate-key.d.ts +9 -0
  80. package/dist/src/decorators/alternate-key.d.ts.map +1 -0
  81. package/dist/src/decorators/alternate-key.js +13 -0
  82. package/dist/src/decorators/alternate-key.js.map +1 -0
  83. package/dist/src/decorators/attribute-builder.d.ts +2 -0
  84. package/dist/src/decorators/attribute-builder.d.ts.map +1 -0
  85. package/dist/src/decorators/attribute-builder.js +166 -0
  86. package/dist/src/decorators/attribute-builder.js.map +1 -0
  87. package/dist/src/decorators/attributes.d.ts +57 -0
  88. package/dist/src/decorators/attributes.d.ts.map +1 -0
  89. package/dist/src/decorators/attributes.js +50 -0
  90. package/dist/src/decorators/attributes.js.map +1 -0
  91. package/dist/src/decorators/complex.d.ts +9 -0
  92. package/dist/src/decorators/complex.d.ts.map +1 -0
  93. package/dist/src/decorators/complex.js +19 -0
  94. package/dist/src/decorators/complex.js.map +1 -0
  95. package/dist/src/decorators/computed.d.ts +9 -0
  96. package/dist/src/decorators/computed.d.ts.map +1 -0
  97. package/dist/src/decorators/computed.js +13 -0
  98. package/dist/src/decorators/computed.js.map +1 -0
  99. package/dist/src/decorators/contains.d.ts +9 -0
  100. package/dist/src/decorators/contains.d.ts.map +1 -0
  101. package/dist/src/decorators/contains.js +13 -0
  102. package/dist/src/decorators/contains.js.map +1 -0
  103. package/dist/src/decorators/count.d.ts +9 -0
  104. package/dist/src/decorators/count.d.ts.map +1 -0
  105. package/dist/src/decorators/count.js +13 -0
  106. package/dist/src/decorators/count.js.map +1 -0
  107. package/dist/src/decorators/deprecated-definition.d.ts +21 -0
  108. package/dist/src/decorators/deprecated-definition.d.ts.map +1 -0
  109. package/dist/src/decorators/deprecated-definition.js +18 -0
  110. package/dist/src/decorators/deprecated-definition.js.map +1 -0
  111. package/dist/src/decorators/entity.d.ts +10 -0
  112. package/dist/src/decorators/entity.d.ts.map +1 -0
  113. package/dist/src/decorators/entity.js +23 -0
  114. package/dist/src/decorators/entity.js.map +1 -0
  115. package/dist/src/decorators/expand.d.ts +11 -0
  116. package/dist/src/decorators/expand.d.ts.map +1 -0
  117. package/dist/src/decorators/expand.js +17 -0
  118. package/dist/src/decorators/expand.js.map +1 -0
  119. package/dist/src/decorators/handlers/custom/additional-query-parameters.d.ts +14 -0
  120. package/dist/src/decorators/handlers/custom/additional-query-parameters.d.ts.map +1 -0
  121. package/dist/src/decorators/handlers/custom/additional-query-parameters.js +36 -0
  122. package/dist/src/decorators/handlers/custom/additional-query-parameters.js.map +1 -0
  123. package/dist/src/decorators/handlers/custom/ags-attribute.d.ts +7 -0
  124. package/dist/src/decorators/handlers/custom/ags-attribute.d.ts.map +1 -0
  125. package/dist/src/decorators/handlers/custom/ags-attribute.js +36 -0
  126. package/dist/src/decorators/handlers/custom/ags-attribute.js.map +1 -0
  127. package/dist/src/decorators/handlers/custom/index.d.ts +3 -0
  128. package/dist/src/decorators/handlers/custom/index.d.ts.map +1 -0
  129. package/dist/src/decorators/handlers/custom/index.js +3 -0
  130. package/dist/src/decorators/handlers/custom/index.js.map +1 -0
  131. package/dist/src/decorators/handlers/index.d.ts +30 -0
  132. package/dist/src/decorators/handlers/index.d.ts.map +1 -0
  133. package/dist/src/decorators/handlers/index.js +121 -0
  134. package/dist/src/decorators/handlers/index.js.map +1 -0
  135. package/dist/src/decorators/has-stream.d.ts +11 -0
  136. package/dist/src/decorators/has-stream.d.ts.map +1 -0
  137. package/dist/src/decorators/has-stream.js +30 -0
  138. package/dist/src/decorators/has-stream.js.map +1 -0
  139. package/dist/src/decorators/index.d.ts +21 -0
  140. package/dist/src/decorators/index.d.ts.map +1 -0
  141. package/dist/src/decorators/index.js +21 -0
  142. package/dist/src/decorators/index.js.map +1 -0
  143. package/dist/src/decorators/open.d.ts +9 -0
  144. package/dist/src/decorators/open.d.ts.map +1 -0
  145. package/dist/src/decorators/open.js +19 -0
  146. package/dist/src/decorators/open.js.map +1 -0
  147. package/dist/src/decorators/order-by.d.ts +11 -0
  148. package/dist/src/decorators/order-by.d.ts.map +1 -0
  149. package/dist/src/decorators/order-by.js +17 -0
  150. package/dist/src/decorators/order-by.js.map +1 -0
  151. package/dist/src/decorators/private-preview-definition.d.ts +19 -0
  152. package/dist/src/decorators/private-preview-definition.d.ts.map +1 -0
  153. package/dist/src/decorators/private-preview-definition.js +15 -0
  154. package/dist/src/decorators/private-preview-definition.js.map +1 -0
  155. package/dist/src/decorators/private-preview.d.ts +9 -0
  156. package/dist/src/decorators/private-preview.d.ts.map +1 -0
  157. package/dist/src/decorators/private-preview.js +25 -0
  158. package/dist/src/decorators/private-preview.js.map +1 -0
  159. package/dist/src/decorators/read-only.d.ts +9 -0
  160. package/dist/src/decorators/read-only.d.ts.map +1 -0
  161. package/dist/src/decorators/read-only.js +13 -0
  162. package/dist/src/decorators/read-only.js.map +1 -0
  163. package/dist/src/decorators/references.d.ts +9 -0
  164. package/dist/src/decorators/references.d.ts.map +1 -0
  165. package/dist/src/decorators/references.js +13 -0
  166. package/dist/src/decorators/references.js.map +1 -0
  167. package/dist/src/decorators/routed-interfaces.d.ts +19 -0
  168. package/dist/src/decorators/routed-interfaces.d.ts.map +1 -0
  169. package/dist/src/decorators/routed-interfaces.js +43 -0
  170. package/dist/src/decorators/routed-interfaces.js.map +1 -0
  171. package/dist/src/decorators/search.d.ts +8 -0
  172. package/dist/src/decorators/search.d.ts.map +1 -0
  173. package/dist/src/decorators/search.js +12 -0
  174. package/dist/src/decorators/search.js.map +1 -0
  175. package/dist/src/decorators/skip.d.ts +8 -0
  176. package/dist/src/decorators/skip.d.ts.map +1 -0
  177. package/dist/src/decorators/skip.js +12 -0
  178. package/dist/src/decorators/skip.js.map +1 -0
  179. package/dist/src/decorators/top.d.ts +8 -0
  180. package/dist/src/decorators/top.d.ts.map +1 -0
  181. package/dist/src/decorators/top.js +12 -0
  182. package/dist/src/decorators/top.js.map +1 -0
  183. package/dist/src/decorators/write-only.d.ts +9 -0
  184. package/dist/src/decorators/write-only.d.ts.map +1 -0
  185. package/dist/src/decorators/write-only.js +13 -0
  186. package/dist/src/decorators/write-only.js.map +1 -0
  187. package/dist/src/dom/reconciler.d.ts +10 -0
  188. package/dist/src/dom/reconciler.d.ts.map +1 -0
  189. package/dist/src/dom/reconciler.js +95 -0
  190. package/dist/src/dom/reconciler.js.map +1 -0
  191. package/dist/src/dom/renderer.d.ts +6 -0
  192. package/dist/src/dom/renderer.d.ts.map +1 -0
  193. package/dist/src/dom/renderer.js +33 -0
  194. package/dist/src/dom/renderer.js.map +1 -0
  195. package/dist/src/dom/types.d.ts +33 -0
  196. package/dist/src/dom/types.d.ts.map +1 -0
  197. package/dist/src/dom/types.js +2 -0
  198. package/dist/src/dom/types.js.map +1 -0
  199. package/dist/src/emitter.d.ts +4 -0
  200. package/dist/src/emitter.d.ts.map +1 -0
  201. package/dist/src/emitter.js +11 -0
  202. package/dist/src/emitter.js.map +1 -0
  203. package/dist/src/index.d.ts +7 -0
  204. package/dist/src/index.d.ts.map +1 -0
  205. package/dist/src/index.js +7 -0
  206. package/dist/src/index.js.map +1 -0
  207. package/dist/src/lib.d.ts +138 -0
  208. package/dist/src/lib.d.ts.map +1 -0
  209. package/dist/src/lib.js +55 -0
  210. package/dist/src/lib.js.map +1 -0
  211. package/dist/src/linter.d.ts +3 -0
  212. package/dist/src/linter.d.ts.map +1 -0
  213. package/dist/src/linter.js +35 -0
  214. package/dist/src/linter.js.map +1 -0
  215. package/dist/src/rules/abstract.d.ts +5 -0
  216. package/dist/src/rules/abstract.d.ts.map +1 -0
  217. package/dist/src/rules/abstract.js +31 -0
  218. package/dist/src/rules/abstract.js.map +1 -0
  219. package/dist/src/rules/alternate-key.d.ts +4 -0
  220. package/dist/src/rules/alternate-key.d.ts.map +1 -0
  221. package/dist/src/rules/alternate-key.js +81 -0
  222. package/dist/src/rules/alternate-key.js.map +1 -0
  223. package/dist/src/rules/computed.d.ts +7 -0
  224. package/dist/src/rules/computed.d.ts.map +1 -0
  225. package/dist/src/rules/computed.js +47 -0
  226. package/dist/src/rules/computed.js.map +1 -0
  227. package/dist/src/rules/contains.d.ts +5 -0
  228. package/dist/src/rules/contains.d.ts.map +1 -0
  229. package/dist/src/rules/contains.js +32 -0
  230. package/dist/src/rules/contains.js.map +1 -0
  231. package/dist/src/rules/count.d.ts +5 -0
  232. package/dist/src/rules/count.d.ts.map +1 -0
  233. package/dist/src/rules/count.js +35 -0
  234. package/dist/src/rules/count.js.map +1 -0
  235. package/dist/src/rules/entity.d.ts +2 -0
  236. package/dist/src/rules/entity.d.ts.map +1 -0
  237. package/dist/src/rules/entity.js +31 -0
  238. package/dist/src/rules/entity.js.map +1 -0
  239. package/dist/src/rules/expand.d.ts +3 -0
  240. package/dist/src/rules/expand.d.ts.map +1 -0
  241. package/dist/src/rules/expand.js +69 -0
  242. package/dist/src/rules/expand.js.map +1 -0
  243. package/dist/src/rules/has-stream.d.ts +2 -0
  244. package/dist/src/rules/has-stream.d.ts.map +1 -0
  245. package/dist/src/rules/has-stream.js +29 -0
  246. package/dist/src/rules/has-stream.js.map +1 -0
  247. package/dist/src/rules/index.d.ts +21 -0
  248. package/dist/src/rules/index.d.ts.map +1 -0
  249. package/dist/src/rules/index.js +176 -0
  250. package/dist/src/rules/index.js.map +1 -0
  251. package/dist/src/rules/open.d.ts +5 -0
  252. package/dist/src/rules/open.d.ts.map +1 -0
  253. package/dist/src/rules/open.js +31 -0
  254. package/dist/src/rules/open.js.map +1 -0
  255. package/dist/src/rules/order-by.d.ts +3 -0
  256. package/dist/src/rules/order-by.d.ts.map +1 -0
  257. package/dist/src/rules/order-by.js +69 -0
  258. package/dist/src/rules/order-by.js.map +1 -0
  259. package/dist/src/rules/references.d.ts +5 -0
  260. package/dist/src/rules/references.d.ts.map +1 -0
  261. package/dist/src/rules/references.js +32 -0
  262. package/dist/src/rules/references.js.map +1 -0
  263. package/dist/src/rules/search.d.ts +5 -0
  264. package/dist/src/rules/search.d.ts.map +1 -0
  265. package/dist/src/rules/search.js +35 -0
  266. package/dist/src/rules/search.js.map +1 -0
  267. package/dist/src/rules/skip.d.ts +5 -0
  268. package/dist/src/rules/skip.d.ts.map +1 -0
  269. package/dist/src/rules/skip.js +35 -0
  270. package/dist/src/rules/skip.js.map +1 -0
  271. package/dist/src/rules/top.d.ts +5 -0
  272. package/dist/src/rules/top.d.ts.map +1 -0
  273. package/dist/src/rules/top.js +35 -0
  274. package/dist/src/rules/top.js.map +1 -0
  275. package/dist/src/testing/index.d.ts +3 -0
  276. package/dist/src/testing/index.d.ts.map +1 -0
  277. package/dist/src/testing/index.js +24 -0
  278. package/dist/src/testing/index.js.map +1 -0
  279. package/dist/src/utils.d.ts +27 -0
  280. package/dist/src/utils.d.ts.map +1 -0
  281. package/dist/src/utils.js +186 -0
  282. package/dist/src/utils.js.map +1 -0
  283. package/lib/decorators.tsp +164 -0
  284. package/lib/lib.tsp +35 -0
  285. package/lib/msgraph.tsp +2 -0
  286. package/package.json +68 -0
@@ -0,0 +1,138 @@
1
+ export declare const namespace = "TypeSpec.MsGraph";
2
+ export declare const libDef: {
3
+ readonly name: "@microsoft/typespec-msgraph";
4
+ readonly diagnostics: {
5
+ readonly "decorator-missing-dependencies": {
6
+ readonly severity: "error";
7
+ readonly messages: {
8
+ readonly default: import("@typespec/compiler").CallableMessage<["decorator", "required", "location"]>;
9
+ readonly function: import("@typespec/compiler").CallableMessage<[]>;
10
+ };
11
+ };
12
+ readonly "element-missing-dependencies": {
13
+ readonly severity: "error";
14
+ readonly messages: {
15
+ readonly default: import("@typespec/compiler").CallableMessage<["element", "other", "location"]>;
16
+ readonly operation: import("@typespec/compiler").CallableMessage<[]>;
17
+ };
18
+ };
19
+ readonly "decorator-invalid-use": {
20
+ readonly severity: "error";
21
+ readonly messages: {
22
+ readonly default: import("@typespec/compiler").CallableMessage<["decorator", "other", "location"]>;
23
+ readonly alternateKey: import("@typespec/compiler").CallableMessage<[]>;
24
+ readonly disallowedTypeSpecDecorators: import("@typespec/compiler").CallableMessage<["decorator"]>;
25
+ readonly expandProperties: import("@typespec/compiler").CallableMessage<["properties", "model"]>;
26
+ readonly key: import("@typespec/compiler").CallableMessage<[]>;
27
+ readonly orderByProperties: import("@typespec/compiler").CallableMessage<["properties", "model"]>;
28
+ readonly required: import("@typespec/compiler").CallableMessage<["decorator", "parameters"]>;
29
+ readonly wrongType: import("@typespec/compiler").CallableMessage<["decorator", "target"]>;
30
+ };
31
+ };
32
+ readonly "singleton-invalid-name": {
33
+ readonly severity: "error";
34
+ readonly messages: {
35
+ readonly default: import("@typespec/compiler").CallableMessage<["value"]>;
36
+ };
37
+ };
38
+ readonly "extends-invalid-use": {
39
+ readonly severity: "error";
40
+ readonly messages: {
41
+ readonly default: import("@typespec/compiler").CallableMessage<["type", "type"]>;
42
+ };
43
+ };
44
+ readonly "use-evolvable-enum": {
45
+ readonly severity: "warning";
46
+ readonly messages: {
47
+ readonly default: import("@typespec/compiler").CallableMessage<["enum"]>;
48
+ };
49
+ };
50
+ };
51
+ };
52
+ export declare const $lib: import("@typespec/compiler").TypeSpecLibrary<{
53
+ "decorator-missing-dependencies": {
54
+ readonly default: import("@typespec/compiler").CallableMessage<["decorator", "required", "location"]>;
55
+ readonly function: import("@typespec/compiler").CallableMessage<[]>;
56
+ };
57
+ "element-missing-dependencies": {
58
+ readonly default: import("@typespec/compiler").CallableMessage<["element", "other", "location"]>;
59
+ readonly operation: import("@typespec/compiler").CallableMessage<[]>;
60
+ };
61
+ "decorator-invalid-use": {
62
+ readonly default: import("@typespec/compiler").CallableMessage<["decorator", "other", "location"]>;
63
+ readonly alternateKey: import("@typespec/compiler").CallableMessage<[]>;
64
+ readonly disallowedTypeSpecDecorators: import("@typespec/compiler").CallableMessage<["decorator"]>;
65
+ readonly expandProperties: import("@typespec/compiler").CallableMessage<["properties", "model"]>;
66
+ readonly key: import("@typespec/compiler").CallableMessage<[]>;
67
+ readonly orderByProperties: import("@typespec/compiler").CallableMessage<["properties", "model"]>;
68
+ readonly required: import("@typespec/compiler").CallableMessage<["decorator", "parameters"]>;
69
+ readonly wrongType: import("@typespec/compiler").CallableMessage<["decorator", "target"]>;
70
+ };
71
+ "singleton-invalid-name": {
72
+ readonly default: import("@typespec/compiler").CallableMessage<["value"]>;
73
+ };
74
+ "extends-invalid-use": {
75
+ readonly default: import("@typespec/compiler").CallableMessage<["type", "type"]>;
76
+ };
77
+ "use-evolvable-enum": {
78
+ readonly default: import("@typespec/compiler").CallableMessage<["enum"]>;
79
+ };
80
+ }, Record<string, any>>;
81
+ export declare const reportDiagnostic: <C extends "decorator-missing-dependencies" | "element-missing-dependencies" | "decorator-invalid-use" | "singleton-invalid-name" | "extends-invalid-use" | "use-evolvable-enum", M extends keyof {
82
+ "decorator-missing-dependencies": {
83
+ readonly default: import("@typespec/compiler").CallableMessage<["decorator", "required", "location"]>;
84
+ readonly function: import("@typespec/compiler").CallableMessage<[]>;
85
+ };
86
+ "element-missing-dependencies": {
87
+ readonly default: import("@typespec/compiler").CallableMessage<["element", "other", "location"]>;
88
+ readonly operation: import("@typespec/compiler").CallableMessage<[]>;
89
+ };
90
+ "decorator-invalid-use": {
91
+ readonly default: import("@typespec/compiler").CallableMessage<["decorator", "other", "location"]>;
92
+ readonly alternateKey: import("@typespec/compiler").CallableMessage<[]>;
93
+ readonly disallowedTypeSpecDecorators: import("@typespec/compiler").CallableMessage<["decorator"]>;
94
+ readonly expandProperties: import("@typespec/compiler").CallableMessage<["properties", "model"]>;
95
+ readonly key: import("@typespec/compiler").CallableMessage<[]>;
96
+ readonly orderByProperties: import("@typespec/compiler").CallableMessage<["properties", "model"]>;
97
+ readonly required: import("@typespec/compiler").CallableMessage<["decorator", "parameters"]>;
98
+ readonly wrongType: import("@typespec/compiler").CallableMessage<["decorator", "target"]>;
99
+ };
100
+ "singleton-invalid-name": {
101
+ readonly default: import("@typespec/compiler").CallableMessage<["value"]>;
102
+ };
103
+ "extends-invalid-use": {
104
+ readonly default: import("@typespec/compiler").CallableMessage<["type", "type"]>;
105
+ };
106
+ "use-evolvable-enum": {
107
+ readonly default: import("@typespec/compiler").CallableMessage<["enum"]>;
108
+ };
109
+ }[C]>(program: import("@typespec/compiler").Program, diag: import("@typespec/compiler").DiagnosticReport<{
110
+ "decorator-missing-dependencies": {
111
+ readonly default: import("@typespec/compiler").CallableMessage<["decorator", "required", "location"]>;
112
+ readonly function: import("@typespec/compiler").CallableMessage<[]>;
113
+ };
114
+ "element-missing-dependencies": {
115
+ readonly default: import("@typespec/compiler").CallableMessage<["element", "other", "location"]>;
116
+ readonly operation: import("@typespec/compiler").CallableMessage<[]>;
117
+ };
118
+ "decorator-invalid-use": {
119
+ readonly default: import("@typespec/compiler").CallableMessage<["decorator", "other", "location"]>;
120
+ readonly alternateKey: import("@typespec/compiler").CallableMessage<[]>;
121
+ readonly disallowedTypeSpecDecorators: import("@typespec/compiler").CallableMessage<["decorator"]>;
122
+ readonly expandProperties: import("@typespec/compiler").CallableMessage<["properties", "model"]>;
123
+ readonly key: import("@typespec/compiler").CallableMessage<[]>;
124
+ readonly orderByProperties: import("@typespec/compiler").CallableMessage<["properties", "model"]>;
125
+ readonly required: import("@typespec/compiler").CallableMessage<["decorator", "parameters"]>;
126
+ readonly wrongType: import("@typespec/compiler").CallableMessage<["decorator", "target"]>;
127
+ };
128
+ "singleton-invalid-name": {
129
+ readonly default: import("@typespec/compiler").CallableMessage<["value"]>;
130
+ };
131
+ "extends-invalid-use": {
132
+ readonly default: import("@typespec/compiler").CallableMessage<["type", "type"]>;
133
+ };
134
+ "use-evolvable-enum": {
135
+ readonly default: import("@typespec/compiler").CallableMessage<["enum"]>;
136
+ };
137
+ }, C, M>) => void;
138
+ //# sourceMappingURL=lib.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,qBAAqB,CAAC;AAE5C,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDT,CAAC;AAEX,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAAgC,CAAC;AAClD,eAAO,MAAQ,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAS,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { createTypeSpecLibrary, paramMessage } from "@typespec/compiler";
2
+ export const namespace = "TypeSpec.MsGraph";
3
+ export const libDef = {
4
+ name: "@microsoft/typespec-msgraph",
5
+ diagnostics: {
6
+ "decorator-missing-dependencies": {
7
+ severity: "error",
8
+ messages: {
9
+ default: paramMessage `The ${"decorator"} decorator must be used together with the required ${"required"} decorator on the ${"location"}.`,
10
+ function: paramMessage `The @function decorator must be defined on an operation that does not return void.`,
11
+ },
12
+ },
13
+ "element-missing-dependencies": {
14
+ severity: "error",
15
+ messages: {
16
+ default: paramMessage `The ${"element"} must be used together with ${"other"} on a ${"location"}.`,
17
+ operation: paramMessage `Operations must be used inside interfaces.`,
18
+ },
19
+ },
20
+ "decorator-invalid-use": {
21
+ severity: "error",
22
+ messages: {
23
+ default: paramMessage `The ${"decorator"} decorator cannot be used together with ${"other"} on a ${"location"}.`,
24
+ alternateKey: paramMessage `The @alternateKey decorator can only be attached to a non-nullable primitive-typed property.`,
25
+ disallowedTypeSpecDecorators: paramMessage `The decorator ${"decorator"} may not be used in MSGraph TypeSpec.`,
26
+ expandProperties: paramMessage `The properties "${"properties"}" defined in the @expand decorator must be defined with @references or @contains in the referenced model "${"model"}" or its inheritance hierarchy.`,
27
+ key: paramMessage `The @key decorator can only be attached to a non-nullable primitive type.`,
28
+ orderByProperties: paramMessage `The properties "${"properties"}" defined in the @orderBy decorator must not be defined with @references or @contains in the referenced model "${"model"}" or its inheritance hierarchy.`,
29
+ required: paramMessage `The ${"decorator"} decorator must define required ${"parameters"}.`,
30
+ wrongType: paramMessage `The ${"decorator"} decorator can only be applied to a ${"target"}.`,
31
+ },
32
+ },
33
+ "singleton-invalid-name": {
34
+ severity: "error",
35
+ messages: {
36
+ default: paramMessage `An existing @entity model with name '${"value"}' was not found, please specify a valid value for the singleton name.`,
37
+ },
38
+ },
39
+ "extends-invalid-use": {
40
+ severity: "error",
41
+ messages: {
42
+ default: paramMessage `A ${"type"} model can only extend a ${"type"} baseModel`,
43
+ },
44
+ },
45
+ "use-evolvable-enum": {
46
+ severity: "warning",
47
+ messages: {
48
+ default: paramMessage `Enumeration '${"enum"}' should have a member named unknownFutureValue for future extensibility.`,
49
+ },
50
+ },
51
+ },
52
+ };
53
+ export const $lib = createTypeSpecLibrary(libDef);
54
+ export const { reportDiagnostic } = $lib;
55
+ //# sourceMappingURL=lib.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lib.js","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEzE,MAAM,CAAC,MAAM,SAAS,GAAG,kBAAkB,CAAC;AAE5C,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,IAAI,EAAE,6BAA6B;IACnC,WAAW,EAAE;QACX,gCAAgC,EAAE;YAChC,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,OAAO,WAAW,sDAAsD,UAAU,qBAAqB,UAAU,GAAG;gBACzI,QAAQ,EAAE,YAAY,CAAA,oFAAoF;aAC3G;SACF;QACD,8BAA8B,EAAE;YAC9B,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,OAAO,SAAS,+BAA+B,OAAO,SAAS,UAAU,GAAG;gBACjG,SAAS,EAAE,YAAY,CAAA,4CAA4C;aACpE;SACF;QACD,uBAAuB,EAAE;YACvB,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,OAAO,WAAW,2CAA2C,OAAO,SAAS,UAAU,GAAG;gBAC/G,YAAY,EAAE,YAAY,CAAA,8FAA8F;gBACxH,4BAA4B,EAAE,YAAY,CAAA,iBAAiB,WAAW,uCAAuC;gBAC7G,gBAAgB,EAAE,YAAY,CAAA,mBAAmB,YAAY,6GAA6G,OAAO,iCAAiC;gBAClN,GAAG,EAAE,YAAY,CAAA,2EAA2E;gBAC5F,iBAAiB,EAAE,YAAY,CAAA,mBAAmB,YAAY,kHAAkH,OAAO,iCAAiC;gBACxN,QAAQ,EAAE,YAAY,CAAA,OAAO,WAAW,mCAAmC,YAAY,GAAG;gBAC1F,SAAS,EAAE,YAAY,CAAA,OAAO,WAAW,uCAAuC,QAAQ,GAAG;aAC5F;SACF;QACD,wBAAwB,EAAE;YACxB,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,wCAAwC,OAAO,uEAAuE;aAC5I;SACF;QACD,qBAAqB,EAAE;YACrB,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,KAAK,MAAM,4BAA4B,MAAM,YAAY;aAC/E;SACF;QACD,oBAAoB,EAAE;YACpB,QAAQ,EAAE,SAAS;YACnB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,gBAAgB,MAAM,2EAA2E;aACvH;SACF;KACF;CACO,CAAC;AAEX,MAAM,CAAC,MAAM,IAAI,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAClD,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Program } from "@typespec/compiler";
2
+ export declare function $onValidate(program: Program): void;
3
+ //# sourceMappingURL=linter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AA6D7C,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,QAG3C"}
@@ -0,0 +1,35 @@
1
+ import { getLinter } from "@typespec/lint";
2
+ import { $lib } from "./lib.js";
3
+ import { abstractOnlyAppliesToStructuredTypeRule, alternateKeyOnKeyRule, alternateKeyOnPrimitivePropertyRule, alternateKeyRequiresKeyRule, computedCannotBeCombinedWithRule, containsOnlyAppliesToNavigationPropertyRule, countAppliesToGetOperationsThatReturnCollectionsRule, disallowedTypeSpecDecoratorsRule, entityMustHaveKeyRule, expandOnlyNavigationPropertiesRule, expandOnlyOnGetNavigationSourceRule, extendsOnSameTypeRule, hasStreamOnlyOnEntity, keyOnlyOnEntityNonNullablePrimitivePropertyRule, openOnlyAppliesToStructuredType, operationInsideInterfaceRule, orderByOnlyNonNavigationPropertiesRule, orderByOnlyOnGetNavigationSourceRule, referencesOnlyAppliesToNavigationPropertyRule, searchAppliesToGetOperationsThatReturnCollectionsRule, skipAppliesToGetOperationsThatReturnCollectionsRule, topAppliesToGetOperationsThatReturnCollectionsRule, useEvolvableEnumRule, voidFunctionRule, } from "./rules/index.js";
4
+ const linter = getLinter($lib);
5
+ linter.registerRules([
6
+ abstractOnlyAppliesToStructuredTypeRule,
7
+ alternateKeyOnKeyRule,
8
+ alternateKeyOnPrimitivePropertyRule,
9
+ alternateKeyRequiresKeyRule,
10
+ computedCannotBeCombinedWithRule,
11
+ containsOnlyAppliesToNavigationPropertyRule,
12
+ countAppliesToGetOperationsThatReturnCollectionsRule,
13
+ disallowedTypeSpecDecoratorsRule,
14
+ entityMustHaveKeyRule,
15
+ expandOnlyNavigationPropertiesRule,
16
+ expandOnlyOnGetNavigationSourceRule,
17
+ extendsOnSameTypeRule,
18
+ hasStreamOnlyOnEntity,
19
+ keyOnlyOnEntityNonNullablePrimitivePropertyRule,
20
+ openOnlyAppliesToStructuredType,
21
+ operationInsideInterfaceRule,
22
+ orderByOnlyNonNavigationPropertiesRule,
23
+ orderByOnlyOnGetNavigationSourceRule,
24
+ referencesOnlyAppliesToNavigationPropertyRule,
25
+ searchAppliesToGetOperationsThatReturnCollectionsRule,
26
+ skipAppliesToGetOperationsThatReturnCollectionsRule,
27
+ topAppliesToGetOperationsThatReturnCollectionsRule,
28
+ useEvolvableEnumRule,
29
+ voidFunctionRule,
30
+ ], { autoEnable: true });
31
+ export function $onValidate(program) {
32
+ linter.autoEnableRules();
33
+ linter.lintOnValidate(program);
34
+ }
35
+ //# sourceMappingURL=linter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linter.js","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EACL,uCAAuC,EACvC,qBAAqB,EACrB,mCAAmC,EACnC,2BAA2B,EAC3B,gCAAgC,EAChC,2CAA2C,EAC3C,oDAAoD,EACpD,gCAAgC,EAChC,qBAAqB,EACrB,kCAAkC,EAClC,mCAAmC,EACnC,qBAAqB,EACrB,qBAAqB,EACrB,+CAA+C,EAC/C,+BAA+B,EAC/B,4BAA4B,EAC5B,sCAAsC,EACtC,oCAAoC,EACpC,6CAA6C,EAC7C,qDAAqD,EACrD,mDAAmD,EACnD,kDAAkD,EAClD,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAC/B,MAAM,CAAC,aAAa,CAClB;IACE,uCAAuC;IACvC,qBAAqB;IACrB,mCAAmC;IACnC,2BAA2B;IAC3B,gCAAgC;IAChC,2CAA2C;IAC3C,oDAAoD;IACpD,gCAAgC;IAChC,qBAAqB;IACrB,kCAAkC;IAClC,mCAAmC;IACnC,qBAAqB;IACrB,qBAAqB;IACrB,+CAA+C;IAC/C,+BAA+B;IAC/B,4BAA4B;IAC5B,sCAAsC;IACtC,oCAAoC;IACpC,6CAA6C;IAC7C,qDAAqD;IACrD,mDAAmD;IACnD,kDAAkD;IAClD,oBAAoB;IACpB,gBAAgB;CACjB,EACD,EAAE,UAAU,EAAE,IAAI,EAAE,CACrB,CAAC;AAEF,MAAM,UAAU,WAAW,CAAC,OAAgB;IAC1C,MAAM,CAAC,eAAe,EAAE,CAAC;IACzB,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @abstract applies to either an entity or a complex type.
3
+ */
4
+ export declare const abstractOnlyAppliesToStructuredTypeRule: import("@typespec/lint").LintRule;
5
+ //# sourceMappingURL=abstract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstract.d.ts","sourceRoot":"","sources":["../../../src/rules/abstract.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,eAAO,MAAM,uCAAuC,mCAyBlD,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { createRule } from "@typespec/lint";
2
+ import { isAbstract, isComplex, isEntity } from "../index.js";
3
+ import { reportDiagnostic } from "../lib.js";
4
+ /**
5
+ * @abstract applies to either an entity or a complex type.
6
+ */
7
+ export const abstractOnlyAppliesToStructuredTypeRule = createRule({
8
+ name: "abstract-only-applies-to-structured-type",
9
+ create({ program }) {
10
+ return {
11
+ model: (model) => {
12
+ if (!isAbstract(program, model)) {
13
+ return;
14
+ }
15
+ if (isEntity(program, model) || isComplex(program, model)) {
16
+ return;
17
+ }
18
+ reportDiagnostic(program, {
19
+ code: "decorator-invalid-use",
20
+ target: model,
21
+ messageId: "wrongType",
22
+ format: {
23
+ decorator: "@abstract",
24
+ target: "@complex or @entity model type",
25
+ },
26
+ });
27
+ },
28
+ };
29
+ },
30
+ });
31
+ //# sourceMappingURL=abstract.js.map
@@ -0,0 +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,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,uCAAuC,GAAG,UAAU,CAAC;IAChE,IAAI,EAAE,0CAA0C;IAChD,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;gBACf,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,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;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const alternateKeyOnPrimitivePropertyRule: import("@typespec/lint").LintRule;
2
+ export declare const alternateKeyOnKeyRule: import("@typespec/lint").LintRule;
3
+ export declare const alternateKeyRequiresKeyRule: import("@typespec/lint").LintRule;
4
+ //# sourceMappingURL=alternate-key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alternate-key.d.ts","sourceRoot":"","sources":["../../../src/rules/alternate-key.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,mCAAmC,mCA0B9C,CAAC;AAEH,eAAO,MAAM,qBAAqB,mCA4BhC,CAAC;AAEH,eAAO,MAAM,2BAA2B,mCA2BtC,CAAC"}
@@ -0,0 +1,81 @@
1
+ import { isKey, walkPropertiesInherited } from "@typespec/compiler";
2
+ import { createRule } from "@typespec/lint";
3
+ import { isAlternateKey } from "../index.js";
4
+ import { reportDiagnostic } from "../lib.js";
5
+ import { isTypeNullable } from "../utils.js";
6
+ export const alternateKeyOnPrimitivePropertyRule = createRule({
7
+ name: "alternate-key-on-primitive-property",
8
+ create({ program }) {
9
+ return {
10
+ modelProperty: (property) => {
11
+ if (!property.model || !isAlternateKey(program, property)) {
12
+ return;
13
+ }
14
+ if (property.type.kind !== "Scalar" ||
15
+ property.name === "Array" ||
16
+ isTypeNullable(program, property.type)) {
17
+ reportDiagnostic(program, {
18
+ code: "decorator-invalid-use",
19
+ target: property,
20
+ messageId: "alternateKey",
21
+ format: {},
22
+ });
23
+ return;
24
+ }
25
+ },
26
+ };
27
+ },
28
+ });
29
+ export const alternateKeyOnKeyRule = createRule({
30
+ name: "alternate-key-on-key",
31
+ create({ program }) {
32
+ return {
33
+ modelProperty: (property) => {
34
+ if (!property.model || !isAlternateKey(program, property)) {
35
+ return;
36
+ }
37
+ if (!isKey(program, property)) {
38
+ return;
39
+ }
40
+ reportDiagnostic(program, {
41
+ code: "decorator-invalid-use",
42
+ target: property,
43
+ messageId: "default",
44
+ format: {
45
+ decorator: "@alternateKey",
46
+ other: "@key",
47
+ location: "property",
48
+ },
49
+ });
50
+ return;
51
+ },
52
+ };
53
+ },
54
+ });
55
+ export const alternateKeyRequiresKeyRule = createRule({
56
+ name: "alternate-key-requires-key",
57
+ create({ program }) {
58
+ return {
59
+ modelProperty: (property) => {
60
+ if (!property.model || !isAlternateKey(program, property)) {
61
+ return;
62
+ }
63
+ for (const otherProperty of walkPropertiesInherited(property.model)) {
64
+ if (isKey(program, otherProperty)) {
65
+ return;
66
+ }
67
+ }
68
+ reportDiagnostic(program, {
69
+ code: "decorator-missing-dependencies",
70
+ target: property,
71
+ format: {
72
+ decorator: "@alternateKey",
73
+ required: "@key",
74
+ location: "entity model",
75
+ },
76
+ });
77
+ },
78
+ };
79
+ },
80
+ });
81
+ //# sourceMappingURL=alternate-key.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alternate-key.js","sourceRoot":"","sources":["../../../src/rules/alternate-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,CAAC,MAAM,mCAAmC,GAAG,UAAU,CAAC;IAC5D,IAAI,EAAE,qCAAqC;IAC3C,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,aAAa,EAAE,CAAC,QAAQ,EAAE,EAAE;gBAC1B,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE;oBACzD,OAAO;iBACR;gBAED,IACE,QAAQ,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ;oBAC/B,QAAQ,CAAC,IAAI,KAAK,OAAO;oBACzB,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,EACtC;oBACA,gBAAgB,CAAC,OAAO,EAAE;wBACxB,IAAI,EAAE,uBAAuB;wBAC7B,MAAM,EAAE,QAAQ;wBAChB,SAAS,EAAE,cAAc;wBACzB,MAAM,EAAE,EAAE;qBACX,CAAC,CAAC;oBAEH,OAAO;iBACR;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,UAAU,CAAC;IAC9C,IAAI,EAAE,sBAAsB;IAC5B,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,aAAa,EAAE,CAAC,QAAQ,EAAE,EAAE;gBAC1B,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE;oBACzD,OAAO;iBACR;gBAED,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE;oBAC7B,OAAO;iBACR;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,QAAQ;oBAChB,SAAS,EAAE,SAAS;oBACpB,MAAM,EAAE;wBACN,SAAS,EAAE,eAAe;wBAC1B,KAAK,EAAE,MAAM;wBACb,QAAQ,EAAE,UAAU;qBACrB;iBACF,CAAC,CAAC;gBAEH,OAAO;YACT,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,2BAA2B,GAAG,UAAU,CAAC;IACpD,IAAI,EAAE,4BAA4B;IAClC,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,aAAa,EAAE,CAAC,QAAQ,EAAE,EAAE;gBAC1B,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE;oBACzD,OAAO;iBACR;gBAED,KAAK,MAAM,aAAa,IAAI,uBAAuB,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;oBACnE,IAAI,KAAK,CAAC,OAAO,EAAE,aAAa,CAAC,EAAE;wBACjC,OAAO;qBACR;iBACF;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,gCAAgC;oBACtC,MAAM,EAAE,QAAQ;oBAChB,MAAM,EAAE;wBACN,SAAS,EAAE,eAAe;wBAC1B,QAAQ,EAAE,MAAM;wBAChB,QAAQ,EAAE,cAAc;qBACzB;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @computed cannot be combined with nullable
3
+ * @computed cannot be combined with @required
4
+ * @computed cannot be combined with @writeOnly
5
+ */
6
+ export declare const computedCannotBeCombinedWithRule: import("@typespec/lint").LintRule;
7
+ //# sourceMappingURL=computed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computed.d.ts","sourceRoot":"","sources":["../../../src/rules/computed.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,mCAqC3C,CAAC"}
@@ -0,0 +1,47 @@
1
+ import { createRule } from "@typespec/lint";
2
+ import { isComputed } from "../decorators/computed.js";
3
+ import { isWriteOnly } from "../index.js";
4
+ import { reportDiagnostic } from "../lib.js";
5
+ import { isTypeNullable } from "../utils.js";
6
+ /**
7
+ * @computed cannot be combined with nullable
8
+ * @computed cannot be combined with @required
9
+ * @computed cannot be combined with @writeOnly
10
+ */
11
+ export const computedCannotBeCombinedWithRule = createRule({
12
+ name: "computed-cannot-be-combined-with",
13
+ create({ program }) {
14
+ return {
15
+ modelProperty: (property) => {
16
+ if (!isComputed(program, property)) {
17
+ return;
18
+ }
19
+ if (isTypeNullable(program, property.type)) {
20
+ reportDiagnostic(program, {
21
+ code: "decorator-invalid-use",
22
+ target: property,
23
+ messageId: "default",
24
+ format: {
25
+ decorator: "@computed",
26
+ other: "nullable",
27
+ location: "property",
28
+ },
29
+ });
30
+ }
31
+ if (isWriteOnly(program, property)) {
32
+ reportDiagnostic(program, {
33
+ code: "decorator-invalid-use",
34
+ target: property,
35
+ messageId: "default",
36
+ format: {
37
+ decorator: "@computed",
38
+ other: "@writeOnly",
39
+ location: "property",
40
+ },
41
+ });
42
+ }
43
+ },
44
+ };
45
+ },
46
+ });
47
+ //# sourceMappingURL=computed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computed.js","sourceRoot":"","sources":["../../../src/rules/computed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;GAIG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,UAAU,CAAC;IACzD,IAAI,EAAE,kCAAkC;IACxC,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,aAAa,EAAE,CAAC,QAAQ,EAAE,EAAE;gBAC1B,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE;oBAClC,OAAO;iBACR;gBAED,IAAI,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE;oBAC1C,gBAAgB,CAAC,OAAO,EAAE;wBACxB,IAAI,EAAE,uBAAuB;wBAC7B,MAAM,EAAE,QAAQ;wBAChB,SAAS,EAAE,SAAS;wBACpB,MAAM,EAAE;4BACN,SAAS,EAAE,WAAW;4BACtB,KAAK,EAAE,UAAU;4BACjB,QAAQ,EAAE,UAAU;yBACrB;qBACF,CAAC,CAAC;iBACJ;gBAED,IAAI,WAAW,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE;oBAClC,gBAAgB,CAAC,OAAO,EAAE;wBACxB,IAAI,EAAE,uBAAuB;wBAC7B,MAAM,EAAE,QAAQ;wBAChB,SAAS,EAAE,SAAS;wBACpB,MAAM,EAAE;4BACN,SAAS,EAAE,WAAW;4BACtB,KAAK,EAAE,YAAY;4BACnB,QAAQ,EAAE,UAAU;yBACrB;qBACF,CAAC,CAAC;iBACJ;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @contains applies to a navigation property.
3
+ */
4
+ export declare const containsOnlyAppliesToNavigationPropertyRule: import("@typespec/lint").LintRule;
5
+ //# sourceMappingURL=contains.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contains.d.ts","sourceRoot":"","sources":["../../../src/rules/contains.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,2CAA2C,mCAyBtD,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { createRule } from "@typespec/lint";
2
+ import { isContains } from "../index.js";
3
+ import { reportDiagnostic } from "../lib.js";
4
+ import { isNavigationProperty } from "../utils.js";
5
+ /**
6
+ * @contains applies to a navigation property.
7
+ */
8
+ export const containsOnlyAppliesToNavigationPropertyRule = createRule({
9
+ name: "contains-only-applies-to-navigation-property",
10
+ create({ program }) {
11
+ return {
12
+ modelProperty: (property) => {
13
+ if (!isContains(program, property)) {
14
+ return;
15
+ }
16
+ if (isNavigationProperty(program, property)) {
17
+ return;
18
+ }
19
+ reportDiagnostic(program, {
20
+ code: "decorator-invalid-use",
21
+ target: property,
22
+ messageId: "wrongType",
23
+ format: {
24
+ decorator: "@contains",
25
+ target: "property that returns an @entity model",
26
+ },
27
+ });
28
+ },
29
+ };
30
+ },
31
+ });
32
+ //# sourceMappingURL=contains.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contains.js","sourceRoot":"","sources":["../../../src/rules/contains.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD;;GAEG;AACH,MAAM,CAAC,MAAM,2CAA2C,GAAG,UAAU,CAAC;IACpE,IAAI,EAAE,8CAA8C;IACpD,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,aAAa,EAAE,CAAC,QAAQ,EAAE,EAAE;gBAC1B,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE;oBAClC,OAAO;iBACR;gBAED,IAAI,oBAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE;oBAC3C,OAAO;iBACR;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,QAAQ;oBAChB,SAAS,EAAE,WAAW;oBACtB,MAAM,EAAE;wBACN,SAAS,EAAE,WAAW;wBACtB,MAAM,EAAE,wCAAwC;qBACjD;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @count applies to get operations that return collections.
3
+ */
4
+ export declare const countAppliesToGetOperationsThatReturnCollectionsRule: import("@typespec/lint").LintRule;
5
+ //# sourceMappingURL=count.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,35 @@
1
+ import { createRule } from "@typespec/lint";
2
+ import { getOperationVerb } from "@typespec/http";
3
+ import { isCount } from "../index.js";
4
+ import { reportDiagnostic } from "../lib.js";
5
+ /**
6
+ * @count applies to get operations that return collections.
7
+ */
8
+ export const countAppliesToGetOperationsThatReturnCollectionsRule = createRule({
9
+ name: "count-applies-to-get-operations-that-return-collections",
10
+ create({ program }) {
11
+ return {
12
+ operation: (operation) => {
13
+ if (!isCount(program, operation)) {
14
+ return;
15
+ }
16
+ if (getOperationVerb(program, operation) === "get") {
17
+ const returnType = operation.returnType;
18
+ if (returnType.kind === "Model" && returnType.name === "PagedListResponse") {
19
+ return;
20
+ }
21
+ }
22
+ reportDiagnostic(program, {
23
+ code: "decorator-invalid-use",
24
+ target: operation,
25
+ messageId: "wrongType",
26
+ format: {
27
+ decorator: "@count",
28
+ target: "get operation that returns a collection",
29
+ },
30
+ });
31
+ },
32
+ };
33
+ },
34
+ });
35
+ //# sourceMappingURL=count.js.map
@@ -0,0 +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"}
@@ -0,0 +1,2 @@
1
+ export declare const entityMustHaveKeyRule: import("@typespec/lint").LintRule;
2
+ //# sourceMappingURL=entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/rules/entity.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB,mCA2BhC,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { isKey, walkPropertiesInherited } from "@typespec/compiler";
2
+ import { createRule } from "@typespec/lint";
3
+ import { isEntity } from "../index.js";
4
+ import { reportDiagnostic } from "../lib.js";
5
+ export const entityMustHaveKeyRule = createRule({
6
+ name: "entity-must-have-key",
7
+ create({ program }) {
8
+ return {
9
+ model: (model) => {
10
+ if (!isEntity(program, model)) {
11
+ return;
12
+ }
13
+ for (const property of walkPropertiesInherited(model)) {
14
+ if (isKey(program, property)) {
15
+ return;
16
+ }
17
+ }
18
+ reportDiagnostic(program, {
19
+ code: "decorator-missing-dependencies",
20
+ target: model,
21
+ format: {
22
+ decorator: "@entity",
23
+ required: "@key",
24
+ location: "entity model property",
25
+ },
26
+ });
27
+ },
28
+ };
29
+ },
30
+ });
31
+ //# sourceMappingURL=entity.js.map
@@ -0,0 +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,MAAM,EAAE,KAAK;oBACb,MAAM,EAAE;wBACN,SAAS,EAAE,SAAS;wBACpB,QAAQ,EAAE,MAAM;wBAChB,QAAQ,EAAE,uBAAuB;qBAClC;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const expandOnlyOnGetNavigationSourceRule: import("@typespec/lint").LintRule;
2
+ export declare const expandOnlyNavigationPropertiesRule: import("@typespec/lint").LintRule;
3
+ //# sourceMappingURL=expand.d.ts.map
@@ -0,0 +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"}