@azure-tools/typespec-ts 0.56.0-dev.1 → 0.56.0-dev.11

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 (459) hide show
  1. package/README.md +1 -13
  2. package/dist/src/context-manager.d.ts +19 -2
  3. package/dist/src/context-manager.d.ts.map +1 -1
  4. package/dist/src/context-manager.js +21 -0
  5. package/dist/src/context-manager.js.map +1 -1
  6. package/dist/src/framework/declaration.d.ts.map +1 -1
  7. package/dist/src/framework/declaration.js +6 -20
  8. package/dist/src/framework/declaration.js.map +1 -1
  9. package/dist/src/framework/hooks/sdk-types.d.ts +9 -0
  10. package/dist/src/framework/hooks/sdk-types.d.ts.map +1 -1
  11. package/dist/src/framework/hooks/sdk-types.js +14 -1
  12. package/dist/src/framework/hooks/sdk-types.js.map +1 -1
  13. package/dist/src/framework/source-file-batch.d.ts +35 -0
  14. package/dist/src/framework/source-file-batch.d.ts.map +1 -0
  15. package/dist/src/framework/source-file-batch.js +128 -0
  16. package/dist/src/framework/source-file-batch.js.map +1 -0
  17. package/dist/src/index.d.ts.map +1 -1
  18. package/dist/src/index.js +73 -62
  19. package/dist/src/index.js.map +1 -1
  20. package/dist/src/{rlc-common/interfaces.d.ts → interfaces.d.ts} +12 -14
  21. package/dist/src/interfaces.d.ts.map +1 -0
  22. package/dist/src/interfaces.js.map +1 -0
  23. package/dist/src/lib.d.ts +2 -4
  24. package/dist/src/lib.d.ts.map +1 -1
  25. package/dist/src/lib.js +2 -12
  26. package/dist/src/lib.js.map +1 -1
  27. package/dist/src/meta-tree.d.ts +4 -4
  28. package/dist/src/meta-tree.d.ts.map +1 -1
  29. package/dist/src/metadata/build-api-extractor-config.d.ts +6 -0
  30. package/dist/src/metadata/build-api-extractor-config.d.ts.map +1 -0
  31. package/dist/src/metadata/build-api-extractor-config.js.map +1 -0
  32. package/dist/src/metadata/build-changelog-file.d.ts +6 -0
  33. package/dist/src/metadata/build-changelog-file.d.ts.map +1 -0
  34. package/dist/src/metadata/build-changelog-file.js.map +1 -0
  35. package/dist/src/metadata/build-es-lint-config.d.ts +6 -0
  36. package/dist/src/metadata/build-es-lint-config.d.ts.map +1 -0
  37. package/dist/src/metadata/build-es-lint-config.js.map +1 -0
  38. package/dist/src/metadata/build-license-file.d.ts.map +1 -0
  39. package/dist/src/metadata/build-license-file.js.map +1 -0
  40. package/dist/src/{rlc-common/metadata → metadata}/build-package-file.d.ts +3 -3
  41. package/dist/src/metadata/build-package-file.d.ts.map +1 -0
  42. package/dist/src/{rlc-common/metadata → metadata}/build-package-file.js +1 -1
  43. package/dist/src/metadata/build-package-file.js.map +1 -0
  44. package/dist/src/metadata/build-readme-file.d.ts +11 -0
  45. package/dist/src/metadata/build-readme-file.d.ts.map +1 -0
  46. package/dist/src/{rlc-common/metadata → metadata}/build-readme-file.js +16 -69
  47. package/dist/src/metadata/build-readme-file.js.map +1 -0
  48. package/dist/src/metadata/build-sample-env-file.d.ts +6 -0
  49. package/dist/src/metadata/build-sample-env-file.d.ts.map +1 -0
  50. package/dist/src/metadata/build-sample-env-file.js.map +1 -0
  51. package/dist/src/{rlc-common/metadata → metadata}/build-test-config.d.ts +3 -3
  52. package/dist/src/metadata/build-test-config.d.ts.map +1 -0
  53. package/dist/src/metadata/build-test-config.js.map +1 -0
  54. package/dist/src/{rlc-common/metadata → metadata}/build-ts-config.d.ts +3 -3
  55. package/dist/src/metadata/build-ts-config.d.ts.map +1 -0
  56. package/dist/src/metadata/build-ts-config.js.map +1 -0
  57. package/dist/src/metadata/build-vitest-config.d.ts +6 -0
  58. package/dist/src/metadata/build-vitest-config.d.ts.map +1 -0
  59. package/dist/src/metadata/build-vitest-config.js.map +1 -0
  60. package/dist/src/{rlc-common/metadata → metadata}/build-warp-config.d.ts +2 -2
  61. package/dist/src/metadata/build-warp-config.d.ts.map +1 -0
  62. package/dist/src/metadata/build-warp-config.js.map +1 -0
  63. package/dist/src/metadata/package-json/azure-package-common.d.ts.map +1 -0
  64. package/dist/src/metadata/package-json/azure-package-common.js.map +1 -0
  65. package/dist/src/metadata/package-json/build-azure-monorepo-package.d.ts.map +1 -0
  66. package/dist/src/metadata/package-json/build-azure-monorepo-package.js.map +1 -0
  67. package/dist/src/metadata/package-json/package-common.d.ts.map +1 -0
  68. package/dist/src/metadata/package-json/package-common.js.map +1 -0
  69. package/dist/src/metadata/render-template.d.ts +24 -0
  70. package/dist/src/metadata/render-template.d.ts.map +1 -0
  71. package/dist/src/metadata/render-template.js +148 -0
  72. package/dist/src/metadata/render-template.js.map +1 -0
  73. package/dist/src/metadata/test/build-recorded-client.d.ts +6 -0
  74. package/dist/src/metadata/test/build-recorded-client.d.ts.map +1 -0
  75. package/dist/src/metadata/test/build-recorded-client.js +8 -0
  76. package/dist/src/metadata/test/build-recorded-client.js.map +1 -0
  77. package/dist/src/metadata/test/build-sample-test.d.ts +6 -0
  78. package/dist/src/metadata/test/build-sample-test.d.ts.map +1 -0
  79. package/dist/src/metadata/test/build-sample-test.js +8 -0
  80. package/dist/src/metadata/test/build-sample-test.js.map +1 -0
  81. package/dist/src/metadata/test/build-snippets.d.ts +6 -0
  82. package/dist/src/metadata/test/build-snippets.d.ts.map +1 -0
  83. package/dist/src/{rlc-common → metadata}/test/build-snippets.js +3 -5
  84. package/dist/src/metadata/test/build-snippets.js.map +1 -0
  85. package/dist/src/metadata/test/template.d.ts +4 -0
  86. package/dist/src/metadata/test/template.d.ts.map +1 -0
  87. package/dist/src/metadata/test/template.js +100 -0
  88. package/dist/src/metadata/test/template.js.map +1 -0
  89. package/dist/src/metadata/utils.d.ts +3 -0
  90. package/dist/src/metadata/utils.d.ts.map +1 -0
  91. package/dist/src/metadata/utils.js.map +1 -0
  92. package/dist/src/modular/build-classical-client.d.ts.map +1 -1
  93. package/dist/src/modular/build-classical-client.js +9 -9
  94. package/dist/src/modular/build-classical-client.js.map +1 -1
  95. package/dist/src/modular/build-classical-operation-groups.d.ts.map +1 -1
  96. package/dist/src/modular/build-classical-operation-groups.js +3 -3
  97. package/dist/src/modular/build-classical-operation-groups.js.map +1 -1
  98. package/dist/src/modular/build-client-context.d.ts.map +1 -1
  99. package/dist/src/modular/build-client-context.js +7 -7
  100. package/dist/src/modular/build-client-context.js.map +1 -1
  101. package/dist/src/modular/build-modular-options.js +3 -3
  102. package/dist/src/modular/build-modular-options.js.map +1 -1
  103. package/dist/src/modular/build-operations.d.ts.map +1 -1
  104. package/dist/src/modular/build-operations.js +6 -6
  105. package/dist/src/modular/build-operations.js.map +1 -1
  106. package/dist/src/modular/build-project-files.d.ts.map +1 -1
  107. package/dist/src/modular/build-project-files.js +4 -4
  108. package/dist/src/modular/build-project-files.js.map +1 -1
  109. package/dist/src/modular/build-restore-poller.d.ts.map +1 -1
  110. package/dist/src/modular/build-restore-poller.js +3 -3
  111. package/dist/src/modular/build-restore-poller.js.map +1 -1
  112. package/dist/src/modular/build-root-index.d.ts.map +1 -1
  113. package/dist/src/modular/build-root-index.js +42 -14
  114. package/dist/src/modular/build-root-index.js.map +1 -1
  115. package/dist/src/modular/build-subpath-index.d.ts.map +1 -1
  116. package/dist/src/modular/build-subpath-index.js +17 -4
  117. package/dist/src/modular/build-subpath-index.js.map +1 -1
  118. package/dist/src/modular/emit-models-options.d.ts.map +1 -1
  119. package/dist/src/modular/emit-models-options.js +3 -3
  120. package/dist/src/modular/emit-models-options.js.map +1 -1
  121. package/dist/src/modular/emit-models.d.ts +1 -1
  122. package/dist/src/modular/emit-models.d.ts.map +1 -1
  123. package/dist/src/modular/emit-models.js +32 -25
  124. package/dist/src/modular/emit-models.js.map +1 -1
  125. package/dist/src/modular/emit-samples.d.ts.map +1 -1
  126. package/dist/src/modular/emit-samples.js +5 -5
  127. package/dist/src/modular/emit-samples.js.map +1 -1
  128. package/dist/src/modular/emit-tests.d.ts.map +1 -1
  129. package/dist/src/modular/emit-tests.js +1 -1
  130. package/dist/src/modular/emit-tests.js.map +1 -1
  131. package/dist/src/modular/helpers/classical-operation-helpers.d.ts.map +1 -1
  132. package/dist/src/modular/helpers/classical-operation-helpers.js +11 -11
  133. package/dist/src/modular/helpers/classical-operation-helpers.js.map +1 -1
  134. package/dist/src/modular/helpers/client-helpers.d.ts.map +1 -1
  135. package/dist/src/modular/helpers/client-helpers.js +3 -3
  136. package/dist/src/modular/helpers/client-helpers.js.map +1 -1
  137. package/dist/src/modular/helpers/example-value-helpers.d.ts.map +1 -1
  138. package/dist/src/modular/helpers/example-value-helpers.js +2 -2
  139. package/dist/src/modular/helpers/example-value-helpers.js.map +1 -1
  140. package/dist/src/modular/helpers/naming-helpers.d.ts +1 -1
  141. package/dist/src/modular/helpers/naming-helpers.d.ts.map +1 -1
  142. package/dist/src/modular/helpers/naming-helpers.js +2 -2
  143. package/dist/src/modular/helpers/naming-helpers.js.map +1 -1
  144. package/dist/src/modular/helpers/operation-helpers.d.ts +4 -4
  145. package/dist/src/modular/helpers/operation-helpers.d.ts.map +1 -1
  146. package/dist/src/modular/helpers/operation-helpers.js +25 -26
  147. package/dist/src/modular/helpers/operation-helpers.js.map +1 -1
  148. package/dist/src/modular/helpers/type-helpers.d.ts.map +1 -1
  149. package/dist/src/modular/helpers/type-helpers.js +1 -1
  150. package/dist/src/modular/helpers/type-helpers.js.map +1 -1
  151. package/dist/src/modular/interfaces.d.ts +4 -4
  152. package/dist/src/modular/interfaces.d.ts.map +1 -1
  153. package/dist/src/modular/serialization/build-deserializer-function.d.ts.map +1 -1
  154. package/dist/src/modular/serialization/build-deserializer-function.js +2 -2
  155. package/dist/src/modular/serialization/build-deserializer-function.js.map +1 -1
  156. package/dist/src/modular/serialization/build-serializer-function.d.ts.map +1 -1
  157. package/dist/src/modular/serialization/build-serializer-function.js +2 -2
  158. package/dist/src/modular/serialization/build-serializer-function.js.map +1 -1
  159. package/dist/src/modular/serialization/build-xml-serializer-function.d.ts.map +1 -1
  160. package/dist/src/modular/serialization/build-xml-serializer-function.js +1 -1
  161. package/dist/src/modular/serialization/build-xml-serializer-function.js.map +1 -1
  162. package/dist/src/modular/type-expressions/get-enum-expression.js +1 -1
  163. package/dist/src/modular/type-expressions/get-enum-expression.js.map +1 -1
  164. package/dist/src/modular/type-expressions/get-nullable-expression.js +1 -1
  165. package/dist/src/modular/type-expressions/get-nullable-expression.js.map +1 -1
  166. package/dist/src/modular/type-expressions/get-type-expression.d.ts.map +1 -1
  167. package/dist/src/modular/type-expressions/get-type-expression.js +3 -3
  168. package/dist/src/modular/type-expressions/get-type-expression.js.map +1 -1
  169. package/dist/src/transform/transform-api-version-info.d.ts +1 -1
  170. package/dist/src/transform/transform-api-version-info.d.ts.map +1 -1
  171. package/dist/src/transform/transform-api-version-info.js +4 -3
  172. package/dist/src/transform/transform-api-version-info.js.map +1 -1
  173. package/dist/src/transform/{transfrom-rlc-options.d.ts → transform-client-options.d.ts} +3 -3
  174. package/dist/src/transform/transform-client-options.d.ts.map +1 -0
  175. package/dist/src/transform/{transfrom-rlc-options.js → transform-client-options.js} +9 -13
  176. package/dist/src/transform/transform-client-options.js.map +1 -0
  177. package/dist/src/transform/transform-helper-function-details.d.ts +1 -1
  178. package/dist/src/transform/transform-helper-function-details.d.ts.map +1 -1
  179. package/dist/src/transform/transform-helper-function-details.js +4 -4
  180. package/dist/src/transform/transform-helper-function-details.js.map +1 -1
  181. package/dist/src/transform/transform-parameters.d.ts +1 -1
  182. package/dist/src/transform/transform-parameters.d.ts.map +1 -1
  183. package/dist/src/transform/transform-parameters.js +11 -11
  184. package/dist/src/transform/transform-parameters.js.map +1 -1
  185. package/dist/src/transform/transform-paths.d.ts +1 -1
  186. package/dist/src/transform/transform-paths.d.ts.map +1 -1
  187. package/dist/src/transform/transform-paths.js +5 -4
  188. package/dist/src/transform/transform-paths.js.map +1 -1
  189. package/dist/src/transform/transform-responses.d.ts +1 -1
  190. package/dist/src/transform/transform-responses.d.ts.map +1 -1
  191. package/dist/src/transform/transform-responses.js +19 -18
  192. package/dist/src/transform/transform-responses.js.map +1 -1
  193. package/dist/src/transform/transform-schemas.js +5 -5
  194. package/dist/src/transform/transform-schemas.js.map +1 -1
  195. package/dist/src/transform/transform-telemetry-info.d.ts +1 -1
  196. package/dist/src/transform/transform-telemetry-info.d.ts.map +1 -1
  197. package/dist/src/transform/transform-telemetry-info.js +2 -2
  198. package/dist/src/transform/transform-telemetry-info.js.map +1 -1
  199. package/dist/src/transform/transform.d.ts +2 -2
  200. package/dist/src/transform/transform.d.ts.map +1 -1
  201. package/dist/src/transform/transform.js +9 -10
  202. package/dist/src/transform/transform.js.map +1 -1
  203. package/dist/src/utils/api-version-util.d.ts.map +1 -0
  204. package/dist/src/utils/api-version-util.js.map +1 -0
  205. package/dist/src/utils/client-utils.d.ts +5 -5
  206. package/dist/src/utils/client-utils.d.ts.map +1 -1
  207. package/dist/src/utils/client-utils.js +10 -10
  208. package/dist/src/utils/client-utils.js.map +1 -1
  209. package/dist/src/utils/cross-language-def.d.ts.map +1 -1
  210. package/dist/src/utils/cross-language-def.js +3 -3
  211. package/dist/src/utils/cross-language-def.js.map +1 -1
  212. package/dist/src/utils/emit-util.d.ts +2 -2
  213. package/dist/src/utils/emit-util.d.ts.map +1 -1
  214. package/dist/src/utils/emit-util.js +2 -2
  215. package/dist/src/utils/emit-util.js.map +1 -1
  216. package/dist/src/utils/imports-util.d.ts.map +1 -0
  217. package/dist/src/{rlc-common/helpers → utils}/imports-util.js +6 -6
  218. package/dist/src/utils/imports-util.js.map +1 -0
  219. package/dist/src/utils/interfaces.d.ts +3 -4
  220. package/dist/src/utils/interfaces.d.ts.map +1 -1
  221. package/dist/src/utils/model-utils.d.ts +1 -1
  222. package/dist/src/utils/model-utils.d.ts.map +1 -1
  223. package/dist/src/utils/model-utils.js +4 -2
  224. package/dist/src/utils/model-utils.js.map +1 -1
  225. package/dist/src/{rlc-common/helpers → utils}/name-constructors.d.ts +2 -2
  226. package/dist/src/utils/name-constructors.d.ts.map +1 -0
  227. package/dist/src/utils/name-constructors.js.map +1 -0
  228. package/dist/src/utils/name-utils.d.ts.map +1 -0
  229. package/dist/src/utils/name-utils.js.map +1 -0
  230. package/dist/src/utils/namespace-utils.js +4 -4
  231. package/dist/src/utils/namespace-utils.js.map +1 -1
  232. package/dist/src/utils/operation-helpers.d.ts +16 -0
  233. package/dist/src/utils/operation-helpers.d.ts.map +1 -0
  234. package/dist/src/utils/operation-helpers.js.map +1 -0
  235. package/dist/src/utils/operation-util.d.ts +2 -2
  236. package/dist/src/utils/operation-util.d.ts.map +1 -1
  237. package/dist/src/utils/operation-util.js +17 -18
  238. package/dist/src/utils/operation-util.js.map +1 -1
  239. package/dist/src/utils/parameter-utils.d.ts +1 -1
  240. package/dist/src/utils/parameter-utils.d.ts.map +1 -1
  241. package/dist/src/utils/parameter-utils.js +2 -4
  242. package/dist/src/utils/parameter-utils.js.map +1 -1
  243. package/dist/src/{rlc-common/helpers → utils}/schema-helpers.d.ts +2 -2
  244. package/dist/src/utils/schema-helpers.d.ts.map +1 -0
  245. package/dist/src/utils/schema-helpers.js.map +1 -0
  246. package/dist/src/utils/type-util.d.ts.map +1 -0
  247. package/dist/src/utils/type-util.js.map +1 -0
  248. package/dist/tsconfig.tsbuildinfo +1 -1
  249. package/package.json +14 -24
  250. package/src/context-manager.ts +25 -2
  251. package/src/framework/declaration.ts +8 -20
  252. package/src/framework/hooks/sdk-types.ts +15 -1
  253. package/src/framework/source-file-batch.ts +140 -0
  254. package/src/index.ts +92 -103
  255. package/src/{rlc-common/interfaces.ts → interfaces.ts} +14 -16
  256. package/src/lib.ts +3 -16
  257. package/src/meta-tree.ts +4 -4
  258. package/src/{rlc-common/metadata → metadata}/build-api-extractor-config.ts +2 -2
  259. package/src/{rlc-common/metadata → metadata}/build-changelog-file.ts +3 -3
  260. package/src/{rlc-common/metadata → metadata}/build-es-lint-config.ts +2 -2
  261. package/src/{rlc-common/metadata → metadata}/build-package-file.ts +6 -6
  262. package/src/{rlc-common/metadata → metadata}/build-readme-file.ts +25 -99
  263. package/src/{rlc-common/metadata → metadata}/build-sample-env-file.ts +2 -2
  264. package/src/{rlc-common/metadata → metadata}/build-test-config.ts +4 -4
  265. package/src/{rlc-common/metadata → metadata}/build-ts-config.ts +3 -3
  266. package/src/{rlc-common/metadata → metadata}/build-vitest-config.ts +2 -2
  267. package/src/{rlc-common/metadata → metadata}/build-warp-config.ts +2 -2
  268. package/src/metadata/render-template.ts +202 -0
  269. package/src/metadata/test/build-recorded-client.ts +9 -0
  270. package/src/metadata/test/build-sample-test.ts +9 -0
  271. package/src/{rlc-common → metadata}/test/build-snippets.ts +5 -7
  272. package/src/metadata/test/template.ts +101 -0
  273. package/src/{rlc-common/metadata → metadata}/utils.ts +2 -2
  274. package/src/modular/build-classical-client.ts +9 -9
  275. package/src/modular/build-classical-operation-groups.ts +3 -3
  276. package/src/modular/build-client-context.ts +7 -7
  277. package/src/modular/build-modular-options.ts +3 -3
  278. package/src/modular/build-operations.ts +6 -6
  279. package/src/modular/build-project-files.ts +4 -5
  280. package/src/modular/build-restore-poller.ts +3 -3
  281. package/src/modular/build-root-index.ts +57 -19
  282. package/src/modular/build-subpath-index.ts +26 -5
  283. package/src/modular/emit-models-options.ts +3 -3
  284. package/src/modular/emit-models.ts +32 -26
  285. package/src/modular/emit-samples.ts +5 -5
  286. package/src/modular/emit-tests.ts +1 -1
  287. package/src/modular/helpers/classical-operation-helpers.ts +11 -11
  288. package/src/modular/helpers/client-helpers.ts +3 -3
  289. package/src/modular/helpers/example-value-helpers.ts +2 -2
  290. package/src/modular/helpers/naming-helpers.ts +2 -2
  291. package/src/modular/helpers/operation-helpers.ts +27 -27
  292. package/src/modular/helpers/type-helpers.ts +1 -1
  293. package/src/modular/interfaces.ts +4 -4
  294. package/src/modular/serialization/build-deserializer-function.ts +2 -2
  295. package/src/modular/serialization/build-serializer-function.ts +2 -2
  296. package/src/modular/serialization/build-xml-serializer-function.ts +1 -1
  297. package/src/modular/type-expressions/get-enum-expression.ts +1 -1
  298. package/src/modular/type-expressions/get-nullable-expression.ts +1 -1
  299. package/src/modular/type-expressions/get-type-expression.ts +3 -3
  300. package/src/transform/transform-api-version-info.ts +4 -10
  301. package/src/transform/{transfrom-rlc-options.ts → transform-client-options.ts} +12 -22
  302. package/src/transform/transform-helper-function-details.ts +5 -5
  303. package/src/transform/transform-parameters.ts +12 -12
  304. package/src/transform/transform-paths.ts +5 -12
  305. package/src/transform/transform-responses.ts +19 -19
  306. package/src/transform/transform-schemas.ts +5 -5
  307. package/src/transform/transform-telemetry-info.ts +3 -3
  308. package/src/transform/transform.ts +13 -18
  309. package/src/utils/client-utils.ts +11 -11
  310. package/src/utils/cross-language-def.ts +3 -3
  311. package/src/utils/emit-util.ts +3 -3
  312. package/src/{rlc-common/helpers → utils}/imports-util.ts +6 -6
  313. package/src/utils/interfaces.ts +3 -4
  314. package/src/utils/model-utils.ts +7 -8
  315. package/src/{rlc-common/helpers → utils}/name-constructors.ts +2 -2
  316. package/src/utils/namespace-utils.ts +4 -4
  317. package/src/{rlc-common/helpers → utils}/operation-helpers.ts +12 -12
  318. package/src/utils/operation-util.ts +19 -33
  319. package/src/utils/parameter-utils.ts +2 -4
  320. package/src/{rlc-common/helpers → utils}/schema-helpers.ts +2 -2
  321. package/dist/src/rlc-common/helpers/api-version-util.d.ts.map +0 -1
  322. package/dist/src/rlc-common/helpers/api-version-util.js.map +0 -1
  323. package/dist/src/rlc-common/helpers/imports-util.d.ts.map +0 -1
  324. package/dist/src/rlc-common/helpers/imports-util.js.map +0 -1
  325. package/dist/src/rlc-common/helpers/name-constructors.d.ts.map +0 -1
  326. package/dist/src/rlc-common/helpers/name-constructors.js.map +0 -1
  327. package/dist/src/rlc-common/helpers/name-utils.d.ts.map +0 -1
  328. package/dist/src/rlc-common/helpers/name-utils.js.map +0 -1
  329. package/dist/src/rlc-common/helpers/operation-helpers.d.ts +0 -16
  330. package/dist/src/rlc-common/helpers/operation-helpers.d.ts.map +0 -1
  331. package/dist/src/rlc-common/helpers/operation-helpers.js.map +0 -1
  332. package/dist/src/rlc-common/helpers/schema-helpers.d.ts.map +0 -1
  333. package/dist/src/rlc-common/helpers/schema-helpers.js.map +0 -1
  334. package/dist/src/rlc-common/helpers/type-util.d.ts.map +0 -1
  335. package/dist/src/rlc-common/helpers/type-util.js.map +0 -1
  336. package/dist/src/rlc-common/index.d.ts +0 -23
  337. package/dist/src/rlc-common/index.d.ts.map +0 -1
  338. package/dist/src/rlc-common/index.js +0 -25
  339. package/dist/src/rlc-common/index.js.map +0 -1
  340. package/dist/src/rlc-common/interfaces.d.ts.map +0 -1
  341. package/dist/src/rlc-common/interfaces.js.map +0 -1
  342. package/dist/src/rlc-common/metadata/build-api-extractor-config.d.ts +0 -6
  343. package/dist/src/rlc-common/metadata/build-api-extractor-config.d.ts.map +0 -1
  344. package/dist/src/rlc-common/metadata/build-api-extractor-config.js.map +0 -1
  345. package/dist/src/rlc-common/metadata/build-changelog-file.d.ts +0 -6
  346. package/dist/src/rlc-common/metadata/build-changelog-file.d.ts.map +0 -1
  347. package/dist/src/rlc-common/metadata/build-changelog-file.js.map +0 -1
  348. package/dist/src/rlc-common/metadata/build-es-lint-config.d.ts +0 -6
  349. package/dist/src/rlc-common/metadata/build-es-lint-config.d.ts.map +0 -1
  350. package/dist/src/rlc-common/metadata/build-es-lint-config.js.map +0 -1
  351. package/dist/src/rlc-common/metadata/build-license-file.d.ts.map +0 -1
  352. package/dist/src/rlc-common/metadata/build-license-file.js.map +0 -1
  353. package/dist/src/rlc-common/metadata/build-package-file.d.ts.map +0 -1
  354. package/dist/src/rlc-common/metadata/build-package-file.js.map +0 -1
  355. package/dist/src/rlc-common/metadata/build-readme-file.d.ts +0 -11
  356. package/dist/src/rlc-common/metadata/build-readme-file.d.ts.map +0 -1
  357. package/dist/src/rlc-common/metadata/build-readme-file.js.map +0 -1
  358. package/dist/src/rlc-common/metadata/build-sample-env-file.d.ts +0 -6
  359. package/dist/src/rlc-common/metadata/build-sample-env-file.d.ts.map +0 -1
  360. package/dist/src/rlc-common/metadata/build-sample-env-file.js.map +0 -1
  361. package/dist/src/rlc-common/metadata/build-test-config.d.ts.map +0 -1
  362. package/dist/src/rlc-common/metadata/build-test-config.js.map +0 -1
  363. package/dist/src/rlc-common/metadata/build-ts-config.d.ts.map +0 -1
  364. package/dist/src/rlc-common/metadata/build-ts-config.js.map +0 -1
  365. package/dist/src/rlc-common/metadata/build-vitest-config.d.ts +0 -6
  366. package/dist/src/rlc-common/metadata/build-vitest-config.d.ts.map +0 -1
  367. package/dist/src/rlc-common/metadata/build-vitest-config.js.map +0 -1
  368. package/dist/src/rlc-common/metadata/build-warp-config.d.ts.map +0 -1
  369. package/dist/src/rlc-common/metadata/build-warp-config.js.map +0 -1
  370. package/dist/src/rlc-common/metadata/package-json/azure-package-common.d.ts.map +0 -1
  371. package/dist/src/rlc-common/metadata/package-json/azure-package-common.js.map +0 -1
  372. package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.d.ts.map +0 -1
  373. package/dist/src/rlc-common/metadata/package-json/build-azure-monorepo-package.js.map +0 -1
  374. package/dist/src/rlc-common/metadata/package-json/package-common.d.ts.map +0 -1
  375. package/dist/src/rlc-common/metadata/package-json/package-common.js.map +0 -1
  376. package/dist/src/rlc-common/metadata/utils.d.ts +0 -3
  377. package/dist/src/rlc-common/metadata/utils.d.ts.map +0 -1
  378. package/dist/src/rlc-common/metadata/utils.js.map +0 -1
  379. package/dist/src/rlc-common/static/paginate-content.d.ts +0 -2
  380. package/dist/src/rlc-common/static/paginate-content.d.ts.map +0 -1
  381. package/dist/src/rlc-common/static/paginate-content.js +0 -345
  382. package/dist/src/rlc-common/static/paginate-content.js.map +0 -1
  383. package/dist/src/rlc-common/static/polling-content.d.ts +0 -2
  384. package/dist/src/rlc-common/static/polling-content.d.ts.map +0 -1
  385. package/dist/src/rlc-common/static/polling-content.js +0 -225
  386. package/dist/src/rlc-common/static/polling-content.js.map +0 -1
  387. package/dist/src/rlc-common/static/sample-template.d.ts +0 -2
  388. package/dist/src/rlc-common/static/sample-template.d.ts.map +0 -1
  389. package/dist/src/rlc-common/static/sample-template.js +0 -56
  390. package/dist/src/rlc-common/static/sample-template.js.map +0 -1
  391. package/dist/src/rlc-common/static/serialize-helper.d.ts +0 -6
  392. package/dist/src/rlc-common/static/serialize-helper.d.ts.map +0 -1
  393. package/dist/src/rlc-common/static/serialize-helper.js +0 -31
  394. package/dist/src/rlc-common/static/serialize-helper.js.map +0 -1
  395. package/dist/src/rlc-common/test/build-karma-config.d.ts +0 -6
  396. package/dist/src/rlc-common/test/build-karma-config.d.ts.map +0 -1
  397. package/dist/src/rlc-common/test/build-karma-config.js +0 -11
  398. package/dist/src/rlc-common/test/build-karma-config.js.map +0 -1
  399. package/dist/src/rlc-common/test/build-recorded-client.d.ts +0 -6
  400. package/dist/src/rlc-common/test/build-recorded-client.d.ts.map +0 -1
  401. package/dist/src/rlc-common/test/build-recorded-client.js +0 -14
  402. package/dist/src/rlc-common/test/build-recorded-client.js.map +0 -1
  403. package/dist/src/rlc-common/test/build-sample-test.d.ts +0 -6
  404. package/dist/src/rlc-common/test/build-sample-test.d.ts.map +0 -1
  405. package/dist/src/rlc-common/test/build-sample-test.js +0 -11
  406. package/dist/src/rlc-common/test/build-sample-test.js.map +0 -1
  407. package/dist/src/rlc-common/test/build-snippets.d.ts +0 -6
  408. package/dist/src/rlc-common/test/build-snippets.d.ts.map +0 -1
  409. package/dist/src/rlc-common/test/build-snippets.js.map +0 -1
  410. package/dist/src/rlc-common/test/template.d.ts +0 -5
  411. package/dist/src/rlc-common/test/template.d.ts.map +0 -1
  412. package/dist/src/rlc-common/test/template.js +0 -227
  413. package/dist/src/rlc-common/test/template.js.map +0 -1
  414. package/dist/src/transform/transfrom-rlc-options.d.ts.map +0 -1
  415. package/dist/src/transform/transfrom-rlc-options.js.map +0 -1
  416. package/src/rlc-common/index.ts +0 -25
  417. package/src/rlc-common/static/paginate-content.ts +0 -345
  418. package/src/rlc-common/static/polling-content.ts +0 -225
  419. package/src/rlc-common/static/sample-template.ts +0 -56
  420. package/src/rlc-common/static/serialize-helper.ts +0 -34
  421. package/src/rlc-common/test/build-karma-config.ts +0 -12
  422. package/src/rlc-common/test/build-recorded-client.ts +0 -15
  423. package/src/rlc-common/test/build-sample-test.ts +0 -12
  424. package/src/rlc-common/test/template.ts +0 -229
  425. /package/dist/src/{rlc-common/interfaces.js → interfaces.js} +0 -0
  426. /package/dist/src/{rlc-common/metadata → metadata}/build-api-extractor-config.js +0 -0
  427. /package/dist/src/{rlc-common/metadata → metadata}/build-changelog-file.js +0 -0
  428. /package/dist/src/{rlc-common/metadata → metadata}/build-es-lint-config.js +0 -0
  429. /package/dist/src/{rlc-common/metadata → metadata}/build-license-file.d.ts +0 -0
  430. /package/dist/src/{rlc-common/metadata → metadata}/build-license-file.js +0 -0
  431. /package/dist/src/{rlc-common/metadata → metadata}/build-sample-env-file.js +0 -0
  432. /package/dist/src/{rlc-common/metadata → metadata}/build-test-config.js +0 -0
  433. /package/dist/src/{rlc-common/metadata → metadata}/build-ts-config.js +0 -0
  434. /package/dist/src/{rlc-common/metadata → metadata}/build-vitest-config.js +0 -0
  435. /package/dist/src/{rlc-common/metadata → metadata}/build-warp-config.js +0 -0
  436. /package/dist/src/{rlc-common/metadata → metadata}/package-json/azure-package-common.d.ts +0 -0
  437. /package/dist/src/{rlc-common/metadata → metadata}/package-json/azure-package-common.js +0 -0
  438. /package/dist/src/{rlc-common/metadata → metadata}/package-json/build-azure-monorepo-package.d.ts +0 -0
  439. /package/dist/src/{rlc-common/metadata → metadata}/package-json/build-azure-monorepo-package.js +0 -0
  440. /package/dist/src/{rlc-common/metadata → metadata}/package-json/package-common.d.ts +0 -0
  441. /package/dist/src/{rlc-common/metadata → metadata}/package-json/package-common.js +0 -0
  442. /package/dist/src/{rlc-common/metadata → metadata}/utils.js +0 -0
  443. /package/dist/src/{rlc-common/helpers → utils}/api-version-util.d.ts +0 -0
  444. /package/dist/src/{rlc-common/helpers → utils}/api-version-util.js +0 -0
  445. /package/dist/src/{rlc-common/helpers → utils}/imports-util.d.ts +0 -0
  446. /package/dist/src/{rlc-common/helpers → utils}/name-constructors.js +0 -0
  447. /package/dist/src/{rlc-common/helpers → utils}/name-utils.d.ts +0 -0
  448. /package/dist/src/{rlc-common/helpers → utils}/name-utils.js +0 -0
  449. /package/dist/src/{rlc-common/helpers → utils}/operation-helpers.js +0 -0
  450. /package/dist/src/{rlc-common/helpers → utils}/schema-helpers.js +0 -0
  451. /package/dist/src/{rlc-common/helpers → utils}/type-util.d.ts +0 -0
  452. /package/dist/src/{rlc-common/helpers → utils}/type-util.js +0 -0
  453. /package/src/{rlc-common/metadata → metadata}/build-license-file.ts +0 -0
  454. /package/src/{rlc-common/metadata → metadata}/package-json/azure-package-common.ts +0 -0
  455. /package/src/{rlc-common/metadata → metadata}/package-json/build-azure-monorepo-package.ts +0 -0
  456. /package/src/{rlc-common/metadata → metadata}/package-json/package-common.ts +0 -0
  457. /package/src/{rlc-common/helpers → utils}/api-version-util.ts +0 -0
  458. /package/src/{rlc-common/helpers → utils}/name-utils.ts +0 -0
  459. /package/src/{rlc-common/helpers → utils}/type-util.ts +0 -0
@@ -1,225 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
-
4
- export const pollingContent = `
5
- import type { Client, HttpResponse } from "@azure-rest/core-client";
6
- import type { AbortSignalLike } from "@azure/abort-controller";
7
- import type {
8
- CancelOnProgress,
9
- CreateHttpPollerOptions,
10
- RunningOperation,
11
- OperationResponse,
12
- OperationState,
13
- } from "@azure/core-lro";
14
- import { createHttpPoller } from "@azure/core-lro";
15
- {{#if clientOverload}}
16
- import type {
17
- {{#each importedResponses}}
18
- {{this}},
19
- {{/each}}
20
- } from "./responses.js";
21
- {{/if}}
22
-
23
- /**
24
- * A simple poller that can be used to poll a long running operation.
25
- */
26
- export interface SimplePollerLike<
27
- TState extends OperationState<TResult>,
28
- TResult
29
- > {
30
- /**
31
- * Returns true if the poller has finished polling.
32
- */
33
- isDone(): boolean;
34
- /**
35
- * Returns the state of the operation.
36
- */
37
- getOperationState(): TState;
38
- /**
39
- * Returns the result value of the operation,
40
- * regardless of the state of the poller.
41
- * It can return undefined or an incomplete form of the final TResult value
42
- * depending on the implementation.
43
- */
44
- getResult(): TResult | undefined;
45
- /**
46
- * Returns a promise that will resolve once a single polling request finishes.
47
- * It does this by calling the update method of the Poller's operation.
48
- */
49
- poll(options?: { abortSignal?: AbortSignalLike }): Promise<TState>;
50
- /**
51
- * Returns a promise that will resolve once the underlying operation is completed.
52
- */
53
- pollUntilDone(pollOptions?: {
54
- abortSignal?: AbortSignalLike;
55
- }): Promise<TResult>;
56
- /**
57
- * Invokes the provided callback after each polling is completed,
58
- * sending the current state of the poller's operation.
59
- *
60
- * It returns a method that can be used to stop receiving updates on the given callback function.
61
- */
62
- onProgress(callback: (state: TState) => void): CancelOnProgress;
63
-
64
- /**
65
- * Returns a promise that could be used for serialized version of the poller's operation
66
- * by invoking the operation's serialize method.
67
- */
68
- serialize(): Promise<string>;
69
-
70
- /**
71
- * Wait the poller to be submitted.
72
- */
73
- submitted(): Promise<void>;
74
-
75
- /**
76
- * Returns a string representation of the poller's operation. Similar to serialize but returns a string.
77
- * @deprecated Use serialize() instead.
78
- */
79
- toString(): string;
80
-
81
- /**
82
- * Stops the poller from continuing to poll. Please note this will only stop the client-side polling
83
- * @deprecated Use abortSignal to stop polling instead.
84
- */
85
- stopPolling(): void;
86
-
87
- /**
88
- * Returns true if the poller is stopped.
89
- * @deprecated Use abortSignal status to track this instead.
90
- */
91
- isStopped(): boolean;
92
- }
93
-
94
- /**
95
- * Helper function that builds a Poller object to help polling a long running operation.
96
- * @param client - Client to use for sending the request to get additional pages.
97
- * @param initialResponse - The initial response.
98
- * @param options - Options to set a resume state or custom polling interval.
99
- * @returns - A poller object to poll for operation state updates and eventually get the final response.
100
- */
101
- {{#if clientOverload}}
102
- {{#each overloadMap}}
103
- export async function getLongRunningPoller<
104
- TResult extends {{ this.finalResponses }}
105
- >(
106
- client: Client,
107
- initialResponse: {{ this.initialResponses }},
108
- options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>
109
- ): Promise<SimplePollerLike<OperationState<TResult>, TResult>>;
110
- {{/each}}
111
- {{/if}}
112
- export async function getLongRunningPoller<TResult extends HttpResponse>(
113
- client: Client,
114
- initialResponse: TResult,
115
- options: CreateHttpPollerOptions<TResult, OperationState<TResult>> = {}
116
- ): Promise<SimplePollerLike<OperationState<TResult>, TResult>> {
117
- const abortController = new AbortController();
118
- const poller: RunningOperation<TResult> = {
119
- sendInitialRequest: async () => {
120
- // In the case of Rest Clients we are building the LRO poller object from a response that's the reason
121
- // we are not triggering the initial request here, just extracting the information from the
122
- // response we were provided.
123
- return getLroResponse(initialResponse);
124
- },
125
- sendPollRequest: async (
126
- path: string,
127
- pollOptions?: { abortSignal?: AbortSignalLike }
128
- ) => {
129
- // This is the callback that is going to be called to poll the service
130
- // to get the latest status. We use the client provided and the polling path
131
- // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location
132
- // depending on the lro pattern that the service implements. If non is provided we default to the initial path.
133
- function abortListener(): void {
134
- abortController.abort();
135
- }
136
- const inputAbortSignal = pollOptions?.abortSignal;
137
- const abortSignal = abortController.signal;
138
- if (inputAbortSignal?.aborted) {
139
- abortController.abort();
140
- } else if (!abortSignal.aborted) {
141
- inputAbortSignal?.addEventListener("abort", abortListener, {
142
- once: true
143
- });
144
- }
145
- let response;
146
- try {
147
- response = await client
148
- .pathUnchecked(path ?? initialResponse.request.url)
149
- .get({ abortSignal });
150
- } finally {
151
- inputAbortSignal?.removeEventListener("abort", abortListener);
152
- }
153
- const lroResponse = getLroResponse(response as TResult);
154
- lroResponse.rawResponse.headers["x-ms-original-url"] =
155
- initialResponse.request.url;
156
- return lroResponse;
157
- }
158
- };
159
-
160
- options.resolveOnUnsuccessful = options.resolveOnUnsuccessful ?? true;
161
- const httpPoller = createHttpPoller(poller, options);
162
- const simplePoller: SimplePollerLike<OperationState<TResult>, TResult> = {
163
- isDone() {
164
- return httpPoller.isDone;
165
- },
166
- isStopped() {
167
- return abortController.signal.aborted;
168
- },
169
- getOperationState() {
170
- if (!httpPoller.operationState) {
171
- throw new Error(
172
- "Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState()."
173
- );
174
- }
175
- return httpPoller.operationState;
176
- },
177
- getResult() {
178
- return httpPoller.result;
179
- },
180
- toString() {
181
- if (!httpPoller.operationState) {
182
- throw new Error(
183
- "Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState()."
184
- );
185
- }
186
- return JSON.stringify({
187
- state: httpPoller.operationState
188
- });
189
- },
190
- stopPolling() {
191
- abortController.abort();
192
- },
193
- onProgress: httpPoller.onProgress,
194
- poll: httpPoller.poll,
195
- pollUntilDone: httpPoller.pollUntilDone,
196
- serialize: httpPoller.serialize,
197
- submitted: httpPoller.submitted
198
- };
199
- return simplePoller;
200
- }
201
-
202
- /**
203
- * Converts a Rest Client response to a response that the LRO implementation understands
204
- * @param response - a rest client http response
205
- * @returns - An LRO response that the LRO implementation understands
206
- */
207
- function getLroResponse<TResult extends HttpResponse>(
208
- response: TResult
209
- ): OperationResponse<TResult> {
210
- if (Number.isNaN(response.status)) {
211
- throw new TypeError(
212
- \`Status code of the response is not a number. Value: \${response.status}\`
213
- );
214
- }
215
-
216
- return {
217
- flatResponse: response,
218
- rawResponse: {
219
- ...response,
220
- statusCode: Number.parseInt(response.status),
221
- body: response.body
222
- }
223
- };
224
- }
225
- `;
@@ -1,56 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
-
4
- export const sampleTemplate = `
5
- {{#each importedTypes}}
6
- {{this}}
7
- {{/each}}
8
- import "dotenv/config";
9
-
10
- {{#each samples}}
11
- /**
12
- * This sample demonstrates how to {{this.description}}
13
- *
14
- * @summary {{this.description}}
15
- {{#if this.originalFileLocation}}
16
- * x-ms-original-file: {{this.originalFileLocation}}
17
- {{/if}}
18
- */
19
- async function {{name}}(): Promise<void> {
20
- {{#each this.clientParamAssignments}}
21
- {{this}}
22
- {{/each}}
23
- const client = {{this.defaultFactoryName}}({{this.clientParamNames}});
24
- {{#each this.pathParamAssignments}}
25
- {{this}}
26
- {{/each}}
27
- {{#each this.methodParamAssignments}}
28
- {{this}}
29
- {{/each}}
30
- {{#if this.isPaging}}
31
- const initialResponse = await client.path({{this.pathParamNames}}).{{method}}({{methodParamNames}});
32
- const pageData = paginate(client, initialResponse);
33
- const result = [];
34
- for await (const item of pageData) {
35
- result.push(item);
36
- }
37
- {{else if this.isLRO}}
38
- const initialResponse ={{#unless this.useLegacyLro}} await{{/unless}} client.path({{this.pathParamNames}}).{{method}}({{methodParamNames}});
39
- const poller = await getLongRunningPoller(client, initialResponse);
40
- const result = await poller.pollUntilDone();
41
- {{else}}
42
- const result = await client.path({{this.pathParamNames}}).{{method}}({{methodParamNames}});
43
- {{/if}}
44
- console.log(result);
45
- }
46
-
47
- {{/each}}
48
-
49
- async function main(): Promise<void> {
50
- {{#each samples}}
51
- await {{this.name}}();
52
- {{/each}}
53
- }
54
-
55
- main().catch(console.error);
56
- `;
@@ -1,34 +0,0 @@
1
- export const buildMultiCollectionContent = `
2
- export function buildMultiCollection(
3
- items: string[],
4
- parameterName: string
5
- ): string {
6
- return items
7
- .map((item, index) => {
8
- if (index === 0) {
9
- return item;
10
- }
11
- return \`\${parameterName}=\${item}\`;
12
- })
13
- .join("&");
14
- }`;
15
-
16
- export const buildPipeCollectionContent = `
17
- export function buildPipeCollection(items: string[] | number[]): string {
18
- return items.join("|");
19
- }`;
20
-
21
- export const buildSsvCollectionContent = `
22
- export function buildSsvCollection(items: string[] | number[]): string {
23
- return items.join(" ");
24
- }`;
25
-
26
- export const buildTsvCollectionContent = `
27
- export function buildTsvCollection(items: string[] | number[]): string {
28
- return items.join("\\t");
29
- }`;
30
-
31
- export const buildCsvCollectionContent = `
32
- export function buildCsvCollection(items: string[] | number[]): string {
33
- return items.join(",");
34
- }`;
@@ -1,12 +0,0 @@
1
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2
- // @ts-ignore: to fix the handlebars issue
3
- import hbs from "handlebars";
4
- import { RLCModel } from "../interfaces.js";
5
- import { karmaConfig } from "./template.js";
6
-
7
- export function buildKarmaConfigFile(_model: RLCModel) {
8
- return {
9
- path: "karma.conf.js",
10
- content: hbs.compile(karmaConfig, { noEscape: true })({}),
11
- };
12
- }
@@ -1,15 +0,0 @@
1
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2
- // @ts-ignore: to fix the handlebars issue
3
- import hbs from "handlebars";
4
- import { RLCModel } from "../interfaces.js";
5
- import { recordedClientContent } from "./template.js";
6
-
7
- export function buildRecordedClientFile(_model: RLCModel) {
8
- const recordedClientFileContents = hbs.compile(recordedClientContent, {
9
- noEscape: true,
10
- });
11
- return {
12
- path: "test/public/utils/recordedClient.ts",
13
- content: recordedClientFileContents({}),
14
- };
15
- }
@@ -1,12 +0,0 @@
1
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2
- // @ts-ignore: to fix the handlebars issue
3
- import hbs from "handlebars";
4
- import { RLCModel } from "../interfaces.js";
5
- import { sampleTestContent } from "./template.js";
6
-
7
- export function buildSampleTest(_model: RLCModel) {
8
- return {
9
- path: "test/public/sampleTest.spec.ts",
10
- content: hbs.compile(sampleTestContent, { noEscape: true })({}),
11
- };
12
- }
@@ -1,229 +0,0 @@
1
- export const karmaConfig = `
2
- // https://github.com/karma-runner/karma-chrome-launcher
3
- process.env.CHROME_BIN = require("puppeteer").executablePath();
4
- require("dotenv").config();
5
- const { relativeRecordingsPath } = require("@azure-tools/test-recorder");
6
- process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath();
7
-
8
- module.exports = function (config) {
9
- config.set({
10
- // base path that will be used to resolve all patterns (eg. files, exclude)
11
- basePath: "./",
12
-
13
- // frameworks to use
14
- // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
15
- frameworks: ["source-map-support", "mocha"],
16
-
17
- plugins: [
18
- "karma-mocha",
19
- "karma-mocha-reporter",
20
- "karma-chrome-launcher",
21
- "karma-firefox-launcher",
22
- "karma-env-preprocessor",
23
- "karma-coverage",
24
- "karma-sourcemap-loader",
25
- "karma-junit-reporter",
26
- "karma-source-map-support",
27
- ],
28
-
29
- // list of files / patterns to load in the browser
30
- files: [
31
- "dist-test/index.browser.js",
32
- { pattern: "dist-test/index.browser.js.map", type: "html", included: false, served: true },
33
- ],
34
-
35
- // list of files / patterns to exclude
36
- exclude: [],
37
-
38
- // preprocess matching files before serving them to the browser
39
- // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
40
- preprocessors: {
41
- "**/*.js": ["sourcemap", "env"],
42
- // IMPORTANT: COMMENT following line if you want to debug in your browsers!!
43
- // Preprocess source file to calculate code coverage, however this will make source file unreadable
44
- // "dist-test/index.js": ["coverage"]
45
- },
46
-
47
- envPreprocessor: [
48
- "TEST_MODE",
49
- "ENDPOINT",
50
- "AZURE_CLIENT_SECRET",
51
- "AZURE_CLIENT_ID",
52
- "AZURE_TENANT_ID",
53
- "SUBSCRIPTION_ID",
54
- "RECORDINGS_RELATIVE_PATH",
55
- ],
56
-
57
- // test results reporter to use
58
- // possible values: 'dots', 'progress'
59
- // available reporters: https://npmjs.org/browse/keyword/karma-reporter
60
- reporters: ["mocha", "coverage", "junit"],
61
-
62
- coverageReporter: {
63
- // specify a common output directory
64
- dir: "coverage-browser/",
65
- reporters: [
66
- { type: "json", subdir: ".", file: "coverage.json" },
67
- { type: "lcovonly", subdir: ".", file: "lcov.info" },
68
- { type: "html", subdir: "html" },
69
- { type: "cobertura", subdir: ".", file: "cobertura-coverage.xml" },
70
- ],
71
- },
72
-
73
- junitReporter: {
74
- outputDir: "", // results will be saved as $outputDir/$browserName.xml
75
- outputFile: "test-results.browser.xml", // if included, results will be saved as $outputDir/$browserName/$outputFile
76
- suite: "", // suite will become the package name attribute in xml testsuite element
77
- useBrowserName: false, // add browser name to report and classes names
78
- nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element
79
- classNameFormatter: undefined, // function (browser, result) to customize the classname attribute in xml testcase element
80
- properties: {}, // key value pair of properties to add to the <properties> section of the report
81
- },
82
-
83
- // web server port
84
- port: 9876,
85
-
86
- // enable / disable colors in the output (reporters and logs)
87
- colors: true,
88
-
89
- // level of logging
90
- // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
91
- logLevel: config.LOG_INFO,
92
-
93
- // enable / disable watching file and executing tests whenever any file changes
94
- autoWatch: false,
95
-
96
- // --no-sandbox allows our tests to run in Linux without having to change the system.
97
- // --disable-web-security allows us to authenticate from the browser without having to write tests using interactive auth, which would be far more complex.
98
- browsers: ["ChromeHeadlessNoSandbox"],
99
- customLaunchers: {
100
- ChromeHeadlessNoSandbox: {
101
- base: "ChromeHeadless",
102
- flags: ["--no-sandbox", "--disable-web-security"],
103
- },
104
- },
105
-
106
- // Continuous Integration mode
107
- // if true, Karma captures browsers, runs the tests and exits
108
- singleRun: false,
109
-
110
- // Concurrency level
111
- // how many browser should be started simultaneous
112
- concurrency: 1,
113
-
114
- browserNoActivityTimeout: 60000000,
115
- browserDisconnectTimeout: 10000,
116
- browserDisconnectTolerance: 3,
117
-
118
- client: {
119
- mocha: {
120
- // change Karma's debug.html to the mocha web reporter
121
- reporter: "html",
122
- timeout: "600000",
123
- },
124
- },
125
- });
126
- };
127
- `;
128
-
129
- export const recordedClientContent = `
130
-
131
- import {
132
- Recorder,
133
- RecorderStartOptions,
134
- VitestTestContext,
135
- } from "@azure-tools/test-recorder";
136
-
137
- const replaceableVariables: Record<string, string> = {
138
- SUBSCRIPTION_ID: "azure_subscription_id"
139
- };
140
-
141
- const recorderEnvSetup: RecorderStartOptions = {
142
- envSetupForPlayback: replaceableVariables,
143
- };
144
-
145
- /**
146
- * creates the recorder and reads the environment variables from the \`.env\` file.
147
- * Should be called first in the test suite to make sure environment variables are
148
- * read before they are being used.
149
- */
150
- export async function createRecorder(context: VitestTestContext): Promise<Recorder> {
151
- const recorder = new Recorder(context);
152
- await recorder.start(recorderEnvSetup);
153
- return recorder;
154
- }
155
- `;
156
-
157
- export const sampleTestContent = `
158
- // import { Recorder } from "@azure-tools/test-recorder";
159
- // import { createRecorder } from "./utils/recordedClient.js";
160
- import { assert,
161
- // beforeEach,
162
- // afterEach,
163
- it,
164
- describe
165
- } from "vitest";
166
-
167
- describe("My test", () => {
168
- // let recorder: Recorder;
169
-
170
- // beforeEach(async function(ctx) {
171
- // recorder = await createRecorder(ctx);
172
- // });
173
-
174
- // afterEach(async function() {
175
- // await recorder.stop();
176
- // });
177
-
178
- it("sample test", async function() {
179
- assert.equal(1, 1);
180
- });
181
- });
182
- `;
183
-
184
- export const snippetsContent = `
185
- import { {{ clientClassName }} } from "../src/index.js";
186
- import { DefaultAzureCredential, InteractiveBrowserCredential } from "@azure/identity";
187
- import { setLogLevel } from "@azure/logger";
188
- import { describe, it } from "vitest";
189
-
190
- describe("snippets", () => {
191
- it("ReadmeSampleCreateClient_Node", async () => {
192
- {{#if azureArm}}
193
- {{#if hasSubscriptionId}}
194
- const subscriptionId = "00000000-0000-0000-0000-000000000000";
195
- const client = new {{ clientClassName }}(new DefaultAzureCredential(), subscriptionId);
196
- {{else}}
197
- const client = new {{ clientClassName }}(new DefaultAzureCredential());
198
- {{/if}}
199
- {{else}}
200
- const client = new {{ clientClassName }}("<endpoint>", new DefaultAzureCredential());
201
- {{/if}}
202
- });
203
-
204
- it("ReadmeSampleCreateClient_Browser", async () => {
205
- {{#if azureArm}}
206
- const credential = new InteractiveBrowserCredential({
207
- tenantId: "<YOUR_TENANT_ID>",
208
- clientId: "<YOUR_CLIENT_ID>",
209
- });
210
- {{#if hasSubscriptionId}}
211
- const subscriptionId = "00000000-0000-0000-0000-000000000000";
212
- const client = new {{ clientClassName }}(credential, subscriptionId);
213
- {{else}}
214
- const client = new {{ clientClassName }}(credential);
215
- {{/if}}
216
- {{else}}
217
- const credential = new InteractiveBrowserCredential({
218
- tenantId: "<YOUR_TENANT_ID>",
219
- clientId: "<YOUR_CLIENT_ID>",
220
- });
221
- const client = new {{ clientClassName }}("<endpoint>", credential);
222
- {{/if}}
223
- });
224
-
225
- it("SetLogLevel", async () => {
226
- setLogLevel("info");
227
- });
228
- });
229
- `;
File without changes
File without changes