@autorest/powershell 4.0.0-dev.9 → 4.0.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 (483) hide show
  1. package/.rush/temp/package-deps_build.json +208 -203
  2. package/.rush/temp/shrinkwrap-deps.json +253 -280
  3. package/autorest-configuration-for-sdk.md +9 -3
  4. package/autorest-configuration.md +1 -1
  5. package/dist/cmdlets/class.d.ts +24 -3
  6. package/dist/cmdlets/class.d.ts.map +1 -1
  7. package/dist/cmdlets/class.js +888 -603
  8. package/dist/cmdlets/class.js.map +1 -1
  9. package/dist/cmdlets/namespace.d.ts.map +1 -1
  10. package/dist/cmdlets/namespace.js +39 -5
  11. package/dist/cmdlets/namespace.js.map +1 -1
  12. package/dist/enums/namespace.js +5 -5
  13. package/dist/enums/namespace.js.map +1 -1
  14. package/dist/exports.d.ts +3 -0
  15. package/dist/exports.d.ts.map +1 -0
  16. package/dist/exports.js +19 -0
  17. package/dist/exports.js.map +1 -0
  18. package/dist/generators/gitignore.d.ts.map +1 -1
  19. package/dist/generators/gitignore.js +2 -0
  20. package/dist/generators/gitignore.js.map +1 -1
  21. package/dist/generators/psm1.custom.js +2 -2
  22. package/dist/generators/psm1.custom.js.map +1 -1
  23. package/dist/generators/psm1.d.ts.map +1 -1
  24. package/dist/generators/psm1.internal.js +2 -2
  25. package/dist/generators/psm1.internal.js.map +1 -1
  26. package/dist/generators/psm1.js +17 -11
  27. package/dist/generators/psm1.js.map +1 -1
  28. package/dist/generators/readme.d.ts.map +1 -1
  29. package/dist/generators/readme.js +0 -3
  30. package/dist/generators/readme.js.map +1 -1
  31. package/dist/generators/script-cmdlet.js +18 -18
  32. package/dist/generators/script-cmdlet.js.map +1 -1
  33. package/dist/internal/name-inferrer.d.ts +1 -1
  34. package/dist/internal/name-inferrer.d.ts.map +1 -1
  35. package/dist/internal/name-inferrer.js +12 -12
  36. package/dist/internal/name-inferrer.js.map +1 -1
  37. package/dist/internal/powershell-declarations.d.ts +2 -0
  38. package/dist/internal/powershell-declarations.d.ts.map +1 -1
  39. package/dist/internal/powershell-declarations.js +4 -2
  40. package/dist/internal/powershell-declarations.js.map +1 -1
  41. package/dist/internal/project.d.ts +14 -6
  42. package/dist/internal/project.d.ts.map +1 -1
  43. package/dist/internal/project.js +24 -13
  44. package/dist/internal/project.js.map +1 -1
  45. package/dist/internal/state.d.ts +3 -2
  46. package/dist/internal/state.d.ts.map +1 -1
  47. package/dist/internal/state.js.map +1 -1
  48. package/dist/llcsharp/clientruntime.d.ts +1 -0
  49. package/dist/llcsharp/clientruntime.d.ts.map +1 -1
  50. package/dist/llcsharp/clientruntime.js +12 -11
  51. package/dist/llcsharp/clientruntime.js.map +1 -1
  52. package/dist/llcsharp/code-model.d.ts +7 -7
  53. package/dist/llcsharp/code-model.d.ts.map +1 -1
  54. package/dist/llcsharp/enums/enum.d.ts +1 -1
  55. package/dist/llcsharp/enums/enum.d.ts.map +1 -1
  56. package/dist/llcsharp/enums/enum.js +42 -42
  57. package/dist/llcsharp/enums/enum.js.map +1 -1
  58. package/dist/llcsharp/exports.js +5 -1
  59. package/dist/llcsharp/exports.js.map +1 -1
  60. package/dist/llcsharp/generator.d.ts +3 -2
  61. package/dist/llcsharp/generator.d.ts.map +1 -1
  62. package/dist/llcsharp/generator.js.map +1 -1
  63. package/dist/llcsharp/model/idictionary.js +16 -16
  64. package/dist/llcsharp/model/idictionary.js.map +1 -1
  65. package/dist/llcsharp/model/interface.d.ts +1 -1
  66. package/dist/llcsharp/model/interface.d.ts.map +1 -1
  67. package/dist/llcsharp/model/interface.js +19 -19
  68. package/dist/llcsharp/model/interface.js.map +1 -1
  69. package/dist/llcsharp/model/model-class-dictionary.js +18 -18
  70. package/dist/llcsharp/model/model-class-dictionary.js.map +1 -1
  71. package/dist/llcsharp/model/model-class-json.js +20 -20
  72. package/dist/llcsharp/model/model-class-json.js.map +1 -1
  73. package/dist/llcsharp/model/model-class-serializer.d.ts +1 -1
  74. package/dist/llcsharp/model/model-class-serializer.d.ts.map +1 -1
  75. package/dist/llcsharp/model/model-class-serializer.js +6 -6
  76. package/dist/llcsharp/model/model-class-serializer.js.map +1 -1
  77. package/dist/llcsharp/model/model-class.d.ts +1 -1
  78. package/dist/llcsharp/model/model-class.d.ts.map +1 -1
  79. package/dist/llcsharp/model/model-class.js +108 -97
  80. package/dist/llcsharp/model/model-class.js.map +1 -1
  81. package/dist/llcsharp/model/namespace.d.ts +1 -1
  82. package/dist/llcsharp/model/namespace.d.ts.map +1 -1
  83. package/dist/llcsharp/model/namespace.js +2 -2
  84. package/dist/llcsharp/model/namespace.js.map +1 -1
  85. package/dist/llcsharp/model/property.d.ts +1 -1
  86. package/dist/llcsharp/model/property.d.ts.map +1 -1
  87. package/dist/llcsharp/model/property.js +20 -20
  88. package/dist/llcsharp/model/property.js.map +1 -1
  89. package/dist/llcsharp/operation/api-class.d.ts.map +1 -1
  90. package/dist/llcsharp/operation/api-class.js +26 -1
  91. package/dist/llcsharp/operation/api-class.js.map +1 -1
  92. package/dist/llcsharp/operation/method.d.ts +10 -5
  93. package/dist/llcsharp/operation/method.d.ts.map +1 -1
  94. package/dist/llcsharp/operation/method.js +287 -134
  95. package/dist/llcsharp/operation/method.js.map +1 -1
  96. package/dist/llcsharp/operation/parameter.d.ts +1 -1
  97. package/dist/llcsharp/operation/parameter.d.ts.map +1 -1
  98. package/dist/llcsharp/operation/parameter.js +10 -10
  99. package/dist/llcsharp/operation/parameter.js.map +1 -1
  100. package/dist/llcsharp/project.d.ts +8 -4
  101. package/dist/llcsharp/project.d.ts.map +1 -1
  102. package/dist/llcsharp/project.js +10 -1
  103. package/dist/llcsharp/project.js.map +1 -1
  104. package/dist/llcsharp/schema/Uuid.d.ts +1 -1
  105. package/dist/llcsharp/schema/Uuid.d.ts.map +1 -1
  106. package/dist/llcsharp/schema/Uuid.js +2 -2
  107. package/dist/llcsharp/schema/Uuid.js.map +1 -1
  108. package/dist/llcsharp/schema/array.d.ts +1 -1
  109. package/dist/llcsharp/schema/array.d.ts.map +1 -1
  110. package/dist/llcsharp/schema/array.js +45 -43
  111. package/dist/llcsharp/schema/array.js.map +1 -1
  112. package/dist/llcsharp/schema/binary.d.ts +1 -1
  113. package/dist/llcsharp/schema/binary.d.ts.map +1 -1
  114. package/dist/llcsharp/schema/binary.js +9 -9
  115. package/dist/llcsharp/schema/binary.js.map +1 -1
  116. package/dist/llcsharp/schema/boolean.d.ts +1 -1
  117. package/dist/llcsharp/schema/boolean.d.ts.map +1 -1
  118. package/dist/llcsharp/schema/byte-array.d.ts +1 -1
  119. package/dist/llcsharp/schema/byte-array.d.ts.map +1 -1
  120. package/dist/llcsharp/schema/byte-array.js +24 -24
  121. package/dist/llcsharp/schema/byte-array.js.map +1 -1
  122. package/dist/llcsharp/schema/char.d.ts +1 -1
  123. package/dist/llcsharp/schema/char.d.ts.map +1 -1
  124. package/dist/llcsharp/schema/char.js +1 -1
  125. package/dist/llcsharp/schema/char.js.map +1 -1
  126. package/dist/llcsharp/schema/date-time.d.ts +1 -1
  127. package/dist/llcsharp/schema/date-time.d.ts.map +1 -1
  128. package/dist/llcsharp/schema/date-time.js +45 -41
  129. package/dist/llcsharp/schema/date-time.js.map +1 -1
  130. package/dist/llcsharp/schema/date.d.ts +1 -1
  131. package/dist/llcsharp/schema/date.d.ts.map +1 -1
  132. package/dist/llcsharp/schema/duration.d.ts +1 -1
  133. package/dist/llcsharp/schema/duration.d.ts.map +1 -1
  134. package/dist/llcsharp/schema/duration.js +9 -7
  135. package/dist/llcsharp/schema/duration.js.map +1 -1
  136. package/dist/llcsharp/schema/enum.d.ts +6 -2
  137. package/dist/llcsharp/schema/enum.d.ts.map +1 -1
  138. package/dist/llcsharp/schema/enum.js +13 -4
  139. package/dist/llcsharp/schema/enum.js.map +1 -1
  140. package/dist/llcsharp/schema/extended-type-declaration.d.ts +1 -1
  141. package/dist/llcsharp/schema/extended-type-declaration.d.ts.map +1 -1
  142. package/dist/llcsharp/schema/fixed-array.d.ts +1 -1
  143. package/dist/llcsharp/schema/fixed-array.d.ts.map +1 -1
  144. package/dist/llcsharp/schema/fixed-array.js +44 -42
  145. package/dist/llcsharp/schema/fixed-array.js.map +1 -1
  146. package/dist/llcsharp/schema/integer.d.ts +1 -1
  147. package/dist/llcsharp/schema/integer.d.ts.map +1 -1
  148. package/dist/llcsharp/schema/integer.js +5 -5
  149. package/dist/llcsharp/schema/integer.js.map +1 -1
  150. package/dist/llcsharp/schema/object.d.ts +1 -1
  151. package/dist/llcsharp/schema/object.d.ts.map +1 -1
  152. package/dist/llcsharp/schema/object.js +28 -28
  153. package/dist/llcsharp/schema/object.js.map +1 -1
  154. package/dist/llcsharp/schema/password.d.ts +1 -1
  155. package/dist/llcsharp/schema/password.d.ts.map +1 -1
  156. package/dist/llcsharp/schema/password.js +13 -13
  157. package/dist/llcsharp/schema/password.js.map +1 -1
  158. package/dist/llcsharp/schema/primitive.d.ts +1 -1
  159. package/dist/llcsharp/schema/primitive.d.ts.map +1 -1
  160. package/dist/llcsharp/schema/primitive.js +40 -37
  161. package/dist/llcsharp/schema/primitive.js.map +1 -1
  162. package/dist/llcsharp/schema/schema-resolver.d.ts +1 -1
  163. package/dist/llcsharp/schema/schema-resolver.d.ts.map +1 -1
  164. package/dist/llcsharp/schema/schema-resolver.js +2 -1
  165. package/dist/llcsharp/schema/schema-resolver.js.map +1 -1
  166. package/dist/llcsharp/schema/string.d.ts +1 -1
  167. package/dist/llcsharp/schema/string.d.ts.map +1 -1
  168. package/dist/llcsharp/schema/string.js +48 -44
  169. package/dist/llcsharp/schema/string.js.map +1 -1
  170. package/dist/llcsharp/schema/uri.d.ts +1 -1
  171. package/dist/llcsharp/schema/uri.d.ts.map +1 -1
  172. package/dist/llcsharp/schema/uri.js +2 -2
  173. package/dist/llcsharp/schema/uri.js.map +1 -1
  174. package/dist/llcsharp/validations.js +2 -2
  175. package/dist/llcsharp/validations.js.map +1 -1
  176. package/dist/main.d.ts.map +1 -1
  177. package/dist/main.js +5 -2
  178. package/dist/main.js.map +1 -1
  179. package/dist/models/model-extensions.d.ts +1 -1
  180. package/dist/models/model-extensions.d.ts.map +1 -1
  181. package/dist/models/model-extensions.js +39 -39
  182. package/dist/models/model-extensions.js.map +1 -1
  183. package/dist/module/module-class.d.ts.map +1 -1
  184. package/dist/module/module-class.js +45 -15
  185. package/dist/module/module-class.js.map +1 -1
  186. package/dist/module/module-namespace.js +3 -3
  187. package/dist/module/module-namespace.js.map +1 -1
  188. package/dist/plugins/add-azure-completers-v2.d.ts +6 -1
  189. package/dist/plugins/add-azure-completers-v2.d.ts.map +1 -1
  190. package/dist/plugins/add-azure-completers-v2.js +5 -4
  191. package/dist/plugins/add-azure-completers-v2.js.map +1 -1
  192. package/dist/plugins/create-commands-v2.d.ts +16 -7
  193. package/dist/plugins/create-commands-v2.d.ts.map +1 -1
  194. package/dist/plugins/create-commands-v2.js +269 -66
  195. package/dist/plugins/create-commands-v2.js.map +1 -1
  196. package/dist/plugins/cs-namer-v2.d.ts +6 -1
  197. package/dist/plugins/cs-namer-v2.d.ts.map +1 -1
  198. package/dist/plugins/cs-namer-v2.js +42 -41
  199. package/dist/plugins/cs-namer-v2.js.map +1 -1
  200. package/dist/plugins/llcsharp-v2.d.ts +5 -2
  201. package/dist/plugins/llcsharp-v2.d.ts.map +1 -1
  202. package/dist/plugins/llcsharp-v2.js +11 -9
  203. package/dist/plugins/llcsharp-v2.js.map +1 -1
  204. package/dist/plugins/modifiers-v2.d.ts +6 -1
  205. package/dist/plugins/modifiers-v2.d.ts.map +1 -1
  206. package/dist/plugins/modifiers-v2.js +120 -92
  207. package/dist/plugins/modifiers-v2.js.map +1 -1
  208. package/dist/plugins/plugin-create-inline-properties.d.ts +6 -1
  209. package/dist/plugins/plugin-create-inline-properties.d.ts.map +1 -1
  210. package/dist/plugins/plugin-create-inline-properties.js +44 -32
  211. package/dist/plugins/plugin-create-inline-properties.js.map +1 -1
  212. package/dist/plugins/plugin-tweak-m4-model.d.ts +7 -1
  213. package/dist/plugins/plugin-tweak-m4-model.d.ts.map +1 -1
  214. package/dist/plugins/plugin-tweak-m4-model.js +28 -11
  215. package/dist/plugins/plugin-tweak-m4-model.js.map +1 -1
  216. package/dist/plugins/plugin-tweak-model-azure-v2.d.ts +6 -1
  217. package/dist/plugins/plugin-tweak-model-azure-v2.d.ts.map +1 -1
  218. package/dist/plugins/plugin-tweak-model-azure-v2.js +32 -22
  219. package/dist/plugins/plugin-tweak-model-azure-v2.js.map +1 -1
  220. package/dist/plugins/plugin-tweak-model.d.ts +6 -1
  221. package/dist/plugins/plugin-tweak-model.d.ts.map +1 -1
  222. package/dist/plugins/plugin-tweak-model.js +33 -32
  223. package/dist/plugins/plugin-tweak-model.js.map +1 -1
  224. package/dist/plugins/powershell-v2.d.ts +5 -2
  225. package/dist/plugins/powershell-v2.d.ts.map +1 -1
  226. package/dist/plugins/powershell-v2.js +32 -28
  227. package/dist/plugins/powershell-v2.js.map +1 -1
  228. package/dist/plugins/ps-namer-v2.d.ts +6 -1
  229. package/dist/plugins/ps-namer-v2.d.ts.map +1 -1
  230. package/dist/plugins/ps-namer-v2.js +33 -32
  231. package/dist/plugins/ps-namer-v2.js.map +1 -1
  232. package/dist/plugins/sdk-create-inline-properties.d.ts +1 -1
  233. package/dist/plugins/sdk-create-inline-properties.d.ts.map +1 -1
  234. package/dist/plugins/sdk-create-inline-properties.js +129 -39
  235. package/dist/plugins/sdk-create-inline-properties.js.map +1 -1
  236. package/dist/plugins/sdk-cs-namer.d.ts +1 -1
  237. package/dist/plugins/sdk-cs-namer.d.ts.map +1 -1
  238. package/dist/plugins/sdk-cs-namer.js +59 -34
  239. package/dist/plugins/sdk-cs-namer.js.map +1 -1
  240. package/dist/plugins/sdk-cs-simplifier.d.ts +1 -1
  241. package/dist/plugins/sdk-cs-simplifier.d.ts.map +1 -1
  242. package/dist/plugins/sdk-cs-simplifier.js +3 -3
  243. package/dist/plugins/sdk-cs-simplifier.js.map +1 -1
  244. package/dist/plugins/sdk-generate.d.ts +1 -1
  245. package/dist/plugins/sdk-generate.d.ts.map +1 -1
  246. package/dist/plugins/sdk-generate.js +23 -18
  247. package/dist/plugins/sdk-generate.js.map +1 -1
  248. package/dist/plugins/sdk-modifiers.d.ts +4 -0
  249. package/dist/plugins/sdk-modifiers.d.ts.map +1 -0
  250. package/dist/plugins/sdk-modifiers.js +175 -0
  251. package/dist/plugins/sdk-modifiers.js.map +1 -0
  252. package/dist/plugins/sdk-tweak-model.d.ts +1 -1
  253. package/dist/plugins/sdk-tweak-model.d.ts.map +1 -1
  254. package/dist/plugins/sdk-tweak-model.js +140 -44
  255. package/dist/plugins/sdk-tweak-model.js.map +1 -1
  256. package/dist/sdk/project.d.ts +2 -2
  257. package/dist/sdk/project.d.ts.map +1 -1
  258. package/dist/sdk/project.js +10 -9
  259. package/dist/sdk/project.js.map +1 -1
  260. package/dist/sdk/state.d.ts +2 -2
  261. package/dist/sdk/state.d.ts.map +1 -1
  262. package/dist/sdk/utility.d.ts +12 -3
  263. package/dist/sdk/utility.d.ts.map +1 -1
  264. package/dist/sdk/utility.js +122 -30
  265. package/dist/sdk/utility.js.map +1 -1
  266. package/dist/utils/PwshModel.d.ts +1 -1
  267. package/dist/utils/PwshModel.d.ts.map +1 -1
  268. package/dist/utils/PwshModel.js +1 -1
  269. package/dist/utils/PwshModel.js.map +1 -1
  270. package/dist/utils/SdkModel.d.ts +1 -1
  271. package/dist/utils/SdkModel.d.ts.map +1 -1
  272. package/dist/utils/SdkModel.js +1 -1
  273. package/dist/utils/SdkModel.js.map +1 -1
  274. package/dist/utils/command-operation.d.ts +11 -3
  275. package/dist/utils/command-operation.d.ts.map +1 -1
  276. package/dist/utils/command-operation.js +26 -4
  277. package/dist/utils/command-operation.js.map +1 -1
  278. package/dist/utils/components.d.ts +1 -1
  279. package/dist/utils/components.d.ts.map +1 -1
  280. package/dist/utils/components.js +2 -2
  281. package/dist/utils/components.js.map +1 -1
  282. package/dist/utils/http-operation.d.ts +2 -0
  283. package/dist/utils/http-operation.d.ts.map +1 -1
  284. package/dist/utils/http-operation.js +16 -12
  285. package/dist/utils/http-operation.js.map +1 -1
  286. package/dist/utils/model-state.d.ts +7 -5
  287. package/dist/utils/model-state.d.ts.map +1 -1
  288. package/dist/utils/model-state.js +28 -20
  289. package/dist/utils/model-state.js.map +1 -1
  290. package/dist/utils/programatic-operation.d.ts +1 -1
  291. package/dist/utils/programatic-operation.d.ts.map +1 -1
  292. package/dist/utils/programatic-operation.js +1 -1
  293. package/dist/utils/programatic-operation.js.map +1 -1
  294. package/dist/utils/resolve-conflicts.js +8 -8
  295. package/dist/utils/resolve-conflicts.js.map +1 -1
  296. package/dist/utils/schema.d.ts +1 -1
  297. package/dist/utils/schema.d.ts.map +1 -1
  298. package/dist/utils/schema.js +11 -11
  299. package/dist/utils/schema.js.map +1 -1
  300. package/dist/utils/security-scheme.d.ts +2 -2
  301. package/dist/utils/security-scheme.d.ts.map +1 -1
  302. package/dist/utils/security-scheme.js +2 -2
  303. package/dist/utils/security-scheme.js.map +1 -1
  304. package/dist/utils/sort-parameters.d.ts +1 -1
  305. package/dist/utils/sort-parameters.d.ts.map +1 -1
  306. package/dist/utils/tsp-generator.d.ts +3 -0
  307. package/dist/utils/tsp-generator.d.ts.map +1 -0
  308. package/dist/utils/tsp-generator.js +65 -0
  309. package/dist/utils/tsp-generator.js.map +1 -0
  310. package/dist/utils/tsp-host.d.ts +42 -0
  311. package/dist/utils/tsp-host.d.ts.map +1 -0
  312. package/dist/utils/tsp-host.js +56 -0
  313. package/dist/utils/tsp-host.js.map +1 -0
  314. package/generators/readme.ts +0 -3
  315. package/package.json +11 -10
  316. package/resources/assets/build-module.ps1 +29 -2
  317. package/resources/assets/create-model-cmdlets.ps1 +1 -0
  318. package/resources/assets/generate-help.ps1 +2 -2
  319. package/resources/assets/generate-portal-ux.ps1 +6 -22
  320. package/resources/assets/test/loadEnv.ps1 +1 -1
  321. package/resources/assets/test-module.ps1 +9 -5
  322. package/resources/assets/tools/Resources/README.md +0 -3
  323. package/resources/assets/tools/Resources/custom/New-AzDeployment.ps1 +2 -2
  324. package/resources/assets/tools/Resources/how-to.md +2 -0
  325. package/resources/built-time-cmdlets.csproj +1 -0
  326. package/resources/modules/Az.Accounts/2.13.1/Accounts.format.ps1xml +554 -0
  327. package/resources/modules/Az.Accounts/2.13.1/Accounts.generated.format.ps1xml +471 -0
  328. package/resources/modules/Az.Accounts/2.13.1/Accounts.types.ps1xml +306 -0
  329. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Az.Accounts.nuspec +4 -5
  330. package/resources/modules/Az.Accounts/2.13.1/Az.Accounts.psd1 +389 -0
  331. package/resources/modules/Az.Accounts/2.13.1/Az.Accounts.psm1 +365 -0
  332. package/resources/modules/Az.Accounts/2.13.1/FuzzySharp.dll +0 -0
  333. package/resources/modules/Az.Accounts/2.13.1/Microsoft.ApplicationInsights.dll +0 -0
  334. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.AssemblyLoading.dll +0 -0
  335. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Authentication.Abstractions.dll +0 -0
  336. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Authentication.ResourceManager.dll +0 -0
  337. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Authentication.dll +0 -0
  338. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.dll +0 -0
  339. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Authenticators.dll +0 -0
  340. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Clients.Aks.dll +0 -0
  341. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Authorization.dll +0 -0
  342. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Compute.dll +0 -0
  343. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Clients.Graph.Rbac.dll +0 -0
  344. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.KeyVault.dll +0 -0
  345. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Monitor.dll +0 -0
  346. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Network.dll +0 -0
  347. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.PolicyInsights.dll +0 -0
  348. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Clients.ResourceManager.dll +0 -0
  349. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Storage.Management.dll +0 -0
  350. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Websites.dll +0 -0
  351. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll +0 -0
  352. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll-Help.xml +2510 -779
  353. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Common.Share.dll +0 -0
  354. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Common.dll +0 -0
  355. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Storage.dll +0 -0
  356. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Strategies.dll +0 -0
  357. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Rest.ClientRuntime.dll +0 -0
  358. package/resources/modules/Az.Accounts/2.13.1/PostImportScripts/LoadAuthenticators.ps1 +222 -0
  359. package/resources/modules/Az.Accounts/2.13.1/StartupScripts/AzError.ps1 +281 -0
  360. package/resources/modules/Az.Accounts/2.13.1/StartupScripts/InitializeAssemblyResolver.ps1 +242 -0
  361. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/[Content_Types].xml +2 -3
  362. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/_rels/.rels +2 -2
  363. package/resources/modules/Az.Accounts/2.13.1/lib/netcoreapp2.1/Azure.Core.dll +0 -0
  364. package/resources/modules/Az.Accounts/2.13.1/lib/netcoreapp2.1/Microsoft.Identity.Client.dll +0 -0
  365. package/resources/modules/Az.Accounts/2.13.1/lib/netcoreapp3.1/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
  366. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/Azure.Core.dll +0 -0
  367. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
  368. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/Microsoft.Identity.Client.dll +0 -0
  369. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/Newtonsoft.Json.dll +0 -0
  370. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/System.Diagnostics.DiagnosticSource.dll +0 -0
  371. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/System.Reflection.DispatchProxy.dll +0 -0
  372. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/System.Runtime.CompilerServices.Unsafe.dll +0 -0
  373. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Azure.Identity.BrokeredAuthentication.dll +0 -0
  374. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Azure.Identity.dll +0 -0
  375. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Microsoft.Identity.Client.Broker.dll +0 -0
  376. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Microsoft.Identity.Client.NativeInterop.dll +0 -0
  377. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Microsoft.IdentityModel.Abstractions.dll +0 -0
  378. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/System.Security.AccessControl.dll +0 -0
  379. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/System.Security.Permissions.dll +0 -0
  380. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/System.Security.Principal.Windows.dll +0 -0
  381. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/msalruntime.dll +0 -0
  382. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/msalruntime_arm64.dll +0 -0
  383. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/msalruntime_x86.dll +0 -0
  384. package/resources/modules/Az.Accounts/2.13.1/package/services/metadata/core-properties/f9ac9c2e40914e78a646a7b0b997403b.psmdcp +11 -0
  385. package/resources/psruntime/BuildTime/Cmdlets/ExportHelpMarkdown.cs +4 -1
  386. package/resources/psruntime/BuildTime/Cmdlets/ExportProxyCmdlet.cs +6 -3
  387. package/resources/psruntime/BuildTime/Cmdlets/ExportPsd1.cs +7 -4
  388. package/resources/psruntime/BuildTime/Cmdlets/ExportTestStub.cs +130 -81
  389. package/resources/psruntime/BuildTime/Cmdlets/NewAssemblyInfo.cs +64 -0
  390. package/resources/psruntime/BuildTime/MarkdownRenderer.cs +17 -9
  391. package/resources/psruntime/BuildTime/Models/PsProxyOutputs.cs +36 -8
  392. package/resources/psruntime/BuildTime/Models/PsProxyTypes.cs +21 -10
  393. package/resources/psruntime/BuildTime/PsAttributes.cs +5 -0
  394. package/resources/psruntime/BuildTime/PsHelpers.cs +4 -3
  395. package/resources/psruntime/MessageAttribute.cs +45 -55
  396. package/resources/psruntime/MessageAttributeHelper.cs +30 -7
  397. package/resources/psruntime/Properties/Resources.Designer.cs +25 -3
  398. package/resources/psruntime/Properties/Resources.resx +8 -2
  399. package/resources/runtime/csharp/pipeline/PipelineMocking.cs +1 -1
  400. package/resources/templates/azureMethod.ejs +2 -2
  401. package/resources/templates/azureMethodGroup.ejs +2 -2
  402. package/resources/templates/azureServiceClient.ejs +11 -4
  403. package/resources/templates/enum.ejs +3 -3
  404. package/resources/templates/extensionMethod.ejs +18 -12
  405. package/resources/templates/extensions.ejs +9 -2
  406. package/resources/templates/longRunningOperationMethod.ejs +10 -8
  407. package/resources/templates/method.ejs +10 -8
  408. package/resources/templates/methodBodyRestCall.ejs +77 -32
  409. package/resources/templates/methodGroupInterface.ejs +2 -61
  410. package/resources/templates/methodGroupInterfaceBody.ejs +60 -0
  411. package/resources/templates/model.ejs +15 -15
  412. package/resources/templates/serviceClientBody.ejs +8 -8
  413. package/resources/templates/serviceClientInterface.ejs +10 -4
  414. package/resources/utils/Get-SubscriptionIdTestSafe.ps1 +7 -0
  415. package/dist/utils/WrapComments.d.ts +0 -2
  416. package/dist/utils/WrapComments.d.ts.map +0 -1
  417. package/dist/utils/WrapComments.js +0 -46
  418. package/dist/utils/WrapComments.js.map +0 -1
  419. package/resources/modules/Az.Accounts/2.7.5/Accounts.format.ps1xml +0 -496
  420. package/resources/modules/Az.Accounts/2.7.5/Accounts.generated.format.ps1xml +0 -468
  421. package/resources/modules/Az.Accounts/2.7.5/Accounts.types.ps1xml +0 -303
  422. package/resources/modules/Az.Accounts/2.7.5/Az.Accounts.psd1 +0 -387
  423. package/resources/modules/Az.Accounts/2.7.5/Az.Accounts.psm1 +0 -375
  424. package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Azure.Core.dll +0 -0
  425. package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Azure.Identity.dll +0 -0
  426. package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
  427. package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Microsoft.Identity.Client.dll +0 -0
  428. package/resources/modules/Az.Accounts/2.7.5/Microsoft.ApplicationInsights.dll +0 -0
  429. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.Abstractions.dll +0 -0
  430. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.ResourceManager.deps.json +0 -2309
  431. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.ResourceManager.dll +0 -0
  432. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.deps.json +0 -2273
  433. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.dll +0 -0
  434. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.deps.json +0 -1316
  435. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.dll +0 -0
  436. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authenticators.dll +0 -0
  437. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Aks.dll +0 -0
  438. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Graph.Rbac.dll +0 -0
  439. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.ResourceManager.dll +0 -0
  440. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.deps.json +0 -2413
  441. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll +0 -0
  442. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Common.Share.dll +0 -0
  443. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Common.dll +0 -0
  444. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Rest.ClientRuntime.dll +0 -0
  445. package/resources/modules/Az.Accounts/2.7.5/PostImportScripts/LoadAuthenticators.ps1 +0 -219
  446. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Azure.Core.dll +0 -0
  447. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Azure.Identity.dll +0 -0
  448. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Azure.PowerShell.Authenticators.dll +0 -0
  449. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
  450. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
  451. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Identity.Client.dll +0 -0
  452. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Newtonsoft.Json.12.0.3.dll +0 -0
  453. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Newtonsoft.Json.dll +0 -0
  454. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Diagnostics.DiagnosticSource.dll +0 -0
  455. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Memory.Data.dll +0 -0
  456. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Reflection.DispatchProxy.dll +0 -0
  457. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Runtime.CompilerServices.Unsafe.dll +0 -0
  458. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.AccessControl.dll +0 -0
  459. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.Permissions.dll +0 -0
  460. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.Principal.Windows.dll +0 -0
  461. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Text.Json.dll +0 -0
  462. package/resources/modules/Az.Accounts/2.7.5/StartupScripts/AzError.ps1 +0 -278
  463. package/resources/modules/Az.Accounts/2.7.5/StartupScripts/InitializeAssemblyResolver.ps1 +0 -234
  464. package/resources/modules/Az.Accounts/2.7.5/package/services/metadata/core-properties/1aa0749a068a4238881858013f1a5b7f.psmdcp +0 -11
  465. /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Hyak.Common.dll +0 -0
  466. /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.Common.dll +0 -0
  467. /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Rest.ClientRuntime.Azure.dll +0 -0
  468. /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.WindowsAzure.Storage.DataMovement.dll +0 -0
  469. /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.WindowsAzure.Storage.dll +0 -0
  470. /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/en-US/about_az.help.txt +0 -0
  471. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netfx}/System.Numerics.Vectors.dll +0 -0
  472. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netfx}/System.Security.Cryptography.Cng.dll +0 -0
  473. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netfx}/System.Text.Encodings.Web.dll +0 -0
  474. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netfx}/System.Xml.ReaderWriter.dll +0 -0
  475. /package/resources/modules/Az.Accounts/{2.7.5/AzSharedAlcAssemblies → 2.13.1/lib/netstandard2.0}/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
  476. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Buffers.dll +0 -0
  477. /package/resources/modules/Az.Accounts/{2.7.5/AzSharedAlcAssemblies → 2.13.1/lib/netstandard2.0}/System.Memory.Data.dll +0 -0
  478. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Memory.dll +0 -0
  479. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Net.Http.WinHttpHandler.dll +0 -0
  480. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Private.ServiceModel.dll +0 -0
  481. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.ServiceModel.Primitives.dll +0 -0
  482. /package/resources/modules/Az.Accounts/{2.7.5/AzSharedAlcAssemblies → 2.13.1/lib/netstandard2.0}/System.Text.Json.dll +0 -0
  483. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Threading.Tasks.Extensions.dll +0 -0
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Microsoft Corporation. All rights reserved.
4
+ * Licensed under the MIT License. See License.txt in the project root for license information.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.applyModelNameModifiersSdk = exports.applyModifiersSdk = void 0;
8
+ const extension_base_1 = require("@autorest/extension-base");
9
+ const codegen_1 = require("@azure-tools/codegen");
10
+ const linq_1 = require("@azure-tools/linq");
11
+ const model_state_1 = require("../utils/model-state");
12
+ const resolve_conflicts_1 = require("../utils/resolve-conflicts");
13
+ let directives = [];
14
+ function hasSpecialChars(str) {
15
+ return !/^[a-zA-Z0-9]+$/.test(str);
16
+ }
17
+ function getFilterError(whereObject, prohibitedFilters, selectionType) {
18
+ let error = '';
19
+ for (const each of (0, linq_1.values)(prohibitedFilters)) {
20
+ if (whereObject[each] !== undefined) {
21
+ error += `Can't filter by ${each} when selecting command. `;
22
+ }
23
+ }
24
+ return error;
25
+ }
26
+ function getSetError(setObject, prohibitedSetters, selectionType) {
27
+ let error = '';
28
+ for (const each of (0, linq_1.values)(prohibitedSetters)) {
29
+ if (setObject[each] !== undefined) {
30
+ error += `Can't set ${each} when a ${selectionType} is selected. `;
31
+ }
32
+ }
33
+ return error;
34
+ }
35
+ function isWhereModelDirective(it) {
36
+ const directive = it;
37
+ const where = directive.where;
38
+ const set = directive.set;
39
+ if (where && set && (where['model-name'] || where['property-name'] || directive.select === 'model')) {
40
+ return true;
41
+ }
42
+ return false;
43
+ }
44
+ async function tweakModel(state) {
45
+ var _a;
46
+ // only look at directives without the `transform` node.
47
+ for (const directive of directives.filter(each => !each.transform)) {
48
+ const getPatternToMatch = (selector) => {
49
+ return selector ? !hasSpecialChars(selector) ? new RegExp(`^${selector}$`, 'gi') : new RegExp(selector, 'gi') : undefined;
50
+ };
51
+ if (isWhereModelDirective(directive)) {
52
+ const selectType = directive.select;
53
+ const modelNameRegex = getPatternToMatch(directive.where['model-name']);
54
+ const propertyNameRegex = getPatternToMatch(directive.where['property-name']);
55
+ const modelNameReplacer = directive.set['model-name'];
56
+ const propertyNameReplacer = directive.set['property-name'];
57
+ // select all models
58
+ let models = [...(_a = state.model.schemas.objects) !== null && _a !== void 0 ? _a : []];
59
+ // let models = values(state.model.schemas).toArray();
60
+ if (modelNameRegex) {
61
+ models = (0, linq_1.values)(models)
62
+ .where(model => { var _a; return !!`${(_a = model.language.csharp) === null || _a === void 0 ? void 0 : _a.name}`.match(modelNameRegex); })
63
+ .toArray();
64
+ }
65
+ if (propertyNameRegex && selectType === 'model') {
66
+ models = (0, linq_1.values)(models)
67
+ .where(model => {
68
+ var _a;
69
+ return (0, linq_1.values)((0, resolve_conflicts_1.allVirtualProperties)((_a = model.language.csharp) === null || _a === void 0 ? void 0 : _a.virtualProperties))
70
+ .any(property => !!`${property.name}`.match(propertyNameRegex));
71
+ })
72
+ .toArray();
73
+ }
74
+ if (propertyNameRegex && (selectType === undefined || selectType === 'property')) {
75
+ const properties = (0, linq_1.values)(models)
76
+ .selectMany(model => { var _a; return (0, resolve_conflicts_1.allVirtualProperties)((_a = model.language.csharp) === null || _a === void 0 ? void 0 : _a.virtualProperties); })
77
+ .where(property => !!`${property.name}`.match(propertyNameRegex))
78
+ .toArray();
79
+ for (const property of (0, linq_1.values)(properties)) {
80
+ const prevName = property.name;
81
+ property.name = propertyNameReplacer ? propertyNameRegex ? property.name.replace(propertyNameRegex, propertyNameReplacer) : propertyNameReplacer : property.name;
82
+ if (!property.name) {
83
+ state.message({ Channel: extension_base_1.Channel.Error, Text: `Directive '${directive.where['model-name']}/${directive.where['property-name']}' attempted to change '${prevName}' to '' ` });
84
+ }
85
+ if (propertyNameRegex) {
86
+ state.message({
87
+ Channel: extension_base_1.Channel.Debug, Text: `[DIRECTIVE] Changed property-name from ${prevName} to ${property.name}.`
88
+ });
89
+ }
90
+ }
91
+ }
92
+ else if (models) {
93
+ // comment out below to disable model name change, which will be added in the tweakModelName before the plugin csnamerSdk
94
+ // for (const model of values(models)) {
95
+ // const prevName = model.language.csharp?.name;
96
+ // if (model.language.csharp) {
97
+ // model.language.default.fullname = model.language.csharp.fullname = model.language.default.name = model.language.csharp.name = modelNameReplacer ? modelNameRegex ? model.language.csharp.name.replace(modelNameRegex, modelNameReplacer) : modelNameReplacer : model.language.csharp.name;
98
+ // }
99
+ // state.message({
100
+ // Channel: Channel.Debug, Text: `[DIRECTIVE] Changed model-name from ${prevName} to ${model.language.csharp?.name}.`
101
+ // });
102
+ // }
103
+ }
104
+ }
105
+ }
106
+ return state.model;
107
+ }
108
+ async function tweakModelName(state) {
109
+ var _a;
110
+ // only look at directives without the `transform` node.
111
+ for (const directive of directives.filter(each => !each.transform)) {
112
+ const getPatternToMatch = (selector) => {
113
+ return selector ? !hasSpecialChars(selector) ? new RegExp(`^${selector}$`, 'gi') : new RegExp(selector, 'gi') : undefined;
114
+ };
115
+ if (isWhereModelDirective(directive)) {
116
+ const selectType = directive.select;
117
+ const modelNameRegex = getPatternToMatch(directive.where['model-name']);
118
+ const propertyNameRegex = getPatternToMatch(directive.where['property-name']);
119
+ const modelNameReplacer = directive.set['model-name'];
120
+ const propertyNameReplacer = directive.set['property-name'];
121
+ // select all models
122
+ let models = [...(_a = state.model.schemas.objects) !== null && _a !== void 0 ? _a : []];
123
+ // let models = values(state.model.schemas).toArray();
124
+ if (modelNameRegex) {
125
+ models = (0, linq_1.values)(models)
126
+ .where(model => !!`${model.language.default.name}`.match(modelNameRegex))
127
+ .toArray();
128
+ }
129
+ if (propertyNameRegex && selectType === 'model') {
130
+ models = (0, linq_1.values)(models)
131
+ .where(model => (0, linq_1.values)((0, resolve_conflicts_1.allVirtualProperties)(model.language.default.virtualProperties))
132
+ .any(property => !!`${property.name}`.match(propertyNameRegex)))
133
+ .toArray();
134
+ }
135
+ if (propertyNameRegex && (selectType === undefined || selectType === 'property')) {
136
+ // skip directive for property
137
+ }
138
+ else if (models) {
139
+ for (const model of (0, linq_1.values)(models)) {
140
+ const prevName = model.language.default.name;
141
+ model.language.default.name = modelNameReplacer ? modelNameRegex ? model.language.default.name.replace(modelNameRegex, modelNameReplacer) : modelNameReplacer : model.language.default.name;
142
+ state.message({
143
+ Channel: extension_base_1.Channel.Debug, Text: `[DIRECTIVE] Changed model-name from ${prevName} to ${model.language.default.name}.`
144
+ });
145
+ }
146
+ }
147
+ }
148
+ }
149
+ return state.model;
150
+ }
151
+ async function applyModifiersSdk(service) {
152
+ // dolauli implement directives
153
+ const allDirectives = await service.getValue('directive');
154
+ directives = (0, linq_1.values)(allDirectives)
155
+ // .select(directive => directive)
156
+ .where(directive => isWhereModelDirective(directive))
157
+ .toArray();
158
+ const state = await new model_state_1.ModelState(service).init();
159
+ const result = await tweakModel(state);
160
+ await service.writeFile({ filename: 'code-model-v4-modifiers-sdk.yaml', content: (0, codegen_1.serialize)(result), sourceMap: undefined, artifactType: 'code-model-sdk' });
161
+ }
162
+ exports.applyModifiersSdk = applyModifiersSdk;
163
+ async function applyModelNameModifiersSdk(service) {
164
+ // dolauli implement directives
165
+ const allDirectives = await service.getValue('directive');
166
+ directives = (0, linq_1.values)(allDirectives)
167
+ // .select(directive => directive)
168
+ .where(directive => isWhereModelDirective(directive))
169
+ .toArray();
170
+ const state = await new model_state_1.ModelState(service).init();
171
+ const result = await tweakModelName(state);
172
+ await service.writeFile({ filename: 'code-model-v4-model-name-modifiers-sdk.yaml', content: (0, codegen_1.serialize)(result), sourceMap: undefined, artifactType: 'code-model-sdk' });
173
+ }
174
+ exports.applyModelNameModifiersSdk = applyModelNameModifiersSdk;
175
+ //# sourceMappingURL=sdk-modifiers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk-modifiers.js","sourceRoot":"","sources":["../../plugins/sdk-modifiers.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,6DAAkF;AAClF,kDAAuE;AAEvE,4CAA4E;AAI5E,sDAAkD;AAElD,kEAAwF;AAKxF,IAAI,UAAU,GAAe,EAAE,CAAC;AAGhC,SAAS,eAAe,CAAC,GAAW;IAClC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC;AAED,SAAS,cAAc,CAAC,WAAgB,EAAE,iBAAgC,EAAE,aAAqB;IAC/F,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,KAAK,MAAM,IAAI,IAAI,IAAA,aAAM,EAAC,iBAAiB,CAAC,EAAE;QAC5C,IAAI,WAAW,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE;YACnC,KAAK,IAAI,mBAAmB,IAAI,2BAA2B,CAAC;SAC7D;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,WAAW,CAAC,SAAc,EAAE,iBAAgC,EAAE,aAAqB;IAC1F,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,KAAK,MAAM,IAAI,IAAI,IAAA,aAAM,EAAC,iBAAiB,CAAC,EAAE;QAC5C,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE;YACjC,KAAK,IAAI,aAAa,IAAI,WAAW,aAAa,gBAAgB,CAAC;SACpE;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAcD,SAAS,qBAAqB,CAAC,EAAO;IACpC,MAAM,SAAS,GAAG,EAAE,CAAC;IACrB,MAAM,K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;QAChC,kCAAkC;SACjC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC;SACpD,OAAO,EAAE,CAAC;IAEb,MAAM,KAAK,GAAG,MAAM,IAAI,wBAAU,CAAW,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;IAC7D,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,KAAK,CAAC,CAAC;IAEvC,MAAM,OAAO,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,kCAAkC,EAAE,OAAO,EAAE,IAAA,mBAAS,EAAC,MAAM,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC,CAAC;AAC9J,CAAC;AAZD,8CAYC;AAEM,KAAK,UAAU,0BAA0B,CAAC,OAAa;IAC5D,+BAA+B;IAC/B,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAM,WAAW,CAAC,CAAC;IAC/D,UAAU,GAAG,IAAA,aAAM,EAAC,aAAa,CAAC;QAChC,kCAAkC;SACjC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC;SACpD,OAAO,EAAE,CAAC;IAEb,MAAM,KAAK,GAAG,MAAM,IAAI,wBAAU,CAAW,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;IAC7D,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,KAAK,CAAC,CAAC;IAE3C,MAAM,OAAO,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,6CAA6C,EAAE,OAAO,EAAE,IAAA,mBAAS,EAAC,MAAM,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC,CAAC;AACzK,CAAC;AAZD,gEAYC"}
@@ -1,3 +1,3 @@
1
- import { Host } from '@azure-tools/autorest-extension-base';
1
+ import { AutorestExtensionHost as Host } from '@autorest/extension-base';
2
2
  export declare function tweakSdkModelPlugin(service: Host): Promise<void>;
3
3
  //# sourceMappingURL=sdk-tweak-model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sdk-tweak-model.d.ts","sourceRoot":"","sources":["../../plugins/sdk-tweak-model.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;AAsW5D,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,IAAI,iBAWtD"}
1
+ {"version":3,"file":"sdk-tweak-model.d.ts","sourceRoot":"","sources":["../../plugins/sdk-tweak-model.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,qBAAqB,IAAI,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAiczE,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,IAAI,iBAWtD"}
@@ -5,9 +5,10 @@ exports.tweakSdkModelPlugin = void 0;
5
5
  * Copyright (c) Microsoft Corporation. All rights reserved.
6
6
  * Licensed under the MIT License. See License.txt in the project root for license information.
7
7
  *--------------------------------------------------------------------------------------------*/
8
- const codemodel_1 = require("@azure-tools/codemodel");
8
+ const codemodel_1 = require("@autorest/codemodel");
9
9
  const codegen_1 = require("@azure-tools/codegen");
10
10
  const model_state_1 = require("../utils/model-state");
11
+ const http_definitions_1 = require("../utils/http-definitions");
11
12
  const linq_1 = require("@azure-tools/linq");
12
13
  const schema_1 = require("../utils/schema");
13
14
  const exports_1 = require("../llcsharp/exports");
@@ -24,10 +25,36 @@ async function tweakModel(state) {
24
25
  addClientRequiredConstructorParametersDeclaration(model);
25
26
  return model;
26
27
  }
28
+ function splitStringWithExclusion(input, delimiter) {
29
+ const result = [];
30
+ let temp = '';
31
+ let insideBracket = 0;
32
+ for (let i = 0; i < input.length; i++) {
33
+ if (input[i] === '<') {
34
+ insideBracket++;
35
+ temp += input[i];
36
+ }
37
+ else if (input[i] === '>') {
38
+ insideBracket--;
39
+ temp += input[i];
40
+ }
41
+ else if (input[i] === delimiter && insideBracket === 0) {
42
+ result.push(temp.trim());
43
+ temp = '';
44
+ }
45
+ else {
46
+ temp += input[i];
47
+ }
48
+ }
49
+ if (temp !== '') {
50
+ result.push(temp.trim());
51
+ }
52
+ return result;
53
+ }
27
54
  function addClientRequiredConstructorParametersDeclaration(model) {
28
55
  var _a;
29
56
  const declarations = [];
30
- for (const parameter of linq_1.values(model.globalParameters)) {
57
+ for (const parameter of (0, linq_1.values)(model.globalParameters)) {
31
58
  if (parameter.language.default.name === '$host') {
32
59
  // skip $host
33
60
  continue;
@@ -40,16 +67,19 @@ function addClientRequiredConstructorParametersDeclaration(model) {
40
67
  }
41
68
  function tweakSchema(model) {
42
69
  var _a;
43
- for (const obj of linq_1.values(model.schemas.objects)) {
70
+ for (const obj of (0, linq_1.values)(model.schemas.objects)) {
44
71
  const optionalParameters = Array();
45
72
  const requiredParameters = Array();
46
- for (const property of linq_1.values(obj.properties)) {
73
+ const optionalParametersWithoutReadOnly = Array();
74
+ const requiredParametersWithoutReadOnly = Array();
75
+ for (const property of (0, linq_1.values)(obj.properties)) {
47
76
  property.language.csharp = {
48
77
  name: property.language.default.name.substring(0, 1).toUpperCase() + property.language.default.name.substring(1),
49
78
  formattedPropertySummary: (property.readOnly ? 'Gets ' : 'Gets or sets ') + property.language.default.description.substring(0, 1).toLowerCase() + property.language.default.description.substring(1)
50
79
  };
51
80
  }
52
- for (const virtualProperty of schema_1.getAllPublicVirtualPropertiesForSdk(obj.language.default.virtualProperties)) {
81
+ const publicProperties = obj.extensions && obj.extensions['x-ms-azure-resource'] ? (0, schema_1.getAllPublicVirtualPropertiesForSdkWithoutInherited)(obj.language.default.virtualProperties) : (0, schema_1.getAllPublicVirtualPropertiesForSdk)(obj.language.default.virtualProperties);
82
+ for (const virtualProperty of publicProperties) {
53
83
  if (virtualProperty.name.toLowerCase() === obj.language.default.name.toLowerCase()) {
54
84
  // If the name is same as class name, will add 'Property' suffix
55
85
  virtualProperty.name = virtualProperty.name + 'Property';
@@ -60,17 +90,20 @@ function tweakSchema(model) {
60
90
  continue;
61
91
  }
62
92
  let type = ((_a = virtualProperty.property.schema.language.csharp) === null || _a === void 0 ? void 0 : _a.fullname) || '';
63
- type = (schema_1.valueType(virtualProperty.property.schema.type) || (virtualProperty.property.schema.type === codemodel_1.SchemaType.SealedChoice && (virtualProperty.property.schema.choiceType.type !== codemodel_1.SchemaType.String || (virtualProperty.property.schema.extensions && !virtualProperty.property.schema.extensions['x-ms-model-as-string'])))) && !virtualProperty.required ? `${type}?` : type;
64
- const CamelName = codegen_1.camelCase(virtualProperty.name);
93
+ type = ((0, schema_1.valueType)(virtualProperty.property.schema.type) || (virtualProperty.property.schema.type === codemodel_1.SchemaType.SealedChoice && (virtualProperty.property.schema.choiceType.type !== codemodel_1.SchemaType.String || (virtualProperty.property.schema.extensions && !virtualProperty.property.schema.extensions['x-ms-model-as-string'])))) && !virtualProperty.required && virtualProperty.property.nullable != false ? `${type}?` : type;
94
+ const CamelName = (0, codegen_1.camelCase)(virtualProperty.name);
65
95
  virtualProperty.required ? requiredParameters.push(`${type} ${CamelName}`) : optionalParameters.push(`${type} ${CamelName} = default(${type})`);
96
+ if (!virtualProperty.readOnly) {
97
+ virtualProperty.required ? requiredParametersWithoutReadOnly.push(`${type} ${CamelName}`) : optionalParametersWithoutReadOnly.push(`${type} ${CamelName} = default(${type})`);
98
+ }
66
99
  }
67
- if (obj.parents && obj.parents.immediate.length === 1) {
68
- // If there is only one direct parameter, will implement it as base class
100
+ if (obj.parents && (obj.parents.immediate.length === 1 && !(obj.extensions && obj.extensions['x-ms-azure-resource']))) {
101
+ // If there is only one direct parent parameter and extension x-ms-azure-resource is not set, will implement it as base class
69
102
  let baseConstructorParametersCall = Array();
70
103
  const baseRequiredParameters = Array();
71
104
  const baseOptionalParameters = Array();
72
- const combinedProperties = schema_1.getAllPublicVirtualPropertiesForSdk(obj.parents.immediate[0].language.default.virtualProperties);
73
- for (const virtualProperty of linq_1.values(combinedProperties)) {
105
+ const combinedProperties = (0, schema_1.getAllPublicVirtualPropertiesForSdk)(obj.parents.immediate[0].language.default.virtualProperties);
106
+ for (const virtualProperty of (0, linq_1.values)(combinedProperties)) {
74
107
  if (virtualProperty.required) {
75
108
  baseRequiredParameters.push(virtualProperty.name);
76
109
  }
@@ -78,12 +111,13 @@ function tweakSchema(model) {
78
111
  baseOptionalParameters.push(virtualProperty.name);
79
112
  }
80
113
  }
81
- baseConstructorParametersCall = [...baseRequiredParameters, ...baseOptionalParameters].map((p) => codegen_1.camelCase(p) || '');
114
+ baseConstructorParametersCall = [...baseRequiredParameters, ...baseOptionalParameters].map((p) => (0, codegen_1.camelCase)(p) || '');
82
115
  if (baseConstructorParametersCall.length > 0) {
83
116
  obj.language.default.baseConstructorCall = `base(${baseConstructorParametersCall.join(', ')})`;
84
117
  }
85
118
  }
86
119
  obj.language.default.constructorParametersDeclaration = [...requiredParameters, ...optionalParameters].join(', ');
120
+ obj.language.default.constructorParametersDeclarationWithoutReadOnly = [...requiredParametersWithoutReadOnly, ...optionalParametersWithoutReadOnly].join(', ');
87
121
  }
88
122
  }
89
123
  function addUsings(model) {
@@ -103,8 +137,8 @@ function addMethodParameterDeclaration(operation, state) {
103
137
  addNormalMethodParameterDeclaration(operation, state);
104
138
  }
105
139
  }
106
- function typePostfix(schema) {
107
- return schema_1.valueType(schema.type) || (schema.type === codemodel_1.SchemaType.SealedChoice && (schema.choiceType.type !== codemodel_1.SchemaType.String || (schema.extensions && !schema.extensions['x-ms-model-as-string']))) ? '?' : '';
140
+ function typePostfix(schema, nullable = true) {
141
+ return ((0, schema_1.valueType)(schema.type) || (schema.type === codemodel_1.SchemaType.SealedChoice && (schema.choiceType.type !== codemodel_1.SchemaType.String || (schema.extensions && !schema.extensions['x-ms-model-as-string'])))) && nullable ? '?' : '';
108
142
  }
109
143
  function addNormalMethodParameterDeclaration(operation, state) {
110
144
  let declarations = [];
@@ -118,15 +152,18 @@ function addNormalMethodParameterDeclaration(operation, state) {
118
152
  if (operation.requests && operation.requests.length > 0) {
119
153
  bodyParameters = (operation.requests[0].parameters || []).filter(p => { var _a; return ((_a = p.protocol.http) === null || _a === void 0 ? void 0 : _a.in) === codemodel_1.ParameterLocation.Body; });
120
154
  }
121
- (operation.parameters || []).filter(p => p.implementation != 'Client' && !(p.extensions && p.extensions['x-ms-parameter-grouping'])
122
- && !(p.required && p.schema.type === codemodel_1.SchemaType.Choice && p.schema.choices.length === 1)
123
- && !(p.required && p.schema.type === codemodel_1.SchemaType.SealedChoice && p.schema.choices.length === 1)).forEach(function (parameter) {
155
+ (operation.parameters || []).filter(p => {
156
+ var _a;
157
+ return p.implementation != 'Client' && ((_a = p.protocol.http) === null || _a === void 0 ? void 0 : _a.in) !== 'complexHeader' && !(p.extensions && p.extensions['x-ms-parameter-grouping'])
158
+ && !(p.required && p.schema.type === codemodel_1.SchemaType.Choice && p.schema.choices.length === 1)
159
+ && !(p.required && p.schema.type === codemodel_1.SchemaType.SealedChoice && p.schema.choices.length === 1);
160
+ }).forEach(function (parameter) {
124
161
  var _a, _b;
125
162
  let type = ((_a = parameter.schema.language.csharp) === null || _a === void 0 ? void 0 : _a.fullname) || ((_b = parameter.schema.language.csharp) === null || _b === void 0 ? void 0 : _b.name) || '';
126
163
  if (parameter.extensions && parameter.extensions['x-ms-odata']) {
127
164
  type = `Microsoft.Rest.Azure.OData.ODataQuery<${type}>`;
128
165
  }
129
- const postfix = typePostfix(parameter.schema);
166
+ const postfix = typePostfix(parameter.schema, parameter.nullable != false);
130
167
  if (!(parameter.required && parameter.schema.type === codemodel_1.SchemaType.Constant)) {
131
168
  // skip required const parameter
132
169
  parameter.required ? requiredDeclarations.push(`${type} ${parameter.language.default.name}`) : optionalDeclarations.push(`${type}${postfix} ${parameter.language.default.name} = default(${type}${postfix})`);
@@ -137,15 +174,19 @@ function addNormalMethodParameterDeclaration(operation, state) {
137
174
  && !(p.required && p.schema.type === codemodel_1.SchemaType.Choice && p.schema.choices.length === 1)
138
175
  && !(p.required && p.schema.type === codemodel_1.SchemaType.SealedChoice && p.schema.choices.length === 1)).forEach(function (parameter) {
139
176
  if (parameter.extensions && parameter.extensions['x-ms-client-flatten']) {
140
- const constructorParametersDeclaration = parameter.schema.language.default.constructorParametersDeclaration;
141
- constructorParametersDeclaration.split(', ').forEach(function (p) {
177
+ const constructorParametersDeclarationWithoutReadOnly = parameter.schema.language.default.constructorParametersDeclarationWithoutReadOnly;
178
+ splitStringWithExclusion(constructorParametersDeclarationWithoutReadOnly, ',').forEach(function (p) {
142
179
  requiredDeclarations.push(p);
143
- requiredArgs.push(p.split(' ')[1]);
180
+ requiredArgs.push(splitStringWithExclusion(p, ' ')[1]);
144
181
  });
145
182
  }
146
183
  else {
147
- const type = parameter.schema.language.csharp && parameter.schema.language.csharp.fullname && parameter.schema.language.csharp.fullname != '<INVALID_FULLNAME>' ? parameter.schema.language.csharp.fullname : parameter.schema.language.default.name;
148
- const postfix = typePostfix(parameter.schema);
184
+ let type = parameter.schema.language.csharp && parameter.schema.language.csharp.fullname && parameter.schema.language.csharp.fullname != '<INVALID_FULLNAME>' ? parameter.schema.language.csharp.fullname : parameter.schema.language.default.name;
185
+ if (parameter.schema.type === codemodel_1.SchemaType.Binary) {
186
+ //as response or request body, binary is always stream, otherwise it is string
187
+ type = 'System.IO.Stream';
188
+ }
189
+ const postfix = typePostfix(parameter.schema, parameter.nullable != false);
149
190
  parameter.required ? requiredDeclarations.push(`${type} ${parameter.language.default.name}`) : optionalDeclarations.push(`${type}${postfix} ${parameter.language.default.name} = default(${type}${postfix})`);
150
191
  parameter.required ? requiredArgs.push(parameter.language.default.name) : optionalArgs.push(parameter.language.default.name);
151
192
  }
@@ -170,7 +211,31 @@ function addNormalMethodParameterDeclaration(operation, state) {
170
211
  operation.language.default.asyncMethodInvocationArgsWithCustomerHeaders = argsWithCustomerHeaders.join(', ');
171
212
  }
172
213
  function addPageableMethodParameterDeclaration(operation) {
173
- const pageableMethodDeclarations = ['string nextPageLink'];
214
+ const optionalDeclarations = [];
215
+ const requiredDeclarations = [];
216
+ const requiredArgs = [];
217
+ const optionalArgs = [];
218
+ const headerParameters = (operation.parameters || []).filter(p => {
219
+ var _a, _b;
220
+ return p.implementation != 'Client' && !(p.extensions && p.extensions['x-ms-parameter-grouping'])
221
+ && !(p.required && p.schema.type === codemodel_1.SchemaType.Choice && p.schema.choices.length === 1)
222
+ && !(p.required && p.schema.type === codemodel_1.SchemaType.SealedChoice && p.schema.choices.length === 1)
223
+ && (((_a = p.protocol.http) === null || _a === void 0 ? void 0 : _a.in) === codemodel_1.ParameterLocation.Header || ((_b = p.protocol.http) === null || _b === void 0 ? void 0 : _b.in) === 'complexHeader');
224
+ });
225
+ headerParameters.forEach(function (parameter) {
226
+ var _a, _b;
227
+ let type = ((_a = parameter.schema.language.csharp) === null || _a === void 0 ? void 0 : _a.fullname) || ((_b = parameter.schema.language.csharp) === null || _b === void 0 ? void 0 : _b.name) || '';
228
+ if (parameter.extensions && parameter.extensions['x-ms-odata']) {
229
+ type = `Microsoft.Rest.Azure.OData.ODataQuery<${type}>`;
230
+ }
231
+ const postfix = typePostfix(parameter.schema, parameter.nullable != false);
232
+ if (!(parameter.required && parameter.schema.type === codemodel_1.SchemaType.Constant)) {
233
+ // skip required const parameter
234
+ parameter.required ? requiredDeclarations.push(`${type} ${parameter.language.default.name}`) : optionalDeclarations.push(`${type}${postfix} ${parameter.language.default.name} = default(${type}${postfix})`);
235
+ parameter.required ? requiredArgs.push(parameter.language.default.name) : optionalArgs.push(parameter.language.default.name);
236
+ }
237
+ });
238
+ const pageableMethodDeclarations = ['string nextPageLink', ...requiredDeclarations, ...optionalDeclarations];
174
239
  operation.language.default.syncMethodParameterDeclaration = pageableMethodDeclarations.join(', ');
175
240
  pageableMethodDeclarations.push('System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)');
176
241
  operation.language.default.asyncMethodParameterDeclaration = pageableMethodDeclarations.join(', ');
@@ -179,11 +244,15 @@ function addPageableMethodParameterDeclaration(operation) {
179
244
  operation.language.default.syncMethodParameterDeclarationWithCustomHeader = pageableMethodDeclarations.join(', ');
180
245
  pageableMethodDeclarations.push('System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)');
181
246
  operation.language.default.asyncMethodParameterDeclarationWithCustomHeader = pageableMethodDeclarations.join(', ');
182
- const pageableMethodArgs = ['nextPageLink'];
247
+ const pageableMethodArgs = ['nextPageLink', ...requiredArgs, ...optionalArgs];
183
248
  operation.language.default.syncMethodInvocationArgs = pageableMethodArgs.join(', ');
249
+ const pageableMethodArgsWithCustomerHeaders = [...pageableMethodArgs];
184
250
  pageableMethodArgs.push('null');
185
251
  pageableMethodArgs.push('cancellationToken');
186
252
  operation.language.default.asyncMethodInvocationArgs = pageableMethodArgs.join(', ');
253
+ pageableMethodArgsWithCustomerHeaders.push('customHeaders');
254
+ pageableMethodArgsWithCustomerHeaders.push('cancellationToken');
255
+ operation.language.default.asyncMethodInvocationArgsWithCustomerHeaders = pageableMethodArgsWithCustomerHeaders.join(', ');
187
256
  }
188
257
  function tweakGlobalParameter(globalParameters) {
189
258
  if (!globalParameters) {
@@ -200,10 +269,10 @@ function tweakGlobalParameter(globalParameters) {
200
269
  });
201
270
  }
202
271
  async function tweakOperation(state) {
203
- var _a, _b, _c, _d;
272
+ var _a, _b, _c, _d, _e;
204
273
  for (const operationGroup of state.model.operationGroups) {
205
- if (code_namer_1.isReserved(operationGroup.$key)) {
206
- operationGroup.$key = codegen_1.pascalCase(`${operationGroup.$key}Model`);
274
+ if ((0, code_namer_1.isReserved)(operationGroup.$key)) {
275
+ operationGroup.$key = (0, codegen_1.pascalCase)(`${operationGroup.$key}Model`);
207
276
  operationGroup.language.default.name = operationGroup.$key;
208
277
  }
209
278
  for (const operation of operationGroup.operations) {
@@ -212,25 +281,37 @@ async function tweakOperation(state) {
212
281
  operation.language.default.returnTypeHeader.name = '';
213
282
  if (operation.responses) {
214
283
  const schemas = new Set();
284
+ let respCountWithBody = 0;
285
+ let binaryResponse = false;
286
+ // sometimes, it will generate a binary response with no schema
287
+ let specialBinaryResponse = 0;
215
288
  operation.responses.forEach(function (resp) {
216
289
  if (resp.schema) {
217
290
  schemas.add(resp.schema);
291
+ if ((resp.schema).type === codemodel_1.SchemaType.Binary) {
292
+ binaryResponse = true;
293
+ }
294
+ }
295
+ else if (resp.binary) {
296
+ binaryResponse = true;
297
+ specialBinaryResponse = 1;
218
298
  }
219
299
  });
220
- const respCountWithBody = schemas.size;
300
+ respCountWithBody = schemas.size + specialBinaryResponse;
221
301
  const isHead = operation.requests && ((_a = operation.requests[0].protocol.http) === null || _a === void 0 ? void 0 : _a.method) === 'head';
222
302
  if (isHead) {
223
- initializeResponseBody = '_result.Body = (_statusCode == System.Net.HttpStatusCode.OK);';
303
+ const succeedCode = (_b = operation.responses.filter(r => { var _a; return ((_a = r.protocol.http) === null || _a === void 0 ? void 0 : _a.statusCodes[0]).startsWith('2'); })[0].protocol.http) === null || _b === void 0 ? void 0 : _b.statusCodes[0];
304
+ initializeResponseBody = `_result.Body = (_statusCode == System.Net.HttpStatusCode.${http_definitions_1.StatusCodes[succeedCode]});`;
224
305
  }
225
306
  const responses = operation.responses.filter(r => r.schema);
226
307
  const hasHeaderResponse = operation.responses.some(r => r.protocol.http.headers);
227
- const headerSchema = codegen_1.pascalCase(operationGroup.$key + ((_b = operation.language.default.original) !== null && _b !== void 0 ? _b : operation.language.default.name) + 'Headers');
308
+ const headerSchema = (0, codegen_1.pascalCase)(operationGroup.$key + ((_c = operation.language.default.original) !== null && _c !== void 0 ? _c : operation.language.default.name) + 'Headers');
228
309
  operation.language.default.returnTypeHeader.name = hasHeaderResponse ? headerSchema : '';
229
310
  let headerPostfix = hasHeaderResponse ? `,${headerSchema}` : '';
230
311
  if (respCountWithBody === 0) {
231
312
  const statusCodes = new Array();
232
313
  operation.responses.forEach(resp => { var _a; return statusCodes.push((_a = resp.protocol.http) === null || _a === void 0 ? void 0 : _a.statusCodes[0]); });
233
- if (isHead && ((_c = operation.responses) === null || _c === void 0 ? void 0 : _c.length) === 2 && statusCodes.includes('404') && !hasHeaderResponse) {
314
+ if (isHead && ((_d = operation.responses) === null || _d === void 0 ? void 0 : _d.length) === 2 && statusCodes.includes('404') && !hasHeaderResponse) {
234
315
  operation.language.default.responseType = 'Microsoft.Rest.Azure.AzureOperationResponse<bool>';
235
316
  operation.language.default.returnType = 'bool';
236
317
  }
@@ -241,21 +322,36 @@ async function tweakOperation(state) {
241
322
  }
242
323
  }
243
324
  else if (respCountWithBody === 1) {
244
- const respSchema = responses[0].schema;
325
+ const respSchema = binaryResponse ? undefined : responses[0].schema;
245
326
  if (operation.language.default.pageable) {
246
- const responseType = respSchema.language.default.virtualProperties.owned.find((p) => p.name === codegen_1.pascalCase(operation.language.default.pageable.itemName)).property.schema.elementType.language.csharp.fullname;
327
+ const responseType = respSchema.language.default.virtualProperties.owned.find((p) => p.name === (0, codegen_1.pascalCase)(operation.language.default.pageable.itemName)).property.schema.elementType.language.csharp.fullname;
328
+ if (responseType) {
329
+ if (hasHeaderResponse) {
330
+ operation.language.default.responseType = `Microsoft.Rest.Azure.AzureOperationResponse<${operation.language.default.pageable.ipageType}<${responseType}>${headerPostfix}>`;
331
+ }
332
+ else {
333
+ operation.language.default.responseType = `Microsoft.Rest.Azure.AzureOperationResponse<${operation.language.default.pageable.ipageType}<${responseType}>>`;
334
+ }
335
+ }
336
+ else {
337
+ operation.language.default.responseType = 'Microsoft.Rest.Azure.AzureOperationResponse';
338
+ }
247
339
  // Mark response as pageable
248
- respSchema.language.default.pagable = true;
249
- operation.language.default.responseType = `Microsoft.Rest.Azure.AzureOperationResponse<${operation.language.default.pageable.ipageType}<${responseType}>>`;
340
+ if (respSchema.language.default.pagable == undefined) {
341
+ respSchema.language.default.pagable = true;
342
+ }
250
343
  operation.language.default.returnType = `${operation.language.default.pageable.ipageType}<${responseType}>`;
251
344
  operation.language.default.deserializeType = `${operation.language.default.pageable.pageType}<${responseType}>`;
252
345
  }
253
346
  else {
254
- const postfix = (schema_1.valueType(respSchema.type)
347
+ if (respSchema) {
348
+ respSchema.language.default.pagable = false;
349
+ }
350
+ const postfix = !!respSchema && ((0, schema_1.valueType)(respSchema.type)
255
351
  || (respSchema.type === codemodel_1.SchemaType.SealedChoice && respSchema.extensions && !respSchema.extensions['x-ms-model-as-string'])
256
- || (respSchema.type === codemodel_1.SchemaType.Choice && schema_1.valueType(respSchema.choiceType.type))
257
- || (respSchema.type === codemodel_1.SchemaType.SealedChoice && respSchema.extensions && schema_1.valueType(respSchema.choiceType.type))) ? '?' : '';
258
- const fullname = (respSchema.type === codemodel_1.SchemaType.Choice || (respSchema.type === codemodel_1.SchemaType.SealedChoice && (schema_1.valueType(respSchema.choiceType.type) || (respSchema.extensions && respSchema.extensions['x-ms-model-as-string'])))) ? (_d = respSchema.choiceType.language.csharp) === null || _d === void 0 ? void 0 : _d.fullname : respSchema.language.csharp.fullname;
352
+ || (respSchema.type === codemodel_1.SchemaType.Choice && (0, schema_1.valueType)(respSchema.choiceType.type))
353
+ || (respSchema.type === codemodel_1.SchemaType.SealedChoice && respSchema.extensions && (0, schema_1.valueType)(respSchema.choiceType.type))) ? '?' : '';
354
+ const fullname = binaryResponse ? 'System.IO.Stream' : ((respSchema.type === codemodel_1.SchemaType.Choice || (respSchema.type === codemodel_1.SchemaType.SealedChoice && ((0, schema_1.valueType)(respSchema.choiceType.type) || (respSchema.extensions && respSchema.extensions['x-ms-model-as-string'])))) ? (_e = respSchema.choiceType.language.csharp) === null || _e === void 0 ? void 0 : _e.fullname : respSchema.language.csharp.fullname);
259
355
  operation.language.default.responseType = `Microsoft.Rest.Azure.AzureOperationResponse<${fullname}${postfix}${headerPostfix}>`;
260
356
  operation.language.default.returnType = `${fullname}${postfix}`;
261
357
  }
@@ -278,7 +374,7 @@ async function tweakOperation(state) {
278
374
  function setFailureStatusCodePredicate(operation) {
279
375
  var _a;
280
376
  const failureStatusCodePredicate = Array();
281
- for (const resp of linq_1.values(operation.responses)) {
377
+ for (const resp of (0, linq_1.values)(operation.responses)) {
282
378
  const status = (_a = resp.protocol.http) === null || _a === void 0 ? void 0 : _a.statusCodes[0];
283
379
  failureStatusCodePredicate.push(`(int)_statusCode != ${status}`);
284
380
  }
@@ -342,12 +438,12 @@ function addAzureProperties(globalParameters) {
342
438
  }
343
439
  async function tweakSdkModelPlugin(service) {
344
440
  const state = await new model_state_1.ModelState(service).init();
345
- const debug = await service.GetValue('debug') || false;
441
+ const debug = await service.getValue('debug') || false;
346
442
  try {
347
- service.WriteFile('sdk-code-model-v4-tweaksdk.yaml', codegen_1.serialize(await tweakModel(state)), undefined, 'code-model-v4');
443
+ service.writeFile({ filename: 'sdk-code-model-v4-tweaksdk.yaml', content: (0, codegen_1.serialize)(await tweakModel(state)), sourceMap: undefined, artifactType: 'code-model-v4' });
348
444
  }
349
445
  catch (E) {
350
- if (debug) {
446
+ if (debug && E instanceof Error) {
351
447
  console.error(`${__filename} - FAILURE ${JSON.stringify(E)} ${E.stack} `);
352
448
  }
353
449
  throw E;