@azure-tools/typespec-ts 0.54.2 → 0.55.0-dev.10

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 (345) hide show
  1. package/CHANGELOG.md +0 -9
  2. package/README.md +68 -105
  3. package/dist/src/framework/hooks/binder.d.ts +1 -1
  4. package/dist/src/framework/hooks/binder.d.ts.map +1 -1
  5. package/dist/src/framework/hooks/binder.js +3 -4
  6. package/dist/src/framework/hooks/binder.js.map +1 -1
  7. package/dist/src/framework/hooks/sdk-types.d.ts +2 -3
  8. package/dist/src/framework/hooks/sdk-types.d.ts.map +1 -1
  9. package/dist/src/framework/hooks/sdk-types.js +2 -3
  10. package/dist/src/framework/hooks/sdk-types.js.map +1 -1
  11. package/dist/src/framework/load-static-helpers.d.ts +4 -1
  12. package/dist/src/framework/load-static-helpers.d.ts.map +1 -1
  13. package/dist/src/framework/load-static-helpers.js +26 -34
  14. package/dist/src/framework/load-static-helpers.js.map +1 -1
  15. package/dist/src/framework/sample.js +1 -1
  16. package/dist/src/framework/sample.js.map +1 -1
  17. package/dist/src/index.d.ts.map +1 -1
  18. package/dist/src/index.js +104 -170
  19. package/dist/src/index.js.map +1 -1
  20. package/dist/src/lib.d.ts +2 -18
  21. package/dist/src/lib.d.ts.map +1 -1
  22. package/dist/src/lib.js +30 -124
  23. package/dist/src/lib.js.map +1 -1
  24. package/dist/src/modular/build-classical-client.js +2 -2
  25. package/dist/src/modular/build-classical-client.js.map +1 -1
  26. package/dist/src/modular/build-client-context.d.ts.map +1 -1
  27. package/dist/src/modular/build-client-context.js +6 -15
  28. package/dist/src/modular/build-client-context.js.map +1 -1
  29. package/dist/src/modular/build-project-files.d.ts.map +1 -1
  30. package/dist/src/modular/build-project-files.js +4 -4
  31. package/dist/src/modular/build-project-files.js.map +1 -1
  32. package/dist/src/modular/build-restore-poller.js +2 -2
  33. package/dist/src/modular/build-restore-poller.js.map +1 -1
  34. package/dist/src/modular/build-root-index.d.ts.map +1 -1
  35. package/dist/src/modular/build-root-index.js +9 -13
  36. package/dist/src/modular/build-root-index.js.map +1 -1
  37. package/dist/src/modular/build-subpath-index.d.ts.map +1 -1
  38. package/dist/src/modular/build-subpath-index.js +4 -4
  39. package/dist/src/modular/build-subpath-index.js.map +1 -1
  40. package/dist/src/modular/emit-logger-file.d.ts.map +1 -1
  41. package/dist/src/modular/emit-logger-file.js +0 -3
  42. package/dist/src/modular/emit-logger-file.js.map +1 -1
  43. package/dist/src/modular/emit-models-options.js +2 -2
  44. package/dist/src/modular/emit-models-options.js.map +1 -1
  45. package/dist/src/modular/emit-models.d.ts.map +1 -1
  46. package/dist/src/modular/emit-models.js +7 -22
  47. package/dist/src/modular/emit-models.js.map +1 -1
  48. package/dist/src/modular/emit-samples.d.ts.map +1 -1
  49. package/dist/src/modular/emit-samples.js +10 -28
  50. package/dist/src/modular/emit-samples.js.map +1 -1
  51. package/dist/src/modular/emit-tests.d.ts +2 -1
  52. package/dist/src/modular/emit-tests.d.ts.map +1 -1
  53. package/dist/src/modular/emit-tests.js +21 -11
  54. package/dist/src/modular/emit-tests.js.map +1 -1
  55. package/dist/src/modular/helpers/client-helpers.d.ts.map +1 -1
  56. package/dist/src/modular/helpers/client-helpers.js +6 -16
  57. package/dist/src/modular/helpers/client-helpers.js.map +1 -1
  58. package/dist/src/modular/helpers/example-value-helpers.d.ts +1 -1
  59. package/dist/src/modular/helpers/example-value-helpers.d.ts.map +1 -1
  60. package/dist/src/modular/helpers/example-value-helpers.js +11 -28
  61. package/dist/src/modular/helpers/example-value-helpers.js.map +1 -1
  62. package/dist/src/modular/serialization/serialize-utils.js +2 -2
  63. package/dist/src/modular/serialization/serialize-utils.js.map +1 -1
  64. package/dist/src/rlc-common/helpers/imports-util.d.ts +3 -4
  65. package/dist/src/rlc-common/helpers/imports-util.d.ts.map +1 -1
  66. package/dist/src/rlc-common/helpers/imports-util.js +43 -56
  67. package/dist/src/rlc-common/helpers/imports-util.js.map +1 -1
  68. package/dist/src/rlc-common/helpers/name-constructors.d.ts +0 -9
  69. package/dist/src/rlc-common/helpers/name-constructors.d.ts.map +1 -1
  70. package/dist/src/rlc-common/helpers/name-constructors.js +1 -17
  71. package/dist/src/rlc-common/helpers/name-constructors.js.map +1 -1
  72. package/dist/src/rlc-common/index.d.ts +0 -18
  73. package/dist/src/rlc-common/index.d.ts.map +1 -1
  74. package/dist/src/rlc-common/index.js +0 -18
  75. package/dist/src/rlc-common/index.js.map +1 -1
  76. package/dist/src/rlc-common/interfaces.d.ts +2 -20
  77. package/dist/src/rlc-common/interfaces.d.ts.map +1 -1
  78. package/dist/src/rlc-common/interfaces.js.map +1 -1
  79. package/dist/src/rlc-common/metadata/build-api-extractor-config.d.ts +1 -1
  80. package/dist/src/rlc-common/metadata/build-api-extractor-config.d.ts.map +1 -1
  81. package/dist/src/rlc-common/metadata/build-api-extractor-config.js +5 -42
  82. package/dist/src/rlc-common/metadata/build-api-extractor-config.js.map +1 -1
  83. package/dist/src/rlc-common/metadata/build-es-lint-config.d.ts +2 -2
  84. package/dist/src/rlc-common/metadata/build-es-lint-config.d.ts.map +1 -1
  85. package/dist/src/rlc-common/metadata/build-es-lint-config.js +3 -41
  86. package/dist/src/rlc-common/metadata/build-es-lint-config.js.map +1 -1
  87. package/dist/src/rlc-common/metadata/build-package-file.d.ts.map +1 -1
  88. package/dist/src/rlc-common/metadata/build-package-file.js +25 -73
  89. package/dist/src/rlc-common/metadata/build-package-file.js.map +1 -1
  90. package/dist/src/rlc-common/metadata/build-readme-file.d.ts +2 -2
  91. package/dist/src/rlc-common/metadata/build-readme-file.d.ts.map +1 -1
  92. package/dist/src/rlc-common/metadata/build-readme-file.js +18 -108
  93. package/dist/src/rlc-common/metadata/build-readme-file.js.map +1 -1
  94. package/dist/src/rlc-common/metadata/build-sample-env-file.d.ts.map +1 -1
  95. package/dist/src/rlc-common/metadata/build-sample-env-file.js +1 -2
  96. package/dist/src/rlc-common/metadata/build-sample-env-file.js.map +1 -1
  97. package/dist/src/rlc-common/metadata/build-test-config.d.ts.map +1 -1
  98. package/dist/src/rlc-common/metadata/build-test-config.js +1 -4
  99. package/dist/src/rlc-common/metadata/build-test-config.js.map +1 -1
  100. package/dist/src/rlc-common/metadata/build-ts-config.d.ts +2 -2
  101. package/dist/src/rlc-common/metadata/build-ts-config.d.ts.map +1 -1
  102. package/dist/src/rlc-common/metadata/build-ts-config.js +19 -60
  103. package/dist/src/rlc-common/metadata/build-ts-config.js.map +1 -1
  104. package/dist/src/rlc-common/metadata/build-warp-config.d.ts +1 -1
  105. package/dist/src/rlc-common/metadata/build-warp-config.d.ts.map +1 -1
  106. package/dist/src/rlc-common/metadata/build-warp-config.js +0 -3
  107. package/dist/src/rlc-common/metadata/build-warp-config.js.map +1 -1
  108. package/dist/src/rlc-common/metadata/package-json/azure-package-common.d.ts +1 -38
  109. package/dist/src/rlc-common/metadata/package-json/azure-package-common.d.ts.map +1 -1
  110. package/dist/src/rlc-common/metadata/package-json/azure-package-common.js +1 -108
  111. package/dist/src/rlc-common/metadata/package-json/azure-package-common.js.map +1 -1
  112. package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.d.ts +0 -39
  113. package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.d.ts.map +1 -1
  114. package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.js +4 -20
  115. package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.js.map +1 -1
  116. package/dist/src/rlc-common/metadata/package-json/package-common.d.ts +1 -22
  117. package/dist/src/rlc-common/metadata/package-json/package-common.d.ts.map +1 -1
  118. package/dist/src/rlc-common/metadata/package-json/package-common.js +21 -98
  119. package/dist/src/rlc-common/metadata/package-json/package-common.js.map +1 -1
  120. package/dist/src/rlc-common/static/polling-content.d.ts +1 -1
  121. package/dist/src/rlc-common/static/polling-content.d.ts.map +1 -1
  122. package/dist/src/rlc-common/static/polling-content.js +1 -1
  123. package/dist/src/rlc-common/test/build-recorded-client.d.ts +1 -1
  124. package/dist/src/rlc-common/test/build-recorded-client.d.ts.map +1 -1
  125. package/dist/src/rlc-common/test/build-recorded-client.js +2 -5
  126. package/dist/src/rlc-common/test/build-recorded-client.js.map +1 -1
  127. package/dist/src/rlc-common/test/build-sample-test.d.ts +1 -1
  128. package/dist/src/rlc-common/test/build-sample-test.d.ts.map +1 -1
  129. package/dist/src/rlc-common/test/build-sample-test.js +2 -5
  130. package/dist/src/rlc-common/test/build-sample-test.js.map +1 -1
  131. package/dist/src/rlc-common/test/build-snippets.d.ts +1 -1
  132. package/dist/src/rlc-common/test/build-snippets.d.ts.map +1 -1
  133. package/dist/src/rlc-common/test/build-snippets.js +2 -6
  134. package/dist/src/rlc-common/test/build-snippets.js.map +1 -1
  135. package/dist/src/rlc-common/test/template.d.ts +3 -3
  136. package/dist/src/rlc-common/test/template.d.ts.map +1 -1
  137. package/dist/src/rlc-common/test/template.js +1 -35
  138. package/dist/src/rlc-common/test/template.js.map +1 -1
  139. package/dist/src/transform/transform-helper-function-details.d.ts +2 -2
  140. package/dist/src/transform/transform-helper-function-details.d.ts.map +1 -1
  141. package/dist/src/transform/transform-helper-function-details.js +1 -9
  142. package/dist/src/transform/transform-helper-function-details.js.map +1 -1
  143. package/dist/src/transform/transform-schemas.js +1 -1
  144. package/dist/src/transform/transform-schemas.js.map +1 -1
  145. package/dist/src/transform/transform.d.ts.map +1 -1
  146. package/dist/src/transform/transform.js +9 -16
  147. package/dist/src/transform/transform.js.map +1 -1
  148. package/dist/src/transform/transfrom-rlc-options.d.ts +2 -2
  149. package/dist/src/transform/transfrom-rlc-options.d.ts.map +1 -1
  150. package/dist/src/transform/transfrom-rlc-options.js +29 -94
  151. package/dist/src/transform/transfrom-rlc-options.js.map +1 -1
  152. package/dist/src/utils/client-utils.d.ts +1 -1
  153. package/dist/src/utils/client-utils.d.ts.map +1 -1
  154. package/dist/src/utils/client-utils.js +4 -5
  155. package/dist/src/utils/client-utils.js.map +1 -1
  156. package/dist/src/utils/emit-util.d.ts +0 -1
  157. package/dist/src/utils/emit-util.d.ts.map +1 -1
  158. package/dist/src/utils/emit-util.js +13 -24
  159. package/dist/src/utils/emit-util.js.map +1 -1
  160. package/dist/src/utils/file-system-utils.d.ts +4 -4
  161. package/dist/src/utils/file-system-utils.d.ts.map +1 -1
  162. package/dist/src/utils/file-system-utils.js +14 -16
  163. package/dist/src/utils/file-system-utils.js.map +1 -1
  164. package/dist/src/utils/import-helper.js +3 -3
  165. package/dist/src/utils/import-helper.js.map +1 -1
  166. package/dist/src/utils/model-utils.d.ts +1 -1
  167. package/dist/src/utils/model-utils.d.ts.map +1 -1
  168. package/dist/src/utils/model-utils.js +4 -11
  169. package/dist/src/utils/model-utils.js.map +1 -1
  170. package/dist/src/utils/resolve-project-root.d.ts +6 -4
  171. package/dist/src/utils/resolve-project-root.d.ts.map +1 -1
  172. package/dist/src/utils/resolve-project-root.js +11 -18
  173. package/dist/src/utils/resolve-project-root.js.map +1 -1
  174. package/dist/tsconfig.tsbuildinfo +1 -1
  175. package/package.json +44 -59
  176. package/src/framework/hooks/binder.ts +4 -5
  177. package/src/framework/hooks/sdk-types.ts +2 -3
  178. package/src/framework/load-static-helpers.ts +38 -41
  179. package/src/framework/sample.ts +1 -1
  180. package/src/index.ts +126 -204
  181. package/src/lib.ts +32 -143
  182. package/src/modular/build-classical-client.ts +2 -2
  183. package/src/modular/build-client-context.ts +6 -14
  184. package/src/modular/build-project-files.ts +11 -4
  185. package/src/modular/build-restore-poller.ts +2 -2
  186. package/src/modular/build-root-index.ts +9 -13
  187. package/src/modular/build-subpath-index.ts +4 -4
  188. package/src/modular/emit-logger-file.ts +0 -3
  189. package/src/modular/emit-models-options.ts +2 -2
  190. package/src/modular/emit-models.ts +7 -23
  191. package/src/modular/emit-samples.ts +10 -26
  192. package/src/modular/emit-tests.ts +28 -11
  193. package/src/modular/helpers/client-helpers.ts +7 -17
  194. package/src/modular/helpers/example-value-helpers.ts +11 -26
  195. package/src/modular/serialization/serialize-utils.ts +2 -2
  196. package/src/rlc-common/helpers/imports-util.ts +44 -56
  197. package/src/rlc-common/helpers/name-constructors.ts +1 -23
  198. package/src/rlc-common/index.ts +0 -18
  199. package/src/rlc-common/interfaces.ts +2 -23
  200. package/src/rlc-common/metadata/build-api-extractor-config.ts +5 -47
  201. package/src/rlc-common/metadata/build-es-lint-config.ts +3 -42
  202. package/src/rlc-common/metadata/build-package-file.ts +24 -86
  203. package/src/rlc-common/metadata/build-readme-file.ts +19 -121
  204. package/src/rlc-common/metadata/build-sample-env-file.ts +1 -4
  205. package/src/rlc-common/metadata/build-test-config.ts +1 -6
  206. package/src/rlc-common/metadata/build-ts-config.ts +30 -72
  207. package/src/rlc-common/metadata/build-warp-config.ts +0 -4
  208. package/src/rlc-common/metadata/package-json/azure-package-common.ts +2 -134
  209. package/src/rlc-common/metadata/package-json/build-azure-monorepo-package.ts +4 -24
  210. package/src/rlc-common/metadata/package-json/package-common.ts +22 -120
  211. package/src/rlc-common/static/polling-content.ts +1 -1
  212. package/src/rlc-common/test/build-recorded-client.ts +2 -5
  213. package/src/rlc-common/test/build-sample-test.ts +2 -5
  214. package/src/rlc-common/test/build-snippets.ts +2 -6
  215. package/src/rlc-common/test/template.ts +1 -35
  216. package/src/transform/transform-helper-function-details.ts +1 -10
  217. package/src/transform/transform-schemas.ts +1 -1
  218. package/src/transform/transform.ts +8 -19
  219. package/src/transform/transfrom-rlc-options.ts +29 -127
  220. package/src/utils/client-utils.ts +4 -5
  221. package/src/utils/emit-util.ts +14 -39
  222. package/src/utils/file-system-utils.ts +14 -15
  223. package/src/utils/import-helper.ts +3 -3
  224. package/src/utils/model-utils.ts +4 -17
  225. package/src/utils/resolve-project-root.ts +11 -24
  226. package/dist/src/rlc-common/build-client-definitions.d.ts +0 -6
  227. package/dist/src/rlc-common/build-client-definitions.d.ts.map +0 -1
  228. package/dist/src/rlc-common/build-client-definitions.js +0 -157
  229. package/dist/src/rlc-common/build-client-definitions.js.map +0 -1
  230. package/dist/src/rlc-common/build-client.d.ts +0 -9
  231. package/dist/src/rlc-common/build-client.d.ts.map +0 -1
  232. package/dist/src/rlc-common/build-client.js +0 -391
  233. package/dist/src/rlc-common/build-client.js.map +0 -1
  234. package/dist/src/rlc-common/build-index-file.d.ts +0 -6
  235. package/dist/src/rlc-common/build-index-file.d.ts.map +0 -1
  236. package/dist/src/rlc-common/build-index-file.js +0 -241
  237. package/dist/src/rlc-common/build-index-file.js.map +0 -1
  238. package/dist/src/rlc-common/build-is-unexpected-helper.d.ts +0 -6
  239. package/dist/src/rlc-common/build-is-unexpected-helper.d.ts.map +0 -1
  240. package/dist/src/rlc-common/build-is-unexpected-helper.js +0 -223
  241. package/dist/src/rlc-common/build-is-unexpected-helper.js.map +0 -1
  242. package/dist/src/rlc-common/build-logger.d.ts +0 -6
  243. package/dist/src/rlc-common/build-logger.d.ts.map +0 -1
  244. package/dist/src/rlc-common/build-logger.js +0 -31
  245. package/dist/src/rlc-common/build-logger.js.map +0 -1
  246. package/dist/src/rlc-common/build-method-shortcuts.d.ts +0 -5
  247. package/dist/src/rlc-common/build-method-shortcuts.d.ts.map +0 -1
  248. package/dist/src/rlc-common/build-method-shortcuts.js +0 -54
  249. package/dist/src/rlc-common/build-method-shortcuts.js.map +0 -1
  250. package/dist/src/rlc-common/build-object-types.d.ts +0 -29
  251. package/dist/src/rlc-common/build-object-types.d.ts.map +0 -1
  252. package/dist/src/rlc-common/build-object-types.js +0 -412
  253. package/dist/src/rlc-common/build-object-types.js.map +0 -1
  254. package/dist/src/rlc-common/build-paginate-helper.d.ts +0 -6
  255. package/dist/src/rlc-common/build-paginate-helper.d.ts.map +0 -1
  256. package/dist/src/rlc-common/build-paginate-helper.js +0 -27
  257. package/dist/src/rlc-common/build-paginate-helper.js.map +0 -1
  258. package/dist/src/rlc-common/build-parameter-types.d.ts +0 -14
  259. package/dist/src/rlc-common/build-parameter-types.d.ts.map +0 -1
  260. package/dist/src/rlc-common/build-parameter-types.js +0 -391
  261. package/dist/src/rlc-common/build-parameter-types.js.map +0 -1
  262. package/dist/src/rlc-common/build-polling-helper.d.ts +0 -6
  263. package/dist/src/rlc-common/build-polling-helper.d.ts.map +0 -1
  264. package/dist/src/rlc-common/build-polling-helper.js +0 -61
  265. package/dist/src/rlc-common/build-polling-helper.js.map +0 -1
  266. package/dist/src/rlc-common/build-response-types.d.ts +0 -6
  267. package/dist/src/rlc-common/build-response-types.d.ts.map +0 -1
  268. package/dist/src/rlc-common/build-response-types.js +0 -143
  269. package/dist/src/rlc-common/build-response-types.js.map +0 -1
  270. package/dist/src/rlc-common/build-samples.d.ts +0 -3
  271. package/dist/src/rlc-common/build-samples.d.ts.map +0 -1
  272. package/dist/src/rlc-common/build-samples.js +0 -30
  273. package/dist/src/rlc-common/build-samples.js.map +0 -1
  274. package/dist/src/rlc-common/build-schema-type.d.ts +0 -20
  275. package/dist/src/rlc-common/build-schema-type.d.ts.map +0 -1
  276. package/dist/src/rlc-common/build-schema-type.js +0 -71
  277. package/dist/src/rlc-common/build-schema-type.js.map +0 -1
  278. package/dist/src/rlc-common/build-serialize-helper.d.ts +0 -6
  279. package/dist/src/rlc-common/build-serialize-helper.d.ts.map +0 -1
  280. package/dist/src/rlc-common/build-serialize-helper.js +0 -36
  281. package/dist/src/rlc-common/build-serialize-helper.js.map +0 -1
  282. package/dist/src/rlc-common/build-top-level-index-file.d.ts +0 -6
  283. package/dist/src/rlc-common/build-top-level-index-file.d.ts.map +0 -1
  284. package/dist/src/rlc-common/build-top-level-index-file.js +0 -48
  285. package/dist/src/rlc-common/build-top-level-index-file.js.map +0 -1
  286. package/dist/src/rlc-common/helpers/package-util.d.ts +0 -7
  287. package/dist/src/rlc-common/helpers/package-util.d.ts.map +0 -1
  288. package/dist/src/rlc-common/helpers/package-util.js +0 -10
  289. package/dist/src/rlc-common/helpers/package-util.js.map +0 -1
  290. package/dist/src/rlc-common/helpers/path-utils.d.ts +0 -2
  291. package/dist/src/rlc-common/helpers/path-utils.d.ts.map +0 -1
  292. package/dist/src/rlc-common/helpers/path-utils.js +0 -10
  293. package/dist/src/rlc-common/helpers/path-utils.js.map +0 -1
  294. package/dist/src/rlc-common/helpers/shortcut-methods.d.ts +0 -4
  295. package/dist/src/rlc-common/helpers/shortcut-methods.d.ts.map +0 -1
  296. package/dist/src/rlc-common/helpers/shortcut-methods.js +0 -49
  297. package/dist/src/rlc-common/helpers/shortcut-methods.js.map +0 -1
  298. package/dist/src/rlc-common/helpers/value-generation-util.d.ts +0 -12
  299. package/dist/src/rlc-common/helpers/value-generation-util.d.ts.map +0 -1
  300. package/dist/src/rlc-common/helpers/value-generation-util.js +0 -161
  301. package/dist/src/rlc-common/helpers/value-generation-util.js.map +0 -1
  302. package/dist/src/rlc-common/metadata/build-rollup-config.d.ts +0 -6
  303. package/dist/src/rlc-common/metadata/build-rollup-config.d.ts.map +0 -1
  304. package/dist/src/rlc-common/metadata/build-rollup-config.js +0 -140
  305. package/dist/src/rlc-common/metadata/build-rollup-config.js.map +0 -1
  306. package/dist/src/rlc-common/metadata/package-json/build-azure-standalone-package.d.ts +0 -8
  307. package/dist/src/rlc-common/metadata/package-json/build-azure-standalone-package.d.ts.map +0 -1
  308. package/dist/src/rlc-common/metadata/package-json/build-azure-standalone-package.js +0 -101
  309. package/dist/src/rlc-common/metadata/package-json/build-azure-standalone-package.js.map +0 -1
  310. package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.d.ts +0 -57
  311. package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.d.ts.map +0 -1
  312. package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.js +0 -53
  313. package/dist/src/rlc-common/metadata/package-json/build-flavorless-package.js.map +0 -1
  314. package/dist/src/rlc-common/transform-sample-groups.d.ts +0 -9
  315. package/dist/src/rlc-common/transform-sample-groups.d.ts.map +0 -1
  316. package/dist/src/rlc-common/transform-sample-groups.js +0 -313
  317. package/dist/src/rlc-common/transform-sample-groups.js.map +0 -1
  318. package/dist/src/utils/dirname.d.ts +0 -9
  319. package/dist/src/utils/dirname.d.ts.map +0 -1
  320. package/dist/src/utils/dirname.js +0 -12
  321. package/dist/src/utils/dirname.js.map +0 -1
  322. package/src/rlc-common/build-client-definitions.ts +0 -235
  323. package/src/rlc-common/build-client.ts +0 -490
  324. package/src/rlc-common/build-index-file.ts +0 -344
  325. package/src/rlc-common/build-is-unexpected-helper.ts +0 -248
  326. package/src/rlc-common/build-logger.ts +0 -43
  327. package/src/rlc-common/build-method-shortcuts.ts +0 -71
  328. package/src/rlc-common/build-object-types.ts +0 -603
  329. package/src/rlc-common/build-paginate-helper.ts +0 -31
  330. package/src/rlc-common/build-parameter-types.ts +0 -554
  331. package/src/rlc-common/build-polling-helper.ts +0 -83
  332. package/src/rlc-common/build-response-types.ts +0 -180
  333. package/src/rlc-common/build-samples.ts +0 -32
  334. package/src/rlc-common/build-schema-type.ts +0 -89
  335. package/src/rlc-common/build-serialize-helper.ts +0 -49
  336. package/src/rlc-common/build-top-level-index-file.ts +0 -58
  337. package/src/rlc-common/helpers/package-util.ts +0 -13
  338. package/src/rlc-common/helpers/path-utils.ts +0 -10
  339. package/src/rlc-common/helpers/shortcut-methods.ts +0 -58
  340. package/src/rlc-common/helpers/value-generation-util.ts +0 -234
  341. package/src/rlc-common/metadata/build-rollup-config.ts +0 -147
  342. package/src/rlc-common/metadata/package-json/build-azure-standalone-package.ts +0 -123
  343. package/src/rlc-common/metadata/package-json/build-flavorless-package.ts +0 -68
  344. package/src/rlc-common/transform-sample-groups.ts +0 -407
  345. package/src/utils/dirname.ts +0 -12
@@ -1,554 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
-
4
- import * as path from "path";
5
- import {
6
- InterfaceDeclarationStructure,
7
- Project,
8
- PropertySignatureStructure,
9
- SourceFile,
10
- StructureKind,
11
- } from "ts-morph";
12
- import { getObjectInterfaceDeclaration } from "./build-object-types.js";
13
- import { getImportSpecifier } from "./helpers/imports-util.js";
14
- import {
15
- getImportModuleName,
16
- getParameterBaseName,
17
- getParameterTypeName,
18
- } from "./helpers/name-constructors.js";
19
- import { getGeneratedWrapperTypes } from "./helpers/operation-helpers.js";
20
- import {
21
- ObjectSchema,
22
- ParameterMetadata,
23
- ParameterMetadatas,
24
- RLCModel,
25
- Schema,
26
- SchemaContext,
27
- } from "./interfaces.js";
28
-
29
- export function buildParameterTypes(model: RLCModel) {
30
- const project = new Project();
31
- const srcPath = model.srcPath;
32
- const filePath = path.join(srcPath, `parameters.ts`);
33
- const partialBodyTypeNames = new Set<string>();
34
- const parametersFile = project.createSourceFile(filePath, undefined, {
35
- overwrite: true,
36
- });
37
- let hasHeaders = false;
38
-
39
- if (!model.parameters) {
40
- return;
41
- }
42
- for (const requestParameter of model.parameters) {
43
- const baseParameterName = getParameterBaseName(
44
- requestParameter.operationGroup,
45
- requestParameter.operationName,
46
- );
47
- const requestCount = requestParameter?.parameters?.length ?? 0;
48
- const topParamName = getParameterTypeName(baseParameterName);
49
- const subParamNames: string[] = [];
50
-
51
- // We need to loop the requests. An operation with multiple requests means that
52
- // the operation can get different values for content-type and each value may
53
- // have a different type associated to it.
54
- for (let i = 0; i < requestCount; i++) {
55
- const parameter = requestParameter.parameters[i];
56
- if (!parameter) {
57
- continue;
58
- }
59
- const internalReferences = new Set<string>();
60
- // In case we have more than one request to model we need to add a suffix to differentiate
61
- const nameSuffix = i > 0 ? `${i}` : "";
62
- const parameterInterfaceName =
63
- requestCount > 1 ? `${baseParameterName}RequestParameters${nameSuffix}` : topParamName;
64
- const queryParameterDefinitions = buildQueryParameterDefinition(
65
- model,
66
- parameter,
67
- baseParameterName,
68
- internalReferences,
69
- i,
70
- );
71
- const pathParameterDefinitions = buildPathParameterDefinitions(
72
- model,
73
- parameter,
74
- baseParameterName,
75
- parametersFile,
76
- internalReferences,
77
- i,
78
- );
79
-
80
- const headerParameterDefinitions = buildHeaderParameterDefinitions(
81
- parameter,
82
- baseParameterName,
83
- parametersFile,
84
- internalReferences,
85
- i,
86
- );
87
-
88
- const contentTypeParameterDefinition = buildContentTypeParametersDefinition(
89
- parameter,
90
- baseParameterName,
91
- internalReferences,
92
- i,
93
- );
94
-
95
- const bodyParameterDefinition = buildBodyParametersDefinition(
96
- parameter,
97
- baseParameterName,
98
- internalReferences,
99
- i,
100
- );
101
-
102
- const bodyTypeAlias = buildBodyTypeAlias(parameter, partialBodyTypeNames);
103
- if (bodyTypeAlias) {
104
- parametersFile.addTypeAlias(bodyTypeAlias);
105
- }
106
-
107
- // Add interfaces for body and query parameters
108
- parametersFile.addInterfaces([
109
- ...(bodyParameterDefinition ?? []),
110
- ...(queryParameterDefinitions ?? []),
111
- ...(pathParameterDefinitions ?? []),
112
- ...(headerParameterDefinitions ? [headerParameterDefinitions] : []),
113
- ...(contentTypeParameterDefinition ? [contentTypeParameterDefinition] : []),
114
- ]);
115
-
116
- // Add Operation parameters type alias which is composed of the types we generated above
117
- // plus the common type RequestParameters
118
- parametersFile.addTypeAlias({
119
- name: parameterInterfaceName,
120
- isExported: true,
121
- type: [...internalReferences, "RequestParameters"].join(" & "),
122
- });
123
-
124
- subParamNames.push(parameterInterfaceName);
125
-
126
- if (headerParameterDefinitions !== undefined) {
127
- hasHeaders = true;
128
- }
129
- }
130
- // Add Operation parameters type alias which is composed of the types we generated above
131
- // plus the common type RequestParameters
132
- if (requestCount > 1) {
133
- parametersFile.addTypeAlias({
134
- name: topParamName,
135
- isExported: true,
136
- type: [...subParamNames].join(" | "),
137
- });
138
- }
139
- }
140
-
141
- if (hasHeaders) {
142
- parametersFile.addImportDeclarations([
143
- {
144
- isTypeOnly: true,
145
- namedImports: ["RawHttpHeadersInput"],
146
- moduleSpecifier: getImportSpecifier("restPipeline", model.importInfo.runtimeImports),
147
- },
148
- ]);
149
- }
150
- parametersFile.addImportDeclarations([
151
- {
152
- isTypeOnly: true,
153
- namedImports: ["RequestParameters"],
154
- moduleSpecifier: getImportSpecifier("restClient", model.importInfo.runtimeImports),
155
- },
156
- ]);
157
- if ((model.importInfo.internalImports?.parameter?.importsSet?.size ?? 0) > 0) {
158
- parametersFile.addImportDeclarations([
159
- {
160
- isTypeOnly: true,
161
- namedImports: Array.from(model.importInfo.internalImports.parameter.importsSet!),
162
- moduleSpecifier: getImportModuleName(
163
- {
164
- cjsName: `./models`,
165
- esModulesName: `./models.js`,
166
- },
167
- model,
168
- ),
169
- },
170
- ]);
171
- }
172
- // Add NodeReadableStream import if binary types are used in parameters.
173
- // platform-types.ts is generated directly under src/ (no static-helpers/
174
- // subdirectory) to match the RLC design where all output lives in src/.
175
- // The platform-types static helper resolves NodeReadableStream to
176
- // NodeJS.ReadableStream on Node and `never` on browser/react-native, so the
177
- // union arm drops out naturally in non-Node builds.
178
- if (parametersFile.getFullText().includes("NodeReadableStream")) {
179
- const platformTypesModuleSpecifier = model.options?.azureSdkForJs
180
- ? "#platform/platform-types"
181
- : getImportModuleName(
182
- {
183
- cjsName: `./platform-types`,
184
- esModulesName: `./platform-types.js`,
185
- },
186
- model,
187
- );
188
- parametersFile.addImportDeclarations([
189
- {
190
- isTypeOnly: true,
191
- namedImports: ["NodeReadableStream"],
192
- moduleSpecifier: platformTypesModuleSpecifier,
193
- },
194
- ]);
195
- }
196
- return { path: filePath, content: parametersFile.getFullText() };
197
- }
198
-
199
- function buildQueryParameterDefinition(
200
- model: RLCModel,
201
- parameters: ParameterMetadatas,
202
- baseName: string,
203
- internalReferences: Set<string>,
204
- requestIndex: number,
205
- ): InterfaceDeclarationStructure[] | undefined {
206
- const queryParameters = (parameters?.parameters || []).filter((p) => p.type === "query");
207
-
208
- if (!queryParameters.length) {
209
- return undefined;
210
- }
211
-
212
- const nameSuffix = requestIndex > 0 ? `${requestIndex}` : "";
213
- const queryParameterInterfaceName = `${baseName}QueryParam${nameSuffix}`;
214
- const queryParameterPropertiesName = `${baseName}QueryParamProperties`;
215
-
216
- // Get the property signature for each query parameter
217
- const propertiesDefinition = queryParameters.map((qp) => getPropertyFromSchema(qp.param));
218
- // Get wrapper types for query parameters
219
- const wrapperTypesDefinition = getGeneratedWrapperTypes(queryParameters).map((wrapObj) => {
220
- return getObjectInterfaceDeclaration(
221
- model,
222
- wrapObj.name,
223
- wrapObj,
224
- [SchemaContext.Input],
225
- new Set<string>(),
226
- );
227
- });
228
-
229
- const hasRequiredParameters = propertiesDefinition.some((p) => !p.hasQuestionToken);
230
-
231
- const propertiesInterface: InterfaceDeclarationStructure = {
232
- kind: StructureKind.Interface,
233
- isExported: true,
234
- name: queryParameterPropertiesName,
235
- properties: propertiesDefinition,
236
- };
237
-
238
- const parameterInterface: InterfaceDeclarationStructure = {
239
- kind: StructureKind.Interface,
240
- isExported: true,
241
- name: queryParameterInterfaceName,
242
- properties: [
243
- {
244
- name: "queryParameters",
245
- type: queryParameterPropertiesName,
246
- // Mark as optional if there are no required parameters
247
- hasQuestionToken: !hasRequiredParameters,
248
- },
249
- ],
250
- };
251
-
252
- // Mark the queryParameter interface for importing
253
- internalReferences.add(queryParameterInterfaceName);
254
-
255
- return [...wrapperTypesDefinition, propertiesInterface, parameterInterface];
256
- }
257
-
258
- function getPropertyFromSchema(schema: Schema): PropertySignatureStructure {
259
- const description = schema.description;
260
- return {
261
- name: schema.name,
262
- ...(description && { docs: [{ description }] }),
263
- type: schema.type,
264
- hasQuestionToken: !schema.required,
265
- kind: StructureKind.PropertySignature,
266
- };
267
- }
268
-
269
- function buildPathParameterDefinitions(
270
- model: RLCModel,
271
- parameters: ParameterMetadatas,
272
- baseName: string,
273
- parametersFile: SourceFile,
274
- internalReferences: Set<string>,
275
- requestIndex: number,
276
- ): InterfaceDeclarationStructure[] | undefined {
277
- const pathParameters = (parameters.parameters || []).filter((p) => p.type === "path");
278
- if (!pathParameters.length) {
279
- return undefined;
280
- }
281
- const allDefinitions: InterfaceDeclarationStructure[] = [];
282
-
283
- buildClientPathParameters();
284
- buildMethodWrapParameters();
285
- return allDefinitions;
286
- function buildClientPathParameters() {
287
- // we only have client-level path parameters if the source is from swagger
288
- if (model.options?.sourceFrom === "TypeSpec") {
289
- return;
290
- }
291
- const clientPathParams = pathParameters.length > 0 ? pathParameters : [];
292
- const nameSuffix = requestIndex > 0 ? `${requestIndex}` : "";
293
- const pathParameterInterfaceName = `${baseName}PathParam${nameSuffix}`;
294
-
295
- const pathInterface = getPathInterfaceDefinition(clientPathParams, baseName);
296
-
297
- if (pathInterface) {
298
- parametersFile.addInterface(pathInterface);
299
- }
300
-
301
- internalReferences.add(pathParameterInterfaceName);
302
-
303
- allDefinitions.push({
304
- isExported: true,
305
- kind: StructureKind.Interface,
306
- name: pathParameterInterfaceName,
307
- properties: [
308
- {
309
- name: "pathParameters",
310
- type: `${baseName}PathParameters`,
311
- kind: StructureKind.PropertySignature,
312
- },
313
- ],
314
- });
315
- }
316
-
317
- function buildMethodWrapParameters() {
318
- if (model.options?.sourceFrom === "Swagger") {
319
- return;
320
- }
321
- // we only have method-level path parameters if the source is from typespec
322
- const methodPathParams = pathParameters.length > 0 ? pathParameters : [];
323
-
324
- // we only need to build the wrapper types if the path parameters are objects
325
- const wrapperTypesDefinition = getGeneratedWrapperTypes(methodPathParams).map((wrap) => {
326
- return getObjectInterfaceDeclaration(
327
- model,
328
- wrap.name,
329
- wrap,
330
- [SchemaContext.Input],
331
- new Set<string>(),
332
- );
333
- });
334
- allDefinitions.push(...wrapperTypesDefinition);
335
- }
336
- }
337
-
338
- function getPathInterfaceDefinition(
339
- pathParameters: ParameterMetadata[],
340
- baseName: string,
341
- ): undefined | InterfaceDeclarationStructure {
342
- const pathInterfaceName = `${baseName}PathParameters`;
343
- return {
344
- kind: StructureKind.Interface,
345
- isExported: true,
346
- name: pathInterfaceName,
347
- properties: pathParameters.map((p: ParameterMetadata) => getPropertyFromSchema(p.param)),
348
- };
349
- }
350
-
351
- function buildHeaderParameterDefinitions(
352
- parameters: ParameterMetadatas,
353
- baseName: string,
354
- parametersFile: SourceFile,
355
- internalReferences: Set<string>,
356
- requestIndex: number,
357
- ): InterfaceDeclarationStructure | undefined {
358
- const headerParameters = (parameters.parameters || []).filter(
359
- (p) => p.type === "header" && p.name !== "contentType",
360
- );
361
- if (!headerParameters.length) {
362
- return undefined;
363
- }
364
-
365
- const nameSuffix = requestIndex > 0 ? `${requestIndex}` : "";
366
- const headerParameterInterfaceName = `${baseName}HeaderParam${nameSuffix}`;
367
-
368
- const headersInterface = getRequestHeaderInterfaceDefinition(headerParameters, baseName);
369
-
370
- let isOptional = true;
371
- if (headersInterface) {
372
- parametersFile.addInterface(headersInterface);
373
- isOptional = !(headersInterface.properties || []).some(
374
- (prop) => prop.hasQuestionToken === false,
375
- );
376
- }
377
-
378
- internalReferences.add(headerParameterInterfaceName);
379
-
380
- return {
381
- isExported: true,
382
- kind: StructureKind.Interface,
383
- name: headerParameterInterfaceName,
384
- properties: [
385
- {
386
- name: "headers",
387
- type: `RawHttpHeadersInput & ${baseName}Headers`,
388
- kind: StructureKind.PropertySignature,
389
- hasQuestionToken: isOptional,
390
- },
391
- ],
392
- };
393
- }
394
-
395
- function getRequestHeaderInterfaceDefinition(
396
- headerParameters: ParameterMetadata[],
397
- baseName: string,
398
- ): undefined | InterfaceDeclarationStructure {
399
- const headersInterfaceName = `${baseName}Headers`;
400
- return {
401
- kind: StructureKind.Interface,
402
- isExported: true,
403
- name: headersInterfaceName,
404
- properties: headerParameters.map((h: ParameterMetadata) => getPropertyFromSchema(h.param)),
405
- };
406
- }
407
-
408
- function buildContentTypeParametersDefinition(
409
- parameters: ParameterMetadatas,
410
- baseName: string,
411
- internalReferences: Set<string>,
412
- requestIndex: number,
413
- ): InterfaceDeclarationStructure | undefined {
414
- const mediaTypeParameters = (parameters.parameters || []).filter(
415
- (p) => p.type === "header" && p.name === "contentType",
416
- );
417
- if (!mediaTypeParameters.length) {
418
- return undefined;
419
- }
420
-
421
- const nameSuffix = requestIndex > 0 ? `${requestIndex}` : "";
422
- const mediaTypesParameterInterfaceName = `${baseName}MediaTypesParam${nameSuffix}`;
423
-
424
- // Mark the queryParameter interface for importing
425
- internalReferences.add(mediaTypesParameterInterfaceName);
426
- const firstMediaType = mediaTypeParameters[0];
427
- if (!firstMediaType) {
428
- return undefined;
429
- }
430
- const mediaParam = firstMediaType.param;
431
-
432
- return {
433
- isExported: true,
434
- kind: StructureKind.Interface,
435
- name: mediaTypesParameterInterfaceName,
436
- properties: [getPropertyFromSchema(mediaParam)],
437
- };
438
- }
439
-
440
- function buildBodyParametersDefinition(
441
- parameters: ParameterMetadatas,
442
- baseName: string,
443
- internalReferences: Set<string>,
444
- requestIndex: number,
445
- ): InterfaceDeclarationStructure[] {
446
- const bodyParameters = parameters.body;
447
- if (!bodyParameters || !bodyParameters?.body || !bodyParameters?.body.length) {
448
- return [];
449
- }
450
-
451
- const nameSuffix = requestIndex > 0 ? `${requestIndex}` : "";
452
- const bodyParameterInterfaceName = `${baseName}BodyParam${nameSuffix}`;
453
- internalReferences.add(bodyParameterInterfaceName);
454
-
455
- // In case of formData we'd get multiple properties in body marked as partialBody
456
- if (bodyParameters.isPartialBody) {
457
- let allOptionalParts = true;
458
- const propertiesDefinitions: PropertySignatureStructure[] = [];
459
- for (const param of bodyParameters.body) {
460
- if (param.required) {
461
- allOptionalParts = false;
462
- }
463
-
464
- propertiesDefinitions.push(getPropertyFromSchema(param));
465
- }
466
-
467
- const formBodyName = `${baseName}FormBody`;
468
- const formBodyInterface: InterfaceDeclarationStructure = {
469
- isExported: true,
470
- kind: StructureKind.Interface,
471
- name: formBodyName,
472
- properties: propertiesDefinitions,
473
- };
474
-
475
- return [
476
- {
477
- isExported: true,
478
- kind: StructureKind.Interface,
479
- name: bodyParameterInterfaceName,
480
- properties: [
481
- {
482
- name: "body",
483
- type: formBodyName,
484
- hasQuestionToken: allOptionalParts,
485
- },
486
- ],
487
- },
488
- formBodyInterface,
489
- ];
490
- } else {
491
- const firstBody = bodyParameters.body[0];
492
- if (!firstBody) {
493
- return [];
494
- }
495
- const bodySignature = getPropertyFromSchema(firstBody);
496
-
497
- return [
498
- {
499
- isExported: true,
500
- kind: StructureKind.Interface,
501
- name: bodyParameterInterfaceName,
502
- properties: [
503
- {
504
- docs: bodySignature.docs,
505
- name: "body",
506
- type: bodySignature.type,
507
- hasQuestionToken: bodySignature.hasQuestionToken,
508
- },
509
- ],
510
- },
511
- ];
512
- }
513
- }
514
-
515
- export function buildBodyTypeAlias(
516
- parameters: ParameterMetadatas,
517
- partialBodyTypeNames: Set<string>,
518
- ) {
519
- const bodyParameters = parameters.body;
520
- if (!bodyParameters || !bodyParameters?.body || !bodyParameters?.body.length) {
521
- return undefined;
522
- }
523
- const schema = bodyParameters.body[0] as ObjectSchema;
524
- const headerParameters = (parameters.parameters || []).filter(
525
- (p) => p.type === "header" && p.name === "contentType",
526
- );
527
- if (!headerParameters.length || headerParameters.length > 1) {
528
- return undefined;
529
- }
530
-
531
- const firstHeader = headerParameters[0];
532
- if (!firstHeader) {
533
- return undefined;
534
- }
535
- const contentType = firstHeader.param.type;
536
- const description = `${schema.description}`;
537
- const typeName = `${schema.typeName}ResourceMergeAndPatch`;
538
- if (partialBodyTypeNames.has(typeName)) {
539
- return null;
540
- } else {
541
- partialBodyTypeNames.add(typeName);
542
- }
543
- if (contentType.includes("application/merge-patch+json")) {
544
- const type = `Partial<${schema.typeName}>`;
545
- return {
546
- // kind: StructureKind.TypeAlias,
547
- ...(description && { docs: [{ description }] }),
548
- name: `${typeName}`,
549
- type,
550
- isExported: true,
551
- };
552
- }
553
- return undefined;
554
- }
@@ -1,83 +0,0 @@
1
- import * as path from "path";
2
- import { OPERATION_LRO_HIGH_PRIORITY, RLCModel } from "./interfaces.js";
3
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4
- // @ts-ignore: to fix the handlebars issue
5
- import hbs from "handlebars";
6
- import { hasPollingOperations } from "./helpers/operation-helpers.js";
7
- import { pollingContent } from "./static/polling-content.js";
8
-
9
- interface LroDetail {
10
- clientOverload?: boolean;
11
- overloadMap?: ResponseMap[];
12
- importedResponses?: string[];
13
- isEsm?: boolean;
14
- }
15
-
16
- interface ResponseMap {
17
- initialResponses: string;
18
- finalResponses: string;
19
- precedence?: number;
20
- }
21
-
22
- export function buildPollingHelper(model: RLCModel) {
23
- if (!hasPollingOperations(model)) {
24
- return;
25
- }
26
-
27
- const lroDetail: LroDetail = buildLroHelperDetail(model);
28
- const readmeFileContents = hbs.compile(pollingContent, { noEscape: true });
29
- const { srcPath } = model;
30
- return {
31
- path: path.join(srcPath, "pollingHelper.ts"),
32
- content: readmeFileContents(lroDetail),
33
- };
34
- }
35
-
36
- function buildLroHelperDetail(model: RLCModel): LroDetail {
37
- if (!model.helperDetails?.clientLroOverload) {
38
- return {
39
- clientOverload: false,
40
- isEsm: model.options?.moduleKind === "esm",
41
- };
42
- }
43
- const mapDetail = [];
44
- const pathDictionary = model.paths;
45
- const responses = new Set<string>();
46
- for (const details of Object.values(pathDictionary)) {
47
- for (const methodDetails of Object.values(details.methods)) {
48
- const firstMethod = methodDetails[0];
49
- if (!firstMethod) {
50
- continue;
51
- }
52
- const lroDetail = firstMethod.operationHelperDetail?.lroDetails;
53
- if (lroDetail?.isLongRunning) {
54
- const initialResponses = firstMethod.responseTypes.success.concat(
55
- firstMethod.responseTypes.error,
56
- );
57
-
58
- const finalResponse = lroDetail.logicalResponseTypes?.success.concat(
59
- firstMethod.responseTypes.error,
60
- );
61
-
62
- if (initialResponses && finalResponse) {
63
- initialResponses.forEach((n) => responses.add(n));
64
- finalResponse.forEach((n) => responses.add(n));
65
- mapDetail!.push({
66
- initialResponses: initialResponses.join("|"),
67
- finalResponses: finalResponse.join("|"),
68
- precedence: lroDetail.precedence ?? OPERATION_LRO_HIGH_PRIORITY,
69
- });
70
- }
71
- }
72
- }
73
- }
74
-
75
- // Sorted by the precedence
76
- mapDetail.sort((d1, d2) => d1.precedence - d2.precedence);
77
- return {
78
- clientOverload: responses.size > 0 && mapDetail.length > 0,
79
- importedResponses: Array.from(responses),
80
- overloadMap: mapDetail,
81
- isEsm: model.options?.moduleKind === "esm",
82
- };
83
- }