@azure-tools/typespec-ts 0.54.0-dev.5 → 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 -5
  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 -116
  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,25 +1,21 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
3
 
4
+ import * as path from "path";
4
5
  import {
5
6
  InterfaceDeclarationStructure,
6
7
  OptionalKind,
7
8
  Project,
8
9
  PropertySignatureStructure,
9
- StructureKind
10
+ StructureKind,
10
11
  } from "ts-morph";
11
- import {
12
- ResponseHeaderSchema,
13
- ResponseMetadata,
14
- RLCModel
15
- } from "./interfaces.js";
16
- import * as path from "path";
12
+ import { getImportSpecifier } from "./helpers/importsUtil.js";
17
13
  import {
18
14
  getImportModuleName,
19
15
  getResponseBaseName,
20
- getResponseTypeName
16
+ getResponseTypeName,
21
17
  } from "./helpers/nameConstructors.js";
22
- import { getImportSpecifier } from "./helpers/importsUtil.js";
18
+ import { ResponseHeaderSchema, ResponseMetadata, RLCModel } from "./interfaces.js";
23
19
 
24
20
  let hasErrorResponse = false;
25
21
  export function buildResponseTypes(model: RLCModel) {
@@ -28,7 +24,7 @@ export function buildResponseTypes(model: RLCModel) {
28
24
  const filePath = path.join(srcPath, `responses.ts`);
29
25
  hasErrorResponse = false;
30
26
  const responsesFile = project.createSourceFile(filePath, undefined, {
31
- overwrite: true
27
+ overwrite: true,
32
28
  });
33
29
  // Set used to track down which models need to be imported
34
30
  // Track if we need to import RawHttpHeaders
@@ -42,7 +38,7 @@ export function buildResponseTypes(model: RLCModel) {
42
38
  const baseResponseName = getResponseBaseName(
43
39
  operationResponse.operationGroup,
44
40
  operationResponse.operationName,
45
- response.statusCode
41
+ response.statusCode,
46
42
  );
47
43
 
48
44
  // Build the response header
@@ -54,27 +50,20 @@ export function buildResponseTypes(model: RLCModel) {
54
50
  }
55
51
 
56
52
  // Get the information to build the Response Interface
57
- const responseTypeName =
58
- response.predefinedName ?? getResponseTypeName(baseResponseName);
59
- const responseProperties = getResponseInterfaceProperties(
60
- response,
61
- headersInterface?.name
62
- );
53
+ const responseTypeName = response.predefinedName ?? getResponseTypeName(baseResponseName);
54
+ const responseProperties = getResponseInterfaceProperties(response, headersInterface?.name);
63
55
 
64
- const responseInterfaceDefinition: OptionalKind<InterfaceDeclarationStructure> =
65
- {
66
- name: responseTypeName,
67
- properties: responseProperties,
68
- isExported: true,
69
- extends: ["HttpResponse"]
70
- };
56
+ const responseInterfaceDefinition: OptionalKind<InterfaceDeclarationStructure> = {
57
+ name: responseTypeName,
58
+ properties: responseProperties,
59
+ isExported: true,
60
+ extends: ["HttpResponse"],
61
+ };
71
62
 
72
63
  // Only add a description if one was provided in the Swagger
73
64
  // otherwise skip to avoid having empty TSDoc lines
74
65
  if (response.description) {
75
- responseInterfaceDefinition.docs = [
76
- { description: response.description }
77
- ];
66
+ responseInterfaceDefinition.docs = [{ description: response.description }];
78
67
  }
79
68
 
80
69
  // Add the response interface to the responses file
@@ -87,11 +76,8 @@ export function buildResponseTypes(model: RLCModel) {
87
76
  {
88
77
  isTypeOnly: true,
89
78
  namedImports: ["RawHttpHeaders"],
90
- moduleSpecifier: getImportSpecifier(
91
- "restPipeline",
92
- model.importInfo.runtimeImports
93
- )
94
- }
79
+ moduleSpecifier: getImportSpecifier("restPipeline", model.importInfo.runtimeImports),
80
+ },
95
81
  ]);
96
82
  }
97
83
  const namedImports = ["HttpResponse"];
@@ -102,16 +88,13 @@ export function buildResponseTypes(model: RLCModel) {
102
88
  {
103
89
  isTypeOnly: true,
104
90
  namedImports,
105
- moduleSpecifier: getImportSpecifier(
106
- "restClient",
107
- model.importInfo.runtimeImports
108
- )
109
- }
91
+ moduleSpecifier: getImportSpecifier("restClient", model.importInfo.runtimeImports),
92
+ },
110
93
  ]);
111
94
 
112
95
  if ((model.importInfo.internalImports.response?.importsSet?.size ?? 0) > 0) {
113
96
  const modelNamedImports = Array.from(
114
- model.importInfo.internalImports.response!.importsSet!
97
+ model.importInfo.internalImports.response!.importsSet!,
115
98
  ).filter((modelName) => {
116
99
  return !(modelName === "ErrorResponseOutput" && hasErrorResponse);
117
100
  });
@@ -122,11 +105,11 @@ export function buildResponseTypes(model: RLCModel) {
122
105
  moduleSpecifier: getImportModuleName(
123
106
  {
124
107
  cjsName: `./outputModels`,
125
- esModulesName: `./outputModels.js`
108
+ esModulesName: `./outputModels.js`,
126
109
  },
127
- model
128
- )
129
- }
110
+ model,
111
+ ),
112
+ },
130
113
  ]);
131
114
  }
132
115
  return { path: filePath, content: responsesFile.getFullText() };
@@ -134,7 +117,7 @@ export function buildResponseTypes(model: RLCModel) {
134
117
 
135
118
  function getResponseHeaderInterfaceDefinition(
136
119
  response: ResponseMetadata,
137
- baseName: string
120
+ baseName: string,
138
121
  ): undefined | InterfaceDeclarationStructure {
139
122
  // Check if there are any required headers
140
123
  if (!response.headers) {
@@ -151,35 +134,29 @@ function getResponseHeaderInterfaceDefinition(
151
134
  name: h.name,
152
135
  ...(description && { docs: [{ description }] }),
153
136
  type: h.type,
154
- hasQuestionToken: !h.required
137
+ hasQuestionToken: !h.required,
155
138
  };
156
- })
139
+ }),
157
140
  };
158
141
  }
159
142
 
160
143
  /**
161
144
  * Gets the properties that need to be part of the response interface
162
145
  */
163
- function getResponseInterfaceProperties(
164
- response: ResponseMetadata,
165
- headersInterfaceName?: string
166
- ) {
146
+ function getResponseInterfaceProperties(response: ResponseMetadata, headersInterfaceName?: string) {
167
147
  const statusCode = response.statusCode;
168
148
  const responseProperties: PropertySignatureStructure[] = [
169
149
  {
170
150
  name: "status",
171
151
  type: statusCode === "default" ? `string` : `"${statusCode}"`,
172
- kind: StructureKind.PropertySignature
173
- }
152
+ kind: StructureKind.PropertySignature,
153
+ },
174
154
  ];
175
155
 
176
156
  if (response.body) {
177
157
  const description = response.body.description;
178
158
  let type = response.body.type;
179
- if (
180
- response.body.type === "ErrorResponseOutput" &&
181
- response.body.fromCore
182
- ) {
159
+ if (response.body.type === "ErrorResponseOutput" && response.body.fromCore) {
183
160
  type = "ErrorResponse";
184
161
  hasErrorResponse = true;
185
162
  }
@@ -187,7 +164,7 @@ function getResponseInterfaceProperties(
187
164
  name: "body",
188
165
  type,
189
166
  kind: StructureKind.PropertySignature,
190
- ...(description && { docs: [{ description }] })
167
+ ...(description && { docs: [{ description }] }),
191
168
  });
192
169
  }
193
170
 
@@ -195,7 +172,7 @@ function getResponseInterfaceProperties(
195
172
  responseProperties.push({
196
173
  name: "headers",
197
174
  type: `RawHttpHeaders & ${headersInterfaceName}`,
198
- kind: StructureKind.PropertySignature
175
+ kind: StructureKind.PropertySignature,
199
176
  });
200
177
  }
201
178
 
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
3
 
4
- import { RLCModel, RLCSampleGroup, File as RLCFile } from "./interfaces.js";
4
+ import { File as RLCFile, RLCModel, RLCSampleGroup } from "./interfaces.js";
5
5
  import { sampleTemplate } from "./static/sampleTemplate.js";
6
6
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
7
7
  // @ts-ignore: to fix the handlebars issue
@@ -20,12 +20,12 @@ export function buildSamples(model: RLCModel) {
20
20
  const sampleFiles: RLCFile[] = [];
21
21
  for (const sampleGroup of sampleGroups) {
22
22
  const sampleGroupFileContents = hbs.compile(sampleTemplate, {
23
- noEscape: true
23
+ noEscape: true,
24
24
  });
25
25
  const filePath = path.join("samples-dev", `${sampleGroup.filename}.ts`);
26
26
  sampleFiles.push({
27
27
  path: filePath,
28
- content: sampleGroupFileContents(sampleGroup)
28
+ content: sampleGroupFileContents(sampleGroup),
29
29
  });
30
30
  }
31
31
  return sampleFiles;
@@ -1,15 +1,15 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
3
 
4
- import { Project } from "ts-morph";
5
4
  import * as path from "path";
5
+ import { Project } from "ts-morph";
6
6
  import {
7
7
  buildObjectAliases,
8
8
  buildObjectInterfaces,
9
- buildPolymorphicAliases
9
+ buildPolymorphicAliases,
10
10
  } from "./buildObjectTypes.js";
11
- import { RLCModel, SchemaContext } from "./interfaces.js";
12
11
  import { getImportSpecifier } from "./helpers/importsUtil.js";
12
+ import { RLCModel, SchemaContext } from "./interfaces.js";
13
13
 
14
14
  /**
15
15
  * Generates types to represent schema definitions in the swagger
@@ -18,13 +18,11 @@ export function buildSchemaTypes(model: RLCModel) {
18
18
  const { srcPath } = model;
19
19
  const project = new Project();
20
20
  let filePath = path.join(srcPath, `models.ts`);
21
- const inputModelFile = generateModelFiles(model, project, filePath, [
22
- SchemaContext.Input
23
- ]);
21
+ const inputModelFile = generateModelFiles(model, project, filePath, [SchemaContext.Input]);
24
22
  filePath = path.join(srcPath, `outputModels.ts`);
25
23
  const outputModelFile = generateModelFiles(model, project, filePath, [
26
24
  SchemaContext.Output,
27
- SchemaContext.Exception
25
+ SchemaContext.Exception,
28
26
  ]);
29
27
  return { inputModelFile, outputModelFile };
30
28
  }
@@ -33,31 +31,19 @@ export function generateModelFiles(
33
31
  model: RLCModel,
34
32
  project: Project,
35
33
  filePath: string,
36
- schemaContext: SchemaContext[]
34
+ schemaContext: SchemaContext[],
37
35
  ) {
38
36
  // Track models that need to be imported
39
37
  const importedModels = new Set<string>();
40
- const objectsDefinitions = buildObjectInterfaces(
41
- model,
42
- importedModels,
43
- schemaContext
44
- );
38
+ const objectsDefinitions = buildObjectInterfaces(model, importedModels, schemaContext);
45
39
 
46
40
  const objectTypeAliases = buildPolymorphicAliases(model, schemaContext);
47
41
 
48
- const objectAliases = buildObjectAliases(
49
- model,
50
- importedModels,
51
- schemaContext
52
- );
42
+ const objectAliases = buildObjectAliases(model, importedModels, schemaContext);
53
43
 
54
- if (
55
- objectTypeAliases.length ||
56
- objectsDefinitions.length ||
57
- objectAliases.length
58
- ) {
44
+ if (objectTypeAliases.length || objectsDefinitions.length || objectAliases.length) {
59
45
  const modelsFile = project.createSourceFile(filePath, undefined, {
60
- overwrite: true
46
+ overwrite: true,
61
47
  });
62
48
 
63
49
  modelsFile.addInterfaces(objectsDefinitions);
@@ -68,11 +54,8 @@ export function generateModelFiles(
68
54
  {
69
55
  isTypeOnly: true,
70
56
  namedImports: [...Array.from(importedModels || [])],
71
- moduleSpecifier: getImportSpecifier(
72
- "restClient",
73
- model.importInfo.runtimeImports
74
- )
75
- }
57
+ moduleSpecifier: getImportSpecifier("restClient", model.importInfo.runtimeImports),
58
+ },
76
59
  ]);
77
60
  }
78
61
  return { path: filePath, content: modelsFile.getFullText() };
@@ -1,5 +1,5 @@
1
- import { RLCModel } from "./interfaces.js";
2
1
  import * as path from "path";
2
+ import { RLCModel } from "./interfaces.js";
3
3
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4
4
  // @ts-ignore: to fix the handlebars issue
5
5
  import hbs from "handlebars";
@@ -8,14 +8,14 @@ import {
8
8
  hasMultiCollection,
9
9
  hasPipeCollection,
10
10
  hasSsvCollection,
11
- hasTsvCollection
11
+ hasTsvCollection,
12
12
  } from "./helpers/operationHelpers.js";
13
13
  import {
14
14
  buildCsvCollectionContent,
15
15
  buildMultiCollectionContent,
16
16
  buildPipeCollectionContent,
17
17
  buildSsvCollectionContent,
18
- buildTsvCollectionContent
18
+ buildTsvCollectionContent,
19
19
  } from "./static/serializeHelper.js";
20
20
 
21
21
  export function buildSerializeHelper(model: RLCModel) {
@@ -37,12 +37,12 @@ export function buildSerializeHelper(model: RLCModel) {
37
37
  }
38
38
  if (serializeHelperContent !== "") {
39
39
  const readmeFileContents = hbs.compile(serializeHelperContent, {
40
- noEscape: true
40
+ noEscape: true,
41
41
  });
42
42
  const { srcPath } = model;
43
43
  return {
44
44
  path: path.join(srcPath, "serializeHelper.ts"),
45
- content: readmeFileContents({})
45
+ content: readmeFileContents({}),
46
46
  };
47
47
  }
48
48
  return undefined;
@@ -1,12 +1,12 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
3
 
4
- import { NameType, normalizeName } from "./helpers/nameUtils.js";
5
- import { RLCModel } from "./interfaces.js";
6
- import { Project } from "ts-morph";
7
4
  import * as path from "path";
8
- import { getRelativePartFromSrcPath } from "./helpers/pathUtils.js";
5
+ import { Project } from "ts-morph";
9
6
  import { getImportModuleName } from "./helpers/nameConstructors.js";
7
+ import { NameType, normalizeName } from "./helpers/nameUtils.js";
8
+ import { getRelativePartFromSrcPath } from "./helpers/pathUtils.js";
9
+ import { RLCModel } from "./interfaces.js";
10
10
 
11
11
  const batchOutputFolder: [string, string, string][] = [];
12
12
 
@@ -21,19 +21,12 @@ export function buildTopLevelIndex(model: RLCModel) {
21
21
  if (srcPath) {
22
22
  const clientName = model.libraryName;
23
23
  const moduleName = normalizeName(clientName, NameType.File);
24
- const relativePath =
25
- "./" +
26
- getRelativePartFromSrcPath(srcPath, model.options.isModularLibrary);
24
+ const relativePath = "./" + getRelativePartFromSrcPath(srcPath, model.options.isModularLibrary);
27
25
  batchOutputFolder.push([relativePath, clientName, moduleName]);
28
26
  }
29
- if (
30
- multiClient &&
31
- batch &&
32
- batch.length > 1 &&
33
- batchOutputFolder.length === batch.length
34
- ) {
27
+ if (multiClient && batch && batch.length > 1 && batchOutputFolder.length === batch.length) {
35
28
  const indexFile = project.createSourceFile("index.ts", undefined, {
36
- overwrite: true
29
+ overwrite: true,
37
30
  });
38
31
  const allModules: string[] = [];
39
32
  batchOutputFolder.forEach((item) => {
@@ -43,21 +36,21 @@ export function buildTopLevelIndex(model: RLCModel) {
43
36
  moduleSpecifier: getImportModuleName(
44
37
  {
45
38
  cjsName: `${item[0]}`,
46
- esModulesName: `${item[0]}/index.js`
39
+ esModulesName: `${item[0]}/index.js`,
47
40
  },
48
- model
49
- )
41
+ model,
42
+ ),
50
43
  });
51
44
  allModules.push(item[1]);
52
45
  });
53
46
  indexFile.addExportDeclaration({
54
- namedExports: [...allModules]
47
+ namedExports: [...allModules],
55
48
  });
56
49
  const content = indexFile.getFullText();
57
50
  const filePath = path.join(
58
51
  srcPath.substring(0, srcPath.lastIndexOf("src") + 4),
59
52
  model.options.isModularLibrary ? "rest" : "",
60
- `index.ts`
53
+ `index.ts`,
61
54
  );
62
55
  return { path: filePath, content };
63
56
  }
@@ -5,16 +5,12 @@ import { ApiVersionInfo, ApiVersionPosition, UrlInfo } from "../interfaces.js";
5
5
  * @param urlInfo UrlInfo detail
6
6
  * @returns path api-version detail
7
7
  */
8
- export function extractPathApiVersion(
9
- urlInfo?: UrlInfo
10
- ): ApiVersionInfo | undefined {
8
+ export function extractPathApiVersion(urlInfo?: UrlInfo): ApiVersionInfo | undefined {
11
9
  if (!urlInfo) {
12
10
  return;
13
11
  }
14
12
  const param = urlInfo.urlParameters?.filter(
15
- (p) =>
16
- p.name.toLowerCase() === "api-version" ||
17
- p.name.toLowerCase() === "apiversion"
13
+ (p) => p.name.toLowerCase() === "api-version" || p.name.toLowerCase() === "apiversion",
18
14
  );
19
15
  if (!param || param?.length < 1) {
20
16
  return;
@@ -22,9 +18,8 @@ export function extractPathApiVersion(
22
18
  const detail: ApiVersionInfo = {
23
19
  definedPosition: "path",
24
20
  isCrossedVersion: Boolean(param?.length > 1),
25
- defaultValue:
26
- param.length === 1 ? (param[0]?.value as string | undefined) : undefined,
27
- required: true
21
+ defaultValue: param.length === 1 ? (param[0]?.value as string | undefined) : undefined,
22
+ required: true,
28
23
  };
29
24
  return detail;
30
25
  }
@@ -39,7 +34,7 @@ export function extractPathApiVersion(
39
34
  */
40
35
  export function extractDefinedPosition(
41
36
  operationApiVersion?: ApiVersionInfo,
42
- urlVersionDetail?: ApiVersionInfo
37
+ urlVersionDetail?: ApiVersionInfo,
43
38
  ): ApiVersionPosition {
44
39
  let pos: ApiVersionPosition = "none";
45
40
  if (operationApiVersion && urlVersionDetail) {
@@ -12,42 +12,42 @@ export function buildRuntimeImports(flavor?: PackageFlavor): Imports {
12
12
  restClient: {
13
13
  type: "restClient",
14
14
  specifier: "@azure-rest/core-client",
15
- version: "^2.0.0"
15
+ version: "^2.0.0",
16
16
  },
17
17
  coreAuth: {
18
18
  type: "coreAuth",
19
19
  specifier: "@azure/core-auth",
20
- version: "^1.6.0"
20
+ version: "^1.6.0",
21
21
  },
22
22
  restPipeline: {
23
23
  type: "restPipeline",
24
24
  specifier: "@azure/core-rest-pipeline",
25
- version: "^1.14.0"
25
+ version: "^1.14.0",
26
26
  },
27
27
  coreUtil: {
28
28
  type: "coreUtil",
29
29
  specifier: "@azure/core-util",
30
- version: "^1.4.0"
30
+ version: "^1.4.0",
31
31
  },
32
32
  coreLogger: {
33
33
  type: "coreLogger",
34
34
  specifier: "@azure/logger",
35
- version: "^1.0.4"
35
+ version: "^1.0.4",
36
36
  },
37
37
  azureEslintPlugin: {
38
38
  type: "azureEslintPlugin",
39
39
  specifier: "@azure/eslint-plugin-azure-sdk",
40
- version: "^3.0.0"
40
+ version: "^3.0.0",
41
41
  },
42
42
  azureTestRecorder: {
43
43
  type: "azureTestRecorder",
44
44
  specifier: "@azure-tools/test-recorder",
45
- version: "^3.0.0"
45
+ version: "^3.0.0",
46
46
  },
47
47
  azureCoreLro: {
48
48
  type: "azureCoreLro",
49
- specifier: "@azure/core-lro"
50
- }
49
+ specifier: "@azure/core-lro",
50
+ },
51
51
  } as Imports;
52
52
  } else {
53
53
  // In non-azure branded scope we only have one dependency that is ts-http-runtime
@@ -55,8 +55,8 @@ export function buildRuntimeImports(flavor?: PackageFlavor): Imports {
55
55
  commonFallback: {
56
56
  type: "commonFallback",
57
57
  specifier: "@typespec/ts-http-runtime",
58
- version: "0.1.0"
59
- }
58
+ version: "0.1.0",
59
+ },
60
60
  } as Imports;
61
61
  }
62
62
  }
@@ -69,39 +69,39 @@ export function initInternalImports(): Imports {
69
69
  return {
70
70
  parameter: {
71
71
  type: "parameter",
72
- importsSet: new Set<string>()
72
+ importsSet: new Set<string>(),
73
73
  },
74
74
  response: {
75
75
  type: "response",
76
- importsSet: new Set<string>()
76
+ importsSet: new Set<string>(),
77
77
  },
78
78
  rlcIndex: {
79
79
  type: "rlcIndex",
80
- importsSet: new Set<string>()
80
+ importsSet: new Set<string>(),
81
81
  },
82
82
  modularModel: {
83
83
  type: "modularModel",
84
- importsSet: new Set<string>()
84
+ importsSet: new Set<string>(),
85
85
  },
86
86
  rlcClientFactory: {
87
87
  type: "rlcClientFactory",
88
- importsSet: new Set<string>()
88
+ importsSet: new Set<string>(),
89
89
  },
90
90
  rlcClientDefinition: {
91
91
  type: "rlcClientDefinition",
92
- importsSet: new Set<string>()
92
+ importsSet: new Set<string>(),
93
93
  },
94
94
  serializerHelpers: {
95
95
  type: "serializerHelpers",
96
- importsSet: new Set<string>()
97
- }
96
+ importsSet: new Set<string>(),
97
+ },
98
98
  } as Imports;
99
99
  }
100
100
 
101
101
  export function getImportSpecifier(
102
102
  importType: ImportType,
103
103
  imports?: Imports,
104
- includeFallback = true
104
+ includeFallback = true,
105
105
  ): string {
106
106
  imports = imports ?? ({} as Imports);
107
107
  const defaultPackageMap: Record<ImportType, string> = {
@@ -110,7 +110,7 @@ export function getImportSpecifier(
110
110
  restPipeline: "@azure/core-rest-pipeline",
111
111
  coreUtil: "@azure/core-util",
112
112
  coreLogger: "@azure/logger",
113
- azureCoreLro: "@azure/core-lro"
113
+ azureCoreLro: "@azure/core-lro",
114
114
  } as any;
115
115
  if (!includeFallback) {
116
116
  return imports[importType]?.specifier ?? "";
@@ -125,7 +125,7 @@ export function getImportSpecifier(
125
125
  export function addImportToSpecifier(
126
126
  importType: ImportType,
127
127
  runtimeImports: Imports,
128
- importedName: string
128
+ importedName: string,
129
129
  ): void {
130
130
  const specifier = getImportSpecifier(importType, runtimeImports);
131
131
  const importSet = runtimeImports[importType]?.importsSet;
@@ -133,7 +133,7 @@ export function addImportToSpecifier(
133
133
  runtimeImports[importType] = {
134
134
  type: importType,
135
135
  specifier,
136
- importsSet: new Set<string>().add(importedName)
136
+ importsSet: new Set<string>().add(importedName),
137
137
  };
138
138
  } else {
139
139
  importSet.add(importedName);
@@ -149,15 +149,14 @@ export function clearImportSets(runtimeImports: Imports): void {
149
149
  export function addImportsToFiles(
150
150
  runtimeImports: Imports,
151
151
  file: SourceFile,
152
- internalSpecifierMap?: Record<string, string>
152
+ internalSpecifierMap?: Record<string, string>,
153
153
  ): void {
154
154
  Object.values(runtimeImports)
155
155
  .filter((importType) => {
156
156
  return importType.importsSet?.size;
157
157
  })
158
158
  .forEach((importType) => {
159
- const specifier =
160
- internalSpecifierMap?.[importType.type] ?? importType.specifier!;
159
+ const specifier = internalSpecifierMap?.[importType.type] ?? importType.specifier!;
161
160
  let hasModifier = false;
162
161
  if (!specifier) {
163
162
  return;
@@ -169,16 +168,14 @@ export function addImportsToFiles(
169
168
  })
170
169
  .forEach((importDeclaration) => {
171
170
  hasModifier = true;
172
- importDeclaration.addNamedImports([
173
- ...importType.importsSet!.values()
174
- ]);
171
+ importDeclaration.addNamedImports([...importType.importsSet!.values()]);
175
172
  });
176
173
 
177
174
  if (!hasModifier) {
178
175
  file.addImportDeclaration({
179
176
  isTypeOnly: true,
180
177
  moduleSpecifier: specifier,
181
- namedImports: [...importType.importsSet!.values()]
178
+ namedImports: [...importType.importsSet!.values()],
182
179
  });
183
180
  return;
184
181
  }