@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.
- package/.rush/temp/package-deps_build.json +208 -203
- package/.rush/temp/shrinkwrap-deps.json +253 -280
- package/autorest-configuration-for-sdk.md +9 -3
- package/autorest-configuration.md +1 -1
- package/dist/cmdlets/class.d.ts +24 -3
- package/dist/cmdlets/class.d.ts.map +1 -1
- package/dist/cmdlets/class.js +888 -603
- package/dist/cmdlets/class.js.map +1 -1
- package/dist/cmdlets/namespace.d.ts.map +1 -1
- package/dist/cmdlets/namespace.js +39 -5
- package/dist/cmdlets/namespace.js.map +1 -1
- package/dist/enums/namespace.js +5 -5
- package/dist/enums/namespace.js.map +1 -1
- package/dist/exports.d.ts +3 -0
- package/dist/exports.d.ts.map +1 -0
- package/dist/exports.js +19 -0
- package/dist/exports.js.map +1 -0
- package/dist/generators/gitignore.d.ts.map +1 -1
- package/dist/generators/gitignore.js +2 -0
- package/dist/generators/gitignore.js.map +1 -1
- package/dist/generators/psm1.custom.js +2 -2
- package/dist/generators/psm1.custom.js.map +1 -1
- package/dist/generators/psm1.d.ts.map +1 -1
- package/dist/generators/psm1.internal.js +2 -2
- package/dist/generators/psm1.internal.js.map +1 -1
- package/dist/generators/psm1.js +17 -11
- package/dist/generators/psm1.js.map +1 -1
- package/dist/generators/readme.d.ts.map +1 -1
- package/dist/generators/readme.js +0 -3
- package/dist/generators/readme.js.map +1 -1
- package/dist/generators/script-cmdlet.js +18 -18
- package/dist/generators/script-cmdlet.js.map +1 -1
- package/dist/internal/name-inferrer.d.ts +1 -1
- package/dist/internal/name-inferrer.d.ts.map +1 -1
- package/dist/internal/name-inferrer.js +12 -12
- package/dist/internal/name-inferrer.js.map +1 -1
- package/dist/internal/powershell-declarations.d.ts +2 -0
- package/dist/internal/powershell-declarations.d.ts.map +1 -1
- package/dist/internal/powershell-declarations.js +4 -2
- package/dist/internal/powershell-declarations.js.map +1 -1
- package/dist/internal/project.d.ts +14 -6
- package/dist/internal/project.d.ts.map +1 -1
- package/dist/internal/project.js +24 -13
- package/dist/internal/project.js.map +1 -1
- package/dist/internal/state.d.ts +3 -2
- package/dist/internal/state.d.ts.map +1 -1
- package/dist/internal/state.js.map +1 -1
- package/dist/llcsharp/clientruntime.d.ts +1 -0
- package/dist/llcsharp/clientruntime.d.ts.map +1 -1
- package/dist/llcsharp/clientruntime.js +12 -11
- package/dist/llcsharp/clientruntime.js.map +1 -1
- package/dist/llcsharp/code-model.d.ts +7 -7
- package/dist/llcsharp/code-model.d.ts.map +1 -1
- package/dist/llcsharp/enums/enum.d.ts +1 -1
- package/dist/llcsharp/enums/enum.d.ts.map +1 -1
- package/dist/llcsharp/enums/enum.js +42 -42
- package/dist/llcsharp/enums/enum.js.map +1 -1
- package/dist/llcsharp/exports.js +5 -1
- package/dist/llcsharp/exports.js.map +1 -1
- package/dist/llcsharp/generator.d.ts +3 -2
- package/dist/llcsharp/generator.d.ts.map +1 -1
- package/dist/llcsharp/generator.js.map +1 -1
- package/dist/llcsharp/model/idictionary.js +16 -16
- package/dist/llcsharp/model/idictionary.js.map +1 -1
- package/dist/llcsharp/model/interface.d.ts +1 -1
- package/dist/llcsharp/model/interface.d.ts.map +1 -1
- package/dist/llcsharp/model/interface.js +19 -19
- package/dist/llcsharp/model/interface.js.map +1 -1
- package/dist/llcsharp/model/model-class-dictionary.js +18 -18
- package/dist/llcsharp/model/model-class-dictionary.js.map +1 -1
- package/dist/llcsharp/model/model-class-json.js +20 -20
- package/dist/llcsharp/model/model-class-json.js.map +1 -1
- package/dist/llcsharp/model/model-class-serializer.d.ts +1 -1
- package/dist/llcsharp/model/model-class-serializer.d.ts.map +1 -1
- package/dist/llcsharp/model/model-class-serializer.js +6 -6
- package/dist/llcsharp/model/model-class-serializer.js.map +1 -1
- package/dist/llcsharp/model/model-class.d.ts +1 -1
- package/dist/llcsharp/model/model-class.d.ts.map +1 -1
- package/dist/llcsharp/model/model-class.js +108 -97
- package/dist/llcsharp/model/model-class.js.map +1 -1
- package/dist/llcsharp/model/namespace.d.ts +1 -1
- package/dist/llcsharp/model/namespace.d.ts.map +1 -1
- package/dist/llcsharp/model/namespace.js +2 -2
- package/dist/llcsharp/model/namespace.js.map +1 -1
- package/dist/llcsharp/model/property.d.ts +1 -1
- package/dist/llcsharp/model/property.d.ts.map +1 -1
- package/dist/llcsharp/model/property.js +20 -20
- package/dist/llcsharp/model/property.js.map +1 -1
- package/dist/llcsharp/operation/api-class.d.ts.map +1 -1
- package/dist/llcsharp/operation/api-class.js +26 -1
- package/dist/llcsharp/operation/api-class.js.map +1 -1
- package/dist/llcsharp/operation/method.d.ts +10 -5
- package/dist/llcsharp/operation/method.d.ts.map +1 -1
- package/dist/llcsharp/operation/method.js +287 -134
- package/dist/llcsharp/operation/method.js.map +1 -1
- package/dist/llcsharp/operation/parameter.d.ts +1 -1
- package/dist/llcsharp/operation/parameter.d.ts.map +1 -1
- package/dist/llcsharp/operation/parameter.js +10 -10
- package/dist/llcsharp/operation/parameter.js.map +1 -1
- package/dist/llcsharp/project.d.ts +8 -4
- package/dist/llcsharp/project.d.ts.map +1 -1
- package/dist/llcsharp/project.js +10 -1
- package/dist/llcsharp/project.js.map +1 -1
- package/dist/llcsharp/schema/Uuid.d.ts +1 -1
- package/dist/llcsharp/schema/Uuid.d.ts.map +1 -1
- package/dist/llcsharp/schema/Uuid.js +2 -2
- package/dist/llcsharp/schema/Uuid.js.map +1 -1
- package/dist/llcsharp/schema/array.d.ts +1 -1
- package/dist/llcsharp/schema/array.d.ts.map +1 -1
- package/dist/llcsharp/schema/array.js +45 -43
- package/dist/llcsharp/schema/array.js.map +1 -1
- package/dist/llcsharp/schema/binary.d.ts +1 -1
- package/dist/llcsharp/schema/binary.d.ts.map +1 -1
- package/dist/llcsharp/schema/binary.js +9 -9
- package/dist/llcsharp/schema/binary.js.map +1 -1
- package/dist/llcsharp/schema/boolean.d.ts +1 -1
- package/dist/llcsharp/schema/boolean.d.ts.map +1 -1
- package/dist/llcsharp/schema/byte-array.d.ts +1 -1
- package/dist/llcsharp/schema/byte-array.d.ts.map +1 -1
- package/dist/llcsharp/schema/byte-array.js +24 -24
- package/dist/llcsharp/schema/byte-array.js.map +1 -1
- package/dist/llcsharp/schema/char.d.ts +1 -1
- package/dist/llcsharp/schema/char.d.ts.map +1 -1
- package/dist/llcsharp/schema/char.js +1 -1
- package/dist/llcsharp/schema/char.js.map +1 -1
- package/dist/llcsharp/schema/date-time.d.ts +1 -1
- package/dist/llcsharp/schema/date-time.d.ts.map +1 -1
- package/dist/llcsharp/schema/date-time.js +45 -41
- package/dist/llcsharp/schema/date-time.js.map +1 -1
- package/dist/llcsharp/schema/date.d.ts +1 -1
- package/dist/llcsharp/schema/date.d.ts.map +1 -1
- package/dist/llcsharp/schema/duration.d.ts +1 -1
- package/dist/llcsharp/schema/duration.d.ts.map +1 -1
- package/dist/llcsharp/schema/duration.js +9 -7
- package/dist/llcsharp/schema/duration.js.map +1 -1
- package/dist/llcsharp/schema/enum.d.ts +6 -2
- package/dist/llcsharp/schema/enum.d.ts.map +1 -1
- package/dist/llcsharp/schema/enum.js +13 -4
- package/dist/llcsharp/schema/enum.js.map +1 -1
- package/dist/llcsharp/schema/extended-type-declaration.d.ts +1 -1
- package/dist/llcsharp/schema/extended-type-declaration.d.ts.map +1 -1
- package/dist/llcsharp/schema/fixed-array.d.ts +1 -1
- package/dist/llcsharp/schema/fixed-array.d.ts.map +1 -1
- package/dist/llcsharp/schema/fixed-array.js +44 -42
- package/dist/llcsharp/schema/fixed-array.js.map +1 -1
- package/dist/llcsharp/schema/integer.d.ts +1 -1
- package/dist/llcsharp/schema/integer.d.ts.map +1 -1
- package/dist/llcsharp/schema/integer.js +5 -5
- package/dist/llcsharp/schema/integer.js.map +1 -1
- package/dist/llcsharp/schema/object.d.ts +1 -1
- package/dist/llcsharp/schema/object.d.ts.map +1 -1
- package/dist/llcsharp/schema/object.js +28 -28
- package/dist/llcsharp/schema/object.js.map +1 -1
- package/dist/llcsharp/schema/password.d.ts +1 -1
- package/dist/llcsharp/schema/password.d.ts.map +1 -1
- package/dist/llcsharp/schema/password.js +13 -13
- package/dist/llcsharp/schema/password.js.map +1 -1
- package/dist/llcsharp/schema/primitive.d.ts +1 -1
- package/dist/llcsharp/schema/primitive.d.ts.map +1 -1
- package/dist/llcsharp/schema/primitive.js +40 -37
- package/dist/llcsharp/schema/primitive.js.map +1 -1
- package/dist/llcsharp/schema/schema-resolver.d.ts +1 -1
- package/dist/llcsharp/schema/schema-resolver.d.ts.map +1 -1
- package/dist/llcsharp/schema/schema-resolver.js +2 -1
- package/dist/llcsharp/schema/schema-resolver.js.map +1 -1
- package/dist/llcsharp/schema/string.d.ts +1 -1
- package/dist/llcsharp/schema/string.d.ts.map +1 -1
- package/dist/llcsharp/schema/string.js +48 -44
- package/dist/llcsharp/schema/string.js.map +1 -1
- package/dist/llcsharp/schema/uri.d.ts +1 -1
- package/dist/llcsharp/schema/uri.d.ts.map +1 -1
- package/dist/llcsharp/schema/uri.js +2 -2
- package/dist/llcsharp/schema/uri.js.map +1 -1
- package/dist/llcsharp/validations.js +2 -2
- package/dist/llcsharp/validations.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +5 -2
- package/dist/main.js.map +1 -1
- package/dist/models/model-extensions.d.ts +1 -1
- package/dist/models/model-extensions.d.ts.map +1 -1
- package/dist/models/model-extensions.js +39 -39
- package/dist/models/model-extensions.js.map +1 -1
- package/dist/module/module-class.d.ts.map +1 -1
- package/dist/module/module-class.js +45 -15
- package/dist/module/module-class.js.map +1 -1
- package/dist/module/module-namespace.js +3 -3
- package/dist/module/module-namespace.js.map +1 -1
- package/dist/plugins/add-azure-completers-v2.d.ts +6 -1
- package/dist/plugins/add-azure-completers-v2.d.ts.map +1 -1
- package/dist/plugins/add-azure-completers-v2.js +5 -4
- package/dist/plugins/add-azure-completers-v2.js.map +1 -1
- package/dist/plugins/create-commands-v2.d.ts +16 -7
- package/dist/plugins/create-commands-v2.d.ts.map +1 -1
- package/dist/plugins/create-commands-v2.js +269 -66
- package/dist/plugins/create-commands-v2.js.map +1 -1
- package/dist/plugins/cs-namer-v2.d.ts +6 -1
- package/dist/plugins/cs-namer-v2.d.ts.map +1 -1
- package/dist/plugins/cs-namer-v2.js +42 -41
- package/dist/plugins/cs-namer-v2.js.map +1 -1
- package/dist/plugins/llcsharp-v2.d.ts +5 -2
- package/dist/plugins/llcsharp-v2.d.ts.map +1 -1
- package/dist/plugins/llcsharp-v2.js +11 -9
- package/dist/plugins/llcsharp-v2.js.map +1 -1
- package/dist/plugins/modifiers-v2.d.ts +6 -1
- package/dist/plugins/modifiers-v2.d.ts.map +1 -1
- package/dist/plugins/modifiers-v2.js +120 -92
- package/dist/plugins/modifiers-v2.js.map +1 -1
- package/dist/plugins/plugin-create-inline-properties.d.ts +6 -1
- package/dist/plugins/plugin-create-inline-properties.d.ts.map +1 -1
- package/dist/plugins/plugin-create-inline-properties.js +44 -32
- package/dist/plugins/plugin-create-inline-properties.js.map +1 -1
- package/dist/plugins/plugin-tweak-m4-model.d.ts +7 -1
- package/dist/plugins/plugin-tweak-m4-model.d.ts.map +1 -1
- package/dist/plugins/plugin-tweak-m4-model.js +28 -11
- package/dist/plugins/plugin-tweak-m4-model.js.map +1 -1
- package/dist/plugins/plugin-tweak-model-azure-v2.d.ts +6 -1
- package/dist/plugins/plugin-tweak-model-azure-v2.d.ts.map +1 -1
- package/dist/plugins/plugin-tweak-model-azure-v2.js +32 -22
- package/dist/plugins/plugin-tweak-model-azure-v2.js.map +1 -1
- package/dist/plugins/plugin-tweak-model.d.ts +6 -1
- package/dist/plugins/plugin-tweak-model.d.ts.map +1 -1
- package/dist/plugins/plugin-tweak-model.js +33 -32
- package/dist/plugins/plugin-tweak-model.js.map +1 -1
- package/dist/plugins/powershell-v2.d.ts +5 -2
- package/dist/plugins/powershell-v2.d.ts.map +1 -1
- package/dist/plugins/powershell-v2.js +32 -28
- package/dist/plugins/powershell-v2.js.map +1 -1
- package/dist/plugins/ps-namer-v2.d.ts +6 -1
- package/dist/plugins/ps-namer-v2.d.ts.map +1 -1
- package/dist/plugins/ps-namer-v2.js +33 -32
- package/dist/plugins/ps-namer-v2.js.map +1 -1
- package/dist/plugins/sdk-create-inline-properties.d.ts +1 -1
- package/dist/plugins/sdk-create-inline-properties.d.ts.map +1 -1
- package/dist/plugins/sdk-create-inline-properties.js +129 -39
- package/dist/plugins/sdk-create-inline-properties.js.map +1 -1
- package/dist/plugins/sdk-cs-namer.d.ts +1 -1
- package/dist/plugins/sdk-cs-namer.d.ts.map +1 -1
- package/dist/plugins/sdk-cs-namer.js +59 -34
- package/dist/plugins/sdk-cs-namer.js.map +1 -1
- package/dist/plugins/sdk-cs-simplifier.d.ts +1 -1
- package/dist/plugins/sdk-cs-simplifier.d.ts.map +1 -1
- package/dist/plugins/sdk-cs-simplifier.js +3 -3
- package/dist/plugins/sdk-cs-simplifier.js.map +1 -1
- package/dist/plugins/sdk-generate.d.ts +1 -1
- package/dist/plugins/sdk-generate.d.ts.map +1 -1
- package/dist/plugins/sdk-generate.js +23 -18
- package/dist/plugins/sdk-generate.js.map +1 -1
- package/dist/plugins/sdk-modifiers.d.ts +4 -0
- package/dist/plugins/sdk-modifiers.d.ts.map +1 -0
- package/dist/plugins/sdk-modifiers.js +175 -0
- package/dist/plugins/sdk-modifiers.js.map +1 -0
- package/dist/plugins/sdk-tweak-model.d.ts +1 -1
- package/dist/plugins/sdk-tweak-model.d.ts.map +1 -1
- package/dist/plugins/sdk-tweak-model.js +140 -44
- package/dist/plugins/sdk-tweak-model.js.map +1 -1
- package/dist/sdk/project.d.ts +2 -2
- package/dist/sdk/project.d.ts.map +1 -1
- package/dist/sdk/project.js +10 -9
- package/dist/sdk/project.js.map +1 -1
- package/dist/sdk/state.d.ts +2 -2
- package/dist/sdk/state.d.ts.map +1 -1
- package/dist/sdk/utility.d.ts +12 -3
- package/dist/sdk/utility.d.ts.map +1 -1
- package/dist/sdk/utility.js +122 -30
- package/dist/sdk/utility.js.map +1 -1
- package/dist/utils/PwshModel.d.ts +1 -1
- package/dist/utils/PwshModel.d.ts.map +1 -1
- package/dist/utils/PwshModel.js +1 -1
- package/dist/utils/PwshModel.js.map +1 -1
- package/dist/utils/SdkModel.d.ts +1 -1
- package/dist/utils/SdkModel.d.ts.map +1 -1
- package/dist/utils/SdkModel.js +1 -1
- package/dist/utils/SdkModel.js.map +1 -1
- package/dist/utils/command-operation.d.ts +11 -3
- package/dist/utils/command-operation.d.ts.map +1 -1
- package/dist/utils/command-operation.js +26 -4
- package/dist/utils/command-operation.js.map +1 -1
- package/dist/utils/components.d.ts +1 -1
- package/dist/utils/components.d.ts.map +1 -1
- package/dist/utils/components.js +2 -2
- package/dist/utils/components.js.map +1 -1
- package/dist/utils/http-operation.d.ts +2 -0
- package/dist/utils/http-operation.d.ts.map +1 -1
- package/dist/utils/http-operation.js +16 -12
- package/dist/utils/http-operation.js.map +1 -1
- package/dist/utils/model-state.d.ts +7 -5
- package/dist/utils/model-state.d.ts.map +1 -1
- package/dist/utils/model-state.js +28 -20
- package/dist/utils/model-state.js.map +1 -1
- package/dist/utils/programatic-operation.d.ts +1 -1
- package/dist/utils/programatic-operation.d.ts.map +1 -1
- package/dist/utils/programatic-operation.js +1 -1
- package/dist/utils/programatic-operation.js.map +1 -1
- package/dist/utils/resolve-conflicts.js +8 -8
- package/dist/utils/resolve-conflicts.js.map +1 -1
- package/dist/utils/schema.d.ts +1 -1
- package/dist/utils/schema.d.ts.map +1 -1
- package/dist/utils/schema.js +11 -11
- package/dist/utils/schema.js.map +1 -1
- package/dist/utils/security-scheme.d.ts +2 -2
- package/dist/utils/security-scheme.d.ts.map +1 -1
- package/dist/utils/security-scheme.js +2 -2
- package/dist/utils/security-scheme.js.map +1 -1
- package/dist/utils/sort-parameters.d.ts +1 -1
- package/dist/utils/sort-parameters.d.ts.map +1 -1
- package/dist/utils/tsp-generator.d.ts +3 -0
- package/dist/utils/tsp-generator.d.ts.map +1 -0
- package/dist/utils/tsp-generator.js +65 -0
- package/dist/utils/tsp-generator.js.map +1 -0
- package/dist/utils/tsp-host.d.ts +42 -0
- package/dist/utils/tsp-host.d.ts.map +1 -0
- package/dist/utils/tsp-host.js +56 -0
- package/dist/utils/tsp-host.js.map +1 -0
- package/generators/readme.ts +0 -3
- package/package.json +11 -10
- package/resources/assets/build-module.ps1 +29 -2
- package/resources/assets/create-model-cmdlets.ps1 +1 -0
- package/resources/assets/generate-help.ps1 +2 -2
- package/resources/assets/generate-portal-ux.ps1 +6 -22
- package/resources/assets/test/loadEnv.ps1 +1 -1
- package/resources/assets/test-module.ps1 +9 -5
- package/resources/assets/tools/Resources/README.md +0 -3
- package/resources/assets/tools/Resources/custom/New-AzDeployment.ps1 +2 -2
- package/resources/assets/tools/Resources/how-to.md +2 -0
- package/resources/built-time-cmdlets.csproj +1 -0
- package/resources/modules/Az.Accounts/2.13.1/Accounts.format.ps1xml +554 -0
- package/resources/modules/Az.Accounts/2.13.1/Accounts.generated.format.ps1xml +471 -0
- package/resources/modules/Az.Accounts/2.13.1/Accounts.types.ps1xml +306 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Az.Accounts.nuspec +4 -5
- package/resources/modules/Az.Accounts/2.13.1/Az.Accounts.psd1 +389 -0
- package/resources/modules/Az.Accounts/2.13.1/Az.Accounts.psm1 +365 -0
- package/resources/modules/Az.Accounts/2.13.1/FuzzySharp.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.ApplicationInsights.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.AssemblyLoading.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Authentication.Abstractions.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Authentication.ResourceManager.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Authentication.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Authenticators.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Clients.Aks.dll +0 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Authorization.dll +0 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Compute.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Clients.Graph.Rbac.dll +0 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.KeyVault.dll +0 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Monitor.dll +0 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Network.dll +0 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.PolicyInsights.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Clients.ResourceManager.dll +0 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Storage.Management.dll +0 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Websites.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll +0 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll-Help.xml +2510 -779
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Common.Share.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Common.dll +0 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Storage.dll +0 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Strategies.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/Microsoft.Rest.ClientRuntime.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/PostImportScripts/LoadAuthenticators.ps1 +222 -0
- package/resources/modules/Az.Accounts/2.13.1/StartupScripts/AzError.ps1 +281 -0
- package/resources/modules/Az.Accounts/2.13.1/StartupScripts/InitializeAssemblyResolver.ps1 +242 -0
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/[Content_Types].xml +2 -3
- package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/_rels/.rels +2 -2
- package/resources/modules/Az.Accounts/2.13.1/lib/netcoreapp2.1/Azure.Core.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netcoreapp2.1/Microsoft.Identity.Client.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netcoreapp3.1/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netfx/Azure.Core.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netfx/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netfx/Microsoft.Identity.Client.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netfx/Newtonsoft.Json.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netfx/System.Diagnostics.DiagnosticSource.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netfx/System.Reflection.DispatchProxy.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netfx/System.Runtime.CompilerServices.Unsafe.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Azure.Identity.BrokeredAuthentication.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Azure.Identity.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Microsoft.Identity.Client.Broker.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Microsoft.Identity.Client.NativeInterop.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Microsoft.IdentityModel.Abstractions.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/System.Security.AccessControl.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/System.Security.Permissions.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/System.Security.Principal.Windows.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/msalruntime.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/msalruntime_arm64.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/msalruntime_x86.dll +0 -0
- package/resources/modules/Az.Accounts/2.13.1/package/services/metadata/core-properties/f9ac9c2e40914e78a646a7b0b997403b.psmdcp +11 -0
- package/resources/psruntime/BuildTime/Cmdlets/ExportHelpMarkdown.cs +4 -1
- package/resources/psruntime/BuildTime/Cmdlets/ExportProxyCmdlet.cs +6 -3
- package/resources/psruntime/BuildTime/Cmdlets/ExportPsd1.cs +7 -4
- package/resources/psruntime/BuildTime/Cmdlets/ExportTestStub.cs +130 -81
- package/resources/psruntime/BuildTime/Cmdlets/NewAssemblyInfo.cs +64 -0
- package/resources/psruntime/BuildTime/MarkdownRenderer.cs +17 -9
- package/resources/psruntime/BuildTime/Models/PsProxyOutputs.cs +36 -8
- package/resources/psruntime/BuildTime/Models/PsProxyTypes.cs +21 -10
- package/resources/psruntime/BuildTime/PsAttributes.cs +5 -0
- package/resources/psruntime/BuildTime/PsHelpers.cs +4 -3
- package/resources/psruntime/MessageAttribute.cs +45 -55
- package/resources/psruntime/MessageAttributeHelper.cs +30 -7
- package/resources/psruntime/Properties/Resources.Designer.cs +25 -3
- package/resources/psruntime/Properties/Resources.resx +8 -2
- package/resources/runtime/csharp/pipeline/PipelineMocking.cs +1 -1
- package/resources/templates/azureMethod.ejs +2 -2
- package/resources/templates/azureMethodGroup.ejs +2 -2
- package/resources/templates/azureServiceClient.ejs +11 -4
- package/resources/templates/enum.ejs +3 -3
- package/resources/templates/extensionMethod.ejs +18 -12
- package/resources/templates/extensions.ejs +9 -2
- package/resources/templates/longRunningOperationMethod.ejs +10 -8
- package/resources/templates/method.ejs +10 -8
- package/resources/templates/methodBodyRestCall.ejs +77 -32
- package/resources/templates/methodGroupInterface.ejs +2 -61
- package/resources/templates/methodGroupInterfaceBody.ejs +60 -0
- package/resources/templates/model.ejs +15 -15
- package/resources/templates/serviceClientBody.ejs +8 -8
- package/resources/templates/serviceClientInterface.ejs +10 -4
- package/resources/utils/Get-SubscriptionIdTestSafe.ps1 +7 -0
- package/dist/utils/WrapComments.d.ts +0 -2
- package/dist/utils/WrapComments.d.ts.map +0 -1
- package/dist/utils/WrapComments.js +0 -46
- package/dist/utils/WrapComments.js.map +0 -1
- package/resources/modules/Az.Accounts/2.7.5/Accounts.format.ps1xml +0 -496
- package/resources/modules/Az.Accounts/2.7.5/Accounts.generated.format.ps1xml +0 -468
- package/resources/modules/Az.Accounts/2.7.5/Accounts.types.ps1xml +0 -303
- package/resources/modules/Az.Accounts/2.7.5/Az.Accounts.psd1 +0 -387
- package/resources/modules/Az.Accounts/2.7.5/Az.Accounts.psm1 +0 -375
- package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Azure.Core.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Azure.Identity.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Microsoft.Identity.Client.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.ApplicationInsights.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.Abstractions.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.ResourceManager.deps.json +0 -2309
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.ResourceManager.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.deps.json +0 -2273
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.deps.json +0 -1316
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authenticators.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Aks.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Graph.Rbac.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.ResourceManager.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.deps.json +0 -2413
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Common.Share.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Common.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/Microsoft.Rest.ClientRuntime.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PostImportScripts/LoadAuthenticators.ps1 +0 -219
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Azure.Core.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Azure.Identity.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Azure.PowerShell.Authenticators.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Identity.Client.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Newtonsoft.Json.12.0.3.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Newtonsoft.Json.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Diagnostics.DiagnosticSource.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Memory.Data.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Reflection.DispatchProxy.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Runtime.CompilerServices.Unsafe.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.AccessControl.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.Permissions.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.Principal.Windows.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Text.Json.dll +0 -0
- package/resources/modules/Az.Accounts/2.7.5/StartupScripts/AzError.ps1 +0 -278
- package/resources/modules/Az.Accounts/2.7.5/StartupScripts/InitializeAssemblyResolver.ps1 +0 -234
- package/resources/modules/Az.Accounts/2.7.5/package/services/metadata/core-properties/1aa0749a068a4238881858013f1a5b7f.psmdcp +0 -11
- /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Hyak.Common.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.Common.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Rest.ClientRuntime.Azure.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.WindowsAzure.Storage.DataMovement.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.WindowsAzure.Storage.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/en-US/about_az.help.txt +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netfx}/System.Numerics.Vectors.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netfx}/System.Security.Cryptography.Cng.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netfx}/System.Text.Encodings.Web.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netfx}/System.Xml.ReaderWriter.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/AzSharedAlcAssemblies → 2.13.1/lib/netstandard2.0}/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Buffers.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/AzSharedAlcAssemblies → 2.13.1/lib/netstandard2.0}/System.Memory.Data.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Memory.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Net.Http.WinHttpHandler.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Private.ServiceModel.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.ServiceModel.Primitives.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/AzSharedAlcAssemblies → 2.13.1/lib/netstandard2.0}/System.Text.Json.dll +0 -0
- /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Threading.Tasks.Extensions.dll +0 -0
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.createCommandsV2 = exports.Inferrer = exports.titleToAzureServiceName = void 0;
|
|
8
|
-
const codemodel_1 = require("@
|
|
8
|
+
const codemodel_1 = require("@autorest/codemodel");
|
|
9
9
|
const codegen_1 = require("@azure-tools/codegen");
|
|
10
10
|
const linq_1 = require("@azure-tools/linq");
|
|
11
|
-
const
|
|
11
|
+
const extension_base_1 = require("@autorest/extension-base");
|
|
12
12
|
const linq_2 = require("@azure-tools/linq");
|
|
13
13
|
const verbs_1 = require("../internal/verbs");
|
|
14
14
|
const components_1 = require("../utils/components");
|
|
@@ -16,11 +16,14 @@ const model_state_1 = require("../utils/model-state");
|
|
|
16
16
|
//import { Schema as SchemaV3 } from '../utils/schema';
|
|
17
17
|
const command_operation_1 = require("../utils/command-operation");
|
|
18
18
|
const command_operation_2 = require("../utils/command-operation");
|
|
19
|
+
const codemodel_2 = require("@autorest/codemodel");
|
|
19
20
|
const resourceName_1 = require("../utils/resourceName");
|
|
21
|
+
const http_operation_1 = require("../utils/http-operation");
|
|
22
|
+
const specialWords = { in: ['sign'] };
|
|
20
23
|
// UNUSED: Moved to plugin-tweak-model.ts in remodeler
|
|
21
24
|
// For now, we are not dynamically changing the service-name. Instead, we would figure out a method to change it during the creation of service readme's.
|
|
22
25
|
function titleToAzureServiceName(title) {
|
|
23
|
-
const titleCamelCase = codegen_1.pascalCase(codegen_1.deconstruct(title)).trim();
|
|
26
|
+
const titleCamelCase = (0, codegen_1.pascalCase)((0, codegen_1.deconstruct)(title)).trim();
|
|
24
27
|
const serviceName = titleCamelCase
|
|
25
28
|
// Remove: !StartsWith(Management)AndContains(Management), Client, Azure, Microsoft, APIs, API, REST
|
|
26
29
|
.replace(/(?!^Management)(?=.*)Management|Client|Azure|Microsoft|APIs|API|REST/g, '')
|
|
@@ -35,8 +38,8 @@ pluralizationService.addWord('database', 'databases');
|
|
|
35
38
|
pluralizationService.addWord('Premise', 'Premises');
|
|
36
39
|
pluralizationService.addWord('premise', 'premises');
|
|
37
40
|
function fn(active, remaining, result) {
|
|
38
|
-
if (linq_1.length(active) || linq_1.length(remaining)) {
|
|
39
|
-
if (linq_1.length(remaining)) {
|
|
41
|
+
if ((0, linq_1.length)(active) || (0, linq_1.length)(remaining)) {
|
|
42
|
+
if ((0, linq_1.length)(remaining)) {
|
|
40
43
|
fn([...active, remaining[0]], remaining.slice(1), result);
|
|
41
44
|
fn(active, remaining.slice(1), result);
|
|
42
45
|
}
|
|
@@ -49,8 +52,25 @@ function fn(active, remaining, result) {
|
|
|
49
52
|
function combinations(elements) {
|
|
50
53
|
return fn([], elements, []);
|
|
51
54
|
}
|
|
55
|
+
function filterSpecialWords(preposition, parts) {
|
|
56
|
+
let start = 0;
|
|
57
|
+
let idx = -1;
|
|
58
|
+
if (specialWords[preposition] !== undefined) {
|
|
59
|
+
do {
|
|
60
|
+
idx = parts.indexOf(preposition, start);
|
|
61
|
+
if (idx <= 0 || !specialWords[preposition].includes(parts[idx - 1])) {
|
|
62
|
+
return idx;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
start = idx + 1;
|
|
66
|
+
}
|
|
67
|
+
// eslint-disable-next-line no-constant-condition
|
|
68
|
+
} while (true);
|
|
69
|
+
}
|
|
70
|
+
return parts.indexOf(preposition);
|
|
71
|
+
}
|
|
52
72
|
function splitOnPreposition(preposition, parts) {
|
|
53
|
-
const i =
|
|
73
|
+
const i = filterSpecialWords(preposition, parts);
|
|
54
74
|
if (i > 0) {
|
|
55
75
|
return [
|
|
56
76
|
parts.slice(0, i),
|
|
@@ -95,35 +115,115 @@ class Inferrer {
|
|
|
95
115
|
this.isAzure = await this.state.getValue('azure', false);
|
|
96
116
|
this.prefix = await this.state.getValue('prefix');
|
|
97
117
|
this.serviceName = titleToAzureServiceName(await this.state.getValue('service-name'));
|
|
118
|
+
if (this.isAzure) {
|
|
119
|
+
this.supportJsonInput = await this.state.getValue('support-json-input', true);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
this.supportJsonInput = await this.state.getValue('support-json-input', false);
|
|
123
|
+
}
|
|
98
124
|
this.state.setValue('service-name', this.serviceName);
|
|
99
125
|
this.subjectPrefix = await this.state.getValue('subject-prefix');
|
|
100
126
|
this.state.setValue('isAzure', this.isAzure);
|
|
101
127
|
this.state.setValue('prefix', this.prefix);
|
|
102
128
|
const model = this.state.model;
|
|
103
129
|
this.state.message({
|
|
104
|
-
Channel:
|
|
130
|
+
Channel: extension_base_1.Channel.Debug, Text: `[CMDLET-PREFIX] => '${model.language.default.prefix}'`
|
|
105
131
|
});
|
|
106
132
|
model.language.default.serviceName = this.serviceName;
|
|
107
133
|
this.state.message({
|
|
108
|
-
Channel:
|
|
134
|
+
Channel: extension_base_1.Channel.Debug, Text: `[SERVICE-NAME] => '${model.language.default.serviceName}'`
|
|
109
135
|
});
|
|
110
136
|
model.language.default.subjectPrefix = this.subjectPrefix;
|
|
111
137
|
this.state.message({
|
|
112
|
-
Channel:
|
|
138
|
+
Channel: extension_base_1.Channel.Debug, Text: `[SUBJECT-PREFIX] => '${model.language.default.subjectPrefix}'`
|
|
113
139
|
});
|
|
114
140
|
return this;
|
|
115
141
|
}
|
|
116
142
|
async createCommands() {
|
|
143
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
117
144
|
const model = this.state.model;
|
|
118
145
|
this.state.model.commands = {
|
|
119
146
|
operations: new linq_1.Dictionary(),
|
|
120
147
|
parameters: new linq_1.Dictionary(),
|
|
121
148
|
};
|
|
122
|
-
this.state.
|
|
123
|
-
|
|
124
|
-
|
|
149
|
+
const disableGetPut = await this.state.getValue('disable-getput', false);
|
|
150
|
+
const disableTransformIdentityType = await this.state.getValue('disable-transform-identity-type', false);
|
|
151
|
+
const disableTransformIdentityTypeForOperation = await this.state.getValue('disable-transform-identity-type-for-operation', []);
|
|
152
|
+
const optsToExclude = new Array();
|
|
153
|
+
if (disableTransformIdentityTypeForOperation) {
|
|
154
|
+
for (const item of (0, linq_1.values)(disableTransformIdentityTypeForOperation)) {
|
|
155
|
+
optsToExclude.push(item);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
this.state.message({ Channel: extension_base_1.Channel.Debug, Text: 'detecting high level commands...' });
|
|
159
|
+
for (const operationGroup of (0, linq_1.values)(model.operationGroups)) {
|
|
160
|
+
let hasPatch = false;
|
|
161
|
+
let commandType;
|
|
162
|
+
const getOperations = [];
|
|
163
|
+
let putOperation;
|
|
164
|
+
let patchOperation;
|
|
165
|
+
for (const operation of (0, linq_1.values)(operationGroup.operations)) {
|
|
166
|
+
if (((_d = (_c = (_b = (_a = operation.requests) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.protocol) === null || _c === void 0 ? void 0 : _c.http) === null || _d === void 0 ? void 0 : _d.method.toLowerCase()) === 'patch') {
|
|
167
|
+
hasPatch = true;
|
|
168
|
+
patchOperation = operation;
|
|
169
|
+
// bez: remove patch operation to avoid conflicts with replacements
|
|
170
|
+
if (this.isAzure && !disableTransformIdentityType && this.IsManagedIdentityOperation(operation)) {
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
else if (((_h = (_g = (_f = (_e = operation.requests) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.protocol) === null || _g === void 0 ? void 0 : _g.http) === null || _h === void 0 ? void 0 : _h.method.toLowerCase()) === 'get') {
|
|
175
|
+
getOperations.push(operation);
|
|
176
|
+
}
|
|
177
|
+
else if (((_m = (_l = (_k = (_j = operation.requests) === null || _j === void 0 ? void 0 : _j[0]) === null || _k === void 0 ? void 0 : _k.protocol) === null || _l === void 0 ? void 0 : _l.http) === null || _m === void 0 ? void 0 : _m.method.toLowerCase()) === 'put') {
|
|
178
|
+
putOperation = operation;
|
|
179
|
+
if (this.isAzure && !disableTransformIdentityType && this.IsManagedIdentityOperation(operation)) {
|
|
180
|
+
commandType = command_operation_1.CommandType.ManagedIdentityNew;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
125
183
|
for (const variant of await this.inferCommandNames(operation, operationGroup.$key, this.state)) {
|
|
126
|
-
await this.addVariants(operation.parameters, operation, variant, '', this.state);
|
|
184
|
+
await this.addVariants(operation.parameters, operation, variant, '', this.state, undefined, commandType);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
// bez: if we have get+put, try to replace
|
|
188
|
+
if (this.isAzure && getOperations && putOperation && ((_o = putOperation.requests) === null || _o === void 0 ? void 0 : _o.length) == 1) {
|
|
189
|
+
const getOperation = getOperations.find(getOperation => { var _a, _b, _c, _d, _e, _f, _g, _h; return ((_d = (_c = (_b = (_a = getOperation.requests) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.protocol) === null || _c === void 0 ? void 0 : _c.http) === null || _d === void 0 ? void 0 : _d.path) === ((_h = (_g = (_f = (_e = putOperation === null || putOperation === void 0 ? void 0 : putOperation.requests) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.protocol) === null || _g === void 0 ? void 0 : _g.http) === null || _h === void 0 ? void 0 : _h.path); });
|
|
190
|
+
const supportsCombineGetPutOperation = getOperation && this.supportsGetPut(getOperation, putOperation);
|
|
191
|
+
if (!disableTransformIdentityType && supportsCombineGetPutOperation &&
|
|
192
|
+
(hasPatch && patchOperation && this.IsManagedIdentityOperation(patchOperation)
|
|
193
|
+
|| !hasPatch && putOperation && this.IsManagedIdentityOperation(putOperation))) {
|
|
194
|
+
await this.addVariants(putOperation.parameters, putOperation, this.createCommandVariant('create', [operationGroup.$key], [], this.state.model), '', this.state, [getOperation], command_operation_1.CommandType.ManagedIdentityUpdate);
|
|
195
|
+
}
|
|
196
|
+
else if (!disableTransformIdentityType && !supportsCombineGetPutOperation && hasPatch && patchOperation && this.IsManagedIdentityOperation(patchOperation)) {
|
|
197
|
+
if (!optsToExclude.includes((_p = patchOperation.operationId) !== null && _p !== void 0 ? _p : '')) {
|
|
198
|
+
const transformIdentityTypeErrorMessage = `Parameter IdentityType in operation '${patchOperation.operationId}' can not be transformed as the best practice design. See https://github.com/Azure/azure-powershell/blob/main/documentation/development-docs/design-guidelines/managed-identity-best-practices.md#frequently-asked-question to mitigate this issue.`;
|
|
199
|
+
this.state.message({ Channel: extension_base_1.Channel.Error, Text: transformIdentityTypeErrorMessage });
|
|
200
|
+
throw new Error(transformIdentityTypeErrorMessage);
|
|
201
|
+
}
|
|
202
|
+
// bez: add patch operation back and disable transforming identity type
|
|
203
|
+
for (const variant of await this.inferCommandNames(patchOperation, operationGroup.$key, this.state)) {
|
|
204
|
+
await this.addVariants(patchOperation.parameters, patchOperation, variant, '', this.state);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
else if (!disableGetPut && !hasPatch && supportsCombineGetPutOperation) {
|
|
208
|
+
/* generate variants for Update(Get+Put) for subjects only if:
|
|
209
|
+
- there is a get operation
|
|
210
|
+
- there is a put operation
|
|
211
|
+
- get operation path is the same as put operation path
|
|
212
|
+
- there is only one put request schema
|
|
213
|
+
- get operation response schema type is the same as put operation request schema type
|
|
214
|
+
*/
|
|
215
|
+
await this.addVariants(putOperation.parameters, putOperation, this.createCommandVariant('create', [operationGroup.$key], [], this.state.model), '', this.state, [getOperation], command_operation_1.CommandType.GetPut);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
else if (this.isAzure && !disableTransformIdentityType && patchOperation && this.IsManagedIdentityOperation(patchOperation)) {
|
|
219
|
+
if (!optsToExclude.includes((_q = patchOperation.operationId) !== null && _q !== void 0 ? _q : '')) {
|
|
220
|
+
const transformIdentityTypeErrorMessage = `Parameter IdentityType in operation '${patchOperation.operationId}' can not be transformed as the best practice design. See https://github.com/Azure/azure-powershell/blob/main/documentation/development-docs/design-guidelines/managed-identity-best-practices.md#frequently-asked-question to mitigate this issue.`;
|
|
221
|
+
this.state.message({ Channel: extension_base_1.Channel.Error, Text: transformIdentityTypeErrorMessage });
|
|
222
|
+
throw new Error(transformIdentityTypeErrorMessage);
|
|
223
|
+
}
|
|
224
|
+
// bez: add variants back and disable transforming identity type as no put or get
|
|
225
|
+
for (const variant of await this.inferCommandNames(patchOperation, operationGroup.$key, this.state)) {
|
|
226
|
+
await this.addVariants(patchOperation.parameters, patchOperation, variant, '', this.state);
|
|
127
227
|
}
|
|
128
228
|
}
|
|
129
229
|
}
|
|
@@ -135,37 +235,60 @@ class Inferrer {
|
|
|
135
235
|
// }
|
|
136
236
|
return model;
|
|
137
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* Judge if the response of get operation can be piped as the input of put operation
|
|
240
|
+
* 1. there is only one put request schema
|
|
241
|
+
* 2. get operation response schema type is the same as put operation request schema type
|
|
242
|
+
*/
|
|
243
|
+
supportsGetPut(getOperation, putOperation) {
|
|
244
|
+
var _a, _b, _c, _d, _e, _f;
|
|
245
|
+
const hasQueryParameter = (_a = getOperation === null || getOperation === void 0 ? void 0 : getOperation.parameters) === null || _a === void 0 ? void 0 : _a.find(p => { var _a; return ((_a = p.protocol.http) === null || _a === void 0 ? void 0 : _a.in) === 'query' && p.language.default.name !== 'apiVersion'; });
|
|
246
|
+
//parameter.protocal.http.in === 'body' probably only applies to open api 2.0
|
|
247
|
+
const schema = (_e = (_d = (_c = (_b = putOperation === null || putOperation === void 0 ? void 0 : putOperation.requests) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.parameters) === null || _d === void 0 ? void 0 : _d.find(p => { var _a; return ((_a = p.protocol.http) === null || _a === void 0 ? void 0 : _a.in) === 'body'; })) === null || _e === void 0 ? void 0 : _e.schema;
|
|
248
|
+
return (_f = (getOperation && !hasQueryParameter && schema && [...(0, linq_1.values)(getOperation === null || getOperation === void 0 ? void 0 : getOperation.responses)].filter(each => each.schema !== schema).length === 0)) !== null && _f !== void 0 ? _f : false;
|
|
249
|
+
}
|
|
250
|
+
containsIdentityType(op) {
|
|
251
|
+
var _a, _b, _c, _d, _e, _f;
|
|
252
|
+
const body = ((_b = (_a = op.requests) === null || _a === void 0 ? void 0 : _a[0].parameters) === null || _b === void 0 ? void 0 : _b.find((p) => !p.origin || p.origin.indexOf('modelerfour:synthesized') < 0)) || null;
|
|
253
|
+
// property identity in the body parameter
|
|
254
|
+
const identityProperty = (body && body.schema && (0, codemodel_1.isObjectSchema)(body.schema)) ? (_d = (_c = (0, linq_1.values)((0, codemodel_1.getAllProperties)(body.schema)).where(property => !property.language.default.readOnly && (0, codemodel_1.isObjectSchema)(property.schema) && property.language.default.name === 'identity')) === null || _c === void 0 ? void 0 : _c.toArray()) === null || _d === void 0 ? void 0 : _d[0] : null;
|
|
255
|
+
const identityTypeProperty = (identityProperty && identityProperty.schema && (0, codemodel_1.isObjectSchema)(identityProperty.schema)) ? (_f = (_e = (0, linq_1.values)((0, codemodel_1.getAllProperties)(identityProperty.schema)).where(property => !property.language.default.readOnly && property.language.default.name === 'type')) === null || _e === void 0 ? void 0 : _e.toArray()) === null || _f === void 0 ? void 0 : _f[0] : null;
|
|
256
|
+
return identityTypeProperty !== null && identityTypeProperty !== undefined;
|
|
257
|
+
}
|
|
258
|
+
IsManagedIdentityOperation(op) {
|
|
259
|
+
return this.containsIdentityType(op);
|
|
260
|
+
}
|
|
138
261
|
inferCommand(operation, group, suffix = []) {
|
|
139
262
|
operation = operation.filter(each => each !== 'all');
|
|
140
263
|
// no instant match
|
|
141
|
-
switch (linq_1.length(operation)) {
|
|
264
|
+
switch ((0, linq_1.length)(operation)) {
|
|
142
265
|
case 0:
|
|
143
266
|
throw new Error('Missing operation id?');
|
|
144
267
|
case 1:
|
|
145
268
|
// simple operation, just an id with a single value
|
|
146
269
|
// OPERATION => OPERATION-GROUP
|
|
147
270
|
return [
|
|
148
|
-
this.createCommandVariant(operation[0],
|
|
271
|
+
this.createCommandVariant(operation[0], [group], suffix, this.state.model)
|
|
149
272
|
];
|
|
150
273
|
case 2:
|
|
151
274
|
// should try to infer [SUBJECT] and [ACTION] from operation
|
|
152
275
|
if (verbs_1.verbs.has(operation[0])) {
|
|
153
276
|
// [ACTION][SUBJECT]
|
|
154
277
|
return [
|
|
155
|
-
this.createCommandVariant(operation[0], [
|
|
278
|
+
this.createCommandVariant(operation[0], [group, operation[1]], suffix, this.state.model)
|
|
156
279
|
];
|
|
157
280
|
}
|
|
158
281
|
if (verbs_1.verbs.has(operation[1])) {
|
|
159
282
|
// [SUBJECT][ACTION]
|
|
160
283
|
return [
|
|
161
|
-
this.createCommandVariant(operation[1], [
|
|
284
|
+
this.createCommandVariant(operation[1], [group, operation[0]], suffix, this.state.model)
|
|
162
285
|
];
|
|
163
286
|
}
|
|
164
287
|
// can't tell which is the [ACTION] -- let's return it the way we used to,
|
|
165
288
|
// but now let's mention that we are doing that.
|
|
166
289
|
this.state.warning(`Operation ${operation[0]}/${operation[1]} is inferred without finding action.`, [], {});
|
|
167
290
|
return [
|
|
168
|
-
this.createCommandVariant(operation[0], [
|
|
291
|
+
this.createCommandVariant(operation[0], [group, operation[1]], suffix, this.state.model)
|
|
169
292
|
];
|
|
170
293
|
}
|
|
171
294
|
// three or more words.
|
|
@@ -185,27 +308,27 @@ class Inferrer {
|
|
|
185
308
|
return [...this.inferCommand(parts[0], group, parts[1])];
|
|
186
309
|
}
|
|
187
310
|
// if not, then seek out a verb from there.
|
|
188
|
-
for (let i = 0; i < linq_1.length(operation); i++) {
|
|
311
|
+
for (let i = 0; i < (0, linq_1.length)(operation); i++) {
|
|
189
312
|
if (verbs_1.verbs.has(operation[i])) {
|
|
190
313
|
// if the action is first
|
|
191
314
|
if (i === 0) {
|
|
192
315
|
// everything else is the subject
|
|
193
|
-
return [this.createCommandVariant(operation[i], group ? [
|
|
316
|
+
return [this.createCommandVariant(operation[i], group ? [group, ...operation.slice(i + 1)] : operation.slice(i + 1), suffix, this.state.model)];
|
|
194
317
|
}
|
|
195
|
-
if (i === linq_1.length(operation) - 1) {
|
|
318
|
+
if (i === (0, linq_1.length)(operation) - 1) {
|
|
196
319
|
// if it's last, the subject would be the first thing
|
|
197
|
-
return [this.createCommandVariant(operation[i], group ? [
|
|
320
|
+
return [this.createCommandVariant(operation[i], group ? [group, ...operation.slice(0, i)] : operation.slice(0, i), suffix, this.state.model)];
|
|
198
321
|
}
|
|
199
322
|
// otherwise
|
|
200
323
|
// things before are part of the subject
|
|
201
324
|
// things after the verb should be part of the suffix
|
|
202
|
-
return [this.createCommandVariant(operation[i], group ? [
|
|
325
|
+
return [this.createCommandVariant(operation[i], group ? [group, ...operation.slice(i, i)] : operation.slice(i, i), [...suffix, ...operation.slice(i + 1)], this.state.model)];
|
|
203
326
|
}
|
|
204
327
|
}
|
|
205
328
|
// so couldn't tell what the action was.
|
|
206
329
|
// fallback to the original behavior with a warning.
|
|
207
330
|
this.state.warning(`Operation ${operation[0]}/${operation[1]} is inferred without finding action.`, [], {});
|
|
208
|
-
return [this.createCommandVariant(operation[0], group ? [
|
|
331
|
+
return [this.createCommandVariant(operation[0], group ? [group, ...operation.slice(1)] : operation.slice(1), [...suffix, ...operation.slice(1)], this.state.model)];
|
|
209
332
|
}
|
|
210
333
|
async inferCommandNames(op, group, state) {
|
|
211
334
|
const method = op.language.default.name;
|
|
@@ -221,10 +344,10 @@ class Inferrer {
|
|
|
221
344
|
// }
|
|
222
345
|
// group = pascalCase(op.tags) || '';
|
|
223
346
|
// }
|
|
224
|
-
const groupWords = codegen_1.deconstruct(group);
|
|
347
|
+
const groupWords = [...(0, codegen_1.removeSequentialDuplicates)((0, codegen_1.deconstruct)(group))];
|
|
225
348
|
groupWords[groupWords.length - 1] = pluralizationService.singularize(groupWords.last);
|
|
226
|
-
group = codegen_1.pascalCase(groupWords);
|
|
227
|
-
const operation = codegen_1.deconstruct(method);
|
|
349
|
+
group = (0, codegen_1.pascalCase)(groupWords);
|
|
350
|
+
const operation = (0, codegen_1.deconstruct)(method);
|
|
228
351
|
// instant match
|
|
229
352
|
if (this.verbMap[method]) {
|
|
230
353
|
return [this.createCommandVariant(method, [group], [], state.model)];
|
|
@@ -232,16 +355,20 @@ class Inferrer {
|
|
|
232
355
|
// dig deeper.
|
|
233
356
|
return this.inferCommand(operation, group);
|
|
234
357
|
}
|
|
235
|
-
async addVariant(vname, body, bodyParameterName, parameters, operation, variant, state) {
|
|
236
|
-
|
|
358
|
+
async addVariant(vname, body, bodyParameterName, parameters, operation, variant, state, preOperations, commandType) {
|
|
359
|
+
// beth: filter command description for New/Update command
|
|
360
|
+
const createOrUpdateRegex = /^(creates? or updates?)|^(creates?)|^(updates?)/i;
|
|
361
|
+
operation.language.default.description = operation.language.default.description.replace(createOrUpdateRegex, `${variant.action.capitalize()}`);
|
|
362
|
+
const op = await this.addCommandOperation(vname, parameters, operation, variant, state, preOperations, commandType);
|
|
237
363
|
// if this has a body with it, let's add that parameter
|
|
238
364
|
if (body && body.schema) {
|
|
239
365
|
op.details.default.hasBody = true;
|
|
240
366
|
op.parameters.push(new components_1.IParameter(bodyParameterName, body.schema, {
|
|
367
|
+
required: body.required,
|
|
241
368
|
details: {
|
|
242
369
|
default: {
|
|
243
370
|
description: body.schema.language.default.description,
|
|
244
|
-
name: codegen_1.pascalCase(bodyParameterName),
|
|
371
|
+
name: (0, codegen_1.pascalCase)(bodyParameterName),
|
|
245
372
|
isBodyParameter: true,
|
|
246
373
|
}
|
|
247
374
|
}
|
|
@@ -249,24 +376,26 @@ class Inferrer {
|
|
|
249
376
|
// let's add a variant where it's expanded out.
|
|
250
377
|
// *IF* the body is an object or dictionary
|
|
251
378
|
if (body.schema.type === codemodel_1.SchemaType.Object || body.schema.type === codemodel_1.SchemaType.Dictionary || body.schema.type === codemodel_1.SchemaType.Any) {
|
|
252
|
-
const opExpanded = await this.addCommandOperation(`${vname}Expanded`, parameters, operation, variant, state);
|
|
379
|
+
const opExpanded = await this.addCommandOperation(`${vname}Expanded`, parameters, operation, variant, state, preOperations, commandType);
|
|
253
380
|
opExpanded.details.default.dropBodyParameter = true;
|
|
254
381
|
opExpanded.parameters.push(new components_1.IParameter(`${bodyParameterName}Body`, body.schema, {
|
|
382
|
+
required: body.required,
|
|
255
383
|
details: {
|
|
256
384
|
default: {
|
|
257
385
|
description: body.schema.language.default.description,
|
|
258
|
-
name: codegen_1.pascalCase(`${bodyParameterName}Body`),
|
|
386
|
+
name: (0, codegen_1.pascalCase)(`${bodyParameterName}Body`),
|
|
259
387
|
isBodyParameter: true,
|
|
260
388
|
}
|
|
261
389
|
}
|
|
262
390
|
}));
|
|
263
391
|
}
|
|
264
392
|
}
|
|
393
|
+
return op;
|
|
265
394
|
}
|
|
266
|
-
async addCommandOperation(vname, parameters, operation, variant, state) {
|
|
395
|
+
async addCommandOperation(vname, parameters, operation, variant, state, preOperations, commandType) {
|
|
267
396
|
// skip-for-time-being following code seems redundant -----
|
|
268
397
|
// let apiversion = '';
|
|
269
|
-
var _a, _b;
|
|
398
|
+
var _a, _b, _c;
|
|
270
399
|
// for (const each of items(operation.responses)) {
|
|
271
400
|
// for (const rsp of items(each)) {
|
|
272
401
|
// if (rsp.schema && rsp.schema.details && rsp.schema.details.default && rsp.schema.details.default.apiversion) {
|
|
@@ -278,12 +407,12 @@ class Inferrer {
|
|
|
278
407
|
// ----------------------------------------------------------
|
|
279
408
|
// if vname is > 64 characters, let's trim it
|
|
280
409
|
// after trimming it, make sure there aren't any other operation with a name that's exactly the same
|
|
281
|
-
if (linq_1.length(vname) > 64) {
|
|
282
|
-
const names = codegen_1.deconstruct(vname);
|
|
410
|
+
if ((0, linq_1.length)(vname) > 64) {
|
|
411
|
+
const names = (0, codegen_1.deconstruct)(vname);
|
|
283
412
|
let newVName = '';
|
|
284
|
-
for (let i = 0; i < linq_1.length(names); i++) {
|
|
285
|
-
newVName = codegen_1.pascalCase(names.slice(0, i));
|
|
286
|
-
if (linq_1.length(newVName) > 60) {
|
|
413
|
+
for (let i = 0; i < (0, linq_1.length)(names); i++) {
|
|
414
|
+
newVName = (0, codegen_1.pascalCase)(names.slice(0, i));
|
|
415
|
+
if ((0, linq_1.length)(newVName) > 60) {
|
|
287
416
|
break;
|
|
288
417
|
}
|
|
289
418
|
}
|
|
@@ -298,28 +427,39 @@ class Inferrer {
|
|
|
298
427
|
}
|
|
299
428
|
this.operationIdentities.add(fname);
|
|
300
429
|
variant.variant = vname;
|
|
301
|
-
vname = codegen_1.pascalCase(vname);
|
|
430
|
+
vname = (0, codegen_1.pascalCase)(vname);
|
|
431
|
+
let commandName = operation.language.default.name;
|
|
432
|
+
let operations = [operation];
|
|
433
|
+
const language = { default: { ...operation.language.default } };
|
|
434
|
+
//handle when there are pre operataions
|
|
435
|
+
if (preOperations && preOperations.length > 0) {
|
|
436
|
+
commandName = 'Update';
|
|
437
|
+
language.default.name = 'Update';
|
|
438
|
+
operations = [...preOperations, ...operations];
|
|
439
|
+
}
|
|
302
440
|
// skip-for-time-being x-ms-metadata looks not supported any more.
|
|
303
441
|
//const xmsMetadata = operation.pathExtensions ? operation.pathExtensions['x-ms-metadata'] ? clone(operation.pathExtensions['x-ms-metadata']) : {} : {};
|
|
304
442
|
// Add operation type to support x-ms-mutability
|
|
305
443
|
let operationType = command_operation_2.OperationType.Other;
|
|
306
444
|
if (operation.requests) {
|
|
307
|
-
if (((_a = operation.requests[0].protocol.http) === null || _a === void 0 ? void 0 : _a.method) === 'put' && variant.action.toLowerCase() === 'create') {
|
|
445
|
+
if (((_a = operation.requests[0].protocol.http) === null || _a === void 0 ? void 0 : _a.method) === 'put' && (variant.action.toLowerCase() === 'create' || variant.action.toLowerCase() === 'update' && variant.verb.toLowerCase() === 'set')) {
|
|
446
|
+
// put create and put set
|
|
308
447
|
operationType = command_operation_2.OperationType.Create;
|
|
309
448
|
}
|
|
310
|
-
else if (((_b = operation.requests[0].protocol.http) === null || _b === void 0 ? void 0 : _b.method) === 'patch' && variant.action.toLowerCase() === 'update') {
|
|
449
|
+
else if ((((_b = operation.requests[0].protocol.http) === null || _b === void 0 ? void 0 : _b.method) === 'patch' || ((_c = operation.requests[0].protocol.http) === null || _c === void 0 ? void 0 : _c.method) === 'put') && variant.action.toLowerCase() === 'update') {
|
|
450
|
+
// patch update, get+put update and exclude set update
|
|
311
451
|
operationType = command_operation_2.OperationType.Update;
|
|
312
452
|
}
|
|
313
453
|
}
|
|
314
|
-
return state.model.commands.operations[`${linq_1.length(state.model.commands.operations)}`] = new command_operation_1.CommandOperation(
|
|
315
|
-
asjob:
|
|
454
|
+
return state.model.commands.operations[`${(0, linq_1.length)(state.model.commands.operations)}`] = new command_operation_1.CommandOperation(commandName, {
|
|
455
|
+
asjob: language.default.asjob ? true : false,
|
|
316
456
|
operationType: operationType,
|
|
317
457
|
extensions: {},
|
|
318
458
|
...variant,
|
|
319
459
|
details: {
|
|
320
|
-
...
|
|
460
|
+
...language,
|
|
321
461
|
default: {
|
|
322
|
-
...
|
|
462
|
+
...language.default,
|
|
323
463
|
subject: variant.subject,
|
|
324
464
|
subjectPrefix: variant.subjectPrefix,
|
|
325
465
|
verb: variant.verb,
|
|
@@ -333,29 +473,29 @@ class Inferrer {
|
|
|
333
473
|
parameters: parameters.map(httpParameter => {
|
|
334
474
|
// make it's own copy of the parameter since after this,
|
|
335
475
|
// the parameter can be altered for each operation individually.
|
|
336
|
-
const each = linq_2.clone(httpParameter, false, undefined, undefined, ['schema', 'origin']);
|
|
476
|
+
const each = (0, linq_2.clone)(httpParameter, false, undefined, undefined, ['schema', 'origin']);
|
|
337
477
|
each.language.default = {
|
|
338
478
|
...each.language.default,
|
|
339
|
-
name: codegen_1.pascalCase(each.language.default.name),
|
|
479
|
+
name: (0, codegen_1.pascalCase)(each.language.default.name),
|
|
340
480
|
httpParameter
|
|
341
481
|
};
|
|
342
482
|
each.details = {};
|
|
343
483
|
each.details.default = {
|
|
344
484
|
...each.language.default,
|
|
345
|
-
name: codegen_1.pascalCase(each.language.default.name),
|
|
485
|
+
name: (0, codegen_1.pascalCase)(each.language.default.name),
|
|
346
486
|
httpParameter
|
|
347
487
|
};
|
|
348
488
|
each.name = each.language.default.serializedName;
|
|
349
489
|
return each;
|
|
350
490
|
}),
|
|
351
491
|
// skip-for-time-being, this callGraph is used in the header comments
|
|
352
|
-
callGraph:
|
|
353
|
-
});
|
|
492
|
+
callGraph: operations
|
|
493
|
+
}, commandType);
|
|
354
494
|
}
|
|
355
|
-
async addVariants(parameters, operation, variant, vname, state) {
|
|
495
|
+
async addVariants(parameters, operation, variant, vname, state, preOperations, commandType) {
|
|
356
496
|
var _a, _b, _c, _d, _e, _f;
|
|
357
497
|
// now synthesize parameter set variants multiplexed by the variants.
|
|
358
|
-
const [constants, requiredParameters] = linq_1.values(parameters).bifurcate(parameter => parameter.language.default.constantValue || parameter.language.default.fromHost ? true : false);
|
|
498
|
+
const [constants, requiredParameters] = (0, linq_1.values)(parameters).bifurcate(parameter => parameter.language.default.constantValue || parameter.language.default.fromHost ? true : false);
|
|
359
499
|
const constantParameters = constants.map(each => `'${each.language.default.constantValue}'`);
|
|
360
500
|
// the body parameter
|
|
361
501
|
// xichen: How to handle if has multiple requests?
|
|
@@ -364,35 +504,39 @@ class Inferrer {
|
|
|
364
504
|
//const bodyParameterName = (operation.requestBody && operation.requestBody.extensions) ? operation.requestBody.extensions['x-ms-requestBody-name'] || 'bodyParameter' : '';
|
|
365
505
|
const bodyParameterName = body ? body.language.default.name : '';
|
|
366
506
|
// all the properties in the body parameter
|
|
367
|
-
const bodyProperties = (body && body.schema && codemodel_1.isObjectSchema(body.schema)) ? linq_1.values(codemodel_1.getAllProperties(body.schema)).where(property => !property.language.default.readOnly).toArray() : [];
|
|
507
|
+
const bodyProperties = (body && body.schema && (0, codemodel_1.isObjectSchema)(body.schema)) ? (0, linq_1.values)((0, codemodel_1.getAllProperties)(body.schema)).where(property => !property.language.default.readOnly).toArray() : [];
|
|
368
508
|
// smash body property names together
|
|
369
509
|
const bodyPropertyNames = bodyProperties.joinWith(each => each.language.default.name);
|
|
370
510
|
// for each polymorphic body, we should do a separate variant that takes the polymorphic body type instead of the base type
|
|
371
511
|
// skip-for-time-being, this is for polymorphism
|
|
372
512
|
//const polymorphicBodies = (body && body.schema && body.schema.details.default.polymorphicChildren && length(body.schema.details.default.polymorphicChildren)) ? (<Array<Schema>>body.schema.details.default.polymorphicChildren).joinWith(child => child.details.default.name) : '';
|
|
373
|
-
// wait! "update" should be "set" if it's a
|
|
513
|
+
// wait! "update" should be "set" if it's a PUT
|
|
374
514
|
if (variant.verb === 'Update' && operation.requests && ((_d = (_c = operation.requests[0].protocol) === null || _c === void 0 ? void 0 : _c.http) === null || _d === void 0 ? void 0 : _d.method) === codemodel_1.HttpMethod.Put) {
|
|
375
515
|
variant.verb = 'Set';
|
|
376
516
|
}
|
|
517
|
+
//for operations which has pre operations (only support GET+PUT for now), change it's action to update
|
|
518
|
+
if (preOperations && preOperations.length > 0) {
|
|
519
|
+
variant.action = variant.verb = 'Update';
|
|
520
|
+
}
|
|
377
521
|
// create variant
|
|
378
522
|
// skip-for-time-being, since operationId looks not included in m4.
|
|
379
523
|
//state.message({ Channel: Channel.Debug, Text: `${variant.verb}-${variant.subject} // ${operation.operationId} => ${JSON.stringify(variant)} taking ${requiredParameters.joinWith(each => each.name)}; ${constantParameters} ; ${bodyPropertyNames} ${polymorphicBodies ? `; Polymorphic bodies: ${polymorphicBodies} ` : ''}` });
|
|
380
|
-
await this.addVariant(codegen_1.pascalCase([variant.action, vname]), body, bodyParameterName, [...constants, ...requiredParameters], operation, variant, state);
|
|
524
|
+
await this.addVariant((0, codegen_1.pascalCase)([variant.action, vname]), body, bodyParameterName, [...constants, ...requiredParameters], operation, variant, state, preOperations, commandType);
|
|
381
525
|
if (await state.getValue('disable-via-identity', false)) {
|
|
382
526
|
return;
|
|
383
527
|
}
|
|
384
528
|
// eslint-disable-next-line prefer-const
|
|
385
|
-
let [pathParams, otherParams] = linq_1.values(requiredParameters).bifurcate(each => { var _a, _b; return ((_b = (_a = each === null || each === void 0 ? void 0 : each.protocol) === null || _a === void 0 ? void 0 : _a.http) === null || _b === void 0 ? void 0 : _b.in) === codemodel_1.ParameterLocation.Path; });
|
|
529
|
+
let [pathParams, otherParams] = (0, linq_1.values)(requiredParameters).bifurcate(each => { var _a, _b; return ((_b = (_a = each === null || each === void 0 ? void 0 : each.protocol) === null || _a === void 0 ? void 0 : _a.http) === null || _b === void 0 ? void 0 : _b.in) === codemodel_1.ParameterLocation.Path; });
|
|
386
530
|
//exclude subscriptionId and resourceGroupName from path parameters
|
|
387
531
|
pathParams = pathParams.filter(pathParam => !this.reservedPathParam.has(pathParam.language.default.name));
|
|
388
532
|
//if parent pipline input is disabled, only generate identity for current resource itself
|
|
389
533
|
if (!await state.getValue('enable-parent-pipeline-input', this.isAzure)) {
|
|
390
|
-
if (linq_1.length(pathParams) > 0 && variant.action.toLowerCase() != 'list') {
|
|
391
|
-
await this.addVariant(codegen_1.pascalCase([variant.action, vname, 'via-identity']), body, bodyParameterName, [...constants, ...otherParams], operation, variant, state);
|
|
534
|
+
if ((0, linq_1.length)(pathParams) > 0 && variant.action.toLowerCase() != 'list') {
|
|
535
|
+
await this.addVariant((0, codegen_1.pascalCase)([variant.action, vname, 'via-identity']), body, bodyParameterName, [...constants, ...otherParams], operation, variant, state, preOperations, commandType);
|
|
392
536
|
}
|
|
393
537
|
return;
|
|
394
538
|
}
|
|
395
|
-
const disableGetEnableList = await this.state.getValue('enable-parent-pipeline-input-for-list',
|
|
539
|
+
const disableGetEnableList = await this.state.getValue('enable-parent-pipeline-input-for-list', false);
|
|
396
540
|
/*
|
|
397
541
|
for resource /A1/A2/.../An-1/An, generate variants that take
|
|
398
542
|
ViaIdentity: An as identity
|
|
@@ -404,7 +548,7 @@ class Inferrer {
|
|
|
404
548
|
if ((!disableGetEnableList && variant.action.toLowerCase() === 'list') || (disableGetEnableList && i === pathParams.length - 1 && variant.action.toLowerCase() === 'get')) {
|
|
405
549
|
continue;
|
|
406
550
|
}
|
|
407
|
-
let resourceName = resourceName_1.getResourceNameFromPath((_f = (_e = operation.requests) === null || _e === void 0 ? void 0 : _e[0].protocol.http) === null || _f === void 0 ? void 0 : _f.path, pathParams[i].language.default.name, true);
|
|
551
|
+
let resourceName = (0, resourceName_1.getResourceNameFromPath)((_f = (_e = operation.requests) === null || _e === void 0 ? void 0 : _e[0].protocol.http) === null || _f === void 0 ? void 0 : _f.path, pathParams[i].language.default.name, true);
|
|
408
552
|
//cannot get resource name from path, give up generate ViaIdentity variant
|
|
409
553
|
if (!resourceName) {
|
|
410
554
|
break;
|
|
@@ -413,7 +557,66 @@ class Inferrer {
|
|
|
413
557
|
if (i === pathParams.length - 1 && variant.action.toLowerCase() !== 'list') {
|
|
414
558
|
resourceName = '';
|
|
415
559
|
}
|
|
416
|
-
await this.addVariant(codegen_1.pascalCase([variant.action, vname, `via-identity${resourceName}`]), body, bodyParameterName, [...constants, ...otherParams, ...pathParams.slice(i + 1)], operation, variant, state);
|
|
560
|
+
await this.addVariant((0, codegen_1.pascalCase)([variant.action, vname, `via-identity${resourceName}`]), body, bodyParameterName, [...constants, ...otherParams, ...pathParams.slice(i + 1)], operation, variant, state, preOperations, commandType);
|
|
561
|
+
}
|
|
562
|
+
if (this.supportJsonInput && (0, http_operation_1.hasValidBodyParameters)(operation) &&
|
|
563
|
+
commandType != command_operation_1.CommandType.GetPut && commandType != command_operation_1.CommandType.ManagedIdentityUpdate) {
|
|
564
|
+
const createStringParameter = (name, description, serializedName) => {
|
|
565
|
+
const schema = new codemodel_2.Schema(name, description, codemodel_1.SchemaType.String);
|
|
566
|
+
const language = {
|
|
567
|
+
default: {
|
|
568
|
+
name: name,
|
|
569
|
+
description: description,
|
|
570
|
+
serializedName: serializedName,
|
|
571
|
+
},
|
|
572
|
+
};
|
|
573
|
+
schema.language = language;
|
|
574
|
+
const httpParameter = {
|
|
575
|
+
implementation: 'Method',
|
|
576
|
+
language: language,
|
|
577
|
+
schema: schema,
|
|
578
|
+
required: true,
|
|
579
|
+
};
|
|
580
|
+
const parameter = new components_1.IParameter(name, schema, {
|
|
581
|
+
description: description,
|
|
582
|
+
required: true,
|
|
583
|
+
details: {
|
|
584
|
+
default: {
|
|
585
|
+
description: description,
|
|
586
|
+
name: name,
|
|
587
|
+
isBodyParameter: false,
|
|
588
|
+
httpParameter: httpParameter,
|
|
589
|
+
},
|
|
590
|
+
},
|
|
591
|
+
schema: schema,
|
|
592
|
+
allowEmptyValue: false,
|
|
593
|
+
deprecated: false,
|
|
594
|
+
});
|
|
595
|
+
parameter.httpParameter = httpParameter;
|
|
596
|
+
return parameter;
|
|
597
|
+
};
|
|
598
|
+
const jsonVariant = (0, codegen_1.pascalCase)([variant.action, vname]);
|
|
599
|
+
const parameter = new components_1.IParameter(`${bodyParameterName}Body`, body.schema, {
|
|
600
|
+
details: {
|
|
601
|
+
default: {
|
|
602
|
+
description: body.schema.language.default.description,
|
|
603
|
+
name: (0, codegen_1.pascalCase)(`${bodyParameterName}Body`),
|
|
604
|
+
isBodyParameter: true,
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
const opJsonString = await this.addVariant(`${jsonVariant}ViaJsonString`, null, '', [...constants, ...requiredParameters], operation, variant, state, preOperations, commandType);
|
|
609
|
+
opJsonString.details.default.dropBodyParameter = true;
|
|
610
|
+
opJsonString.parameters = opJsonString.parameters.filter(each => each.details.default.isBodyParameter !== true);
|
|
611
|
+
opJsonString.parameters.push(createStringParameter('JsonString', `Json string supplied to the ${jsonVariant} operation`, 'jsonString'));
|
|
612
|
+
opJsonString.parameters.push(parameter);
|
|
613
|
+
opJsonString.details.default.dropBodyParameter = true;
|
|
614
|
+
const opJsonFilePath = await this.addVariant(`${jsonVariant}ViaJsonFilePath`, null, '', [...constants, ...requiredParameters], operation, variant, state, preOperations, commandType);
|
|
615
|
+
opJsonFilePath.details.default.dropBodyParameter = true;
|
|
616
|
+
opJsonFilePath.parameters = opJsonFilePath.parameters.filter(each => each.details.default.isBodyParameter !== true);
|
|
617
|
+
opJsonFilePath.parameters.push(createStringParameter('JsonFilePath', `Path of Json file supplied to the ${jsonVariant} operation`, 'jsonFilePath'));
|
|
618
|
+
opJsonFilePath.parameters.push(parameter);
|
|
619
|
+
opJsonFilePath.details.default.dropBodyParameter = true;
|
|
417
620
|
}
|
|
418
621
|
}
|
|
419
622
|
createCommandVariant(action, subject, variant, model) {
|
|
@@ -427,15 +630,15 @@ class Inferrer {
|
|
|
427
630
|
}
|
|
428
631
|
return {
|
|
429
632
|
alias: [],
|
|
430
|
-
subject: codegen_1.pascalCase([...codegen_1.removeSequentialDuplicates(subject.map(each => pluralizationService.singularize(each)))]),
|
|
431
|
-
variant: codegen_1.pascalCase(variant),
|
|
633
|
+
subject: (0, codegen_1.pascalCase)([...(0, codegen_1.removeSequentialDuplicates)(subject.map(each => pluralizationService.singularize(each)))]),
|
|
634
|
+
variant: (0, codegen_1.pascalCase)(variant),
|
|
432
635
|
verb,
|
|
433
636
|
subjectPrefix: model.language.default.subjectPrefix,
|
|
434
637
|
action
|
|
435
638
|
};
|
|
436
639
|
}
|
|
437
640
|
getPowerShellVerb(action) {
|
|
438
|
-
const verb = this.verbMap[codegen_1.pascalCase(action)];
|
|
641
|
+
const verb = this.verbMap[(0, codegen_1.pascalCase)(action)];
|
|
439
642
|
if (verb) {
|
|
440
643
|
return verb;
|
|
441
644
|
}
|
|
@@ -450,7 +653,7 @@ async function createCommandsV2(service) {
|
|
|
450
653
|
//const session = await startSession<PwshModel>(service, {}, codeModelSchema);
|
|
451
654
|
//const result = tweakModelV2(session);
|
|
452
655
|
const state = await new model_state_1.ModelState(service).init();
|
|
453
|
-
await service.
|
|
656
|
+
await service.writeFile({ filename: 'code-model-v4-createcommands-v2.yaml', content: (0, codegen_1.serialize)(await (await new Inferrer(state).init()).createCommands()), sourceMap: undefined, artifactType: 'code-model-v4' });
|
|
454
657
|
// return processCodeModel(async (state) => {
|
|
455
658
|
// return await (await new Inferrer(state).init()).createCommands();
|
|
456
659
|
// }, service, 'createCommands-v2');
|