@azure-tools/typespec-ts 0.54.0-dev.6 → 0.54.0-dev.7

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 (506) hide show
  1. package/dist/src/contextManager.d.ts +5 -5
  2. package/dist/src/contextManager.d.ts.map +1 -1
  3. package/dist/src/contextManager.js.map +1 -1
  4. package/dist/src/framework/declaration.d.ts +1 -1
  5. package/dist/src/framework/declaration.d.ts.map +1 -1
  6. package/dist/src/framework/declaration.js +2 -4
  7. package/dist/src/framework/declaration.js.map +1 -1
  8. package/dist/src/framework/dependency.d.ts.map +1 -1
  9. package/dist/src/framework/hooks/binder.d.ts +1 -1
  10. package/dist/src/framework/hooks/binder.d.ts.map +1 -1
  11. package/dist/src/framework/hooks/binder.js +12 -20
  12. package/dist/src/framework/hooks/binder.js.map +1 -1
  13. package/dist/src/framework/hooks/sdkTypes.d.ts +1 -1
  14. package/dist/src/framework/hooks/sdkTypes.d.ts.map +1 -1
  15. package/dist/src/framework/hooks/sdkTypes.js +8 -11
  16. package/dist/src/framework/hooks/sdkTypes.js.map +1 -1
  17. package/dist/src/framework/hooks/useDependencies.d.ts.map +1 -1
  18. package/dist/src/framework/hooks/useDependencies.js +1 -1
  19. package/dist/src/framework/hooks/useDependencies.js.map +1 -1
  20. package/dist/src/framework/load-static-helpers.d.ts +1 -1
  21. package/dist/src/framework/load-static-helpers.d.ts.map +1 -1
  22. package/dist/src/framework/load-static-helpers.js +12 -25
  23. package/dist/src/framework/load-static-helpers.js.map +1 -1
  24. package/dist/src/framework/reference.d.ts.map +1 -1
  25. package/dist/src/framework/reference.js +1 -1
  26. package/dist/src/framework/reference.js.map +1 -1
  27. package/dist/src/framework/sample.js +8 -8
  28. package/dist/src/framework/sample.js.map +1 -1
  29. package/dist/src/index.d.ts +1 -1
  30. package/dist/src/index.d.ts.map +1 -1
  31. package/dist/src/index.js +47 -48
  32. package/dist/src/index.js.map +1 -1
  33. package/dist/src/lib.d.ts +1 -1
  34. package/dist/src/lib.d.ts.map +1 -1
  35. package/dist/src/lib.js +140 -140
  36. package/dist/src/lib.js.map +1 -1
  37. package/dist/src/metaTree.d.ts +1 -1
  38. package/dist/src/metaTree.d.ts.map +1 -1
  39. package/dist/src/modular/buildClassicalClient.d.ts +1 -1
  40. package/dist/src/modular/buildClassicalClient.d.ts.map +1 -1
  41. package/dist/src/modular/buildClassicalClient.js +49 -62
  42. package/dist/src/modular/buildClassicalClient.js.map +1 -1
  43. package/dist/src/modular/buildClassicalOperationGroups.d.ts +2 -2
  44. package/dist/src/modular/buildClassicalOperationGroups.d.ts.map +1 -1
  45. package/dist/src/modular/buildClassicalOperationGroups.js +4 -7
  46. package/dist/src/modular/buildClassicalOperationGroups.js.map +1 -1
  47. package/dist/src/modular/buildClientContext.d.ts +2 -2
  48. package/dist/src/modular/buildClientContext.d.ts.map +1 -1
  49. package/dist/src/modular/buildClientContext.js +30 -36
  50. package/dist/src/modular/buildClientContext.js.map +1 -1
  51. package/dist/src/modular/buildModularOptions.d.ts +1 -1
  52. package/dist/src/modular/buildModularOptions.d.ts.map +1 -1
  53. package/dist/src/modular/buildModularOptions.js +2 -2
  54. package/dist/src/modular/buildModularOptions.js.map +1 -1
  55. package/dist/src/modular/buildOperations.d.ts +3 -3
  56. package/dist/src/modular/buildOperations.d.ts.map +1 -1
  57. package/dist/src/modular/buildOperations.js +22 -23
  58. package/dist/src/modular/buildOperations.js.map +1 -1
  59. package/dist/src/modular/buildProjectFiles.d.ts +1 -1
  60. package/dist/src/modular/buildProjectFiles.d.ts.map +1 -1
  61. package/dist/src/modular/buildProjectFiles.js +7 -9
  62. package/dist/src/modular/buildProjectFiles.js.map +1 -1
  63. package/dist/src/modular/buildRestorePoller.d.ts +1 -1
  64. package/dist/src/modular/buildRestorePoller.d.ts.map +1 -1
  65. package/dist/src/modular/buildRestorePoller.js +11 -11
  66. package/dist/src/modular/buildRestorePoller.js.map +1 -1
  67. package/dist/src/modular/buildRootIndex.d.ts +2 -2
  68. package/dist/src/modular/buildRootIndex.d.ts.map +1 -1
  69. package/dist/src/modular/buildRootIndex.js +30 -39
  70. package/dist/src/modular/buildRootIndex.js.map +1 -1
  71. package/dist/src/modular/buildSubpathIndex.d.ts.map +1 -1
  72. package/dist/src/modular/buildSubpathIndex.js +9 -17
  73. package/dist/src/modular/buildSubpathIndex.js.map +1 -1
  74. package/dist/src/modular/emitLoggerFile.d.ts.map +1 -1
  75. package/dist/src/modular/emitLoggerFile.js +2 -2
  76. package/dist/src/modular/emitLoggerFile.js.map +1 -1
  77. package/dist/src/modular/emitModels.d.ts +1 -1
  78. package/dist/src/modular/emitModels.d.ts.map +1 -1
  79. package/dist/src/modular/emitModels.js +54 -72
  80. package/dist/src/modular/emitModels.js.map +1 -1
  81. package/dist/src/modular/emitModelsOptions.d.ts +1 -1
  82. package/dist/src/modular/emitModelsOptions.d.ts.map +1 -1
  83. package/dist/src/modular/emitModelsOptions.js +6 -7
  84. package/dist/src/modular/emitModelsOptions.js.map +1 -1
  85. package/dist/src/modular/emitSamples.d.ts.map +1 -1
  86. package/dist/src/modular/emitSamples.js +40 -52
  87. package/dist/src/modular/emitSamples.js.map +1 -1
  88. package/dist/src/modular/emitTests.d.ts.map +1 -1
  89. package/dist/src/modular/emitTests.js +9 -12
  90. package/dist/src/modular/emitTests.js.map +1 -1
  91. package/dist/src/modular/external-dependencies.js +54 -54
  92. package/dist/src/modular/helpers/classicalOperationHelpers.d.ts +1 -1
  93. package/dist/src/modular/helpers/classicalOperationHelpers.d.ts.map +1 -1
  94. package/dist/src/modular/helpers/classicalOperationHelpers.js +27 -36
  95. package/dist/src/modular/helpers/classicalOperationHelpers.js.map +1 -1
  96. package/dist/src/modular/helpers/clientHelpers.d.ts +2 -2
  97. package/dist/src/modular/helpers/clientHelpers.d.ts.map +1 -1
  98. package/dist/src/modular/helpers/clientHelpers.js +20 -38
  99. package/dist/src/modular/helpers/clientHelpers.js.map +1 -1
  100. package/dist/src/modular/helpers/clientOptionHelpers.d.ts.map +1 -1
  101. package/dist/src/modular/helpers/clientOptionHelpers.js.map +1 -1
  102. package/dist/src/modular/helpers/exampleValueHelpers.d.ts +2 -2
  103. package/dist/src/modular/helpers/exampleValueHelpers.d.ts.map +1 -1
  104. package/dist/src/modular/helpers/exampleValueHelpers.js +39 -58
  105. package/dist/src/modular/helpers/exampleValueHelpers.js.map +1 -1
  106. package/dist/src/modular/helpers/namingHelpers.d.ts +1 -1
  107. package/dist/src/modular/helpers/namingHelpers.d.ts.map +1 -1
  108. package/dist/src/modular/helpers/namingHelpers.js +4 -5
  109. package/dist/src/modular/helpers/namingHelpers.js.map +1 -1
  110. package/dist/src/modular/helpers/operationHelpers.d.ts +2 -2
  111. package/dist/src/modular/helpers/operationHelpers.d.ts.map +1 -1
  112. package/dist/src/modular/helpers/operationHelpers.js +136 -196
  113. package/dist/src/modular/helpers/operationHelpers.js.map +1 -1
  114. package/dist/src/modular/helpers/typeHelpers.d.ts +1 -1
  115. package/dist/src/modular/helpers/typeHelpers.d.ts.map +1 -1
  116. package/dist/src/modular/helpers/typeHelpers.js +1 -1
  117. package/dist/src/modular/helpers/typeHelpers.js.map +1 -1
  118. package/dist/src/modular/serialization/buildDeserializerFunction.d.ts +1 -1
  119. package/dist/src/modular/serialization/buildDeserializerFunction.d.ts.map +1 -1
  120. package/dist/src/modular/serialization/buildDeserializerFunction.js +50 -56
  121. package/dist/src/modular/serialization/buildDeserializerFunction.js.map +1 -1
  122. package/dist/src/modular/serialization/buildSerializerFunction.d.ts +1 -1
  123. package/dist/src/modular/serialization/buildSerializerFunction.d.ts.map +1 -1
  124. package/dist/src/modular/serialization/buildSerializerFunction.js +52 -59
  125. package/dist/src/modular/serialization/buildSerializerFunction.js.map +1 -1
  126. package/dist/src/modular/serialization/buildXmlSerializerFunction.d.ts +1 -1
  127. package/dist/src/modular/serialization/buildXmlSerializerFunction.d.ts.map +1 -1
  128. package/dist/src/modular/serialization/buildXmlSerializerFunction.js +43 -51
  129. package/dist/src/modular/serialization/buildXmlSerializerFunction.js.map +1 -1
  130. package/dist/src/modular/serialization/serializeUtils.d.ts.map +1 -1
  131. package/dist/src/modular/serialization/serializeUtils.js +4 -11
  132. package/dist/src/modular/serialization/serializeUtils.js.map +1 -1
  133. package/dist/src/modular/static-helpers-metadata.js +60 -60
  134. package/dist/src/modular/type-expressions/get-credential-expression.js +1 -1
  135. package/dist/src/modular/type-expressions/get-credential-expression.js.map +1 -1
  136. package/dist/src/modular/type-expressions/get-enum-expression.d.ts +1 -1
  137. package/dist/src/modular/type-expressions/get-enum-expression.d.ts.map +1 -1
  138. package/dist/src/modular/type-expressions/get-enum-expression.js +1 -1
  139. package/dist/src/modular/type-expressions/get-enum-expression.js.map +1 -1
  140. package/dist/src/modular/type-expressions/get-model-expression.d.ts.map +1 -1
  141. package/dist/src/modular/type-expressions/get-model-expression.js +7 -9
  142. package/dist/src/modular/type-expressions/get-model-expression.js.map +1 -1
  143. package/dist/src/modular/type-expressions/get-nullable-expression.d.ts +1 -1
  144. package/dist/src/modular/type-expressions/get-nullable-expression.d.ts.map +1 -1
  145. package/dist/src/modular/type-expressions/get-nullable-expression.js.map +1 -1
  146. package/dist/src/modular/type-expressions/get-type-expression.d.ts.map +1 -1
  147. package/dist/src/modular/type-expressions/get-type-expression.js +4 -8
  148. package/dist/src/modular/type-expressions/get-type-expression.js.map +1 -1
  149. package/dist/src/modular/type-expressions/get-union-expression.d.ts +1 -1
  150. package/dist/src/modular/type-expressions/get-union-expression.d.ts.map +1 -1
  151. package/dist/src/modular/type-expressions/get-union-expression.js.map +1 -1
  152. package/dist/src/rlc-common/buildClient.d.ts +1 -1
  153. package/dist/src/rlc-common/buildClient.d.ts.map +1 -1
  154. package/dist/src/rlc-common/buildClient.js +48 -66
  155. package/dist/src/rlc-common/buildClient.js.map +1 -1
  156. package/dist/src/rlc-common/buildClientDefinitions.d.ts.map +1 -1
  157. package/dist/src/rlc-common/buildClientDefinitions.js +24 -42
  158. package/dist/src/rlc-common/buildClientDefinitions.js.map +1 -1
  159. package/dist/src/rlc-common/buildIndexFile.d.ts.map +1 -1
  160. package/dist/src/rlc-common/buildIndexFile.js +57 -57
  161. package/dist/src/rlc-common/buildIndexFile.js.map +1 -1
  162. package/dist/src/rlc-common/buildIsUnexpectedHelper.d.ts.map +1 -1
  163. package/dist/src/rlc-common/buildIsUnexpectedHelper.js +32 -35
  164. package/dist/src/rlc-common/buildIsUnexpectedHelper.js.map +1 -1
  165. package/dist/src/rlc-common/buildLogger.d.ts.map +1 -1
  166. package/dist/src/rlc-common/buildLogger.js +3 -3
  167. package/dist/src/rlc-common/buildLogger.js.map +1 -1
  168. package/dist/src/rlc-common/buildMethodShortcuts.d.ts.map +1 -1
  169. package/dist/src/rlc-common/buildMethodShortcuts.js +3 -3
  170. package/dist/src/rlc-common/buildMethodShortcuts.js.map +1 -1
  171. package/dist/src/rlc-common/buildObjectTypes.d.ts.map +1 -1
  172. package/dist/src/rlc-common/buildObjectTypes.js +29 -46
  173. package/dist/src/rlc-common/buildObjectTypes.js.map +1 -1
  174. package/dist/src/rlc-common/buildPaginateHelper.d.ts.map +1 -1
  175. package/dist/src/rlc-common/buildPaginateHelper.js +2 -2
  176. package/dist/src/rlc-common/buildPaginateHelper.js.map +1 -1
  177. package/dist/src/rlc-common/buildParameterTypes.d.ts.map +1 -1
  178. package/dist/src/rlc-common/buildParameterTypes.js +42 -50
  179. package/dist/src/rlc-common/buildParameterTypes.js.map +1 -1
  180. package/dist/src/rlc-common/buildPollingHelper.d.ts.map +1 -1
  181. package/dist/src/rlc-common/buildPollingHelper.js +5 -5
  182. package/dist/src/rlc-common/buildPollingHelper.js.map +1 -1
  183. package/dist/src/rlc-common/buildResponseTypes.d.ts.map +1 -1
  184. package/dist/src/rlc-common/buildResponseTypes.js +19 -22
  185. package/dist/src/rlc-common/buildResponseTypes.js.map +1 -1
  186. package/dist/src/rlc-common/buildSamples.d.ts +1 -1
  187. package/dist/src/rlc-common/buildSamples.d.ts.map +1 -1
  188. package/dist/src/rlc-common/buildSamples.js +2 -2
  189. package/dist/src/rlc-common/buildSchemaType.d.ts.map +1 -1
  190. package/dist/src/rlc-common/buildSchemaType.js +9 -13
  191. package/dist/src/rlc-common/buildSchemaType.js.map +1 -1
  192. package/dist/src/rlc-common/buildSerializeHelper.d.ts.map +1 -1
  193. package/dist/src/rlc-common/buildSerializeHelper.js +4 -4
  194. package/dist/src/rlc-common/buildSerializeHelper.js.map +1 -1
  195. package/dist/src/rlc-common/buildTopLevelIndexFile.d.ts.map +1 -1
  196. package/dist/src/rlc-common/buildTopLevelIndexFile.js +9 -13
  197. package/dist/src/rlc-common/buildTopLevelIndexFile.js.map +1 -1
  198. package/dist/src/rlc-common/helpers/apiVersionUtil.d.ts.map +1 -1
  199. package/dist/src/rlc-common/helpers/apiVersionUtil.js +2 -3
  200. package/dist/src/rlc-common/helpers/apiVersionUtil.js.map +1 -1
  201. package/dist/src/rlc-common/helpers/importsUtil.d.ts.map +1 -1
  202. package/dist/src/rlc-common/helpers/importsUtil.js +23 -25
  203. package/dist/src/rlc-common/helpers/importsUtil.js.map +1 -1
  204. package/dist/src/rlc-common/helpers/nameConstructors.d.ts.map +1 -1
  205. package/dist/src/rlc-common/helpers/nameConstructors.js.map +1 -1
  206. package/dist/src/rlc-common/helpers/nameUtils.d.ts.map +1 -1
  207. package/dist/src/rlc-common/helpers/nameUtils.js +8 -13
  208. package/dist/src/rlc-common/helpers/nameUtils.js.map +1 -1
  209. package/dist/src/rlc-common/helpers/operationHelpers.d.ts.map +1 -1
  210. package/dist/src/rlc-common/helpers/operationHelpers.js +8 -12
  211. package/dist/src/rlc-common/helpers/operationHelpers.js.map +1 -1
  212. package/dist/src/rlc-common/helpers/pathUtils.d.ts.map +1 -1
  213. package/dist/src/rlc-common/helpers/pathUtils.js +1 -3
  214. package/dist/src/rlc-common/helpers/pathUtils.js.map +1 -1
  215. package/dist/src/rlc-common/helpers/schemaHelpers.d.ts.map +1 -1
  216. package/dist/src/rlc-common/helpers/schemaHelpers.js +1 -1
  217. package/dist/src/rlc-common/helpers/schemaHelpers.js.map +1 -1
  218. package/dist/src/rlc-common/helpers/shortcutMethods.d.ts +1 -1
  219. package/dist/src/rlc-common/helpers/shortcutMethods.d.ts.map +1 -1
  220. package/dist/src/rlc-common/helpers/shortcutMethods.js +2 -2
  221. package/dist/src/rlc-common/helpers/shortcutMethods.js.map +1 -1
  222. package/dist/src/rlc-common/helpers/typeUtil.d.ts.map +1 -1
  223. package/dist/src/rlc-common/helpers/typeUtil.js +1 -2
  224. package/dist/src/rlc-common/helpers/typeUtil.js.map +1 -1
  225. package/dist/src/rlc-common/helpers/valueGenerationUtil.js +3 -4
  226. package/dist/src/rlc-common/helpers/valueGenerationUtil.js.map +1 -1
  227. package/dist/src/rlc-common/index.d.ts +28 -28
  228. package/dist/src/rlc-common/index.d.ts.map +1 -1
  229. package/dist/src/rlc-common/index.js +28 -28
  230. package/dist/src/rlc-common/index.js.map +1 -1
  231. package/dist/src/rlc-common/interfaces.d.ts.map +1 -1
  232. package/dist/src/rlc-common/interfaces.js.map +1 -1
  233. package/dist/src/rlc-common/metadata/buildApiExtractorConfig.d.ts.map +1 -1
  234. package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js +13 -13
  235. package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js.map +1 -1
  236. package/dist/src/rlc-common/metadata/buildChangelogFile.js +1 -1
  237. package/dist/src/rlc-common/metadata/buildESLintConfig.d.ts.map +1 -1
  238. package/dist/src/rlc-common/metadata/buildESLintConfig.js +3 -5
  239. package/dist/src/rlc-common/metadata/buildESLintConfig.js.map +1 -1
  240. package/dist/src/rlc-common/metadata/buildLicenseFile.js +1 -1
  241. package/dist/src/rlc-common/metadata/buildPackageFile.d.ts.map +1 -1
  242. package/dist/src/rlc-common/metadata/buildPackageFile.js +16 -16
  243. package/dist/src/rlc-common/metadata/buildPackageFile.js.map +1 -1
  244. package/dist/src/rlc-common/metadata/buildReadmeFile.d.ts.map +1 -1
  245. package/dist/src/rlc-common/metadata/buildReadmeFile.js +10 -18
  246. package/dist/src/rlc-common/metadata/buildReadmeFile.js.map +1 -1
  247. package/dist/src/rlc-common/metadata/buildRollupConfig.d.ts.map +1 -1
  248. package/dist/src/rlc-common/metadata/buildRollupConfig.js +3 -4
  249. package/dist/src/rlc-common/metadata/buildRollupConfig.js.map +1 -1
  250. package/dist/src/rlc-common/metadata/buildSampleEnvFile.d.ts.map +1 -1
  251. package/dist/src/rlc-common/metadata/buildSampleEnvFile.js +2 -3
  252. package/dist/src/rlc-common/metadata/buildSampleEnvFile.js.map +1 -1
  253. package/dist/src/rlc-common/metadata/buildTestConfig.js +8 -8
  254. package/dist/src/rlc-common/metadata/buildTsConfig.d.ts.map +1 -1
  255. package/dist/src/rlc-common/metadata/buildTsConfig.js +23 -21
  256. package/dist/src/rlc-common/metadata/buildTsConfig.js.map +1 -1
  257. package/dist/src/rlc-common/metadata/buildVitestConfig.d.ts.map +1 -1
  258. package/dist/src/rlc-common/metadata/buildVitestConfig.js +3 -4
  259. package/dist/src/rlc-common/metadata/buildVitestConfig.js.map +1 -1
  260. package/dist/src/rlc-common/metadata/buildWarpConfig.d.ts.map +1 -1
  261. package/dist/src/rlc-common/metadata/buildWarpConfig.js +2 -2
  262. package/dist/src/rlc-common/metadata/buildWarpConfig.js.map +1 -1
  263. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts +1 -1
  264. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts.map +1 -1
  265. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js +13 -13
  266. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js.map +1 -1
  267. package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.d.ts.map +1 -1
  268. package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js +22 -26
  269. package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js.map +1 -1
  270. package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.d.ts.map +1 -1
  271. package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js +15 -16
  272. package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js.map +1 -1
  273. package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js +8 -8
  274. package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js.map +1 -1
  275. package/dist/src/rlc-common/metadata/packageJson/packageCommon.d.ts.map +1 -1
  276. package/dist/src/rlc-common/metadata/packageJson/packageCommon.js +26 -29
  277. package/dist/src/rlc-common/metadata/packageJson/packageCommon.js.map +1 -1
  278. package/dist/src/rlc-common/test/buildKarmaConfig.js +1 -1
  279. package/dist/src/rlc-common/test/buildRecordedClient.js +3 -3
  280. package/dist/src/rlc-common/test/buildSampleTest.d.ts.map +1 -1
  281. package/dist/src/rlc-common/test/buildSampleTest.js +2 -2
  282. package/dist/src/rlc-common/test/buildSampleTest.js.map +1 -1
  283. package/dist/src/rlc-common/test/buildSnippets.d.ts.map +1 -1
  284. package/dist/src/rlc-common/test/buildSnippets.js +4 -6
  285. package/dist/src/rlc-common/test/buildSnippets.js.map +1 -1
  286. package/dist/src/rlc-common/transformSampleGroups.d.ts.map +1 -1
  287. package/dist/src/rlc-common/transformSampleGroups.js +19 -23
  288. package/dist/src/rlc-common/transformSampleGroups.js.map +1 -1
  289. package/dist/src/testing/index.d.ts.map +1 -1
  290. package/dist/src/testing/index.js +1 -1
  291. package/dist/src/testing/index.js.map +1 -1
  292. package/dist/src/transform/transform.d.ts +1 -1
  293. package/dist/src/transform/transform.d.ts.map +1 -1
  294. package/dist/src/transform/transform.js +10 -11
  295. package/dist/src/transform/transform.js.map +1 -1
  296. package/dist/src/transform/transformApiVersionInfo.d.ts +1 -1
  297. package/dist/src/transform/transformApiVersionInfo.d.ts.map +1 -1
  298. package/dist/src/transform/transformApiVersionInfo.js +8 -10
  299. package/dist/src/transform/transformApiVersionInfo.js.map +1 -1
  300. package/dist/src/transform/transformHelperFunctionDetails.d.ts +1 -1
  301. package/dist/src/transform/transformHelperFunctionDetails.d.ts.map +1 -1
  302. package/dist/src/transform/transformHelperFunctionDetails.js +9 -11
  303. package/dist/src/transform/transformHelperFunctionDetails.js.map +1 -1
  304. package/dist/src/transform/transformParameters.d.ts +2 -2
  305. package/dist/src/transform/transformParameters.d.ts.map +1 -1
  306. package/dist/src/transform/transformParameters.js +22 -28
  307. package/dist/src/transform/transformParameters.js.map +1 -1
  308. package/dist/src/transform/transformPaths.d.ts +1 -1
  309. package/dist/src/transform/transformPaths.d.ts.map +1 -1
  310. package/dist/src/transform/transformPaths.js +11 -12
  311. package/dist/src/transform/transformPaths.js.map +1 -1
  312. package/dist/src/transform/transformResponses.d.ts +1 -1
  313. package/dist/src/transform/transformResponses.d.ts.map +1 -1
  314. package/dist/src/transform/transformResponses.js +12 -12
  315. package/dist/src/transform/transformResponses.js.map +1 -1
  316. package/dist/src/transform/transformSchemas.d.ts.map +1 -1
  317. package/dist/src/transform/transformSchemas.js +9 -15
  318. package/dist/src/transform/transformSchemas.js.map +1 -1
  319. package/dist/src/transform/transformTelemetryInfo.d.ts +1 -1
  320. package/dist/src/transform/transformTelemetryInfo.d.ts.map +1 -1
  321. package/dist/src/transform/transformTelemetryInfo.js +3 -3
  322. package/dist/src/transform/transformTelemetryInfo.js.map +1 -1
  323. package/dist/src/transform/transfromRLCOptions.d.ts +1 -1
  324. package/dist/src/transform/transfromRLCOptions.d.ts.map +1 -1
  325. package/dist/src/transform/transfromRLCOptions.js +14 -26
  326. package/dist/src/transform/transfromRLCOptions.js.map +1 -1
  327. package/dist/src/utils/clientUtils.d.ts +1 -1
  328. package/dist/src/utils/clientUtils.d.ts.map +1 -1
  329. package/dist/src/utils/clientUtils.js +11 -14
  330. package/dist/src/utils/clientUtils.js.map +1 -1
  331. package/dist/src/utils/credentialUtils.d.ts +1 -1
  332. package/dist/src/utils/credentialUtils.d.ts.map +1 -1
  333. package/dist/src/utils/credentialUtils.js +3 -3
  334. package/dist/src/utils/credentialUtils.js.map +1 -1
  335. package/dist/src/utils/crossLanguageDef.d.ts.map +1 -1
  336. package/dist/src/utils/crossLanguageDef.js +8 -12
  337. package/dist/src/utils/crossLanguageDef.js.map +1 -1
  338. package/dist/src/utils/emitUtil.d.ts +1 -1
  339. package/dist/src/utils/emitUtil.d.ts.map +1 -1
  340. package/dist/src/utils/emitUtil.js +4 -6
  341. package/dist/src/utils/emitUtil.js.map +1 -1
  342. package/dist/src/utils/fileSystemUtils.d.ts.map +1 -1
  343. package/dist/src/utils/fileSystemUtils.js +2 -2
  344. package/dist/src/utils/fileSystemUtils.js.map +1 -1
  345. package/dist/src/utils/importHelper.d.ts.map +1 -1
  346. package/dist/src/utils/importHelper.js +2 -4
  347. package/dist/src/utils/importHelper.js.map +1 -1
  348. package/dist/src/utils/interfaces.d.ts +1 -1
  349. package/dist/src/utils/interfaces.d.ts.map +1 -1
  350. package/dist/src/utils/mediaTypes.d.ts.map +1 -1
  351. package/dist/src/utils/mediaTypes.js +7 -19
  352. package/dist/src/utils/mediaTypes.js.map +1 -1
  353. package/dist/src/utils/modelUtils.d.ts +2 -2
  354. package/dist/src/utils/modelUtils.d.ts.map +1 -1
  355. package/dist/src/utils/modelUtils.js +107 -170
  356. package/dist/src/utils/modelUtils.js.map +1 -1
  357. package/dist/src/utils/namespaceUtils.d.ts.map +1 -1
  358. package/dist/src/utils/namespaceUtils.js +2 -2
  359. package/dist/src/utils/namespaceUtils.js.map +1 -1
  360. package/dist/src/utils/operationUtil.d.ts +1 -1
  361. package/dist/src/utils/operationUtil.d.ts.map +1 -1
  362. package/dist/src/utils/operationUtil.js +29 -42
  363. package/dist/src/utils/operationUtil.js.map +1 -1
  364. package/dist/src/utils/parameterUtils.d.ts +1 -1
  365. package/dist/src/utils/parameterUtils.d.ts.map +1 -1
  366. package/dist/src/utils/parameterUtils.js +19 -22
  367. package/dist/src/utils/parameterUtils.js.map +1 -1
  368. package/dist/src/utils/resolve-project-root.js +2 -2
  369. package/dist/src/utils/resolve-project-root.js.map +1 -1
  370. package/dist/tsconfig.tsbuildinfo +1 -1
  371. package/package.json +1 -3
  372. package/src/contextManager.ts +6 -9
  373. package/src/framework/declaration.ts +18 -28
  374. package/src/framework/dependency.ts +1 -2
  375. package/src/framework/hooks/binder.ts +47 -120
  376. package/src/framework/hooks/sdkTypes.ts +27 -54
  377. package/src/framework/hooks/useDependencies.ts +2 -4
  378. package/src/framework/load-static-helpers.ts +28 -51
  379. package/src/framework/reference.ts +2 -5
  380. package/src/framework/sample.ts +9 -9
  381. package/src/index.ts +111 -180
  382. package/src/lib.ts +143 -158
  383. package/src/metaTree.ts +1 -1
  384. package/src/modular/buildClassicalClient.ts +83 -160
  385. package/src/modular/buildClassicalOperationGroups.ts +14 -39
  386. package/src/modular/buildClientContext.ts +54 -83
  387. package/src/modular/buildModularOptions.ts +4 -5
  388. package/src/modular/buildOperations.ts +46 -73
  389. package/src/modular/buildProjectFiles.ts +18 -47
  390. package/src/modular/buildRestorePoller.ts +27 -46
  391. package/src/modular/buildRootIndex.ts +86 -159
  392. package/src/modular/buildSubpathIndex.ts +35 -58
  393. package/src/modular/emitLoggerFile.ts +4 -9
  394. package/src/modular/emitModels.ts +136 -266
  395. package/src/modular/emitModelsOptions.ts +10 -16
  396. package/src/modular/emitSamples.ts +91 -177
  397. package/src/modular/emitTests.ts +28 -61
  398. package/src/modular/external-dependencies.ts +54 -54
  399. package/src/modular/helpers/classicalOperationHelpers.ts +73 -126
  400. package/src/modular/helpers/clientHelpers.ts +41 -88
  401. package/src/modular/helpers/clientOptionHelpers.ts +4 -11
  402. package/src/modular/helpers/exampleValueHelpers.ts +97 -209
  403. package/src/modular/helpers/namingHelpers.ts +12 -28
  404. package/src/modular/helpers/operationHelpers.ts +430 -757
  405. package/src/modular/helpers/typeHelpers.ts +11 -22
  406. package/src/modular/serialization/buildDeserializerFunction.ts +88 -122
  407. package/src/modular/serialization/buildSerializerFunction.ts +91 -129
  408. package/src/modular/serialization/buildXmlSerializerFunction.ts +104 -183
  409. package/src/modular/serialization/serializeUtils.ts +12 -21
  410. package/src/modular/static/rollup.test.config.js +11 -14
  411. package/src/modular/static/scripts/renameOutput.mjs +2 -2
  412. package/src/modular/static-helpers-metadata.ts +60 -60
  413. package/src/modular/type-expressions/get-credential-expression.ts +1 -1
  414. package/src/modular/type-expressions/get-enum-expression.ts +5 -10
  415. package/src/modular/type-expressions/get-model-expression.ts +13 -17
  416. package/src/modular/type-expressions/get-nullable-expression.ts +4 -5
  417. package/src/modular/type-expressions/get-type-expression.ts +8 -12
  418. package/src/modular/type-expressions/get-union-expression.ts +4 -4
  419. package/src/modular/type-expressions/utils.ts +1 -1
  420. package/src/rlc-common/buildClient.ts +70 -141
  421. package/src/rlc-common/buildClientDefinitions.ts +43 -87
  422. package/src/rlc-common/buildIndexFile.ts +78 -78
  423. package/src/rlc-common/buildIsUnexpectedHelper.ts +34 -41
  424. package/src/rlc-common/buildLogger.ts +7 -7
  425. package/src/rlc-common/buildMethodShortcuts.ts +9 -21
  426. package/src/rlc-common/buildObjectTypes.ts +78 -155
  427. package/src/rlc-common/buildPaginateHelper.ts +9 -12
  428. package/src/rlc-common/buildParameterTypes.ts +92 -137
  429. package/src/rlc-common/buildPollingHelper.ts +7 -7
  430. package/src/rlc-common/buildResponseTypes.ts +34 -57
  431. package/src/rlc-common/buildSamples.ts +3 -3
  432. package/src/rlc-common/buildSchemaType.ts +12 -29
  433. package/src/rlc-common/buildSerializeHelper.ts +5 -5
  434. package/src/rlc-common/buildTopLevelIndexFile.ts +12 -19
  435. package/src/rlc-common/helpers/apiVersionUtil.ts +5 -10
  436. package/src/rlc-common/helpers/importsUtil.ts +27 -30
  437. package/src/rlc-common/helpers/nameConstructors.ts +16 -50
  438. package/src/rlc-common/helpers/nameUtils.ts +19 -42
  439. package/src/rlc-common/helpers/operationHelpers.ts +14 -31
  440. package/src/rlc-common/helpers/pathUtils.ts +2 -7
  441. package/src/rlc-common/helpers/schemaHelpers.ts +4 -15
  442. package/src/rlc-common/helpers/shortcutMethods.ts +6 -15
  443. package/src/rlc-common/helpers/typeUtil.ts +4 -11
  444. package/src/rlc-common/helpers/valueGenerationUtil.ts +16 -39
  445. package/src/rlc-common/index.ts +28 -28
  446. package/src/rlc-common/interfaces.ts +3 -11
  447. package/src/rlc-common/metadata/buildApiExtractorConfig.ts +17 -24
  448. package/src/rlc-common/metadata/buildChangelogFile.ts +1 -1
  449. package/src/rlc-common/metadata/buildESLintConfig.ts +3 -5
  450. package/src/rlc-common/metadata/buildLicenseFile.ts +1 -1
  451. package/src/rlc-common/metadata/buildPackageFile.ts +27 -35
  452. package/src/rlc-common/metadata/buildReadmeFile.ts +16 -29
  453. package/src/rlc-common/metadata/buildRollupConfig.ts +5 -8
  454. package/src/rlc-common/metadata/buildSampleEnvFile.ts +2 -3
  455. package/src/rlc-common/metadata/buildTestConfig.ts +10 -10
  456. package/src/rlc-common/metadata/buildTsConfig.ts +32 -35
  457. package/src/rlc-common/metadata/buildVitestConfig.ts +4 -10
  458. package/src/rlc-common/metadata/buildWarpConfig.ts +3 -6
  459. package/src/rlc-common/metadata/packageJson/azurePackageCommon.ts +16 -25
  460. package/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.ts +29 -50
  461. package/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.ts +20 -31
  462. package/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.ts +11 -13
  463. package/src/rlc-common/metadata/packageJson/packageCommon.ts +32 -52
  464. package/src/rlc-common/test/buildKarmaConfig.ts +1 -1
  465. package/src/rlc-common/test/buildRecordedClient.ts +3 -3
  466. package/src/rlc-common/test/buildSampleTest.ts +3 -3
  467. package/src/rlc-common/test/buildSnippets.ts +6 -12
  468. package/src/rlc-common/transformSampleGroups.ts +54 -105
  469. package/src/testing/index.ts +2 -5
  470. package/src/transform/transform.ts +22 -34
  471. package/src/transform/transformApiVersionInfo.ts +17 -30
  472. package/src/transform/transformHelperFunctionDetails.ts +14 -26
  473. package/src/transform/transformParameters.ts +55 -105
  474. package/src/transform/transformPaths.ts +26 -43
  475. package/src/transform/transformResponses.ts +26 -33
  476. package/src/transform/transformSchemas.ts +15 -33
  477. package/src/transform/transformTelemetryInfo.ts +8 -14
  478. package/src/transform/transfromRLCOptions.ts +53 -115
  479. package/src/utils/clientUtils.ts +22 -41
  480. package/src/utils/credentialUtils.ts +8 -19
  481. package/src/utils/crossLanguageDef.ts +15 -34
  482. package/src/utils/emitUtil.ts +11 -17
  483. package/src/utils/fileSystemUtils.ts +4 -6
  484. package/src/utils/importHelper.ts +5 -10
  485. package/src/utils/interfaces.ts +1 -1
  486. package/src/utils/mediaTypes.ts +13 -34
  487. package/src/utils/modelUtils.ts +174 -383
  488. package/src/utils/namespaceUtils.ts +8 -24
  489. package/src/utils/operationUtil.ts +98 -190
  490. package/src/utils/parameterUtils.ts +31 -54
  491. package/src/utils/resolve-project-root.ts +3 -3
  492. package/static/static-helpers/cloudSettingHelpers.ts +4 -6
  493. package/static/static-helpers/multipartHelpers.ts +3 -3
  494. package/static/static-helpers/pagingHelpers.ts +28 -63
  495. package/static/static-helpers/pollingHelpers.ts +15 -28
  496. package/static/static-helpers/serialization/build-multi-collection.ts +1 -4
  497. package/static/static-helpers/serialization/check-prop-undefined.ts +1 -4
  498. package/static/static-helpers/serialization/get-binary-response.ts +2 -2
  499. package/static/static-helpers/serialization/get-binary-stream-response.ts +2 -4
  500. package/static/static-helpers/serialization/serialize-record.ts +1 -1
  501. package/static/static-helpers/serialization/serializers.ts +4 -7
  502. package/static/static-helpers/serialization/xml-helpers.ts +41 -89
  503. package/static/static-helpers/simplePollerHelpers.ts +9 -18
  504. package/static/static-helpers/storageCompatResponse.ts +10 -27
  505. package/static/static-helpers/urlTemplate.ts +4 -7
  506. package/static/test-helpers/recordedClient.ts +5 -10
@@ -1,37 +1,30 @@
1
- import {
2
- NameType,
3
- normalizeName,
4
- isAzurePackage
5
- } from "../rlc-common/index.js";
1
+ import { SdkClientType, SdkServiceOperation } from "@azure-tools/typespec-client-generator-core";
2
+ import { NoTarget } from "@typespec/compiler";
3
+ import { join } from "path/posix";
6
4
  import { Project, SourceFile } from "ts-morph";
5
+ import { useContext } from "../contextManager.js";
6
+ import { resolveReference } from "../framework/reference.js";
7
+ import { reportDiagnostic } from "../lib.js";
8
+ import { isAzurePackage, NameType, normalizeName } from "../rlc-common/index.js";
9
+ import { getModularClientOptions } from "../utils/clientUtils.js";
10
+ import { SdkContext } from "../utils/interfaces.js";
11
+ import { getMethodHierarchiesMap } from "../utils/operationUtil.js";
12
+ import { partitionAndEmitExports } from "./buildSubpathIndex.js";
7
13
  import { getClassicalClientName } from "./helpers/namingHelpers.js";
14
+ import { isLroOnlyOperation } from "./helpers/operationHelpers.js";
8
15
  import { ModularEmitterOptions } from "./interfaces.js";
9
- import { resolveReference } from "../framework/reference.js";
10
16
  import {
11
17
  CloudSettingHelpers,
12
18
  MultipartHelpers,
13
19
  PagingHelpers,
14
- PlatformTypeHelpers
20
+ PlatformTypeHelpers,
15
21
  } from "./static-helpers-metadata.js";
16
- import {
17
- SdkClientType,
18
- SdkServiceOperation
19
- } from "@azure-tools/typespec-client-generator-core";
20
- import { getModularClientOptions } from "../utils/clientUtils.js";
21
- import { getMethodHierarchiesMap } from "../utils/operationUtil.js";
22
- import { join } from "path/posix";
23
- import { useContext } from "../contextManager.js";
24
- import { reportDiagnostic } from "../lib.js";
25
- import { NoTarget } from "@typespec/compiler";
26
- import { isLroOnlyOperation } from "./helpers/operationHelpers.js";
27
- import { SdkContext } from "../utils/interfaces.js";
28
- import { partitionAndEmitExports } from "./buildSubpathIndex.js";
29
22
 
30
23
  export function buildRootIndex(
31
24
  context: SdkContext,
32
25
  emitterOptions: ModularEmitterOptions,
33
26
  rootIndexFile: SourceFile,
34
- clientMap?: [string[], SdkClientType<SdkServiceOperation>]
27
+ clientMap?: [string[], SdkClientType<SdkServiceOperation>],
35
28
  ) {
36
29
  if (!clientMap) {
37
30
  // we still need to export the models if no client is provided
@@ -47,47 +40,33 @@ export function buildRootIndex(
47
40
  const clientFile = project.getSourceFile(
48
41
  `${srcPath}/${subfolder && subfolder !== "" ? subfolder + "/" : ""}${normalizeName(
49
42
  clientName,
50
- NameType.File
51
- )}.ts`
43
+ NameType.File,
44
+ )}.ts`,
52
45
  );
53
46
 
54
47
  if (!clientFile) {
55
48
  reportDiagnostic(context.program, {
56
49
  code: "client-file-not-found",
57
50
  format: {
58
- filePath: `${srcPath}/${normalizeName(clientName, NameType.File)}.ts`
51
+ filePath: `${srcPath}/${normalizeName(clientName, NameType.File)}.ts`,
59
52
  },
60
- target: NoTarget
53
+ target: NoTarget,
61
54
  });
62
55
  return; // Skip exporting this client but continue with others
63
56
  }
64
57
 
65
58
  exportClassicalClient(client, rootIndexFile, subfolder ?? "");
66
- exportSimplePollerLike(
67
- context,
68
- clientMap,
69
- rootIndexFile,
70
- project,
71
- srcPath,
72
- subfolder
73
- );
74
- exportRestoreHelpers(
75
- rootIndexFile,
76
- project,
77
- srcPath,
78
- clientName,
79
- subfolder,
80
- true
81
- );
59
+ exportSimplePollerLike(context, clientMap, rootIndexFile, project, srcPath, subfolder);
60
+ exportRestoreHelpers(rootIndexFile, project, srcPath, clientName, subfolder, true);
82
61
  exportModels(emitterOptions, rootIndexFile, clientName);
83
62
  exportModules(rootIndexFile, project, srcPath, clientName, "api", {
84
63
  subfolder,
85
64
  interfaceOnly: true,
86
- isTopLevel: true
65
+ isTopLevel: true,
87
66
  });
88
67
  exportModules(rootIndexFile, project, srcPath, clientName, "classic", {
89
68
  subfolder,
90
- isTopLevel: true
69
+ isTopLevel: true,
91
70
  });
92
71
 
93
72
  exportPagingTypes(context, rootIndexFile);
@@ -99,20 +78,18 @@ export function buildRootIndex(
99
78
  function exportModels(
100
79
  emitterOptions: ModularEmitterOptions,
101
80
  rootIndexFile: SourceFile,
102
- clientName: string = ""
81
+ clientName: string = "",
103
82
  ) {
104
83
  // export models index file if not exists
105
84
  const project = useContext("outputProject");
106
85
  const srcPath = emitterOptions.modularOptions.sourceRoot;
107
- const modelsExportsIndex = rootIndexFile
108
- .getExportDeclarations()
109
- ?.find((i) => {
110
- return i.getModuleSpecifierValue()?.startsWith(`./models/`);
111
- });
86
+ const modelsExportsIndex = rootIndexFile.getExportDeclarations()?.find((i) => {
87
+ return i.getModuleSpecifierValue()?.startsWith(`./models/`);
88
+ });
112
89
  if (!modelsExportsIndex) {
113
90
  exportModules(rootIndexFile, project, srcPath, clientName, "models", {
114
91
  isTopLevel: true,
115
- recursive: true
92
+ recursive: true,
116
93
  });
117
94
  }
118
95
  }
@@ -120,13 +97,11 @@ function exportModels(
120
97
  function exportAzureCloudTypes(context: SdkContext, rootIndexFile: SourceFile) {
121
98
  if (context.arm) {
122
99
  // AzureClouds is an enum (runtime value), AzureSupportedClouds is a type alias
123
- addExportsToRootIndexFile(rootIndexFile, [
124
- resolveReference(CloudSettingHelpers.AzureClouds)
125
- ]);
100
+ addExportsToRootIndexFile(rootIndexFile, [resolveReference(CloudSettingHelpers.AzureClouds)]);
126
101
  addExportsToRootIndexFile(
127
102
  rootIndexFile,
128
103
  [resolveReference(CloudSettingHelpers.AzureSupportedClouds)],
129
- true
104
+ true,
130
105
  );
131
106
  }
132
107
  }
@@ -136,13 +111,11 @@ function exportRestErrorTypes(context: SdkContext, rootIndexFile: SourceFile) {
136
111
  return;
137
112
  }
138
113
  const existingExports = getExistingExports(rootIndexFile);
139
- const namedExports = ["RestError", "isRestError"].filter(
140
- (name) => !existingExports.has(name)
141
- );
114
+ const namedExports = ["RestError", "isRestError"].filter((name) => !existingExports.has(name));
142
115
  if (namedExports.length > 0) {
143
116
  rootIndexFile.addExportDeclaration({
144
117
  moduleSpecifier: "@azure/core-rest-pipeline",
145
- namedExports
118
+ namedExports,
146
119
  });
147
120
  }
148
121
  }
@@ -160,9 +133,9 @@ function exportPagingTypes(context: SdkContext, rootIndexFile: SourceFile) {
160
133
  [
161
134
  resolveReference(PagingHelpers.PageSettings),
162
135
  resolveReference(PagingHelpers.ContinuablePage),
163
- resolveReference(PagingHelpers.PagedAsyncIterableIterator)
136
+ resolveReference(PagingHelpers.PagedAsyncIterableIterator),
164
137
  ],
165
- true
138
+ true,
166
139
  );
167
140
  }
168
141
 
@@ -170,9 +143,7 @@ function hasPaging(context: SdkContext): boolean {
170
143
  return context.sdkPackage.clients.some((client) => {
171
144
  const methodMap = getMethodHierarchiesMap(context, client);
172
145
  for (const [_, operations] of methodMap) {
173
- if (
174
- operations.some((op) => op.kind === "paging" || op.kind === "lropaging")
175
- ) {
146
+ if (operations.some((op) => op.kind === "paging" || op.kind === "lropaging")) {
176
147
  return true;
177
148
  }
178
149
  }
@@ -180,14 +151,9 @@ function hasPaging(context: SdkContext): boolean {
180
151
  });
181
152
  }
182
153
 
183
- function exportFileContentsType(
184
- context: SdkContext,
185
- rootIndexFile: SourceFile
186
- ) {
154
+ function exportFileContentsType(context: SdkContext, rootIndexFile: SourceFile) {
187
155
  const hasMultipartFileParts = context.sdkPackage.models.some((x) =>
188
- x.properties.some(
189
- (y) => y.kind === "property" && y.multipartOptions?.isFilePart
190
- )
156
+ x.properties.some((y) => y.kind === "property" && y.multipartOptions?.isFilePart),
191
157
  );
192
158
 
193
159
  if (hasMultipartFileParts) {
@@ -195,9 +161,9 @@ function exportFileContentsType(
195
161
  rootIndexFile,
196
162
  [
197
163
  resolveReference(MultipartHelpers.FileContents),
198
- resolveReference(PlatformTypeHelpers.NodeReadableStream)
164
+ resolveReference(PlatformTypeHelpers.NodeReadableStream),
199
165
  ],
200
- true
166
+ true,
201
167
  );
202
168
  }
203
169
  }
@@ -207,31 +173,26 @@ function getExistingExports(rootIndexFile: SourceFile): Set<string> {
207
173
  rootIndexFile
208
174
  .getExportDeclarations()
209
175
  .flatMap((exportDecl) =>
210
- exportDecl.getNamedExports().map((namedExport) => namedExport.getName())
211
- )
176
+ exportDecl.getNamedExports().map((namedExport) => namedExport.getName()),
177
+ ),
212
178
  );
213
179
  }
214
180
 
215
- function getNewNamedExports(
216
- namedExports: string[],
217
- existingExports: Set<string>
218
- ): string[] {
219
- return namedExports.filter(
220
- (namedExport) => !existingExports.has(namedExport)
221
- );
181
+ function getNewNamedExports(namedExports: string[], existingExports: Set<string>): string[] {
182
+ return namedExports.filter((namedExport) => !existingExports.has(namedExport));
222
183
  }
223
184
 
224
185
  function addExportsToRootIndexFile(
225
186
  rootIndexFile: SourceFile,
226
187
  namedExports: string[],
227
- isTypeOnly: boolean = false
188
+ isTypeOnly: boolean = false,
228
189
  ) {
229
190
  const existingExports = getExistingExports(rootIndexFile);
230
191
  const newNamedExports = getNewNamedExports(namedExports, existingExports);
231
192
  if (newNamedExports.length > 0) {
232
193
  rootIndexFile.addExportDeclaration({
233
194
  isTypeOnly,
234
- namedExports: newNamedExports
195
+ namedExports: newNamedExports,
235
196
  });
236
197
  }
237
198
  }
@@ -243,7 +204,7 @@ function exportSimplePollerLike(
243
204
  project: Project,
244
205
  srcPath: string,
245
206
  subfolder: string = "",
246
- isTopLevel: boolean = false
207
+ isTopLevel: boolean = false,
247
208
  ) {
248
209
  const [_, client] = clientMap;
249
210
 
@@ -257,7 +218,7 @@ function exportSimplePollerLike(
257
218
  const helperFile = project.getSourceFile(
258
219
  `${srcPath}/${
259
220
  subfolder && subfolder !== "" ? subfolder + "/" : ""
260
- }static-helpers/simplePollerHelpers.ts`
221
+ }static-helpers/simplePollerHelpers.ts`,
261
222
  );
262
223
  if (!helperFile) {
263
224
  return;
@@ -268,7 +229,7 @@ function exportSimplePollerLike(
268
229
  indexFile.addExportDeclaration({
269
230
  isTypeOnly: true,
270
231
  moduleSpecifier,
271
- namedExports: ["SimplePollerLike"]
232
+ namedExports: ["SimplePollerLike"],
272
233
  });
273
234
  }
274
235
 
@@ -278,12 +239,10 @@ function exportRestoreHelpers(
278
239
  srcPath: string,
279
240
  clientName: string,
280
241
  subfolder: string = "",
281
- isTopLevel: boolean = false
242
+ isTopLevel: boolean = false,
282
243
  ) {
283
244
  const helperFile = project.getSourceFile(
284
- `${srcPath}/${
285
- subfolder && subfolder !== "" ? subfolder + "/" : ""
286
- }restorePollerHelpers.ts`
245
+ `${srcPath}/${subfolder && subfolder !== "" ? subfolder + "/" : ""}restorePollerHelpers.ts`,
287
246
  );
288
247
  if (!helperFile) {
289
248
  return;
@@ -293,8 +252,7 @@ function exportRestoreHelpers(
293
252
  const moduleSpecifier = `./${
294
253
  isTopLevel && subfolder && subfolder !== "" ? subfolder + "/" : ""
295
254
  }restorePollerHelpers.js`;
296
- const renamer = (name: string) =>
297
- exported.has(name) ? `${name} as ${clientName}${name}` : name;
255
+ const renamer = (name: string) => (exported.has(name) ? `${name} as ${clientName}${name}` : name);
298
256
  partitionAndEmitExports(indexFile, moduleSpecifier, allEntries, renamer);
299
257
  }
300
258
 
@@ -302,14 +260,14 @@ function exportClassicalClient(
302
260
  client: SdkClientType<SdkServiceOperation>,
303
261
  indexFile: SourceFile,
304
262
  subfolder: string,
305
- isSubClient: boolean = false
263
+ isSubClient: boolean = false,
306
264
  ) {
307
265
  const clientName = client.name;
308
266
  indexFile.addExportDeclaration({
309
267
  namedExports: [clientName],
310
268
  moduleSpecifier: `./${
311
269
  subfolder && subfolder !== "" && !isSubClient ? subfolder + "/" : ""
312
- }${normalizeName(clientName, NameType.File)}.js`
270
+ }${normalizeName(clientName, NameType.File)}.js`,
313
271
  });
314
272
  }
315
273
 
@@ -330,8 +288,8 @@ function exportModules(
330
288
  interfaceOnly: false,
331
289
  isTopLevel: false,
332
290
  subfolder: "",
333
- recursive: false
334
- }
291
+ recursive: false,
292
+ },
335
293
  ) {
336
294
  const subfolder = options.subfolder ?? "";
337
295
  let folders = [];
@@ -340,10 +298,7 @@ function exportModules(
340
298
  .getDirectories()
341
299
  .filter((dir) => {
342
300
  const formattedDir = dir.getPath().replace(/\\/g, "/");
343
- const targetPath = join(srcPath, subfolder, moduleName).replace(
344
- /\\/g,
345
- "/"
346
- );
301
+ const targetPath = join(srcPath, subfolder, moduleName).replace(/\\/g, "/");
347
302
  return formattedDir.startsWith(targetPath);
348
303
  })
349
304
  .map((dir) => {
@@ -354,10 +309,7 @@ function exportModules(
354
309
  .getDirectories()
355
310
  .filter((dir) => {
356
311
  const formattedDir = dir.getPath().replace(/\\/g, "/");
357
- const targetPath = join(srcPath, subfolder, moduleName).replace(
358
- /\\/g,
359
- "/"
360
- );
312
+ const targetPath = join(srcPath, subfolder, moduleName).replace(/\\/g, "/");
361
313
  return formattedDir.startsWith(targetPath);
362
314
  })
363
315
  .map((dir) => {
@@ -375,37 +327,30 @@ function exportModules(
375
327
 
376
328
  const exported = new Set(indexFile.getExportedDeclarations().keys());
377
329
  const serializerOrDeserializerRegex = /.*(Serializer|Deserializer)(_\d+)?$/;
378
- const filteredEntries = [
379
- ...modelsFile.getExportedDeclarations().entries()
380
- ].filter((exDeclaration) => {
381
- if (exDeclaration[0].startsWith("_")) {
382
- return false;
383
- }
384
- return exDeclaration[1].some((ex) => {
385
- if (
386
- options.interfaceOnly &&
387
- ex.getKindName() !== "InterfaceDeclaration"
388
- ) {
389
- return false;
390
- }
391
- if (
392
- moduleName === "models" &&
393
- ex.getKindName() === "FunctionDeclaration" &&
394
- serializerOrDeserializerRegex.test(exDeclaration[0])
395
- ) {
396
- return false;
397
- }
398
- if (
399
- options.interfaceOnly &&
400
- options.isTopLevel &&
401
- exDeclaration[0].endsWith("Context")
402
- ) {
330
+ const filteredEntries = [...modelsFile.getExportedDeclarations().entries()].filter(
331
+ (exDeclaration) => {
332
+ if (exDeclaration[0].startsWith("_")) {
403
333
  return false;
404
334
  }
335
+ return exDeclaration[1].some((ex) => {
336
+ if (options.interfaceOnly && ex.getKindName() !== "InterfaceDeclaration") {
337
+ return false;
338
+ }
339
+ if (
340
+ moduleName === "models" &&
341
+ ex.getKindName() === "FunctionDeclaration" &&
342
+ serializerOrDeserializerRegex.test(exDeclaration[0])
343
+ ) {
344
+ return false;
345
+ }
346
+ if (options.interfaceOnly && options.isTopLevel && exDeclaration[0].endsWith("Context")) {
347
+ return false;
348
+ }
405
349
 
406
- return true;
407
- });
408
- });
350
+ return true;
351
+ });
352
+ },
353
+ );
409
354
  const moduleSpecifier = `.${modelsFile
410
355
  .getFilePath()
411
356
  .replace(indexFile.getDirectoryPath(), "")
@@ -413,19 +358,14 @@ function exportModules(
413
358
  .replace(".ts", "")}.js`;
414
359
  const renamer = (name: string) =>
415
360
  exported.has(name) ? `${name} as ${clientName}${name}` : name;
416
- partitionAndEmitExports(
417
- indexFile,
418
- moduleSpecifier,
419
- filteredEntries,
420
- renamer
421
- );
361
+ partitionAndEmitExports(indexFile, moduleSpecifier, filteredEntries, renamer);
422
362
  }
423
363
  }
424
364
 
425
365
  export function buildSubClientIndexFile(
426
366
  context: SdkContext,
427
367
  clientMap: [string[], SdkClientType<SdkServiceOperation>],
428
- emitterOptions: ModularEmitterOptions
368
+ emitterOptions: ModularEmitterOptions,
429
369
  ) {
430
370
  const project = useContext("outputProject");
431
371
  const [_, client] = clientMap;
@@ -434,7 +374,7 @@ export function buildSubClientIndexFile(
434
374
  const subClientIndexFile = project.createSourceFile(
435
375
  `${srcPath}/${subfolder && subfolder !== "" ? subfolder + "/" : ""}index.ts`,
436
376
  undefined,
437
- { overwrite: true }
377
+ { overwrite: true },
438
378
  );
439
379
  const clientName = `${getClassicalClientName(client)}`;
440
380
  const clientFilePath = `${srcPath}/${
@@ -446,35 +386,22 @@ export function buildSubClientIndexFile(
446
386
  reportDiagnostic(context.program, {
447
387
  code: "client-file-not-found",
448
388
  format: {
449
- filePath: clientFilePath
389
+ filePath: clientFilePath,
450
390
  },
451
- target: NoTarget
391
+ target: NoTarget,
452
392
  });
453
393
  return; // Skip exporting this client but continue with others
454
394
  }
455
395
 
456
396
  exportClassicalClient(client, subClientIndexFile, subfolder ?? "", true);
457
- exportSimplePollerLike(
458
- context,
459
- clientMap,
460
- subClientIndexFile,
461
- project,
462
- srcPath,
463
- subfolder
464
- );
465
- exportRestoreHelpers(
466
- subClientIndexFile,
467
- project,
468
- srcPath,
469
- clientName,
470
- subfolder
471
- );
397
+ exportSimplePollerLike(context, clientMap, subClientIndexFile, project, srcPath, subfolder);
398
+ exportRestoreHelpers(subClientIndexFile, project, srcPath, clientName, subfolder);
472
399
  exportModules(subClientIndexFile, project, srcPath, clientName, "api", {
473
400
  subfolder,
474
401
  interfaceOnly: true,
475
- recursive: true
402
+ recursive: true,
476
403
  });
477
404
  exportModules(subClientIndexFile, project, srcPath, clientName, "classic", {
478
- subfolder
405
+ subfolder,
479
406
  });
480
407
  }
@@ -1,13 +1,10 @@
1
- import {
2
- SdkClientType,
3
- SdkServiceOperation
4
- } from "@azure-tools/typespec-client-generator-core";
1
+ import { SdkClientType, SdkServiceOperation } from "@azure-tools/typespec-client-generator-core";
5
2
  import { ModularEmitterOptions } from "./interfaces.js";
6
3
 
7
4
  import { join } from "path";
8
- import { getModularClientOptions } from "../utils/clientUtils.js";
9
- import { useContext } from "../contextManager.js";
10
5
  import { Node, SourceFile } from "ts-morph";
6
+ import { useContext } from "../contextManager.js";
7
+ import { getModularClientOptions } from "../utils/clientUtils.js";
11
8
 
12
9
  export interface buildSubpathIndexFileOptions {
13
10
  exportIndex?: boolean;
@@ -19,12 +16,10 @@ export function buildSubpathIndexFile(
19
16
  emitterOptions: ModularEmitterOptions,
20
17
  subpath: string,
21
18
  clientMap?: [string[], SdkClientType<SdkServiceOperation>],
22
- options: buildSubpathIndexFileOptions = {}
19
+ options: buildSubpathIndexFileOptions = {},
23
20
  ) {
24
21
  const project = useContext("outputProject");
25
- const subfolder = clientMap
26
- ? (getModularClientOptions(clientMap).subfolder ?? "")
27
- : "";
22
+ const subfolder = clientMap ? (getModularClientOptions(clientMap).subfolder ?? "") : "";
28
23
  const srcPath = emitterOptions.modularOptions.sourceRoot;
29
24
  // Skip to export these files because they are used internally.
30
25
  const skipFiles = ["pagingHelpers.ts", "pollingHelpers.ts"];
@@ -34,13 +29,9 @@ export function buildSubpathIndexFile(
34
29
  .getDirectories()
35
30
  .filter((dir) => {
36
31
  const formattedDir = dir.getPath().replace(/\\/g, "/");
37
- const targetPath = join(srcPath, subfolder, subpath).replace(
38
- /\\/g,
39
- "/"
40
- );
32
+ const targetPath = join(srcPath, subfolder, subpath).replace(/\\/g, "/");
41
33
  return (
42
- formattedDir.startsWith(targetPath) &&
43
- !project.getSourceFile(`${formattedDir}/index.ts`)
34
+ formattedDir.startsWith(targetPath) && !project.getSourceFile(`${formattedDir}/index.ts`)
44
35
  );
45
36
  })
46
37
  .map((dir) => {
@@ -50,21 +41,16 @@ export function buildSubpathIndexFile(
50
41
  folders = [join(srcPath, subfolder, subpath).replace(/\\/g, "/")];
51
42
  }
52
43
  for (const folder of folders) {
53
- const apiFilePattern =
54
- subpath === "models" ? join(folder, "models.ts") : folder;
44
+ const apiFilePattern = subpath === "models" ? join(folder, "models.ts") : folder;
55
45
  const apiFiles = project.getSourceFiles().filter((file) => {
56
46
  if (subpath === "api" && options.recursive) {
57
- return (
58
- file.getDirectoryPath().replace(/\\/g, "/") ===
59
- apiFilePattern.replace(/\\/g, "/")
60
- );
47
+ return file.getDirectoryPath().replace(/\\/g, "/") === apiFilePattern.replace(/\\/g, "/");
61
48
  }
62
49
  return file
63
50
  .getFilePath()
64
51
  .replace(/\\/g, "/")
65
52
  .startsWith(
66
- apiFilePattern.replace(/\\/g, "/") +
67
- (apiFilePattern.endsWith("models.ts") ? "" : "/")
53
+ apiFilePattern.replace(/\\/g, "/") + (apiFilePattern.endsWith("models.ts") ? "" : "/"),
68
54
  );
69
55
  });
70
56
  if (apiFiles.length === 0) {
@@ -73,8 +59,7 @@ export function buildSubpathIndexFile(
73
59
  const indexFile = project.createSourceFile(`${folder}/index.ts`);
74
60
  for (const file of apiFiles) {
75
61
  const filePath = file.getFilePath();
76
- const serializerOrDeserializerRegex =
77
- /.*(Serializer|Deserializer)(_\d+)?$/;
62
+ const serializerOrDeserializerRegex = /.*(Serializer|Deserializer)(_\d+)?$/;
78
63
  if (!options.exportIndex && filePath.endsWith("index.ts")) {
79
64
  continue;
80
65
  }
@@ -86,37 +71,33 @@ export function buildSubpathIndexFile(
86
71
  continue;
87
72
  }
88
73
 
89
- let filteredDeclarations = [
90
- ...file.getExportedDeclarations().entries()
91
- ].filter((exDeclaration) => {
92
- if (exDeclaration[0].startsWith("_")) {
93
- return false;
94
- }
95
- return exDeclaration[1].some((ex) => {
96
- if (
97
- options.interfaceOnly &&
98
- ex.getKindName() !== "InterfaceDeclaration"
99
- ) {
74
+ let filteredDeclarations = [...file.getExportedDeclarations().entries()].filter(
75
+ (exDeclaration) => {
76
+ if (exDeclaration[0].startsWith("_")) {
100
77
  return false;
101
78
  }
79
+ return exDeclaration[1].some((ex) => {
80
+ if (options.interfaceOnly && ex.getKindName() !== "InterfaceDeclaration") {
81
+ return false;
82
+ }
102
83
 
103
- // skip exporting serializers for models
104
- if (
105
- subpath === "models" &&
106
- ex.getKindName() === "FunctionDeclaration" &&
107
- serializerOrDeserializerRegex.test(exDeclaration[0])
108
- ) {
109
- return false;
110
- }
84
+ // skip exporting serializers for models
85
+ if (
86
+ subpath === "models" &&
87
+ ex.getKindName() === "FunctionDeclaration" &&
88
+ serializerOrDeserializerRegex.test(exDeclaration[0])
89
+ ) {
90
+ return false;
91
+ }
111
92
 
112
- return true;
113
- });
114
- });
93
+ return true;
94
+ });
95
+ },
96
+ );
115
97
  // Skip to export PagedResult and BuildPagedAsyncIteratorOptions
116
98
  if (filePath.endsWith("pagingTypes.ts")) {
117
99
  filteredDeclarations = filteredDeclarations.filter(
118
- ([name]) =>
119
- !["PagedResult", "BuildPagedAsyncIteratorOptions"].includes(name)
100
+ ([name]) => !["PagedResult", "BuildPagedAsyncIteratorOptions"].includes(name),
120
101
  );
121
102
  }
122
103
  if (filteredDeclarations.length > 0) {
@@ -124,11 +105,7 @@ export function buildSubpathIndexFile(
124
105
  .replace(indexFile.getDirectoryPath(), "")
125
106
  .replace(/\\/g, "/")
126
107
  .replace(".ts", "")}.js`;
127
- partitionAndEmitExports(
128
- indexFile,
129
- moduleSpecifier,
130
- filteredDeclarations
131
- );
108
+ partitionAndEmitExports(indexFile, moduleSpecifier, filteredDeclarations);
132
109
  }
133
110
  }
134
111
  }
@@ -147,7 +124,7 @@ export function partitionAndEmitExports(
147
124
  indexFile: SourceFile,
148
125
  moduleSpecifier: string,
149
126
  entries: [string, Node[]][],
150
- mapName: (name: string) => string = (n) => n
127
+ mapName: (name: string) => string = (n) => n,
151
128
  ): void {
152
129
  const typeOnlyExports: string[] = [];
153
130
  const valueExports: string[] = [];
@@ -163,13 +140,13 @@ export function partitionAndEmitExports(
163
140
  indexFile.addExportDeclaration({
164
141
  isTypeOnly: true,
165
142
  moduleSpecifier,
166
- namedExports: typeOnlyExports
143
+ namedExports: typeOnlyExports,
167
144
  });
168
145
  }
169
146
  if (valueExports.length > 0) {
170
147
  indexFile.addExportDeclaration({
171
148
  moduleSpecifier,
172
- namedExports: valueExports
149
+ namedExports: valueExports,
173
150
  });
174
151
  }
175
152
  }