@azure-tools/typespec-ts 0.54.0 → 0.54.1

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 (522) hide show
  1. package/CHANGELOG.md +25 -10
  2. package/README.md +0 -4
  3. package/dist/src/contextManager.d.ts +5 -5
  4. package/dist/src/contextManager.d.ts.map +1 -1
  5. package/dist/src/contextManager.js +3 -3
  6. package/dist/src/contextManager.js.map +1 -1
  7. package/dist/src/framework/declaration.d.ts +1 -1
  8. package/dist/src/framework/declaration.d.ts.map +1 -1
  9. package/dist/src/framework/declaration.js +2 -4
  10. package/dist/src/framework/declaration.js.map +1 -1
  11. package/dist/src/framework/dependency.d.ts.map +1 -1
  12. package/dist/src/framework/hooks/binder.d.ts +1 -1
  13. package/dist/src/framework/hooks/binder.d.ts.map +1 -1
  14. package/dist/src/framework/hooks/binder.js +31 -40
  15. package/dist/src/framework/hooks/binder.js.map +1 -1
  16. package/dist/src/framework/hooks/sdkTypes.d.ts +1 -1
  17. package/dist/src/framework/hooks/sdkTypes.d.ts.map +1 -1
  18. package/dist/src/framework/hooks/sdkTypes.js +8 -12
  19. package/dist/src/framework/hooks/sdkTypes.js.map +1 -1
  20. package/dist/src/framework/hooks/useDependencies.d.ts.map +1 -1
  21. package/dist/src/framework/hooks/useDependencies.js +1 -1
  22. package/dist/src/framework/hooks/useDependencies.js.map +1 -1
  23. package/dist/src/framework/load-static-helpers.d.ts +1 -1
  24. package/dist/src/framework/load-static-helpers.d.ts.map +1 -1
  25. package/dist/src/framework/load-static-helpers.js +17 -31
  26. package/dist/src/framework/load-static-helpers.js.map +1 -1
  27. package/dist/src/framework/reference.d.ts.map +1 -1
  28. package/dist/src/framework/reference.js +2 -2
  29. package/dist/src/framework/reference.js.map +1 -1
  30. package/dist/src/framework/sample.js +8 -8
  31. package/dist/src/framework/sample.js.map +1 -1
  32. package/dist/src/index.d.ts +1 -1
  33. package/dist/src/index.d.ts.map +1 -1
  34. package/dist/src/index.js +103 -92
  35. package/dist/src/index.js.map +1 -1
  36. package/dist/src/lib.d.ts +1 -1
  37. package/dist/src/lib.d.ts.map +1 -1
  38. package/dist/src/lib.js +140 -140
  39. package/dist/src/lib.js.map +1 -1
  40. package/dist/src/metaTree.d.ts +1 -1
  41. package/dist/src/metaTree.d.ts.map +1 -1
  42. package/dist/src/modular/buildClassicalClient.d.ts +1 -1
  43. package/dist/src/modular/buildClassicalClient.d.ts.map +1 -1
  44. package/dist/src/modular/buildClassicalClient.js +60 -74
  45. package/dist/src/modular/buildClassicalClient.js.map +1 -1
  46. package/dist/src/modular/buildClassicalOperationGroups.d.ts +2 -2
  47. package/dist/src/modular/buildClassicalOperationGroups.d.ts.map +1 -1
  48. package/dist/src/modular/buildClassicalOperationGroups.js +8 -10
  49. package/dist/src/modular/buildClassicalOperationGroups.js.map +1 -1
  50. package/dist/src/modular/buildClientContext.d.ts +2 -2
  51. package/dist/src/modular/buildClientContext.d.ts.map +1 -1
  52. package/dist/src/modular/buildClientContext.js +31 -38
  53. package/dist/src/modular/buildClientContext.js.map +1 -1
  54. package/dist/src/modular/buildModularOptions.d.ts +1 -1
  55. package/dist/src/modular/buildModularOptions.d.ts.map +1 -1
  56. package/dist/src/modular/buildModularOptions.js +5 -6
  57. package/dist/src/modular/buildModularOptions.js.map +1 -1
  58. package/dist/src/modular/buildOperations.d.ts +3 -3
  59. package/dist/src/modular/buildOperations.d.ts.map +1 -1
  60. package/dist/src/modular/buildOperations.js +23 -25
  61. package/dist/src/modular/buildOperations.js.map +1 -1
  62. package/dist/src/modular/buildProjectFiles.d.ts +1 -1
  63. package/dist/src/modular/buildProjectFiles.d.ts.map +1 -1
  64. package/dist/src/modular/buildProjectFiles.js +8 -11
  65. package/dist/src/modular/buildProjectFiles.js.map +1 -1
  66. package/dist/src/modular/buildRestorePoller.d.ts +1 -1
  67. package/dist/src/modular/buildRestorePoller.d.ts.map +1 -1
  68. package/dist/src/modular/buildRestorePoller.js +12 -13
  69. package/dist/src/modular/buildRestorePoller.js.map +1 -1
  70. package/dist/src/modular/buildRootIndex.d.ts +2 -2
  71. package/dist/src/modular/buildRootIndex.d.ts.map +1 -1
  72. package/dist/src/modular/buildRootIndex.js +36 -50
  73. package/dist/src/modular/buildRootIndex.js.map +1 -1
  74. package/dist/src/modular/buildSubpathIndex.d.ts.map +1 -1
  75. package/dist/src/modular/buildSubpathIndex.js +9 -18
  76. package/dist/src/modular/buildSubpathIndex.js.map +1 -1
  77. package/dist/src/modular/emitLoggerFile.d.ts.map +1 -1
  78. package/dist/src/modular/emitLoggerFile.js +4 -4
  79. package/dist/src/modular/emitLoggerFile.js.map +1 -1
  80. package/dist/src/modular/emitModels.d.ts +1 -1
  81. package/dist/src/modular/emitModels.d.ts.map +1 -1
  82. package/dist/src/modular/emitModels.js +81 -113
  83. package/dist/src/modular/emitModels.js.map +1 -1
  84. package/dist/src/modular/emitModelsOptions.d.ts +1 -1
  85. package/dist/src/modular/emitModelsOptions.d.ts.map +1 -1
  86. package/dist/src/modular/emitModelsOptions.js +7 -8
  87. package/dist/src/modular/emitModelsOptions.js.map +1 -1
  88. package/dist/src/modular/emitSamples.d.ts.map +1 -1
  89. package/dist/src/modular/emitSamples.js +69 -77
  90. package/dist/src/modular/emitSamples.js.map +1 -1
  91. package/dist/src/modular/emitTests.d.ts.map +1 -1
  92. package/dist/src/modular/emitTests.js +13 -18
  93. package/dist/src/modular/emitTests.js.map +1 -1
  94. package/dist/src/modular/external-dependencies.js +54 -54
  95. package/dist/src/modular/helpers/classicalOperationHelpers.d.ts +1 -1
  96. package/dist/src/modular/helpers/classicalOperationHelpers.d.ts.map +1 -1
  97. package/dist/src/modular/helpers/classicalOperationHelpers.js +59 -68
  98. package/dist/src/modular/helpers/classicalOperationHelpers.js.map +1 -1
  99. package/dist/src/modular/helpers/clientHelpers.d.ts +2 -2
  100. package/dist/src/modular/helpers/clientHelpers.d.ts.map +1 -1
  101. package/dist/src/modular/helpers/clientHelpers.js +31 -54
  102. package/dist/src/modular/helpers/clientHelpers.js.map +1 -1
  103. package/dist/src/modular/helpers/clientOptionHelpers.d.ts.map +1 -1
  104. package/dist/src/modular/helpers/clientOptionHelpers.js +1 -1
  105. package/dist/src/modular/helpers/clientOptionHelpers.js.map +1 -1
  106. package/dist/src/modular/helpers/exampleValueHelpers.d.ts +2 -2
  107. package/dist/src/modular/helpers/exampleValueHelpers.d.ts.map +1 -1
  108. package/dist/src/modular/helpers/exampleValueHelpers.js +72 -84
  109. package/dist/src/modular/helpers/exampleValueHelpers.js.map +1 -1
  110. package/dist/src/modular/helpers/namingHelpers.d.ts +1 -1
  111. package/dist/src/modular/helpers/namingHelpers.d.ts.map +1 -1
  112. package/dist/src/modular/helpers/namingHelpers.js +7 -10
  113. package/dist/src/modular/helpers/namingHelpers.js.map +1 -1
  114. package/dist/src/modular/helpers/operationHelpers.d.ts +2 -2
  115. package/dist/src/modular/helpers/operationHelpers.d.ts.map +1 -1
  116. package/dist/src/modular/helpers/operationHelpers.js +204 -288
  117. package/dist/src/modular/helpers/operationHelpers.js.map +1 -1
  118. package/dist/src/modular/helpers/typeHelpers.d.ts +1 -1
  119. package/dist/src/modular/helpers/typeHelpers.d.ts.map +1 -1
  120. package/dist/src/modular/helpers/typeHelpers.js +4 -6
  121. package/dist/src/modular/helpers/typeHelpers.js.map +1 -1
  122. package/dist/src/modular/serialization/buildDeserializerFunction.d.ts +1 -1
  123. package/dist/src/modular/serialization/buildDeserializerFunction.d.ts.map +1 -1
  124. package/dist/src/modular/serialization/buildDeserializerFunction.js +58 -67
  125. package/dist/src/modular/serialization/buildDeserializerFunction.js.map +1 -1
  126. package/dist/src/modular/serialization/buildSerializerFunction.d.ts +1 -1
  127. package/dist/src/modular/serialization/buildSerializerFunction.d.ts.map +1 -1
  128. package/dist/src/modular/serialization/buildSerializerFunction.js +65 -75
  129. package/dist/src/modular/serialization/buildSerializerFunction.js.map +1 -1
  130. package/dist/src/modular/serialization/buildXmlSerializerFunction.d.ts +1 -1
  131. package/dist/src/modular/serialization/buildXmlSerializerFunction.d.ts.map +1 -1
  132. package/dist/src/modular/serialization/buildXmlSerializerFunction.js +73 -90
  133. package/dist/src/modular/serialization/buildXmlSerializerFunction.js.map +1 -1
  134. package/dist/src/modular/serialization/serializeUtils.d.ts.map +1 -1
  135. package/dist/src/modular/serialization/serializeUtils.js +25 -33
  136. package/dist/src/modular/serialization/serializeUtils.js.map +1 -1
  137. package/dist/src/modular/static-helpers-metadata.js +60 -60
  138. package/dist/src/modular/type-expressions/get-credential-expression.js +1 -1
  139. package/dist/src/modular/type-expressions/get-credential-expression.js.map +1 -1
  140. package/dist/src/modular/type-expressions/get-enum-expression.d.ts +1 -1
  141. package/dist/src/modular/type-expressions/get-enum-expression.d.ts.map +1 -1
  142. package/dist/src/modular/type-expressions/get-enum-expression.js +1 -2
  143. package/dist/src/modular/type-expressions/get-enum-expression.js.map +1 -1
  144. package/dist/src/modular/type-expressions/get-model-expression.d.ts.map +1 -1
  145. package/dist/src/modular/type-expressions/get-model-expression.js +10 -13
  146. package/dist/src/modular/type-expressions/get-model-expression.js.map +1 -1
  147. package/dist/src/modular/type-expressions/get-nullable-expression.d.ts +1 -1
  148. package/dist/src/modular/type-expressions/get-nullable-expression.d.ts.map +1 -1
  149. package/dist/src/modular/type-expressions/get-nullable-expression.js +2 -3
  150. package/dist/src/modular/type-expressions/get-nullable-expression.js.map +1 -1
  151. package/dist/src/modular/type-expressions/get-type-expression.d.ts.map +1 -1
  152. package/dist/src/modular/type-expressions/get-type-expression.js +5 -11
  153. package/dist/src/modular/type-expressions/get-type-expression.js.map +1 -1
  154. package/dist/src/modular/type-expressions/get-union-expression.d.ts +1 -1
  155. package/dist/src/modular/type-expressions/get-union-expression.d.ts.map +1 -1
  156. package/dist/src/modular/type-expressions/get-union-expression.js.map +1 -1
  157. package/dist/src/rlc-common/buildClient.d.ts +1 -1
  158. package/dist/src/rlc-common/buildClient.d.ts.map +1 -1
  159. package/dist/src/rlc-common/buildClient.js +67 -89
  160. package/dist/src/rlc-common/buildClient.js.map +1 -1
  161. package/dist/src/rlc-common/buildClientDefinitions.d.ts.map +1 -1
  162. package/dist/src/rlc-common/buildClientDefinitions.js +28 -45
  163. package/dist/src/rlc-common/buildClientDefinitions.js.map +1 -1
  164. package/dist/src/rlc-common/buildIndexFile.d.ts.map +1 -1
  165. package/dist/src/rlc-common/buildIndexFile.js +59 -60
  166. package/dist/src/rlc-common/buildIndexFile.js.map +1 -1
  167. package/dist/src/rlc-common/buildIsUnexpectedHelper.d.ts.map +1 -1
  168. package/dist/src/rlc-common/buildIsUnexpectedHelper.js +37 -38
  169. package/dist/src/rlc-common/buildIsUnexpectedHelper.js.map +1 -1
  170. package/dist/src/rlc-common/buildLogger.d.ts.map +1 -1
  171. package/dist/src/rlc-common/buildLogger.js +4 -5
  172. package/dist/src/rlc-common/buildLogger.js.map +1 -1
  173. package/dist/src/rlc-common/buildMethodShortcuts.d.ts.map +1 -1
  174. package/dist/src/rlc-common/buildMethodShortcuts.js +4 -4
  175. package/dist/src/rlc-common/buildMethodShortcuts.js.map +1 -1
  176. package/dist/src/rlc-common/buildObjectTypes.d.ts.map +1 -1
  177. package/dist/src/rlc-common/buildObjectTypes.js +57 -96
  178. package/dist/src/rlc-common/buildObjectTypes.js.map +1 -1
  179. package/dist/src/rlc-common/buildPaginateHelper.d.ts.map +1 -1
  180. package/dist/src/rlc-common/buildPaginateHelper.js +2 -2
  181. package/dist/src/rlc-common/buildPaginateHelper.js.map +1 -1
  182. package/dist/src/rlc-common/buildParameterTypes.d.ts.map +1 -1
  183. package/dist/src/rlc-common/buildParameterTypes.js +71 -61
  184. package/dist/src/rlc-common/buildParameterTypes.js.map +1 -1
  185. package/dist/src/rlc-common/buildPollingHelper.d.ts.map +1 -1
  186. package/dist/src/rlc-common/buildPollingHelper.js +9 -10
  187. package/dist/src/rlc-common/buildPollingHelper.js.map +1 -1
  188. package/dist/src/rlc-common/buildResponseTypes.d.ts.map +1 -1
  189. package/dist/src/rlc-common/buildResponseTypes.js +23 -27
  190. package/dist/src/rlc-common/buildResponseTypes.js.map +1 -1
  191. package/dist/src/rlc-common/buildSamples.d.ts +1 -1
  192. package/dist/src/rlc-common/buildSamples.d.ts.map +1 -1
  193. package/dist/src/rlc-common/buildSamples.js +2 -2
  194. package/dist/src/rlc-common/buildSchemaType.d.ts.map +1 -1
  195. package/dist/src/rlc-common/buildSchemaType.js +31 -13
  196. package/dist/src/rlc-common/buildSchemaType.js.map +1 -1
  197. package/dist/src/rlc-common/buildSerializeHelper.d.ts.map +1 -1
  198. package/dist/src/rlc-common/buildSerializeHelper.js +4 -4
  199. package/dist/src/rlc-common/buildSerializeHelper.js.map +1 -1
  200. package/dist/src/rlc-common/buildTopLevelIndexFile.d.ts.map +1 -1
  201. package/dist/src/rlc-common/buildTopLevelIndexFile.js +9 -13
  202. package/dist/src/rlc-common/buildTopLevelIndexFile.js.map +1 -1
  203. package/dist/src/rlc-common/helpers/apiVersionUtil.d.ts.map +1 -1
  204. package/dist/src/rlc-common/helpers/apiVersionUtil.js +6 -8
  205. package/dist/src/rlc-common/helpers/apiVersionUtil.js.map +1 -1
  206. package/dist/src/rlc-common/helpers/importsUtil.d.ts.map +1 -1
  207. package/dist/src/rlc-common/helpers/importsUtil.js +32 -37
  208. package/dist/src/rlc-common/helpers/importsUtil.js.map +1 -1
  209. package/dist/src/rlc-common/helpers/nameConstructors.d.ts.map +1 -1
  210. package/dist/src/rlc-common/helpers/nameConstructors.js +2 -4
  211. package/dist/src/rlc-common/helpers/nameConstructors.js.map +1 -1
  212. package/dist/src/rlc-common/helpers/nameUtils.d.ts.map +1 -1
  213. package/dist/src/rlc-common/helpers/nameUtils.js +17 -23
  214. package/dist/src/rlc-common/helpers/nameUtils.js.map +1 -1
  215. package/dist/src/rlc-common/helpers/operationHelpers.d.ts.map +1 -1
  216. package/dist/src/rlc-common/helpers/operationHelpers.js +16 -31
  217. package/dist/src/rlc-common/helpers/operationHelpers.js.map +1 -1
  218. package/dist/src/rlc-common/helpers/packageUtil.js +3 -6
  219. package/dist/src/rlc-common/helpers/packageUtil.js.map +1 -1
  220. package/dist/src/rlc-common/helpers/pathUtils.d.ts.map +1 -1
  221. package/dist/src/rlc-common/helpers/pathUtils.js +1 -3
  222. package/dist/src/rlc-common/helpers/pathUtils.js.map +1 -1
  223. package/dist/src/rlc-common/helpers/schemaHelpers.d.ts.map +1 -1
  224. package/dist/src/rlc-common/helpers/schemaHelpers.js +3 -7
  225. package/dist/src/rlc-common/helpers/schemaHelpers.js.map +1 -1
  226. package/dist/src/rlc-common/helpers/shortcutMethods.d.ts +1 -1
  227. package/dist/src/rlc-common/helpers/shortcutMethods.d.ts.map +1 -1
  228. package/dist/src/rlc-common/helpers/shortcutMethods.js +2 -2
  229. package/dist/src/rlc-common/helpers/shortcutMethods.js.map +1 -1
  230. package/dist/src/rlc-common/helpers/typeUtil.d.ts.map +1 -1
  231. package/dist/src/rlc-common/helpers/typeUtil.js +4 -9
  232. package/dist/src/rlc-common/helpers/typeUtil.js.map +1 -1
  233. package/dist/src/rlc-common/helpers/valueGenerationUtil.js +7 -11
  234. package/dist/src/rlc-common/helpers/valueGenerationUtil.js.map +1 -1
  235. package/dist/src/rlc-common/index.d.ts +28 -28
  236. package/dist/src/rlc-common/index.d.ts.map +1 -1
  237. package/dist/src/rlc-common/index.js +28 -28
  238. package/dist/src/rlc-common/index.js.map +1 -1
  239. package/dist/src/rlc-common/interfaces.d.ts.map +1 -1
  240. package/dist/src/rlc-common/interfaces.js.map +1 -1
  241. package/dist/src/rlc-common/metadata/buildApiExtractorConfig.d.ts.map +1 -1
  242. package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js +14 -15
  243. package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js.map +1 -1
  244. package/dist/src/rlc-common/metadata/buildChangelogFile.js +2 -3
  245. package/dist/src/rlc-common/metadata/buildChangelogFile.js.map +1 -1
  246. package/dist/src/rlc-common/metadata/buildESLintConfig.d.ts.map +1 -1
  247. package/dist/src/rlc-common/metadata/buildESLintConfig.js +5 -8
  248. package/dist/src/rlc-common/metadata/buildESLintConfig.js.map +1 -1
  249. package/dist/src/rlc-common/metadata/buildLicenseFile.js +1 -1
  250. package/dist/src/rlc-common/metadata/buildPackageFile.d.ts.map +1 -1
  251. package/dist/src/rlc-common/metadata/buildPackageFile.js +33 -37
  252. package/dist/src/rlc-common/metadata/buildPackageFile.js.map +1 -1
  253. package/dist/src/rlc-common/metadata/buildReadmeFile.d.ts.map +1 -1
  254. package/dist/src/rlc-common/metadata/buildReadmeFile.js +31 -39
  255. package/dist/src/rlc-common/metadata/buildReadmeFile.js.map +1 -1
  256. package/dist/src/rlc-common/metadata/buildRollupConfig.d.ts.map +1 -1
  257. package/dist/src/rlc-common/metadata/buildRollupConfig.js +4 -6
  258. package/dist/src/rlc-common/metadata/buildRollupConfig.js.map +1 -1
  259. package/dist/src/rlc-common/metadata/buildSampleEnvFile.d.ts.map +1 -1
  260. package/dist/src/rlc-common/metadata/buildSampleEnvFile.js +3 -5
  261. package/dist/src/rlc-common/metadata/buildSampleEnvFile.js.map +1 -1
  262. package/dist/src/rlc-common/metadata/buildTestConfig.js +11 -12
  263. package/dist/src/rlc-common/metadata/buildTestConfig.js.map +1 -1
  264. package/dist/src/rlc-common/metadata/buildTsConfig.d.ts.map +1 -1
  265. package/dist/src/rlc-common/metadata/buildTsConfig.js +28 -28
  266. package/dist/src/rlc-common/metadata/buildTsConfig.js.map +1 -1
  267. package/dist/src/rlc-common/metadata/buildVitestConfig.d.ts.map +1 -1
  268. package/dist/src/rlc-common/metadata/buildVitestConfig.js +3 -5
  269. package/dist/src/rlc-common/metadata/buildVitestConfig.js.map +1 -1
  270. package/dist/src/rlc-common/metadata/buildWarpConfig.d.ts.map +1 -1
  271. package/dist/src/rlc-common/metadata/buildWarpConfig.js +4 -5
  272. package/dist/src/rlc-common/metadata/buildWarpConfig.js.map +1 -1
  273. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts +1 -1
  274. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts.map +1 -1
  275. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js +14 -14
  276. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js.map +1 -1
  277. package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.d.ts.map +1 -1
  278. package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js +24 -29
  279. package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js.map +1 -1
  280. package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.d.ts.map +1 -1
  281. package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js +15 -16
  282. package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js.map +1 -1
  283. package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js +8 -8
  284. package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js.map +1 -1
  285. package/dist/src/rlc-common/metadata/packageJson/packageCommon.d.ts.map +1 -1
  286. package/dist/src/rlc-common/metadata/packageJson/packageCommon.js +28 -31
  287. package/dist/src/rlc-common/metadata/packageJson/packageCommon.js.map +1 -1
  288. package/dist/src/rlc-common/metadata/utils.js +1 -2
  289. package/dist/src/rlc-common/metadata/utils.js.map +1 -1
  290. package/dist/src/rlc-common/test/buildKarmaConfig.js +1 -1
  291. package/dist/src/rlc-common/test/buildRecordedClient.js +4 -5
  292. package/dist/src/rlc-common/test/buildRecordedClient.js.map +1 -1
  293. package/dist/src/rlc-common/test/buildSampleTest.d.ts.map +1 -1
  294. package/dist/src/rlc-common/test/buildSampleTest.js +3 -4
  295. package/dist/src/rlc-common/test/buildSampleTest.js.map +1 -1
  296. package/dist/src/rlc-common/test/buildSnippets.d.ts.map +1 -1
  297. package/dist/src/rlc-common/test/buildSnippets.js +7 -10
  298. package/dist/src/rlc-common/test/buildSnippets.js.map +1 -1
  299. package/dist/src/rlc-common/transformSampleGroups.d.ts.map +1 -1
  300. package/dist/src/rlc-common/transformSampleGroups.js +41 -45
  301. package/dist/src/rlc-common/transformSampleGroups.js.map +1 -1
  302. package/dist/src/testing/index.d.ts.map +1 -1
  303. package/dist/src/testing/index.js +1 -1
  304. package/dist/src/testing/index.js.map +1 -1
  305. package/dist/src/transform/transform.d.ts +1 -1
  306. package/dist/src/transform/transform.d.ts.map +1 -1
  307. package/dist/src/transform/transform.js +28 -27
  308. package/dist/src/transform/transform.js.map +1 -1
  309. package/dist/src/transform/transformApiVersionInfo.d.ts +1 -1
  310. package/dist/src/transform/transformApiVersionInfo.d.ts.map +1 -1
  311. package/dist/src/transform/transformApiVersionInfo.js +12 -14
  312. package/dist/src/transform/transformApiVersionInfo.js.map +1 -1
  313. package/dist/src/transform/transformHelperFunctionDetails.d.ts +1 -1
  314. package/dist/src/transform/transformHelperFunctionDetails.d.ts.map +1 -1
  315. package/dist/src/transform/transformHelperFunctionDetails.js +11 -14
  316. package/dist/src/transform/transformHelperFunctionDetails.js.map +1 -1
  317. package/dist/src/transform/transformParameters.d.ts +2 -2
  318. package/dist/src/transform/transformParameters.d.ts.map +1 -1
  319. package/dist/src/transform/transformParameters.js +32 -45
  320. package/dist/src/transform/transformParameters.js.map +1 -1
  321. package/dist/src/transform/transformPaths.d.ts +1 -1
  322. package/dist/src/transform/transformPaths.d.ts.map +1 -1
  323. package/dist/src/transform/transformPaths.js +19 -23
  324. package/dist/src/transform/transformPaths.js.map +1 -1
  325. package/dist/src/transform/transformResponses.d.ts +1 -1
  326. package/dist/src/transform/transformResponses.d.ts.map +1 -1
  327. package/dist/src/transform/transformResponses.js +21 -25
  328. package/dist/src/transform/transformResponses.js.map +1 -1
  329. package/dist/src/transform/transformSchemas.d.ts.map +1 -1
  330. package/dist/src/transform/transformSchemas.js +21 -32
  331. package/dist/src/transform/transformSchemas.js.map +1 -1
  332. package/dist/src/transform/transformTelemetryInfo.d.ts +1 -1
  333. package/dist/src/transform/transformTelemetryInfo.d.ts.map +1 -1
  334. package/dist/src/transform/transformTelemetryInfo.js +3 -3
  335. package/dist/src/transform/transformTelemetryInfo.js.map +1 -1
  336. package/dist/src/transform/transfromRLCOptions.d.ts +1 -1
  337. package/dist/src/transform/transfromRLCOptions.d.ts.map +1 -1
  338. package/dist/src/transform/transfromRLCOptions.js +28 -39
  339. package/dist/src/transform/transfromRLCOptions.js.map +1 -1
  340. package/dist/src/utils/clientUtils.d.ts +1 -1
  341. package/dist/src/utils/clientUtils.d.ts.map +1 -1
  342. package/dist/src/utils/clientUtils.js +15 -23
  343. package/dist/src/utils/clientUtils.js.map +1 -1
  344. package/dist/src/utils/credentialUtils.d.ts +1 -1
  345. package/dist/src/utils/credentialUtils.d.ts.map +1 -1
  346. package/dist/src/utils/credentialUtils.js +4 -5
  347. package/dist/src/utils/credentialUtils.js.map +1 -1
  348. package/dist/src/utils/crossLanguageDef.d.ts.map +1 -1
  349. package/dist/src/utils/crossLanguageDef.js +11 -15
  350. package/dist/src/utils/crossLanguageDef.js.map +1 -1
  351. package/dist/src/utils/emitUtil.d.ts +1 -1
  352. package/dist/src/utils/emitUtil.d.ts.map +1 -1
  353. package/dist/src/utils/emitUtil.js +5 -7
  354. package/dist/src/utils/emitUtil.js.map +1 -1
  355. package/dist/src/utils/fileSystemUtils.d.ts +2 -0
  356. package/dist/src/utils/fileSystemUtils.d.ts.map +1 -1
  357. package/dist/src/utils/fileSystemUtils.js +26 -7
  358. package/dist/src/utils/fileSystemUtils.js.map +1 -1
  359. package/dist/src/utils/importHelper.d.ts.map +1 -1
  360. package/dist/src/utils/importHelper.js +3 -6
  361. package/dist/src/utils/importHelper.js.map +1 -1
  362. package/dist/src/utils/interfaces.d.ts +1 -1
  363. package/dist/src/utils/interfaces.d.ts.map +1 -1
  364. package/dist/src/utils/mediaTypes.d.ts.map +1 -1
  365. package/dist/src/utils/mediaTypes.js +7 -19
  366. package/dist/src/utils/mediaTypes.js.map +1 -1
  367. package/dist/src/utils/modelUtils.d.ts +5 -5
  368. package/dist/src/utils/modelUtils.d.ts.map +1 -1
  369. package/dist/src/utils/modelUtils.js +168 -257
  370. package/dist/src/utils/modelUtils.js.map +1 -1
  371. package/dist/src/utils/namespaceUtils.d.ts.map +1 -1
  372. package/dist/src/utils/namespaceUtils.js +6 -7
  373. package/dist/src/utils/namespaceUtils.js.map +1 -1
  374. package/dist/src/utils/operationUtil.d.ts +1 -1
  375. package/dist/src/utils/operationUtil.d.ts.map +1 -1
  376. package/dist/src/utils/operationUtil.js +60 -81
  377. package/dist/src/utils/operationUtil.js.map +1 -1
  378. package/dist/src/utils/parameterUtils.d.ts +1 -1
  379. package/dist/src/utils/parameterUtils.d.ts.map +1 -1
  380. package/dist/src/utils/parameterUtils.js +26 -33
  381. package/dist/src/utils/parameterUtils.js.map +1 -1
  382. package/dist/src/utils/resolve-project-root.js +2 -2
  383. package/dist/src/utils/resolve-project-root.js.map +1 -1
  384. package/dist/tsconfig.tsbuildinfo +1 -1
  385. package/package.json +36 -43
  386. package/src/contextManager.ts +6 -9
  387. package/src/framework/declaration.ts +18 -28
  388. package/src/framework/dependency.ts +1 -2
  389. package/src/framework/hooks/binder.ts +47 -120
  390. package/src/framework/hooks/sdkTypes.ts +27 -54
  391. package/src/framework/hooks/useDependencies.ts +2 -4
  392. package/src/framework/load-static-helpers.ts +28 -51
  393. package/src/framework/reference.ts +2 -5
  394. package/src/framework/sample.ts +9 -9
  395. package/src/index.ts +145 -185
  396. package/src/lib.ts +143 -158
  397. package/src/metaTree.ts +1 -1
  398. package/src/modular/buildClassicalClient.ts +83 -160
  399. package/src/modular/buildClassicalOperationGroups.ts +14 -39
  400. package/src/modular/buildClientContext.ts +54 -83
  401. package/src/modular/buildModularOptions.ts +4 -5
  402. package/src/modular/buildOperations.ts +46 -73
  403. package/src/modular/buildProjectFiles.ts +18 -47
  404. package/src/modular/buildRestorePoller.ts +27 -46
  405. package/src/modular/buildRootIndex.ts +86 -160
  406. package/src/modular/buildSubpathIndex.ts +35 -58
  407. package/src/modular/emitLoggerFile.ts +4 -9
  408. package/src/modular/emitModels.ts +136 -266
  409. package/src/modular/emitModelsOptions.ts +10 -16
  410. package/src/modular/emitSamples.ts +92 -180
  411. package/src/modular/emitTests.ts +28 -61
  412. package/src/modular/external-dependencies.ts +54 -54
  413. package/src/modular/helpers/classicalOperationHelpers.ts +73 -126
  414. package/src/modular/helpers/clientHelpers.ts +41 -88
  415. package/src/modular/helpers/clientOptionHelpers.ts +4 -11
  416. package/src/modular/helpers/exampleValueHelpers.ts +99 -215
  417. package/src/modular/helpers/namingHelpers.ts +12 -28
  418. package/src/modular/helpers/operationHelpers.ts +430 -757
  419. package/src/modular/helpers/typeHelpers.ts +11 -22
  420. package/src/modular/serialization/buildDeserializerFunction.ts +88 -122
  421. package/src/modular/serialization/buildSerializerFunction.ts +91 -129
  422. package/src/modular/serialization/buildXmlSerializerFunction.ts +104 -183
  423. package/src/modular/serialization/serializeUtils.ts +12 -22
  424. package/src/modular/static/rollup.test.config.js +11 -14
  425. package/src/modular/static/scripts/renameOutput.mjs +2 -2
  426. package/src/modular/static-helpers-metadata.ts +60 -60
  427. package/src/modular/type-expressions/get-credential-expression.ts +1 -1
  428. package/src/modular/type-expressions/get-enum-expression.ts +5 -10
  429. package/src/modular/type-expressions/get-model-expression.ts +13 -17
  430. package/src/modular/type-expressions/get-nullable-expression.ts +4 -5
  431. package/src/modular/type-expressions/get-type-expression.ts +8 -12
  432. package/src/modular/type-expressions/get-union-expression.ts +4 -4
  433. package/src/modular/type-expressions/utils.ts +1 -1
  434. package/src/rlc-common/buildClient.ts +70 -141
  435. package/src/rlc-common/buildClientDefinitions.ts +44 -87
  436. package/src/rlc-common/buildIndexFile.ts +78 -78
  437. package/src/rlc-common/buildIsUnexpectedHelper.ts +34 -41
  438. package/src/rlc-common/buildLogger.ts +7 -7
  439. package/src/rlc-common/buildMethodShortcuts.ts +9 -21
  440. package/src/rlc-common/buildObjectTypes.ts +79 -156
  441. package/src/rlc-common/buildPaginateHelper.ts +9 -12
  442. package/src/rlc-common/buildParameterTypes.ts +116 -137
  443. package/src/rlc-common/buildPollingHelper.ts +7 -7
  444. package/src/rlc-common/buildResponseTypes.ts +34 -57
  445. package/src/rlc-common/buildSamples.ts +3 -3
  446. package/src/rlc-common/buildSchemaType.ts +37 -29
  447. package/src/rlc-common/buildSerializeHelper.ts +5 -5
  448. package/src/rlc-common/buildTopLevelIndexFile.ts +12 -19
  449. package/src/rlc-common/helpers/apiVersionUtil.ts +5 -10
  450. package/src/rlc-common/helpers/importsUtil.ts +27 -30
  451. package/src/rlc-common/helpers/nameConstructors.ts +16 -50
  452. package/src/rlc-common/helpers/nameUtils.ts +19 -42
  453. package/src/rlc-common/helpers/operationHelpers.ts +14 -31
  454. package/src/rlc-common/helpers/pathUtils.ts +2 -7
  455. package/src/rlc-common/helpers/schemaHelpers.ts +4 -15
  456. package/src/rlc-common/helpers/shortcutMethods.ts +6 -15
  457. package/src/rlc-common/helpers/typeUtil.ts +4 -11
  458. package/src/rlc-common/helpers/valueGenerationUtil.ts +16 -39
  459. package/src/rlc-common/index.ts +28 -28
  460. package/src/rlc-common/interfaces.ts +3 -11
  461. package/src/rlc-common/metadata/buildApiExtractorConfig.ts +17 -24
  462. package/src/rlc-common/metadata/buildChangelogFile.ts +1 -1
  463. package/src/rlc-common/metadata/buildESLintConfig.ts +3 -5
  464. package/src/rlc-common/metadata/buildLicenseFile.ts +1 -1
  465. package/src/rlc-common/metadata/buildPackageFile.ts +27 -35
  466. package/src/rlc-common/metadata/buildReadmeFile.ts +16 -29
  467. package/src/rlc-common/metadata/buildRollupConfig.ts +5 -8
  468. package/src/rlc-common/metadata/buildSampleEnvFile.ts +2 -3
  469. package/src/rlc-common/metadata/buildTestConfig.ts +10 -10
  470. package/src/rlc-common/metadata/buildTsConfig.ts +32 -35
  471. package/src/rlc-common/metadata/buildVitestConfig.ts +4 -10
  472. package/src/rlc-common/metadata/buildWarpConfig.ts +3 -6
  473. package/src/rlc-common/metadata/packageJson/azurePackageCommon.ts +16 -25
  474. package/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.ts +29 -50
  475. package/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.ts +20 -31
  476. package/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.ts +11 -13
  477. package/src/rlc-common/metadata/packageJson/packageCommon.ts +32 -52
  478. package/src/rlc-common/test/buildKarmaConfig.ts +1 -1
  479. package/src/rlc-common/test/buildRecordedClient.ts +3 -3
  480. package/src/rlc-common/test/buildSampleTest.ts +3 -3
  481. package/src/rlc-common/test/buildSnippets.ts +6 -12
  482. package/src/rlc-common/transformSampleGroups.ts +54 -105
  483. package/src/testing/index.ts +2 -5
  484. package/src/transform/transform.ts +22 -34
  485. package/src/transform/transformApiVersionInfo.ts +17 -30
  486. package/src/transform/transformHelperFunctionDetails.ts +14 -26
  487. package/src/transform/transformParameters.ts +55 -105
  488. package/src/transform/transformPaths.ts +26 -43
  489. package/src/transform/transformResponses.ts +26 -33
  490. package/src/transform/transformSchemas.ts +15 -33
  491. package/src/transform/transformTelemetryInfo.ts +8 -14
  492. package/src/transform/transfromRLCOptions.ts +53 -116
  493. package/src/utils/clientUtils.ts +22 -41
  494. package/src/utils/credentialUtils.ts +8 -19
  495. package/src/utils/crossLanguageDef.ts +15 -34
  496. package/src/utils/emitUtil.ts +11 -17
  497. package/src/utils/fileSystemUtils.ts +30 -8
  498. package/src/utils/importHelper.ts +5 -10
  499. package/src/utils/interfaces.ts +1 -1
  500. package/src/utils/mediaTypes.ts +13 -34
  501. package/src/utils/modelUtils.ts +175 -384
  502. package/src/utils/namespaceUtils.ts +8 -24
  503. package/src/utils/operationUtil.ts +98 -190
  504. package/src/utils/parameterUtils.ts +31 -54
  505. package/src/utils/resolve-project-root.ts +3 -3
  506. package/static/static-helpers/cloudSettingHelpers.ts +4 -6
  507. package/static/static-helpers/multipartHelpers.ts +3 -3
  508. package/static/static-helpers/pagingHelpers.ts +28 -63
  509. package/static/static-helpers/pollingHelpers.ts +16 -29
  510. package/static/static-helpers/serialization/build-multi-collection.ts +1 -4
  511. package/static/static-helpers/serialization/check-prop-undefined.ts +1 -4
  512. package/static/static-helpers/serialization/get-binary-response-browser.mts +3 -1
  513. package/static/static-helpers/serialization/get-binary-response.ts +2 -2
  514. package/static/static-helpers/serialization/get-binary-stream-response-browser.mts +1 -3
  515. package/static/static-helpers/serialization/get-binary-stream-response.ts +2 -4
  516. package/static/static-helpers/serialization/serialize-record.ts +1 -1
  517. package/static/static-helpers/serialization/serializers.ts +4 -7
  518. package/static/static-helpers/serialization/xml-helpers.ts +42 -90
  519. package/static/static-helpers/simplePollerHelpers.ts +10 -19
  520. package/static/static-helpers/storageCompatResponse.ts +10 -27
  521. package/static/static-helpers/urlTemplate.ts +4 -7
  522. package/static/test-helpers/recordedClient.ts +5 -10
@@ -1,27 +1,15 @@
1
1
  import {
2
- EnumDeclarationStructure,
3
- EnumMemberStructure,
4
- InterfaceDeclarationStructure,
5
- OptionalKind,
6
- PropertySignatureStructure,
7
- SourceFile,
8
- StructureKind,
9
- TypeAliasDeclarationStructure
10
- } from "ts-morph";
11
- import {
12
- fixLeadingNumber,
13
- NameType,
14
- normalizeName
15
- } from "../rlc-common/index.js";
16
- import {
2
+ isPagedResultModel,
3
+ isReadOnly,
4
+ listAllServiceNamespaces,
17
5
  SdkArrayType,
18
- SdkModelPropertyType,
19
6
  SdkClientType,
20
7
  SdkDictionaryType,
21
8
  SdkEnumType,
22
9
  SdkEnumValueType,
23
10
  SdkHttpOperation,
24
11
  SdkMethod,
12
+ SdkModelPropertyType,
25
13
  SdkModelType,
26
14
  SdkNullableType,
27
15
  SdkServiceMethod,
@@ -29,67 +17,75 @@ import {
29
17
  SdkType,
30
18
  SdkUnionType,
31
19
  UsageFlags,
32
- isPagedResultModel,
33
- isReadOnly,
34
- listAllServiceNamespaces
35
20
  } from "@azure-tools/typespec-client-generator-core";
21
+ import {
22
+ EnumDeclarationStructure,
23
+ EnumMemberStructure,
24
+ InterfaceDeclarationStructure,
25
+ OptionalKind,
26
+ PropertySignatureStructure,
27
+ SourceFile,
28
+ StructureKind,
29
+ TypeAliasDeclarationStructure,
30
+ } from "ts-morph";
31
+ import { fixLeadingNumber, NameType, normalizeName } from "../rlc-common/index.js";
36
32
  // import { isKey } from "@typespec/compiler";
37
33
  import {
38
34
  getExternalModel,
39
35
  getModelExpression,
40
- getMultipartFileTypeExpression
36
+ getMultipartFileTypeExpression,
41
37
  } from "./type-expressions/get-model-expression.js";
42
38
 
43
- import { SdkContext } from "../utils/interfaces.js";
39
+ import { getNamespaceFullName, NoTarget } from "@typespec/compiler";
40
+ import { isMetadata, isOrExtendsHttpFile, Visibility } from "@typespec/http";
41
+ import path from "path";
42
+ import { useContext } from "../contextManager.js";
44
43
  import { addDeclaration } from "../framework/declaration.js";
44
+ import {
45
+ emitQueue,
46
+ flattenPropertyModelMap,
47
+ getAllOperationsFromClient,
48
+ pagedModelsUsedInNonPagingOps,
49
+ } from "../framework/hooks/sdkTypes.js";
50
+ import { refkey } from "../framework/refkey.js";
51
+ import { reportDiagnostic } from "../lib.js";
52
+ import { getClientHierarchyMap } from "../utils/clientUtils.js";
53
+ import { SdkContext } from "../utils/interfaces.js";
54
+ import { isAzureCoreErrorType } from "../utils/modelUtils.js";
55
+ import { getMethodHierarchiesMap } from "../utils/operationUtil.js";
56
+ import { getHeaderClientOptions } from "./helpers/clientOptionHelpers.js";
57
+ import {
58
+ buildNonModelResponseTypeDeclaration,
59
+ checkWrapNonModelReturn,
60
+ getAllAncestors,
61
+ getAllProperties,
62
+ } from "./helpers/operationHelpers.js";
63
+ import { getDirectSubtypes } from "./helpers/typeHelpers.js";
45
64
  import {
46
65
  buildModelDeserializer,
47
- buildPropertyDeserializer
66
+ buildPropertyDeserializer,
48
67
  } from "./serialization/buildDeserializerFunction.js";
49
68
  import {
50
69
  buildModelSerializer,
51
- buildPropertySerializer
70
+ buildPropertySerializer,
52
71
  } from "./serialization/buildSerializerFunction.js";
53
72
  import {
54
- buildXmlModelSerializer,
55
73
  buildXmlModelDeserializer,
56
- buildXmlObjectModelSerializer,
74
+ buildXmlModelSerializer,
57
75
  buildXmlObjectModelDeserializer,
58
- hasXmlSerialization
76
+ buildXmlObjectModelSerializer,
77
+ hasXmlSerialization,
59
78
  } from "./serialization/buildXmlSerializerFunction.js";
60
- import path from "path";
61
- import { refkey } from "../framework/refkey.js";
62
- import { useContext } from "../contextManager.js";
63
- import { isMetadata, isOrExtendsHttpFile, Visibility } from "@typespec/http";
64
- import { isAzureCoreErrorType } from "../utils/modelUtils.js";
65
- import { getHeaderClientOptions } from "./helpers/clientOptionHelpers.js";
66
- import { isExtensibleEnum } from "./type-expressions/get-enum-expression.js";
67
79
  import {
68
80
  getAllDiscriminatedValues,
69
81
  getPropertyWithOverrides,
70
- isDiscriminatedUnion
82
+ isDiscriminatedUnion,
71
83
  } from "./serialization/serializeUtils.js";
72
- import { reportDiagnostic } from "../lib.js";
73
- import { getNamespaceFullName, NoTarget } from "@typespec/compiler";
84
+ import { isExtensibleEnum } from "./type-expressions/get-enum-expression.js";
74
85
  import {
75
86
  getTypeExpression,
76
- normalizeModelPropertyName
87
+ normalizeModelPropertyName,
77
88
  } from "./type-expressions/get-type-expression.js";
78
- import {
79
- emitQueue,
80
- flattenPropertyModelMap,
81
- getAllOperationsFromClient,
82
- pagedModelsUsedInNonPagingOps
83
- } from "../framework/hooks/sdkTypes.js";
84
- import {
85
- getAllAncestors,
86
- getAllProperties,
87
- buildNonModelResponseTypeDeclaration,
88
- checkWrapNonModelReturn
89
- } from "./helpers/operationHelpers.js";
90
- import { getDirectSubtypes } from "./helpers/typeHelpers.js";
91
- import { getClientHierarchyMap } from "../utils/clientUtils.js";
92
- import { getMethodHierarchiesMap } from "../utils/operationUtil.js";
93
89
 
94
90
  type InterfaceStructure = OptionalKind<InterfaceDeclarationStructure> & {
95
91
  extends?: string[];
@@ -97,7 +93,7 @@ type InterfaceStructure = OptionalKind<InterfaceDeclarationStructure> & {
97
93
  };
98
94
 
99
95
  function isGenerableType(
100
- type: SdkType
96
+ type: SdkType,
101
97
  ): type is
102
98
  | SdkModelType
103
99
  | SdkEnumType
@@ -117,10 +113,7 @@ function isGenerableType(
117
113
  !type.isGeneratedName)
118
114
  );
119
115
  }
120
- export function emitTypes(
121
- context: SdkContext,
122
- { sourceRoot }: { sourceRoot: string }
123
- ) {
116
+ export function emitTypes(context: SdkContext, { sourceRoot }: { sourceRoot: string }) {
124
117
  const outputProject = useContext("outputProject");
125
118
 
126
119
  let sourceFile;
@@ -153,9 +146,7 @@ export function emitTypes(
153
146
  addSerializationFunctions(context, property, sourceFile!);
154
147
  }
155
148
 
156
- const modelFiles = outputProject.getSourceFiles(
157
- sourceRoot + "/models/**/*.ts"
158
- );
149
+ const modelFiles = outputProject.getSourceFiles(sourceRoot + "/models/**/*.ts");
159
150
  const result = [];
160
151
  for (const modelFile of modelFiles) {
161
152
  if (
@@ -179,7 +170,7 @@ export function emitTypes(
179
170
  */
180
171
  export function emitNonModelResponseTypes(
181
172
  context: SdkContext,
182
- { sourceRoot }: { sourceRoot: string }
173
+ { sourceRoot }: { sourceRoot: string },
183
174
  ) {
184
175
  const outputProject = useContext("outputProject");
185
176
  const clientMap = getClientHierarchyMap(context);
@@ -200,11 +191,7 @@ export function emitNonModelResponseTypes(
200
191
  modelsFile = outputProject.createSourceFile(filepath);
201
192
  }
202
193
  const method: [string[], typeof op] = [prefixes, op];
203
- const typeAlias = buildNonModelResponseTypeDeclaration(
204
- context,
205
- method,
206
- isBinary
207
- );
194
+ const typeAlias = buildNonModelResponseTypeDeclaration(context, method, isBinary);
208
195
  addDeclaration(modelsFile, typeAlias, refkey(op, "response"));
209
196
  }
210
197
  }
@@ -237,14 +224,11 @@ function emitType(context: SdkContext, type: SdkType, sourceFile: SourceFile) {
237
224
  if (type.discriminatorProperty) {
238
225
  modelInterface.properties
239
226
  ?.filter((p) => {
240
- return (
241
- p.name ===
242
- normalizeModelPropertyName(context, type.discriminatorProperty!)
243
- );
227
+ return p.name === normalizeModelPropertyName(context, type.discriminatorProperty!);
244
228
  })
245
229
  .map((p) => {
246
230
  p.docs?.push(
247
- `The discriminator possible values: ${Object.keys(type.discriminatedSubtypes ?? {}).join(", ")}`
231
+ `The discriminator possible values: ${Object.keys(type.discriminatedSubtypes ?? {}).join(", ")}`,
248
232
  );
249
233
  return p;
250
234
  });
@@ -253,11 +237,7 @@ function emitType(context: SdkContext, type: SdkType, sourceFile: SourceFile) {
253
237
  const modelPolymorphicType = buildModelPolymorphicType(context, type);
254
238
  if (modelPolymorphicType) {
255
239
  addSerializationFunctions(context, type, sourceFile, true);
256
- addDeclaration(
257
- sourceFile,
258
- modelPolymorphicType,
259
- refkey(type, "polymorphicType")
260
- );
240
+ addDeclaration(sourceFile, modelPolymorphicType, refkey(type, "polymorphicType"));
261
241
  }
262
242
  addSerializationFunctions(context, type, sourceFile);
263
243
  } else if (type.kind === "enum") {
@@ -271,15 +251,14 @@ function emitType(context: SdkContext, type: SdkType, sourceFile: SourceFile) {
271
251
  }
272
252
  const inputUsage = (type.usage & UsageFlags.Input) === UsageFlags.Input;
273
253
  const outputUsage = (type.usage & UsageFlags.Output) === UsageFlags.Output;
274
- const exceptionUsage =
275
- (type.usage & UsageFlags.Exception) === UsageFlags.Exception;
254
+ const exceptionUsage = (type.usage & UsageFlags.Exception) === UsageFlags.Exception;
276
255
  if (!(inputUsage || outputUsage || apiVersionEnumOnly || exceptionUsage)) {
277
256
  return;
278
257
  }
279
258
  const [enumType, knownValuesEnum] = buildEnumTypes(
280
259
  context,
281
260
  type,
282
- isExtensibleEnum(context, type)
261
+ isExtensibleEnum(context, type),
283
262
  );
284
263
  if (enumType.name.startsWith("_")) {
285
264
  // skip enum generation for internal enums
@@ -287,18 +266,10 @@ function emitType(context: SdkContext, type: SdkType, sourceFile: SourceFile) {
287
266
  }
288
267
  if (apiVersionEnumOnly) {
289
268
  // generate known values enum only for api version enums
290
- addDeclaration(
291
- sourceFile,
292
- knownValuesEnum,
293
- refkey(knownValuesEnum.name, "knownValues")
294
- );
269
+ addDeclaration(sourceFile, knownValuesEnum, refkey(knownValuesEnum.name, "knownValues"));
295
270
  } else {
296
271
  if (isExtensibleEnum(context, type)) {
297
- addDeclaration(
298
- sourceFile,
299
- knownValuesEnum,
300
- refkey(type, "knownValues")
301
- );
272
+ addDeclaration(sourceFile, knownValuesEnum, refkey(type, "knownValues"));
302
273
  }
303
274
  addDeclaration(sourceFile, enumType, type);
304
275
  }
@@ -324,7 +295,7 @@ export function getApiVersionEnum(context: SdkContext) {
324
295
  return;
325
296
  }
326
297
  const apiVersionEnum = context.sdkPackage.enums.find(
327
- (e) => e.usage === UsageFlags.ApiVersionEnum
298
+ (e) => e.usage === UsageFlags.ApiVersionEnum,
328
299
  );
329
300
  if (!apiVersionEnum) {
330
301
  return;
@@ -332,35 +303,23 @@ export function getApiVersionEnum(context: SdkContext) {
332
303
  return apiVersionEnum;
333
304
  }
334
305
 
335
- export function getModelsPath(
336
- sourceRoot: string,
337
- modelNamespace: string[] = []
338
- ): string {
306
+ export function getModelsPath(sourceRoot: string, modelNamespace: string[] = []): string {
339
307
  return path.join(
340
308
  ...[
341
309
  sourceRoot,
342
310
  "models",
343
311
  ...modelNamespace.map((n) => normalizeName(n, NameType.File)),
344
- `models.ts`
345
- ]
312
+ `models.ts`,
313
+ ],
346
314
  );
347
315
  }
348
316
 
349
- export function getModelNamespaces(
350
- context: SdkContext,
351
- model: SdkType
352
- ): string[] {
353
- if (
354
- model.kind === "model" ||
355
- model.kind === "enum" ||
356
- model.kind === "union"
357
- ) {
317
+ export function getModelNamespaces(context: SdkContext, model: SdkType): string[] {
318
+ if (model.kind === "model" || model.kind === "enum" || model.kind === "union") {
358
319
  if (
359
320
  (model.namespace ?? "").startsWith("Azure.ResourceManager") ||
360
321
  (model.namespace ?? "").startsWith("Azure.Core") ||
361
- (model.crossLanguageDefinitionId ?? "").startsWith(
362
- "TypeSpec.Rest.Resource"
363
- ) ||
322
+ (model.crossLanguageDefinitionId ?? "").startsWith("TypeSpec.Rest.Resource") ||
364
323
  (model.crossLanguageDefinitionId ?? "") === "TypeSpec.Http.File" // filter out the TypeSpec.Http.File model similar like what java does here https://github.com/microsoft/typespec/blob/main/packages/http-client-java/emitter/src/code-model-builder.ts#L2589
365
324
  ) {
366
325
  return [];
@@ -371,8 +330,7 @@ export function getModelNamespaces(
371
330
  return segments;
372
331
  }
373
332
 
374
- const allServiceNamespaces =
375
- context.allServiceNamespaces ?? listAllServiceNamespaces(context);
333
+ const allServiceNamespaces = context.allServiceNamespaces ?? listAllServiceNamespaces(context);
376
334
  const deepestNamespace = getNamespaceFullName(allServiceNamespaces[0]!);
377
335
  const rootNamespace = deepestNamespace.split(".") ?? [];
378
336
  if (segments.length > rootNamespace.length) {
@@ -425,9 +383,7 @@ function isNestedInXmlModel(targetModel: SdkModelType): boolean {
425
383
  /**
426
384
  * Gets all properties from a model and its ancestors (base models).
427
385
  */
428
- function getModelAndAncestorProperties(
429
- type: SdkModelType
430
- ): SdkModelPropertyType[] {
386
+ function getModelAndAncestorProperties(type: SdkModelType): SdkModelPropertyType[] {
431
387
  const properties: SdkModelPropertyType[] = [];
432
388
  let current: SdkModelType | undefined = type;
433
389
  while (current) {
@@ -445,11 +401,11 @@ function addSerializationFunctions(
445
401
  context: SdkContext,
446
402
  typeOrProperty: SdkType | SdkModelPropertyType,
447
403
  sourceFile: SourceFile,
448
- skipDiscriminatedUnionSuffix = false
404
+ skipDiscriminatedUnionSuffix = false,
449
405
  ) {
450
406
  const options = {
451
407
  nameOnly: false,
452
- skipDiscriminatedUnionSuffix
408
+ skipDiscriminatedUnionSuffix,
453
409
  };
454
410
 
455
411
  // Add JSON serializers
@@ -484,11 +440,7 @@ function addSerializationFunctions(
484
440
  const xmlSerializerRefKey = refkey(typeOrProperty, "xmlSerializer");
485
441
  const xmlDeserializerRefKey = refkey(typeOrProperty, "xmlDeserializer");
486
442
 
487
- const xmlSerializationFunction = buildXmlModelSerializer(
488
- context,
489
- typeOrProperty,
490
- options
491
- );
443
+ const xmlSerializationFunction = buildXmlModelSerializer(context, typeOrProperty, options);
492
444
  if (
493
445
  xmlSerializationFunction &&
494
446
  typeof xmlSerializationFunction !== "string" &&
@@ -497,83 +449,56 @@ function addSerializationFunctions(
497
449
  addDeclaration(sourceFile, xmlSerializationFunction, xmlSerializerRefKey);
498
450
  }
499
451
 
500
- const xmlDeserializationFunction = buildXmlModelDeserializer(
501
- context,
502
- typeOrProperty,
503
- options
504
- );
452
+ const xmlDeserializationFunction = buildXmlModelDeserializer(context, typeOrProperty, options);
505
453
  if (
506
454
  xmlDeserializationFunction &&
507
455
  typeof xmlDeserializationFunction !== "string" &&
508
456
  xmlDeserializationFunction.name
509
457
  ) {
510
- addDeclaration(
511
- sourceFile,
512
- xmlDeserializationFunction,
513
- xmlDeserializerRefKey
514
- );
458
+ addDeclaration(sourceFile, xmlDeserializationFunction, xmlDeserializerRefKey);
515
459
  }
516
460
 
517
461
  // Only generate XML object serializer/deserializer for models that are
518
462
  // actually nested as properties inside other XML models
519
463
  if (isNestedInXmlModel(typeOrProperty)) {
520
- const xmlObjectSerializerRefKey = refkey(
521
- typeOrProperty,
522
- "xmlObjectSerializer"
523
- );
524
- const xmlObjectDeserializerRefKey = refkey(
525
- typeOrProperty,
526
- "xmlObjectDeserializer"
527
- );
464
+ const xmlObjectSerializerRefKey = refkey(typeOrProperty, "xmlObjectSerializer");
465
+ const xmlObjectDeserializerRefKey = refkey(typeOrProperty, "xmlObjectDeserializer");
528
466
 
529
467
  const xmlObjectSerializationFunction = buildXmlObjectModelSerializer(
530
468
  context,
531
469
  typeOrProperty,
532
- options
470
+ options,
533
471
  );
534
472
  if (
535
473
  xmlObjectSerializationFunction &&
536
474
  typeof xmlObjectSerializationFunction !== "string" &&
537
475
  xmlObjectSerializationFunction.name
538
476
  ) {
539
- addDeclaration(
540
- sourceFile,
541
- xmlObjectSerializationFunction,
542
- xmlObjectSerializerRefKey
543
- );
477
+ addDeclaration(sourceFile, xmlObjectSerializationFunction, xmlObjectSerializerRefKey);
544
478
  }
545
479
 
546
480
  const xmlObjectDeserializationFunction = buildXmlObjectModelDeserializer(
547
481
  context,
548
482
  typeOrProperty,
549
- options
483
+ options,
550
484
  );
551
485
  if (
552
486
  xmlObjectDeserializationFunction &&
553
487
  typeof xmlObjectDeserializationFunction !== "string" &&
554
488
  xmlObjectDeserializationFunction.name
555
489
  ) {
556
- addDeclaration(
557
- sourceFile,
558
- xmlObjectDeserializationFunction,
559
- xmlObjectDeserializerRefKey
560
- );
490
+ addDeclaration(sourceFile, xmlObjectDeserializationFunction, xmlObjectDeserializerRefKey);
561
491
  }
562
492
  }
563
493
  }
564
494
  }
565
495
 
566
- function buildUnionType(
567
- context: SdkContext,
568
- type: SdkUnionType
569
- ): TypeAliasDeclarationStructure {
496
+ function buildUnionType(context: SdkContext, type: SdkUnionType): TypeAliasDeclarationStructure {
570
497
  const unionDeclaration: TypeAliasDeclarationStructure = {
571
498
  kind: StructureKind.TypeAlias,
572
499
  name: normalizeModelName(context, type),
573
500
  isExported: true,
574
- type: type.variantTypes
575
- .map((v) => getTypeExpression(context, v))
576
- .join(" | ")
501
+ type: type.variantTypes.map((v) => getTypeExpression(context, v)).join(" | "),
577
502
  };
578
503
 
579
504
  unionDeclaration.docs = [type.doc ?? `Alias for ${unionDeclaration.name}`];
@@ -586,27 +511,25 @@ function buildNullableType(context: SdkContext, type: SdkNullableType) {
586
511
  kind: StructureKind.TypeAlias,
587
512
  name: normalizeModelName(context, type),
588
513
  isExported: true,
589
- type: getTypeExpression(context, type.type) + " | null"
514
+ type: getTypeExpression(context, type.type) + " | null",
590
515
  };
591
- nullableDeclaration.docs = [
592
- type.doc ?? `Alias for ${nullableDeclaration.name}`
593
- ];
516
+ nullableDeclaration.docs = [type.doc ?? `Alias for ${nullableDeclaration.name}`];
594
517
  return nullableDeclaration;
595
518
  }
596
519
 
597
520
  export function buildEnumTypes(
598
521
  context: SdkContext,
599
522
  type: SdkEnumType,
600
- reportMemberNameDiagnostic = false // if reportMemberNameDiagnostic is true, it will report diagnostic for enum member name
523
+ reportMemberNameDiagnostic = false, // if reportMemberNameDiagnostic is true, it will report diagnostic for enum member name
601
524
  ): [TypeAliasDeclarationStructure, EnumDeclarationStructure] {
602
525
  const rawMembers = type.values.map((value) =>
603
- emitEnumMember(context, value, reportMemberNameDiagnostic)
526
+ emitEnumMember(context, value, reportMemberNameDiagnostic),
604
527
  );
605
528
  const enumDeclaration: EnumDeclarationStructure = {
606
529
  kind: StructureKind.Enum,
607
530
  name: `Known${normalizeModelName(context, type)}`,
608
531
  isExported: true,
609
- members: deduplicateEnumMemberNames(rawMembers)
532
+ members: deduplicateEnumMemberNames(rawMembers),
610
533
  };
611
534
 
612
535
  const enumAsUnion: TypeAliasDeclarationStructure = {
@@ -615,7 +538,7 @@ export function buildEnumTypes(
615
538
  isExported: true,
616
539
  type: !isExtensibleEnum(context, type)
617
540
  ? type.values.map((v) => getTypeExpression(context, v)).join(" | ")
618
- : getTypeExpression(context, type.valueType)
541
+ : getTypeExpression(context, type.valueType),
619
542
  };
620
543
 
621
544
  const docs = type.doc ? type.doc : "Type of " + enumAsUnion.name;
@@ -630,10 +553,7 @@ export function buildEnumTypes(
630
553
  return [enumAsUnion, enumDeclaration];
631
554
  }
632
555
 
633
- function getExtensibleEnumDescription(
634
- context: SdkContext,
635
- model: SdkEnumType
636
- ): string | undefined {
556
+ function getExtensibleEnumDescription(context: SdkContext, model: SdkEnumType): string | undefined {
637
557
  if (model.isFixed && model.name && model.values) {
638
558
  return;
639
559
  }
@@ -649,7 +569,7 @@ function getExtensibleEnumDescription(
649
569
  `${model.doc} \\`,
650
570
  enumLink,
651
571
  `### Known values supported by the service`,
652
- valueDescriptions
572
+ valueDescriptions,
653
573
  ].join(" \n");
654
574
  }
655
575
 
@@ -659,9 +579,7 @@ function getExtensibleEnumDescription(
659
579
  * This handles cases where different values (e.g. "10" and "1.0") normalize
660
580
  * to the same identifier.
661
581
  */
662
- function deduplicateEnumMemberNames(
663
- members: EnumMemberStructure[]
664
- ): EnumMemberStructure[] {
582
+ function deduplicateEnumMemberNames(members: EnumMemberStructure[]): EnumMemberStructure[] {
665
583
  const nameCount = new Map<string, number>();
666
584
  for (const member of members) {
667
585
  const name = member.name as string;
@@ -682,14 +600,10 @@ function deduplicateEnumMemberNames(
682
600
  function emitEnumMember(
683
601
  context: SdkContext,
684
602
  member: SdkEnumValueType,
685
- reportMemberNameDiagnostic = false // if reportMemberNameDiagnostic is true, it will report diagnostic for enum member name
603
+ reportMemberNameDiagnostic = false, // if reportMemberNameDiagnostic is true, it will report diagnostic for enum member name
686
604
  ): EnumMemberStructure {
687
605
  const shouldNormalizeName = !member.name.startsWith("$DO_NOT_NORMALIZE$");
688
- const enumTypeName = normalizeName(
689
- member.enumType.name,
690
- NameType.Interface,
691
- true
692
- );
606
+ const enumTypeName = normalizeName(member.enumType.name, NameType.Interface, true);
693
607
  let normalizedMemberName = context.rlcOptions?.ignoreEnumMemberNameNormalize
694
608
  ? fixLeadingNumber(member.name, NameType.EnumMemberName) // need to fix the leading number also for enum member
695
609
  : normalizeName(member.name, NameType.EnumMemberName, true);
@@ -701,8 +615,7 @@ function emitEnumMember(
701
615
  !member.name.toLowerCase().startsWith("_")
702
616
  ) {
703
617
  const isApiVersionEnum =
704
- (member.enumType.usage & UsageFlags.ApiVersionEnum) ===
705
- UsageFlags.ApiVersionEnum;
618
+ (member.enumType.usage & UsageFlags.ApiVersionEnum) === UsageFlags.ApiVersionEnum;
706
619
  const prefix = isApiVersionEnum ? "V" : enumTypeName;
707
620
  normalizedMemberName = prefix + normalizedMemberName.slice(1);
708
621
  if (reportMemberNameDiagnostic) {
@@ -711,16 +624,16 @@ function emitEnumMember(
711
624
  format: {
712
625
  memberName: member.name,
713
626
  normalizedName: normalizedMemberName,
714
- enumTypeName
627
+ enumTypeName,
715
628
  },
716
- target: NoTarget
629
+ target: NoTarget,
717
630
  });
718
631
  }
719
632
  }
720
633
  const memberStructure: EnumMemberStructure = {
721
634
  kind: StructureKind.EnumMember,
722
635
  name: normalizedMemberName,
723
- value: member.value
636
+ value: member.value,
724
637
  };
725
638
 
726
639
  if (member.doc) {
@@ -735,7 +648,7 @@ function emitEnumMember(
735
648
 
736
649
  function buildModelInterface(
737
650
  context: SdkContext,
738
- type: SdkModelType
651
+ type: SdkModelType,
739
652
  ): InterfaceDeclarationStructure {
740
653
  const flattenPropertySet = new Set<SdkModelPropertyType>();
741
654
  // For non-input models (output-only, exception, etc.), filter out metadata
@@ -773,25 +686,20 @@ function buildModelInterface(
773
686
  })
774
687
  .map((p) => {
775
688
  return buildModelProperty(context, p, type);
776
- })
689
+ }),
777
690
  } as InterfaceStructure;
778
691
  for (const flatten of flattenPropertySet.keys()) {
779
- const conflictMap =
780
- useContext("sdkTypes").flattenProperties.get(flatten)?.conflictMap;
781
- const allProperties = getAllProperties(
782
- context,
783
- flatten.type,
784
- getAllAncestors(flatten.type)
785
- );
692
+ const conflictMap = useContext("sdkTypes").flattenProperties.get(flatten)?.conflictMap;
693
+ const allProperties = getAllProperties(context, flatten.type, getAllAncestors(flatten.type));
786
694
  interfaceStructure.properties!.push(
787
695
  ...allProperties.map((p) => {
788
696
  // when the flattened property is optional, all its child properties should be optional too
789
697
  const property = getPropertyWithOverrides(p, {
790
698
  allOptional: flatten.optional,
791
- propertyRenames: conflictMap
699
+ propertyRenames: conflictMap,
792
700
  });
793
701
  return buildModelProperty(context, property, type);
794
- })
702
+ }),
795
703
  );
796
704
  }
797
705
 
@@ -799,9 +707,7 @@ function buildModelInterface(
799
707
  const headerOptions = getHeaderClientOptions(type);
800
708
  if (headerOptions.length > 0) {
801
709
  const existingNames = new Set(
802
- interfaceStructure.properties!.map(
803
- (p: OptionalKind<PropertySignatureStructure>) => p.name
804
- )
710
+ interfaceStructure.properties!.map((p: OptionalKind<PropertySignatureStructure>) => p.name),
805
711
  );
806
712
  for (const opt of headerOptions) {
807
713
  if (!existingNames.has(opt.propertyName)) {
@@ -809,7 +715,7 @@ function buildModelInterface(
809
715
  kind: StructureKind.PropertySignature,
810
716
  name: opt.propertyName,
811
717
  type: "string",
812
- hasQuestionToken: true
718
+ hasQuestionToken: true,
813
719
  });
814
720
  }
815
721
  }
@@ -817,7 +723,7 @@ function buildModelInterface(
817
723
 
818
724
  if (type.baseModel) {
819
725
  const parentReference = getModelExpression(context, type.baseModel, {
820
- skipPolymorphicUnion: true
726
+ skipPolymorphicUnion: true,
821
727
  });
822
728
  interfaceStructure.extends = [parentReference];
823
729
  }
@@ -826,9 +732,7 @@ function buildModelInterface(
826
732
  addExtendedDictInfo(context, type, interfaceStructure);
827
733
  }
828
734
 
829
- interfaceStructure.docs = [
830
- type.doc ?? "model interface " + interfaceStructure.name
831
- ];
735
+ interfaceStructure.docs = [type.doc ?? "model interface " + interfaceStructure.name];
832
736
 
833
737
  return interfaceStructure;
834
738
  }
@@ -836,7 +740,7 @@ function buildModelInterface(
836
740
  function addExtendedDictInfo(
837
741
  context: SdkContext,
838
742
  model: SdkModelType,
839
- modelInterface: InterfaceStructure
743
+ modelInterface: InterfaceStructure,
840
744
  ) {
841
745
  const additionalPropertiesType = model.additionalProperties
842
746
  ? getTypeExpression(context, model.additionalProperties)
@@ -854,17 +758,13 @@ function addExtendedDictInfo(
854
758
  } else {
855
759
  // case 3: if additionalProperties is defined and model.properties is not empty, we should check if all properties are compatible with additionalProperties type
856
760
  anyType = !properties.every((p) => {
857
- return additionalPropertiesType?.includes(
858
- getTypeExpression(context, p.type)
859
- );
761
+ return additionalPropertiesType?.includes(getTypeExpression(context, p.type));
860
762
  });
861
763
  }
862
764
  if (!modelInterface.extends) {
863
765
  modelInterface.extends = [];
864
766
  }
865
- modelInterface.extends.push(
866
- `Record<string, ${anyType ? "any" : additionalPropertiesType}>`
867
- );
767
+ modelInterface.extends.push(`Record<string, ${anyType ? "any" : additionalPropertiesType}>`);
868
768
  } else {
869
769
  const additionalPropertiesType = model.additionalProperties
870
770
  ? getTypeExpression(context, model.additionalProperties)
@@ -875,9 +775,9 @@ function addExtendedDictInfo(
875
775
  reportDiagnostic(context.program, {
876
776
  code: "property-name-conflict",
877
777
  format: {
878
- propertyName: "additionalProperties"
778
+ propertyName: "additionalProperties",
879
779
  },
880
- target: NoTarget
780
+ target: NoTarget,
881
781
  });
882
782
  }
883
783
  if (!modelInterface.properties) {
@@ -888,20 +788,15 @@ function addExtendedDictInfo(
888
788
  docs: ["Additional properties"],
889
789
  hasQuestionToken: true,
890
790
  isReadonly: false,
891
- type: `Record<string, ${additionalPropertiesType ?? "any"}>`
791
+ type: `Record<string, ${additionalPropertiesType ?? "any"}>`,
892
792
  });
893
793
  }
894
794
  }
895
795
 
896
- export function getAdditionalPropertiesName(
897
- context: SdkContext,
898
- model: SdkModelType
899
- ): string {
796
+ export function getAdditionalPropertiesName(context: SdkContext, model: SdkModelType): string {
900
797
  const ancestors = getAllAncestors(model);
901
798
  const properties = getAllProperties(context, model, ancestors);
902
- const nameConflict = properties.find(
903
- (p) => p.name === "additionalProperties"
904
- );
799
+ const nameConflict = properties.find((p) => p.name === "additionalProperties");
905
800
  return nameConflict ? "additionalPropertiesBag" : "additionalProperties";
906
801
  }
907
802
 
@@ -916,7 +811,7 @@ export function normalizeModelName(
916
811
  | SdkNullableType,
917
812
  nameType: NameType = NameType.Interface,
918
813
  skipPolymorphicUnionSuffix = false,
919
- rawModelName?: boolean
814
+ rawModelName?: boolean,
920
815
  ): string {
921
816
  if (type.kind === "array") {
922
817
  if (rawModelName) {
@@ -927,11 +822,7 @@ export function normalizeModelName(
927
822
  if (rawModelName) {
928
823
  return `${normalizeModelName(context, type.valueType as any, nameType, skipPolymorphicUnionSuffix, rawModelName)}Record`;
929
824
  }
930
- return `Record<string, ${normalizeModelName(
931
- context,
932
- type.valueType as any,
933
- nameType
934
- )}>`;
825
+ return `Record<string, ${normalizeModelName(context, type.valueType as any, nameType)}>`;
935
826
  }
936
827
  if (
937
828
  type.kind !== "model" &&
@@ -949,12 +840,9 @@ export function normalizeModelName(
949
840
  unionSuffix = "Union";
950
841
  }
951
842
  }
952
- const namespacePrefix = context.rlcOptions?.enableModelNamespace
953
- ? segments.join("")
954
- : "";
843
+ const namespacePrefix = context.rlcOptions?.enableModelNamespace ? segments.join("") : "";
955
844
  const internalModelPrefix =
956
- (isPagedResultModel(context, type) &&
957
- !pagedModelsUsedInNonPagingOps.has(type)) ||
845
+ (isPagedResultModel(context, type) && !pagedModelsUsedInNonPagingOps.has(type)) ||
958
846
  type.isGeneratedName
959
847
  ? "_"
960
848
  : "";
@@ -980,12 +868,12 @@ function buildModelPolymorphicType(context: SdkContext, type: SdkModelType) {
980
868
  );
981
869
  })
982
870
  .map((t) => getTypeExpression(context, t))
983
- .join(" | ")
871
+ .join(" | "),
984
872
  };
985
873
  typeDeclaration.docs = [`Alias for ${typeDeclaration.name}`];
986
874
 
987
875
  typeDeclaration.type += ` | ${getModelExpression(context, type, {
988
- skipPolymorphicUnion: true
876
+ skipPolymorphicUnion: true,
989
877
  })}`;
990
878
  return typeDeclaration;
991
879
  }
@@ -993,7 +881,7 @@ function buildModelPolymorphicType(context: SdkContext, type: SdkModelType) {
993
881
  function buildModelProperty(
994
882
  context: SdkContext,
995
883
  property: SdkModelPropertyType,
996
- model: SdkModelType
884
+ model: SdkModelType,
997
885
  ): PropertySignatureStructure {
998
886
  const normalizedPropName = normalizeModelPropertyName(context, property);
999
887
  if (
@@ -1004,9 +892,9 @@ function buildModelProperty(
1004
892
  code: "property-name-normalized",
1005
893
  format: {
1006
894
  propertyName: property.name,
1007
- normalizedName: normalizedPropName
895
+ normalizedName: normalizedPropName,
1008
896
  },
1009
- target: NoTarget
897
+ target: NoTarget,
1010
898
  });
1011
899
  }
1012
900
 
@@ -1017,17 +905,12 @@ function buildModelProperty(
1017
905
  // 1. it is discriminated union
1018
906
  // 2. it has other discriminator values except itself
1019
907
  if (isDiscriminatedUnion(model) && allDiscriminatorValues.length > 1) {
1020
- typeExpression = allDiscriminatorValues
1021
- .map((value) => `"${value}"`)
1022
- .join(" | ");
1023
- } else if (
1024
- property.kind === "property" &&
1025
- property.serializationOptions.multipart?.isFilePart
1026
- ) {
908
+ typeExpression = allDiscriminatorValues.map((value) => `"${value}"`).join(" | ");
909
+ } else if (property.kind === "property" && property.serializationOptions.multipart?.isFilePart) {
1027
910
  typeExpression = getMultipartFileTypeExpression(context, property);
1028
911
  } else {
1029
912
  typeExpression = getTypeExpression(context, property.type, {
1030
- isOptional: property.optional
913
+ isOptional: property.optional,
1031
914
  });
1032
915
  }
1033
916
 
@@ -1036,7 +919,7 @@ function buildModelProperty(
1036
919
  name: normalizedPropName,
1037
920
  type: typeExpression,
1038
921
  hasQuestionToken: property.optional,
1039
- isReadonly: isReadOnly(property as SdkModelPropertyType)
922
+ isReadonly: isReadOnly(property as SdkModelPropertyType),
1040
923
  };
1041
924
 
1042
925
  if (property.doc) {
@@ -1072,22 +955,14 @@ export function visitPackageTypes(context: SdkContext) {
1072
955
  }
1073
956
  }
1074
957
 
1075
- function visitClient(
1076
- context: SdkContext,
1077
- client: SdkClientType<SdkServiceOperation>
1078
- ) {
958
+ function visitClient(context: SdkContext, client: SdkClientType<SdkServiceOperation>) {
1079
959
  // TODO: include the client parameters
1080
960
  // https://github.com/Azure/autorest.typescript/issues/3148
1081
961
  // Comment this out for now, as client initialization is not used in the generated code
1082
- getAllOperationsFromClient(client).forEach((method) =>
1083
- visitClientMethod(context, method)
1084
- );
962
+ getAllOperationsFromClient(client).forEach((method) => visitClientMethod(context, method));
1085
963
  }
1086
964
 
1087
- function visitClientMethod(
1088
- context: SdkContext,
1089
- method: SdkMethod<SdkHttpOperation>
1090
- ) {
965
+ function visitClientMethod(context: SdkContext, method: SdkMethod<SdkHttpOperation>) {
1091
966
  switch (method.kind) {
1092
967
  case "lro":
1093
968
  case "paging":
@@ -1100,9 +975,9 @@ function visitClientMethod(
1100
975
  reportDiagnostic(context.program, {
1101
976
  code: "unknown-sdk-method-kind",
1102
977
  format: {
1103
- methodKind: (method as any).kind
978
+ methodKind: (method as any).kind,
1104
979
  },
1105
- target: NoTarget
980
+ target: NoTarget,
1106
981
  });
1107
982
  return; // Skip processing this method but continue with others
1108
983
  }
@@ -1112,9 +987,7 @@ function visitOperation(context: SdkContext, operation: SdkHttpOperation) {
1112
987
  // Visit the request
1113
988
  visitType(context, operation.bodyParam?.type);
1114
989
  // Visit the response
1115
- operation.exceptions.forEach((exception) =>
1116
- visitType(context, exception.type)
1117
- );
990
+ operation.exceptions.forEach((exception) => visitType(context, exception.type));
1118
991
 
1119
992
  operation.parameters.forEach((parameter) => {
1120
993
  visitType(context, parameter.type);
@@ -1123,10 +996,7 @@ function visitOperation(context: SdkContext, operation: SdkHttpOperation) {
1123
996
  operation.responses.forEach((response) => visitType(context, response.type));
1124
997
  }
1125
998
 
1126
- function visitMethod(
1127
- context: SdkContext,
1128
- method: SdkServiceMethod<SdkHttpOperation>
1129
- ) {
999
+ function visitMethod(context: SdkContext, method: SdkServiceMethod<SdkHttpOperation>) {
1130
1000
  // Visit the request
1131
1001
  method.parameters.forEach((parameter) => {
1132
1002
  visitType(context, parameter.type);
@@ -1141,7 +1011,7 @@ function visitMethod(
1141
1011
  */
1142
1012
  function trackPagedModelInNonPagingMethod(
1143
1013
  context: SdkContext,
1144
- method: SdkServiceMethod<SdkHttpOperation>
1014
+ method: SdkServiceMethod<SdkHttpOperation>,
1145
1015
  ): void {
1146
1016
  if (method.kind !== "basic" && method.kind !== "lro") return;
1147
1017
  const respType = method.response.type;