@azure-tools/typespec-ts 0.54.0-dev.6 → 0.54.0-dev.7

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 (506) hide show
  1. package/dist/src/contextManager.d.ts +5 -5
  2. package/dist/src/contextManager.d.ts.map +1 -1
  3. package/dist/src/contextManager.js.map +1 -1
  4. package/dist/src/framework/declaration.d.ts +1 -1
  5. package/dist/src/framework/declaration.d.ts.map +1 -1
  6. package/dist/src/framework/declaration.js +2 -4
  7. package/dist/src/framework/declaration.js.map +1 -1
  8. package/dist/src/framework/dependency.d.ts.map +1 -1
  9. package/dist/src/framework/hooks/binder.d.ts +1 -1
  10. package/dist/src/framework/hooks/binder.d.ts.map +1 -1
  11. package/dist/src/framework/hooks/binder.js +12 -20
  12. package/dist/src/framework/hooks/binder.js.map +1 -1
  13. package/dist/src/framework/hooks/sdkTypes.d.ts +1 -1
  14. package/dist/src/framework/hooks/sdkTypes.d.ts.map +1 -1
  15. package/dist/src/framework/hooks/sdkTypes.js +8 -11
  16. package/dist/src/framework/hooks/sdkTypes.js.map +1 -1
  17. package/dist/src/framework/hooks/useDependencies.d.ts.map +1 -1
  18. package/dist/src/framework/hooks/useDependencies.js +1 -1
  19. package/dist/src/framework/hooks/useDependencies.js.map +1 -1
  20. package/dist/src/framework/load-static-helpers.d.ts +1 -1
  21. package/dist/src/framework/load-static-helpers.d.ts.map +1 -1
  22. package/dist/src/framework/load-static-helpers.js +12 -25
  23. package/dist/src/framework/load-static-helpers.js.map +1 -1
  24. package/dist/src/framework/reference.d.ts.map +1 -1
  25. package/dist/src/framework/reference.js +1 -1
  26. package/dist/src/framework/reference.js.map +1 -1
  27. package/dist/src/framework/sample.js +8 -8
  28. package/dist/src/framework/sample.js.map +1 -1
  29. package/dist/src/index.d.ts +1 -1
  30. package/dist/src/index.d.ts.map +1 -1
  31. package/dist/src/index.js +47 -48
  32. package/dist/src/index.js.map +1 -1
  33. package/dist/src/lib.d.ts +1 -1
  34. package/dist/src/lib.d.ts.map +1 -1
  35. package/dist/src/lib.js +140 -140
  36. package/dist/src/lib.js.map +1 -1
  37. package/dist/src/metaTree.d.ts +1 -1
  38. package/dist/src/metaTree.d.ts.map +1 -1
  39. package/dist/src/modular/buildClassicalClient.d.ts +1 -1
  40. package/dist/src/modular/buildClassicalClient.d.ts.map +1 -1
  41. package/dist/src/modular/buildClassicalClient.js +49 -62
  42. package/dist/src/modular/buildClassicalClient.js.map +1 -1
  43. package/dist/src/modular/buildClassicalOperationGroups.d.ts +2 -2
  44. package/dist/src/modular/buildClassicalOperationGroups.d.ts.map +1 -1
  45. package/dist/src/modular/buildClassicalOperationGroups.js +4 -7
  46. package/dist/src/modular/buildClassicalOperationGroups.js.map +1 -1
  47. package/dist/src/modular/buildClientContext.d.ts +2 -2
  48. package/dist/src/modular/buildClientContext.d.ts.map +1 -1
  49. package/dist/src/modular/buildClientContext.js +30 -36
  50. package/dist/src/modular/buildClientContext.js.map +1 -1
  51. package/dist/src/modular/buildModularOptions.d.ts +1 -1
  52. package/dist/src/modular/buildModularOptions.d.ts.map +1 -1
  53. package/dist/src/modular/buildModularOptions.js +2 -2
  54. package/dist/src/modular/buildModularOptions.js.map +1 -1
  55. package/dist/src/modular/buildOperations.d.ts +3 -3
  56. package/dist/src/modular/buildOperations.d.ts.map +1 -1
  57. package/dist/src/modular/buildOperations.js +22 -23
  58. package/dist/src/modular/buildOperations.js.map +1 -1
  59. package/dist/src/modular/buildProjectFiles.d.ts +1 -1
  60. package/dist/src/modular/buildProjectFiles.d.ts.map +1 -1
  61. package/dist/src/modular/buildProjectFiles.js +7 -9
  62. package/dist/src/modular/buildProjectFiles.js.map +1 -1
  63. package/dist/src/modular/buildRestorePoller.d.ts +1 -1
  64. package/dist/src/modular/buildRestorePoller.d.ts.map +1 -1
  65. package/dist/src/modular/buildRestorePoller.js +11 -11
  66. package/dist/src/modular/buildRestorePoller.js.map +1 -1
  67. package/dist/src/modular/buildRootIndex.d.ts +2 -2
  68. package/dist/src/modular/buildRootIndex.d.ts.map +1 -1
  69. package/dist/src/modular/buildRootIndex.js +30 -39
  70. package/dist/src/modular/buildRootIndex.js.map +1 -1
  71. package/dist/src/modular/buildSubpathIndex.d.ts.map +1 -1
  72. package/dist/src/modular/buildSubpathIndex.js +9 -17
  73. package/dist/src/modular/buildSubpathIndex.js.map +1 -1
  74. package/dist/src/modular/emitLoggerFile.d.ts.map +1 -1
  75. package/dist/src/modular/emitLoggerFile.js +2 -2
  76. package/dist/src/modular/emitLoggerFile.js.map +1 -1
  77. package/dist/src/modular/emitModels.d.ts +1 -1
  78. package/dist/src/modular/emitModels.d.ts.map +1 -1
  79. package/dist/src/modular/emitModels.js +54 -72
  80. package/dist/src/modular/emitModels.js.map +1 -1
  81. package/dist/src/modular/emitModelsOptions.d.ts +1 -1
  82. package/dist/src/modular/emitModelsOptions.d.ts.map +1 -1
  83. package/dist/src/modular/emitModelsOptions.js +6 -7
  84. package/dist/src/modular/emitModelsOptions.js.map +1 -1
  85. package/dist/src/modular/emitSamples.d.ts.map +1 -1
  86. package/dist/src/modular/emitSamples.js +40 -52
  87. package/dist/src/modular/emitSamples.js.map +1 -1
  88. package/dist/src/modular/emitTests.d.ts.map +1 -1
  89. package/dist/src/modular/emitTests.js +9 -12
  90. package/dist/src/modular/emitTests.js.map +1 -1
  91. package/dist/src/modular/external-dependencies.js +54 -54
  92. package/dist/src/modular/helpers/classicalOperationHelpers.d.ts +1 -1
  93. package/dist/src/modular/helpers/classicalOperationHelpers.d.ts.map +1 -1
  94. package/dist/src/modular/helpers/classicalOperationHelpers.js +27 -36
  95. package/dist/src/modular/helpers/classicalOperationHelpers.js.map +1 -1
  96. package/dist/src/modular/helpers/clientHelpers.d.ts +2 -2
  97. package/dist/src/modular/helpers/clientHelpers.d.ts.map +1 -1
  98. package/dist/src/modular/helpers/clientHelpers.js +20 -38
  99. package/dist/src/modular/helpers/clientHelpers.js.map +1 -1
  100. package/dist/src/modular/helpers/clientOptionHelpers.d.ts.map +1 -1
  101. package/dist/src/modular/helpers/clientOptionHelpers.js.map +1 -1
  102. package/dist/src/modular/helpers/exampleValueHelpers.d.ts +2 -2
  103. package/dist/src/modular/helpers/exampleValueHelpers.d.ts.map +1 -1
  104. package/dist/src/modular/helpers/exampleValueHelpers.js +39 -58
  105. package/dist/src/modular/helpers/exampleValueHelpers.js.map +1 -1
  106. package/dist/src/modular/helpers/namingHelpers.d.ts +1 -1
  107. package/dist/src/modular/helpers/namingHelpers.d.ts.map +1 -1
  108. package/dist/src/modular/helpers/namingHelpers.js +4 -5
  109. package/dist/src/modular/helpers/namingHelpers.js.map +1 -1
  110. package/dist/src/modular/helpers/operationHelpers.d.ts +2 -2
  111. package/dist/src/modular/helpers/operationHelpers.d.ts.map +1 -1
  112. package/dist/src/modular/helpers/operationHelpers.js +136 -196
  113. package/dist/src/modular/helpers/operationHelpers.js.map +1 -1
  114. package/dist/src/modular/helpers/typeHelpers.d.ts +1 -1
  115. package/dist/src/modular/helpers/typeHelpers.d.ts.map +1 -1
  116. package/dist/src/modular/helpers/typeHelpers.js +1 -1
  117. package/dist/src/modular/helpers/typeHelpers.js.map +1 -1
  118. package/dist/src/modular/serialization/buildDeserializerFunction.d.ts +1 -1
  119. package/dist/src/modular/serialization/buildDeserializerFunction.d.ts.map +1 -1
  120. package/dist/src/modular/serialization/buildDeserializerFunction.js +50 -56
  121. package/dist/src/modular/serialization/buildDeserializerFunction.js.map +1 -1
  122. package/dist/src/modular/serialization/buildSerializerFunction.d.ts +1 -1
  123. package/dist/src/modular/serialization/buildSerializerFunction.d.ts.map +1 -1
  124. package/dist/src/modular/serialization/buildSerializerFunction.js +52 -59
  125. package/dist/src/modular/serialization/buildSerializerFunction.js.map +1 -1
  126. package/dist/src/modular/serialization/buildXmlSerializerFunction.d.ts +1 -1
  127. package/dist/src/modular/serialization/buildXmlSerializerFunction.d.ts.map +1 -1
  128. package/dist/src/modular/serialization/buildXmlSerializerFunction.js +43 -51
  129. package/dist/src/modular/serialization/buildXmlSerializerFunction.js.map +1 -1
  130. package/dist/src/modular/serialization/serializeUtils.d.ts.map +1 -1
  131. package/dist/src/modular/serialization/serializeUtils.js +4 -11
  132. package/dist/src/modular/serialization/serializeUtils.js.map +1 -1
  133. package/dist/src/modular/static-helpers-metadata.js +60 -60
  134. package/dist/src/modular/type-expressions/get-credential-expression.js +1 -1
  135. package/dist/src/modular/type-expressions/get-credential-expression.js.map +1 -1
  136. package/dist/src/modular/type-expressions/get-enum-expression.d.ts +1 -1
  137. package/dist/src/modular/type-expressions/get-enum-expression.d.ts.map +1 -1
  138. package/dist/src/modular/type-expressions/get-enum-expression.js +1 -1
  139. package/dist/src/modular/type-expressions/get-enum-expression.js.map +1 -1
  140. package/dist/src/modular/type-expressions/get-model-expression.d.ts.map +1 -1
  141. package/dist/src/modular/type-expressions/get-model-expression.js +7 -9
  142. package/dist/src/modular/type-expressions/get-model-expression.js.map +1 -1
  143. package/dist/src/modular/type-expressions/get-nullable-expression.d.ts +1 -1
  144. package/dist/src/modular/type-expressions/get-nullable-expression.d.ts.map +1 -1
  145. package/dist/src/modular/type-expressions/get-nullable-expression.js.map +1 -1
  146. package/dist/src/modular/type-expressions/get-type-expression.d.ts.map +1 -1
  147. package/dist/src/modular/type-expressions/get-type-expression.js +4 -8
  148. package/dist/src/modular/type-expressions/get-type-expression.js.map +1 -1
  149. package/dist/src/modular/type-expressions/get-union-expression.d.ts +1 -1
  150. package/dist/src/modular/type-expressions/get-union-expression.d.ts.map +1 -1
  151. package/dist/src/modular/type-expressions/get-union-expression.js.map +1 -1
  152. package/dist/src/rlc-common/buildClient.d.ts +1 -1
  153. package/dist/src/rlc-common/buildClient.d.ts.map +1 -1
  154. package/dist/src/rlc-common/buildClient.js +48 -66
  155. package/dist/src/rlc-common/buildClient.js.map +1 -1
  156. package/dist/src/rlc-common/buildClientDefinitions.d.ts.map +1 -1
  157. package/dist/src/rlc-common/buildClientDefinitions.js +24 -42
  158. package/dist/src/rlc-common/buildClientDefinitions.js.map +1 -1
  159. package/dist/src/rlc-common/buildIndexFile.d.ts.map +1 -1
  160. package/dist/src/rlc-common/buildIndexFile.js +57 -57
  161. package/dist/src/rlc-common/buildIndexFile.js.map +1 -1
  162. package/dist/src/rlc-common/buildIsUnexpectedHelper.d.ts.map +1 -1
  163. package/dist/src/rlc-common/buildIsUnexpectedHelper.js +32 -35
  164. package/dist/src/rlc-common/buildIsUnexpectedHelper.js.map +1 -1
  165. package/dist/src/rlc-common/buildLogger.d.ts.map +1 -1
  166. package/dist/src/rlc-common/buildLogger.js +3 -3
  167. package/dist/src/rlc-common/buildLogger.js.map +1 -1
  168. package/dist/src/rlc-common/buildMethodShortcuts.d.ts.map +1 -1
  169. package/dist/src/rlc-common/buildMethodShortcuts.js +3 -3
  170. package/dist/src/rlc-common/buildMethodShortcuts.js.map +1 -1
  171. package/dist/src/rlc-common/buildObjectTypes.d.ts.map +1 -1
  172. package/dist/src/rlc-common/buildObjectTypes.js +29 -46
  173. package/dist/src/rlc-common/buildObjectTypes.js.map +1 -1
  174. package/dist/src/rlc-common/buildPaginateHelper.d.ts.map +1 -1
  175. package/dist/src/rlc-common/buildPaginateHelper.js +2 -2
  176. package/dist/src/rlc-common/buildPaginateHelper.js.map +1 -1
  177. package/dist/src/rlc-common/buildParameterTypes.d.ts.map +1 -1
  178. package/dist/src/rlc-common/buildParameterTypes.js +42 -50
  179. package/dist/src/rlc-common/buildParameterTypes.js.map +1 -1
  180. package/dist/src/rlc-common/buildPollingHelper.d.ts.map +1 -1
  181. package/dist/src/rlc-common/buildPollingHelper.js +5 -5
  182. package/dist/src/rlc-common/buildPollingHelper.js.map +1 -1
  183. package/dist/src/rlc-common/buildResponseTypes.d.ts.map +1 -1
  184. package/dist/src/rlc-common/buildResponseTypes.js +19 -22
  185. package/dist/src/rlc-common/buildResponseTypes.js.map +1 -1
  186. package/dist/src/rlc-common/buildSamples.d.ts +1 -1
  187. package/dist/src/rlc-common/buildSamples.d.ts.map +1 -1
  188. package/dist/src/rlc-common/buildSamples.js +2 -2
  189. package/dist/src/rlc-common/buildSchemaType.d.ts.map +1 -1
  190. package/dist/src/rlc-common/buildSchemaType.js +9 -13
  191. package/dist/src/rlc-common/buildSchemaType.js.map +1 -1
  192. package/dist/src/rlc-common/buildSerializeHelper.d.ts.map +1 -1
  193. package/dist/src/rlc-common/buildSerializeHelper.js +4 -4
  194. package/dist/src/rlc-common/buildSerializeHelper.js.map +1 -1
  195. package/dist/src/rlc-common/buildTopLevelIndexFile.d.ts.map +1 -1
  196. package/dist/src/rlc-common/buildTopLevelIndexFile.js +9 -13
  197. package/dist/src/rlc-common/buildTopLevelIndexFile.js.map +1 -1
  198. package/dist/src/rlc-common/helpers/apiVersionUtil.d.ts.map +1 -1
  199. package/dist/src/rlc-common/helpers/apiVersionUtil.js +2 -3
  200. package/dist/src/rlc-common/helpers/apiVersionUtil.js.map +1 -1
  201. package/dist/src/rlc-common/helpers/importsUtil.d.ts.map +1 -1
  202. package/dist/src/rlc-common/helpers/importsUtil.js +23 -25
  203. package/dist/src/rlc-common/helpers/importsUtil.js.map +1 -1
  204. package/dist/src/rlc-common/helpers/nameConstructors.d.ts.map +1 -1
  205. package/dist/src/rlc-common/helpers/nameConstructors.js.map +1 -1
  206. package/dist/src/rlc-common/helpers/nameUtils.d.ts.map +1 -1
  207. package/dist/src/rlc-common/helpers/nameUtils.js +8 -13
  208. package/dist/src/rlc-common/helpers/nameUtils.js.map +1 -1
  209. package/dist/src/rlc-common/helpers/operationHelpers.d.ts.map +1 -1
  210. package/dist/src/rlc-common/helpers/operationHelpers.js +8 -12
  211. package/dist/src/rlc-common/helpers/operationHelpers.js.map +1 -1
  212. package/dist/src/rlc-common/helpers/pathUtils.d.ts.map +1 -1
  213. package/dist/src/rlc-common/helpers/pathUtils.js +1 -3
  214. package/dist/src/rlc-common/helpers/pathUtils.js.map +1 -1
  215. package/dist/src/rlc-common/helpers/schemaHelpers.d.ts.map +1 -1
  216. package/dist/src/rlc-common/helpers/schemaHelpers.js +1 -1
  217. package/dist/src/rlc-common/helpers/schemaHelpers.js.map +1 -1
  218. package/dist/src/rlc-common/helpers/shortcutMethods.d.ts +1 -1
  219. package/dist/src/rlc-common/helpers/shortcutMethods.d.ts.map +1 -1
  220. package/dist/src/rlc-common/helpers/shortcutMethods.js +2 -2
  221. package/dist/src/rlc-common/helpers/shortcutMethods.js.map +1 -1
  222. package/dist/src/rlc-common/helpers/typeUtil.d.ts.map +1 -1
  223. package/dist/src/rlc-common/helpers/typeUtil.js +1 -2
  224. package/dist/src/rlc-common/helpers/typeUtil.js.map +1 -1
  225. package/dist/src/rlc-common/helpers/valueGenerationUtil.js +3 -4
  226. package/dist/src/rlc-common/helpers/valueGenerationUtil.js.map +1 -1
  227. package/dist/src/rlc-common/index.d.ts +28 -28
  228. package/dist/src/rlc-common/index.d.ts.map +1 -1
  229. package/dist/src/rlc-common/index.js +28 -28
  230. package/dist/src/rlc-common/index.js.map +1 -1
  231. package/dist/src/rlc-common/interfaces.d.ts.map +1 -1
  232. package/dist/src/rlc-common/interfaces.js.map +1 -1
  233. package/dist/src/rlc-common/metadata/buildApiExtractorConfig.d.ts.map +1 -1
  234. package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js +13 -13
  235. package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js.map +1 -1
  236. package/dist/src/rlc-common/metadata/buildChangelogFile.js +1 -1
  237. package/dist/src/rlc-common/metadata/buildESLintConfig.d.ts.map +1 -1
  238. package/dist/src/rlc-common/metadata/buildESLintConfig.js +3 -5
  239. package/dist/src/rlc-common/metadata/buildESLintConfig.js.map +1 -1
  240. package/dist/src/rlc-common/metadata/buildLicenseFile.js +1 -1
  241. package/dist/src/rlc-common/metadata/buildPackageFile.d.ts.map +1 -1
  242. package/dist/src/rlc-common/metadata/buildPackageFile.js +16 -16
  243. package/dist/src/rlc-common/metadata/buildPackageFile.js.map +1 -1
  244. package/dist/src/rlc-common/metadata/buildReadmeFile.d.ts.map +1 -1
  245. package/dist/src/rlc-common/metadata/buildReadmeFile.js +10 -18
  246. package/dist/src/rlc-common/metadata/buildReadmeFile.js.map +1 -1
  247. package/dist/src/rlc-common/metadata/buildRollupConfig.d.ts.map +1 -1
  248. package/dist/src/rlc-common/metadata/buildRollupConfig.js +3 -4
  249. package/dist/src/rlc-common/metadata/buildRollupConfig.js.map +1 -1
  250. package/dist/src/rlc-common/metadata/buildSampleEnvFile.d.ts.map +1 -1
  251. package/dist/src/rlc-common/metadata/buildSampleEnvFile.js +2 -3
  252. package/dist/src/rlc-common/metadata/buildSampleEnvFile.js.map +1 -1
  253. package/dist/src/rlc-common/metadata/buildTestConfig.js +8 -8
  254. package/dist/src/rlc-common/metadata/buildTsConfig.d.ts.map +1 -1
  255. package/dist/src/rlc-common/metadata/buildTsConfig.js +23 -21
  256. package/dist/src/rlc-common/metadata/buildTsConfig.js.map +1 -1
  257. package/dist/src/rlc-common/metadata/buildVitestConfig.d.ts.map +1 -1
  258. package/dist/src/rlc-common/metadata/buildVitestConfig.js +3 -4
  259. package/dist/src/rlc-common/metadata/buildVitestConfig.js.map +1 -1
  260. package/dist/src/rlc-common/metadata/buildWarpConfig.d.ts.map +1 -1
  261. package/dist/src/rlc-common/metadata/buildWarpConfig.js +2 -2
  262. package/dist/src/rlc-common/metadata/buildWarpConfig.js.map +1 -1
  263. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts +1 -1
  264. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts.map +1 -1
  265. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js +13 -13
  266. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js.map +1 -1
  267. package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.d.ts.map +1 -1
  268. package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js +22 -26
  269. package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js.map +1 -1
  270. package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.d.ts.map +1 -1
  271. package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js +15 -16
  272. package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js.map +1 -1
  273. package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js +8 -8
  274. package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js.map +1 -1
  275. package/dist/src/rlc-common/metadata/packageJson/packageCommon.d.ts.map +1 -1
  276. package/dist/src/rlc-common/metadata/packageJson/packageCommon.js +26 -29
  277. package/dist/src/rlc-common/metadata/packageJson/packageCommon.js.map +1 -1
  278. package/dist/src/rlc-common/test/buildKarmaConfig.js +1 -1
  279. package/dist/src/rlc-common/test/buildRecordedClient.js +3 -3
  280. package/dist/src/rlc-common/test/buildSampleTest.d.ts.map +1 -1
  281. package/dist/src/rlc-common/test/buildSampleTest.js +2 -2
  282. package/dist/src/rlc-common/test/buildSampleTest.js.map +1 -1
  283. package/dist/src/rlc-common/test/buildSnippets.d.ts.map +1 -1
  284. package/dist/src/rlc-common/test/buildSnippets.js +4 -6
  285. package/dist/src/rlc-common/test/buildSnippets.js.map +1 -1
  286. package/dist/src/rlc-common/transformSampleGroups.d.ts.map +1 -1
  287. package/dist/src/rlc-common/transformSampleGroups.js +19 -23
  288. package/dist/src/rlc-common/transformSampleGroups.js.map +1 -1
  289. package/dist/src/testing/index.d.ts.map +1 -1
  290. package/dist/src/testing/index.js +1 -1
  291. package/dist/src/testing/index.js.map +1 -1
  292. package/dist/src/transform/transform.d.ts +1 -1
  293. package/dist/src/transform/transform.d.ts.map +1 -1
  294. package/dist/src/transform/transform.js +10 -11
  295. package/dist/src/transform/transform.js.map +1 -1
  296. package/dist/src/transform/transformApiVersionInfo.d.ts +1 -1
  297. package/dist/src/transform/transformApiVersionInfo.d.ts.map +1 -1
  298. package/dist/src/transform/transformApiVersionInfo.js +8 -10
  299. package/dist/src/transform/transformApiVersionInfo.js.map +1 -1
  300. package/dist/src/transform/transformHelperFunctionDetails.d.ts +1 -1
  301. package/dist/src/transform/transformHelperFunctionDetails.d.ts.map +1 -1
  302. package/dist/src/transform/transformHelperFunctionDetails.js +9 -11
  303. package/dist/src/transform/transformHelperFunctionDetails.js.map +1 -1
  304. package/dist/src/transform/transformParameters.d.ts +2 -2
  305. package/dist/src/transform/transformParameters.d.ts.map +1 -1
  306. package/dist/src/transform/transformParameters.js +22 -28
  307. package/dist/src/transform/transformParameters.js.map +1 -1
  308. package/dist/src/transform/transformPaths.d.ts +1 -1
  309. package/dist/src/transform/transformPaths.d.ts.map +1 -1
  310. package/dist/src/transform/transformPaths.js +11 -12
  311. package/dist/src/transform/transformPaths.js.map +1 -1
  312. package/dist/src/transform/transformResponses.d.ts +1 -1
  313. package/dist/src/transform/transformResponses.d.ts.map +1 -1
  314. package/dist/src/transform/transformResponses.js +12 -12
  315. package/dist/src/transform/transformResponses.js.map +1 -1
  316. package/dist/src/transform/transformSchemas.d.ts.map +1 -1
  317. package/dist/src/transform/transformSchemas.js +9 -15
  318. package/dist/src/transform/transformSchemas.js.map +1 -1
  319. package/dist/src/transform/transformTelemetryInfo.d.ts +1 -1
  320. package/dist/src/transform/transformTelemetryInfo.d.ts.map +1 -1
  321. package/dist/src/transform/transformTelemetryInfo.js +3 -3
  322. package/dist/src/transform/transformTelemetryInfo.js.map +1 -1
  323. package/dist/src/transform/transfromRLCOptions.d.ts +1 -1
  324. package/dist/src/transform/transfromRLCOptions.d.ts.map +1 -1
  325. package/dist/src/transform/transfromRLCOptions.js +14 -26
  326. package/dist/src/transform/transfromRLCOptions.js.map +1 -1
  327. package/dist/src/utils/clientUtils.d.ts +1 -1
  328. package/dist/src/utils/clientUtils.d.ts.map +1 -1
  329. package/dist/src/utils/clientUtils.js +11 -14
  330. package/dist/src/utils/clientUtils.js.map +1 -1
  331. package/dist/src/utils/credentialUtils.d.ts +1 -1
  332. package/dist/src/utils/credentialUtils.d.ts.map +1 -1
  333. package/dist/src/utils/credentialUtils.js +3 -3
  334. package/dist/src/utils/credentialUtils.js.map +1 -1
  335. package/dist/src/utils/crossLanguageDef.d.ts.map +1 -1
  336. package/dist/src/utils/crossLanguageDef.js +8 -12
  337. package/dist/src/utils/crossLanguageDef.js.map +1 -1
  338. package/dist/src/utils/emitUtil.d.ts +1 -1
  339. package/dist/src/utils/emitUtil.d.ts.map +1 -1
  340. package/dist/src/utils/emitUtil.js +4 -6
  341. package/dist/src/utils/emitUtil.js.map +1 -1
  342. package/dist/src/utils/fileSystemUtils.d.ts.map +1 -1
  343. package/dist/src/utils/fileSystemUtils.js +2 -2
  344. package/dist/src/utils/fileSystemUtils.js.map +1 -1
  345. package/dist/src/utils/importHelper.d.ts.map +1 -1
  346. package/dist/src/utils/importHelper.js +2 -4
  347. package/dist/src/utils/importHelper.js.map +1 -1
  348. package/dist/src/utils/interfaces.d.ts +1 -1
  349. package/dist/src/utils/interfaces.d.ts.map +1 -1
  350. package/dist/src/utils/mediaTypes.d.ts.map +1 -1
  351. package/dist/src/utils/mediaTypes.js +7 -19
  352. package/dist/src/utils/mediaTypes.js.map +1 -1
  353. package/dist/src/utils/modelUtils.d.ts +2 -2
  354. package/dist/src/utils/modelUtils.d.ts.map +1 -1
  355. package/dist/src/utils/modelUtils.js +107 -170
  356. package/dist/src/utils/modelUtils.js.map +1 -1
  357. package/dist/src/utils/namespaceUtils.d.ts.map +1 -1
  358. package/dist/src/utils/namespaceUtils.js +2 -2
  359. package/dist/src/utils/namespaceUtils.js.map +1 -1
  360. package/dist/src/utils/operationUtil.d.ts +1 -1
  361. package/dist/src/utils/operationUtil.d.ts.map +1 -1
  362. package/dist/src/utils/operationUtil.js +29 -42
  363. package/dist/src/utils/operationUtil.js.map +1 -1
  364. package/dist/src/utils/parameterUtils.d.ts +1 -1
  365. package/dist/src/utils/parameterUtils.d.ts.map +1 -1
  366. package/dist/src/utils/parameterUtils.js +19 -22
  367. package/dist/src/utils/parameterUtils.js.map +1 -1
  368. package/dist/src/utils/resolve-project-root.js +2 -2
  369. package/dist/src/utils/resolve-project-root.js.map +1 -1
  370. package/dist/tsconfig.tsbuildinfo +1 -1
  371. package/package.json +1 -3
  372. package/src/contextManager.ts +6 -9
  373. package/src/framework/declaration.ts +18 -28
  374. package/src/framework/dependency.ts +1 -2
  375. package/src/framework/hooks/binder.ts +47 -120
  376. package/src/framework/hooks/sdkTypes.ts +27 -54
  377. package/src/framework/hooks/useDependencies.ts +2 -4
  378. package/src/framework/load-static-helpers.ts +28 -51
  379. package/src/framework/reference.ts +2 -5
  380. package/src/framework/sample.ts +9 -9
  381. package/src/index.ts +111 -180
  382. package/src/lib.ts +143 -158
  383. package/src/metaTree.ts +1 -1
  384. package/src/modular/buildClassicalClient.ts +83 -160
  385. package/src/modular/buildClassicalOperationGroups.ts +14 -39
  386. package/src/modular/buildClientContext.ts +54 -83
  387. package/src/modular/buildModularOptions.ts +4 -5
  388. package/src/modular/buildOperations.ts +46 -73
  389. package/src/modular/buildProjectFiles.ts +18 -47
  390. package/src/modular/buildRestorePoller.ts +27 -46
  391. package/src/modular/buildRootIndex.ts +86 -159
  392. package/src/modular/buildSubpathIndex.ts +35 -58
  393. package/src/modular/emitLoggerFile.ts +4 -9
  394. package/src/modular/emitModels.ts +136 -266
  395. package/src/modular/emitModelsOptions.ts +10 -16
  396. package/src/modular/emitSamples.ts +91 -177
  397. package/src/modular/emitTests.ts +28 -61
  398. package/src/modular/external-dependencies.ts +54 -54
  399. package/src/modular/helpers/classicalOperationHelpers.ts +73 -126
  400. package/src/modular/helpers/clientHelpers.ts +41 -88
  401. package/src/modular/helpers/clientOptionHelpers.ts +4 -11
  402. package/src/modular/helpers/exampleValueHelpers.ts +97 -209
  403. package/src/modular/helpers/namingHelpers.ts +12 -28
  404. package/src/modular/helpers/operationHelpers.ts +430 -757
  405. package/src/modular/helpers/typeHelpers.ts +11 -22
  406. package/src/modular/serialization/buildDeserializerFunction.ts +88 -122
  407. package/src/modular/serialization/buildSerializerFunction.ts +91 -129
  408. package/src/modular/serialization/buildXmlSerializerFunction.ts +104 -183
  409. package/src/modular/serialization/serializeUtils.ts +12 -21
  410. package/src/modular/static/rollup.test.config.js +11 -14
  411. package/src/modular/static/scripts/renameOutput.mjs +2 -2
  412. package/src/modular/static-helpers-metadata.ts +60 -60
  413. package/src/modular/type-expressions/get-credential-expression.ts +1 -1
  414. package/src/modular/type-expressions/get-enum-expression.ts +5 -10
  415. package/src/modular/type-expressions/get-model-expression.ts +13 -17
  416. package/src/modular/type-expressions/get-nullable-expression.ts +4 -5
  417. package/src/modular/type-expressions/get-type-expression.ts +8 -12
  418. package/src/modular/type-expressions/get-union-expression.ts +4 -4
  419. package/src/modular/type-expressions/utils.ts +1 -1
  420. package/src/rlc-common/buildClient.ts +70 -141
  421. package/src/rlc-common/buildClientDefinitions.ts +43 -87
  422. package/src/rlc-common/buildIndexFile.ts +78 -78
  423. package/src/rlc-common/buildIsUnexpectedHelper.ts +34 -41
  424. package/src/rlc-common/buildLogger.ts +7 -7
  425. package/src/rlc-common/buildMethodShortcuts.ts +9 -21
  426. package/src/rlc-common/buildObjectTypes.ts +78 -155
  427. package/src/rlc-common/buildPaginateHelper.ts +9 -12
  428. package/src/rlc-common/buildParameterTypes.ts +92 -137
  429. package/src/rlc-common/buildPollingHelper.ts +7 -7
  430. package/src/rlc-common/buildResponseTypes.ts +34 -57
  431. package/src/rlc-common/buildSamples.ts +3 -3
  432. package/src/rlc-common/buildSchemaType.ts +12 -29
  433. package/src/rlc-common/buildSerializeHelper.ts +5 -5
  434. package/src/rlc-common/buildTopLevelIndexFile.ts +12 -19
  435. package/src/rlc-common/helpers/apiVersionUtil.ts +5 -10
  436. package/src/rlc-common/helpers/importsUtil.ts +27 -30
  437. package/src/rlc-common/helpers/nameConstructors.ts +16 -50
  438. package/src/rlc-common/helpers/nameUtils.ts +19 -42
  439. package/src/rlc-common/helpers/operationHelpers.ts +14 -31
  440. package/src/rlc-common/helpers/pathUtils.ts +2 -7
  441. package/src/rlc-common/helpers/schemaHelpers.ts +4 -15
  442. package/src/rlc-common/helpers/shortcutMethods.ts +6 -15
  443. package/src/rlc-common/helpers/typeUtil.ts +4 -11
  444. package/src/rlc-common/helpers/valueGenerationUtil.ts +16 -39
  445. package/src/rlc-common/index.ts +28 -28
  446. package/src/rlc-common/interfaces.ts +3 -11
  447. package/src/rlc-common/metadata/buildApiExtractorConfig.ts +17 -24
  448. package/src/rlc-common/metadata/buildChangelogFile.ts +1 -1
  449. package/src/rlc-common/metadata/buildESLintConfig.ts +3 -5
  450. package/src/rlc-common/metadata/buildLicenseFile.ts +1 -1
  451. package/src/rlc-common/metadata/buildPackageFile.ts +27 -35
  452. package/src/rlc-common/metadata/buildReadmeFile.ts +16 -29
  453. package/src/rlc-common/metadata/buildRollupConfig.ts +5 -8
  454. package/src/rlc-common/metadata/buildSampleEnvFile.ts +2 -3
  455. package/src/rlc-common/metadata/buildTestConfig.ts +10 -10
  456. package/src/rlc-common/metadata/buildTsConfig.ts +32 -35
  457. package/src/rlc-common/metadata/buildVitestConfig.ts +4 -10
  458. package/src/rlc-common/metadata/buildWarpConfig.ts +3 -6
  459. package/src/rlc-common/metadata/packageJson/azurePackageCommon.ts +16 -25
  460. package/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.ts +29 -50
  461. package/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.ts +20 -31
  462. package/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.ts +11 -13
  463. package/src/rlc-common/metadata/packageJson/packageCommon.ts +32 -52
  464. package/src/rlc-common/test/buildKarmaConfig.ts +1 -1
  465. package/src/rlc-common/test/buildRecordedClient.ts +3 -3
  466. package/src/rlc-common/test/buildSampleTest.ts +3 -3
  467. package/src/rlc-common/test/buildSnippets.ts +6 -12
  468. package/src/rlc-common/transformSampleGroups.ts +54 -105
  469. package/src/testing/index.ts +2 -5
  470. package/src/transform/transform.ts +22 -34
  471. package/src/transform/transformApiVersionInfo.ts +17 -30
  472. package/src/transform/transformHelperFunctionDetails.ts +14 -26
  473. package/src/transform/transformParameters.ts +55 -105
  474. package/src/transform/transformPaths.ts +26 -43
  475. package/src/transform/transformResponses.ts +26 -33
  476. package/src/transform/transformSchemas.ts +15 -33
  477. package/src/transform/transformTelemetryInfo.ts +8 -14
  478. package/src/transform/transfromRLCOptions.ts +53 -115
  479. package/src/utils/clientUtils.ts +22 -41
  480. package/src/utils/credentialUtils.ts +8 -19
  481. package/src/utils/crossLanguageDef.ts +15 -34
  482. package/src/utils/emitUtil.ts +11 -17
  483. package/src/utils/fileSystemUtils.ts +4 -6
  484. package/src/utils/importHelper.ts +5 -10
  485. package/src/utils/interfaces.ts +1 -1
  486. package/src/utils/mediaTypes.ts +13 -34
  487. package/src/utils/modelUtils.ts +174 -383
  488. package/src/utils/namespaceUtils.ts +8 -24
  489. package/src/utils/operationUtil.ts +98 -190
  490. package/src/utils/parameterUtils.ts +31 -54
  491. package/src/utils/resolve-project-root.ts +3 -3
  492. package/static/static-helpers/cloudSettingHelpers.ts +4 -6
  493. package/static/static-helpers/multipartHelpers.ts +3 -3
  494. package/static/static-helpers/pagingHelpers.ts +28 -63
  495. package/static/static-helpers/pollingHelpers.ts +15 -28
  496. package/static/static-helpers/serialization/build-multi-collection.ts +1 -4
  497. package/static/static-helpers/serialization/check-prop-undefined.ts +1 -4
  498. package/static/static-helpers/serialization/get-binary-response.ts +2 -2
  499. package/static/static-helpers/serialization/get-binary-stream-response.ts +2 -4
  500. package/static/static-helpers/serialization/serialize-record.ts +1 -1
  501. package/static/static-helpers/serialization/serializers.ts +4 -7
  502. package/static/static-helpers/serialization/xml-helpers.ts +41 -89
  503. package/static/static-helpers/simplePollerHelpers.ts +9 -18
  504. package/static/static-helpers/storageCompatResponse.ts +10 -27
  505. package/static/static-helpers/urlTemplate.ts +4 -7
  506. package/static/test-helpers/recordedClient.ts +5 -10
@@ -1,107 +1,97 @@
1
+ import {
2
+ getClientOptions,
3
+ isHttpMetadata,
4
+ isReadOnly,
5
+ SdkBodyParameter,
6
+ SdkClientType,
7
+ SdkConstantType,
8
+ SdkEnumType,
9
+ SdkHttpOperation,
10
+ SdkHttpParameter,
11
+ SdkLroPagingServiceMethod,
12
+ SdkLroServiceMethod,
13
+ SdkMethod,
14
+ SdkMethodParameter,
15
+ SdkModelPropertyType,
16
+ SdkModelType,
17
+ SdkPagingServiceMethod,
18
+ SdkServiceResponseHeader,
19
+ SdkType,
20
+ } from "@azure-tools/typespec-client-generator-core";
21
+ import { NoTarget, Program } from "@typespec/compiler";
22
+ import { isHeader, isMetadata } from "@typespec/http";
1
23
  import {
2
24
  FunctionDeclarationStructure,
3
25
  OptionalKind,
4
26
  ParameterDeclarationStructure,
5
27
  StructureKind,
6
- TypeAliasDeclarationStructure
28
+ TypeAliasDeclarationStructure,
7
29
  } from "ts-morph";
8
- import { NoTarget, Program } from "@typespec/compiler";
9
- import {
10
- PagingHelpers,
11
- PollingHelpers,
12
- PlatformTypeHelpers,
13
- SerializationHelpers,
14
- StorageCompatHelpers,
15
- UrlTemplateHelpers,
16
- XmlHelpers
17
- } from "../static-helpers-metadata.js";
18
- import {
19
- getNullableValidType,
20
- isSpreadBodyParameter,
21
- isTypeNullable
22
- } from "./typeHelpers.js";
23
- import {
24
- getClassicalLayerPrefix,
25
- getOperationName,
26
- generateLocallyUniqueName
27
- } from "./namingHelpers.js";
30
+ import { useContext } from "../../contextManager.js";
31
+ import { useSdkTypes } from "../../framework/hooks/sdkTypes.js";
32
+ import { useDependencies } from "../../framework/hooks/useDependencies.js";
33
+ import { resolveReference } from "../../framework/reference.js";
34
+ import { refkey } from "../../framework/refkey.js";
35
+ import { reportDiagnostic } from "../../lib.js";
36
+ import { NameType, normalizeName } from "../../rlc-common/index.js";
37
+ import { SdkContext } from "../../utils/interfaces.js";
38
+ import { isAzureCoreErrorType } from "../../utils/modelUtils.js";
28
39
  import {
40
+ getCollectionFormatFromArrayEncoding,
29
41
  getCollectionFormatHelper,
42
+ getCollectionFormatParseHelper,
30
43
  hasCollectionFormatInfo,
44
+ hasDualFormatSupport,
31
45
  isBinaryPayload,
32
- isXmlPayload,
33
46
  isMultipartPayload,
34
- hasDualFormatSupport,
47
+ isXmlPayload,
48
+ KnownCollectionFormat,
35
49
  ServiceOperation,
36
- getCollectionFormatParseHelper,
37
- getCollectionFormatFromArrayEncoding,
38
- KnownCollectionFormat
39
50
  } from "../../utils/operationUtil.js";
40
- import {
41
- getPropertyWithOverrides,
42
- isNormalUnion,
43
- isSpecialHandledUnion,
44
- ModelOverrideOptions
45
- } from "../serialization/serializeUtils.js";
46
- import {
47
- getDocsFromDescription,
48
- getFixmeForMultilineDocs
49
- } from "./docsHelpers.js";
50
51
  import { AzurePollingDependencies } from "../external-dependencies.js";
51
- import { NameType, normalizeName } from "../../rlc-common/index.js";
52
52
  import {
53
53
  buildModelDeserializer,
54
- buildPropertyDeserializer
54
+ buildPropertyDeserializer,
55
55
  } from "../serialization/buildDeserializerFunction.js";
56
56
  import {
57
57
  buildModelSerializer,
58
- buildPropertySerializer
58
+ buildPropertySerializer,
59
59
  } from "../serialization/buildSerializerFunction.js";
60
60
  import {
61
- buildXmlModelSerializer,
62
61
  buildXmlModelDeserializer,
63
- hasXmlSerialization
62
+ buildXmlModelSerializer,
63
+ hasXmlSerialization,
64
64
  } from "../serialization/buildXmlSerializerFunction.js";
65
- import { refkey } from "../../framework/refkey.js";
66
- import { reportDiagnostic } from "../../lib.js";
67
- import { resolveReference } from "../../framework/reference.js";
68
- import { useDependencies } from "../../framework/hooks/useDependencies.js";
69
- import { useSdkTypes } from "../../framework/hooks/sdkTypes.js";
70
- import { isAzureCoreErrorType } from "../../utils/modelUtils.js";
71
65
  import {
72
- getTypeExpression,
73
- normalizeModelPropertyName
74
- } from "../type-expressions/get-type-expression.js";
75
- import { SdkContext } from "../../utils/interfaces.js";
76
- import {
77
- getClientOptions,
78
- isHttpMetadata,
79
- isReadOnly,
80
- SdkBodyParameter,
81
- SdkClientType,
82
- SdkConstantType,
83
- SdkEnumType,
84
- SdkHttpOperation,
85
- SdkHttpParameter,
86
- SdkLroPagingServiceMethod,
87
- SdkMethodParameter,
88
- SdkLroServiceMethod,
89
- SdkMethod,
90
- SdkModelPropertyType,
91
- SdkModelType,
92
- SdkPagingServiceMethod,
93
- SdkServiceResponseHeader,
94
- SdkType
95
- } from "@azure-tools/typespec-client-generator-core";
96
- import { isHeader, isMetadata } from "@typespec/http";
97
- import { useContext } from "../../contextManager.js";
66
+ getPropertyWithOverrides,
67
+ isNormalUnion,
68
+ isSpecialHandledUnion,
69
+ ModelOverrideOptions,
70
+ } from "../serialization/serializeUtils.js";
98
71
  import {
99
- getHeaderClientOptions,
100
- getRestErrorCodeHeader
101
- } from "./clientOptionHelpers.js";
102
- import { getClientParameterName } from "./clientHelpers.js";
72
+ PagingHelpers,
73
+ PlatformTypeHelpers,
74
+ PollingHelpers,
75
+ SerializationHelpers,
76
+ StorageCompatHelpers,
77
+ UrlTemplateHelpers,
78
+ XmlHelpers,
79
+ } from "../static-helpers-metadata.js";
103
80
  import { isExtensibleEnum } from "../type-expressions/get-enum-expression.js";
104
81
  import { emitInlineModel } from "../type-expressions/get-model-expression.js";
82
+ import {
83
+ getTypeExpression,
84
+ normalizeModelPropertyName,
85
+ } from "../type-expressions/get-type-expression.js";
86
+ import { getClientParameterName } from "./clientHelpers.js";
87
+ import { getHeaderClientOptions, getRestErrorCodeHeader } from "./clientOptionHelpers.js";
88
+ import { getDocsFromDescription, getFixmeForMultilineDocs } from "./docsHelpers.js";
89
+ import {
90
+ generateLocallyUniqueName,
91
+ getClassicalLayerPrefix,
92
+ getOperationName,
93
+ } from "./namingHelpers.js";
94
+ import { getNullableValidType, isSpreadBodyParameter, isTypeNullable } from "./typeHelpers.js";
105
95
 
106
96
  /**
107
97
  * Checks whether a header should be skipped during serialization/deserialization.
@@ -109,7 +99,7 @@ import { emitInlineModel } from "../type-expressions/get-model-expression.js";
109
99
  * which indicates it uses a prefix-based dictionary pattern not handled by standard ser/deser.
110
100
  */
111
101
  function shouldSkipHeaderSerialization(
112
- header: SdkHttpParameter | SdkServiceResponseHeader
102
+ header: SdkHttpParameter | SdkServiceResponseHeader,
113
103
  ): boolean {
114
104
  return getClientOptions(header, "headerCollectionPrefix") !== undefined;
115
105
  }
@@ -118,14 +108,10 @@ export function getSendPrivateFunction(
118
108
  dpgContext: SdkContext,
119
109
  method: [string[], ServiceOperation],
120
110
  clientType: string,
121
- client?: SdkClientType<SdkHttpOperation>
111
+ client?: SdkClientType<SdkHttpOperation>,
122
112
  ): OptionalKind<FunctionDeclarationStructure> {
123
113
  const operation = method[1];
124
- const parameters = getOperationSignatureParameters(
125
- dpgContext,
126
- method,
127
- clientType
128
- );
114
+ const parameters = getOperationSignatureParameters(dpgContext, method, clientType);
129
115
  const { name } = getOperationName(operation);
130
116
  const dependencies = useDependencies();
131
117
 
@@ -134,7 +120,7 @@ export function getSendPrivateFunction(
134
120
  isExported: true,
135
121
  name: `_${name}Send`,
136
122
  parameters,
137
- returnType: resolveReference(dependencies.StreamableMethod)
123
+ returnType: resolveReference(dependencies.StreamableMethod),
138
124
  };
139
125
 
140
126
  const operationPath = operation.operation.path;
@@ -144,15 +130,13 @@ export function getSendPrivateFunction(
144
130
  let pathStr = `"${operationPath}"`;
145
131
  const urlTemplateParams = [
146
132
  ...getPathParameters(operation),
147
- ...getQueryParameters(dpgContext, operation)
133
+ ...getQueryParameters(dpgContext, operation),
148
134
  ];
149
135
  if (urlTemplateParams.length > 0) {
150
136
  // Generate a unique local variable name that doesn't conflict with parameter names
151
137
  const paramNames = new Set(parameters.map((p) => p.name));
152
138
  const pathVarName = generateLocallyUniqueName("path", paramNames);
153
- const includeRootSlash = client
154
- ? getClientOptions(client, "includeRootSlash") !== false
155
- : true;
139
+ const includeRootSlash = client ? getClientOptions(client, "includeRootSlash") !== false : true;
156
140
 
157
141
  const uriTemplate = includeRootSlash
158
142
  ? operation.operation.uriTemplate
@@ -170,26 +154,24 @@ export function getSendPrivateFunction(
170
154
  `return context.path(${pathStr}).${operationMethod}({...${resolveReference(dependencies.operationOptionsToRequestParameters)}(${optionalParamName}), ${getHeaderAndBodyParameters(
171
155
  dpgContext,
172
156
  operation,
173
- optionalParamName
174
- )}});`
157
+ optionalParamName,
158
+ )}});`,
175
159
  );
176
160
 
177
161
  return {
178
162
  ...functionStatement,
179
- statements
163
+ statements,
180
164
  };
181
165
  }
182
166
 
183
167
  export function getDeserializePrivateFunction(
184
168
  context: SdkContext,
185
- method: [string[], ServiceOperation]
169
+ method: [string[], ServiceOperation],
186
170
  ): OptionalKind<FunctionDeclarationStructure> {
187
171
  const operation = method[1];
188
172
  const { name } = getOperationName(operation);
189
173
  const dependencies = useDependencies();
190
- const PathUncheckedResponseReference = resolveReference(
191
- dependencies.PathUncheckedResponse
192
- );
174
+ const PathUncheckedResponseReference = resolveReference(dependencies.PathUncheckedResponse);
193
175
 
194
176
  // Check if we need to wrap the non-model return type
195
177
  const { shouldWrap, isBinary } = checkWrapNonModelReturn(context, operation);
@@ -211,7 +193,7 @@ export function getDeserializePrivateFunction(
211
193
  // For LRO-only operations with non-model final result, wrap in a response type alias
212
194
  returnType = {
213
195
  name: getOperationResponseTypeName(method),
214
- type: resolveReference(refkey(operation, "response"))
196
+ type: resolveReference(refkey(operation, "response")),
215
197
  };
216
198
  } else {
217
199
  returnType = buildLroReturnType(context, operation);
@@ -221,13 +203,13 @@ export function getDeserializePrivateFunction(
221
203
  // instead of just the array element type
222
204
  returnType = {
223
205
  name: (restResponse as any).name ?? "",
224
- type: getTypeExpression(context, restResponse.type)
206
+ type: getTypeExpression(context, restResponse.type),
225
207
  };
226
208
  } else if (shouldWrap) {
227
209
  // Use the wrapper response type name (resolved via binder for cross-file imports)
228
210
  returnType = {
229
211
  name: getOperationResponseTypeName(method),
230
- type: resolveReference(refkey(operation, "response"))
212
+ type: resolveReference(refkey(operation, "response")),
231
213
  };
232
214
  } else if (response.type) {
233
215
  // When response.optional is true, some HTTP responses have no body (e.g. 204), so
@@ -235,7 +217,7 @@ export function getDeserializePrivateFunction(
235
217
  const baseType = getTypeExpression(context, response.type);
236
218
  returnType = {
237
219
  name: (response as any).name ?? "",
238
- type: response.optional ? `${baseType} | undefined` : baseType
220
+ type: response.optional ? `${baseType} | undefined` : baseType,
239
221
  };
240
222
  } else if (isHeadAsBooleanOperation(operation)) {
241
223
  returnType = { name: "", type: "boolean" };
@@ -250,27 +232,23 @@ export function getDeserializePrivateFunction(
250
232
  const parameters: OptionalKind<ParameterDeclarationStructure>[] = [
251
233
  {
252
234
  name: resultParamName,
253
- type: resultParamType
254
- }
235
+ type: resultParamType,
236
+ },
255
237
  ];
256
238
  const functionStatement: OptionalKind<FunctionDeclarationStructure> = {
257
239
  isAsync: true,
258
240
  isExported: true,
259
241
  name: `_${name}Deserialize`,
260
242
  parameters,
261
- returnType: `Promise<${returnType.type}>`
243
+ returnType: `Promise<${returnType.type}>`,
262
244
  };
263
245
  const statements: string[] = [];
264
- const createRestErrorReference = resolveReference(
265
- dependencies.createRestError
266
- );
267
- statements.push(
268
- `const expectedStatuses = ${getExpectedStatuses(operation)};`
269
- );
246
+ const createRestErrorReference = resolveReference(dependencies.createRestError);
247
+ statements.push(`const expectedStatuses = ${getExpectedStatuses(operation)};`);
270
248
  statements.push(
271
249
  `if(!expectedStatuses.includes(result.status)){`,
272
250
  `${getExceptionThrowStatement(context, operation)}`,
273
- "}"
251
+ "}",
274
252
  );
275
253
  const deserializedType =
276
254
  isLroOnly || isLroAndPaging
@@ -299,7 +277,7 @@ export function getDeserializePrivateFunction(
299
277
  `if(${deserializedRoot.split(".").join("?.")} === undefined) {
300
278
  throw ${createRestErrorReference}(\`Expected a result in the response at position "${deserializedRoot}"\`, result);
301
279
  }
302
- `
280
+ `,
303
281
  );
304
282
  }
305
283
 
@@ -308,17 +286,14 @@ export function getDeserializePrivateFunction(
308
286
  // guard all body deserialization so we return undefined instead of throwing.
309
287
  // This only applies to non-LRO, non-paging operations where the deserialized type
310
288
  // comes from response.type (not from LRO metadata or paging).
311
- const needsBodyGuard =
312
- response.optional && !isLroOnly && !isLroAndPaging && !isPagingOnly;
289
+ const needsBodyGuard = response.optional && !isLroOnly && !isLroAndPaging && !isPagingOnly;
313
290
 
314
291
  const contentTypes = operation.operation.responses[0]?.contentTypes ?? [];
315
292
  const isXml = isXmlPayload(contentTypes);
316
293
  const isDualFormat = hasDualFormatSupport(contentTypes);
317
294
  const isMultipart = isMultipartPayload(contentTypes);
318
295
  const useXmlDeserialization =
319
- isXml &&
320
- deserializedType.kind === "model" &&
321
- hasXmlSerialization(deserializedType);
296
+ isXml && deserializedType.kind === "model" && hasXmlSerialization(deserializedType);
322
297
 
323
298
  // Workaround for multipart response: cast return value as any due to lack of multipart response handling in core
324
299
  const multipartCastSuffix = isMultipart ? " as any" : "";
@@ -333,51 +308,35 @@ export function getDeserializePrivateFunction(
333
308
  statements.push(
334
309
  `if (!result.body) {
335
310
  return result.body as ${returnType.type};
336
- }`
311
+ }`,
337
312
  );
338
313
  }
339
- const xmlDeserializerName = buildXmlModelDeserializer(
340
- context,
341
- deserializedType,
342
- {
343
- nameOnly: true,
344
- skipDiscriminatedUnionSuffix: false
345
- }
346
- ) as string | undefined;
347
- const jsonDeserializerName = buildModelDeserializer(
348
- context,
349
- deserializedType,
350
- {
351
- nameOnly: true,
352
- skipDiscriminatedUnionSuffix: false
353
- }
354
- );
314
+ const xmlDeserializerName = buildXmlModelDeserializer(context, deserializedType, {
315
+ nameOnly: true,
316
+ skipDiscriminatedUnionSuffix: false,
317
+ }) as string | undefined;
318
+ const jsonDeserializerName = buildModelDeserializer(context, deserializedType, {
319
+ nameOnly: true,
320
+ skipDiscriminatedUnionSuffix: false,
321
+ });
355
322
 
356
323
  if (xmlDeserializerName && jsonDeserializerName) {
357
- const isXmlContentTypeRef = resolveReference(
358
- XmlHelpers.isXmlContentType
359
- );
324
+ const isXmlContentTypeRef = resolveReference(XmlHelpers.isXmlContentType);
360
325
  statements.push(
361
326
  `const responseContentType = result.headers?.["content-type"] ?? "";
362
327
  if (${isXmlContentTypeRef}(responseContentType)) {
363
328
  return ${xmlDeserializerName}(${deserializedRoot});
364
329
  }
365
- return ${jsonDeserializerName}(${deserializedRoot});`
330
+ return ${jsonDeserializerName}(${deserializedRoot});`,
366
331
  );
367
332
  } else {
368
333
  // Fall back to JSON deserializer
369
- const deserializeFunctionName = buildModelDeserializer(
370
- context,
371
- deserializedType,
372
- {
373
- nameOnly: true,
374
- skipDiscriminatedUnionSuffix: false
375
- }
376
- );
334
+ const deserializeFunctionName = buildModelDeserializer(context, deserializedType, {
335
+ nameOnly: true,
336
+ skipDiscriminatedUnionSuffix: false,
337
+ });
377
338
  if (deserializeFunctionName) {
378
- statements.push(
379
- `return ${deserializeFunctionName}(${deserializedRoot})`
380
- );
339
+ statements.push(`return ${deserializeFunctionName}(${deserializedRoot})`);
381
340
  }
382
341
  }
383
342
  } else if (useXmlDeserialization) {
@@ -386,48 +345,34 @@ export function getDeserializePrivateFunction(
386
345
  statements.push(
387
346
  `if (!result.body) {
388
347
  return result.body as ${returnType.type};
389
- }`
348
+ }`,
390
349
  );
391
350
  }
392
- const xmlDeserializerName = buildXmlModelDeserializer(
393
- context,
394
- deserializedType,
395
- {
396
- nameOnly: true,
397
- skipDiscriminatedUnionSuffix: false
398
- }
399
- ) as string | undefined;
351
+ const xmlDeserializerName = buildXmlModelDeserializer(context, deserializedType, {
352
+ nameOnly: true,
353
+ skipDiscriminatedUnionSuffix: false,
354
+ }) as string | undefined;
400
355
 
401
356
  if (xmlDeserializerName) {
402
357
  statements.push(`return ${xmlDeserializerName}(${deserializedRoot})`);
403
358
  } else {
404
359
  // Fall back to JSON deserializer if XML deserializer is not available
405
- const deserializeFunctionName = buildModelDeserializer(
406
- context,
407
- deserializedType,
408
- {
409
- nameOnly: true,
410
- skipDiscriminatedUnionSuffix: false
411
- }
412
- );
360
+ const deserializeFunctionName = buildModelDeserializer(context, deserializedType, {
361
+ nameOnly: true,
362
+ skipDiscriminatedUnionSuffix: false,
363
+ });
413
364
  if (deserializeFunctionName) {
414
- statements.push(
415
- `return ${deserializeFunctionName}(${deserializedRoot})`
416
- );
365
+ statements.push(`return ${deserializeFunctionName}(${deserializedRoot})`);
417
366
  } else {
418
367
  statements.push(`return ${deserializedRoot}`);
419
368
  }
420
369
  }
421
370
  } else {
422
371
  // JSON response (default) - also handles multipart responses
423
- const deserializeFunctionName = buildModelDeserializer(
424
- context,
425
- deserializedType,
426
- {
427
- nameOnly: true,
428
- skipDiscriminatedUnionSuffix: false
429
- }
430
- );
372
+ const deserializeFunctionName = buildModelDeserializer(context, deserializedType, {
373
+ nameOnly: true,
374
+ skipDiscriminatedUnionSuffix: false,
375
+ });
431
376
  // Handle wrap-non-model-return for non-LRO, non-paging and LRO-only operations
432
377
  if (shouldWrap) {
433
378
  if (isBinary) {
@@ -435,7 +380,7 @@ export function getDeserializePrivateFunction(
435
380
  // status check and error.details handling ran above.
436
381
  // Return the platform-specific stream properties.
437
382
  statements.push(
438
- `return { blobBody: result.blobBody, readableStreamBody: result.readableStreamBody };`
383
+ `return { blobBody: result.blobBody, readableStreamBody: result.readableStreamBody };`,
439
384
  );
440
385
  } else if (isHeadAsBooleanOperation(operation)) {
441
386
  // HEAD has no body; derive boolean from status code
@@ -449,29 +394,27 @@ export function getDeserializePrivateFunction(
449
394
  deserializedType,
450
395
  deserializedRoot,
451
396
  true,
452
- getEncodeForType(deserializedType)
397
+ getEncodeForType(deserializedType),
453
398
  );
454
399
  statements.push(`return { body: ${bodyValue} };`);
455
400
  }
456
401
  return {
457
402
  ...functionStatement,
458
- statements
403
+ statements,
459
404
  };
460
405
  }
461
406
  if (deserializeFunctionName) {
462
407
  if (needsBodyGuard) {
463
408
  // Use ternary form: return result.body ? deserializer(result.body) : undefined
464
409
  statements.push(
465
- `return ${deserializedRoot} ? ${deserializeFunctionName}(${deserializedRoot})${multipartCastSuffix} : undefined`
410
+ `return ${deserializedRoot} ? ${deserializeFunctionName}(${deserializedRoot})${multipartCastSuffix} : undefined`,
466
411
  );
467
412
  } else {
468
413
  statements.push(
469
- `return ${deserializeFunctionName}(${deserializedRoot})${multipartCastSuffix}`
414
+ `return ${deserializeFunctionName}(${deserializedRoot})${multipartCastSuffix}`,
470
415
  );
471
416
  }
472
- } else if (
473
- isAzureCoreErrorType(context.program, deserializedType.__raw)
474
- ) {
417
+ } else if (isAzureCoreErrorType(context.program, deserializedType.__raw)) {
475
418
  statements.push(`return ${deserializedRoot}${multipartCastSuffix}`);
476
419
  } else if (isHeadAsBooleanOperation(operation)) {
477
420
  // HEAD has no body; derive boolean from status code
@@ -487,11 +430,11 @@ export function getDeserializePrivateFunction(
487
430
  context,
488
431
  response.type!.__raw!,
489
432
  contentTypes,
490
- getEncodeForType(response.type!)
433
+ getEncodeForType(response.type!),
491
434
  )
492
435
  ? "binary"
493
- : getEncodeForType(deserializedType)
494
- )}${multipartCastSuffix}`
436
+ : getEncodeForType(deserializedType),
437
+ )}${multipartCastSuffix}`,
495
438
  );
496
439
  }
497
440
  }
@@ -507,7 +450,7 @@ export function getDeserializePrivateFunction(
507
450
 
508
451
  return {
509
452
  ...functionStatement,
510
- statements
453
+ statements,
511
454
  };
512
455
  }
513
456
 
@@ -518,33 +461,26 @@ export function getDeserializePrivateFunction(
518
461
  */
519
462
  export function getDeserializeHeadersPrivateFunction(
520
463
  context: SdkContext,
521
- operation: ServiceOperation
464
+ operation: ServiceOperation,
522
465
  ): OptionalKind<FunctionDeclarationStructure> | undefined {
523
466
  const responseHeaders = getResponseHeaders(operation.operation.responses);
524
- const isResponseHeadersEnabled =
525
- context.rlcOptions?.includeHeadersInResponse === true;
526
- const isStorageCompatEnabled =
527
- context.rlcOptions?.enableStorageCompat === true;
467
+ const isResponseHeadersEnabled = context.rlcOptions?.includeHeadersInResponse === true;
468
+ const isStorageCompatEnabled = context.rlcOptions?.enableStorageCompat === true;
528
469
 
529
470
  // Only generate if headers exist and a relevant feature is enabled
530
- if (
531
- responseHeaders.length === 0 ||
532
- (!isResponseHeadersEnabled && !isStorageCompatEnabled)
533
- ) {
471
+ if (responseHeaders.length === 0 || (!isResponseHeadersEnabled && !isStorageCompatEnabled)) {
534
472
  return undefined;
535
473
  }
536
474
 
537
475
  const { name } = getOperationName(operation);
538
476
  const dependencies = useDependencies();
539
- const PathUncheckedResponseReference = resolveReference(
540
- dependencies.PathUncheckedResponse
541
- );
477
+ const PathUncheckedResponseReference = resolveReference(dependencies.PathUncheckedResponse);
542
478
 
543
479
  const parameters: OptionalKind<ParameterDeclarationStructure>[] = [
544
480
  {
545
481
  name: "result",
546
- type: PathUncheckedResponseReference
547
- }
482
+ type: PathUncheckedResponseReference,
483
+ },
548
484
  ];
549
485
 
550
486
  const returnType = buildHeaderOnlyResponseType(context, responseHeaders);
@@ -554,17 +490,15 @@ export function getDeserializeHeadersPrivateFunction(
554
490
  isExported: true,
555
491
  name: `_${name}DeserializeHeaders`,
556
492
  parameters,
557
- returnType
493
+ returnType,
558
494
  };
559
495
 
560
496
  const statements: string[] = [];
561
- statements.push(
562
- `return ${buildHeaderOnlyResponseValue(context, responseHeaders)};`
563
- );
497
+ statements.push(`return ${buildHeaderOnlyResponseValue(context, responseHeaders)};`);
564
498
 
565
499
  return {
566
500
  ...functionStatement,
567
- statements
501
+ statements,
568
502
  };
569
503
  }
570
504
 
@@ -587,7 +521,7 @@ interface OperationExceptionDetails {
587
521
 
588
522
  function getExceptionDetails(
589
523
  context: SdkContext,
590
- operation: ServiceOperation
524
+ operation: ServiceOperation,
591
525
  ): OperationExceptionDetails {
592
526
  const customized: ExceptionThrowDetail[] = [];
593
527
  let defaultDeserializer: string | undefined;
@@ -598,18 +532,11 @@ function getExceptionDetails(
598
532
  continue;
599
533
  }
600
534
  const statusCode = exception.statusCodes;
601
- const deserializeFunctionName = buildModelDeserializer(
602
- context,
603
- exception.type,
604
- {
605
- nameOnly: true,
606
- skipDiscriminatedUnionSuffix: false
607
- }
608
- );
609
- if (
610
- !deserializeFunctionName ||
611
- typeof deserializeFunctionName !== "string"
612
- ) {
535
+ const deserializeFunctionName = buildModelDeserializer(context, exception.type, {
536
+ nameOnly: true,
537
+ skipDiscriminatedUnionSuffix: false,
538
+ });
539
+ if (!deserializeFunctionName || typeof deserializeFunctionName !== "string") {
613
540
  continue;
614
541
  }
615
542
 
@@ -618,14 +545,13 @@ function getExceptionDetails(
618
545
  const exceptionContentTypes = exception.contentTypes ?? [];
619
546
  const exceptionIsXml = isXmlPayload(exceptionContentTypes);
620
547
  const exceptionIsDualFormat = hasDualFormatSupport(exceptionContentTypes);
621
- const typeHasXml =
622
- exception.type.kind === "model" && hasXmlSerialization(exception.type);
548
+ const typeHasXml = exception.type.kind === "model" && hasXmlSerialization(exception.type);
623
549
 
624
550
  let xmlDeserializerName: string | undefined;
625
551
  if (exception.type.kind === "model" && (typeHasXml || exceptionIsXml)) {
626
552
  const xmlName = buildXmlModelDeserializer(context, exception.type, {
627
553
  nameOnly: true,
628
- skipDiscriminatedUnionSuffix: false
554
+ skipDiscriminatedUnionSuffix: false,
629
555
  });
630
556
  if (typeof xmlName === "string") {
631
557
  xmlDeserializerName = xmlName;
@@ -633,10 +559,7 @@ function getExceptionDetails(
633
559
  }
634
560
 
635
561
  // XML-only when all content types are XML (no JSON support)
636
- const isXmlOnly =
637
- xmlDeserializerName !== undefined &&
638
- exceptionIsXml &&
639
- !exceptionIsDualFormat;
562
+ const isXmlOnly = xmlDeserializerName !== undefined && exceptionIsXml && !exceptionIsDualFormat;
640
563
 
641
564
  if (statusCode === "*") {
642
565
  defaultDeserializer = deserializeFunctionName;
@@ -647,7 +570,7 @@ function getExceptionDetails(
647
570
  start: statusCode,
648
571
  deserializer: deserializeFunctionName,
649
572
  xmlDeserializer: xmlDeserializerName,
650
- isXmlOnly
573
+ isXmlOnly,
651
574
  });
652
575
  } else {
653
576
  customized.push({
@@ -655,7 +578,7 @@ function getExceptionDetails(
655
578
  end: statusCode.end,
656
579
  deserializer: deserializeFunctionName,
657
580
  xmlDeserializer: xmlDeserializerName,
658
- isXmlOnly
581
+ isXmlOnly,
659
582
  });
660
583
  }
661
584
  }
@@ -663,7 +586,7 @@ function getExceptionDetails(
663
586
  customized,
664
587
  defaultDeserializer,
665
588
  defaultXmlDeserializer,
666
- defaultIsXmlOnly
589
+ defaultIsXmlOnly,
667
590
  };
668
591
  }
669
592
 
@@ -671,7 +594,7 @@ function getExceptionDetails(
671
594
  * Collects and deduplicates all response headers from operation exceptions.
672
595
  */
673
596
  function getExceptionResponseHeaders(
674
- exceptions: SdkHttpOperation["exceptions"]
597
+ exceptions: SdkHttpOperation["exceptions"],
675
598
  ): SdkServiceResponseHeader[] {
676
599
  const headerMap = new Map<string, SdkServiceResponseHeader>();
677
600
  for (const exception of exceptions ?? []) {
@@ -692,32 +615,27 @@ function getExceptionResponseHeaders(
692
615
  */
693
616
  export function getDeserializeExceptionHeadersPrivateFunction(
694
617
  context: SdkContext,
695
- operation: ServiceOperation
618
+ operation: ServiceOperation,
696
619
  ): OptionalKind<FunctionDeclarationStructure> | undefined {
697
- const isResponseHeadersEnabled =
698
- context.rlcOptions?.includeHeadersInResponse === true;
620
+ const isResponseHeadersEnabled = context.rlcOptions?.includeHeadersInResponse === true;
699
621
  if (!isResponseHeadersEnabled) {
700
622
  return undefined;
701
623
  }
702
624
 
703
- const exceptionHeaders = getExceptionResponseHeaders(
704
- operation.operation.exceptions
705
- );
625
+ const exceptionHeaders = getExceptionResponseHeaders(operation.operation.exceptions);
706
626
  if (exceptionHeaders.length === 0) {
707
627
  return undefined;
708
628
  }
709
629
 
710
630
  const { name } = getOperationName(operation);
711
631
  const dependencies = useDependencies();
712
- const PathUncheckedResponseReference = resolveReference(
713
- dependencies.PathUncheckedResponse
714
- );
632
+ const PathUncheckedResponseReference = resolveReference(dependencies.PathUncheckedResponse);
715
633
 
716
634
  const parameters: OptionalKind<ParameterDeclarationStructure>[] = [
717
635
  {
718
636
  name: "result",
719
- type: PathUncheckedResponseReference
720
- }
637
+ type: PathUncheckedResponseReference,
638
+ },
721
639
  ];
722
640
 
723
641
  const returnType = buildHeaderOnlyResponseType(context, exceptionHeaders);
@@ -727,17 +645,15 @@ export function getDeserializeExceptionHeadersPrivateFunction(
727
645
  isExported: true,
728
646
  name: `_${name}DeserializeExceptionHeaders`,
729
647
  parameters,
730
- returnType
648
+ returnType,
731
649
  };
732
650
 
733
651
  const statements: string[] = [];
734
- statements.push(
735
- `return ${buildHeaderOnlyResponseValue(context, exceptionHeaders)};`
736
- );
652
+ statements.push(`return ${buildHeaderOnlyResponseValue(context, exceptionHeaders)};`);
737
653
 
738
654
  return {
739
655
  ...functionStatement,
740
- statements
656
+ statements,
741
657
  };
742
658
  }
743
659
 
@@ -751,50 +667,29 @@ function getExceptionDeserializeExpr(exception: ExceptionThrowDetail): string {
751
667
  return `isXml ? ${exception.xmlDeserializer}(result.body) : ${exception.deserializer}(result.body)`;
752
668
  }
753
669
 
754
- function getExceptionThrowStatement(
755
- context: SdkContext,
756
- operation: ServiceOperation
757
- ) {
670
+ function getExceptionThrowStatement(context: SdkContext, operation: ServiceOperation) {
758
671
  const statements = [];
759
- const createRestErrorReference = resolveReference(
760
- useDependencies().createRestError
761
- );
762
- const {
763
- customized,
764
- defaultDeserializer,
765
- defaultXmlDeserializer,
766
- defaultIsXmlOnly
767
- } = getExceptionDetails(context, operation);
672
+ const createRestErrorReference = resolveReference(useDependencies().createRestError);
673
+ const { customized, defaultDeserializer, defaultXmlDeserializer, defaultIsXmlOnly } =
674
+ getExceptionDetails(context, operation);
768
675
 
769
- const isResponseHeadersEnabled =
770
- context.rlcOptions?.includeHeadersInResponse === true;
676
+ const isResponseHeadersEnabled = context.rlcOptions?.includeHeadersInResponse === true;
771
677
 
772
678
  // Check if exception headers function exists and build the call
773
- const exceptionHeaders = getExceptionResponseHeaders(
774
- operation.operation.exceptions
775
- );
776
- const hasExceptionHeaders =
777
- isResponseHeadersEnabled && exceptionHeaders.length > 0;
679
+ const exceptionHeaders = getExceptionResponseHeaders(operation.operation.exceptions);
680
+ const hasExceptionHeaders = isResponseHeadersEnabled && exceptionHeaders.length > 0;
778
681
  const { name: opName } = getOperationName(operation);
779
682
  const exceptionHeadersCall = hasExceptionHeaders
780
683
  ? `error.details = {...(error.details as any), ..._${opName}DeserializeExceptionHeaders(result)};`
781
684
  : undefined;
782
685
 
783
686
  // Build @clientOption("header", ...) extraction code (independent of include-headers-in-response)
784
- const clientOptionHeadersCall = buildClientOptionHeadersCall(
785
- operation.operation.exceptions
786
- );
687
+ const clientOptionHeadersCall = buildClientOptionHeadersCall(operation.operation.exceptions);
787
688
 
788
689
  // Build @clientOption("restErrorCodeHeader", ...) code to set error.code from a header
789
- const restErrorCodeAssignment = buildRestErrorCodeAssignment(
790
- operation.operation.exceptions
791
- );
690
+ const restErrorCodeAssignment = buildRestErrorCodeAssignment(operation.operation.exceptions);
792
691
 
793
- const allHeaderCalls = [
794
- exceptionHeadersCall,
795
- clientOptionHeadersCall,
796
- restErrorCodeAssignment
797
- ]
692
+ const allHeaderCalls = [exceptionHeadersCall, clientOptionHeadersCall, restErrorCodeAssignment]
798
693
  .filter(Boolean)
799
694
  .join("\n");
800
695
 
@@ -807,12 +702,8 @@ function getExceptionThrowStatement(
807
702
  statements.push(`const error = ${createRestErrorReference}(result);`);
808
703
  if (hasAnyDualFormatXml) {
809
704
  const isXmlContentTypeRef = resolveReference(XmlHelpers.isXmlContentType);
810
- statements.push(
811
- `const responseContentType = result.headers?.["content-type"] ?? "";`
812
- );
813
- statements.push(
814
- `const isXml = ${isXmlContentTypeRef}(responseContentType);`
815
- );
705
+ statements.push(`const responseContentType = result.headers?.["content-type"] ?? "";`);
706
+ statements.push(`const isXml = ${isXmlContentTypeRef}(responseContentType);`);
816
707
  }
817
708
  statements.push(`const statusCode = Number.parseInt(result.status);`);
818
709
  const stats: string[] = customized.map((exception) => {
@@ -851,9 +742,7 @@ function getExceptionThrowStatement(
851
742
  if(result.body) { error.details = ${defaultXmlDeserializer}(result.body); }
852
743
  ${allHeaderCalls}`);
853
744
  } else {
854
- const isXmlContentTypeRef = resolveReference(
855
- XmlHelpers.isXmlContentType
856
- );
745
+ const isXmlContentTypeRef = resolveReference(XmlHelpers.isXmlContentType);
857
746
  statements.push(`const error = ${createRestErrorReference}(result);
858
747
  const responseContentType = result.headers?.["content-type"] ?? "";
859
748
  if(result.body) { error.details = ${isXmlContentTypeRef}(responseContentType) ? ${defaultXmlDeserializer}(result.body) : ${defaultDeserializer}(result.body); }
@@ -877,7 +766,7 @@ function getExceptionThrowStatement(
877
766
  * on exception model types. This is independent of include-headers-in-response.
878
767
  */
879
768
  function buildClientOptionHeadersCall(
880
- exceptions: SdkHttpOperation["exceptions"]
769
+ exceptions: SdkHttpOperation["exceptions"],
881
770
  ): string | undefined {
882
771
  const seenProperties = new Set<string>();
883
772
  const assignments: string[] = [];
@@ -892,9 +781,7 @@ function buildClientOptionHeadersCall(
892
781
  continue;
893
782
  }
894
783
  seenProperties.add(opt.propertyName);
895
- assignments.push(
896
- `${opt.propertyName}: result.headers[${JSON.stringify(opt.headerName)}]`
897
- );
784
+ assignments.push(`${opt.propertyName}: result.headers[${JSON.stringify(opt.headerName)}]`);
898
785
  }
899
786
  }
900
787
 
@@ -910,7 +797,7 @@ function buildClientOptionHeadersCall(
910
797
  * based on @clientOption("restErrorCodeHeader", ...) on exception model types.
911
798
  */
912
799
  function buildRestErrorCodeAssignment(
913
- exceptions: SdkHttpOperation["exceptions"]
800
+ exceptions: SdkHttpOperation["exceptions"],
914
801
  ): string | undefined {
915
802
  for (const exception of exceptions ?? []) {
916
803
  if (!exception.type || exception.type.kind !== "model") {
@@ -925,27 +812,21 @@ if (restErrorCodeValue !== undefined) { error.code = restErrorCodeValue; }`;
925
812
  return undefined;
926
813
  }
927
814
 
928
- function getOptionalParamsName(
929
- parameters: OptionalKind<ParameterDeclarationStructure>[]
930
- ) {
815
+ function getOptionalParamsName(parameters: OptionalKind<ParameterDeclarationStructure>[]) {
931
816
  return (
932
- parameters.filter((p) =>
933
- p.type?.toString().endsWith("operationOptions__")
934
- )[0]?.name ?? "options"
817
+ parameters.filter((p) => p.type?.toString().endsWith("operationOptions__"))[0]?.name ??
818
+ "options"
935
819
  );
936
820
  }
937
821
 
938
822
  function getOperationSignatureParameters(
939
823
  context: SdkContext,
940
824
  method: [string[], ServiceOperation],
941
- clientType: string
825
+ clientType: string,
942
826
  ): OptionalKind<ParameterDeclarationStructure>[] {
943
827
  const operation = method[1];
944
828
  const optionsType = resolveReference(refkey(method[1], "operationOptions"));
945
- const parameters: Map<
946
- string,
947
- OptionalKind<ParameterDeclarationStructure>
948
- > = new Map();
829
+ const parameters: Map<string, OptionalKind<ParameterDeclarationStructure>> = new Map();
949
830
 
950
831
  operation.parameters
951
832
  .filter(
@@ -960,16 +841,13 @@ function getOperationSignatureParameters(
960
841
  );
961
842
  })[0]?.kind !== "cookie" &&
962
843
  !p.optional &&
963
- !(
964
- p.isGeneratedName &&
965
- (p.name === "contentType" || p.name === "accept")
966
- ) && // skip tcgc generated contentType and accept header parameter
967
- getClientOptions(p, "headerCollectionPrefix") === undefined // skip headers with collection prefix
844
+ !(p.isGeneratedName && (p.name === "contentType" || p.name === "accept")) && // skip tcgc generated contentType and accept header parameter
845
+ getClientOptions(p, "headerCollectionPrefix") === undefined, // skip headers with collection prefix
968
846
  )
969
847
  .map((p) => {
970
848
  return {
971
849
  name: p.name,
972
- type: getTypeExpression(context, p.type)
850
+ type: getTypeExpression(context, p.type),
973
851
  };
974
852
  })
975
853
  .forEach((p) => {
@@ -983,7 +861,7 @@ function getOperationSignatureParameters(
983
861
  const optionsParam = {
984
862
  name: parameters.has("options") ? "optionalParams" : "options",
985
863
  type: optionsType,
986
- initializer: "{ requestOptions: {} }"
864
+ initializer: "{ requestOptions: {} }",
987
865
  };
988
866
 
989
867
  const finalParameters = [contextParam, ...parameters.values(), optionsParam];
@@ -997,7 +875,7 @@ function getOperationSignatureParameters(
997
875
  export function getOperationFunction(
998
876
  context: SdkContext,
999
877
  method: [string[], ServiceOperation],
1000
- clientType: string
878
+ clientType: string,
1001
879
  ): FunctionDeclarationStructure & {
1002
880
  propertyName?: string;
1003
881
  isLro?: boolean;
@@ -1007,23 +885,22 @@ export function getOperationFunction(
1007
885
  } {
1008
886
  const operation = method[1];
1009
887
  // Extract required parameters
1010
- const parameters: OptionalKind<ParameterDeclarationStructure>[] =
1011
- getOperationSignatureParameters(context, method, clientType);
888
+ const parameters: OptionalKind<ParameterDeclarationStructure>[] = getOperationSignatureParameters(
889
+ context,
890
+ method,
891
+ clientType,
892
+ );
1012
893
  const optionalParamName = getOptionalParamsName(parameters);
1013
894
  if (isPagingOnlyOperation(operation)) {
1014
895
  // Case 1: paging-only operation
1015
- return getPagingOnlyOperationFunction(
1016
- context,
1017
- [method[0], operation],
1018
- clientType
1019
- );
896
+ return getPagingOnlyOperationFunction(context, [method[0], operation], clientType);
1020
897
  } else if (isLroOnlyOperation(operation)) {
1021
898
  // Case 2: lro-only operation
1022
899
  return getLroOnlyOperationFunction(
1023
900
  context,
1024
901
  [method[0], operation],
1025
902
  clientType,
1026
- optionalParamName
903
+ optionalParamName,
1027
904
  );
1028
905
  } else if (isLroAndPagingOperation(operation)) {
1029
906
  // Case 3: both paging + lro operation
@@ -1031,7 +908,7 @@ export function getOperationFunction(
1031
908
  context,
1032
909
  [method[0], operation],
1033
910
  clientType,
1034
- optionalParamName
911
+ optionalParamName,
1035
912
  );
1036
913
  }
1037
914
 
@@ -1039,10 +916,8 @@ export function getOperationFunction(
1039
916
  const response = operation.response;
1040
917
  const responseHeaders = getResponseHeaders(operation.operation.responses);
1041
918
  const hasHeaderOnlyResponse = !response.type && responseHeaders.length > 0;
1042
- const isResponseHeadersEnabled =
1043
- context.rlcOptions?.includeHeadersInResponse === true;
1044
- const isStorageCompatEnabled =
1045
- context.rlcOptions?.enableStorageCompat === true;
919
+ const isResponseHeadersEnabled = context.rlcOptions?.includeHeadersInResponse === true;
920
+ const isStorageCompatEnabled = context.rlcOptions?.enableStorageCompat === true;
1046
921
 
1047
922
  // Track the raw body type separately for storage-compat (before header merging)
1048
923
  const hasResponseBody = !!response.type;
@@ -1052,50 +927,42 @@ export function getOperationFunction(
1052
927
  }
1053
928
 
1054
929
  // Check if we need to wrap the non-model return type
1055
- const { shouldWrap: wrapReturn, isBinary: wrapReturnIsBinary } =
1056
- checkWrapNonModelReturn(context, operation);
930
+ const { shouldWrap: wrapReturn, isBinary: wrapReturnIsBinary } = checkWrapNonModelReturn(
931
+ context,
932
+ operation,
933
+ );
1057
934
 
1058
935
  let returnType = { name: "", type: "void" };
1059
936
  if (wrapReturn) {
1060
937
  // Use the wrapper response type name (resolved via binder for cross-file imports)
1061
938
  returnType = {
1062
939
  name: getOperationResponseTypeName(method),
1063
- type: resolveReference(refkey(operation, "response"))
940
+ type: resolveReference(refkey(operation, "response")),
1064
941
  };
1065
942
  bodyType = returnType.type;
1066
943
  } else if (response.type) {
1067
944
  const type = response.type;
1068
945
 
1069
946
  // If feature flag enabled, we'll append the response headers to the operation response type.
1070
- if (
1071
- type.kind === "model" &&
1072
- responseHeaders.length > 0 &&
1073
- isResponseHeadersEnabled
1074
- ) {
947
+ if (type.kind === "model" && responseHeaders.length > 0 && isResponseHeadersEnabled) {
1075
948
  // Build a composite type that includes both model and additional header properties
1076
- const baseCompositeType = buildCompositeResponseType(
1077
- context,
1078
- type,
1079
- responseHeaders
1080
- );
949
+ const baseCompositeType = buildCompositeResponseType(context, type, responseHeaders);
1081
950
  returnType = {
1082
951
  name: (type as any).name ?? "",
1083
- type: response.optional
1084
- ? `${baseCompositeType} | undefined`
1085
- : baseCompositeType
952
+ type: response.optional ? `${baseCompositeType} | undefined` : baseCompositeType,
1086
953
  };
1087
954
  } else {
1088
955
  const baseType = getTypeExpression(context, type!);
1089
956
  returnType = {
1090
957
  name: (type as any).name ?? "",
1091
- type: response.optional ? `${baseType} | undefined` : baseType
958
+ type: response.optional ? `${baseType} | undefined` : baseType,
1092
959
  };
1093
960
  }
1094
961
  } else if (hasHeaderOnlyResponse && isResponseHeadersEnabled) {
1095
962
  // Here we handle returning headers when the operation return type is void
1096
963
  returnType = {
1097
964
  name: "",
1098
- type: `${buildHeaderOnlyResponseType(context, responseHeaders)}`
965
+ type: `${buildHeaderOnlyResponseType(context, responseHeaders)}`,
1099
966
  };
1100
967
  } else if (isHeadAsBooleanOperation(operation)) {
1101
968
  returnType = { name: "", type: "boolean" };
@@ -1105,9 +972,7 @@ export function getOperationFunction(
1105
972
  // Use the raw body type (not the header-augmented return type) for TBody
1106
973
  let finalReturnType = returnType.type;
1107
974
  if (isStorageCompatEnabled) {
1108
- const storageCompatInfoRef = resolveReference(
1109
- StorageCompatHelpers.StorageCompatResponseInfo
1110
- );
975
+ const storageCompatInfoRef = resolveReference(StorageCompatHelpers.StorageCompatResponseInfo);
1111
976
  const headersType =
1112
977
  responseHeaders.length > 0
1113
978
  ? buildHeaderOnlyResponseType(context, responseHeaders)
@@ -1134,16 +999,13 @@ export function getOperationFunction(
1134
999
  const { name, fixme = [] } = getOperationName(operation, context);
1135
1000
  const functionStatement = {
1136
1001
  kind: StructureKind.Function,
1137
- docs: [
1138
- ...getDocsFromDescription(operation.doc),
1139
- ...getFixmeForMultilineDocs(fixme)
1140
- ],
1002
+ docs: [...getDocsFromDescription(operation.doc), ...getFixmeForMultilineDocs(fixme)],
1141
1003
  isAsync: true,
1142
1004
  isExported: true,
1143
1005
  name,
1144
1006
  propertyName: normalizeName(operation.name, NameType.Property),
1145
1007
  parameters,
1146
- returnType: `Promise<${finalReturnType}>`
1008
+ returnType: `Promise<${finalReturnType}>`,
1147
1009
  };
1148
1010
 
1149
1011
  const statements: string[] = [];
@@ -1154,16 +1016,13 @@ export function getOperationFunction(
1154
1016
 
1155
1017
  const parameterList = parameters.map((p) => p.name).join(", ");
1156
1018
  // When storage-compat is enabled, set up the onResponse interceptor before sending
1157
- const storageCompatVarName = generateLocallyUniqueName(
1158
- "_storageCompat",
1159
- paramNames
1160
- );
1019
+ const storageCompatVarName = generateLocallyUniqueName("_storageCompat", paramNames);
1161
1020
  if (isStorageCompatEnabled) {
1162
1021
  const createOnResponseRef = resolveReference(
1163
- StorageCompatHelpers.createStorageCompatOnResponse
1022
+ StorageCompatHelpers.createStorageCompatOnResponse,
1164
1023
  );
1165
1024
  statements.push(
1166
- `const ${storageCompatVarName} = ${createOnResponseRef}(${optionalParamName}.onResponse);`
1025
+ `const ${storageCompatVarName} = ${createOnResponseRef}(${optionalParamName}.onResponse);`,
1167
1026
  );
1168
1027
  }
1169
1028
 
@@ -1171,7 +1030,7 @@ export function getOperationFunction(
1171
1030
  const sendParameterList = isStorageCompatEnabled
1172
1031
  ? parameterList.replace(
1173
1032
  optionalParamName,
1174
- `{...${optionalParamName}, onResponse: ${storageCompatVarName}.onResponse}`
1033
+ `{...${optionalParamName}, onResponse: ${storageCompatVarName}.onResponse}`,
1175
1034
  )
1176
1035
  : parameterList;
1177
1036
 
@@ -1180,54 +1039,37 @@ export function getOperationFunction(
1180
1039
  // For binary wrap, use getBinaryStreamResponse which preserves blobBody/readableStreamBody properties.
1181
1040
  // For non-wrapped binary, use getBinaryResponse which buffers the body into Uint8Array.
1182
1041
  if (response?.type?.kind === "bytes" && response.type.encode === "bytes") {
1183
- const streamableMethodVarName = generateLocallyUniqueName(
1184
- "streamableMethod",
1185
- paramNames
1186
- );
1187
- statements.push(
1188
- `const ${streamableMethodVarName} = _${name}Send(${sendParameterList});`
1189
- );
1042
+ const streamableMethodVarName = generateLocallyUniqueName("streamableMethod", paramNames);
1043
+ statements.push(`const ${streamableMethodVarName} = _${name}Send(${sendParameterList});`);
1190
1044
  const binaryHelper =
1191
1045
  wrapReturn && wrapReturnIsBinary
1192
1046
  ? SerializationHelpers.getBinaryStreamResponse
1193
1047
  : SerializationHelpers.getBinaryResponse;
1194
1048
  statements.push(
1195
- `const ${resultVarName} = await ${resolveReference(binaryHelper)}(${streamableMethodVarName});`
1049
+ `const ${resultVarName} = await ${resolveReference(binaryHelper)}(${streamableMethodVarName});`,
1196
1050
  );
1197
1051
  } else {
1198
- statements.push(
1199
- `const ${resultVarName} = await _${name}Send(${sendParameterList});`
1200
- );
1052
+ statements.push(`const ${resultVarName} = await _${name}Send(${sendParameterList});`);
1201
1053
  }
1202
1054
 
1203
1055
  // If the response has headers and the feature flag to include headers in response is enabled, build the headers object and include it in the return value
1204
1056
  if (isStorageCompatEnabled) {
1205
1057
  // Storage-compat mode: wrap the return value with _response metadata using captured PipelineResponse
1206
- const addStorageCompatRef = resolveReference(
1207
- StorageCompatHelpers.addStorageCompatResponse
1208
- );
1209
- const parsedBodyVarName = generateLocallyUniqueName(
1210
- "parsedBody",
1211
- paramNames
1212
- );
1213
- const parsedHeadersVarName = generateLocallyUniqueName(
1214
- "parsedHeaders",
1215
- paramNames
1216
- );
1058
+ const addStorageCompatRef = resolveReference(StorageCompatHelpers.addStorageCompatResponse);
1059
+ const parsedBodyVarName = generateLocallyUniqueName("parsedBody", paramNames);
1060
+ const parsedHeadersVarName = generateLocallyUniqueName("parsedHeaders", paramNames);
1217
1061
 
1218
1062
  // Deserialize body
1219
1063
  if (!hasResponseBody) {
1220
1064
  statements.push(`await _${name}Deserialize(${resultVarName});`);
1221
1065
  } else {
1222
- statements.push(
1223
- `const ${parsedBodyVarName} = await _${name}Deserialize(${resultVarName});`
1224
- );
1066
+ statements.push(`const ${parsedBodyVarName} = await _${name}Deserialize(${resultVarName});`);
1225
1067
  }
1226
1068
 
1227
1069
  // Deserialize headers if present
1228
1070
  if (responseHeaders.length > 0) {
1229
1071
  statements.push(
1230
- `const ${parsedHeadersVarName} = _${name}DeserializeHeaders(${resultVarName});`
1072
+ `const ${parsedHeadersVarName} = _${name}DeserializeHeaders(${resultVarName});`,
1231
1073
  );
1232
1074
  }
1233
1075
 
@@ -1235,13 +1077,11 @@ export function getOperationFunction(
1235
1077
  const bodyArg = !hasResponseBody ? "undefined" : parsedBodyVarName;
1236
1078
  const headersArg = responseHeaders.length > 0 ? parsedHeadersVarName : "{}";
1237
1079
  statements.push(
1238
- `return ${addStorageCompatRef}(${storageCompatVarName}.getRawResponse()!, ${bodyArg}, ${headersArg});`
1080
+ `return ${addStorageCompatRef}(${storageCompatVarName}.getRawResponse()!, ${bodyArg}, ${headersArg});`,
1239
1081
  );
1240
1082
  } else if (responseHeaders.length > 0 && isResponseHeadersEnabled) {
1241
1083
  const headersVarName = generateLocallyUniqueName("headers", paramNames);
1242
- statements.push(
1243
- `const ${headersVarName} = _${name}DeserializeHeaders(result);`
1244
- );
1084
+ statements.push(`const ${headersVarName} = _${name}DeserializeHeaders(result);`);
1245
1085
 
1246
1086
  // If there is no body payload just return the headers
1247
1087
  if (hasHeaderOnlyResponse) {
@@ -1249,9 +1089,7 @@ export function getOperationFunction(
1249
1089
  statements.push(`return {...${headersVarName} };`);
1250
1090
  } else {
1251
1091
  const payloadVarName = generateLocallyUniqueName("payload", paramNames);
1252
- statements.push(
1253
- `const ${payloadVarName} = await _${name}Deserialize(${resultVarName});`
1254
- );
1092
+ statements.push(`const ${payloadVarName} = await _${name}Deserialize(${resultVarName});`);
1255
1093
  statements.push(`return { ...${payloadVarName}, ...${headersVarName} };`);
1256
1094
  }
1257
1095
  } else {
@@ -1260,7 +1098,7 @@ export function getOperationFunction(
1260
1098
 
1261
1099
  return {
1262
1100
  ...functionStatement,
1263
- statements
1101
+ statements,
1264
1102
  } as FunctionDeclarationStructure & { propertyName?: string };
1265
1103
  }
1266
1104
 
@@ -1268,7 +1106,7 @@ function getLroOnlyOperationFunction(
1268
1106
  context: SdkContext,
1269
1107
  method: [string[], SdkLroServiceMethod<SdkHttpOperation>],
1270
1108
  clientType: string,
1271
- optionalParamName: string = "options"
1109
+ optionalParamName: string = "options",
1272
1110
  ): FunctionDeclarationStructure & {
1273
1111
  propertyName?: string;
1274
1112
  isLro?: boolean;
@@ -1276,23 +1114,19 @@ function getLroOnlyOperationFunction(
1276
1114
  } {
1277
1115
  const operation = method[1];
1278
1116
  // Extract required parameters
1279
- const parameters: OptionalKind<ParameterDeclarationStructure>[] =
1280
- getOperationSignatureParameters(context, method, clientType);
1117
+ const parameters: OptionalKind<ParameterDeclarationStructure>[] = getOperationSignatureParameters(
1118
+ context,
1119
+ method,
1120
+ clientType,
1121
+ );
1281
1122
  const returnType = buildLroReturnType(context, operation);
1282
1123
  const { name, fixme = [] } = getOperationName(operation, context);
1283
- const pollerLikeReference = resolveReference(
1284
- AzurePollingDependencies.PollerLike
1285
- );
1286
- const operationStateReference = resolveReference(
1287
- AzurePollingDependencies.OperationState
1288
- );
1124
+ const pollerLikeReference = resolveReference(AzurePollingDependencies.PollerLike);
1125
+ const operationStateReference = resolveReference(AzurePollingDependencies.OperationState);
1289
1126
 
1290
1127
  // When wrap-non-model-return is enabled and the LRO final result is a non-model type,
1291
1128
  // use the wrapper response type (e.g. GetIkeSasResponse) instead of the raw type (e.g. string).
1292
- const { shouldWrap } = checkWrapNonModelReturn(
1293
- context,
1294
- operation as ServiceOperation
1295
- );
1129
+ const { shouldWrap } = checkWrapNonModelReturn(context, operation as ServiceOperation);
1296
1130
  const effectiveReturnTypeStr = shouldWrap
1297
1131
  ? (resolveReference(refkey(operation, "response")) as string)
1298
1132
  : returnType.type;
@@ -1302,10 +1136,7 @@ function getLroOnlyOperationFunction(
1302
1136
 
1303
1137
  const functionStatement = {
1304
1138
  kind: StructureKind.Function,
1305
- docs: [
1306
- ...getDocsFromDescription(operation.doc),
1307
- ...getFixmeForMultilineDocs(fixme)
1308
- ],
1139
+ docs: [...getDocsFromDescription(operation.doc), ...getFixmeForMultilineDocs(fixme)],
1309
1140
  isAsync: false,
1310
1141
  isExported: true,
1311
1142
  name,
@@ -1313,25 +1144,20 @@ function getLroOnlyOperationFunction(
1313
1144
  isLro: true,
1314
1145
  lroFinalReturnType: effectiveReturnTypeName,
1315
1146
  parameters,
1316
- returnType: `${pollerLikeReference}<${operationStateReference}<${effectiveReturnTypeStr}>, ${effectiveReturnTypeStr}>`
1147
+ returnType: `${pollerLikeReference}<${operationStateReference}<${effectiveReturnTypeStr}>, ${effectiveReturnTypeStr}>`,
1317
1148
  };
1318
1149
 
1319
- const getLongRunningPollerReference = resolveReference(
1320
- PollingHelpers.GetLongRunningPoller
1321
- );
1150
+ const getLongRunningPollerReference = resolveReference(PollingHelpers.GetLongRunningPoller);
1322
1151
  const lroMetadata =
1323
- operation.kind === "lro" || operation.kind === "lropaging"
1324
- ? operation.lroMetadata
1325
- : undefined;
1152
+ operation.kind === "lro" || operation.kind === "lropaging" ? operation.lroMetadata : undefined;
1326
1153
  const allowedFinalLocation = [
1327
1154
  "azure-async-operation",
1328
1155
  "location",
1329
1156
  "original-uri",
1330
- "operation-location"
1157
+ "operation-location",
1331
1158
  ];
1332
1159
  const resourceLocationConfig =
1333
- lroMetadata?.finalStateVia &&
1334
- allowedFinalLocation.includes(lroMetadata?.finalStateVia)
1160
+ lroMetadata?.finalStateVia && allowedFinalLocation.includes(lroMetadata?.finalStateVia)
1335
1161
  ? `resourceLocationConfig: "${lroMetadata?.finalStateVia}",`
1336
1162
  : "";
1337
1163
  const apiVersion = getApiVersionExpression(context, operation);
@@ -1340,13 +1166,11 @@ function getLroOnlyOperationFunction(
1340
1166
  statements.push(`
1341
1167
 
1342
1168
  return ${getLongRunningPollerReference}(context, _${name}Deserialize, ${getExpectedStatuses(
1343
- operation
1169
+ operation,
1344
1170
  )}, {
1345
1171
  updateIntervalInMs: ${optionalParamName}?.updateIntervalInMs,
1346
1172
  abortSignal: ${optionalParamName}?.abortSignal,
1347
- getInitialResponse: () => _${name}Send(${parameters
1348
- .map((p) => p.name)
1349
- .join(", ")}),
1173
+ getInitialResponse: () => _${name}Send(${parameters.map((p) => p.name).join(", ")}),
1350
1174
  ${resourceLocationConfig}
1351
1175
  ${apiVersion ? `apiVersion: ${apiVersion}` : ""}
1352
1176
  }) as ${pollerLikeReference}<${operationStateReference}<${effectiveReturnTypeStr}>, ${effectiveReturnTypeStr}>;
@@ -1354,7 +1178,7 @@ function getLroOnlyOperationFunction(
1354
1178
 
1355
1179
  return {
1356
1180
  ...functionStatement,
1357
- statements
1181
+ statements,
1358
1182
  } as FunctionDeclarationStructure & { propertyName?: string };
1359
1183
  }
1360
1184
 
@@ -1362,18 +1186,14 @@ function getLroAndPagingOperationFunction(
1362
1186
  context: SdkContext,
1363
1187
  method: [string[], SdkLroPagingServiceMethod<SdkHttpOperation>],
1364
1188
  clientType: string,
1365
- optionalParamName: string = "options"
1189
+ optionalParamName: string = "options",
1366
1190
  ): FunctionDeclarationStructure & {
1367
1191
  isLroPaging?: boolean;
1368
1192
  propertyName?: string;
1369
1193
  lropagingFinalReturnType?: string;
1370
1194
  } {
1371
1195
  const operation = method[1];
1372
- const parameters = getOperationSignatureParameters(
1373
- context,
1374
- method,
1375
- clientType
1376
- );
1196
+ const parameters = getOperationSignatureParameters(context, method, clientType);
1377
1197
  const { name, fixme = [] } = getOperationName(operation, context);
1378
1198
 
1379
1199
  const returnType = buildLroPagingReturnType(context, operation);
@@ -1389,7 +1209,7 @@ function getLroAndPagingOperationFunction(
1389
1209
  `nextLinkName: "${operation.pagingMetadata.nextLinkSegments.map((p) => p.name).join(".")}"`,
1390
1210
  operation.pagingMetadata.nextLinkVerb !== "GET" &&
1391
1211
  `nextLinkMethod: "${operation.pagingMetadata.nextLinkVerb}"`,
1392
- apiVersion && `apiVersion: ${apiVersion}`
1212
+ apiVersion && `apiVersion: ${apiVersion}`,
1393
1213
  ].filter(Boolean);
1394
1214
 
1395
1215
  // Build LRO resource location config
@@ -1397,7 +1217,7 @@ function getLroAndPagingOperationFunction(
1397
1217
  "azure-async-operation",
1398
1218
  "location",
1399
1219
  "original-uri",
1400
- "operation-location"
1220
+ "operation-location",
1401
1221
  ];
1402
1222
  const resourceLocationConfig =
1403
1223
  operation.lroMetadata?.finalStateVia &&
@@ -1412,20 +1232,16 @@ function getLroAndPagingOperationFunction(
1412
1232
  getLroPoller: resolveReference(PollingHelpers.GetLongRunningPoller),
1413
1233
  pollerLike: resolveReference(AzurePollingDependencies.PollerLike),
1414
1234
  operationState: resolveReference(AzurePollingDependencies.OperationState),
1415
- pathResponse: resolveReference(useDependencies().PathUncheckedResponse)
1235
+ pathResponse: resolveReference(useDependencies().PathUncheckedResponse),
1416
1236
  };
1417
1237
 
1418
1238
  const expectedStatuses = getExpectedStatuses(operation);
1419
1239
  const paramList = parameters.map((p) => p.name).join(", ");
1420
- const pagingOptionsStr =
1421
- pagingOptions.length > 0 ? `,\n {${pagingOptions.join(", ")}}` : "";
1240
+ const pagingOptionsStr = pagingOptions.length > 0 ? `,\n {${pagingOptions.join(", ")}}` : "";
1422
1241
 
1423
1242
  return {
1424
1243
  kind: StructureKind.Function,
1425
- docs: [
1426
- ...getDocsFromDescription(operation.doc),
1427
- ...getFixmeForMultilineDocs(fixme)
1428
- ],
1244
+ docs: [...getDocsFromDescription(operation.doc), ...getFixmeForMultilineDocs(fixme)],
1429
1245
  isAsync: false,
1430
1246
  isExported: true,
1431
1247
  isLroPaging: true,
@@ -1452,23 +1268,21 @@ function getLroAndPagingOperationFunction(
1452
1268
  _${name}Deserialize,
1453
1269
  ${expectedStatuses}${pagingOptionsStr}
1454
1270
  );
1455
- `
1456
- ]
1271
+ `,
1272
+ ],
1457
1273
  };
1458
1274
  }
1459
1275
 
1460
1276
  function buildLroReturnType(
1461
1277
  context: SdkContext,
1462
- operation:
1463
- | SdkLroServiceMethod<SdkHttpOperation>
1464
- | SdkLroPagingServiceMethod<SdkHttpOperation>
1278
+ operation: SdkLroServiceMethod<SdkHttpOperation> | SdkLroPagingServiceMethod<SdkHttpOperation>,
1465
1279
  ) {
1466
1280
  const metadata = operation.lroMetadata;
1467
1281
  if (metadata !== undefined && metadata.finalResponse !== undefined) {
1468
1282
  const type = metadata.finalResponse.result;
1469
1283
  return {
1470
1284
  name: type.name,
1471
- type: getTypeExpression(context, type)
1285
+ type: getTypeExpression(context, type),
1472
1286
  };
1473
1287
  }
1474
1288
  return { name: "", type: "void" };
@@ -1476,12 +1290,12 @@ function buildLroReturnType(
1476
1290
 
1477
1291
  function buildLroPagingReturnType(
1478
1292
  context: SdkContext,
1479
- operation: SdkLroPagingServiceMethod<SdkHttpOperation>
1293
+ operation: SdkLroPagingServiceMethod<SdkHttpOperation>,
1480
1294
  ) {
1481
1295
  if (operation.response.type?.kind === "array") {
1482
1296
  return {
1483
1297
  name: (operation.response.type.valueType as any).name ?? "",
1484
- type: getTypeExpression(context, operation.response.type.valueType)
1298
+ type: getTypeExpression(context, operation.response.type.valueType),
1485
1299
  };
1486
1300
  }
1487
1301
  return { name: "", type: "void" };
@@ -1490,12 +1304,15 @@ function buildLroPagingReturnType(
1490
1304
  function getPagingOnlyOperationFunction(
1491
1305
  context: SdkContext,
1492
1306
  method: [string[], SdkPagingServiceMethod<SdkHttpOperation>],
1493
- clientType: string
1307
+ clientType: string,
1494
1308
  ): FunctionDeclarationStructure & { propertyName?: string } {
1495
1309
  const operation = method[1];
1496
1310
  // Extract required parameters
1497
- const parameters: OptionalKind<ParameterDeclarationStructure>[] =
1498
- getOperationSignatureParameters(context, method, clientType);
1311
+ const parameters: OptionalKind<ParameterDeclarationStructure>[] = getOperationSignatureParameters(
1312
+ context,
1313
+ method,
1314
+ clientType,
1315
+ );
1499
1316
 
1500
1317
  // TODO: Support operation overloads
1501
1318
  const response = operation.response;
@@ -1504,28 +1321,23 @@ function getPagingOnlyOperationFunction(
1504
1321
  const type = response.type;
1505
1322
  returnType = {
1506
1323
  name: (type.valueType as any).name ?? "",
1507
- type: getTypeExpression(context, type.valueType)
1324
+ type: getTypeExpression(context, type.valueType),
1508
1325
  };
1509
1326
  }
1510
1327
  const { name, fixme = [] } = getOperationName(operation, context);
1511
1328
  const pagedAsyncIterableIteratorReference = resolveReference(
1512
- PagingHelpers.PagedAsyncIterableIterator
1513
- );
1514
- const buildPagedAsyncIteratorReference = resolveReference(
1515
- PagingHelpers.BuildPagedAsyncIterator
1329
+ PagingHelpers.PagedAsyncIterableIterator,
1516
1330
  );
1331
+ const buildPagedAsyncIteratorReference = resolveReference(PagingHelpers.BuildPagedAsyncIterator);
1517
1332
  const functionStatement = {
1518
1333
  kind: StructureKind.Function,
1519
- docs: [
1520
- ...getDocsFromDescription(operation.doc),
1521
- ...getFixmeForMultilineDocs(fixme)
1522
- ],
1334
+ docs: [...getDocsFromDescription(operation.doc), ...getFixmeForMultilineDocs(fixme)],
1523
1335
  isAsync: false,
1524
1336
  isExported: true,
1525
1337
  name,
1526
1338
  propertyName: normalizeName(operation.name, NameType.Property),
1527
1339
  parameters,
1528
- returnType: `${pagedAsyncIterableIteratorReference}<${returnType.type}>`
1340
+ returnType: `${pagedAsyncIterableIteratorReference}<${returnType.type}>`,
1529
1341
  };
1530
1342
 
1531
1343
  const statements: string[] = [];
@@ -1567,18 +1379,18 @@ function getPagingOnlyOperationFunction(
1567
1379
  () => _${name}Send(${parameters.map((p) => p.name).join(", ")}),
1568
1380
  _${name}Deserialize,
1569
1381
  ${getExpectedStatuses(operation)}${options.length > 0 ? `,\n {${options.join(", ")}}` : ""}
1570
- );`
1382
+ );`,
1571
1383
  );
1572
1384
 
1573
1385
  return {
1574
1386
  ...functionStatement,
1575
- statements
1387
+ statements,
1576
1388
  } as FunctionDeclarationStructure & { propertyName?: string };
1577
1389
  }
1578
1390
 
1579
1391
  export function getOperationOptionsName(
1580
1392
  method: [string[], ServiceOperation],
1581
- includeGroupName = false
1393
+ includeGroupName = false,
1582
1394
  ) {
1583
1395
  const prefixes = method[0];
1584
1396
  const operation = method[1];
@@ -1598,24 +1410,21 @@ export function getOperationOptionsName(
1598
1410
  function getHeaderAndBodyParameters(
1599
1411
  dpgContext: SdkContext,
1600
1412
  operation: ServiceOperation,
1601
- optionalParamName: string = "options"
1413
+ optionalParamName: string = "options",
1602
1414
  ): string {
1603
1415
  if (!operation.operation.parameters) {
1604
1416
  return "";
1605
1417
  }
1606
- const operationParameters = operation.operation.parameters.filter(
1607
- (p) => !isContentType(p)
1608
- );
1418
+ const operationParameters = operation.operation.parameters.filter((p) => !isContentType(p));
1609
1419
 
1610
- const contentTypeParameter =
1611
- operation.operation.parameters.find(isContentType);
1420
+ const contentTypeParameter = operation.operation.parameters.find(isContentType);
1612
1421
 
1613
1422
  const parametersImplementation: Record<
1614
1423
  "header" | "body",
1615
1424
  { paramMap: string; param: SdkHttpParameter; paramAccessor: string }[]
1616
1425
  > = {
1617
1426
  header: [],
1618
- body: []
1427
+ body: [],
1619
1428
  };
1620
1429
 
1621
1430
  for (const param of operationParameters) {
@@ -1633,15 +1442,12 @@ function getHeaderAndBodyParameters(
1633
1442
  continue;
1634
1443
  }
1635
1444
  // Check if this parameter still exists in the corresponding method params (after override)
1636
- if (
1637
- param.methodParameterSegments &&
1638
- param.methodParameterSegments.length > 0
1639
- ) {
1445
+ if (param.methodParameterSegments && param.methodParameterSegments.length > 0) {
1640
1446
  const paramAccessor = getParamAccessor(param, optionalParamName);
1641
1447
  parametersImplementation[param.kind].push({
1642
1448
  paramMap: getParameterMap(dpgContext, param, paramAccessor),
1643
1449
  param,
1644
- paramAccessor
1450
+ paramAccessor,
1645
1451
  });
1646
1452
  }
1647
1453
  }
@@ -1655,20 +1461,10 @@ function getHeaderAndBodyParameters(
1655
1461
 
1656
1462
  if (parametersImplementation.header.length) {
1657
1463
  paramStr = `${paramStr}\nheaders: {${parametersImplementation.header
1658
- .map((i) =>
1659
- buildHeaderParameter(
1660
- dpgContext.program,
1661
- i.paramMap,
1662
- i.param,
1663
- i.paramAccessor
1664
- )
1665
- )
1464
+ .map((i) => buildHeaderParameter(dpgContext.program, i.paramMap, i.param, i.paramAccessor))
1666
1465
  .join(",\n")}, ...${optionalParamName}.requestOptions?.headers },`;
1667
1466
  }
1668
- if (
1669
- operation.operation.bodyParam === undefined &&
1670
- parametersImplementation.body.length
1671
- ) {
1467
+ if (operation.operation.bodyParam === undefined && parametersImplementation.body.length) {
1672
1468
  paramStr = `${paramStr}\nbody: {${parametersImplementation.body
1673
1469
  .map((i) => i.paramMap)
1674
1470
  .join(",\n")}}`;
@@ -1683,13 +1479,13 @@ function buildHeaderParameter(
1683
1479
  program: Program,
1684
1480
  paramMap: string,
1685
1481
  param: SdkHttpParameter,
1686
- paramAccessor: string
1482
+ paramAccessor: string,
1687
1483
  ): string {
1688
1484
  const effectiveOptional = getEffectiveOptional(param);
1689
1485
  if (!effectiveOptional && isTypeNullable(param.type) === true) {
1690
1486
  reportDiagnostic(program, {
1691
1487
  code: "nullable-required-header",
1692
- target: NoTarget
1488
+ target: NoTarget,
1693
1489
  });
1694
1490
  return paramMap;
1695
1491
  }
@@ -1697,8 +1493,7 @@ function buildHeaderParameter(
1697
1493
  // If the param has a clientDefaultValue that type-matches, the paramMap already contains
1698
1494
  // `?? defaultValue` from getOptional(). In this case, always send the header (do not
1699
1495
  // conditionally omit it when the accessor is undefined) so the default is always applied.
1700
- const hasEffectiveDefaultValue =
1701
- effectiveOptional && hasEffectiveClientDefaultValue(param);
1496
+ const hasEffectiveDefaultValue = effectiveOptional && hasEffectiveClientDefaultValue(param);
1702
1497
 
1703
1498
  const conditions = [];
1704
1499
  if (effectiveOptional && !hasEffectiveDefaultValue) {
@@ -1707,15 +1502,13 @@ function buildHeaderParameter(
1707
1502
  if (isTypeNullable(param.type) === true) {
1708
1503
  conditions.push(`${paramAccessor} !== null`);
1709
1504
  }
1710
- return conditions.length > 0
1711
- ? `...(${conditions.join(" && ")} ? {${paramMap}} : {})`
1712
- : paramMap;
1505
+ return conditions.length > 0 ? `...(${conditions.join(" && ")} ? {${paramMap}} : {})` : paramMap;
1713
1506
  }
1714
1507
 
1715
1508
  function buildBodyParameter(
1716
1509
  context: SdkContext,
1717
1510
  bodyParameter: SdkBodyParameter | undefined,
1718
- optionalParamName: string = "options"
1511
+ optionalParamName: string = "options",
1719
1512
  ) {
1720
1513
  if (!bodyParameter || !bodyParameter.type) {
1721
1514
  return "";
@@ -1727,8 +1520,7 @@ function buildBodyParameter(
1727
1520
  const bodyType = getNullableValidType(bodyParameter.type);
1728
1521
 
1729
1522
  // Check if XML serialization is needed and available
1730
- const useXmlSerialization =
1731
- isXml && bodyType.kind === "model" && hasXmlSerialization(bodyType);
1523
+ const useXmlSerialization = isXml && bodyType.kind === "model" && hasXmlSerialization(bodyType);
1732
1524
 
1733
1525
  let serializerFunctionName: string | undefined;
1734
1526
 
@@ -1736,27 +1528,24 @@ function buildBodyParameter(
1736
1528
  // Use XML serializer
1737
1529
  serializerFunctionName = buildXmlModelSerializer(context, bodyType, {
1738
1530
  nameOnly: true,
1739
- skipDiscriminatedUnionSuffix: false
1531
+ skipDiscriminatedUnionSuffix: false,
1740
1532
  }) as string | undefined;
1741
1533
  } else {
1742
1534
  // Use JSON serializer (default)
1743
1535
  serializerFunctionName = buildModelSerializer(context, bodyType, {
1744
1536
  nameOnly: true,
1745
- skipDiscriminatedUnionSuffix: false
1537
+ skipDiscriminatedUnionSuffix: false,
1746
1538
  }) as string | undefined;
1747
1539
  }
1748
1540
 
1749
1541
  let bodyNameExpression = getParamAccessor(bodyParameter, optionalParamName);
1750
1542
 
1751
1543
  // Check if body parameter has a client default value with matching type
1752
- const hasClientDefault =
1753
- bodyParameter.optional && hasEffectiveClientDefaultValue(bodyParameter);
1544
+ const hasClientDefault = bodyParameter.optional && hasEffectiveClientDefaultValue(bodyParameter);
1754
1545
 
1755
1546
  // Apply client default value if present for optional body parameters
1756
1547
  if (hasClientDefault) {
1757
- const formattedDefault = formatDefaultValue(
1758
- bodyParameter.clientDefaultValue
1759
- );
1548
+ const formattedDefault = formatDefaultValue(bodyParameter.clientDefaultValue);
1760
1549
  bodyNameExpression = `(${bodyNameExpression} ?? ${formattedDefault})`;
1761
1550
  }
1762
1551
 
@@ -1773,18 +1562,14 @@ function buildBodyParameter(
1773
1562
  : "";
1774
1563
 
1775
1564
  // For dual-format operations, check the contentType option at runtime
1776
- if (
1777
- isDualFormat &&
1778
- bodyType.kind === "model" &&
1779
- hasXmlSerialization(bodyType)
1780
- ) {
1565
+ if (isDualFormat && bodyType.kind === "model" && hasXmlSerialization(bodyType)) {
1781
1566
  const xmlSerializerName = buildXmlModelSerializer(context, bodyType, {
1782
1567
  nameOnly: true,
1783
- skipDiscriminatedUnionSuffix: false
1568
+ skipDiscriminatedUnionSuffix: false,
1784
1569
  }) as string | undefined;
1785
1570
  const jsonSerializerName = buildModelSerializer(context, bodyType, {
1786
1571
  nameOnly: true,
1787
- skipDiscriminatedUnionSuffix: false
1572
+ skipDiscriminatedUnionSuffix: false,
1788
1573
  }) as string | undefined;
1789
1574
 
1790
1575
  if (xmlSerializerName && jsonSerializerName) {
@@ -1808,12 +1593,12 @@ function buildBodyParameter(
1808
1593
  context,
1809
1594
  bodyParameter.__raw!,
1810
1595
  bodyParameter.contentTypes,
1811
- getEncodeForType(bodyParameter.type)
1596
+ getEncodeForType(bodyParameter.type),
1812
1597
  )
1813
1598
  ? "binary"
1814
1599
  : getEncodeForType(bodyParameter.type),
1815
1600
  undefined,
1816
- true
1601
+ true,
1817
1602
  );
1818
1603
  return `\nbody: ${serializedBody.startsWith(nullOrUndefinedPrefix) ? "" : nullOrUndefinedPrefix}${serializedBody},`;
1819
1604
  }
@@ -1834,13 +1619,11 @@ function getEncodingFormat(type: { format?: string }) {
1834
1619
  export function getParameterMap(
1835
1620
  context: SdkContext,
1836
1621
  param: SdkHttpParameter,
1837
- paramAccessor: string
1622
+ paramAccessor: string,
1838
1623
  ): string {
1839
1624
  // Use lowercase for header names since HTTP headers are case-insensitive
1840
1625
  const serializedName =
1841
- param.kind === "header"
1842
- ? getHeaderSerializedName(param)
1843
- : getPropertySerializedName(param);
1626
+ param.kind === "header" ? getHeaderSerializedName(param) : getPropertySerializedName(param);
1844
1627
 
1845
1628
  if (isConstant(param.type) && !isOptional(param)) {
1846
1629
  return `"${serializedName}": ${getConstantValue(param.type)}`;
@@ -1856,12 +1639,7 @@ export function getParameterMap(
1856
1639
  }
1857
1640
 
1858
1641
  if (hasCollectionFormatInfo(param.kind, (param as any).collectionFormat)) {
1859
- return getCollectionFormatForParam(
1860
- context,
1861
- param,
1862
- paramAccessor,
1863
- serializedName
1864
- );
1642
+ return getCollectionFormatForParam(context, param, paramAccessor, serializedName);
1865
1643
  }
1866
1644
 
1867
1645
  // if the parameter or property is optional, we don't need to handle the default value
@@ -1877,9 +1655,9 @@ export function getParameterMap(
1877
1655
  code: "unsupported-parameter-type",
1878
1656
  format: {
1879
1657
  paramName: param.name,
1880
- paramKind: param.kind
1658
+ paramKind: param.kind,
1881
1659
  },
1882
- target: param.__raw || NoTarget
1660
+ target: param.__raw || NoTarget,
1883
1661
  });
1884
1662
 
1885
1663
  // Return a fallback value to allow the emitter to continue
@@ -1890,7 +1668,7 @@ function getCollectionFormatForParam(
1890
1668
  context: SdkContext,
1891
1669
  param: SdkHttpParameter,
1892
1670
  paramAccessor: string,
1893
- serializedName: string
1671
+ serializedName: string,
1894
1672
  ) {
1895
1673
  const format = (param as any).collectionFormat;
1896
1674
  return `"${serializedName}": ${serializeRequestValue(
@@ -1900,21 +1678,15 @@ function getCollectionFormatForParam(
1900
1678
  !param.optional,
1901
1679
  format,
1902
1680
  serializedName,
1903
- true
1681
+ true,
1904
1682
  )}`;
1905
1683
  }
1906
1684
 
1907
1685
  function isContentType(param: SdkHttpParameter): boolean {
1908
- return (
1909
- param.kind === "header" &&
1910
- param.serializedName.toLowerCase() === "content-type"
1911
- );
1686
+ return param.kind === "header" && param.serializedName.toLowerCase() === "content-type";
1912
1687
  }
1913
1688
 
1914
- function getContentTypeValue(
1915
- param: SdkHttpParameter,
1916
- optionalParamName: string = "options"
1917
- ) {
1689
+ function getContentTypeValue(param: SdkHttpParameter, optionalParamName: string = "options") {
1918
1690
  const defaultValue = param.clientDefaultValue;
1919
1691
  // allow customers to customize the content type if it's guessed by tcgc.
1920
1692
  if (isConstant(param.type)) {
@@ -1965,13 +1737,13 @@ function getRequired(
1965
1737
  context: SdkContext,
1966
1738
  param: SdkHttpParameter,
1967
1739
  serializedName: string,
1968
- paramAccessor: string
1740
+ paramAccessor: string,
1969
1741
  ) {
1970
1742
  if (param.type.kind === "model") {
1971
1743
  const propertiesStr = getRequestModelMapping(
1972
1744
  context,
1973
1745
  { ...param.type, optional: param.optional },
1974
- paramAccessor
1746
+ paramAccessor,
1975
1747
  );
1976
1748
  return `"${serializedName}": { ${propertiesStr.join(",")} }`;
1977
1749
  }
@@ -1982,7 +1754,7 @@ function getRequired(
1982
1754
  true,
1983
1755
  getEncodeForType(param.type),
1984
1756
  serializedName,
1985
- true
1757
+ true,
1986
1758
  )}`;
1987
1759
  }
1988
1760
 
@@ -2005,7 +1777,7 @@ function getOptional(
2005
1777
  context: SdkContext,
2006
1778
  param: SdkHttpParameter,
2007
1779
  serializedName: string,
2008
- paramAccessor: string
1780
+ paramAccessor: string,
2009
1781
  ) {
2010
1782
  // Apply client default value if present and type matches
2011
1783
  const defaultSuffix = hasEffectiveClientDefaultValue(param)
@@ -2016,7 +1788,7 @@ function getOptional(
2016
1788
  const propertiesStr = getRequestModelMapping(
2017
1789
  context,
2018
1790
  { ...param.type, optional: param.optional },
2019
- paramAccessor + "?."
1791
+ paramAccessor + "?.",
2020
1792
  );
2021
1793
  const serializeContent = `{${propertiesStr.join(",")}}`;
2022
1794
  return `"${serializedName}": ${serializeContent}`;
@@ -2028,7 +1800,7 @@ function getOptional(
2028
1800
  false,
2029
1801
  getEncodeForType(param.type),
2030
1802
  serializedName,
2031
- true
1803
+ true,
2032
1804
  );
2033
1805
  return `"${serializedName}": ${serializedValue}${defaultSuffix}`;
2034
1806
  }
@@ -2036,18 +1808,14 @@ function getOptional(
2036
1808
  /**
2037
1809
  * Get the encode for SDK type
2038
1810
  */
2039
- function getEncodeForType(
2040
- type: SdkType | SdkHttpParameter | SdkModelPropertyType
2041
- ) {
1811
+ function getEncodeForType(type: SdkType | SdkHttpParameter | SdkModelPropertyType) {
2042
1812
  return (type as any).encode;
2043
1813
  }
2044
1814
 
2045
1815
  /**
2046
1816
  * Get the optionality for SDK type
2047
1817
  */
2048
- function getOptionalForType(
2049
- type: SdkType | SdkHttpParameter | SdkModelPropertyType
2050
- ) {
1818
+ function getOptionalForType(type: SdkType | SdkHttpParameter | SdkModelPropertyType) {
2051
1819
  return (type as any).optional;
2052
1820
  }
2053
1821
 
@@ -2061,10 +1829,7 @@ function getDefaultValue(param: SdkHttpParameter) {
2061
1829
  /**
2062
1830
  * Extracts the path parameters
2063
1831
  */
2064
- function getPathParameters(
2065
- operation: ServiceOperation,
2066
- optionalParamName: string = "options"
2067
- ) {
1832
+ function getPathParameters(operation: ServiceOperation, optionalParamName: string = "options") {
2068
1833
  if (!operation.operation.parameters) {
2069
1834
  return [];
2070
1835
  }
@@ -2075,7 +1840,7 @@ function getPathParameters(
2075
1840
  const methodParam = param.methodParameterSegments[0]?.[0];
2076
1841
  if (methodParam) {
2077
1842
  pathParams.push(
2078
- `"${param.serializedName}": ${getPathParamExpr(param, getDefaultValue(param) as string, optionalParamName)}`
1843
+ `"${param.serializedName}": ${getPathParamExpr(param, getDefaultValue(param) as string, optionalParamName)}`,
2079
1844
  );
2080
1845
  }
2081
1846
  }
@@ -2087,30 +1852,20 @@ function getPathParameters(
2087
1852
  /**
2088
1853
  * Extract the query parameters
2089
1854
  */
2090
- function getQueryParameters(
2091
- dpgContext: SdkContext,
2092
- operation: ServiceOperation
2093
- ): string[] {
1855
+ function getQueryParameters(dpgContext: SdkContext, operation: ServiceOperation): string[] {
2094
1856
  if (!operation.parameters) {
2095
1857
  return [];
2096
1858
  }
2097
- const operationParameters = operation.operation.parameters.filter(
2098
- (p) => !isContentType(p)
2099
- );
2100
- const parametersImplementation: Record<
2101
- "query",
2102
- { paramMap: string; param: SdkHttpParameter }[]
2103
- > = {
2104
- query: []
2105
- };
1859
+ const operationParameters = operation.operation.parameters.filter((p) => !isContentType(p));
1860
+ const parametersImplementation: Record<"query", { paramMap: string; param: SdkHttpParameter }[]> =
1861
+ {
1862
+ query: [],
1863
+ };
2106
1864
 
2107
1865
  for (const param of operationParameters) {
2108
1866
  if (param.kind === "query") {
2109
1867
  // Check if this parameter still exists in the corresponding method params (after override)
2110
- if (
2111
- param.methodParameterSegments &&
2112
- param.methodParameterSegments.length > 0
2113
- ) {
1868
+ if (param.methodParameterSegments && param.methodParameterSegments.length > 0) {
2114
1869
  const paramAccessor = getParamAccessor(param);
2115
1870
  parametersImplementation[param.kind].push({
2116
1871
  paramMap: getParameterMap(
@@ -2119,19 +1874,17 @@ function getQueryParameters(
2119
1874
  ...param,
2120
1875
  // TODO: remember to remove this hack once compiler gives us a name
2121
1876
  // https://github.com/microsoft/typespec/issues/6743
2122
- serializedName: getUriTemplateQueryParamName(param.serializedName)
1877
+ serializedName: getUriTemplateQueryParamName(param.serializedName),
2123
1878
  },
2124
- paramAccessor
1879
+ paramAccessor,
2125
1880
  ),
2126
- param
1881
+ param,
2127
1882
  });
2128
1883
  }
2129
1884
  }
2130
1885
  }
2131
1886
 
2132
- const paramStr: string[] = parametersImplementation.query.map(
2133
- (i) => i.paramMap
2134
- );
1887
+ const paramStr: string[] = parametersImplementation.query.map((i) => i.paramMap);
2135
1888
 
2136
1889
  return paramStr;
2137
1890
  }
@@ -2152,19 +1905,14 @@ function escapeUriTemplateParamName(name: string) {
2152
1905
  * built from those segments (e.g. `options?.ocpDate`, `body.nested`).
2153
1906
  * 3. Fallback: returns the parameter name directly, with optional chaining if optional.
2154
1907
  */
2155
- function getParamAccessor(
2156
- param: SdkHttpParameter,
2157
- optionalParamName: string = "options"
2158
- ): string {
1908
+ function getParamAccessor(param: SdkHttpParameter, optionalParamName: string = "options"): string {
2159
1909
  if (param.isGeneratedName) {
2160
1910
  return param.name;
2161
1911
  }
2162
1912
  const methodParamExpr = getMethodParamExpr(param, optionalParamName);
2163
1913
  const clientPrefix = "context.";
2164
1914
  if (methodParamExpr) {
2165
- return param.onClient
2166
- ? `${clientPrefix}${methodParamExpr}`
2167
- : methodParamExpr;
1915
+ return param.onClient ? `${clientPrefix}${methodParamExpr}` : methodParamExpr;
2168
1916
  }
2169
1917
  if (param.onClient) {
2170
1918
  return `${clientPrefix}${getClientParameterName(param)}`;
@@ -2182,7 +1930,7 @@ function getParamAccessor(
2182
1930
  */
2183
1931
  function getMethodParamExpr(
2184
1932
  param: SdkHttpParameter,
2185
- optionalParamName: string = "options"
1933
+ optionalParamName: string = "options",
2186
1934
  ): string | undefined {
2187
1935
  const segments = param.methodParameterSegments;
2188
1936
  if (segments.length === 0) {
@@ -2222,7 +1970,7 @@ function getMethodParamExpr(
2222
1970
  function getPathParamExpr(
2223
1971
  param: SdkHttpParameter,
2224
1972
  defaultValue?: string,
2225
- optionalParamName: string = "options"
1973
+ optionalParamName: string = "options",
2226
1974
  ) {
2227
1975
  if (isConstant(param.type)) {
2228
1976
  return getConstantValue(param.type);
@@ -2251,7 +1999,7 @@ function getNullableCheck(name: string, type: SdkType) {
2251
1999
  */
2252
2000
  function getEncodeForModelProperty(
2253
2001
  context: SdkContext,
2254
- property: SdkModelPropertyType
2002
+ property: SdkModelPropertyType,
2255
2003
  ): string | undefined {
2256
2004
  if (property.encode && property.type.kind === "array") {
2257
2005
  // Only arrays of string type or string-based enum type can have collectionFormat encoding
@@ -2260,20 +2008,15 @@ function getEncodeForModelProperty(
2260
2008
  code: "un-supported-array-encoding",
2261
2009
  format: {
2262
2010
  arrayName: property.name,
2263
- arrayType: property.type.valueType.kind
2011
+ arrayType: property.type.valueType.kind,
2264
2012
  },
2265
- target: NoTarget
2013
+ target: NoTarget,
2266
2014
  });
2267
2015
  return getEncodeForType(property.type);
2268
2016
  }
2269
2017
 
2270
- const collectionFormat = getCollectionFormatFromArrayEncoding(
2271
- property.encode
2272
- );
2273
- if (
2274
- collectionFormat &&
2275
- hasCollectionFormatInfo(property.kind, collectionFormat)
2276
- ) {
2018
+ const collectionFormat = getCollectionFormatFromArrayEncoding(property.encode);
2019
+ if (collectionFormat && hasCollectionFormatInfo(property.kind, collectionFormat)) {
2277
2020
  return collectionFormat;
2278
2021
  }
2279
2022
  }
@@ -2290,10 +2033,7 @@ function isStringEncodableArrayValueType(valueType: SdkType): boolean {
2290
2033
  return true;
2291
2034
  }
2292
2035
  // String-based enum type
2293
- if (
2294
- valueType.kind === "enum" &&
2295
- (valueType as SdkEnumType).valueType.kind === "string"
2296
- ) {
2036
+ if (valueType.kind === "enum" && (valueType as SdkEnumType).valueType.kind === "string") {
2297
2037
  return true;
2298
2038
  }
2299
2039
  return false;
@@ -2302,11 +2042,11 @@ function isStringEncodableArrayValueType(valueType: SdkType): boolean {
2302
2042
  function getSerializationExpressionForFlatten(
2303
2043
  context: SdkContext,
2304
2044
  property: SdkModelPropertyType,
2305
- propertyPath: string
2045
+ propertyPath: string,
2306
2046
  ): string {
2307
2047
  const serializeFunctionName = buildPropertySerializer(context, property, {
2308
2048
  nameOnly: true,
2309
- skipDiscriminatedUnionSuffix: false
2049
+ skipDiscriminatedUnionSuffix: false,
2310
2050
  });
2311
2051
  if (!serializeFunctionName) {
2312
2052
  return property.optional ? `undefined` : `{}`;
@@ -2314,12 +2054,9 @@ function getSerializationExpressionForFlatten(
2314
2054
  const validProps = getAllProperties(
2315
2055
  context,
2316
2056
  property.type,
2317
- getAllAncestors(property.type)
2057
+ getAllAncestors(property.type),
2318
2058
  ).filter(
2319
- (p) =>
2320
- p.kind === "property" &&
2321
- !isReadOnly(p) &&
2322
- !isMetadata(context.program, p.__raw!)
2059
+ (p) => p.kind === "property" && !isReadOnly(p) && !isMetadata(context.program, p.__raw!),
2323
2060
  );
2324
2061
  const optionalPrefix = property.optional
2325
2062
  ? `${resolveReference(SerializationHelpers.areAllPropsUndefined)}(${propertyPath}, [${validProps
@@ -2333,32 +2070,20 @@ export function getSerializationExpression(
2333
2070
  context: SdkContext,
2334
2071
  property: SdkModelPropertyType,
2335
2072
  propertyPath: string,
2336
- enableFlatten: boolean = true
2073
+ enableFlatten: boolean = true,
2337
2074
  ): string {
2338
2075
  if (property.flatten && property.type.kind === "model" && enableFlatten) {
2339
2076
  return getSerializationExpressionForFlatten(context, property, "item");
2340
2077
  }
2341
2078
  const dot = propertyPath.endsWith("?") ? "." : "";
2342
2079
  const propertyPathWithDot = `${propertyPath ? `${propertyPath}${dot}` : `${dot}`}`;
2343
- const nullOrUndefinedPrefix = getPropertySerializationPrefix(
2344
- context,
2345
- property,
2346
- propertyPath
2347
- );
2080
+ const nullOrUndefinedPrefix = getPropertySerializationPrefix(context, property, propertyPath);
2348
2081
 
2349
- const propertyFullName = getPropertyFullName(
2350
- context,
2351
- property,
2352
- propertyPathWithDot
2353
- );
2354
- const serializeFunctionName = buildModelSerializer(
2355
- context,
2356
- getNullableValidType(property.type),
2357
- {
2358
- nameOnly: true,
2359
- skipDiscriminatedUnionSuffix: false
2360
- }
2361
- );
2082
+ const propertyFullName = getPropertyFullName(context, property, propertyPathWithDot);
2083
+ const serializeFunctionName = buildModelSerializer(context, getNullableValidType(property.type), {
2084
+ nameOnly: true,
2085
+ skipDiscriminatedUnionSuffix: false,
2086
+ });
2362
2087
 
2363
2088
  // Apply clientDefaultValue for model properties that have one
2364
2089
  const defaultValueSuffix = hasEffectiveClientDefaultValue(property)
@@ -2377,7 +2102,7 @@ export function getSerializationExpression(
2377
2102
  !property.optional,
2378
2103
  getEncodeForModelProperty(context, property),
2379
2104
  getPropertySerializedName(property),
2380
- propertyPath === "" ? true : false
2105
+ propertyPath === "" ? true : false,
2381
2106
  );
2382
2107
  return `${baseExpr}${defaultValueSuffix}`;
2383
2108
  }
@@ -2388,7 +2113,7 @@ export function getRequestModelProperties(
2388
2113
  modelPropertyType: SdkModelType & { optional?: boolean },
2389
2114
  propertyPath: string = "body",
2390
2115
  overrides?: ModelOverrideOptions,
2391
- enableFlatten: boolean = true
2116
+ enableFlatten: boolean = true,
2392
2117
  ): Array<[string, string]> {
2393
2118
  const props: [string, string][] = [];
2394
2119
  const allParents = getAllAncestors(modelPropertyType);
@@ -2407,7 +2132,7 @@ export function getRequestModelProperties(
2407
2132
  const property = getPropertyWithOverrides(prop, overrides);
2408
2133
  props.push([
2409
2134
  getPropertySerializedName(property)!,
2410
- getSerializationExpression(context, property, propertyPath, enableFlatten)
2135
+ getSerializationExpression(context, property, propertyPath, enableFlatten),
2411
2136
  ]);
2412
2137
  }
2413
2138
 
@@ -2424,20 +2149,18 @@ export function getRequestModelMapping(
2424
2149
  modelPropertyType: SdkModelType & { optional?: boolean },
2425
2150
  propertyPath: string = "body",
2426
2151
  overrides?: ModelOverrideOptions,
2427
- enableFlatten: boolean = true
2152
+ enableFlatten: boolean = true,
2428
2153
  ): string[] {
2429
2154
  return getRequestModelProperties(
2430
2155
  context,
2431
2156
  modelPropertyType,
2432
2157
  propertyPath,
2433
2158
  overrides,
2434
- enableFlatten
2159
+ enableFlatten,
2435
2160
  ).map(([name, value]) => `"${name}": ${value}`);
2436
2161
  }
2437
2162
 
2438
- export function getPropertySerializedName(
2439
- property: SdkHttpParameter | SdkModelPropertyType
2440
- ) {
2163
+ export function getPropertySerializedName(property: SdkHttpParameter | SdkModelPropertyType) {
2441
2164
  return (
2442
2165
  (property.kind === "property"
2443
2166
  ? property.serializationOptions.json?.name
@@ -2462,11 +2185,10 @@ export function getResponseMapping(
2462
2185
  type: SdkType,
2463
2186
  propertyPath: string = "result.body",
2464
2187
  overrides?: ModelOverrideOptions,
2465
- enableFlatten: boolean = true
2188
+ enableFlatten: boolean = true,
2466
2189
  ) {
2467
2190
  const allParents = type.kind === "model" ? getAllAncestors(type) : [];
2468
- const properties =
2469
- type.kind === "model" ? getAllProperties(context, type, allParents) : [];
2191
+ const properties = type.kind === "model" ? getAllProperties(context, type, allParents) : [];
2470
2192
  const props: string[] = [];
2471
2193
  for (const prop of properties) {
2472
2194
  if (isMetadata(context.program, prop.__raw!)) {
@@ -2475,35 +2197,28 @@ export function getResponseMapping(
2475
2197
  const property = getPropertyWithOverrides(prop, overrides);
2476
2198
  const dot = propertyPath.endsWith("?") ? "." : "";
2477
2199
  const serializedName = getPropertySerializedName(property);
2478
- const restValue = `${
2479
- propertyPath ? `${propertyPath}${dot}` : `${dot}`
2480
- }["${serializedName}"]`;
2200
+ const restValue = `${propertyPath ? `${propertyPath}${dot}` : `${dot}`}["${serializedName}"]`;
2481
2201
 
2482
2202
  const nullOrUndefinedPrefix =
2483
- property.optional || isTypeNullable(property.type)
2484
- ? `!${restValue}? ${restValue}: `
2485
- : "";
2486
- const flattenContext =
2487
- useContext("sdkTypes").flattenProperties.get(property);
2203
+ property.optional || isTypeNullable(property.type) ? `!${restValue}? ${restValue}: ` : "";
2204
+ const flattenContext = useContext("sdkTypes").flattenProperties.get(property);
2488
2205
  const isSupportedFlatten = flattenContext && enableFlatten;
2489
2206
  const deserializeFunctionName = isSupportedFlatten
2490
2207
  ? buildPropertyDeserializer(context, property, {
2491
2208
  nameOnly: true,
2492
- skipDiscriminatedUnionSuffix: false
2209
+ skipDiscriminatedUnionSuffix: false,
2493
2210
  })
2494
2211
  : buildModelDeserializer(context, getNullableValidType(property.type), {
2495
2212
  nameOnly: true,
2496
- skipDiscriminatedUnionSuffix: false
2213
+ skipDiscriminatedUnionSuffix: false,
2497
2214
  });
2498
2215
  const propertyName = normalizeModelPropertyName(context, property);
2499
2216
  if (deserializeFunctionName) {
2500
2217
  if (isSupportedFlatten) {
2501
- props.push(
2502
- `...${nullOrUndefinedPrefix}${deserializeFunctionName}(${restValue})`
2503
- );
2218
+ props.push(`...${nullOrUndefinedPrefix}${deserializeFunctionName}(${restValue})`);
2504
2219
  } else {
2505
2220
  props.push(
2506
- `${propertyName}: ${nullOrUndefinedPrefix}${deserializeFunctionName}(${restValue})`
2221
+ `${propertyName}: ${nullOrUndefinedPrefix}${deserializeFunctionName}(${restValue})`,
2507
2222
  );
2508
2223
  }
2509
2224
  } else if (isAzureCoreErrorType(context.program, property.type.__raw)) {
@@ -2514,7 +2229,7 @@ export function getResponseMapping(
2514
2229
  property.type,
2515
2230
  `${propertyPath}${dot}["${serializedName}"]`,
2516
2231
  !property.optional,
2517
- getEncodeForModelProperty(context, property)
2232
+ getEncodeForModelProperty(context, property),
2518
2233
  );
2519
2234
  props.push(`${propertyName}: ${deserializeValue}`);
2520
2235
  }
@@ -2532,7 +2247,7 @@ export function serializeRequestValue(
2532
2247
  required: boolean,
2533
2248
  format?: string,
2534
2249
  serializedName?: string,
2535
- isTopLevel: boolean = false
2250
+ isTopLevel: boolean = false,
2536
2251
  ): string {
2537
2252
  const getSdkType = useSdkTypes();
2538
2253
  const dependencies = useDependencies();
@@ -2558,22 +2273,18 @@ export function serializeRequestValue(
2558
2273
  if (type.valueType) {
2559
2274
  const prefix = nullOrUndefinedPrefix + clientValue;
2560
2275
  const elementNullOrUndefinedPrefix =
2561
- isTypeNullable(type.valueType) || getOptionalForType(type.valueType)
2562
- ? "!p ? p : "
2563
- : "";
2276
+ isTypeNullable(type.valueType) || getOptionalForType(type.valueType) ? "!p ? p : " : "";
2564
2277
  const serializeFunctionName = buildModelSerializer(
2565
2278
  context,
2566
2279
  getNullableValidType(type.valueType),
2567
2280
  {
2568
2281
  nameOnly: true,
2569
- skipDiscriminatedUnionSuffix: false
2570
- }
2282
+ skipDiscriminatedUnionSuffix: false,
2283
+ },
2571
2284
  );
2572
2285
  if (serializeFunctionName) {
2573
2286
  return `${prefix}.map((p: any) => { return ${elementNullOrUndefinedPrefix}${serializeFunctionName}(p)})`;
2574
- } else if (
2575
- isAzureCoreErrorType(context.program, type.valueType.__raw)
2576
- ) {
2287
+ } else if (isAzureCoreErrorType(context.program, type.valueType.__raw)) {
2577
2288
  return `${prefix}.map((p: any) => { return ${elementNullOrUndefinedPrefix}p})`;
2578
2289
  } else {
2579
2290
  const serializedValue = `${clientValue}.map((p: any) => { return ${elementNullOrUndefinedPrefix}${serializeRequestValue(context, type.valueType, "p", true, getEncodeForType(type.valueType))}})`;
@@ -2594,13 +2305,11 @@ export function serializeRequestValue(
2594
2305
  case "bytes":
2595
2306
  // TODO https://github.com/Azure/typespec-azure/issues/1999
2596
2307
  if (format !== "binary" && format !== "bytes") {
2597
- const uint8ArrayToStringReference = resolveReference(
2598
- dependencies.uint8ArrayToString
2599
- );
2308
+ const uint8ArrayToStringReference = resolveReference(dependencies.uint8ArrayToString);
2600
2309
  return required
2601
2310
  ? `${getNullableCheck(
2602
2311
  clientValue,
2603
- type
2312
+ type,
2604
2313
  )} ${uint8ArrayToStringReference}(${clientValue}, "${
2605
2314
  getEncodingFormat({ format }) ?? "base64"
2606
2315
  }")`
@@ -2615,8 +2324,7 @@ export function serializeRequestValue(
2615
2324
  } else if (
2616
2325
  isSpecialHandledUnion({
2617
2326
  ...type,
2618
- isNonExhaustive:
2619
- context.rlcOptions?.experimentalExtensibleEnums ?? false
2327
+ isNonExhaustive: context.rlcOptions?.experimentalExtensibleEnums ?? false,
2620
2328
  })
2621
2329
  ) {
2622
2330
  const sdkType = getSdkType(type.__raw!);
@@ -2639,7 +2347,7 @@ export function serializeRequestValue(
2639
2347
  type.type,
2640
2348
  clientValue,
2641
2349
  false,
2642
- getEncodeForType(type.type)
2350
+ getEncodeForType(type.type),
2643
2351
  );
2644
2352
  default:
2645
2353
  if (clientValue === "constructorParam") {
@@ -2659,7 +2367,7 @@ export function deserializeResponseHeadersValue(
2659
2367
  restValue: string,
2660
2368
  required: boolean,
2661
2369
  format?: string,
2662
- recursionDepth: number = 0
2370
+ recursionDepth: number = 0,
2663
2371
  ) {
2664
2372
  const nullOrUndefinedPrefix =
2665
2373
  isTypeNullable(type) || getOptionalForType(type) || !required
@@ -2695,7 +2403,7 @@ export function deserializeResponseHeadersValue(
2695
2403
  const deserializeFunctionName = type
2696
2404
  ? buildModelDeserializer(context, getNullableValidType(type), {
2697
2405
  nameOnly: true,
2698
- skipDiscriminatedUnionSuffix: false
2406
+ skipDiscriminatedUnionSuffix: false,
2699
2407
  })
2700
2408
  : undefined;
2701
2409
  if (deserializeFunctionName) {
@@ -2707,14 +2415,7 @@ export function deserializeResponseHeadersValue(
2707
2415
  return `${restValue} as any`;
2708
2416
  }
2709
2417
  default: {
2710
- const val = deserializeResponseValue(
2711
- context,
2712
- type,
2713
- restValue,
2714
- true,
2715
- format,
2716
- recursionDepth
2717
- );
2418
+ const val = deserializeResponseValue(context, type, restValue, true, format, recursionDepth);
2718
2419
  return `${nullOrUndefinedPrefix} ${val}`;
2719
2420
  }
2720
2421
  }
@@ -2731,12 +2432,10 @@ export function deserializeResponseValue(
2731
2432
  restValue: string,
2732
2433
  required: boolean,
2733
2434
  format?: string,
2734
- recursionDepth: number = 0
2435
+ recursionDepth: number = 0,
2735
2436
  ): string {
2736
2437
  const dependencies = useDependencies();
2737
- const stringToUint8ArrayReference = resolveReference(
2738
- dependencies.stringToUint8Array
2739
- );
2438
+ const stringToUint8ArrayReference = resolveReference(dependencies.stringToUint8Array);
2740
2439
  const nullOrUndefinedPrefix =
2741
2440
  isTypeNullable(type) || getOptionalForType(type) || !required
2742
2441
  ? `!${restValue}? ${restValue}: `
@@ -2758,21 +2457,14 @@ export function deserializeResponseValue(
2758
2457
  elementNullOrUndefinedPrefix = `!${varName} ? ${varName} :`;
2759
2458
  }
2760
2459
  const deserializeFunctionName = type.valueType
2761
- ? buildModelDeserializer(
2762
- context,
2763
- getNullableValidType(type.valueType),
2764
- {
2765
- nameOnly: true,
2766
- skipDiscriminatedUnionSuffix: false
2767
- }
2768
- )
2460
+ ? buildModelDeserializer(context, getNullableValidType(type.valueType), {
2461
+ nameOnly: true,
2462
+ skipDiscriminatedUnionSuffix: false,
2463
+ })
2769
2464
  : undefined;
2770
2465
  if (deserializeFunctionName) {
2771
2466
  return `${prefix}.map((${varName}: any) => { return ${elementNullOrUndefinedPrefix}${deserializeFunctionName}(${varName})})`;
2772
- } else if (
2773
- type.valueType &&
2774
- isAzureCoreErrorType(context.program, type.valueType.__raw)
2775
- ) {
2467
+ } else if (type.valueType && isAzureCoreErrorType(context.program, type.valueType.__raw)) {
2776
2468
  return `${prefix}.map((${varName}: any) => { return ${elementNullOrUndefinedPrefix}${varName}})`;
2777
2469
  } else if (type.valueType) {
2778
2470
  if (format) {
@@ -2783,10 +2475,7 @@ export function deserializeResponseValue(
2783
2475
  isTypeNullable(type) || getOptionalForType(type) || !required
2784
2476
  ? `${restValue} === null || ${restValue} === undefined ? ${restValue}: `
2785
2477
  : "";
2786
- if (
2787
- type.valueType.kind === "enum" &&
2788
- !isExtensibleEnum(context, type.valueType)
2789
- ) {
2478
+ if (type.valueType.kind === "enum" && !isExtensibleEnum(context, type.valueType)) {
2790
2479
  // Special handling for non-extensible enums to cast the result to the correct type
2791
2480
  return `${optionalPrefixForString}${parseHelper}(${restValue}) as ${getTypeExpression(context, type)}`;
2792
2481
  } else {
@@ -2810,21 +2499,14 @@ export function deserializeResponseValue(
2810
2499
  elementNullOrUndefinedPrefix = `!${valueVar} ? ${valueVar} :`;
2811
2500
  }
2812
2501
  const deserializeFunctionName = type.valueType
2813
- ? buildModelDeserializer(
2814
- context,
2815
- getNullableValidType(type.valueType),
2816
- {
2817
- nameOnly: true,
2818
- skipDiscriminatedUnionSuffix: false
2819
- }
2820
- )
2502
+ ? buildModelDeserializer(context, getNullableValidType(type.valueType), {
2503
+ nameOnly: true,
2504
+ skipDiscriminatedUnionSuffix: false,
2505
+ })
2821
2506
  : undefined;
2822
2507
  if (deserializeFunctionName) {
2823
2508
  return `${nullOrUndefinedPrefix}Object.fromEntries(Object.entries(${restValue}).map(([${keyVar}, ${valueVar}]: [string, any]) => [${keyVar}, ${elementNullOrUndefinedPrefix}${deserializeFunctionName}(${valueVar})]))`;
2824
- } else if (
2825
- type.valueType &&
2826
- isAzureCoreErrorType(context.program, type.valueType.__raw)
2827
- ) {
2509
+ } else if (type.valueType && isAzureCoreErrorType(context.program, type.valueType.__raw)) {
2828
2510
  return `${nullOrUndefinedPrefix}Object.fromEntries(Object.entries(${restValue}).map(([${keyVar}, ${valueVar}]: [string, any]) => [${keyVar}, ${elementNullOrUndefinedPrefix}${valueVar}]))`;
2829
2511
  } else if (type.valueType) {
2830
2512
  return `${nullOrUndefinedPrefix}Object.fromEntries(Object.entries(${restValue}).map(([${keyVar}, ${valueVar}]: [string, any]) => [${keyVar}, ${elementNullOrUndefinedPrefix}${deserializeResponseValue(context, type.valueType, valueVar, true, getEncodeForType(type.valueType), recursionDepth + 1)}]))`;
@@ -2846,7 +2528,7 @@ export function deserializeResponseValue(
2846
2528
  const deserializeFunctionName = type
2847
2529
  ? buildModelDeserializer(context, getNullableValidType(type), {
2848
2530
  nameOnly: true,
2849
- skipDiscriminatedUnionSuffix: false
2531
+ skipDiscriminatedUnionSuffix: false,
2850
2532
  })
2851
2533
  : undefined;
2852
2534
  if (deserializeFunctionName) {
@@ -2866,7 +2548,7 @@ export function deserializeResponseValue(
2866
2548
  restValue,
2867
2549
  false,
2868
2550
  getEncodeForType(type.type),
2869
- recursionDepth + 1
2551
+ recursionDepth + 1,
2870
2552
  );
2871
2553
  default:
2872
2554
  return restValue;
@@ -2874,19 +2556,19 @@ export function deserializeResponseValue(
2874
2556
  }
2875
2557
 
2876
2558
  export function isLroAndPagingOperation(
2877
- op: SdkMethod<SdkHttpOperation>
2559
+ op: SdkMethod<SdkHttpOperation>,
2878
2560
  ): op is SdkLroPagingServiceMethod<SdkHttpOperation> {
2879
2561
  return op.kind === "lropaging";
2880
2562
  }
2881
2563
 
2882
2564
  export function isLroOnlyOperation(
2883
- op: SdkMethod<SdkHttpOperation>
2565
+ op: SdkMethod<SdkHttpOperation>,
2884
2566
  ): op is SdkLroServiceMethod<SdkHttpOperation> {
2885
2567
  return op.kind === "lro";
2886
2568
  }
2887
2569
 
2888
2570
  export function isPagingOnlyOperation(
2889
- op: SdkMethod<SdkHttpOperation>
2571
+ op: SdkMethod<SdkHttpOperation>,
2890
2572
  ): op is SdkPagingServiceMethod<SdkHttpOperation> {
2891
2573
  return op.kind === "paging";
2892
2574
  }
@@ -2894,7 +2576,7 @@ export function isPagingOnlyOperation(
2894
2576
  export function getAllProperties(
2895
2577
  context: SdkContext,
2896
2578
  type: SdkType,
2897
- parents?: SdkType[]
2579
+ parents?: SdkType[],
2898
2580
  ): SdkModelPropertyType[] {
2899
2581
  const propertiesMap: Map<string, SdkModelPropertyType> = new Map();
2900
2582
  if (!type) {
@@ -2933,7 +2615,7 @@ export function getAllAncestors(type: SdkType): SdkType[] {
2933
2615
  * safely into generated code.
2934
2616
  */
2935
2617
  function hasEffectiveClientDefaultValue(
2936
- param: SdkHttpParameter | SdkBodyParameter | SdkModelPropertyType
2618
+ param: SdkHttpParameter | SdkBodyParameter | SdkModelPropertyType,
2937
2619
  ): boolean {
2938
2620
  return (
2939
2621
  param.clientDefaultValue !== undefined &&
@@ -2947,7 +2629,7 @@ function hasEffectiveClientDefaultValue(
2947
2629
  */
2948
2630
  function isDefaultValueTypeMatch(
2949
2631
  param: SdkHttpParameter | SdkBodyParameter | SdkModelPropertyType,
2950
- defaultValue: unknown
2632
+ defaultValue: unknown,
2951
2633
  ): boolean {
2952
2634
  const defaultType = typeof defaultValue;
2953
2635
  const paramType = param.type;
@@ -2990,7 +2672,7 @@ function formatDefaultValue(defaultValue: unknown): string {
2990
2672
  export function getPropertySerializationPrefix(
2991
2673
  context: SdkContext,
2992
2674
  property: SdkHttpParameter | SdkModelPropertyType,
2993
- propertyPath?: string
2675
+ propertyPath?: string,
2994
2676
  ) {
2995
2677
  const propertyFullName = getPropertyFullName(context, property, propertyPath);
2996
2678
 
@@ -3004,14 +2686,12 @@ export function getPropertySerializationPrefix(
3004
2686
  export function getPropertyFullName(
3005
2687
  context: SdkContext,
3006
2688
  property: SdkHttpParameter | SdkModelPropertyType,
3007
- propertyPath?: string
2689
+ propertyPath?: string,
3008
2690
  ) {
3009
2691
  const normalizedPropertyName =
3010
2692
  propertyPath === ""
3011
2693
  ? normalizeName(property.name, NameType.Parameter, true)
3012
- : normalizeModelPropertyName(context, property)
3013
- .replace(/^"/g, "")
3014
- .replace(/"$/g, "");
2694
+ : normalizeModelPropertyName(context, property).replace(/^"/g, "").replace(/"$/g, "");
3015
2695
 
3016
2696
  let fullName = normalizedPropertyName;
3017
2697
  if (propertyPath === "" && property.optional) {
@@ -3061,10 +2741,10 @@ export function getExpectedStatuses(operation: ServiceOperation): string {
3061
2741
  */
3062
2742
  function getApiVersionExpression(
3063
2743
  dpgContext: SdkContext,
3064
- operation: ServiceOperation
2744
+ operation: ServiceOperation,
3065
2745
  ): string | undefined {
3066
2746
  const queryApiVersionParam = operation.operation.parameters.find(
3067
- (p) => p.kind === "query" && p.isApiVersionParam
2747
+ (p) => p.kind === "query" && p.isApiVersionParam,
3068
2748
  );
3069
2749
  if (!queryApiVersionParam) {
3070
2750
  return undefined;
@@ -3088,7 +2768,7 @@ function getApiVersionExpression(
3088
2768
  * @returns Array of unique response headers
3089
2769
  */
3090
2770
  export function getResponseHeaders(
3091
- responses: SdkHttpOperation["responses"]
2771
+ responses: SdkHttpOperation["responses"],
3092
2772
  ): SdkServiceResponseHeader[] {
3093
2773
  const headerMap = new Map<string, SdkServiceResponseHeader>();
3094
2774
  for (const response of responses ?? []) {
@@ -3114,23 +2794,24 @@ export function getResponseHeaders(
3114
2794
  function buildCompositeResponseType(
3115
2795
  context: SdkContext,
3116
2796
  modelType: SdkModelType,
3117
- headers: SdkServiceResponseHeader[]
2797
+ headers: SdkServiceResponseHeader[],
3118
2798
  ): string {
3119
2799
  const allParents = getAllAncestors(modelType);
3120
- const modelProps: (SdkModelPropertyType | SdkServiceResponseHeader)[] =
3121
- getAllProperties(context, modelType, allParents).filter((property) => {
3122
- // Skip model properties that are headers with headerCollectionPrefix
3123
- if (
3124
- property.__raw &&
3125
- isHeader(context.program, property.__raw) &&
3126
- shouldSkipHeaderSerialization(
3127
- property as SdkModelPropertyType & SdkServiceResponseHeader
3128
- )
3129
- ) {
3130
- return false;
3131
- }
3132
- return true;
3133
- });
2800
+ const modelProps: (SdkModelPropertyType | SdkServiceResponseHeader)[] = getAllProperties(
2801
+ context,
2802
+ modelType,
2803
+ allParents,
2804
+ ).filter((property) => {
2805
+ // Skip model properties that are headers with headerCollectionPrefix
2806
+ if (
2807
+ property.__raw &&
2808
+ isHeader(context.program, property.__raw) &&
2809
+ shouldSkipHeaderSerialization(property as SdkModelPropertyType & SdkServiceResponseHeader)
2810
+ ) {
2811
+ return false;
2812
+ }
2813
+ return true;
2814
+ });
3134
2815
 
3135
2816
  // Collect header property names already in the model to avoid duplicates
3136
2817
  const modelHeaderNames = new Set<string>();
@@ -3159,7 +2840,7 @@ function buildCompositeResponseType(
3159
2840
  */
3160
2841
  function buildHeaderOnlyResponseType(
3161
2842
  context: SdkContext,
3162
- headers: SdkServiceResponseHeader[]
2843
+ headers: SdkServiceResponseHeader[],
3163
2844
  ): string {
3164
2845
  const properties: string[] = [];
3165
2846
 
@@ -3182,7 +2863,7 @@ function buildHeaderOnlyResponseType(
3182
2863
  */
3183
2864
  function buildHeaderOnlyResponseValue(
3184
2865
  context: SdkContext,
3185
- headers: SdkServiceResponseHeader[]
2866
+ headers: SdkServiceResponseHeader[],
3186
2867
  ): string {
3187
2868
  const props = headers.map((header) => {
3188
2869
  const headerName = (header.serializedName ?? header.name).toLowerCase();
@@ -3193,7 +2874,7 @@ function buildHeaderOnlyResponseValue(
3193
2874
  `result.headers[${JSON.stringify(headerName)}]`,
3194
2875
  !header.optional,
3195
2876
  getEncodeForType(header.type),
3196
- 0
2877
+ 0,
3197
2878
  );
3198
2879
 
3199
2880
  return `${key}: ${value}`;
@@ -3207,9 +2888,7 @@ function buildHeaderOnlyResponseValue(
3207
2888
  * The name follows the pattern: {OperationGroupName}{MethodName}Response
3208
2889
  * @param method - The method tuple [prefixes, operation]
3209
2890
  */
3210
- export function getOperationResponseTypeName(
3211
- method: [string[], ServiceOperation]
3212
- ): string {
2891
+ export function getOperationResponseTypeName(method: [string[], ServiceOperation]): string {
3213
2892
  const prefixes = method[0];
3214
2893
  const operation = method[1];
3215
2894
  const prefix = !operation.name.includes("_")
@@ -3239,8 +2918,7 @@ export function getOperationResponseTypeName(
3239
2918
  function isWrappableType(context: SdkContext, type: SdkType): boolean {
3240
2919
  if (type.kind === "array" && type.valueType.kind === "model") return false;
3241
2920
  if (type.kind === "dict" || type.kind === "model") return false;
3242
- if (type.kind === "unknown" && context.rlcOptions?.treatUnknownAsRecord)
3243
- return false;
2921
+ if (type.kind === "unknown" && context.rlcOptions?.treatUnknownAsRecord) return false;
3244
2922
  return true;
3245
2923
  }
3246
2924
 
@@ -3264,7 +2942,7 @@ function isHeadAsBooleanOperation(operation: ServiceOperation): boolean {
3264
2942
  */
3265
2943
  export function checkWrapNonModelReturn(
3266
2944
  context: SdkContext,
3267
- operation: ServiceOperation
2945
+ operation: ServiceOperation,
3268
2946
  ): { shouldWrap: boolean; isBinary: boolean } {
3269
2947
  const noWrap = { shouldWrap: false, isBinary: false };
3270
2948
 
@@ -3286,7 +2964,7 @@ export function checkWrapNonModelReturn(
3286
2964
  }
3287
2965
  return {
3288
2966
  shouldWrap: isWrappableType(context, lroResultType),
3289
- isBinary: false
2967
+ isBinary: false,
3290
2968
  };
3291
2969
  }
3292
2970
 
@@ -3303,10 +2981,7 @@ export function checkWrapNonModelReturn(
3303
2981
 
3304
2982
  // bytes with binary content type → binary wrap (isBinary=true)
3305
2983
  // HLC: bytes → binary payload → separate binary handling
3306
- if (
3307
- type.__raw &&
3308
- isBinaryPayload(context, type.__raw, contentTypes, getEncodeForType(type))
3309
- ) {
2984
+ if (type.__raw && isBinaryPayload(context, type.__raw, contentTypes, getEncodeForType(type))) {
3310
2985
  return { shouldWrap: true, isBinary: true };
3311
2986
  }
3312
2987
 
@@ -3321,16 +2996,14 @@ export function checkWrapNonModelReturn(
3321
2996
  export function buildNonModelResponseTypeDeclaration(
3322
2997
  context: SdkContext,
3323
2998
  method: [string[], ServiceOperation],
3324
- isBinary: boolean
2999
+ isBinary: boolean,
3325
3000
  ): TypeAliasDeclarationStructure {
3326
3001
  const typeName = getOperationResponseTypeName(method);
3327
3002
  const operation = method[1];
3328
3003
  let typeBody: string;
3329
3004
 
3330
3005
  if (isBinary) {
3331
- const nodeReadableStreamRef = resolveReference(
3332
- PlatformTypeHelpers.NodeReadableStream
3333
- );
3006
+ const nodeReadableStreamRef = resolveReference(PlatformTypeHelpers.NodeReadableStream);
3334
3007
  typeBody = `{
3335
3008
  /**
3336
3009
  * BROWSER ONLY
@@ -3357,6 +3030,6 @@ export function buildNonModelResponseTypeDeclaration(
3357
3030
  name: typeName,
3358
3031
  type: typeBody,
3359
3032
  isExported: true,
3360
- leadingTrivia: "\n"
3033
+ leadingTrivia: "\n",
3361
3034
  };
3362
3035
  }