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