@autorest/powershell 4.0.0-dev.8 → 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 +214 -206
- 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 +27 -2
- package/dist/cmdlets/class.d.ts.map +1 -1
- package/dist/cmdlets/class.js +913 -549
- 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 +3 -0
- package/dist/internal/powershell-declarations.d.ts.map +1 -1
- package/dist/internal/powershell-declarations.js +5 -2
- package/dist/internal/powershell-declarations.js.map +1 -1
- package/dist/internal/project.d.ts +14 -8
- package/dist/internal/project.d.ts.map +1 -1
- package/dist/internal/project.js +27 -20
- 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 +25 -11
- 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 +4 -12
- 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 +10 -5
- package/dist/llcsharp/project.d.ts.map +1 -1
- package/dist/llcsharp/project.js +15 -4
- 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 +5 -9
- 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 +17 -7
- package/dist/plugins/create-commands-v2.d.ts.map +1 -1
- package/dist/plugins/create-commands-v2.js +302 -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 +14 -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 +135 -88
- 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 +39 -10
- 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/resourceName.d.ts +3 -0
- package/dist/utils/resourceName.d.ts.map +1 -0
- package/dist/utils/resourceName.js +29 -0
- package/dist/utils/resourceName.js.map +1 -0
- 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 +3 -0
- package/dist/utils/sort-parameters.d.ts.map +1 -0
- package/dist/utils/sort-parameters.js +33 -0
- package/dist/utils/sort-parameters.js.map +1 -0
- 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 +31 -4
- package/resources/assets/check-dependencies.ps1 +3 -3
- package/resources/assets/create-model-cmdlets.ps1 +34 -5
- package/resources/assets/export-surface.ps1 +3 -3
- package/resources/assets/generate-help.ps1 +5 -5
- package/resources/assets/generate-portal-ux.ps1 +9 -25
- package/resources/assets/run-module.ps1 +4 -4
- package/resources/assets/test/loadEnv.ps1 +1 -1
- package/resources/assets/test-module.ps1 +11 -7
- 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/Attributes/PSArgumentCompleterAttribute.cs +52 -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 +53 -8
- package/resources/psruntime/BuildTime/Models/PsProxyTypes.cs +35 -11
- 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/ISendAsync.cs +113 -0
- 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,10 +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");
|
|
20
|
+
const resourceName_1 = require("../utils/resourceName");
|
|
21
|
+
const http_operation_1 = require("../utils/http-operation");
|
|
22
|
+
const specialWords = { in: ['sign'] };
|
|
19
23
|
// UNUSED: Moved to plugin-tweak-model.ts in remodeler
|
|
20
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.
|
|
21
25
|
function titleToAzureServiceName(title) {
|
|
22
|
-
const titleCamelCase = codegen_1.pascalCase(codegen_1.deconstruct(title)).trim();
|
|
26
|
+
const titleCamelCase = (0, codegen_1.pascalCase)((0, codegen_1.deconstruct)(title)).trim();
|
|
23
27
|
const serviceName = titleCamelCase
|
|
24
28
|
// Remove: !StartsWith(Management)AndContains(Management), Client, Azure, Microsoft, APIs, API, REST
|
|
25
29
|
.replace(/(?!^Management)(?=.*)Management|Client|Azure|Microsoft|APIs|API|REST/g, '')
|
|
@@ -34,8 +38,8 @@ pluralizationService.addWord('database', 'databases');
|
|
|
34
38
|
pluralizationService.addWord('Premise', 'Premises');
|
|
35
39
|
pluralizationService.addWord('premise', 'premises');
|
|
36
40
|
function fn(active, remaining, result) {
|
|
37
|
-
if (linq_1.length(active) || linq_1.length(remaining)) {
|
|
38
|
-
if (linq_1.length(remaining)) {
|
|
41
|
+
if ((0, linq_1.length)(active) || (0, linq_1.length)(remaining)) {
|
|
42
|
+
if ((0, linq_1.length)(remaining)) {
|
|
39
43
|
fn([...active, remaining[0]], remaining.slice(1), result);
|
|
40
44
|
fn(active, remaining.slice(1), result);
|
|
41
45
|
}
|
|
@@ -48,8 +52,25 @@ function fn(active, remaining, result) {
|
|
|
48
52
|
function combinations(elements) {
|
|
49
53
|
return fn([], elements, []);
|
|
50
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
|
+
}
|
|
51
72
|
function splitOnPreposition(preposition, parts) {
|
|
52
|
-
const i =
|
|
73
|
+
const i = filterSpecialWords(preposition, parts);
|
|
53
74
|
if (i > 0) {
|
|
54
75
|
return [
|
|
55
76
|
parts.slice(0, i),
|
|
@@ -83,6 +104,7 @@ class Inferrer {
|
|
|
83
104
|
// }
|
|
84
105
|
// for tracking unique operation identities
|
|
85
106
|
this.operationIdentities = new Set();
|
|
107
|
+
this.reservedPathParam = new Set(['SubscriptionId', 'resourceGroupName']);
|
|
86
108
|
}
|
|
87
109
|
async init() {
|
|
88
110
|
this.commonParameters = await this.state.getValue('azure', false) ? [
|
|
@@ -93,35 +115,115 @@ class Inferrer {
|
|
|
93
115
|
this.isAzure = await this.state.getValue('azure', false);
|
|
94
116
|
this.prefix = await this.state.getValue('prefix');
|
|
95
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
|
+
}
|
|
96
124
|
this.state.setValue('service-name', this.serviceName);
|
|
97
125
|
this.subjectPrefix = await this.state.getValue('subject-prefix');
|
|
98
126
|
this.state.setValue('isAzure', this.isAzure);
|
|
99
127
|
this.state.setValue('prefix', this.prefix);
|
|
100
128
|
const model = this.state.model;
|
|
101
129
|
this.state.message({
|
|
102
|
-
Channel:
|
|
130
|
+
Channel: extension_base_1.Channel.Debug, Text: `[CMDLET-PREFIX] => '${model.language.default.prefix}'`
|
|
103
131
|
});
|
|
104
132
|
model.language.default.serviceName = this.serviceName;
|
|
105
133
|
this.state.message({
|
|
106
|
-
Channel:
|
|
134
|
+
Channel: extension_base_1.Channel.Debug, Text: `[SERVICE-NAME] => '${model.language.default.serviceName}'`
|
|
107
135
|
});
|
|
108
136
|
model.language.default.subjectPrefix = this.subjectPrefix;
|
|
109
137
|
this.state.message({
|
|
110
|
-
Channel:
|
|
138
|
+
Channel: extension_base_1.Channel.Debug, Text: `[SUBJECT-PREFIX] => '${model.language.default.subjectPrefix}'`
|
|
111
139
|
});
|
|
112
140
|
return this;
|
|
113
141
|
}
|
|
114
142
|
async createCommands() {
|
|
143
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
115
144
|
const model = this.state.model;
|
|
116
145
|
this.state.model.commands = {
|
|
117
146
|
operations: new linq_1.Dictionary(),
|
|
118
147
|
parameters: new linq_1.Dictionary(),
|
|
119
148
|
};
|
|
120
|
-
this.state.
|
|
121
|
-
|
|
122
|
-
|
|
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
|
+
}
|
|
123
183
|
for (const variant of await this.inferCommandNames(operation, operationGroup.$key, this.state)) {
|
|
124
|
-
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);
|
|
125
227
|
}
|
|
126
228
|
}
|
|
127
229
|
}
|
|
@@ -133,37 +235,60 @@ class Inferrer {
|
|
|
133
235
|
// }
|
|
134
236
|
return model;
|
|
135
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
|
+
}
|
|
136
261
|
inferCommand(operation, group, suffix = []) {
|
|
137
262
|
operation = operation.filter(each => each !== 'all');
|
|
138
263
|
// no instant match
|
|
139
|
-
switch (linq_1.length(operation)) {
|
|
264
|
+
switch ((0, linq_1.length)(operation)) {
|
|
140
265
|
case 0:
|
|
141
266
|
throw new Error('Missing operation id?');
|
|
142
267
|
case 1:
|
|
143
268
|
// simple operation, just an id with a single value
|
|
144
269
|
// OPERATION => OPERATION-GROUP
|
|
145
270
|
return [
|
|
146
|
-
this.createCommandVariant(operation[0],
|
|
271
|
+
this.createCommandVariant(operation[0], [group], suffix, this.state.model)
|
|
147
272
|
];
|
|
148
273
|
case 2:
|
|
149
274
|
// should try to infer [SUBJECT] and [ACTION] from operation
|
|
150
275
|
if (verbs_1.verbs.has(operation[0])) {
|
|
151
276
|
// [ACTION][SUBJECT]
|
|
152
277
|
return [
|
|
153
|
-
this.createCommandVariant(operation[0], [
|
|
278
|
+
this.createCommandVariant(operation[0], [group, operation[1]], suffix, this.state.model)
|
|
154
279
|
];
|
|
155
280
|
}
|
|
156
281
|
if (verbs_1.verbs.has(operation[1])) {
|
|
157
282
|
// [SUBJECT][ACTION]
|
|
158
283
|
return [
|
|
159
|
-
this.createCommandVariant(operation[1], [
|
|
284
|
+
this.createCommandVariant(operation[1], [group, operation[0]], suffix, this.state.model)
|
|
160
285
|
];
|
|
161
286
|
}
|
|
162
287
|
// can't tell which is the [ACTION] -- let's return it the way we used to,
|
|
163
288
|
// but now let's mention that we are doing that.
|
|
164
289
|
this.state.warning(`Operation ${operation[0]}/${operation[1]} is inferred without finding action.`, [], {});
|
|
165
290
|
return [
|
|
166
|
-
this.createCommandVariant(operation[0], [
|
|
291
|
+
this.createCommandVariant(operation[0], [group, operation[1]], suffix, this.state.model)
|
|
167
292
|
];
|
|
168
293
|
}
|
|
169
294
|
// three or more words.
|
|
@@ -183,27 +308,27 @@ class Inferrer {
|
|
|
183
308
|
return [...this.inferCommand(parts[0], group, parts[1])];
|
|
184
309
|
}
|
|
185
310
|
// if not, then seek out a verb from there.
|
|
186
|
-
for (let i = 0; i < linq_1.length(operation); i++) {
|
|
311
|
+
for (let i = 0; i < (0, linq_1.length)(operation); i++) {
|
|
187
312
|
if (verbs_1.verbs.has(operation[i])) {
|
|
188
313
|
// if the action is first
|
|
189
314
|
if (i === 0) {
|
|
190
315
|
// everything else is the subject
|
|
191
|
-
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)];
|
|
192
317
|
}
|
|
193
|
-
if (i === linq_1.length(operation) - 1) {
|
|
318
|
+
if (i === (0, linq_1.length)(operation) - 1) {
|
|
194
319
|
// if it's last, the subject would be the first thing
|
|
195
|
-
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)];
|
|
196
321
|
}
|
|
197
322
|
// otherwise
|
|
198
323
|
// things before are part of the subject
|
|
199
324
|
// things after the verb should be part of the suffix
|
|
200
|
-
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)];
|
|
201
326
|
}
|
|
202
327
|
}
|
|
203
328
|
// so couldn't tell what the action was.
|
|
204
329
|
// fallback to the original behavior with a warning.
|
|
205
330
|
this.state.warning(`Operation ${operation[0]}/${operation[1]} is inferred without finding action.`, [], {});
|
|
206
|
-
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)];
|
|
207
332
|
}
|
|
208
333
|
async inferCommandNames(op, group, state) {
|
|
209
334
|
const method = op.language.default.name;
|
|
@@ -219,10 +344,10 @@ class Inferrer {
|
|
|
219
344
|
// }
|
|
220
345
|
// group = pascalCase(op.tags) || '';
|
|
221
346
|
// }
|
|
222
|
-
const groupWords = codegen_1.deconstruct(group);
|
|
347
|
+
const groupWords = [...(0, codegen_1.removeSequentialDuplicates)((0, codegen_1.deconstruct)(group))];
|
|
223
348
|
groupWords[groupWords.length - 1] = pluralizationService.singularize(groupWords.last);
|
|
224
|
-
group = codegen_1.pascalCase(groupWords);
|
|
225
|
-
const operation = codegen_1.deconstruct(method);
|
|
349
|
+
group = (0, codegen_1.pascalCase)(groupWords);
|
|
350
|
+
const operation = (0, codegen_1.deconstruct)(method);
|
|
226
351
|
// instant match
|
|
227
352
|
if (this.verbMap[method]) {
|
|
228
353
|
return [this.createCommandVariant(method, [group], [], state.model)];
|
|
@@ -230,16 +355,20 @@ class Inferrer {
|
|
|
230
355
|
// dig deeper.
|
|
231
356
|
return this.inferCommand(operation, group);
|
|
232
357
|
}
|
|
233
|
-
async addVariant(vname, body, bodyParameterName, parameters, operation, variant, state) {
|
|
234
|
-
|
|
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);
|
|
235
363
|
// if this has a body with it, let's add that parameter
|
|
236
364
|
if (body && body.schema) {
|
|
237
365
|
op.details.default.hasBody = true;
|
|
238
366
|
op.parameters.push(new components_1.IParameter(bodyParameterName, body.schema, {
|
|
367
|
+
required: body.required,
|
|
239
368
|
details: {
|
|
240
369
|
default: {
|
|
241
370
|
description: body.schema.language.default.description,
|
|
242
|
-
name: codegen_1.pascalCase(bodyParameterName),
|
|
371
|
+
name: (0, codegen_1.pascalCase)(bodyParameterName),
|
|
243
372
|
isBodyParameter: true,
|
|
244
373
|
}
|
|
245
374
|
}
|
|
@@ -247,24 +376,26 @@ class Inferrer {
|
|
|
247
376
|
// let's add a variant where it's expanded out.
|
|
248
377
|
// *IF* the body is an object or dictionary
|
|
249
378
|
if (body.schema.type === codemodel_1.SchemaType.Object || body.schema.type === codemodel_1.SchemaType.Dictionary || body.schema.type === codemodel_1.SchemaType.Any) {
|
|
250
|
-
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);
|
|
251
380
|
opExpanded.details.default.dropBodyParameter = true;
|
|
252
381
|
opExpanded.parameters.push(new components_1.IParameter(`${bodyParameterName}Body`, body.schema, {
|
|
382
|
+
required: body.required,
|
|
253
383
|
details: {
|
|
254
384
|
default: {
|
|
255
385
|
description: body.schema.language.default.description,
|
|
256
|
-
name: codegen_1.pascalCase(`${bodyParameterName}Body`),
|
|
386
|
+
name: (0, codegen_1.pascalCase)(`${bodyParameterName}Body`),
|
|
257
387
|
isBodyParameter: true,
|
|
258
388
|
}
|
|
259
389
|
}
|
|
260
390
|
}));
|
|
261
391
|
}
|
|
262
392
|
}
|
|
393
|
+
return op;
|
|
263
394
|
}
|
|
264
|
-
async addCommandOperation(vname, parameters, operation, variant, state) {
|
|
395
|
+
async addCommandOperation(vname, parameters, operation, variant, state, preOperations, commandType) {
|
|
265
396
|
// skip-for-time-being following code seems redundant -----
|
|
266
397
|
// let apiversion = '';
|
|
267
|
-
var _a, _b;
|
|
398
|
+
var _a, _b, _c;
|
|
268
399
|
// for (const each of items(operation.responses)) {
|
|
269
400
|
// for (const rsp of items(each)) {
|
|
270
401
|
// if (rsp.schema && rsp.schema.details && rsp.schema.details.default && rsp.schema.details.default.apiversion) {
|
|
@@ -276,12 +407,12 @@ class Inferrer {
|
|
|
276
407
|
// ----------------------------------------------------------
|
|
277
408
|
// if vname is > 64 characters, let's trim it
|
|
278
409
|
// after trimming it, make sure there aren't any other operation with a name that's exactly the same
|
|
279
|
-
if (linq_1.length(vname) > 64) {
|
|
280
|
-
const names = codegen_1.deconstruct(vname);
|
|
410
|
+
if ((0, linq_1.length)(vname) > 64) {
|
|
411
|
+
const names = (0, codegen_1.deconstruct)(vname);
|
|
281
412
|
let newVName = '';
|
|
282
|
-
for (let i = 0; i < linq_1.length(names); i++) {
|
|
283
|
-
newVName = codegen_1.pascalCase(names.slice(0, i));
|
|
284
|
-
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) {
|
|
285
416
|
break;
|
|
286
417
|
}
|
|
287
418
|
}
|
|
@@ -296,28 +427,39 @@ class Inferrer {
|
|
|
296
427
|
}
|
|
297
428
|
this.operationIdentities.add(fname);
|
|
298
429
|
variant.variant = vname;
|
|
299
|
-
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
|
+
}
|
|
300
440
|
// skip-for-time-being x-ms-metadata looks not supported any more.
|
|
301
441
|
//const xmsMetadata = operation.pathExtensions ? operation.pathExtensions['x-ms-metadata'] ? clone(operation.pathExtensions['x-ms-metadata']) : {} : {};
|
|
302
442
|
// Add operation type to support x-ms-mutability
|
|
303
443
|
let operationType = command_operation_2.OperationType.Other;
|
|
304
444
|
if (operation.requests) {
|
|
305
|
-
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
|
|
306
447
|
operationType = command_operation_2.OperationType.Create;
|
|
307
448
|
}
|
|
308
|
-
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
|
|
309
451
|
operationType = command_operation_2.OperationType.Update;
|
|
310
452
|
}
|
|
311
453
|
}
|
|
312
|
-
return state.model.commands.operations[`${linq_1.length(state.model.commands.operations)}`] = new command_operation_1.CommandOperation(
|
|
313
|
-
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,
|
|
314
456
|
operationType: operationType,
|
|
315
457
|
extensions: {},
|
|
316
458
|
...variant,
|
|
317
459
|
details: {
|
|
318
|
-
...
|
|
460
|
+
...language,
|
|
319
461
|
default: {
|
|
320
|
-
...
|
|
462
|
+
...language.default,
|
|
321
463
|
subject: variant.subject,
|
|
322
464
|
subjectPrefix: variant.subjectPrefix,
|
|
323
465
|
verb: variant.verb,
|
|
@@ -331,29 +473,29 @@ class Inferrer {
|
|
|
331
473
|
parameters: parameters.map(httpParameter => {
|
|
332
474
|
// make it's own copy of the parameter since after this,
|
|
333
475
|
// the parameter can be altered for each operation individually.
|
|
334
|
-
const each = linq_2.clone(httpParameter, false, undefined, undefined, ['schema', 'origin']);
|
|
476
|
+
const each = (0, linq_2.clone)(httpParameter, false, undefined, undefined, ['schema', 'origin']);
|
|
335
477
|
each.language.default = {
|
|
336
478
|
...each.language.default,
|
|
337
|
-
name: codegen_1.pascalCase(each.language.default.name),
|
|
479
|
+
name: (0, codegen_1.pascalCase)(each.language.default.name),
|
|
338
480
|
httpParameter
|
|
339
481
|
};
|
|
340
482
|
each.details = {};
|
|
341
483
|
each.details.default = {
|
|
342
484
|
...each.language.default,
|
|
343
|
-
name: codegen_1.pascalCase(each.language.default.name),
|
|
485
|
+
name: (0, codegen_1.pascalCase)(each.language.default.name),
|
|
344
486
|
httpParameter
|
|
345
487
|
};
|
|
346
488
|
each.name = each.language.default.serializedName;
|
|
347
489
|
return each;
|
|
348
490
|
}),
|
|
349
491
|
// skip-for-time-being, this callGraph is used in the header comments
|
|
350
|
-
callGraph:
|
|
351
|
-
});
|
|
492
|
+
callGraph: operations
|
|
493
|
+
}, commandType);
|
|
352
494
|
}
|
|
353
|
-
async addVariants(parameters, operation, variant, vname, state) {
|
|
354
|
-
var _a, _b, _c, _d;
|
|
495
|
+
async addVariants(parameters, operation, variant, vname, state, preOperations, commandType) {
|
|
496
|
+
var _a, _b, _c, _d, _e, _f;
|
|
355
497
|
// now synthesize parameter set variants multiplexed by the variants.
|
|
356
|
-
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);
|
|
357
499
|
const constantParameters = constants.map(each => `'${each.language.default.constantValue}'`);
|
|
358
500
|
// the body parameter
|
|
359
501
|
// xichen: How to handle if has multiple requests?
|
|
@@ -362,25 +504,119 @@ class Inferrer {
|
|
|
362
504
|
//const bodyParameterName = (operation.requestBody && operation.requestBody.extensions) ? operation.requestBody.extensions['x-ms-requestBody-name'] || 'bodyParameter' : '';
|
|
363
505
|
const bodyParameterName = body ? body.language.default.name : '';
|
|
364
506
|
// all the properties in the body parameter
|
|
365
|
-
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() : [];
|
|
366
508
|
// smash body property names together
|
|
367
509
|
const bodyPropertyNames = bodyProperties.joinWith(each => each.language.default.name);
|
|
368
510
|
// for each polymorphic body, we should do a separate variant that takes the polymorphic body type instead of the base type
|
|
369
511
|
// skip-for-time-being, this is for polymorphism
|
|
370
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) : '';
|
|
371
|
-
// wait! "update" should be "set" if it's a
|
|
513
|
+
// wait! "update" should be "set" if it's a PUT
|
|
372
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) {
|
|
373
515
|
variant.verb = 'Set';
|
|
374
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
|
+
}
|
|
375
521
|
// create variant
|
|
376
522
|
// skip-for-time-being, since operationId looks not included in m4.
|
|
377
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} ` : ''}` });
|
|
378
|
-
await this.addVariant(codegen_1.pascalCase([variant.action, vname]), body, bodyParameterName, [...constants, ...requiredParameters], operation, variant, state);
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
524
|
+
await this.addVariant((0, codegen_1.pascalCase)([variant.action, vname]), body, bodyParameterName, [...constants, ...requiredParameters], operation, variant, state, preOperations, commandType);
|
|
525
|
+
if (await state.getValue('disable-via-identity', false)) {
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
// eslint-disable-next-line prefer-const
|
|
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; });
|
|
530
|
+
//exclude subscriptionId and resourceGroupName from path parameters
|
|
531
|
+
pathParams = pathParams.filter(pathParam => !this.reservedPathParam.has(pathParam.language.default.name));
|
|
532
|
+
//if parent pipline input is disabled, only generate identity for current resource itself
|
|
533
|
+
if (!await state.getValue('enable-parent-pipeline-input', this.isAzure)) {
|
|
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);
|
|
536
|
+
}
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
const disableGetEnableList = await this.state.getValue('enable-parent-pipeline-input-for-list', false);
|
|
540
|
+
/*
|
|
541
|
+
for resource /A1/A2/.../An-1/An, generate variants that take
|
|
542
|
+
ViaIdentity: An as identity
|
|
543
|
+
ViaIdentity{An-1}: An-1 as identity + An Name
|
|
544
|
+
...
|
|
545
|
+
ViaIdentity{A1}: A1 as identity + [A2 + A3 + ... + An-1 + An] Names
|
|
546
|
+
*/
|
|
547
|
+
for (let i = pathParams.length - 1; i >= 0; i--) {
|
|
548
|
+
if ((!disableGetEnableList && variant.action.toLowerCase() === 'list') || (disableGetEnableList && i === pathParams.length - 1 && variant.action.toLowerCase() === 'get')) {
|
|
549
|
+
continue;
|
|
550
|
+
}
|
|
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);
|
|
552
|
+
//cannot get resource name from path, give up generate ViaIdentity variant
|
|
553
|
+
if (!resourceName) {
|
|
554
|
+
break;
|
|
555
|
+
}
|
|
556
|
+
//variant for current resource is simply named ViaIdentity otherwise ViaIdentity${resourceName}
|
|
557
|
+
if (i === pathParams.length - 1 && variant.action.toLowerCase() !== 'list') {
|
|
558
|
+
resourceName = '';
|
|
559
|
+
}
|
|
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;
|
|
384
620
|
}
|
|
385
621
|
}
|
|
386
622
|
createCommandVariant(action, subject, variant, model) {
|
|
@@ -394,15 +630,15 @@ class Inferrer {
|
|
|
394
630
|
}
|
|
395
631
|
return {
|
|
396
632
|
alias: [],
|
|
397
|
-
subject: codegen_1.pascalCase([...codegen_1.removeSequentialDuplicates(subject.map(each => pluralizationService.singularize(each)))]),
|
|
398
|
-
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),
|
|
399
635
|
verb,
|
|
400
636
|
subjectPrefix: model.language.default.subjectPrefix,
|
|
401
637
|
action
|
|
402
638
|
};
|
|
403
639
|
}
|
|
404
640
|
getPowerShellVerb(action) {
|
|
405
|
-
const verb = this.verbMap[codegen_1.pascalCase(action)];
|
|
641
|
+
const verb = this.verbMap[(0, codegen_1.pascalCase)(action)];
|
|
406
642
|
if (verb) {
|
|
407
643
|
return verb;
|
|
408
644
|
}
|
|
@@ -417,7 +653,7 @@ async function createCommandsV2(service) {
|
|
|
417
653
|
//const session = await startSession<PwshModel>(service, {}, codeModelSchema);
|
|
418
654
|
//const result = tweakModelV2(session);
|
|
419
655
|
const state = await new model_state_1.ModelState(service).init();
|
|
420
|
-
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' });
|
|
421
657
|
// return processCodeModel(async (state) => {
|
|
422
658
|
// return await (await new Inferrer(state).init()).createCommands();
|
|
423
659
|
// }, service, 'createCommands-v2');
|