@azure-tools/typespec-ts 0.54.0 → 0.55.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (522) hide show
  1. package/CHANGELOG.md +25 -10
  2. package/README.md +0 -4
  3. package/dist/src/contextManager.d.ts +5 -5
  4. package/dist/src/contextManager.d.ts.map +1 -1
  5. package/dist/src/contextManager.js +3 -3
  6. package/dist/src/contextManager.js.map +1 -1
  7. package/dist/src/framework/declaration.d.ts +1 -1
  8. package/dist/src/framework/declaration.d.ts.map +1 -1
  9. package/dist/src/framework/declaration.js +2 -4
  10. package/dist/src/framework/declaration.js.map +1 -1
  11. package/dist/src/framework/dependency.d.ts.map +1 -1
  12. package/dist/src/framework/hooks/binder.d.ts +1 -1
  13. package/dist/src/framework/hooks/binder.d.ts.map +1 -1
  14. package/dist/src/framework/hooks/binder.js +31 -40
  15. package/dist/src/framework/hooks/binder.js.map +1 -1
  16. package/dist/src/framework/hooks/sdkTypes.d.ts +1 -1
  17. package/dist/src/framework/hooks/sdkTypes.d.ts.map +1 -1
  18. package/dist/src/framework/hooks/sdkTypes.js +8 -12
  19. package/dist/src/framework/hooks/sdkTypes.js.map +1 -1
  20. package/dist/src/framework/hooks/useDependencies.d.ts.map +1 -1
  21. package/dist/src/framework/hooks/useDependencies.js +1 -1
  22. package/dist/src/framework/hooks/useDependencies.js.map +1 -1
  23. package/dist/src/framework/load-static-helpers.d.ts +1 -1
  24. package/dist/src/framework/load-static-helpers.d.ts.map +1 -1
  25. package/dist/src/framework/load-static-helpers.js +17 -31
  26. package/dist/src/framework/load-static-helpers.js.map +1 -1
  27. package/dist/src/framework/reference.d.ts.map +1 -1
  28. package/dist/src/framework/reference.js +2 -2
  29. package/dist/src/framework/reference.js.map +1 -1
  30. package/dist/src/framework/sample.js +8 -8
  31. package/dist/src/framework/sample.js.map +1 -1
  32. package/dist/src/index.d.ts +1 -1
  33. package/dist/src/index.d.ts.map +1 -1
  34. package/dist/src/index.js +103 -92
  35. package/dist/src/index.js.map +1 -1
  36. package/dist/src/lib.d.ts +1 -1
  37. package/dist/src/lib.d.ts.map +1 -1
  38. package/dist/src/lib.js +140 -140
  39. package/dist/src/lib.js.map +1 -1
  40. package/dist/src/metaTree.d.ts +1 -1
  41. package/dist/src/metaTree.d.ts.map +1 -1
  42. package/dist/src/modular/buildClassicalClient.d.ts +1 -1
  43. package/dist/src/modular/buildClassicalClient.d.ts.map +1 -1
  44. package/dist/src/modular/buildClassicalClient.js +60 -74
  45. package/dist/src/modular/buildClassicalClient.js.map +1 -1
  46. package/dist/src/modular/buildClassicalOperationGroups.d.ts +2 -2
  47. package/dist/src/modular/buildClassicalOperationGroups.d.ts.map +1 -1
  48. package/dist/src/modular/buildClassicalOperationGroups.js +8 -10
  49. package/dist/src/modular/buildClassicalOperationGroups.js.map +1 -1
  50. package/dist/src/modular/buildClientContext.d.ts +2 -2
  51. package/dist/src/modular/buildClientContext.d.ts.map +1 -1
  52. package/dist/src/modular/buildClientContext.js +31 -38
  53. package/dist/src/modular/buildClientContext.js.map +1 -1
  54. package/dist/src/modular/buildModularOptions.d.ts +1 -1
  55. package/dist/src/modular/buildModularOptions.d.ts.map +1 -1
  56. package/dist/src/modular/buildModularOptions.js +5 -6
  57. package/dist/src/modular/buildModularOptions.js.map +1 -1
  58. package/dist/src/modular/buildOperations.d.ts +3 -3
  59. package/dist/src/modular/buildOperations.d.ts.map +1 -1
  60. package/dist/src/modular/buildOperations.js +23 -25
  61. package/dist/src/modular/buildOperations.js.map +1 -1
  62. package/dist/src/modular/buildProjectFiles.d.ts +1 -1
  63. package/dist/src/modular/buildProjectFiles.d.ts.map +1 -1
  64. package/dist/src/modular/buildProjectFiles.js +8 -11
  65. package/dist/src/modular/buildProjectFiles.js.map +1 -1
  66. package/dist/src/modular/buildRestorePoller.d.ts +1 -1
  67. package/dist/src/modular/buildRestorePoller.d.ts.map +1 -1
  68. package/dist/src/modular/buildRestorePoller.js +12 -13
  69. package/dist/src/modular/buildRestorePoller.js.map +1 -1
  70. package/dist/src/modular/buildRootIndex.d.ts +2 -2
  71. package/dist/src/modular/buildRootIndex.d.ts.map +1 -1
  72. package/dist/src/modular/buildRootIndex.js +36 -50
  73. package/dist/src/modular/buildRootIndex.js.map +1 -1
  74. package/dist/src/modular/buildSubpathIndex.d.ts.map +1 -1
  75. package/dist/src/modular/buildSubpathIndex.js +9 -18
  76. package/dist/src/modular/buildSubpathIndex.js.map +1 -1
  77. package/dist/src/modular/emitLoggerFile.d.ts.map +1 -1
  78. package/dist/src/modular/emitLoggerFile.js +4 -4
  79. package/dist/src/modular/emitLoggerFile.js.map +1 -1
  80. package/dist/src/modular/emitModels.d.ts +1 -1
  81. package/dist/src/modular/emitModels.d.ts.map +1 -1
  82. package/dist/src/modular/emitModels.js +81 -113
  83. package/dist/src/modular/emitModels.js.map +1 -1
  84. package/dist/src/modular/emitModelsOptions.d.ts +1 -1
  85. package/dist/src/modular/emitModelsOptions.d.ts.map +1 -1
  86. package/dist/src/modular/emitModelsOptions.js +7 -8
  87. package/dist/src/modular/emitModelsOptions.js.map +1 -1
  88. package/dist/src/modular/emitSamples.d.ts.map +1 -1
  89. package/dist/src/modular/emitSamples.js +69 -77
  90. package/dist/src/modular/emitSamples.js.map +1 -1
  91. package/dist/src/modular/emitTests.d.ts.map +1 -1
  92. package/dist/src/modular/emitTests.js +13 -18
  93. package/dist/src/modular/emitTests.js.map +1 -1
  94. package/dist/src/modular/external-dependencies.js +54 -54
  95. package/dist/src/modular/helpers/classicalOperationHelpers.d.ts +1 -1
  96. package/dist/src/modular/helpers/classicalOperationHelpers.d.ts.map +1 -1
  97. package/dist/src/modular/helpers/classicalOperationHelpers.js +59 -68
  98. package/dist/src/modular/helpers/classicalOperationHelpers.js.map +1 -1
  99. package/dist/src/modular/helpers/clientHelpers.d.ts +2 -2
  100. package/dist/src/modular/helpers/clientHelpers.d.ts.map +1 -1
  101. package/dist/src/modular/helpers/clientHelpers.js +31 -54
  102. package/dist/src/modular/helpers/clientHelpers.js.map +1 -1
  103. package/dist/src/modular/helpers/clientOptionHelpers.d.ts.map +1 -1
  104. package/dist/src/modular/helpers/clientOptionHelpers.js +1 -1
  105. package/dist/src/modular/helpers/clientOptionHelpers.js.map +1 -1
  106. package/dist/src/modular/helpers/exampleValueHelpers.d.ts +2 -2
  107. package/dist/src/modular/helpers/exampleValueHelpers.d.ts.map +1 -1
  108. package/dist/src/modular/helpers/exampleValueHelpers.js +72 -84
  109. package/dist/src/modular/helpers/exampleValueHelpers.js.map +1 -1
  110. package/dist/src/modular/helpers/namingHelpers.d.ts +1 -1
  111. package/dist/src/modular/helpers/namingHelpers.d.ts.map +1 -1
  112. package/dist/src/modular/helpers/namingHelpers.js +7 -10
  113. package/dist/src/modular/helpers/namingHelpers.js.map +1 -1
  114. package/dist/src/modular/helpers/operationHelpers.d.ts +2 -2
  115. package/dist/src/modular/helpers/operationHelpers.d.ts.map +1 -1
  116. package/dist/src/modular/helpers/operationHelpers.js +204 -288
  117. package/dist/src/modular/helpers/operationHelpers.js.map +1 -1
  118. package/dist/src/modular/helpers/typeHelpers.d.ts +1 -1
  119. package/dist/src/modular/helpers/typeHelpers.d.ts.map +1 -1
  120. package/dist/src/modular/helpers/typeHelpers.js +4 -6
  121. package/dist/src/modular/helpers/typeHelpers.js.map +1 -1
  122. package/dist/src/modular/serialization/buildDeserializerFunction.d.ts +1 -1
  123. package/dist/src/modular/serialization/buildDeserializerFunction.d.ts.map +1 -1
  124. package/dist/src/modular/serialization/buildDeserializerFunction.js +58 -67
  125. package/dist/src/modular/serialization/buildDeserializerFunction.js.map +1 -1
  126. package/dist/src/modular/serialization/buildSerializerFunction.d.ts +1 -1
  127. package/dist/src/modular/serialization/buildSerializerFunction.d.ts.map +1 -1
  128. package/dist/src/modular/serialization/buildSerializerFunction.js +65 -75
  129. package/dist/src/modular/serialization/buildSerializerFunction.js.map +1 -1
  130. package/dist/src/modular/serialization/buildXmlSerializerFunction.d.ts +1 -1
  131. package/dist/src/modular/serialization/buildXmlSerializerFunction.d.ts.map +1 -1
  132. package/dist/src/modular/serialization/buildXmlSerializerFunction.js +73 -90
  133. package/dist/src/modular/serialization/buildXmlSerializerFunction.js.map +1 -1
  134. package/dist/src/modular/serialization/serializeUtils.d.ts.map +1 -1
  135. package/dist/src/modular/serialization/serializeUtils.js +25 -33
  136. package/dist/src/modular/serialization/serializeUtils.js.map +1 -1
  137. package/dist/src/modular/static-helpers-metadata.js +60 -60
  138. package/dist/src/modular/type-expressions/get-credential-expression.js +1 -1
  139. package/dist/src/modular/type-expressions/get-credential-expression.js.map +1 -1
  140. package/dist/src/modular/type-expressions/get-enum-expression.d.ts +1 -1
  141. package/dist/src/modular/type-expressions/get-enum-expression.d.ts.map +1 -1
  142. package/dist/src/modular/type-expressions/get-enum-expression.js +1 -2
  143. package/dist/src/modular/type-expressions/get-enum-expression.js.map +1 -1
  144. package/dist/src/modular/type-expressions/get-model-expression.d.ts.map +1 -1
  145. package/dist/src/modular/type-expressions/get-model-expression.js +10 -13
  146. package/dist/src/modular/type-expressions/get-model-expression.js.map +1 -1
  147. package/dist/src/modular/type-expressions/get-nullable-expression.d.ts +1 -1
  148. package/dist/src/modular/type-expressions/get-nullable-expression.d.ts.map +1 -1
  149. package/dist/src/modular/type-expressions/get-nullable-expression.js +2 -3
  150. package/dist/src/modular/type-expressions/get-nullable-expression.js.map +1 -1
  151. package/dist/src/modular/type-expressions/get-type-expression.d.ts.map +1 -1
  152. package/dist/src/modular/type-expressions/get-type-expression.js +5 -11
  153. package/dist/src/modular/type-expressions/get-type-expression.js.map +1 -1
  154. package/dist/src/modular/type-expressions/get-union-expression.d.ts +1 -1
  155. package/dist/src/modular/type-expressions/get-union-expression.d.ts.map +1 -1
  156. package/dist/src/modular/type-expressions/get-union-expression.js.map +1 -1
  157. package/dist/src/rlc-common/buildClient.d.ts +1 -1
  158. package/dist/src/rlc-common/buildClient.d.ts.map +1 -1
  159. package/dist/src/rlc-common/buildClient.js +67 -89
  160. package/dist/src/rlc-common/buildClient.js.map +1 -1
  161. package/dist/src/rlc-common/buildClientDefinitions.d.ts.map +1 -1
  162. package/dist/src/rlc-common/buildClientDefinitions.js +28 -45
  163. package/dist/src/rlc-common/buildClientDefinitions.js.map +1 -1
  164. package/dist/src/rlc-common/buildIndexFile.d.ts.map +1 -1
  165. package/dist/src/rlc-common/buildIndexFile.js +59 -60
  166. package/dist/src/rlc-common/buildIndexFile.js.map +1 -1
  167. package/dist/src/rlc-common/buildIsUnexpectedHelper.d.ts.map +1 -1
  168. package/dist/src/rlc-common/buildIsUnexpectedHelper.js +37 -38
  169. package/dist/src/rlc-common/buildIsUnexpectedHelper.js.map +1 -1
  170. package/dist/src/rlc-common/buildLogger.d.ts.map +1 -1
  171. package/dist/src/rlc-common/buildLogger.js +4 -5
  172. package/dist/src/rlc-common/buildLogger.js.map +1 -1
  173. package/dist/src/rlc-common/buildMethodShortcuts.d.ts.map +1 -1
  174. package/dist/src/rlc-common/buildMethodShortcuts.js +4 -4
  175. package/dist/src/rlc-common/buildMethodShortcuts.js.map +1 -1
  176. package/dist/src/rlc-common/buildObjectTypes.d.ts.map +1 -1
  177. package/dist/src/rlc-common/buildObjectTypes.js +57 -96
  178. package/dist/src/rlc-common/buildObjectTypes.js.map +1 -1
  179. package/dist/src/rlc-common/buildPaginateHelper.d.ts.map +1 -1
  180. package/dist/src/rlc-common/buildPaginateHelper.js +2 -2
  181. package/dist/src/rlc-common/buildPaginateHelper.js.map +1 -1
  182. package/dist/src/rlc-common/buildParameterTypes.d.ts.map +1 -1
  183. package/dist/src/rlc-common/buildParameterTypes.js +71 -61
  184. package/dist/src/rlc-common/buildParameterTypes.js.map +1 -1
  185. package/dist/src/rlc-common/buildPollingHelper.d.ts.map +1 -1
  186. package/dist/src/rlc-common/buildPollingHelper.js +9 -10
  187. package/dist/src/rlc-common/buildPollingHelper.js.map +1 -1
  188. package/dist/src/rlc-common/buildResponseTypes.d.ts.map +1 -1
  189. package/dist/src/rlc-common/buildResponseTypes.js +23 -27
  190. package/dist/src/rlc-common/buildResponseTypes.js.map +1 -1
  191. package/dist/src/rlc-common/buildSamples.d.ts +1 -1
  192. package/dist/src/rlc-common/buildSamples.d.ts.map +1 -1
  193. package/dist/src/rlc-common/buildSamples.js +2 -2
  194. package/dist/src/rlc-common/buildSchemaType.d.ts.map +1 -1
  195. package/dist/src/rlc-common/buildSchemaType.js +31 -13
  196. package/dist/src/rlc-common/buildSchemaType.js.map +1 -1
  197. package/dist/src/rlc-common/buildSerializeHelper.d.ts.map +1 -1
  198. package/dist/src/rlc-common/buildSerializeHelper.js +4 -4
  199. package/dist/src/rlc-common/buildSerializeHelper.js.map +1 -1
  200. package/dist/src/rlc-common/buildTopLevelIndexFile.d.ts.map +1 -1
  201. package/dist/src/rlc-common/buildTopLevelIndexFile.js +9 -13
  202. package/dist/src/rlc-common/buildTopLevelIndexFile.js.map +1 -1
  203. package/dist/src/rlc-common/helpers/apiVersionUtil.d.ts.map +1 -1
  204. package/dist/src/rlc-common/helpers/apiVersionUtil.js +6 -8
  205. package/dist/src/rlc-common/helpers/apiVersionUtil.js.map +1 -1
  206. package/dist/src/rlc-common/helpers/importsUtil.d.ts.map +1 -1
  207. package/dist/src/rlc-common/helpers/importsUtil.js +32 -37
  208. package/dist/src/rlc-common/helpers/importsUtil.js.map +1 -1
  209. package/dist/src/rlc-common/helpers/nameConstructors.d.ts.map +1 -1
  210. package/dist/src/rlc-common/helpers/nameConstructors.js +2 -4
  211. package/dist/src/rlc-common/helpers/nameConstructors.js.map +1 -1
  212. package/dist/src/rlc-common/helpers/nameUtils.d.ts.map +1 -1
  213. package/dist/src/rlc-common/helpers/nameUtils.js +17 -23
  214. package/dist/src/rlc-common/helpers/nameUtils.js.map +1 -1
  215. package/dist/src/rlc-common/helpers/operationHelpers.d.ts.map +1 -1
  216. package/dist/src/rlc-common/helpers/operationHelpers.js +16 -31
  217. package/dist/src/rlc-common/helpers/operationHelpers.js.map +1 -1
  218. package/dist/src/rlc-common/helpers/packageUtil.js +3 -6
  219. package/dist/src/rlc-common/helpers/packageUtil.js.map +1 -1
  220. package/dist/src/rlc-common/helpers/pathUtils.d.ts.map +1 -1
  221. package/dist/src/rlc-common/helpers/pathUtils.js +1 -3
  222. package/dist/src/rlc-common/helpers/pathUtils.js.map +1 -1
  223. package/dist/src/rlc-common/helpers/schemaHelpers.d.ts.map +1 -1
  224. package/dist/src/rlc-common/helpers/schemaHelpers.js +3 -7
  225. package/dist/src/rlc-common/helpers/schemaHelpers.js.map +1 -1
  226. package/dist/src/rlc-common/helpers/shortcutMethods.d.ts +1 -1
  227. package/dist/src/rlc-common/helpers/shortcutMethods.d.ts.map +1 -1
  228. package/dist/src/rlc-common/helpers/shortcutMethods.js +2 -2
  229. package/dist/src/rlc-common/helpers/shortcutMethods.js.map +1 -1
  230. package/dist/src/rlc-common/helpers/typeUtil.d.ts.map +1 -1
  231. package/dist/src/rlc-common/helpers/typeUtil.js +4 -9
  232. package/dist/src/rlc-common/helpers/typeUtil.js.map +1 -1
  233. package/dist/src/rlc-common/helpers/valueGenerationUtil.js +7 -11
  234. package/dist/src/rlc-common/helpers/valueGenerationUtil.js.map +1 -1
  235. package/dist/src/rlc-common/index.d.ts +28 -28
  236. package/dist/src/rlc-common/index.d.ts.map +1 -1
  237. package/dist/src/rlc-common/index.js +28 -28
  238. package/dist/src/rlc-common/index.js.map +1 -1
  239. package/dist/src/rlc-common/interfaces.d.ts.map +1 -1
  240. package/dist/src/rlc-common/interfaces.js.map +1 -1
  241. package/dist/src/rlc-common/metadata/buildApiExtractorConfig.d.ts.map +1 -1
  242. package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js +14 -15
  243. package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js.map +1 -1
  244. package/dist/src/rlc-common/metadata/buildChangelogFile.js +2 -3
  245. package/dist/src/rlc-common/metadata/buildChangelogFile.js.map +1 -1
  246. package/dist/src/rlc-common/metadata/buildESLintConfig.d.ts.map +1 -1
  247. package/dist/src/rlc-common/metadata/buildESLintConfig.js +5 -8
  248. package/dist/src/rlc-common/metadata/buildESLintConfig.js.map +1 -1
  249. package/dist/src/rlc-common/metadata/buildLicenseFile.js +1 -1
  250. package/dist/src/rlc-common/metadata/buildPackageFile.d.ts.map +1 -1
  251. package/dist/src/rlc-common/metadata/buildPackageFile.js +33 -37
  252. package/dist/src/rlc-common/metadata/buildPackageFile.js.map +1 -1
  253. package/dist/src/rlc-common/metadata/buildReadmeFile.d.ts.map +1 -1
  254. package/dist/src/rlc-common/metadata/buildReadmeFile.js +31 -39
  255. package/dist/src/rlc-common/metadata/buildReadmeFile.js.map +1 -1
  256. package/dist/src/rlc-common/metadata/buildRollupConfig.d.ts.map +1 -1
  257. package/dist/src/rlc-common/metadata/buildRollupConfig.js +4 -6
  258. package/dist/src/rlc-common/metadata/buildRollupConfig.js.map +1 -1
  259. package/dist/src/rlc-common/metadata/buildSampleEnvFile.d.ts.map +1 -1
  260. package/dist/src/rlc-common/metadata/buildSampleEnvFile.js +3 -5
  261. package/dist/src/rlc-common/metadata/buildSampleEnvFile.js.map +1 -1
  262. package/dist/src/rlc-common/metadata/buildTestConfig.js +11 -12
  263. package/dist/src/rlc-common/metadata/buildTestConfig.js.map +1 -1
  264. package/dist/src/rlc-common/metadata/buildTsConfig.d.ts.map +1 -1
  265. package/dist/src/rlc-common/metadata/buildTsConfig.js +28 -28
  266. package/dist/src/rlc-common/metadata/buildTsConfig.js.map +1 -1
  267. package/dist/src/rlc-common/metadata/buildVitestConfig.d.ts.map +1 -1
  268. package/dist/src/rlc-common/metadata/buildVitestConfig.js +3 -5
  269. package/dist/src/rlc-common/metadata/buildVitestConfig.js.map +1 -1
  270. package/dist/src/rlc-common/metadata/buildWarpConfig.d.ts.map +1 -1
  271. package/dist/src/rlc-common/metadata/buildWarpConfig.js +4 -5
  272. package/dist/src/rlc-common/metadata/buildWarpConfig.js.map +1 -1
  273. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts +1 -1
  274. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts.map +1 -1
  275. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js +14 -14
  276. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js.map +1 -1
  277. package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.d.ts.map +1 -1
  278. package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js +24 -29
  279. package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js.map +1 -1
  280. package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.d.ts.map +1 -1
  281. package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js +15 -16
  282. package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js.map +1 -1
  283. package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js +8 -8
  284. package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js.map +1 -1
  285. package/dist/src/rlc-common/metadata/packageJson/packageCommon.d.ts.map +1 -1
  286. package/dist/src/rlc-common/metadata/packageJson/packageCommon.js +28 -31
  287. package/dist/src/rlc-common/metadata/packageJson/packageCommon.js.map +1 -1
  288. package/dist/src/rlc-common/metadata/utils.js +1 -2
  289. package/dist/src/rlc-common/metadata/utils.js.map +1 -1
  290. package/dist/src/rlc-common/test/buildKarmaConfig.js +1 -1
  291. package/dist/src/rlc-common/test/buildRecordedClient.js +4 -5
  292. package/dist/src/rlc-common/test/buildRecordedClient.js.map +1 -1
  293. package/dist/src/rlc-common/test/buildSampleTest.d.ts.map +1 -1
  294. package/dist/src/rlc-common/test/buildSampleTest.js +3 -4
  295. package/dist/src/rlc-common/test/buildSampleTest.js.map +1 -1
  296. package/dist/src/rlc-common/test/buildSnippets.d.ts.map +1 -1
  297. package/dist/src/rlc-common/test/buildSnippets.js +7 -10
  298. package/dist/src/rlc-common/test/buildSnippets.js.map +1 -1
  299. package/dist/src/rlc-common/transformSampleGroups.d.ts.map +1 -1
  300. package/dist/src/rlc-common/transformSampleGroups.js +41 -45
  301. package/dist/src/rlc-common/transformSampleGroups.js.map +1 -1
  302. package/dist/src/testing/index.d.ts.map +1 -1
  303. package/dist/src/testing/index.js +1 -1
  304. package/dist/src/testing/index.js.map +1 -1
  305. package/dist/src/transform/transform.d.ts +1 -1
  306. package/dist/src/transform/transform.d.ts.map +1 -1
  307. package/dist/src/transform/transform.js +28 -27
  308. package/dist/src/transform/transform.js.map +1 -1
  309. package/dist/src/transform/transformApiVersionInfo.d.ts +1 -1
  310. package/dist/src/transform/transformApiVersionInfo.d.ts.map +1 -1
  311. package/dist/src/transform/transformApiVersionInfo.js +12 -14
  312. package/dist/src/transform/transformApiVersionInfo.js.map +1 -1
  313. package/dist/src/transform/transformHelperFunctionDetails.d.ts +1 -1
  314. package/dist/src/transform/transformHelperFunctionDetails.d.ts.map +1 -1
  315. package/dist/src/transform/transformHelperFunctionDetails.js +11 -14
  316. package/dist/src/transform/transformHelperFunctionDetails.js.map +1 -1
  317. package/dist/src/transform/transformParameters.d.ts +2 -2
  318. package/dist/src/transform/transformParameters.d.ts.map +1 -1
  319. package/dist/src/transform/transformParameters.js +32 -45
  320. package/dist/src/transform/transformParameters.js.map +1 -1
  321. package/dist/src/transform/transformPaths.d.ts +1 -1
  322. package/dist/src/transform/transformPaths.d.ts.map +1 -1
  323. package/dist/src/transform/transformPaths.js +19 -23
  324. package/dist/src/transform/transformPaths.js.map +1 -1
  325. package/dist/src/transform/transformResponses.d.ts +1 -1
  326. package/dist/src/transform/transformResponses.d.ts.map +1 -1
  327. package/dist/src/transform/transformResponses.js +21 -25
  328. package/dist/src/transform/transformResponses.js.map +1 -1
  329. package/dist/src/transform/transformSchemas.d.ts.map +1 -1
  330. package/dist/src/transform/transformSchemas.js +21 -32
  331. package/dist/src/transform/transformSchemas.js.map +1 -1
  332. package/dist/src/transform/transformTelemetryInfo.d.ts +1 -1
  333. package/dist/src/transform/transformTelemetryInfo.d.ts.map +1 -1
  334. package/dist/src/transform/transformTelemetryInfo.js +3 -3
  335. package/dist/src/transform/transformTelemetryInfo.js.map +1 -1
  336. package/dist/src/transform/transfromRLCOptions.d.ts +1 -1
  337. package/dist/src/transform/transfromRLCOptions.d.ts.map +1 -1
  338. package/dist/src/transform/transfromRLCOptions.js +28 -39
  339. package/dist/src/transform/transfromRLCOptions.js.map +1 -1
  340. package/dist/src/utils/clientUtils.d.ts +1 -1
  341. package/dist/src/utils/clientUtils.d.ts.map +1 -1
  342. package/dist/src/utils/clientUtils.js +15 -23
  343. package/dist/src/utils/clientUtils.js.map +1 -1
  344. package/dist/src/utils/credentialUtils.d.ts +1 -1
  345. package/dist/src/utils/credentialUtils.d.ts.map +1 -1
  346. package/dist/src/utils/credentialUtils.js +4 -5
  347. package/dist/src/utils/credentialUtils.js.map +1 -1
  348. package/dist/src/utils/crossLanguageDef.d.ts.map +1 -1
  349. package/dist/src/utils/crossLanguageDef.js +11 -15
  350. package/dist/src/utils/crossLanguageDef.js.map +1 -1
  351. package/dist/src/utils/emitUtil.d.ts +1 -1
  352. package/dist/src/utils/emitUtil.d.ts.map +1 -1
  353. package/dist/src/utils/emitUtil.js +5 -7
  354. package/dist/src/utils/emitUtil.js.map +1 -1
  355. package/dist/src/utils/fileSystemUtils.d.ts +2 -0
  356. package/dist/src/utils/fileSystemUtils.d.ts.map +1 -1
  357. package/dist/src/utils/fileSystemUtils.js +26 -7
  358. package/dist/src/utils/fileSystemUtils.js.map +1 -1
  359. package/dist/src/utils/importHelper.d.ts.map +1 -1
  360. package/dist/src/utils/importHelper.js +3 -6
  361. package/dist/src/utils/importHelper.js.map +1 -1
  362. package/dist/src/utils/interfaces.d.ts +1 -1
  363. package/dist/src/utils/interfaces.d.ts.map +1 -1
  364. package/dist/src/utils/mediaTypes.d.ts.map +1 -1
  365. package/dist/src/utils/mediaTypes.js +7 -19
  366. package/dist/src/utils/mediaTypes.js.map +1 -1
  367. package/dist/src/utils/modelUtils.d.ts +5 -5
  368. package/dist/src/utils/modelUtils.d.ts.map +1 -1
  369. package/dist/src/utils/modelUtils.js +168 -257
  370. package/dist/src/utils/modelUtils.js.map +1 -1
  371. package/dist/src/utils/namespaceUtils.d.ts.map +1 -1
  372. package/dist/src/utils/namespaceUtils.js +6 -7
  373. package/dist/src/utils/namespaceUtils.js.map +1 -1
  374. package/dist/src/utils/operationUtil.d.ts +1 -1
  375. package/dist/src/utils/operationUtil.d.ts.map +1 -1
  376. package/dist/src/utils/operationUtil.js +60 -81
  377. package/dist/src/utils/operationUtil.js.map +1 -1
  378. package/dist/src/utils/parameterUtils.d.ts +1 -1
  379. package/dist/src/utils/parameterUtils.d.ts.map +1 -1
  380. package/dist/src/utils/parameterUtils.js +26 -33
  381. package/dist/src/utils/parameterUtils.js.map +1 -1
  382. package/dist/src/utils/resolve-project-root.js +2 -2
  383. package/dist/src/utils/resolve-project-root.js.map +1 -1
  384. package/dist/tsconfig.tsbuildinfo +1 -1
  385. package/package.json +38 -45
  386. package/src/contextManager.ts +6 -9
  387. package/src/framework/declaration.ts +18 -28
  388. package/src/framework/dependency.ts +1 -2
  389. package/src/framework/hooks/binder.ts +47 -120
  390. package/src/framework/hooks/sdkTypes.ts +27 -54
  391. package/src/framework/hooks/useDependencies.ts +2 -4
  392. package/src/framework/load-static-helpers.ts +28 -51
  393. package/src/framework/reference.ts +2 -5
  394. package/src/framework/sample.ts +9 -9
  395. package/src/index.ts +145 -185
  396. package/src/lib.ts +143 -158
  397. package/src/metaTree.ts +1 -1
  398. package/src/modular/buildClassicalClient.ts +83 -160
  399. package/src/modular/buildClassicalOperationGroups.ts +14 -39
  400. package/src/modular/buildClientContext.ts +54 -83
  401. package/src/modular/buildModularOptions.ts +4 -5
  402. package/src/modular/buildOperations.ts +46 -73
  403. package/src/modular/buildProjectFiles.ts +18 -47
  404. package/src/modular/buildRestorePoller.ts +27 -46
  405. package/src/modular/buildRootIndex.ts +86 -160
  406. package/src/modular/buildSubpathIndex.ts +35 -58
  407. package/src/modular/emitLoggerFile.ts +4 -9
  408. package/src/modular/emitModels.ts +136 -266
  409. package/src/modular/emitModelsOptions.ts +10 -16
  410. package/src/modular/emitSamples.ts +92 -180
  411. package/src/modular/emitTests.ts +28 -61
  412. package/src/modular/external-dependencies.ts +54 -54
  413. package/src/modular/helpers/classicalOperationHelpers.ts +73 -126
  414. package/src/modular/helpers/clientHelpers.ts +41 -88
  415. package/src/modular/helpers/clientOptionHelpers.ts +4 -11
  416. package/src/modular/helpers/exampleValueHelpers.ts +99 -215
  417. package/src/modular/helpers/namingHelpers.ts +12 -28
  418. package/src/modular/helpers/operationHelpers.ts +430 -757
  419. package/src/modular/helpers/typeHelpers.ts +11 -22
  420. package/src/modular/serialization/buildDeserializerFunction.ts +88 -122
  421. package/src/modular/serialization/buildSerializerFunction.ts +91 -129
  422. package/src/modular/serialization/buildXmlSerializerFunction.ts +104 -183
  423. package/src/modular/serialization/serializeUtils.ts +12 -22
  424. package/src/modular/static/rollup.test.config.js +11 -14
  425. package/src/modular/static/scripts/renameOutput.mjs +2 -2
  426. package/src/modular/static-helpers-metadata.ts +60 -60
  427. package/src/modular/type-expressions/get-credential-expression.ts +1 -1
  428. package/src/modular/type-expressions/get-enum-expression.ts +5 -10
  429. package/src/modular/type-expressions/get-model-expression.ts +13 -17
  430. package/src/modular/type-expressions/get-nullable-expression.ts +4 -5
  431. package/src/modular/type-expressions/get-type-expression.ts +8 -12
  432. package/src/modular/type-expressions/get-union-expression.ts +4 -4
  433. package/src/modular/type-expressions/utils.ts +1 -1
  434. package/src/rlc-common/buildClient.ts +70 -141
  435. package/src/rlc-common/buildClientDefinitions.ts +44 -87
  436. package/src/rlc-common/buildIndexFile.ts +78 -78
  437. package/src/rlc-common/buildIsUnexpectedHelper.ts +34 -41
  438. package/src/rlc-common/buildLogger.ts +7 -7
  439. package/src/rlc-common/buildMethodShortcuts.ts +9 -21
  440. package/src/rlc-common/buildObjectTypes.ts +79 -156
  441. package/src/rlc-common/buildPaginateHelper.ts +9 -12
  442. package/src/rlc-common/buildParameterTypes.ts +116 -137
  443. package/src/rlc-common/buildPollingHelper.ts +7 -7
  444. package/src/rlc-common/buildResponseTypes.ts +34 -57
  445. package/src/rlc-common/buildSamples.ts +3 -3
  446. package/src/rlc-common/buildSchemaType.ts +37 -29
  447. package/src/rlc-common/buildSerializeHelper.ts +5 -5
  448. package/src/rlc-common/buildTopLevelIndexFile.ts +12 -19
  449. package/src/rlc-common/helpers/apiVersionUtil.ts +5 -10
  450. package/src/rlc-common/helpers/importsUtil.ts +27 -30
  451. package/src/rlc-common/helpers/nameConstructors.ts +16 -50
  452. package/src/rlc-common/helpers/nameUtils.ts +19 -42
  453. package/src/rlc-common/helpers/operationHelpers.ts +14 -31
  454. package/src/rlc-common/helpers/pathUtils.ts +2 -7
  455. package/src/rlc-common/helpers/schemaHelpers.ts +4 -15
  456. package/src/rlc-common/helpers/shortcutMethods.ts +6 -15
  457. package/src/rlc-common/helpers/typeUtil.ts +4 -11
  458. package/src/rlc-common/helpers/valueGenerationUtil.ts +16 -39
  459. package/src/rlc-common/index.ts +28 -28
  460. package/src/rlc-common/interfaces.ts +3 -11
  461. package/src/rlc-common/metadata/buildApiExtractorConfig.ts +17 -24
  462. package/src/rlc-common/metadata/buildChangelogFile.ts +1 -1
  463. package/src/rlc-common/metadata/buildESLintConfig.ts +3 -5
  464. package/src/rlc-common/metadata/buildLicenseFile.ts +1 -1
  465. package/src/rlc-common/metadata/buildPackageFile.ts +27 -35
  466. package/src/rlc-common/metadata/buildReadmeFile.ts +16 -29
  467. package/src/rlc-common/metadata/buildRollupConfig.ts +5 -8
  468. package/src/rlc-common/metadata/buildSampleEnvFile.ts +2 -3
  469. package/src/rlc-common/metadata/buildTestConfig.ts +10 -10
  470. package/src/rlc-common/metadata/buildTsConfig.ts +32 -35
  471. package/src/rlc-common/metadata/buildVitestConfig.ts +4 -10
  472. package/src/rlc-common/metadata/buildWarpConfig.ts +3 -6
  473. package/src/rlc-common/metadata/packageJson/azurePackageCommon.ts +16 -25
  474. package/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.ts +29 -50
  475. package/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.ts +20 -31
  476. package/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.ts +11 -13
  477. package/src/rlc-common/metadata/packageJson/packageCommon.ts +32 -52
  478. package/src/rlc-common/test/buildKarmaConfig.ts +1 -1
  479. package/src/rlc-common/test/buildRecordedClient.ts +3 -3
  480. package/src/rlc-common/test/buildSampleTest.ts +3 -3
  481. package/src/rlc-common/test/buildSnippets.ts +6 -12
  482. package/src/rlc-common/transformSampleGroups.ts +54 -105
  483. package/src/testing/index.ts +2 -5
  484. package/src/transform/transform.ts +22 -34
  485. package/src/transform/transformApiVersionInfo.ts +17 -30
  486. package/src/transform/transformHelperFunctionDetails.ts +14 -26
  487. package/src/transform/transformParameters.ts +55 -105
  488. package/src/transform/transformPaths.ts +26 -43
  489. package/src/transform/transformResponses.ts +26 -33
  490. package/src/transform/transformSchemas.ts +15 -33
  491. package/src/transform/transformTelemetryInfo.ts +8 -14
  492. package/src/transform/transfromRLCOptions.ts +53 -116
  493. package/src/utils/clientUtils.ts +22 -41
  494. package/src/utils/credentialUtils.ts +8 -19
  495. package/src/utils/crossLanguageDef.ts +15 -34
  496. package/src/utils/emitUtil.ts +11 -17
  497. package/src/utils/fileSystemUtils.ts +30 -8
  498. package/src/utils/importHelper.ts +5 -10
  499. package/src/utils/interfaces.ts +1 -1
  500. package/src/utils/mediaTypes.ts +13 -34
  501. package/src/utils/modelUtils.ts +175 -384
  502. package/src/utils/namespaceUtils.ts +8 -24
  503. package/src/utils/operationUtil.ts +98 -190
  504. package/src/utils/parameterUtils.ts +31 -54
  505. package/src/utils/resolve-project-root.ts +3 -3
  506. package/static/static-helpers/cloudSettingHelpers.ts +4 -6
  507. package/static/static-helpers/multipartHelpers.ts +3 -3
  508. package/static/static-helpers/pagingHelpers.ts +28 -63
  509. package/static/static-helpers/pollingHelpers.ts +16 -29
  510. package/static/static-helpers/serialization/build-multi-collection.ts +1 -4
  511. package/static/static-helpers/serialization/check-prop-undefined.ts +1 -4
  512. package/static/static-helpers/serialization/get-binary-response-browser.mts +3 -1
  513. package/static/static-helpers/serialization/get-binary-response.ts +2 -2
  514. package/static/static-helpers/serialization/get-binary-stream-response-browser.mts +1 -3
  515. package/static/static-helpers/serialization/get-binary-stream-response.ts +2 -4
  516. package/static/static-helpers/serialization/serialize-record.ts +1 -1
  517. package/static/static-helpers/serialization/serializers.ts +4 -7
  518. package/static/static-helpers/serialization/xml-helpers.ts +42 -90
  519. package/static/static-helpers/simplePollerHelpers.ts +10 -19
  520. package/static/static-helpers/storageCompatResponse.ts +10 -27
  521. package/static/static-helpers/urlTemplate.ts +4 -7
  522. package/static/test-helpers/recordedClient.ts +5 -10
@@ -1,30 +1,30 @@
1
- import { StructureKind } from "ts-morph";
1
+ import { getClientOptions, isHttpMetadata, isReadOnly, } from "@azure-tools/typespec-client-generator-core";
2
2
  import { NoTarget } from "@typespec/compiler";
3
- import { PagingHelpers, PollingHelpers, PlatformTypeHelpers, SerializationHelpers, StorageCompatHelpers, UrlTemplateHelpers, XmlHelpers } from "../static-helpers-metadata.js";
4
- import { getNullableValidType, isSpreadBodyParameter, isTypeNullable } from "./typeHelpers.js";
5
- import { getClassicalLayerPrefix, getOperationName, generateLocallyUniqueName } from "./namingHelpers.js";
6
- import { getCollectionFormatHelper, hasCollectionFormatInfo, isBinaryPayload, isXmlPayload, isMultipartPayload, hasDualFormatSupport, getCollectionFormatParseHelper, getCollectionFormatFromArrayEncoding, KnownCollectionFormat } from "../../utils/operationUtil.js";
7
- import { getPropertyWithOverrides, isNormalUnion, isSpecialHandledUnion } from "../serialization/serializeUtils.js";
8
- import { getDocsFromDescription, getFixmeForMultilineDocs } from "./docsHelpers.js";
9
- import { AzurePollingDependencies } from "../external-dependencies.js";
10
- import { NameType, normalizeName } from "../../rlc-common/index.js";
11
- import { buildModelDeserializer, buildPropertyDeserializer } from "../serialization/buildDeserializerFunction.js";
12
- import { buildModelSerializer, buildPropertySerializer } from "../serialization/buildSerializerFunction.js";
13
- import { buildXmlModelSerializer, buildXmlModelDeserializer, hasXmlSerialization } from "../serialization/buildXmlSerializerFunction.js";
3
+ import { isHeader, isMetadata } from "@typespec/http";
4
+ import { StructureKind, } from "ts-morph";
5
+ import { useContext } from "../../contextManager.js";
6
+ import { useSdkTypes } from "../../framework/hooks/sdkTypes.js";
7
+ import { useDependencies } from "../../framework/hooks/useDependencies.js";
8
+ import { resolveReference } from "../../framework/reference.js";
14
9
  import { refkey } from "../../framework/refkey.js";
15
10
  import { reportDiagnostic } from "../../lib.js";
16
- import { resolveReference } from "../../framework/reference.js";
17
- import { useDependencies } from "../../framework/hooks/useDependencies.js";
18
- import { useSdkTypes } from "../../framework/hooks/sdkTypes.js";
11
+ import { NameType, normalizeName } from "../../rlc-common/index.js";
19
12
  import { isAzureCoreErrorType } from "../../utils/modelUtils.js";
20
- import { getTypeExpression, normalizeModelPropertyName } from "../type-expressions/get-type-expression.js";
21
- import { getClientOptions, isHttpMetadata, isReadOnly } from "@azure-tools/typespec-client-generator-core";
22
- import { isHeader, isMetadata } from "@typespec/http";
23
- import { useContext } from "../../contextManager.js";
24
- import { getHeaderClientOptions, getRestErrorCodeHeader } from "./clientOptionHelpers.js";
25
- import { getClientParameterName } from "./clientHelpers.js";
13
+ import { getCollectionFormatFromArrayEncoding, getCollectionFormatHelper, getCollectionFormatParseHelper, hasCollectionFormatInfo, hasDualFormatSupport, isBinaryPayload, isMultipartPayload, isXmlPayload, KnownCollectionFormat, } from "../../utils/operationUtil.js";
14
+ import { AzurePollingDependencies } from "../external-dependencies.js";
15
+ import { buildModelDeserializer, buildPropertyDeserializer, } from "../serialization/buildDeserializerFunction.js";
16
+ import { buildModelSerializer, buildPropertySerializer, } from "../serialization/buildSerializerFunction.js";
17
+ import { buildXmlModelDeserializer, buildXmlModelSerializer, hasXmlSerialization, } from "../serialization/buildXmlSerializerFunction.js";
18
+ import { getPropertyWithOverrides, isNormalUnion, isSpecialHandledUnion, } from "../serialization/serializeUtils.js";
19
+ import { PagingHelpers, PlatformTypeHelpers, PollingHelpers, SerializationHelpers, StorageCompatHelpers, UrlTemplateHelpers, XmlHelpers, } from "../static-helpers-metadata.js";
26
20
  import { isExtensibleEnum } from "../type-expressions/get-enum-expression.js";
27
21
  import { emitInlineModel } from "../type-expressions/get-model-expression.js";
22
+ import { getTypeExpression, normalizeModelPropertyName, } from "../type-expressions/get-type-expression.js";
23
+ import { getClientParameterName } from "./clientHelpers.js";
24
+ import { getHeaderClientOptions, getRestErrorCodeHeader } from "./clientOptionHelpers.js";
25
+ import { getDocsFromDescription, getFixmeForMultilineDocs } from "./docsHelpers.js";
26
+ import { generateLocallyUniqueName, getClassicalLayerPrefix, getOperationName, } from "./namingHelpers.js";
27
+ import { getNullableValidType, isSpreadBodyParameter, isTypeNullable } from "./typeHelpers.js";
28
28
  /**
29
29
  * Checks whether a header should be skipped during serialization/deserialization.
30
30
  * A header is skipped when it has the "headerCollectionPrefix" client option set,
@@ -43,7 +43,7 @@ export function getSendPrivateFunction(dpgContext, method, clientType, client) {
43
43
  isExported: true,
44
44
  name: `_${name}Send`,
45
45
  parameters,
46
- returnType: resolveReference(dependencies.StreamableMethod)
46
+ returnType: resolveReference(dependencies.StreamableMethod),
47
47
  };
48
48
  const operationPath = operation.operation.path;
49
49
  const operationMethod = operation.operation.verb.toLowerCase();
@@ -52,15 +52,13 @@ export function getSendPrivateFunction(dpgContext, method, clientType, client) {
52
52
  let pathStr = `"${operationPath}"`;
53
53
  const urlTemplateParams = [
54
54
  ...getPathParameters(operation),
55
- ...getQueryParameters(dpgContext, operation)
55
+ ...getQueryParameters(dpgContext, operation),
56
56
  ];
57
57
  if (urlTemplateParams.length > 0) {
58
58
  // Generate a unique local variable name that doesn't conflict with parameter names
59
59
  const paramNames = new Set(parameters.map((p) => p.name));
60
60
  const pathVarName = generateLocallyUniqueName("path", paramNames);
61
- const includeRootSlash = client
62
- ? getClientOptions(client, "includeRootSlash") !== false
63
- : true;
61
+ const includeRootSlash = client ? getClientOptions(client, "includeRootSlash") !== false : true;
64
62
  const uriTemplate = includeRootSlash
65
63
  ? operation.operation.uriTemplate
66
64
  : operation.operation.uriTemplate.replace(/^\//, "");
@@ -74,11 +72,10 @@ export function getSendPrivateFunction(dpgContext, method, clientType, client) {
74
72
  statements.push(`return context.path(${pathStr}).${operationMethod}({...${resolveReference(dependencies.operationOptionsToRequestParameters)}(${optionalParamName}), ${getHeaderAndBodyParameters(dpgContext, operation, optionalParamName)}});`);
75
73
  return {
76
74
  ...functionStatement,
77
- statements
75
+ statements,
78
76
  };
79
77
  }
80
78
  export function getDeserializePrivateFunction(context, method) {
81
- var _a, _b, _c, _d, _e, _f, _g, _h;
82
79
  const operation = method[1];
83
80
  const { name } = getOperationName(operation);
84
81
  const dependencies = useDependencies();
@@ -101,26 +98,26 @@ export function getDeserializePrivateFunction(context, method) {
101
98
  // For LRO-only operations with non-model final result, wrap in a response type alias
102
99
  returnType = {
103
100
  name: getOperationResponseTypeName(method),
104
- type: resolveReference(refkey(operation, "response"))
101
+ type: resolveReference(refkey(operation, "response")),
105
102
  };
106
103
  }
107
104
  else {
108
105
  returnType = buildLroReturnType(context, operation);
109
106
  }
110
107
  }
111
- else if (isPagingOnly && (restResponse === null || restResponse === void 0 ? void 0 : restResponse.type)) {
108
+ else if (isPagingOnly && restResponse?.type) {
112
109
  // For paging operations, use the full response model (e.g., _OperationListResult)
113
110
  // instead of just the array element type
114
111
  returnType = {
115
- name: (_a = restResponse.name) !== null && _a !== void 0 ? _a : "",
116
- type: getTypeExpression(context, restResponse.type)
112
+ name: restResponse.name ?? "",
113
+ type: getTypeExpression(context, restResponse.type),
117
114
  };
118
115
  }
119
116
  else if (shouldWrap) {
120
117
  // Use the wrapper response type name (resolved via binder for cross-file imports)
121
118
  returnType = {
122
119
  name: getOperationResponseTypeName(method),
123
- type: resolveReference(refkey(operation, "response"))
120
+ type: resolveReference(refkey(operation, "response")),
124
121
  };
125
122
  }
126
123
  else if (response.type) {
@@ -128,8 +125,8 @@ export function getDeserializePrivateFunction(context, method) {
128
125
  // the return type must include undefined to reflect that possibility.
129
126
  const baseType = getTypeExpression(context, response.type);
130
127
  returnType = {
131
- name: (_b = response.name) !== null && _b !== void 0 ? _b : "",
132
- type: response.optional ? `${baseType} | undefined` : baseType
128
+ name: response.name ?? "",
129
+ type: response.optional ? `${baseType} | undefined` : baseType,
133
130
  };
134
131
  }
135
132
  else if (isHeadAsBooleanOperation(operation)) {
@@ -145,27 +142,27 @@ export function getDeserializePrivateFunction(context, method) {
145
142
  const parameters = [
146
143
  {
147
144
  name: resultParamName,
148
- type: resultParamType
149
- }
145
+ type: resultParamType,
146
+ },
150
147
  ];
151
148
  const functionStatement = {
152
149
  isAsync: true,
153
150
  isExported: true,
154
151
  name: `_${name}Deserialize`,
155
152
  parameters,
156
- returnType: `Promise<${returnType.type}>`
153
+ returnType: `Promise<${returnType.type}>`,
157
154
  };
158
155
  const statements = [];
159
156
  const createRestErrorReference = resolveReference(dependencies.createRestError);
160
157
  statements.push(`const expectedStatuses = ${getExpectedStatuses(operation)};`);
161
158
  statements.push(`if(!expectedStatuses.includes(result.status)){`, `${getExceptionThrowStatement(context, operation)}`, "}");
162
159
  const deserializedType = isLroOnly || isLroAndPaging
163
- ? (_d = (_c = operation === null || operation === void 0 ? void 0 : operation.lroMetadata) === null || _c === void 0 ? void 0 : _c.finalResponse) === null || _d === void 0 ? void 0 : _d.result
164
- : isPagingOnly && (restResponse === null || restResponse === void 0 ? void 0 : restResponse.type)
160
+ ? operation?.lroMetadata?.finalResponse?.result
161
+ : isPagingOnly && restResponse?.type
165
162
  ? restResponse.type
166
163
  : response.type;
167
164
  const lroSubSegments = isLroOnly
168
- ? (_f = (_e = operation === null || operation === void 0 ? void 0 : operation.lroMetadata) === null || _e === void 0 ? void 0 : _e.finalResponse) === null || _f === void 0 ? void 0 : _f.resultSegments
165
+ ? operation?.lroMetadata?.finalResponse?.resultSegments
169
166
  : undefined;
170
167
  let lroSubPath;
171
168
  if (lroSubSegments && lroSubSegments.length > 0) {
@@ -189,13 +186,11 @@ export function getDeserializePrivateFunction(context, method) {
189
186
  // This only applies to non-LRO, non-paging operations where the deserialized type
190
187
  // comes from response.type (not from LRO metadata or paging).
191
188
  const needsBodyGuard = response.optional && !isLroOnly && !isLroAndPaging && !isPagingOnly;
192
- const contentTypes = (_h = (_g = operation.operation.responses[0]) === null || _g === void 0 ? void 0 : _g.contentTypes) !== null && _h !== void 0 ? _h : [];
189
+ const contentTypes = operation.operation.responses[0]?.contentTypes ?? [];
193
190
  const isXml = isXmlPayload(contentTypes);
194
191
  const isDualFormat = hasDualFormatSupport(contentTypes);
195
192
  const isMultipart = isMultipartPayload(contentTypes);
196
- const useXmlDeserialization = isXml &&
197
- deserializedType.kind === "model" &&
198
- hasXmlSerialization(deserializedType);
193
+ const useXmlDeserialization = isXml && deserializedType.kind === "model" && hasXmlSerialization(deserializedType);
199
194
  // Workaround for multipart response: cast return value as any due to lack of multipart response handling in core
200
195
  const multipartCastSuffix = isMultipart ? " as any" : "";
201
196
  // For dual-format responses, check content-type header at runtime
@@ -209,11 +204,11 @@ export function getDeserializePrivateFunction(context, method) {
209
204
  }
210
205
  const xmlDeserializerName = buildXmlModelDeserializer(context, deserializedType, {
211
206
  nameOnly: true,
212
- skipDiscriminatedUnionSuffix: false
207
+ skipDiscriminatedUnionSuffix: false,
213
208
  });
214
209
  const jsonDeserializerName = buildModelDeserializer(context, deserializedType, {
215
210
  nameOnly: true,
216
- skipDiscriminatedUnionSuffix: false
211
+ skipDiscriminatedUnionSuffix: false,
217
212
  });
218
213
  if (xmlDeserializerName && jsonDeserializerName) {
219
214
  const isXmlContentTypeRef = resolveReference(XmlHelpers.isXmlContentType);
@@ -227,7 +222,7 @@ export function getDeserializePrivateFunction(context, method) {
227
222
  // Fall back to JSON deserializer
228
223
  const deserializeFunctionName = buildModelDeserializer(context, deserializedType, {
229
224
  nameOnly: true,
230
- skipDiscriminatedUnionSuffix: false
225
+ skipDiscriminatedUnionSuffix: false,
231
226
  });
232
227
  if (deserializeFunctionName) {
233
228
  statements.push(`return ${deserializeFunctionName}(${deserializedRoot})`);
@@ -243,7 +238,7 @@ export function getDeserializePrivateFunction(context, method) {
243
238
  }
244
239
  const xmlDeserializerName = buildXmlModelDeserializer(context, deserializedType, {
245
240
  nameOnly: true,
246
- skipDiscriminatedUnionSuffix: false
241
+ skipDiscriminatedUnionSuffix: false,
247
242
  });
248
243
  if (xmlDeserializerName) {
249
244
  statements.push(`return ${xmlDeserializerName}(${deserializedRoot})`);
@@ -252,7 +247,7 @@ export function getDeserializePrivateFunction(context, method) {
252
247
  // Fall back to JSON deserializer if XML deserializer is not available
253
248
  const deserializeFunctionName = buildModelDeserializer(context, deserializedType, {
254
249
  nameOnly: true,
255
- skipDiscriminatedUnionSuffix: false
250
+ skipDiscriminatedUnionSuffix: false,
256
251
  });
257
252
  if (deserializeFunctionName) {
258
253
  statements.push(`return ${deserializeFunctionName}(${deserializedRoot})`);
@@ -266,7 +261,7 @@ export function getDeserializePrivateFunction(context, method) {
266
261
  // JSON response (default) - also handles multipart responses
267
262
  const deserializeFunctionName = buildModelDeserializer(context, deserializedType, {
268
263
  nameOnly: true,
269
- skipDiscriminatedUnionSuffix: false
264
+ skipDiscriminatedUnionSuffix: false,
270
265
  });
271
266
  // Handle wrap-non-model-return for non-LRO, non-paging and LRO-only operations
272
267
  if (shouldWrap) {
@@ -289,7 +284,7 @@ export function getDeserializePrivateFunction(context, method) {
289
284
  }
290
285
  return {
291
286
  ...functionStatement,
292
- statements
287
+ statements,
293
288
  };
294
289
  }
295
290
  if (deserializeFunctionName) {
@@ -328,7 +323,7 @@ export function getDeserializePrivateFunction(context, method) {
328
323
  }
329
324
  return {
330
325
  ...functionStatement,
331
- statements
326
+ statements,
332
327
  };
333
328
  }
334
329
  /**
@@ -337,13 +332,11 @@ export function getDeserializePrivateFunction(context, method) {
337
332
  * or enable-storage-compat is enabled.
338
333
  */
339
334
  export function getDeserializeHeadersPrivateFunction(context, operation) {
340
- var _a, _b;
341
335
  const responseHeaders = getResponseHeaders(operation.operation.responses);
342
- const isResponseHeadersEnabled = ((_a = context.rlcOptions) === null || _a === void 0 ? void 0 : _a.includeHeadersInResponse) === true;
343
- const isStorageCompatEnabled = ((_b = context.rlcOptions) === null || _b === void 0 ? void 0 : _b.enableStorageCompat) === true;
336
+ const isResponseHeadersEnabled = context.rlcOptions?.includeHeadersInResponse === true;
337
+ const isStorageCompatEnabled = context.rlcOptions?.enableStorageCompat === true;
344
338
  // Only generate if headers exist and a relevant feature is enabled
345
- if (responseHeaders.length === 0 ||
346
- (!isResponseHeadersEnabled && !isStorageCompatEnabled)) {
339
+ if (responseHeaders.length === 0 || (!isResponseHeadersEnabled && !isStorageCompatEnabled)) {
347
340
  return undefined;
348
341
  }
349
342
  const { name } = getOperationName(operation);
@@ -352,8 +345,8 @@ export function getDeserializeHeadersPrivateFunction(context, operation) {
352
345
  const parameters = [
353
346
  {
354
347
  name: "result",
355
- type: PathUncheckedResponseReference
356
- }
348
+ type: PathUncheckedResponseReference,
349
+ },
357
350
  ];
358
351
  const returnType = buildHeaderOnlyResponseType(context, responseHeaders);
359
352
  const functionStatement = {
@@ -361,17 +354,16 @@ export function getDeserializeHeadersPrivateFunction(context, operation) {
361
354
  isExported: true,
362
355
  name: `_${name}DeserializeHeaders`,
363
356
  parameters,
364
- returnType
357
+ returnType,
365
358
  };
366
359
  const statements = [];
367
360
  statements.push(`return ${buildHeaderOnlyResponseValue(context, responseHeaders)};`);
368
361
  return {
369
362
  ...functionStatement,
370
- statements
363
+ statements,
371
364
  };
372
365
  }
373
366
  function getExceptionDetails(context, operation) {
374
- var _a;
375
367
  const customized = [];
376
368
  let defaultDeserializer;
377
369
  let defaultXmlDeserializer;
@@ -383,15 +375,14 @@ function getExceptionDetails(context, operation) {
383
375
  const statusCode = exception.statusCodes;
384
376
  const deserializeFunctionName = buildModelDeserializer(context, exception.type, {
385
377
  nameOnly: true,
386
- skipDiscriminatedUnionSuffix: false
378
+ skipDiscriminatedUnionSuffix: false,
387
379
  });
388
- if (!deserializeFunctionName ||
389
- typeof deserializeFunctionName !== "string") {
380
+ if (!deserializeFunctionName || typeof deserializeFunctionName !== "string") {
390
381
  continue;
391
382
  }
392
383
  // Check if the exception type has XML serialization support
393
384
  // Use exception contentTypes when available, otherwise check the type itself
394
- const exceptionContentTypes = (_a = exception.contentTypes) !== null && _a !== void 0 ? _a : [];
385
+ const exceptionContentTypes = exception.contentTypes ?? [];
395
386
  const exceptionIsXml = isXmlPayload(exceptionContentTypes);
396
387
  const exceptionIsDualFormat = hasDualFormatSupport(exceptionContentTypes);
397
388
  const typeHasXml = exception.type.kind === "model" && hasXmlSerialization(exception.type);
@@ -399,16 +390,14 @@ function getExceptionDetails(context, operation) {
399
390
  if (exception.type.kind === "model" && (typeHasXml || exceptionIsXml)) {
400
391
  const xmlName = buildXmlModelDeserializer(context, exception.type, {
401
392
  nameOnly: true,
402
- skipDiscriminatedUnionSuffix: false
393
+ skipDiscriminatedUnionSuffix: false,
403
394
  });
404
395
  if (typeof xmlName === "string") {
405
396
  xmlDeserializerName = xmlName;
406
397
  }
407
398
  }
408
399
  // XML-only when all content types are XML (no JSON support)
409
- const isXmlOnly = xmlDeserializerName !== undefined &&
410
- exceptionIsXml &&
411
- !exceptionIsDualFormat;
400
+ const isXmlOnly = xmlDeserializerName !== undefined && exceptionIsXml && !exceptionIsDualFormat;
412
401
  if (statusCode === "*") {
413
402
  defaultDeserializer = deserializeFunctionName;
414
403
  defaultXmlDeserializer = xmlDeserializerName;
@@ -419,7 +408,7 @@ function getExceptionDetails(context, operation) {
419
408
  start: statusCode,
420
409
  deserializer: deserializeFunctionName,
421
410
  xmlDeserializer: xmlDeserializerName,
422
- isXmlOnly
411
+ isXmlOnly,
423
412
  });
424
413
  }
425
414
  else {
@@ -428,7 +417,7 @@ function getExceptionDetails(context, operation) {
428
417
  end: statusCode.end,
429
418
  deserializer: deserializeFunctionName,
430
419
  xmlDeserializer: xmlDeserializerName,
431
- isXmlOnly
420
+ isXmlOnly,
432
421
  });
433
422
  }
434
423
  }
@@ -436,20 +425,19 @@ function getExceptionDetails(context, operation) {
436
425
  customized,
437
426
  defaultDeserializer,
438
427
  defaultXmlDeserializer,
439
- defaultIsXmlOnly
428
+ defaultIsXmlOnly,
440
429
  };
441
430
  }
442
431
  /**
443
432
  * Collects and deduplicates all response headers from operation exceptions.
444
433
  */
445
434
  function getExceptionResponseHeaders(exceptions) {
446
- var _a, _b;
447
435
  const headerMap = new Map();
448
- for (const exception of exceptions !== null && exceptions !== void 0 ? exceptions : []) {
449
- for (const header of (_a = exception.headers) !== null && _a !== void 0 ? _a : []) {
436
+ for (const exception of exceptions ?? []) {
437
+ for (const header of exception.headers ?? []) {
450
438
  if (shouldSkipHeaderSerialization(header))
451
439
  continue;
452
- const key = (_b = header.serializedName) !== null && _b !== void 0 ? _b : header.name;
440
+ const key = header.serializedName ?? header.name;
453
441
  if (!headerMap.has(key)) {
454
442
  headerMap.set(key, header);
455
443
  }
@@ -462,8 +450,7 @@ function getExceptionResponseHeaders(exceptions) {
462
450
  * Only generated when exception headers are present and include-headers-in-response is enabled.
463
451
  */
464
452
  export function getDeserializeExceptionHeadersPrivateFunction(context, operation) {
465
- var _a;
466
- const isResponseHeadersEnabled = ((_a = context.rlcOptions) === null || _a === void 0 ? void 0 : _a.includeHeadersInResponse) === true;
453
+ const isResponseHeadersEnabled = context.rlcOptions?.includeHeadersInResponse === true;
467
454
  if (!isResponseHeadersEnabled) {
468
455
  return undefined;
469
456
  }
@@ -477,8 +464,8 @@ export function getDeserializeExceptionHeadersPrivateFunction(context, operation
477
464
  const parameters = [
478
465
  {
479
466
  name: "result",
480
- type: PathUncheckedResponseReference
481
- }
467
+ type: PathUncheckedResponseReference,
468
+ },
482
469
  ];
483
470
  const returnType = buildHeaderOnlyResponseType(context, exceptionHeaders);
484
471
  const functionStatement = {
@@ -486,13 +473,13 @@ export function getDeserializeExceptionHeadersPrivateFunction(context, operation
486
473
  isExported: true,
487
474
  name: `_${name}DeserializeExceptionHeaders`,
488
475
  parameters,
489
- returnType
476
+ returnType,
490
477
  };
491
478
  const statements = [];
492
479
  statements.push(`return ${buildHeaderOnlyResponseValue(context, exceptionHeaders)};`);
493
480
  return {
494
481
  ...functionStatement,
495
- statements
482
+ statements,
496
483
  };
497
484
  }
498
485
  function getExceptionDeserializeExpr(exception) {
@@ -505,11 +492,10 @@ function getExceptionDeserializeExpr(exception) {
505
492
  return `isXml ? ${exception.xmlDeserializer}(result.body) : ${exception.deserializer}(result.body)`;
506
493
  }
507
494
  function getExceptionThrowStatement(context, operation) {
508
- var _a;
509
495
  const statements = [];
510
496
  const createRestErrorReference = resolveReference(useDependencies().createRestError);
511
497
  const { customized, defaultDeserializer, defaultXmlDeserializer, defaultIsXmlOnly } = getExceptionDetails(context, operation);
512
- const isResponseHeadersEnabled = ((_a = context.rlcOptions) === null || _a === void 0 ? void 0 : _a.includeHeadersInResponse) === true;
498
+ const isResponseHeadersEnabled = context.rlcOptions?.includeHeadersInResponse === true;
513
499
  // Check if exception headers function exists and build the call
514
500
  const exceptionHeaders = getExceptionResponseHeaders(operation.operation.exceptions);
515
501
  const hasExceptionHeaders = isResponseHeadersEnabled && exceptionHeaders.length > 0;
@@ -521,11 +507,7 @@ function getExceptionThrowStatement(context, operation) {
521
507
  const clientOptionHeadersCall = buildClientOptionHeadersCall(operation.operation.exceptions);
522
508
  // Build @clientOption("restErrorCodeHeader", ...) code to set error.code from a header
523
509
  const restErrorCodeAssignment = buildRestErrorCodeAssignment(operation.operation.exceptions);
524
- const allHeaderCalls = [
525
- exceptionHeadersCall,
526
- clientOptionHeadersCall,
527
- restErrorCodeAssignment
528
- ]
510
+ const allHeaderCalls = [exceptionHeadersCall, clientOptionHeadersCall, restErrorCodeAssignment]
529
511
  .filter(Boolean)
530
512
  .join("\n");
531
513
  // Check if any exception has XML deserialization support that requires runtime content-type check
@@ -605,7 +587,7 @@ function getExceptionThrowStatement(context, operation) {
605
587
  function buildClientOptionHeadersCall(exceptions) {
606
588
  const seenProperties = new Set();
607
589
  const assignments = [];
608
- for (const exception of exceptions !== null && exceptions !== void 0 ? exceptions : []) {
590
+ for (const exception of exceptions ?? []) {
609
591
  if (!exception.type || exception.type.kind !== "model") {
610
592
  continue;
611
593
  }
@@ -628,7 +610,7 @@ function buildClientOptionHeadersCall(exceptions) {
628
610
  * based on @clientOption("restErrorCodeHeader", ...) on exception model types.
629
611
  */
630
612
  function buildRestErrorCodeAssignment(exceptions) {
631
- for (const exception of exceptions !== null && exceptions !== void 0 ? exceptions : []) {
613
+ for (const exception of exceptions ?? []) {
632
614
  if (!exception.type || exception.type.kind !== "model") {
633
615
  continue;
634
616
  }
@@ -641,34 +623,28 @@ if (restErrorCodeValue !== undefined) { error.code = restErrorCodeValue; }`;
641
623
  return undefined;
642
624
  }
643
625
  function getOptionalParamsName(parameters) {
644
- var _a, _b;
645
- return ((_b = (_a = parameters.filter((p) => { var _a; return (_a = p.type) === null || _a === void 0 ? void 0 : _a.toString().endsWith("operationOptions__"); })[0]) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : "options");
626
+ return (parameters.filter((p) => p.type?.toString().endsWith("operationOptions__"))[0]?.name ??
627
+ "options");
646
628
  }
647
629
  function getOperationSignatureParameters(context, method, clientType) {
648
630
  const operation = method[1];
649
631
  const optionsType = resolveReference(refkey(method[1], "operationOptions"));
650
632
  const parameters = new Map();
651
633
  operation.parameters
652
- .filter((p) => {
653
- var _a;
654
- return p.onClient === false &&
655
- p.type.kind !== "constant" &&
656
- ((_a = operation.operation.parameters.filter((param) => {
657
- var _a, _b;
658
- return (param.methodParameterSegments.length === 1 &&
659
- ((_a = param.methodParameterSegments[0]) === null || _a === void 0 ? void 0 : _a.length) === 1 &&
660
- ((_b = param.methodParameterSegments[0]) === null || _b === void 0 ? void 0 : _b[0]) === p);
661
- })[0]) === null || _a === void 0 ? void 0 : _a.kind) !== "cookie" &&
662
- !p.optional &&
663
- !(p.isGeneratedName &&
664
- (p.name === "contentType" || p.name === "accept")) && // skip tcgc generated contentType and accept header parameter
665
- getClientOptions(p, "headerCollectionPrefix") === undefined;
666
- } // skip headers with collection prefix
667
- )
634
+ .filter((p) => p.onClient === false &&
635
+ p.type.kind !== "constant" &&
636
+ operation.operation.parameters.filter((param) => {
637
+ return (param.methodParameterSegments.length === 1 &&
638
+ param.methodParameterSegments[0]?.length === 1 &&
639
+ param.methodParameterSegments[0]?.[0] === p);
640
+ })[0]?.kind !== "cookie" &&
641
+ !p.optional &&
642
+ !(p.isGeneratedName && (p.name === "contentType" || p.name === "accept")) && // skip tcgc generated contentType and accept header parameter
643
+ getClientOptions(p, "headerCollectionPrefix") === undefined)
668
644
  .map((p) => {
669
645
  return {
670
646
  name: p.name,
671
- type: getTypeExpression(context, p.type)
647
+ type: getTypeExpression(context, p.type),
672
648
  };
673
649
  })
674
650
  .forEach((p) => {
@@ -680,7 +656,7 @@ function getOperationSignatureParameters(context, method, clientType) {
680
656
  const optionsParam = {
681
657
  name: parameters.has("options") ? "optionalParams" : "options",
682
658
  type: optionsType,
683
- initializer: "{ requestOptions: {} }"
659
+ initializer: "{ requestOptions: {} }",
684
660
  };
685
661
  const finalParameters = [contextParam, ...parameters.values(), optionsParam];
686
662
  return finalParameters;
@@ -689,7 +665,6 @@ function getOperationSignatureParameters(context, method, clientType) {
689
665
  * This operation builds and returns the function declaration for an operation.
690
666
  */
691
667
  export function getOperationFunction(context, method, clientType) {
692
- var _a, _b, _c, _d, _e;
693
668
  const operation = method[1];
694
669
  // Extract required parameters
695
670
  const parameters = getOperationSignatureParameters(context, method, clientType);
@@ -710,8 +685,8 @@ export function getOperationFunction(context, method, clientType) {
710
685
  const response = operation.response;
711
686
  const responseHeaders = getResponseHeaders(operation.operation.responses);
712
687
  const hasHeaderOnlyResponse = !response.type && responseHeaders.length > 0;
713
- const isResponseHeadersEnabled = ((_a = context.rlcOptions) === null || _a === void 0 ? void 0 : _a.includeHeadersInResponse) === true;
714
- const isStorageCompatEnabled = ((_b = context.rlcOptions) === null || _b === void 0 ? void 0 : _b.enableStorageCompat) === true;
688
+ const isResponseHeadersEnabled = context.rlcOptions?.includeHeadersInResponse === true;
689
+ const isStorageCompatEnabled = context.rlcOptions?.enableStorageCompat === true;
715
690
  // Track the raw body type separately for storage-compat (before header merging)
716
691
  const hasResponseBody = !!response.type;
717
692
  let bodyType = "void";
@@ -725,30 +700,26 @@ export function getOperationFunction(context, method, clientType) {
725
700
  // Use the wrapper response type name (resolved via binder for cross-file imports)
726
701
  returnType = {
727
702
  name: getOperationResponseTypeName(method),
728
- type: resolveReference(refkey(operation, "response"))
703
+ type: resolveReference(refkey(operation, "response")),
729
704
  };
730
705
  bodyType = returnType.type;
731
706
  }
732
707
  else if (response.type) {
733
708
  const type = response.type;
734
709
  // If feature flag enabled, we'll append the response headers to the operation response type.
735
- if (type.kind === "model" &&
736
- responseHeaders.length > 0 &&
737
- isResponseHeadersEnabled) {
710
+ if (type.kind === "model" && responseHeaders.length > 0 && isResponseHeadersEnabled) {
738
711
  // Build a composite type that includes both model and additional header properties
739
712
  const baseCompositeType = buildCompositeResponseType(context, type, responseHeaders);
740
713
  returnType = {
741
- name: (_c = type.name) !== null && _c !== void 0 ? _c : "",
742
- type: response.optional
743
- ? `${baseCompositeType} | undefined`
744
- : baseCompositeType
714
+ name: type.name ?? "",
715
+ type: response.optional ? `${baseCompositeType} | undefined` : baseCompositeType,
745
716
  };
746
717
  }
747
718
  else {
748
719
  const baseType = getTypeExpression(context, type);
749
720
  returnType = {
750
- name: (_d = type.name) !== null && _d !== void 0 ? _d : "",
751
- type: response.optional ? `${baseType} | undefined` : baseType
721
+ name: type.name ?? "",
722
+ type: response.optional ? `${baseType} | undefined` : baseType,
752
723
  };
753
724
  }
754
725
  }
@@ -756,7 +727,7 @@ export function getOperationFunction(context, method, clientType) {
756
727
  // Here we handle returning headers when the operation return type is void
757
728
  returnType = {
758
729
  name: "",
759
- type: `${buildHeaderOnlyResponseType(context, responseHeaders)}`
730
+ type: `${buildHeaderOnlyResponseType(context, responseHeaders)}`,
760
731
  };
761
732
  }
762
733
  else if (isHeadAsBooleanOperation(operation)) {
@@ -794,16 +765,13 @@ export function getOperationFunction(context, method, clientType) {
794
765
  const { name, fixme = [] } = getOperationName(operation, context);
795
766
  const functionStatement = {
796
767
  kind: StructureKind.Function,
797
- docs: [
798
- ...getDocsFromDescription(operation.doc),
799
- ...getFixmeForMultilineDocs(fixme)
800
- ],
768
+ docs: [...getDocsFromDescription(operation.doc), ...getFixmeForMultilineDocs(fixme)],
801
769
  isAsync: true,
802
770
  isExported: true,
803
771
  name,
804
772
  propertyName: normalizeName(operation.name, NameType.Property),
805
773
  parameters,
806
- returnType: `Promise<${finalReturnType}>`
774
+ returnType: `Promise<${finalReturnType}>`,
807
775
  };
808
776
  const statements = [];
809
777
  // Generate unique local variable names that don't conflict with parameter names
@@ -824,7 +792,7 @@ export function getOperationFunction(context, method, clientType) {
824
792
  // doing a UTF-8 decode on the raw bytes.
825
793
  // For binary wrap, use getBinaryStreamResponse which preserves blobBody/readableStreamBody properties.
826
794
  // For non-wrapped binary, use getBinaryResponse which buffers the body into Uint8Array.
827
- if (((_e = response === null || response === void 0 ? void 0 : response.type) === null || _e === void 0 ? void 0 : _e.kind) === "bytes" && response.type.encode === "bytes") {
795
+ if (response?.type?.kind === "bytes" && response.type.encode === "bytes") {
828
796
  const streamableMethodVarName = generateLocallyUniqueName("streamableMethod", paramNames);
829
797
  statements.push(`const ${streamableMethodVarName} = _${name}Send(${sendParameterList});`);
830
798
  const binaryHelper = wrapReturn && wrapReturnIsBinary
@@ -876,7 +844,7 @@ export function getOperationFunction(context, method, clientType) {
876
844
  }
877
845
  return {
878
846
  ...functionStatement,
879
- statements
847
+ statements,
880
848
  };
881
849
  }
882
850
  function getLroOnlyOperationFunction(context, method, clientType, optionalParamName = "options") {
@@ -898,10 +866,7 @@ function getLroOnlyOperationFunction(context, method, clientType, optionalParamN
898
866
  : returnType.type;
899
867
  const functionStatement = {
900
868
  kind: StructureKind.Function,
901
- docs: [
902
- ...getDocsFromDescription(operation.doc),
903
- ...getFixmeForMultilineDocs(fixme)
904
- ],
869
+ docs: [...getDocsFromDescription(operation.doc), ...getFixmeForMultilineDocs(fixme)],
905
870
  isAsync: false,
906
871
  isExported: true,
907
872
  name,
@@ -909,21 +874,18 @@ function getLroOnlyOperationFunction(context, method, clientType, optionalParamN
909
874
  isLro: true,
910
875
  lroFinalReturnType: effectiveReturnTypeName,
911
876
  parameters,
912
- returnType: `${pollerLikeReference}<${operationStateReference}<${effectiveReturnTypeStr}>, ${effectiveReturnTypeStr}>`
877
+ returnType: `${pollerLikeReference}<${operationStateReference}<${effectiveReturnTypeStr}>, ${effectiveReturnTypeStr}>`,
913
878
  };
914
879
  const getLongRunningPollerReference = resolveReference(PollingHelpers.GetLongRunningPoller);
915
- const lroMetadata = operation.kind === "lro" || operation.kind === "lropaging"
916
- ? operation.lroMetadata
917
- : undefined;
880
+ const lroMetadata = operation.kind === "lro" || operation.kind === "lropaging" ? operation.lroMetadata : undefined;
918
881
  const allowedFinalLocation = [
919
882
  "azure-async-operation",
920
883
  "location",
921
884
  "original-uri",
922
- "operation-location"
885
+ "operation-location",
923
886
  ];
924
- const resourceLocationConfig = (lroMetadata === null || lroMetadata === void 0 ? void 0 : lroMetadata.finalStateVia) &&
925
- allowedFinalLocation.includes(lroMetadata === null || lroMetadata === void 0 ? void 0 : lroMetadata.finalStateVia)
926
- ? `resourceLocationConfig: "${lroMetadata === null || lroMetadata === void 0 ? void 0 : lroMetadata.finalStateVia}",`
887
+ const resourceLocationConfig = lroMetadata?.finalStateVia && allowedFinalLocation.includes(lroMetadata?.finalStateVia)
888
+ ? `resourceLocationConfig: "${lroMetadata?.finalStateVia}",`
927
889
  : "";
928
890
  const apiVersion = getApiVersionExpression(context, operation);
929
891
  const statements = [];
@@ -932,20 +894,17 @@ function getLroOnlyOperationFunction(context, method, clientType, optionalParamN
932
894
  return ${getLongRunningPollerReference}(context, _${name}Deserialize, ${getExpectedStatuses(operation)}, {
933
895
  updateIntervalInMs: ${optionalParamName}?.updateIntervalInMs,
934
896
  abortSignal: ${optionalParamName}?.abortSignal,
935
- getInitialResponse: () => _${name}Send(${parameters
936
- .map((p) => p.name)
937
- .join(", ")}),
897
+ getInitialResponse: () => _${name}Send(${parameters.map((p) => p.name).join(", ")}),
938
898
  ${resourceLocationConfig}
939
899
  ${apiVersion ? `apiVersion: ${apiVersion}` : ""}
940
900
  }) as ${pollerLikeReference}<${operationStateReference}<${effectiveReturnTypeStr}>, ${effectiveReturnTypeStr}>;
941
901
  `);
942
902
  return {
943
903
  ...functionStatement,
944
- statements
904
+ statements,
945
905
  };
946
906
  }
947
907
  function getLroAndPagingOperationFunction(context, method, clientType, optionalParamName = "options") {
948
- var _a;
949
908
  const operation = method[1];
950
909
  const parameters = getOperationSignatureParameters(context, method, clientType);
951
910
  const { name, fixme = [] } = getOperationName(operation, context);
@@ -960,16 +919,16 @@ function getLroAndPagingOperationFunction(context, method, clientType, optionalP
960
919
  `nextLinkName: "${operation.pagingMetadata.nextLinkSegments.map((p) => p.name).join(".")}"`,
961
920
  operation.pagingMetadata.nextLinkVerb !== "GET" &&
962
921
  `nextLinkMethod: "${operation.pagingMetadata.nextLinkVerb}"`,
963
- apiVersion && `apiVersion: ${apiVersion}`
922
+ apiVersion && `apiVersion: ${apiVersion}`,
964
923
  ].filter(Boolean);
965
924
  // Build LRO resource location config
966
925
  const allowedLocations = [
967
926
  "azure-async-operation",
968
927
  "location",
969
928
  "original-uri",
970
- "operation-location"
929
+ "operation-location",
971
930
  ];
972
- const resourceLocationConfig = ((_a = operation.lroMetadata) === null || _a === void 0 ? void 0 : _a.finalStateVia) &&
931
+ const resourceLocationConfig = operation.lroMetadata?.finalStateVia &&
973
932
  allowedLocations.includes(operation.lroMetadata.finalStateVia)
974
933
  ? `resourceLocationConfig: "${operation.lroMetadata.finalStateVia}",`
975
934
  : "";
@@ -980,17 +939,14 @@ function getLroAndPagingOperationFunction(context, method, clientType, optionalP
980
939
  getLroPoller: resolveReference(PollingHelpers.GetLongRunningPoller),
981
940
  pollerLike: resolveReference(AzurePollingDependencies.PollerLike),
982
941
  operationState: resolveReference(AzurePollingDependencies.OperationState),
983
- pathResponse: resolveReference(useDependencies().PathUncheckedResponse)
942
+ pathResponse: resolveReference(useDependencies().PathUncheckedResponse),
984
943
  };
985
944
  const expectedStatuses = getExpectedStatuses(operation);
986
945
  const paramList = parameters.map((p) => p.name).join(", ");
987
946
  const pagingOptionsStr = pagingOptions.length > 0 ? `,\n {${pagingOptions.join(", ")}}` : "";
988
947
  return {
989
948
  kind: StructureKind.Function,
990
- docs: [
991
- ...getDocsFromDescription(operation.doc),
992
- ...getFixmeForMultilineDocs(fixme)
993
- ],
949
+ docs: [...getDocsFromDescription(operation.doc), ...getFixmeForMultilineDocs(fixme)],
994
950
  isAsync: false,
995
951
  isExported: true,
996
952
  isLroPaging: true,
@@ -1017,8 +973,8 @@ function getLroAndPagingOperationFunction(context, method, clientType, optionalP
1017
973
  _${name}Deserialize,
1018
974
  ${expectedStatuses}${pagingOptionsStr}
1019
975
  );
1020
- `
1021
- ]
976
+ `,
977
+ ],
1022
978
  };
1023
979
  }
1024
980
  function buildLroReturnType(context, operation) {
@@ -1027,23 +983,21 @@ function buildLroReturnType(context, operation) {
1027
983
  const type = metadata.finalResponse.result;
1028
984
  return {
1029
985
  name: type.name,
1030
- type: getTypeExpression(context, type)
986
+ type: getTypeExpression(context, type),
1031
987
  };
1032
988
  }
1033
989
  return { name: "", type: "void" };
1034
990
  }
1035
991
  function buildLroPagingReturnType(context, operation) {
1036
- var _a, _b;
1037
- if (((_a = operation.response.type) === null || _a === void 0 ? void 0 : _a.kind) === "array") {
992
+ if (operation.response.type?.kind === "array") {
1038
993
  return {
1039
- name: (_b = operation.response.type.valueType.name) !== null && _b !== void 0 ? _b : "",
1040
- type: getTypeExpression(context, operation.response.type.valueType)
994
+ name: operation.response.type.valueType.name ?? "",
995
+ type: getTypeExpression(context, operation.response.type.valueType),
1041
996
  };
1042
997
  }
1043
998
  return { name: "", type: "void" };
1044
999
  }
1045
1000
  function getPagingOnlyOperationFunction(context, method, clientType) {
1046
- var _a;
1047
1001
  const operation = method[1];
1048
1002
  // Extract required parameters
1049
1003
  const parameters = getOperationSignatureParameters(context, method, clientType);
@@ -1053,8 +1007,8 @@ function getPagingOnlyOperationFunction(context, method, clientType) {
1053
1007
  if (response.type && response.type.kind === "array") {
1054
1008
  const type = response.type;
1055
1009
  returnType = {
1056
- name: (_a = type.valueType.name) !== null && _a !== void 0 ? _a : "",
1057
- type: getTypeExpression(context, type.valueType)
1010
+ name: type.valueType.name ?? "",
1011
+ type: getTypeExpression(context, type.valueType),
1058
1012
  };
1059
1013
  }
1060
1014
  const { name, fixme = [] } = getOperationName(operation, context);
@@ -1062,28 +1016,29 @@ function getPagingOnlyOperationFunction(context, method, clientType) {
1062
1016
  const buildPagedAsyncIteratorReference = resolveReference(PagingHelpers.BuildPagedAsyncIterator);
1063
1017
  const functionStatement = {
1064
1018
  kind: StructureKind.Function,
1065
- docs: [
1066
- ...getDocsFromDescription(operation.doc),
1067
- ...getFixmeForMultilineDocs(fixme)
1068
- ],
1019
+ docs: [...getDocsFromDescription(operation.doc), ...getFixmeForMultilineDocs(fixme)],
1069
1020
  isAsync: false,
1070
1021
  isExported: true,
1071
1022
  name,
1072
1023
  propertyName: normalizeName(operation.name, NameType.Property),
1073
1024
  parameters,
1074
- returnType: `${pagedAsyncIterableIteratorReference}<${returnType.type}>`
1025
+ returnType: `${pagedAsyncIterableIteratorReference}<${returnType.type}>`,
1075
1026
  };
1076
1027
  const statements = [];
1077
1028
  const options = [];
1078
1029
  // TODO: follow up on https://github.com/Azure/typespec-azure/issues/2103
1079
1030
  const nextLinkSegments = operation.pagingMetadata.nextLinkSegments;
1080
- const nextLinkName = nextLinkSegments === null || nextLinkSegments === void 0 ? void 0 : nextLinkSegments.map((property) => {
1031
+ const nextLinkName = nextLinkSegments
1032
+ ?.map((property) => {
1081
1033
  return property.name;
1082
- }).join(".");
1034
+ })
1035
+ .join(".");
1083
1036
  const itemSegments = operation.response.resultSegments;
1084
- const itemName = itemSegments === null || itemSegments === void 0 ? void 0 : itemSegments.map((property) => {
1037
+ const itemName = itemSegments
1038
+ ?.map((property) => {
1085
1039
  return property.name;
1086
- }).join(".");
1040
+ })
1041
+ .join(".");
1087
1042
  // Check for nextLinkVerb from TCGC pagingMetadata (supports @Legacy.nextLinkVerb decorator)
1088
1043
  const nextLinkMethod = operation.pagingMetadata.nextLinkVerb;
1089
1044
  const apiVersion = getApiVersionExpression(context, operation);
@@ -1107,7 +1062,7 @@ function getPagingOnlyOperationFunction(context, method, clientType) {
1107
1062
  );`);
1108
1063
  return {
1109
1064
  ...functionStatement,
1110
- statements
1065
+ statements,
1111
1066
  };
1112
1067
  }
1113
1068
  export function getOperationOptionsName(method, includeGroupName = false) {
@@ -1132,7 +1087,7 @@ function getHeaderAndBodyParameters(dpgContext, operation, optionalParamName = "
1132
1087
  const contentTypeParameter = operation.operation.parameters.find(isContentType);
1133
1088
  const parametersImplementation = {
1134
1089
  header: [],
1135
- body: []
1090
+ body: [],
1136
1091
  };
1137
1092
  for (const param of operationParameters) {
1138
1093
  if (param.kind === "header") {
@@ -1147,13 +1102,12 @@ function getHeaderAndBodyParameters(dpgContext, operation, optionalParamName = "
1147
1102
  continue;
1148
1103
  }
1149
1104
  // Check if this parameter still exists in the corresponding method params (after override)
1150
- if (param.methodParameterSegments &&
1151
- param.methodParameterSegments.length > 0) {
1105
+ if (param.methodParameterSegments && param.methodParameterSegments.length > 0) {
1152
1106
  const paramAccessor = getParamAccessor(param, optionalParamName);
1153
1107
  parametersImplementation[param.kind].push({
1154
1108
  paramMap: getParameterMap(dpgContext, param, paramAccessor),
1155
1109
  param,
1156
- paramAccessor
1110
+ paramAccessor,
1157
1111
  });
1158
1112
  }
1159
1113
  }
@@ -1167,8 +1121,7 @@ function getHeaderAndBodyParameters(dpgContext, operation, optionalParamName = "
1167
1121
  .map((i) => buildHeaderParameter(dpgContext.program, i.paramMap, i.param, i.paramAccessor))
1168
1122
  .join(",\n")}, ...${optionalParamName}.requestOptions?.headers },`;
1169
1123
  }
1170
- if (operation.operation.bodyParam === undefined &&
1171
- parametersImplementation.body.length) {
1124
+ if (operation.operation.bodyParam === undefined && parametersImplementation.body.length) {
1172
1125
  paramStr = `${paramStr}\nbody: {${parametersImplementation.body
1173
1126
  .map((i) => i.paramMap)
1174
1127
  .join(",\n")}}`;
@@ -1184,7 +1137,7 @@ function buildHeaderParameter(program, paramMap, param, paramAccessor) {
1184
1137
  if (!effectiveOptional && isTypeNullable(param.type) === true) {
1185
1138
  reportDiagnostic(program, {
1186
1139
  code: "nullable-required-header",
1187
- target: NoTarget
1140
+ target: NoTarget,
1188
1141
  });
1189
1142
  return paramMap;
1190
1143
  }
@@ -1199,9 +1152,7 @@ function buildHeaderParameter(program, paramMap, param, paramAccessor) {
1199
1152
  if (isTypeNullable(param.type) === true) {
1200
1153
  conditions.push(`${paramAccessor} !== null`);
1201
1154
  }
1202
- return conditions.length > 0
1203
- ? `...(${conditions.join(" && ")} ? {${paramMap}} : {})`
1204
- : paramMap;
1155
+ return conditions.length > 0 ? `...(${conditions.join(" && ")} ? {${paramMap}} : {})` : paramMap;
1205
1156
  }
1206
1157
  function buildBodyParameter(context, bodyParameter, optionalParamName = "options") {
1207
1158
  if (!bodyParameter || !bodyParameter.type) {
@@ -1218,14 +1169,14 @@ function buildBodyParameter(context, bodyParameter, optionalParamName = "options
1218
1169
  // Use XML serializer
1219
1170
  serializerFunctionName = buildXmlModelSerializer(context, bodyType, {
1220
1171
  nameOnly: true,
1221
- skipDiscriminatedUnionSuffix: false
1172
+ skipDiscriminatedUnionSuffix: false,
1222
1173
  });
1223
1174
  }
1224
1175
  else {
1225
1176
  // Use JSON serializer (default)
1226
1177
  serializerFunctionName = buildModelSerializer(context, bodyType, {
1227
1178
  nameOnly: true,
1228
- skipDiscriminatedUnionSuffix: false
1179
+ skipDiscriminatedUnionSuffix: false,
1229
1180
  });
1230
1181
  }
1231
1182
  let bodyNameExpression = getParamAccessor(bodyParameter, optionalParamName);
@@ -1247,16 +1198,14 @@ function buildBodyParameter(context, bodyParameter, optionalParamName = "options
1247
1198
  ? `!${bodyNameExpression}? ${bodyNameExpression}:`
1248
1199
  : "";
1249
1200
  // For dual-format operations, check the contentType option at runtime
1250
- if (isDualFormat &&
1251
- bodyType.kind === "model" &&
1252
- hasXmlSerialization(bodyType)) {
1201
+ if (isDualFormat && bodyType.kind === "model" && hasXmlSerialization(bodyType)) {
1253
1202
  const xmlSerializerName = buildXmlModelSerializer(context, bodyType, {
1254
1203
  nameOnly: true,
1255
- skipDiscriminatedUnionSuffix: false
1204
+ skipDiscriminatedUnionSuffix: false,
1256
1205
  });
1257
1206
  const jsonSerializerName = buildModelSerializer(context, bodyType, {
1258
1207
  nameOnly: true,
1259
- skipDiscriminatedUnionSuffix: false
1208
+ skipDiscriminatedUnionSuffix: false,
1260
1209
  });
1261
1210
  if (xmlSerializerName && jsonSerializerName) {
1262
1211
  const isXmlContentTypeRef = resolveReference(XmlHelpers.isXmlContentType);
@@ -1276,9 +1225,8 @@ function buildBodyParameter(context, bodyParameter, optionalParamName = "options
1276
1225
  return `\nbody: ${serializedBody.startsWith(nullOrUndefinedPrefix) ? "" : nullOrUndefinedPrefix}${serializedBody},`;
1277
1226
  }
1278
1227
  function getEncodingFormat(type) {
1279
- var _a;
1280
1228
  const supportedFormats = ["base64url", "base64", "byte"];
1281
- if (!supportedFormats.includes((_a = type.format) !== null && _a !== void 0 ? _a : "")) {
1229
+ if (!supportedFormats.includes(type.format ?? "")) {
1282
1230
  return "base64";
1283
1231
  }
1284
1232
  return type.format;
@@ -1287,18 +1235,15 @@ function getEncodingFormat(type) {
1287
1235
  * This function helps with renames, translating client names to rest api names
1288
1236
  */
1289
1237
  export function getParameterMap(context, param, paramAccessor) {
1290
- var _a;
1291
1238
  // Use lowercase for header names since HTTP headers are case-insensitive
1292
- const serializedName = param.kind === "header"
1293
- ? getHeaderSerializedName(param)
1294
- : getPropertySerializedName(param);
1239
+ const serializedName = param.kind === "header" ? getHeaderSerializedName(param) : getPropertySerializedName(param);
1295
1240
  if (isConstant(param.type) && !isOptional(param)) {
1296
1241
  return `"${serializedName}": ${getConstantValue(param.type)}`;
1297
1242
  }
1298
1243
  // Special case for api-version parameters with default values
1299
1244
  if (param.isApiVersionParam && param.clientDefaultValue) {
1300
1245
  // For multi-service, use only the default value (don't reference context.apiVersion)
1301
- if ((_a = context.rlcOptions) === null || _a === void 0 ? void 0 : _a.isMultiService) {
1246
+ if (context.rlcOptions?.isMultiService) {
1302
1247
  return `"${serializedName}": "${param.clientDefaultValue}"`;
1303
1248
  }
1304
1249
  return `"${serializedName}": ${param.onClient ? "context." : ""}${param.name} ?? "${param.clientDefaultValue}"`;
@@ -1317,9 +1262,9 @@ export function getParameterMap(context, param, paramAccessor) {
1317
1262
  code: "unsupported-parameter-type",
1318
1263
  format: {
1319
1264
  paramName: param.name,
1320
- paramKind: param.kind
1265
+ paramKind: param.kind,
1321
1266
  },
1322
- target: param.__raw || NoTarget
1267
+ target: param.__raw || NoTarget,
1323
1268
  });
1324
1269
  // Return a fallback value to allow the emitter to continue
1325
1270
  return `"${param.name}": undefined`;
@@ -1329,8 +1274,7 @@ function getCollectionFormatForParam(context, param, paramAccessor, serializedNa
1329
1274
  return `"${serializedName}": ${serializeRequestValue(context, param.type, paramAccessor, !param.optional, format, serializedName, true)}`;
1330
1275
  }
1331
1276
  function isContentType(param) {
1332
- return (param.kind === "header" &&
1333
- param.serializedName.toLowerCase() === "content-type");
1277
+ return param.kind === "header" && param.serializedName.toLowerCase() === "content-type";
1334
1278
  }
1335
1279
  function getContentTypeValue(param, optionalParamName = "options") {
1336
1280
  const defaultValue = param.clientDefaultValue;
@@ -1355,15 +1299,14 @@ function getContentTypeValue(param, optionalParamName = "options") {
1355
1299
  * For client-level parameters (onClient), preserve the HTTP parameter's own flag.
1356
1300
  */
1357
1301
  function getEffectiveOptional(param) {
1358
- var _a, _b;
1359
1302
  // For client-level parameters, the HTTP parameter's optional flag is authoritative
1360
1303
  if (param.onClient) {
1361
1304
  return Boolean(param.optional);
1362
1305
  }
1363
1306
  // For method-level parameters with a direct mapping to a single method param,
1364
1307
  // use the method parameter's optional flag (correctly reflects @@override changes)
1365
- if (((_a = param.methodParameterSegments) === null || _a === void 0 ? void 0 : _a.length) === 1 &&
1366
- ((_b = param.methodParameterSegments[0]) === null || _b === void 0 ? void 0 : _b.length) === 1) {
1308
+ if (param.methodParameterSegments?.length === 1 &&
1309
+ param.methodParameterSegments[0]?.length === 1) {
1367
1310
  const methodParam = param.methodParameterSegments[0][0];
1368
1311
  if (methodParam) {
1369
1312
  return Boolean(methodParam.optional);
@@ -1428,14 +1371,13 @@ function getDefaultValue(param) {
1428
1371
  * Extracts the path parameters
1429
1372
  */
1430
1373
  function getPathParameters(operation, optionalParamName = "options") {
1431
- var _a;
1432
1374
  if (!operation.operation.parameters) {
1433
1375
  return [];
1434
1376
  }
1435
1377
  const pathParams = [];
1436
1378
  for (const param of operation.operation.parameters) {
1437
1379
  if (param.kind === "path") {
1438
- const methodParam = (_a = param.methodParameterSegments[0]) === null || _a === void 0 ? void 0 : _a[0];
1380
+ const methodParam = param.methodParameterSegments[0]?.[0];
1439
1381
  if (methodParam) {
1440
1382
  pathParams.push(`"${param.serializedName}": ${getPathParamExpr(param, getDefaultValue(param), optionalParamName)}`);
1441
1383
  }
@@ -1452,22 +1394,21 @@ function getQueryParameters(dpgContext, operation) {
1452
1394
  }
1453
1395
  const operationParameters = operation.operation.parameters.filter((p) => !isContentType(p));
1454
1396
  const parametersImplementation = {
1455
- query: []
1397
+ query: [],
1456
1398
  };
1457
1399
  for (const param of operationParameters) {
1458
1400
  if (param.kind === "query") {
1459
1401
  // Check if this parameter still exists in the corresponding method params (after override)
1460
- if (param.methodParameterSegments &&
1461
- param.methodParameterSegments.length > 0) {
1402
+ if (param.methodParameterSegments && param.methodParameterSegments.length > 0) {
1462
1403
  const paramAccessor = getParamAccessor(param);
1463
1404
  parametersImplementation[param.kind].push({
1464
1405
  paramMap: getParameterMap(dpgContext, {
1465
1406
  ...param,
1466
1407
  // TODO: remember to remove this hack once compiler gives us a name
1467
1408
  // https://github.com/microsoft/typespec/issues/6743
1468
- serializedName: getUriTemplateQueryParamName(param.serializedName)
1409
+ serializedName: getUriTemplateQueryParamName(param.serializedName),
1469
1410
  }, paramAccessor),
1470
- param
1411
+ param,
1471
1412
  });
1472
1413
  }
1473
1414
  }
@@ -1497,9 +1438,7 @@ function getParamAccessor(param, optionalParamName = "options") {
1497
1438
  const methodParamExpr = getMethodParamExpr(param, optionalParamName);
1498
1439
  const clientPrefix = "context.";
1499
1440
  if (methodParamExpr) {
1500
- return param.onClient
1501
- ? `${clientPrefix}${methodParamExpr}`
1502
- : methodParamExpr;
1441
+ return param.onClient ? `${clientPrefix}${methodParamExpr}` : methodParamExpr;
1503
1442
  }
1504
1443
  if (param.onClient) {
1505
1444
  return `${clientPrefix}${getClientParameterName(param)}`;
@@ -1578,15 +1517,14 @@ function getEncodeForModelProperty(context, property) {
1578
1517
  code: "un-supported-array-encoding",
1579
1518
  format: {
1580
1519
  arrayName: property.name,
1581
- arrayType: property.type.valueType.kind
1520
+ arrayType: property.type.valueType.kind,
1582
1521
  },
1583
- target: NoTarget
1522
+ target: NoTarget,
1584
1523
  });
1585
1524
  return getEncodeForType(property.type);
1586
1525
  }
1587
1526
  const collectionFormat = getCollectionFormatFromArrayEncoding(property.encode);
1588
- if (collectionFormat &&
1589
- hasCollectionFormatInfo(property.kind, collectionFormat)) {
1527
+ if (collectionFormat && hasCollectionFormatInfo(property.kind, collectionFormat)) {
1590
1528
  return collectionFormat;
1591
1529
  }
1592
1530
  }
@@ -1602,8 +1540,7 @@ function isStringEncodableArrayValueType(valueType) {
1602
1540
  return true;
1603
1541
  }
1604
1542
  // String-based enum type
1605
- if (valueType.kind === "enum" &&
1606
- valueType.valueType.kind === "string") {
1543
+ if (valueType.kind === "enum" && valueType.valueType.kind === "string") {
1607
1544
  return true;
1608
1545
  }
1609
1546
  return false;
@@ -1611,14 +1548,12 @@ function isStringEncodableArrayValueType(valueType) {
1611
1548
  function getSerializationExpressionForFlatten(context, property, propertyPath) {
1612
1549
  const serializeFunctionName = buildPropertySerializer(context, property, {
1613
1550
  nameOnly: true,
1614
- skipDiscriminatedUnionSuffix: false
1551
+ skipDiscriminatedUnionSuffix: false,
1615
1552
  });
1616
1553
  if (!serializeFunctionName) {
1617
1554
  return property.optional ? `undefined` : `{}`;
1618
1555
  }
1619
- const validProps = getAllProperties(context, property.type, getAllAncestors(property.type)).filter((p) => p.kind === "property" &&
1620
- !isReadOnly(p) &&
1621
- !isMetadata(context.program, p.__raw));
1556
+ const validProps = getAllProperties(context, property.type, getAllAncestors(property.type)).filter((p) => p.kind === "property" && !isReadOnly(p) && !isMetadata(context.program, p.__raw));
1622
1557
  const optionalPrefix = property.optional
1623
1558
  ? `${resolveReference(SerializationHelpers.areAllPropsUndefined)}(${propertyPath}, [${validProps
1624
1559
  .map((p) => `"${p.name}"`)
@@ -1636,7 +1571,7 @@ export function getSerializationExpression(context, property, propertyPath, enab
1636
1571
  const propertyFullName = getPropertyFullName(context, property, propertyPathWithDot);
1637
1572
  const serializeFunctionName = buildModelSerializer(context, getNullableValidType(property.type), {
1638
1573
  nameOnly: true,
1639
- skipDiscriminatedUnionSuffix: false
1574
+ skipDiscriminatedUnionSuffix: false,
1640
1575
  });
1641
1576
  // Apply clientDefaultValue for model properties that have one
1642
1577
  const defaultValueSuffix = hasEffectiveClientDefaultValue(property)
@@ -1654,10 +1589,9 @@ export function getSerializationExpression(context, property, propertyPath, enab
1654
1589
  }
1655
1590
  }
1656
1591
  export function getRequestModelProperties(context, modelPropertyType, propertyPath = "body", overrides, enableFlatten = true) {
1657
- var _a;
1658
1592
  const props = [];
1659
1593
  const allParents = getAllAncestors(modelPropertyType);
1660
- const properties = (_a = getAllProperties(context, modelPropertyType, allParents)) !== null && _a !== void 0 ? _a : [];
1594
+ const properties = getAllProperties(context, modelPropertyType, allParents) ?? [];
1661
1595
  if (properties.length <= 0) {
1662
1596
  return [];
1663
1597
  }
@@ -1671,7 +1605,7 @@ export function getRequestModelProperties(context, modelPropertyType, propertyPa
1671
1605
  const property = getPropertyWithOverrides(prop, overrides);
1672
1606
  props.push([
1673
1607
  getPropertySerializedName(property),
1674
- getSerializationExpression(context, property, propertyPath, enableFlatten)
1608
+ getSerializationExpression(context, property, propertyPath, enableFlatten),
1675
1609
  ]);
1676
1610
  }
1677
1611
  return props;
@@ -1685,10 +1619,9 @@ export function getRequestModelMapping(context, modelPropertyType, propertyPath
1685
1619
  return getRequestModelProperties(context, modelPropertyType, propertyPath, overrides, enableFlatten).map(([name, value]) => `"${name}": ${value}`);
1686
1620
  }
1687
1621
  export function getPropertySerializedName(property) {
1688
- var _a, _b;
1689
- return ((_b = (property.kind === "property"
1690
- ? (_a = property.serializationOptions.json) === null || _a === void 0 ? void 0 : _a.name
1691
- : property.serializedName)) !== null && _b !== void 0 ? _b : property.name);
1622
+ return ((property.kind === "property"
1623
+ ? property.serializationOptions.json?.name
1624
+ : property.serializedName) ?? property.name);
1692
1625
  }
1693
1626
  /**
1694
1627
  * Get the serialized name for a header parameter, normalized to lowercase.
@@ -1713,19 +1646,17 @@ export function getResponseMapping(context, type, propertyPath = "result.body",
1713
1646
  const dot = propertyPath.endsWith("?") ? "." : "";
1714
1647
  const serializedName = getPropertySerializedName(property);
1715
1648
  const restValue = `${propertyPath ? `${propertyPath}${dot}` : `${dot}`}["${serializedName}"]`;
1716
- const nullOrUndefinedPrefix = property.optional || isTypeNullable(property.type)
1717
- ? `!${restValue}? ${restValue}: `
1718
- : "";
1649
+ const nullOrUndefinedPrefix = property.optional || isTypeNullable(property.type) ? `!${restValue}? ${restValue}: ` : "";
1719
1650
  const flattenContext = useContext("sdkTypes").flattenProperties.get(property);
1720
1651
  const isSupportedFlatten = flattenContext && enableFlatten;
1721
1652
  const deserializeFunctionName = isSupportedFlatten
1722
1653
  ? buildPropertyDeserializer(context, property, {
1723
1654
  nameOnly: true,
1724
- skipDiscriminatedUnionSuffix: false
1655
+ skipDiscriminatedUnionSuffix: false,
1725
1656
  })
1726
1657
  : buildModelDeserializer(context, getNullableValidType(property.type), {
1727
1658
  nameOnly: true,
1728
- skipDiscriminatedUnionSuffix: false
1659
+ skipDiscriminatedUnionSuffix: false,
1729
1660
  });
1730
1661
  const propertyName = normalizeModelPropertyName(context, property);
1731
1662
  if (deserializeFunctionName) {
@@ -1750,7 +1681,6 @@ export function getResponseMapping(context, type, propertyPath = "result.body",
1750
1681
  * Converts JavaScript values to their serialized wire format for HTTP requests.
1751
1682
  */
1752
1683
  export function serializeRequestValue(context, type, clientValue, required, format, serializedName, isTopLevel = false) {
1753
- var _a, _b, _c, _d, _e;
1754
1684
  const getSdkType = useSdkTypes();
1755
1685
  const dependencies = useDependencies();
1756
1686
  const nullOrUndefinedPrefix = isTypeNullable(type) || getOptionalForType(type) || !required
@@ -1761,7 +1691,7 @@ export function serializeRequestValue(context, type, clientValue, required, form
1761
1691
  // plainDate always uses ISO8601 format (YYYY-MM-DD)
1762
1692
  return `${nullOrUndefinedPrefix}${clientValue}.toISOString().split('T')[0]`;
1763
1693
  case "utcDateTime":
1764
- switch ((_a = type.encode) !== null && _a !== void 0 ? _a : format) {
1694
+ switch (type.encode ?? format) {
1765
1695
  case "rfc7231":
1766
1696
  return `${nullOrUndefinedPrefix}${clientValue}.toUTCString()`;
1767
1697
  case "unixTimestamp":
@@ -1773,12 +1703,10 @@ export function serializeRequestValue(context, type, clientValue, required, form
1773
1703
  case "array": {
1774
1704
  if (type.valueType) {
1775
1705
  const prefix = nullOrUndefinedPrefix + clientValue;
1776
- const elementNullOrUndefinedPrefix = isTypeNullable(type.valueType) || getOptionalForType(type.valueType)
1777
- ? "!p ? p : "
1778
- : "";
1706
+ const elementNullOrUndefinedPrefix = isTypeNullable(type.valueType) || getOptionalForType(type.valueType) ? "!p ? p : " : "";
1779
1707
  const serializeFunctionName = buildModelSerializer(context, getNullableValidType(type.valueType), {
1780
1708
  nameOnly: true,
1781
- skipDiscriminatedUnionSuffix: false
1709
+ skipDiscriminatedUnionSuffix: false,
1782
1710
  });
1783
1711
  if (serializeFunctionName) {
1784
1712
  return `${prefix}.map((p: any) => { return ${elementNullOrUndefinedPrefix}${serializeFunctionName}(p)})`;
@@ -1791,7 +1719,7 @@ export function serializeRequestValue(context, type, clientValue, required, form
1791
1719
  if (format) {
1792
1720
  const formatHelper = getCollectionFormatHelper(format);
1793
1721
  if (formatHelper) {
1794
- if ((format === null || format === void 0 ? void 0 : format.toLowerCase()) === KnownCollectionFormat.Multi) {
1722
+ if (format?.toLowerCase() === KnownCollectionFormat.Multi) {
1795
1723
  return `${nullOrUndefinedPrefix}${formatHelper}(${serializedValue}, "${serializedName}")`;
1796
1724
  }
1797
1725
  return `${nullOrUndefinedPrefix}${formatHelper}(${serializedValue})`;
@@ -1807,8 +1735,8 @@ export function serializeRequestValue(context, type, clientValue, required, form
1807
1735
  if (format !== "binary" && format !== "bytes") {
1808
1736
  const uint8ArrayToStringReference = resolveReference(dependencies.uint8ArrayToString);
1809
1737
  return required
1810
- ? `${getNullableCheck(clientValue, type)} ${uint8ArrayToStringReference}(${clientValue}, "${(_b = getEncodingFormat({ format })) !== null && _b !== void 0 ? _b : "base64"}")`
1811
- : `${nullOrUndefinedPrefix} ${uint8ArrayToStringReference}(${clientValue}, "${(_c = getEncodingFormat({ format })) !== null && _c !== void 0 ? _c : "base64"}")`;
1738
+ ? `${getNullableCheck(clientValue, type)} ${uint8ArrayToStringReference}(${clientValue}, "${getEncodingFormat({ format }) ?? "base64"}")`
1739
+ : `${nullOrUndefinedPrefix} ${uint8ArrayToStringReference}(${clientValue}, "${getEncodingFormat({ format }) ?? "base64"}")`;
1812
1740
  }
1813
1741
  return clientValue;
1814
1742
  case "union":
@@ -1817,7 +1745,7 @@ export function serializeRequestValue(context, type, clientValue, required, form
1817
1745
  }
1818
1746
  else if (isSpecialHandledUnion({
1819
1747
  ...type,
1820
- isNonExhaustive: (_e = (_d = context.rlcOptions) === null || _d === void 0 ? void 0 : _d.experimentalExtensibleEnums) !== null && _e !== void 0 ? _e : false
1748
+ isNonExhaustive: context.rlcOptions?.experimentalExtensibleEnums ?? false,
1821
1749
  })) {
1822
1750
  const sdkType = getSdkType(type.__raw);
1823
1751
  const serializerRefkey = refkey(sdkType, "serializer");
@@ -1881,7 +1809,7 @@ export function deserializeResponseHeadersValue(context, type, restValue, requir
1881
1809
  const deserializeFunctionName = type
1882
1810
  ? buildModelDeserializer(context, getNullableValidType(type), {
1883
1811
  nameOnly: true,
1884
- skipDiscriminatedUnionSuffix: false
1812
+ skipDiscriminatedUnionSuffix: false,
1885
1813
  })
1886
1814
  : undefined;
1887
1815
  if (deserializeFunctionName) {
@@ -1928,14 +1856,13 @@ export function deserializeResponseValue(context, type, restValue, required, for
1928
1856
  const deserializeFunctionName = type.valueType
1929
1857
  ? buildModelDeserializer(context, getNullableValidType(type.valueType), {
1930
1858
  nameOnly: true,
1931
- skipDiscriminatedUnionSuffix: false
1859
+ skipDiscriminatedUnionSuffix: false,
1932
1860
  })
1933
1861
  : undefined;
1934
1862
  if (deserializeFunctionName) {
1935
1863
  return `${prefix}.map((${varName}: any) => { return ${elementNullOrUndefinedPrefix}${deserializeFunctionName}(${varName})})`;
1936
1864
  }
1937
- else if (type.valueType &&
1938
- isAzureCoreErrorType(context.program, type.valueType.__raw)) {
1865
+ else if (type.valueType && isAzureCoreErrorType(context.program, type.valueType.__raw)) {
1939
1866
  return `${prefix}.map((${varName}: any) => { return ${elementNullOrUndefinedPrefix}${varName}})`;
1940
1867
  }
1941
1868
  else if (type.valueType) {
@@ -1946,8 +1873,7 @@ export function deserializeResponseValue(context, type, restValue, required, for
1946
1873
  const optionalPrefixForString = isTypeNullable(type) || getOptionalForType(type) || !required
1947
1874
  ? `${restValue} === null || ${restValue} === undefined ? ${restValue}: `
1948
1875
  : "";
1949
- if (type.valueType.kind === "enum" &&
1950
- !isExtensibleEnum(context, type.valueType)) {
1876
+ if (type.valueType.kind === "enum" && !isExtensibleEnum(context, type.valueType)) {
1951
1877
  // Special handling for non-extensible enums to cast the result to the correct type
1952
1878
  return `${optionalPrefixForString}${parseHelper}(${restValue}) as ${getTypeExpression(context, type)}`;
1953
1879
  }
@@ -1973,14 +1899,13 @@ export function deserializeResponseValue(context, type, restValue, required, for
1973
1899
  const deserializeFunctionName = type.valueType
1974
1900
  ? buildModelDeserializer(context, getNullableValidType(type.valueType), {
1975
1901
  nameOnly: true,
1976
- skipDiscriminatedUnionSuffix: false
1902
+ skipDiscriminatedUnionSuffix: false,
1977
1903
  })
1978
1904
  : undefined;
1979
1905
  if (deserializeFunctionName) {
1980
1906
  return `${nullOrUndefinedPrefix}Object.fromEntries(Object.entries(${restValue}).map(([${keyVar}, ${valueVar}]: [string, any]) => [${keyVar}, ${elementNullOrUndefinedPrefix}${deserializeFunctionName}(${valueVar})]))`;
1981
1907
  }
1982
- else if (type.valueType &&
1983
- isAzureCoreErrorType(context.program, type.valueType.__raw)) {
1908
+ else if (type.valueType && isAzureCoreErrorType(context.program, type.valueType.__raw)) {
1984
1909
  return `${nullOrUndefinedPrefix}Object.fromEntries(Object.entries(${restValue}).map(([${keyVar}, ${valueVar}]: [string, any]) => [${keyVar}, ${elementNullOrUndefinedPrefix}${valueVar}]))`;
1985
1910
  }
1986
1911
  else if (type.valueType) {
@@ -1993,7 +1918,7 @@ export function deserializeResponseValue(context, type, restValue, required, for
1993
1918
  case "bytes":
1994
1919
  if (format !== "binary" && format !== "bytes") {
1995
1920
  return `${nullOrUndefinedPrefix}typeof ${restValue} === 'string'
1996
- ? ${stringToUint8ArrayReference}(${restValue}, "${format !== null && format !== void 0 ? format : "base64"}")
1921
+ ? ${stringToUint8ArrayReference}(${restValue}, "${format ?? "base64"}")
1997
1922
  : ${restValue}`;
1998
1923
  }
1999
1924
  return restValue;
@@ -2005,7 +1930,7 @@ export function deserializeResponseValue(context, type, restValue, required, for
2005
1930
  const deserializeFunctionName = type
2006
1931
  ? buildModelDeserializer(context, getNullableValidType(type), {
2007
1932
  nameOnly: true,
2008
- skipDiscriminatedUnionSuffix: false
1933
+ skipDiscriminatedUnionSuffix: false,
2009
1934
  })
2010
1935
  : undefined;
2011
1936
  if (deserializeFunctionName) {
@@ -2040,7 +1965,7 @@ export function getAllProperties(context, type, parents) {
2040
1965
  if (!type) {
2041
1966
  return [];
2042
1967
  }
2043
- parents === null || parents === void 0 ? void 0 : parents.forEach((p) => {
1968
+ parents?.forEach((p) => {
2044
1969
  getAllProperties(context, p).forEach((prop) => {
2045
1970
  propertiesMap.set(prop.name, prop);
2046
1971
  });
@@ -2120,9 +2045,7 @@ export function getPropertySerializationPrefix(context, property, propertyPath)
2120
2045
  export function getPropertyFullName(context, property, propertyPath) {
2121
2046
  const normalizedPropertyName = propertyPath === ""
2122
2047
  ? normalizeName(property.name, NameType.Parameter, true)
2123
- : normalizeModelPropertyName(context, property)
2124
- .replace(/^"/g, "")
2125
- .replace(/"$/g, "");
2048
+ : normalizeModelPropertyName(context, property).replace(/^"/g, "").replace(/"$/g, "");
2126
2049
  let fullName = normalizedPropertyName;
2127
2050
  if (propertyPath === "" && property.optional) {
2128
2051
  fullName = `options?.${normalizedPropertyName}`;
@@ -2165,13 +2088,12 @@ export function getExpectedStatuses(operation) {
2165
2088
  * @returns The apiVersion expression string, or undefined if no apiVersion query param exists
2166
2089
  */
2167
2090
  function getApiVersionExpression(dpgContext, operation) {
2168
- var _a;
2169
2091
  const queryApiVersionParam = operation.operation.parameters.find((p) => p.kind === "query" && p.isApiVersionParam);
2170
2092
  if (!queryApiVersionParam) {
2171
2093
  return undefined;
2172
2094
  }
2173
2095
  // For multi-service, use only the default value (don't reference context.apiVersion)
2174
- if ((_a = dpgContext.rlcOptions) === null || _a === void 0 ? void 0 : _a.isMultiService) {
2096
+ if (dpgContext.rlcOptions?.isMultiService) {
2175
2097
  return queryApiVersionParam.clientDefaultValue
2176
2098
  ? `"${queryApiVersionParam.clientDefaultValue}"`
2177
2099
  : undefined;
@@ -2188,13 +2110,12 @@ function getApiVersionExpression(dpgContext, operation) {
2188
2110
  * @returns Array of unique response headers
2189
2111
  */
2190
2112
  export function getResponseHeaders(responses) {
2191
- var _a, _b;
2192
2113
  const headerMap = new Map();
2193
- for (const response of responses !== null && responses !== void 0 ? responses : []) {
2194
- for (const header of (_a = response.headers) !== null && _a !== void 0 ? _a : []) {
2114
+ for (const response of responses ?? []) {
2115
+ for (const header of response.headers ?? []) {
2195
2116
  if (shouldSkipHeaderSerialization(header))
2196
2117
  continue;
2197
- const key = (_b = header.serializedName) !== null && _b !== void 0 ? _b : header.name;
2118
+ const key = header.serializedName ?? header.name;
2198
2119
  if (!headerMap.has(key)) {
2199
2120
  headerMap.set(key, header);
2200
2121
  }
@@ -2262,8 +2183,7 @@ function buildHeaderOnlyResponseType(context, headers) {
2262
2183
  */
2263
2184
  function buildHeaderOnlyResponseValue(context, headers) {
2264
2185
  const props = headers.map((header) => {
2265
- var _a;
2266
- const headerName = ((_a = header.serializedName) !== null && _a !== void 0 ? _a : header.name).toLowerCase();
2186
+ const headerName = (header.serializedName ?? header.name).toLowerCase();
2267
2187
  const key = normalizeModelPropertyName(context, header);
2268
2188
  const value = deserializeResponseHeadersValue(context, header.type, `result.headers[${JSON.stringify(headerName)}]`, !header.optional, getEncodeForType(header.type), 0);
2269
2189
  return `${key}: ${value}`;
@@ -2302,12 +2222,11 @@ export function getOperationResponseTypeName(method) {
2302
2222
  * - any / unknown (no treatAsRecord) → HLC PropertyKind.Primitive
2303
2223
  */
2304
2224
  function isWrappableType(context, type) {
2305
- var _a;
2306
2225
  if (type.kind === "array" && type.valueType.kind === "model")
2307
2226
  return false;
2308
2227
  if (type.kind === "dict" || type.kind === "model")
2309
2228
  return false;
2310
- if (type.kind === "unknown" && ((_a = context.rlcOptions) === null || _a === void 0 ? void 0 : _a.treatUnknownAsRecord))
2229
+ if (type.kind === "unknown" && context.rlcOptions?.treatUnknownAsRecord)
2311
2230
  return false;
2312
2231
  return true;
2313
2232
  }
@@ -2318,11 +2237,10 @@ function isHeadOperation(operation) {
2318
2237
  return operation.operation.verb.toLowerCase() === "head";
2319
2238
  }
2320
2239
  function isHeadAsBooleanOperation(operation) {
2321
- var _a;
2322
2240
  if (!isHeadOperation(operation))
2323
2241
  return false;
2324
2242
  // @responseAsBool: TCGC promotes response.type to SdkBuiltInType { kind: "boolean" }
2325
- if (((_a = operation.response.type) === null || _a === void 0 ? void 0 : _a.kind) === "boolean")
2243
+ if (operation.response.type?.kind === "boolean")
2326
2244
  return true;
2327
2245
  return false;
2328
2246
  }
@@ -2331,25 +2249,24 @@ function isHeadAsBooleanOperation(operation) {
2331
2249
  * Returns an object with `shouldWrap` (whether to wrap) and `isBinary` (whether it's a binary response).
2332
2250
  */
2333
2251
  export function checkWrapNonModelReturn(context, operation) {
2334
- var _a, _b, _c, _d, _e;
2335
2252
  const noWrap = { shouldWrap: false, isBinary: false };
2336
2253
  // LRO+paging and paging-only operations are not wrapped
2337
2254
  if (isLroAndPagingOperation(operation) || isPagingOnlyOperation(operation)) {
2338
2255
  return noWrap;
2339
2256
  }
2340
2257
  // Only if the feature flag is enabled
2341
- if (!((_a = context.rlcOptions) === null || _a === void 0 ? void 0 : _a.wrapNonModelReturn)) {
2258
+ if (!context.rlcOptions?.wrapNonModelReturn) {
2342
2259
  return noWrap;
2343
2260
  }
2344
2261
  // For LRO-only operations, check the final result type from LRO metadata
2345
2262
  if (isLroOnlyOperation(operation)) {
2346
- const lroResultType = (_c = (_b = operation.lroMetadata) === null || _b === void 0 ? void 0 : _b.finalResponse) === null || _c === void 0 ? void 0 : _c.result;
2263
+ const lroResultType = operation.lroMetadata?.finalResponse?.result;
2347
2264
  if (!lroResultType) {
2348
2265
  return noWrap; // void LRO - no wrap needed
2349
2266
  }
2350
2267
  return {
2351
2268
  shouldWrap: isWrappableType(context, lroResultType),
2352
- isBinary: false
2269
+ isBinary: false,
2353
2270
  };
2354
2271
  }
2355
2272
  const { type } = operation.response;
@@ -2360,11 +2277,10 @@ export function checkWrapNonModelReturn(context, operation) {
2360
2277
  }
2361
2278
  return noWrap; // void return type - no wrap needed
2362
2279
  }
2363
- const contentTypes = (_e = (_d = operation.operation.responses[0]) === null || _d === void 0 ? void 0 : _d.contentTypes) !== null && _e !== void 0 ? _e : [];
2280
+ const contentTypes = operation.operation.responses[0]?.contentTypes ?? [];
2364
2281
  // bytes with binary content type → binary wrap (isBinary=true)
2365
2282
  // HLC: bytes → binary payload → separate binary handling
2366
- if (type.__raw &&
2367
- isBinaryPayload(context, type.__raw, contentTypes, getEncodeForType(type))) {
2283
+ if (type.__raw && isBinaryPayload(context, type.__raw, contentTypes, getEncodeForType(type))) {
2368
2284
  return { shouldWrap: true, isBinary: true };
2369
2285
  }
2370
2286
  return { shouldWrap: isWrappableType(context, type), isBinary: false };
@@ -2406,7 +2322,7 @@ export function buildNonModelResponseTypeDeclaration(context, method, isBinary)
2406
2322
  name: typeName,
2407
2323
  type: typeBody,
2408
2324
  isExported: true,
2409
- leadingTrivia: "\n"
2325
+ leadingTrivia: "\n",
2410
2326
  };
2411
2327
  }
2412
2328
  //# sourceMappingURL=operationHelpers.js.map