@typespec/http-client-csharp 0.1.9-alpha.20250214.3 → 0.1.9

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 (274) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +38 -38
  3. package/readme.md +10 -12
  4. package/dist/emitter/constants.d.ts +0 -11
  5. package/dist/emitter/constants.d.ts.map +0 -1
  6. package/dist/emitter/constants.js +0 -18
  7. package/dist/emitter/constants.js.map +0 -1
  8. package/dist/emitter/emitter.d.ts +0 -19
  9. package/dist/emitter/emitter.d.ts.map +0 -1
  10. package/dist/emitter/emitter.js +0 -239
  11. package/dist/emitter/emitter.js.map +0 -1
  12. package/dist/emitter/index.d.ts +0 -10
  13. package/dist/emitter/index.d.ts.map +0 -1
  14. package/dist/emitter/index.js +0 -11
  15. package/dist/emitter/index.js.map +0 -1
  16. package/dist/emitter/lib/client-model-builder.d.ts +0 -10
  17. package/dist/emitter/lib/client-model-builder.d.ts.map +0 -1
  18. package/dist/emitter/lib/client-model-builder.js +0 -161
  19. package/dist/emitter/lib/client-model-builder.js.map +0 -1
  20. package/dist/emitter/lib/decorators.d.ts +0 -10
  21. package/dist/emitter/lib/decorators.d.ts.map +0 -1
  22. package/dist/emitter/lib/decorators.js +0 -17
  23. package/dist/emitter/lib/decorators.js.map +0 -1
  24. package/dist/emitter/lib/example-converter.d.ts +0 -7
  25. package/dist/emitter/lib/example-converter.d.ts.map +0 -1
  26. package/dist/emitter/lib/example-converter.js +0 -131
  27. package/dist/emitter/lib/example-converter.js.map +0 -1
  28. package/dist/emitter/lib/lib.d.ts +0 -32
  29. package/dist/emitter/lib/lib.d.ts.map +0 -1
  30. package/dist/emitter/lib/lib.js +0 -110
  31. package/dist/emitter/lib/lib.js.map +0 -1
  32. package/dist/emitter/lib/logger-level.d.ts +0 -10
  33. package/dist/emitter/lib/logger-level.d.ts.map +0 -1
  34. package/dist/emitter/lib/logger-level.js +0 -13
  35. package/dist/emitter/lib/logger-level.js.map +0 -1
  36. package/dist/emitter/lib/logger.d.ts +0 -20
  37. package/dist/emitter/lib/logger.d.ts.map +0 -1
  38. package/dist/emitter/lib/logger.js +0 -54
  39. package/dist/emitter/lib/logger.js.map +0 -1
  40. package/dist/emitter/lib/model.d.ts +0 -8
  41. package/dist/emitter/lib/model.d.ts.map +0 -1
  42. package/dist/emitter/lib/model.js +0 -37
  43. package/dist/emitter/lib/model.js.map +0 -1
  44. package/dist/emitter/lib/operation-converter.d.ts +0 -8
  45. package/dist/emitter/lib/operation-converter.d.ts.map +0 -1
  46. package/dist/emitter/lib/operation-converter.js +0 -316
  47. package/dist/emitter/lib/operation-converter.js.map +0 -1
  48. package/dist/emitter/lib/service-authentication.d.ts +0 -5
  49. package/dist/emitter/lib/service-authentication.d.ts.map +0 -1
  50. package/dist/emitter/lib/service-authentication.js +0 -123
  51. package/dist/emitter/lib/service-authentication.js.map +0 -1
  52. package/dist/emitter/lib/type-converter.d.ts +0 -8
  53. package/dist/emitter/lib/type-converter.d.ts.map +0 -1
  54. package/dist/emitter/lib/type-converter.js +0 -332
  55. package/dist/emitter/lib/type-converter.js.map +0 -1
  56. package/dist/emitter/lib/typespec-server.d.ts +0 -10
  57. package/dist/emitter/lib/typespec-server.d.ts.map +0 -1
  58. package/dist/emitter/lib/typespec-server.js +0 -90
  59. package/dist/emitter/lib/typespec-server.js.map +0 -1
  60. package/dist/emitter/lib/utils.d.ts +0 -9
  61. package/dist/emitter/lib/utils.d.ts.map +0 -1
  62. package/dist/emitter/lib/utils.js +0 -30
  63. package/dist/emitter/lib/utils.js.map +0 -1
  64. package/dist/emitter/options.d.ts +0 -73
  65. package/dist/emitter/options.d.ts.map +0 -1
  66. package/dist/emitter/options.js +0 -87
  67. package/dist/emitter/options.js.map +0 -1
  68. package/dist/emitter/sdk-context-options.d.ts +0 -9
  69. package/dist/emitter/sdk-context-options.d.ts.map +0 -1
  70. package/dist/emitter/sdk-context-options.js +0 -31
  71. package/dist/emitter/sdk-context-options.js.map +0 -1
  72. package/dist/emitter/sdk-context.d.ts +0 -18
  73. package/dist/emitter/sdk-context.d.ts.map +0 -1
  74. package/dist/emitter/sdk-context.js +0 -4
  75. package/dist/emitter/sdk-context.js.map +0 -1
  76. package/dist/emitter/tsdoc-metadata.json +0 -11
  77. package/dist/emitter/type/body-media-type.d.ts +0 -12
  78. package/dist/emitter/type/body-media-type.d.ts.map +0 -1
  79. package/dist/emitter/type/body-media-type.js +0 -26
  80. package/dist/emitter/type/body-media-type.js.map +0 -1
  81. package/dist/emitter/type/client-kind.d.ts +0 -5
  82. package/dist/emitter/type/client-kind.d.ts.map +0 -1
  83. package/dist/emitter/type/client-kind.js +0 -8
  84. package/dist/emitter/type/client-kind.js.map +0 -1
  85. package/dist/emitter/type/code-model.d.ts +0 -12
  86. package/dist/emitter/type/code-model.d.ts.map +0 -1
  87. package/dist/emitter/type/code-model.js +0 -4
  88. package/dist/emitter/type/code-model.js.map +0 -1
  89. package/dist/emitter/type/collection-format.d.ts +0 -13
  90. package/dist/emitter/type/collection-format.d.ts.map +0 -1
  91. package/dist/emitter/type/collection-format.js +0 -22
  92. package/dist/emitter/type/collection-format.js.map +0 -1
  93. package/dist/emitter/type/configuration.d.ts +0 -7
  94. package/dist/emitter/type/configuration.d.ts.map +0 -1
  95. package/dist/emitter/type/configuration.js +0 -4
  96. package/dist/emitter/type/configuration.js.map +0 -1
  97. package/dist/emitter/type/external-docs.d.ts +0 -5
  98. package/dist/emitter/type/external-docs.d.ts.map +0 -1
  99. package/dist/emitter/type/external-docs.js +0 -4
  100. package/dist/emitter/type/external-docs.js.map +0 -1
  101. package/dist/emitter/type/http-response-header.d.ts +0 -9
  102. package/dist/emitter/type/http-response-header.d.ts.map +0 -1
  103. package/dist/emitter/type/http-response-header.js +0 -4
  104. package/dist/emitter/type/http-response-header.js.map +0 -1
  105. package/dist/emitter/type/input-api-key-auth.d.ts +0 -7
  106. package/dist/emitter/type/input-api-key-auth.d.ts.map +0 -1
  107. package/dist/emitter/type/input-api-key-auth.js +0 -4
  108. package/dist/emitter/type/input-api-key-auth.js.map +0 -1
  109. package/dist/emitter/type/input-auth.d.ts +0 -7
  110. package/dist/emitter/type/input-auth.d.ts.map +0 -1
  111. package/dist/emitter/type/input-auth.js +0 -4
  112. package/dist/emitter/type/input-auth.js.map +0 -1
  113. package/dist/emitter/type/input-client.d.ts +0 -16
  114. package/dist/emitter/type/input-client.d.ts.map +0 -1
  115. package/dist/emitter/type/input-client.js +0 -4
  116. package/dist/emitter/type/input-client.js.map +0 -1
  117. package/dist/emitter/type/input-constant.d.ts +0 -6
  118. package/dist/emitter/type/input-constant.d.ts.map +0 -1
  119. package/dist/emitter/type/input-constant.js +0 -4
  120. package/dist/emitter/type/input-constant.js.map +0 -1
  121. package/dist/emitter/type/input-examples.d.ts +0 -77
  122. package/dist/emitter/type/input-examples.d.ts.map +0 -1
  123. package/dist/emitter/type/input-examples.js +0 -4
  124. package/dist/emitter/type/input-examples.js.map +0 -1
  125. package/dist/emitter/type/input-oauth2-auth.d.ts +0 -4
  126. package/dist/emitter/type/input-oauth2-auth.d.ts.map +0 -1
  127. package/dist/emitter/type/input-oauth2-auth.js +0 -4
  128. package/dist/emitter/type/input-oauth2-auth.js.map +0 -1
  129. package/dist/emitter/type/input-operation-parameter-kind.d.ts +0 -9
  130. package/dist/emitter/type/input-operation-parameter-kind.d.ts.map +0 -1
  131. package/dist/emitter/type/input-operation-parameter-kind.js +0 -12
  132. package/dist/emitter/type/input-operation-parameter-kind.js.map +0 -1
  133. package/dist/emitter/type/input-operation.d.ts +0 -38
  134. package/dist/emitter/type/input-operation.d.ts.map +0 -1
  135. package/dist/emitter/type/input-operation.js +0 -4
  136. package/dist/emitter/type/input-operation.js.map +0 -1
  137. package/dist/emitter/type/input-parameter.d.ts +0 -30
  138. package/dist/emitter/type/input-parameter.d.ts.map +0 -1
  139. package/dist/emitter/type/input-parameter.js +0 -4
  140. package/dist/emitter/type/input-parameter.js.map +0 -1
  141. package/dist/emitter/type/input-type.d.ts +0 -120
  142. package/dist/emitter/type/input-type.d.ts.map +0 -1
  143. package/dist/emitter/type/input-type.js +0 -21
  144. package/dist/emitter/type/input-type.js.map +0 -1
  145. package/dist/emitter/type/literal-type-context.d.ts +0 -8
  146. package/dist/emitter/type/literal-type-context.d.ts.map +0 -1
  147. package/dist/emitter/type/literal-type-context.js +0 -4
  148. package/dist/emitter/type/literal-type-context.js.map +0 -1
  149. package/dist/emitter/type/operation-final-state-via.d.ts +0 -12
  150. package/dist/emitter/type/operation-final-state-via.d.ts.map +0 -1
  151. package/dist/emitter/type/operation-final-state-via.js +0 -36
  152. package/dist/emitter/type/operation-final-state-via.js.map +0 -1
  153. package/dist/emitter/type/operation-long-running.d.ts +0 -8
  154. package/dist/emitter/type/operation-long-running.d.ts.map +0 -1
  155. package/dist/emitter/type/operation-long-running.js +0 -4
  156. package/dist/emitter/type/operation-long-running.js.map +0 -1
  157. package/dist/emitter/type/operation-paging.d.ts +0 -8
  158. package/dist/emitter/type/operation-paging.d.ts.map +0 -1
  159. package/dist/emitter/type/operation-paging.js +0 -4
  160. package/dist/emitter/type/operation-paging.js.map +0 -1
  161. package/dist/emitter/type/operation-response.d.ts +0 -12
  162. package/dist/emitter/type/operation-response.d.ts.map +0 -1
  163. package/dist/emitter/type/operation-response.js +0 -4
  164. package/dist/emitter/type/operation-response.js.map +0 -1
  165. package/dist/emitter/type/protocols.d.ts +0 -3
  166. package/dist/emitter/type/protocols.d.ts.map +0 -1
  167. package/dist/emitter/type/protocols.js +0 -4
  168. package/dist/emitter/type/protocols.js.map +0 -1
  169. package/dist/emitter/type/request-location.d.ts +0 -12
  170. package/dist/emitter/type/request-location.d.ts.map +0 -1
  171. package/dist/emitter/type/request-location.js +0 -19
  172. package/dist/emitter/type/request-location.js.map +0 -1
  173. package/dist/emitter/type/request-method.d.ts +0 -13
  174. package/dist/emitter/type/request-method.d.ts.map +0 -1
  175. package/dist/emitter/type/request-method.js +0 -40
  176. package/dist/emitter/type/request-method.js.map +0 -1
  177. package/dist/emitter/type/validation-type.d.ts +0 -6
  178. package/dist/emitter/type/validation-type.d.ts.map +0 -1
  179. package/dist/emitter/type/validation-type.js +0 -9
  180. package/dist/emitter/type/validation-type.js.map +0 -1
  181. package/dist/generator/CommandLine.dll +0 -0
  182. package/dist/generator/Humanizer.dll +0 -0
  183. package/dist/generator/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
  184. package/dist/generator/Microsoft.Build.Framework.dll +0 -0
  185. package/dist/generator/Microsoft.Build.dll +0 -0
  186. package/dist/generator/Microsoft.CodeAnalysis.CSharp.Workspaces.dll +0 -0
  187. package/dist/generator/Microsoft.CodeAnalysis.CSharp.dll +0 -0
  188. package/dist/generator/Microsoft.CodeAnalysis.Workspaces.dll +0 -0
  189. package/dist/generator/Microsoft.CodeAnalysis.dll +0 -0
  190. package/dist/generator/Microsoft.NET.StringTools.dll +0 -0
  191. package/dist/generator/Microsoft.TypeSpec.Generator +0 -0
  192. package/dist/generator/Microsoft.TypeSpec.Generator.ClientModel.StubLibrary.deps.json +0 -819
  193. package/dist/generator/Microsoft.TypeSpec.Generator.ClientModel.StubLibrary.dll +0 -0
  194. package/dist/generator/Microsoft.TypeSpec.Generator.ClientModel.StubLibrary.pdb +0 -0
  195. package/dist/generator/Microsoft.TypeSpec.Generator.ClientModel.deps.json +0 -802
  196. package/dist/generator/Microsoft.TypeSpec.Generator.ClientModel.dll +0 -0
  197. package/dist/generator/Microsoft.TypeSpec.Generator.ClientModel.pdb +0 -0
  198. package/dist/generator/Microsoft.TypeSpec.Generator.Input.dll +0 -0
  199. package/dist/generator/Microsoft.TypeSpec.Generator.Input.pdb +0 -0
  200. package/dist/generator/Microsoft.TypeSpec.Generator.deps.json +0 -758
  201. package/dist/generator/Microsoft.TypeSpec.Generator.dll +0 -0
  202. package/dist/generator/Microsoft.TypeSpec.Generator.pdb +0 -0
  203. package/dist/generator/Microsoft.TypeSpec.Generator.runtimeconfig.json +0 -12
  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 +0 -458
@@ -1,161 +0,0 @@
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, } from "@azure-tools/typespec-client-generator-core";
4
- import { NoTarget } from "@typespec/compiler";
5
- import { InputOperationParameterKind } from "../type/input-operation-parameter-kind.js";
6
- import { RequestLocation } from "../type/request-location.js";
7
- import { navigateModels } from "./model.js";
8
- import { fromSdkServiceMethod, getParameterDefaultValue } from "./operation-converter.js";
9
- import { processServiceAuthentication } from "./service-authentication.js";
10
- import { fromSdkType } from "./type-converter.js";
11
- /**
12
- * Creates the code model from the SDK context.
13
- * @param sdkContext - The SDK context
14
- * @returns The code model
15
- * @beta
16
- */
17
- export function createModel(sdkContext) {
18
- const sdkPackage = sdkContext.sdkPackage;
19
- navigateModels(sdkContext);
20
- const sdkApiVersionEnums = sdkPackage.enums.filter((e) => e.usage === UsageFlags.ApiVersionEnum);
21
- const rootClients = sdkPackage.clients.filter((c) => c.initialization.access === "public");
22
- if (rootClients.length === 0) {
23
- sdkContext.logger.reportDiagnostic({
24
- code: "no-root-client",
25
- format: {},
26
- target: NoTarget,
27
- });
28
- return {};
29
- }
30
- const rootApiVersions = sdkApiVersionEnums.length > 0
31
- ? sdkApiVersionEnums[0].values.map((v) => v.value).flat()
32
- : rootClients[0].apiVersions;
33
- const inputClients = [];
34
- fromSdkClients(rootClients, inputClients, []);
35
- const clientModel = {
36
- // rootNamespace is really coalescing the `package-name` option and the first namespace found.
37
- Name: sdkPackage.rootNamespace,
38
- ApiVersions: rootApiVersions,
39
- Enums: Array.from(sdkContext.__typeCache.enums.values()),
40
- Models: Array.from(sdkContext.__typeCache.models.values()),
41
- Clients: inputClients,
42
- Auth: processServiceAuthentication(sdkContext, sdkPackage),
43
- };
44
- return clientModel;
45
- function fromSdkClients(clients, inputClients, parentClientNames) {
46
- for (const client of clients) {
47
- const inputClient = fromSdkClient(client, parentClientNames);
48
- inputClients.push(inputClient);
49
- const subClients = client.methods
50
- .filter((m) => m.kind === "clientaccessor")
51
- .map((m) => m.response);
52
- parentClientNames.push(inputClient.Name);
53
- fromSdkClients(subClients, inputClients, parentClientNames);
54
- parentClientNames.pop();
55
- }
56
- }
57
- function fromSdkClient(client, parentNames) {
58
- const endpointParameter = client.initialization.properties.find((p) => p.kind === "endpoint");
59
- const uri = getMethodUri(endpointParameter);
60
- const clientParameters = fromSdkEndpointParameter(endpointParameter);
61
- const clientName = getClientName(client, parentNames);
62
- // see if this namespace is a sub-namespace of an existing bad namespace
63
- const segments = client.clientNamespace.split(".");
64
- const lastSegment = segments[segments.length - 1];
65
- if (lastSegment === clientName) {
66
- // we report diagnostics when the last segment of the namespace is the same as the client name
67
- // because in our design, a sub namespace will be generated as a sub client with exact the same name as the namespace
68
- // in csharp, this will cause a conflict between the namespace and the class name
69
- sdkContext.logger.reportDiagnostic({
70
- code: "client-namespace-conflict",
71
- format: { clientNamespace: client.clientNamespace, clientName },
72
- target: client.__raw.type ?? NoTarget,
73
- });
74
- }
75
- return {
76
- Name: clientName,
77
- ClientNamespace: client.clientNamespace,
78
- Summary: client.summary,
79
- Doc: client.doc,
80
- Operations: client.methods
81
- .filter((m) => m.kind !== "clientaccessor")
82
- .map((m) => fromSdkServiceMethod(sdkContext, m, uri, rootApiVersions)),
83
- Protocol: {},
84
- Parent: parentNames.length > 0 ? parentNames[parentNames.length - 1] : undefined,
85
- Parameters: clientParameters,
86
- Decorators: client.decorators,
87
- };
88
- }
89
- function getClientName(client, parentClientNames) {
90
- const clientName = client.name;
91
- if (parentClientNames.length === 0)
92
- return clientName;
93
- if (parentClientNames.length >= 2)
94
- return `${parentClientNames.slice(parentClientNames.length - 1).join("")}${clientName}`;
95
- return clientName;
96
- }
97
- function fromSdkEndpointParameter(p) {
98
- if (p.type.kind === "union") {
99
- return fromSdkEndpointType(p.type.variantTypes[0]);
100
- }
101
- else {
102
- return fromSdkEndpointType(p.type);
103
- }
104
- }
105
- function fromSdkEndpointType(type) {
106
- // TODO: support free-style endpoint url with multiple parameters
107
- const endpointExpr = type.serverUrl
108
- .replace("https://", "")
109
- .replace("http://", "")
110
- .split("/")[0];
111
- if (!/^\{\w+\}$/.test(endpointExpr)) {
112
- sdkContext.logger.reportDiagnostic({
113
- code: "unsupported-endpoint-url",
114
- format: { endpoint: type.serverUrl },
115
- target: NoTarget,
116
- });
117
- return [];
118
- }
119
- const endpointVariableName = endpointExpr.substring(1, endpointExpr.length - 1);
120
- const parameters = [];
121
- for (const parameter of type.templateArguments) {
122
- const isEndpoint = parameter.name === endpointVariableName;
123
- const parameterType = isEndpoint
124
- ? {
125
- kind: "url",
126
- name: "url",
127
- crossLanguageDefinitionId: "TypeSpec.url",
128
- }
129
- : fromSdkType(sdkContext, parameter.type); // TODO: consolidate with converter.fromSdkEndpointType
130
- parameters.push({
131
- Name: parameter.name,
132
- NameInRequest: parameter.serializedName,
133
- Summary: parameter.summary,
134
- Doc: parameter.doc,
135
- // TODO: we should do the magic in generator
136
- Type: parameterType,
137
- Location: RequestLocation.Uri,
138
- IsApiVersion: parameter.isApiVersionParam,
139
- IsResourceParameter: false,
140
- IsContentType: false,
141
- IsRequired: !parameter.optional,
142
- IsEndpoint: isEndpoint,
143
- SkipUrlEncoding: false,
144
- Explode: false,
145
- Kind: InputOperationParameterKind.Client,
146
- DefaultValue: getParameterDefaultValue(sdkContext, parameter.clientDefaultValue, parameterType),
147
- });
148
- }
149
- return parameters;
150
- }
151
- }
152
- function getMethodUri(p) {
153
- if (!p)
154
- return "";
155
- if (p.type.kind === "endpoint" && p.type.templateArguments.length > 0)
156
- return p.type.serverUrl;
157
- if (p.type.kind === "union" && p.type.variantTypes.length > 0)
158
- return p.type.variantTypes[0].serverUrl;
159
- return `{${p.name}}`;
160
- }
161
- //# sourceMappingURL=client-model-builder.js.map
@@ -1 +0,0 @@
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,EAML,UAAU,GACX,MAAM,6CAA6C,CAAC;AACrD,OAAO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BAAwB,CACpC,UAAU,EACV,SAAS,CAAC,kBAAkB,EAC5B,aAAa,CACd;aACF,CAAC,CAAC;QACL,CAAC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,CAAmC;IACvD,IAAI,CAAC,CAAC;QAAE,OAAO,EAAE,CAAC;IAElB,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,IAAI,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;IAE/F,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC;QAC3D,OAAQ,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAqB,CAAC,SAAS,CAAC;IAE/D,OAAO,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC;AACvB,CAAC"}
@@ -1,10 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,17 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,7 +0,0 @@
1
- import { SdkHttpOperationExample, SdkHttpParameter, SdkHttpResponse } from "@azure-tools/typespec-client-generator-core";
2
- import { CSharpEmitterContext } from "../sdk-context.js";
3
- import { InputHttpOperationExample } from "../type/input-examples.js";
4
- import { InputParameter } from "../type/input-parameter.js";
5
- import { OperationResponse } from "../type/operation-response.js";
6
- export declare function fromSdkHttpExamples(sdkContext: CSharpEmitterContext, examples: SdkHttpOperationExample[], parameterMap: Map<SdkHttpParameter, InputParameter>, responseMap: Map<SdkHttpResponse, OperationResponse>): InputHttpOperationExample[];
7
- //# sourceMappingURL=example-converter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"example-converter.d.ts","sourceRoot":"","sources":["../../../emitter/src/lib/example-converter.ts"],"names":[],"mappings":"AAGA,OAAO,EAKL,uBAAuB,EACvB,gBAAgB,EAEhB,eAAe,EAQhB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAKL,yBAAyB,EAS1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAS5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGlE,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,oBAAoB,EAChC,QAAQ,EAAE,uBAAuB,EAAE,EACnC,YAAY,EAAE,GAAG,CAAC,gBAAgB,EAAE,cAAc,CAAC,EACnD,WAAW,EAAE,GAAG,CAAC,eAAe,EAAE,iBAAiB,CAAC,GACnD,yBAAyB,EAAE,CA0J7B"}
@@ -1,131 +0,0 @@
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 { fromSdkType } from "./type-converter.js";
4
- export function fromSdkHttpExamples(sdkContext, examples, parameterMap, responseMap) {
5
- return examples.map((example) => fromSdkHttpExample(example));
6
- function fromSdkHttpExample(example) {
7
- return {
8
- kind: "http",
9
- name: example.name,
10
- description: example.description,
11
- filePath: example.filePath,
12
- parameters: example.parameters.map((p) => fromSdkParameterExample(p)),
13
- responses: fromSdkOperationResponses(example.responses),
14
- };
15
- }
16
- function fromSdkParameterExample(parameter) {
17
- return {
18
- parameter: parameterMap.get(parameter.parameter),
19
- value: fromSdkExample(parameter.value),
20
- };
21
- }
22
- function fromSdkOperationResponses(responses) {
23
- const result = [];
24
- for (const response of responses) {
25
- result.push(fromSdkOperationResponse(response));
26
- }
27
- return result;
28
- }
29
- function fromSdkOperationResponse(response) {
30
- return {
31
- response: responseMap.get(response.response),
32
- statusCode: response.statusCode,
33
- bodyValue: response.bodyValue ? fromSdkExample(response.bodyValue) : undefined,
34
- };
35
- }
36
- function fromSdkExample(example) {
37
- switch (example.kind) {
38
- case "string":
39
- return fromSdkStringExample(example);
40
- case "number":
41
- return fromSdkNumberExample(example);
42
- case "boolean":
43
- return fromSdkBooleanExample(example);
44
- case "union":
45
- return fromSdkUnionExample(example);
46
- case "array":
47
- return fromSdkArrayExample(example);
48
- case "dict":
49
- return fromSdkDictionaryExample(example);
50
- case "model":
51
- return fromSdkModelExample(example);
52
- case "unknown":
53
- return fromSdkAnyExample(example);
54
- case "null":
55
- return fromSdkNullExample(example);
56
- }
57
- }
58
- function fromSdkStringExample(example) {
59
- return {
60
- kind: "string",
61
- type: fromSdkType(sdkContext, example.type),
62
- value: example.value,
63
- };
64
- }
65
- function fromSdkNumberExample(example) {
66
- return {
67
- kind: "number",
68
- type: fromSdkType(sdkContext, example.type),
69
- value: example.value,
70
- };
71
- }
72
- function fromSdkBooleanExample(example) {
73
- return {
74
- kind: example.kind,
75
- type: fromSdkType(sdkContext, example.type),
76
- value: example.value,
77
- };
78
- }
79
- function fromSdkUnionExample(example) {
80
- return {
81
- kind: example.kind,
82
- type: fromSdkType(sdkContext, example.type),
83
- value: example.value,
84
- };
85
- }
86
- function fromSdkArrayExample(example) {
87
- return {
88
- kind: example.kind,
89
- type: fromSdkType(sdkContext, example.type),
90
- value: example.value.map((v) => fromSdkExample(v)),
91
- };
92
- }
93
- function fromSdkDictionaryExample(example) {
94
- return {
95
- kind: example.kind,
96
- type: fromSdkType(sdkContext, example.type),
97
- value: fromExampleRecord(example.value),
98
- };
99
- }
100
- function fromSdkModelExample(example) {
101
- return {
102
- kind: example.kind,
103
- type: fromSdkType(sdkContext, example.type),
104
- value: fromExampleRecord(example.value),
105
- additionalPropertiesValue: example.additionalPropertiesValue
106
- ? fromExampleRecord(example.additionalPropertiesValue)
107
- : undefined,
108
- };
109
- }
110
- function fromSdkAnyExample(example) {
111
- return {
112
- kind: example.kind,
113
- type: fromSdkType(sdkContext, example.type),
114
- value: example.value,
115
- };
116
- }
117
- function fromSdkNullExample(example) {
118
- return {
119
- kind: example.kind,
120
- type: fromSdkType(sdkContext, example.type),
121
- value: example.value,
122
- };
123
- }
124
- function fromExampleRecord(value) {
125
- return Object.entries(value).reduce((acc, [key, value]) => {
126
- acc[key] = fromSdkExample(value);
127
- return acc;
128
- }, {});
129
- }
130
- }
131
- //# sourceMappingURL=example-converter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"example-converter.js","sourceRoot":"","sources":["../../../emitter/src/lib/example-converter.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,+FAA+F;AA6C/F,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,MAAM,UAAU,mBAAmB,CACjC,UAAgC,EAChC,QAAmC,EACnC,YAAmD,EACnD,WAAoD;IAEpD,OAAO,QAAQ,CAAC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AAO,CAAC,KAAK;SACrB,CAAC;IACJ,CAAC;IAED,SAAS,kBAAkB,CAAC,OAA4B;QACtD,OAAO;YACL,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,IAAI,EAAE,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC,IAAI,CAAsB;YAChE,KAAK,EAAE,OAAO,CAAC,KAAK;SACrB,CAAC;IACJ,CAAC;IAED,SAAS,iBAAiB,CACxB,KAAsC;QAEtC,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CACjC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YACpB,GAAG,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;YACjC,OAAO,GAAG,CAAC;QACb,CAAC,EACD,EAAuC,CACxC,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1,32 +0,0 @@
1
- import { DiagnosticDefinition, DiagnosticMessages } from "@typespec/compiler";
2
- export type DiagnosticMessagesMap = {
3
- [K in keyof typeof diags]: (typeof diags)[K]["messages"];
4
- };
5
- declare const diags: {
6
- [code: string]: DiagnosticDefinition<DiagnosticMessages>;
7
- };
8
- /**
9
- * Reports a diagnostic. Defined in the core compiler.
10
- * @beta
11
- */
12
- export declare const reportDiagnostic: <C extends string | number, M extends keyof {
13
- [x: string]: any;
14
- }[C]>(program: import("@typespec/compiler").Program, diag: import("@typespec/compiler").DiagnosticReport<{
15
- [x: string]: any;
16
- }, C, M>) => void;
17
- /**
18
- * Creates a diagnostic. Defined in the core compiler.
19
- * @beta
20
- */
21
- export declare const createDiagnostic: <C extends string | number, M extends keyof {
22
- [x: string]: any;
23
- }[C]>(diag: import("@typespec/compiler").DiagnosticReport<{
24
- [x: string]: any;
25
- }, C, M>) => import("@typespec/compiler").Diagnostic;
26
- /**
27
- * Gets a tracer. Defined in the core compiler.
28
- * @beta
29
- */
30
- export declare const getTracer: (program: import("@typespec/compiler").Program) => import("@typespec/compiler").Tracer;
31
- export {};
32
- //# sourceMappingURL=lib.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../../emitter/src/lib/lib.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,oBAAoB,EACpB,kBAAkB,EAEnB,MAAM,oBAAoB,CAAC;AAG5B,MAAM,MAAM,qBAAqB,GAAG;KACjC,CAAC,IAAI,MAAM,OAAO,KAAK,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;CACzD,CAAC;AAEF,QAAA,MAAM,KAAK,EAAE;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,CAAA;CAmFtE,CAAC;AAUF;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;iBAAwB,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;oDAAwB,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,SAAS,wFAAiB,CAAC"}
@@ -1,110 +0,0 @@
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 { CSharpEmitterOptionsSchema } from "../options.js";
5
- const diags = {
6
- "no-apiVersion": {
7
- severity: "error",
8
- messages: {
9
- default: paramMessage `No APIVersion Provider for service ${"service"}`,
10
- },
11
- },
12
- "no-route": {
13
- severity: "error",
14
- messages: {
15
- default: paramMessage `No Route for service for service ${"service"}`,
16
- },
17
- },
18
- "general-warning": {
19
- severity: "warning",
20
- messages: {
21
- default: paramMessage `${"message"}`,
22
- },
23
- },
24
- "general-error": {
25
- severity: "error",
26
- messages: {
27
- default: paramMessage `${"message"}`,
28
- },
29
- },
30
- "invalid-dotnet-sdk-dependency": {
31
- severity: "error",
32
- messages: {
33
- default: paramMessage `Invalid .NET SDK installed.`,
34
- missing: paramMessage `The dotnet command was not found in the PATH. Please install the .NET SDK version ${"dotnetMajorVersion"} or above. Guidance for installing the .NET SDK can be found at ${"downloadUrl"}.`,
35
- invalidVersion: paramMessage `The .NET SDK found is version ${"installedVersion"}. Please install the .NET SDK ${"dotnetMajorVersion"} or above and ensure there is no global.json in the file system requesting a lower version. Guidance for installing the .NET SDK can be found at ${"downloadUrl"}.`,
36
- },
37
- },
38
- "no-root-client": {
39
- severity: "error",
40
- messages: {
41
- default: "Cannot generate CSharp SDK since no public root client is defined in typespec file.",
42
- },
43
- },
44
- "unsupported-auth": {
45
- severity: "warning",
46
- messages: {
47
- default: paramMessage `${"message"}`,
48
- onlyUnsupportedAuthProvided: `No supported authentication methods were provided. No public client constructors will be generated. Please provide your own custom constructor for client instantiation.`,
49
- },
50
- },
51
- "client-namespace-conflict": {
52
- severity: "warning",
53
- messages: {
54
- default: paramMessage `namespace ${"clientNamespace"} conflicts with client ${"clientName"}, please use @clientName to specify a different name for the client.`,
55
- },
56
- },
57
- "unsupported-endpoint-url": {
58
- severity: "error",
59
- messages: {
60
- default: paramMessage `Unsupported server endpoint URL: ${"endpoint"}`,
61
- },
62
- },
63
- "unsupported-sdk-type": {
64
- severity: "error",
65
- messages: {
66
- default: paramMessage `Unsupported SDK type: ${"sdkType"}.`,
67
- },
68
- },
69
- "unsupported-default-value-type": {
70
- severity: "error",
71
- messages: {
72
- default: paramMessage `Unsupported default value type: ${"valueType"}.`,
73
- },
74
- },
75
- "unsupported-cookie-parameter": {
76
- severity: "error",
77
- messages: {
78
- default: paramMessage `Cookie parameter is not supported: ${"parameterName"}, found in operation ${"path"}`,
79
- },
80
- },
81
- "unsupported-patch-convenience-method": {
82
- severity: "warning",
83
- messages: {
84
- default: paramMessage `Convenience method is not supported for PATCH method, it will be turned off. Please set the '@convenientAPI' to false for operation ${"methodCrossLanguageDefinitionId"}.`,
85
- },
86
- },
87
- };
88
- const $lib = createTypeSpecLibrary({
89
- name: "@typespec/http-client-csharp",
90
- diagnostics: diags,
91
- emitter: {
92
- options: CSharpEmitterOptionsSchema,
93
- },
94
- });
95
- /**
96
- * Reports a diagnostic. Defined in the core compiler.
97
- * @beta
98
- */
99
- export const reportDiagnostic = $lib.reportDiagnostic;
100
- /**
101
- * Creates a diagnostic. Defined in the core compiler.
102
- * @beta
103
- */
104
- export const createDiagnostic = $lib.createDiagnostic;
105
- /**
106
- * Gets a tracer. Defined in the core compiler.
107
- * @beta
108
- */
109
- export const getTracer = $lib.getTracer;
110
- //# sourceMappingURL=lib.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lib.js","sourceRoot":"","sources":["../../../emitter/src/lib/lib.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,+FAA+F;AAE/F,OAAO,EACL,qBAAqB,EAGrB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAM3D,MAAM,KAAK,GAAiE;IAC1E,eAAe,EAAE;QACf,QAAQ,EAAE,OAAO;QACjB,QAAQ,EAAE;YACR,OAAO,EAAE,YAAY,CAAA,sCAAsC,SAAS,EAAE;SACvE;KACF;IACD,UAAU,EAAE;QACV,QAAQ,EAAE,OAAO;QACjB,QAAQ,EAAE;YACR,OAAO,EAAE,YAAY,CAAA,oCAAoC,SAAS,EAAE;SACrE;KACF;IACD,iBAAiB,EAAE;QACjB,QAAQ,EAAE,SAAS;QACnB,QAAQ,EAAE;YACR,OAAO,EAAE,YAAY,CAAA,GAAG,SAAS,EAAE;SACpC;KACF;IACD,eAAe,EAAE;QACf,QAAQ,EAAE,OAAO;QACjB,QAAQ,EAAE;YACR,OAAO,EAAE,YAAY,CAAA,GAAG,SAAS,EAAE;SACpC;KACF;IACD,+BAA+B,EAAE;QAC/B,QAAQ,EAAE,OAAO;QACjB,QAAQ,EAAE;YACR,OAAO,EAAE,YAAY,CAAA,6BAA6B;YAClD,OAAO,EAAE,YAAY,CAAA,qFAAqF,oBAAoB,mEAAmE,aAAa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AK;IAClB,OAAO,EAAE;QACP,OAAO,EAAE,0BAA0B;KACpC;CACF,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC;AAEtD;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC;AAEtD;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * The Logger level to use for logging. The default is `info`.
3
- * @beta
4
- */
5
- export declare enum LoggerLevel {
6
- INFO = "info",
7
- DEBUG = "debug",
8
- VERBOSE = "verbose"
9
- }
10
- //# sourceMappingURL=logger-level.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger-level.d.ts","sourceRoot":"","sources":["../../../emitter/src/lib/logger-level.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,oBAAY,WAAW;IACrB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,OAAO,YAAY;CACpB"}
@@ -1,13 +0,0 @@
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
- /**
4
- * The Logger level to use for logging. The default is `info`.
5
- * @beta
6
- */
7
- export var LoggerLevel;
8
- (function (LoggerLevel) {
9
- LoggerLevel["INFO"] = "info";
10
- LoggerLevel["DEBUG"] = "debug";
11
- LoggerLevel["VERBOSE"] = "verbose";
12
- })(LoggerLevel || (LoggerLevel = {}));
13
- //# sourceMappingURL=logger-level.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger-level.js","sourceRoot":"","sources":["../../../emitter/src/lib/logger-level.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,+FAA+F;AAE/F;;;GAGG;AACH,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,8BAAe,CAAA;IACf,kCAAmB,CAAA;AACrB,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB"}
@@ -1,20 +0,0 @@
1
- import { DiagnosticReport, Program } from "@typespec/compiler";
2
- import { DiagnosticMessagesMap } from "./lib.js";
3
- import { LoggerLevel } from "./logger-level.js";
4
- /**
5
- * The Logger class for the emitter.
6
- * @beta
7
- */
8
- export declare class Logger {
9
- private tracer;
10
- private level;
11
- private program;
12
- constructor(program: Program, level: LoggerLevel);
13
- info(message: string): void;
14
- debug(message: string): void;
15
- verbose(message: string): void;
16
- reportDiagnostic<C extends keyof DiagnosticMessagesMap, M extends keyof DiagnosticMessagesMap[C]>(diag: DiagnosticReport<DiagnosticMessagesMap, C, M>): void;
17
- warn(message: string): void;
18
- error(message: string): void;
19
- }
20
- //# sourceMappingURL=logger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../emitter/src/lib/logger.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAY,OAAO,EAAU,MAAM,oBAAoB,CAAC;AACjF,OAAO,EACL,qBAAqB,EAGtB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;GAGG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,OAAO,CAAU;gBAEN,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW;IAMvD,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAU3B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAM5B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAM9B,gBAAgB,CAAC,CAAC,SAAS,MAAM,qBAAqB,EAAE,CAAC,SAAS,MAAM,qBAAqB,CAAC,CAAC,CAAC,EAC9F,IAAI,EAAE,gBAAgB,CAAC,qBAAqB,EAAE,CAAC,EAAE,CAAC,CAAC,GAClD,IAAI;IAIP,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAQ3B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAO7B"}
@@ -1,54 +0,0 @@
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 as libReportDiagnostic, } from "./lib.js";
5
- import { LoggerLevel } from "./logger-level.js";
6
- /**
7
- * The Logger class for the emitter.
8
- * @beta
9
- */
10
- export class Logger {
11
- tracer;
12
- level;
13
- program;
14
- constructor(program, level) {
15
- this.tracer = getTracer(program);
16
- this.level = level;
17
- this.program = program;
18
- }
19
- info(message) {
20
- if (this.level === LoggerLevel.INFO ||
21
- this.level === LoggerLevel.DEBUG ||
22
- this.level === LoggerLevel.VERBOSE) {
23
- this.tracer.trace(LoggerLevel.INFO, message);
24
- }
25
- }
26
- debug(message) {
27
- if (this.level === LoggerLevel.DEBUG || this.level === LoggerLevel.VERBOSE) {
28
- this.tracer.trace(LoggerLevel.DEBUG, message);
29
- }
30
- }
31
- verbose(message) {
32
- if (this.level === LoggerLevel.VERBOSE) {
33
- this.tracer.trace(LoggerLevel.VERBOSE, message);
34
- }
35
- }
36
- reportDiagnostic(diag) {
37
- libReportDiagnostic(this.program, diag);
38
- }
39
- warn(message) {
40
- this.reportDiagnostic({
41
- code: "general-warning",
42
- format: { message: message },
43
- target: NoTarget,
44
- });
45
- }
46
- error(message) {
47
- this.reportDiagnostic({
48
- code: "general-error",
49
- format: { message: message },
50
- target: NoTarget,
51
- });
52
- }
53
- }
54
- //# sourceMappingURL=logger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../emitter/src/lib/logger.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,+FAA+F;AAE/F,OAAO,EAAoB,QAAQ,EAAmB,MAAM,oBAAo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,CAAC;IAC1C,CAAC;IAED,IAAI,CAAC,OAAe;QAClB,IAAI,CAAC,gBAAgB,CAAC;YACpB,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,IAAI,CAAC,gBAAgB,CAAC;YACpB,IAAI,EAAE,eAAe;YACrB,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;YAC5B,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,8 +0,0 @@
1
- import { Operation, Type } from "@typespec/compiler";
2
- import { CSharpEmitterContext } from "../sdk-context.js";
3
- import { InputType } from "../type/input-type.js";
4
- import { LiteralTypeContext } from "../type/literal-type-context.js";
5
- export declare function getDefaultValue(type: Type): any;
6
- export declare function getInputType(context: CSharpEmitterContext, type: Type, operation?: Operation, literalTypeContext?: LiteralTypeContext): InputType;
7
- export declare function navigateModels(sdkContext: CSharpEmitterContext): void;
8
- //# sourceMappingURL=model.d.ts.map