@typespec/http-client-csharp 0.1.9-alpha.20240715.3

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 (275) hide show
  1. package/dist/emitter/constants.d.ts +7 -0
  2. package/dist/emitter/constants.d.ts.map +1 -0
  3. package/dist/emitter/constants.js +9 -0
  4. package/dist/emitter/constants.js.map +1 -0
  5. package/dist/emitter/emitter.d.ts +4 -0
  6. package/dist/emitter/emitter.d.ts.map +1 -0
  7. package/dist/emitter/emitter.js +174 -0
  8. package/dist/emitter/emitter.js.map +1 -0
  9. package/dist/emitter/index.d.ts +7 -0
  10. package/dist/emitter/index.d.ts.map +1 -0
  11. package/dist/emitter/index.js +9 -0
  12. package/dist/emitter/index.js.map +1 -0
  13. package/dist/emitter/lib/client-model-builder.d.ts +7 -0
  14. package/dist/emitter/lib/client-model-builder.d.ts.map +1 -0
  15. package/dist/emitter/lib/client-model-builder.js +236 -0
  16. package/dist/emitter/lib/client-model-builder.js.map +1 -0
  17. package/dist/emitter/lib/converter.d.ts +7 -0
  18. package/dist/emitter/lib/converter.d.ts.map +1 -0
  19. package/dist/emitter/lib/converter.js +261 -0
  20. package/dist/emitter/lib/converter.js.map +1 -0
  21. package/dist/emitter/lib/decorators.d.ts +10 -0
  22. package/dist/emitter/lib/decorators.d.ts.map +1 -0
  23. package/dist/emitter/lib/decorators.js +17 -0
  24. package/dist/emitter/lib/decorators.js.map +1 -0
  25. package/dist/emitter/lib/lib.d.ts +66 -0
  26. package/dist/emitter/lib/lib.d.ts.map +1 -0
  27. package/dist/emitter/lib/lib.js +45 -0
  28. package/dist/emitter/lib/lib.js.map +1 -0
  29. package/dist/emitter/lib/log-level.d.ts +6 -0
  30. package/dist/emitter/lib/log-level.d.ts.map +1 -0
  31. package/dist/emitter/lib/log-level.js +7 -0
  32. package/dist/emitter/lib/log-level.js.map +1 -0
  33. package/dist/emitter/lib/logger.d.ts +18 -0
  34. package/dist/emitter/lib/logger.d.ts.map +1 -0
  35. package/dist/emitter/lib/logger.js +70 -0
  36. package/dist/emitter/lib/logger.js.map +1 -0
  37. package/dist/emitter/lib/model.d.ts +20 -0
  38. package/dist/emitter/lib/model.d.ts.map +1 -0
  39. package/dist/emitter/lib/model.js +255 -0
  40. package/dist/emitter/lib/model.js.map +1 -0
  41. package/dist/emitter/lib/operation.d.ts +9 -0
  42. package/dist/emitter/lib/operation.d.ts.map +1 -0
  43. package/dist/emitter/lib/operation.js +295 -0
  44. package/dist/emitter/lib/operation.js.map +1 -0
  45. package/dist/emitter/lib/service-authentication.d.ts +4 -0
  46. package/dist/emitter/lib/service-authentication.d.ts.map +1 -0
  47. package/dist/emitter/lib/service-authentication.js +53 -0
  48. package/dist/emitter/lib/service-authentication.js.map +1 -0
  49. package/dist/emitter/lib/typespec-server.d.ts +12 -0
  50. package/dist/emitter/lib/typespec-server.d.ts.map +1 -0
  51. package/dist/emitter/lib/typespec-server.js +83 -0
  52. package/dist/emitter/lib/typespec-server.js.map +1 -0
  53. package/dist/emitter/lib/utils.d.ts +8 -0
  54. package/dist/emitter/lib/utils.d.ts.map +1 -0
  55. package/dist/emitter/lib/utils.js +53 -0
  56. package/dist/emitter/lib/utils.js.map +1 -0
  57. package/dist/emitter/options.d.ts +93 -0
  58. package/dist/emitter/options.d.ts.map +1 -0
  59. package/dist/emitter/options.js +114 -0
  60. package/dist/emitter/options.js.map +1 -0
  61. package/dist/emitter/tsdoc-metadata.json +11 -0
  62. package/dist/emitter/type/body-media-type.d.ts +12 -0
  63. package/dist/emitter/type/body-media-type.d.ts.map +1 -0
  64. package/dist/emitter/type/body-media-type.js +26 -0
  65. package/dist/emitter/type/body-media-type.js.map +1 -0
  66. package/dist/emitter/type/client-kind.d.ts +5 -0
  67. package/dist/emitter/type/client-kind.d.ts.map +1 -0
  68. package/dist/emitter/type/client-kind.js +8 -0
  69. package/dist/emitter/type/client-kind.js.map +1 -0
  70. package/dist/emitter/type/code-model.d.ts +12 -0
  71. package/dist/emitter/type/code-model.d.ts.map +1 -0
  72. package/dist/emitter/type/code-model.js +4 -0
  73. package/dist/emitter/type/code-model.js.map +1 -0
  74. package/dist/emitter/type/collection-format.d.ts +13 -0
  75. package/dist/emitter/type/collection-format.d.ts.map +1 -0
  76. package/dist/emitter/type/collection-format.js +22 -0
  77. package/dist/emitter/type/collection-format.js.map +1 -0
  78. package/dist/emitter/type/configuration.d.ts +21 -0
  79. package/dist/emitter/type/configuration.d.ts.map +1 -0
  80. package/dist/emitter/type/configuration.js +4 -0
  81. package/dist/emitter/type/configuration.js.map +1 -0
  82. package/dist/emitter/type/external-docs.d.ts +5 -0
  83. package/dist/emitter/type/external-docs.d.ts.map +1 -0
  84. package/dist/emitter/type/external-docs.js +4 -0
  85. package/dist/emitter/type/external-docs.js.map +1 -0
  86. package/dist/emitter/type/http-response-header.d.ts +8 -0
  87. package/dist/emitter/type/http-response-header.d.ts.map +1 -0
  88. package/dist/emitter/type/http-response-header.js +4 -0
  89. package/dist/emitter/type/http-response-header.js.map +1 -0
  90. package/dist/emitter/type/input-api-key-auth.d.ts +5 -0
  91. package/dist/emitter/type/input-api-key-auth.d.ts.map +1 -0
  92. package/dist/emitter/type/input-api-key-auth.js +4 -0
  93. package/dist/emitter/type/input-api-key-auth.js.map +1 -0
  94. package/dist/emitter/type/input-auth.d.ts +7 -0
  95. package/dist/emitter/type/input-auth.d.ts.map +1 -0
  96. package/dist/emitter/type/input-auth.js +4 -0
  97. package/dist/emitter/type/input-auth.js.map +1 -0
  98. package/dist/emitter/type/input-client.d.ts +12 -0
  99. package/dist/emitter/type/input-client.d.ts.map +1 -0
  100. package/dist/emitter/type/input-client.js +4 -0
  101. package/dist/emitter/type/input-client.js.map +1 -0
  102. package/dist/emitter/type/input-constant.d.ts +6 -0
  103. package/dist/emitter/type/input-constant.d.ts.map +1 -0
  104. package/dist/emitter/type/input-constant.js +4 -0
  105. package/dist/emitter/type/input-constant.js.map +1 -0
  106. package/dist/emitter/type/input-enum-type-value.d.ts +6 -0
  107. package/dist/emitter/type/input-enum-type-value.d.ts.map +1 -0
  108. package/dist/emitter/type/input-enum-type-value.js +4 -0
  109. package/dist/emitter/type/input-enum-type-value.js.map +1 -0
  110. package/dist/emitter/type/input-model-property.d.ts +12 -0
  111. package/dist/emitter/type/input-model-property.d.ts.map +1 -0
  112. package/dist/emitter/type/input-model-property.js +4 -0
  113. package/dist/emitter/type/input-model-property.js.map +1 -0
  114. package/dist/emitter/type/input-oauth2-auth.d.ts +4 -0
  115. package/dist/emitter/type/input-oauth2-auth.d.ts.map +1 -0
  116. package/dist/emitter/type/input-oauth2-auth.js +4 -0
  117. package/dist/emitter/type/input-oauth2-auth.js.map +1 -0
  118. package/dist/emitter/type/input-operation-parameter-kind.d.ts +9 -0
  119. package/dist/emitter/type/input-operation-parameter-kind.d.ts.map +1 -0
  120. package/dist/emitter/type/input-operation-parameter-kind.js +12 -0
  121. package/dist/emitter/type/input-operation-parameter-kind.js.map +1 -0
  122. package/dist/emitter/type/input-operation.d.ts +33 -0
  123. package/dist/emitter/type/input-operation.d.ts.map +1 -0
  124. package/dist/emitter/type/input-operation.js +4 -0
  125. package/dist/emitter/type/input-operation.js.map +1 -0
  126. package/dist/emitter/type/input-parameter.d.ts +27 -0
  127. package/dist/emitter/type/input-parameter.d.ts.map +1 -0
  128. package/dist/emitter/type/input-parameter.js +4 -0
  129. package/dist/emitter/type/input-parameter.js.map +1 -0
  130. package/dist/emitter/type/input-type-serialization-format.d.ts +15 -0
  131. package/dist/emitter/type/input-type-serialization-format.d.ts.map +1 -0
  132. package/dist/emitter/type/input-type-serialization-format.js +18 -0
  133. package/dist/emitter/type/input-type-serialization-format.js.map +1 -0
  134. package/dist/emitter/type/input-type-value.d.ts +6 -0
  135. package/dist/emitter/type/input-type-value.d.ts.map +1 -0
  136. package/dist/emitter/type/input-type-value.js +4 -0
  137. package/dist/emitter/type/input-type-value.js.map +1 -0
  138. package/dist/emitter/type/input-type.d.ts +87 -0
  139. package/dist/emitter/type/input-type.d.ts.map +1 -0
  140. package/dist/emitter/type/input-type.js +21 -0
  141. package/dist/emitter/type/input-type.js.map +1 -0
  142. package/dist/emitter/type/literal-type-context.d.ts +5 -0
  143. package/dist/emitter/type/literal-type-context.d.ts.map +1 -0
  144. package/dist/emitter/type/literal-type-context.js +4 -0
  145. package/dist/emitter/type/literal-type-context.js.map +1 -0
  146. package/dist/emitter/type/operation-final-state-via.d.ts +12 -0
  147. package/dist/emitter/type/operation-final-state-via.d.ts.map +1 -0
  148. package/dist/emitter/type/operation-final-state-via.js +36 -0
  149. package/dist/emitter/type/operation-final-state-via.js.map +1 -0
  150. package/dist/emitter/type/operation-long-running.d.ts +8 -0
  151. package/dist/emitter/type/operation-long-running.d.ts.map +1 -0
  152. package/dist/emitter/type/operation-long-running.js +4 -0
  153. package/dist/emitter/type/operation-long-running.js.map +1 -0
  154. package/dist/emitter/type/operation-paging.d.ts +8 -0
  155. package/dist/emitter/type/operation-paging.d.ts.map +1 -0
  156. package/dist/emitter/type/operation-paging.js +4 -0
  157. package/dist/emitter/type/operation-paging.js.map +1 -0
  158. package/dist/emitter/type/operation-response.d.ts +12 -0
  159. package/dist/emitter/type/operation-response.d.ts.map +1 -0
  160. package/dist/emitter/type/operation-response.js +4 -0
  161. package/dist/emitter/type/operation-response.js.map +1 -0
  162. package/dist/emitter/type/protocols.d.ts +3 -0
  163. package/dist/emitter/type/protocols.d.ts.map +1 -0
  164. package/dist/emitter/type/protocols.js +4 -0
  165. package/dist/emitter/type/protocols.js.map +1 -0
  166. package/dist/emitter/type/request-location.d.ts +12 -0
  167. package/dist/emitter/type/request-location.d.ts.map +1 -0
  168. package/dist/emitter/type/request-location.js +19 -0
  169. package/dist/emitter/type/request-location.js.map +1 -0
  170. package/dist/emitter/type/request-method.d.ts +13 -0
  171. package/dist/emitter/type/request-method.d.ts.map +1 -0
  172. package/dist/emitter/type/request-method.js +40 -0
  173. package/dist/emitter/type/request-method.js.map +1 -0
  174. package/dist/emitter/type/usage.d.ts +8 -0
  175. package/dist/emitter/type/usage.d.ts.map +1 -0
  176. package/dist/emitter/type/usage.js +11 -0
  177. package/dist/emitter/type/usage.js.map +1 -0
  178. package/dist/emitter/type/validation-type.d.ts +6 -0
  179. package/dist/emitter/type/validation-type.d.ts.map +1 -0
  180. package/dist/emitter/type/validation-type.js +9 -0
  181. package/dist/emitter/type/validation-type.js.map +1 -0
  182. package/dist/generator/CommandLine.dll +0 -0
  183. package/dist/generator/Humanizer.dll +0 -0
  184. package/dist/generator/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
  185. package/dist/generator/Microsoft.Build.Framework.dll +0 -0
  186. package/dist/generator/Microsoft.Build.dll +0 -0
  187. package/dist/generator/Microsoft.CodeAnalysis.CSharp.Workspaces.dll +0 -0
  188. package/dist/generator/Microsoft.CodeAnalysis.CSharp.dll +0 -0
  189. package/dist/generator/Microsoft.CodeAnalysis.Workspaces.dll +0 -0
  190. package/dist/generator/Microsoft.CodeAnalysis.dll +0 -0
  191. package/dist/generator/Microsoft.Generator.CSharp +0 -0
  192. package/dist/generator/Microsoft.Generator.CSharp.ClientModel.deps.json +818 -0
  193. package/dist/generator/Microsoft.Generator.CSharp.ClientModel.dll +0 -0
  194. package/dist/generator/Microsoft.Generator.CSharp.ClientModel.pdb +0 -0
  195. package/dist/generator/Microsoft.Generator.CSharp.Customization.dll +0 -0
  196. package/dist/generator/Microsoft.Generator.CSharp.Customization.pdb +0 -0
  197. package/dist/generator/Microsoft.Generator.CSharp.Input.dll +0 -0
  198. package/dist/generator/Microsoft.Generator.CSharp.Input.pdb +0 -0
  199. package/dist/generator/Microsoft.Generator.CSharp.deps.json +785 -0
  200. package/dist/generator/Microsoft.Generator.CSharp.dll +0 -0
  201. package/dist/generator/Microsoft.Generator.CSharp.pdb +0 -0
  202. package/dist/generator/Microsoft.Generator.CSharp.runtimeconfig.json +12 -0
  203. package/dist/generator/Microsoft.NET.StringTools.dll +0 -0
  204. package/dist/generator/NuGet.Common.dll +0 -0
  205. package/dist/generator/NuGet.Configuration.dll +0 -0
  206. package/dist/generator/NuGet.Frameworks.dll +0 -0
  207. package/dist/generator/System.ClientModel.dll +0 -0
  208. package/dist/generator/System.ComponentModel.Composition.dll +0 -0
  209. package/dist/generator/System.Composition.AttributedModel.dll +0 -0
  210. package/dist/generator/System.Composition.Convention.dll +0 -0
  211. package/dist/generator/System.Composition.Hosting.dll +0 -0
  212. package/dist/generator/System.Composition.Runtime.dll +0 -0
  213. package/dist/generator/System.Composition.TypedParts.dll +0 -0
  214. package/dist/generator/System.Configuration.ConfigurationManager.dll +0 -0
  215. package/dist/generator/System.Diagnostics.EventLog.dll +0 -0
  216. package/dist/generator/System.IO.Pipelines.dll +0 -0
  217. package/dist/generator/System.Memory.Data.dll +0 -0
  218. package/dist/generator/System.Reflection.MetadataLoadContext.dll +0 -0
  219. package/dist/generator/System.Security.Cryptography.ProtectedData.dll +0 -0
  220. package/dist/generator/cs/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll +0 -0
  221. package/dist/generator/cs/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  222. package/dist/generator/cs/Microsoft.CodeAnalysis.Workspaces.resources.dll +0 -0
  223. package/dist/generator/cs/Microsoft.CodeAnalysis.resources.dll +0 -0
  224. package/dist/generator/de/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll +0 -0
  225. package/dist/generator/de/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  226. package/dist/generator/de/Microsoft.CodeAnalysis.Workspaces.resources.dll +0 -0
  227. package/dist/generator/de/Microsoft.CodeAnalysis.resources.dll +0 -0
  228. package/dist/generator/es/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll +0 -0
  229. package/dist/generator/es/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  230. package/dist/generator/es/Microsoft.CodeAnalysis.Workspaces.resources.dll +0 -0
  231. package/dist/generator/es/Microsoft.CodeAnalysis.resources.dll +0 -0
  232. package/dist/generator/fr/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll +0 -0
  233. package/dist/generator/fr/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  234. package/dist/generator/fr/Microsoft.CodeAnalysis.Workspaces.resources.dll +0 -0
  235. package/dist/generator/fr/Microsoft.CodeAnalysis.resources.dll +0 -0
  236. package/dist/generator/it/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll +0 -0
  237. package/dist/generator/it/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  238. package/dist/generator/it/Microsoft.CodeAnalysis.Workspaces.resources.dll +0 -0
  239. package/dist/generator/it/Microsoft.CodeAnalysis.resources.dll +0 -0
  240. package/dist/generator/ja/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll +0 -0
  241. package/dist/generator/ja/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  242. package/dist/generator/ja/Microsoft.CodeAnalysis.Workspaces.resources.dll +0 -0
  243. package/dist/generator/ja/Microsoft.CodeAnalysis.resources.dll +0 -0
  244. package/dist/generator/ko/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll +0 -0
  245. package/dist/generator/ko/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  246. package/dist/generator/ko/Microsoft.CodeAnalysis.Workspaces.resources.dll +0 -0
  247. package/dist/generator/ko/Microsoft.CodeAnalysis.resources.dll +0 -0
  248. package/dist/generator/pl/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll +0 -0
  249. package/dist/generator/pl/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  250. package/dist/generator/pl/Microsoft.CodeAnalysis.Workspaces.resources.dll +0 -0
  251. package/dist/generator/pl/Microsoft.CodeAnalysis.resources.dll +0 -0
  252. package/dist/generator/pt-BR/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll +0 -0
  253. package/dist/generator/pt-BR/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  254. package/dist/generator/pt-BR/Microsoft.CodeAnalysis.Workspaces.resources.dll +0 -0
  255. package/dist/generator/pt-BR/Microsoft.CodeAnalysis.resources.dll +0 -0
  256. package/dist/generator/ru/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll +0 -0
  257. package/dist/generator/ru/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  258. package/dist/generator/ru/Microsoft.CodeAnalysis.Workspaces.resources.dll +0 -0
  259. package/dist/generator/ru/Microsoft.CodeAnalysis.resources.dll +0 -0
  260. package/dist/generator/runtimes/win/lib/net8.0/System.Diagnostics.EventLog.Messages.dll +0 -0
  261. package/dist/generator/runtimes/win/lib/net8.0/System.Diagnostics.EventLog.dll +0 -0
  262. package/dist/generator/tr/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll +0 -0
  263. package/dist/generator/tr/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  264. package/dist/generator/tr/Microsoft.CodeAnalysis.Workspaces.resources.dll +0 -0
  265. package/dist/generator/tr/Microsoft.CodeAnalysis.resources.dll +0 -0
  266. package/dist/generator/zh-Hans/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll +0 -0
  267. package/dist/generator/zh-Hans/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  268. package/dist/generator/zh-Hans/Microsoft.CodeAnalysis.Workspaces.resources.dll +0 -0
  269. package/dist/generator/zh-Hans/Microsoft.CodeAnalysis.resources.dll +0 -0
  270. package/dist/generator/zh-Hant/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll +0 -0
  271. package/dist/generator/zh-Hant/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  272. package/dist/generator/zh-Hant/Microsoft.CodeAnalysis.Workspaces.resources.dll +0 -0
  273. package/dist/generator/zh-Hant/Microsoft.CodeAnalysis.resources.dll +0 -0
  274. package/dist/typespec-http-client-csharp.d.ts +202 -0
  275. package/package.json +76 -0
@@ -0,0 +1,261 @@
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // Licensed under the MIT License. See License.txt in the project root for license information.
3
+ import { UsageFlags, getAccessOverride, isReadOnly, } from "@azure-tools/typespec-client-generator-core";
4
+ import { Usage } from "../type/usage.js";
5
+ export function fromSdkType(sdkType, context, models, enums, literalTypeContext) {
6
+ if (sdkType.kind === "nullable") {
7
+ const inputType = fromSdkType(sdkType.type, context, models, enums);
8
+ return {
9
+ Kind: "nullable",
10
+ Type: inputType,
11
+ };
12
+ }
13
+ if (sdkType.kind === "model")
14
+ return fromSdkModelType(sdkType, context, models, enums);
15
+ if (sdkType.kind === "enum")
16
+ return fromSdkEnumType(sdkType, context, enums);
17
+ if (sdkType.kind === "enumvalue")
18
+ return fromSdkEnumValueTypeToConstantType(sdkType, context, enums, literalTypeContext);
19
+ if (sdkType.kind === "dict")
20
+ return fromSdkDictionaryType(sdkType, context, models, enums);
21
+ if (sdkType.kind === "array")
22
+ return fromSdkArrayType(sdkType, context, models, enums);
23
+ if (sdkType.kind === "constant")
24
+ return fromSdkConstantType(sdkType, context, models, enums, literalTypeContext);
25
+ if (sdkType.kind === "union")
26
+ return fromUnionType(sdkType, context, models, enums);
27
+ if (sdkType.kind === "utcDateTime" || sdkType.kind === "offsetDateTime")
28
+ return fromSdkDateTimeType(sdkType);
29
+ if (sdkType.kind === "duration")
30
+ return fromSdkDurationType(sdkType);
31
+ if (sdkType.kind === "tuple")
32
+ return fromTupleType();
33
+ // TODO -- only in operations we could have these types, considering we did not adopt getAllOperations from TCGC yet, this should be fine.
34
+ // we need to resolve these conversions when we adopt getAllOperations
35
+ if (sdkType.kind === "credential")
36
+ throw new Error("Credential type is not supported yet.");
37
+ if (sdkType.kind === "endpoint")
38
+ throw new Error("Endpoint type is not supported yet.");
39
+ return fromSdkBuiltInType(sdkType);
40
+ }
41
+ export function fromSdkModelType(modelType, context, models, enums) {
42
+ const modelTypeName = modelType.name;
43
+ let inputModelType = models.get(modelTypeName);
44
+ if (!inputModelType) {
45
+ inputModelType = {
46
+ Kind: "model",
47
+ Name: modelTypeName,
48
+ CrossLanguageDefinitionId: modelType.crossLanguageDefinitionId,
49
+ Access: getAccessOverride(context, modelType.__raw) /* when tcgc provide a way to identify if the access is override or not, we can get the accessibility from the modelType.access */,
50
+ Usage: fromUsageFlags(modelType.usage),
51
+ Deprecation: modelType.deprecation,
52
+ Description: modelType.description,
53
+ DiscriminatorValue: modelType.discriminatorValue,
54
+ };
55
+ models.set(modelTypeName, inputModelType);
56
+ inputModelType.AdditionalProperties = modelType.additionalProperties
57
+ ? fromSdkType(modelType.additionalProperties, context, models, enums)
58
+ : undefined;
59
+ const propertiesDict = new Map();
60
+ for (const property of modelType.properties) {
61
+ if (property.kind !== "property") {
62
+ continue;
63
+ }
64
+ const ourProperties = fromSdkModelProperty(property, {
65
+ ModelName: modelTypeName,
66
+ }, []);
67
+ propertiesDict.set(property, ourProperties);
68
+ }
69
+ inputModelType.DiscriminatorProperty = modelType.discriminatorProperty
70
+ ? propertiesDict.get(modelType.discriminatorProperty)[0]
71
+ : undefined;
72
+ inputModelType.BaseModel = modelType.baseModel
73
+ ? fromSdkModelType(modelType.baseModel, context, models, enums)
74
+ : undefined;
75
+ inputModelType.Properties = Array.from(propertiesDict.values()).flat();
76
+ if (modelType.discriminatedSubtypes) {
77
+ const discriminatedSubtypes = {};
78
+ for (const key in modelType.discriminatedSubtypes) {
79
+ const subtype = modelType.discriminatedSubtypes[key];
80
+ discriminatedSubtypes[key] = fromSdkModelType(subtype, context, models, enums);
81
+ }
82
+ inputModelType.DiscriminatedSubtypes = discriminatedSubtypes;
83
+ }
84
+ }
85
+ return inputModelType;
86
+ function fromSdkModelProperty(property, literalTypeContext, flattenedNamePrefixes) {
87
+ // TODO -- we should consolidate the flatten somewhere else
88
+ if (!property.flatten) {
89
+ const serializedName = property.serializedName;
90
+ literalTypeContext.PropertyName = serializedName;
91
+ const isRequired = !property.optional;
92
+ const isDiscriminator = property.discriminator;
93
+ const modelProperty = {
94
+ Name: property.name,
95
+ SerializedName: serializedName,
96
+ Description: property.description ?? (isDiscriminator ? "Discriminator" : ""),
97
+ Type: fromSdkType(property.type, context, models, enums, isDiscriminator ? undefined : literalTypeContext // this is a workaround because the type of discriminator property in derived models is always literal and we wrap literal into enums, which leads to a lot of extra enum types, adding this check to avoid them
98
+ ),
99
+ IsRequired: isRequired,
100
+ IsReadOnly: isReadOnly(property),
101
+ IsDiscriminator: isDiscriminator === true ? true : undefined,
102
+ FlattenedNames: flattenedNamePrefixes.length > 0
103
+ ? flattenedNamePrefixes.concat(property.name)
104
+ : undefined,
105
+ };
106
+ return [modelProperty];
107
+ }
108
+ const flattenedProperties = [];
109
+ const childPropertiesToFlatten = property.type.properties;
110
+ const newFlattenedNamePrefixes = flattenedNamePrefixes.concat(property.serializedName);
111
+ for (const childProperty of childPropertiesToFlatten) {
112
+ if (childProperty.kind !== "property")
113
+ continue;
114
+ flattenedProperties.push(...fromSdkModelProperty(childProperty, literalTypeContext, newFlattenedNamePrefixes));
115
+ }
116
+ return flattenedProperties;
117
+ }
118
+ }
119
+ export function fromSdkEnumType(enumType, context, enums, addToCollection = true) {
120
+ const enumName = enumType.name;
121
+ let inputEnumType = enums.get(enumName);
122
+ if (inputEnumType === undefined) {
123
+ const newInputEnumType = {
124
+ Kind: "enum",
125
+ Name: enumName,
126
+ CrossLanguageDefinitionId: enumType.crossLanguageDefinitionId,
127
+ ValueType: fromSdkBuiltInType(enumType.valueType),
128
+ Values: enumType.values.map((v) => fromSdkEnumValueType(v)),
129
+ Accessibility: getAccessOverride(context, enumType.__raw) /* when tcgc provide a way to identify if the access is override or not, we can get the accessibility from the enumType.access,*/,
130
+ Deprecated: enumType.deprecation,
131
+ Description: enumType.description,
132
+ IsExtensible: enumType.isFixed ? false : true,
133
+ Usage: fromUsageFlags(enumType.usage),
134
+ };
135
+ if (addToCollection)
136
+ enums.set(enumName, newInputEnumType);
137
+ inputEnumType = newInputEnumType;
138
+ }
139
+ return inputEnumType;
140
+ }
141
+ function fromSdkDateTimeType(dateTimeType) {
142
+ return {
143
+ Kind: dateTimeType.kind,
144
+ Encode: dateTimeType.encode,
145
+ WireType: fromSdkBuiltInType(dateTimeType.wireType),
146
+ };
147
+ }
148
+ function fromSdkDurationType(durationType) {
149
+ return {
150
+ Kind: durationType.kind,
151
+ Encode: durationType.encode,
152
+ WireType: fromSdkBuiltInType(durationType.wireType),
153
+ };
154
+ }
155
+ // TODO: tuple is not officially supported
156
+ function fromTupleType() {
157
+ return {
158
+ Kind: "any",
159
+ };
160
+ }
161
+ function fromSdkBuiltInType(builtInType) {
162
+ return {
163
+ Kind: builtInType.kind,
164
+ Encode: builtInType.encode !== builtInType.kind ? builtInType.encode : undefined, // In TCGC this is required, and when there is no encoding, it just has the same value as kind, we could remove this when TCGC decides to simplify
165
+ };
166
+ }
167
+ function fromUnionType(union, context, models, enums) {
168
+ const variantTypes = [];
169
+ for (const value of union.values) {
170
+ const variantType = fromSdkType(value, context, models, enums);
171
+ variantTypes.push(variantType);
172
+ }
173
+ return {
174
+ Kind: "union",
175
+ Name: union.name,
176
+ VariantTypes: variantTypes,
177
+ };
178
+ }
179
+ function fromSdkConstantType(constantType, context, models, enums, literalTypeContext) {
180
+ return {
181
+ Kind: constantType.kind,
182
+ ValueType: constantType.valueType.kind === "boolean" || literalTypeContext === undefined
183
+ ? fromSdkBuiltInType(constantType.valueType)
184
+ : // TODO: this might change in the near future
185
+ // we might keep constant as-is, instead of creating an enum for it.
186
+ convertConstantToEnum(constantType, enums, literalTypeContext),
187
+ Value: constantType.value,
188
+ };
189
+ function convertConstantToEnum(constantType, enums, literalTypeContext) {
190
+ // otherwise we need to wrap this into an extensible enum
191
+ // we use the model name followed by the property name as the enum name to ensure it is unique
192
+ const enumName = `${literalTypeContext.ModelName}_${literalTypeContext.PropertyName}`;
193
+ const enumValueName = constantType.value === null ? "Null" : constantType.value.toString();
194
+ const allowValues = [
195
+ {
196
+ Name: enumValueName,
197
+ Value: constantType.value,
198
+ Description: enumValueName,
199
+ },
200
+ ];
201
+ const enumType = {
202
+ Kind: "enum",
203
+ Name: enumName,
204
+ ValueType: fromSdkBuiltInType(constantType.valueType),
205
+ Values: allowValues,
206
+ CrossLanguageDefinitionId: "",
207
+ Accessibility: undefined,
208
+ Deprecated: undefined,
209
+ Description: `The ${enumName}`, // TODO -- what should we put here?
210
+ IsExtensible: true,
211
+ Usage: "None", // will be updated later
212
+ };
213
+ enums.set(enumName, enumType);
214
+ return enumType;
215
+ }
216
+ }
217
+ function fromSdkEnumValueTypeToConstantType(enumValueType, context, enums, literalTypeContext) {
218
+ return {
219
+ Kind: "constant",
220
+ ValueType: enumValueType.valueType.kind === "boolean" || literalTypeContext === undefined
221
+ ? fromSdkBuiltInType(enumValueType.valueType) // TODO: TCGC fix
222
+ : fromSdkEnumType(enumValueType.enumType, context, enums),
223
+ Value: enumValueType.value,
224
+ };
225
+ }
226
+ function fromSdkEnumValueType(enumValueType) {
227
+ return {
228
+ Name: enumValueType.name,
229
+ Value: enumValueType.value,
230
+ Description: enumValueType.description,
231
+ };
232
+ }
233
+ function fromSdkDictionaryType(dictionaryType, context, models, enums) {
234
+ return {
235
+ Kind: "dict",
236
+ KeyType: fromSdkType(dictionaryType.keyType, context, models, enums),
237
+ ValueType: fromSdkType(dictionaryType.valueType, context, models, enums),
238
+ };
239
+ }
240
+ function fromSdkArrayType(arrayType, context, models, enums) {
241
+ return {
242
+ Kind: "array",
243
+ Name: arrayType.name,
244
+ ValueType: fromSdkType(arrayType.valueType, context, models, enums),
245
+ CrossLanguageDefinitionId: arrayType.crossLanguageDefinitionId,
246
+ };
247
+ }
248
+ function fromUsageFlags(usage) {
249
+ if (usage & UsageFlags.JsonMergePatch)
250
+ return Usage.None; // if the model is used in patch, we ignore the usage and defer to the logic of ours
251
+ usage = usage & (UsageFlags.Input | UsageFlags.Output); // trim off other flags
252
+ if (usage === UsageFlags.Input)
253
+ return Usage.Input;
254
+ else if (usage === UsageFlags.Output)
255
+ return Usage.Output;
256
+ else if (usage === (UsageFlags.Input | UsageFlags.Output))
257
+ return Usage.RoundTrip;
258
+ else
259
+ return Usage.None;
260
+ }
261
+ //# sourceMappingURL=converter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"converter.js","sourceRoot":"","sources":["../../../emitter/src/lib/converter.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,+FAA+F;AAE/F,OAAO,EAeL,UAAU,EACV,iBAAiB,EACjB,UAAU,GACX,MAAM,6CAA6C,CAAC;AAkBrD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,MAAM,UAAU,WAAW,CACzB,OAAgB,EAChB,OAAmB,EACnB,MAAmC,EACnC,KAAiC,EACjC,kBAAuC;IAEvC,IAAI,OAAO,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QAChC,MAAM,SAAS,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;QACpE,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,SAAS;SACK,CAAC;IACzB,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO;QAAE,OAAO,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACvF,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAC7E,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW;QAC9B,OAAO,kCAAkC,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC;IACzF,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IAC3F,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO;QAAE,OAAO,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,C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AAmB,EACnB,MAAmC,EACnC,KAAiC;IAEjC,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,WAAW,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC;QACpE,SAAS,EAAE,WAAW,CAAC,cAAc,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC;KACzE,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CACvB,SAAuB,EACvB,OAAmB,EACnB,MAAmC,EACnC,KAAiC;IAEjC,OAAO;QACL,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,SAAS,CAAC,IAAI;QACpB,SAAS,EAAE,WAAW,CAAC,SAAS,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC;QACnE,yBAAyB,EAAE,SAAS,CAAC,yBAAyB;KAC/D,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,KAAiB;IACvC,IAAI,KAAK,GAAG,UAAU,CAAC,cAAc;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,oFAAoF;IAC9I,KAAK,GAAG,KAAK,GAAG,CAAC,UAAU,CAAC,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,uBAAuB;IAC/E,IAAI,KAAK,KAAK,UAAU,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC,KAAK,CAAC;SAC9C,IAAI,KAAK,KAAK,UAAU,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC,MAAM,CAAC;SACrD,IAAI,KAAK,KAAK,CAAC,UAAU,CAAC,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAC,SAAS,CAAC;;QAC7E,OAAO,KAAK,CAAC,IAAI,CAAC;AACzB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { SdkContext } from "@azure-tools/typespec-client-generator-core";
2
+ import { DecoratedType, Operation, Type } from "@typespec/compiler";
3
+ import { ExternalDocs } from "../type/external-docs.js";
4
+ export declare function getExternalDocs(context: SdkContext, entity: Type): ExternalDocs | undefined;
5
+ /**
6
+ * @returns operationId set via the @operationId decorator or `undefined`
7
+ */
8
+ export declare function getOperationId(context: SdkContext, entity: Operation): string | undefined;
9
+ export declare function hasDecorator(type: DecoratedType, name: string): boolean;
10
+ //# sourceMappingURL=decorators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../../emitter/src/lib/decorators.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,6CAA6C,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGxD,wBAAgB,eAAe,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,GAAG,YAAY,GAAG,SAAS,CAE3F;AAGD;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAEzF;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvE"}
@@ -0,0 +1,17 @@
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // Licensed under the MIT License. See License.txt in the project root for license information.
3
+ const externalDocsKey = Symbol("externalDocs");
4
+ export function getExternalDocs(context, entity) {
5
+ return context.program.stateMap(externalDocsKey).get(entity);
6
+ }
7
+ const operationIdsKey = Symbol("operationIds");
8
+ /**
9
+ * @returns operationId set via the @operationId decorator or `undefined`
10
+ */
11
+ export function getOperationId(context, entity) {
12
+ return context.program.stateMap(operationIdsKey).get(entity);
13
+ }
14
+ export function hasDecorator(type, name) {
15
+ return type.decorators.find((it) => it.decorator.name === name) !== undefined;
16
+ }
17
+ //# sourceMappingURL=decorators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../emitter/src/lib/decorators.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,+FAA+F;AAM/F,MAAM,eAAe,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAC/C,MAAM,UAAU,eAAe,CAAC,OAAmB,EAAE,MAAY;IAC/D,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,eAAe,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAC/C;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,OAAmB,EAAE,MAAiB;IACnE,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAmB,EAAE,IAAY;IAC5D,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,SAAS,CAAC;AAChF,CAAC"}
@@ -0,0 +1,66 @@
1
+ export declare const reportDiagnostic: <C extends "no-apiVersion" | "no-route" | "invalid-name" | "general-warning" | "general-error", M extends keyof {
2
+ "no-apiVersion": {
3
+ default: import("@typespec/compiler").CallableMessage<[string]>;
4
+ };
5
+ "no-route": {
6
+ default: import("@typespec/compiler").CallableMessage<[string]>;
7
+ };
8
+ "invalid-name": {
9
+ default: import("@typespec/compiler").CallableMessage<[string]>;
10
+ };
11
+ "general-warning": {
12
+ default: import("@typespec/compiler").CallableMessage<[string]>;
13
+ };
14
+ "general-error": {
15
+ default: import("@typespec/compiler").CallableMessage<[string]>;
16
+ };
17
+ }[C]>(program: import("@typespec/compiler").Program, diag: import("@typespec/compiler").DiagnosticReport<{
18
+ "no-apiVersion": {
19
+ default: import("@typespec/compiler").CallableMessage<[string]>;
20
+ };
21
+ "no-route": {
22
+ default: import("@typespec/compiler").CallableMessage<[string]>;
23
+ };
24
+ "invalid-name": {
25
+ default: import("@typespec/compiler").CallableMessage<[string]>;
26
+ };
27
+ "general-warning": {
28
+ default: import("@typespec/compiler").CallableMessage<[string]>;
29
+ };
30
+ "general-error": {
31
+ default: import("@typespec/compiler").CallableMessage<[string]>;
32
+ };
33
+ }, C, M>) => void, createDiagnostic: <C extends "no-apiVersion" | "no-route" | "invalid-name" | "general-warning" | "general-error", M extends keyof {
34
+ "no-apiVersion": {
35
+ default: import("@typespec/compiler").CallableMessage<[string]>;
36
+ };
37
+ "no-route": {
38
+ default: import("@typespec/compiler").CallableMessage<[string]>;
39
+ };
40
+ "invalid-name": {
41
+ default: import("@typespec/compiler").CallableMessage<[string]>;
42
+ };
43
+ "general-warning": {
44
+ default: import("@typespec/compiler").CallableMessage<[string]>;
45
+ };
46
+ "general-error": {
47
+ default: import("@typespec/compiler").CallableMessage<[string]>;
48
+ };
49
+ }[C]>(diag: import("@typespec/compiler").DiagnosticReport<{
50
+ "no-apiVersion": {
51
+ default: import("@typespec/compiler").CallableMessage<[string]>;
52
+ };
53
+ "no-route": {
54
+ default: import("@typespec/compiler").CallableMessage<[string]>;
55
+ };
56
+ "invalid-name": {
57
+ default: import("@typespec/compiler").CallableMessage<[string]>;
58
+ };
59
+ "general-warning": {
60
+ default: import("@typespec/compiler").CallableMessage<[string]>;
61
+ };
62
+ "general-error": {
63
+ default: import("@typespec/compiler").CallableMessage<[string]>;
64
+ };
65
+ }, C, M>) => import("@typespec/compiler").Diagnostic, getTracer: (program: import("@typespec/compiler").Program) => import("@typespec/compiler").Tracer;
66
+ //# sourceMappingURL=lib.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../../emitter/src/lib/lib.ts"],"names":[],"mappings":"AA8CA,eAAO,MAAQ,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAE,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sDAAE,SAAS,wFAAS,CAAC"}
@@ -0,0 +1,45 @@
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // Licensed under the MIT License. See License.txt in the project root for license information.
3
+ import { createTypeSpecLibrary, paramMessage } from "@typespec/compiler";
4
+ import { NetEmitterOptionsSchema } from "../options.js";
5
+ const $lib = createTypeSpecLibrary({
6
+ name: "@typespec/http-client-csharp",
7
+ diagnostics: {
8
+ "no-apiVersion": {
9
+ severity: "error",
10
+ messages: {
11
+ default: paramMessage `No APIVersion Provider for service ${"service"}`,
12
+ },
13
+ },
14
+ "no-route": {
15
+ // TODO - once https://github.com/Azure/typespec-azure/issues/1018 is fixed, change this back to error
16
+ severity: "warning",
17
+ messages: {
18
+ default: paramMessage `No Route for service for service ${"service"}`,
19
+ },
20
+ },
21
+ "invalid-name": {
22
+ severity: "warning",
23
+ messages: {
24
+ default: paramMessage `Invalid interface or operation group name ${"name"} when configuration "model-namespace" is on`,
25
+ },
26
+ },
27
+ "general-warning": {
28
+ severity: "warning",
29
+ messages: {
30
+ default: paramMessage `${"message"}`,
31
+ },
32
+ },
33
+ "general-error": {
34
+ severity: "error",
35
+ messages: {
36
+ default: paramMessage `${"message"}`,
37
+ },
38
+ },
39
+ },
40
+ emitter: {
41
+ options: NetEmitterOptionsSchema,
42
+ },
43
+ });
44
+ export const { reportDiagnostic, createDiagnostic, getTracer } = $lib;
45
+ //# sourceMappingURL=lib.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lib.js","sourceRoot":"","sources":["../../../emitter/src/lib/lib.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,+FAA+F;AAE/F,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD,MAAM,IAAI,GAAG,qBAAqB,CAAC;IACjC,IAAI,EAAE,8BAA8B;IACpC,WAAW,EAAE;QACX,eAAe,EAAE;YACf,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,sCAAsC,SAAS,EAAE;aACvE;SACF;QACD,UAAU,EAAE;YACV,sGAAsG;YACtG,QAAQ,EAAE,SAAS;YACnB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,oCAAoC,SAAS,EAAE;aACrE;SACF;QACD,cAAc,EAAE;YACd,QAAQ,EAAE,SAAS;YACnB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,6CAA6C,MAAM,6CAA6C;aACtH;SACF;QACD,iBAAiB,EAAE;YACjB,QAAQ,EAAE,SAAS;YACnB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,GAAG,SAAS,EAAE;aACpC;SACF;QACD,eAAe,EAAE;YACf,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,GAAG,SAAS,EAAE;aACpC;SACF;KACF;IACD,OAAO,EAAE;QACP,OAAO,EAAE,uBAAuB;KACjC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare enum LoggerLevel {
2
+ INFO = "info",
3
+ DEBUG = "debug",
4
+ VERBOSE = "verbose"
5
+ }
6
+ //# sourceMappingURL=log-level.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-level.d.ts","sourceRoot":"","sources":["../../../emitter/src/lib/log-level.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,OAAO,YAAY;CACpB"}
@@ -0,0 +1,7 @@
1
+ export var LoggerLevel;
2
+ (function (LoggerLevel) {
3
+ LoggerLevel["INFO"] = "info";
4
+ LoggerLevel["DEBUG"] = "debug";
5
+ LoggerLevel["VERBOSE"] = "verbose";
6
+ })(LoggerLevel || (LoggerLevel = {}));
7
+ //# sourceMappingURL=log-level.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-level.js","sourceRoot":"","sources":["../../../emitter/src/lib/log-level.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,8BAAe,CAAA;IACf,kCAAmB,CAAA;AACrB,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB"}
@@ -0,0 +1,18 @@
1
+ import { Program } from "@typespec/compiler";
2
+ import { LoggerLevel } from "./log-level.js";
3
+ export declare class Logger {
4
+ private static instance;
5
+ private initialized;
6
+ private tracer;
7
+ private level;
8
+ private program;
9
+ private constructor();
10
+ static initialize(program: Program, level: LoggerLevel): void;
11
+ static getInstance(): Logger;
12
+ info(message: string): void;
13
+ debug(message: string): void;
14
+ verbose(message: string): void;
15
+ warn(message: string): void;
16
+ error(message: string): void;
17
+ }
18
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../emitter/src/lib/logger.ts"],"names":[],"mappings":"AAGA,OAAO,EAAY,OAAO,EAAU,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAS;IAChC,OAAO,CAAC,WAAW,CAAkB;IACrC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,OAAO,CAAU;IAEzB,OAAO;IAMP,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI;IAO7D,MAAM,CAAC,WAAW,IAAI,MAAM;IAO5B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAa3B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAS5B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAS9B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAQ3B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAO7B"}
@@ -0,0 +1,70 @@
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // Licensed under the MIT License. See License.txt in the project root for license information.
3
+ import { NoTarget } from "@typespec/compiler";
4
+ import { getTracer, reportDiagnostic } from "./lib.js";
5
+ import { LoggerLevel } from "./log-level.js";
6
+ export class Logger {
7
+ static instance;
8
+ initialized = false;
9
+ tracer;
10
+ level;
11
+ program;
12
+ constructor(program, level) {
13
+ this.tracer = getTracer(program);
14
+ this.level = level;
15
+ this.program = program;
16
+ }
17
+ static initialize(program, level) {
18
+ if (!Logger.instance) {
19
+ Logger.instance = new Logger(program, level);
20
+ Logger.instance.initialized = true;
21
+ }
22
+ }
23
+ static getInstance() {
24
+ if (!Logger.instance) {
25
+ throw new Error("Logger is not initialized. Call initialize() first.");
26
+ }
27
+ return Logger.instance;
28
+ }
29
+ info(message) {
30
+ if (!this.initialized) {
31
+ throw new Error("Logger is not initialized. Call initialize() first.");
32
+ }
33
+ if (this.level === LoggerLevel.INFO ||
34
+ this.level === LoggerLevel.DEBUG ||
35
+ this.level === LoggerLevel.VERBOSE) {
36
+ this.tracer.trace(LoggerLevel.INFO, message);
37
+ }
38
+ }
39
+ debug(message) {
40
+ if (!this.initialized) {
41
+ throw new Error("Logger is not initialized. Call initialize() first.");
42
+ }
43
+ if (this.level === LoggerLevel.DEBUG || this.level === LoggerLevel.VERBOSE) {
44
+ this.tracer.trace(LoggerLevel.DEBUG, message);
45
+ }
46
+ }
47
+ verbose(message) {
48
+ if (!this.initialized) {
49
+ throw new Error("Logger is not initialized. Call initialize() first.");
50
+ }
51
+ if (this.level === LoggerLevel.VERBOSE) {
52
+ this.tracer.trace(LoggerLevel.VERBOSE, message);
53
+ }
54
+ }
55
+ warn(message) {
56
+ reportDiagnostic(this.program, {
57
+ code: "general-warning",
58
+ format: { message: message },
59
+ target: NoTarget,
60
+ });
61
+ }
62
+ error(message) {
63
+ reportDiagnostic(this.program, {
64
+ code: "general-error",
65
+ format: { message: message },
66
+ target: NoTarget,
67
+ });
68
+ }
69
+ }
70
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../emitter/src/lib/logger.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,+FAA+F;AAE/F,OAAO,EAAE,QAAQ,EAAmB,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,OAAO,MAAM;IACT,MAAM,CAAC,QAAQ,CAAS;IACxB,WAAW,GAAY,KAAK,CAAC;IAC7B,MAAM,CAAS;IACf,KAAK,CAAc;IACnB,OAAO,CAAU;IAEzB,YAAoB,OAAgB,EAAE,KAAkB;QACtD,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,OAAgB,EAAE,KAAkB;QACpD,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YACrB,MAAM,CAAC,QAAQ,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YAC7C,MAAM,CAAC,QAAQ,CAAC,WAAW,GAAG,IAAI,CAAC;QACrC,CAAC;IACH,CAAC;IAED,MAAM,CAAC,WAAW;QAChB,IAAI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e;QAClB,gBAAgB,CAAC,IAAI,CAAC,OAAO,EAAE;YAC7B,IAAI,EAAE,iBAAiB;YACvB,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;YAC5B,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,OAAe;QACnB,gBAAgB,CAAC,IAAI,CAAC,OAAO,EAAE;YAC7B,IAAI,EAAE,eAAe;YACrB,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;YAC5B,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,20 @@
1
+ import { SdkContext } from "@azure-tools/typespec-client-generator-core";
2
+ import { Operation, Type } from "@typespec/compiler";
3
+ import { HttpOperation } from "@typespec/http";
4
+ import { NetEmitterOptions } from "../options.js";
5
+ import { InputEnumType, InputModelType, InputType } from "../type/input-type.js";
6
+ import { LiteralTypeContext } from "../type/literal-type-context.js";
7
+ /**
8
+ * If type is an anonymous model, tries to find a named model that has the same
9
+ * set of properties when non-schema properties are excluded.
10
+ */
11
+ export declare function getEffectiveSchemaType(context: SdkContext, type: Type): Type;
12
+ export declare function getDefaultValue(type: Type): any;
13
+ export declare function getInputType(context: SdkContext<NetEmitterOptions>, type: Type, models: Map<string, InputModelType>, enums: Map<string, InputEnumType>, operation?: Operation, literalTypeContext?: LiteralTypeContext): InputType;
14
+ export declare function getUsages(context: SdkContext, ops?: HttpOperation[], modelMap?: Map<string, InputModelType>): {
15
+ inputs: string[];
16
+ outputs: string[];
17
+ roundTrips: string[];
18
+ };
19
+ export declare function navigateModels(context: SdkContext<NetEmitterOptions>, models: Map<string, InputModelType>, enums: Map<string, InputEnumType>): void;
20
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../emitter/src/lib/model.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,UAAU,EAGX,MAAM,6CAA6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