@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,407 +0,0 @@
1
- import { getClientName } from "./helpers/name-constructors.js";
2
- import { NameType, camelCase, normalizeName } from "./helpers/name-utils.js";
3
- import { isAzurePackage } from "./helpers/package-util.js";
4
- import { buildSchemaObjectMap } from "./helpers/schema-helpers.js";
5
- import { generateParameterTypeValue } from "./helpers/value-generation-util.js";
6
- import {
7
- OperationMethod,
8
- OperationParameter,
9
- PathMetadata,
10
- Paths,
11
- RLCModel,
12
- RLCSampleDetail,
13
- RLCSampleGroup,
14
- SampleParameter,
15
- SampleParameters,
16
- Schema,
17
- } from "./interfaces.js";
18
-
19
- /**
20
- * Transform the sample data based RLC detail e.g path, operations & schemas
21
- * @param model RLC detail
22
- * @param allowMockValue allow to mock value if not exist, currently we always generate mock value
23
- * @returns Generated sample data or undefined if not support to generate
24
- */
25
- export function transformSampleGroups(model: RLCModel, allowMockValue = true) {
26
- if (model.options?.multiClient || model.options?.isModularLibrary) {
27
- // Not support to generate if multiple clients
28
- // Not support to generate if modular libraries
29
- return;
30
- }
31
- if ((model.sampleGroups && model.sampleGroups.length > 0) || !allowMockValue) {
32
- // Skip to transform if already has sample data
33
- // Skip to transform if not allow to mock value
34
- return;
35
- }
36
- const rlcSampleGroups: RLCSampleGroup[] = [];
37
- // Get all paths
38
- const paths: Paths = model.paths;
39
- const clientName = getClientName(model);
40
- const clientInterfaceName = clientName.endsWith("Client")
41
- ? `${clientName}`
42
- : `${clientName}Client`;
43
- const defaultFactoryName = normalizeName(
44
- camelCase(`create ${clientInterfaceName}`),
45
- NameType.Method,
46
- );
47
- const packageName = model.options?.packageDetails?.name ?? "";
48
- const methodParameterMap = buildMethodParamMap(model);
49
- const schemaObjectMap = buildSchemaObjectMap(model);
50
- for (const path in paths) {
51
- const pathDetails = paths[path];
52
- if (!pathDetails) {
53
- continue;
54
- }
55
- const methods = pathDetails.methods;
56
- for (const method in methods) {
57
- const importedDict: Record<string, Set<string>> = {};
58
- const methodArray = methods[method];
59
- if (!methodArray || methodArray.length === 0) {
60
- continue;
61
- }
62
- const detail = methodArray[0];
63
- if (!detail) {
64
- continue;
65
- }
66
- const operatonConcante = getOperationConcate(
67
- detail.operationName,
68
- pathDetails.operationGroupName,
69
- model.options?.sourceFrom,
70
- );
71
- const operationPrefix = normalizeName(
72
- camelCase(transformSpecialLetterToSpace(operatonConcante)),
73
- NameType.Operation,
74
- );
75
- const sampleGroup: RLCSampleGroup = {
76
- filename: `${operationPrefix}Sample`,
77
- defaultFactoryName,
78
- clientPackageName: packageName,
79
- samples: [],
80
- };
81
-
82
- // initialize the sample
83
- const sample: RLCSampleDetail = {
84
- description: `call operation ${detail.operationName}`,
85
- name: `${operationPrefix}Sample`,
86
- path,
87
- defaultFactoryName,
88
- clientParamAssignments: [],
89
- pathParamAssignments: [],
90
- methodParamAssignments: [],
91
- clientParamNames: "",
92
- pathParamNames: "",
93
- methodParamNames: "",
94
- method,
95
- isLRO: detail.operationHelperDetail?.lroDetails?.isLongRunning ?? false,
96
- isPaging: detail.operationHelperDetail?.isPaging ?? false,
97
- useLegacyLro: false,
98
- };
99
- // client-level, path-level and method-level parameter preparation
100
- const parameters: SampleParameters = {
101
- client: convertClientLevelParameters(model, importedDict, schemaObjectMap),
102
- path: convertPathLevelParameters(pathDetails, path, schemaObjectMap),
103
- method: convertMethodLevelParameters(
104
- methodArray,
105
- schemaObjectMap,
106
- methodParameterMap.get(operatonConcante),
107
- ),
108
- };
109
- // enrich parameter details
110
- enrichParameterInSample(sample, parameters);
111
- // enrich LRO and pagination info
112
- enrichLROAndPagingInSample(detail, importedDict, packageName);
113
- sampleGroup.samples.push(sample);
114
- rlcSampleGroups.push(sampleGroup);
115
- enrichImportedString(sampleGroup, importedDict, defaultFactoryName, packageName);
116
- }
117
- }
118
- return rlcSampleGroups;
119
- }
120
-
121
- function enrichLROAndPagingInSample(
122
- operation: OperationMethod,
123
- importedDict: Record<string, Set<string>>,
124
- packageName: string,
125
- ) {
126
- const isLRO = operation.operationHelperDetail?.lroDetails?.isLongRunning ?? false,
127
- isPaging = operation.operationHelperDetail?.isPaging ?? false;
128
- if (isPaging) {
129
- if (isLRO) {
130
- // TODO: report warning this is not supported
131
- }
132
- addValueInImportedDict(packageName, "paginate", importedDict);
133
- } else if (isLRO) {
134
- addValueInImportedDict(packageName, "getLongRunningPoller", importedDict);
135
- }
136
- }
137
-
138
- function transformSpecialLetterToSpace(str: string) {
139
- if (!str) {
140
- return str;
141
- }
142
- return str
143
- .replace(/_/g, " ")
144
- .replace(/\//g, " Or ")
145
- .replace(/,|\.|\(|\)/g, " ")
146
- .replace("'s ", " ");
147
- }
148
-
149
- function enrichImportedString(
150
- sampleGroup: RLCSampleGroup,
151
- importedDict: Record<string, Set<string>>,
152
- defaultFactoryName: string,
153
- packageName: string,
154
- ) {
155
- const importedTypes: string[] = [];
156
- if (!importedDict[packageName] || importedDict[packageName].size === 0) {
157
- importedTypes.push(`import ${defaultFactoryName} from "${packageName}";`);
158
- }
159
- for (const key in importedDict) {
160
- const importedSet = importedDict[key];
161
- if (!importedSet) {
162
- continue;
163
- }
164
- const values = Array.from(importedSet).join(", ");
165
- const hasDefaultFactory = key === packageName ? `${defaultFactoryName},` : "";
166
- importedTypes.push(`import ${hasDefaultFactory} { ${values} } from "${key}";`);
167
- }
168
- sampleGroup.importedTypes = importedTypes;
169
- }
170
-
171
- function enrichParameterInSample(sample: RLCSampleDetail, parameters: SampleParameters) {
172
- sample.clientParamAssignments = getAssignmentStrArray(parameters.client);
173
- sample.clientParamNames = getContactParameterNames(parameters.client);
174
- sample.pathParamAssignments = getAssignmentStrArray(parameters.path);
175
- sample.pathParamNames = getContactParameterNames(parameters.path);
176
- // Directly apply the inline option value as method parameter
177
- sample.methodParamNames = parameters.method.length > 0 ? (parameters.method[0]?.value ?? "") : "";
178
- }
179
-
180
- function getAssignmentStrArray(parameters: SampleParameter[]) {
181
- return parameters.filter((p) => !!p.assignment).map((p) => p.assignment!);
182
- }
183
-
184
- function getContactParameterNames(parameters: SampleParameter[]) {
185
- return parameters
186
- .filter((p) => p.name != null)
187
- .map((p) => p.name!)
188
- .join(",");
189
- }
190
-
191
- function convertClientLevelParameters(
192
- model: RLCModel,
193
- importedDict: Record<string, Set<string>>,
194
- schemaMap: Map<string, Schema>,
195
- ): SampleParameter[] {
196
- if (!model.options) {
197
- return [];
198
- }
199
- const clientParams: SampleParameter[] = [];
200
- const urlParameters = model?.urlInfo?.urlParameters?.filter(
201
- // Do not include parameters with constant values in the signature, these should go in the options bag
202
- (p) => p.value === undefined,
203
- );
204
- const {
205
- addCredentials,
206
- credentialScopes,
207
- credentialKeyHeaderName,
208
- customHttpAuthHeaderName,
209
- flavor,
210
- } = model.options;
211
- const hasUrlParameter = !!urlParameters,
212
- hasCredentials =
213
- addCredentials && (credentialScopes || credentialKeyHeaderName || customHttpAuthHeaderName);
214
-
215
- if (hasUrlParameter) {
216
- // convert the host parameters in url
217
- const clientParamAssignments = urlParameters.map((urlParameter) => {
218
- const urlValue = generateParameterTypeValue(urlParameter.type, urlParameter.name, schemaMap);
219
- const normalizedName = normalizeName(urlParameter.name, NameType.Parameter);
220
- return {
221
- name: normalizedName,
222
- assignment: `const ${normalizedName} = ` + urlValue + `;`,
223
- };
224
- });
225
-
226
- clientParams.push(...clientParamAssignments);
227
- }
228
- if (hasCredentials) {
229
- // Currently only support token credential
230
- const apiKeyCredentialPackage = isAzurePackage(model)
231
- ? "@azure/core-auth"
232
- : "@typespec/ts-http-runtime";
233
- const tokenCredentialPackage = isAzurePackage(model)
234
- ? "@azure/identity"
235
- : "@typespec/ts-http-runtime";
236
- if (credentialKeyHeaderName && isAzurePackage(model)) {
237
- clientParams.push({
238
- name: "credential",
239
- assignment: `const credential = new AzureKeyCredential("{Your API key}");`,
240
- });
241
- addValueInImportedDict(apiKeyCredentialPackage, "AzureKeyCredential", importedDict);
242
- } else if ((credentialKeyHeaderName && flavor !== "azure") || customHttpAuthHeaderName) {
243
- clientParams.push({
244
- name: "credential",
245
- assignment: `const credential = { key: "{Your API key}"};`,
246
- });
247
- } else if (isAzurePackage(model)) {
248
- clientParams.push({
249
- name: "credential",
250
- assignment: "const credential = new DefaultAzureCredential();",
251
- });
252
- addValueInImportedDict(tokenCredentialPackage, "DefaultAzureCredential", importedDict);
253
- } else {
254
- clientParams.push({
255
- name: "credential",
256
- assignment: `const credential = {getToken: () => Promise.resolve({ token: "{Your token}", expiresOnTimestamp: 0 })};`,
257
- });
258
- }
259
- }
260
- return clientParams;
261
- }
262
-
263
- function convertPathLevelParameters(
264
- pathDetail: PathMetadata,
265
- path: string,
266
- schemaMap: Map<string, Schema>,
267
- ): SampleParameter[] {
268
- const pathItself = {
269
- name: `"${path}"`,
270
- };
271
- const pathParams = (pathDetail || []).pathParameters.map((p) => {
272
- const pathParam: SampleParameter = {
273
- name: normalizeName(p.name, NameType.Parameter),
274
- };
275
- const value = generateParameterTypeValue(p.type, p.name, schemaMap);
276
- pathParam.assignment = `const ${pathParam.name} =` + value + `;`;
277
- return pathParam;
278
- });
279
- return [pathItself].concat(pathParams);
280
- }
281
-
282
- function convertMethodLevelParameters(
283
- methods: OperationMethod[],
284
- schemaMap: Map<string, Schema>,
285
- operationParameter?: OperationParameter,
286
- ): SampleParameter[] {
287
- if (
288
- !methods ||
289
- methods.length === 0 ||
290
- !operationParameter ||
291
- operationParameter.parameters.length === 0
292
- ) {
293
- return [];
294
- }
295
- const rawMethodParams = operationParameter.parameters;
296
- const method = methods[0];
297
- const requestParameter = rawMethodParams[0];
298
- if (!method || !requestParameter) {
299
- return [];
300
- }
301
- const hasInputParams = !!rawMethodParams && rawMethodParams.length > 0,
302
- requireParam = !method.hasOptionalOptions;
303
- if (!hasInputParams && !requireParam) {
304
- return [];
305
- }
306
-
307
- const allSideAssignments = [],
308
- querySideAssignments: string[] = [],
309
- headerSideAssignments: string[] = [];
310
- if (
311
- !!requestParameter.body &&
312
- requestParameter.body &&
313
- requestParameter.body.body &&
314
- requestParameter.body.body?.length > 0
315
- ) {
316
- const body = requestParameter.body.body[0];
317
- if (body) {
318
- const bodyTypeName = body.typeName ?? body.type;
319
- if (bodyTypeName !== "string" && body.oriSchema) {
320
- schemaMap.set(bodyTypeName, body.oriSchema);
321
- }
322
- allSideAssignments.push(
323
- ` body: ` + generateParameterTypeValue(bodyTypeName, "body", schemaMap),
324
- );
325
- }
326
- }
327
-
328
- requestParameter.parameters
329
- ?.filter((p) => p.type === "query")
330
- .forEach((p) => {
331
- const name = `${p.name}`;
332
- querySideAssignments.push(
333
- `${name}: ` + generateParameterTypeValue(p.param.type, name, schemaMap),
334
- );
335
- });
336
-
337
- if (querySideAssignments.length > 0) {
338
- allSideAssignments.push(` queryParameters: { ` + querySideAssignments.join(", ") + `}`);
339
- }
340
- requestParameter.parameters
341
- ?.filter((p) => p.type === "header")
342
- .filter((p) => p.name.toLowerCase() !== "contenttype")
343
- .forEach((p) => {
344
- const name = `${p.name}`;
345
- headerSideAssignments.push(
346
- `${name}: ` + generateParameterTypeValue(p.param.type, name, schemaMap),
347
- );
348
- });
349
- if (headerSideAssignments.length > 0) {
350
- allSideAssignments.push(` headers: { ` + headerSideAssignments.join(", ") + `}`);
351
- }
352
- const contentType = requestParameter.parameters
353
- ?.filter((p) => p.type === "header")
354
- .filter((p) => p.name.toLowerCase() === "contenttype");
355
- const firstContentType = contentType?.[0];
356
- if (firstContentType) {
357
- allSideAssignments.push(
358
- ` ${firstContentType.name}: ` +
359
- generateParameterTypeValue(firstContentType.param.type, firstContentType.name, schemaMap),
360
- );
361
- }
362
- let value: string;
363
- if (allSideAssignments.length > 0) {
364
- value = `{ ` + allSideAssignments.join(", ") + `}`;
365
- } else {
366
- return [];
367
- }
368
-
369
- const optionParam: SampleParameter = {
370
- name: "options",
371
- assignment: `const options =` + value + `;`,
372
- value,
373
- };
374
- return [optionParam];
375
- }
376
-
377
- function addValueInImportedDict(
378
- key: string,
379
- val: string,
380
- importedDict: Record<string, Set<string>>,
381
- ) {
382
- if (!importedDict[key]) {
383
- importedDict[key] = new Set<string>();
384
- }
385
- importedDict[key].add(val);
386
- }
387
-
388
- function buildMethodParamMap(model: RLCModel): Map<string, OperationParameter> {
389
- const map = new Map<string, OperationParameter>();
390
- (model.parameters ?? []).forEach((p) => {
391
- const operatonConcante = getOperationConcate(
392
- p.operationName,
393
- p.operationGroup,
394
- model.options?.sourceFrom,
395
- );
396
- map.set(operatonConcante, p);
397
- });
398
- return map;
399
- }
400
-
401
- function getOperationConcate(opName: string, opGroup: string, sourceFrom?: string) {
402
- return sourceFrom === "Swagger"
403
- ? opGroup === "" || opGroup === "Client"
404
- ? opName
405
- : `${opGroup}${opName}`
406
- : `${opGroup}_${opName}`;
407
- }
@@ -1,12 +0,0 @@
1
- import path from "path";
2
- import { fileURLToPath } from "url";
3
-
4
- /**
5
- *
6
- * @param metaUrl usually import.meta.url
7
- */
8
- export function getDirname(metaUrl: string) {
9
- const __filename = fileURLToPath(metaUrl);
10
- const __dirname = path.dirname(__filename);
11
- return { __dirname, __filename };
12
- }