@azure-tools/typespec-ts 0.53.3 → 0.54.0

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 (446) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/src/framework/hooks/binder.d.ts.map +1 -1
  3. package/dist/src/framework/hooks/binder.js +102 -44
  4. package/dist/src/framework/hooks/binder.js.map +1 -1
  5. package/dist/src/framework/hooks/sdkTypes.js +1 -1
  6. package/dist/src/framework/hooks/sdkTypes.js.map +1 -1
  7. package/dist/src/framework/load-static-helpers.js +1 -1
  8. package/dist/src/framework/load-static-helpers.js.map +1 -1
  9. package/dist/src/index.d.ts.map +1 -1
  10. package/dist/src/index.js +4 -1
  11. package/dist/src/index.js.map +1 -1
  12. package/dist/src/lib.d.ts +1 -10
  13. package/dist/src/lib.d.ts.map +1 -1
  14. package/dist/src/lib.js +0 -5
  15. package/dist/src/lib.js.map +1 -1
  16. package/dist/src/metaTree.d.ts +1 -1
  17. package/dist/src/metaTree.d.ts.map +1 -1
  18. package/dist/src/modular/buildClassicalClient.js +1 -1
  19. package/dist/src/modular/buildClassicalClient.js.map +1 -1
  20. package/dist/src/modular/buildClassicalOperationGroups.js +1 -1
  21. package/dist/src/modular/buildClassicalOperationGroups.js.map +1 -1
  22. package/dist/src/modular/buildClientContext.js +1 -1
  23. package/dist/src/modular/buildClientContext.js.map +1 -1
  24. package/dist/src/modular/buildOperations.js +1 -1
  25. package/dist/src/modular/buildOperations.js.map +1 -1
  26. package/dist/src/modular/buildProjectFiles.js +1 -1
  27. package/dist/src/modular/buildProjectFiles.js.map +1 -1
  28. package/dist/src/modular/buildRestorePoller.js +1 -1
  29. package/dist/src/modular/buildRestorePoller.js.map +1 -1
  30. package/dist/src/modular/buildRootIndex.js +1 -1
  31. package/dist/src/modular/buildRootIndex.js.map +1 -1
  32. package/dist/src/modular/emitModels.d.ts +1 -1
  33. package/dist/src/modular/emitModels.d.ts.map +1 -1
  34. package/dist/src/modular/emitModels.js +1 -1
  35. package/dist/src/modular/emitModels.js.map +1 -1
  36. package/dist/src/modular/emitModelsOptions.js +1 -1
  37. package/dist/src/modular/emitModelsOptions.js.map +1 -1
  38. package/dist/src/modular/emitSamples.js +1 -1
  39. package/dist/src/modular/emitSamples.js.map +1 -1
  40. package/dist/src/modular/emitTests.js +1 -1
  41. package/dist/src/modular/emitTests.js.map +1 -1
  42. package/dist/src/modular/helpers/classicalOperationHelpers.js +1 -1
  43. package/dist/src/modular/helpers/classicalOperationHelpers.js.map +1 -1
  44. package/dist/src/modular/helpers/clientHelpers.js +1 -1
  45. package/dist/src/modular/helpers/clientHelpers.js.map +1 -1
  46. package/dist/src/modular/helpers/exampleValueHelpers.js +1 -1
  47. package/dist/src/modular/helpers/exampleValueHelpers.js.map +1 -1
  48. package/dist/src/modular/helpers/namingHelpers.d.ts +1 -1
  49. package/dist/src/modular/helpers/namingHelpers.d.ts.map +1 -1
  50. package/dist/src/modular/helpers/namingHelpers.js +1 -1
  51. package/dist/src/modular/helpers/namingHelpers.js.map +1 -1
  52. package/dist/src/modular/helpers/operationHelpers.d.ts +1 -1
  53. package/dist/src/modular/helpers/operationHelpers.d.ts.map +1 -1
  54. package/dist/src/modular/helpers/operationHelpers.js +53 -34
  55. package/dist/src/modular/helpers/operationHelpers.js.map +1 -1
  56. package/dist/src/modular/helpers/typeHelpers.js +1 -1
  57. package/dist/src/modular/helpers/typeHelpers.js.map +1 -1
  58. package/dist/src/modular/interfaces.d.ts +1 -1
  59. package/dist/src/modular/interfaces.d.ts.map +1 -1
  60. package/dist/src/modular/serialization/buildDeserializerFunction.js +1 -1
  61. package/dist/src/modular/serialization/buildDeserializerFunction.js.map +1 -1
  62. package/dist/src/modular/serialization/buildSerializerFunction.js +1 -1
  63. package/dist/src/modular/serialization/buildSerializerFunction.js.map +1 -1
  64. package/dist/src/modular/serialization/buildXmlSerializerFunction.js +1 -1
  65. package/dist/src/modular/serialization/buildXmlSerializerFunction.js.map +1 -1
  66. package/dist/src/modular/type-expressions/get-type-expression.js +1 -1
  67. package/dist/src/modular/type-expressions/get-type-expression.js.map +1 -1
  68. package/dist/src/rlc-common/buildClient.d.ts +9 -0
  69. package/dist/src/rlc-common/buildClient.d.ts.map +1 -0
  70. package/dist/src/rlc-common/buildClient.js +413 -0
  71. package/dist/src/rlc-common/buildClient.js.map +1 -0
  72. package/dist/src/rlc-common/buildClientDefinitions.d.ts +6 -0
  73. package/dist/src/rlc-common/buildClientDefinitions.d.ts.map +1 -0
  74. package/dist/src/rlc-common/buildClientDefinitions.js +174 -0
  75. package/dist/src/rlc-common/buildClientDefinitions.js.map +1 -0
  76. package/dist/src/rlc-common/buildIndexFile.d.ts +6 -0
  77. package/dist/src/rlc-common/buildIndexFile.d.ts.map +1 -0
  78. package/dist/src/rlc-common/buildIndexFile.js +242 -0
  79. package/dist/src/rlc-common/buildIndexFile.js.map +1 -0
  80. package/dist/src/rlc-common/buildIsUnexpectedHelper.d.ts +6 -0
  81. package/dist/src/rlc-common/buildIsUnexpectedHelper.d.ts.map +1 -0
  82. package/dist/src/rlc-common/buildIsUnexpectedHelper.js +224 -0
  83. package/dist/src/rlc-common/buildIsUnexpectedHelper.js.map +1 -0
  84. package/dist/src/rlc-common/buildLogger.d.ts +6 -0
  85. package/dist/src/rlc-common/buildLogger.d.ts.map +1 -0
  86. package/dist/src/rlc-common/buildLogger.js +32 -0
  87. package/dist/src/rlc-common/buildLogger.js.map +1 -0
  88. package/dist/src/rlc-common/buildMethodShortcuts.d.ts +5 -0
  89. package/dist/src/rlc-common/buildMethodShortcuts.d.ts.map +1 -0
  90. package/dist/src/rlc-common/buildMethodShortcuts.js +54 -0
  91. package/dist/src/rlc-common/buildMethodShortcuts.js.map +1 -0
  92. package/dist/src/rlc-common/buildObjectTypes.d.ts +29 -0
  93. package/dist/src/rlc-common/buildObjectTypes.d.ts.map +1 -0
  94. package/dist/src/rlc-common/buildObjectTypes.js +451 -0
  95. package/dist/src/rlc-common/buildObjectTypes.js.map +1 -0
  96. package/dist/src/rlc-common/buildPaginateHelper.d.ts +6 -0
  97. package/dist/src/rlc-common/buildPaginateHelper.d.ts.map +1 -0
  98. package/dist/src/rlc-common/buildPaginateHelper.js +27 -0
  99. package/dist/src/rlc-common/buildPaginateHelper.js.map +1 -0
  100. package/dist/src/rlc-common/buildParameterTypes.d.ts +14 -0
  101. package/dist/src/rlc-common/buildParameterTypes.d.ts.map +1 -0
  102. package/dist/src/rlc-common/buildParameterTypes.js +381 -0
  103. package/dist/src/rlc-common/buildParameterTypes.js.map +1 -0
  104. package/dist/src/rlc-common/buildPollingHelper.d.ts +6 -0
  105. package/dist/src/rlc-common/buildPollingHelper.d.ts.map +1 -0
  106. package/dist/src/rlc-common/buildPollingHelper.js +62 -0
  107. package/dist/src/rlc-common/buildPollingHelper.js.map +1 -0
  108. package/dist/src/rlc-common/buildResponseTypes.d.ts +6 -0
  109. package/dist/src/rlc-common/buildResponseTypes.d.ts.map +1 -0
  110. package/dist/src/rlc-common/buildResponseTypes.js +147 -0
  111. package/dist/src/rlc-common/buildResponseTypes.js.map +1 -0
  112. package/dist/src/rlc-common/buildSamples.d.ts +3 -0
  113. package/dist/src/rlc-common/buildSamples.d.ts.map +1 -0
  114. package/dist/src/rlc-common/buildSamples.js +30 -0
  115. package/dist/src/rlc-common/buildSamples.js.map +1 -0
  116. package/dist/src/rlc-common/buildSchemaType.d.ts +20 -0
  117. package/dist/src/rlc-common/buildSchemaType.d.ts.map +1 -0
  118. package/dist/src/rlc-common/buildSchemaType.js +53 -0
  119. package/dist/src/rlc-common/buildSchemaType.js.map +1 -0
  120. package/dist/src/rlc-common/buildSerializeHelper.d.ts +6 -0
  121. package/dist/src/rlc-common/buildSerializeHelper.d.ts.map +1 -0
  122. package/dist/src/rlc-common/buildSerializeHelper.js +36 -0
  123. package/dist/src/rlc-common/buildSerializeHelper.js.map +1 -0
  124. package/dist/src/rlc-common/buildTopLevelIndexFile.d.ts +6 -0
  125. package/dist/src/rlc-common/buildTopLevelIndexFile.d.ts.map +1 -0
  126. package/dist/src/rlc-common/buildTopLevelIndexFile.js +52 -0
  127. package/dist/src/rlc-common/buildTopLevelIndexFile.js.map +1 -0
  128. package/dist/src/rlc-common/helpers/apiVersionUtil.d.ts +17 -0
  129. package/dist/src/rlc-common/helpers/apiVersionUtil.d.ts.map +1 -0
  130. package/dist/src/rlc-common/helpers/apiVersionUtil.js +45 -0
  131. package/dist/src/rlc-common/helpers/apiVersionUtil.js.map +1 -0
  132. package/dist/src/rlc-common/helpers/importsUtil.d.ts +18 -0
  133. package/dist/src/rlc-common/helpers/importsUtil.d.ts.map +1 -0
  134. package/dist/src/rlc-common/helpers/importsUtil.js +169 -0
  135. package/dist/src/rlc-common/helpers/importsUtil.js.map +1 -0
  136. package/dist/src/rlc-common/helpers/nameConstructors.d.ts +42 -0
  137. package/dist/src/rlc-common/helpers/nameConstructors.d.ts.map +1 -0
  138. package/dist/src/rlc-common/helpers/nameConstructors.js +63 -0
  139. package/dist/src/rlc-common/helpers/nameConstructors.js.map +1 -0
  140. package/dist/src/rlc-common/helpers/nameUtils.d.ts +37 -0
  141. package/dist/src/rlc-common/helpers/nameUtils.d.ts.map +1 -0
  142. package/dist/src/rlc-common/helpers/nameUtils.js +246 -0
  143. package/dist/src/rlc-common/helpers/nameUtils.js.map +1 -0
  144. package/dist/src/rlc-common/helpers/operationHelpers.d.ts +16 -0
  145. package/dist/src/rlc-common/helpers/operationHelpers.d.ts.map +1 -0
  146. package/dist/src/rlc-common/helpers/operationHelpers.js +119 -0
  147. package/dist/src/rlc-common/helpers/operationHelpers.js.map +1 -0
  148. package/dist/src/rlc-common/helpers/packageUtil.d.ts +7 -0
  149. package/dist/src/rlc-common/helpers/packageUtil.d.ts.map +1 -0
  150. package/dist/src/rlc-common/helpers/packageUtil.js +13 -0
  151. package/dist/src/rlc-common/helpers/packageUtil.js.map +1 -0
  152. package/dist/src/rlc-common/helpers/pathUtils.d.ts +2 -0
  153. package/dist/src/rlc-common/helpers/pathUtils.d.ts.map +1 -0
  154. package/dist/src/rlc-common/helpers/pathUtils.js +12 -0
  155. package/dist/src/rlc-common/helpers/pathUtils.js.map +1 -0
  156. package/dist/src/rlc-common/helpers/schemaHelpers.d.ts +10 -0
  157. package/dist/src/rlc-common/helpers/schemaHelpers.d.ts.map +1 -0
  158. package/dist/src/rlc-common/helpers/schemaHelpers.js +41 -0
  159. package/dist/src/rlc-common/helpers/schemaHelpers.js.map +1 -0
  160. package/dist/src/rlc-common/helpers/shortcutMethods.d.ts +4 -0
  161. package/dist/src/rlc-common/helpers/shortcutMethods.d.ts.map +1 -0
  162. package/dist/src/rlc-common/helpers/shortcutMethods.js +49 -0
  163. package/dist/src/rlc-common/helpers/shortcutMethods.js.map +1 -0
  164. package/dist/src/rlc-common/helpers/typeUtil.d.ts +32 -0
  165. package/dist/src/rlc-common/helpers/typeUtil.d.ts.map +1 -0
  166. package/dist/src/rlc-common/helpers/typeUtil.js +167 -0
  167. package/dist/src/rlc-common/helpers/typeUtil.js.map +1 -0
  168. package/dist/src/rlc-common/helpers/valueGenerationUtil.d.ts +12 -0
  169. package/dist/src/rlc-common/helpers/valueGenerationUtil.d.ts.map +1 -0
  170. package/dist/src/rlc-common/helpers/valueGenerationUtil.js +165 -0
  171. package/dist/src/rlc-common/helpers/valueGenerationUtil.js.map +1 -0
  172. package/dist/src/rlc-common/index.d.ts +41 -0
  173. package/dist/src/rlc-common/index.d.ts.map +1 -0
  174. package/dist/src/rlc-common/index.js +43 -0
  175. package/dist/src/rlc-common/index.js.map +1 -0
  176. package/dist/src/rlc-common/interfaces.d.ts +369 -0
  177. package/dist/src/rlc-common/interfaces.d.ts.map +1 -0
  178. package/dist/src/rlc-common/interfaces.js +11 -0
  179. package/dist/src/rlc-common/interfaces.js.map +1 -0
  180. package/dist/src/rlc-common/metadata/buildApiExtractorConfig.d.ts +6 -0
  181. package/dist/src/rlc-common/metadata/buildApiExtractorConfig.d.ts.map +1 -0
  182. package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js +56 -0
  183. package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js.map +1 -0
  184. package/dist/src/rlc-common/metadata/buildChangelogFile.d.ts +6 -0
  185. package/dist/src/rlc-common/metadata/buildChangelogFile.d.ts.map +1 -0
  186. package/dist/src/rlc-common/metadata/buildChangelogFile.js +26 -0
  187. package/dist/src/rlc-common/metadata/buildChangelogFile.js.map +1 -0
  188. package/dist/src/rlc-common/metadata/buildESLintConfig.d.ts +6 -0
  189. package/dist/src/rlc-common/metadata/buildESLintConfig.d.ts.map +1 -0
  190. package/dist/src/rlc-common/metadata/buildESLintConfig.js +82 -0
  191. package/dist/src/rlc-common/metadata/buildESLintConfig.js.map +1 -0
  192. package/dist/src/rlc-common/metadata/buildLicenseFile.d.ts +5 -0
  193. package/dist/src/rlc-common/metadata/buildLicenseFile.d.ts.map +1 -0
  194. package/dist/src/rlc-common/metadata/buildLicenseFile.js +32 -0
  195. package/dist/src/rlc-common/metadata/buildLicenseFile.js.map +1 -0
  196. package/dist/src/rlc-common/metadata/buildPackageFile.d.ts +25 -0
  197. package/dist/src/rlc-common/metadata/buildPackageFile.d.ts.map +1 -0
  198. package/dist/src/rlc-common/metadata/buildPackageFile.js +201 -0
  199. package/dist/src/rlc-common/metadata/buildPackageFile.js.map +1 -0
  200. package/dist/src/rlc-common/metadata/buildReadmeFile.d.ts +11 -0
  201. package/dist/src/rlc-common/metadata/buildReadmeFile.d.ts.map +1 -0
  202. package/dist/src/rlc-common/metadata/buildReadmeFile.js +426 -0
  203. package/dist/src/rlc-common/metadata/buildReadmeFile.js.map +1 -0
  204. package/dist/src/rlc-common/metadata/buildRollupConfig.d.ts +6 -0
  205. package/dist/src/rlc-common/metadata/buildRollupConfig.d.ts.map +1 -0
  206. package/dist/src/rlc-common/metadata/buildRollupConfig.js +142 -0
  207. package/dist/src/rlc-common/metadata/buildRollupConfig.js.map +1 -0
  208. package/dist/src/rlc-common/metadata/buildSampleEnvFile.d.ts +6 -0
  209. package/dist/src/rlc-common/metadata/buildSampleEnvFile.d.ts.map +1 -0
  210. package/dist/src/rlc-common/metadata/buildSampleEnvFile.js +17 -0
  211. package/dist/src/rlc-common/metadata/buildSampleEnvFile.js.map +1 -0
  212. package/dist/src/rlc-common/metadata/buildTestConfig.d.ts +16 -0
  213. package/dist/src/rlc-common/metadata/buildTestConfig.d.ts.map +1 -0
  214. package/dist/src/rlc-common/metadata/buildTestConfig.js +55 -0
  215. package/dist/src/rlc-common/metadata/buildTestConfig.js.map +1 -0
  216. package/dist/src/rlc-common/metadata/buildTsConfig.d.ts +61 -0
  217. package/dist/src/rlc-common/metadata/buildTsConfig.d.ts.map +1 -0
  218. package/dist/src/rlc-common/metadata/buildTsConfig.js +170 -0
  219. package/dist/src/rlc-common/metadata/buildTsConfig.js.map +1 -0
  220. package/dist/src/rlc-common/metadata/buildVitestConfig.d.ts +6 -0
  221. package/dist/src/rlc-common/metadata/buildVitestConfig.d.ts.map +1 -0
  222. package/dist/src/rlc-common/metadata/buildVitestConfig.js +28 -0
  223. package/dist/src/rlc-common/metadata/buildVitestConfig.js.map +1 -0
  224. package/dist/src/rlc-common/metadata/buildWarpConfig.d.ts +20 -0
  225. package/dist/src/rlc-common/metadata/buildWarpConfig.d.ts.map +1 -0
  226. package/dist/src/rlc-common/metadata/buildWarpConfig.js +77 -0
  227. package/dist/src/rlc-common/metadata/buildWarpConfig.js.map +1 -0
  228. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts +51 -0
  229. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts.map +1 -0
  230. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js +121 -0
  231. package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js.map +1 -0
  232. package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.d.ts +242 -0
  233. package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.d.ts.map +1 -0
  234. package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js +176 -0
  235. package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js.map +1 -0
  236. package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.d.ts +8 -0
  237. package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.d.ts.map +1 -0
  238. package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js +102 -0
  239. package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js.map +1 -0
  240. package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.d.ts +57 -0
  241. package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.d.ts.map +1 -0
  242. package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js +53 -0
  243. package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js.map +1 -0
  244. package/dist/src/rlc-common/metadata/packageJson/packageCommon.d.ts +64 -0
  245. package/dist/src/rlc-common/metadata/packageJson/packageCommon.d.ts.map +1 -0
  246. package/dist/src/rlc-common/metadata/packageJson/packageCommon.js +183 -0
  247. package/dist/src/rlc-common/metadata/packageJson/packageCommon.js.map +1 -0
  248. package/dist/src/rlc-common/metadata/utils.d.ts +3 -0
  249. package/dist/src/rlc-common/metadata/utils.d.ts.map +1 -0
  250. package/dist/src/rlc-common/metadata/utils.js +7 -0
  251. package/dist/src/rlc-common/metadata/utils.js.map +1 -0
  252. package/dist/src/rlc-common/static/paginateContent.d.ts +2 -0
  253. package/dist/src/rlc-common/static/paginateContent.d.ts.map +1 -0
  254. package/dist/src/rlc-common/static/paginateContent.js +345 -0
  255. package/dist/src/rlc-common/static/paginateContent.js.map +1 -0
  256. package/dist/src/rlc-common/static/pollingContent.d.ts +2 -0
  257. package/dist/src/rlc-common/static/pollingContent.d.ts.map +1 -0
  258. package/dist/src/rlc-common/static/pollingContent.js +225 -0
  259. package/dist/src/rlc-common/static/pollingContent.js.map +1 -0
  260. package/dist/src/rlc-common/static/sampleTemplate.d.ts +2 -0
  261. package/dist/src/rlc-common/static/sampleTemplate.d.ts.map +1 -0
  262. package/dist/src/rlc-common/static/sampleTemplate.js +56 -0
  263. package/dist/src/rlc-common/static/sampleTemplate.js.map +1 -0
  264. package/dist/src/rlc-common/static/serializeHelper.d.ts +6 -0
  265. package/dist/src/rlc-common/static/serializeHelper.d.ts.map +1 -0
  266. package/dist/src/rlc-common/static/serializeHelper.js +31 -0
  267. package/dist/src/rlc-common/static/serializeHelper.js.map +1 -0
  268. package/dist/src/rlc-common/test/buildKarmaConfig.d.ts +6 -0
  269. package/dist/src/rlc-common/test/buildKarmaConfig.d.ts.map +1 -0
  270. package/dist/src/rlc-common/test/buildKarmaConfig.js +11 -0
  271. package/dist/src/rlc-common/test/buildKarmaConfig.js.map +1 -0
  272. package/dist/src/rlc-common/test/buildRecordedClient.d.ts +6 -0
  273. package/dist/src/rlc-common/test/buildRecordedClient.d.ts.map +1 -0
  274. package/dist/src/rlc-common/test/buildRecordedClient.js +18 -0
  275. package/dist/src/rlc-common/test/buildRecordedClient.js.map +1 -0
  276. package/dist/src/rlc-common/test/buildSampleTest.d.ts +6 -0
  277. package/dist/src/rlc-common/test/buildSampleTest.d.ts.map +1 -0
  278. package/dist/src/rlc-common/test/buildSampleTest.js +15 -0
  279. package/dist/src/rlc-common/test/buildSampleTest.js.map +1 -0
  280. package/dist/src/rlc-common/test/buildSnippets.d.ts +6 -0
  281. package/dist/src/rlc-common/test/buildSnippets.d.ts.map +1 -0
  282. package/dist/src/rlc-common/test/buildSnippets.js +29 -0
  283. package/dist/src/rlc-common/test/buildSnippets.js.map +1 -0
  284. package/dist/src/rlc-common/test/template.d.ts +5 -0
  285. package/dist/src/rlc-common/test/template.d.ts.map +1 -0
  286. package/dist/src/rlc-common/test/template.js +261 -0
  287. package/dist/src/rlc-common/test/template.js.map +1 -0
  288. package/dist/src/rlc-common/transformSampleGroups.d.ts +9 -0
  289. package/dist/src/rlc-common/transformSampleGroups.d.ts.map +1 -0
  290. package/dist/src/rlc-common/transformSampleGroups.js +317 -0
  291. package/dist/src/rlc-common/transformSampleGroups.js.map +1 -0
  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 +1 -1
  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 +1 -1
  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/transformParameters.d.ts +1 -1
  303. package/dist/src/transform/transformParameters.d.ts.map +1 -1
  304. package/dist/src/transform/transformParameters.js +1 -1
  305. package/dist/src/transform/transformParameters.js.map +1 -1
  306. package/dist/src/transform/transformPaths.d.ts +1 -1
  307. package/dist/src/transform/transformPaths.d.ts.map +1 -1
  308. package/dist/src/transform/transformPaths.js +1 -1
  309. package/dist/src/transform/transformPaths.js.map +1 -1
  310. package/dist/src/transform/transformResponses.d.ts +1 -1
  311. package/dist/src/transform/transformResponses.d.ts.map +1 -1
  312. package/dist/src/transform/transformResponses.js +1 -1
  313. package/dist/src/transform/transformResponses.js.map +1 -1
  314. package/dist/src/transform/transformSchemas.js +1 -1
  315. package/dist/src/transform/transformSchemas.js.map +1 -1
  316. package/dist/src/transform/transformTelemetryInfo.d.ts +1 -1
  317. package/dist/src/transform/transformTelemetryInfo.d.ts.map +1 -1
  318. package/dist/src/transform/transfromRLCOptions.d.ts +1 -1
  319. package/dist/src/transform/transfromRLCOptions.d.ts.map +1 -1
  320. package/dist/src/transform/transfromRLCOptions.js +1 -3
  321. package/dist/src/transform/transfromRLCOptions.js.map +1 -1
  322. package/dist/src/utils/clientUtils.js +1 -1
  323. package/dist/src/utils/clientUtils.js.map +1 -1
  324. package/dist/src/utils/crossLanguageDef.js +1 -1
  325. package/dist/src/utils/crossLanguageDef.js.map +1 -1
  326. package/dist/src/utils/emitUtil.d.ts +1 -1
  327. package/dist/src/utils/emitUtil.d.ts.map +1 -1
  328. package/dist/src/utils/emitUtil.js +1 -1
  329. package/dist/src/utils/emitUtil.js.map +1 -1
  330. package/dist/src/utils/interfaces.d.ts +1 -1
  331. package/dist/src/utils/interfaces.d.ts.map +1 -1
  332. package/dist/src/utils/modelUtils.d.ts +1 -1
  333. package/dist/src/utils/modelUtils.d.ts.map +1 -1
  334. package/dist/src/utils/modelUtils.js +1 -1
  335. package/dist/src/utils/modelUtils.js.map +1 -1
  336. package/dist/src/utils/operationUtil.d.ts +1 -1
  337. package/dist/src/utils/operationUtil.d.ts.map +1 -1
  338. package/dist/src/utils/operationUtil.js +1 -1
  339. package/dist/src/utils/operationUtil.js.map +1 -1
  340. package/dist/src/utils/parameterUtils.d.ts +1 -1
  341. package/dist/src/utils/parameterUtils.d.ts.map +1 -1
  342. package/dist/src/utils/parameterUtils.js +1 -1
  343. package/dist/src/utils/parameterUtils.js.map +1 -1
  344. package/dist/tsconfig.tsbuildinfo +1 -1
  345. package/package.json +9 -9
  346. package/src/framework/hooks/binder.ts +142 -51
  347. package/src/framework/hooks/sdkTypes.ts +1 -1
  348. package/src/framework/load-static-helpers.ts +1 -1
  349. package/src/index.ts +5 -1
  350. package/src/lib.ts +1 -16
  351. package/src/metaTree.ts +1 -1
  352. package/src/modular/buildClassicalClient.ts +1 -1
  353. package/src/modular/buildClassicalOperationGroups.ts +1 -1
  354. package/src/modular/buildClientContext.ts +1 -1
  355. package/src/modular/buildOperations.ts +1 -1
  356. package/src/modular/buildProjectFiles.ts +1 -1
  357. package/src/modular/buildRestorePoller.ts +1 -1
  358. package/src/modular/buildRootIndex.ts +1 -1
  359. package/src/modular/emitModels.ts +1 -1
  360. package/src/modular/emitModelsOptions.ts +1 -1
  361. package/src/modular/emitSamples.ts +1 -1
  362. package/src/modular/emitTests.ts +1 -1
  363. package/src/modular/helpers/classicalOperationHelpers.ts +1 -1
  364. package/src/modular/helpers/clientHelpers.ts +1 -1
  365. package/src/modular/helpers/exampleValueHelpers.ts +1 -1
  366. package/src/modular/helpers/namingHelpers.ts +1 -1
  367. package/src/modular/helpers/operationHelpers.ts +65 -42
  368. package/src/modular/helpers/typeHelpers.ts +1 -1
  369. package/src/modular/interfaces.ts +1 -1
  370. package/src/modular/serialization/buildDeserializerFunction.ts +1 -1
  371. package/src/modular/serialization/buildSerializerFunction.ts +1 -1
  372. package/src/modular/serialization/buildXmlSerializerFunction.ts +1 -1
  373. package/src/modular/type-expressions/get-type-expression.ts +1 -1
  374. package/src/rlc-common/buildClient.ts +561 -0
  375. package/src/rlc-common/buildClientDefinitions.ts +278 -0
  376. package/src/rlc-common/buildIndexFile.ts +344 -0
  377. package/src/rlc-common/buildIsUnexpectedHelper.ts +255 -0
  378. package/src/rlc-common/buildLogger.ts +43 -0
  379. package/src/rlc-common/buildMethodShortcuts.ts +83 -0
  380. package/src/rlc-common/buildObjectTypes.ts +680 -0
  381. package/src/rlc-common/buildPaginateHelper.ts +34 -0
  382. package/src/rlc-common/buildParameterTypes.ts +575 -0
  383. package/src/rlc-common/buildPollingHelper.ts +83 -0
  384. package/src/rlc-common/buildResponseTypes.ts +203 -0
  385. package/src/rlc-common/buildSamples.ts +32 -0
  386. package/src/rlc-common/buildSchemaType.ts +81 -0
  387. package/src/rlc-common/buildSerializeHelper.ts +49 -0
  388. package/src/rlc-common/buildTopLevelIndexFile.ts +65 -0
  389. package/src/rlc-common/helpers/apiVersionUtil.ts +53 -0
  390. package/src/rlc-common/helpers/importsUtil.ts +187 -0
  391. package/src/rlc-common/helpers/nameConstructors.ts +144 -0
  392. package/src/rlc-common/helpers/nameUtils.ts +319 -0
  393. package/src/rlc-common/helpers/operationHelpers.ts +155 -0
  394. package/src/rlc-common/helpers/packageUtil.ts +13 -0
  395. package/src/rlc-common/helpers/pathUtils.ts +15 -0
  396. package/src/rlc-common/helpers/schemaHelpers.ts +61 -0
  397. package/src/rlc-common/helpers/shortcutMethods.ts +67 -0
  398. package/src/rlc-common/helpers/typeUtil.ts +173 -0
  399. package/src/rlc-common/helpers/valueGenerationUtil.ts +257 -0
  400. package/src/rlc-common/index.ts +43 -0
  401. package/src/rlc-common/interfaces.ts +441 -0
  402. package/src/rlc-common/metadata/buildApiExtractorConfig.ts +71 -0
  403. package/src/rlc-common/metadata/buildChangelogFile.ts +29 -0
  404. package/src/rlc-common/metadata/buildESLintConfig.ts +86 -0
  405. package/src/rlc-common/metadata/buildLicenseFile.ts +33 -0
  406. package/src/rlc-common/metadata/buildPackageFile.ts +250 -0
  407. package/src/rlc-common/metadata/buildReadmeFile.ts +528 -0
  408. package/src/rlc-common/metadata/buildRollupConfig.ts +150 -0
  409. package/src/rlc-common/metadata/buildSampleEnvFile.ts +22 -0
  410. package/src/rlc-common/metadata/buildTestConfig.ts +72 -0
  411. package/src/rlc-common/metadata/buildTsConfig.ts +222 -0
  412. package/src/rlc-common/metadata/buildVitestConfig.ts +36 -0
  413. package/src/rlc-common/metadata/buildWarpConfig.ts +94 -0
  414. package/src/rlc-common/metadata/packageJson/azurePackageCommon.ts +161 -0
  415. package/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.ts +220 -0
  416. package/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.ts +134 -0
  417. package/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.ts +70 -0
  418. package/src/rlc-common/metadata/packageJson/packageCommon.ts +255 -0
  419. package/src/rlc-common/metadata/utils.ts +8 -0
  420. package/src/rlc-common/static/paginateContent.ts +345 -0
  421. package/src/rlc-common/static/pollingContent.ts +225 -0
  422. package/src/rlc-common/static/sampleTemplate.ts +56 -0
  423. package/src/rlc-common/static/serializeHelper.ts +34 -0
  424. package/src/rlc-common/test/buildKarmaConfig.ts +12 -0
  425. package/src/rlc-common/test/buildRecordedClient.ts +18 -0
  426. package/src/rlc-common/test/buildSampleTest.ts +15 -0
  427. package/src/rlc-common/test/buildSnippets.ts +35 -0
  428. package/src/rlc-common/test/template.ts +263 -0
  429. package/src/rlc-common/transformSampleGroups.ts +458 -0
  430. package/src/transform/transform.ts +1 -1
  431. package/src/transform/transformApiVersionInfo.ts +1 -1
  432. package/src/transform/transformHelperFunctionDetails.ts +1 -1
  433. package/src/transform/transformParameters.ts +1 -1
  434. package/src/transform/transformPaths.ts +1 -1
  435. package/src/transform/transformResponses.ts +1 -1
  436. package/src/transform/transformSchemas.ts +1 -1
  437. package/src/transform/transformTelemetryInfo.ts +1 -1
  438. package/src/transform/transfromRLCOptions.ts +1 -3
  439. package/src/utils/clientUtils.ts +1 -1
  440. package/src/utils/crossLanguageDef.ts +1 -1
  441. package/src/utils/emitUtil.ts +1 -1
  442. package/src/utils/interfaces.ts +1 -1
  443. package/src/utils/modelUtils.ts +1 -1
  444. package/src/utils/operationUtil.ts +1 -1
  445. package/src/utils/parameterUtils.ts +1 -1
  446. package/LICENSE +0 -21
@@ -0,0 +1,528 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ import { RLCModel } from "../interfaces.js";
5
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
6
+ // @ts-ignore: to fix the handlebars issue
7
+ import hbs from "handlebars";
8
+ import { NameType, normalizeName } from "../helpers/nameUtils.js";
9
+ import { isAzurePackage } from "../helpers/packageUtil.js";
10
+ import { getClientName } from "../helpers/nameConstructors.js";
11
+ import { readFileSync } from "fs";
12
+
13
+ const azureReadmeRLCTemplate = `# {{ clientDescriptiveName }} library for JavaScript
14
+
15
+ {{ description }}
16
+
17
+ {{#if azureArm}}
18
+ **If you are not familiar with our REST client, please spend 5 minutes to take a look at {{#if serviceDocURL}}[the service's documentation]({{ serviceDocURL }}) and {{/if}}our [REST client docs](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/rest-clients.md) to use this library, the REST client provides a light-weighted & developer friendly way to call azure rest api
19
+ {{else}}
20
+ **Please rely heavily on {{#if serviceDocURL}}[the service's documentation]({{ serviceDocURL }}) and {{/if}}our [REST client docs](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/rest-clients.md) to use this library**
21
+ {{/if}}
22
+
23
+ Key links:
24
+
25
+ {{#if packageSourceURL}}
26
+ - [Source code]({{ packageSourceURL }})
27
+ {{/if}}
28
+ {{#if packageNPMURL}}
29
+ - [Package (NPM)]({{ packageNPMURL }})
30
+ {{/if}}
31
+ {{#if apiRefURL}}
32
+ - [API reference documentation]({{ apiRefURL }})
33
+ {{/if}}
34
+ {{#if serviceDocURL}}
35
+ - [Product documentation]({{ serviceDocURL }})
36
+ {{/if}}
37
+ {{#if samplesURL}}
38
+ - [Samples]({{ samplesURL }})
39
+ {{/if}}
40
+
41
+ ## Getting started
42
+
43
+ ### Currently supported environments
44
+
45
+ - LTS versions of Node.js
46
+
47
+ ### Prerequisites
48
+
49
+ - You must have an [Azure subscription](https://azure.microsoft.com/free/){{#if dependencyLink}} and follow [these]({{ dependencyLink }}) instructions{{/if}} to use this package.
50
+
51
+ ### Install the \`{{ clientPackageName }}\` package
52
+
53
+ Install the {{ clientDescriptiveName }} REST client library for JavaScript with \`npm\`:
54
+
55
+ \`\`\`bash
56
+ npm install {{ clientPackageName }}
57
+ \`\`\`
58
+
59
+ ### Create and authenticate a \`{{ clientClassName }}\`
60
+
61
+ To use an [Azure Active Directory (AAD) token credential](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token),
62
+ provide an instance of the desired credential type obtained from the
63
+ [@azure/identity](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) library.
64
+
65
+ To authenticate with AAD, you must first \`npm\` install [\`@azure/identity\`](https://www.npmjs.com/package/@azure/identity) {{#if dependencyLink}}and
66
+ [{{dependencyDescription }}]({{ dependencyLink }}){{/if}}
67
+
68
+ After setup, you can choose which type of [credential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) from \`@azure/identity\` to use.
69
+ As an example, [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential)
70
+ can be used to authenticate the client.
71
+
72
+ ## Troubleshooting
73
+
74
+ ### Logging
75
+
76
+ Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the \`AZURE_LOG_LEVEL\` environment variable to \`info\`. Alternatively, logging can be enabled at runtime by calling \`setLogLevel\` in the \`@azure/logger\`:
77
+
78
+ \`\`\`ts {{#if azureSdkForJs}}{{#if generateTest}}snippet:SetLogLevel{{/if}}{{/if}}
79
+ import { setLogLevel } from "@azure/logger";
80
+
81
+ setLogLevel("info");
82
+ \`\`\`
83
+
84
+ For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).
85
+ `;
86
+
87
+ const azureReadmeModularTemplate = `# {{ clientDescriptiveName }} library for JavaScript
88
+
89
+ This package contains an isomorphic SDK (runs both in Node.js and in browsers) for {{ clientDescriptiveName }}.
90
+
91
+ {{ description }}
92
+
93
+ Key links:
94
+
95
+ {{#if packageSourceURL}}
96
+ - [Source code]({{ packageSourceURL }})
97
+ {{/if}}
98
+ {{#if packageNPMURL}}
99
+ - [Package (NPM)]({{ packageNPMURL }})
100
+ {{/if}}
101
+ {{#if apiRefURL}}
102
+ - [API reference documentation]({{ apiRefURL }})
103
+ {{/if}}
104
+ {{#if samplesURL}}
105
+ - [Samples]({{samplesURL}})
106
+ {{/if}}
107
+
108
+ ## Getting started
109
+
110
+ ### Currently supported environments
111
+
112
+ - [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule)
113
+ - Latest versions of Safari, Chrome, Edge and Firefox.
114
+
115
+ See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
116
+
117
+ {{#if azure}}
118
+ ### Prerequisites
119
+
120
+ - An [Azure subscription][azure_sub].
121
+ {{/if}}
122
+
123
+ {{#if isReleasablePackage}}
124
+ ### Install the \`{{ clientPackageName }}\` package
125
+
126
+ Install the {{ clientDescriptiveName }} library for JavaScript with \`npm\`:
127
+
128
+ \`\`\`bash
129
+ npm install {{ clientPackageName }}
130
+ \`\`\`
131
+ {{/if}}
132
+
133
+ {{#if azure}}
134
+ {{#if addCredentials}}
135
+ ### Create and authenticate a \`{{ clientClassName}}\`
136
+
137
+ To create a client object to access the {{ serviceName }} API, you will need the \`endpoint\` of your {{ serviceName }} resource and a \`credential\`. The {{ clientDescriptiveName }} can use Azure Active Directory credentials to authenticate.
138
+ You can find the endpoint for your {{ serviceName }} resource in the [Azure Portal][azure_portal].
139
+
140
+ You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token).
141
+
142
+ To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the \`@azure/identity\` package:
143
+
144
+ \`\`\`bash
145
+ npm install @azure/identity
146
+ \`\`\`
147
+
148
+ You will also need to **register a new AAD application and grant access to {{ serviceName}}** by assigning the suitable role to your service principal (note: roles such as \`"Owner"\` will not grant the necessary permissions).
149
+
150
+ For more information about how to create an Azure AD Application check out [this guide](https://learn.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal).
151
+
152
+ {{#if azureArm}}
153
+ Using Node.js and Node-like environments, you can use the \`DefaultAzureCredential\` class to authenticate the client.
154
+
155
+ \`\`\`ts {{#if azureSdkForJs}}{{#if generateTest}}snippet:ReadmeSampleCreateClient_Node{{/if}}{{/if}}
156
+ import { {{ clientClassName }} } from "{{ clientPackageName }}";
157
+ import { DefaultAzureCredential } from "@azure/identity";
158
+
159
+ {{#if hasSubscriptionId}}
160
+ const subscriptionId = "00000000-0000-0000-0000-000000000000";
161
+ const client = new {{ clientClassName }}(new DefaultAzureCredential(), subscriptionId);
162
+ {{else}}
163
+ const client = new {{ clientClassName }}(new DefaultAzureCredential());
164
+ {{/if}}
165
+ \`\`\`
166
+
167
+ For browser environments, use the \`InteractiveBrowserCredential\` from the \`@azure/identity\` package to authenticate.
168
+
169
+ \`\`\`ts {{#if azureSdkForJs}}{{#if generateTest}}snippet:ReadmeSampleCreateClient_Browser{{/if}}{{/if}}
170
+ import { InteractiveBrowserCredential } from "@azure/identity";
171
+ import { {{ clientClassName }} } from "{{ clientPackageName }}";
172
+
173
+ const credential = new InteractiveBrowserCredential({
174
+ tenantId: "<YOUR_TENANT_ID>",
175
+ clientId: "<YOUR_CLIENT_ID>",
176
+ });
177
+
178
+ {{#if hasSubscriptionId}}
179
+ const subscriptionId = "00000000-0000-0000-0000-000000000000";
180
+ const client = new {{ clientClassName }}(credential, subscriptionId);
181
+ {{else}}
182
+ const client = new {{ clientClassName }}(credential);
183
+ {{/if}}
184
+ \`\`\`
185
+ {{else}}
186
+ Using Node.js and Node-like environments, you can use the \`DefaultAzureCredential\` class to authenticate the client.
187
+
188
+ \`\`\`ts {{#if azureSdkForJs}}{{#if generateTest}}snippet:ReadmeSampleCreateClient_Node{{/if}}{{/if}}
189
+ import { {{ clientClassName }} } from "{{ clientPackageName }}";
190
+ import { DefaultAzureCredential } from "@azure/identity";
191
+
192
+ const client = new {{ clientClassName }}("<endpoint>", new DefaultAzureCredential());
193
+ \`\`\`
194
+
195
+ For browser environments, use the \`InteractiveBrowserCredential\` from the \`@azure/identity\` package to authenticate.
196
+
197
+ \`\`\`ts {{#if azureSdkForJs}}{{#if generateTest}}snippet:ReadmeSampleCreateClient_Browser{{/if}}{{/if}}
198
+ import { InteractiveBrowserCredential } from "@azure/identity";
199
+ import { {{ clientClassName }} } from "{{ clientPackageName }}";
200
+
201
+ const credential = new InteractiveBrowserCredential({
202
+ tenantId: "<YOUR_TENANT_ID>",
203
+ clientId: "<YOUR_CLIENT_ID>"
204
+ });
205
+ const client = new {{ clientClassName }}("<endpoint>", credential);
206
+ \`\`\`
207
+ {{/if}}
208
+ {{/if}}{{/if}}
209
+
210
+ ### JavaScript Bundle
211
+ To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling).
212
+
213
+ ## Key concepts
214
+
215
+ ### {{ clientClassName }}
216
+
217
+ \`{{ clientClassName }}\` is the primary interface for developers using the {{ clientDescriptiveName }} library. Explore the methods on this client object to understand the different features of the {{ serviceName }} service that you can access.
218
+
219
+ {{#if azure}}
220
+ ## Troubleshooting
221
+
222
+ ### Logging
223
+
224
+ Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the \`AZURE_LOG_LEVEL\` environment variable to \`info\`. Alternatively, logging can be enabled at runtime by calling \`setLogLevel\` in the \`@azure/logger\`:
225
+
226
+ \`\`\`ts {{#if azureSdkForJs}}{{#if generateTest}}snippet:SetLogLevel{{/if}}{{/if}}
227
+ import { setLogLevel } from "@azure/logger";
228
+
229
+ setLogLevel("info");
230
+ \`\`\`
231
+
232
+ For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs]({{ repoURL }}/tree/main/sdk/core/logger).
233
+
234
+ {{#if samplesURL}}
235
+ ## Next steps
236
+
237
+ Please take a look at the [samples]({{ samplesURL }}) directory for detailed examples on how to use this library.
238
+ {{/if}}
239
+
240
+ ## Contributing
241
+
242
+ If you'd like to contribute to this library, please read the [contributing guide]({{ contributingGuideURL }}) to learn more about how to build and test the code.
243
+
244
+ ## Related projects
245
+
246
+ - [{{ projectName }}]({{ repoURL }})
247
+
248
+ [azure_sub]: https://azure.microsoft.com/free/
249
+ [azure_portal]: https://portal.azure.com
250
+ {{#if identityPackageURL}}[azure_identity]: {{ identityPackageURL }}
251
+ {{/if}}[defaultazurecredential]: {{ identityPackageURL }}#defaultazurecredential
252
+ {{/if}}
253
+ `;
254
+
255
+ const nonBrandedReadmeTemplate = `# {{ clientDescriptiveName }} library for JavaScript
256
+
257
+ {{ description }}
258
+
259
+ Key links:
260
+
261
+ {{#if packageSourceURL}}
262
+ - [Source code]({{ packageSourceURL }})
263
+ {{/if}}
264
+ {{#if packageNPMURL}}
265
+ - [Package (NPM)]({{ packageNPMURL }})
266
+ {{/if}}
267
+ {{#if apiRefURL}}
268
+ - [API reference documentation]({{ apiRefURL }})
269
+ {{/if}}
270
+ {{#if serviceDocURL}}
271
+ - [Product documentation]({{ serviceDocURL }})
272
+ {{/if}}
273
+ {{#if samplesURL}}
274
+ - [Samples]({{ samplesURL }})
275
+ {{/if}}
276
+
277
+ ## Getting started
278
+
279
+ ### Currently supported environments
280
+
281
+ - LTS versions of Node.js
282
+
283
+ ### Install the \`{{ clientPackageName }}\` package
284
+
285
+ Install the {{ clientDescriptiveName }} library for JavaScript with \`npm\`:
286
+
287
+ \`\`\`bash
288
+ npm install {{ clientPackageName }}
289
+ \`\`\`
290
+ `;
291
+
292
+ const apiReferenceTemplate = `{{#if apiRefURL}}
293
+ - [API reference documentation]({{ apiRefURL }})
294
+ {{/if}}
295
+ `;
296
+
297
+ /**
298
+ * Meta data information about the service, the package, and the client.
299
+ */
300
+ interface Metadata {
301
+ /** The name of the service */
302
+ serviceName: string;
303
+ /** The name of the package */
304
+ clientPackageName: string;
305
+ /** The name of the client class */
306
+ clientClassName: string;
307
+ /** The URL of the repository the package lives in */
308
+ repoURL?: string;
309
+ /** The URL to the package directory in the repository */
310
+ packageSourceURL?: string;
311
+ /** The URL to the package's samples */
312
+ samplesURL?: string;
313
+ /** A descriptive name for the client extracted from the swagger */
314
+ clientDescriptiveName?: string;
315
+ /** A description for the service extracted from the swagger */
316
+ description?: string;
317
+ /** The URL to the package on npmjs.org */
318
+ packageNPMURL?: string;
319
+ /** The name of the project that lives in the repository */
320
+ projectName?: string;
321
+ /** whether the client accepts standard credentials */
322
+ addCredentials?: boolean;
323
+ /** The link to the identity package in the repository */
324
+ identityPackageURL?: string;
325
+ /** The URL for the service document */
326
+ serviceDocURL?: string;
327
+ /** The dependency info for this service */
328
+ dependencyDescription?: string;
329
+ dependencyLink?: string;
330
+ /** Indicates if the package is a multi-client */
331
+ hasMultiClients?: boolean;
332
+ /** The URL to the API reference */
333
+ apiRefURL?: string;
334
+ /** Check if the rp is management plane */
335
+ azureArm?: boolean;
336
+ /** Whether the package being generated is for an Azure service */
337
+ azure: boolean;
338
+ /** Indicates if the package is a test/releasable package. */
339
+ isReleasablePackage?: boolean;
340
+ /** The link to the contributing guide in the repository */
341
+ contributingGuideURL?: string;
342
+ /** Indicates if the package is generated to azure-sdk-for-js repo */
343
+ azureSdkForJs?: boolean;
344
+ /** Indicates if the package need generate test files */
345
+ generateTest?: boolean;
346
+ /** Indicates if the package need SubscriptionId as the client parameter */
347
+ hasSubscriptionId?: boolean;
348
+ }
349
+
350
+ export function buildReadmeFile(model: RLCModel) {
351
+ const metadata = createMetadata(model) ?? {};
352
+ const readmeFileContents = hbs.compile(
353
+ model.options && isAzurePackage(model)
354
+ ? model.options.isModularLibrary
355
+ ? azureReadmeModularTemplate
356
+ : azureReadmeRLCTemplate
357
+ : nonBrandedReadmeTemplate,
358
+ { noEscape: true }
359
+ );
360
+ return {
361
+ path: "README.md",
362
+ content: readmeFileContents(metadata)
363
+ };
364
+ }
365
+
366
+ export function hasClientNameChanged(
367
+ model: RLCModel,
368
+ existingReadmeFilePath: string
369
+ ): boolean {
370
+ try {
371
+ const existingContent = readFileSync(existingReadmeFilePath, "utf8");
372
+ const importMatch = existingContent.match(
373
+ /import\s*\{\s*([A-Za-z0-9_]+)\s*\}\s*from\s*["'][^"']*["']/
374
+ );
375
+ const existingClientName = importMatch?.[1];
376
+ const newClientName = getClientName(model);
377
+ return !!existingClientName && existingClientName !== newClientName;
378
+ } catch {
379
+ return false;
380
+ }
381
+ }
382
+
383
+ export function updateReadmeFile(
384
+ model: RLCModel,
385
+ existingReadmeFilePath: string
386
+ ): { path: string; content: string } | undefined {
387
+ try {
388
+ const existingContent = readFileSync(existingReadmeFilePath, "utf8");
389
+ const metadata = createMetadata(model) ?? {};
390
+
391
+ const newApiRefLink = hbs
392
+ .compile(apiReferenceTemplate, { noEscape: true })(metadata)
393
+ .trim();
394
+
395
+ if (!newApiRefLink) {
396
+ return { path: "README.md", content: existingContent };
397
+ }
398
+
399
+ const apiRefRegex =
400
+ /^- \[API reference documentation\]\(https:\/\/learn\.microsoft\.com\/javascript\/api\/[^)]+\)$/m;
401
+ const updatedContent = existingContent.replace(apiRefRegex, (match) =>
402
+ match ? newApiRefLink : match
403
+ );
404
+
405
+ return { path: "README.md", content: updatedContent };
406
+ } catch {
407
+ return;
408
+ }
409
+ }
410
+
411
+ /**
412
+ * Returns meta data information about the service, the package, and the client.
413
+ * @param codeModel - include the client details
414
+ * @returns inferred metadata about the service, the package, and the client
415
+ */
416
+ function createMetadata(model: RLCModel): Metadata | undefined {
417
+ if (!model.options || !model.options.packageDetails) {
418
+ return;
419
+ }
420
+ // const packageDetails = model.options.packageDetails;
421
+ const {
422
+ packageDetails,
423
+ azureOutputDirectory,
424
+ productDocLink,
425
+ dependencyInfo,
426
+ multiClient,
427
+ batch,
428
+ serviceInfo,
429
+ isTypeSpecTest
430
+ } = model.options;
431
+
432
+ const azureHuh =
433
+ packageDetails?.scopeName === "azure" ||
434
+ packageDetails?.scopeName === "azure-rest";
435
+ const repoURL = "https://github.com/Azure/azure-sdk-for-js";
436
+ const relativePackageSourcePath = azureOutputDirectory;
437
+ const packageSourceURL =
438
+ relativePackageSourcePath &&
439
+ repoURL &&
440
+ `${repoURL}/tree/main/${relativePackageSourcePath}`;
441
+
442
+ const clientPackageName = packageDetails?.name;
443
+ const clientClassName = getClientName(model);
444
+ const serviceName = getServiceName(model);
445
+ let apiRefUrlQueryParameter: string = "";
446
+ if (
447
+ !packageDetails?.isVersionUserProvided &&
448
+ model.apiVersionInfo?.defaultValue
449
+ ) {
450
+ if (model.apiVersionInfo?.defaultValue?.toLowerCase().includes("preview")) {
451
+ apiRefUrlQueryParameter = "?view=azure-node-preview";
452
+ }
453
+ } else {
454
+ packageDetails.version = packageDetails.version ?? "1.0.0-beta.1";
455
+ if (packageDetails?.version.includes("beta")) {
456
+ apiRefUrlQueryParameter = "?view=azure-node-preview";
457
+ }
458
+ }
459
+
460
+ return {
461
+ serviceName,
462
+ clientClassName,
463
+ clientPackageName: clientPackageName,
464
+ clientDescriptiveName: model.options.isModularLibrary
465
+ ? `${serviceName} client`
466
+ : `${serviceName} REST client`,
467
+ description: serviceInfo?.description ?? packageDetails.description,
468
+ serviceDocURL: productDocLink,
469
+ packageSourceURL: packageSourceURL,
470
+ packageNPMURL: `https://www.npmjs.com/package/${clientPackageName}`,
471
+ samplesURL:
472
+ model.options.generateSample && packageSourceURL
473
+ ? `${packageSourceURL}/samples`
474
+ : undefined,
475
+ apiRefURL: azureHuh
476
+ ? `https://learn.microsoft.com/javascript/api/${clientPackageName}${apiRefUrlQueryParameter}`
477
+ : undefined,
478
+ dependencyDescription: dependencyInfo?.description,
479
+ dependencyLink: dependencyInfo?.link,
480
+ hasMultiClients: multiClient && batch && batch.length > 1,
481
+ azureArm: Boolean(model.options.azureArm),
482
+ azure: azureHuh,
483
+ isReleasablePackage: !isTypeSpecTest,
484
+ repoURL: repoURL,
485
+ projectName: azureHuh ? "Microsoft Azure SDK for JavaScript" : undefined,
486
+ identityPackageURL: repoURL && `${repoURL}/tree/main/sdk/identity/identity`,
487
+ addCredentials: model.options.addCredentials,
488
+ contributingGuideURL: repoURL && `${repoURL}/blob/main/CONTRIBUTING.md`,
489
+ azureSdkForJs: model.options.azureSdkForJs,
490
+ generateTest: model.options.generateTest,
491
+ hasSubscriptionId: model.options.hasSubscriptionId
492
+ };
493
+ }
494
+
495
+ function getServiceName(model: RLCModel) {
496
+ const azureHuh =
497
+ model?.options?.packageDetails?.scopeName === "azure" ||
498
+ model?.options?.packageDetails?.scopeName === "azure-rest";
499
+ const libraryName = model.libraryName;
500
+ const serviceTitle = model.options?.isModularLibrary
501
+ ? model.libraryName
502
+ : (model.options?.serviceInfo?.title ?? model.libraryName);
503
+ const batch = model?.options?.batch,
504
+ packageDetails = model?.options?.packageDetails;
505
+ let simpleServiceName =
506
+ batch && batch.length > 1
507
+ ? normalizeName(
508
+ packageDetails!.nameWithoutScope ?? packageDetails?.name ?? "",
509
+ NameType.Class
510
+ )
511
+ : normalizeName(serviceTitle, NameType.Class);
512
+ simpleServiceName =
513
+ /**
514
+ * It is a required convention in Azure swaggers for their titles to end with
515
+ * "Client".
516
+ */
517
+ serviceTitle.match(/(.*) Client/)?.[1] ??
518
+ serviceTitle.match(/(.*)Client/)?.[1] ??
519
+ libraryName.match(/(.*)Client/)?.[1] ??
520
+ serviceTitle.match(/(.*) Service/)?.[1] ??
521
+ simpleServiceName;
522
+
523
+ return azureHuh
524
+ ? simpleServiceName.startsWith("Azure")
525
+ ? simpleServiceName
526
+ : `Azure ${simpleServiceName}`
527
+ : simpleServiceName;
528
+ }
@@ -0,0 +1,150 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ import { Project } from "ts-morph";
5
+ import { RLCModel } from "../interfaces.js";
6
+ import { isAzurePackage } from "../helpers/packageUtil.js";
7
+
8
+ export function buildRollupConfig(model: RLCModel) {
9
+ const azureSdkForJs = Boolean(model.options?.azureSdkForJs);
10
+ // Only generate the file when it is not in sdk repo
11
+ if (
12
+ isAzurePackage(model) &&
13
+ (azureSdkForJs === true || azureSdkForJs === undefined)
14
+ ) {
15
+ return;
16
+ }
17
+
18
+ const project = new Project();
19
+ const filePath = "rollup.config.js";
20
+ const rollupFile = project.createSourceFile(filePath, undefined, {
21
+ overwrite: true
22
+ });
23
+
24
+ rollupFile.addStatements(
25
+ `import nodeResolve from "@rollup/plugin-node-resolve";
26
+ import cjs from "@rollup/plugin-commonjs";
27
+ import sourcemaps from "rollup-plugin-sourcemaps";
28
+ import multiEntry from "@rollup/plugin-multi-entry";
29
+ import json from "@rollup/plugin-json";
30
+
31
+ import nodeBuiltins from "builtin-modules";
32
+
33
+ // #region Warning Handler
34
+
35
+ /**
36
+ * A function that can determine whether a rollup warning should be ignored. If
37
+ * the function returns \`true\`, then the warning will not be displayed.
38
+ */
39
+
40
+ function ignoreNiseSinonEval(warning) {
41
+ return (
42
+ warning.code === "EVAL" &&
43
+ (warning.id && ((warning.id.includes("node_modules/nise")) ||
44
+ warning.id.includes("node_modules/sinon")) === true)
45
+ );
46
+ }
47
+
48
+ function ignoreChaiCircularDependency(warning) {
49
+ return (
50
+ warning.code === "CIRCULAR_DEPENDENCY" &&
51
+ (warning.importer && warning.importer.includes("node_modules/chai") === true)
52
+ );
53
+ }
54
+
55
+ const warningInhibitors = [
56
+ ignoreChaiCircularDependency,
57
+ ignoreNiseSinonEval
58
+ ];
59
+
60
+ /**
61
+ * Construct a warning handler for the shared rollup configuration
62
+ * that ignores certain warnings that are not relevant to testing.
63
+ */
64
+ function makeOnWarnForTesting() {
65
+ return (warning, warn) => {
66
+ // If every inhibitor returns false (i.e. no inhibitors), then show the warning
67
+ if (warningInhibitors.every(inhib => !inhib(warning))) {
68
+ warn(warning);
69
+ }
70
+ };
71
+ }
72
+
73
+ // #endregion
74
+
75
+ function makeBrowserTestConfig() {
76
+ const config = {
77
+ input: {
78
+ include: ["dist-esm/test/**/*.spec.js"],
79
+ exclude: ["dist-esm/test/**/node/**"]
80
+ },
81
+ output: {
82
+ file: \`dist-test/index.browser.js\`,
83
+ format: "umd",
84
+ sourcemap: true
85
+ },
86
+ preserveSymlinks: false,
87
+ plugins: [
88
+ multiEntry({ exports: false }),
89
+ nodeResolve({
90
+ mainFields: ["module", "browser"]
91
+ }),
92
+ cjs(),
93
+ json(),
94
+ sourcemaps()
95
+ //viz({ filename: "dist-test/browser-stats.html", sourcemap: true })
96
+ ],
97
+ onwarn: makeOnWarnForTesting(),
98
+ // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0,
99
+ // rollup started respecting the "sideEffects" field in package.json. Since
100
+ // our package.json sets "sideEffects=false", this also applies to test
101
+ // code, which causes all tests to be removed by tree-shaking.
102
+ treeshake: false
103
+ };
104
+
105
+ return config;
106
+ }
107
+
108
+ const defaultConfigurationOptions = {
109
+ disableBrowserBundle: false
110
+ };
111
+
112
+ export function makeConfig(
113
+ pkg,
114
+ options
115
+ ) {
116
+ options = {
117
+ ...defaultConfigurationOptions,
118
+ ...(options || {})
119
+ };
120
+
121
+ const baseConfig = {
122
+ // Use the package's module field if it has one
123
+ input: pkg["module"] || "dist-esm/src/index.js",
124
+ external: [
125
+ ...nodeBuiltins,
126
+ ...Object.keys(pkg.dependencies),
127
+ ...Object.keys(pkg.devDependencies)
128
+ ],
129
+ output: { file: "dist/index.js", format: "cjs", sourcemap: true },
130
+ preserveSymlinks: false,
131
+ plugins: [sourcemaps(), nodeResolve()]
132
+ };
133
+
134
+ const config = [baseConfig];
135
+
136
+ if (!options.disableBrowserBundle) {
137
+ config.push(makeBrowserTestConfig());
138
+ }
139
+
140
+ return config;
141
+ }
142
+
143
+ export default makeConfig(require("./package.json"));`
144
+ );
145
+
146
+ return {
147
+ path: filePath,
148
+ content: rollupFile.getFullText()
149
+ };
150
+ }
@@ -0,0 +1,22 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { RLCModel } from "../interfaces.js";
4
+
5
+ const sampleEnvText = `
6
+ # Feel free to add your own environment variables.
7
+ `;
8
+
9
+ export function buildSampleEnvFile(model: RLCModel) {
10
+ if (
11
+ (model.options?.generateMetadata === true ||
12
+ model.options?.generateSample === true) &&
13
+ model.options?.flavor === "azure"
14
+ ) {
15
+ const filePath = "sample.env";
16
+ return {
17
+ path: filePath,
18
+ content: sampleEnvText.trim()
19
+ };
20
+ }
21
+ return undefined;
22
+ }