@azure-tools/typespec-ts 0.54.1 → 0.54.2

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 (1003) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/src/context-manager.d.ts +75 -0
  3. package/dist/src/context-manager.d.ts.map +1 -0
  4. package/dist/src/context-manager.js +59 -0
  5. package/dist/src/context-manager.js.map +1 -0
  6. package/dist/src/framework/hooks/binder.js +3 -3
  7. package/dist/src/framework/hooks/binder.js.map +1 -1
  8. package/dist/src/framework/hooks/sdk-types.d.ts +27 -0
  9. package/dist/src/framework/hooks/sdk-types.d.ts.map +1 -0
  10. package/dist/src/framework/hooks/sdk-types.js +158 -0
  11. package/dist/src/framework/hooks/sdk-types.js.map +1 -0
  12. package/dist/src/framework/hooks/use-dependencies.d.ts +4 -0
  13. package/dist/src/framework/hooks/use-dependencies.d.ts.map +1 -0
  14. package/dist/src/framework/hooks/use-dependencies.js +13 -0
  15. package/dist/src/framework/hooks/use-dependencies.js.map +1 -0
  16. package/dist/src/index.js +23 -23
  17. package/dist/src/index.js.map +1 -1
  18. package/dist/src/meta-tree.d.ts +7 -0
  19. package/dist/src/meta-tree.d.ts.map +1 -0
  20. package/dist/src/meta-tree.js +2 -0
  21. package/dist/src/meta-tree.js.map +1 -0
  22. package/dist/src/modular/build-classical-client.d.ts +6 -0
  23. package/dist/src/modular/build-classical-client.d.ts.map +1 -0
  24. package/dist/src/modular/build-classical-client.js +345 -0
  25. package/dist/src/modular/build-classical-client.js.map +1 -0
  26. package/dist/src/modular/build-classical-operation-groups.d.ts +6 -0
  27. package/dist/src/modular/build-classical-operation-groups.d.ts.map +1 -0
  28. package/dist/src/modular/build-classical-operation-groups.js +48 -0
  29. package/dist/src/modular/build-classical-operation-groups.js.map +1 -0
  30. package/dist/src/modular/build-client-context.d.ts +13 -0
  31. package/dist/src/modular/build-client-context.d.ts.map +1 -0
  32. package/dist/src/modular/build-client-context.js +246 -0
  33. package/dist/src/modular/build-client-context.js.map +1 -0
  34. package/dist/src/modular/build-modular-options.d.ts +6 -0
  35. package/dist/src/modular/build-modular-options.d.ts.map +1 -0
  36. package/dist/src/modular/build-modular-options.js +14 -0
  37. package/dist/src/modular/build-modular-options.js.map +1 -0
  38. package/dist/src/modular/build-operations.d.ts +21 -0
  39. package/dist/src/modular/build-operations.d.ts.map +1 -0
  40. package/dist/src/modular/build-operations.js +172 -0
  41. package/dist/src/modular/build-operations.js.map +1 -0
  42. package/dist/src/modular/build-project-files.d.ts +4 -0
  43. package/dist/src/modular/build-project-files.d.ts.map +1 -0
  44. package/dist/src/modular/build-project-files.js +91 -0
  45. package/dist/src/modular/build-project-files.js.map +1 -0
  46. package/dist/src/modular/build-restore-poller.d.ts +5 -0
  47. package/dist/src/modular/build-restore-poller.d.ts.map +1 -0
  48. package/dist/src/modular/build-restore-poller.js +216 -0
  49. package/dist/src/modular/build-restore-poller.js.map +1 -0
  50. package/dist/src/modular/build-root-index.d.ts +13 -0
  51. package/dist/src/modular/build-root-index.d.ts.map +1 -0
  52. package/dist/src/modular/build-root-index.js +279 -0
  53. package/dist/src/modular/build-root-index.js.map +1 -0
  54. package/dist/src/modular/build-subpath-index.d.ts +16 -0
  55. package/dist/src/modular/build-subpath-index.d.ts.map +1 -0
  56. package/dist/src/modular/build-subpath-index.js +119 -0
  57. package/dist/src/modular/build-subpath-index.js.map +1 -0
  58. package/dist/src/modular/emit-logger-file.d.ts +3 -0
  59. package/dist/src/modular/emit-logger-file.d.ts.map +1 -0
  60. package/dist/src/modular/emit-logger-file.js +18 -0
  61. package/dist/src/modular/emit-logger-file.js.map +1 -0
  62. package/dist/src/modular/emit-models-options.d.ts +5 -0
  63. package/dist/src/modular/emit-models-options.d.ts.map +1 -0
  64. package/dist/src/modular/emit-models-options.js +35 -0
  65. package/dist/src/modular/emit-models-options.js.map +1 -0
  66. package/dist/src/modular/emit-models.d.ts +23 -0
  67. package/dist/src/modular/emit-models.d.ts.map +1 -0
  68. package/dist/src/modular/emit-models.js +864 -0
  69. package/dist/src/modular/emit-models.js.map +1 -0
  70. package/dist/src/modular/emit-samples.d.ts +7 -0
  71. package/dist/src/modular/emit-samples.d.ts.map +1 -0
  72. package/dist/src/modular/emit-samples.js +500 -0
  73. package/dist/src/modular/emit-samples.js.map +1 -0
  74. package/dist/src/modular/emit-tests.d.ts +7 -0
  75. package/dist/src/modular/emit-tests.d.ts.map +1 -0
  76. package/dist/src/modular/emit-tests.js +155 -0
  77. package/dist/src/modular/emit-tests.js.map +1 -0
  78. package/dist/src/modular/helpers/classical-operation-helpers.d.ts +7 -0
  79. package/dist/src/modular/helpers/classical-operation-helpers.d.ts.map +1 -0
  80. package/dist/src/modular/helpers/classical-operation-helpers.js +258 -0
  81. package/dist/src/modular/helpers/classical-operation-helpers.js.map +1 -0
  82. package/dist/src/modular/helpers/client-helpers.d.ts +34 -0
  83. package/dist/src/modular/helpers/client-helpers.d.ts.map +1 -0
  84. package/dist/src/modular/helpers/client-helpers.js +259 -0
  85. package/dist/src/modular/helpers/client-helpers.js.map +1 -0
  86. package/dist/src/modular/helpers/client-option-helpers.d.ts +43 -0
  87. package/dist/src/modular/helpers/client-option-helpers.d.ts.map +1 -0
  88. package/dist/src/modular/helpers/client-option-helpers.js +103 -0
  89. package/dist/src/modular/helpers/client-option-helpers.js.map +1 -0
  90. package/dist/src/modular/helpers/docs-helpers.d.ts +3 -0
  91. package/dist/src/modular/helpers/docs-helpers.d.ts.map +1 -0
  92. package/dist/src/modular/helpers/docs-helpers.js +10 -0
  93. package/dist/src/modular/helpers/docs-helpers.js.map +1 -0
  94. package/dist/src/modular/helpers/example-value-helpers.d.ts +83 -0
  95. package/dist/src/modular/helpers/example-value-helpers.d.ts.map +1 -0
  96. package/dist/src/modular/helpers/example-value-helpers.js +639 -0
  97. package/dist/src/modular/helpers/example-value-helpers.js.map +1 -0
  98. package/dist/src/modular/helpers/naming-helpers.d.ts +22 -0
  99. package/dist/src/modular/helpers/naming-helpers.d.ts.map +1 -0
  100. package/dist/src/modular/helpers/naming-helpers.js +59 -0
  101. package/dist/src/modular/helpers/naming-helpers.js.map +1 -0
  102. package/dist/src/modular/helpers/operation-helpers.d.ts +105 -0
  103. package/dist/src/modular/helpers/operation-helpers.d.ts.map +1 -0
  104. package/dist/src/modular/helpers/operation-helpers.js +2328 -0
  105. package/dist/src/modular/helpers/operation-helpers.js.map +1 -0
  106. package/dist/src/modular/helpers/type-helpers.d.ts +22 -0
  107. package/dist/src/modular/helpers/type-helpers.d.ts.map +1 -0
  108. package/dist/src/modular/helpers/type-helpers.js +94 -0
  109. package/dist/src/modular/helpers/type-helpers.js.map +1 -0
  110. package/dist/src/modular/serialization/build-deserializer-function.d.ts +7 -0
  111. package/dist/src/modular/serialization/build-deserializer-function.d.ts.map +1 -0
  112. package/dist/src/modular/serialization/build-deserializer-function.js +401 -0
  113. package/dist/src/modular/serialization/build-deserializer-function.js.map +1 -0
  114. package/dist/src/modular/serialization/build-serializer-function.d.ts +7 -0
  115. package/dist/src/modular/serialization/build-serializer-function.d.ts.map +1 -0
  116. package/dist/src/modular/serialization/build-serializer-function.js +442 -0
  117. package/dist/src/modular/serialization/build-serializer-function.js.map +1 -0
  118. package/dist/src/modular/serialization/build-xml-serializer-function.d.ts +44 -0
  119. package/dist/src/modular/serialization/build-xml-serializer-function.d.ts.map +1 -0
  120. package/dist/src/modular/serialization/build-xml-serializer-function.js +729 -0
  121. package/dist/src/modular/serialization/build-xml-serializer-function.js.map +1 -0
  122. package/dist/src/modular/serialization/serialize-utils.d.ts +37 -0
  123. package/dist/src/modular/serialization/serialize-utils.d.ts.map +1 -0
  124. package/dist/src/modular/serialization/serialize-utils.js +145 -0
  125. package/dist/src/modular/serialization/serialize-utils.js.map +1 -0
  126. package/dist/src/modular/type-expressions/get-credential-expression.js +1 -1
  127. package/dist/src/modular/type-expressions/get-credential-expression.js.map +1 -1
  128. package/dist/src/modular/type-expressions/get-model-expression.js +1 -1
  129. package/dist/src/modular/type-expressions/get-model-expression.js.map +1 -1
  130. package/dist/src/rlc-common/build-client-definitions.d.ts +6 -0
  131. package/dist/src/rlc-common/build-client-definitions.d.ts.map +1 -0
  132. package/dist/src/rlc-common/build-client-definitions.js +157 -0
  133. package/dist/src/rlc-common/build-client-definitions.js.map +1 -0
  134. package/dist/src/rlc-common/build-client.d.ts +9 -0
  135. package/dist/src/rlc-common/build-client.d.ts.map +1 -0
  136. package/dist/src/rlc-common/build-client.js +391 -0
  137. package/dist/src/rlc-common/build-client.js.map +1 -0
  138. package/dist/src/rlc-common/build-index-file.d.ts +6 -0
  139. package/dist/src/rlc-common/build-index-file.d.ts.map +1 -0
  140. package/dist/src/rlc-common/build-index-file.js +241 -0
  141. package/dist/src/rlc-common/build-index-file.js.map +1 -0
  142. package/dist/src/rlc-common/build-is-unexpected-helper.d.ts +6 -0
  143. package/dist/src/rlc-common/build-is-unexpected-helper.d.ts.map +1 -0
  144. package/dist/src/rlc-common/build-is-unexpected-helper.js +223 -0
  145. package/dist/src/rlc-common/build-is-unexpected-helper.js.map +1 -0
  146. package/dist/src/rlc-common/build-logger.d.ts +6 -0
  147. package/dist/src/rlc-common/build-logger.d.ts.map +1 -0
  148. package/dist/src/rlc-common/build-logger.js +31 -0
  149. package/dist/src/rlc-common/build-logger.js.map +1 -0
  150. package/dist/src/rlc-common/build-method-shortcuts.d.ts +5 -0
  151. package/dist/src/rlc-common/build-method-shortcuts.d.ts.map +1 -0
  152. package/dist/src/rlc-common/build-method-shortcuts.js +54 -0
  153. package/dist/src/rlc-common/build-method-shortcuts.js.map +1 -0
  154. package/dist/src/rlc-common/build-object-types.d.ts +29 -0
  155. package/dist/src/rlc-common/build-object-types.d.ts.map +1 -0
  156. package/dist/src/rlc-common/build-object-types.js +412 -0
  157. package/dist/src/rlc-common/build-object-types.js.map +1 -0
  158. package/dist/src/rlc-common/build-paginate-helper.d.ts +6 -0
  159. package/dist/src/rlc-common/build-paginate-helper.d.ts.map +1 -0
  160. package/dist/src/rlc-common/build-paginate-helper.js +27 -0
  161. package/dist/src/rlc-common/build-paginate-helper.js.map +1 -0
  162. package/dist/src/rlc-common/build-parameter-types.d.ts +14 -0
  163. package/dist/src/rlc-common/build-parameter-types.d.ts.map +1 -0
  164. package/dist/src/rlc-common/build-parameter-types.js +391 -0
  165. package/dist/src/rlc-common/build-parameter-types.js.map +1 -0
  166. package/dist/src/rlc-common/build-polling-helper.d.ts +6 -0
  167. package/dist/src/rlc-common/build-polling-helper.d.ts.map +1 -0
  168. package/dist/src/rlc-common/build-polling-helper.js +61 -0
  169. package/dist/src/rlc-common/build-polling-helper.js.map +1 -0
  170. package/dist/src/rlc-common/build-response-types.d.ts +6 -0
  171. package/dist/src/rlc-common/build-response-types.d.ts.map +1 -0
  172. package/dist/src/rlc-common/build-response-types.js +143 -0
  173. package/dist/src/rlc-common/build-response-types.js.map +1 -0
  174. package/dist/src/rlc-common/build-samples.d.ts +3 -0
  175. package/dist/src/rlc-common/build-samples.d.ts.map +1 -0
  176. package/dist/src/rlc-common/build-samples.js +30 -0
  177. package/dist/src/rlc-common/build-samples.js.map +1 -0
  178. package/dist/src/rlc-common/build-schema-type.d.ts +20 -0
  179. package/dist/src/rlc-common/build-schema-type.d.ts.map +1 -0
  180. package/dist/src/rlc-common/build-schema-type.js +71 -0
  181. package/dist/src/rlc-common/build-schema-type.js.map +1 -0
  182. package/dist/src/rlc-common/build-serialize-helper.d.ts +6 -0
  183. package/dist/src/rlc-common/build-serialize-helper.d.ts.map +1 -0
  184. package/dist/src/rlc-common/build-serialize-helper.js +36 -0
  185. package/dist/src/rlc-common/build-serialize-helper.js.map +1 -0
  186. package/dist/src/rlc-common/build-top-level-index-file.d.ts +6 -0
  187. package/dist/src/rlc-common/build-top-level-index-file.d.ts.map +1 -0
  188. package/dist/src/rlc-common/build-top-level-index-file.js +48 -0
  189. package/dist/src/rlc-common/build-top-level-index-file.js.map +1 -0
  190. package/dist/src/rlc-common/helpers/api-version-util.d.ts +17 -0
  191. package/dist/src/rlc-common/helpers/api-version-util.d.ts.map +1 -0
  192. package/dist/src/rlc-common/helpers/api-version-util.js +43 -0
  193. package/dist/src/rlc-common/helpers/api-version-util.js.map +1 -0
  194. package/dist/src/rlc-common/helpers/imports-util.d.ts +18 -0
  195. package/dist/src/rlc-common/helpers/imports-util.d.ts.map +1 -0
  196. package/dist/src/rlc-common/helpers/imports-util.js +164 -0
  197. package/dist/src/rlc-common/helpers/imports-util.js.map +1 -0
  198. package/dist/src/rlc-common/helpers/name-constructors.d.ts +42 -0
  199. package/dist/src/rlc-common/helpers/name-constructors.d.ts.map +1 -0
  200. package/dist/src/rlc-common/helpers/name-constructors.js +61 -0
  201. package/dist/src/rlc-common/helpers/name-constructors.js.map +1 -0
  202. package/dist/src/rlc-common/helpers/name-utils.d.ts +37 -0
  203. package/dist/src/rlc-common/helpers/name-utils.d.ts.map +1 -0
  204. package/dist/src/rlc-common/helpers/name-utils.js +240 -0
  205. package/dist/src/rlc-common/helpers/name-utils.js.map +1 -0
  206. package/dist/src/rlc-common/helpers/operation-helpers.d.ts +16 -0
  207. package/dist/src/rlc-common/helpers/operation-helpers.d.ts.map +1 -0
  208. package/dist/src/rlc-common/helpers/operation-helpers.js +104 -0
  209. package/dist/src/rlc-common/helpers/operation-helpers.js.map +1 -0
  210. package/dist/src/rlc-common/helpers/package-util.d.ts +7 -0
  211. package/dist/src/rlc-common/helpers/package-util.d.ts.map +1 -0
  212. package/dist/src/rlc-common/helpers/package-util.js +10 -0
  213. package/dist/src/rlc-common/helpers/package-util.js.map +1 -0
  214. package/dist/src/rlc-common/helpers/path-utils.d.ts +2 -0
  215. package/dist/src/rlc-common/helpers/path-utils.d.ts.map +1 -0
  216. package/dist/src/rlc-common/helpers/path-utils.js +10 -0
  217. package/dist/src/rlc-common/helpers/path-utils.js.map +1 -0
  218. package/dist/src/rlc-common/helpers/schema-helpers.d.ts +10 -0
  219. package/dist/src/rlc-common/helpers/schema-helpers.d.ts.map +1 -0
  220. package/dist/src/rlc-common/helpers/schema-helpers.js +37 -0
  221. package/dist/src/rlc-common/helpers/schema-helpers.js.map +1 -0
  222. package/dist/src/rlc-common/helpers/shortcut-methods.d.ts +4 -0
  223. package/dist/src/rlc-common/helpers/shortcut-methods.d.ts.map +1 -0
  224. package/dist/src/rlc-common/helpers/shortcut-methods.js +49 -0
  225. package/dist/src/rlc-common/helpers/shortcut-methods.js.map +1 -0
  226. package/dist/src/rlc-common/helpers/type-util.d.ts +32 -0
  227. package/dist/src/rlc-common/helpers/type-util.d.ts.map +1 -0
  228. package/dist/src/rlc-common/helpers/type-util.js +162 -0
  229. package/dist/src/rlc-common/helpers/type-util.js.map +1 -0
  230. package/dist/src/rlc-common/helpers/value-generation-util.d.ts +12 -0
  231. package/dist/src/rlc-common/helpers/value-generation-util.d.ts.map +1 -0
  232. package/dist/src/rlc-common/helpers/value-generation-util.js +161 -0
  233. package/dist/src/rlc-common/helpers/value-generation-util.js.map +1 -0
  234. package/dist/src/rlc-common/index.d.ts +39 -39
  235. package/dist/src/rlc-common/index.d.ts.map +1 -1
  236. package/dist/src/rlc-common/index.js +39 -39
  237. package/dist/src/rlc-common/index.js.map +1 -1
  238. package/dist/src/rlc-common/metadata/build-api-extractor-config.d.ts +6 -0
  239. package/dist/src/rlc-common/metadata/build-api-extractor-config.d.ts.map +1 -0
  240. package/dist/src/rlc-common/metadata/build-api-extractor-config.js +55 -0
  241. package/dist/src/rlc-common/metadata/build-api-extractor-config.js.map +1 -0
  242. package/dist/src/rlc-common/metadata/build-changelog-file.d.ts +6 -0
  243. package/dist/src/rlc-common/metadata/build-changelog-file.d.ts.map +1 -0
  244. package/dist/src/rlc-common/metadata/build-changelog-file.js +25 -0
  245. package/dist/src/rlc-common/metadata/build-changelog-file.js.map +1 -0
  246. package/dist/src/rlc-common/metadata/build-es-lint-config.d.ts +6 -0
  247. package/dist/src/rlc-common/metadata/build-es-lint-config.d.ts.map +1 -0
  248. package/dist/src/rlc-common/metadata/build-es-lint-config.js +79 -0
  249. package/dist/src/rlc-common/metadata/build-es-lint-config.js.map +1 -0
  250. package/dist/src/rlc-common/metadata/build-license-file.d.ts +5 -0
  251. package/dist/src/rlc-common/metadata/build-license-file.d.ts.map +1 -0
  252. package/dist/src/rlc-common/metadata/build-license-file.js +32 -0
  253. package/dist/src/rlc-common/metadata/build-license-file.js.map +1 -0
  254. package/dist/src/rlc-common/metadata/build-package-file.d.ts +25 -0
  255. package/dist/src/rlc-common/metadata/build-package-file.d.ts.map +1 -0
  256. package/dist/src/rlc-common/metadata/build-package-file.js +197 -0
  257. package/dist/src/rlc-common/metadata/build-package-file.js.map +1 -0
  258. package/dist/src/rlc-common/metadata/build-readme-file.d.ts +11 -0
  259. package/dist/src/rlc-common/metadata/build-readme-file.d.ts.map +1 -0
  260. package/dist/src/rlc-common/metadata/build-readme-file.js +418 -0
  261. package/dist/src/rlc-common/metadata/build-readme-file.js.map +1 -0
  262. package/dist/src/rlc-common/metadata/build-rollup-config.d.ts +6 -0
  263. package/dist/src/rlc-common/metadata/build-rollup-config.d.ts.map +1 -0
  264. package/dist/src/rlc-common/metadata/build-rollup-config.js +140 -0
  265. package/dist/src/rlc-common/metadata/build-rollup-config.js.map +1 -0
  266. package/dist/src/rlc-common/metadata/build-sample-env-file.d.ts +6 -0
  267. package/dist/src/rlc-common/metadata/build-sample-env-file.d.ts.map +1 -0
  268. package/dist/src/rlc-common/metadata/build-sample-env-file.js +15 -0
  269. package/dist/src/rlc-common/metadata/build-sample-env-file.js.map +1 -0
  270. package/dist/src/rlc-common/metadata/build-test-config.d.ts +16 -0
  271. package/dist/src/rlc-common/metadata/build-test-config.d.ts.map +1 -0
  272. package/dist/src/rlc-common/metadata/build-test-config.js +54 -0
  273. package/dist/src/rlc-common/metadata/build-test-config.js.map +1 -0
  274. package/dist/src/rlc-common/metadata/build-ts-config.d.ts +61 -0
  275. package/dist/src/rlc-common/metadata/build-ts-config.d.ts.map +1 -0
  276. package/dist/src/rlc-common/metadata/build-ts-config.js +170 -0
  277. package/dist/src/rlc-common/metadata/build-ts-config.js.map +1 -0
  278. package/dist/src/rlc-common/metadata/build-vitest-config.d.ts +6 -0
  279. package/dist/src/rlc-common/metadata/build-vitest-config.d.ts.map +1 -0
  280. package/dist/src/rlc-common/metadata/build-vitest-config.js +26 -0
  281. package/dist/src/rlc-common/metadata/build-vitest-config.js.map +1 -0
  282. package/dist/src/rlc-common/metadata/build-warp-config.d.ts +20 -0
  283. package/dist/src/rlc-common/metadata/build-warp-config.d.ts.map +1 -0
  284. package/dist/src/rlc-common/metadata/build-warp-config.js +76 -0
  285. package/dist/src/rlc-common/metadata/build-warp-config.js.map +1 -0
  286. package/dist/src/rlc-common/metadata/package-json/azure-package-common.d.ts +51 -0
  287. package/dist/src/rlc-common/metadata/package-json/azure-package-common.d.ts.map +1 -0
  288. package/dist/src/rlc-common/metadata/package-json/azure-package-common.js +121 -0
  289. package/dist/src/rlc-common/metadata/package-json/azure-package-common.js.map +1 -0
  290. package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.d.ts +242 -0
  291. package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.d.ts.map +1 -0
  292. package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.js +171 -0
  293. package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.js.map +1 -0
  294. package/dist/src/rlc-common/metadata/package-json/build-azure-standalone-package.d.ts +8 -0
  295. package/dist/src/rlc-common/metadata/package-json/build-azure-standalone-package.d.ts.map +1 -0
  296. package/dist/src/rlc-common/metadata/package-json/build-azure-standalone-package.js +101 -0
  297. package/dist/src/rlc-common/metadata/package-json/build-azure-standalone-package.js.map +1 -0
  298. package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.d.ts +57 -0
  299. package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.d.ts.map +1 -0
  300. package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.js +53 -0
  301. package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.js.map +1 -0
  302. package/dist/src/rlc-common/metadata/package-json/package-common.d.ts +64 -0
  303. package/dist/src/rlc-common/metadata/package-json/package-common.d.ts.map +1 -0
  304. package/dist/src/rlc-common/metadata/package-json/package-common.js +180 -0
  305. package/dist/src/rlc-common/metadata/package-json/package-common.js.map +1 -0
  306. package/dist/src/rlc-common/static/paginate-content.d.ts +2 -0
  307. package/dist/src/rlc-common/static/paginate-content.d.ts.map +1 -0
  308. package/dist/src/rlc-common/static/paginate-content.js +345 -0
  309. package/dist/src/rlc-common/static/paginate-content.js.map +1 -0
  310. package/dist/src/rlc-common/static/polling-content.d.ts +2 -0
  311. package/dist/src/rlc-common/static/polling-content.d.ts.map +1 -0
  312. package/dist/src/rlc-common/static/polling-content.js +225 -0
  313. package/dist/src/rlc-common/static/polling-content.js.map +1 -0
  314. package/dist/src/rlc-common/static/sample-template.d.ts +2 -0
  315. package/dist/src/rlc-common/static/sample-template.d.ts.map +1 -0
  316. package/dist/src/rlc-common/static/sample-template.js +56 -0
  317. package/dist/src/rlc-common/static/sample-template.js.map +1 -0
  318. package/dist/src/rlc-common/static/serialize-helper.d.ts +6 -0
  319. package/dist/src/rlc-common/static/serialize-helper.d.ts.map +1 -0
  320. package/dist/src/rlc-common/static/serialize-helper.js +31 -0
  321. package/dist/src/rlc-common/static/serialize-helper.js.map +1 -0
  322. package/dist/src/rlc-common/test/build-karma-config.d.ts +6 -0
  323. package/dist/src/rlc-common/test/build-karma-config.d.ts.map +1 -0
  324. package/dist/src/rlc-common/test/build-karma-config.js +11 -0
  325. package/dist/src/rlc-common/test/build-karma-config.js.map +1 -0
  326. package/dist/src/rlc-common/test/build-recorded-client.d.ts +6 -0
  327. package/dist/src/rlc-common/test/build-recorded-client.d.ts.map +1 -0
  328. package/dist/src/rlc-common/test/build-recorded-client.js +17 -0
  329. package/dist/src/rlc-common/test/build-recorded-client.js.map +1 -0
  330. package/dist/src/rlc-common/test/build-sample-test.d.ts +6 -0
  331. package/dist/src/rlc-common/test/build-sample-test.d.ts.map +1 -0
  332. package/dist/src/rlc-common/test/build-sample-test.js +14 -0
  333. package/dist/src/rlc-common/test/build-sample-test.js.map +1 -0
  334. package/dist/src/rlc-common/test/build-snippets.d.ts +6 -0
  335. package/dist/src/rlc-common/test/build-snippets.d.ts.map +1 -0
  336. package/dist/src/rlc-common/test/build-snippets.js +26 -0
  337. package/dist/src/rlc-common/test/build-snippets.js.map +1 -0
  338. package/dist/src/rlc-common/transform-sample-groups.d.ts +9 -0
  339. package/dist/src/rlc-common/transform-sample-groups.d.ts.map +1 -0
  340. package/dist/src/rlc-common/transform-sample-groups.js +313 -0
  341. package/dist/src/rlc-common/transform-sample-groups.js.map +1 -0
  342. package/dist/src/transform/transform-api-version-info.d.ts +6 -0
  343. package/dist/src/transform/transform-api-version-info.d.ts.map +1 -0
  344. package/dist/src/transform/transform-api-version-info.js +78 -0
  345. package/dist/src/transform/transform-api-version-info.js.map +1 -0
  346. package/dist/src/transform/transform-helper-function-details.d.ts +5 -0
  347. package/dist/src/transform/transform-helper-function-details.d.ts.map +1 -0
  348. package/dist/src/transform/transform-helper-function-details.js +74 -0
  349. package/dist/src/transform/transform-helper-function-details.js.map +1 -0
  350. package/dist/src/transform/transform-parameters.d.ts +14 -0
  351. package/dist/src/transform/transform-parameters.d.ts.map +1 -0
  352. package/dist/src/transform/transform-parameters.js +201 -0
  353. package/dist/src/transform/transform-parameters.js.map +1 -0
  354. package/dist/src/transform/transform-paths.d.ts +5 -0
  355. package/dist/src/transform/transform-paths.d.ts.map +1 -0
  356. package/dist/src/transform/transform-paths.js +102 -0
  357. package/dist/src/transform/transform-paths.js.map +1 -0
  358. package/dist/src/transform/transform-responses.d.ts +5 -0
  359. package/dist/src/transform/transform-responses.d.ts.map +1 -0
  360. package/dist/src/transform/transform-responses.js +171 -0
  361. package/dist/src/transform/transform-responses.js.map +1 -0
  362. package/dist/src/transform/transform-schemas.d.ts +4 -0
  363. package/dist/src/transform/transform-schemas.d.ts.map +1 -0
  364. package/dist/src/transform/transform-schemas.js +191 -0
  365. package/dist/src/transform/transform-schemas.js.map +1 -0
  366. package/dist/src/transform/transform-telemetry-info.d.ts +4 -0
  367. package/dist/src/transform/transform-telemetry-info.d.ts.map +1 -0
  368. package/dist/src/transform/transform-telemetry-info.js +22 -0
  369. package/dist/src/transform/transform-telemetry-info.js.map +1 -0
  370. package/dist/src/transform/transform.js +10 -10
  371. package/dist/src/transform/transform.js.map +1 -1
  372. package/dist/src/transform/transfrom-rlc-options.d.ts +14 -0
  373. package/dist/src/transform/transfrom-rlc-options.d.ts.map +1 -0
  374. package/dist/src/transform/transfrom-rlc-options.js +369 -0
  375. package/dist/src/transform/transfrom-rlc-options.js.map +1 -0
  376. package/dist/src/utils/client-utils.d.ts +10 -0
  377. package/dist/src/utils/client-utils.d.ts.map +1 -0
  378. package/dist/src/utils/client-utils.js +124 -0
  379. package/dist/src/utils/client-utils.js.map +1 -0
  380. package/dist/src/utils/credential-utils.d.ts +15 -0
  381. package/dist/src/utils/credential-utils.d.ts.map +1 -0
  382. package/dist/src/utils/credential-utils.js +68 -0
  383. package/dist/src/utils/credential-utils.js.map +1 -0
  384. package/dist/src/utils/cross-language-def.d.ts +6 -0
  385. package/dist/src/utils/cross-language-def.d.ts.map +1 -0
  386. package/dist/src/utils/cross-language-def.js +59 -0
  387. package/dist/src/utils/cross-language-def.js.map +1 -0
  388. package/dist/src/utils/emit-util.d.ts +5 -0
  389. package/dist/src/utils/emit-util.d.ts.map +1 -0
  390. package/dist/src/utils/emit-util.js +71 -0
  391. package/dist/src/utils/emit-util.js.map +1 -0
  392. package/dist/src/utils/file-system-utils.d.ts +5 -0
  393. package/dist/src/utils/file-system-utils.d.ts.map +1 -0
  394. package/dist/src/utils/file-system-utils.js +59 -0
  395. package/dist/src/utils/file-system-utils.js.map +1 -0
  396. package/dist/src/utils/import-helper.d.ts +10 -0
  397. package/dist/src/utils/import-helper.d.ts.map +1 -0
  398. package/dist/src/utils/import-helper.js +51 -0
  399. package/dist/src/utils/import-helper.js.map +1 -0
  400. package/dist/src/utils/interfaces.d.ts +1 -1
  401. package/dist/src/utils/interfaces.d.ts.map +1 -1
  402. package/dist/src/utils/media-types.d.ts +28 -0
  403. package/dist/src/utils/media-types.d.ts.map +1 -0
  404. package/dist/src/utils/media-types.js +124 -0
  405. package/dist/src/utils/media-types.js.map +1 -0
  406. package/dist/src/utils/model-utils.d.ts +60 -0
  407. package/dist/src/utils/model-utils.d.ts.map +1 -0
  408. package/dist/src/utils/model-utils.js +1480 -0
  409. package/dist/src/utils/model-utils.js.map +1 -0
  410. package/dist/src/utils/namespace-utils.d.ts +6 -0
  411. package/dist/src/utils/namespace-utils.d.ts.map +1 -0
  412. package/dist/src/utils/namespace-utils.js +69 -0
  413. package/dist/src/utils/namespace-utils.js.map +1 -0
  414. package/dist/src/utils/operation-util.d.ts +97 -0
  415. package/dist/src/utils/operation-util.d.ts.map +1 -0
  416. package/dist/src/utils/operation-util.js +547 -0
  417. package/dist/src/utils/operation-util.js.map +1 -0
  418. package/dist/src/utils/parameter-utils.d.ts +9 -0
  419. package/dist/src/utils/parameter-utils.d.ts.map +1 -0
  420. package/dist/src/utils/parameter-utils.js +147 -0
  421. package/dist/src/utils/parameter-utils.js.map +1 -0
  422. package/dist/tsconfig.tsbuildinfo +1 -1
  423. package/package.json +24 -28
  424. package/src/context-manager.ts +101 -0
  425. package/src/framework/hooks/binder.ts +3 -3
  426. package/src/framework/hooks/sdk-types.ts +219 -0
  427. package/src/framework/hooks/use-dependencies.ts +16 -0
  428. package/src/index.ts +23 -23
  429. package/src/modular/build-classical-client.ts +434 -0
  430. package/src/modular/build-classical-operation-groups.ts +69 -0
  431. package/src/modular/build-client-context.ts +325 -0
  432. package/src/modular/build-operations.ts +248 -0
  433. package/src/modular/build-project-files.ts +111 -0
  434. package/src/modular/build-restore-poller.ts +242 -0
  435. package/src/modular/build-root-index.ts +407 -0
  436. package/src/modular/build-subpath-index.ts +152 -0
  437. package/src/modular/emit-logger-file.ts +23 -0
  438. package/src/modular/emit-models-options.ts +56 -0
  439. package/src/modular/emit-models.ts +1096 -0
  440. package/src/modular/emit-samples.ts +675 -0
  441. package/src/modular/emit-tests.ts +194 -0
  442. package/src/modular/helpers/classical-operation-helpers.ts +375 -0
  443. package/src/modular/helpers/client-helpers.ts +362 -0
  444. package/src/modular/helpers/example-value-helpers.ts +851 -0
  445. package/src/modular/helpers/naming-helpers.ts +84 -0
  446. package/src/modular/helpers/operation-helpers.ts +3035 -0
  447. package/src/modular/helpers/type-helpers.ts +134 -0
  448. package/src/modular/serialization/build-deserializer-function.ts +564 -0
  449. package/src/modular/serialization/build-serializer-function.ts +614 -0
  450. package/src/modular/serialization/build-xml-serializer-function.ts +951 -0
  451. package/src/modular/serialization/serialize-utils.ts +217 -0
  452. package/src/modular/type-expressions/get-credential-expression.ts +1 -1
  453. package/src/modular/type-expressions/get-model-expression.ts +1 -1
  454. package/src/rlc-common/build-client-definitions.ts +235 -0
  455. package/src/rlc-common/build-client.ts +490 -0
  456. package/src/rlc-common/build-index-file.ts +344 -0
  457. package/src/rlc-common/build-is-unexpected-helper.ts +248 -0
  458. package/src/rlc-common/build-logger.ts +43 -0
  459. package/src/rlc-common/build-method-shortcuts.ts +71 -0
  460. package/src/rlc-common/build-object-types.ts +603 -0
  461. package/src/rlc-common/build-paginate-helper.ts +31 -0
  462. package/src/rlc-common/build-parameter-types.ts +554 -0
  463. package/src/rlc-common/build-polling-helper.ts +83 -0
  464. package/src/rlc-common/build-response-types.ts +180 -0
  465. package/src/rlc-common/build-samples.ts +32 -0
  466. package/src/rlc-common/build-schema-type.ts +89 -0
  467. package/src/rlc-common/build-serialize-helper.ts +49 -0
  468. package/src/rlc-common/build-top-level-index-file.ts +58 -0
  469. package/src/rlc-common/helpers/name-constructors.ts +110 -0
  470. package/src/rlc-common/helpers/operation-helpers.ts +138 -0
  471. package/src/rlc-common/helpers/shortcut-methods.ts +58 -0
  472. package/src/rlc-common/helpers/value-generation-util.ts +234 -0
  473. package/src/rlc-common/index.ts +39 -39
  474. package/src/rlc-common/metadata/build-package-file.ts +242 -0
  475. package/src/rlc-common/metadata/build-readme-file.ts +515 -0
  476. package/src/rlc-common/metadata/build-rollup-config.ts +147 -0
  477. package/src/rlc-common/metadata/package-json/azure-package-common.ts +152 -0
  478. package/src/rlc-common/metadata/package-json/build-azure-monorepo-package.ts +199 -0
  479. package/src/rlc-common/metadata/package-json/build-azure-standalone-package.ts +123 -0
  480. package/src/rlc-common/metadata/package-json/build-flavorless-package.ts +68 -0
  481. package/src/rlc-common/test/build-snippets.ts +29 -0
  482. package/src/rlc-common/transform-sample-groups.ts +407 -0
  483. package/src/transform/transform-api-version-info.ts +103 -0
  484. package/src/transform/transform-helper-function-details.ts +88 -0
  485. package/src/transform/transform-parameters.ts +321 -0
  486. package/src/transform/transform-paths.ts +157 -0
  487. package/src/transform/transform-responses.ts +237 -0
  488. package/src/transform/transform-schemas.ts +212 -0
  489. package/src/transform/transform-telemetry-info.ts +33 -0
  490. package/src/transform/transform.ts +10 -10
  491. package/src/transform/transfrom-rlc-options.ts +461 -0
  492. package/src/utils/cross-language-def.ts +66 -0
  493. package/src/utils/import-helper.ts +59 -0
  494. package/src/utils/interfaces.ts +1 -1
  495. package/src/utils/model-utils.ts +1727 -0
  496. package/src/utils/operation-util.ts +763 -0
  497. package/src/utils/parameter-utils.ts +192 -0
  498. package/static/static-helpers/serialization/serializers.ts +1 -0
  499. package/dist/src/contextManager.d.ts +0 -75
  500. package/dist/src/contextManager.d.ts.map +0 -1
  501. package/dist/src/contextManager.js +0 -59
  502. package/dist/src/contextManager.js.map +0 -1
  503. package/dist/src/framework/hooks/sdkTypes.d.ts +0 -26
  504. package/dist/src/framework/hooks/sdkTypes.d.ts.map +0 -1
  505. package/dist/src/framework/hooks/sdkTypes.js +0 -157
  506. package/dist/src/framework/hooks/sdkTypes.js.map +0 -1
  507. package/dist/src/framework/hooks/useDependencies.d.ts +0 -4
  508. package/dist/src/framework/hooks/useDependencies.d.ts.map +0 -1
  509. package/dist/src/framework/hooks/useDependencies.js +0 -13
  510. package/dist/src/framework/hooks/useDependencies.js.map +0 -1
  511. package/dist/src/metaTree.d.ts +0 -7
  512. package/dist/src/metaTree.d.ts.map +0 -1
  513. package/dist/src/metaTree.js +0 -2
  514. package/dist/src/metaTree.js.map +0 -1
  515. package/dist/src/modular/buildClassicalClient.d.ts +0 -6
  516. package/dist/src/modular/buildClassicalClient.d.ts.map +0 -1
  517. package/dist/src/modular/buildClassicalClient.js +0 -345
  518. package/dist/src/modular/buildClassicalClient.js.map +0 -1
  519. package/dist/src/modular/buildClassicalOperationGroups.d.ts +0 -6
  520. package/dist/src/modular/buildClassicalOperationGroups.d.ts.map +0 -1
  521. package/dist/src/modular/buildClassicalOperationGroups.js +0 -48
  522. package/dist/src/modular/buildClassicalOperationGroups.js.map +0 -1
  523. package/dist/src/modular/buildClientContext.d.ts +0 -13
  524. package/dist/src/modular/buildClientContext.d.ts.map +0 -1
  525. package/dist/src/modular/buildClientContext.js +0 -246
  526. package/dist/src/modular/buildClientContext.js.map +0 -1
  527. package/dist/src/modular/buildModularOptions.d.ts +0 -6
  528. package/dist/src/modular/buildModularOptions.d.ts.map +0 -1
  529. package/dist/src/modular/buildModularOptions.js +0 -14
  530. package/dist/src/modular/buildModularOptions.js.map +0 -1
  531. package/dist/src/modular/buildOperations.d.ts +0 -21
  532. package/dist/src/modular/buildOperations.d.ts.map +0 -1
  533. package/dist/src/modular/buildOperations.js +0 -172
  534. package/dist/src/modular/buildOperations.js.map +0 -1
  535. package/dist/src/modular/buildProjectFiles.d.ts +0 -4
  536. package/dist/src/modular/buildProjectFiles.d.ts.map +0 -1
  537. package/dist/src/modular/buildProjectFiles.js +0 -91
  538. package/dist/src/modular/buildProjectFiles.js.map +0 -1
  539. package/dist/src/modular/buildRestorePoller.d.ts +0 -5
  540. package/dist/src/modular/buildRestorePoller.d.ts.map +0 -1
  541. package/dist/src/modular/buildRestorePoller.js +0 -216
  542. package/dist/src/modular/buildRestorePoller.js.map +0 -1
  543. package/dist/src/modular/buildRootIndex.d.ts +0 -13
  544. package/dist/src/modular/buildRootIndex.d.ts.map +0 -1
  545. package/dist/src/modular/buildRootIndex.js +0 -279
  546. package/dist/src/modular/buildRootIndex.js.map +0 -1
  547. package/dist/src/modular/buildSubpathIndex.d.ts +0 -16
  548. package/dist/src/modular/buildSubpathIndex.d.ts.map +0 -1
  549. package/dist/src/modular/buildSubpathIndex.js +0 -119
  550. package/dist/src/modular/buildSubpathIndex.js.map +0 -1
  551. package/dist/src/modular/emitLoggerFile.d.ts +0 -3
  552. package/dist/src/modular/emitLoggerFile.d.ts.map +0 -1
  553. package/dist/src/modular/emitLoggerFile.js +0 -18
  554. package/dist/src/modular/emitLoggerFile.js.map +0 -1
  555. package/dist/src/modular/emitModels.d.ts +0 -23
  556. package/dist/src/modular/emitModels.d.ts.map +0 -1
  557. package/dist/src/modular/emitModels.js +0 -850
  558. package/dist/src/modular/emitModels.js.map +0 -1
  559. package/dist/src/modular/emitModelsOptions.d.ts +0 -5
  560. package/dist/src/modular/emitModelsOptions.d.ts.map +0 -1
  561. package/dist/src/modular/emitModelsOptions.js +0 -35
  562. package/dist/src/modular/emitModelsOptions.js.map +0 -1
  563. package/dist/src/modular/emitSamples.d.ts +0 -7
  564. package/dist/src/modular/emitSamples.d.ts.map +0 -1
  565. package/dist/src/modular/emitSamples.js +0 -500
  566. package/dist/src/modular/emitSamples.js.map +0 -1
  567. package/dist/src/modular/emitTests.d.ts +0 -7
  568. package/dist/src/modular/emitTests.d.ts.map +0 -1
  569. package/dist/src/modular/emitTests.js +0 -155
  570. package/dist/src/modular/emitTests.js.map +0 -1
  571. package/dist/src/modular/helpers/classicalOperationHelpers.d.ts +0 -7
  572. package/dist/src/modular/helpers/classicalOperationHelpers.d.ts.map +0 -1
  573. package/dist/src/modular/helpers/classicalOperationHelpers.js +0 -258
  574. package/dist/src/modular/helpers/classicalOperationHelpers.js.map +0 -1
  575. package/dist/src/modular/helpers/clientHelpers.d.ts +0 -34
  576. package/dist/src/modular/helpers/clientHelpers.d.ts.map +0 -1
  577. package/dist/src/modular/helpers/clientHelpers.js +0 -259
  578. package/dist/src/modular/helpers/clientHelpers.js.map +0 -1
  579. package/dist/src/modular/helpers/clientOptionHelpers.d.ts +0 -43
  580. package/dist/src/modular/helpers/clientOptionHelpers.d.ts.map +0 -1
  581. package/dist/src/modular/helpers/clientOptionHelpers.js +0 -103
  582. package/dist/src/modular/helpers/clientOptionHelpers.js.map +0 -1
  583. package/dist/src/modular/helpers/docsHelpers.d.ts +0 -3
  584. package/dist/src/modular/helpers/docsHelpers.d.ts.map +0 -1
  585. package/dist/src/modular/helpers/docsHelpers.js +0 -10
  586. package/dist/src/modular/helpers/docsHelpers.js.map +0 -1
  587. package/dist/src/modular/helpers/exampleValueHelpers.d.ts +0 -83
  588. package/dist/src/modular/helpers/exampleValueHelpers.d.ts.map +0 -1
  589. package/dist/src/modular/helpers/exampleValueHelpers.js +0 -639
  590. package/dist/src/modular/helpers/exampleValueHelpers.js.map +0 -1
  591. package/dist/src/modular/helpers/namingHelpers.d.ts +0 -22
  592. package/dist/src/modular/helpers/namingHelpers.d.ts.map +0 -1
  593. package/dist/src/modular/helpers/namingHelpers.js +0 -59
  594. package/dist/src/modular/helpers/namingHelpers.js.map +0 -1
  595. package/dist/src/modular/helpers/operationHelpers.d.ts +0 -105
  596. package/dist/src/modular/helpers/operationHelpers.d.ts.map +0 -1
  597. package/dist/src/modular/helpers/operationHelpers.js +0 -2328
  598. package/dist/src/modular/helpers/operationHelpers.js.map +0 -1
  599. package/dist/src/modular/helpers/typeHelpers.d.ts +0 -22
  600. package/dist/src/modular/helpers/typeHelpers.d.ts.map +0 -1
  601. package/dist/src/modular/helpers/typeHelpers.js +0 -94
  602. package/dist/src/modular/helpers/typeHelpers.js.map +0 -1
  603. package/dist/src/modular/serialization/buildDeserializerFunction.d.ts +0 -7
  604. package/dist/src/modular/serialization/buildDeserializerFunction.d.ts.map +0 -1
  605. package/dist/src/modular/serialization/buildDeserializerFunction.js +0 -401
  606. package/dist/src/modular/serialization/buildDeserializerFunction.js.map +0 -1
  607. package/dist/src/modular/serialization/buildSerializerFunction.d.ts +0 -7
  608. package/dist/src/modular/serialization/buildSerializerFunction.d.ts.map +0 -1
  609. package/dist/src/modular/serialization/buildSerializerFunction.js +0 -444
  610. package/dist/src/modular/serialization/buildSerializerFunction.js.map +0 -1
  611. package/dist/src/modular/serialization/buildXmlSerializerFunction.d.ts +0 -44
  612. package/dist/src/modular/serialization/buildXmlSerializerFunction.d.ts.map +0 -1
  613. package/dist/src/modular/serialization/buildXmlSerializerFunction.js +0 -729
  614. package/dist/src/modular/serialization/buildXmlSerializerFunction.js.map +0 -1
  615. package/dist/src/modular/serialization/serializeUtils.d.ts +0 -37
  616. package/dist/src/modular/serialization/serializeUtils.d.ts.map +0 -1
  617. package/dist/src/modular/serialization/serializeUtils.js +0 -145
  618. package/dist/src/modular/serialization/serializeUtils.js.map +0 -1
  619. package/dist/src/rlc-common/buildClient.d.ts +0 -9
  620. package/dist/src/rlc-common/buildClient.d.ts.map +0 -1
  621. package/dist/src/rlc-common/buildClient.js +0 -391
  622. package/dist/src/rlc-common/buildClient.js.map +0 -1
  623. package/dist/src/rlc-common/buildClientDefinitions.d.ts +0 -6
  624. package/dist/src/rlc-common/buildClientDefinitions.d.ts.map +0 -1
  625. package/dist/src/rlc-common/buildClientDefinitions.js +0 -157
  626. package/dist/src/rlc-common/buildClientDefinitions.js.map +0 -1
  627. package/dist/src/rlc-common/buildIndexFile.d.ts +0 -6
  628. package/dist/src/rlc-common/buildIndexFile.d.ts.map +0 -1
  629. package/dist/src/rlc-common/buildIndexFile.js +0 -241
  630. package/dist/src/rlc-common/buildIndexFile.js.map +0 -1
  631. package/dist/src/rlc-common/buildIsUnexpectedHelper.d.ts +0 -6
  632. package/dist/src/rlc-common/buildIsUnexpectedHelper.d.ts.map +0 -1
  633. package/dist/src/rlc-common/buildIsUnexpectedHelper.js +0 -223
  634. package/dist/src/rlc-common/buildIsUnexpectedHelper.js.map +0 -1
  635. package/dist/src/rlc-common/buildLogger.d.ts +0 -6
  636. package/dist/src/rlc-common/buildLogger.d.ts.map +0 -1
  637. package/dist/src/rlc-common/buildLogger.js +0 -31
  638. package/dist/src/rlc-common/buildLogger.js.map +0 -1
  639. package/dist/src/rlc-common/buildMethodShortcuts.d.ts +0 -5
  640. package/dist/src/rlc-common/buildMethodShortcuts.d.ts.map +0 -1
  641. package/dist/src/rlc-common/buildMethodShortcuts.js +0 -54
  642. package/dist/src/rlc-common/buildMethodShortcuts.js.map +0 -1
  643. package/dist/src/rlc-common/buildObjectTypes.d.ts +0 -29
  644. package/dist/src/rlc-common/buildObjectTypes.d.ts.map +0 -1
  645. package/dist/src/rlc-common/buildObjectTypes.js +0 -412
  646. package/dist/src/rlc-common/buildObjectTypes.js.map +0 -1
  647. package/dist/src/rlc-common/buildPaginateHelper.d.ts +0 -6
  648. package/dist/src/rlc-common/buildPaginateHelper.d.ts.map +0 -1
  649. package/dist/src/rlc-common/buildPaginateHelper.js +0 -27
  650. package/dist/src/rlc-common/buildPaginateHelper.js.map +0 -1
  651. package/dist/src/rlc-common/buildParameterTypes.d.ts +0 -14
  652. package/dist/src/rlc-common/buildParameterTypes.d.ts.map +0 -1
  653. package/dist/src/rlc-common/buildParameterTypes.js +0 -391
  654. package/dist/src/rlc-common/buildParameterTypes.js.map +0 -1
  655. package/dist/src/rlc-common/buildPollingHelper.d.ts +0 -6
  656. package/dist/src/rlc-common/buildPollingHelper.d.ts.map +0 -1
  657. package/dist/src/rlc-common/buildPollingHelper.js +0 -61
  658. package/dist/src/rlc-common/buildPollingHelper.js.map +0 -1
  659. package/dist/src/rlc-common/buildResponseTypes.d.ts +0 -6
  660. package/dist/src/rlc-common/buildResponseTypes.d.ts.map +0 -1
  661. package/dist/src/rlc-common/buildResponseTypes.js +0 -143
  662. package/dist/src/rlc-common/buildResponseTypes.js.map +0 -1
  663. package/dist/src/rlc-common/buildSamples.d.ts +0 -3
  664. package/dist/src/rlc-common/buildSamples.d.ts.map +0 -1
  665. package/dist/src/rlc-common/buildSamples.js +0 -30
  666. package/dist/src/rlc-common/buildSamples.js.map +0 -1
  667. package/dist/src/rlc-common/buildSchemaType.d.ts +0 -20
  668. package/dist/src/rlc-common/buildSchemaType.d.ts.map +0 -1
  669. package/dist/src/rlc-common/buildSchemaType.js +0 -71
  670. package/dist/src/rlc-common/buildSchemaType.js.map +0 -1
  671. package/dist/src/rlc-common/buildSerializeHelper.d.ts +0 -6
  672. package/dist/src/rlc-common/buildSerializeHelper.d.ts.map +0 -1
  673. package/dist/src/rlc-common/buildSerializeHelper.js +0 -36
  674. package/dist/src/rlc-common/buildSerializeHelper.js.map +0 -1
  675. package/dist/src/rlc-common/buildTopLevelIndexFile.d.ts +0 -6
  676. package/dist/src/rlc-common/buildTopLevelIndexFile.d.ts.map +0 -1
  677. package/dist/src/rlc-common/buildTopLevelIndexFile.js +0 -48
  678. package/dist/src/rlc-common/buildTopLevelIndexFile.js.map +0 -1
  679. package/dist/src/rlc-common/helpers/apiVersionUtil.d.ts +0 -17
  680. package/dist/src/rlc-common/helpers/apiVersionUtil.d.ts.map +0 -1
  681. package/dist/src/rlc-common/helpers/apiVersionUtil.js +0 -43
  682. package/dist/src/rlc-common/helpers/apiVersionUtil.js.map +0 -1
  683. package/dist/src/rlc-common/helpers/importsUtil.d.ts +0 -18
  684. package/dist/src/rlc-common/helpers/importsUtil.d.ts.map +0 -1
  685. package/dist/src/rlc-common/helpers/importsUtil.js +0 -164
  686. package/dist/src/rlc-common/helpers/importsUtil.js.map +0 -1
  687. package/dist/src/rlc-common/helpers/nameConstructors.d.ts +0 -42
  688. package/dist/src/rlc-common/helpers/nameConstructors.d.ts.map +0 -1
  689. package/dist/src/rlc-common/helpers/nameConstructors.js +0 -61
  690. package/dist/src/rlc-common/helpers/nameConstructors.js.map +0 -1
  691. package/dist/src/rlc-common/helpers/nameUtils.d.ts +0 -37
  692. package/dist/src/rlc-common/helpers/nameUtils.d.ts.map +0 -1
  693. package/dist/src/rlc-common/helpers/nameUtils.js +0 -240
  694. package/dist/src/rlc-common/helpers/nameUtils.js.map +0 -1
  695. package/dist/src/rlc-common/helpers/operationHelpers.d.ts +0 -16
  696. package/dist/src/rlc-common/helpers/operationHelpers.d.ts.map +0 -1
  697. package/dist/src/rlc-common/helpers/operationHelpers.js +0 -104
  698. package/dist/src/rlc-common/helpers/operationHelpers.js.map +0 -1
  699. package/dist/src/rlc-common/helpers/packageUtil.d.ts +0 -7
  700. package/dist/src/rlc-common/helpers/packageUtil.d.ts.map +0 -1
  701. package/dist/src/rlc-common/helpers/packageUtil.js +0 -10
  702. package/dist/src/rlc-common/helpers/packageUtil.js.map +0 -1
  703. package/dist/src/rlc-common/helpers/pathUtils.d.ts +0 -2
  704. package/dist/src/rlc-common/helpers/pathUtils.d.ts.map +0 -1
  705. package/dist/src/rlc-common/helpers/pathUtils.js +0 -10
  706. package/dist/src/rlc-common/helpers/pathUtils.js.map +0 -1
  707. package/dist/src/rlc-common/helpers/schemaHelpers.d.ts +0 -10
  708. package/dist/src/rlc-common/helpers/schemaHelpers.d.ts.map +0 -1
  709. package/dist/src/rlc-common/helpers/schemaHelpers.js +0 -37
  710. package/dist/src/rlc-common/helpers/schemaHelpers.js.map +0 -1
  711. package/dist/src/rlc-common/helpers/shortcutMethods.d.ts +0 -4
  712. package/dist/src/rlc-common/helpers/shortcutMethods.d.ts.map +0 -1
  713. package/dist/src/rlc-common/helpers/shortcutMethods.js +0 -49
  714. package/dist/src/rlc-common/helpers/shortcutMethods.js.map +0 -1
  715. package/dist/src/rlc-common/helpers/typeUtil.d.ts +0 -32
  716. package/dist/src/rlc-common/helpers/typeUtil.d.ts.map +0 -1
  717. package/dist/src/rlc-common/helpers/typeUtil.js +0 -162
  718. package/dist/src/rlc-common/helpers/typeUtil.js.map +0 -1
  719. package/dist/src/rlc-common/helpers/valueGenerationUtil.d.ts +0 -12
  720. package/dist/src/rlc-common/helpers/valueGenerationUtil.d.ts.map +0 -1
  721. package/dist/src/rlc-common/helpers/valueGenerationUtil.js +0 -161
  722. package/dist/src/rlc-common/helpers/valueGenerationUtil.js.map +0 -1
  723. package/dist/src/rlc-common/metadata/buildApiExtractorConfig.d.ts +0 -6
  724. package/dist/src/rlc-common/metadata/buildApiExtractorConfig.d.ts.map +0 -1
  725. package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js +0 -55
  726. package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js.map +0 -1
  727. package/dist/src/rlc-common/metadata/buildChangelogFile.d.ts +0 -6
  728. package/dist/src/rlc-common/metadata/buildChangelogFile.d.ts.map +0 -1
  729. package/dist/src/rlc-common/metadata/buildChangelogFile.js +0 -25
  730. package/dist/src/rlc-common/metadata/buildChangelogFile.js.map +0 -1
  731. package/dist/src/rlc-common/metadata/buildESLintConfig.d.ts +0 -6
  732. package/dist/src/rlc-common/metadata/buildESLintConfig.d.ts.map +0 -1
  733. package/dist/src/rlc-common/metadata/buildESLintConfig.js +0 -79
  734. package/dist/src/rlc-common/metadata/buildESLintConfig.js.map +0 -1
  735. package/dist/src/rlc-common/metadata/buildLicenseFile.d.ts +0 -5
  736. package/dist/src/rlc-common/metadata/buildLicenseFile.d.ts.map +0 -1
  737. package/dist/src/rlc-common/metadata/buildLicenseFile.js +0 -32
  738. package/dist/src/rlc-common/metadata/buildLicenseFile.js.map +0 -1
  739. package/dist/src/rlc-common/metadata/buildPackageFile.d.ts +0 -25
  740. package/dist/src/rlc-common/metadata/buildPackageFile.d.ts.map +0 -1
  741. package/dist/src/rlc-common/metadata/buildPackageFile.js +0 -197
  742. package/dist/src/rlc-common/metadata/buildPackageFile.js.map +0 -1
  743. package/dist/src/rlc-common/metadata/buildReadmeFile.d.ts +0 -11
  744. package/dist/src/rlc-common/metadata/buildReadmeFile.d.ts.map +0 -1
  745. package/dist/src/rlc-common/metadata/buildReadmeFile.js +0 -418
  746. package/dist/src/rlc-common/metadata/buildReadmeFile.js.map +0 -1
  747. package/dist/src/rlc-common/metadata/buildRollupConfig.d.ts +0 -6
  748. package/dist/src/rlc-common/metadata/buildRollupConfig.d.ts.map +0 -1
  749. package/dist/src/rlc-common/metadata/buildRollupConfig.js +0 -140
  750. package/dist/src/rlc-common/metadata/buildRollupConfig.js.map +0 -1
  751. package/dist/src/rlc-common/metadata/buildSampleEnvFile.d.ts +0 -6
  752. package/dist/src/rlc-common/metadata/buildSampleEnvFile.d.ts.map +0 -1
  753. package/dist/src/rlc-common/metadata/buildSampleEnvFile.js +0 -15
  754. package/dist/src/rlc-common/metadata/buildSampleEnvFile.js.map +0 -1
  755. package/dist/src/rlc-common/metadata/buildTestConfig.d.ts +0 -16
  756. package/dist/src/rlc-common/metadata/buildTestConfig.d.ts.map +0 -1
  757. package/dist/src/rlc-common/metadata/buildTestConfig.js +0 -54
  758. package/dist/src/rlc-common/metadata/buildTestConfig.js.map +0 -1
  759. package/dist/src/rlc-common/metadata/buildTsConfig.d.ts +0 -61
  760. package/dist/src/rlc-common/metadata/buildTsConfig.d.ts.map +0 -1
  761. package/dist/src/rlc-common/metadata/buildTsConfig.js +0 -170
  762. package/dist/src/rlc-common/metadata/buildTsConfig.js.map +0 -1
  763. package/dist/src/rlc-common/metadata/buildVitestConfig.d.ts +0 -6
  764. package/dist/src/rlc-common/metadata/buildVitestConfig.d.ts.map +0 -1
  765. package/dist/src/rlc-common/metadata/buildVitestConfig.js +0 -26
  766. package/dist/src/rlc-common/metadata/buildVitestConfig.js.map +0 -1
  767. package/dist/src/rlc-common/metadata/buildWarpConfig.d.ts +0 -20
  768. package/dist/src/rlc-common/metadata/buildWarpConfig.d.ts.map +0 -1
  769. package/dist/src/rlc-common/metadata/buildWarpConfig.js +0 -76
  770. package/dist/src/rlc-common/metadata/buildWarpConfig.js.map +0 -1
  771. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts +0 -51
  772. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts.map +0 -1
  773. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js +0 -121
  774. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js.map +0 -1
  775. package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.d.ts +0 -242
  776. package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.d.ts.map +0 -1
  777. package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js +0 -171
  778. package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js.map +0 -1
  779. package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.d.ts +0 -8
  780. package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.d.ts.map +0 -1
  781. package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js +0 -101
  782. package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js.map +0 -1
  783. package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.d.ts +0 -57
  784. package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.d.ts.map +0 -1
  785. package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js +0 -53
  786. package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js.map +0 -1
  787. package/dist/src/rlc-common/metadata/packageJson/packageCommon.d.ts +0 -64
  788. package/dist/src/rlc-common/metadata/packageJson/packageCommon.d.ts.map +0 -1
  789. package/dist/src/rlc-common/metadata/packageJson/packageCommon.js +0 -180
  790. package/dist/src/rlc-common/metadata/packageJson/packageCommon.js.map +0 -1
  791. package/dist/src/rlc-common/static/paginateContent.d.ts +0 -2
  792. package/dist/src/rlc-common/static/paginateContent.d.ts.map +0 -1
  793. package/dist/src/rlc-common/static/paginateContent.js +0 -345
  794. package/dist/src/rlc-common/static/paginateContent.js.map +0 -1
  795. package/dist/src/rlc-common/static/pollingContent.d.ts +0 -2
  796. package/dist/src/rlc-common/static/pollingContent.d.ts.map +0 -1
  797. package/dist/src/rlc-common/static/pollingContent.js +0 -225
  798. package/dist/src/rlc-common/static/pollingContent.js.map +0 -1
  799. package/dist/src/rlc-common/static/sampleTemplate.d.ts +0 -2
  800. package/dist/src/rlc-common/static/sampleTemplate.d.ts.map +0 -1
  801. package/dist/src/rlc-common/static/sampleTemplate.js +0 -56
  802. package/dist/src/rlc-common/static/sampleTemplate.js.map +0 -1
  803. package/dist/src/rlc-common/static/serializeHelper.d.ts +0 -6
  804. package/dist/src/rlc-common/static/serializeHelper.d.ts.map +0 -1
  805. package/dist/src/rlc-common/static/serializeHelper.js +0 -31
  806. package/dist/src/rlc-common/static/serializeHelper.js.map +0 -1
  807. package/dist/src/rlc-common/test/buildKarmaConfig.d.ts +0 -6
  808. package/dist/src/rlc-common/test/buildKarmaConfig.d.ts.map +0 -1
  809. package/dist/src/rlc-common/test/buildKarmaConfig.js +0 -11
  810. package/dist/src/rlc-common/test/buildKarmaConfig.js.map +0 -1
  811. package/dist/src/rlc-common/test/buildRecordedClient.d.ts +0 -6
  812. package/dist/src/rlc-common/test/buildRecordedClient.d.ts.map +0 -1
  813. package/dist/src/rlc-common/test/buildRecordedClient.js +0 -17
  814. package/dist/src/rlc-common/test/buildRecordedClient.js.map +0 -1
  815. package/dist/src/rlc-common/test/buildSampleTest.d.ts +0 -6
  816. package/dist/src/rlc-common/test/buildSampleTest.d.ts.map +0 -1
  817. package/dist/src/rlc-common/test/buildSampleTest.js +0 -14
  818. package/dist/src/rlc-common/test/buildSampleTest.js.map +0 -1
  819. package/dist/src/rlc-common/test/buildSnippets.d.ts +0 -6
  820. package/dist/src/rlc-common/test/buildSnippets.d.ts.map +0 -1
  821. package/dist/src/rlc-common/test/buildSnippets.js +0 -26
  822. package/dist/src/rlc-common/test/buildSnippets.js.map +0 -1
  823. package/dist/src/rlc-common/transformSampleGroups.d.ts +0 -9
  824. package/dist/src/rlc-common/transformSampleGroups.d.ts.map +0 -1
  825. package/dist/src/rlc-common/transformSampleGroups.js +0 -313
  826. package/dist/src/rlc-common/transformSampleGroups.js.map +0 -1
  827. package/dist/src/transform/transformApiVersionInfo.d.ts +0 -6
  828. package/dist/src/transform/transformApiVersionInfo.d.ts.map +0 -1
  829. package/dist/src/transform/transformApiVersionInfo.js +0 -78
  830. package/dist/src/transform/transformApiVersionInfo.js.map +0 -1
  831. package/dist/src/transform/transformHelperFunctionDetails.d.ts +0 -5
  832. package/dist/src/transform/transformHelperFunctionDetails.d.ts.map +0 -1
  833. package/dist/src/transform/transformHelperFunctionDetails.js +0 -74
  834. package/dist/src/transform/transformHelperFunctionDetails.js.map +0 -1
  835. package/dist/src/transform/transformParameters.d.ts +0 -14
  836. package/dist/src/transform/transformParameters.d.ts.map +0 -1
  837. package/dist/src/transform/transformParameters.js +0 -201
  838. package/dist/src/transform/transformParameters.js.map +0 -1
  839. package/dist/src/transform/transformPaths.d.ts +0 -5
  840. package/dist/src/transform/transformPaths.d.ts.map +0 -1
  841. package/dist/src/transform/transformPaths.js +0 -102
  842. package/dist/src/transform/transformPaths.js.map +0 -1
  843. package/dist/src/transform/transformResponses.d.ts +0 -5
  844. package/dist/src/transform/transformResponses.d.ts.map +0 -1
  845. package/dist/src/transform/transformResponses.js +0 -171
  846. package/dist/src/transform/transformResponses.js.map +0 -1
  847. package/dist/src/transform/transformSchemas.d.ts +0 -4
  848. package/dist/src/transform/transformSchemas.d.ts.map +0 -1
  849. package/dist/src/transform/transformSchemas.js +0 -191
  850. package/dist/src/transform/transformSchemas.js.map +0 -1
  851. package/dist/src/transform/transformTelemetryInfo.d.ts +0 -4
  852. package/dist/src/transform/transformTelemetryInfo.d.ts.map +0 -1
  853. package/dist/src/transform/transformTelemetryInfo.js +0 -22
  854. package/dist/src/transform/transformTelemetryInfo.js.map +0 -1
  855. package/dist/src/transform/transfromRLCOptions.d.ts +0 -14
  856. package/dist/src/transform/transfromRLCOptions.d.ts.map +0 -1
  857. package/dist/src/transform/transfromRLCOptions.js +0 -369
  858. package/dist/src/transform/transfromRLCOptions.js.map +0 -1
  859. package/dist/src/utils/clientUtils.d.ts +0 -10
  860. package/dist/src/utils/clientUtils.d.ts.map +0 -1
  861. package/dist/src/utils/clientUtils.js +0 -124
  862. package/dist/src/utils/clientUtils.js.map +0 -1
  863. package/dist/src/utils/credentialUtils.d.ts +0 -15
  864. package/dist/src/utils/credentialUtils.d.ts.map +0 -1
  865. package/dist/src/utils/credentialUtils.js +0 -68
  866. package/dist/src/utils/credentialUtils.js.map +0 -1
  867. package/dist/src/utils/crossLanguageDef.d.ts +0 -6
  868. package/dist/src/utils/crossLanguageDef.d.ts.map +0 -1
  869. package/dist/src/utils/crossLanguageDef.js +0 -59
  870. package/dist/src/utils/crossLanguageDef.js.map +0 -1
  871. package/dist/src/utils/emitUtil.d.ts +0 -5
  872. package/dist/src/utils/emitUtil.d.ts.map +0 -1
  873. package/dist/src/utils/emitUtil.js +0 -71
  874. package/dist/src/utils/emitUtil.js.map +0 -1
  875. package/dist/src/utils/fileSystemUtils.d.ts +0 -5
  876. package/dist/src/utils/fileSystemUtils.d.ts.map +0 -1
  877. package/dist/src/utils/fileSystemUtils.js +0 -59
  878. package/dist/src/utils/fileSystemUtils.js.map +0 -1
  879. package/dist/src/utils/importHelper.d.ts +0 -10
  880. package/dist/src/utils/importHelper.d.ts.map +0 -1
  881. package/dist/src/utils/importHelper.js +0 -51
  882. package/dist/src/utils/importHelper.js.map +0 -1
  883. package/dist/src/utils/mediaTypes.d.ts +0 -28
  884. package/dist/src/utils/mediaTypes.d.ts.map +0 -1
  885. package/dist/src/utils/mediaTypes.js +0 -124
  886. package/dist/src/utils/mediaTypes.js.map +0 -1
  887. package/dist/src/utils/modelUtils.d.ts +0 -60
  888. package/dist/src/utils/modelUtils.d.ts.map +0 -1
  889. package/dist/src/utils/modelUtils.js +0 -1488
  890. package/dist/src/utils/modelUtils.js.map +0 -1
  891. package/dist/src/utils/namespaceUtils.d.ts +0 -6
  892. package/dist/src/utils/namespaceUtils.d.ts.map +0 -1
  893. package/dist/src/utils/namespaceUtils.js +0 -69
  894. package/dist/src/utils/namespaceUtils.js.map +0 -1
  895. package/dist/src/utils/operationUtil.d.ts +0 -97
  896. package/dist/src/utils/operationUtil.d.ts.map +0 -1
  897. package/dist/src/utils/operationUtil.js +0 -547
  898. package/dist/src/utils/operationUtil.js.map +0 -1
  899. package/dist/src/utils/parameterUtils.d.ts +0 -9
  900. package/dist/src/utils/parameterUtils.d.ts.map +0 -1
  901. package/dist/src/utils/parameterUtils.js +0 -147
  902. package/dist/src/utils/parameterUtils.js.map +0 -1
  903. package/src/contextManager.ts +0 -101
  904. package/src/framework/hooks/sdkTypes.ts +0 -218
  905. package/src/framework/hooks/useDependencies.ts +0 -16
  906. package/src/modular/buildClassicalClient.ts +0 -434
  907. package/src/modular/buildClassicalOperationGroups.ts +0 -69
  908. package/src/modular/buildClientContext.ts +0 -325
  909. package/src/modular/buildOperations.ts +0 -248
  910. package/src/modular/buildProjectFiles.ts +0 -111
  911. package/src/modular/buildRestorePoller.ts +0 -242
  912. package/src/modular/buildRootIndex.ts +0 -407
  913. package/src/modular/buildSubpathIndex.ts +0 -152
  914. package/src/modular/emitLoggerFile.ts +0 -23
  915. package/src/modular/emitModels.ts +0 -1081
  916. package/src/modular/emitModelsOptions.ts +0 -56
  917. package/src/modular/emitSamples.ts +0 -675
  918. package/src/modular/emitTests.ts +0 -194
  919. package/src/modular/helpers/classicalOperationHelpers.ts +0 -375
  920. package/src/modular/helpers/clientHelpers.ts +0 -362
  921. package/src/modular/helpers/exampleValueHelpers.ts +0 -851
  922. package/src/modular/helpers/namingHelpers.ts +0 -84
  923. package/src/modular/helpers/operationHelpers.ts +0 -3035
  924. package/src/modular/helpers/typeHelpers.ts +0 -131
  925. package/src/modular/serialization/buildDeserializerFunction.ts +0 -564
  926. package/src/modular/serialization/buildSerializerFunction.ts +0 -616
  927. package/src/modular/serialization/buildXmlSerializerFunction.ts +0 -951
  928. package/src/modular/serialization/serializeUtils.ts +0 -217
  929. package/src/rlc-common/buildClient.ts +0 -490
  930. package/src/rlc-common/buildClientDefinitions.ts +0 -235
  931. package/src/rlc-common/buildIndexFile.ts +0 -344
  932. package/src/rlc-common/buildIsUnexpectedHelper.ts +0 -248
  933. package/src/rlc-common/buildLogger.ts +0 -43
  934. package/src/rlc-common/buildMethodShortcuts.ts +0 -71
  935. package/src/rlc-common/buildObjectTypes.ts +0 -603
  936. package/src/rlc-common/buildPaginateHelper.ts +0 -31
  937. package/src/rlc-common/buildParameterTypes.ts +0 -554
  938. package/src/rlc-common/buildPollingHelper.ts +0 -83
  939. package/src/rlc-common/buildResponseTypes.ts +0 -180
  940. package/src/rlc-common/buildSamples.ts +0 -32
  941. package/src/rlc-common/buildSchemaType.ts +0 -89
  942. package/src/rlc-common/buildSerializeHelper.ts +0 -49
  943. package/src/rlc-common/buildTopLevelIndexFile.ts +0 -58
  944. package/src/rlc-common/helpers/nameConstructors.ts +0 -110
  945. package/src/rlc-common/helpers/operationHelpers.ts +0 -138
  946. package/src/rlc-common/helpers/shortcutMethods.ts +0 -58
  947. package/src/rlc-common/helpers/valueGenerationUtil.ts +0 -234
  948. package/src/rlc-common/metadata/buildPackageFile.ts +0 -242
  949. package/src/rlc-common/metadata/buildReadmeFile.ts +0 -515
  950. package/src/rlc-common/metadata/buildRollupConfig.ts +0 -147
  951. package/src/rlc-common/metadata/packageJson/azurePackageCommon.ts +0 -152
  952. package/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.ts +0 -199
  953. package/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.ts +0 -123
  954. package/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.ts +0 -68
  955. package/src/rlc-common/test/buildSnippets.ts +0 -29
  956. package/src/rlc-common/transformSampleGroups.ts +0 -407
  957. package/src/transform/transformApiVersionInfo.ts +0 -103
  958. package/src/transform/transformHelperFunctionDetails.ts +0 -88
  959. package/src/transform/transformParameters.ts +0 -321
  960. package/src/transform/transformPaths.ts +0 -157
  961. package/src/transform/transformResponses.ts +0 -237
  962. package/src/transform/transformSchemas.ts +0 -212
  963. package/src/transform/transformTelemetryInfo.ts +0 -33
  964. package/src/transform/transfromRLCOptions.ts +0 -461
  965. package/src/utils/crossLanguageDef.ts +0 -66
  966. package/src/utils/importHelper.ts +0 -59
  967. package/src/utils/modelUtils.ts +0 -1737
  968. package/src/utils/operationUtil.ts +0 -763
  969. package/src/utils/parameterUtils.ts +0 -192
  970. /package/src/{metaTree.ts → meta-tree.ts} +0 -0
  971. /package/src/modular/{buildModularOptions.ts → build-modular-options.ts} +0 -0
  972. /package/src/modular/helpers/{clientOptionHelpers.ts → client-option-helpers.ts} +0 -0
  973. /package/src/modular/helpers/{docsHelpers.ts → docs-helpers.ts} +0 -0
  974. /package/src/rlc-common/helpers/{apiVersionUtil.ts → api-version-util.ts} +0 -0
  975. /package/src/rlc-common/helpers/{importsUtil.ts → imports-util.ts} +0 -0
  976. /package/src/rlc-common/helpers/{nameUtils.ts → name-utils.ts} +0 -0
  977. /package/src/rlc-common/helpers/{packageUtil.ts → package-util.ts} +0 -0
  978. /package/src/rlc-common/helpers/{pathUtils.ts → path-utils.ts} +0 -0
  979. /package/src/rlc-common/helpers/{schemaHelpers.ts → schema-helpers.ts} +0 -0
  980. /package/src/rlc-common/helpers/{typeUtil.ts → type-util.ts} +0 -0
  981. /package/src/rlc-common/metadata/{buildApiExtractorConfig.ts → build-api-extractor-config.ts} +0 -0
  982. /package/src/rlc-common/metadata/{buildChangelogFile.ts → build-changelog-file.ts} +0 -0
  983. /package/src/rlc-common/metadata/{buildESLintConfig.ts → build-es-lint-config.ts} +0 -0
  984. /package/src/rlc-common/metadata/{buildLicenseFile.ts → build-license-file.ts} +0 -0
  985. /package/src/rlc-common/metadata/{buildSampleEnvFile.ts → build-sample-env-file.ts} +0 -0
  986. /package/src/rlc-common/metadata/{buildTestConfig.ts → build-test-config.ts} +0 -0
  987. /package/src/rlc-common/metadata/{buildTsConfig.ts → build-ts-config.ts} +0 -0
  988. /package/src/rlc-common/metadata/{buildVitestConfig.ts → build-vitest-config.ts} +0 -0
  989. /package/src/rlc-common/metadata/{buildWarpConfig.ts → build-warp-config.ts} +0 -0
  990. /package/src/rlc-common/metadata/{packageJson/packageCommon.ts → package-json/package-common.ts} +0 -0
  991. /package/src/rlc-common/static/{paginateContent.ts → paginate-content.ts} +0 -0
  992. /package/src/rlc-common/static/{pollingContent.ts → polling-content.ts} +0 -0
  993. /package/src/rlc-common/static/{sampleTemplate.ts → sample-template.ts} +0 -0
  994. /package/src/rlc-common/static/{serializeHelper.ts → serialize-helper.ts} +0 -0
  995. /package/src/rlc-common/test/{buildKarmaConfig.ts → build-karma-config.ts} +0 -0
  996. /package/src/rlc-common/test/{buildRecordedClient.ts → build-recorded-client.ts} +0 -0
  997. /package/src/rlc-common/test/{buildSampleTest.ts → build-sample-test.ts} +0 -0
  998. /package/src/utils/{clientUtils.ts → client-utils.ts} +0 -0
  999. /package/src/utils/{credentialUtils.ts → credential-utils.ts} +0 -0
  1000. /package/src/utils/{emitUtil.ts → emit-util.ts} +0 -0
  1001. /package/src/utils/{fileSystemUtils.ts → file-system-utils.ts} +0 -0
  1002. /package/src/utils/{mediaTypes.ts → media-types.ts} +0 -0
  1003. /package/src/utils/{namespaceUtils.ts → namespace-utils.ts} +0 -0
@@ -0,0 +1,2328 @@
1
+ import { getClientOptions, isHttpMetadata, isReadOnly, } from "@azure-tools/typespec-client-generator-core";
2
+ import { NoTarget } from "@typespec/compiler";
3
+ import { isHeader, isMetadata } from "@typespec/http";
4
+ import { StructureKind, } from "ts-morph";
5
+ import { useContext } from "../../context-manager.js";
6
+ import { useSdkTypes } from "../../framework/hooks/sdk-types.js";
7
+ import { useDependencies } from "../../framework/hooks/use-dependencies.js";
8
+ import { resolveReference } from "../../framework/reference.js";
9
+ import { refkey } from "../../framework/refkey.js";
10
+ import { reportDiagnostic } from "../../lib.js";
11
+ import { NameType, normalizeName } from "../../rlc-common/index.js";
12
+ import { isAzureCoreErrorType } from "../../utils/model-utils.js";
13
+ import { getCollectionFormatFromArrayEncoding, getCollectionFormatHelper, getCollectionFormatParseHelper, hasCollectionFormatInfo, hasDualFormatSupport, isBinaryPayload, isMultipartPayload, isXmlPayload, KnownCollectionFormat, } from "../../utils/operation-util.js";
14
+ import { AzurePollingDependencies } from "../external-dependencies.js";
15
+ import { buildModelDeserializer, buildPropertyDeserializer, } from "../serialization/build-deserializer-function.js";
16
+ import { buildModelSerializer, buildPropertySerializer, } from "../serialization/build-serializer-function.js";
17
+ import { buildXmlModelDeserializer, buildXmlModelSerializer, hasXmlSerialization, } from "../serialization/build-xml-serializer-function.js";
18
+ import { getPropertyWithOverrides, isNormalUnion, isSpecialHandledUnion, } from "../serialization/serialize-utils.js";
19
+ import { PagingHelpers, PlatformTypeHelpers, PollingHelpers, SerializationHelpers, StorageCompatHelpers, UrlTemplateHelpers, XmlHelpers, } from "../static-helpers-metadata.js";
20
+ import { isExtensibleEnum } from "../type-expressions/get-enum-expression.js";
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 "./client-helpers.js";
24
+ import { getHeaderClientOptions, getRestErrorCodeHeader } from "./client-option-helpers.js";
25
+ import { getDocsFromDescription, getFixmeForMultilineDocs } from "./docs-helpers.js";
26
+ import { generateLocallyUniqueName, getClassicalLayerPrefix, getOperationName, } from "./naming-helpers.js";
27
+ import { getNullableValidType, isSpreadBodyParameter, isTypeNullable } from "./type-helpers.js";
28
+ /**
29
+ * Checks whether a header should be skipped during serialization/deserialization.
30
+ * A header is skipped when it has the "headerCollectionPrefix" client option set,
31
+ * which indicates it uses a prefix-based dictionary pattern not handled by standard ser/deser.
32
+ */
33
+ function shouldSkipHeaderSerialization(header) {
34
+ return getClientOptions(header, "headerCollectionPrefix") !== undefined;
35
+ }
36
+ export function getSendPrivateFunction(dpgContext, method, clientType, client) {
37
+ const operation = method[1];
38
+ const parameters = getOperationSignatureParameters(dpgContext, method, clientType);
39
+ const { name } = getOperationName(operation);
40
+ const dependencies = useDependencies();
41
+ const functionStatement = {
42
+ isAsync: false,
43
+ isExported: true,
44
+ name: `_${name}Send`,
45
+ parameters,
46
+ returnType: resolveReference(dependencies.StreamableMethod),
47
+ };
48
+ const operationPath = operation.operation.path;
49
+ const operationMethod = operation.operation.verb.toLowerCase();
50
+ const optionalParamName = getOptionalParamsName(parameters);
51
+ const statements = [];
52
+ let pathStr = `"${operationPath}"`;
53
+ const urlTemplateParams = [
54
+ ...getPathParameters(operation),
55
+ ...getQueryParameters(dpgContext, operation),
56
+ ];
57
+ if (urlTemplateParams.length > 0) {
58
+ // Generate a unique local variable name that doesn't conflict with parameter names
59
+ const paramNames = new Set(parameters.map((p) => p.name));
60
+ const pathVarName = generateLocallyUniqueName("path", paramNames);
61
+ const includeRootSlash = client ? getClientOptions(client, "includeRootSlash") !== false : true;
62
+ const uriTemplate = includeRootSlash
63
+ ? operation.operation.uriTemplate
64
+ : operation.operation.uriTemplate.replace(/^\//, "");
65
+ statements.push(`const ${pathVarName} = ${resolveReference(UrlTemplateHelpers.parseTemplate)}("${uriTemplate}", {
66
+ ${urlTemplateParams.join(",\n")}
67
+ },{
68
+ allowReserved: ${optionalParamName}?.requestOptions?.skipUrlEncoding
69
+ });`);
70
+ pathStr = pathVarName;
71
+ }
72
+ statements.push(`return context.path(${pathStr}).${operationMethod}({...${resolveReference(dependencies.operationOptionsToRequestParameters)}(${optionalParamName}), ${getHeaderAndBodyParameters(dpgContext, operation, optionalParamName)}});`);
73
+ return {
74
+ ...functionStatement,
75
+ statements,
76
+ };
77
+ }
78
+ export function getDeserializePrivateFunction(context, method) {
79
+ const operation = method[1];
80
+ const { name } = getOperationName(operation);
81
+ const dependencies = useDependencies();
82
+ const PathUncheckedResponseReference = resolveReference(dependencies.PathUncheckedResponse);
83
+ // Check if we need to wrap the non-model return type
84
+ const { shouldWrap, isBinary } = checkWrapNonModelReturn(context, operation);
85
+ // For binary wrap, the deserializer receives PathUncheckedResponse & { blobBody, readableStreamBody }
86
+ // which is returned by getBinaryStreamResponse.
87
+ const isBinaryWrap = shouldWrap && isBinary;
88
+ const isLroOnly = isLroOnlyOperation(operation);
89
+ const isLroAndPaging = isLroAndPagingOperation(operation);
90
+ const isPagingOnly = isPagingOnlyOperation(operation);
91
+ // TODO: Support operation overloads
92
+ // TODO: Support multiple responses
93
+ const response = operation.response;
94
+ const restResponse = operation.operation.responses[0];
95
+ let returnType;
96
+ if (isLroOnly || isLroAndPaging) {
97
+ if (isLroOnly && shouldWrap) {
98
+ // For LRO-only operations with non-model final result, wrap in a response type alias
99
+ returnType = {
100
+ name: getOperationResponseTypeName(method),
101
+ type: resolveReference(refkey(operation, "response")),
102
+ };
103
+ }
104
+ else {
105
+ returnType = buildLroReturnType(context, operation);
106
+ }
107
+ }
108
+ else if (isPagingOnly && restResponse?.type) {
109
+ // For paging operations, use the full response model (e.g., _OperationListResult)
110
+ // instead of just the array element type
111
+ returnType = {
112
+ name: restResponse.name ?? "",
113
+ type: getTypeExpression(context, restResponse.type),
114
+ };
115
+ }
116
+ else if (shouldWrap) {
117
+ // Use the wrapper response type name (resolved via binder for cross-file imports)
118
+ returnType = {
119
+ name: getOperationResponseTypeName(method),
120
+ type: resolveReference(refkey(operation, "response")),
121
+ };
122
+ }
123
+ else if (response.type) {
124
+ // When response.optional is true, some HTTP responses have no body (e.g. 204), so
125
+ // the return type must include undefined to reflect that possibility.
126
+ const baseType = getTypeExpression(context, response.type);
127
+ returnType = {
128
+ name: response.name ?? "",
129
+ type: response.optional ? `${baseType} | undefined` : baseType,
130
+ };
131
+ }
132
+ else if (isHeadAsBooleanOperation(operation)) {
133
+ returnType = { name: "", type: "boolean" };
134
+ }
135
+ else {
136
+ returnType = { name: "", type: "void" };
137
+ }
138
+ const resultParamName = "result";
139
+ const resultParamType = isBinaryWrap
140
+ ? `${PathUncheckedResponseReference} & ${returnType.type}`
141
+ : PathUncheckedResponseReference;
142
+ const parameters = [
143
+ {
144
+ name: resultParamName,
145
+ type: resultParamType,
146
+ },
147
+ ];
148
+ const functionStatement = {
149
+ isAsync: true,
150
+ isExported: true,
151
+ name: `_${name}Deserialize`,
152
+ parameters,
153
+ returnType: `Promise<${returnType.type}>`,
154
+ };
155
+ const statements = [];
156
+ const createRestErrorReference = resolveReference(dependencies.createRestError);
157
+ statements.push(`const expectedStatuses = ${getExpectedStatuses(operation)};`);
158
+ statements.push(`if(!expectedStatuses.includes(result.status)){`, `${getExceptionThrowStatement(context, operation)}`, "}");
159
+ const deserializedType = isLroOnly || isLroAndPaging
160
+ ? operation?.lroMetadata?.finalResponse?.result
161
+ : isPagingOnly && restResponse?.type
162
+ ? restResponse.type
163
+ : response.type;
164
+ const lroSubSegments = isLroOnly
165
+ ? operation?.lroMetadata?.finalResponse?.resultSegments
166
+ : undefined;
167
+ let lroSubPath;
168
+ if (lroSubSegments && lroSubSegments.length > 0) {
169
+ lroSubPath = lroSubSegments
170
+ .map((property) => {
171
+ return property.name;
172
+ })
173
+ .join(".");
174
+ }
175
+ const deserializePrefix = "result.body";
176
+ const deserializedRoot = `${deserializePrefix}${lroSubPath ? "." + lroSubPath : ""}`;
177
+ if (isLroOnly && lroSubPath) {
178
+ statements.push(`if(${deserializedRoot.split(".").join("?.")} === undefined) {
179
+ throw ${createRestErrorReference}(\`Expected a result in the response at position "${deserializedRoot}"\`, result);
180
+ }
181
+ `);
182
+ }
183
+ if (deserializedType) {
184
+ // When the method response is optional (some HTTP responses have no body, e.g. 204),
185
+ // guard all body deserialization so we return undefined instead of throwing.
186
+ // This only applies to non-LRO, non-paging operations where the deserialized type
187
+ // comes from response.type (not from LRO metadata or paging).
188
+ const needsBodyGuard = response.optional && !isLroOnly && !isLroAndPaging && !isPagingOnly;
189
+ const contentTypes = operation.operation.responses[0]?.contentTypes ?? [];
190
+ const isXml = isXmlPayload(contentTypes);
191
+ const isDualFormat = hasDualFormatSupport(contentTypes);
192
+ const isMultipart = isMultipartPayload(contentTypes);
193
+ const useXmlDeserialization = isXml && deserializedType.kind === "model" && hasXmlSerialization(deserializedType);
194
+ // Workaround for multipart response: cast return value as any due to lack of multipart response handling in core
195
+ const multipartCastSuffix = isMultipart ? " as any" : "";
196
+ // For dual-format responses, check content-type header at runtime
197
+ if (isDualFormat &&
198
+ deserializedType.kind === "model" &&
199
+ hasXmlSerialization(deserializedType)) {
200
+ if (needsBodyGuard) {
201
+ statements.push(`if (!result.body) {
202
+ return result.body as ${returnType.type};
203
+ }`);
204
+ }
205
+ const xmlDeserializerName = buildXmlModelDeserializer(context, deserializedType, {
206
+ nameOnly: true,
207
+ skipDiscriminatedUnionSuffix: false,
208
+ });
209
+ const jsonDeserializerName = buildModelDeserializer(context, deserializedType, {
210
+ nameOnly: true,
211
+ skipDiscriminatedUnionSuffix: false,
212
+ });
213
+ if (xmlDeserializerName && jsonDeserializerName) {
214
+ const isXmlContentTypeRef = resolveReference(XmlHelpers.isXmlContentType);
215
+ statements.push(`const responseContentType = result.headers?.["content-type"] ?? "";
216
+ if (${isXmlContentTypeRef}(responseContentType)) {
217
+ return ${xmlDeserializerName}(${deserializedRoot});
218
+ }
219
+ return ${jsonDeserializerName}(${deserializedRoot});`);
220
+ }
221
+ else {
222
+ // Fall back to JSON deserializer
223
+ const deserializeFunctionName = buildModelDeserializer(context, deserializedType, {
224
+ nameOnly: true,
225
+ skipDiscriminatedUnionSuffix: false,
226
+ });
227
+ if (deserializeFunctionName) {
228
+ statements.push(`return ${deserializeFunctionName}(${deserializedRoot})`);
229
+ }
230
+ }
231
+ }
232
+ else if (useXmlDeserialization) {
233
+ // XML-only response
234
+ if (needsBodyGuard) {
235
+ statements.push(`if (!result.body) {
236
+ return result.body as ${returnType.type};
237
+ }`);
238
+ }
239
+ const xmlDeserializerName = buildXmlModelDeserializer(context, deserializedType, {
240
+ nameOnly: true,
241
+ skipDiscriminatedUnionSuffix: false,
242
+ });
243
+ if (xmlDeserializerName) {
244
+ statements.push(`return ${xmlDeserializerName}(${deserializedRoot})`);
245
+ }
246
+ else {
247
+ // Fall back to JSON deserializer if XML deserializer is not available
248
+ const deserializeFunctionName = buildModelDeserializer(context, deserializedType, {
249
+ nameOnly: true,
250
+ skipDiscriminatedUnionSuffix: false,
251
+ });
252
+ if (deserializeFunctionName) {
253
+ statements.push(`return ${deserializeFunctionName}(${deserializedRoot})`);
254
+ }
255
+ else {
256
+ statements.push(`return ${deserializedRoot}`);
257
+ }
258
+ }
259
+ }
260
+ else {
261
+ // JSON response (default) - also handles multipart responses
262
+ const deserializeFunctionName = buildModelDeserializer(context, deserializedType, {
263
+ nameOnly: true,
264
+ skipDiscriminatedUnionSuffix: false,
265
+ });
266
+ // Handle wrap-non-model-return for non-LRO, non-paging and LRO-only operations
267
+ if (shouldWrap) {
268
+ if (isBinary) {
269
+ // Binary wrap: getBinaryStream already resolved the stream,
270
+ // status check and error.details handling ran above.
271
+ // Return the platform-specific stream properties.
272
+ statements.push(`return { blobBody: result.blobBody, readableStreamBody: result.readableStreamBody };`);
273
+ }
274
+ else if (isHeadAsBooleanOperation(operation)) {
275
+ // HEAD has no body; derive boolean from status code
276
+ statements.push(`return { body: result.status.startsWith("2") };`);
277
+ }
278
+ else {
279
+ // Non-model response: wrap with body property
280
+ // Generate the appropriate deserialization for the body value.
281
+ // For LRO operations, deserializedRoot may include the sub-path (e.g. result.body.someProperty).
282
+ const bodyValue = deserializeResponseValue(context, deserializedType, deserializedRoot, true, getEncodeForType(deserializedType));
283
+ statements.push(`return { body: ${bodyValue} };`);
284
+ }
285
+ return {
286
+ ...functionStatement,
287
+ statements,
288
+ };
289
+ }
290
+ if (deserializeFunctionName) {
291
+ if (needsBodyGuard) {
292
+ // Use ternary form: return result.body ? deserializer(result.body) : undefined
293
+ statements.push(`return ${deserializedRoot} ? ${deserializeFunctionName}(${deserializedRoot})${multipartCastSuffix} : undefined`);
294
+ }
295
+ else {
296
+ statements.push(`return ${deserializeFunctionName}(${deserializedRoot})${multipartCastSuffix}`);
297
+ }
298
+ }
299
+ else if (isAzureCoreErrorType(context.program, deserializedType.__raw)) {
300
+ statements.push(`return ${deserializedRoot}${multipartCastSuffix}`);
301
+ }
302
+ else if (isHeadAsBooleanOperation(operation)) {
303
+ // HEAD has no body; derive boolean from status code
304
+ statements.push(`return result.status.startsWith("2");`);
305
+ }
306
+ else {
307
+ statements.push(`return ${deserializeResponseValue(context, deserializedType, deserializedRoot, true, isBinaryPayload(context, response.type.__raw, contentTypes, getEncodeForType(response.type))
308
+ ? "binary"
309
+ : getEncodeForType(deserializedType))}${multipartCastSuffix}`);
310
+ }
311
+ }
312
+ }
313
+ else if (isHeadAsBooleanOperation(operation)) {
314
+ if (shouldWrap) {
315
+ statements.push(`return { body: result.status.startsWith("2") };`);
316
+ }
317
+ else {
318
+ statements.push(`return result.status.startsWith("2");`);
319
+ }
320
+ }
321
+ else {
322
+ statements.push("return;");
323
+ }
324
+ return {
325
+ ...functionStatement,
326
+ statements,
327
+ };
328
+ }
329
+ /**
330
+ * Generates a private function to deserialize response headers.
331
+ * Only generated when response headers are present and include-headers-in-response
332
+ * or enable-storage-compat is enabled.
333
+ */
334
+ export function getDeserializeHeadersPrivateFunction(context, operation) {
335
+ const responseHeaders = getResponseHeaders(operation.operation.responses);
336
+ const isResponseHeadersEnabled = context.rlcOptions?.includeHeadersInResponse === true;
337
+ const isStorageCompatEnabled = context.rlcOptions?.enableStorageCompat === true;
338
+ // Only generate if headers exist and a relevant feature is enabled
339
+ if (responseHeaders.length === 0 || (!isResponseHeadersEnabled && !isStorageCompatEnabled)) {
340
+ return undefined;
341
+ }
342
+ const { name } = getOperationName(operation);
343
+ const dependencies = useDependencies();
344
+ const PathUncheckedResponseReference = resolveReference(dependencies.PathUncheckedResponse);
345
+ const parameters = [
346
+ {
347
+ name: "result",
348
+ type: PathUncheckedResponseReference,
349
+ },
350
+ ];
351
+ const returnType = buildHeaderOnlyResponseType(context, responseHeaders);
352
+ const functionStatement = {
353
+ isAsync: false,
354
+ isExported: true,
355
+ name: `_${name}DeserializeHeaders`,
356
+ parameters,
357
+ returnType,
358
+ };
359
+ const statements = [];
360
+ statements.push(`return ${buildHeaderOnlyResponseValue(context, responseHeaders)};`);
361
+ return {
362
+ ...functionStatement,
363
+ statements,
364
+ };
365
+ }
366
+ function getExceptionDetails(context, operation) {
367
+ const customized = [];
368
+ let defaultDeserializer;
369
+ let defaultXmlDeserializer;
370
+ let defaultIsXmlOnly;
371
+ for (const exception of operation.operation.exceptions) {
372
+ if (!exception.type) {
373
+ continue;
374
+ }
375
+ const statusCode = exception.statusCodes;
376
+ const deserializeFunctionName = buildModelDeserializer(context, exception.type, {
377
+ nameOnly: true,
378
+ skipDiscriminatedUnionSuffix: false,
379
+ });
380
+ if (!deserializeFunctionName || typeof deserializeFunctionName !== "string") {
381
+ continue;
382
+ }
383
+ // Check if the exception type has XML serialization support
384
+ // Use exception contentTypes when available, otherwise check the type itself
385
+ const exceptionContentTypes = exception.contentTypes ?? [];
386
+ const exceptionIsXml = isXmlPayload(exceptionContentTypes);
387
+ const exceptionIsDualFormat = hasDualFormatSupport(exceptionContentTypes);
388
+ const typeHasXml = exception.type.kind === "model" && hasXmlSerialization(exception.type);
389
+ let xmlDeserializerName;
390
+ if (exception.type.kind === "model" && (typeHasXml || exceptionIsXml)) {
391
+ const xmlName = buildXmlModelDeserializer(context, exception.type, {
392
+ nameOnly: true,
393
+ skipDiscriminatedUnionSuffix: false,
394
+ });
395
+ if (typeof xmlName === "string") {
396
+ xmlDeserializerName = xmlName;
397
+ }
398
+ }
399
+ // XML-only when all content types are XML (no JSON support)
400
+ const isXmlOnly = xmlDeserializerName !== undefined && exceptionIsXml && !exceptionIsDualFormat;
401
+ if (statusCode === "*") {
402
+ defaultDeserializer = deserializeFunctionName;
403
+ defaultXmlDeserializer = xmlDeserializerName;
404
+ defaultIsXmlOnly = isXmlOnly;
405
+ }
406
+ else if (typeof statusCode === "number") {
407
+ customized.push({
408
+ start: statusCode,
409
+ deserializer: deserializeFunctionName,
410
+ xmlDeserializer: xmlDeserializerName,
411
+ isXmlOnly,
412
+ });
413
+ }
414
+ else {
415
+ customized.push({
416
+ start: statusCode.start,
417
+ end: statusCode.end,
418
+ deserializer: deserializeFunctionName,
419
+ xmlDeserializer: xmlDeserializerName,
420
+ isXmlOnly,
421
+ });
422
+ }
423
+ }
424
+ return {
425
+ customized,
426
+ defaultDeserializer,
427
+ defaultXmlDeserializer,
428
+ defaultIsXmlOnly,
429
+ };
430
+ }
431
+ /**
432
+ * Collects and deduplicates all response headers from operation exceptions.
433
+ */
434
+ function getExceptionResponseHeaders(exceptions) {
435
+ const headerMap = new Map();
436
+ for (const exception of exceptions ?? []) {
437
+ for (const header of exception.headers ?? []) {
438
+ if (shouldSkipHeaderSerialization(header))
439
+ continue;
440
+ const key = header.serializedName ?? header.name;
441
+ if (!headerMap.has(key)) {
442
+ headerMap.set(key, header);
443
+ }
444
+ }
445
+ }
446
+ return Array.from(headerMap.values());
447
+ }
448
+ /**
449
+ * Generates a private function to deserialize exception response headers.
450
+ * Only generated when exception headers are present and include-headers-in-response is enabled.
451
+ */
452
+ export function getDeserializeExceptionHeadersPrivateFunction(context, operation) {
453
+ const isResponseHeadersEnabled = context.rlcOptions?.includeHeadersInResponse === true;
454
+ if (!isResponseHeadersEnabled) {
455
+ return undefined;
456
+ }
457
+ const exceptionHeaders = getExceptionResponseHeaders(operation.operation.exceptions);
458
+ if (exceptionHeaders.length === 0) {
459
+ return undefined;
460
+ }
461
+ const { name } = getOperationName(operation);
462
+ const dependencies = useDependencies();
463
+ const PathUncheckedResponseReference = resolveReference(dependencies.PathUncheckedResponse);
464
+ const parameters = [
465
+ {
466
+ name: "result",
467
+ type: PathUncheckedResponseReference,
468
+ },
469
+ ];
470
+ const returnType = buildHeaderOnlyResponseType(context, exceptionHeaders);
471
+ const functionStatement = {
472
+ isAsync: false,
473
+ isExported: true,
474
+ name: `_${name}DeserializeExceptionHeaders`,
475
+ parameters,
476
+ returnType,
477
+ };
478
+ const statements = [];
479
+ statements.push(`return ${buildHeaderOnlyResponseValue(context, exceptionHeaders)};`);
480
+ return {
481
+ ...functionStatement,
482
+ statements,
483
+ };
484
+ }
485
+ function getExceptionDeserializeExpr(exception) {
486
+ if (!exception.xmlDeserializer) {
487
+ return `${exception.deserializer}(result.body)`;
488
+ }
489
+ if (exception.isXmlOnly) {
490
+ return `${exception.xmlDeserializer}(result.body)`;
491
+ }
492
+ return `isXml ? ${exception.xmlDeserializer}(result.body) : ${exception.deserializer}(result.body)`;
493
+ }
494
+ function getExceptionThrowStatement(context, operation) {
495
+ const statements = [];
496
+ const createRestErrorReference = resolveReference(useDependencies().createRestError);
497
+ const { customized, defaultDeserializer, defaultXmlDeserializer, defaultIsXmlOnly } = getExceptionDetails(context, operation);
498
+ const isResponseHeadersEnabled = context.rlcOptions?.includeHeadersInResponse === true;
499
+ // Check if exception headers function exists and build the call
500
+ const exceptionHeaders = getExceptionResponseHeaders(operation.operation.exceptions);
501
+ const hasExceptionHeaders = isResponseHeadersEnabled && exceptionHeaders.length > 0;
502
+ const { name: opName } = getOperationName(operation);
503
+ const exceptionHeadersCall = hasExceptionHeaders
504
+ ? `error.details = {...(error.details as any), ..._${opName}DeserializeExceptionHeaders(result)};`
505
+ : undefined;
506
+ // Build @clientOption("header", ...) extraction code (independent of include-headers-in-response)
507
+ const clientOptionHeadersCall = buildClientOptionHeadersCall(operation.operation.exceptions);
508
+ // Build @clientOption("restErrorCodeHeader", ...) code to set error.code from a header
509
+ const restErrorCodeAssignment = buildRestErrorCodeAssignment(operation.operation.exceptions);
510
+ const allHeaderCalls = [exceptionHeadersCall, clientOptionHeadersCall, restErrorCodeAssignment]
511
+ .filter(Boolean)
512
+ .join("\n");
513
+ // Check if any exception has XML deserialization support that requires runtime content-type check
514
+ const hasAnyDualFormatXml = (defaultXmlDeserializer !== undefined && !defaultIsXmlOnly) ||
515
+ customized.some((e) => e.xmlDeserializer !== undefined && !e.isXmlOnly);
516
+ if (customized.length > 0) {
517
+ statements.push(`const error = ${createRestErrorReference}(result);`);
518
+ if (hasAnyDualFormatXml) {
519
+ const isXmlContentTypeRef = resolveReference(XmlHelpers.isXmlContentType);
520
+ statements.push(`const responseContentType = result.headers?.["content-type"] ?? "";`);
521
+ statements.push(`const isXml = ${isXmlContentTypeRef}(responseContentType);`);
522
+ }
523
+ statements.push(`const statusCode = Number.parseInt(result.status);`);
524
+ const stats = customized.map((exception) => {
525
+ const deserializeExpr = getExceptionDeserializeExpr(exception);
526
+ const headerStmt = allHeaderCalls;
527
+ if (exception.end) {
528
+ return `if(statusCode >= ${exception.start} && statusCode <= ${exception.end}) {
529
+ if(result.body) { error.details = ${deserializeExpr}; }
530
+ ${headerStmt}
531
+ }`;
532
+ }
533
+ else {
534
+ return `if(statusCode === ${exception.start}) {
535
+ if(result.body) { error.details = ${deserializeExpr}; }
536
+ ${headerStmt}
537
+ }`;
538
+ }
539
+ });
540
+ statements.push(stats.join("\nelse "));
541
+ if (defaultDeserializer) {
542
+ const defaultDeserializeExpr = !defaultXmlDeserializer
543
+ ? `${defaultDeserializer}(result.body)`
544
+ : defaultIsXmlOnly
545
+ ? `${defaultXmlDeserializer}(result.body)`
546
+ : `isXml ? ${defaultXmlDeserializer}(result.body) : ${defaultDeserializer}(result.body)`;
547
+ statements.push(`else {
548
+ if(result.body) { error.details = ${defaultDeserializeExpr}; }
549
+ ${allHeaderCalls}
550
+ }`);
551
+ }
552
+ statements.push("throw error;");
553
+ }
554
+ else {
555
+ if (defaultDeserializer) {
556
+ if (defaultXmlDeserializer) {
557
+ if (defaultIsXmlOnly) {
558
+ statements.push(`const error = ${createRestErrorReference}(result);
559
+ if(result.body) { error.details = ${defaultXmlDeserializer}(result.body); }
560
+ ${allHeaderCalls}`);
561
+ }
562
+ else {
563
+ const isXmlContentTypeRef = resolveReference(XmlHelpers.isXmlContentType);
564
+ statements.push(`const error = ${createRestErrorReference}(result);
565
+ const responseContentType = result.headers?.["content-type"] ?? "";
566
+ if(result.body) { error.details = ${isXmlContentTypeRef}(responseContentType) ? ${defaultXmlDeserializer}(result.body) : ${defaultDeserializer}(result.body); }
567
+ ${allHeaderCalls}`);
568
+ }
569
+ }
570
+ else {
571
+ statements.push(`const error = ${createRestErrorReference}(result);
572
+ if(result.body) { error.details = ${defaultDeserializer}(result.body); }
573
+ ${allHeaderCalls}`);
574
+ }
575
+ statements.push("throw error;");
576
+ }
577
+ else {
578
+ statements.push(`throw ${createRestErrorReference}(result);`);
579
+ }
580
+ }
581
+ return statements.join("\n");
582
+ }
583
+ /**
584
+ * Builds the code to extract header values from @clientOption("header", ...) decorators
585
+ * on exception model types. This is independent of include-headers-in-response.
586
+ */
587
+ function buildClientOptionHeadersCall(exceptions) {
588
+ const seenProperties = new Set();
589
+ const assignments = [];
590
+ for (const exception of exceptions ?? []) {
591
+ if (!exception.type || exception.type.kind !== "model") {
592
+ continue;
593
+ }
594
+ const headerOptions = getHeaderClientOptions(exception.type);
595
+ for (const opt of headerOptions) {
596
+ if (seenProperties.has(opt.propertyName)) {
597
+ continue;
598
+ }
599
+ seenProperties.add(opt.propertyName);
600
+ assignments.push(`${opt.propertyName}: result.headers[${JSON.stringify(opt.headerName)}]`);
601
+ }
602
+ }
603
+ if (assignments.length === 0) {
604
+ return undefined;
605
+ }
606
+ return `error.details = {...(error.details as any), ${assignments.join(", ")}};`;
607
+ }
608
+ /**
609
+ * Builds the code to conditionally set error.code from a response header,
610
+ * based on @clientOption("restErrorCodeHeader", ...) on exception model types.
611
+ */
612
+ function buildRestErrorCodeAssignment(exceptions) {
613
+ for (const exception of exceptions ?? []) {
614
+ if (!exception.type || exception.type.kind !== "model") {
615
+ continue;
616
+ }
617
+ const headerName = getRestErrorCodeHeader(exception.type);
618
+ if (headerName) {
619
+ return `const restErrorCodeValue = result.headers[${JSON.stringify(headerName)}];
620
+ if (restErrorCodeValue !== undefined) { error.code = restErrorCodeValue; }`;
621
+ }
622
+ }
623
+ return undefined;
624
+ }
625
+ function getOptionalParamsName(parameters) {
626
+ return (parameters.filter((p) => p.type?.toString().endsWith("operationOptions__"))[0]?.name ??
627
+ "options");
628
+ }
629
+ function getOperationSignatureParameters(context, method, clientType) {
630
+ const operation = method[1];
631
+ const optionsType = resolveReference(refkey(method[1], "operationOptions"));
632
+ const parameters = new Map();
633
+ operation.parameters
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)
644
+ .map((p) => {
645
+ return {
646
+ name: p.name,
647
+ type: getTypeExpression(context, p.type),
648
+ };
649
+ })
650
+ .forEach((p) => {
651
+ parameters.set(p.name, p);
652
+ });
653
+ // Add context as the first parameter
654
+ const contextParam = { name: "context", type: clientType };
655
+ // Add the options parameter
656
+ const optionsParam = {
657
+ name: parameters.has("options") ? "optionalParams" : "options",
658
+ type: optionsType,
659
+ initializer: "{ requestOptions: {} }",
660
+ };
661
+ const finalParameters = [contextParam, ...parameters.values(), optionsParam];
662
+ return finalParameters;
663
+ }
664
+ /**
665
+ * This operation builds and returns the function declaration for an operation.
666
+ */
667
+ export function getOperationFunction(context, method, clientType) {
668
+ const operation = method[1];
669
+ // Extract required parameters
670
+ const parameters = getOperationSignatureParameters(context, method, clientType);
671
+ const optionalParamName = getOptionalParamsName(parameters);
672
+ if (isPagingOnlyOperation(operation)) {
673
+ // Case 1: paging-only operation
674
+ return getPagingOnlyOperationFunction(context, [method[0], operation], clientType);
675
+ }
676
+ else if (isLroOnlyOperation(operation)) {
677
+ // Case 2: lro-only operation
678
+ return getLroOnlyOperationFunction(context, [method[0], operation], clientType, optionalParamName);
679
+ }
680
+ else if (isLroAndPagingOperation(operation)) {
681
+ // Case 3: both paging + lro operation
682
+ return getLroAndPagingOperationFunction(context, [method[0], operation], clientType, optionalParamName);
683
+ }
684
+ // TODO: Support operation overloads
685
+ const response = operation.response;
686
+ const responseHeaders = getResponseHeaders(operation.operation.responses);
687
+ const hasHeaderOnlyResponse = !response.type && responseHeaders.length > 0;
688
+ const isResponseHeadersEnabled = context.rlcOptions?.includeHeadersInResponse === true;
689
+ const isStorageCompatEnabled = context.rlcOptions?.enableStorageCompat === true;
690
+ // Track the raw body type separately for storage-compat (before header merging)
691
+ const hasResponseBody = !!response.type;
692
+ let bodyType = "void";
693
+ if (response.type) {
694
+ bodyType = getTypeExpression(context, response.type);
695
+ }
696
+ // Check if we need to wrap the non-model return type
697
+ const { shouldWrap: wrapReturn, isBinary: wrapReturnIsBinary } = checkWrapNonModelReturn(context, operation);
698
+ let returnType = { name: "", type: "void" };
699
+ if (wrapReturn) {
700
+ // Use the wrapper response type name (resolved via binder for cross-file imports)
701
+ returnType = {
702
+ name: getOperationResponseTypeName(method),
703
+ type: resolveReference(refkey(operation, "response")),
704
+ };
705
+ bodyType = returnType.type;
706
+ }
707
+ else if (response.type) {
708
+ const type = response.type;
709
+ // If feature flag enabled, we'll append the response headers to the operation response type.
710
+ if (type.kind === "model" && responseHeaders.length > 0 && isResponseHeadersEnabled) {
711
+ // Build a composite type that includes both model and additional header properties
712
+ const baseCompositeType = buildCompositeResponseType(context, type, responseHeaders);
713
+ returnType = {
714
+ name: type.name ?? "",
715
+ type: response.optional ? `${baseCompositeType} | undefined` : baseCompositeType,
716
+ };
717
+ }
718
+ else {
719
+ const baseType = getTypeExpression(context, type);
720
+ returnType = {
721
+ name: type.name ?? "",
722
+ type: response.optional ? `${baseType} | undefined` : baseType,
723
+ };
724
+ }
725
+ }
726
+ else if (hasHeaderOnlyResponse && isResponseHeadersEnabled) {
727
+ // Here we handle returning headers when the operation return type is void
728
+ returnType = {
729
+ name: "",
730
+ type: `${buildHeaderOnlyResponseType(context, responseHeaders)}`,
731
+ };
732
+ }
733
+ else if (isHeadAsBooleanOperation(operation)) {
734
+ returnType = { name: "", type: "boolean" };
735
+ }
736
+ // When storage-compat is enabled, wrap the return type with StorageCompatResponseInfo
737
+ // Use the raw body type (not the header-augmented return type) for TBody
738
+ let finalReturnType = returnType.type;
739
+ if (isStorageCompatEnabled) {
740
+ const storageCompatInfoRef = resolveReference(StorageCompatHelpers.StorageCompatResponseInfo);
741
+ const headersType = responseHeaders.length > 0
742
+ ? buildHeaderOnlyResponseType(context, responseHeaders)
743
+ : "Record<string, unknown>";
744
+ if (!hasResponseBody) {
745
+ if (responseHeaders.length > 0) {
746
+ // Void with headers — headers at top level + StorageCompatResponseInfo
747
+ finalReturnType = `${headersType} & ${storageCompatInfoRef}<undefined, ${headersType}>`;
748
+ }
749
+ else {
750
+ // Void without headers — just StorageCompatResponseInfo
751
+ finalReturnType = `${storageCompatInfoRef}<undefined, ${headersType}>`;
752
+ }
753
+ }
754
+ else {
755
+ if (responseHeaders.length > 0) {
756
+ // Body with headers — headers + body + StorageCompatResponseInfo at top level
757
+ finalReturnType = `${headersType} & ${bodyType} & ${storageCompatInfoRef}<${bodyType}, ${headersType}>`;
758
+ }
759
+ else {
760
+ // Body without headers — body + StorageCompatResponseInfo
761
+ finalReturnType = `${bodyType} & ${storageCompatInfoRef}<${bodyType}, ${headersType}>`;
762
+ }
763
+ }
764
+ }
765
+ const { name, fixme = [] } = getOperationName(operation, context);
766
+ const functionStatement = {
767
+ kind: StructureKind.Function,
768
+ docs: [...getDocsFromDescription(operation.doc), ...getFixmeForMultilineDocs(fixme)],
769
+ isAsync: true,
770
+ isExported: true,
771
+ name,
772
+ propertyName: normalizeName(operation.name, NameType.Property),
773
+ parameters,
774
+ returnType: `Promise<${finalReturnType}>`,
775
+ };
776
+ const statements = [];
777
+ // Generate unique local variable names that don't conflict with parameter names
778
+ const paramNames = new Set(parameters.map((p) => p.name));
779
+ const resultVarName = generateLocallyUniqueName("result", paramNames);
780
+ const parameterList = parameters.map((p) => p.name).join(", ");
781
+ // When storage-compat is enabled, set up the onResponse interceptor before sending
782
+ const storageCompatVarName = generateLocallyUniqueName("_storageCompat", paramNames);
783
+ if (isStorageCompatEnabled) {
784
+ const createOnResponseRef = resolveReference(StorageCompatHelpers.createStorageCompatOnResponse);
785
+ statements.push(`const ${storageCompatVarName} = ${createOnResponseRef}(${optionalParamName}.onResponse);`);
786
+ }
787
+ // Build the parameterList for the send call, injecting onResponse when storage-compat is enabled
788
+ const sendParameterList = isStorageCompatEnabled
789
+ ? parameterList.replace(optionalParamName, `{...${optionalParamName}, onResponse: ${storageCompatVarName}.onResponse}`)
790
+ : parameterList;
791
+ // Special case for binary-only bodies: use helper to call streaming methods so that Core doesn't poison the response body by
792
+ // doing a UTF-8 decode on the raw bytes.
793
+ // For binary wrap, use getBinaryStreamResponse which preserves blobBody/readableStreamBody properties.
794
+ // For non-wrapped binary, use getBinaryResponse which buffers the body into Uint8Array.
795
+ if (response?.type?.kind === "bytes" && response.type.encode === "bytes") {
796
+ const streamableMethodVarName = generateLocallyUniqueName("streamableMethod", paramNames);
797
+ statements.push(`const ${streamableMethodVarName} = _${name}Send(${sendParameterList});`);
798
+ const binaryHelper = wrapReturn && wrapReturnIsBinary
799
+ ? SerializationHelpers.getBinaryStreamResponse
800
+ : SerializationHelpers.getBinaryResponse;
801
+ statements.push(`const ${resultVarName} = await ${resolveReference(binaryHelper)}(${streamableMethodVarName});`);
802
+ }
803
+ else {
804
+ statements.push(`const ${resultVarName} = await _${name}Send(${sendParameterList});`);
805
+ }
806
+ // If the response has headers and the feature flag to include headers in response is enabled, build the headers object and include it in the return value
807
+ if (isStorageCompatEnabled) {
808
+ // Storage-compat mode: wrap the return value with _response metadata using captured PipelineResponse
809
+ const addStorageCompatRef = resolveReference(StorageCompatHelpers.addStorageCompatResponse);
810
+ const parsedBodyVarName = generateLocallyUniqueName("parsedBody", paramNames);
811
+ const parsedHeadersVarName = generateLocallyUniqueName("parsedHeaders", paramNames);
812
+ // Deserialize body
813
+ if (!hasResponseBody) {
814
+ statements.push(`await _${name}Deserialize(${resultVarName});`);
815
+ }
816
+ else {
817
+ statements.push(`const ${parsedBodyVarName} = await _${name}Deserialize(${resultVarName});`);
818
+ }
819
+ // Deserialize headers if present
820
+ if (responseHeaders.length > 0) {
821
+ statements.push(`const ${parsedHeadersVarName} = _${name}DeserializeHeaders(${resultVarName});`);
822
+ }
823
+ // Build the return statement using captured PipelineResponse
824
+ const bodyArg = !hasResponseBody ? "undefined" : parsedBodyVarName;
825
+ const headersArg = responseHeaders.length > 0 ? parsedHeadersVarName : "{}";
826
+ statements.push(`return ${addStorageCompatRef}(${storageCompatVarName}.getRawResponse()!, ${bodyArg}, ${headersArg});`);
827
+ }
828
+ else if (responseHeaders.length > 0 && isResponseHeadersEnabled) {
829
+ const headersVarName = generateLocallyUniqueName("headers", paramNames);
830
+ statements.push(`const ${headersVarName} = _${name}DeserializeHeaders(result);`);
831
+ // If there is no body payload just return the headers
832
+ if (hasHeaderOnlyResponse) {
833
+ statements.push(`await _${name}Deserialize(${resultVarName});`);
834
+ statements.push(`return {...${headersVarName} };`);
835
+ }
836
+ else {
837
+ const payloadVarName = generateLocallyUniqueName("payload", paramNames);
838
+ statements.push(`const ${payloadVarName} = await _${name}Deserialize(${resultVarName});`);
839
+ statements.push(`return { ...${payloadVarName}, ...${headersVarName} };`);
840
+ }
841
+ }
842
+ else {
843
+ statements.push(`return _${name}Deserialize(${resultVarName});`);
844
+ }
845
+ return {
846
+ ...functionStatement,
847
+ statements,
848
+ };
849
+ }
850
+ function getLroOnlyOperationFunction(context, method, clientType, optionalParamName = "options") {
851
+ const operation = method[1];
852
+ // Extract required parameters
853
+ const parameters = getOperationSignatureParameters(context, method, clientType);
854
+ const returnType = buildLroReturnType(context, operation);
855
+ const { name, fixme = [] } = getOperationName(operation, context);
856
+ const pollerLikeReference = resolveReference(AzurePollingDependencies.PollerLike);
857
+ const operationStateReference = resolveReference(AzurePollingDependencies.OperationState);
858
+ // When wrap-non-model-return is enabled and the LRO final result is a non-model type,
859
+ // use the wrapper response type (e.g. GetIkeSasResponse) instead of the raw type (e.g. string).
860
+ const { shouldWrap } = checkWrapNonModelReturn(context, operation);
861
+ const effectiveReturnTypeStr = shouldWrap
862
+ ? resolveReference(refkey(operation, "response"))
863
+ : returnType.type;
864
+ const effectiveReturnTypeName = shouldWrap
865
+ ? getOperationResponseTypeName(method)
866
+ : returnType.type;
867
+ const functionStatement = {
868
+ kind: StructureKind.Function,
869
+ docs: [...getDocsFromDescription(operation.doc), ...getFixmeForMultilineDocs(fixme)],
870
+ isAsync: false,
871
+ isExported: true,
872
+ name,
873
+ propertyName: normalizeName(operation.name, NameType.Property),
874
+ isLro: true,
875
+ lroFinalReturnType: effectiveReturnTypeName,
876
+ parameters,
877
+ returnType: `${pollerLikeReference}<${operationStateReference}<${effectiveReturnTypeStr}>, ${effectiveReturnTypeStr}>`,
878
+ };
879
+ const getLongRunningPollerReference = resolveReference(PollingHelpers.GetLongRunningPoller);
880
+ const lroMetadata = operation.kind === "lro" || operation.kind === "lropaging" ? operation.lroMetadata : undefined;
881
+ const allowedFinalLocation = [
882
+ "azure-async-operation",
883
+ "location",
884
+ "original-uri",
885
+ "operation-location",
886
+ ];
887
+ const resourceLocationConfig = lroMetadata?.finalStateVia && allowedFinalLocation.includes(lroMetadata?.finalStateVia)
888
+ ? `resourceLocationConfig: "${lroMetadata?.finalStateVia}",`
889
+ : "";
890
+ const apiVersion = getApiVersionExpression(context, operation);
891
+ const statements = [];
892
+ statements.push(`
893
+
894
+ return ${getLongRunningPollerReference}(context, _${name}Deserialize, ${getExpectedStatuses(operation)}, {
895
+ updateIntervalInMs: ${optionalParamName}?.updateIntervalInMs,
896
+ abortSignal: ${optionalParamName}?.abortSignal,
897
+ getInitialResponse: () => _${name}Send(${parameters.map((p) => p.name).join(", ")}),
898
+ ${resourceLocationConfig}
899
+ ${apiVersion ? `apiVersion: ${apiVersion}` : ""}
900
+ }) as ${pollerLikeReference}<${operationStateReference}<${effectiveReturnTypeStr}>, ${effectiveReturnTypeStr}>;
901
+ `);
902
+ return {
903
+ ...functionStatement,
904
+ statements,
905
+ };
906
+ }
907
+ function getLroAndPagingOperationFunction(context, method, clientType, optionalParamName = "options") {
908
+ const operation = method[1];
909
+ const parameters = getOperationSignatureParameters(context, method, clientType);
910
+ const { name, fixme = [] } = getOperationName(operation, context);
911
+ const returnType = buildLroPagingReturnType(context, operation);
912
+ // Get apiVersion expression for both LRO poller and paging options
913
+ const apiVersion = getApiVersionExpression(context, operation);
914
+ // Build paging options from metadata
915
+ const pagingOptions = [
916
+ operation.response.resultSegments &&
917
+ `itemName: "${operation.response.resultSegments.map((p) => p.name).join(".")}"`,
918
+ operation.pagingMetadata.nextLinkSegments &&
919
+ `nextLinkName: "${operation.pagingMetadata.nextLinkSegments.map((p) => p.name).join(".")}"`,
920
+ operation.pagingMetadata.nextLinkVerb !== "GET" &&
921
+ `nextLinkMethod: "${operation.pagingMetadata.nextLinkVerb}"`,
922
+ apiVersion && `apiVersion: ${apiVersion}`,
923
+ ].filter(Boolean);
924
+ // Build LRO resource location config
925
+ const allowedLocations = [
926
+ "azure-async-operation",
927
+ "location",
928
+ "original-uri",
929
+ "operation-location",
930
+ ];
931
+ const resourceLocationConfig = operation.lroMetadata?.finalStateVia &&
932
+ allowedLocations.includes(operation.lroMetadata.finalStateVia)
933
+ ? `resourceLocationConfig: "${operation.lroMetadata.finalStateVia}",`
934
+ : "";
935
+ // Resolve references
936
+ const refs = {
937
+ pagedIterator: resolveReference(PagingHelpers.PagedAsyncIterableIterator),
938
+ buildPaging: resolveReference(PagingHelpers.BuildPagedAsyncIterator),
939
+ getLroPoller: resolveReference(PollingHelpers.GetLongRunningPoller),
940
+ pollerLike: resolveReference(AzurePollingDependencies.PollerLike),
941
+ operationState: resolveReference(AzurePollingDependencies.OperationState),
942
+ pathResponse: resolveReference(useDependencies().PathUncheckedResponse),
943
+ };
944
+ const expectedStatuses = getExpectedStatuses(operation);
945
+ const paramList = parameters.map((p) => p.name).join(", ");
946
+ const pagingOptionsStr = pagingOptions.length > 0 ? `,\n {${pagingOptions.join(", ")}}` : "";
947
+ return {
948
+ kind: StructureKind.Function,
949
+ docs: [...getDocsFromDescription(operation.doc), ...getFixmeForMultilineDocs(fixme)],
950
+ isAsync: false,
951
+ isExported: true,
952
+ isLroPaging: true,
953
+ lropagingFinalReturnType: returnType.type,
954
+ name,
955
+ propertyName: normalizeName(operation.name, NameType.Property),
956
+ parameters,
957
+ returnType: `${refs.pagedIterator}<${returnType.type}>`,
958
+ statements: [
959
+ `
960
+ const initialPagingPoller = ${refs.getLroPoller}(context,
961
+ async (result: ${refs.pathResponse}) => result,
962
+ ${expectedStatuses}, {
963
+ updateIntervalInMs: ${optionalParamName}?.updateIntervalInMs,
964
+ abortSignal: ${optionalParamName}?.abortSignal,
965
+ getInitialResponse: () => _${name}Send(${paramList}),
966
+ ${resourceLocationConfig}
967
+ ${apiVersion ? `apiVersion: ${apiVersion}` : ""}
968
+ }) as ${refs.pollerLike}<${refs.operationState}<${refs.pathResponse}>, ${refs.pathResponse}>;
969
+
970
+ return ${refs.buildPaging}(
971
+ context,
972
+ async () => await initialPagingPoller,
973
+ _${name}Deserialize,
974
+ ${expectedStatuses}${pagingOptionsStr}
975
+ );
976
+ `,
977
+ ],
978
+ };
979
+ }
980
+ function buildLroReturnType(context, operation) {
981
+ const metadata = operation.lroMetadata;
982
+ if (metadata !== undefined && metadata.finalResponse !== undefined) {
983
+ const type = metadata.finalResponse.result;
984
+ return {
985
+ name: type.name,
986
+ type: getTypeExpression(context, type),
987
+ };
988
+ }
989
+ return { name: "", type: "void" };
990
+ }
991
+ function buildLroPagingReturnType(context, operation) {
992
+ if (operation.response.type?.kind === "array") {
993
+ return {
994
+ name: operation.response.type.valueType.name ?? "",
995
+ type: getTypeExpression(context, operation.response.type.valueType),
996
+ };
997
+ }
998
+ return { name: "", type: "void" };
999
+ }
1000
+ function getPagingOnlyOperationFunction(context, method, clientType) {
1001
+ const operation = method[1];
1002
+ // Extract required parameters
1003
+ const parameters = getOperationSignatureParameters(context, method, clientType);
1004
+ // TODO: Support operation overloads
1005
+ const response = operation.response;
1006
+ let returnType = { name: "", type: "void" };
1007
+ if (response.type && response.type.kind === "array") {
1008
+ const type = response.type;
1009
+ returnType = {
1010
+ name: type.valueType.name ?? "",
1011
+ type: getTypeExpression(context, type.valueType),
1012
+ };
1013
+ }
1014
+ const { name, fixme = [] } = getOperationName(operation, context);
1015
+ const pagedAsyncIterableIteratorReference = resolveReference(PagingHelpers.PagedAsyncIterableIterator);
1016
+ const buildPagedAsyncIteratorReference = resolveReference(PagingHelpers.BuildPagedAsyncIterator);
1017
+ const functionStatement = {
1018
+ kind: StructureKind.Function,
1019
+ docs: [...getDocsFromDescription(operation.doc), ...getFixmeForMultilineDocs(fixme)],
1020
+ isAsync: false,
1021
+ isExported: true,
1022
+ name,
1023
+ propertyName: normalizeName(operation.name, NameType.Property),
1024
+ parameters,
1025
+ returnType: `${pagedAsyncIterableIteratorReference}<${returnType.type}>`,
1026
+ };
1027
+ const statements = [];
1028
+ const options = [];
1029
+ // TODO: follow up on https://github.com/Azure/typespec-azure/issues/2103
1030
+ const nextLinkSegments = operation.pagingMetadata.nextLinkSegments;
1031
+ const nextLinkName = nextLinkSegments
1032
+ ?.map((property) => {
1033
+ return property.name;
1034
+ })
1035
+ .join(".");
1036
+ const itemSegments = operation.response.resultSegments;
1037
+ const itemName = itemSegments
1038
+ ?.map((property) => {
1039
+ return property.name;
1040
+ })
1041
+ .join(".");
1042
+ // Check for nextLinkVerb from TCGC pagingMetadata (supports @Legacy.nextLinkVerb decorator)
1043
+ const nextLinkMethod = operation.pagingMetadata.nextLinkVerb;
1044
+ const apiVersion = getApiVersionExpression(context, operation);
1045
+ if (itemName) {
1046
+ options.push(`itemName: "${itemName}"`);
1047
+ }
1048
+ if (nextLinkName) {
1049
+ options.push(`nextLinkName: "${nextLinkName}"`);
1050
+ }
1051
+ if (nextLinkMethod && nextLinkMethod !== "GET") {
1052
+ options.push(`nextLinkMethod: "${nextLinkMethod}"`);
1053
+ }
1054
+ if (apiVersion) {
1055
+ options.push(`apiVersion: ${apiVersion}`);
1056
+ }
1057
+ statements.push(`return ${buildPagedAsyncIteratorReference}(
1058
+ context,
1059
+ () => _${name}Send(${parameters.map((p) => p.name).join(", ")}),
1060
+ _${name}Deserialize,
1061
+ ${getExpectedStatuses(operation)}${options.length > 0 ? `,\n {${options.join(", ")}}` : ""}
1062
+ );`);
1063
+ return {
1064
+ ...functionStatement,
1065
+ statements,
1066
+ };
1067
+ }
1068
+ export function getOperationOptionsName(method, includeGroupName = false) {
1069
+ const prefixes = method[0];
1070
+ const operation = method[1];
1071
+ const prefix = includeGroupName && operation.name.indexOf("_") === -1
1072
+ ? getClassicalLayerPrefix(prefixes, NameType.Interface)
1073
+ : "";
1074
+ const optionName = `${prefix}${normalizeName(operation.name, NameType.Interface)}OptionalParams`;
1075
+ return optionName;
1076
+ }
1077
+ /**
1078
+ * This function build the request parameters that we will provide to the
1079
+ * RLC internally. This will translate High Level parameters into the RLC ones.
1080
+ * Figuring out what goes in headers, body, path and qsp.
1081
+ */
1082
+ function getHeaderAndBodyParameters(dpgContext, operation, optionalParamName = "options") {
1083
+ if (!operation.operation.parameters) {
1084
+ return "";
1085
+ }
1086
+ const operationParameters = operation.operation.parameters.filter((p) => !isContentType(p));
1087
+ const contentTypeParameter = operation.operation.parameters.find(isContentType);
1088
+ const parametersImplementation = {
1089
+ header: [],
1090
+ body: [],
1091
+ };
1092
+ for (const param of operationParameters) {
1093
+ if (param.kind === "header") {
1094
+ // skip tcgc generated contentType and accept non constant type header parameter
1095
+ if (param.isGeneratedName &&
1096
+ !isConstant(param.type) &&
1097
+ (param.name === "contentType" || param.name === "accept")) {
1098
+ continue;
1099
+ }
1100
+ // Skip headers marked with headerCollectionPrefix client option
1101
+ if (shouldSkipHeaderSerialization(param)) {
1102
+ continue;
1103
+ }
1104
+ // Check if this parameter still exists in the corresponding method params (after override)
1105
+ if (param.methodParameterSegments && param.methodParameterSegments.length > 0) {
1106
+ const paramAccessor = getParamAccessor(param, optionalParamName);
1107
+ parametersImplementation[param.kind].push({
1108
+ paramMap: getParameterMap(dpgContext, param, paramAccessor),
1109
+ param,
1110
+ paramAccessor,
1111
+ });
1112
+ }
1113
+ }
1114
+ }
1115
+ let paramStr = "";
1116
+ if (contentTypeParameter) {
1117
+ paramStr = `${getContentTypeValue(contentTypeParameter, optionalParamName)},`;
1118
+ }
1119
+ if (parametersImplementation.header.length) {
1120
+ paramStr = `${paramStr}\nheaders: {${parametersImplementation.header
1121
+ .map((i) => buildHeaderParameter(dpgContext.program, i.paramMap, i.param, i.paramAccessor))
1122
+ .join(",\n")}, ...${optionalParamName}.requestOptions?.headers },`;
1123
+ }
1124
+ if (operation.operation.bodyParam === undefined && parametersImplementation.body.length) {
1125
+ paramStr = `${paramStr}\nbody: {${parametersImplementation.body
1126
+ .map((i) => i.paramMap)
1127
+ .join(",\n")}}`;
1128
+ }
1129
+ else if (operation.operation.bodyParam !== undefined) {
1130
+ paramStr = `${paramStr}${buildBodyParameter(dpgContext, operation.operation.bodyParam)}`;
1131
+ }
1132
+ return paramStr;
1133
+ }
1134
+ // Specially handle the type for headers because we only allow string/number/boolean values
1135
+ function buildHeaderParameter(program, paramMap, param, paramAccessor) {
1136
+ const effectiveOptional = getEffectiveOptional(param);
1137
+ if (!effectiveOptional && isTypeNullable(param.type) === true) {
1138
+ reportDiagnostic(program, {
1139
+ code: "nullable-required-header",
1140
+ target: NoTarget,
1141
+ });
1142
+ return paramMap;
1143
+ }
1144
+ // If the param has a clientDefaultValue that type-matches, the paramMap already contains
1145
+ // `?? defaultValue` from getOptional(). In this case, always send the header (do not
1146
+ // conditionally omit it when the accessor is undefined) so the default is always applied.
1147
+ const hasEffectiveDefaultValue = effectiveOptional && hasEffectiveClientDefaultValue(param);
1148
+ const conditions = [];
1149
+ if (effectiveOptional && !hasEffectiveDefaultValue) {
1150
+ conditions.push(`${paramAccessor} !== undefined`);
1151
+ }
1152
+ if (isTypeNullable(param.type) === true) {
1153
+ conditions.push(`${paramAccessor} !== null`);
1154
+ }
1155
+ return conditions.length > 0 ? `...(${conditions.join(" && ")} ? {${paramMap}} : {})` : paramMap;
1156
+ }
1157
+ function buildBodyParameter(context, bodyParameter, optionalParamName = "options") {
1158
+ if (!bodyParameter || !bodyParameter.type) {
1159
+ return "";
1160
+ }
1161
+ const contentTypes = bodyParameter.contentTypes;
1162
+ const isXml = isXmlPayload(contentTypes);
1163
+ const isDualFormat = hasDualFormatSupport(contentTypes);
1164
+ const bodyType = getNullableValidType(bodyParameter.type);
1165
+ // Check if XML serialization is needed and available
1166
+ const useXmlSerialization = isXml && bodyType.kind === "model" && hasXmlSerialization(bodyType);
1167
+ let serializerFunctionName;
1168
+ if (useXmlSerialization) {
1169
+ // Use XML serializer
1170
+ serializerFunctionName = buildXmlModelSerializer(context, bodyType, {
1171
+ nameOnly: true,
1172
+ skipDiscriminatedUnionSuffix: false,
1173
+ });
1174
+ }
1175
+ else {
1176
+ // Use JSON serializer (default)
1177
+ serializerFunctionName = buildModelSerializer(context, bodyType, {
1178
+ nameOnly: true,
1179
+ skipDiscriminatedUnionSuffix: false,
1180
+ });
1181
+ }
1182
+ let bodyNameExpression = getParamAccessor(bodyParameter, optionalParamName);
1183
+ // Check if body parameter has a client default value with matching type
1184
+ const hasClientDefault = bodyParameter.optional && hasEffectiveClientDefaultValue(bodyParameter);
1185
+ // Apply client default value if present for optional body parameters
1186
+ if (hasClientDefault) {
1187
+ const formattedDefault = formatDefaultValue(bodyParameter.clientDefaultValue);
1188
+ bodyNameExpression = `(${bodyNameExpression} ?? ${formattedDefault})`;
1189
+ }
1190
+ // Build null guard using bodyNameExpression so it stays consistent with the
1191
+ // accessor path (especially for nested body parameters like options?.body?.x).
1192
+ // Skip when there's a client default value since it already handles null/undefined.
1193
+ const needsNullGuard = !hasClientDefault &&
1194
+ (bodyParameter.optional ||
1195
+ isTypeNullable(bodyParameter.type) ||
1196
+ bodyNameExpression.includes("?."));
1197
+ const nullOrUndefinedPrefix = needsNullGuard
1198
+ ? `!${bodyNameExpression}? ${bodyNameExpression}:`
1199
+ : "";
1200
+ // For dual-format operations, check the contentType option at runtime
1201
+ if (isDualFormat && bodyType.kind === "model" && hasXmlSerialization(bodyType)) {
1202
+ const xmlSerializerName = buildXmlModelSerializer(context, bodyType, {
1203
+ nameOnly: true,
1204
+ skipDiscriminatedUnionSuffix: false,
1205
+ });
1206
+ const jsonSerializerName = buildModelSerializer(context, bodyType, {
1207
+ nameOnly: true,
1208
+ skipDiscriminatedUnionSuffix: false,
1209
+ });
1210
+ if (xmlSerializerName && jsonSerializerName) {
1211
+ const isXmlContentTypeRef = resolveReference(XmlHelpers.isXmlContentType);
1212
+ return `\nbody: ${nullOrUndefinedPrefix}(${isXmlContentTypeRef}(${optionalParamName}?.contentType ?? "application/json") ? ${xmlSerializerName}(${bodyNameExpression}) : ${jsonSerializerName}(${bodyNameExpression})),`;
1213
+ }
1214
+ }
1215
+ // if a model being used in both spread and non spread operation, we should only leverage the deserializer in non spread operation
1216
+ if (serializerFunctionName && !isSpreadBodyParameter(bodyParameter)) {
1217
+ return `\nbody: ${nullOrUndefinedPrefix}${serializerFunctionName}(${bodyNameExpression}),`;
1218
+ }
1219
+ else if (isAzureCoreErrorType(context.program, bodyParameter.type.__raw)) {
1220
+ return `\nbody: ${nullOrUndefinedPrefix}${bodyNameExpression},`;
1221
+ }
1222
+ const serializedBody = serializeRequestValue(context, bodyParameter.type, bodyNameExpression, !bodyParameter.optional, isBinaryPayload(context, bodyParameter.__raw, bodyParameter.contentTypes, getEncodeForType(bodyParameter.type))
1223
+ ? "binary"
1224
+ : getEncodeForType(bodyParameter.type), undefined, true);
1225
+ return `\nbody: ${serializedBody.startsWith(nullOrUndefinedPrefix) ? "" : nullOrUndefinedPrefix}${serializedBody},`;
1226
+ }
1227
+ function getEncodingFormat(type) {
1228
+ const supportedFormats = ["base64url", "base64", "byte"];
1229
+ if (!supportedFormats.includes(type.format ?? "")) {
1230
+ return "base64";
1231
+ }
1232
+ return type.format;
1233
+ }
1234
+ /**
1235
+ * This function helps with renames, translating client names to rest api names
1236
+ */
1237
+ export function getParameterMap(context, param, paramAccessor) {
1238
+ // Use lowercase for header names since HTTP headers are case-insensitive
1239
+ const serializedName = param.kind === "header" ? getHeaderSerializedName(param) : getPropertySerializedName(param);
1240
+ if (isConstant(param.type) && !isOptional(param)) {
1241
+ return `"${serializedName}": ${getConstantValue(param.type)}`;
1242
+ }
1243
+ // Special case for api-version parameters with default values
1244
+ if (param.isApiVersionParam && param.clientDefaultValue) {
1245
+ // For multi-service, use only the default value (don't reference context.apiVersion)
1246
+ if (context.rlcOptions?.isMultiService) {
1247
+ return `"${serializedName}": "${param.clientDefaultValue}"`;
1248
+ }
1249
+ return `"${serializedName}": ${param.onClient ? "context." : ""}${param.name} ?? "${param.clientDefaultValue}"`;
1250
+ }
1251
+ if (hasCollectionFormatInfo(param.kind, param.collectionFormat)) {
1252
+ return getCollectionFormatForParam(context, param, paramAccessor, serializedName);
1253
+ }
1254
+ // if the parameter or property is optional, we don't need to handle the default value
1255
+ if (isOptional(param)) {
1256
+ return getOptional(context, param, serializedName, paramAccessor);
1257
+ }
1258
+ if (isRequired(param)) {
1259
+ return getRequired(context, param, serializedName, paramAccessor);
1260
+ }
1261
+ reportDiagnostic(context.program, {
1262
+ code: "unsupported-parameter-type",
1263
+ format: {
1264
+ paramName: param.name,
1265
+ paramKind: param.kind,
1266
+ },
1267
+ target: param.__raw || NoTarget,
1268
+ });
1269
+ // Return a fallback value to allow the emitter to continue
1270
+ return `"${param.name}": undefined`;
1271
+ }
1272
+ function getCollectionFormatForParam(context, param, paramAccessor, serializedName) {
1273
+ const format = param.collectionFormat;
1274
+ return `"${serializedName}": ${serializeRequestValue(context, param.type, paramAccessor, !param.optional, format, serializedName, true)}`;
1275
+ }
1276
+ function isContentType(param) {
1277
+ return param.kind === "header" && param.serializedName.toLowerCase() === "content-type";
1278
+ }
1279
+ function getContentTypeValue(param, optionalParamName = "options") {
1280
+ const defaultValue = param.clientDefaultValue;
1281
+ // allow customers to customize the content type if it's guessed by tcgc.
1282
+ if (isConstant(param.type)) {
1283
+ return `contentType: ${getConstantValue(param.type)}`;
1284
+ }
1285
+ if (defaultValue) {
1286
+ return `contentType: ${optionalParamName}.${param.name} as any ?? "${defaultValue}"`;
1287
+ }
1288
+ else {
1289
+ return `contentType: ${!param.optional
1290
+ ? normalizeName(param.name, NameType.Property)
1291
+ : `${optionalParamName}.` + param.name + " as any"}`;
1292
+ }
1293
+ }
1294
+ /**
1295
+ * Gets the effective optionality for an HTTP parameter by checking
1296
+ * the linked method parameter via methodParameterSegments.
1297
+ * This is needed because @@override can change a method parameter's
1298
+ * optionality without updating the HTTP parameter's optional flag.
1299
+ * For client-level parameters (onClient), preserve the HTTP parameter's own flag.
1300
+ */
1301
+ function getEffectiveOptional(param) {
1302
+ // For client-level parameters, the HTTP parameter's optional flag is authoritative
1303
+ if (param.onClient) {
1304
+ return Boolean(param.optional);
1305
+ }
1306
+ // For method-level parameters with a direct mapping to a single method param,
1307
+ // use the method parameter's optional flag (correctly reflects @@override changes)
1308
+ if (param.methodParameterSegments?.length === 1 &&
1309
+ param.methodParameterSegments[0]?.length === 1) {
1310
+ const methodParam = param.methodParameterSegments[0][0];
1311
+ if (methodParam) {
1312
+ return Boolean(methodParam.optional);
1313
+ }
1314
+ }
1315
+ return Boolean(param.optional);
1316
+ }
1317
+ function isRequired(param) {
1318
+ return !getEffectiveOptional(param);
1319
+ }
1320
+ function getRequired(context, param, serializedName, paramAccessor) {
1321
+ if (param.type.kind === "model") {
1322
+ const propertiesStr = getRequestModelMapping(context, { ...param.type, optional: param.optional }, paramAccessor);
1323
+ return `"${serializedName}": { ${propertiesStr.join(",")} }`;
1324
+ }
1325
+ return `"${serializedName}": ${serializeRequestValue(context, param.type, paramAccessor, true, getEncodeForType(param.type), serializedName, true)}`;
1326
+ }
1327
+ function getConstantValue(param) {
1328
+ if (typeof param.value === "string") {
1329
+ return `"${param.value}"`;
1330
+ }
1331
+ return `${param.value}`;
1332
+ }
1333
+ function isConstant(param) {
1334
+ return param.kind === "constant";
1335
+ }
1336
+ function isOptional(param) {
1337
+ return getEffectiveOptional(param);
1338
+ }
1339
+ function getOptional(context, param, serializedName, paramAccessor) {
1340
+ // Apply client default value if present and type matches
1341
+ const defaultSuffix = hasEffectiveClientDefaultValue(param)
1342
+ ? ` ?? ${formatDefaultValue(param.clientDefaultValue)}`
1343
+ : "";
1344
+ if (param.type.kind === "model") {
1345
+ const propertiesStr = getRequestModelMapping(context, { ...param.type, optional: param.optional }, paramAccessor + "?.");
1346
+ const serializeContent = `{${propertiesStr.join(",")}}`;
1347
+ return `"${serializedName}": ${serializeContent}`;
1348
+ }
1349
+ const serializedValue = serializeRequestValue(context, param.type, paramAccessor, false, getEncodeForType(param.type), serializedName, true);
1350
+ return `"${serializedName}": ${serializedValue}${defaultSuffix}`;
1351
+ }
1352
+ /**
1353
+ * Get the encode for SDK type
1354
+ */
1355
+ function getEncodeForType(type) {
1356
+ return type.encode;
1357
+ }
1358
+ /**
1359
+ * Get the optionality for SDK type
1360
+ */
1361
+ function getOptionalForType(type) {
1362
+ return type.optional;
1363
+ }
1364
+ /**
1365
+ * Builds the assignment for when a property or parameter has a default value
1366
+ */
1367
+ function getDefaultValue(param) {
1368
+ return param.clientDefaultValue;
1369
+ }
1370
+ /**
1371
+ * Extracts the path parameters
1372
+ */
1373
+ function getPathParameters(operation, optionalParamName = "options") {
1374
+ if (!operation.operation.parameters) {
1375
+ return [];
1376
+ }
1377
+ const pathParams = [];
1378
+ for (const param of operation.operation.parameters) {
1379
+ if (param.kind === "path") {
1380
+ const methodParam = param.methodParameterSegments[0]?.[0];
1381
+ if (methodParam) {
1382
+ pathParams.push(`"${param.serializedName}": ${getPathParamExpr(param, getDefaultValue(param), optionalParamName)}`);
1383
+ }
1384
+ }
1385
+ }
1386
+ return pathParams;
1387
+ }
1388
+ /**
1389
+ * Extract the query parameters
1390
+ */
1391
+ function getQueryParameters(dpgContext, operation) {
1392
+ if (!operation.parameters) {
1393
+ return [];
1394
+ }
1395
+ const operationParameters = operation.operation.parameters.filter((p) => !isContentType(p));
1396
+ const parametersImplementation = {
1397
+ query: [],
1398
+ };
1399
+ for (const param of operationParameters) {
1400
+ if (param.kind === "query") {
1401
+ // Check if this parameter still exists in the corresponding method params (after override)
1402
+ if (param.methodParameterSegments && param.methodParameterSegments.length > 0) {
1403
+ const paramAccessor = getParamAccessor(param);
1404
+ parametersImplementation[param.kind].push({
1405
+ paramMap: getParameterMap(dpgContext, {
1406
+ ...param,
1407
+ // TODO: remember to remove this hack once compiler gives us a name
1408
+ // https://github.com/microsoft/typespec/issues/6743
1409
+ serializedName: getUriTemplateQueryParamName(param.serializedName),
1410
+ }, paramAccessor),
1411
+ param,
1412
+ });
1413
+ }
1414
+ }
1415
+ }
1416
+ const paramStr = parametersImplementation.query.map((i) => i.paramMap);
1417
+ return paramStr;
1418
+ }
1419
+ function getUriTemplateQueryParamName(name) {
1420
+ return `${escapeUriTemplateParamName(name)}`;
1421
+ }
1422
+ function escapeUriTemplateParamName(name) {
1423
+ return encodeURIComponent(name).replace(/[:-]/g, function (c) {
1424
+ return "%" + c.charCodeAt(0).toString(16).toUpperCase();
1425
+ });
1426
+ }
1427
+ /**
1428
+ * Returns the parameter expression matching the operation signature for an HTTP parameter.
1429
+ * 1. Client-level parameter (`param.onClient`): returns `context.<paramName>`.
1430
+ * 2. Method-level parameter with `methodParameterSegments`: returns the expression
1431
+ * built from those segments (e.g. `options?.ocpDate`, `body.nested`).
1432
+ * 3. Fallback: returns the parameter name directly, with optional chaining if optional.
1433
+ */
1434
+ function getParamAccessor(param, optionalParamName = "options") {
1435
+ if (param.isGeneratedName) {
1436
+ return param.name;
1437
+ }
1438
+ const methodParamExpr = getMethodParamExpr(param, optionalParamName);
1439
+ const clientPrefix = "context.";
1440
+ if (methodParamExpr) {
1441
+ return param.onClient ? `${clientPrefix}${methodParamExpr}` : methodParamExpr;
1442
+ }
1443
+ if (param.onClient) {
1444
+ return `${clientPrefix}${getClientParameterName(param)}`;
1445
+ }
1446
+ if (getEffectiveOptional(param)) {
1447
+ return `${optionalParamName}?.${param.name}`;
1448
+ }
1449
+ return param.name;
1450
+ }
1451
+ /**
1452
+ * Builds a property accessor expression from the param's `methodParameterSegments`.
1453
+ * Each segment represents a level of property access (e.g. `options?.nested.value`).
1454
+ * Returns `undefined` when no segments are available, so the caller can fall back.
1455
+ */
1456
+ function getMethodParamExpr(param, optionalParamName = "options") {
1457
+ const segments = param.methodParameterSegments;
1458
+ if (segments.length === 0) {
1459
+ return undefined;
1460
+ }
1461
+ // When there are multiple paths (e.g., a composite body from multiple method
1462
+ // params), we cannot resolve a single accessor — fall back to the caller's logic.
1463
+ if (segments.length > 1) {
1464
+ return undefined;
1465
+ }
1466
+ const path = segments[0];
1467
+ if (!path || path.length < 1) {
1468
+ return undefined;
1469
+ }
1470
+ const parts = [];
1471
+ for (let i = 0; i < path.length; i++) {
1472
+ const segment = path[i];
1473
+ if (i === 0) {
1474
+ // Normalize names for client-level segments to match the context interface property names
1475
+ const segmentName = segment.onClient
1476
+ ? getClientParameterName(segment)
1477
+ : segment.name;
1478
+ if (segment.optional && !segment.onClient) {
1479
+ // If the first segment is optional and not on the client, we need to start with the optionalParamName
1480
+ parts.push(`${optionalParamName}?.`);
1481
+ }
1482
+ parts.push(segmentName);
1483
+ }
1484
+ else {
1485
+ const needsOptionalChain = path[i - 1].optional;
1486
+ parts.push(`${needsOptionalChain ? "?." : "."}${segment.name}`);
1487
+ }
1488
+ }
1489
+ return parts.join("");
1490
+ }
1491
+ function getPathParamExpr(param, defaultValue, optionalParamName = "options") {
1492
+ if (isConstant(param.type)) {
1493
+ return getConstantValue(param.type);
1494
+ }
1495
+ const paramName = getParamAccessor(param, optionalParamName);
1496
+ return defaultValue
1497
+ ? typeof defaultValue === "string"
1498
+ ? `${paramName} ?? "${defaultValue}"`
1499
+ : `${paramName} ?? ${defaultValue}`
1500
+ : paramName;
1501
+ }
1502
+ function getNullableCheck(name, type) {
1503
+ if (!isTypeNullable(type)) {
1504
+ return "";
1505
+ }
1506
+ return `${name} === null ? null :`;
1507
+ }
1508
+ /**
1509
+ * Determines the appropriate encoding format for a model property, especially for arrays with collection format encoding.
1510
+ * For example, returns "csv" for comma-delimited arrays or the property's type encoding for regular properties.
1511
+ */
1512
+ function getEncodeForModelProperty(context, property) {
1513
+ if (property.encode && property.type.kind === "array") {
1514
+ // Only arrays of string type or string-based enum type can have collectionFormat encoding
1515
+ if (!isStringEncodableArrayValueType(property.type.valueType)) {
1516
+ reportDiagnostic(context.program, {
1517
+ code: "un-supported-array-encoding",
1518
+ format: {
1519
+ arrayName: property.name,
1520
+ arrayType: property.type.valueType.kind,
1521
+ },
1522
+ target: NoTarget,
1523
+ });
1524
+ return getEncodeForType(property.type);
1525
+ }
1526
+ const collectionFormat = getCollectionFormatFromArrayEncoding(property.encode);
1527
+ if (collectionFormat && hasCollectionFormatInfo(property.kind, collectionFormat)) {
1528
+ return collectionFormat;
1529
+ }
1530
+ }
1531
+ return getEncodeForType(property.type);
1532
+ }
1533
+ /**
1534
+ * Checks if an array value type is string-encodable for collection format encoding.
1535
+ * This includes both string type and string-based enum types.
1536
+ */
1537
+ function isStringEncodableArrayValueType(valueType) {
1538
+ // Direct string type
1539
+ if (valueType.kind === "string") {
1540
+ return true;
1541
+ }
1542
+ // String-based enum type
1543
+ if (valueType.kind === "enum" && valueType.valueType.kind === "string") {
1544
+ return true;
1545
+ }
1546
+ return false;
1547
+ }
1548
+ function getSerializationExpressionForFlatten(context, property, propertyPath) {
1549
+ const serializeFunctionName = buildPropertySerializer(context, property, {
1550
+ nameOnly: true,
1551
+ skipDiscriminatedUnionSuffix: false,
1552
+ });
1553
+ if (!serializeFunctionName) {
1554
+ return property.optional ? `undefined` : `{}`;
1555
+ }
1556
+ const validProps = getAllProperties(context, property.type, getAllAncestors(property.type)).filter((p) => p.kind === "property" && !isReadOnly(p) && !isMetadata(context.program, p.__raw));
1557
+ const optionalPrefix = property.optional
1558
+ ? `${resolveReference(SerializationHelpers.areAllPropsUndefined)}(${propertyPath}, [${validProps
1559
+ .map((p) => normalizeModelPropertyName(context, p))
1560
+ .join(", ")}]) ? undefined : `
1561
+ : "";
1562
+ return `${optionalPrefix}${serializeFunctionName}(${propertyPath})`;
1563
+ }
1564
+ export function getSerializationExpression(context, property, propertyPath, enableFlatten = true) {
1565
+ if (property.flatten && property.type.kind === "model" && enableFlatten) {
1566
+ return getSerializationExpressionForFlatten(context, property, "item");
1567
+ }
1568
+ const dot = propertyPath.endsWith("?") ? "." : "";
1569
+ const propertyPathWithDot = `${propertyPath ? `${propertyPath}${dot}` : `${dot}`}`;
1570
+ const nullOrUndefinedPrefix = getPropertySerializationPrefix(context, property, propertyPath);
1571
+ const propertyFullName = getPropertyFullName(context, property, propertyPathWithDot);
1572
+ const serializeFunctionName = buildModelSerializer(context, getNullableValidType(property.type), {
1573
+ nameOnly: true,
1574
+ skipDiscriminatedUnionSuffix: false,
1575
+ });
1576
+ // Apply clientDefaultValue for model properties that have one
1577
+ const defaultValueSuffix = hasEffectiveClientDefaultValue(property)
1578
+ ? ` ?? ${formatDefaultValue(property.clientDefaultValue)}`
1579
+ : "";
1580
+ if (serializeFunctionName) {
1581
+ return `${nullOrUndefinedPrefix}${serializeFunctionName}(${propertyFullName})${defaultValueSuffix}`;
1582
+ }
1583
+ else if (isAzureCoreErrorType(context.program, property.type.__raw)) {
1584
+ return `${nullOrUndefinedPrefix}${propertyFullName}${defaultValueSuffix}`;
1585
+ }
1586
+ else {
1587
+ const baseExpr = serializeRequestValue(context, property.type, propertyFullName, !property.optional, getEncodeForModelProperty(context, property), getPropertySerializedName(property), propertyPath === "" ? true : false);
1588
+ return `${baseExpr}${defaultValueSuffix}`;
1589
+ }
1590
+ }
1591
+ export function getRequestModelProperties(context, modelPropertyType, propertyPath = "body", overrides, enableFlatten = true) {
1592
+ const props = [];
1593
+ const allParents = getAllAncestors(modelPropertyType);
1594
+ const properties = getAllProperties(context, modelPropertyType, allParents) ?? [];
1595
+ if (properties.length <= 0) {
1596
+ return [];
1597
+ }
1598
+ for (const prop of properties) {
1599
+ if (prop.kind === "property" && isReadOnly(prop)) {
1600
+ continue;
1601
+ }
1602
+ if (isMetadata(context.program, prop.__raw)) {
1603
+ continue;
1604
+ }
1605
+ const property = getPropertyWithOverrides(prop, overrides);
1606
+ props.push([
1607
+ getPropertySerializedName(property),
1608
+ getSerializationExpression(context, property, propertyPath, enableFlatten),
1609
+ ]);
1610
+ }
1611
+ return props;
1612
+ }
1613
+ /**
1614
+ *
1615
+ * This function helps translating an HLC request to RLC request,
1616
+ * extracting properties from body and headers and building the RLC response object
1617
+ */
1618
+ export function getRequestModelMapping(context, modelPropertyType, propertyPath = "body", overrides, enableFlatten = true) {
1619
+ return getRequestModelProperties(context, modelPropertyType, propertyPath, overrides, enableFlatten).map(([name, value]) => `"${name}": ${value}`);
1620
+ }
1621
+ export function getPropertySerializedName(property) {
1622
+ return ((property.kind === "property"
1623
+ ? property.serializationOptions.json?.name
1624
+ : property.serializedName) ?? property.name);
1625
+ }
1626
+ /**
1627
+ * Get the serialized name for a header parameter, normalized to lowercase.
1628
+ * HTTP headers are case-insensitive, so we normalize to lowercase for consistency.
1629
+ */
1630
+ function getHeaderSerializedName(param) {
1631
+ return getPropertySerializedName(param).toLowerCase();
1632
+ }
1633
+ /**
1634
+ * This function helps translating an RLC response to an HLC response,
1635
+ * extracting properties from body and headers and building the HLC response object
1636
+ */
1637
+ export function getResponseMapping(context, type, propertyPath = "result.body", overrides, enableFlatten = true) {
1638
+ const allParents = type.kind === "model" ? getAllAncestors(type) : [];
1639
+ const properties = type.kind === "model" ? getAllProperties(context, type, allParents) : [];
1640
+ const props = [];
1641
+ for (const prop of properties) {
1642
+ if (isMetadata(context.program, prop.__raw)) {
1643
+ continue;
1644
+ }
1645
+ const property = getPropertyWithOverrides(prop, overrides);
1646
+ const dot = propertyPath.endsWith("?") ? "." : "";
1647
+ const serializedName = getPropertySerializedName(property);
1648
+ const restValue = `${propertyPath ? `${propertyPath}${dot}` : `${dot}`}["${serializedName}"]`;
1649
+ const nullOrUndefinedPrefix = property.optional || isTypeNullable(property.type) ? `!${restValue}? ${restValue}: ` : "";
1650
+ const flattenContext = useContext("sdkTypes").flattenProperties.get(property);
1651
+ const isSupportedFlatten = flattenContext && enableFlatten;
1652
+ const deserializeFunctionName = isSupportedFlatten
1653
+ ? buildPropertyDeserializer(context, property, {
1654
+ nameOnly: true,
1655
+ skipDiscriminatedUnionSuffix: false,
1656
+ })
1657
+ : buildModelDeserializer(context, getNullableValidType(property.type), {
1658
+ nameOnly: true,
1659
+ skipDiscriminatedUnionSuffix: false,
1660
+ });
1661
+ const propertyName = normalizeModelPropertyName(context, property);
1662
+ if (deserializeFunctionName) {
1663
+ if (isSupportedFlatten) {
1664
+ props.push(`...${nullOrUndefinedPrefix}${deserializeFunctionName}(${restValue})`);
1665
+ }
1666
+ else {
1667
+ props.push(`${propertyName}: ${nullOrUndefinedPrefix}${deserializeFunctionName}(${restValue})`);
1668
+ }
1669
+ }
1670
+ else if (isAzureCoreErrorType(context.program, property.type.__raw)) {
1671
+ props.push(`${propertyName}: ${nullOrUndefinedPrefix}${restValue}`);
1672
+ }
1673
+ else {
1674
+ const deserializeValue = deserializeResponseValue(context, property.type, `${propertyPath}${dot}["${serializedName}"]`, !property.optional, getEncodeForModelProperty(context, property));
1675
+ props.push(`${propertyName}: ${deserializeValue}`);
1676
+ }
1677
+ }
1678
+ return props;
1679
+ }
1680
+ /**
1681
+ * Converts JavaScript values to their serialized wire format for HTTP requests.
1682
+ */
1683
+ export function serializeRequestValue(context, type, clientValue, required, format, serializedName, isTopLevel = false) {
1684
+ const getSdkType = useSdkTypes();
1685
+ const dependencies = useDependencies();
1686
+ const nullOrUndefinedPrefix = isTypeNullable(type) || getOptionalForType(type) || !required
1687
+ ? `!${clientValue}? ${clientValue}: `
1688
+ : "";
1689
+ switch (type.kind) {
1690
+ case "plainDate":
1691
+ // plainDate always uses ISO8601 format (YYYY-MM-DD)
1692
+ return `${nullOrUndefinedPrefix}${clientValue}.toISOString().split('T')[0]`;
1693
+ case "utcDateTime":
1694
+ switch (type.encode ?? format) {
1695
+ case "rfc7231":
1696
+ return `${nullOrUndefinedPrefix}${clientValue}.toUTCString()`;
1697
+ case "unixTimestamp":
1698
+ return `${nullOrUndefinedPrefix}((${clientValue}.getTime() / 1000) | 0)`;
1699
+ case "rfc3339":
1700
+ default:
1701
+ return `${nullOrUndefinedPrefix}${clientValue}.toISOString()`;
1702
+ }
1703
+ case "array": {
1704
+ if (type.valueType) {
1705
+ const prefix = nullOrUndefinedPrefix + clientValue;
1706
+ const elementNullOrUndefinedPrefix = isTypeNullable(type.valueType) || getOptionalForType(type.valueType) ? "!p ? p : " : "";
1707
+ const serializeFunctionName = buildModelSerializer(context, getNullableValidType(type.valueType), {
1708
+ nameOnly: true,
1709
+ skipDiscriminatedUnionSuffix: false,
1710
+ });
1711
+ if (serializeFunctionName) {
1712
+ return `${prefix}.map((p: any) => { return ${elementNullOrUndefinedPrefix}${serializeFunctionName}(p)})`;
1713
+ }
1714
+ else if (isAzureCoreErrorType(context.program, type.valueType.__raw)) {
1715
+ return `${prefix}.map((p: any) => { return ${elementNullOrUndefinedPrefix}p})`;
1716
+ }
1717
+ else {
1718
+ const serializedValue = `${clientValue}.map((p: any) => { return ${elementNullOrUndefinedPrefix}${serializeRequestValue(context, type.valueType, "p", true, getEncodeForType(type.valueType))}})`;
1719
+ if (format) {
1720
+ const formatHelper = getCollectionFormatHelper(format);
1721
+ if (formatHelper) {
1722
+ if (format?.toLowerCase() === KnownCollectionFormat.Multi) {
1723
+ return `${nullOrUndefinedPrefix}${formatHelper}(${serializedValue}, "${serializedName}")`;
1724
+ }
1725
+ return `${nullOrUndefinedPrefix}${formatHelper}(${serializedValue})`;
1726
+ }
1727
+ }
1728
+ return `${nullOrUndefinedPrefix}${serializedValue}`;
1729
+ }
1730
+ }
1731
+ return clientValue;
1732
+ }
1733
+ case "bytes":
1734
+ // TODO https://github.com/Azure/typespec-azure/issues/1999
1735
+ if (format !== "binary" && format !== "bytes") {
1736
+ const uint8ArrayToStringReference = resolveReference(dependencies.uint8ArrayToString);
1737
+ return required
1738
+ ? `${getNullableCheck(clientValue, type)} ${uint8ArrayToStringReference}(${clientValue}, "${getEncodingFormat({ format }) ?? "base64"}")`
1739
+ : `${nullOrUndefinedPrefix} ${uint8ArrayToStringReference}(${clientValue}, "${getEncodingFormat({ format }) ?? "base64"}")`;
1740
+ }
1741
+ return clientValue;
1742
+ case "union":
1743
+ if (isNormalUnion(type)) {
1744
+ return `${clientValue}`;
1745
+ }
1746
+ else if (isSpecialHandledUnion({
1747
+ ...type,
1748
+ isNonExhaustive: context.rlcOptions?.experimentalExtensibleEnums ?? false,
1749
+ })) {
1750
+ const sdkType = getSdkType(type.__raw);
1751
+ const serializerRefkey = refkey(sdkType, "serializer");
1752
+ const serializeFunctionName = resolveReference(serializerRefkey);
1753
+ return `${serializeFunctionName}(${clientValue})`;
1754
+ }
1755
+ else {
1756
+ return `${clientValue} as any`;
1757
+ }
1758
+ case "model": // this is to build serialization logic for spread model types
1759
+ return `{${getRequestModelMapping(context, type, "").join(",")}}`;
1760
+ case "constant":
1761
+ if (isTopLevel) {
1762
+ return `${nullOrUndefinedPrefix}${getConstantValue(type)}`;
1763
+ }
1764
+ return clientValue;
1765
+ case "nullable":
1766
+ return serializeRequestValue(context, type.type, clientValue, false, getEncodeForType(type.type));
1767
+ default:
1768
+ if (clientValue === "constructorParam") {
1769
+ return `${clientValue} as any`;
1770
+ }
1771
+ return clientValue;
1772
+ }
1773
+ }
1774
+ /**
1775
+ * Wrapper of deserializeResponseValue, this is used to handle the special cases for response header deserialization, since response header only supports primitive types, we will have a simpler deserialization logic comparing to response body, and we also need to handle the null/undefined cases differently since if a header is missing, the value will be undefined instead of null.
1776
+ * Note: that this has been added to isolate these changes behind the feature flag. Once the feature flag is removed, we can consider merging this back to deserializeResponseValue if the special handling logic is not needed anymore.
1777
+ */
1778
+ export function deserializeResponseHeadersValue(context, type, restValue, required, format, recursionDepth = 0) {
1779
+ const nullOrUndefinedPrefix = isTypeNullable(type) || getOptionalForType(type) || !required
1780
+ ? `${restValue} === undefined || ${restValue} === null ? ${restValue}: `
1781
+ : "";
1782
+ switch (type.kind) {
1783
+ case "constant":
1784
+ return `${restValue} as any`;
1785
+ case "boolean":
1786
+ return `${nullOrUndefinedPrefix} ${restValue}.trim().toLowerCase() === "true"`;
1787
+ case "int16":
1788
+ case "int32":
1789
+ case "int64":
1790
+ case "uint16":
1791
+ case "uint32":
1792
+ case "uint64":
1793
+ case "float":
1794
+ case "decimal":
1795
+ case "decimal128":
1796
+ case "float32":
1797
+ case "float64":
1798
+ case "int8":
1799
+ case "integer":
1800
+ case "numeric":
1801
+ case "safeint":
1802
+ case "uint8":
1803
+ return `${nullOrUndefinedPrefix} Number(${restValue})`;
1804
+ case "enum":
1805
+ if (isNormalUnion(type)) {
1806
+ return `${restValue}`;
1807
+ }
1808
+ else if (isSpecialHandledUnion(type)) {
1809
+ const deserializeFunctionName = type
1810
+ ? buildModelDeserializer(context, getNullableValidType(type), {
1811
+ nameOnly: true,
1812
+ skipDiscriminatedUnionSuffix: false,
1813
+ })
1814
+ : undefined;
1815
+ if (deserializeFunctionName) {
1816
+ return `${deserializeFunctionName}(${restValue})`;
1817
+ }
1818
+ else {
1819
+ return `${restValue} as any`;
1820
+ }
1821
+ }
1822
+ else {
1823
+ return `${restValue} as any`;
1824
+ }
1825
+ default: {
1826
+ const val = deserializeResponseValue(context, type, restValue, true, format, recursionDepth);
1827
+ return `${nullOrUndefinedPrefix} ${val}`;
1828
+ }
1829
+ }
1830
+ }
1831
+ /**
1832
+ * This function helps converting strings into JS complex types recursively.
1833
+ * We need to drill down into Array elements to make sure that the element type is
1834
+ * deserialized correctly
1835
+ */
1836
+ export function deserializeResponseValue(context, type, restValue, required, format, recursionDepth = 0) {
1837
+ const dependencies = useDependencies();
1838
+ const stringToUint8ArrayReference = resolveReference(dependencies.stringToUint8Array);
1839
+ const nullOrUndefinedPrefix = isTypeNullable(type) || getOptionalForType(type) || !required
1840
+ ? `!${restValue}? ${restValue}: `
1841
+ : "";
1842
+ switch (type.kind) {
1843
+ case "plainDate":
1844
+ // plainDate deserializes from YYYY-MM-DD string to Date
1845
+ return `${nullOrUndefinedPrefix} new Date(${restValue})`;
1846
+ case "utcDateTime":
1847
+ return `${nullOrUndefinedPrefix} new Date(${type.encode === "unixTimestamp" ? `${restValue} * 1000` : restValue})`;
1848
+ case "array": {
1849
+ const prefix = nullOrUndefinedPrefix + restValue;
1850
+ const varName = recursionDepth > 0 ? `p${recursionDepth}` : "p";
1851
+ let elementNullOrUndefinedPrefix = "";
1852
+ if (type.valueType &&
1853
+ (isTypeNullable(type.valueType) || getOptionalForType(type.valueType))) {
1854
+ elementNullOrUndefinedPrefix = `!${varName} ? ${varName} :`;
1855
+ }
1856
+ const deserializeFunctionName = type.valueType
1857
+ ? buildModelDeserializer(context, getNullableValidType(type.valueType), {
1858
+ nameOnly: true,
1859
+ skipDiscriminatedUnionSuffix: false,
1860
+ })
1861
+ : undefined;
1862
+ if (deserializeFunctionName) {
1863
+ return `${prefix}.map((${varName}: any) => { return ${elementNullOrUndefinedPrefix}${deserializeFunctionName}(${varName})})`;
1864
+ }
1865
+ else if (type.valueType && isAzureCoreErrorType(context.program, type.valueType.__raw)) {
1866
+ return `${prefix}.map((${varName}: any) => { return ${elementNullOrUndefinedPrefix}${varName}})`;
1867
+ }
1868
+ else if (type.valueType) {
1869
+ if (format) {
1870
+ const parseHelper = getCollectionFormatParseHelper(format);
1871
+ if (parseHelper) {
1872
+ // We shouldn't check for an empty string here since an empty string should be parsed as an empty array
1873
+ const optionalPrefixForString = isTypeNullable(type) || getOptionalForType(type) || !required
1874
+ ? `${restValue} === null || ${restValue} === undefined ? ${restValue}: `
1875
+ : "";
1876
+ if (type.valueType.kind === "enum" && !isExtensibleEnum(context, type.valueType)) {
1877
+ // Special handling for non-extensible enums to cast the result to the correct type
1878
+ return `${optionalPrefixForString}${parseHelper}(${restValue}) as ${getTypeExpression(context, type)}`;
1879
+ }
1880
+ else {
1881
+ return `${optionalPrefixForString}${parseHelper}(${restValue})`;
1882
+ }
1883
+ }
1884
+ }
1885
+ return `${prefix}.map((${varName}: any) => { return ${elementNullOrUndefinedPrefix}${deserializeResponseValue(context, type.valueType, varName, true, getEncodeForType(type.valueType), recursionDepth + 1)}})`;
1886
+ }
1887
+ else {
1888
+ return restValue;
1889
+ }
1890
+ }
1891
+ case "dict": {
1892
+ const keyVar = recursionDepth > 0 ? `k${recursionDepth}` : "k";
1893
+ const valueVar = recursionDepth > 0 ? `p${recursionDepth}` : "p";
1894
+ let elementNullOrUndefinedPrefix = "";
1895
+ if (type.valueType &&
1896
+ (isTypeNullable(type.valueType) || getOptionalForType(type.valueType))) {
1897
+ elementNullOrUndefinedPrefix = `!${valueVar} ? ${valueVar} :`;
1898
+ }
1899
+ const deserializeFunctionName = type.valueType
1900
+ ? buildModelDeserializer(context, getNullableValidType(type.valueType), {
1901
+ nameOnly: true,
1902
+ skipDiscriminatedUnionSuffix: false,
1903
+ })
1904
+ : undefined;
1905
+ if (deserializeFunctionName) {
1906
+ return `${nullOrUndefinedPrefix}Object.fromEntries(Object.entries(${restValue}).map(([${keyVar}, ${valueVar}]: [string, any]) => [${keyVar}, ${elementNullOrUndefinedPrefix}${deserializeFunctionName}(${valueVar})]))`;
1907
+ }
1908
+ else if (type.valueType && isAzureCoreErrorType(context.program, type.valueType.__raw)) {
1909
+ return `${nullOrUndefinedPrefix}Object.fromEntries(Object.entries(${restValue}).map(([${keyVar}, ${valueVar}]: [string, any]) => [${keyVar}, ${elementNullOrUndefinedPrefix}${valueVar}]))`;
1910
+ }
1911
+ else if (type.valueType) {
1912
+ return `${nullOrUndefinedPrefix}Object.fromEntries(Object.entries(${restValue}).map(([${keyVar}, ${valueVar}]: [string, any]) => [${keyVar}, ${elementNullOrUndefinedPrefix}${deserializeResponseValue(context, type.valueType, valueVar, true, getEncodeForType(type.valueType), recursionDepth + 1)}]))`;
1913
+ }
1914
+ else {
1915
+ return restValue;
1916
+ }
1917
+ }
1918
+ case "bytes":
1919
+ if (format !== "binary" && format !== "bytes") {
1920
+ return `${nullOrUndefinedPrefix}typeof ${restValue} === 'string'
1921
+ ? ${stringToUint8ArrayReference}(${restValue}, "${format ?? "base64"}")
1922
+ : ${restValue}`;
1923
+ }
1924
+ return restValue;
1925
+ case "union":
1926
+ if (isNormalUnion(type)) {
1927
+ return `${restValue}`;
1928
+ }
1929
+ else if (isSpecialHandledUnion(type)) {
1930
+ const deserializeFunctionName = type
1931
+ ? buildModelDeserializer(context, getNullableValidType(type), {
1932
+ nameOnly: true,
1933
+ skipDiscriminatedUnionSuffix: false,
1934
+ })
1935
+ : undefined;
1936
+ if (deserializeFunctionName) {
1937
+ return `${deserializeFunctionName}(${restValue})`;
1938
+ }
1939
+ else {
1940
+ return `${restValue} as any`;
1941
+ }
1942
+ }
1943
+ else {
1944
+ return `${restValue} as any`;
1945
+ }
1946
+ case "model": // generate deserialize logic for spread model types
1947
+ return `{${getResponseMapping(context, type, "").join(",")}}`;
1948
+ case "nullable":
1949
+ return deserializeResponseValue(context, type.type, restValue, false, getEncodeForType(type.type), recursionDepth + 1);
1950
+ default:
1951
+ return restValue;
1952
+ }
1953
+ }
1954
+ export function isLroAndPagingOperation(op) {
1955
+ return op.kind === "lropaging";
1956
+ }
1957
+ export function isLroOnlyOperation(op) {
1958
+ return op.kind === "lro";
1959
+ }
1960
+ export function isPagingOnlyOperation(op) {
1961
+ return op.kind === "paging";
1962
+ }
1963
+ export function getAllProperties(context, type, parents) {
1964
+ const propertiesMap = new Map();
1965
+ if (!type) {
1966
+ return [];
1967
+ }
1968
+ parents?.forEach((p) => {
1969
+ getAllProperties(context, p).forEach((prop) => {
1970
+ propertiesMap.set(prop.name, prop);
1971
+ });
1972
+ });
1973
+ if (type.kind === "model" && type.properties) {
1974
+ type.properties
1975
+ .filter((p) => {
1976
+ return p.kind === "property" && !isHttpMetadata(context, p);
1977
+ })
1978
+ .forEach((p) => {
1979
+ propertiesMap.set(p.name, p);
1980
+ });
1981
+ }
1982
+ return [...propertiesMap.values()];
1983
+ }
1984
+ export function getAllAncestors(type) {
1985
+ const ancestors = [];
1986
+ if (type.kind === "model" && type.baseModel) {
1987
+ ancestors.push(type.baseModel);
1988
+ ancestors.push(...getAllAncestors(type.baseModel));
1989
+ }
1990
+ return ancestors;
1991
+ }
1992
+ /**
1993
+ * Returns true when a param/property has a clientDefaultValue whose JavaScript type
1994
+ * is compatible with the declared TypeSpec type, meaning the default can be emitted
1995
+ * safely into generated code.
1996
+ */
1997
+ function hasEffectiveClientDefaultValue(param) {
1998
+ return (param.clientDefaultValue !== undefined &&
1999
+ isDefaultValueTypeMatch(param, param.clientDefaultValue));
2000
+ }
2001
+ /**
2002
+ * Checks if a clientDefaultValue type matches a parameter or model property type.
2003
+ * Returns true if the default value type is compatible with the target type.
2004
+ */
2005
+ function isDefaultValueTypeMatch(param, defaultValue) {
2006
+ const defaultType = typeof defaultValue;
2007
+ const paramType = param.type;
2008
+ // Map JavaScript types to TypeSpec types
2009
+ if (defaultType === "string") {
2010
+ return paramType.kind === "string" || paramType.kind === "enum";
2011
+ }
2012
+ if (defaultType === "number") {
2013
+ return (paramType.kind === "int32" ||
2014
+ paramType.kind === "int64" ||
2015
+ paramType.kind === "float32" ||
2016
+ paramType.kind === "float64" ||
2017
+ paramType.kind === "numeric" ||
2018
+ paramType.kind === "integer" ||
2019
+ paramType.kind === "float" ||
2020
+ paramType.kind === "decimal");
2021
+ }
2022
+ if (defaultType === "boolean") {
2023
+ return paramType.kind === "boolean";
2024
+ }
2025
+ // For other types, don't apply the default
2026
+ return false;
2027
+ }
2028
+ /**
2029
+ * Formats a default value for code generation.
2030
+ * Strings are wrapped in quotes, other values are used as-is.
2031
+ */
2032
+ function formatDefaultValue(defaultValue) {
2033
+ if (typeof defaultValue === "string") {
2034
+ return `"${defaultValue}"`;
2035
+ }
2036
+ return String(defaultValue);
2037
+ }
2038
+ export function getPropertySerializationPrefix(context, property, propertyPath) {
2039
+ const propertyFullName = getPropertyFullName(context, property, propertyPath);
2040
+ if (property.optional || isTypeNullable(property.type)) {
2041
+ return `!${propertyFullName}? ${propertyFullName}:`;
2042
+ }
2043
+ return "";
2044
+ }
2045
+ export function getPropertyFullName(context, property, propertyPath) {
2046
+ const normalizedPropertyName = propertyPath === ""
2047
+ ? normalizeName(property.name, NameType.Parameter, true)
2048
+ : normalizeModelPropertyName(context, property).replace(/^"/g, "").replace(/"$/g, "");
2049
+ let fullName = normalizedPropertyName;
2050
+ if (propertyPath === "" && property.optional) {
2051
+ fullName = `options?.${normalizedPropertyName}`;
2052
+ }
2053
+ else if (propertyPath) {
2054
+ fullName = `${propertyPath}["${normalizedPropertyName}"]`;
2055
+ }
2056
+ return fullName;
2057
+ }
2058
+ /**
2059
+ * Get an expression representing an array of expected status codes for the operation
2060
+ * @param operation The operation
2061
+ */
2062
+ export function getExpectedStatuses(operation) {
2063
+ let statusCodes = operation.operation.responses.map((x) => x.statusCodes);
2064
+ // For HEAD + @responseAsBool, 404 is a valid "false" response.
2065
+ if (isHeadAsBooleanOperation(operation) && !statusCodes.includes(404)) {
2066
+ statusCodes = [...statusCodes, 404];
2067
+ }
2068
+ // LROs may call the same path but with GET to get the operation status.
2069
+ if ((isLroOnlyOperation(operation) || isLroAndPagingOperation(operation)) &&
2070
+ operation.operation.verb !== "get") {
2071
+ // DELETE: Add 200, 202 for polling
2072
+ // POST/PUT/PATCH: Add 200, 201, 202 for polling
2073
+ const verb = operation.operation.verb.toLowerCase();
2074
+ if (verb === "delete") {
2075
+ statusCodes = [...statusCodes, 200, 202];
2076
+ }
2077
+ else {
2078
+ statusCodes = [...statusCodes, 200, 201, 202];
2079
+ }
2080
+ }
2081
+ statusCodes = Array.from(new Set(statusCodes));
2082
+ return `[${statusCodes.map((x) => `"${x}"`).join(", ")}]`;
2083
+ }
2084
+ /**
2085
+ * Gets the apiVersion expression with default value fallback for query parameters.
2086
+ * @param dpgContext - The SDK context
2087
+ * @param operation - The operation to get the apiVersion parameter from
2088
+ * @returns The apiVersion expression string, or undefined if no apiVersion query param exists
2089
+ */
2090
+ function getApiVersionExpression(dpgContext, operation) {
2091
+ const queryApiVersionParam = operation.operation.parameters.find((p) => p.kind === "query" && p.isApiVersionParam);
2092
+ if (!queryApiVersionParam) {
2093
+ return undefined;
2094
+ }
2095
+ // For multi-service, use only the default value (don't reference context.apiVersion)
2096
+ if (dpgContext.rlcOptions?.isMultiService) {
2097
+ return queryApiVersionParam.clientDefaultValue
2098
+ ? `"${queryApiVersionParam.clientDefaultValue}"`
2099
+ : undefined;
2100
+ }
2101
+ const paramAccess = `${queryApiVersionParam.onClient ? "context." : ""}${queryApiVersionParam.name}`;
2102
+ const defaultValueSuffix = queryApiVersionParam.clientDefaultValue
2103
+ ? ` ?? "${queryApiVersionParam.clientDefaultValue}"`
2104
+ : "";
2105
+ return `${paramAccess}${defaultValueSuffix}`;
2106
+ }
2107
+ /**
2108
+ * Extracts and deduplicates all response headers from operation responses.
2109
+ * @param responses - The operation responses
2110
+ * @returns Array of unique response headers
2111
+ */
2112
+ export function getResponseHeaders(responses) {
2113
+ const headerMap = new Map();
2114
+ for (const response of responses ?? []) {
2115
+ for (const header of response.headers ?? []) {
2116
+ if (shouldSkipHeaderSerialization(header))
2117
+ continue;
2118
+ const key = header.serializedName ?? header.name;
2119
+ if (!headerMap.has(key)) {
2120
+ headerMap.set(key, header);
2121
+ }
2122
+ }
2123
+ }
2124
+ return Array.from(headerMap.values());
2125
+ }
2126
+ /**
2127
+ * Builds a composite return type for operations that return both a model and additional headers.
2128
+ * Combines model properties and header properties into an inline object type.
2129
+ * @param context - The SDK context
2130
+ * @param modelType - The model type
2131
+ * @param headers - The response headers that are NOT in the model
2132
+ * @returns The composite type expression as a string (e.g., "{ name: string; email: string; requestId: string }")
2133
+ */
2134
+ function buildCompositeResponseType(context, modelType, headers) {
2135
+ const allParents = getAllAncestors(modelType);
2136
+ const modelProps = getAllProperties(context, modelType, allParents).filter((property) => {
2137
+ // Skip model properties that are headers with headerCollectionPrefix
2138
+ if (property.__raw &&
2139
+ isHeader(context.program, property.__raw) &&
2140
+ shouldSkipHeaderSerialization(property)) {
2141
+ return false;
2142
+ }
2143
+ return true;
2144
+ });
2145
+ // Collect header property names already in the model to avoid duplicates
2146
+ const modelHeaderNames = new Set();
2147
+ for (const property of modelProps) {
2148
+ if (isHeader(context.program, property.__raw)) {
2149
+ modelHeaderNames.add(property.name.toLowerCase());
2150
+ }
2151
+ }
2152
+ // Add only additional host response header properties not already in model
2153
+ for (const header of headers) {
2154
+ if (modelHeaderNames.has(header.name.toLowerCase())) {
2155
+ continue;
2156
+ }
2157
+ modelProps.push(header);
2158
+ }
2159
+ return emitInlineModel(context, modelProps);
2160
+ }
2161
+ /**
2162
+ * Builds an inline type string for header-only responses.
2163
+ * @param context - The SDK context
2164
+ * @param headers - The response headers
2165
+ * @returns The inline type expression as a string (e.g., "{ requestId: string; optionalHeader?: string }")
2166
+ */
2167
+ function buildHeaderOnlyResponseType(context, headers) {
2168
+ const properties = [];
2169
+ for (const header of headers) {
2170
+ const headerName = normalizeModelPropertyName(context, header);
2171
+ const headerType = getTypeExpression(context, header.type);
2172
+ const isOptional = header.optional ? "?" : "";
2173
+ properties.push(`${headerName}${isOptional}: ${headerType}`);
2174
+ }
2175
+ return `{ ${properties.join("; ")} }`;
2176
+ }
2177
+ /**
2178
+ * Builds the object literal expression for a header-only response.
2179
+ * Handles type conversions for headers (string to boolean, Date, number, Uint8Array).
2180
+ * @param operation - The service operation
2181
+ * @param headers - The response headers
2182
+ * @returns JavaScript expression string for the header-only response object
2183
+ */
2184
+ function buildHeaderOnlyResponseValue(context, headers) {
2185
+ const props = headers.map((header) => {
2186
+ const headerName = (header.serializedName ?? header.name).toLowerCase();
2187
+ const key = normalizeModelPropertyName(context, header);
2188
+ const value = deserializeResponseHeadersValue(context, header.type, `result.headers[${JSON.stringify(headerName)}]`, !header.optional, getEncodeForType(header.type), 0);
2189
+ return `${key}: ${value}`;
2190
+ });
2191
+ return `{ ${props.join(", ")} }`;
2192
+ }
2193
+ /**
2194
+ * Returns the name for a non-model response wrapper type.
2195
+ * The name follows the pattern: {OperationGroupName}{MethodName}Response
2196
+ * @param method - The method tuple [prefixes, operation]
2197
+ */
2198
+ export function getOperationResponseTypeName(method) {
2199
+ const prefixes = method[0];
2200
+ const operation = method[1];
2201
+ const prefix = !operation.name.includes("_")
2202
+ ? getClassicalLayerPrefix(prefixes, NameType.Interface)
2203
+ : "";
2204
+ return `${prefix}${normalizeName(operation.name, NameType.Interface)}Response`;
2205
+ }
2206
+ /**
2207
+ * Returns true when a type should be wrapped with a `body` property.
2208
+ * Wrapping is needed for primitive/enum types; composite (model, dict, model-array)
2209
+ * and unknown-as-record types map to the HLC PropertyKind.Composite / Dictionary
2210
+ * patterns which do NOT get a body wrapper.
2211
+ *
2212
+ * Covered cases (no wrap):
2213
+ * - model array (e.g. Foo[]) → HLC PropertyKind.Composite
2214
+ * - model → HLC PropertyKind.Composite
2215
+ * - dict / Record<string, unknown> → HLC PropertyKind.Dictionary
2216
+ * - unknown with treatUnknownAsRecord → treated as Dict
2217
+ *
2218
+ * Covered cases (wrap):
2219
+ * - string, boolean, number → HLC PropertyKind.Primitive
2220
+ * - string[] → HLC PropertyKind.Primitive (item kind)
2221
+ * - enum / KnownXxx | string → HLC PropertyKind.Enum
2222
+ * - any / unknown (no treatAsRecord) → HLC PropertyKind.Primitive
2223
+ */
2224
+ function isWrappableType(context, type) {
2225
+ if (type.kind === "array" && type.valueType.kind === "model")
2226
+ return false;
2227
+ if (type.kind === "dict" || type.kind === "model")
2228
+ return false;
2229
+ if (type.kind === "unknown" && context.rlcOptions?.treatUnknownAsRecord)
2230
+ return false;
2231
+ return true;
2232
+ }
2233
+ /**
2234
+ * Returns true if the operation uses the HTTP HEAD method.
2235
+ */
2236
+ function isHeadOperation(operation) {
2237
+ return operation.operation.verb.toLowerCase() === "head";
2238
+ }
2239
+ function isHeadAsBooleanOperation(operation) {
2240
+ if (!isHeadOperation(operation))
2241
+ return false;
2242
+ // @responseAsBool: TCGC promotes response.type to SdkBuiltInType { kind: "boolean" }
2243
+ if (operation.response.type?.kind === "boolean")
2244
+ return true;
2245
+ return false;
2246
+ }
2247
+ /**
2248
+ * Determines whether wrapping the non-model return type is needed for an operation.
2249
+ * Returns an object with `shouldWrap` (whether to wrap) and `isBinary` (whether it's a binary response).
2250
+ */
2251
+ export function checkWrapNonModelReturn(context, operation) {
2252
+ const noWrap = { shouldWrap: false, isBinary: false };
2253
+ // LRO+paging and paging-only operations are not wrapped
2254
+ if (isLroAndPagingOperation(operation) || isPagingOnlyOperation(operation)) {
2255
+ return noWrap;
2256
+ }
2257
+ // Only if the feature flag is enabled
2258
+ if (!context.rlcOptions?.wrapNonModelReturn) {
2259
+ return noWrap;
2260
+ }
2261
+ // For LRO-only operations, check the final result type from LRO metadata
2262
+ if (isLroOnlyOperation(operation)) {
2263
+ const lroResultType = operation.lroMetadata?.finalResponse?.result;
2264
+ if (!lroResultType) {
2265
+ return noWrap; // void LRO - no wrap needed
2266
+ }
2267
+ return {
2268
+ shouldWrap: isWrappableType(context, lroResultType),
2269
+ isBinary: false,
2270
+ };
2271
+ }
2272
+ const { type } = operation.response;
2273
+ if (!type) {
2274
+ // Special case: HEAD operation with @responseAsBool and void response → wrap as boolean { body: boolean }
2275
+ if (isHeadAsBooleanOperation(operation)) {
2276
+ return { shouldWrap: true, isBinary: false };
2277
+ }
2278
+ return noWrap; // void return type - no wrap needed
2279
+ }
2280
+ const contentTypes = operation.operation.responses[0]?.contentTypes ?? [];
2281
+ // bytes with binary content type → binary wrap (isBinary=true)
2282
+ // HLC: bytes → binary payload → separate binary handling
2283
+ if (type.__raw && isBinaryPayload(context, type.__raw, contentTypes, getEncodeForType(type))) {
2284
+ return { shouldWrap: true, isBinary: true };
2285
+ }
2286
+ return { shouldWrap: isWrappableType(context, type), isBinary: false };
2287
+ }
2288
+ /**
2289
+ * Builds a TypeAliasDeclarationStructure for the non-model response wrapper type.
2290
+ * - For binary responses: { blobBody?: Promise<Blob>; readableStreamBody?: NodeReadableStream }
2291
+ * - For other non-model responses: { body: <type> }
2292
+ */
2293
+ export function buildNonModelResponseTypeDeclaration(context, method, isBinary) {
2294
+ const typeName = getOperationResponseTypeName(method);
2295
+ const operation = method[1];
2296
+ let typeBody;
2297
+ if (isBinary) {
2298
+ const nodeReadableStreamRef = resolveReference(PlatformTypeHelpers.NodeReadableStream);
2299
+ typeBody = `{
2300
+ /**
2301
+ * BROWSER ONLY
2302
+ *
2303
+ * The response body as a browser Blob.
2304
+ * Always \`undefined\` in node.js.
2305
+ */
2306
+ blobBody?: Promise<Blob>;
2307
+ /**
2308
+ * NODEJS ONLY
2309
+ *
2310
+ * The response body as a node.js Readable stream.
2311
+ * Always \`undefined\` in the browser.
2312
+ */
2313
+ readableStreamBody?: ${nodeReadableStreamRef};
2314
+ }`;
2315
+ }
2316
+ else {
2317
+ const returnType = getTypeExpression(context, operation.response.type);
2318
+ typeBody = `{ body: ${returnType} }`;
2319
+ }
2320
+ return {
2321
+ kind: StructureKind.TypeAlias,
2322
+ name: typeName,
2323
+ type: typeBody,
2324
+ isExported: true,
2325
+ leadingTrivia: "\n",
2326
+ };
2327
+ }
2328
+ //# sourceMappingURL=operation-helpers.js.map