@azure-tools/typespec-ts 0.55.0 → 0.55.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 (461) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +24 -19
  3. package/dist/src/context-manager.d.ts +19 -2
  4. package/dist/src/context-manager.d.ts.map +1 -1
  5. package/dist/src/context-manager.js +21 -0
  6. package/dist/src/context-manager.js.map +1 -1
  7. package/dist/src/framework/declaration.d.ts.map +1 -1
  8. package/dist/src/framework/declaration.js +6 -20
  9. package/dist/src/framework/declaration.js.map +1 -1
  10. package/dist/src/framework/hooks/sdk-types.d.ts +9 -0
  11. package/dist/src/framework/hooks/sdk-types.d.ts.map +1 -1
  12. package/dist/src/framework/hooks/sdk-types.js +14 -1
  13. package/dist/src/framework/hooks/sdk-types.js.map +1 -1
  14. package/dist/src/framework/source-file-batch.d.ts +35 -0
  15. package/dist/src/framework/source-file-batch.d.ts.map +1 -0
  16. package/dist/src/framework/source-file-batch.js +128 -0
  17. package/dist/src/framework/source-file-batch.js.map +1 -0
  18. package/dist/src/index.d.ts.map +1 -1
  19. package/dist/src/index.js +84 -66
  20. package/dist/src/index.js.map +1 -1
  21. package/dist/src/{rlc-common/interfaces.d.ts → interfaces.d.ts} +12 -14
  22. package/dist/src/interfaces.d.ts.map +1 -0
  23. package/dist/src/interfaces.js.map +1 -0
  24. package/dist/src/lib.d.ts +17 -5
  25. package/dist/src/lib.d.ts.map +1 -1
  26. package/dist/src/lib.js +24 -17
  27. package/dist/src/lib.js.map +1 -1
  28. package/dist/src/meta-tree.d.ts +4 -4
  29. package/dist/src/meta-tree.d.ts.map +1 -1
  30. package/dist/src/metadata/build-api-extractor-config.d.ts +6 -0
  31. package/dist/src/metadata/build-api-extractor-config.d.ts.map +1 -0
  32. package/dist/src/metadata/build-api-extractor-config.js.map +1 -0
  33. package/dist/src/metadata/build-changelog-file.d.ts +6 -0
  34. package/dist/src/metadata/build-changelog-file.d.ts.map +1 -0
  35. package/dist/src/metadata/build-changelog-file.js.map +1 -0
  36. package/dist/src/metadata/build-es-lint-config.d.ts +6 -0
  37. package/dist/src/metadata/build-es-lint-config.d.ts.map +1 -0
  38. package/dist/src/metadata/build-es-lint-config.js.map +1 -0
  39. package/dist/src/metadata/build-license-file.d.ts.map +1 -0
  40. package/dist/src/metadata/build-license-file.js.map +1 -0
  41. package/dist/src/{rlc-common/metadata → metadata}/build-package-file.d.ts +3 -3
  42. package/dist/src/metadata/build-package-file.d.ts.map +1 -0
  43. package/dist/src/{rlc-common/metadata → metadata}/build-package-file.js +1 -1
  44. package/dist/src/metadata/build-package-file.js.map +1 -0
  45. package/dist/src/metadata/build-readme-file.d.ts +11 -0
  46. package/dist/src/metadata/build-readme-file.d.ts.map +1 -0
  47. package/dist/src/{rlc-common/metadata → metadata}/build-readme-file.js +16 -69
  48. package/dist/src/metadata/build-readme-file.js.map +1 -0
  49. package/dist/src/metadata/build-sample-env-file.d.ts +6 -0
  50. package/dist/src/metadata/build-sample-env-file.d.ts.map +1 -0
  51. package/dist/src/metadata/build-sample-env-file.js.map +1 -0
  52. package/dist/src/{rlc-common/metadata → metadata}/build-test-config.d.ts +3 -3
  53. package/dist/src/metadata/build-test-config.d.ts.map +1 -0
  54. package/dist/src/metadata/build-test-config.js.map +1 -0
  55. package/dist/src/{rlc-common/metadata → metadata}/build-ts-config.d.ts +13 -7
  56. package/dist/src/metadata/build-ts-config.d.ts.map +1 -0
  57. package/dist/src/{rlc-common/metadata → metadata}/build-ts-config.js +24 -8
  58. package/dist/src/metadata/build-ts-config.js.map +1 -0
  59. package/dist/src/metadata/build-vitest-config.d.ts +6 -0
  60. package/dist/src/metadata/build-vitest-config.d.ts.map +1 -0
  61. package/dist/src/metadata/build-vitest-config.js.map +1 -0
  62. package/dist/src/{rlc-common/metadata → metadata}/build-warp-config.d.ts +2 -2
  63. package/dist/src/metadata/build-warp-config.d.ts.map +1 -0
  64. package/dist/src/metadata/build-warp-config.js.map +1 -0
  65. package/dist/src/metadata/package-json/azure-package-common.d.ts.map +1 -0
  66. package/dist/src/metadata/package-json/azure-package-common.js.map +1 -0
  67. package/dist/src/metadata/package-json/build-azure-monorepo-package.d.ts.map +1 -0
  68. package/dist/src/{rlc-common/metadata → metadata}/package-json/build-azure-monorepo-package.js +1 -1
  69. package/dist/src/metadata/package-json/build-azure-monorepo-package.js.map +1 -0
  70. package/dist/src/metadata/package-json/package-common.d.ts.map +1 -0
  71. package/dist/src/metadata/package-json/package-common.js.map +1 -0
  72. package/dist/src/metadata/render-template.d.ts +24 -0
  73. package/dist/src/metadata/render-template.d.ts.map +1 -0
  74. package/dist/src/metadata/render-template.js +148 -0
  75. package/dist/src/metadata/render-template.js.map +1 -0
  76. package/dist/src/metadata/test/build-recorded-client.d.ts +6 -0
  77. package/dist/src/metadata/test/build-recorded-client.d.ts.map +1 -0
  78. package/dist/src/metadata/test/build-recorded-client.js +8 -0
  79. package/dist/src/metadata/test/build-recorded-client.js.map +1 -0
  80. package/dist/src/metadata/test/build-sample-test.d.ts +6 -0
  81. package/dist/src/metadata/test/build-sample-test.d.ts.map +1 -0
  82. package/dist/src/metadata/test/build-sample-test.js +8 -0
  83. package/dist/src/metadata/test/build-sample-test.js.map +1 -0
  84. package/dist/src/metadata/test/build-snippets.d.ts +6 -0
  85. package/dist/src/metadata/test/build-snippets.d.ts.map +1 -0
  86. package/dist/src/{rlc-common → metadata}/test/build-snippets.js +3 -5
  87. package/dist/src/metadata/test/build-snippets.js.map +1 -0
  88. package/dist/src/metadata/test/template.d.ts +4 -0
  89. package/dist/src/metadata/test/template.d.ts.map +1 -0
  90. package/dist/src/metadata/test/template.js +100 -0
  91. package/dist/src/metadata/test/template.js.map +1 -0
  92. package/dist/src/metadata/utils.d.ts +3 -0
  93. package/dist/src/metadata/utils.d.ts.map +1 -0
  94. package/dist/src/metadata/utils.js.map +1 -0
  95. package/dist/src/modular/build-classical-client.d.ts.map +1 -1
  96. package/dist/src/modular/build-classical-client.js +11 -11
  97. package/dist/src/modular/build-classical-client.js.map +1 -1
  98. package/dist/src/modular/build-classical-operation-groups.d.ts.map +1 -1
  99. package/dist/src/modular/build-classical-operation-groups.js +3 -3
  100. package/dist/src/modular/build-classical-operation-groups.js.map +1 -1
  101. package/dist/src/modular/build-client-context.d.ts.map +1 -1
  102. package/dist/src/modular/build-client-context.js +7 -7
  103. package/dist/src/modular/build-client-context.js.map +1 -1
  104. package/dist/src/modular/build-modular-options.js +3 -3
  105. package/dist/src/modular/build-modular-options.js.map +1 -1
  106. package/dist/src/modular/build-operations.d.ts.map +1 -1
  107. package/dist/src/modular/build-operations.js +6 -6
  108. package/dist/src/modular/build-operations.js.map +1 -1
  109. package/dist/src/modular/build-project-files.d.ts.map +1 -1
  110. package/dist/src/modular/build-project-files.js +4 -4
  111. package/dist/src/modular/build-project-files.js.map +1 -1
  112. package/dist/src/modular/build-restore-poller.d.ts.map +1 -1
  113. package/dist/src/modular/build-restore-poller.js +3 -3
  114. package/dist/src/modular/build-restore-poller.js.map +1 -1
  115. package/dist/src/modular/build-root-index.d.ts.map +1 -1
  116. package/dist/src/modular/build-root-index.js +42 -14
  117. package/dist/src/modular/build-root-index.js.map +1 -1
  118. package/dist/src/modular/build-subpath-index.d.ts.map +1 -1
  119. package/dist/src/modular/build-subpath-index.js +17 -4
  120. package/dist/src/modular/build-subpath-index.js.map +1 -1
  121. package/dist/src/modular/emit-models-options.d.ts.map +1 -1
  122. package/dist/src/modular/emit-models-options.js +3 -3
  123. package/dist/src/modular/emit-models-options.js.map +1 -1
  124. package/dist/src/modular/emit-models.d.ts +1 -1
  125. package/dist/src/modular/emit-models.d.ts.map +1 -1
  126. package/dist/src/modular/emit-models.js +32 -25
  127. package/dist/src/modular/emit-models.js.map +1 -1
  128. package/dist/src/modular/emit-samples.d.ts.map +1 -1
  129. package/dist/src/modular/emit-samples.js +5 -5
  130. package/dist/src/modular/emit-samples.js.map +1 -1
  131. package/dist/src/modular/emit-tests.d.ts.map +1 -1
  132. package/dist/src/modular/emit-tests.js +1 -1
  133. package/dist/src/modular/emit-tests.js.map +1 -1
  134. package/dist/src/modular/helpers/classical-operation-helpers.d.ts.map +1 -1
  135. package/dist/src/modular/helpers/classical-operation-helpers.js +11 -11
  136. package/dist/src/modular/helpers/classical-operation-helpers.js.map +1 -1
  137. package/dist/src/modular/helpers/client-helpers.d.ts +6 -1
  138. package/dist/src/modular/helpers/client-helpers.d.ts.map +1 -1
  139. package/dist/src/modular/helpers/client-helpers.js +18 -14
  140. package/dist/src/modular/helpers/client-helpers.js.map +1 -1
  141. package/dist/src/modular/helpers/example-value-helpers.d.ts.map +1 -1
  142. package/dist/src/modular/helpers/example-value-helpers.js +2 -2
  143. package/dist/src/modular/helpers/example-value-helpers.js.map +1 -1
  144. package/dist/src/modular/helpers/naming-helpers.d.ts +1 -1
  145. package/dist/src/modular/helpers/naming-helpers.d.ts.map +1 -1
  146. package/dist/src/modular/helpers/naming-helpers.js +2 -2
  147. package/dist/src/modular/helpers/naming-helpers.js.map +1 -1
  148. package/dist/src/modular/helpers/operation-helpers.d.ts +4 -4
  149. package/dist/src/modular/helpers/operation-helpers.d.ts.map +1 -1
  150. package/dist/src/modular/helpers/operation-helpers.js +25 -26
  151. package/dist/src/modular/helpers/operation-helpers.js.map +1 -1
  152. package/dist/src/modular/helpers/type-helpers.d.ts.map +1 -1
  153. package/dist/src/modular/helpers/type-helpers.js +1 -1
  154. package/dist/src/modular/helpers/type-helpers.js.map +1 -1
  155. package/dist/src/modular/interfaces.d.ts +4 -4
  156. package/dist/src/modular/interfaces.d.ts.map +1 -1
  157. package/dist/src/modular/serialization/build-deserializer-function.d.ts.map +1 -1
  158. package/dist/src/modular/serialization/build-deserializer-function.js +2 -2
  159. package/dist/src/modular/serialization/build-deserializer-function.js.map +1 -1
  160. package/dist/src/modular/serialization/build-serializer-function.d.ts.map +1 -1
  161. package/dist/src/modular/serialization/build-serializer-function.js +2 -2
  162. package/dist/src/modular/serialization/build-serializer-function.js.map +1 -1
  163. package/dist/src/modular/serialization/build-xml-serializer-function.d.ts.map +1 -1
  164. package/dist/src/modular/serialization/build-xml-serializer-function.js +1 -1
  165. package/dist/src/modular/serialization/build-xml-serializer-function.js.map +1 -1
  166. package/dist/src/modular/type-expressions/get-enum-expression.js +1 -1
  167. package/dist/src/modular/type-expressions/get-enum-expression.js.map +1 -1
  168. package/dist/src/modular/type-expressions/get-nullable-expression.js +1 -1
  169. package/dist/src/modular/type-expressions/get-nullable-expression.js.map +1 -1
  170. package/dist/src/modular/type-expressions/get-type-expression.d.ts.map +1 -1
  171. package/dist/src/modular/type-expressions/get-type-expression.js +3 -3
  172. package/dist/src/modular/type-expressions/get-type-expression.js.map +1 -1
  173. package/dist/src/transform/transform-api-version-info.d.ts +1 -1
  174. package/dist/src/transform/transform-api-version-info.d.ts.map +1 -1
  175. package/dist/src/transform/transform-api-version-info.js +4 -3
  176. package/dist/src/transform/transform-api-version-info.js.map +1 -1
  177. package/dist/src/transform/{transfrom-rlc-options.d.ts → transform-client-options.d.ts} +3 -3
  178. package/dist/src/transform/transform-client-options.d.ts.map +1 -0
  179. package/dist/src/transform/{transfrom-rlc-options.js → transform-client-options.js} +9 -13
  180. package/dist/src/transform/transform-client-options.js.map +1 -0
  181. package/dist/src/transform/transform-helper-function-details.d.ts +1 -1
  182. package/dist/src/transform/transform-helper-function-details.d.ts.map +1 -1
  183. package/dist/src/transform/transform-helper-function-details.js +4 -4
  184. package/dist/src/transform/transform-helper-function-details.js.map +1 -1
  185. package/dist/src/transform/transform-parameters.d.ts +1 -1
  186. package/dist/src/transform/transform-parameters.d.ts.map +1 -1
  187. package/dist/src/transform/transform-parameters.js +11 -11
  188. package/dist/src/transform/transform-parameters.js.map +1 -1
  189. package/dist/src/transform/transform-paths.d.ts +1 -1
  190. package/dist/src/transform/transform-paths.d.ts.map +1 -1
  191. package/dist/src/transform/transform-paths.js +5 -4
  192. package/dist/src/transform/transform-paths.js.map +1 -1
  193. package/dist/src/transform/transform-responses.d.ts +1 -1
  194. package/dist/src/transform/transform-responses.d.ts.map +1 -1
  195. package/dist/src/transform/transform-responses.js +19 -18
  196. package/dist/src/transform/transform-responses.js.map +1 -1
  197. package/dist/src/transform/transform-schemas.js +5 -5
  198. package/dist/src/transform/transform-schemas.js.map +1 -1
  199. package/dist/src/transform/transform-telemetry-info.d.ts +1 -1
  200. package/dist/src/transform/transform-telemetry-info.d.ts.map +1 -1
  201. package/dist/src/transform/transform-telemetry-info.js +2 -2
  202. package/dist/src/transform/transform-telemetry-info.js.map +1 -1
  203. package/dist/src/transform/transform.d.ts +2 -2
  204. package/dist/src/transform/transform.d.ts.map +1 -1
  205. package/dist/src/transform/transform.js +9 -10
  206. package/dist/src/transform/transform.js.map +1 -1
  207. package/dist/src/utils/api-version-util.d.ts.map +1 -0
  208. package/dist/src/utils/api-version-util.js.map +1 -0
  209. package/dist/src/utils/client-utils.d.ts +5 -5
  210. package/dist/src/utils/client-utils.d.ts.map +1 -1
  211. package/dist/src/utils/client-utils.js +10 -10
  212. package/dist/src/utils/client-utils.js.map +1 -1
  213. package/dist/src/utils/cross-language-def.d.ts.map +1 -1
  214. package/dist/src/utils/cross-language-def.js +3 -3
  215. package/dist/src/utils/cross-language-def.js.map +1 -1
  216. package/dist/src/utils/emit-util.d.ts +2 -2
  217. package/dist/src/utils/emit-util.d.ts.map +1 -1
  218. package/dist/src/utils/emit-util.js +2 -2
  219. package/dist/src/utils/emit-util.js.map +1 -1
  220. package/dist/src/utils/imports-util.d.ts.map +1 -0
  221. package/dist/src/{rlc-common/helpers → utils}/imports-util.js +6 -6
  222. package/dist/src/utils/imports-util.js.map +1 -0
  223. package/dist/src/utils/interfaces.d.ts +3 -4
  224. package/dist/src/utils/interfaces.d.ts.map +1 -1
  225. package/dist/src/utils/model-utils.d.ts +1 -1
  226. package/dist/src/utils/model-utils.d.ts.map +1 -1
  227. package/dist/src/utils/model-utils.js +4 -2
  228. package/dist/src/utils/model-utils.js.map +1 -1
  229. package/dist/src/{rlc-common/helpers → utils}/name-constructors.d.ts +2 -2
  230. package/dist/src/utils/name-constructors.d.ts.map +1 -0
  231. package/dist/src/utils/name-constructors.js.map +1 -0
  232. package/dist/src/utils/name-utils.d.ts.map +1 -0
  233. package/dist/src/utils/name-utils.js.map +1 -0
  234. package/dist/src/utils/namespace-utils.js +4 -4
  235. package/dist/src/utils/namespace-utils.js.map +1 -1
  236. package/dist/src/utils/operation-helpers.d.ts +16 -0
  237. package/dist/src/utils/operation-helpers.d.ts.map +1 -0
  238. package/dist/src/utils/operation-helpers.js.map +1 -0
  239. package/dist/src/utils/operation-util.d.ts +2 -2
  240. package/dist/src/utils/operation-util.d.ts.map +1 -1
  241. package/dist/src/utils/operation-util.js +17 -18
  242. package/dist/src/utils/operation-util.js.map +1 -1
  243. package/dist/src/utils/parameter-utils.d.ts +1 -1
  244. package/dist/src/utils/parameter-utils.d.ts.map +1 -1
  245. package/dist/src/utils/parameter-utils.js +2 -4
  246. package/dist/src/utils/parameter-utils.js.map +1 -1
  247. package/dist/src/{rlc-common/helpers → utils}/schema-helpers.d.ts +2 -2
  248. package/dist/src/utils/schema-helpers.d.ts.map +1 -0
  249. package/dist/src/utils/schema-helpers.js.map +1 -0
  250. package/dist/src/utils/type-util.d.ts.map +1 -0
  251. package/dist/src/utils/type-util.js.map +1 -0
  252. package/dist/tsconfig.tsbuildinfo +1 -1
  253. package/package.json +36 -46
  254. package/src/context-manager.ts +25 -2
  255. package/src/framework/declaration.ts +8 -20
  256. package/src/framework/hooks/sdk-types.ts +15 -1
  257. package/src/framework/source-file-batch.ts +140 -0
  258. package/src/index.ts +104 -107
  259. package/src/{rlc-common/interfaces.ts → interfaces.ts} +14 -16
  260. package/src/lib.ts +43 -23
  261. package/src/meta-tree.ts +4 -4
  262. package/src/{rlc-common/metadata → metadata}/build-api-extractor-config.ts +2 -2
  263. package/src/{rlc-common/metadata → metadata}/build-changelog-file.ts +3 -3
  264. package/src/{rlc-common/metadata → metadata}/build-es-lint-config.ts +2 -2
  265. package/src/{rlc-common/metadata → metadata}/build-package-file.ts +6 -6
  266. package/src/{rlc-common/metadata → metadata}/build-readme-file.ts +25 -99
  267. package/src/{rlc-common/metadata → metadata}/build-sample-env-file.ts +2 -2
  268. package/src/{rlc-common/metadata → metadata}/build-test-config.ts +4 -4
  269. package/src/{rlc-common/metadata → metadata}/build-ts-config.ts +28 -11
  270. package/src/{rlc-common/metadata → metadata}/build-vitest-config.ts +2 -2
  271. package/src/{rlc-common/metadata → metadata}/build-warp-config.ts +2 -2
  272. package/src/{rlc-common/metadata → metadata}/package-json/build-azure-monorepo-package.ts +1 -1
  273. package/src/metadata/render-template.ts +202 -0
  274. package/src/metadata/test/build-recorded-client.ts +9 -0
  275. package/src/metadata/test/build-sample-test.ts +9 -0
  276. package/src/{rlc-common → metadata}/test/build-snippets.ts +5 -7
  277. package/src/metadata/test/template.ts +101 -0
  278. package/src/{rlc-common/metadata → metadata}/utils.ts +2 -2
  279. package/src/modular/build-classical-client.ts +11 -15
  280. package/src/modular/build-classical-operation-groups.ts +3 -3
  281. package/src/modular/build-client-context.ts +7 -7
  282. package/src/modular/build-modular-options.ts +3 -3
  283. package/src/modular/build-operations.ts +6 -6
  284. package/src/modular/build-project-files.ts +4 -5
  285. package/src/modular/build-restore-poller.ts +3 -3
  286. package/src/modular/build-root-index.ts +57 -19
  287. package/src/modular/build-subpath-index.ts +26 -5
  288. package/src/modular/emit-models-options.ts +3 -3
  289. package/src/modular/emit-models.ts +32 -26
  290. package/src/modular/emit-samples.ts +5 -5
  291. package/src/modular/emit-tests.ts +1 -1
  292. package/src/modular/helpers/classical-operation-helpers.ts +11 -11
  293. package/src/modular/helpers/client-helpers.ts +19 -16
  294. package/src/modular/helpers/example-value-helpers.ts +2 -2
  295. package/src/modular/helpers/naming-helpers.ts +2 -2
  296. package/src/modular/helpers/operation-helpers.ts +27 -27
  297. package/src/modular/helpers/type-helpers.ts +1 -1
  298. package/src/modular/interfaces.ts +4 -4
  299. package/src/modular/serialization/build-deserializer-function.ts +2 -2
  300. package/src/modular/serialization/build-serializer-function.ts +2 -2
  301. package/src/modular/serialization/build-xml-serializer-function.ts +1 -1
  302. package/src/modular/type-expressions/get-enum-expression.ts +1 -1
  303. package/src/modular/type-expressions/get-nullable-expression.ts +1 -1
  304. package/src/modular/type-expressions/get-type-expression.ts +3 -3
  305. package/src/transform/transform-api-version-info.ts +4 -10
  306. package/src/transform/{transfrom-rlc-options.ts → transform-client-options.ts} +12 -22
  307. package/src/transform/transform-helper-function-details.ts +5 -5
  308. package/src/transform/transform-parameters.ts +12 -12
  309. package/src/transform/transform-paths.ts +5 -12
  310. package/src/transform/transform-responses.ts +19 -19
  311. package/src/transform/transform-schemas.ts +5 -5
  312. package/src/transform/transform-telemetry-info.ts +3 -3
  313. package/src/transform/transform.ts +13 -18
  314. package/src/utils/client-utils.ts +11 -11
  315. package/src/utils/cross-language-def.ts +3 -3
  316. package/src/utils/emit-util.ts +3 -3
  317. package/src/{rlc-common/helpers → utils}/imports-util.ts +6 -6
  318. package/src/utils/interfaces.ts +3 -4
  319. package/src/utils/model-utils.ts +7 -8
  320. package/src/{rlc-common/helpers → utils}/name-constructors.ts +2 -2
  321. package/src/utils/namespace-utils.ts +4 -4
  322. package/src/{rlc-common/helpers → utils}/operation-helpers.ts +12 -12
  323. package/src/utils/operation-util.ts +19 -33
  324. package/src/utils/parameter-utils.ts +2 -4
  325. package/src/{rlc-common/helpers → utils}/schema-helpers.ts +2 -2
  326. package/dist/src/rlc-common/helpers/api-version-util.d.ts.map +0 -1
  327. package/dist/src/rlc-common/helpers/api-version-util.js.map +0 -1
  328. package/dist/src/rlc-common/helpers/imports-util.d.ts.map +0 -1
  329. package/dist/src/rlc-common/helpers/imports-util.js.map +0 -1
  330. package/dist/src/rlc-common/helpers/name-constructors.d.ts.map +0 -1
  331. package/dist/src/rlc-common/helpers/name-constructors.js.map +0 -1
  332. package/dist/src/rlc-common/helpers/name-utils.d.ts.map +0 -1
  333. package/dist/src/rlc-common/helpers/name-utils.js.map +0 -1
  334. package/dist/src/rlc-common/helpers/operation-helpers.d.ts +0 -16
  335. package/dist/src/rlc-common/helpers/operation-helpers.d.ts.map +0 -1
  336. package/dist/src/rlc-common/helpers/operation-helpers.js.map +0 -1
  337. package/dist/src/rlc-common/helpers/schema-helpers.d.ts.map +0 -1
  338. package/dist/src/rlc-common/helpers/schema-helpers.js.map +0 -1
  339. package/dist/src/rlc-common/helpers/type-util.d.ts.map +0 -1
  340. package/dist/src/rlc-common/helpers/type-util.js.map +0 -1
  341. package/dist/src/rlc-common/index.d.ts +0 -23
  342. package/dist/src/rlc-common/index.d.ts.map +0 -1
  343. package/dist/src/rlc-common/index.js +0 -25
  344. package/dist/src/rlc-common/index.js.map +0 -1
  345. package/dist/src/rlc-common/interfaces.d.ts.map +0 -1
  346. package/dist/src/rlc-common/interfaces.js.map +0 -1
  347. package/dist/src/rlc-common/metadata/build-api-extractor-config.d.ts +0 -6
  348. package/dist/src/rlc-common/metadata/build-api-extractor-config.d.ts.map +0 -1
  349. package/dist/src/rlc-common/metadata/build-api-extractor-config.js.map +0 -1
  350. package/dist/src/rlc-common/metadata/build-changelog-file.d.ts +0 -6
  351. package/dist/src/rlc-common/metadata/build-changelog-file.d.ts.map +0 -1
  352. package/dist/src/rlc-common/metadata/build-changelog-file.js.map +0 -1
  353. package/dist/src/rlc-common/metadata/build-es-lint-config.d.ts +0 -6
  354. package/dist/src/rlc-common/metadata/build-es-lint-config.d.ts.map +0 -1
  355. package/dist/src/rlc-common/metadata/build-es-lint-config.js.map +0 -1
  356. package/dist/src/rlc-common/metadata/build-license-file.d.ts.map +0 -1
  357. package/dist/src/rlc-common/metadata/build-license-file.js.map +0 -1
  358. package/dist/src/rlc-common/metadata/build-package-file.d.ts.map +0 -1
  359. package/dist/src/rlc-common/metadata/build-package-file.js.map +0 -1
  360. package/dist/src/rlc-common/metadata/build-readme-file.d.ts +0 -11
  361. package/dist/src/rlc-common/metadata/build-readme-file.d.ts.map +0 -1
  362. package/dist/src/rlc-common/metadata/build-readme-file.js.map +0 -1
  363. package/dist/src/rlc-common/metadata/build-sample-env-file.d.ts +0 -6
  364. package/dist/src/rlc-common/metadata/build-sample-env-file.d.ts.map +0 -1
  365. package/dist/src/rlc-common/metadata/build-sample-env-file.js.map +0 -1
  366. package/dist/src/rlc-common/metadata/build-test-config.d.ts.map +0 -1
  367. package/dist/src/rlc-common/metadata/build-test-config.js.map +0 -1
  368. package/dist/src/rlc-common/metadata/build-ts-config.d.ts.map +0 -1
  369. package/dist/src/rlc-common/metadata/build-ts-config.js.map +0 -1
  370. package/dist/src/rlc-common/metadata/build-vitest-config.d.ts +0 -6
  371. package/dist/src/rlc-common/metadata/build-vitest-config.d.ts.map +0 -1
  372. package/dist/src/rlc-common/metadata/build-vitest-config.js.map +0 -1
  373. package/dist/src/rlc-common/metadata/build-warp-config.d.ts.map +0 -1
  374. package/dist/src/rlc-common/metadata/build-warp-config.js.map +0 -1
  375. package/dist/src/rlc-common/metadata/package-json/azure-package-common.d.ts.map +0 -1
  376. package/dist/src/rlc-common/metadata/package-json/azure-package-common.js.map +0 -1
  377. package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.d.ts.map +0 -1
  378. package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.js.map +0 -1
  379. package/dist/src/rlc-common/metadata/package-json/package-common.d.ts.map +0 -1
  380. package/dist/src/rlc-common/metadata/package-json/package-common.js.map +0 -1
  381. package/dist/src/rlc-common/metadata/utils.d.ts +0 -3
  382. package/dist/src/rlc-common/metadata/utils.d.ts.map +0 -1
  383. package/dist/src/rlc-common/metadata/utils.js.map +0 -1
  384. package/dist/src/rlc-common/static/paginate-content.d.ts +0 -2
  385. package/dist/src/rlc-common/static/paginate-content.d.ts.map +0 -1
  386. package/dist/src/rlc-common/static/paginate-content.js +0 -345
  387. package/dist/src/rlc-common/static/paginate-content.js.map +0 -1
  388. package/dist/src/rlc-common/static/polling-content.d.ts +0 -2
  389. package/dist/src/rlc-common/static/polling-content.d.ts.map +0 -1
  390. package/dist/src/rlc-common/static/polling-content.js +0 -225
  391. package/dist/src/rlc-common/static/polling-content.js.map +0 -1
  392. package/dist/src/rlc-common/static/sample-template.d.ts +0 -2
  393. package/dist/src/rlc-common/static/sample-template.d.ts.map +0 -1
  394. package/dist/src/rlc-common/static/sample-template.js +0 -56
  395. package/dist/src/rlc-common/static/sample-template.js.map +0 -1
  396. package/dist/src/rlc-common/static/serialize-helper.d.ts +0 -6
  397. package/dist/src/rlc-common/static/serialize-helper.d.ts.map +0 -1
  398. package/dist/src/rlc-common/static/serialize-helper.js +0 -31
  399. package/dist/src/rlc-common/static/serialize-helper.js.map +0 -1
  400. package/dist/src/rlc-common/test/build-karma-config.d.ts +0 -6
  401. package/dist/src/rlc-common/test/build-karma-config.d.ts.map +0 -1
  402. package/dist/src/rlc-common/test/build-karma-config.js +0 -11
  403. package/dist/src/rlc-common/test/build-karma-config.js.map +0 -1
  404. package/dist/src/rlc-common/test/build-recorded-client.d.ts +0 -6
  405. package/dist/src/rlc-common/test/build-recorded-client.d.ts.map +0 -1
  406. package/dist/src/rlc-common/test/build-recorded-client.js +0 -14
  407. package/dist/src/rlc-common/test/build-recorded-client.js.map +0 -1
  408. package/dist/src/rlc-common/test/build-sample-test.d.ts +0 -6
  409. package/dist/src/rlc-common/test/build-sample-test.d.ts.map +0 -1
  410. package/dist/src/rlc-common/test/build-sample-test.js +0 -11
  411. package/dist/src/rlc-common/test/build-sample-test.js.map +0 -1
  412. package/dist/src/rlc-common/test/build-snippets.d.ts +0 -6
  413. package/dist/src/rlc-common/test/build-snippets.d.ts.map +0 -1
  414. package/dist/src/rlc-common/test/build-snippets.js.map +0 -1
  415. package/dist/src/rlc-common/test/template.d.ts +0 -5
  416. package/dist/src/rlc-common/test/template.d.ts.map +0 -1
  417. package/dist/src/rlc-common/test/template.js +0 -227
  418. package/dist/src/rlc-common/test/template.js.map +0 -1
  419. package/dist/src/transform/transfrom-rlc-options.d.ts.map +0 -1
  420. package/dist/src/transform/transfrom-rlc-options.js.map +0 -1
  421. package/src/rlc-common/index.ts +0 -25
  422. package/src/rlc-common/static/paginate-content.ts +0 -345
  423. package/src/rlc-common/static/polling-content.ts +0 -225
  424. package/src/rlc-common/static/sample-template.ts +0 -56
  425. package/src/rlc-common/static/serialize-helper.ts +0 -34
  426. package/src/rlc-common/test/build-karma-config.ts +0 -12
  427. package/src/rlc-common/test/build-recorded-client.ts +0 -15
  428. package/src/rlc-common/test/build-sample-test.ts +0 -12
  429. package/src/rlc-common/test/template.ts +0 -229
  430. /package/dist/src/{rlc-common/interfaces.js → interfaces.js} +0 -0
  431. /package/dist/src/{rlc-common/metadata → metadata}/build-api-extractor-config.js +0 -0
  432. /package/dist/src/{rlc-common/metadata → metadata}/build-changelog-file.js +0 -0
  433. /package/dist/src/{rlc-common/metadata → metadata}/build-es-lint-config.js +0 -0
  434. /package/dist/src/{rlc-common/metadata → metadata}/build-license-file.d.ts +0 -0
  435. /package/dist/src/{rlc-common/metadata → metadata}/build-license-file.js +0 -0
  436. /package/dist/src/{rlc-common/metadata → metadata}/build-sample-env-file.js +0 -0
  437. /package/dist/src/{rlc-common/metadata → metadata}/build-test-config.js +0 -0
  438. /package/dist/src/{rlc-common/metadata → metadata}/build-vitest-config.js +0 -0
  439. /package/dist/src/{rlc-common/metadata → metadata}/build-warp-config.js +0 -0
  440. /package/dist/src/{rlc-common/metadata → metadata}/package-json/azure-package-common.d.ts +0 -0
  441. /package/dist/src/{rlc-common/metadata → metadata}/package-json/azure-package-common.js +0 -0
  442. /package/dist/src/{rlc-common/metadata → metadata}/package-json/build-azure-monorepo-package.d.ts +0 -0
  443. /package/dist/src/{rlc-common/metadata → metadata}/package-json/package-common.d.ts +0 -0
  444. /package/dist/src/{rlc-common/metadata → metadata}/package-json/package-common.js +0 -0
  445. /package/dist/src/{rlc-common/metadata → metadata}/utils.js +0 -0
  446. /package/dist/src/{rlc-common/helpers → utils}/api-version-util.d.ts +0 -0
  447. /package/dist/src/{rlc-common/helpers → utils}/api-version-util.js +0 -0
  448. /package/dist/src/{rlc-common/helpers → utils}/imports-util.d.ts +0 -0
  449. /package/dist/src/{rlc-common/helpers → utils}/name-constructors.js +0 -0
  450. /package/dist/src/{rlc-common/helpers → utils}/name-utils.d.ts +0 -0
  451. /package/dist/src/{rlc-common/helpers → utils}/name-utils.js +0 -0
  452. /package/dist/src/{rlc-common/helpers → utils}/operation-helpers.js +0 -0
  453. /package/dist/src/{rlc-common/helpers → utils}/schema-helpers.js +0 -0
  454. /package/dist/src/{rlc-common/helpers → utils}/type-util.d.ts +0 -0
  455. /package/dist/src/{rlc-common/helpers → utils}/type-util.js +0 -0
  456. /package/src/{rlc-common/metadata → metadata}/build-license-file.ts +0 -0
  457. /package/src/{rlc-common/metadata → metadata}/package-json/azure-package-common.ts +0 -0
  458. /package/src/{rlc-common/metadata → metadata}/package-json/package-common.ts +0 -0
  459. /package/src/{rlc-common/helpers → utils}/api-version-util.ts +0 -0
  460. /package/src/{rlc-common/helpers → utils}/name-utils.ts +0 -0
  461. /package/src/{rlc-common/helpers → utils}/type-util.ts +0 -0
@@ -0,0 +1,202 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ /**
5
+ * A tiny, dependency-free renderer for the small subset of Handlebars/Mustache
6
+ * syntax used by the emitter's metadata templates. It intentionally supports only
7
+ * what those templates need:
8
+ *
9
+ * - `{{ name }}` interpolation (always "unescaped", matching the previous
10
+ * `{ noEscape: true }` Handlebars option).
11
+ * - `{{#if name}} ... {{else}} ... {{/if}}` conditional blocks (nesting allowed).
12
+ *
13
+ * It reproduces Handlebars' "standalone" whitespace handling so that a block tag
14
+ * occupying its own line does not leave a blank line behind, keeping the rendered
15
+ * output byte-for-byte identical to the previous Handlebars-based implementation.
16
+ */
17
+
18
+ type TemplateData = Record<string, unknown>;
19
+
20
+ interface TextToken {
21
+ kind: "text";
22
+ value: string;
23
+ }
24
+
25
+ interface TagToken {
26
+ kind: "open" | "else" | "close" | "var";
27
+ /** Condition (for `open`) or variable name (for `var`). */
28
+ name: string;
29
+ /** Whether this block tag stands alone on its line (Handlebars semantics). */
30
+ standalone: boolean;
31
+ }
32
+
33
+ type Token = TextToken | TagToken;
34
+
35
+ const MUSTACHE = /\{\{([^}]*)\}\}/g;
36
+
37
+ function tokenize(template: string): Token[] {
38
+ const tokens: Token[] = [];
39
+ let lastIndex = 0;
40
+ let match: RegExpExecArray | null;
41
+ MUSTACHE.lastIndex = 0;
42
+ while ((match = MUSTACHE.exec(template)) !== null) {
43
+ tokens.push({ kind: "text", value: template.slice(lastIndex, match.index) });
44
+ const inner = match[1]!.trim();
45
+ if (inner.startsWith("#if ")) {
46
+ tokens.push({ kind: "open", name: inner.slice(4).trim(), standalone: false });
47
+ } else if (inner === "else") {
48
+ tokens.push({ kind: "else", name: "", standalone: false });
49
+ } else if (inner === "/if") {
50
+ tokens.push({ kind: "close", name: "", standalone: false });
51
+ } else {
52
+ tokens.push({ kind: "var", name: inner, standalone: false });
53
+ }
54
+ lastIndex = match.index + match[0].length;
55
+ }
56
+ tokens.push({ kind: "text", value: template.slice(lastIndex) });
57
+ return tokens;
58
+ }
59
+
60
+ /**
61
+ * Applies Handlebars "standalone" whitespace stripping. A block tag (`#if`,
62
+ * `else`, `/if`) that is the only non-whitespace content on its line has the
63
+ * surrounding indentation and trailing newline removed.
64
+ */
65
+ function stripStandaloneWhitespace(tokens: Token[]): void {
66
+ const isBlock = (t: Token): t is TagToken =>
67
+ t.kind === "open" || t.kind === "else" || t.kind === "close";
68
+
69
+ // First pass: detect standalone tags from the original text tokens.
70
+ for (let i = 0; i < tokens.length; i++) {
71
+ const token = tokens[i]!;
72
+ if (!isBlock(token)) {
73
+ continue;
74
+ }
75
+ const prev = tokens[i - 1] as TextToken | undefined;
76
+ const next = tokens[i + 1] as TextToken | undefined;
77
+ const prevIsFirst = i - 1 === 0;
78
+ const nextIsLast = i + 1 === tokens.length - 1;
79
+
80
+ const prevValue = prev?.value ?? "";
81
+ const nextValue = next?.value ?? "";
82
+
83
+ const prevStandalone =
84
+ /\n[ \t]*$/.test(prevValue) || (prevIsFirst && /^[ \t]*$/.test(prevValue));
85
+ const nextStandalone =
86
+ /^[ \t]*\n/.test(nextValue) || (nextIsLast && /^[ \t]*$/.test(nextValue));
87
+
88
+ token.standalone = prevStandalone && nextStandalone;
89
+ }
90
+
91
+ // Second pass: strip whitespace around standalone tags.
92
+ for (let i = 0; i < tokens.length; i++) {
93
+ const token = tokens[i]!;
94
+ if (!isBlock(token) || !token.standalone) {
95
+ continue;
96
+ }
97
+ const prev = tokens[i - 1] as TextToken | undefined;
98
+ const next = tokens[i + 1] as TextToken | undefined;
99
+ if (prev) {
100
+ // Drop the indentation preceding the tag, keeping the previous newline.
101
+ prev.value = prev.value.replace(/[ \t]*$/, "");
102
+ }
103
+ if (next) {
104
+ // Drop the rest of the tag's line, including its trailing newline.
105
+ next.value = /^[ \t]*\n/.test(next.value)
106
+ ? next.value.replace(/^[ \t]*\n/, "")
107
+ : next.value.replace(/^[ \t]*$/, "");
108
+ }
109
+ }
110
+ }
111
+
112
+ type Node = TextNode | VarNode | IfNode;
113
+ interface TextNode {
114
+ kind: "text";
115
+ value: string;
116
+ }
117
+ interface VarNode {
118
+ kind: "var";
119
+ name: string;
120
+ }
121
+ interface IfNode {
122
+ kind: "if";
123
+ condition: string;
124
+ whenTrue: Node[];
125
+ whenFalse: Node[];
126
+ }
127
+
128
+ function parse(tokens: Token[], start: number, stopKinds: Token["kind"][]): [Node[], number] {
129
+ const nodes: Node[] = [];
130
+ let i = start;
131
+ while (i < tokens.length) {
132
+ const token = tokens[i]!;
133
+ if (token.kind === "text") {
134
+ if (token.value) {
135
+ nodes.push({ kind: "text", value: token.value });
136
+ }
137
+ i++;
138
+ } else if (token.kind === "var") {
139
+ nodes.push({ kind: "var", name: token.name });
140
+ i++;
141
+ } else if (token.kind === "open") {
142
+ const [whenTrue, afterTrue] = parse(tokens, i + 1, ["else", "close"]);
143
+ let whenFalse: Node[] = [];
144
+ let next = afterTrue;
145
+ if (tokens[next]?.kind === "else") {
146
+ const [elseNodes, afterElse] = parse(tokens, next + 1, ["close"]);
147
+ whenFalse = elseNodes;
148
+ next = afterElse;
149
+ }
150
+ // `next` now points at the matching `close` token.
151
+ nodes.push({ kind: "if", condition: token.name, whenTrue, whenFalse });
152
+ i = next + 1;
153
+ } else if (stopKinds.includes(token.kind)) {
154
+ return [nodes, i];
155
+ } else {
156
+ // Unmatched `else`/`close`; skip defensively.
157
+ i++;
158
+ }
159
+ }
160
+ return [nodes, i];
161
+ }
162
+
163
+ function isTruthy(value: unknown): boolean {
164
+ if (Array.isArray(value)) {
165
+ return value.length > 0;
166
+ }
167
+ return Boolean(value);
168
+ }
169
+
170
+ function renderNodes(nodes: Node[], data: TemplateData): string {
171
+ let out = "";
172
+ for (const node of nodes) {
173
+ switch (node.kind) {
174
+ case "text":
175
+ out += node.value;
176
+ break;
177
+ case "var": {
178
+ const value = data[node.name];
179
+ out += value === undefined || value === null ? "" : String(value);
180
+ break;
181
+ }
182
+ case "if":
183
+ out += renderNodes(isTruthy(data[node.condition]) ? node.whenTrue : node.whenFalse, data);
184
+ break;
185
+ }
186
+ }
187
+ return out;
188
+ }
189
+
190
+ /**
191
+ * Renders a metadata template against the provided data.
192
+ *
193
+ * @param template - Template using the supported `{{var}}` / `{{#if}}` subset.
194
+ * @param data - Values referenced by the template.
195
+ * @returns The rendered string.
196
+ */
197
+ export function renderTemplate(template: string, data: TemplateData): string {
198
+ const tokens = tokenize(template);
199
+ stripStandaloneWhitespace(tokens);
200
+ const [nodes] = parse(tokens, 0, []);
201
+ return renderNodes(nodes, data);
202
+ }
@@ -0,0 +1,9 @@
1
+ import { ClientModel } from "../../interfaces.js";
2
+ import { recordedClientContent } from "./template.js";
3
+
4
+ export function buildRecordedClientFile(_model: ClientModel) {
5
+ return {
6
+ path: "test/public/utils/recordedClient.ts",
7
+ content: recordedClientContent,
8
+ };
9
+ }
@@ -0,0 +1,9 @@
1
+ import { ClientModel } from "../../interfaces.js";
2
+ import { sampleTestContent } from "./template.js";
3
+
4
+ export function buildSampleTest(_model: ClientModel) {
5
+ return {
6
+ path: "test/public/sampleTest.spec.ts",
7
+ content: sampleTestContent,
8
+ };
9
+ }
@@ -1,11 +1,9 @@
1
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2
- // @ts-ignore: to fix the handlebars issue
3
- import hbs from "handlebars";
4
- import { getClientName } from "../helpers/name-constructors.js";
5
- import { RLCModel } from "../interfaces.js";
1
+ import { ClientModel } from "../../interfaces.js";
2
+ import { getClientName } from "../../utils/name-constructors.js";
3
+ import { renderTemplate } from "../render-template.js";
6
4
  import { snippetsContent } from "./template.js";
7
5
 
8
- export function buildSnippets(model: RLCModel, clientName?: string) {
6
+ export function buildSnippets(model: ClientModel, clientName?: string) {
9
7
  // to keep the same config for azure scope in buildReadmeFile.ts
10
8
  if (
11
9
  (model?.options?.packageDetails?.scopeName === "azure" ||
@@ -14,7 +12,7 @@ export function buildSnippets(model: RLCModel, clientName?: string) {
14
12
  ) {
15
13
  return {
16
14
  path: "test/snippets.spec.ts",
17
- content: hbs.compile(snippetsContent, { noEscape: true })({
15
+ content: renderTemplate(snippetsContent, {
18
16
  clientClassName: clientName ? clientName : getClientName(model),
19
17
  azureArm: model.options?.azureArm,
20
18
  hasSubscriptionId: model.options.hasSubscriptionId,
@@ -0,0 +1,101 @@
1
+ export const recordedClientContent = `
2
+
3
+ import {
4
+ Recorder,
5
+ RecorderStartOptions,
6
+ VitestTestContext,
7
+ } from "@azure-tools/test-recorder";
8
+
9
+ const replaceableVariables: Record<string, string> = {
10
+ SUBSCRIPTION_ID: "azure_subscription_id"
11
+ };
12
+
13
+ const recorderEnvSetup: RecorderStartOptions = {
14
+ envSetupForPlayback: replaceableVariables,
15
+ };
16
+
17
+ /**
18
+ * creates the recorder and reads the environment variables from the \`.env\` file.
19
+ * Should be called first in the test suite to make sure environment variables are
20
+ * read before they are being used.
21
+ */
22
+ export async function createRecorder(context: VitestTestContext): Promise<Recorder> {
23
+ const recorder = new Recorder(context);
24
+ await recorder.start(recorderEnvSetup);
25
+ return recorder;
26
+ }
27
+ `;
28
+
29
+ export const sampleTestContent = `
30
+ // import { Recorder } from "@azure-tools/test-recorder";
31
+ // import { createRecorder } from "./utils/recordedClient.js";
32
+ import { assert,
33
+ // beforeEach,
34
+ // afterEach,
35
+ it,
36
+ describe
37
+ } from "vitest";
38
+
39
+ describe("My test", () => {
40
+ // let recorder: Recorder;
41
+
42
+ // beforeEach(async function(ctx) {
43
+ // recorder = await createRecorder(ctx);
44
+ // });
45
+
46
+ // afterEach(async function() {
47
+ // await recorder.stop();
48
+ // });
49
+
50
+ it("sample test", async function() {
51
+ assert.equal(1, 1);
52
+ });
53
+ });
54
+ `;
55
+
56
+ export const snippetsContent = `
57
+ import { {{ clientClassName }} } from "../src/index.js";
58
+ import { DefaultAzureCredential, InteractiveBrowserCredential } from "@azure/identity";
59
+ import { setLogLevel } from "@azure/logger";
60
+ import { describe, it } from "vitest";
61
+
62
+ describe("snippets", () => {
63
+ it("ReadmeSampleCreateClient_Node", async () => {
64
+ {{#if azureArm}}
65
+ {{#if hasSubscriptionId}}
66
+ const subscriptionId = "00000000-0000-0000-0000-000000000000";
67
+ const client = new {{ clientClassName }}(new DefaultAzureCredential(), subscriptionId);
68
+ {{else}}
69
+ const client = new {{ clientClassName }}(new DefaultAzureCredential());
70
+ {{/if}}
71
+ {{else}}
72
+ const client = new {{ clientClassName }}("<endpoint>", new DefaultAzureCredential());
73
+ {{/if}}
74
+ });
75
+
76
+ it("ReadmeSampleCreateClient_Browser", async () => {
77
+ {{#if azureArm}}
78
+ const credential = new InteractiveBrowserCredential({
79
+ tenantId: "<YOUR_TENANT_ID>",
80
+ clientId: "<YOUR_CLIENT_ID>",
81
+ });
82
+ {{#if hasSubscriptionId}}
83
+ const subscriptionId = "00000000-0000-0000-0000-000000000000";
84
+ const client = new {{ clientClassName }}(credential, subscriptionId);
85
+ {{else}}
86
+ const client = new {{ clientClassName }}(credential);
87
+ {{/if}}
88
+ {{else}}
89
+ const credential = new InteractiveBrowserCredential({
90
+ tenantId: "<YOUR_TENANT_ID>",
91
+ clientId: "<YOUR_CLIENT_ID>",
92
+ });
93
+ const client = new {{ clientClassName }}("<endpoint>", credential);
94
+ {{/if}}
95
+ });
96
+
97
+ it("SetLogLevel", async () => {
98
+ setLogLevel("info");
99
+ });
100
+ });
101
+ `;
@@ -1,8 +1,8 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
3
 
4
- import { RLCModel } from "../interfaces.js";
4
+ import { ClientModel } from "../interfaces.js";
5
5
 
6
- export function getPackageName(model: RLCModel): string {
6
+ export function getPackageName(model: ClientModel): string {
7
7
  return model.options?.packageDetails?.name ?? model.libraryName;
8
8
  }
@@ -5,8 +5,7 @@ import {
5
5
  SourceFile,
6
6
  StructureKind,
7
7
  } from "ts-morph";
8
- import { NameType, normalizeName } from "../rlc-common/index.js";
9
- import { buildUserAgentOptions, getClientParametersDeclaration } from "./helpers/client-helpers.js";
8
+ import { getClientParametersDeclaration } from "./helpers/client-helpers.js";
10
9
  import { getClassicalClientName, getClientName } from "./helpers/naming-helpers.js";
11
10
  import { ModularEmitterOptions } from "./interfaces.js";
12
11
 
@@ -20,8 +19,9 @@ import { useContext } from "../context-manager.js";
20
19
  import { useDependencies } from "../framework/hooks/use-dependencies.js";
21
20
  import { resolveReference } from "../framework/reference.js";
22
21
  import { refkey } from "../framework/refkey.js";
23
- import { getModularClientOptions, isRLCMultiEndpoint } from "../utils/client-utils.js";
22
+ import { getClientModuleInfo, isMultiEndpointClient } from "../utils/client-utils.js";
24
23
  import { SdkContext } from "../utils/interfaces.js";
24
+ import { NameType, normalizeName } from "../utils/name-utils.js";
25
25
  import { getMethodHierarchiesMap, isTenantLevelOperation } from "../utils/operation-util.js";
26
26
  import { AzurePollingDependencies } from "./external-dependencies.js";
27
27
  import { getPagingLROMethodName } from "./helpers/classical-operation-helpers.js";
@@ -47,7 +47,7 @@ export function buildClassicalClient(
47
47
  requiredOnly: true,
48
48
  });
49
49
  const srcPath = emitterOptions.modularOptions.sourceRoot;
50
- const { subfolder, rlcClientName } = getModularClientOptions(clientMap);
50
+ const { subfolder, clientName } = getClientModuleInfo(clientMap);
51
51
 
52
52
  const clientFile = project.createSourceFile(
53
53
  `${srcPath}/${subfolder && subfolder !== "" ? subfolder + "/" : ""}${normalizeName(
@@ -68,16 +68,16 @@ export function buildClassicalClient(
68
68
  });
69
69
 
70
70
  // Add the private client member. This will be the client context from /api
71
- if (isRLCMultiEndpoint(dpgContext)) {
71
+ if (isMultiEndpointClient(dpgContext)) {
72
72
  clientClass.addProperty({
73
73
  name: "_client",
74
- type: `Client.${rlcClientName}`,
74
+ type: `Client.${clientName}`,
75
75
  scope: Scope.Private,
76
76
  });
77
77
  } else {
78
78
  clientClass.addProperty({
79
79
  name: "_client",
80
- type: `${rlcClientName}`,
80
+ type: `${clientName}`,
81
81
  scope: Scope.Private,
82
82
  });
83
83
  }
@@ -127,11 +127,7 @@ export function buildClassicalClient(
127
127
  .map((p) => p.name)
128
128
  .map((x) => {
129
129
  if (x === "options") {
130
- return `{...options, userAgentOptions: ${buildUserAgentOptions(
131
- constructor,
132
- emitterOptions,
133
- "azsdk-js-client",
134
- )}}`;
130
+ return `options`;
135
131
  } else if (x.toLowerCase() === "subscriptionid" && shouldSubscriptionIdOptional) {
136
132
  return `subscriptionId ?? ""`;
137
133
  } else {
@@ -214,7 +210,7 @@ function generateMethod(
214
210
  });
215
211
 
216
212
  // add LRO helper methods if applicable
217
- if (context.rlcOptions?.compatibilityLro && declaration?.isLro && !declaration?.isLroPaging) {
213
+ if (context.emitterOptions?.compatibilityLro && declaration?.isLro && !declaration?.isLroPaging) {
218
214
  const operationStateReference = resolveReference(AzurePollingDependencies.OperationState);
219
215
  const simplePollerLikeReference = resolveReference(SimplePollerHelpers.SimplePollerLike);
220
216
  const getSimplePollerReference = resolveReference(SimplePollerHelpers.getSimplePoller);
@@ -244,7 +240,7 @@ function generateMethod(
244
240
  statements: `return await ${declarationRefKey}(${methodParamStr});`,
245
241
  });
246
242
  } // For LRO+Paging operations, use different return types and implementation
247
- else if (context.rlcOptions?.compatibilityLro && declaration?.isLroPaging) {
243
+ else if (context.emitterOptions?.compatibilityLro && declaration?.isLroPaging) {
248
244
  const returnType = declaration?.lropagingFinalReturnType ?? "void";
249
245
  const pagedAsyncIterableIteratorReference = resolveReference(
250
246
  PagingHelpers.PagedAsyncIterableIterator,
@@ -274,7 +270,7 @@ function buildClientOperationGroups(
274
270
  ) {
275
271
  let clientType = "Client";
276
272
  const [_hierarchy, client] = clientMap;
277
- const { subfolder } = getModularClientOptions(clientMap);
273
+ const { subfolder } = getClientModuleInfo(clientMap);
278
274
  if (subfolder && subfolder !== "") {
279
275
  clientType = `Client.${clientClass.getName()}`;
280
276
  }
@@ -1,9 +1,9 @@
1
1
  import { SdkClientType, SdkServiceOperation } from "@azure-tools/typespec-client-generator-core";
2
2
  import { SourceFile } from "ts-morph";
3
3
  import { useContext } from "../context-manager.js";
4
- import { NameType } from "../rlc-common/index.js";
5
- import { getModularClientOptions } from "../utils/client-utils.js";
4
+ import { getClientModuleInfo } from "../utils/client-utils.js";
6
5
  import { SdkContext } from "../utils/interfaces.js";
6
+ import { NameType } from "../utils/name-utils.js";
7
7
  import { getMethodHierarchiesMap } from "../utils/operation-util.js";
8
8
  import { getClassicalOperation } from "./helpers/classical-operation-helpers.js";
9
9
  import { getClassicalLayerPrefix } from "./helpers/naming-helpers.js";
@@ -17,7 +17,7 @@ export function buildClassicOperationFiles(
17
17
  // const sdkPackage = dpgContext.sdkPackage;
18
18
  const project = useContext("outputProject");
19
19
  const [_hierarchy, client] = clientMap;
20
- const { subfolder } = getModularClientOptions(clientMap);
20
+ const { subfolder } = getClientModuleInfo(clientMap);
21
21
  const classicOperationFiles: Map<string, SourceFile> = new Map<string, SourceFile>();
22
22
  const methodMap = getMethodHierarchiesMap(dpgContext, client);
23
23
  for (const [prefixKey, operations] of methodMap) {
@@ -1,4 +1,3 @@
1
- import { NameType, normalizeName } from "../rlc-common/index.js";
2
1
  import {
3
2
  buildGetClientCredentialParam,
4
3
  buildGetClientEndpointParam,
@@ -24,8 +23,9 @@ import { useDependencies } from "../framework/hooks/use-dependencies.js";
24
23
  import { resolveReference } from "../framework/reference.js";
25
24
  import { refkey } from "../framework/refkey.js";
26
25
  import { reportDiagnostic } from "../lib.js";
27
- import { getModularClientOptions } from "../utils/client-utils.js";
26
+ import { getClientModuleInfo } from "../utils/client-utils.js";
28
27
  import { SdkContext } from "../utils/interfaces.js";
28
+ import { NameType, normalizeName } from "../utils/name-utils.js";
29
29
  import { buildEnumTypes, getApiVersionEnum } from "./emit-models.js";
30
30
  import { getDocsFromDescription } from "./helpers/docs-helpers.js";
31
31
  import { getClassicalClientName, getClientName } from "./helpers/naming-helpers.js";
@@ -40,7 +40,7 @@ export function getClientContextPath(
40
40
  emitterOptions: ModularEmitterOptions,
41
41
  ): string {
42
42
  const [_, client] = clientMap;
43
- const { subfolder } = getModularClientOptions(clientMap);
43
+ const { subfolder } = getClientModuleInfo(clientMap);
44
44
  const name = getClientName(client);
45
45
  const srcPath = emitterOptions.modularOptions.sourceRoot;
46
46
  const contentPath = `${srcPath}/${
@@ -61,7 +61,7 @@ export function buildClientContext(
61
61
  const dependencies = useDependencies();
62
62
  const [hierarchy, client] = clientMap;
63
63
  const name = getClientName(client);
64
- const { rlcClientName } = getModularClientOptions(clientMap);
64
+ const { clientName } = getClientModuleInfo(clientMap);
65
65
  const requiredParams = getClientParametersDeclaration(client, dpgContext, {
66
66
  onClientOnly: false,
67
67
  requiredOnly: true,
@@ -116,7 +116,7 @@ export function buildClientContext(
116
116
 
117
117
  clientContextFile.addInterface({
118
118
  isExported: true,
119
- name: `${rlcClientName}`,
119
+ name: `${clientName}`,
120
120
  extends: [resolveReference(dependencies.Client)],
121
121
  docs: getDocsFromDescription(client.doc),
122
122
  properties: [...requiredInterfaceProperties, ...optionalInterfaceProperties],
@@ -172,7 +172,7 @@ export function buildClientContext(
172
172
  const factoryFunction = clientContextFile.addFunction({
173
173
  docs: getDocsFromDescription(client.doc),
174
174
  name: `create${name}`,
175
- returnType: `${rlcClientName}`,
175
+ returnType: `${clientName}`,
176
176
  parameters: getClientParametersDeclaration(client, dpgContext, {
177
177
  onClientOnly: false,
178
178
  requiredOnly: true,
@@ -286,7 +286,7 @@ export function buildClientContext(
286
286
 
287
287
  if (allContextParams.length) {
288
288
  factoryFunction.addStatements(
289
- `return { ...clientContext, ${allContextParams.join(", ")}} as ${rlcClientName};`,
289
+ `return { ...clientContext, ${allContextParams.join(", ")}} as ${clientName};`,
290
290
  );
291
291
  } else {
292
292
  factoryFunction.addStatements(`return clientContext;`);
@@ -10,11 +10,11 @@ export function transformModularEmitterOptions(
10
10
  ): ModularEmitterOptions {
11
11
  CASING = options.casing ?? CASING;
12
12
  const emitterOptions: ModularEmitterOptions = {
13
- options: dpgContext.rlcOptions ?? {},
13
+ options: dpgContext.emitterOptions ?? {},
14
14
  modularOptions: {
15
15
  sourceRoot: modularSourcesRoot,
16
- compatibilityMode: !!dpgContext.rlcOptions?.compatibilityMode,
17
- experimentalExtensibleEnums: !!dpgContext.rlcOptions?.experimentalExtensibleEnums,
16
+ compatibilityMode: !!dpgContext.emitterOptions?.compatibilityMode,
17
+ experimentalExtensibleEnums: !!dpgContext.emitterOptions?.experimentalExtensibleEnums,
18
18
  },
19
19
  };
20
20
 
@@ -1,5 +1,4 @@
1
1
  import { InterfaceDeclarationStructure, SourceFile, StructureKind } from "ts-morph";
2
- import { NameType, normalizeName } from "../rlc-common/index.js";
3
2
  import {
4
3
  getDeserializeExceptionHeadersPrivateFunction,
5
4
  getDeserializeHeadersPrivateFunction,
@@ -23,8 +22,9 @@ import { addDeclaration } from "../framework/declaration.js";
23
22
  import { useDependencies } from "../framework/hooks/use-dependencies.js";
24
23
  import { resolveReference } from "../framework/reference.js";
25
24
  import { refkey } from "../framework/refkey.js";
26
- import { getModularClientOptions, isRLCMultiEndpoint } from "../utils/client-utils.js";
25
+ import { getClientModuleInfo, isMultiEndpointClient } from "../utils/client-utils.js";
27
26
  import { SdkContext } from "../utils/interfaces.js";
27
+ import { NameType, normalizeName } from "../utils/name-utils.js";
28
28
  import {
29
29
  getMethodHierarchiesMap,
30
30
  hasDualFormatSupport,
@@ -48,9 +48,9 @@ export function buildOperationFiles(
48
48
  const project = useContext("outputProject");
49
49
  const [_, client] = clientMap;
50
50
  const operationFiles: Set<SourceFile> = new Set();
51
- const { subfolder, rlcClientName } = getModularClientOptions(clientMap);
52
- const isMultiEndpoint = isRLCMultiEndpoint(dpgContext);
53
- const clientType = isMultiEndpoint ? `Client.${rlcClientName}` : "Client";
51
+ const { subfolder, clientName } = getClientModuleInfo(clientMap);
52
+ const isMultiEndpoint = isMultiEndpointClient(dpgContext);
53
+ const clientType = isMultiEndpoint ? `Client.${clientName}` : "Client";
54
54
  const methodMap = getMethodHierarchiesMap(dpgContext, client);
55
55
  for (const [prefixKey, operations] of methodMap) {
56
56
  const prefixes = prefixKey.split("/");
@@ -102,7 +102,7 @@ export function buildOperationFiles(
102
102
 
103
103
  const indexPathPrefix = "../".repeat(prefixKey === "" ? 0 : prefixes.length) || "./";
104
104
  operationGroupFile.addImportDeclaration({
105
- namedImports: [`${rlcClientName} as Client`],
105
+ namedImports: [`${clientName} as Client`],
106
106
  moduleSpecifier: `${indexPathPrefix}index.js`,
107
107
  });
108
108
  operationGroupFile.fixUnusedIdentifiers();
@@ -1,9 +1,8 @@
1
- import { NameType } from "../rlc-common/index.js";
2
-
3
1
  import { getRelativePathFromDirectory, joinPaths } from "@typespec/compiler";
4
2
  import { useContext } from "../context-manager.js";
5
- import { getClientHierarchyMap, getModularClientOptions } from "../utils/client-utils.js";
3
+ import { getClientHierarchyMap, getClientModuleInfo } from "../utils/client-utils.js";
6
4
  import { SdkContext } from "../utils/interfaces.js";
5
+ import { NameType } from "../utils/name-utils.js";
7
6
  import { getMethodHierarchiesMap } from "../utils/operation-util.js";
8
7
  import { getClassicalLayerPrefix } from "./helpers/naming-helpers.js";
9
8
  import { ModularEmitterOptions } from "./interfaces.js";
@@ -42,7 +41,7 @@ function buildExportsForMultiClient(
42
41
  if (hierarchy.length === 0) {
43
42
  hasTopLevelClient = true;
44
43
  }
45
- const { subfolder } = getModularClientOptions([hierarchy, client]);
44
+ const { subfolder } = getClientModuleInfo([hierarchy, client]);
46
45
  if (subfolder !== "" && methodMap.size > 0) {
47
46
  packageInfo.exports[`./${subfolder}`] = `${srcPrefix}/${subfolder}/index.ts`;
48
47
 
@@ -56,7 +55,7 @@ function buildExportsForMultiClient(
56
55
  // TODO: support api subpath exports for multi-service. Skip for now. https://github.com/Azure/autorest.typescript/issues/3717
57
56
  if (!emitterOptions.options.isMultiService) {
58
57
  for (const flattenedClient of clientMap) {
59
- const { subfolder } = getModularClientOptions(flattenedClient);
58
+ const { subfolder } = getClientModuleInfo(flattenedClient);
60
59
  const client = flattenedClient[1];
61
60
  const methodMap = getMethodHierarchiesMap(context, client);
62
61
  for (const [prefixKey, _] of methodMap) {
@@ -4,9 +4,9 @@ import { SourceFile } from "ts-morph";
4
4
  import { useContext } from "../context-manager.js";
5
5
  import { useDependencies } from "../framework/hooks/use-dependencies.js";
6
6
  import { resolveReference } from "../framework/reference.js";
7
- import { NameType, normalizeName } from "../rlc-common/index.js";
8
- import { getModularClientOptions } from "../utils/client-utils.js";
7
+ import { getClientModuleInfo } from "../utils/client-utils.js";
9
8
  import { SdkContext } from "../utils/interfaces.js";
9
+ import { NameType, normalizeName } from "../utils/name-utils.js";
10
10
  import { getMethodHierarchiesMap } from "../utils/operation-util.js";
11
11
  import { buildLroDeserDetailMap } from "./build-operations.js";
12
12
  import { AzurePollingDependencies } from "./external-dependencies.js";
@@ -23,7 +23,7 @@ export function buildRestorePoller(
23
23
  const project = useContext("outputProject");
24
24
  const [_, client] = clientMap;
25
25
  const dependencies = useDependencies();
26
- const { subfolder } = getModularClientOptions(clientMap);
26
+ const { subfolder } = getClientModuleInfo(clientMap);
27
27
  const methodMap = getMethodHierarchiesMap(context, client);
28
28
  const hasLro = Array.from(methodMap.values()).some((operations) => {
29
29
  return operations.some(isLroOnlyOperation);