@azure-tools/typespec-ts 0.11.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 (353) hide show
  1. package/.eslintrc.json +23 -0
  2. package/.prettierignore +1 -0
  3. package/.prettierrc +7 -0
  4. package/.rush/temp/package-deps_build.json +303 -0
  5. package/.rush/temp/shrinkwrap-deps.json +469 -0
  6. package/CHANGELOG.md +65 -0
  7. package/CONTRIBUTING.md +134 -0
  8. package/README.md +150 -0
  9. package/dist/src/emitUtil.d.ts +6 -0
  10. package/dist/src/emitUtil.d.ts.map +1 -0
  11. package/dist/src/emitUtil.js +45 -0
  12. package/dist/src/emitUtil.js.map +1 -0
  13. package/dist/src/index.d.ts +3 -0
  14. package/dist/src/index.d.ts.map +1 -0
  15. package/dist/src/index.js +59 -0
  16. package/dist/src/index.js.map +1 -0
  17. package/dist/src/lib.d.ts +159 -0
  18. package/dist/src/lib.d.ts.map +1 -0
  19. package/dist/src/lib.js +189 -0
  20. package/dist/src/lib.js.map +1 -0
  21. package/dist/src/modelUtils.d.ts +12 -0
  22. package/dist/src/modelUtils.d.ts.map +1 -0
  23. package/dist/src/modelUtils.js +812 -0
  24. package/dist/src/modelUtils.js.map +1 -0
  25. package/dist/src/operationUtil.d.ts +16 -0
  26. package/dist/src/operationUtil.d.ts.map +1 -0
  27. package/dist/src/operationUtil.js +142 -0
  28. package/dist/src/operationUtil.js.map +1 -0
  29. package/dist/src/transform/transform.d.ts +8 -0
  30. package/dist/src/transform/transform.d.ts.map +1 -0
  31. package/dist/src/transform/transform.js +131 -0
  32. package/dist/src/transform/transform.js.map +1 -0
  33. package/dist/src/transform/transformAnnotationDetails.d.ts +6 -0
  34. package/dist/src/transform/transformAnnotationDetails.d.ts.map +1 -0
  35. package/dist/src/transform/transformAnnotationDetails.js +188 -0
  36. package/dist/src/transform/transformAnnotationDetails.js.map +1 -0
  37. package/dist/src/transform/transformApiVersionParam.d.ts +5 -0
  38. package/dist/src/transform/transformApiVersionParam.d.ts.map +1 -0
  39. package/dist/src/transform/transformApiVersionParam.js +76 -0
  40. package/dist/src/transform/transformApiVersionParam.js.map +1 -0
  41. package/dist/src/transform/transformParameters.d.ts +14 -0
  42. package/dist/src/transform/transformParameters.d.ts.map +1 -0
  43. package/dist/src/transform/transformParameters.js +315 -0
  44. package/dist/src/transform/transformParameters.js.map +1 -0
  45. package/dist/src/transform/transformPaths.d.ts +10 -0
  46. package/dist/src/transform/transformPaths.d.ts.map +1 -0
  47. package/dist/src/transform/transformPaths.js +124 -0
  48. package/dist/src/transform/transformPaths.js.map +1 -0
  49. package/dist/src/transform/transformResponses.d.ts +5 -0
  50. package/dist/src/transform/transformResponses.d.ts.map +1 -0
  51. package/dist/src/transform/transformResponses.js +136 -0
  52. package/dist/src/transform/transformResponses.js.map +1 -0
  53. package/dist/src/transform/transformSchemas.d.ts +4 -0
  54. package/dist/src/transform/transformSchemas.d.ts.map +1 -0
  55. package/dist/src/transform/transformSchemas.js +175 -0
  56. package/dist/src/transform/transformSchemas.js.map +1 -0
  57. package/dist/src/transform/transfromRLCOptions.d.ts +10 -0
  58. package/dist/src/transform/transfromRLCOptions.d.ts.map +1 -0
  59. package/dist/src/transform/transfromRLCOptions.js +156 -0
  60. package/dist/src/transform/transfromRLCOptions.js.map +1 -0
  61. package/dist/tsconfig.tsbuildinfo +1 -0
  62. package/package.json +73 -0
  63. package/src/emitUtil.ts +63 -0
  64. package/src/index.ts +106 -0
  65. package/src/lib.ts +207 -0
  66. package/src/modelUtils.ts +961 -0
  67. package/src/operationUtil.ts +203 -0
  68. package/src/transform/transform.ts +224 -0
  69. package/src/transform/transformAnnotationDetails.ts +231 -0
  70. package/src/transform/transformApiVersionParam.ts +104 -0
  71. package/src/transform/transformParameters.ts +480 -0
  72. package/src/transform/transformPaths.ts +187 -0
  73. package/src/transform/transformResponses.ts +190 -0
  74. package/src/transform/transformSchemas.ts +209 -0
  75. package/src/transform/transfromRLCOptions.ts +202 -0
  76. package/test/commands/cadl-ranch-list.ts +83 -0
  77. package/test/commands/check-clean-tree.ts +55 -0
  78. package/test/commands/childProcessOnExit.ts +16 -0
  79. package/test/commands/gen-cadl-ranch.ts +21 -0
  80. package/test/commands/run.ts +41 -0
  81. package/test/integration/arrayItemTypes.spec.ts +93 -0
  82. package/test/integration/authApiKey.spec.ts +38 -0
  83. package/test/integration/authOauth2.spec.ts +65 -0
  84. package/test/integration/authUnion.spec.ts +72 -0
  85. package/test/integration/dictionary.spec.ts +102 -0
  86. package/test/integration/extensibleEnums.spec.ts +61 -0
  87. package/test/integration/fixedEnums.spec.ts +52 -0
  88. package/test/integration/generated/arrays/itemTypes/src/arrayItemTypesClient.ts +31 -0
  89. package/test/integration/generated/arrays/itemTypes/src/clientDefinitions.ts +150 -0
  90. package/test/integration/generated/arrays/itemTypes/src/index.ts +13 -0
  91. package/test/integration/generated/arrays/itemTypes/src/models.ts +9 -0
  92. package/test/integration/generated/arrays/itemTypes/src/outputModels.ts +9 -0
  93. package/test/integration/generated/arrays/itemTypes/src/parameters.ts +78 -0
  94. package/test/integration/generated/arrays/itemTypes/src/responses.ts +104 -0
  95. package/test/integration/generated/arrays/itemTypes/tspconfig.yaml +12 -0
  96. package/test/integration/generated/authentication/apiKey/.eslintrc.json +11 -0
  97. package/test/integration/generated/authentication/apiKey/README.md +56 -0
  98. package/test/integration/generated/authentication/apiKey/api-extractor.json +18 -0
  99. package/test/integration/generated/authentication/apiKey/karma.conf.js +133 -0
  100. package/test/integration/generated/authentication/apiKey/package.json +103 -0
  101. package/test/integration/generated/authentication/apiKey/rollup.config.js +118 -0
  102. package/test/integration/generated/authentication/apiKey/src/authApiKeyClient.ts +41 -0
  103. package/test/integration/generated/authentication/apiKey/src/clientDefinitions.ts +33 -0
  104. package/test/integration/generated/authentication/apiKey/src/index.ts +12 -0
  105. package/test/integration/generated/authentication/apiKey/src/outputModels.ts +6 -0
  106. package/test/integration/generated/authentication/apiKey/src/parameters.ts +7 -0
  107. package/test/integration/generated/authentication/apiKey/src/responses.ts +21 -0
  108. package/test/integration/generated/authentication/apiKey/test/public/sampleTest.spec.ts +23 -0
  109. package/test/integration/generated/authentication/apiKey/test/public/utils/env.browser.ts +2 -0
  110. package/test/integration/generated/authentication/apiKey/test/public/utils/env.ts +6 -0
  111. package/test/integration/generated/authentication/apiKey/test/public/utils/recordedClient.ts +29 -0
  112. package/test/integration/generated/authentication/apiKey/tsconfig.json +25 -0
  113. package/test/integration/generated/authentication/apiKey/tspconfig.yaml +10 -0
  114. package/test/integration/generated/authentication/oauth2/karma.conf.js +133 -0
  115. package/test/integration/generated/authentication/oauth2/src/authOauth2Client.ts +41 -0
  116. package/test/integration/generated/authentication/oauth2/src/clientDefinitions.ts +33 -0
  117. package/test/integration/generated/authentication/oauth2/src/index.ts +12 -0
  118. package/test/integration/generated/authentication/oauth2/src/outputModels.ts +6 -0
  119. package/test/integration/generated/authentication/oauth2/src/parameters.ts +7 -0
  120. package/test/integration/generated/authentication/oauth2/src/responses.ts +21 -0
  121. package/test/integration/generated/authentication/oauth2/test/public/sampleTest.spec.ts +23 -0
  122. package/test/integration/generated/authentication/oauth2/test/public/utils/env.browser.ts +2 -0
  123. package/test/integration/generated/authentication/oauth2/test/public/utils/env.ts +6 -0
  124. package/test/integration/generated/authentication/oauth2/test/public/utils/recordedClient.ts +29 -0
  125. package/test/integration/generated/authentication/oauth2/tspconfig.yaml +12 -0
  126. package/test/integration/generated/authentication/union/karma.conf.js +133 -0
  127. package/test/integration/generated/authentication/union/src/authUnionClient.ts +42 -0
  128. package/test/integration/generated/authentication/union/src/clientDefinitions.ts +27 -0
  129. package/test/integration/generated/authentication/union/src/index.ts +11 -0
  130. package/test/integration/generated/authentication/union/src/parameters.ts +7 -0
  131. package/test/integration/generated/authentication/union/src/responses.ts +14 -0
  132. package/test/integration/generated/authentication/union/test/public/sampleTest.spec.ts +23 -0
  133. package/test/integration/generated/authentication/union/test/public/utils/env.browser.ts +2 -0
  134. package/test/integration/generated/authentication/union/test/public/utils/env.ts +6 -0
  135. package/test/integration/generated/authentication/union/test/public/utils/recordedClient.ts +29 -0
  136. package/test/integration/generated/authentication/union/tspconfig.yaml +12 -0
  137. package/test/integration/generated/dictionary/.eslintrc.json +11 -0
  138. package/test/integration/generated/dictionary/README.md +56 -0
  139. package/test/integration/generated/dictionary/api-extractor.json +18 -0
  140. package/test/integration/generated/dictionary/package.json +80 -0
  141. package/test/integration/generated/dictionary/rollup.config.js +118 -0
  142. package/test/integration/generated/dictionary/src/clientDefinitions.ts +165 -0
  143. package/test/integration/generated/dictionary/src/dictClient.ts +29 -0
  144. package/test/integration/generated/dictionary/src/index.ts +13 -0
  145. package/test/integration/generated/dictionary/src/models.ts +9 -0
  146. package/test/integration/generated/dictionary/src/outputModels.ts +9 -0
  147. package/test/integration/generated/dictionary/src/parameters.ts +86 -0
  148. package/test/integration/generated/dictionary/src/responses.ts +115 -0
  149. package/test/integration/generated/dictionary/tsconfig.json +25 -0
  150. package/test/integration/generated/dictionary/tspconfig.yaml +12 -0
  151. package/test/integration/generated/enums/extensible/.eslintrc.json +11 -0
  152. package/test/integration/generated/enums/extensible/README.md +56 -0
  153. package/test/integration/generated/enums/extensible/api-extractor.json +18 -0
  154. package/test/integration/generated/enums/extensible/package.json +80 -0
  155. package/test/integration/generated/enums/extensible/rollup.config.js +118 -0
  156. package/test/integration/generated/enums/extensible/src/clientDefinitions.ts +45 -0
  157. package/test/integration/generated/enums/extensible/src/enumsExtensible.ts +31 -0
  158. package/test/integration/generated/enums/extensible/src/index.ts +11 -0
  159. package/test/integration/generated/enums/extensible/src/parameters.ts +23 -0
  160. package/test/integration/generated/enums/extensible/src/responses.ts +26 -0
  161. package/test/integration/generated/enums/extensible/tsconfig.json +25 -0
  162. package/test/integration/generated/enums/extensible/tspconfig.yaml +11 -0
  163. package/test/integration/generated/enums/fixed/.eslintrc.json +11 -0
  164. package/test/integration/generated/enums/fixed/README.md +56 -0
  165. package/test/integration/generated/enums/fixed/api-extractor.json +18 -0
  166. package/test/integration/generated/enums/fixed/package.json +80 -0
  167. package/test/integration/generated/enums/fixed/rollup.config.js +118 -0
  168. package/test/integration/generated/enums/fixed/src/clientDefinitions.ts +43 -0
  169. package/test/integration/generated/enums/fixed/src/enumsFixed.ts +31 -0
  170. package/test/integration/generated/enums/fixed/src/index.ts +11 -0
  171. package/test/integration/generated/enums/fixed/src/parameters.ts +36 -0
  172. package/test/integration/generated/enums/fixed/src/responses.ts +27 -0
  173. package/test/integration/generated/enums/fixed/tsconfig.json +25 -0
  174. package/test/integration/generated/enums/fixed/tspconfig.yaml +11 -0
  175. package/test/integration/generated/hello/.eslintrc.json +11 -0
  176. package/test/integration/generated/hello/README.md +56 -0
  177. package/test/integration/generated/hello/api-extractor.json +18 -0
  178. package/test/integration/generated/hello/package.json +80 -0
  179. package/test/integration/generated/hello/rollup.config.js +118 -0
  180. package/test/integration/generated/hello/src/clientDefinitions.ts +19 -0
  181. package/test/integration/generated/hello/src/hello.ts +29 -0
  182. package/test/integration/generated/hello/src/index.ts +11 -0
  183. package/test/integration/generated/hello/src/parameters.ts +6 -0
  184. package/test/integration/generated/hello/src/responses.ts +10 -0
  185. package/test/integration/generated/hello/tsconfig.json +25 -0
  186. package/test/integration/generated/hello/tspconfig.yaml +11 -0
  187. package/test/integration/generated/lro/lroBasic/.eslintrc.json +11 -0
  188. package/test/integration/generated/lro/lroBasic/README.md +56 -0
  189. package/test/integration/generated/lro/lroBasic/api-extractor.json +18 -0
  190. package/test/integration/generated/lro/lroBasic/package.json +82 -0
  191. package/test/integration/generated/lro/lroBasic/rollup.config.js +118 -0
  192. package/test/integration/generated/lro/lroBasic/src/azureLro.ts +31 -0
  193. package/test/integration/generated/lro/lroBasic/src/clientDefinitions.ts +37 -0
  194. package/test/integration/generated/lro/lroBasic/src/index.ts +12 -0
  195. package/test/integration/generated/lro/lroBasic/src/parameters.ts +8 -0
  196. package/test/integration/generated/lro/lroBasic/src/pollingHelper.ts +75 -0
  197. package/test/integration/generated/lro/lroBasic/src/responses.ts +22 -0
  198. package/test/integration/generated/lro/lroBasic/tsconfig.json +25 -0
  199. package/test/integration/generated/lro/lroBasic/tspconfig.yaml +11 -0
  200. package/test/integration/generated/models/inheritance/.eslintrc.json +11 -0
  201. package/test/integration/generated/models/inheritance/README.md +56 -0
  202. package/test/integration/generated/models/inheritance/api-extractor.json +18 -0
  203. package/test/integration/generated/models/inheritance/package.json +80 -0
  204. package/test/integration/generated/models/inheritance/rollup.config.js +118 -0
  205. package/test/integration/generated/models/inheritance/src/clientDefinitions.ts +79 -0
  206. package/test/integration/generated/models/inheritance/src/index.ts +13 -0
  207. package/test/integration/generated/models/inheritance/src/models.ts +52 -0
  208. package/test/integration/generated/models/inheritance/src/modelsInheritance.ts +31 -0
  209. package/test/integration/generated/models/inheritance/src/outputModels.ts +52 -0
  210. package/test/integration/generated/models/inheritance/src/parameters.ts +35 -0
  211. package/test/integration/generated/models/inheritance/src/responses.ts +56 -0
  212. package/test/integration/generated/models/inheritance/tsconfig.json +25 -0
  213. package/test/integration/generated/models/inheritance/tspconfig.yaml +11 -0
  214. package/test/integration/generated/models/propertyOptional/.eslintrc.json +11 -0
  215. package/test/integration/generated/models/propertyOptional/README.md +56 -0
  216. package/test/integration/generated/models/propertyOptional/api-extractor.json +18 -0
  217. package/test/integration/generated/models/propertyOptional/package.json +80 -0
  218. package/test/integration/generated/models/propertyOptional/rollup.config.js +118 -0
  219. package/test/integration/generated/models/propertyOptional/src/clientDefinitions.ts +263 -0
  220. package/test/integration/generated/models/propertyOptional/src/index.ts +13 -0
  221. package/test/integration/generated/models/propertyOptional/src/models.ts +46 -0
  222. package/test/integration/generated/models/propertyOptional/src/modelsPropertyOptional.ts +31 -0
  223. package/test/integration/generated/models/propertyOptional/src/outputModels.ts +46 -0
  224. package/test/integration/generated/models/propertyOptional/src/parameters.ts +124 -0
  225. package/test/integration/generated/models/propertyOptional/src/responses.ts +169 -0
  226. package/test/integration/generated/models/propertyOptional/tsconfig.json +25 -0
  227. package/test/integration/generated/models/propertyOptional/tspconfig.yaml +11 -0
  228. package/test/integration/generated/models/propertyTypes/.eslintrc.json +11 -0
  229. package/test/integration/generated/models/propertyTypes/README.md +56 -0
  230. package/test/integration/generated/models/propertyTypes/api-extractor.json +18 -0
  231. package/test/integration/generated/models/propertyTypes/package.json +80 -0
  232. package/test/integration/generated/models/propertyTypes/rollup.config.js +118 -0
  233. package/test/integration/generated/models/propertyTypes/src/clientDefinitions.ts +234 -0
  234. package/test/integration/generated/models/propertyTypes/src/index.ts +13 -0
  235. package/test/integration/generated/models/propertyTypes/src/models.ts +99 -0
  236. package/test/integration/generated/models/propertyTypes/src/modelsPropertyTypes.ts +31 -0
  237. package/test/integration/generated/models/propertyTypes/src/outputModels.ts +99 -0
  238. package/test/integration/generated/models/propertyTypes/src/parameters.ts +147 -0
  239. package/test/integration/generated/models/propertyTypes/src/responses.ts +186 -0
  240. package/test/integration/generated/models/propertyTypes/tsconfig.json +25 -0
  241. package/test/integration/generated/models/propertyTypes/tspconfig.yaml +11 -0
  242. package/test/integration/generated/models/usage/.eslintrc.json +11 -0
  243. package/test/integration/generated/models/usage/README.md +56 -0
  244. package/test/integration/generated/models/usage/api-extractor.json +18 -0
  245. package/test/integration/generated/models/usage/package.json +80 -0
  246. package/test/integration/generated/models/usage/rollup.config.js +118 -0
  247. package/test/integration/generated/models/usage/src/clientDefinitions.ts +41 -0
  248. package/test/integration/generated/models/usage/src/index.ts +13 -0
  249. package/test/integration/generated/models/usage/src/models.ts +12 -0
  250. package/test/integration/generated/models/usage/src/modelsUsage.ts +31 -0
  251. package/test/integration/generated/models/usage/src/outputModels.ts +12 -0
  252. package/test/integration/generated/models/usage/src/parameters.ts +19 -0
  253. package/test/integration/generated/models/usage/src/responses.ts +22 -0
  254. package/test/integration/generated/models/usage/tsconfig.json +25 -0
  255. package/test/integration/generated/models/usage/tspconfig.yaml +11 -0
  256. package/test/integration/generated/models/visibility/.eslintrc.json +11 -0
  257. package/test/integration/generated/models/visibility/README.md +56 -0
  258. package/test/integration/generated/models/visibility/api-extractor.json +18 -0
  259. package/test/integration/generated/models/visibility/package.json +80 -0
  260. package/test/integration/generated/models/visibility/rollup.config.js +118 -0
  261. package/test/integration/generated/models/visibility/src/clientDefinitions.ts +40 -0
  262. package/test/integration/generated/models/visibility/src/index.ts +13 -0
  263. package/test/integration/generated/models/visibility/src/models.ts +14 -0
  264. package/test/integration/generated/models/visibility/src/modelsVisibilityAutomatic.ts +31 -0
  265. package/test/integration/generated/models/visibility/src/outputModels.ts +16 -0
  266. package/test/integration/generated/models/visibility/src/parameters.ts +41 -0
  267. package/test/integration/generated/models/visibility/src/responses.ts +36 -0
  268. package/test/integration/generated/models/visibility/tsconfig.json +25 -0
  269. package/test/integration/generated/models/visibility/tspconfig.yaml +11 -0
  270. package/test/integration/generated/resiliency/devDriven/.eslintrc.json +11 -0
  271. package/test/integration/generated/resiliency/devDriven/README.md +56 -0
  272. package/test/integration/generated/resiliency/devDriven/api-extractor.json +18 -0
  273. package/test/integration/generated/resiliency/devDriven/package.json +81 -0
  274. package/test/integration/generated/resiliency/devDriven/rollup.config.js +118 -0
  275. package/test/integration/generated/resiliency/devDriven/src/clientDefinitions.ts +75 -0
  276. package/test/integration/generated/resiliency/devDriven/src/index.ts +15 -0
  277. package/test/integration/generated/resiliency/devDriven/src/isUnexpected.ts +117 -0
  278. package/test/integration/generated/resiliency/devDriven/src/models.ts +8 -0
  279. package/test/integration/generated/resiliency/devDriven/src/outputModels.ts +25 -0
  280. package/test/integration/generated/resiliency/devDriven/src/paginateHelper.ts +154 -0
  281. package/test/integration/generated/resiliency/devDriven/src/parameters.ts +17 -0
  282. package/test/integration/generated/resiliency/devDriven/src/resiliencyDevDriven.ts +31 -0
  283. package/test/integration/generated/resiliency/devDriven/src/responses.ts +62 -0
  284. package/test/integration/generated/resiliency/devDriven/tsconfig.json +25 -0
  285. package/test/integration/generated/resiliency/devDriven/tspconfig.yaml +11 -0
  286. package/test/integration/generated/resiliency/srvDriven1/.eslintrc.json +11 -0
  287. package/test/integration/generated/resiliency/srvDriven1/README.md +56 -0
  288. package/test/integration/generated/resiliency/srvDriven1/api-extractor.json +18 -0
  289. package/test/integration/generated/resiliency/srvDriven1/package.json +80 -0
  290. package/test/integration/generated/resiliency/srvDriven1/rollup.config.js +118 -0
  291. package/test/integration/generated/resiliency/srvDriven1/src/clientDefinitions.ts +70 -0
  292. package/test/integration/generated/resiliency/srvDriven1/src/index.ts +13 -0
  293. package/test/integration/generated/resiliency/srvDriven1/src/models.ts +6 -0
  294. package/test/integration/generated/resiliency/srvDriven1/src/outputModels.ts +6 -0
  295. package/test/integration/generated/resiliency/srvDriven1/src/parameters.ts +51 -0
  296. package/test/integration/generated/resiliency/srvDriven1/src/resiliencyServiceDriven1.ts +31 -0
  297. package/test/integration/generated/resiliency/srvDriven1/src/responses.ts +34 -0
  298. package/test/integration/generated/resiliency/srvDriven1/tsconfig.json +25 -0
  299. package/test/integration/generated/resiliency/srvDriven1/tspconfig.yaml +11 -0
  300. package/test/integration/generated/resiliency/srvDriven2/.eslintrc.json +11 -0
  301. package/test/integration/generated/resiliency/srvDriven2/README.md +56 -0
  302. package/test/integration/generated/resiliency/srvDriven2/api-extractor.json +18 -0
  303. package/test/integration/generated/resiliency/srvDriven2/package.json +80 -0
  304. package/test/integration/generated/resiliency/srvDriven2/rollup.config.js +118 -0
  305. package/test/integration/generated/resiliency/srvDriven2/src/clientDefinitions.ts +93 -0
  306. package/test/integration/generated/resiliency/srvDriven2/src/index.ts +13 -0
  307. package/test/integration/generated/resiliency/srvDriven2/src/models.ts +6 -0
  308. package/test/integration/generated/resiliency/srvDriven2/src/outputModels.ts +6 -0
  309. package/test/integration/generated/resiliency/srvDriven2/src/parameters.ts +68 -0
  310. package/test/integration/generated/resiliency/srvDriven2/src/resiliencyServiceDriven2.ts +31 -0
  311. package/test/integration/generated/resiliency/srvDriven2/src/responses.ts +45 -0
  312. package/test/integration/generated/resiliency/srvDriven2/tsconfig.json +25 -0
  313. package/test/integration/generated/resiliency/srvDriven2/tspconfig.yaml +11 -0
  314. package/test/integration/generated/specialWords/src/clientDefinitions.ts +61 -0
  315. package/test/integration/generated/specialWords/src/index.ts +13 -0
  316. package/test/integration/generated/specialWords/src/models.ts +17 -0
  317. package/test/integration/generated/specialWords/src/outputModels.ts +17 -0
  318. package/test/integration/generated/specialWords/src/parameters.ts +37 -0
  319. package/test/integration/generated/specialWords/src/responses.ts +31 -0
  320. package/test/integration/generated/specialWords/src/specialWordsClient.ts +31 -0
  321. package/test/integration/generated/specialWords/tspconfig.yaml +11 -0
  322. package/test/integration/generated/unions/src/clientDefinitions.ts +53 -0
  323. package/test/integration/generated/unions/src/index.ts +12 -0
  324. package/test/integration/generated/unions/src/models.ts +27 -0
  325. package/test/integration/generated/unions/src/parameters.ts +34 -0
  326. package/test/integration/generated/unions/src/responses.ts +24 -0
  327. package/test/integration/generated/unions/src/unionsClient.ts +31 -0
  328. package/test/integration/generated/unions/tspconfig.yaml +11 -0
  329. package/test/integration/helloWorld.spec.ts +20 -0
  330. package/test/integration/lroBasic.spec.ts +25 -0
  331. package/test/integration/modelInheritance.spec.ts +192 -0
  332. package/test/integration/modelPropertyOptional.spec.ts +362 -0
  333. package/test/integration/modelPropertyType.spec.ts +119 -0
  334. package/test/integration/modelUsage.spec.ts +47 -0
  335. package/test/integration/resiliencyDpgCustomization.spec.ts +52 -0
  336. package/test/integration/specialWords.spec.ts +73 -0
  337. package/test/integration/unions.spec.ts +69 -0
  338. package/test/tsconfig.json +4 -0
  339. package/test/unit/azureCoreOperationsGenerator.spec.ts +71 -0
  340. package/test/unit/clientDefinitionGenerator.spec.ts +73 -0
  341. package/test/unit/clientFactoryGenerator.spec.ts +507 -0
  342. package/test/unit/docsGenerator.spec.ts +201 -0
  343. package/test/unit/modelsGenerator.spec.ts +1319 -0
  344. package/test/unit/parametersGenerator.spec.ts +561 -0
  345. package/test/unit/responsesGenerator.spec.ts +462 -0
  346. package/test/unit/spreadAndAlias.spec.ts +200 -0
  347. package/test/unit/util/emitUtil.ts +156 -0
  348. package/test/unit/util/testUtil.ts +83 -0
  349. package/test/util/customBearerTokenTestingPolicy.ts +78 -0
  350. package/test/util/matrix.ts +48 -0
  351. package/tsconfig.json +36 -0
  352. package/tsconfig.test.json +7 -0
  353. package/typespec-ts.build.log +2 -0
@@ -0,0 +1,154 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+
4
+ import {
5
+ getPagedAsyncIterator,
6
+ PagedAsyncIterableIterator,
7
+ PagedResult,
8
+ } from "@azure/core-paging";
9
+ import {
10
+ Client,
11
+ createRestError,
12
+ PathUncheckedResponse,
13
+ } from "@azure-rest/core-client";
14
+
15
+ /**
16
+ * Helper type to extract the type of an array
17
+ */
18
+ export type GetArrayType<T> = T extends Array<infer TData> ? TData : never;
19
+
20
+ /**
21
+ * The type of a custom function that defines how to get a page and a link to the next one if any.
22
+ */
23
+ export type GetPage<TPage> = (
24
+ pageLink: string,
25
+ maxPageSize?: number
26
+ ) => Promise<{
27
+ page: TPage;
28
+ nextPageLink?: string;
29
+ }>;
30
+
31
+ /**
32
+ * Options for the paging helper
33
+ */
34
+ export interface PagingOptions<TResponse> {
35
+ /**
36
+ * Custom function to extract pagination details for crating the PagedAsyncIterableIterator
37
+ */
38
+ customGetPage?: GetPage<PaginateReturn<TResponse>[]>;
39
+ }
40
+
41
+ /**
42
+ * Helper type to infer the Type of the paged elements from the response type
43
+ * This type is generated based on the swagger information for x-ms-pageable
44
+ * specifically on the itemName property which indicates the property of the response
45
+ * where the page items are found. The default value is `value`.
46
+ * This type will allow us to provide strongly typed Iterator based on the response we get as second parameter
47
+ */
48
+ export type PaginateReturn<TResult> = TResult extends {
49
+ body: { value?: infer TPage };
50
+ }
51
+ ? GetArrayType<TPage>
52
+ : Array<unknown>;
53
+
54
+ /**
55
+ * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
56
+ * @param client - Client to use for sending the next page requests
57
+ * @param initialResponse - Initial response containing the nextLink and current page of elements
58
+ * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results
59
+ * @returns - PagedAsyncIterableIterator to iterate the elements
60
+ */
61
+ export function paginate<TResponse extends PathUncheckedResponse>(
62
+ client: Client,
63
+ initialResponse: TResponse,
64
+ options: PagingOptions<TResponse> = {}
65
+ ): PagedAsyncIterableIterator<PaginateReturn<TResponse>> {
66
+ // Extract element type from initial response
67
+ type TElement = PaginateReturn<TResponse>;
68
+ let firstRun = true;
69
+ const itemName = "value";
70
+ const nextLinkName = "nextLink";
71
+ const { customGetPage } = options;
72
+ const pagedResult: PagedResult<TElement[]> = {
73
+ firstPageLink: "",
74
+ getPage:
75
+ typeof customGetPage === "function"
76
+ ? customGetPage
77
+ : async (pageLink: string) => {
78
+ const result = firstRun
79
+ ? initialResponse
80
+ : await client.pathUnchecked(pageLink).get();
81
+ firstRun = false;
82
+ checkPagingRequest(result);
83
+ const nextLink = getNextLink(result.body, nextLinkName);
84
+ const values = getElements<TElement>(result.body, itemName);
85
+ return {
86
+ page: values,
87
+ nextPageLink: nextLink,
88
+ };
89
+ },
90
+ };
91
+
92
+ return getPagedAsyncIterator(pagedResult);
93
+ }
94
+
95
+ /**
96
+ * Gets for the value of nextLink in the body
97
+ */
98
+ function getNextLink(body: unknown, nextLinkName?: string): string | undefined {
99
+ if (!nextLinkName) {
100
+ return undefined;
101
+ }
102
+
103
+ const nextLink = (body as Record<string, unknown>)[nextLinkName];
104
+
105
+ if (typeof nextLink !== "string" && typeof nextLink !== "undefined") {
106
+ throw new Error(
107
+ `Body Property ${nextLinkName} should be a string or undefined`
108
+ );
109
+ }
110
+
111
+ return nextLink;
112
+ }
113
+
114
+ /**
115
+ * Gets the elements of the current request in the body.
116
+ */
117
+ function getElements<T = unknown>(body: unknown, itemName: string): T[] {
118
+ const value = (body as Record<string, unknown>)[itemName] as T[];
119
+
120
+ // value has to be an array according to the x-ms-pageable extension.
121
+ // The fact that this must be an array is used above to calculate the
122
+ // type of elements in the page in PaginateReturn
123
+ if (!Array.isArray(value)) {
124
+ throw new Error(
125
+ `Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`
126
+ );
127
+ }
128
+
129
+ return value ?? [];
130
+ }
131
+
132
+ /**
133
+ * Checks if a request failed
134
+ */
135
+ function checkPagingRequest(response: PathUncheckedResponse): void {
136
+ const Http2xxStatusCodes = [
137
+ "200",
138
+ "201",
139
+ "202",
140
+ "203",
141
+ "204",
142
+ "205",
143
+ "206",
144
+ "207",
145
+ "208",
146
+ "226",
147
+ ];
148
+ if (!Http2xxStatusCodes.includes(response.status)) {
149
+ throw createRestError(
150
+ `Pagination failed with unexpected statusCode ${response.status}`,
151
+ response
152
+ );
153
+ }
154
+ }
@@ -0,0 +1,17 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+
4
+ import { RequestParameters } from "@azure-rest/core-client";
5
+ import { Input } from "./models";
6
+
7
+ export type GetModelParameters = RequestParameters;
8
+
9
+ export interface PostModelBodyParam {
10
+ /** Please put {'hello': 'world!'} */
11
+ body: Input;
12
+ }
13
+
14
+ export type PostModelParameters = PostModelBodyParam & RequestParameters;
15
+ export type GetProtocolPagesParameters = RequestParameters;
16
+ export type GetConveniencePagesParameters = RequestParameters;
17
+ export type LroParameters = RequestParameters;
@@ -0,0 +1,31 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+
4
+ import { getClient, ClientOptions } from "@azure-rest/core-client";
5
+ import { ResiliencyDevDrivenClient } from "./clientDefinitions";
6
+
7
+ /**
8
+ * Initialize a new instance of `ResiliencyDevDrivenClient`
9
+ * @param options type: ClientOptions, the parameter for all optional parameters
10
+ */
11
+ export default function createClient(
12
+ options: ClientOptions = {}
13
+ ): ResiliencyDevDrivenClient {
14
+ const baseUrl = options.baseUrl ?? `http://localhost:3000`;
15
+ options.apiVersion = options.apiVersion ?? "1.0.0";
16
+ const userAgentInfo = `azsdk-js-dev-driven-rest/1.0.0`;
17
+ const userAgentPrefix =
18
+ options.userAgentOptions && options.userAgentOptions.userAgentPrefix
19
+ ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
20
+ : `${userAgentInfo}`;
21
+ options = {
22
+ ...options,
23
+ userAgentOptions: {
24
+ userAgentPrefix,
25
+ },
26
+ };
27
+
28
+ const client = getClient(baseUrl, options) as ResiliencyDevDrivenClient;
29
+
30
+ return client;
31
+ }
@@ -0,0 +1,62 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+
4
+ import { RawHttpHeaders } from "@azure/core-rest-pipeline";
5
+ import { HttpResponse, ErrorResponse } from "@azure-rest/core-client";
6
+ import {
7
+ ProductOutput,
8
+ ProductListOutput,
9
+ LroProductOutput,
10
+ } from "./outputModels";
11
+
12
+ /** Returns {'received': <mode>} */
13
+ export interface GetModel200Response extends HttpResponse {
14
+ status: "200";
15
+ body: ProductOutput;
16
+ }
17
+
18
+ /** Returns {'received': <mode>} */
19
+ export interface PostModel200Response extends HttpResponse {
20
+ status: "200";
21
+ body: ProductOutput;
22
+ }
23
+
24
+ /** The request has succeeded. */
25
+ export interface GetProtocolPages200Response extends HttpResponse {
26
+ status: "200";
27
+ body: ProductListOutput;
28
+ }
29
+
30
+ export interface GetProtocolPagesDefaultHeaders {
31
+ /** String error code indicating what went wrong. */
32
+ "x-ms-error-code"?: string;
33
+ }
34
+
35
+ export interface GetProtocolPagesDefaultResponse extends HttpResponse {
36
+ status: string;
37
+ body: ErrorResponse;
38
+ headers: RawHttpHeaders & GetProtocolPagesDefaultHeaders;
39
+ }
40
+
41
+ /** The request has succeeded. */
42
+ export interface GetConveniencePages200Response extends HttpResponse {
43
+ status: "200";
44
+ body: ProductListOutput;
45
+ }
46
+
47
+ export interface GetConveniencePagesDefaultHeaders {
48
+ /** String error code indicating what went wrong. */
49
+ "x-ms-error-code"?: string;
50
+ }
51
+
52
+ export interface GetConveniencePagesDefaultResponse extends HttpResponse {
53
+ status: string;
54
+ body: ErrorResponse;
55
+ headers: RawHttpHeaders & GetConveniencePagesDefaultHeaders;
56
+ }
57
+
58
+ /** Initial response with ProvisioningState='Succeeded' */
59
+ export interface Lro200Response extends HttpResponse {
60
+ status: "200";
61
+ body: LroProductOutput;
62
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2017",
4
+ "module": "es6",
5
+ "lib": [],
6
+ "declaration": true,
7
+ "declarationMap": true,
8
+ "inlineSources": true,
9
+ "sourceMap": true,
10
+ "importHelpers": true,
11
+ "strict": true,
12
+ "alwaysStrict": true,
13
+ "noUnusedLocals": true,
14
+ "noUnusedParameters": true,
15
+ "noImplicitReturns": true,
16
+ "noFallthroughCasesInSwitch": true,
17
+ "forceConsistentCasingInFileNames": true,
18
+ "moduleResolution": "node",
19
+ "allowSyntheticDefaultImports": true,
20
+ "esModuleInterop": true,
21
+ "outDir": "./dist-esm",
22
+ "declarationDir": "./types"
23
+ },
24
+ "include": ["./src/**/*.ts"]
25
+ }
@@ -0,0 +1,11 @@
1
+ emitters:
2
+ "../../../../../../../../../../../packages/typespec-ts/dist/src/index.js":
3
+ generateMetadata: true
4
+ generateTest: false
5
+ addCredentials: false
6
+ azureSdkForJs: false
7
+ isCadlTest: true
8
+ packageDetails:
9
+ name: "@msinternal/dev-driven"
10
+ description: "Dev Driven Test Service"
11
+ version: "1.0.0"
@@ -0,0 +1,11 @@
1
+ {
2
+ "plugins": ["@azure/azure-sdk"],
3
+ "extends": ["plugin:@azure/azure-sdk/azure-sdk-base"],
4
+ "rules": {
5
+ "@azure/azure-sdk/ts-modules-only-named": "warn",
6
+ "@azure/azure-sdk/ts-apiextractor-json-types": "warn",
7
+ "@azure/azure-sdk/ts-package-json-types": "warn",
8
+ "@azure/azure-sdk/ts-package-json-engine-is-present": "warn",
9
+ "tsdoc/syntax": "warn"
10
+ }
11
+ }
@@ -0,0 +1,56 @@
1
+ # ResiliencyServiceDriven1 REST client library for JavaScript
2
+
3
+ DPG Swagger, this is the initial swagger a service could do
4
+
5
+ **Please rely heavily on our [REST client docs](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/rest-clients.md) to use this library**
6
+
7
+ Key links:
8
+
9
+ - [Package (NPM)](https://www.npmjs.com/package/@msinternal/srv-driven-1)
10
+
11
+ ## Getting started
12
+
13
+ ### Currently supported environments
14
+
15
+ - LTS versions of Node.js
16
+
17
+ ### Prerequisites
18
+
19
+ - You must have an [Azure subscription](https://azure.microsoft.com/free/) to use this package.
20
+
21
+ ### Install the `@msinternal/srv-driven-1` package
22
+
23
+ Install the ResiliencyServiceDriven1 REST client REST client library for JavaScript with `npm`:
24
+
25
+ ```bash
26
+ npm install @msinternal/srv-driven-1
27
+ ```
28
+
29
+ ### Create and authenticate a `ResiliencyServiceDriven1Client`
30
+
31
+ 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),
32
+ provide an instance of the desired credential type obtained from the
33
+ [@azure/identity](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) library.
34
+
35
+ To authenticate with AAD, you must first `npm` install [`@azure/identity`](https://www.npmjs.com/package/@azure/identity)
36
+
37
+ 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.
38
+ As an example, [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential)
39
+ can be used to authenticate the client.
40
+
41
+ Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables:
42
+ AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET
43
+
44
+ ## Troubleshooting
45
+
46
+ ### Logging
47
+
48
+ 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`:
49
+
50
+ ```javascript
51
+ const { setLogLevel } = require("@azure/logger");
52
+
53
+ setLogLevel("info");
54
+ ```
55
+
56
+ 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).
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "mainEntryPointFilePath": "./types/index.d.ts",
4
+ "docModel": { "enabled": true },
5
+ "apiReport": { "enabled": true, "reportFolder": "./review" },
6
+ "dtsRollup": {
7
+ "enabled": true,
8
+ "untrimmedFilePath": "",
9
+ "publicTrimmedFilePath": "./types/srv-driven-1.d.ts"
10
+ },
11
+ "messages": {
12
+ "tsdocMessageReporting": { "default": { "logLevel": "none" } },
13
+ "extractorMessageReporting": {
14
+ "ae-missing-release-tag": { "logLevel": "none" },
15
+ "ae-unresolved-link": { "logLevel": "none" }
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "@msinternal/srv-driven-1",
3
+ "sdk-type": "client",
4
+ "author": "Microsoft Corporation",
5
+ "version": "1.0.0",
6
+ "description": "Srv Driven 1 Test Service",
7
+ "keywords": ["node", "azure", "cloud", "typescript", "browser", "isomorphic"],
8
+ "license": "MIT",
9
+ "main": "dist/index.js",
10
+ "module": "./dist-esm/index.js",
11
+ "types": "./types/srv-driven-1.d.ts",
12
+ "repository": "github:Azure/azure-sdk-for-js",
13
+ "bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" },
14
+ "files": [
15
+ "dist/",
16
+ "dist-esm/",
17
+ "types/srv-driven-1.d.ts",
18
+ "README.md",
19
+ "LICENSE",
20
+ "review/*"
21
+ ],
22
+ "engines": { "node": ">=14.0.0" },
23
+ "scripts": {
24
+ "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
25
+ "build:browser": "echo skipped.",
26
+ "build:node": "echo skipped.",
27
+ "build:samples": "echo skipped.",
28
+ "build:test": "echo skipped.",
29
+ "build:debug": "echo skipped.",
30
+ "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"*.{js,json}\" ",
31
+ "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log",
32
+ "execute:samples": "echo skipped",
33
+ "extract-api": "rimraf review && mkdirp ./review && api-extractor run --local",
34
+ "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"*.{js,json}\" ",
35
+ "generate:client": "echo skipped",
36
+ "integration-test:browser": "echo skipped",
37
+ "integration-test:node": "echo skipped",
38
+ "integration-test": "echo skipped",
39
+ "lint:fix": "eslint package.json api-extractor.json src --ext .ts --fix --fix-type [problem,suggestion]",
40
+ "lint": "eslint package.json api-extractor.json src --ext .ts",
41
+ "pack": "npm pack 2>&1",
42
+ "test:browser": "echo skipped",
43
+ "test:node": "echo skipped",
44
+ "test": "echo \"Error: no test specified\" && exit 1",
45
+ "unit-test": "echo skipped",
46
+ "unit-test:node": "echo skipped",
47
+ "unit-test:browser": "echo skipped",
48
+ "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api",
49
+ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js"
50
+ },
51
+ "sideEffects": false,
52
+ "autoPublish": false,
53
+ "dependencies": {
54
+ "@azure/core-auth": "^1.3.0",
55
+ "@azure-rest/core-client": "^1.1.0",
56
+ "@azure/core-rest-pipeline": "^1.8.0",
57
+ "@azure/logger": "^1.0.0",
58
+ "tslib": "^2.2.0"
59
+ },
60
+ "devDependencies": {
61
+ "@microsoft/api-extractor": "^7.31.1",
62
+ "autorest": "latest",
63
+ "@types/node": "^14.0.0",
64
+ "dotenv": "^16.0.0",
65
+ "eslint": "^8.0.0",
66
+ "mkdirp": "^2.1.2",
67
+ "prettier": "^2.5.1",
68
+ "rimraf": "^3.0.0",
69
+ "source-map-support": "^0.5.9",
70
+ "typescript": "~4.8.0",
71
+ "@rollup/plugin-commonjs": "^24.0.0",
72
+ "@rollup/plugin-json": "^6.0.0",
73
+ "@rollup/plugin-multi-entry": "^6.0.0",
74
+ "@rollup/plugin-node-resolve": "^13.1.3",
75
+ "rollup": "^2.66.1",
76
+ "rollup-plugin-sourcemaps": "^0.6.3",
77
+ "uglify-js": "^3.4.9"
78
+ },
79
+ "type": "module"
80
+ }
@@ -0,0 +1,118 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+
4
+ import nodeResolve from "@rollup/plugin-node-resolve";
5
+ import cjs from "@rollup/plugin-commonjs";
6
+ import sourcemaps from "rollup-plugin-sourcemaps";
7
+ import multiEntry from "@rollup/plugin-multi-entry";
8
+ import json from "@rollup/plugin-json";
9
+
10
+ import nodeBuiltins from "builtin-modules";
11
+
12
+ // #region Warning Handler
13
+
14
+ /**
15
+ * A function that can determine whether a rollup warning should be ignored. If
16
+ * the function returns `true`, then the warning will not be displayed.
17
+ */
18
+
19
+ function ignoreNiseSinonEval(warning) {
20
+ return (
21
+ warning.code === "EVAL" &&
22
+ warning.id &&
23
+ (warning.id.includes("node_modules/nise") ||
24
+ warning.id.includes("node_modules/sinon")) === true
25
+ );
26
+ }
27
+
28
+ function ignoreChaiCircularDependency(warning) {
29
+ return (
30
+ warning.code === "CIRCULAR_DEPENDENCY" &&
31
+ warning.importer &&
32
+ warning.importer.includes("node_modules/chai") === true
33
+ );
34
+ }
35
+
36
+ const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval];
37
+
38
+ /**
39
+ * Construct a warning handler for the shared rollup configuration
40
+ * that ignores certain warnings that are not relevant to testing.
41
+ */
42
+ function makeOnWarnForTesting() {
43
+ return (warning, warn) => {
44
+ // If every inhibitor returns false (i.e. no inhibitors), then show the warning
45
+ if (warningInhibitors.every((inhib) => !inhib(warning))) {
46
+ warn(warning);
47
+ }
48
+ };
49
+ }
50
+
51
+ // #endregion
52
+
53
+ function makeBrowserTestConfig() {
54
+ const config = {
55
+ input: {
56
+ include: ["dist-esm/test/**/*.spec.js"],
57
+ exclude: ["dist-esm/test/**/node/**"],
58
+ },
59
+ output: {
60
+ file: `dist-test/index.browser.js`,
61
+ format: "umd",
62
+ sourcemap: true,
63
+ },
64
+ preserveSymlinks: false,
65
+ plugins: [
66
+ multiEntry({ exports: false }),
67
+ nodeResolve({
68
+ mainFields: ["module", "browser"],
69
+ }),
70
+ cjs(),
71
+ json(),
72
+ sourcemaps(),
73
+ //viz({ filename: "dist-test/browser-stats.html", sourcemap: true })
74
+ ],
75
+ onwarn: makeOnWarnForTesting(),
76
+ // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0,
77
+ // rollup started respecting the "sideEffects" field in package.json. Since
78
+ // our package.json sets "sideEffects=false", this also applies to test
79
+ // code, which causes all tests to be removed by tree-shaking.
80
+ treeshake: false,
81
+ };
82
+
83
+ return config;
84
+ }
85
+
86
+ const defaultConfigurationOptions = {
87
+ disableBrowserBundle: false,
88
+ };
89
+
90
+ export function makeConfig(pkg, options) {
91
+ options = {
92
+ ...defaultConfigurationOptions,
93
+ ...(options || {}),
94
+ };
95
+
96
+ const baseConfig = {
97
+ // Use the package's module field if it has one
98
+ input: pkg["module"] || "dist-esm/src/index.js",
99
+ external: [
100
+ ...nodeBuiltins,
101
+ ...Object.keys(pkg.dependencies),
102
+ ...Object.keys(pkg.devDependencies),
103
+ ],
104
+ output: { file: "dist/index.js", format: "cjs", sourcemap: true },
105
+ preserveSymlinks: false,
106
+ plugins: [sourcemaps(), nodeResolve()],
107
+ };
108
+
109
+ const config = [baseConfig];
110
+
111
+ if (!options.disableBrowserBundle) {
112
+ config.push(makeBrowserTestConfig());
113
+ }
114
+
115
+ return config;
116
+ }
117
+
118
+ export default makeConfig(require("./package.json"));
@@ -0,0 +1,70 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+
4
+ import {
5
+ HeadNoParamsParameters,
6
+ GetRequiredParameters,
7
+ PutRequiredOptionalParameters,
8
+ PostParametersParameters,
9
+ GetOptionalParameters,
10
+ } from "./parameters";
11
+ import {
12
+ HeadNoParams200Response,
13
+ GetRequired200Response,
14
+ PutRequiredOptional200Response,
15
+ PostParameters200Response,
16
+ GetOptional200Response,
17
+ } from "./responses";
18
+ import { Client, StreamableMethod } from "@azure-rest/core-client";
19
+
20
+ export interface HeadNoParams {
21
+ /**
22
+ * Head request, no params.
23
+ * Initially has no query parameters. After evolution, a new optional query parameter is added
24
+ */
25
+ head(
26
+ options?: HeadNoParamsParameters
27
+ ): StreamableMethod<HeadNoParams200Response>;
28
+ /**
29
+ * Get true Boolean value on path.
30
+ * Initially only has one required Query Parameter. After evolution, a new optional query parameter is added
31
+ */
32
+ get(options: GetRequiredParameters): StreamableMethod<GetRequired200Response>;
33
+ /** Initially has one required query parameter and one optional query parameter. After evolution, a new optional query parameter is added */
34
+ put(
35
+ options: PutRequiredOptionalParameters
36
+ ): StreamableMethod<PutRequiredOptional200Response>;
37
+ }
38
+
39
+ export interface PostParameters {
40
+ /** POST a JSON */
41
+ post(
42
+ options: PostParametersParameters
43
+ ): StreamableMethod<PostParameters200Response>;
44
+ }
45
+
46
+ export interface GetOptional {
47
+ /**
48
+ * Get true Boolean value on path.
49
+ * Initially has one optional query parameter. After evolution, a new optional query parameter is added
50
+ */
51
+ get(
52
+ options?: GetOptionalParameters
53
+ ): StreamableMethod<GetOptional200Response>;
54
+ }
55
+
56
+ export interface Routes {
57
+ /** Resource for '/resiliency/servicedriven1/parameters' has methods for the following verbs: head, get, put */
58
+ (path: "/resiliency/servicedriven1/parameters"): HeadNoParams;
59
+ /** Resource for '/resiliency/servicedriven1/parameters/\{contentTypePath\}' has methods for the following verbs: post */
60
+ (
61
+ path: "/resiliency/servicedriven1/parameters/{contentTypePath}",
62
+ contentTypePath: "json"
63
+ ): PostParameters;
64
+ /** Resource for '/resiliency/servicedriven1/moreParameters' has methods for the following verbs: get */
65
+ (path: "/resiliency/servicedriven1/moreParameters"): GetOptional;
66
+ }
67
+
68
+ export type ResiliencyServiceDriven1Client = Client & {
69
+ path: Routes;
70
+ };
@@ -0,0 +1,13 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+
4
+ import ResiliencyServiceDriven1 from "./resiliencyServiceDriven1";
5
+
6
+ export * from "./resiliencyServiceDriven1";
7
+ export * from "./parameters";
8
+ export * from "./responses";
9
+ export * from "./clientDefinitions";
10
+ export * from "./models";
11
+ export * from "./outputModels";
12
+
13
+ export default ResiliencyServiceDriven1;