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

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 (204) 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 +50 -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/expand-restrictions-annotation.d.ts.map +1 -1
  24. package/dist/src/components/expand-restrictions-annotation.js +7 -13
  25. package/dist/src/components/expand-restrictions-annotation.js.map +1 -1
  26. package/dist/src/components/operation-element.js +3 -3
  27. package/dist/src/components/operation-element.js.map +1 -1
  28. package/dist/src/components/schema-element.d.ts.map +1 -1
  29. package/dist/src/components/schema-element.js +6 -3
  30. package/dist/src/components/schema-element.js.map +1 -1
  31. package/dist/src/components/search-restrictions-annotation.d.ts.map +1 -1
  32. package/dist/src/components/search-restrictions-annotation.js +3 -8
  33. package/dist/src/components/search-restrictions-annotation.js.map +1 -1
  34. package/dist/src/components/skip-supported-annotation.d.ts.map +1 -1
  35. package/dist/src/components/skip-supported-annotation.js +1 -6
  36. package/dist/src/components/skip-supported-annotation.js.map +1 -1
  37. package/dist/src/components/sort-restrictions-annotation.d.ts.map +1 -1
  38. package/dist/src/components/sort-restrictions-annotation.js +7 -13
  39. package/dist/src/components/sort-restrictions-annotation.js.map +1 -1
  40. package/dist/src/components/structured-type-element.d.ts +4 -7
  41. package/dist/src/components/structured-type-element.d.ts.map +1 -1
  42. package/dist/src/components/structured-type-element.js +21 -23
  43. package/dist/src/components/structured-type-element.js.map +1 -1
  44. package/dist/src/components/top-supported-annotation.d.ts.map +1 -1
  45. package/dist/src/components/top-supported-annotation.js +1 -4
  46. package/dist/src/components/top-supported-annotation.js.map +1 -1
  47. package/dist/src/decorators/{handlers/custom/additional-query-parameters.d.ts → additional-query-parameters.d.ts} +4 -3
  48. package/dist/src/decorators/additional-query-parameters.d.ts.map +1 -0
  49. package/dist/src/decorators/additional-query-parameters.js +21 -0
  50. package/dist/src/decorators/additional-query-parameters.js.map +1 -0
  51. package/dist/src/decorators/ags-attribute.d.ts +13 -0
  52. package/dist/src/decorators/ags-attribute.d.ts.map +1 -0
  53. package/dist/src/decorators/ags-attribute.js +68 -0
  54. package/dist/src/decorators/ags-attribute.js.map +1 -0
  55. package/dist/src/decorators/delta-collection.d.ts +8 -0
  56. package/dist/src/decorators/delta-collection.d.ts.map +1 -0
  57. package/dist/src/decorators/delta-collection.js +12 -0
  58. package/dist/src/decorators/delta-collection.js.map +1 -0
  59. package/dist/src/decorators/deprecated-definition.d.ts +3 -4
  60. package/dist/src/decorators/deprecated-definition.d.ts.map +1 -1
  61. package/dist/src/decorators/deprecated-definition.js +1 -7
  62. package/dist/src/decorators/deprecated-definition.js.map +1 -1
  63. package/dist/src/decorators/expand.d.ts +1 -2
  64. package/dist/src/decorators/expand.d.ts.map +1 -1
  65. package/dist/src/decorators/expand.js +1 -1
  66. package/dist/src/decorators/expand.js.map +1 -1
  67. package/dist/src/decorators/function.d.ts +1 -2
  68. package/dist/src/decorators/function.d.ts.map +1 -1
  69. package/dist/src/decorators/function.js +1 -1
  70. package/dist/src/decorators/function.js.map +1 -1
  71. package/dist/src/decorators/graph-route.d.ts +9 -0
  72. package/dist/src/decorators/graph-route.d.ts.map +1 -0
  73. package/dist/src/decorators/graph-route.js +84 -0
  74. package/dist/src/decorators/graph-route.js.map +1 -0
  75. package/dist/src/decorators/has-stream.d.ts +1 -2
  76. package/dist/src/decorators/has-stream.d.ts.map +1 -1
  77. package/dist/src/decorators/has-stream.js +1 -1
  78. package/dist/src/decorators/has-stream.js.map +1 -1
  79. package/dist/src/decorators/index.d.ts +9 -2
  80. package/dist/src/decorators/index.d.ts.map +1 -1
  81. package/dist/src/decorators/index.js +9 -2
  82. package/dist/src/decorators/index.js.map +1 -1
  83. package/dist/src/decorators/is-owner.d.ts +9 -0
  84. package/dist/src/decorators/is-owner.d.ts.map +1 -0
  85. package/dist/src/decorators/is-owner.js +14 -0
  86. package/dist/src/decorators/is-owner.js.map +1 -0
  87. package/dist/src/decorators/order-by.d.ts +1 -2
  88. package/dist/src/decorators/order-by.d.ts.map +1 -1
  89. package/dist/src/decorators/order-by.js +1 -1
  90. package/dist/src/decorators/order-by.js.map +1 -1
  91. package/dist/src/decorators/paged-collection.d.ts +8 -0
  92. package/dist/src/decorators/paged-collection.d.ts.map +1 -0
  93. package/dist/src/decorators/paged-collection.js +12 -0
  94. package/dist/src/decorators/paged-collection.js.map +1 -0
  95. package/dist/src/decorators/private-preview-definition.d.ts +3 -4
  96. package/dist/src/decorators/private-preview-definition.d.ts.map +1 -1
  97. package/dist/src/decorators/private-preview-definition.js +1 -6
  98. package/dist/src/decorators/private-preview-definition.js.map +1 -1
  99. package/dist/src/decorators/private-preview.d.ts +1 -2
  100. package/dist/src/decorators/private-preview.d.ts.map +1 -1
  101. package/dist/src/decorators/private-preview.js +1 -1
  102. package/dist/src/decorators/private-preview.js.map +1 -1
  103. package/dist/src/decorators/privileged.d.ts +9 -0
  104. package/dist/src/decorators/privileged.d.ts.map +1 -0
  105. package/dist/src/decorators/privileged.js +13 -0
  106. package/dist/src/decorators/privileged.js.map +1 -0
  107. package/dist/src/decorators/workload-name-msa.d.ts +9 -0
  108. package/dist/src/decorators/workload-name-msa.d.ts.map +1 -0
  109. package/dist/src/decorators/workload-name-msa.js +13 -0
  110. package/dist/src/decorators/workload-name-msa.js.map +1 -0
  111. package/dist/src/decorators/workload-name.d.ts +9 -0
  112. package/dist/src/decorators/workload-name.d.ts.map +1 -0
  113. package/dist/src/decorators/workload-name.js +13 -0
  114. package/dist/src/decorators/workload-name.js.map +1 -0
  115. package/dist/src/entities/annotations.d.ts +30 -0
  116. package/dist/src/entities/annotations.d.ts.map +1 -0
  117. package/dist/src/entities/annotations.js +97 -0
  118. package/dist/src/entities/annotations.js.map +1 -0
  119. package/dist/src/entities/entity-container.d.ts +3 -24
  120. package/dist/src/entities/entity-container.d.ts.map +1 -1
  121. package/dist/src/entities/entity-container.js +24 -118
  122. package/dist/src/entities/entity-container.js.map +1 -1
  123. package/dist/src/entities/enum.d.ts.map +1 -1
  124. package/dist/src/entities/enum.js +3 -3
  125. package/dist/src/entities/enum.js.map +1 -1
  126. package/dist/src/entities/model.d.ts +12 -22
  127. package/dist/src/entities/model.d.ts.map +1 -1
  128. package/dist/src/entities/model.js +64 -101
  129. package/dist/src/entities/model.js.map +1 -1
  130. package/dist/src/entities/namespace.d.ts +7 -2
  131. package/dist/src/entities/namespace.d.ts.map +1 -1
  132. package/dist/src/entities/namespace.js +20 -13
  133. package/dist/src/entities/namespace.js.map +1 -1
  134. package/dist/src/entities/operation.d.ts +2 -2
  135. package/dist/src/entities/operation.d.ts.map +1 -1
  136. package/dist/src/entities/operation.js +30 -14
  137. package/dist/src/entities/operation.js.map +1 -1
  138. package/dist/src/linter.d.ts.map +1 -1
  139. package/dist/src/linter.js +25 -25
  140. package/dist/src/linter.js.map +1 -1
  141. package/dist/src/rules/count.d.ts.map +1 -1
  142. package/dist/src/rules/count.js +3 -1
  143. package/dist/src/rules/count.js.map +1 -1
  144. package/dist/src/rules/entity.d.ts.map +1 -1
  145. package/dist/src/rules/entity.js +4 -1
  146. package/dist/src/rules/entity.js.map +1 -1
  147. package/dist/src/rules/expand.d.ts.map +1 -1
  148. package/dist/src/rules/expand.js +5 -7
  149. package/dist/src/rules/expand.js.map +1 -1
  150. package/dist/src/rules/index.d.ts.map +1 -1
  151. package/dist/src/rules/index.js +1 -0
  152. package/dist/src/rules/index.js.map +1 -1
  153. package/dist/src/rules/order-by.d.ts +1 -1
  154. package/dist/src/rules/order-by.d.ts.map +1 -1
  155. package/dist/src/rules/order-by.js +11 -10
  156. package/dist/src/rules/order-by.js.map +1 -1
  157. package/dist/src/rules/search.d.ts.map +1 -1
  158. package/dist/src/rules/search.js +3 -1
  159. package/dist/src/rules/search.js.map +1 -1
  160. package/dist/src/rules/skip.d.ts.map +1 -1
  161. package/dist/src/rules/skip.js +3 -1
  162. package/dist/src/rules/skip.js.map +1 -1
  163. package/dist/src/rules/top.d.ts.map +1 -1
  164. package/dist/src/rules/top.js +3 -1
  165. package/dist/src/rules/top.js.map +1 -1
  166. package/dist/src/utils.d.ts +16 -0
  167. package/dist/src/utils.d.ts.map +1 -1
  168. package/dist/src/utils.js +89 -1
  169. package/dist/src/utils.js.map +1 -1
  170. package/lib/decorators.tsp +90 -14
  171. package/lib/deployment.tsp +18 -0
  172. package/lib/lib.tsp +9 -14
  173. package/lib/msgraph.tsp +4 -0
  174. package/lib/porcelain.tsp +135 -0
  175. package/lib/responses.tsp +82 -0
  176. package/lib/shared-models.tsp +74 -0
  177. package/package.json +1 -2
  178. package/dist/src/decorators/attribute-builder.d.ts +0 -2
  179. package/dist/src/decorators/attribute-builder.d.ts.map +0 -1
  180. package/dist/src/decorators/attribute-builder.js +0 -166
  181. package/dist/src/decorators/attribute-builder.js.map +0 -1
  182. package/dist/src/decorators/attributes.d.ts +0 -57
  183. package/dist/src/decorators/attributes.d.ts.map +0 -1
  184. package/dist/src/decorators/attributes.js +0 -50
  185. package/dist/src/decorators/attributes.js.map +0 -1
  186. package/dist/src/decorators/decorator-parameter.d.ts +0 -4
  187. package/dist/src/decorators/decorator-parameter.d.ts.map +0 -1
  188. package/dist/src/decorators/decorator-parameter.js +0 -2
  189. package/dist/src/decorators/decorator-parameter.js.map +0 -1
  190. package/dist/src/decorators/handlers/custom/additional-query-parameters.d.ts.map +0 -1
  191. package/dist/src/decorators/handlers/custom/additional-query-parameters.js +0 -38
  192. package/dist/src/decorators/handlers/custom/additional-query-parameters.js.map +0 -1
  193. package/dist/src/decorators/handlers/custom/ags-attribute.d.ts +0 -8
  194. package/dist/src/decorators/handlers/custom/ags-attribute.d.ts.map +0 -1
  195. package/dist/src/decorators/handlers/custom/ags-attribute.js +0 -36
  196. package/dist/src/decorators/handlers/custom/ags-attribute.js.map +0 -1
  197. package/dist/src/decorators/handlers/custom/index.d.ts +0 -3
  198. package/dist/src/decorators/handlers/custom/index.d.ts.map +0 -1
  199. package/dist/src/decorators/handlers/custom/index.js +0 -3
  200. package/dist/src/decorators/handlers/custom/index.js.map +0 -1
  201. package/dist/src/decorators/handlers/index.d.ts +0 -31
  202. package/dist/src/decorators/handlers/index.d.ts.map +0 -1
  203. package/dist/src/decorators/handlers/index.js +0 -121
  204. package/dist/src/decorators/handlers/index.js.map +0 -1
@@ -1,16 +1,10 @@
1
1
  import React from "react";
2
2
  import { AnnotationElement, CollectionElement, PropertyPathElement, PropertyValueElement, RecordElement } from "./common-elements.js";
3
- export const SortRestrictionsAnnotation = ({ hasSortOperation, nonSortableProperties }) => {
4
- if (!hasSortOperation) {
5
- return (React.createElement(AnnotationElement, { Term: "Org.OData.Capabilities.V1.SortRestrictions" },
6
- React.createElement(RecordElement, null,
7
- React.createElement(PropertyValueElement, { Property: "Sortable", Bool: "false" }))));
8
- }
9
- return (React.createElement(AnnotationElement, { Term: "Org.OData.Capabilities.V1.SortRestrictions" },
10
- React.createElement(RecordElement, null,
11
- React.createElement(PropertyValueElement, { Property: "Sortable", Bool: "true" }),
12
- React.createElement(PropertyValueElement, { Property: "NonSortableProperties" },
13
- React.createElement(CollectionElement, null, nonSortableProperties === null || nonSortableProperties === void 0 ? void 0 : nonSortableProperties.map((property) => (React.createElement(PropertyPathElement, { key: property },
14
- React.createElement(React.Fragment, null, property)))))))));
15
- };
3
+ export const SortRestrictionsAnnotation = ({ hasSortOperation, nonSortableProperties }) => React.createElement(AnnotationElement, { Term: "Org.OData.Capabilities.V1.SortRestrictions" },
4
+ React.createElement(RecordElement, null,
5
+ React.createElement(PropertyValueElement, { Property: "Sortable", Bool: hasSortOperation }),
6
+ hasSortOperation ? React.createElement(NonSortableProperties, { nonSortableProperties: nonSortableProperties }) : React.createElement(React.Fragment, null)));
7
+ const NonSortableProperties = ({ nonSortableProperties }) => React.createElement(PropertyValueElement, { Property: "NonSortableProperties" },
8
+ React.createElement(CollectionElement, null, nonSortableProperties === null || nonSortableProperties === void 0 ? void 0 : nonSortableProperties.map((property) => (React.createElement(PropertyPathElement, { key: property },
9
+ React.createElement(React.Fragment, null, property))))));
16
10
  //# sourceMappingURL=sort-restrictions-annotation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sort-restrictions-annotation.js","sourceRoot":"","sources":["../../../src/components/sort-restrictions-annotation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAa,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEtI,MAAM,CAAC,MAAM,0BAA0B,GACnC,CAAC,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,EAAE,EAAE;IAClD,IAAI,CAAC,gBAAgB,EAAE;QACrB,OAAO,CACL,oBAAC,iBAAiB,IAAC,IAAI,EAAC,4CAA4C;YAClE,oBAAC,aAAa;gBACZ,oBAAC,oBAAoB,IAAC,QAAQ,EAAC,UAAU,EAAC,IAAI,EAAC,OAAO,GAAG,CAC3C,CACE,CACrB,CAAC;KACH;IAED,OAAO,CACL,oBAAC,iBAAiB,IAAC,IAAI,EAAC,4CAA4C;QAClE,oBAAC,aAAa;YACZ,oBAAC,oBAAoB,IAAC,QAAQ,EAAC,UAAU,EAAC,IAAI,EAAC,MAAM,GAAG;YACxD,oBAAC,oBAAoB,IAAC,QAAQ,EAAC,uBAAuB;gBACpD,oBAAC,iBAAiB,QACf,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CACxC,oBAAC,mBAAmB,IAAC,GAAG,EAAE,QAAQ;oBAChC,0CAAG,QAAQ,CAAI,CACK,CACvB,CAAC,CACgB,CACC,CACT,CACE,CACrB,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"sort-restrictions-annotation.js","sourceRoot":"","sources":["../../../src/components/sort-restrictions-annotation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAa,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEtI,MAAM,CAAC,MAAM,0BAA0B,GACnC,CAAC,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,EAAE,EAAE,CAChD,oBAAC,iBAAiB,IAAC,IAAI,EAAC,4CAA4C;IAClE,oBAAC,aAAa;QACZ,oBAAC,oBAAoB,IAAC,QAAQ,EAAC,UAAU,EAAC,IAAI,EAAE,gBAAgB,GAAI;QAClE,gBAAgB,CAAC,CAAC,CAAC,oBAAC,qBAAqB,IAAC,qBAAqB,EAAE,qBAAqB,GAAG,CAAC,CAAC,CAAC,yCAAK,CACrF,CACE,CAAA;AAExB,MAAM,qBAAqB,GAAwD,CAAC,EAAE,qBAAqB,EAAE,EAAE,EAAE,CAC/G,oBAAC,oBAAoB,IAAC,QAAQ,EAAC,uBAAuB;IACpD,oBAAC,iBAAiB,QACf,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CACxC,oBAAC,mBAAmB,IAAC,GAAG,EAAE,QAAQ;QAChC,0CAAG,QAAQ,CAAI,CACK,CACvB,CAAC,CACgB,CACC,CAAA"}
@@ -1,12 +1,9 @@
1
- import React, { FC } from "react";
2
- import { ComplexType, EntityType, StructuredType } from "../entities/model.js";
3
- declare const EntityType: (props: StructuredType) => React.ReactElement<StructuredType, string | React.JSXElementConstructor<any>>;
4
- declare const ComplexType: (props: StructuredType) => React.ReactElement<StructuredType, string | React.JSXElementConstructor<any>>;
1
+ import { FC } from "react";
2
+ import { MsGraphModel } from "../entities/model.js";
5
3
  export declare const EntityTypeElement: FC<{
6
- props: EntityType;
4
+ model: MsGraphModel;
7
5
  }>;
8
6
  export declare const ComplexTypeElement: FC<{
9
- props: ComplexType;
7
+ model: MsGraphModel;
10
8
  }>;
11
- export {};
12
9
  //# sourceMappingURL=structured-type-element.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"structured-type-element.d.ts","sourceRoot":"","sources":["../../../src/components/structured-type-element.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAOlC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAwB,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAErG,QAAA,MAAM,UAAU,UAAW,cAAc,kFAA6C,CAAC;AACvF,QAAA,MAAM,WAAW,UAAW,cAAc,kFAA8C,CAAC;AAKzF,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC;IAAE,KAAK,EAAE,UAAU,CAAA;CAAE,CAWvD,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC;IAAE,KAAK,EAAE,WAAW,CAAA;CAAE,CAQzD,CAAC"}
1
+ {"version":3,"file":"structured-type-element.d.ts","sourceRoot":"","sources":["../../../src/components/structured-type-element.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAOlC,OAAO,EAAE,YAAY,EAAwB,MAAM,sBAAsB,CAAC;AAiB1E,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC;IAAE,KAAK,EAAE,YAAY,CAAA;CAAE,CAgBzD,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC;IAAE,KAAK,EAAE,YAAY,CAAA;CAAE,CAa1D,CAAC"}
@@ -9,29 +9,27 @@ const EntityType = (props) => React.createElement("EntityType", props);
9
9
  const ComplexType = (props) => React.createElement("ComplexType", props);
10
10
  const Key = (props) => React.createElement("Key", props);
11
11
  const PropertyRef = (props) => React.createElement("PropertyRef", props);
12
- export const EntityTypeElement = ({ props }) => {
13
- return (React.createElement(EntityType, { ...props.StructuredType },
14
- React.createElement(KeyPropertyElement, { keyProperty: props.KeyProperty }),
15
- React.createElement(PropertyList, { properties: props.Properties }),
16
- React.createElement(AlternateKeysAnnotation, { alternateKeys: props.AlternateKeys }),
17
- React.createElement(AcceptableMediaTypesAnnotation, { streamTypes: props.StreamTypes }),
18
- React.createElement(RevisionsAnnotation, { definition: props.RevisionDefinition }),
19
- React.createElement(DescriptionAnnotation, { description: props.Description })));
12
+ export const EntityTypeElement = ({ model }) => {
13
+ var _a, _b, _c;
14
+ return (React.createElement(EntityType, { Name: model.Name, Abstract: (_a = model.IsAbstract) === null || _a === void 0 ? void 0 : _a.toString(), BaseType: model.BaseType, OpenType: (_b = model.IsOpenType) === null || _b === void 0 ? void 0 : _b.toString(), HasStream: (_c = model.HasStream) === null || _c === void 0 ? void 0 : _c.toString(), ...model.AgsAttributes },
15
+ React.createElement(KeyPropertyElement, { keyProperty: model.KeyProperty }),
16
+ React.createElement(PropertyList, { properties: model.Properties }),
17
+ React.createElement(AlternateKeysAnnotation, { alternateKeys: model.AlternateKeys }),
18
+ React.createElement(AcceptableMediaTypesAnnotation, { streamTypes: model.StreamTypes }),
19
+ React.createElement(RevisionsAnnotation, { definition: model.RevisionDefinition }),
20
+ React.createElement(DescriptionAnnotation, { description: model.Description })));
20
21
  };
21
- export const ComplexTypeElement = ({ props }) => {
22
- return (React.createElement(ComplexType, { ...props.StructuredType },
23
- React.createElement(PropertyList, { properties: props.Properties }),
24
- React.createElement(RevisionsAnnotation, { definition: props.RevisionDefinition }),
25
- React.createElement(DescriptionAnnotation, { description: props.Description })));
26
- };
27
- const KeyPropertyElement = ({ keyProperty }) => {
28
- if (!keyProperty) {
29
- return React.createElement(React.Fragment, null);
30
- }
31
- return (React.createElement(Key, null,
32
- React.createElement(PropertyRef, { Name: keyProperty[0] })));
33
- };
34
- const PropertyList = (props) => {
35
- return (React.createElement(ItemList, { items: props.properties, render: (property) => React.createElement(PropertyElement, { property: property }) }));
22
+ export const ComplexTypeElement = ({ model }) => {
23
+ var _a, _b, _c;
24
+ return (React.createElement(ComplexType, { Name: model.Name, Abstract: (_a = model.IsAbstract) === null || _a === void 0 ? void 0 : _a.toString(), BaseType: model.BaseType, OpenType: (_b = model.IsOpenType) === null || _b === void 0 ? void 0 : _b.toString(), HasStream: (_c = model.HasStream) === null || _c === void 0 ? void 0 : _c.toString(), ...model.AgsAttributes },
25
+ React.createElement(PropertyList, { properties: model.Properties }),
26
+ React.createElement(RevisionsAnnotation, { definition: model.RevisionDefinition }),
27
+ React.createElement(DescriptionAnnotation, { description: model.Description })));
36
28
  };
29
+ const KeyPropertyElement = ({ keyProperty }) => keyProperty
30
+ ? React.createElement(Key, null,
31
+ React.createElement(PropertyRef, { Name: keyProperty[0] }),
32
+ " ")
33
+ : React.createElement(React.Fragment, null);
34
+ const PropertyList = (props) => React.createElement(ItemList, { items: props.properties, render: (property) => React.createElement(PropertyElement, { property: property }) });
37
35
  //# sourceMappingURL=structured-type-element.js.map
@@ -1 +1 @@
1
- {"version":3,"file":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W,GAAI;QAClE,oBAAC,mBAAmB,IAAC,UAAU,EAAE,KAAK,CAAC,kBAAkB,GAAI;QAC7D,oBAAC,qBAAqB,IAAC,WAAW,EAAE,KAAK,CAAC,WAAW,GAAI,CAC9C,CACd,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAA+B,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC1E,OAAO,CACL,oBAAC,WAAW,OAAK,KAAK,CAAC,cAAc;QACnC,oBAAC,YAAY,IAAC,UAAU,EAAE,KAAK,CAAC,UAAU,GAAI;QAC9C,oBAAC,mBAAmB,IAAC,UAAU,EAAE,KAAK,CAAC,kBAAkB,GAAI;QAC7D,oBAAC,qBAAqB,IAAC,WAAW,EAAE,KAAK,CAAC,WAAW,GAAI,CAC7C,CACf,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAA6D,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE;IACvG,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,yCAAK,CAAC;KACd;IAED,OAAO,CACL,oBAAC,GAAG;QACF,oBAAC,WAAW,IAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,GAAI,CACjC,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,YAAY,GAA+C,CAAC,KAAK,EAAE,EAAE;IACzE,OAAO,CACL,oBAAC,QAAQ,IACP,KAAK,EAAE,KAAK,CAAC,UAAU,EACvB,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,oBAAC,eAAe,IAAC,QAAQ,EAAE,QAAQ,GAAI,GAC7D,CACH,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"structured-type-element.js","sourceRoot":"","sources":["../../../src/components/structured-type-element.tsx"],"names":[],"mappings":"AACA,OAAO,KAAa,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AACxF,OAAO,EAAE,uBAAuB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AAC,QAAQ,EAAE,EAAE,CAAC,oBAAC,eAAe,IAAC,QAAQ,EAAE,QAAQ,GAAI,GAAI,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"top-supported-annotation.d.ts","sourceRoot":"","sources":["../../../src/components/top-supported-annotation.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGlC,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC;IAAE,eAAe,EAAE,OAAO,CAAA;CAAE,CAMnE,CAAC"}
1
+ {"version":3,"file":"top-supported-annotation.d.ts","sourceRoot":"","sources":["../../../src/components/top-supported-annotation.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGlC,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC;IAAE,eAAe,EAAE,OAAO,CAAA;CAAE,CAEnE,CAAC"}
@@ -1,9 +1,6 @@
1
1
  import React from "react";
2
2
  import { AnnotationElement } from "./common-elements.js";
3
3
  export const TopSupportedAnnotation = ({ hasTopOperation }) => {
4
- if (hasTopOperation) {
5
- return React.createElement(React.Fragment, null);
6
- }
7
- return React.createElement(AnnotationElement, { Term: "Org.OData.Core.V1.TopSupported", Bool: "false" });
4
+ return React.createElement(AnnotationElement, { Term: "Org.OData.Core.V1.TopSupported", Bool: hasTopOperation });
8
5
  };
9
6
  //# sourceMappingURL=top-supported-annotation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"top-supported-annotation.js","sourceRoot":"","sources":["../../../src/components/top-supported-annotation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAa,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,CAAC,MAAM,sBAAsB,GAAqC,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE;IAC9F,IAAI,eAAe,EAAE;QACnB,OAAO,yCAAK,CAAC;KACd;IAED,OAAO,oBAAC,iBAAiB,IAAC,IAAI,EAAC,gCAAgC,EAAC,IAAI,EAAC,OAAO,GAAG,CAAC;AAClF,CAAC,CAAC"}
1
+ {"version":3,"file":"top-supported-annotation.js","sourceRoot":"","sources":["../../../src/components/top-supported-annotation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAa,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,CAAC,MAAM,sBAAsB,GAAqC,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE;IAC9F,OAAO,oBAAC,iBAAiB,IAAC,IAAI,EAAC,gCAAgC,EAAC,IAAI,EAAE,eAAe,GAAI,CAAC;AAC5F,CAAC,CAAC"}
@@ -1,13 +1,14 @@
1
1
  import { DecoratorContext, Namespace, Program, Type } from "@typespec/compiler";
2
- import { DecoratorParameter } from "../../decorator-parameter.js";
3
2
  export interface QueryParameter {
4
3
  name: string;
5
4
  value: string;
6
5
  }
7
6
  /**
8
- * \`@additionalQueryParameters\` - Appends a key=value pair to the query string of the mapped internal URL for all models defined within the namespace..
7
+ * `@additionalQueryParameters` - Appends a key=value pair to the query string of the mapped internal URL for all models defined within the namespace.
8
+ *
9
+ * `@additionalQueryParameters` can only be applied to namespaces
9
10
  */
10
- export declare function $additionalQueryParameters(context: DecoratorContext, target: Namespace, nameParam: DecoratorParameter | undefined, valueParam: DecoratorParameter | undefined): void;
11
+ export declare function $additionalQueryParameters(context: DecoratorContext, target: Namespace, name: string, value: string): void;
11
12
  export declare function getAdditionalQueryParameters(program: Program, target: Namespace): QueryParameter[];
12
13
  export declare function unpackAdditionalQueryParameters(program: Program, target: Type): {
13
14
  [key: string]: string;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"additional-query-parameters.d.ts","sourceRoot":"","sources":["../../../src/decorators/additional-query-parameters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAEhF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAGD;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,QAMd;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,SAAS,GAChB,cAAc,EAAE,CAElB;AAED,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,IAAI,GACX;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAM3B"}
@@ -0,0 +1,21 @@
1
+ const additionalQueryParametersKey = Symbol("additionalQueryParameters");
2
+ /**
3
+ * `@additionalQueryParameters` - Appends a key=value pair to the query string of the mapped internal URL for all models defined within the namespace.
4
+ *
5
+ * `@additionalQueryParameters` can only be applied to namespaces
6
+ */
7
+ export function $additionalQueryParameters(context, target, name, value) {
8
+ const queryParameters = getAdditionalQueryParameters(context.program, target);
9
+ queryParameters.push({ name, value });
10
+ context.program.stateMap(additionalQueryParametersKey).set(target, queryParameters);
11
+ }
12
+ export function getAdditionalQueryParameters(program, target) {
13
+ return program.stateMap(additionalQueryParametersKey).get(target) || [];
14
+ }
15
+ export function unpackAdditionalQueryParameters(program, target) {
16
+ const additionalQueryParameters = getAdditionalQueryParameters(program, target);
17
+ const queryParameters = additionalQueryParameters &&
18
+ additionalQueryParameters.map((p) => `${p.name}=${p.value}`).join("&");
19
+ return { "ags:AdditionalQueryParameters": queryParameters };
20
+ }
21
+ //# sourceMappingURL=additional-query-parameters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"additional-query-parameters.js","sourceRoot":"","sources":["../../../src/decorators/additional-query-parameters.ts"],"names":[],"mappings":"AAMA,MAAM,4BAA4B,GAAG,MAAM,CAAC,2BAA2B,CAAC,CAAC;AAEzE;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CACxC,OAAyB,EACzB,MAAiB,EACjB,IAAY,EACZ,KAAa;IAEb,MAAM,eAAe,GAAG,4BAA4B,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC9E,eAAe,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAEtC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AACtF,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,OAAgB,EAChB,MAAiB;IAEjB,OAAO,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC7C,OAAgB,EAChB,MAAY;IAEZ,MAAM,yBAAyB,GAAG,4BAA4B,CAAC,OAAO,EAAE,MAAmB,CAAC,CAAC;IAC7F,MAAM,eAAe,GACnB,yBAAyB;QACzB,yBAAyB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzE,OAAO,EAAE,+BAA+B,EAAE,eAAe,EAAE,CAAC;AAC9D,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { DecoratorContext, Enum, EnumMember, Interface, Model, ModelProperty, Namespace, Operation, Program, Type } from "@typespec/compiler";
2
+ /**
3
+ * `@agsAttribute` - Allows all AGS CSDL extensions that are not yet modelled explicitly in TypeSpec to be maintained
4
+ *
5
+ * `@agsAttribute` - Applies to models.
6
+ */
7
+ export declare function $agsAttribute(context: DecoratorContext, target: Model | ModelProperty | Enum | EnumMember | Operation | Interface, name: string, value: string): void;
8
+ export declare function getAgsAttributes(program: Program, target: Model | ModelProperty | Enum | EnumMember | Operation | Interface): Map<string, string>;
9
+ export declare function unpackAgsAttributes(program: Program, target: Type): {
10
+ [key: string]: string;
11
+ };
12
+ export declare function buildAttributes(program: Program, type: Model | ModelProperty | Namespace | Interface | Operation | Enum | EnumMember): Record<string, string>;
13
+ //# sourceMappingURL=ags-attribute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ags-attribute.d.ts","sourceRoot":"","sources":["../../../src/decorators/ags-attribute.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,IAAI,EACJ,UAAU,EACV,SAAS,EACT,KAAK,EACL,aAAa,EACb,SAAS,EACT,SAAS,EACT,OAAO,EACP,IAAI,EACL,MAAM,oBAAoB,CAAC;AAS5B;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,KAAK,GAAG,aAAa,GAAG,IAAI,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,EACzE,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,QAMd;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,KAAK,GAAG,aAAa,GAAG,IAAI,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,GACxE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAErB;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAQ7F;AAoBD,wBAAgB,eAAe,CAC7B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,KAAK,GAAG,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,IAAI,GAAG,UAAU,GAClF,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA0BxB"}
@@ -0,0 +1,68 @@
1
+ import { unpackAdditionalQueryParameters } from "./additional-query-parameters.js";
2
+ import { isIsOwner } from "./is-owner.js";
3
+ import { isPrivileged } from "./privileged.js";
4
+ import { getWorkloadNameMsa } from "./workload-name-msa.js";
5
+ import { getWorkloadName } from "./workload-name.js";
6
+ const agsAttributeKey = Symbol("agsAttribute");
7
+ /**
8
+ * `@agsAttribute` - Allows all AGS CSDL extensions that are not yet modelled explicitly in TypeSpec to be maintained
9
+ *
10
+ * `@agsAttribute` - Applies to models.
11
+ */
12
+ export function $agsAttribute(context, target, name, value) {
13
+ const agsAttributes = getAgsAttributes(context.program, target);
14
+ agsAttributes.set(name, value);
15
+ context.program.stateMap(agsAttributeKey).set(target, agsAttributes);
16
+ }
17
+ export function getAgsAttributes(program, target) {
18
+ return program.stateMap(agsAttributeKey).get(target) || new Map();
19
+ }
20
+ export function unpackAgsAttributes(program, target) {
21
+ const attributes = getAgsAttributes(program, target);
22
+ let params = {};
23
+ attributes.forEach((value, name) => (params = { ...params, ...{ [`ags:${name}`]: value } }));
24
+ return params;
25
+ }
26
+ const decoratorToMethodMapper = {
27
+ isOwner: isIsOwner,
28
+ privileged: isPrivileged,
29
+ workloadName: getWorkloadName,
30
+ workloadNameMsa: getWorkloadNameMsa,
31
+ additionalQueryParameters: unpackAdditionalQueryParameters,
32
+ agsAttribute: unpackAgsAttributes,
33
+ };
34
+ const decoratorToAgsAttributeMapper = {
35
+ isOwner: "ags:IsOwner",
36
+ privileged: "ags:IsHidden",
37
+ workloadName: "ags:WorkloadName",
38
+ workloadNameMsa: "ags:WorkloadNameMsa",
39
+ };
40
+ export function buildAttributes(program, type) {
41
+ const declaredDecorators = [
42
+ "isOwner",
43
+ "privileged",
44
+ "workloadName",
45
+ "workloadNameMsa",
46
+ "additionalQueryParameters",
47
+ "agsAttribute",
48
+ ];
49
+ let attrs = {};
50
+ type.decorators
51
+ // only handle declared decorators
52
+ .filter((d) => declaredDecorators.some((s) => s === d.decorator.name.substring(1)))
53
+ .forEach((d) => {
54
+ const attrName = d.decorator.name.substring(1); // name prefixed with $
55
+ let key = attrName;
56
+ const agsAttrParams = decoratorToMethodMapper[key](program, type);
57
+ if (typeof agsAttrParams === "object") {
58
+ attrs = { ...attrs, ...agsAttrParams };
59
+ }
60
+ else {
61
+ key = attrName;
62
+ const agsAttr = decoratorToAgsAttributeMapper[key];
63
+ attrs = { ...attrs, ...{ [agsAttr]: agsAttrParams } };
64
+ }
65
+ });
66
+ return attrs;
67
+ }
68
+ //# sourceMappingURL=ags-attribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ags-attribute.js","sourceRoot":"","sources":["../../../src/decorators/ags-attribute.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,eAAe,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAE/C;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,OAAyB,EACzB,MAAyE,EACzE,IAAY,EACZ,KAAa;IAEb,MAAM,aAAa,GAAG,gBAAgB,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAChE,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAE/B,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,OAAgB,EAChB,MAAyE;IAEzE,OAAO,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,G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AAM,QAAQ,GAAG,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,uBAAuB;QACvE,IAAI,GAAG,GAAG,QAAgD,CAAC;QAC3D,MAAM,aAAa,GAAG,uBAAuB,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAClE,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE;YACrC,KAAK,GAAG,EAAE,GAAG,KAAK,EAAE,GAAG,aAAa,EAAE,CAAC;SACxC;aAAM;YACL,GAAG,GAAG,QAAsD,CAAC;YAC7D,MAAM,OAAO,GAAG,6BAA6B,CAAC,GAAG,CAAC,CAAC;YACnD,KAAK,GAAG,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,aAAa,EAAE,EAAE,CAAC;SACvD;IACH,CAAC,CAAC,CAAC;IACL,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { DecoratorContext, Model, Program } from "@typespec/compiler";
2
+ /**
3
+ * `@deltaCollection` - Applies to: models.
4
+ * Indicates that the model is a body response containing a delta paged collection.
5
+ */
6
+ export declare function $deltaCollection(context: DecoratorContext, target: Model): void;
7
+ export declare function isDeltaCollection(program: Program, target: Model): boolean;
8
+ //# sourceMappingURL=delta-collection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delta-collection.d.ts","sourceRoot":"","sources":["../../../src/decorators/delta-collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAItE;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,QAExE;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,WAEhE"}
@@ -0,0 +1,12 @@
1
+ const deltaCollectionKey = Symbol("deltaCollection");
2
+ /**
3
+ * `@deltaCollection` - Applies to: models.
4
+ * Indicates that the model is a body response containing a delta paged collection.
5
+ */
6
+ export function $deltaCollection(context, target) {
7
+ context.program.stateSet(deltaCollectionKey).add(target);
8
+ }
9
+ export function isDeltaCollection(program, target) {
10
+ return program.stateSet(deltaCollectionKey).has(target);
11
+ }
12
+ //# sourceMappingURL=delta-collection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delta-collection.js","sourceRoot":"","sources":["../../../src/decorators/delta-collection.ts"],"names":[],"mappings":"AAEA,MAAM,kBAAkB,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAErD;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAyB,EAAE,MAAa;IACvE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAgB,EAAE,MAAa;IAC/D,OAAO,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAC1D,CAAC"}
@@ -1,11 +1,10 @@
1
1
  import { DecoratorContext, Namespace, Program } from "@typespec/compiler";
2
- import { DecoratorParameter } from "./decorator-parameter.js";
3
2
  /**
4
3
  * `@deprecatedDefinition` - create a reusable deprecation definition.
5
4
  *
6
5
  * `@deprecatedDefinition` can only be applied to namespaces.
7
6
  */
8
- export interface DeprecatedDecoratorParameters {
7
+ export interface DeprecatedDefinitionParameters {
9
8
  name: string;
10
9
  category: string;
11
10
  announcementDate: string;
@@ -16,7 +15,7 @@ export interface DeprecatedDecoratorParameters {
16
15
  * `@deprecatedDefinition` - Allow us create a reusable deprecation definition.
17
16
  * `@deprecatedDefinition` - Applies only to namespaces.
18
17
  */
19
- export declare function $deprecatedDefinition(context: DecoratorContext, target: Namespace, name: DecoratorParameter, category: DecoratorParameter, announcementDate: DecoratorParameter, removalDate: DecoratorParameter, description: DecoratorParameter): void;
18
+ export declare function $deprecatedDefinition(context: DecoratorContext, target: Namespace, name: string, category: string, announcementDate: string, removalDate: string, description: string): void;
20
19
  export declare function hasDeprecatedDefinitions(program: Program, target: Namespace): boolean;
21
- export declare function getDeprecatedDefinitions(program: Program, target: Namespace): Map<string, DeprecatedDecoratorParameters>;
20
+ export declare function getDeprecatedDefinitions(program: Program, target: Namespace): Map<string, DeprecatedDefinitionParameters>;
22
21
  //# sourceMappingURL=deprecated-definition.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deprecated-definition.d.ts","sourceRoot":"","sources":["../../../src/decorators/deprecated-definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D;;;;GAIG;AACH,MAAM,WAAW,6BAA6B;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAID;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,kBAAkB,EACxB,QAAQ,EAAE,kBAAkB,EAC5B,gBAAgB,EAAE,kBAAkB,EACpC,WAAW,EAAE,kBAAkB,EAC/B,WAAW,EAAE,kBAAkB,QAYhC;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAErF;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,SAAS,GAChB,GAAG,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAK5C"}
1
+ {"version":3,"file":"deprecated-definition.d.ts","sourceRoot":"","sources":["../../../src/decorators/deprecated-definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE1E;;;;GAIG;AACH,MAAM,WAAW,8BAA8B;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAID;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,EACxB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,QAMpB;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAErF;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,SAAS,GAChB,GAAG,CAAC,MAAM,EAAE,8BAA8B,CAAC,CAK7C"}
@@ -5,13 +5,7 @@ const deprecatedDefinitionKey = Symbol("deprecatedDefinition");
5
5
  */
6
6
  export function $deprecatedDefinition(context, target, name, category, announcementDate, removalDate, description) {
7
7
  const definitions = getDeprecatedDefinitions(context.program, target);
8
- definitions.set(name.value, {
9
- name: name.value,
10
- category: category.value,
11
- announcementDate: announcementDate.value,
12
- removalDate: removalDate.value,
13
- description: description.value,
14
- });
8
+ definitions.set(name, { name, category, announcementDate, removalDate, description });
15
9
  context.program.stateMap(deprecatedDefinitionKey).set(target, definitions);
16
10
  }
17
11
  export function hasDeprecatedDefinitions(program, target) {
@@ -1 +1 @@
1
- {"version":3,"file":"deprecated-definition.js","sourceRoot":"","sources":["../../../src/decorators/deprecated-definition.ts"],"names":[],"mappings":"AAgBA,MAAM,uBAAuB,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAE/D;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAAyB,EACzB,MAAiB,EACjB,IAAwB,EACxB,QAA4B,EAC5B,gBAAoC,EACpC,WAA+B,EAC/B,WAA+B;IAE/B,MAAM,WAAW,GAAG,wBAAwB,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACtE,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE;QAC1B,IAAI,EAAE,IAAI,CAAC,KAAK;QAChB,QAAQ,EAAE,QAAQ,CAAC,KAAK;QACxB,gBAAgB,EAAE,gBAAgB,CAAC,KAAK;QACxC,WAAW,EAAE,WAAW,CAAC,KAAK;QAC9B,WAAW,EAAE,WAAW,CAAC,KAAK;KAC/B,CAAC,CAAC;IAEH,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,OAAgB,EAAE,MAAiB;IAC1E,OAAO,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,OAAgB,EAChB,MAAiB;IAEjB,OAAO,CACL,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;QACrD,IAAI,GAAG,EAAyC,CACjD,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"deprecated-definition.js","sourceRoot":"","sources":["../../../src/decorators/deprecated-definition.ts"],"names":[],"mappings":"AAeA,MAAM,uBAAuB,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAE/D;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAAyB,EACzB,MAAiB,EACjB,IAAY,EACZ,QAAgB,EAChB,gBAAwB,EACxB,WAAmB,EACnB,WAAmB;IAEnB,MAAM,WAAW,GAAG,wBAAwB,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACtE,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,CAAC;IAEtF,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,OAAgB,EAAE,MAAiB;IAC1E,OAAO,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,OAAgB,EAChB,MAAiB;IAEjB,OAAO,CACL,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;QACrD,IAAI,GAAG,EAA0C,CAClD,CAAC;AACJ,CAAC"}
@@ -1,12 +1,11 @@
1
1
  import { DecoratorContext, Operation, Program } from "@typespec/compiler";
2
- import { DecoratorParameter } from "./decorator-parameter.js";
3
2
  /**
4
3
  * `@expand` - Applies to: get operations that return collections or individual instances of models that contain @contains or @references properties.
5
4
  * Indicates that the get operation supports the OData $expand query parameter.
6
5
  *
7
6
  * `properties` - Property names in the model returned from the get operation that can be used in a $expand query parameter.
8
7
  */
9
- export declare function $expand(context: DecoratorContext, target: Operation, ...properties: DecoratorParameter[]): void;
8
+ export declare function $expand(context: DecoratorContext, target: Operation, ...properties: string[]): void;
10
9
  export declare function getExpand(program: Program, target: Operation): string[];
11
10
  export declare function isExpand(program: Program, target: Operation): boolean;
12
11
  //# sourceMappingURL=expand.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"expand.d.ts","sourceRoot":"","sources":["../../../src/decorators/expand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAI9D;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,UAAU,EAAE,kBAAkB,EAAE,QAExG;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,GAAG,MAAM,EAAE,CAEvE;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAErE"}
1
+ {"version":3,"file":"expand.d.ts","sourceRoot":"","sources":["../../../src/decorators/expand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAI1E;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,UAAU,EAAE,MAAM,EAAE,QAE5F;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,GAAG,MAAM,EAAE,CAEvE;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAErE"}
@@ -6,7 +6,7 @@ const expandKey = Symbol("expand");
6
6
  * `properties` - Property names in the model returned from the get operation that can be used in a $expand query parameter.
7
7
  */
8
8
  export function $expand(context, target, ...properties) {
9
- context.program.stateMap(expandKey).set(target, properties.map(p => p.value));
9
+ context.program.stateMap(expandKey).set(target, properties);
10
10
  }
11
11
  export function getExpand(program, target) {
12
12
  return program.stateMap(expandKey).get(target) || [];
@@ -1 +1 @@
1
- {"version":3,"file":"expand.js","sourceRoot":"","sources":["../../../src/decorators/expand.ts"],"names":[],"mappings":"AAGA,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,OAAyB,EAAE,MAAiB,EAAE,GAAG,UAAgC;IACvG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAChF,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,OAAgB,EAAE,MAAiB;IAC3D,OAAO,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,OAAgB,EAAE,MAAiB;IAC1D,OAAO,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACjD,CAAC"}
1
+ {"version":3,"file":"expand.js","sourceRoot":"","sources":["../../../src/decorators/expand.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,OAAyB,EAAE,MAAiB,EAAE,GAAG,UAAoB;IAC3F,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,OAAgB,EAAE,MAAiB;IAC3D,OAAO,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,OAAgB,EAAE,MAAiB;IAC1D,OAAO,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACjD,CAAC"}
@@ -1,11 +1,10 @@
1
1
  import { DecoratorContext, Operation, Program } from "@typespec/compiler";
2
- import { DecoratorParameter } from "./decorator-parameter.js";
3
2
  /**
4
3
  * `@function` - mark an operation as a function
5
4
  *
6
5
  * `@function` can only be applied to operations.
7
6
  */
8
- export declare function $function(context: DecoratorContext, target: Operation, name?: DecoratorParameter): void;
7
+ export declare function $function(context: DecoratorContext, target: Operation, name?: string): void;
9
8
  export declare function isFunction(program: Program, target: Operation): boolean;
10
9
  export declare function getFunction(program: Program, target: Operation): string | undefined;
11
10
  //# sourceMappingURL=function.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../../src/decorators/function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAI9D;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,kBAAkB,QAEhG;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,WAE7D;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAEnF"}
1
+ {"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../../src/decorators/function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAI1E;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,MAAM,QAEpF;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,WAE7D;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAEnF"}
@@ -5,7 +5,7 @@ const functionKey = Symbol("function");
5
5
  * `@function` can only be applied to operations.
6
6
  */
7
7
  export function $function(context, target, name) {
8
- context.program.stateMap(functionKey).set(target, (name === null || name === void 0 ? void 0 : name.value) || target.name);
8
+ context.program.stateMap(functionKey).set(target, name || target.name);
9
9
  }
10
10
  export function isFunction(program, target) {
11
11
  return program.stateMap(functionKey).has(target);
@@ -1 +1 @@
1
- {"version":3,"file":"function.js","sourceRoot":"","sources":["../../../src/decorators/function.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAEvC;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,OAAyB,EAAE,MAAiB,EAAE,IAAyB;IAC/F,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,KAAI,MAAM,CAAC,IAAI,CAAC,CAAC;AAChF,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,OAAgB,EAAE,MAAiB;IAC5D,OAAO,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAgB,EAAE,MAAiB;IAC7D,OAAO,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACnD,CAAC"}
1
+ {"version":3,"file":"function.js","sourceRoot":"","sources":["../../../src/decorators/function.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAEvC;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,OAAyB,EAAE,MAAiB,EAAE,IAAa;IACnF,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC;AACzE,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,OAAgB,EAAE,MAAiB;IAC5D,OAAO,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAgB,EAAE,MAAiB;IAC7D,OAAO,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACnD,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { DecoratorContext, Interface, Operation, Program, Type } from "@typespec/compiler";
2
+ /**
3
+ * `@graphRoute` - Allow us to define an HTTP route for an interface or operation.
4
+ * `@graphRoute` - Applies to interfaces and operations.
5
+ */
6
+ export declare function $graphRoute(context: DecoratorContext, target: Interface | Operation, path: string): void;
7
+ export declare function getGraphRoutePath(program: Program, target: Type): string;
8
+ export declare function hasGraphRoute(program: Program, target: Type): boolean;
9
+ //# sourceMappingURL=graph-route.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-route.d.ts","sourceRoot":"","sources":["../../../src/decorators/graph-route.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,OAAO,EACP,IAAI,EAIL,MAAM,oBAAoB,CAAC;AAM5B;;;GAGG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,SAAS,GAAG,SAAS,EAC7B,IAAI,EAAE,MAAM,QA+Bb;AAiDD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAG,MAAM,CAExE;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,WAE3D"}
@@ -0,0 +1,84 @@
1
+ import { setRoute } from "@typespec/http";
2
+ import { getNavigationSourceType } from "../utils.js";
3
+ const graphRouteKey = Symbol("graphRoute");
4
+ /**
5
+ * `@graphRoute` - Allow us to define an HTTP route for an interface or operation.
6
+ * `@graphRoute` - Applies to interfaces and operations.
7
+ */
8
+ export function $graphRoute(context, target, path) {
9
+ context.program.stateMap(graphRouteKey).set(target, path);
10
+ setRoute(context, target, {
11
+ path,
12
+ shared: true,
13
+ });
14
+ const routeParams = extractParamsFromPath(path);
15
+ // Modify the operations to inject path parameters and correct resource type from interface base interface.
16
+ // TODO: Using @graphRoute on an operation currently does not work due to the following TypeSpec core issue
17
+ // https://github.com/microsoft/typespec/issues/2106
18
+ // Disabling all related features while we await the outcome.
19
+ /*
20
+ if (target.kind === "Operation") {
21
+ const returnType = getNavigationSourceType(context.program, target as Operation);
22
+ if (returnType !== undefined) {
23
+ replaceParametersOnOperation(target as Operation, routeParams);
24
+ replaceResourceType(context.program, target as Operation, returnType);
25
+ }
26
+ } else */
27
+ if (target.kind === "Interface") {
28
+ target.operations.forEach((operation) => {
29
+ const returnType = getNavigationSourceType(context.program, operation);
30
+ if (returnType !== undefined) {
31
+ replaceParametersOnOperation(operation, routeParams);
32
+ replaceResourceType(context.program, operation, returnType);
33
+ }
34
+ });
35
+ }
36
+ }
37
+ function replaceResourceType(program, operation, resourceType) {
38
+ const [calculatedResourceType, _] = program.resolveTypeReference("TypeSpec.MsGraph.Automatic.CalculatedResourceType");
39
+ if (!calculatedResourceType) {
40
+ return;
41
+ }
42
+ const resourceCoreType = getResourceCoreType(resourceType);
43
+ // Replace body, if any.
44
+ if (operation.parameters.properties.has("body")) {
45
+ const property = operation.parameters.properties.get("body");
46
+ if ((property === null || property === void 0 ? void 0 : property.type) === calculatedResourceType) {
47
+ property.type = resourceCoreType;
48
+ }
49
+ }
50
+ }
51
+ function getResourceCoreType(resourceType) {
52
+ var _a;
53
+ return resourceType.indexer !== undefined ? (_a = resourceType.indexer) === null || _a === void 0 ? void 0 : _a.value : resourceType;
54
+ }
55
+ function replaceParametersOnOperation(operation, params) {
56
+ if (operation.parameters.properties.has("graphRouteParams")) {
57
+ operation.parameters.properties.delete("graphRouteParams");
58
+ params.forEach((param) => {
59
+ operation.parameters.properties.set(param, {
60
+ name: param,
61
+ kind: "ModelProperty",
62
+ type: { name: "string", kind: "Scalar" },
63
+ });
64
+ });
65
+ }
66
+ }
67
+ /**
68
+ * Extract params to be interpolated(Wrapped in '{' and '}'}) from a path/url.
69
+ * @param path Path/Url
70
+ *
71
+ * @example "foo/{name}/bar" -> ["name"]
72
+ */
73
+ function extractParamsFromPath(path) {
74
+ var _a;
75
+ const matchResults = path.match(/\{\w+\}/g);
76
+ return (_a = matchResults === null || matchResults === void 0 ? void 0 : matchResults.map((s) => s.slice(1, -1))) !== null && _a !== void 0 ? _a : [];
77
+ }
78
+ export function getGraphRoutePath(program, target) {
79
+ return program.stateMap(graphRouteKey).get(target);
80
+ }
81
+ export function hasGraphRoute(program, target) {
82
+ return program.stateMap(graphRouteKey).has(target);
83
+ }
84
+ //# sourceMappingURL=graph-route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-route.js","sourceRoot":"","sources":["../../../src/decorators/graph-route.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AAE3C;;;GAGG;AACH,MAAM,UAAU,WAAW,CACzB,OAAyB,EACzB,MAA6B,EAC7B,IAAY;IAEZ,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,GAAG,CA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E,MAAY;IAC1D,OAAO,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACrD,CAAC"}
@@ -1,11 +1,10 @@
1
1
  import { DecoratorContext, Model, Program } from "@typespec/compiler";
2
- import { DecoratorParameter } from "./decorator-parameter.js";
3
2
  /**
4
3
  * `@hasStream` - indicates that an `@entity` model has a stream.
5
4
  *
6
5
  * `mediaTypes` - list of media types supported by the stream. If not specified, the stream supports any media type.
7
6
  */
8
- export declare function $hasStream(context: DecoratorContext, target: Model, args?: DecoratorParameter, ...mediaTypes: DecoratorParameter[]): void;
7
+ export declare function $hasStream(context: DecoratorContext, target: Model, args?: string, ...mediaTypes: string[]): void;
9
8
  export declare function hasStream(program: Program, target: Model): boolean;
10
9
  export declare function getStreamTypes(program: Program, target: Model): string[];
11
10
  //# sourceMappingURL=has-stream.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"has-stream.d.ts","sourceRoot":"","sources":["../../../src/decorators/has-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAI9D;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,KAAK,EACb,IAAI,CAAC,EAAE,kBAAkB,EACzB,GAAG,UAAU,EAAE,kBAAkB,EAAE,QAOpC;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,GAAG,OAAO,CAElE;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,GAAG,MAAM,EAAE,CAExE"}
1
+ {"version":3,"file":"has-stream.d.ts","sourceRoot":"","sources":["../../../src/decorators/has-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAItE;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,KAAK,EACb,IAAI,CAAC,EAAE,MAAM,EACb,GAAG,UAAU,EAAE,MAAM,EAAE,QAOxB;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,GAAG,OAAO,CAElE;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,GAAG,MAAM,EAAE,CAExE"}
@@ -5,7 +5,7 @@ const hasStreamKey = Symbol("hasStream");
5
5
  * `mediaTypes` - list of media types supported by the stream. If not specified, the stream supports any media type.
6
6
  */
7
7
  export function $hasStream(context, target, args, ...mediaTypes) {
8
- const types = args ? [args.value, ...mediaTypes.map(m => m.value)] : [];
8
+ const types = args ? [args, ...mediaTypes] : [];
9
9
  context.program.stateMap(hasStreamKey).set(target, types.filter((t) => t.trim()));
10
10
  }
11
11
  export function hasStream(program, target) {