@microsoft/typespec-msgraph 0.0.1-Preview.4 → 0.0.1-Preview.6

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 (215) hide show
  1. package/dist/src/components/alternate-keys-annotation.js +4 -4
  2. package/dist/src/components/alternate-keys-annotation.js.map +1 -1
  3. package/dist/src/components/annotations.d.ts +9 -0
  4. package/dist/src/components/annotations.d.ts.map +1 -0
  5. package/dist/src/components/annotations.js +45 -0
  6. package/dist/src/components/annotations.js.map +1 -0
  7. package/dist/src/components/common-elements.d.ts +17 -4
  8. package/dist/src/components/common-elements.d.ts.map +1 -1
  9. package/dist/src/components/common-elements.js +2 -2
  10. package/dist/src/components/common-elements.js.map +1 -1
  11. package/dist/src/components/computed-annotation.js +1 -1
  12. package/dist/src/components/computed-annotation.js.map +1 -1
  13. package/dist/src/components/count-restrictions-annotation.d.ts.map +1 -1
  14. package/dist/src/components/count-restrictions-annotation.js +3 -8
  15. package/dist/src/components/count-restrictions-annotation.js.map +1 -1
  16. package/dist/src/components/description-annotation.d.ts.map +1 -1
  17. package/dist/src/components/description-annotation.js +1 -0
  18. package/dist/src/components/description-annotation.js.map +1 -1
  19. package/dist/src/components/entity-container-element.d.ts +18 -3
  20. package/dist/src/components/entity-container-element.d.ts.map +1 -1
  21. package/dist/src/components/entity-container-element.js +6 -42
  22. package/dist/src/components/entity-container-element.js.map +1 -1
  23. package/dist/src/components/enum-type-element.js +1 -1
  24. package/dist/src/components/enum-type-element.js.map +1 -1
  25. package/dist/src/components/expand-restrictions-annotation.d.ts.map +1 -1
  26. package/dist/src/components/expand-restrictions-annotation.js +7 -13
  27. package/dist/src/components/expand-restrictions-annotation.js.map +1 -1
  28. package/dist/src/components/operation-element.js +3 -3
  29. package/dist/src/components/operation-element.js.map +1 -1
  30. package/dist/src/components/schema-element.d.ts.map +1 -1
  31. package/dist/src/components/schema-element.js +6 -3
  32. package/dist/src/components/schema-element.js.map +1 -1
  33. package/dist/src/components/search-restrictions-annotation.d.ts.map +1 -1
  34. package/dist/src/components/search-restrictions-annotation.js +3 -8
  35. package/dist/src/components/search-restrictions-annotation.js.map +1 -1
  36. package/dist/src/components/skip-supported-annotation.d.ts.map +1 -1
  37. package/dist/src/components/skip-supported-annotation.js +1 -6
  38. package/dist/src/components/skip-supported-annotation.js.map +1 -1
  39. package/dist/src/components/sort-restrictions-annotation.d.ts.map +1 -1
  40. package/dist/src/components/sort-restrictions-annotation.js +7 -13
  41. package/dist/src/components/sort-restrictions-annotation.js.map +1 -1
  42. package/dist/src/components/structured-type-element.d.ts +4 -7
  43. package/dist/src/components/structured-type-element.d.ts.map +1 -1
  44. package/dist/src/components/structured-type-element.js +21 -23
  45. package/dist/src/components/structured-type-element.js.map +1 -1
  46. package/dist/src/components/top-supported-annotation.d.ts.map +1 -1
  47. package/dist/src/components/top-supported-annotation.js +1 -4
  48. package/dist/src/components/top-supported-annotation.js.map +1 -1
  49. package/dist/src/components/update-restrictions-annotation.d.ts +5 -0
  50. package/dist/src/components/update-restrictions-annotation.d.ts.map +1 -0
  51. package/dist/src/components/update-restrictions-annotation.js +8 -0
  52. package/dist/src/components/update-restrictions-annotation.js.map +1 -0
  53. package/dist/src/decorators/{handlers/custom/additional-query-parameters.d.ts → additional-query-parameters.d.ts} +4 -3
  54. package/dist/src/decorators/additional-query-parameters.d.ts.map +1 -0
  55. package/dist/src/decorators/additional-query-parameters.js +21 -0
  56. package/dist/src/decorators/additional-query-parameters.js.map +1 -0
  57. package/dist/src/decorators/ags-attribute.d.ts +13 -0
  58. package/dist/src/decorators/ags-attribute.d.ts.map +1 -0
  59. package/dist/src/decorators/ags-attribute.js +68 -0
  60. package/dist/src/decorators/ags-attribute.js.map +1 -0
  61. package/dist/src/decorators/delta-collection.d.ts +8 -0
  62. package/dist/src/decorators/delta-collection.d.ts.map +1 -0
  63. package/dist/src/decorators/delta-collection.js +12 -0
  64. package/dist/src/decorators/delta-collection.js.map +1 -0
  65. package/dist/src/decorators/deprecated-definition.d.ts +3 -4
  66. package/dist/src/decorators/deprecated-definition.d.ts.map +1 -1
  67. package/dist/src/decorators/deprecated-definition.js +1 -7
  68. package/dist/src/decorators/deprecated-definition.js.map +1 -1
  69. package/dist/src/decorators/expand.d.ts +1 -2
  70. package/dist/src/decorators/expand.d.ts.map +1 -1
  71. package/dist/src/decorators/expand.js +1 -1
  72. package/dist/src/decorators/expand.js.map +1 -1
  73. package/dist/src/decorators/flags.d.ts +9 -0
  74. package/dist/src/decorators/flags.d.ts.map +1 -0
  75. package/dist/src/decorators/flags.js +13 -0
  76. package/dist/src/decorators/flags.js.map +1 -0
  77. package/dist/src/decorators/function.d.ts +1 -2
  78. package/dist/src/decorators/function.d.ts.map +1 -1
  79. package/dist/src/decorators/function.js +1 -1
  80. package/dist/src/decorators/function.js.map +1 -1
  81. package/dist/src/decorators/graph-route.d.ts +9 -0
  82. package/dist/src/decorators/graph-route.d.ts.map +1 -0
  83. package/dist/src/decorators/graph-route.js +84 -0
  84. package/dist/src/decorators/graph-route.js.map +1 -0
  85. package/dist/src/decorators/has-stream.d.ts +1 -2
  86. package/dist/src/decorators/has-stream.d.ts.map +1 -1
  87. package/dist/src/decorators/has-stream.js +1 -1
  88. package/dist/src/decorators/has-stream.js.map +1 -1
  89. package/dist/src/decorators/index.d.ts +10 -2
  90. package/dist/src/decorators/index.d.ts.map +1 -1
  91. package/dist/src/decorators/index.js +10 -2
  92. package/dist/src/decorators/index.js.map +1 -1
  93. package/dist/src/decorators/is-owner.d.ts +9 -0
  94. package/dist/src/decorators/is-owner.d.ts.map +1 -0
  95. package/dist/src/decorators/is-owner.js +14 -0
  96. package/dist/src/decorators/is-owner.js.map +1 -0
  97. package/dist/src/decorators/order-by.d.ts +1 -2
  98. package/dist/src/decorators/order-by.d.ts.map +1 -1
  99. package/dist/src/decorators/order-by.js +1 -1
  100. package/dist/src/decorators/order-by.js.map +1 -1
  101. package/dist/src/decorators/paged-collection.d.ts +8 -0
  102. package/dist/src/decorators/paged-collection.d.ts.map +1 -0
  103. package/dist/src/decorators/paged-collection.js +12 -0
  104. package/dist/src/decorators/paged-collection.js.map +1 -0
  105. package/dist/src/decorators/private-preview-definition.d.ts +3 -4
  106. package/dist/src/decorators/private-preview-definition.d.ts.map +1 -1
  107. package/dist/src/decorators/private-preview-definition.js +1 -6
  108. package/dist/src/decorators/private-preview-definition.js.map +1 -1
  109. package/dist/src/decorators/private-preview.d.ts +1 -2
  110. package/dist/src/decorators/private-preview.d.ts.map +1 -1
  111. package/dist/src/decorators/private-preview.js +1 -1
  112. package/dist/src/decorators/private-preview.js.map +1 -1
  113. package/dist/src/decorators/privileged.d.ts +9 -0
  114. package/dist/src/decorators/privileged.d.ts.map +1 -0
  115. package/dist/src/decorators/privileged.js +13 -0
  116. package/dist/src/decorators/privileged.js.map +1 -0
  117. package/dist/src/decorators/workload-name-msa.d.ts +9 -0
  118. package/dist/src/decorators/workload-name-msa.d.ts.map +1 -0
  119. package/dist/src/decorators/workload-name-msa.js +13 -0
  120. package/dist/src/decorators/workload-name-msa.js.map +1 -0
  121. package/dist/src/decorators/workload-name.d.ts +9 -0
  122. package/dist/src/decorators/workload-name.d.ts.map +1 -0
  123. package/dist/src/decorators/workload-name.js +13 -0
  124. package/dist/src/decorators/workload-name.js.map +1 -0
  125. package/dist/src/entities/annotations.d.ts +31 -0
  126. package/dist/src/entities/annotations.d.ts.map +1 -0
  127. package/dist/src/entities/annotations.js +99 -0
  128. package/dist/src/entities/annotations.js.map +1 -0
  129. package/dist/src/entities/entity-container.d.ts +4 -24
  130. package/dist/src/entities/entity-container.d.ts.map +1 -1
  131. package/dist/src/entities/entity-container.js +30 -120
  132. package/dist/src/entities/entity-container.js.map +1 -1
  133. package/dist/src/entities/enum.d.ts +1 -0
  134. package/dist/src/entities/enum.d.ts.map +1 -1
  135. package/dist/src/entities/enum.js +5 -3
  136. package/dist/src/entities/enum.js.map +1 -1
  137. package/dist/src/entities/model.d.ts +12 -22
  138. package/dist/src/entities/model.d.ts.map +1 -1
  139. package/dist/src/entities/model.js +64 -101
  140. package/dist/src/entities/model.js.map +1 -1
  141. package/dist/src/entities/namespace.d.ts +8 -3
  142. package/dist/src/entities/namespace.d.ts.map +1 -1
  143. package/dist/src/entities/namespace.js +31 -13
  144. package/dist/src/entities/namespace.js.map +1 -1
  145. package/dist/src/entities/operation.d.ts +2 -2
  146. package/dist/src/entities/operation.d.ts.map +1 -1
  147. package/dist/src/entities/operation.js +30 -14
  148. package/dist/src/entities/operation.js.map +1 -1
  149. package/dist/src/linter.d.ts.map +1 -1
  150. package/dist/src/linter.js +25 -25
  151. package/dist/src/linter.js.map +1 -1
  152. package/dist/src/rules/count.d.ts.map +1 -1
  153. package/dist/src/rules/count.js +3 -1
  154. package/dist/src/rules/count.js.map +1 -1
  155. package/dist/src/rules/entity.d.ts.map +1 -1
  156. package/dist/src/rules/entity.js +4 -1
  157. package/dist/src/rules/entity.js.map +1 -1
  158. package/dist/src/rules/expand.d.ts.map +1 -1
  159. package/dist/src/rules/expand.js +5 -7
  160. package/dist/src/rules/expand.js.map +1 -1
  161. package/dist/src/rules/index.d.ts.map +1 -1
  162. package/dist/src/rules/index.js +1 -0
  163. package/dist/src/rules/index.js.map +1 -1
  164. package/dist/src/rules/order-by.d.ts +1 -1
  165. package/dist/src/rules/order-by.d.ts.map +1 -1
  166. package/dist/src/rules/order-by.js +11 -10
  167. package/dist/src/rules/order-by.js.map +1 -1
  168. package/dist/src/rules/search.d.ts.map +1 -1
  169. package/dist/src/rules/search.js +3 -1
  170. package/dist/src/rules/search.js.map +1 -1
  171. package/dist/src/rules/skip.d.ts.map +1 -1
  172. package/dist/src/rules/skip.js +3 -1
  173. package/dist/src/rules/skip.js.map +1 -1
  174. package/dist/src/rules/top.d.ts.map +1 -1
  175. package/dist/src/rules/top.js +3 -1
  176. package/dist/src/rules/top.js.map +1 -1
  177. package/dist/src/utils.d.ts +16 -0
  178. package/dist/src/utils.d.ts.map +1 -1
  179. package/dist/src/utils.js +87 -1
  180. package/dist/src/utils.js.map +1 -1
  181. package/lib/decorators.tsp +97 -14
  182. package/lib/deployment.tsp +18 -0
  183. package/lib/lib.tsp +9 -14
  184. package/lib/msgraph.tsp +4 -0
  185. package/lib/porcelain.tsp +135 -0
  186. package/lib/responses.tsp +82 -0
  187. package/lib/shared-models.tsp +74 -0
  188. package/package.json +1 -2
  189. package/dist/src/decorators/attribute-builder.d.ts +0 -2
  190. package/dist/src/decorators/attribute-builder.d.ts.map +0 -1
  191. package/dist/src/decorators/attribute-builder.js +0 -166
  192. package/dist/src/decorators/attribute-builder.js.map +0 -1
  193. package/dist/src/decorators/attributes.d.ts +0 -57
  194. package/dist/src/decorators/attributes.d.ts.map +0 -1
  195. package/dist/src/decorators/attributes.js +0 -50
  196. package/dist/src/decorators/attributes.js.map +0 -1
  197. package/dist/src/decorators/decorator-parameter.d.ts +0 -4
  198. package/dist/src/decorators/decorator-parameter.d.ts.map +0 -1
  199. package/dist/src/decorators/decorator-parameter.js +0 -2
  200. package/dist/src/decorators/decorator-parameter.js.map +0 -1
  201. package/dist/src/decorators/handlers/custom/additional-query-parameters.d.ts.map +0 -1
  202. package/dist/src/decorators/handlers/custom/additional-query-parameters.js +0 -38
  203. package/dist/src/decorators/handlers/custom/additional-query-parameters.js.map +0 -1
  204. package/dist/src/decorators/handlers/custom/ags-attribute.d.ts +0 -8
  205. package/dist/src/decorators/handlers/custom/ags-attribute.d.ts.map +0 -1
  206. package/dist/src/decorators/handlers/custom/ags-attribute.js +0 -36
  207. package/dist/src/decorators/handlers/custom/ags-attribute.js.map +0 -1
  208. package/dist/src/decorators/handlers/custom/index.d.ts +0 -3
  209. package/dist/src/decorators/handlers/custom/index.d.ts.map +0 -1
  210. package/dist/src/decorators/handlers/custom/index.js +0 -3
  211. package/dist/src/decorators/handlers/custom/index.js.map +0 -1
  212. package/dist/src/decorators/handlers/index.d.ts +0 -31
  213. package/dist/src/decorators/handlers/index.d.ts.map +0 -1
  214. package/dist/src/decorators/handlers/index.js +0 -121
  215. package/dist/src/decorators/handlers/index.js.map +0 -1
@@ -3,20 +3,19 @@ import { createRule } from "@typespec/lint";
3
3
  import { getOperationVerb } from "@typespec/http";
4
4
  import { getExpand, isContains, isExpand, isReferences } from "../index.js";
5
5
  import { reportDiagnostic } from "../lib.js";
6
+ import { getNavigationSourceType } from "../utils.js";
6
7
  export const expandOnlyOnGetNavigationSourceRule = createRule({
7
8
  name: "expand-only-on-get-navigation-source",
8
9
  create({ program }) {
9
10
  return {
10
11
  operation: (operation) => {
11
- var _a;
12
12
  if (!isExpand(program, operation)) {
13
13
  return;
14
14
  }
15
15
  if (getOperationVerb(program, operation) === "get") {
16
- return;
17
- }
18
- if ((_a = operation.interface) === null || _a === void 0 ? void 0 : _a.operations.has("_isNavigationSource")) {
19
- return;
16
+ if (getNavigationSourceType(program, operation) !== undefined) {
17
+ return;
18
+ }
20
19
  }
21
20
  reportDiagnostic(program, {
22
21
  code: "decorator-invalid-use",
@@ -36,12 +35,11 @@ export const expandOnlyNavigationPropertiesRule = createRule({
36
35
  create({ program }) {
37
36
  return {
38
37
  operation: (operation) => {
39
- var _a, _b;
40
38
  const expanded = getExpand(program, operation);
41
39
  if (!expanded.length) {
42
40
  return;
43
41
  }
44
- const returnType = (_b = (_a = operation.interface) === null || _a === void 0 ? void 0 : _a.operations.get("_isNavigationSource")) === null || _b === void 0 ? void 0 : _b.returnType;
42
+ const returnType = getNavigationSourceType(program, operation);
45
43
  if (!returnType) {
46
44
  return;
47
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"expand.js","sourceRoot":"","sources":["../../../src/rules/expand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,YA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CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AAEzB,eAAO,MAAM,gCAAgC,mCA+B3C,CAAC;AAEH,eAAO,MAAM,qBAAqB,mCAmChC,CAAC;AAEH,eAAO,MAAM,4BAA4B,mCAsBvC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rules/index.ts"],"names":[],"mappings":"AAKA,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AAEzB,eAAO,MAAM,gCAAgC,mCA+B3C,CAAC;AAEH,eAAO,MAAM,qBAAqB,mCAmChC,CAAC;AAEH,eAAO,MAAM,4BAA4B,mCAuBvC,CAAC"}
@@ -92,6 +92,7 @@ export const operationInsideInterfaceRule = createRule({
92
92
  if (isExcludedCoreType(program, operation)) {
93
93
  return;
94
94
  }
95
+ return; // TODO: Work out the compiler bug and get it fixed. See #138
95
96
  reportDiagnostic(program, {
96
97
  code: "element-missing-dependencies",
97
98
  target: operation,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,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C;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,4BAA4B,GAAG,UAAU,CAAC;IACrD,IAAI,EAAE,4BAA4B;IAClC,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE;gBACvB,IAAI,SAAS,CAAC,SAAS,EAAE;oBACvB,OAAO;iBACR;gBAED,IAAI,kBAAkB,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE;oBAC1C,OAAO;iBACR;gBAED,OAAO,CAAC,6DAA6D;gBACrE,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,8BAA8B;oBACpC,MAAM,EAAE,SAAS;oBACjB,SAAS,EAAE,WAAW;oBACtB,MAAM,EAAE,EAAE;iBACX,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -1,3 +1,3 @@
1
- export declare const orderByOnlyOnGetNavigationSourceRule: import("@typespec/lint").LintRule;
1
+ export declare const orderByAppliesToGetOperationsThatReturnCollectionsRule: import("@typespec/lint").LintRule;
2
2
  export declare const orderByOnlyNonNavigationPropertiesRule: import("@typespec/lint").LintRule;
3
3
  //# sourceMappingURL=order-by.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"order-by.d.ts","sourceRoot":"","sources":["../../../src/rules/order-by.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,oCAAoC,mCA6B/C,CAAC;AAEH,eAAO,MAAM,sCAAsC,mCAyCjD,CAAC"}
1
+ {"version":3,"file":"order-by.d.ts","sourceRoot":"","sources":["../../../src/rules/order-by.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,sDAAsD,mCA6BjE,CAAC;AAEH,eAAO,MAAM,sCAAsC,mCAwCjD,CAAC"}
@@ -2,21 +2,23 @@ import { walkPropertiesInherited } from "@typespec/compiler";
2
2
  import { createRule } from "@typespec/lint";
3
3
  import { getOperationVerb } from "@typespec/http";
4
4
  import { getOrderBy, isContains, isOrderBy, isReferences } from "../index.js";
5
+ import { isReturnTypeCollection } from "../utils.js";
5
6
  import { reportDiagnostic } from "../lib.js";
6
- export const orderByOnlyOnGetNavigationSourceRule = createRule({
7
- name: "order-by-only-on-get-navigation-source",
7
+ import { getNavigationSourceType } from "../utils.js";
8
+ export const orderByAppliesToGetOperationsThatReturnCollectionsRule = createRule({
9
+ name: "order-by-applies-to-get-operations-that-return-collections",
8
10
  create({ program }) {
9
11
  return {
10
12
  operation: (operation) => {
11
- var _a;
12
13
  if (!isOrderBy(program, operation)) {
13
14
  return;
14
15
  }
15
16
  if (getOperationVerb(program, operation) === "get") {
16
- return;
17
- }
18
- if ((_a = operation.interface) === null || _a === void 0 ? void 0 : _a.operations.has("_isNavigationSource")) {
19
- return;
17
+ const returnType = operation.returnType;
18
+ const isCollection = isReturnTypeCollection(program, returnType);
19
+ if (isCollection) {
20
+ return;
21
+ }
20
22
  }
21
23
  reportDiagnostic(program, {
22
24
  code: "decorator-invalid-use",
@@ -24,7 +26,7 @@ export const orderByOnlyOnGetNavigationSourceRule = createRule({
24
26
  messageId: "wrongType",
25
27
  format: {
26
28
  decorator: "@orderBy",
27
- target: "get operation",
29
+ target: "get operation that returns a collection",
28
30
  },
29
31
  });
30
32
  },
@@ -36,12 +38,11 @@ export const orderByOnlyNonNavigationPropertiesRule = createRule({
36
38
  create({ program }) {
37
39
  return {
38
40
  operation: (operation) => {
39
- var _a, _b;
40
41
  const ordered = getOrderBy(program, operation);
41
42
  if (!ordered.length) {
42
43
  return;
43
44
  }
44
- const returnType = (_b = (_a = operation.interface) === null || _a === void 0 ? void 0 : _a.operations.get("_isNavigationSource")) === null || _b === void 0 ? void 0 : _b.returnType;
45
+ const returnType = getNavigationSourceType(program, operation);
45
46
  if (!returnType) {
46
47
  return;
47
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"order-by.js","sourceRoot":"","sources":["../../../src/rules/order-by.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,uBAAu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,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/rules/search.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,qDAAqD,mCA4BhE,CAAC"}
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/rules/search.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,eAAO,MAAM,qDAAqD,mCA6BhE,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { createRule } from "@typespec/lint";
2
2
  import { getOperationVerb } from "@typespec/http";
3
3
  import { isSearch } from "../index.js";
4
+ import { isReturnTypeCollection } from "../utils.js";
4
5
  import { reportDiagnostic } from "../lib.js";
5
6
  /**
6
7
  * @search applies to get operations that return collections.
@@ -15,7 +16,8 @@ export const searchAppliesToGetOperationsThatReturnCollectionsRule = createRule(
15
16
  }
16
17
  if (getOperationVerb(program, operation) === "get") {
17
18
  const returnType = operation.returnType;
18
- if (returnType.kind === "Model" && returnType.name === "PagedListResponse") {
19
+ const isCollection = isReturnTypeCollection(program, returnType);
20
+ if (isCollection) {
19
21
  return;
20
22
  }
21
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"search.js","sourceRoot":"","sources":["../../../src/rules/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,qDAAqD,GAAG,UAAU,CAAC;IAC9E,IAAI,EAAE,0DAA0D;IAChE,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE;gBACvB,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,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C,MAAM,YAAY,GAAG,sBAAsB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;oBACjE,IAAI,YAAY,EAAE;wBAChB,OAAO;qBACR;iBACF;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,SAAS;oBACjB,SAAS,EAAE,WAAW;oBACtB,MAAM,EAAE;wBACN,SAAS,EAAE,SAAS;wBACpB,MAAM,EAAE,yCAAyC;qBAClD;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"skip.d.ts","sourceRoot":"","sources":["../../../src/rules/skip.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,mDAAmD,mCA4B9D,CAAC"}
1
+ {"version":3,"file":"skip.d.ts","sourceRoot":"","sources":["../../../src/rules/skip.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,eAAO,MAAM,mDAAmD,mCA6B9D,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { createRule } from "@typespec/lint";
2
2
  import { getOperationVerb } from "@typespec/http";
3
3
  import { isSkip } from "../index.js";
4
+ import { isReturnTypeCollection } from "../utils.js";
4
5
  import { reportDiagnostic } from "../lib.js";
5
6
  /**
6
7
  * @skip applies to get operations that return collections.
@@ -15,7 +16,8 @@ export const skipAppliesToGetOperationsThatReturnCollectionsRule = createRule({
15
16
  }
16
17
  if (getOperationVerb(program, operation) === "get") {
17
18
  const returnType = operation.returnType;
18
- if (returnType.kind === "Model" && returnType.name === "PagedListResponse") {
19
+ const isCollection = isReturnTypeCollection(program, returnType);
20
+ if (isCollection) {
19
21
  return;
20
22
  }
21
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"skip.js","sourceRoot":"","sources":["../../../src/rules/skip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EA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AACH,MAAM,CAAC,MAAM,mDAAmD,GAAG,UAAU,CAAC;IAC5E,IAAI,EAAE,wDAAwD;IAC9D,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE;gBACvB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE;oBAC/B,OAAO;iBACR;gBAED,IAAI,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,KAAK,KAAK,EAAE;oBAClD,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC;oBACxC,MAAM,YAAY,GAAG,sBAAsB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;oBACjE,IAAI,YAAY,EAAE;wBAChB,OAAO;qBACR;iBACF;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,SAAS;oBACjB,SAAS,EAAE,WAAW;oBACtB,MAAM,EAAE;wBACN,SAAS,EAAE,OAAO;wBAClB,MAAM,EAAE,yCAAyC;qBAClD;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"top.d.ts","sourceRoot":"","sources":["../../../src/rules/top.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,kDAAkD,mCA4B7D,CAAC"}
1
+ {"version":3,"file":"top.d.ts","sourceRoot":"","sources":["../../../src/rules/top.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,eAAO,MAAM,kDAAkD,mCA6B7D,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { createRule } from "@typespec/lint";
2
2
  import { getOperationVerb } from "@typespec/http";
3
3
  import { isTop } from "../index.js";
4
+ import { isReturnTypeCollection } from "../utils.js";
4
5
  import { reportDiagnostic } from "../lib.js";
5
6
  /**
6
7
  * @top applies to get operations that return collections.
@@ -15,7 +16,8 @@ export const topAppliesToGetOperationsThatReturnCollectionsRule = createRule({
15
16
  }
16
17
  if (getOperationVerb(program, operation) === "get") {
17
18
  const returnType = operation.returnType;
18
- if (returnType.kind === "Model" && returnType.name === "PagedListResponse") {
19
+ const isCollection = isReturnTypeCollection(program, returnType);
20
+ if (isCollection) {
19
21
  return;
20
22
  }
21
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"top.js","sourceRoot":"","sources":["../../../src/rules/top.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,kDAAkD,GAAG,UAAU,CAAC;IAC3E,IAAI,EAAE,uDAAuD;IAC7D,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE;gBACvB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE;oBAC9B,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,MAAM;wBACjB,MAAM,EAAE,yCAAyC;qBAClD;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"top.js","sourceRoot":"","sources":["../../../src/rules/top.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,kDAAkD,GAAG,UAAU,CAAC;IAC3E,IAAI,EAAE,uDAAuD;IAC7D,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE;gBACvB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE;oBAC9B,OAAO;iBACR;gBAED,IAAI,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,KAAK,KAAK,EAAE;oBAClD,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC;oBACxC,MAAM,YAAY,GAAG,sBAAsB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;oBACjE,IAAI,YAAY,EAAE;wBAChB,OAAO;qBACR;iBACF;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,SAAS;oBACjB,SAAS,EAAE,WAAW;oBACtB,MAAM,EAAE;wBACN,SAAS,EAAE,MAAM;wBACjB,MAAM,EAAE,yCAAyC;qBAClD;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -1,12 +1,24 @@
1
1
  import { Enum, Interface, Model, ModelProperty, Namespace, Operation, Program, Scalar, Type, Union } from "@typespec/compiler";
2
+ export interface MsGraphInterface {
3
+ key: string;
4
+ theInterface: Interface;
5
+ operations: Operation[];
6
+ }
2
7
  export declare function getNameForType(program: Program, type: Type): string;
3
8
  export declare function getNameForModelType(program: Program, type: Model | Scalar): string;
4
9
  export declare function getIdForType(program: Program, type: Type): string;
5
10
  export declare function getNavigationTypeId(program: Program, getOperation: Operation): string;
11
+ export declare function getInterfacesOfKinds(program: Program, navigationSources: Map<string, Interface>, kinds: string[]): Map<string, MsGraphInterface>;
6
12
  export declare function getPropertyTypeName(program: Program, type: Type): string;
7
13
  export declare function isTypeNullable(program: Program, type: Type): boolean;
8
14
  export declare function extractTypesFromUnion(type: Union): Type[];
9
15
  export declare function getSingletonTypeId(program: Program, singletonType: string | null, getOperation: Operation | undefined): string | undefined;
16
+ /**
17
+ * Returns whether a type used as a return type matches Graph's definition of a collection
18
+ * @param program
19
+ * @param returnType
20
+ */
21
+ export declare function isReturnTypeCollection(program: Program, returnType: Type): boolean;
10
22
  /**
11
23
  * Imported from typespec-azure
12
24
  * Returns the full namespace name for the given type, if available.
@@ -23,5 +35,9 @@ export declare function getNamespaceName(program: Program, type: Model | Scalar
23
35
  * @returns true if the type is defined in a namespace that is excluded from linting.
24
36
  */
25
37
  export declare function isExcludedCoreType(program: Program, type: Model | Scalar | Operation | ModelProperty | Interface | Namespace | Enum): boolean;
38
+ export declare function isExcludedLibraryType(program: Program, type: Model | Scalar | Operation | ModelProperty | Interface | Namespace | Enum): boolean;
26
39
  export declare function isNavigationProperty(program: Program, property: ModelProperty): boolean;
40
+ export declare function isNavigationSource(theInterface: Interface): boolean;
41
+ export declare function getInterfaceNavigationSourceType(program: Program, theInterface: Interface): Model | undefined;
42
+ export declare function getNavigationSourceType(program: Program, operation: Operation): Model | undefined;
27
43
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAEJ,SAAS,EAET,KAAK,EACL,aAAa,EACb,SAA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O,EAAE,OAAO,EAChB,aAAa,EAAE,MAAM,GAAG,IAAI,EAC5B,YAAY,EAAE,SAAS,GAAG,SAAS,GAClC,MAAM,GAAG,SAAS,CAMpB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAG,OAAO,EACjB,UAAU,EAAE,IAAI,GAAG,OAAO,CAgBzB;AAMH;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,IAAI,GAAG,SAAS,GAC1F,MAAM,CAsBR;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,IAAI,GAC9E,OAAO,CAOT;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,IAAI,GAC9E,OAAO,CAIT;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,WAc7E;AAED,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,SAAS,GAAG,OAAO,CAEnE;AAID,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,GAAG,KAAK,GAAE,SAAS,CAQ5G;AAGD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,GAAG,KAAK,GAAE,SAAS,CAE/F"}
package/dist/src/utils.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { getNamespaceFullName, isArrayModelType, } from "@typespec/compiler";
2
2
  import { getEntity, isEntity } from "./decorators/index.js";
3
+ import { getRoutePath } from "@typespec/http";
3
4
  export function getNameForType(program, type) {
4
5
  switch (type.kind) {
5
6
  case "Union":
@@ -87,6 +88,31 @@ export function getNavigationTypeId(program, getOperation) {
87
88
  }
88
89
  return getIdForType(program, returnType.templateArguments[0]);
89
90
  }
91
+ export function getInterfacesOfKinds(program, navigationSources, kinds) {
92
+ const interfaces = new Map();
93
+ navigationSources.forEach((theInterface, key) => {
94
+ var _a;
95
+ if (!theInterface.sourceInterfaces.some(s => kinds.includes(s.name))) {
96
+ // if source interfaces DO NOT have the kinds.
97
+ return;
98
+ }
99
+ const routePath = (_a = getRoutePath(program, theInterface)) === null || _a === void 0 ? void 0 : _a.path.split("/")[0];
100
+ if (!routePath) {
101
+ return;
102
+ }
103
+ let operations = [...theInterface.operations.values()];
104
+ if (interfaces.has(routePath)) {
105
+ const existing = interfaces.get(routePath);
106
+ operations = [...operations, ...existing.operations];
107
+ }
108
+ interfaces.set(routePath, {
109
+ key: key,
110
+ theInterface: theInterface,
111
+ operations: operations,
112
+ });
113
+ });
114
+ return interfaces;
115
+ }
90
116
  export function getPropertyTypeName(program, type) {
91
117
  var _a;
92
118
  if (type.kind === "Union") {
@@ -130,6 +156,28 @@ export function getSingletonTypeId(program, singletonType, getOperation) {
130
156
  }
131
157
  return getOperation && getNavigationTypeId(program, getOperation);
132
158
  }
159
+ /**
160
+ * Returns whether a type used as a return type matches Graph's definition of a collection
161
+ * @param program
162
+ * @param returnType
163
+ */
164
+ export function isReturnTypeCollection(program, returnType) {
165
+ let returnTypes = [];
166
+ if (returnType.kind === "Model") {
167
+ returnTypes.push(returnType);
168
+ }
169
+ else if (returnType.kind === "Union") {
170
+ const extracted = extractTypesFromUnion(returnType).filter(t => t.kind === "Model");
171
+ returnTypes = returnTypes.concat(extracted);
172
+ }
173
+ if (returnTypes.length === 0) {
174
+ return false;
175
+ }
176
+ return returnTypes.some(t => isTypeCollection(t));
177
+ }
178
+ function isTypeCollection(type) {
179
+ return type.kind === "Model" && (type.name === "Array" || type.name.includes("Collection"));
180
+ }
133
181
  /**
134
182
  * Imported from typespec-azure
135
183
  * Returns the full namespace name for the given type, if available.
@@ -167,7 +215,12 @@ export function isExcludedCoreType(program, type) {
167
215
  // https://github.com/Azure/typespec-azure/issues/801#issuecomment-1194454247
168
216
  //
169
217
  const nsName = getNamespaceName(program, type);
170
- const excludedNamespaces = ["TypeSpec", "TypeSpec"];
218
+ const excludedNamespaces = ["TypeSpec"];
219
+ return excludedNamespaces.find((ns) => nsName.startsWith(ns)) !== undefined;
220
+ }
221
+ export function isExcludedLibraryType(program, type) {
222
+ const nsName = getNamespaceName(program, type);
223
+ const excludedNamespaces = ["TypeSpec", "MicrosoftGraph"];
171
224
  return excludedNamespaces.find((ns) => nsName.startsWith(ns)) !== undefined;
172
225
  }
173
226
  export function isNavigationProperty(program, property) {
@@ -183,4 +236,37 @@ export function isNavigationProperty(program, property) {
183
236
  }
184
237
  return isEntity(program, propertyType);
185
238
  }
239
+ export function isNavigationSource(theInterface) {
240
+ return findNavigationSource(theInterface) !== undefined;
241
+ }
242
+ // Get the type returned by all operations in an interface representing a navigation source.
243
+ // This is the 'T' in EntitySet<T> and friends.
244
+ export function getInterfaceNavigationSourceType(program, theInterface) {
245
+ var _a;
246
+ const navSource = findNavigationSource(theInterface);
247
+ if (navSource === undefined) {
248
+ return undefined;
249
+ }
250
+ else {
251
+ return (_a = navSource.templateMapper) === null || _a === void 0 ? void 0 : _a.args[0];
252
+ }
253
+ }
254
+ // Get the type returned by all operations in an interface representing a navigation source.
255
+ export function getNavigationSourceType(program, operation) {
256
+ return getInterfaceNavigationSourceType(program, operation.interface);
257
+ }
258
+ function findNavigationSource(theInterface) {
259
+ for (const baseInterface of theInterface.sourceInterfaces) {
260
+ if (baseInterface.name === "SingleNavigationSource" || baseInterface.name === "CollectionNavigationSource") {
261
+ return baseInterface;
262
+ }
263
+ else {
264
+ const baseBase = findNavigationSource(baseInterface);
265
+ if (baseBase !== undefined) {
266
+ return baseBase;
267
+ }
268
+ }
269
+ }
270
+ return undefined;
271
+ }
186
272
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,oBAAoB,EAEpB,gBAAgB,GASjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,cAAc,CAAC,OAAgB,EAAE,IAAU;IACzD,QAAQ,IAAI,CAAC,IAAI,EAAE;QACjB,KAAK,OAAO;YACV,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5E,KAAK,mBAAmB;YACtB,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;QACzB,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS;YACZ,OAAO,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QACzB,KAAK,WAAW,CAAC;QACjB,KAAK,WAAW,CAAC;QACjB,KAAK,WAAW,CAAC;QACjB,KAAK,MAAM;YACT,OAAO,IAAI,CAAC,IAAI,CAAC;QACnB,KAAK,OAAO,CAAC;QACb,KAAK,QAAQ;YACX,OAAO,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC5C;YACE,OAAO,IAAI,CAAC,IAAI,CAAC;KACpB;AACH,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,OAAgB,EAAE,IAAoB;IACxE,QAAQ,IAAI,CAAC,IAAI,EAAE;QACjB,KAAK,QAAQ;YACX,OAAO,YAAY,CAAC;QACtB,KAAK,OAAO;YACV,OAAO,sBAAsB,CAAC;QAChC,KAAK,MAAM;YACT,OAAO,UA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O,EAAE;YACjC,OAAO,KAAK,CAAC;SACd;KACF;IAED,OAAO,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,YAAuB;IACxD,OAAO,oBAAoB,CAAC,YAAY,CAAC,KAAK,SAAS,CAAC;AAC1D,CAAC;AAED,4FAA4F;AAC5F,+CAA+C;AAC/C,MAAM,UAAU,gCAAgC,CAAC,OAAgB,EAAE,YAAuB;;IACxF,MAAM,SAAS,GAAG,oBAAoB,CAAC,YAAY,CAAC,CAAC;IACrD,IAAG,SAAS,KAAK,SAAS,EAAE;QAC1B,OAAO,SAAS,CAAC;KAClB;SACI;QACH,OAAc,MAAA,SAAS,CAAC,cAAc,0CAAE,IAAI,CAAC,CAAC,CAAC,CAAC;KACjD;AACH,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,uBAAuB,CAAC,OAAgB,EAAE,SAAoB;IAC5E,OAAO,gCAAgC,CAAC,OAAO,EAAE,SAAS,CAAC,SAAU,CAAC,CAAC;AACxE,CAAC;AAEF,SAAS,oBAAoB,CAAC,YAAuB;IACnD,KAAK,MAAM,aAAa,IAAI,YAAY,CAAC,gBAAgB,EAAE;QACzD,IAAI,aAAa,CAAC,IAAI,KAAK,wBAAwB,IAAI,aAAa,CAAC,IAAI,KAAK,4BAA4B,EAAE;YAC1G,OAAO,aAAa,CAAC;SACtB;aACI;YACH,MAAM,QAAQ,GAAG,oBAAoB,CAAC,aAAa,CAAC,CAAC;YACrD,IAAI,QAAQ,KAAK,SAAS,EAAG;gBAC3B,OAAO,QAAQ,CAAC;aACjB;SACF;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -48,11 +48,11 @@ extern dec count(target: Operation);
48
48
  */
49
49
  extern dec deprecatedDefinition(
50
50
  target: Namespace,
51
- name: string,
52
- category: string,
53
- announcementDate: string,
54
- removalDate: string,
55
- description: string
51
+ name: valueof string,
52
+ category: valueof string,
53
+ announcementDate: valueof string,
54
+ removalDate: valueof string,
55
+ description: valueof string
56
56
  );
57
57
 
58
58
  /**
@@ -69,21 +69,28 @@ extern dec entity(target: Model);
69
69
  * `properties` - Property names in the model returned from the get that can be used in a $expand query parameter.
70
70
  * At least one property must be specified.
71
71
  */
72
- extern dec expand(target: Operation, property: string, ...otherProperties: string[]);
72
+ extern dec expand(target: Operation, property: valueof string, ...otherProperties: valueof string[]);
73
+
74
+ /**
75
+ * `@flags` - mark an enumeration type as a flag.
76
+ *
77
+ * `@flags` can only be applied to enums.
78
+ */
79
+ extern dec flags(target: Enum);
73
80
 
74
81
  /**
75
82
  * `@function` - mark an operation as a function
76
83
  *
77
84
  * `@function` can only be applied to operations.
78
85
  */
79
- extern dec function(target: Operation, name?: string);
86
+ extern dec function(target: Operation, name?: valueof string);
80
87
 
81
88
  /**
82
89
  * `@hasStream` - indicates that an `@entity` model has a stream.
83
90
  *
84
91
  * `mediaTypes` - list of media types supported by the stream. If not specified, the stream supports any media type.
85
92
  */
86
- extern dec hasStream(target: Model, ...mediaTypes: string[]);
93
+ extern dec hasStream(target: Model, ...mediaTypes: valueof string[]);
87
94
 
88
95
  /**
89
96
  * `@open` - mark a model type as open
@@ -108,7 +115,7 @@ extern dec operationParameters(target: Model);
108
115
  * `properties` - List of property names in the model returned from the get operation that can be used in a $orderBy query parameter.
109
116
  * At least one property must be specified.
110
117
  */
111
- extern dec orderBy(target: Operation, property: string, ...otherProperties: string[]);
118
+ extern dec orderBy(target: Operation, property: valueof string, ...otherProperties: valueof string[]);
112
119
 
113
120
  /**
114
121
  * `@privatePreview` - Allow us define a privatePreview element.
@@ -116,7 +123,7 @@ extern dec orderBy(target: Operation, property: string, ...otherProperties: stri
116
123
  */
117
124
  extern dec privatePreview(
118
125
  target: Model | ModelProperty | EnumMember | Enum | Operation | Namespace,
119
- name: string
126
+ name: valueof string
120
127
  );
121
128
 
122
129
  /**
@@ -125,10 +132,10 @@ extern dec privatePreview(
125
132
  */
126
133
  extern dec privatePreviewDefinition(
127
134
  target: Namespace,
128
- name: string,
129
- announcementDate: string,
130
- removalDate: string,
131
- owner: string
135
+ name: valueof string,
136
+ announcementDate: valueof string,
137
+ removalDate: valueof string,
138
+ owner: valueof string
132
139
  );
133
140
 
134
141
  /**
@@ -169,3 +176,79 @@ extern dec top(target: Operation);
169
176
  * `@writeOnly` can only be applied to model properties.
170
177
  */
171
178
  extern dec writeOnly(target: ModelProperty);
179
+
180
+ /**
181
+ * `@additionalQueryParameters` - Appends a key=value pair to the query string of the mapped internal URL for all models defined within the namespace.
182
+ *
183
+ * `@additionalQueryParameters` can only be applied to namespaces
184
+ */
185
+ extern dec additionalQueryParameters(target: Namespace, name: valueof string, value: valueof string);
186
+
187
+ /**
188
+ * `@agsAttribute` - Allows all AGS CSDL extensions that are not yet modelled explicitly in TypeSpec to be maintained
189
+ *
190
+ * `@agsAttribute` - Applies to models.
191
+ */
192
+ extern dec agsAttribute(
193
+ target: Model | ModelProperty | Enum | EnumMember | Operation | Interface,
194
+ name: valueof string,
195
+ value: valueof string
196
+ );
197
+
198
+ /**
199
+ * `@isOwner` - specify that this workload is the primary owner of this entity model
200
+ *
201
+ * `@isOwner` can be applied to Model where the model also has an @entity decorator or a ModelProperty where it has either an @contains or @references decorator.
202
+ */
203
+ extern dec isOwner(target: Model | ModelProperty);
204
+
205
+ /**
206
+ * `@privileged` - mark the entity as privileged
207
+ *
208
+ * `@privileged` can be applied to Model, ModelProperty, Enum, EnumMember, Operation, Namespace.
209
+ */
210
+ extern dec privileged(target: Model | ModelProperty | Enum | EnumMember | Operation | Namespace);
211
+
212
+ /**
213
+ * `@workloadName` - specifies the name used by the underlying workload
214
+ *
215
+ * `@workloadName` can be applied to Model, ModelProperty, Enum, EnumMember.
216
+ */
217
+ extern dec workloadName(
218
+ target: Model | ModelProperty | Enum | EnumMember,
219
+ workloadName: valueof string
220
+ );
221
+
222
+ /**
223
+ * `@workloadNameMsa` - specifies the name used by the underlying workload for consumer use cases
224
+ *
225
+ * `@workloadNameMsa` can be applied to Model, ModelProperty, Enum, EnumMember.
226
+ */
227
+ extern dec workloadNameMsa(
228
+ target: Model | ModelProperty | Enum | EnumMember,
229
+ workloadNameMsa: valueof string
230
+ );
231
+
232
+ /**
233
+ * `@pagedCollection` - mark a model as representing a paged collection.
234
+ *
235
+ * `@pagedCollection` can only be applied to models.
236
+ */
237
+ extern dec pagedCollection(target: Model);
238
+
239
+ /**
240
+ * `@deltaCollection` - mark a model as representing a delta paged collection.
241
+ *
242
+ * `@deltaCollection` can only be applied to models.
243
+ */
244
+ extern dec deltaCollection(target: Model);
245
+
246
+ /**
247
+ * `@graphRoute` - mark an interface or operation with an HTTP route.
248
+ *
249
+ * `@graphRoute` - can only be applied to interfaces or operations.
250
+ */
251
+ // TODO: Using @graphRoute on an operation currently does not work due to the following TypeSpec core issue
252
+ // https://github.com/microsoft/typespec/issues/2106
253
+ // Disabling all related features while we await the outcome.
254
+ extern dec graphRoute(target: Interface /* | Operation */, path: valueof string);
@@ -0,0 +1,18 @@
1
+ namespace TypeSpec.MsGraph.Deployment;
2
+
3
+ enum deploymentTargets {
4
+ prodBeta,
5
+ prodV1_0,
6
+ prodEdu,
7
+ ppeBeta,
8
+ ppeV1_0,
9
+ ppeEdu,
10
+ mooncakeBeta,
11
+ mooncakeV1_0,
12
+ fairfaxBeta,
13
+ fairfaxV1_0,
14
+ usNatBeta,
15
+ usNatV1_0,
16
+ usSecBeta,
17
+ usSecV1_0
18
+ }