@autorest/powershell 4.0.0-dev.3 → 4.0.0-dev.4

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 (74) hide show
  1. package/.rush/temp/package-deps_build.json +36 -33
  2. package/.rush/temp/shrinkwrap-deps.json +13 -19
  3. package/dist/cmdlets/class.d.ts +1 -0
  4. package/dist/cmdlets/class.d.ts.map +1 -1
  5. package/dist/cmdlets/class.js +128 -79
  6. package/dist/cmdlets/class.js.map +1 -1
  7. package/dist/cmdlets/namespace.d.ts.map +1 -1
  8. package/dist/cmdlets/namespace.js +2 -1
  9. package/dist/cmdlets/namespace.js.map +1 -1
  10. package/dist/enums/namespace.js.map +1 -1
  11. package/dist/generators/inputhandler.custom.d.ts +3 -0
  12. package/dist/generators/inputhandler.custom.d.ts.map +1 -0
  13. package/dist/generators/inputhandler.custom.js +32 -0
  14. package/dist/generators/inputhandler.custom.js.map +1 -0
  15. package/dist/generators/psm1.js +1 -1
  16. package/dist/generators/psm1.js.map +1 -1
  17. package/dist/internal/project.d.ts +11 -9
  18. package/dist/internal/project.d.ts.map +1 -1
  19. package/dist/internal/project.js +5 -2
  20. package/dist/internal/project.js.map +1 -1
  21. package/dist/llcsharp/clientruntime.d.ts +2 -0
  22. package/dist/llcsharp/clientruntime.d.ts.map +1 -1
  23. package/dist/llcsharp/clientruntime.js +2 -0
  24. package/dist/llcsharp/clientruntime.js.map +1 -1
  25. package/dist/llcsharp/enums/enum.js +1 -1
  26. package/dist/llcsharp/enums/enum.js.map +1 -1
  27. package/dist/llcsharp/model/interface.d.ts.map +1 -1
  28. package/dist/llcsharp/model/interface.js.map +1 -1
  29. package/dist/llcsharp/model/model-class.js +7 -8
  30. package/dist/llcsharp/model/model-class.js.map +1 -1
  31. package/dist/llcsharp/operation/method.d.ts.map +1 -1
  32. package/dist/llcsharp/operation/method.js +6 -6
  33. package/dist/llcsharp/operation/method.js.map +1 -1
  34. package/dist/llcsharp/project.d.ts.map +1 -1
  35. package/dist/llcsharp/project.js +2 -1
  36. package/dist/llcsharp/project.js.map +1 -1
  37. package/dist/llcsharp/schema/date-time.d.ts.map +1 -1
  38. package/dist/llcsharp/schema/date-time.js.map +1 -1
  39. package/dist/llcsharp/schema/password.js +1 -1
  40. package/dist/llcsharp/schema/password.js.map +1 -1
  41. package/dist/llcsharp/schema/primitive.js.map +1 -1
  42. package/dist/llcsharp/schema/string.d.ts.map +1 -1
  43. package/dist/llcsharp/schema/string.js.map +1 -1
  44. package/dist/models/model-extensions.js +6 -6
  45. package/dist/models/model-extensions.js.map +1 -1
  46. package/dist/module/module-class.js.map +1 -1
  47. package/dist/plugins/create-commands-v2.d.ts.map +1 -1
  48. package/dist/plugins/create-commands-v2.js.map +1 -1
  49. package/dist/plugins/cs-namer-v2.js +1 -1
  50. package/dist/plugins/cs-namer-v2.js.map +1 -1
  51. package/dist/plugins/modifiers-v2.d.ts +4 -0
  52. package/dist/plugins/modifiers-v2.d.ts.map +1 -1
  53. package/dist/plugins/modifiers-v2.js +65 -10
  54. package/dist/plugins/modifiers-v2.js.map +1 -1
  55. package/dist/plugins/plugin-tweak-m4-model.js +2 -2
  56. package/dist/plugins/plugin-tweak-m4-model.js.map +1 -1
  57. package/dist/plugins/plugin-tweak-model-azure-v2.js.map +1 -1
  58. package/dist/plugins/plugin-tweak-model.js +2 -2
  59. package/dist/plugins/plugin-tweak-model.js.map +1 -1
  60. package/dist/plugins/powershell-v2.d.ts.map +1 -1
  61. package/dist/plugins/powershell-v2.js +2 -0
  62. package/dist/plugins/powershell-v2.js.map +1 -1
  63. package/dist/utils/command-operation.d.ts +1 -0
  64. package/dist/utils/command-operation.d.ts.map +1 -1
  65. package/dist/utils/command-operation.js.map +1 -1
  66. package/dist/utils/powershell-comment.js +10 -10
  67. package/dist/utils/powershell-comment.js.map +1 -1
  68. package/package.json +3 -3
  69. package/resources/psruntime/BuildTime/Models/PsMarkdownTypes.cs +2 -2
  70. package/resources/psruntime/BuildTime/Models/PsProxyOutputs.cs +5 -1
  71. package/resources/psruntime/BuildTime/Models/PsProxyTypes.cs +2 -0
  72. package/resources/runtime/csharp/client/Context.cs +33 -0
  73. package/resources/runtime/csharp/client/InfoAttribute.cs +1 -0
  74. package/resources/runtime/csharp/client/InputHandler.cs +22 -0
@@ -262,7 +262,11 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
262
262
  var variantListString = defaultInfo.ParameterGroup.VariantNames.ToPsList();
263
263
  var parameterName = defaultInfo.ParameterGroup.ParameterName;
264
264
  sb.AppendLine();
265
- sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}')) {{");
265
+ var setCondition = " ";
266
+ if (!String.IsNullOrEmpty(defaultInfo.SetCondition)) {
267
+ setCondition = $" -and {defaultInfo.SetCondition}";
268
+ }
269
+ sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}'){setCondition}) {{");
266
270
  sb.AppendLine($"{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = {defaultInfo.Script}");
267
271
  sb.Append($"{Indent}{Indent}}}");
268
272
  }
@@ -425,6 +425,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
425
425
  public string Name { get; }
426
426
  public string Description { get; }
427
427
  public string Script { get; }
428
+ public string SetCondition { get; }
428
429
  public ParameterGroup ParameterGroup { get; }
429
430
 
430
431
  public DefaultInfo(DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup)
@@ -432,6 +433,7 @@ namespace Microsoft.Rest.ClientRuntime.PowerShell
432
433
  Name = infoAttribute.Name;
433
434
  Description = infoAttribute.Description;
434
435
  Script = infoAttribute.Script;
436
+ SetCondition = infoAttribute.SetCondition;
435
437
  ParameterGroup = parameterGroup;
436
438
  }
437
439
 
@@ -0,0 +1,33 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+
6
+ namespace Microsoft.Rest.ClientRuntime
7
+ {
8
+
9
+ using System;
10
+ using System.Linq;
11
+ using System.Collections;
12
+ using System.Collections.Generic;
13
+ using System.Net.Http;
14
+ using System.Threading;
15
+ using System.Threading.Tasks;
16
+ using GetEventData = System.Func<EventData>;
17
+ using static Microsoft.Rest.ClientRuntime.Extensions;
18
+
19
+ /// <summary>
20
+ /// The IContext Interface defines the communication mechanism for input customization.
21
+ /// </summary>
22
+ /// <remarks>
23
+ /// In the context, we will have client, pipeline, PSBoundParamters, default EventListener, Cancellation.
24
+ /// </remarks>
25
+ public interface IContext
26
+ {
27
+ System.Management.Automation.InvocationInfo InvocationInformation { get; set; }
28
+ System.Threading.CancellationTokenSource CancellationTokenSource { get; set; }
29
+ System.Collections.Generic.IDictionary<String, Object> ExtensibleParameters { get; }
30
+ HttpPipeline Pipeline { get; set; }
31
+ Microsoft.RestClient Client { get; }
32
+ }
33
+ }
@@ -33,5 +33,6 @@ namespace Microsoft.Rest.ClientRuntime
33
33
  public string Script { get; set; } = "";
34
34
  public string Name { get; set; } = "";
35
35
  public string Description { get; set; } = "";
36
+ public string SetCondition { get; set; } = "";
36
37
  }
37
38
  }
@@ -0,0 +1,22 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+
6
+ using System;
7
+ using System.Collections.Generic;
8
+
9
+ namespace Microsoft.Rest.ClientRuntime.Cmdlets
10
+ {
11
+ public abstract class InputHandler
12
+ {
13
+ protected InputHandler NextHandler = null;
14
+
15
+ public void SetNextHandler(InputHandler nextHandler)
16
+ {
17
+ this.NextHandler = nextHandler;
18
+ }
19
+
20
+ public abstract void Process(Microsoft.Rest.ClientRuntime.IContext context);
21
+ }
22
+ }