@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,7 @@
1
+ export declare const projectedNameJsonKey = "json";
2
+ export declare const projectedNameCSharpKey = "csharp";
3
+ export declare const projectedNameClientKey = "client";
4
+ export declare const mockApiVersion = "0000-00-00";
5
+ export declare const tspOutputFileName = "tspCodeModel.json";
6
+ export declare const configurationFileName = "Configuration.json";
7
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../emitter/src/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB,SAAS,CAAC;AAC3C,eAAO,MAAM,sBAAsB,WAAW,CAAC;AAC/C,eAAO,MAAM,sBAAsB,WAAW,CAAC;AAC/C,eAAO,MAAM,cAAc,eAAe,CAAC;AAC3C,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AACrD,eAAO,MAAM,qBAAqB,uBAAuB,CAAC"}
@@ -0,0 +1,9 @@
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
+ export const projectedNameJsonKey = "json";
4
+ export const projectedNameCSharpKey = "csharp";
5
+ export const projectedNameClientKey = "client";
6
+ export const mockApiVersion = "0000-00-00";
7
+ export const tspOutputFileName = "tspCodeModel.json";
8
+ export const configurationFileName = "Configuration.json";
9
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../emitter/src/constants.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,+FAA+F;AAE/F,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAC3C,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAC;AAC/C,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAC;AAC/C,MAAM,CAAC,MAAM,cAAc,GAAG,YAAY,CAAC;AAC3C,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AACrD,MAAM,CAAC,MAAM,qBAAqB,GAAG,oBAAoB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { EmitContext } from "@typespec/compiler";
2
+ import { NetEmitterOptions } from "./options.js";
3
+ export declare function $onEmit(context: EmitContext<NetEmitterOptions>): Promise<void>;
4
+ //# sourceMappingURL=emitter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../emitter/src/emitter.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,WAAW,EAMZ,MAAM,oBAAoB,CAAC;AAW5B,OAAO,EAAE,iBAAiB,EAAuC,MAAM,cAAc,CAAC;AAuBtF,wBAAsB,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,iBAAiB,CAAC,iBAkIpE"}
@@ -0,0 +1,174 @@
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 { createSdkContext } from "@azure-tools/typespec-client-generator-core";
4
+ import { getDirectoryPath, joinPaths, logDiagnostics, resolvePath, } from "@typespec/compiler";
5
+ import { spawn } from "child_process";
6
+ import fs, { statSync } from "fs";
7
+ import { PreserveType, stringifyRefs } from "json-serialize-refs";
8
+ import { dirname } from "path";
9
+ import { fileURLToPath } from "url";
10
+ import { configurationFileName, tspOutputFileName } from "./constants.js";
11
+ import { createModel } from "./lib/client-model-builder.js";
12
+ import { LoggerLevel } from "./lib/log-level.js";
13
+ import { Logger } from "./lib/logger.js";
14
+ import { resolveOptions, resolveOutputFolder } from "./options.js";
15
+ /**
16
+ * Look for the project root by looking up until a `package.json` is found.
17
+ * @param path Path to start looking
18
+ */
19
+ function findProjectRoot(path) {
20
+ let current = path;
21
+ while (true) {
22
+ const pkgPath = joinPaths(current, "package.json");
23
+ const stats = checkFile(pkgPath);
24
+ if (stats?.isFile()) {
25
+ return current;
26
+ }
27
+ const parent = getDirectoryPath(current);
28
+ if (parent === current) {
29
+ return undefined;
30
+ }
31
+ current = parent;
32
+ }
33
+ }
34
+ export async function $onEmit(context) {
35
+ const program = context.program;
36
+ const options = resolveOptions(context);
37
+ const outputFolder = resolveOutputFolder(context);
38
+ /* set the loglevel. */
39
+ Logger.initialize(program, options.logLevel ?? LoggerLevel.INFO);
40
+ if (!program.compilerOptions.noEmit && !program.hasError()) {
41
+ // Write out the dotnet model to the output path
42
+ const sdkContext = createSdkContext(context, "@typespec/http-client-csharp");
43
+ const root = createModel(sdkContext);
44
+ if (context.program.diagnostics.length > 0 &&
45
+ context.program.diagnostics.filter((digs) => digs.severity === "error").length > 0) {
46
+ logDiagnostics(context.program.diagnostics, context.program.host.logSink);
47
+ process.exit(1);
48
+ }
49
+ const tspNamespace = root.Name; // this is the top-level namespace defined in the typespec file, which is actually always different from the namespace of the SDK
50
+ // await program.host.writeFile(outPath, prettierOutput(JSON.stringify(root, null, 2)));
51
+ if (root) {
52
+ const generatedFolder = resolvePath(outputFolder, "src", "Generated");
53
+ if (!fs.existsSync(generatedFolder)) {
54
+ fs.mkdirSync(generatedFolder, { recursive: true });
55
+ }
56
+ await program.host.writeFile(resolvePath(outputFolder, tspOutputFileName), prettierOutput(stringifyRefs(root, null, 1, PreserveType.Objects)));
57
+ //emit configuration.json
58
+ const namespace = options.namespace ?? tspNamespace;
59
+ const configurations = {
60
+ "output-folder": ".",
61
+ namespace: namespace,
62
+ "library-name": options["library-name"] ?? namespace,
63
+ "single-top-level-client": options["single-top-level-client"],
64
+ "unreferenced-types-handling": options["unreferenced-types-handling"],
65
+ "keep-non-overloadable-protocol-signature": options["keep-non-overloadable-protocol-signature"],
66
+ "model-namespace": options["model-namespace"],
67
+ "models-to-treat-empty-string-as-null": options["models-to-treat-empty-string-as-null"],
68
+ "intrinsic-types-to-treat-empty-string-as-null": options["models-to-treat-empty-string-as-null"]
69
+ ? options["additional-intrinsic-types-to-treat-empty-string-as-null"].concat(["Uri", "Guid", "ResourceIdentifier", "DateTimeOffset"].filter((item) => options["additional-intrinsic-types-to-treat-empty-string-as-null"].indexOf(item) < 0))
70
+ : undefined,
71
+ "methods-to-keep-client-default-value": options["methods-to-keep-client-default-value"],
72
+ "head-as-boolean": options["head-as-boolean"],
73
+ "deserialize-null-collection-as-null-value": options["deserialize-null-collection-as-null-value"],
74
+ flavor: options["flavor"],
75
+ //only emit these if they are not the default values
76
+ "generate-sample-project": options["generate-sample-project"] === true
77
+ ? undefined
78
+ : options["generate-sample-project"],
79
+ "generate-test-project": options["generate-test-project"] === false ? undefined : options["generate-test-project"],
80
+ "use-model-reader-writer": options["use-model-reader-writer"] ?? true,
81
+ "disable-xml-docs": options["disable-xml-docs"] === false ? undefined : options["disable-xml-docs"],
82
+ };
83
+ await program.host.writeFile(resolvePath(outputFolder, configurationFileName), prettierOutput(JSON.stringify(configurations, null, 2)));
84
+ if (options.skipSDKGeneration !== true) {
85
+ const csProjFile = resolvePath(outputFolder, "src", `${configurations["library-name"]}.csproj`);
86
+ Logger.getInstance().info(`Checking if ${csProjFile} exists`);
87
+ const newProjectOption = "";
88
+ // TODO uncomment when https://github.com/Azure/autorest.csharp/issues/4463 is resolved
89
+ // options["new-project"] || !existsSync(csProjFile) ? "--new-project" : "";
90
+ const existingProjectOption = options["existing-project-folder"]
91
+ ? `--existing-project-folder ${options["existing-project-folder"]}`
92
+ : "";
93
+ const debugFlag = options.debug ?? false ? " --debug" : "";
94
+ const projectRoot = findProjectRoot(dirname(fileURLToPath(import.meta.url)));
95
+ const generatorPath = resolvePath(projectRoot + "/dist/generator/Microsoft.Generator.CSharp.dll");
96
+ const command = `dotnet --roll-forward Major ${generatorPath} ${outputFolder} -p ${options["plugin-name"]} ${newProjectOption} ${existingProjectOption}${debugFlag}`;
97
+ Logger.getInstance().info(command);
98
+ const result = await execAsync("dotnet", [
99
+ "--roll-forward",
100
+ "Major",
101
+ generatorPath,
102
+ outputFolder,
103
+ "-p",
104
+ options["plugin-name"],
105
+ newProjectOption,
106
+ existingProjectOption,
107
+ debugFlag,
108
+ ], { stdio: "inherit" });
109
+ if (result.exitCode !== 0) {
110
+ if (result.stderr)
111
+ Logger.getInstance().error(result.stderr);
112
+ if (result.stdout)
113
+ Logger.getInstance().verbose(result.stdout);
114
+ throw new Error(`Failed to generate SDK. Exit code: ${result.exitCode}`);
115
+ }
116
+ if (!options["save-inputs"]) {
117
+ // delete
118
+ deleteFile(resolvePath(outputFolder, tspOutputFileName));
119
+ deleteFile(resolvePath(outputFolder, configurationFileName));
120
+ }
121
+ }
122
+ }
123
+ }
124
+ }
125
+ async function execAsync(command, args = [], options = {}) {
126
+ const child = spawn(command, args, options);
127
+ return new Promise((resolve, reject) => {
128
+ child.on("error", (error) => {
129
+ reject(error);
130
+ });
131
+ const stdio = [];
132
+ const stdout = [];
133
+ const stderr = [];
134
+ child.stdout?.on("data", (data) => {
135
+ stdout.push(data);
136
+ stdio.push(data);
137
+ });
138
+ child.stderr?.on("data", (data) => {
139
+ stderr.push(data);
140
+ stdio.push(data);
141
+ });
142
+ child.on("exit", (exitCode) => {
143
+ resolve({
144
+ exitCode: exitCode ?? -1,
145
+ stdio: Buffer.concat(stdio).toString(),
146
+ stdout: Buffer.concat(stdout).toString(),
147
+ stderr: Buffer.concat(stderr).toString(),
148
+ proc: child,
149
+ });
150
+ });
151
+ });
152
+ }
153
+ function deleteFile(filePath) {
154
+ fs.unlink(filePath, (err) => {
155
+ if (err) {
156
+ //logger.error(`stderr: ${err}`);
157
+ }
158
+ else {
159
+ Logger.getInstance().info(`File ${filePath} is deleted.`);
160
+ }
161
+ });
162
+ }
163
+ function prettierOutput(output) {
164
+ return output + "\n";
165
+ }
166
+ function checkFile(pkgPath) {
167
+ try {
168
+ return statSync(pkgPath);
169
+ }
170
+ catch (error) {
171
+ return undefined;
172
+ }
173
+ }
174
+ //# sourceMappingURL=emitter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../emitter/src/emitter.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,+FAA+F;AAE/F,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAC/E,OAAO,EAGL,gBAAgB,EAChB,SAAS,EACT,c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AAC,QAAgB;IAClC,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE;QAC1B,IAAI,GAAG,EAAE,CAAC;YACR,iCAAiC;QACnC,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,QAAQ,QAAQ,cAAc,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,cAAc,CAAC,MAAc;IACpC,OAAO,MAAM,GAAG,IAAI,CAAC;AACvB,CAAC;AAED,SAAS,SAAS,CAAC,OAAe;IAChC,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { configurationFileName, tspOutputFileName } from "./constants.js";
2
+ export * from "./emitter.js";
3
+ export { createDiagnostic, getTracer, reportDiagnostic } from "./lib/lib.js";
4
+ export { LoggerLevel } from "./lib/log-level.js";
5
+ export { Logger } from "./lib/logger.js";
6
+ export { NetEmitterOptions, NetEmitterOptionsSchema, defaultOptions, resolveOptions, resolveOutputFolder, } from "./options.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../emitter/src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC1E,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,mBAAmB,GACpB,MAAM,cAAc,CAAC"}
@@ -0,0 +1,9 @@
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
+ export { configurationFileName, tspOutputFileName } from "./constants.js";
4
+ export * from "./emitter.js";
5
+ export { createDiagnostic, getTracer, reportDiagnostic } from "./lib/lib.js";
6
+ export { LoggerLevel } from "./lib/log-level.js";
7
+ export { Logger } from "./lib/logger.js";
8
+ export { NetEmitterOptionsSchema, defaultOptions, resolveOptions, resolveOutputFolder, } from "./options.js";
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../emitter/src/index.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,+FAA+F;AAE/F,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC1E,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAEL,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,mBAAmB,GACpB,MAAM,cAAc,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { SdkContext } from "@azure-tools/typespec-client-generator-core";
2
+ import { Service } from "@typespec/compiler";
3
+ import { NetEmitterOptions } from "../options.js";
4
+ import { CodeModel } from "../type/code-model.js";
5
+ export declare function createModel(sdkContext: SdkContext<NetEmitterOptions>): CodeModel;
6
+ export declare function createModelForService(sdkContext: SdkContext<NetEmitterOptions>, service: Service): CodeModel;
7
+ //# sourceMappingURL=client-model-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-model-builder.d.ts","sourceRoot":"","sources":["../../../emitter/src/lib/client-model-builder.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,UAAU,EAOX,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAGL,OAAO,EAKR,MAAM,oBAAoB,CAAC;AAS5B,OAAO,EAAE,iBAAiB,EAAkB,MAAM,eAAe,CAAC;AAElE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAiBlD,wBAAgB,WAAW,CAAC,UAAU,EAAE,UAAU,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAmBhF;AAED,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,UAAU,CAAC,iBAAiB,CAAC,EACzC,OAAO,EAAE,OAAO,GACf,SAAS,CA4MX"}
@@ -0,0 +1,236 @@
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 { getAllModels, getLibraryName, listClients, listOperationGroups, listOperationsInOperationGroup, } from "@azure-tools/typespec-client-generator-core";
4
+ import { NoTarget, getDoc, getNamespaceFullName, ignoreDiagnostics, listServices, } from "@typespec/compiler";
5
+ import { getAllHttpServices, getAuthentication, getHttpOperation, getServers, } from "@typespec/http";
6
+ import { getVersions } from "@typespec/versioning";
7
+ import { resolveOptions } from "../options.js";
8
+ import { ClientKind } from "../type/client-kind.js";
9
+ import { InputOperationParameterKind } from "../type/input-operation-parameter-kind.js";
10
+ import { RequestLocation } from "../type/request-location.js";
11
+ import { Usage } from "../type/usage.js";
12
+ import { reportDiagnostic } from "./lib.js";
13
+ import { Logger } from "./logger.js";
14
+ import { getUsages, navigateModels } from "./model.js";
15
+ import { loadOperation } from "./operation.js";
16
+ import { processServiceAuthentication } from "./service-authentication.js";
17
+ import { resolveServers } from "./typespec-server.js";
18
+ import { createContentTypeOrAcceptParameter } from "./utils.js";
19
+ export function createModel(sdkContext) {
20
+ // initialize tcgc model
21
+ if (!sdkContext.operationModelsMap)
22
+ getAllModels(sdkContext);
23
+ const services = listServices(sdkContext.emitContext.program);
24
+ if (services.length === 0) {
25
+ services.push({
26
+ type: sdkContext.emitContext.program.getGlobalNamespaceType(),
27
+ });
28
+ }
29
+ // TODO: support multiple service. Current only chose the first service.
30
+ const service = services[0];
31
+ const serviceNamespaceType = service.type;
32
+ if (serviceNamespaceType === undefined) {
33
+ throw Error("Can not emit yaml for a namespace that doesn't exist.");
34
+ }
35
+ return createModelForService(sdkContext, service);
36
+ }
37
+ export function createModelForService(sdkContext, service) {
38
+ const program = sdkContext.emitContext.program;
39
+ const serviceNamespaceType = service.type;
40
+ const apiVersions = new Set();
41
+ let defaultApiVersion = undefined;
42
+ let versions = getVersions(program, service.type)[1]
43
+ ?.getVersions()
44
+ .map((v) => v.value);
45
+ const targetApiVersion = sdkContext.emitContext.options["api-version"];
46
+ if (versions !== undefined &&
47
+ targetApiVersion !== undefined &&
48
+ targetApiVersion !== "all" &&
49
+ targetApiVersion !== "latest") {
50
+ const targetApiVersionIndex = versions.findIndex((v) => v === targetApiVersion);
51
+ versions = versions.slice(0, targetApiVersionIndex + 1);
52
+ }
53
+ if (versions && versions.length > 0) {
54
+ for (const ver of versions) {
55
+ apiVersions.add(ver);
56
+ }
57
+ defaultApiVersion = versions[versions.length - 1];
58
+ }
59
+ const defaultApiVersionConstant = defaultApiVersion
60
+ ? {
61
+ Type: {
62
+ Kind: "string",
63
+ },
64
+ Value: defaultApiVersion,
65
+ }
66
+ : undefined;
67
+ const servers = getServers(program, serviceNamespaceType);
68
+ const namespace = getNamespaceFullName(serviceNamespaceType) || "client";
69
+ const authentication = getAuthentication(program, serviceNamespaceType);
70
+ let auth = undefined;
71
+ if (authentication) {
72
+ auth = processServiceAuthentication(authentication);
73
+ }
74
+ const modelMap = new Map();
75
+ const enumMap = new Map();
76
+ let urlParameters = undefined;
77
+ let url = "";
78
+ const convenienceOperations = [];
79
+ //create endpoint parameter from servers
80
+ if (servers !== undefined) {
81
+ const typespecServers = resolveServers(sdkContext, servers, modelMap, enumMap);
82
+ if (typespecServers.length > 0) {
83
+ /* choose the first server as endpoint. */
84
+ url = typespecServers[0].url;
85
+ urlParameters = typespecServers[0].parameters;
86
+ }
87
+ }
88
+ const [services] = getAllHttpServices(program);
89
+ const routes = services[0].operations;
90
+ if (routes.length === 0) {
91
+ reportDiagnostic(program, {
92
+ code: "no-route",
93
+ format: { service: services[0].namespace.name },
94
+ target: NoTarget,
95
+ });
96
+ }
97
+ Logger.getInstance().info("routes:" + routes.length);
98
+ const clients = [];
99
+ const dpgClients = listClients(sdkContext);
100
+ for (const client of dpgClients) {
101
+ clients.push(emitClient(client));
102
+ addChildClients(sdkContext.emitContext, client, clients);
103
+ }
104
+ navigateModels(sdkContext, modelMap, enumMap);
105
+ const usages = getUsages(sdkContext, convenienceOperations, modelMap);
106
+ setUsage(usages, modelMap);
107
+ setUsage(usages, enumMap);
108
+ for (const client of clients) {
109
+ for (const op of client.Operations) {
110
+ /* TODO: remove this when adopt tcgc.
111
+ *set Multipart usage for models.
112
+ */
113
+ const bodyParameter = op.Parameters.find((value) => value.Location === RequestLocation.Body);
114
+ if (bodyParameter && bodyParameter.Type && bodyParameter.Type) {
115
+ const inputModelType = bodyParameter.Type;
116
+ op.RequestMediaTypes?.forEach((item) => {
117
+ if (item === "multipart/form-data" && !inputModelType.Usage.includes(Usage.Multipart)) {
118
+ if (inputModelType.Usage.trim().length === 0) {
119
+ inputModelType.Usage = inputModelType.Usage.concat(Usage.Multipart);
120
+ }
121
+ else {
122
+ inputModelType.Usage = inputModelType.Usage.trim()
123
+ .concat(",")
124
+ .concat(Usage.Multipart);
125
+ }
126
+ }
127
+ });
128
+ }
129
+ const apiVersionIndex = op.Parameters.findIndex((value) => value.IsApiVersion);
130
+ if (apiVersionIndex === -1) {
131
+ continue;
132
+ }
133
+ const apiVersionInOperation = op.Parameters[apiVersionIndex];
134
+ if (defaultApiVersionConstant !== undefined) {
135
+ if (!apiVersionInOperation.DefaultValue?.Value) {
136
+ apiVersionInOperation.DefaultValue = defaultApiVersionConstant;
137
+ }
138
+ }
139
+ else {
140
+ apiVersionInOperation.Kind = InputOperationParameterKind.Method;
141
+ }
142
+ }
143
+ }
144
+ const clientModel = {
145
+ Name: namespace,
146
+ ApiVersions: Array.from(apiVersions.values()),
147
+ Enums: Array.from(enumMap.values()),
148
+ Models: Array.from(modelMap.values()),
149
+ Clients: clients,
150
+ Auth: auth,
151
+ };
152
+ return clientModel;
153
+ function addChildClients(context, client, clients) {
154
+ const dpgOperationGroups = listOperationGroups(sdkContext, client);
155
+ for (const dpgGroup of dpgOperationGroups) {
156
+ const subClient = emitClient(dpgGroup, client);
157
+ clients.push(subClient);
158
+ addChildClients(context, dpgGroup, clients);
159
+ }
160
+ }
161
+ function getClientName(client) {
162
+ if (client.kind === ClientKind.SdkClient) {
163
+ return client.name;
164
+ }
165
+ const pathParts = client.groupPath.split(".");
166
+ if (pathParts?.length >= 3) {
167
+ return pathParts.slice(pathParts.length - 2).join("");
168
+ }
169
+ const clientName = getLibraryName(sdkContext, client.type);
170
+ if (clientName === "Models" &&
171
+ resolveOptions(sdkContext.emitContext)["model-namespace"] !== false) {
172
+ reportDiagnostic(program, {
173
+ code: "invalid-name",
174
+ format: { name: clientName },
175
+ target: client.type,
176
+ });
177
+ return "ModelsOps";
178
+ }
179
+ return clientName;
180
+ }
181
+ function emitClient(client, parent) {
182
+ const operations = listOperationsInOperationGroup(sdkContext, client);
183
+ let clientDesc = "";
184
+ if (operations.length > 0) {
185
+ const container = ignoreDiagnostics(getHttpOperation(program, operations[0])).container;
186
+ clientDesc = getDoc(program, container) ?? "";
187
+ }
188
+ const inputClient = {
189
+ Name: getClientName(client),
190
+ Description: clientDesc,
191
+ Operations: [],
192
+ Protocol: {},
193
+ Parent: parent === undefined ? undefined : getClientName(parent),
194
+ Parameters: urlParameters,
195
+ };
196
+ for (const op of operations) {
197
+ const httpOperation = ignoreDiagnostics(getHttpOperation(program, op));
198
+ const inputOperation = loadOperation(sdkContext, httpOperation, url, urlParameters, serviceNamespaceType, modelMap, enumMap);
199
+ applyDefaultContentTypeAndAcceptParameter(inputOperation);
200
+ inputClient.Operations.push(inputOperation);
201
+ if (inputOperation.GenerateConvenienceMethod)
202
+ convenienceOperations.push(httpOperation);
203
+ }
204
+ return inputClient;
205
+ }
206
+ }
207
+ function setUsage(usages, models) {
208
+ for (const [name, m] of models) {
209
+ if (m.Usage !== undefined && m.Usage !== Usage.None)
210
+ continue;
211
+ if (usages.inputs.includes(name)) {
212
+ m.Usage = Usage.Input;
213
+ }
214
+ else if (usages.outputs.includes(name)) {
215
+ m.Usage = Usage.Output;
216
+ }
217
+ else if (usages.roundTrips.includes(name)) {
218
+ m.Usage = Usage.RoundTrip;
219
+ }
220
+ else {
221
+ m.Usage = Usage.None;
222
+ }
223
+ }
224
+ }
225
+ function applyDefaultContentTypeAndAcceptParameter(operation) {
226
+ const defaultValue = "application/json";
227
+ if (operation.Parameters.some((value) => value.Location === RequestLocation.Body) &&
228
+ !operation.Parameters.some((value) => value.IsContentType === true)) {
229
+ operation.Parameters.push(createContentTypeOrAcceptParameter([defaultValue], "contentType", "Content-Type"));
230
+ operation.RequestMediaTypes = [defaultValue];
231
+ }
232
+ if (!operation.Parameters.some((value) => value.Location === RequestLocation.Header && value.NameInRequest.toLowerCase() === "accept")) {
233
+ operation.Parameters.push(createContentTypeOrAcceptParameter([defaultValue], "accept", "Accept"));
234
+ }
235
+ }
236
+ //# sourceMappingURL=client-model-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-model-builder.js","sourceRoot":"","sources":["../../../emitter/src/lib/client-model-builder.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,+FAA+F;AAE/F,OAAO,EAIL,YAAY,EACZ,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,8BAA8B,GAC/B,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAEL,QAAQ,EAER,MAAM,EACN,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEL,kBAAk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EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,KAAK,eAAe,CAAC,IAAI,CAAC;QAC7E,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,aAAa,KAAK,IAAI,CAAC,EACnE,CAAC;QACD,SAAS,CAAC,UAAU,CAAC,IAAI,CACvB,kCAAkC,CAAC,CAAC,YAAY,CAAC,EAAE,aAAa,EAAE,cAAc,CAAC,CAClF,CAAC;QACF,SAAS,CAAC,iBAAiB,GAAG,CAAC,YAAY,CAAC,CAAC;IAC/C,CAAC;IAED,IACE,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CACxB,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,CAAC,QAAQ,KAAK,eAAe,CAAC,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,WAAW,EAAE,KAAK,QAAQ,CAC9F,EACD,CAAC;QACD,SAAS,CAAC,UAAU,CAAC,IAAI,CACvB,kCAAkC,CAAC,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CACvE,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { SdkContext, SdkEnumType, SdkModelType, SdkType } from "@azure-tools/typespec-client-generator-core";
2
+ import { InputEnumType, InputModelType, InputType } from "../type/input-type.js";
3
+ import { LiteralTypeContext } from "../type/literal-type-context.js";
4
+ export declare function fromSdkType(sdkType: SdkType, context: SdkContext, models: Map<string, InputModelType>, enums: Map<string, InputEnumType>, literalTypeContext?: LiteralTypeContext): InputType;
5
+ export declare function fromSdkModelType(modelType: SdkModelType, context: SdkContext, models: Map<string, InputModelType>, enums: Map<string, InputEnumType>): InputModelType;
6
+ export declare function fromSdkEnumType(enumType: SdkEnumType, context: SdkContext, enums: Map<string, InputEnumType>, addToCollection?: boolean): InputEnumType;
7
+ //# sourceMappingURL=converter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"converter.d.ts","sourceRoot":"","sources":["../../../emitter/src/lib/converter.ts"],"names":[],"mappings":"AAGA,OAAO,EAKL,UAAU,EAIV,WAAW,EAGX,YAAY,EACZ,OAAO,EAKR,MAAM,6CAA6C,CAAC;AAIrD,OAAO,EAKL,aAAa,EAEb,cAAc,EAGd,SAAS,EAEV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAGrE,wBAAgB,WAAW,CACzB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,EACnC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,EACjC,kBAAkB,CAAC,EAAE,kBAAkB,GACtC,SAAS,CA2BX;AAED,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,YAAY,EACvB,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,EACnC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,GAChC,cAAc,CA4GhB;AAED,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,WAAW,EACrB,OAAO,EAAE,UAAU,EACnB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,EACjC,eAAe,GAAE,OAAc,GAC9B,aAAa,CAuBf"}