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

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 (208) hide show
  1. package/dist/src/components/acceptable-media-types-annotation.d.ts +3 -4
  2. package/dist/src/components/acceptable-media-types-annotation.d.ts.map +1 -1
  3. package/dist/src/components/acceptable-media-types-annotation.js +2 -6
  4. package/dist/src/components/acceptable-media-types-annotation.js.map +1 -1
  5. package/dist/src/components/alternate-keys-annotation.d.ts +4 -4
  6. package/dist/src/components/alternate-keys-annotation.d.ts.map +1 -1
  7. package/dist/src/components/alternate-keys-annotation.js +5 -13
  8. package/dist/src/components/alternate-keys-annotation.js.map +1 -1
  9. package/dist/src/components/common-elements.d.ts +0 -71
  10. package/dist/src/components/common-elements.d.ts.map +1 -1
  11. package/dist/src/components/common-elements.js +10 -24
  12. package/dist/src/components/common-elements.js.map +1 -1
  13. package/dist/src/components/computed-annotation.d.ts +3 -4
  14. package/dist/src/components/computed-annotation.d.ts.map +1 -1
  15. package/dist/src/components/computed-annotation.js +4 -10
  16. package/dist/src/components/computed-annotation.js.map +1 -1
  17. package/dist/src/components/count-restrictions-annotation.d.ts +3 -4
  18. package/dist/src/components/count-restrictions-annotation.d.ts.map +1 -1
  19. package/dist/src/components/count-restrictions-annotation.js +2 -6
  20. package/dist/src/components/count-restrictions-annotation.js.map +1 -1
  21. package/dist/src/components/description-annotation.d.ts +3 -4
  22. package/dist/src/components/description-annotation.d.ts.map +1 -1
  23. package/dist/src/components/description-annotation.js +4 -11
  24. package/dist/src/components/description-annotation.js.map +1 -1
  25. package/dist/src/components/entity-container-element.d.ts +6 -0
  26. package/dist/src/components/entity-container-element.d.ts.map +1 -0
  27. package/dist/src/components/entity-container-element.js +58 -0
  28. package/dist/src/components/entity-container-element.js.map +1 -0
  29. package/dist/src/components/enum-type-element.d.ts +6 -0
  30. package/dist/src/components/enum-type-element.d.ts.map +1 -0
  31. package/dist/src/components/enum-type-element.js +17 -0
  32. package/dist/src/components/enum-type-element.js.map +1 -0
  33. package/dist/src/components/expand-restrictions-annotation.d.ts +4 -5
  34. package/dist/src/components/expand-restrictions-annotation.d.ts.map +1 -1
  35. package/dist/src/components/expand-restrictions-annotation.js +5 -20
  36. package/dist/src/components/expand-restrictions-annotation.js.map +1 -1
  37. package/dist/src/components/index.d.ts +2 -14
  38. package/dist/src/components/index.d.ts.map +1 -1
  39. package/dist/src/components/index.js +9 -14
  40. package/dist/src/components/index.js.map +1 -1
  41. package/dist/src/components/operation-element.d.ts +6 -0
  42. package/dist/src/components/operation-element.d.ts.map +1 -0
  43. package/dist/src/components/operation-element.js +70 -0
  44. package/dist/src/components/operation-element.js.map +1 -0
  45. package/dist/src/components/permissions-annotation.d.ts +3 -4
  46. package/dist/src/components/permissions-annotation.d.ts.map +1 -1
  47. package/dist/src/components/permissions-annotation.js +2 -10
  48. package/dist/src/components/permissions-annotation.js.map +1 -1
  49. package/dist/src/components/property-element.d.ts +4 -4
  50. package/dist/src/components/property-element.d.ts.map +1 -1
  51. package/dist/src/components/property-element.js +14 -32
  52. package/dist/src/components/property-element.js.map +1 -1
  53. package/dist/src/components/revisions-annotation.d.ts +4 -5
  54. package/dist/src/components/revisions-annotation.d.ts.map +1 -1
  55. package/dist/src/components/revisions-annotation.js +7 -51
  56. package/dist/src/components/revisions-annotation.js.map +1 -1
  57. package/dist/src/components/schema-element.d.ts +6 -0
  58. package/dist/src/components/schema-element.d.ts.map +1 -0
  59. package/dist/src/components/schema-element.js +38 -0
  60. package/dist/src/components/schema-element.js.map +1 -0
  61. package/dist/src/components/search-restrictions-annotation.d.ts +3 -4
  62. package/dist/src/components/search-restrictions-annotation.d.ts.map +1 -1
  63. package/dist/src/components/search-restrictions-annotation.js +2 -6
  64. package/dist/src/components/search-restrictions-annotation.js.map +1 -1
  65. package/dist/src/components/skip-supported-annotation.d.ts +3 -4
  66. package/dist/src/components/skip-supported-annotation.d.ts.map +1 -1
  67. package/dist/src/components/skip-supported-annotation.js +2 -6
  68. package/dist/src/components/skip-supported-annotation.js.map +1 -1
  69. package/dist/src/components/sort-restrictions-annotation.d.ts +4 -5
  70. package/dist/src/components/sort-restrictions-annotation.d.ts.map +1 -1
  71. package/dist/src/components/sort-restrictions-annotation.js +5 -20
  72. package/dist/src/components/sort-restrictions-annotation.js.map +1 -1
  73. package/dist/src/components/structured-type-element.d.ts +10 -4
  74. package/dist/src/components/structured-type-element.d.ts.map +1 -1
  75. package/dist/src/components/structured-type-element.js +18 -58
  76. package/dist/src/components/structured-type-element.js.map +1 -1
  77. package/dist/src/components/top-supported-annotation.d.ts +3 -4
  78. package/dist/src/components/top-supported-annotation.d.ts.map +1 -1
  79. package/dist/src/components/top-supported-annotation.js +2 -6
  80. package/dist/src/components/top-supported-annotation.js.map +1 -1
  81. package/dist/src/decorators/abstract.d.ts.map +1 -1
  82. package/dist/src/decorators/abstract.js +0 -6
  83. package/dist/src/decorators/abstract.js.map +1 -1
  84. package/dist/src/decorators/complex.d.ts.map +1 -1
  85. package/dist/src/decorators/complex.js +0 -6
  86. package/dist/src/decorators/complex.js.map +1 -1
  87. package/dist/src/decorators/decorator-parameter.d.ts +4 -0
  88. package/dist/src/decorators/decorator-parameter.d.ts.map +1 -0
  89. package/dist/src/decorators/decorator-parameter.js +2 -0
  90. package/dist/src/decorators/decorator-parameter.js.map +1 -0
  91. package/dist/src/decorators/deprecated-definition.d.ts +4 -3
  92. package/dist/src/decorators/deprecated-definition.d.ts.map +1 -1
  93. package/dist/src/decorators/deprecated-definition.js +7 -1
  94. package/dist/src/decorators/deprecated-definition.js.map +1 -1
  95. package/dist/src/decorators/entity.d.ts.map +1 -1
  96. package/dist/src/decorators/entity.js +0 -6
  97. package/dist/src/decorators/entity.js.map +1 -1
  98. package/dist/src/decorators/expand.d.ts +2 -1
  99. package/dist/src/decorators/expand.d.ts.map +1 -1
  100. package/dist/src/decorators/expand.js +1 -1
  101. package/dist/src/decorators/expand.js.map +1 -1
  102. package/dist/src/decorators/function.d.ts +11 -0
  103. package/dist/src/decorators/function.d.ts.map +1 -0
  104. package/dist/src/decorators/function.js +16 -0
  105. package/dist/src/decorators/function.js.map +1 -0
  106. package/dist/src/decorators/handlers/custom/additional-query-parameters.d.ts +2 -1
  107. package/dist/src/decorators/handlers/custom/additional-query-parameters.d.ts.map +1 -1
  108. package/dist/src/decorators/handlers/custom/additional-query-parameters.js +3 -1
  109. package/dist/src/decorators/handlers/custom/additional-query-parameters.js.map +1 -1
  110. package/dist/src/decorators/handlers/custom/ags-attribute.d.ts +2 -1
  111. package/dist/src/decorators/handlers/custom/ags-attribute.d.ts.map +1 -1
  112. package/dist/src/decorators/handlers/custom/ags-attribute.js +3 -3
  113. package/dist/src/decorators/handlers/custom/ags-attribute.js.map +1 -1
  114. package/dist/src/decorators/handlers/index.d.ts +4 -3
  115. package/dist/src/decorators/handlers/index.d.ts.map +1 -1
  116. package/dist/src/decorators/handlers/index.js +4 -4
  117. package/dist/src/decorators/handlers/index.js.map +1 -1
  118. package/dist/src/decorators/has-stream.d.ts +3 -3
  119. package/dist/src/decorators/has-stream.d.ts.map +1 -1
  120. package/dist/src/decorators/has-stream.js +2 -15
  121. package/dist/src/decorators/has-stream.js.map +1 -1
  122. package/dist/src/decorators/index.d.ts +5 -1
  123. package/dist/src/decorators/index.d.ts.map +1 -1
  124. package/dist/src/decorators/index.js +5 -1
  125. package/dist/src/decorators/index.js.map +1 -1
  126. package/dist/src/decorators/open.d.ts.map +1 -1
  127. package/dist/src/decorators/open.js +0 -6
  128. package/dist/src/decorators/open.js.map +1 -1
  129. package/dist/src/decorators/{routed-interfaces.d.ts → operation-parameters.d.ts} +3 -11
  130. package/dist/src/decorators/operation-parameters.d.ts.map +1 -0
  131. package/dist/src/decorators/operation-parameters.js +15 -0
  132. package/dist/src/decorators/operation-parameters.js.map +1 -0
  133. package/dist/src/decorators/order-by.d.ts +2 -1
  134. package/dist/src/decorators/order-by.d.ts.map +1 -1
  135. package/dist/src/decorators/order-by.js +1 -1
  136. package/dist/src/decorators/order-by.js.map +1 -1
  137. package/dist/src/decorators/private-preview-definition.d.ts +4 -3
  138. package/dist/src/decorators/private-preview-definition.d.ts.map +1 -1
  139. package/dist/src/decorators/private-preview-definition.js +6 -1
  140. package/dist/src/decorators/private-preview-definition.js.map +1 -1
  141. package/dist/src/decorators/private-preview.d.ts +2 -1
  142. package/dist/src/decorators/private-preview.d.ts.map +1 -1
  143. package/dist/src/decorators/private-preview.js +1 -11
  144. package/dist/src/decorators/private-preview.js.map +1 -1
  145. package/dist/src/emitter.d.ts.map +1 -1
  146. package/dist/src/emitter.js +4 -2
  147. package/dist/src/emitter.js.map +1 -1
  148. package/dist/src/entities/entity-container.d.ts +35 -0
  149. package/dist/src/entities/entity-container.d.ts.map +1 -0
  150. package/dist/src/entities/entity-container.js +132 -0
  151. package/dist/src/entities/entity-container.js.map +1 -0
  152. package/dist/src/entities/enum.d.ts +16 -0
  153. package/dist/src/entities/enum.d.ts.map +1 -0
  154. package/dist/src/entities/enum.js +22 -0
  155. package/dist/src/entities/enum.js.map +1 -0
  156. package/dist/src/entities/model.d.ts +50 -0
  157. package/dist/src/entities/model.d.ts.map +1 -0
  158. package/dist/src/entities/model.js +119 -0
  159. package/dist/src/entities/model.js.map +1 -0
  160. package/dist/src/entities/namespace.d.ts +14 -0
  161. package/dist/src/entities/namespace.d.ts.map +1 -0
  162. package/dist/src/entities/namespace.js +41 -0
  163. package/dist/src/entities/namespace.js.map +1 -0
  164. package/dist/src/entities/operation.d.ts +28 -0
  165. package/dist/src/entities/operation.d.ts.map +1 -0
  166. package/dist/src/entities/operation.js +88 -0
  167. package/dist/src/entities/operation.js.map +1 -0
  168. package/dist/src/entities/property.d.ts +3 -0
  169. package/dist/src/entities/property.d.ts.map +1 -0
  170. package/dist/src/entities/property.js +54 -0
  171. package/dist/src/entities/property.js.map +1 -0
  172. package/dist/src/entities/revision-definition.d.ts +9 -0
  173. package/dist/src/entities/revision-definition.d.ts.map +1 -0
  174. package/dist/src/entities/revision-definition.js +42 -0
  175. package/dist/src/entities/revision-definition.js.map +1 -0
  176. package/dist/src/index.d.ts +0 -3
  177. package/dist/src/index.d.ts.map +1 -1
  178. package/dist/src/index.js +0 -3
  179. package/dist/src/index.js.map +1 -1
  180. package/dist/src/rules/entity.d.ts +1 -0
  181. package/dist/src/rules/entity.d.ts.map +1 -1
  182. package/dist/src/rules/entity.js +36 -0
  183. package/dist/src/rules/entity.js.map +1 -1
  184. package/dist/src/rules/enum.d.ts +2 -0
  185. package/dist/src/rules/enum.d.ts.map +1 -0
  186. package/dist/src/rules/enum.js +26 -0
  187. package/dist/src/rules/enum.js.map +1 -0
  188. package/dist/src/rules/function.d.ts +2 -0
  189. package/dist/src/rules/function.d.ts.map +1 -0
  190. package/dist/src/rules/function.js +26 -0
  191. package/dist/src/rules/function.js.map +1 -0
  192. package/dist/src/rules/index.d.ts +3 -4
  193. package/dist/src/rules/index.d.ts.map +1 -1
  194. package/dist/src/rules/index.js +40 -111
  195. package/dist/src/rules/index.js.map +1 -1
  196. package/lib/decorators.tsp +29 -22
  197. package/package.json +27 -14
  198. package/dist/src/components/program-context.d.ts +0 -4
  199. package/dist/src/components/program-context.d.ts.map +0 -1
  200. package/dist/src/components/program-context.js +0 -3
  201. package/dist/src/components/program-context.js.map +0 -1
  202. package/dist/src/csdl.d.ts +0 -8
  203. package/dist/src/csdl.d.ts.map +0 -1
  204. package/dist/src/csdl.js +0 -298
  205. package/dist/src/csdl.js.map +0 -1
  206. package/dist/src/decorators/routed-interfaces.d.ts.map +0 -1
  207. package/dist/src/decorators/routed-interfaces.js +0 -43
  208. package/dist/src/decorators/routed-interfaces.js.map +0 -1
package/dist/src/csdl.js DELETED
@@ -1,298 +0,0 @@
1
- import { isVoidType, } from "@typespec/compiler";
2
- import { getOperationVerb, getRoutePath, isPathParam } from "@typespec/http";
3
- import { getAction } from "@typespec/rest";
4
- import React, { useContext } from "react";
5
- import { ProgramContext } from "./components/program-context.js";
6
- import { buildAttributes } from "./decorators/handlers/index.js";
7
- import { getFunction, isOperationParameters } from "./decorators/index.js";
8
- import { ActionElement, AnnotationElement, CountRestrictionsAnnotation, DescriptionAnnotation, EntityContainerElement, EntitySetElement, EnumMemberElement, EnumTypeElement, ExpandRestrictionsAnnotation, FunctionElement, ItemList, ParameterElement, PropertyValueElement, RecordElement, ReturnTypeElement, RevisionsAnnotation, SchemaElement, SearchRestrictionsAnnotation, SingletonElement, SkipSupportedAnnotation, SortRestrictionsAnnotation, StructuredTypeElement, TopSupportedAnnotation, } from "./components/index.js";
9
- import CsdlRenderer from "./dom/renderer.js";
10
- import { extractTypesFromUnion, getNamespaceName, getPropertyTypeName, isExcludedCoreType, isTypeNullable, } from "./utils.js";
11
- function expandNamespaces(namespace) {
12
- return [namespace, ...[...namespace.namespaces.values()].flatMap(expandNamespaces)];
13
- }
14
- export function renderCsdl(program) {
15
- const schemas = React.createElement(TypeSpecProgramViewer, { program: program });
16
- const csdl = CsdlRenderer.getXmlText(schemas);
17
- return csdl;
18
- }
19
- function hasChildren(type) {
20
- switch (type.kind) {
21
- case "Namespace":
22
- return type.enums.size || type.models.size || type.interfaces.size || type.operations.size;
23
- default:
24
- return true;
25
- }
26
- }
27
- export const TypeSpecProgramViewer = ({ program, }) => {
28
- const root = program.checker.getGlobalNamespaceType();
29
- const namespaces = expandNamespaces(root)
30
- .filter((namespace) => !isExcludedCoreType(program, namespace) && hasChildren(namespace))
31
- .map((namespace) => ({ namespace, name: getNamespaceName(program, namespace) }));
32
- return (React.createElement(ProgramContext.Provider, { value: program }, namespaces.map((ns) => {
33
- return (React.createElement(SchemaElement, { Namespace: ns.name, key: ns.name },
34
- React.createElement(Elements, { namespace: ns.namespace })));
35
- })));
36
- };
37
- const Elements = ({ namespace }) => {
38
- return (React.createElement(React.Fragment, null,
39
- React.createElement(EnumTypeList, { enums: namespace.enums }),
40
- React.createElement(ModelList, { models: namespace.models }),
41
- React.createElement(OperationList, { namespace: namespace }),
42
- React.createElement(EntityContainerItem, { namespace: namespace })));
43
- };
44
- const EnumTypeList = (props) => (React.createElement(ItemList, { items: props.enums, render: (type) => {
45
- const program = useContext(ProgramContext);
46
- const agsAttributes = buildAttributes(program, type);
47
- return (React.createElement(EnumTypeElement, { Name: type.name, ...agsAttributes },
48
- React.createElement(EnumMemberList, { members: type.members }),
49
- React.createElement(RevisionsAnnotation, { item: type, namespace: type === null || type === void 0 ? void 0 : type.namespace })));
50
- } }));
51
- const EnumMemberList = (props) => (React.createElement(ItemList, { items: props.members, render: (member) => {
52
- var _a;
53
- const program = useContext(ProgramContext);
54
- const agsAttributes = buildAttributes(program, member);
55
- return (React.createElement(EnumMemberElement, { Name: member.name, Value: member.value, ...agsAttributes },
56
- React.createElement(RevisionsAnnotation, { item: member, namespace: (_a = member.enum) === null || _a === void 0 ? void 0 : _a.namespace })));
57
- } }));
58
- const ModelList = ({ models }) => {
59
- return React.createElement(ItemList, { items: models, render: (model) => React.createElement(StructuredTypeElement, { model: model }) });
60
- };
61
- const OperationList = (props) => {
62
- const operations = [...props.namespace.interfaces]
63
- .filter(([_, $interface]) => $interface.operations.has("_isOperation"))
64
- .flatMap(([_, $interface]) => [...$interface.operations])
65
- .map(([_, operation]) => operation);
66
- return (React.createElement(ItemList, { items: operations, render: (operation) => {
67
- var _a, _b;
68
- const program = useContext(ProgramContext);
69
- const actionName = getAction(program, operation);
70
- const functionName = getFunction(program, operation);
71
- const agsAttributes = buildAttributes(program, operation);
72
- const bindingType = (_b = (_a = operation.interface) === null || _a === void 0 ? void 0 : _a.operations.get("_isOperation")) === null || _b === void 0 ? void 0 : _b.returnType;
73
- if (!bindingType) {
74
- return React.createElement(React.Fragment, null);
75
- }
76
- const bindingTypeName = getPropertyTypeName(program, bindingType);
77
- if (!bindingTypeName) {
78
- return React.createElement(React.Fragment, null);
79
- }
80
- if (actionName) {
81
- return (React.createElement(ActionElement, { Name: actionName, IsBound: "true", ...agsAttributes },
82
- React.createElement(ParameterElement, { Name: "binding", Type: bindingTypeName }),
83
- React.createElement(ParameterList, { parameters: operation.parameters.properties }),
84
- React.createElement(ReturnTypeItem, { type: operation.returnType }),
85
- React.createElement(DescriptionAnnotation, { type: operation })));
86
- }
87
- if (functionName) {
88
- let parameterProperties = [];
89
- const parameterProperty = operation.parameters.properties.get("parameters");
90
- if (parameterProperty && parameterProperty.type.kind === "Union") {
91
- parameterProperties = extractTypesFromUnion(parameterProperty.type).filter((type) => type.kind === "Model");
92
- }
93
- if (!parameterProperties.length) {
94
- return (React.createElement(FunctionElement, { Name: functionName, IsBound: "true", ...agsAttributes },
95
- React.createElement(ParameterElement, { Name: "binding", Type: bindingTypeName }),
96
- React.createElement(ParameterList, { parameters: operation.parameters.properties }),
97
- React.createElement(ReturnTypeItem, { type: operation.returnType }),
98
- React.createElement(DescriptionAnnotation, { type: operation })));
99
- }
100
- return (React.createElement(React.Fragment, null, parameterProperties.map((property, key) => (React.createElement(FunctionElement, { Name: functionName, IsBound: "true", ...agsAttributes, key: key },
101
- React.createElement(ParameterElement, { Name: "binding", Type: bindingTypeName }),
102
- React.createElement(ParameterList, { parameters: property.properties }),
103
- React.createElement(ReturnTypeItem, { type: operation.returnType }),
104
- React.createElement(DescriptionAnnotation, { type: operation }))))));
105
- }
106
- return React.createElement(React.Fragment, null);
107
- } }));
108
- };
109
- const ParameterList = (props) => {
110
- return (React.createElement(ItemList, { items: props.parameters, render: (property) => {
111
- const program = useContext(ProgramContext);
112
- if (isPathParam(program, property)) {
113
- return React.createElement(React.Fragment, null);
114
- }
115
- if (property.type.kind === "Model" && isOperationParameters(program, property.type)) {
116
- return React.createElement(ParameterList, { parameters: property.type.properties });
117
- }
118
- const isNullable = isTypeNullable(program, property.type);
119
- const propType = getPropertyTypeName(program, property.type);
120
- return (React.createElement(ParameterElement, { Name: property.name, Type: propType, ...(isNullable ? {} : { Nullable: "false" }) },
121
- React.createElement(OptionalParameterAnnotation, { property: property }),
122
- React.createElement(DescriptionAnnotation, { type: property })));
123
- } }));
124
- };
125
- const OptionalParameterAnnotation = ({ property, }) => {
126
- var _a;
127
- if (!property.optional) {
128
- return React.createElement(React.Fragment, null);
129
- }
130
- let defaultValueValue = undefined;
131
- switch ((_a = property.default) === null || _a === void 0 ? void 0 : _a.kind) {
132
- case "String":
133
- case "Boolean":
134
- case "Number":
135
- defaultValueValue = property.default.value;
136
- break;
137
- default:
138
- return React.createElement(AnnotationElement, { Term: "Org.OData.Core.V1.OptionalParameter" });
139
- }
140
- const program = useContext(ProgramContext);
141
- const propType = getPropertyTypeName(program, property.type);
142
- let defaultValueKey = "String";
143
- switch (propType) {
144
- case "Edm.String":
145
- defaultValueKey = "String";
146
- break;
147
- case "Collection(Edm.Byte)":
148
- defaultValueKey = "Binary";
149
- break;
150
- case "Edm.Byte":
151
- case "Edm.Int16":
152
- case "Edm.Int32":
153
- case "Edm.Int64":
154
- defaultValueKey = "Int";
155
- break;
156
- case "Edm.Single":
157
- case "Edm.Double":
158
- defaultValueKey = "Single";
159
- break;
160
- case "Edm.Date":
161
- defaultValueKey = "Date";
162
- break;
163
- case "Edm.DateTimeOffset":
164
- defaultValueKey = "DateTimeOffset";
165
- break;
166
- case "Edm.Boolean":
167
- defaultValueKey = "Boolean";
168
- break;
169
- case "Edm.Stream":
170
- defaultValueKey = "Binary";
171
- break;
172
- case "Edm.Duration":
173
- case "Edm.TimeOfDay":
174
- default:
175
- return React.createElement(AnnotationElement, { Term: "Org.OData.Core.V1.OptionalParameter" });
176
- }
177
- return (React.createElement(AnnotationElement, { Term: "Org.OData.Core.V1.OptionalParameter" },
178
- React.createElement(RecordElement, null,
179
- React.createElement(PropertyValueElement, { Property: "DefaultValue", ...{ [defaultValueKey]: defaultValueValue } }))));
180
- };
181
- const ReturnTypeItem = ({ type }) => {
182
- if (isVoidType(type)) {
183
- return React.createElement(React.Fragment, null);
184
- }
185
- const program = useContext(ProgramContext);
186
- const returnType = type.kind === "Model" && !!type.templateMapper && !!type.templateMapper.args.length
187
- ? type.templateMapper.args[0]
188
- : type;
189
- if (!returnType || isVoidType(returnType)) {
190
- return React.createElement(React.Fragment, null);
191
- }
192
- const isNullable = isTypeNullable(program, returnType);
193
- return (React.createElement(ReturnTypeElement, { Type: getPropertyTypeName(program, returnType), ...(isNullable ? {} : { Nullable: "false" }) }));
194
- };
195
- const EntityContainerItem = ({ namespace }) => {
196
- const program = useContext(ProgramContext);
197
- const navigationSources = [...namespace.interfaces]
198
- .filter(([_, $interface]) => $interface.operations.has("_isNavigationSource"))
199
- .map(([_, $interface]) => [
200
- $interface.operations.get("_isNavigationSource").returnType,
201
- $interface,
202
- ]);
203
- const singletons = navigationSources
204
- .filter(([returnType, _]) => returnType.kind === "Model" && returnType.name !== "Array")
205
- .map(([_, $interface]) => $interface);
206
- const entitySets = navigationSources
207
- .filter(([returnType, _]) => returnType.kind === "Model" && returnType.name === "Array")
208
- .reduce((map, [_, item]) => {
209
- var _a;
210
- const key = (_a = getRoutePath(program, item)) === null || _a === void 0 ? void 0 : _a.path.split("/")[0];
211
- if (!key) {
212
- return map;
213
- }
214
- const items = [...(map.get(key) || []), ...item.operations.values()];
215
- map.set(key, items);
216
- return map;
217
- }, new Map());
218
- if (!singletons.length && !entitySets.size) {
219
- return React.createElement(React.Fragment, null);
220
- }
221
- const agsAttributes = buildAttributes(program, namespace);
222
- return (React.createElement(EntityContainerElement, { Name: "container", ...agsAttributes },
223
- React.createElement(SingletonList, { sources: singletons }),
224
- React.createElement(EntitySetList, { sources: entitySets })));
225
- };
226
- const SingletonList = (props) => {
227
- return (React.createElement(ItemList, { items: props.sources, render: (source) => {
228
- const program = useContext(ProgramContext);
229
- const routePath = getRoutePath(program, source);
230
- if (!routePath) {
231
- return React.createElement(React.Fragment, null);
232
- }
233
- const type = source.operations.get("_isNavigationSource").returnType;
234
- const singletonTypeName = getPropertyTypeName(program, type);
235
- if (!singletonTypeName) {
236
- return React.createElement(React.Fragment, null);
237
- }
238
- const singletonName = routePath.path.split("/")[0];
239
- const agsAttributes = buildAttributes(program, source);
240
- return (React.createElement(SingletonElement, { Name: singletonName, Type: singletonTypeName, ...agsAttributes },
241
- React.createElement(ExpandRestrictionsAnnotation, { interface: source, model: type }),
242
- React.createElement(DescriptionAnnotation, { type: source })));
243
- } }));
244
- };
245
- const EntitySetList = (props) => {
246
- return (React.createElement(ItemList, { items: props.sources, render: (operations) => {
247
- const program = useContext(ProgramContext);
248
- const entitySet = operations[0].interface;
249
- const routePath = getRoutePath(program, entitySet);
250
- if (!routePath) {
251
- return React.createElement(React.Fragment, null);
252
- }
253
- let agsAttributes = operations.reduce((attr, item) => ({ ...attr, ...buildAttributes(program, item) }), {});
254
- agsAttributes = { ...agsAttributes, ...buildAttributes(program, entitySet) };
255
- const returnType = entitySet.operations.get("_isNavigationSource").returnType;
256
- const type = returnType.indexer.value;
257
- const entitySetTypeName = getPropertyTypeName(program, type);
258
- if (!entitySetTypeName) {
259
- return React.createElement(React.Fragment, null);
260
- }
261
- const entitySetName = routePath.path.split("/")[0];
262
- const operationMethods = operations.map((operation) => ({
263
- operation,
264
- verb: getOperationVerb(program, operation),
265
- hasEmptyParameters: operation.parameters.properties.size === 0,
266
- }));
267
- const hasGetOnCollection = operationMethods.some(({ verb, hasEmptyParameters }) => hasEmptyParameters && verb === "get");
268
- const hasGetOnItem = operationMethods.some(({ verb, hasEmptyParameters }) => !hasEmptyParameters && verb === "get");
269
- const hasPostOnCollection = operationMethods.some(({ verb }) => verb === "post");
270
- const hasPatchOnItem = operationMethods.some(({ verb }) => verb === "patch");
271
- const hasDeleteOnItem = operationMethods.some(({ verb }) => verb === "delete");
272
- return (React.createElement(EntitySetElement, { Name: entitySetName, EntityType: entitySetTypeName, ...agsAttributes },
273
- React.createElement(AnnotationElement, { Term: "Org.OData.Capabilities.V1.ReadRestrictions" },
274
- React.createElement(RecordElement, null,
275
- React.createElement(PropertyValueElement, { Property: "Readable", Bool: hasGetOnCollection.toString() }),
276
- React.createElement(PropertyValueElement, { Property: "ReadByKeyRestrictions" },
277
- React.createElement(RecordElement, null,
278
- React.createElement(PropertyValueElement, { Property: "Readable", Bool: hasGetOnItem.toString() }))))),
279
- React.createElement(AnnotationElement, { Term: "Org.OData.Capabilities.V1.InsertRestrictions" },
280
- React.createElement(RecordElement, null,
281
- React.createElement(PropertyValueElement, { Property: "Insertable", Bool: hasPostOnCollection.toString() }))),
282
- React.createElement(AnnotationElement, { Term: "Org.OData.Capabilities.V1.UpdateRestrictions" },
283
- React.createElement(RecordElement, null,
284
- React.createElement(PropertyValueElement, { Property: "Updatable", Bool: hasPatchOnItem.toString() }),
285
- React.createElement(PropertyValueElement, { Property: "UpdateMethod", EnumMember: "Org.OData.Capabilities.V1.HttpMethod/PATCH" }))),
286
- React.createElement(AnnotationElement, { Term: "Org.OData.Capabilities.V1.DeleteRestrictions" },
287
- React.createElement(RecordElement, null,
288
- React.createElement(PropertyValueElement, { Property: "Deletable", Bool: hasDeleteOnItem.toString() }))),
289
- React.createElement(CountRestrictionsAnnotation, { interface: entitySet }),
290
- React.createElement(ExpandRestrictionsAnnotation, { interface: entitySet, model: type }),
291
- React.createElement(SearchRestrictionsAnnotation, { interface: entitySet }),
292
- React.createElement(SkipSupportedAnnotation, { interface: entitySet }),
293
- React.createElement(SortRestrictionsAnnotation, { interface: entitySet, model: type }),
294
- React.createElement(TopSupportedAnnotation, { interface: entitySet }),
295
- React.createElement(DescriptionAnnotation, { type: entitySet })));
296
- } }));
297
- };
298
- //# sourceMappingURL=csdl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"csdl.js","sourceRoot":"","sources":["../../src/csdl.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,UAAU,GAOX,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,KAAK,EAAE,EAAqB,UAAU,EAAE,MAAM,OAAO,CAAC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,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,IAAI,QAO1E;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,WAEnE"}
@@ -1,43 +0,0 @@
1
- import { createDecoratorDefinition, validateDecoratorTarget, } from "@typespec/compiler";
2
- const functionKey = Symbol("function");
3
- const functionDecorator = createDecoratorDefinition({
4
- name: "@function",
5
- target: "Operation",
6
- args: [{ kind: "String", optional: true }],
7
- });
8
- /**
9
- * `@function` - mark an operation as a function
10
- *
11
- * `@function` can only be applied to operations.
12
- */
13
- export function $function(context, target, name) {
14
- if (!functionDecorator.validate(context, target, [name])) {
15
- return;
16
- }
17
- context.program.stateMap(functionKey).set(target, name || target.name);
18
- }
19
- export function isFunction(program, target) {
20
- return program.stateMap(functionKey).has(target);
21
- }
22
- export function getFunction(program, target) {
23
- return program.stateMap(functionKey).get(target);
24
- }
25
- const operationParametersKey = Symbol("operationParameters");
26
- /**
27
- * `@operationParameters` - A model with this decorator will not be generated in the CSDL
28
- * and can't be reused by other models through inheritance,
29
- * or any other way except through being a parameter for an action operation.
30
- * The purpose of this model is only to define model parameters that would be too verbose.
31
- * This decorator will be the equivalent of inlining the properties of the model into parameters of the operation.
32
- */
33
- export function $operationParameters(context, model) {
34
- if (!validateDecoratorTarget(context, model, "@operationParameters", "Model")) {
35
- return;
36
- }
37
- // Register the operationParameters property
38
- context.program.stateSet(operationParametersKey).add(model);
39
- }
40
- export function isOperationParameters(program, model) {
41
- return program.stateSet(operationParametersKey).has(model);
42
- }
43
- //# sourceMappingURL=routed-interfaces.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"routed-interfaces.js","sourceRoot":"","sources":["../../../src/decorators/routed-interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EAMzB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AACvC,MAAM,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