@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,426 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4
+ // @ts-ignore: to fix the handlebars issue
5
+ import hbs from "handlebars";
6
+ import { NameType, normalizeName } from "../helpers/nameUtils.js";
7
+ import { isAzurePackage } from "../helpers/packageUtil.js";
8
+ import { getClientName } from "../helpers/nameConstructors.js";
9
+ import { readFileSync } from "fs";
10
+ const azureReadmeRLCTemplate = `# {{ clientDescriptiveName }} library for JavaScript
11
+
12
+ {{ description }}
13
+
14
+ {{#if azureArm}}
15
+ **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
16
+ {{else}}
17
+ **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**
18
+ {{/if}}
19
+
20
+ Key links:
21
+
22
+ {{#if packageSourceURL}}
23
+ - [Source code]({{ packageSourceURL }})
24
+ {{/if}}
25
+ {{#if packageNPMURL}}
26
+ - [Package (NPM)]({{ packageNPMURL }})
27
+ {{/if}}
28
+ {{#if apiRefURL}}
29
+ - [API reference documentation]({{ apiRefURL }})
30
+ {{/if}}
31
+ {{#if serviceDocURL}}
32
+ - [Product documentation]({{ serviceDocURL }})
33
+ {{/if}}
34
+ {{#if samplesURL}}
35
+ - [Samples]({{ samplesURL }})
36
+ {{/if}}
37
+
38
+ ## Getting started
39
+
40
+ ### Currently supported environments
41
+
42
+ - LTS versions of Node.js
43
+
44
+ ### Prerequisites
45
+
46
+ - You must have an [Azure subscription](https://azure.microsoft.com/free/){{#if dependencyLink}} and follow [these]({{ dependencyLink }}) instructions{{/if}} to use this package.
47
+
48
+ ### Install the \`{{ clientPackageName }}\` package
49
+
50
+ Install the {{ clientDescriptiveName }} REST client library for JavaScript with \`npm\`:
51
+
52
+ \`\`\`bash
53
+ npm install {{ clientPackageName }}
54
+ \`\`\`
55
+
56
+ ### Create and authenticate a \`{{ clientClassName }}\`
57
+
58
+ 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),
59
+ provide an instance of the desired credential type obtained from the
60
+ [@azure/identity](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) library.
61
+
62
+ To authenticate with AAD, you must first \`npm\` install [\`@azure/identity\`](https://www.npmjs.com/package/@azure/identity) {{#if dependencyLink}}and
63
+ [{{dependencyDescription }}]({{ dependencyLink }}){{/if}}
64
+
65
+ 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.
66
+ As an example, [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential)
67
+ can be used to authenticate the client.
68
+
69
+ ## Troubleshooting
70
+
71
+ ### Logging
72
+
73
+ 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\`:
74
+
75
+ \`\`\`ts {{#if azureSdkForJs}}{{#if generateTest}}snippet:SetLogLevel{{/if}}{{/if}}
76
+ import { setLogLevel } from "@azure/logger";
77
+
78
+ setLogLevel("info");
79
+ \`\`\`
80
+
81
+ 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).
82
+ `;
83
+ const azureReadmeModularTemplate = `# {{ clientDescriptiveName }} library for JavaScript
84
+
85
+ This package contains an isomorphic SDK (runs both in Node.js and in browsers) for {{ clientDescriptiveName }}.
86
+
87
+ {{ description }}
88
+
89
+ Key links:
90
+
91
+ {{#if packageSourceURL}}
92
+ - [Source code]({{ packageSourceURL }})
93
+ {{/if}}
94
+ {{#if packageNPMURL}}
95
+ - [Package (NPM)]({{ packageNPMURL }})
96
+ {{/if}}
97
+ {{#if apiRefURL}}
98
+ - [API reference documentation]({{ apiRefURL }})
99
+ {{/if}}
100
+ {{#if samplesURL}}
101
+ - [Samples]({{samplesURL}})
102
+ {{/if}}
103
+
104
+ ## Getting started
105
+
106
+ ### Currently supported environments
107
+
108
+ - [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule)
109
+ - Latest versions of Safari, Chrome, Edge and Firefox.
110
+
111
+ See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
112
+
113
+ {{#if azure}}
114
+ ### Prerequisites
115
+
116
+ - An [Azure subscription][azure_sub].
117
+ {{/if}}
118
+
119
+ {{#if isReleasablePackage}}
120
+ ### Install the \`{{ clientPackageName }}\` package
121
+
122
+ Install the {{ clientDescriptiveName }} library for JavaScript with \`npm\`:
123
+
124
+ \`\`\`bash
125
+ npm install {{ clientPackageName }}
126
+ \`\`\`
127
+ {{/if}}
128
+
129
+ {{#if azure}}
130
+ {{#if addCredentials}}
131
+ ### Create and authenticate a \`{{ clientClassName}}\`
132
+
133
+ 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.
134
+ You can find the endpoint for your {{ serviceName }} resource in the [Azure Portal][azure_portal].
135
+
136
+ 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).
137
+
138
+ To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the \`@azure/identity\` package:
139
+
140
+ \`\`\`bash
141
+ npm install @azure/identity
142
+ \`\`\`
143
+
144
+ 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).
145
+
146
+ 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).
147
+
148
+ {{#if azureArm}}
149
+ Using Node.js and Node-like environments, you can use the \`DefaultAzureCredential\` class to authenticate the client.
150
+
151
+ \`\`\`ts {{#if azureSdkForJs}}{{#if generateTest}}snippet:ReadmeSampleCreateClient_Node{{/if}}{{/if}}
152
+ import { {{ clientClassName }} } from "{{ clientPackageName }}";
153
+ import { DefaultAzureCredential } from "@azure/identity";
154
+
155
+ {{#if hasSubscriptionId}}
156
+ const subscriptionId = "00000000-0000-0000-0000-000000000000";
157
+ const client = new {{ clientClassName }}(new DefaultAzureCredential(), subscriptionId);
158
+ {{else}}
159
+ const client = new {{ clientClassName }}(new DefaultAzureCredential());
160
+ {{/if}}
161
+ \`\`\`
162
+
163
+ For browser environments, use the \`InteractiveBrowserCredential\` from the \`@azure/identity\` package to authenticate.
164
+
165
+ \`\`\`ts {{#if azureSdkForJs}}{{#if generateTest}}snippet:ReadmeSampleCreateClient_Browser{{/if}}{{/if}}
166
+ import { InteractiveBrowserCredential } from "@azure/identity";
167
+ import { {{ clientClassName }} } from "{{ clientPackageName }}";
168
+
169
+ const credential = new InteractiveBrowserCredential({
170
+ tenantId: "<YOUR_TENANT_ID>",
171
+ clientId: "<YOUR_CLIENT_ID>",
172
+ });
173
+
174
+ {{#if hasSubscriptionId}}
175
+ const subscriptionId = "00000000-0000-0000-0000-000000000000";
176
+ const client = new {{ clientClassName }}(credential, subscriptionId);
177
+ {{else}}
178
+ const client = new {{ clientClassName }}(credential);
179
+ {{/if}}
180
+ \`\`\`
181
+ {{else}}
182
+ Using Node.js and Node-like environments, you can use the \`DefaultAzureCredential\` class to authenticate the client.
183
+
184
+ \`\`\`ts {{#if azureSdkForJs}}{{#if generateTest}}snippet:ReadmeSampleCreateClient_Node{{/if}}{{/if}}
185
+ import { {{ clientClassName }} } from "{{ clientPackageName }}";
186
+ import { DefaultAzureCredential } from "@azure/identity";
187
+
188
+ const client = new {{ clientClassName }}("<endpoint>", new DefaultAzureCredential());
189
+ \`\`\`
190
+
191
+ For browser environments, use the \`InteractiveBrowserCredential\` from the \`@azure/identity\` package to authenticate.
192
+
193
+ \`\`\`ts {{#if azureSdkForJs}}{{#if generateTest}}snippet:ReadmeSampleCreateClient_Browser{{/if}}{{/if}}
194
+ import { InteractiveBrowserCredential } from "@azure/identity";
195
+ import { {{ clientClassName }} } from "{{ clientPackageName }}";
196
+
197
+ const credential = new InteractiveBrowserCredential({
198
+ tenantId: "<YOUR_TENANT_ID>",
199
+ clientId: "<YOUR_CLIENT_ID>"
200
+ });
201
+ const client = new {{ clientClassName }}("<endpoint>", credential);
202
+ \`\`\`
203
+ {{/if}}
204
+ {{/if}}{{/if}}
205
+
206
+ ### JavaScript Bundle
207
+ 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).
208
+
209
+ ## Key concepts
210
+
211
+ ### {{ clientClassName }}
212
+
213
+ \`{{ 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.
214
+
215
+ {{#if azure}}
216
+ ## Troubleshooting
217
+
218
+ ### Logging
219
+
220
+ 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\`:
221
+
222
+ \`\`\`ts {{#if azureSdkForJs}}{{#if generateTest}}snippet:SetLogLevel{{/if}}{{/if}}
223
+ import { setLogLevel } from "@azure/logger";
224
+
225
+ setLogLevel("info");
226
+ \`\`\`
227
+
228
+ For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs]({{ repoURL }}/tree/main/sdk/core/logger).
229
+
230
+ {{#if samplesURL}}
231
+ ## Next steps
232
+
233
+ Please take a look at the [samples]({{ samplesURL }}) directory for detailed examples on how to use this library.
234
+ {{/if}}
235
+
236
+ ## Contributing
237
+
238
+ 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.
239
+
240
+ ## Related projects
241
+
242
+ - [{{ projectName }}]({{ repoURL }})
243
+
244
+ [azure_sub]: https://azure.microsoft.com/free/
245
+ [azure_portal]: https://portal.azure.com
246
+ {{#if identityPackageURL}}[azure_identity]: {{ identityPackageURL }}
247
+ {{/if}}[defaultazurecredential]: {{ identityPackageURL }}#defaultazurecredential
248
+ {{/if}}
249
+ `;
250
+ const nonBrandedReadmeTemplate = `# {{ clientDescriptiveName }} library for JavaScript
251
+
252
+ {{ description }}
253
+
254
+ Key links:
255
+
256
+ {{#if packageSourceURL}}
257
+ - [Source code]({{ packageSourceURL }})
258
+ {{/if}}
259
+ {{#if packageNPMURL}}
260
+ - [Package (NPM)]({{ packageNPMURL }})
261
+ {{/if}}
262
+ {{#if apiRefURL}}
263
+ - [API reference documentation]({{ apiRefURL }})
264
+ {{/if}}
265
+ {{#if serviceDocURL}}
266
+ - [Product documentation]({{ serviceDocURL }})
267
+ {{/if}}
268
+ {{#if samplesURL}}
269
+ - [Samples]({{ samplesURL }})
270
+ {{/if}}
271
+
272
+ ## Getting started
273
+
274
+ ### Currently supported environments
275
+
276
+ - LTS versions of Node.js
277
+
278
+ ### Install the \`{{ clientPackageName }}\` package
279
+
280
+ Install the {{ clientDescriptiveName }} library for JavaScript with \`npm\`:
281
+
282
+ \`\`\`bash
283
+ npm install {{ clientPackageName }}
284
+ \`\`\`
285
+ `;
286
+ const apiReferenceTemplate = `{{#if apiRefURL}}
287
+ - [API reference documentation]({{ apiRefURL }})
288
+ {{/if}}
289
+ `;
290
+ export function buildReadmeFile(model) {
291
+ var _a;
292
+ const metadata = (_a = createMetadata(model)) !== null && _a !== void 0 ? _a : {};
293
+ const readmeFileContents = hbs.compile(model.options && isAzurePackage(model)
294
+ ? model.options.isModularLibrary
295
+ ? azureReadmeModularTemplate
296
+ : azureReadmeRLCTemplate
297
+ : nonBrandedReadmeTemplate, { noEscape: true });
298
+ return {
299
+ path: "README.md",
300
+ content: readmeFileContents(metadata)
301
+ };
302
+ }
303
+ export function hasClientNameChanged(model, existingReadmeFilePath) {
304
+ try {
305
+ const existingContent = readFileSync(existingReadmeFilePath, "utf8");
306
+ const importMatch = existingContent.match(/import\s*\{\s*([A-Za-z0-9_]+)\s*\}\s*from\s*["'][^"']*["']/);
307
+ const existingClientName = importMatch === null || importMatch === void 0 ? void 0 : importMatch[1];
308
+ const newClientName = getClientName(model);
309
+ return !!existingClientName && existingClientName !== newClientName;
310
+ }
311
+ catch {
312
+ return false;
313
+ }
314
+ }
315
+ export function updateReadmeFile(model, existingReadmeFilePath) {
316
+ var _a;
317
+ try {
318
+ const existingContent = readFileSync(existingReadmeFilePath, "utf8");
319
+ const metadata = (_a = createMetadata(model)) !== null && _a !== void 0 ? _a : {};
320
+ const newApiRefLink = hbs
321
+ .compile(apiReferenceTemplate, { noEscape: true })(metadata)
322
+ .trim();
323
+ if (!newApiRefLink) {
324
+ return { path: "README.md", content: existingContent };
325
+ }
326
+ const apiRefRegex = /^- \[API reference documentation\]\(https:\/\/learn\.microsoft\.com\/javascript\/api\/[^)]+\)$/m;
327
+ const updatedContent = existingContent.replace(apiRefRegex, (match) => match ? newApiRefLink : match);
328
+ return { path: "README.md", content: updatedContent };
329
+ }
330
+ catch {
331
+ return;
332
+ }
333
+ }
334
+ /**
335
+ * Returns meta data information about the service, the package, and the client.
336
+ * @param codeModel - include the client details
337
+ * @returns inferred metadata about the service, the package, and the client
338
+ */
339
+ function createMetadata(model) {
340
+ var _a, _b, _c, _d, _e;
341
+ if (!model.options || !model.options.packageDetails) {
342
+ return;
343
+ }
344
+ // const packageDetails = model.options.packageDetails;
345
+ const { packageDetails, azureOutputDirectory, productDocLink, dependencyInfo, multiClient, batch, serviceInfo, isTypeSpecTest } = model.options;
346
+ const azureHuh = (packageDetails === null || packageDetails === void 0 ? void 0 : packageDetails.scopeName) === "azure" ||
347
+ (packageDetails === null || packageDetails === void 0 ? void 0 : packageDetails.scopeName) === "azure-rest";
348
+ const repoURL = "https://github.com/Azure/azure-sdk-for-js";
349
+ const relativePackageSourcePath = azureOutputDirectory;
350
+ const packageSourceURL = relativePackageSourcePath &&
351
+ repoURL &&
352
+ `${repoURL}/tree/main/${relativePackageSourcePath}`;
353
+ const clientPackageName = packageDetails === null || packageDetails === void 0 ? void 0 : packageDetails.name;
354
+ const clientClassName = getClientName(model);
355
+ const serviceName = getServiceName(model);
356
+ let apiRefUrlQueryParameter = "";
357
+ if (!(packageDetails === null || packageDetails === void 0 ? void 0 : packageDetails.isVersionUserProvided) &&
358
+ ((_a = model.apiVersionInfo) === null || _a === void 0 ? void 0 : _a.defaultValue)) {
359
+ if ((_c = (_b = model.apiVersionInfo) === null || _b === void 0 ? void 0 : _b.defaultValue) === null || _c === void 0 ? void 0 : _c.toLowerCase().includes("preview")) {
360
+ apiRefUrlQueryParameter = "?view=azure-node-preview";
361
+ }
362
+ }
363
+ else {
364
+ packageDetails.version = (_d = packageDetails.version) !== null && _d !== void 0 ? _d : "1.0.0-beta.1";
365
+ if (packageDetails === null || packageDetails === void 0 ? void 0 : packageDetails.version.includes("beta")) {
366
+ apiRefUrlQueryParameter = "?view=azure-node-preview";
367
+ }
368
+ }
369
+ return {
370
+ serviceName,
371
+ clientClassName,
372
+ clientPackageName: clientPackageName,
373
+ clientDescriptiveName: model.options.isModularLibrary
374
+ ? `${serviceName} client`
375
+ : `${serviceName} REST client`,
376
+ description: (_e = serviceInfo === null || serviceInfo === void 0 ? void 0 : serviceInfo.description) !== null && _e !== void 0 ? _e : packageDetails.description,
377
+ serviceDocURL: productDocLink,
378
+ packageSourceURL: packageSourceURL,
379
+ packageNPMURL: `https://www.npmjs.com/package/${clientPackageName}`,
380
+ samplesURL: model.options.generateSample && packageSourceURL
381
+ ? `${packageSourceURL}/samples`
382
+ : undefined,
383
+ apiRefURL: azureHuh
384
+ ? `https://learn.microsoft.com/javascript/api/${clientPackageName}${apiRefUrlQueryParameter}`
385
+ : undefined,
386
+ dependencyDescription: dependencyInfo === null || dependencyInfo === void 0 ? void 0 : dependencyInfo.description,
387
+ dependencyLink: dependencyInfo === null || dependencyInfo === void 0 ? void 0 : dependencyInfo.link,
388
+ hasMultiClients: multiClient && batch && batch.length > 1,
389
+ azureArm: Boolean(model.options.azureArm),
390
+ azure: azureHuh,
391
+ isReleasablePackage: !isTypeSpecTest,
392
+ repoURL: repoURL,
393
+ projectName: azureHuh ? "Microsoft Azure SDK for JavaScript" : undefined,
394
+ identityPackageURL: repoURL && `${repoURL}/tree/main/sdk/identity/identity`,
395
+ addCredentials: model.options.addCredentials,
396
+ contributingGuideURL: repoURL && `${repoURL}/blob/main/CONTRIBUTING.md`,
397
+ azureSdkForJs: model.options.azureSdkForJs,
398
+ generateTest: model.options.generateTest,
399
+ hasSubscriptionId: model.options.hasSubscriptionId
400
+ };
401
+ }
402
+ function getServiceName(model) {
403
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
404
+ const azureHuh = ((_b = (_a = model === null || model === void 0 ? void 0 : model.options) === null || _a === void 0 ? void 0 : _a.packageDetails) === null || _b === void 0 ? void 0 : _b.scopeName) === "azure" ||
405
+ ((_d = (_c = model === null || model === void 0 ? void 0 : model.options) === null || _c === void 0 ? void 0 : _c.packageDetails) === null || _d === void 0 ? void 0 : _d.scopeName) === "azure-rest";
406
+ const libraryName = model.libraryName;
407
+ const serviceTitle = ((_e = model.options) === null || _e === void 0 ? void 0 : _e.isModularLibrary)
408
+ ? model.libraryName
409
+ : ((_h = (_g = (_f = model.options) === null || _f === void 0 ? void 0 : _f.serviceInfo) === null || _g === void 0 ? void 0 : _g.title) !== null && _h !== void 0 ? _h : model.libraryName);
410
+ const batch = (_j = model === null || model === void 0 ? void 0 : model.options) === null || _j === void 0 ? void 0 : _j.batch, packageDetails = (_k = model === null || model === void 0 ? void 0 : model.options) === null || _k === void 0 ? void 0 : _k.packageDetails;
411
+ let simpleServiceName = batch && batch.length > 1
412
+ ? normalizeName((_m = (_l = packageDetails.nameWithoutScope) !== null && _l !== void 0 ? _l : packageDetails === null || packageDetails === void 0 ? void 0 : packageDetails.name) !== null && _m !== void 0 ? _m : "", NameType.Class)
413
+ : normalizeName(serviceTitle, NameType.Class);
414
+ simpleServiceName =
415
+ /**
416
+ * It is a required convention in Azure swaggers for their titles to end with
417
+ * "Client".
418
+ */
419
+ (_v = (_t = (_r = (_p = (_o = serviceTitle.match(/(.*) Client/)) === null || _o === void 0 ? void 0 : _o[1]) !== null && _p !== void 0 ? _p : (_q = serviceTitle.match(/(.*)Client/)) === null || _q === void 0 ? void 0 : _q[1]) !== null && _r !== void 0 ? _r : (_s = libraryName.match(/(.*)Client/)) === null || _s === void 0 ? void 0 : _s[1]) !== null && _t !== void 0 ? _t : (_u = serviceTitle.match(/(.*) Service/)) === null || _u === void 0 ? void 0 : _u[1]) !== null && _v !== void 0 ? _v : simpleServiceName;
420
+ return azureHuh
421
+ ? simpleServiceName.startsWith("Azure")
422
+ ? simpleServiceName
423
+ : `Azure ${simpleServiceName}`
424
+ : simpleServiceName;
425
+ }
426
+ //# sourceMappingURL=buildReadmeFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildReadmeFile.js","sourceRoot":"","sources":["../../../../src/rlc-common/metadata/buildReadmeFile.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,6DAA6D;AAC7D,0CAA0C;AAC1C,OAAO,GAAG,MAAM,YAAY,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAElC,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwE9B,CAAC;AAEF,MAAM,0BAA0B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsKlC,CAAC;AAEF,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmChC,CAAC;AAEF,MAAM,oBAAo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1
+ import { RLCModel } from "../interfaces.js";
2
+ export declare function buildRollupConfig(model: RLCModel): {
3
+ path: string;
4
+ content: string;
5
+ } | undefined;
6
+ //# sourceMappingURL=buildRollupConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildRollupConfig.d.ts","sourceRoot":"","sources":["../../../../src/rlc-common/metadata/buildRollupConfig.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ;;;cA8IhD"}
@@ -0,0 +1,142 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { Project } from "ts-morph";
4
+ import { isAzurePackage } from "../helpers/packageUtil.js";
5
+ export function buildRollupConfig(model) {
6
+ var _a;
7
+ const azureSdkForJs = Boolean((_a = model.options) === null || _a === void 0 ? void 0 : _a.azureSdkForJs);
8
+ // Only generate the file when it is not in sdk repo
9
+ if (isAzurePackage(model) &&
10
+ (azureSdkForJs === true || azureSdkForJs === undefined)) {
11
+ return;
12
+ }
13
+ const project = new Project();
14
+ const filePath = "rollup.config.js";
15
+ const rollupFile = project.createSourceFile(filePath, undefined, {
16
+ overwrite: true
17
+ });
18
+ rollupFile.addStatements(`import nodeResolve from "@rollup/plugin-node-resolve";
19
+ import cjs from "@rollup/plugin-commonjs";
20
+ import sourcemaps from "rollup-plugin-sourcemaps";
21
+ import multiEntry from "@rollup/plugin-multi-entry";
22
+ import json from "@rollup/plugin-json";
23
+
24
+ import nodeBuiltins from "builtin-modules";
25
+
26
+ // #region Warning Handler
27
+
28
+ /**
29
+ * A function that can determine whether a rollup warning should be ignored. If
30
+ * the function returns \`true\`, then the warning will not be displayed.
31
+ */
32
+
33
+ function ignoreNiseSinonEval(warning) {
34
+ return (
35
+ warning.code === "EVAL" &&
36
+ (warning.id && ((warning.id.includes("node_modules/nise")) ||
37
+ warning.id.includes("node_modules/sinon")) === true)
38
+ );
39
+ }
40
+
41
+ function ignoreChaiCircularDependency(warning) {
42
+ return (
43
+ warning.code === "CIRCULAR_DEPENDENCY" &&
44
+ (warning.importer && warning.importer.includes("node_modules/chai") === true)
45
+ );
46
+ }
47
+
48
+ const warningInhibitors = [
49
+ ignoreChaiCircularDependency,
50
+ ignoreNiseSinonEval
51
+ ];
52
+
53
+ /**
54
+ * Construct a warning handler for the shared rollup configuration
55
+ * that ignores certain warnings that are not relevant to testing.
56
+ */
57
+ function makeOnWarnForTesting() {
58
+ return (warning, warn) => {
59
+ // If every inhibitor returns false (i.e. no inhibitors), then show the warning
60
+ if (warningInhibitors.every(inhib => !inhib(warning))) {
61
+ warn(warning);
62
+ }
63
+ };
64
+ }
65
+
66
+ // #endregion
67
+
68
+ function makeBrowserTestConfig() {
69
+ const config = {
70
+ input: {
71
+ include: ["dist-esm/test/**/*.spec.js"],
72
+ exclude: ["dist-esm/test/**/node/**"]
73
+ },
74
+ output: {
75
+ file: \`dist-test/index.browser.js\`,
76
+ format: "umd",
77
+ sourcemap: true
78
+ },
79
+ preserveSymlinks: false,
80
+ plugins: [
81
+ multiEntry({ exports: false }),
82
+ nodeResolve({
83
+ mainFields: ["module", "browser"]
84
+ }),
85
+ cjs(),
86
+ json(),
87
+ sourcemaps()
88
+ //viz({ filename: "dist-test/browser-stats.html", sourcemap: true })
89
+ ],
90
+ onwarn: makeOnWarnForTesting(),
91
+ // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0,
92
+ // rollup started respecting the "sideEffects" field in package.json. Since
93
+ // our package.json sets "sideEffects=false", this also applies to test
94
+ // code, which causes all tests to be removed by tree-shaking.
95
+ treeshake: false
96
+ };
97
+
98
+ return config;
99
+ }
100
+
101
+ const defaultConfigurationOptions = {
102
+ disableBrowserBundle: false
103
+ };
104
+
105
+ export function makeConfig(
106
+ pkg,
107
+ options
108
+ ) {
109
+ options = {
110
+ ...defaultConfigurationOptions,
111
+ ...(options || {})
112
+ };
113
+
114
+ const baseConfig = {
115
+ // Use the package's module field if it has one
116
+ input: pkg["module"] || "dist-esm/src/index.js",
117
+ external: [
118
+ ...nodeBuiltins,
119
+ ...Object.keys(pkg.dependencies),
120
+ ...Object.keys(pkg.devDependencies)
121
+ ],
122
+ output: { file: "dist/index.js", format: "cjs", sourcemap: true },
123
+ preserveSymlinks: false,
124
+ plugins: [sourcemaps(), nodeResolve()]
125
+ };
126
+
127
+ const config = [baseConfig];
128
+
129
+ if (!options.disableBrowserBundle) {
130
+ config.push(makeBrowserTestConfig());
131
+ }
132
+
133
+ return config;
134
+ }
135
+
136
+ export default makeConfig(require("./package.json"));`);
137
+ return {
138
+ path: filePath,
139
+ content: rollupFile.getFullText()
140
+ };
141
+ }
142
+ //# sourceMappingURL=buildRollupConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildRollupConfig.js","sourceRoot":"","sources":["../../../../src/rlc-common/metadata/buildRollupConfig.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,MAAM,UAAU,iBAAiB,CAAC,KAAe;;IAC/C,MAAM,aAAa,GAAG,OAAO,CAAC,MAAA,KAAK,CAAC,OAAO,0CAAE,aAAa,CAAC,CAAC;IAC5D,oDAAoD;IACpD,IACE,cAAc,CAAC,KAAK,CAAC;QACrB,CAAC,aAAa,KAAK,IAAI,IAAI,aAAa,KAAK,SAAS,CAAC,EACvD,CAAC;QACD,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAC9B,MAAM,QAAQ,GAAG,kBAAkB,CAAC;IACpC,MAAM,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,SAAS,EAAE;QAC/D,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC;IAEH,UAAU,CAAC,aAAa,CACtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0DAsHsD,CACvD,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,UAAU,CAAC,WAAW,EAAE;KAClC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { RLCModel } from "../interfaces.js";
2
+ export declare function buildSampleEnvFile(model: RLCModel): {
3
+ path: string;
4
+ content: string;
5
+ } | undefined;
6
+ //# sourceMappingURL=buildSampleEnvFile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildSampleEnvFile.d.ts","sourceRoot":"","sources":["../../../../src/rlc-common/metadata/buildSampleEnvFile.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAM5C,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ;;;cAajD"}
@@ -0,0 +1,17 @@
1
+ const sampleEnvText = `
2
+ # Feel free to add your own environment variables.
3
+ `;
4
+ export function buildSampleEnvFile(model) {
5
+ var _a, _b, _c;
6
+ if ((((_a = model.options) === null || _a === void 0 ? void 0 : _a.generateMetadata) === true ||
7
+ ((_b = model.options) === null || _b === void 0 ? void 0 : _b.generateSample) === true) &&
8
+ ((_c = model.options) === null || _c === void 0 ? void 0 : _c.flavor) === "azure") {
9
+ const filePath = "sample.env";
10
+ return {
11
+ path: filePath,
12
+ content: sampleEnvText.trim()
13
+ };
14
+ }
15
+ return undefined;
16
+ }
17
+ //# sourceMappingURL=buildSampleEnvFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildSampleEnvFile.js","sourceRoot":"","sources":["../../../../src/rlc-common/metadata/buildSampleEnvFile.ts"],"names":[],"mappings":"AAIA,MAAM,aAAa,GAAG;;CAErB,CAAC;AAEF,MAAM,UAAU,kBAAkB,CAAC,KAAe;;IAChD,IACE,CAAC,CAAA,MAAA,KAAK,CAAC,OAAO,0CAAE,gBAAgB,MAAK,IAAI;QACvC,CAAA,MAAA,KAAK,CAAC,OAAO,0CAAE,cAAc,MAAK,IAAI,CAAC;QACzC,CAAA,MAAA,KAAK,CAAC,OAAO,0CAAE,MAAM,MAAK,OAAO,EACjC,CAAC;QACD,MAAM,QAAQ,GAAG,YAAY,CAAC;QAC9B,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,aAAa,CAAC,IAAI,EAAE;SAC9B,CAAC;IACJ,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { RLCModel } from "../interfaces.js";
2
+ /**
3
+ * Builds config/tsconfig.test.browser.json — extends eng/tsconfigs/test.browser.json
4
+ */
5
+ export declare function buildTestBrowserTsConfig(model: RLCModel): {
6
+ path: string;
7
+ content: string;
8
+ } | undefined;
9
+ /**
10
+ * Builds config/tsconfig.test.node.json — extends eng/tsconfigs/test.node.json
11
+ */
12
+ export declare function buildTestNodeTsConfig(model: RLCModel): {
13
+ path: string;
14
+ content: string;
15
+ } | undefined;
16
+ //# sourceMappingURL=buildTestConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildTestConfig.d.ts","sourceRoot":"","sources":["../../../../src/rlc-common/metadata/buildTestConfig.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAY5C;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,QAAQ;;;cAwBvD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,QAAQ;;;cAwBpD"}